mirror of https://github.com/encounter/SDL.git
Readability: remove redundant cast to the same type
This commit is contained in:
parent
56cbe12037
commit
b458d7a28f
|
@ -614,7 +614,7 @@ static void SDLCALL
|
||||||
SDL_Convert_F32_to_U8_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
|
SDL_Convert_F32_to_U8_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
|
||||||
{
|
{
|
||||||
const float *src = (const float *) cvt->buf;
|
const float *src = (const float *) cvt->buf;
|
||||||
Uint8 *dst = (Uint8 *) cvt->buf;
|
Uint8 *dst = cvt->buf;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8 (using SSE2)");
|
LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8 (using SSE2)");
|
||||||
|
|
|
@ -349,7 +349,7 @@ static void
|
||||||
ALSA_PlayDevice(_THIS)
|
ALSA_PlayDevice(_THIS)
|
||||||
{
|
{
|
||||||
const Uint8 *sample_buf = (const Uint8 *) this->hidden->mixbuf;
|
const Uint8 *sample_buf = (const Uint8 *) this->hidden->mixbuf;
|
||||||
const int frame_size = (((int) SDL_AUDIO_BITSIZE(this->spec.format)) / 8) *
|
const int frame_size = ((SDL_AUDIO_BITSIZE(this->spec.format)) / 8) *
|
||||||
this->spec.channels;
|
this->spec.channels;
|
||||||
snd_pcm_uframes_t frames_left = ((snd_pcm_uframes_t) this->spec.samples);
|
snd_pcm_uframes_t frames_left = ((snd_pcm_uframes_t) this->spec.samples);
|
||||||
|
|
||||||
|
@ -398,7 +398,7 @@ static int
|
||||||
ALSA_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
ALSA_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
||||||
{
|
{
|
||||||
Uint8 *sample_buf = (Uint8 *) buffer;
|
Uint8 *sample_buf = (Uint8 *) buffer;
|
||||||
const int frame_size = (((int) SDL_AUDIO_BITSIZE(this->spec.format)) / 8) *
|
const int frame_size = ((SDL_AUDIO_BITSIZE(this->spec.format)) / 8) *
|
||||||
this->spec.channels;
|
this->spec.channels;
|
||||||
const int total_frames = buflen / frame_size;
|
const int total_frames = buflen / frame_size;
|
||||||
snd_pcm_uframes_t frames_left = total_frames;
|
snd_pcm_uframes_t frames_left = total_frames;
|
||||||
|
|
|
@ -878,7 +878,7 @@ SDL_GetKeyFromScancode(SDL_Scancode scancode)
|
||||||
{
|
{
|
||||||
SDL_Keyboard *keyboard = &SDL_keyboard;
|
SDL_Keyboard *keyboard = &SDL_keyboard;
|
||||||
|
|
||||||
if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) {
|
if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
|
||||||
SDL_InvalidParamError("scancode");
|
SDL_InvalidParamError("scancode");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -905,7 +905,7 @@ const char *
|
||||||
SDL_GetScancodeName(SDL_Scancode scancode)
|
SDL_GetScancodeName(SDL_Scancode scancode)
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) {
|
if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
|
||||||
SDL_InvalidParamError("scancode");
|
SDL_InvalidParamError("scancode");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -478,7 +478,7 @@ mem_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum)
|
||||||
|
|
||||||
total_bytes = (maxnum * size);
|
total_bytes = (maxnum * size);
|
||||||
if ((maxnum <= 0) || (size <= 0)
|
if ((maxnum <= 0) || (size <= 0)
|
||||||
|| ((total_bytes / maxnum) != (size_t) size)) {
|
|| ((total_bytes / maxnum) != size)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ SDL_GetBasePath(void)
|
||||||
if (retval == NULL) {
|
if (retval == NULL) {
|
||||||
/* older kernels don't have /proc/self ... try PID version... */
|
/* older kernels don't have /proc/self ... try PID version... */
|
||||||
char path[64];
|
char path[64];
|
||||||
const int rc = (int) SDL_snprintf(path, sizeof(path),
|
const int rc = SDL_snprintf(path, sizeof(path),
|
||||||
"/proc/%llu/exe",
|
"/proc/%llu/exe",
|
||||||
(unsigned long long) getpid());
|
(unsigned long long) getpid());
|
||||||
if ( (rc > 0) && (rc < sizeof(path)) ) {
|
if ( (rc > 0) && (rc < sizeof(path)) ) {
|
||||||
|
|
|
@ -818,7 +818,7 @@ int SDL_atoi(const char *string)
|
||||||
double SDL_atof(const char *string)
|
double SDL_atof(const char *string)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_ATOF
|
#ifdef HAVE_ATOF
|
||||||
return (double) atof(string);
|
return atof(string);
|
||||||
#else
|
#else
|
||||||
return SDL_strtod(string, NULL);
|
return SDL_strtod(string, NULL);
|
||||||
#endif /* HAVE_ATOF */
|
#endif /* HAVE_ATOF */
|
||||||
|
|
|
@ -307,7 +307,7 @@ SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool v
|
||||||
/* max value for Uint64 */
|
/* max value for Uint64 */
|
||||||
const Uint64 maxValue = UINT64_MAX;
|
const Uint64 maxValue = UINT64_MAX;
|
||||||
return SDLTest_GenerateUnsignedBoundaryValues(maxValue,
|
return SDLTest_GenerateUnsignedBoundaryValues(maxValue,
|
||||||
(Uint64) boundary1, (Uint64) boundary2,
|
boundary1, boundary2,
|
||||||
validDomain);
|
validDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,7 +457,7 @@ SDLTest_RandomUnitFloat()
|
||||||
float
|
float
|
||||||
SDLTest_RandomFloat()
|
SDLTest_RandomFloat()
|
||||||
{
|
{
|
||||||
return (float) (SDLTest_RandomUnitDouble() * (double)2.0 * (double)FLT_MAX - (double)(FLT_MAX));
|
return (float) (SDLTest_RandomUnitDouble() * 2.0 * (double)FLT_MAX - (double)(FLT_MAX));
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
|
|
|
@ -434,7 +434,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
|
||||||
/* Count the total number of tests */
|
/* Count the total number of tests */
|
||||||
suiteCounter = 0;
|
suiteCounter = 0;
|
||||||
while (testSuites[suiteCounter]) {
|
while (testSuites[suiteCounter]) {
|
||||||
testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
|
testSuite = testSuites[suiteCounter];
|
||||||
suiteCounter++;
|
suiteCounter++;
|
||||||
testCounter = 0;
|
testCounter = 0;
|
||||||
while (testSuite->testCases[testCounter])
|
while (testSuite->testCases[testCounter])
|
||||||
|
@ -457,7 +457,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
|
||||||
/* Loop over all suites to check if we have a filter match */
|
/* Loop over all suites to check if we have a filter match */
|
||||||
suiteCounter = 0;
|
suiteCounter = 0;
|
||||||
while (testSuites[suiteCounter] && suiteFilter == 0) {
|
while (testSuites[suiteCounter] && suiteFilter == 0) {
|
||||||
testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
|
testSuite = testSuites[suiteCounter];
|
||||||
suiteCounter++;
|
suiteCounter++;
|
||||||
if (testSuite->name != NULL && SDL_strcmp(filter, testSuite->name) == 0) {
|
if (testSuite->name != NULL && SDL_strcmp(filter, testSuite->name) == 0) {
|
||||||
/* Matched a suite name */
|
/* Matched a suite name */
|
||||||
|
@ -496,8 +496,8 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
|
||||||
/* Loop over all suites */
|
/* Loop over all suites */
|
||||||
suiteCounter = 0;
|
suiteCounter = 0;
|
||||||
while(testSuites[suiteCounter]) {
|
while(testSuites[suiteCounter]) {
|
||||||
testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
|
testSuite = testSuites[suiteCounter];
|
||||||
currentSuiteName = (char *)((testSuite->name) ? testSuite->name : SDLTEST_INVALID_NAME_FORMAT);
|
currentSuiteName = (testSuite->name ? testSuite->name : SDLTEST_INVALID_NAME_FORMAT);
|
||||||
suiteCounter++;
|
suiteCounter++;
|
||||||
|
|
||||||
/* Filter suite if flag set and we have a name */
|
/* Filter suite if flag set and we have a name */
|
||||||
|
@ -527,7 +527,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
|
||||||
while(testSuite->testCases[testCounter])
|
while(testSuite->testCases[testCounter])
|
||||||
{
|
{
|
||||||
testCase = testSuite->testCases[testCounter];
|
testCase = testSuite->testCases[testCounter];
|
||||||
currentTestName = (char *)((testCase->name) ? testCase->name : SDLTEST_INVALID_NAME_FORMAT);
|
currentTestName = (testCase->name ? testCase->name : SDLTEST_INVALID_NAME_FORMAT);
|
||||||
testCounter++;
|
testCounter++;
|
||||||
|
|
||||||
/* Filter tests if flag set and we have a name */
|
/* Filter tests if flag set and we have a name */
|
||||||
|
|
|
@ -113,7 +113,7 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
|
||||||
|
|
||||||
/* Set caller-requested stack size. Otherwise: use the system default. */
|
/* Set caller-requested stack size. Otherwise: use the system default. */
|
||||||
if (thread->stacksize) {
|
if (thread->stacksize) {
|
||||||
pthread_attr_setstacksize(&type, (size_t) thread->stacksize);
|
pthread_attr_setstacksize(&type, thread->stacksize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the thread and go! */
|
/* Create the thread and go! */
|
||||||
|
|
|
@ -1466,7 +1466,7 @@ Blit_RGB565_32(SDL_BlitInfo * info, const Uint32 * map)
|
||||||
/* Set up some basic variables */
|
/* Set up some basic variables */
|
||||||
width = info->dst_w;
|
width = info->dst_w;
|
||||||
height = info->dst_h;
|
height = info->dst_h;
|
||||||
src = (Uint8 *) info->src;
|
src = info->src;
|
||||||
srcskip = info->src_skip;
|
srcskip = info->src_skip;
|
||||||
dst = (Uint32 *) info->dst;
|
dst = (Uint32 *) info->dst;
|
||||||
dstskip = info->dst_skip / 4;
|
dstskip = info->dst_skip / 4;
|
||||||
|
|
|
@ -56,7 +56,7 @@ SDL_Blit_Slow(SDL_BlitInfo * info)
|
||||||
|
|
||||||
while (info->dst_h--) {
|
while (info->dst_h--) {
|
||||||
Uint8 *src = 0;
|
Uint8 *src = 0;
|
||||||
Uint8 *dst = (Uint8 *) info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int n = info->dst_w;
|
int n = info->dst_w;
|
||||||
srcx = -1;
|
srcx = -1;
|
||||||
posx = 0x10000L;
|
posx = 0x10000L;
|
||||||
|
|
|
@ -88,7 +88,7 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm
|
||||||
pixel = (Uint8 *)(shape->pixels) + (y*shape->pitch) + (x*shape->format->BytesPerPixel);
|
pixel = (Uint8 *)(shape->pixels) + (y*shape->pitch) + (x*shape->format->BytesPerPixel);
|
||||||
switch(shape->format->BytesPerPixel) {
|
switch(shape->format->BytesPerPixel) {
|
||||||
case(1):
|
case(1):
|
||||||
pixel_value = *(Uint8*)pixel;
|
pixel_value = *pixel;
|
||||||
break;
|
break;
|
||||||
case(2):
|
case(2):
|
||||||
pixel_value = *(Uint16*)pixel;
|
pixel_value = *(Uint16*)pixel;
|
||||||
|
@ -141,7 +141,7 @@ RecursivelyCalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* mask,SDL_Rec
|
||||||
pixel = (Uint8 *)(mask->pixels) + (y*mask->pitch) + (x*mask->format->BytesPerPixel);
|
pixel = (Uint8 *)(mask->pixels) + (y*mask->pitch) + (x*mask->format->BytesPerPixel);
|
||||||
switch(mask->format->BytesPerPixel) {
|
switch(mask->format->BytesPerPixel) {
|
||||||
case(1):
|
case(1):
|
||||||
pixel_value = *(Uint8*)pixel;
|
pixel_value = *pixel;
|
||||||
break;
|
break;
|
||||||
case(2):
|
case(2):
|
||||||
pixel_value = *(Uint16*)pixel;
|
pixel_value = *(Uint16*)pixel;
|
||||||
|
|
|
@ -153,7 +153,7 @@ SDL_bool Wayland_Vulkan_CreateSurface(_THIS,
|
||||||
(PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr;
|
(PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr;
|
||||||
PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR =
|
PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR =
|
||||||
(PFN_vkCreateWaylandSurfaceKHR)vkGetInstanceProcAddr(
|
(PFN_vkCreateWaylandSurfaceKHR)vkGetInstanceProcAddr(
|
||||||
(VkInstance)instance,
|
instance,
|
||||||
"vkCreateWaylandSurfaceKHR");
|
"vkCreateWaylandSurfaceKHR");
|
||||||
VkWaylandSurfaceCreateInfoKHR createInfo;
|
VkWaylandSurfaceCreateInfoKHR createInfo;
|
||||||
VkResult result;
|
VkResult result;
|
||||||
|
|
|
@ -182,7 +182,7 @@ SDL_bool X11_Vulkan_CreateSurface(_THIS,
|
||||||
if(videoData->vulkan_xlib_xcb_library)
|
if(videoData->vulkan_xlib_xcb_library)
|
||||||
{
|
{
|
||||||
PFN_vkCreateXcbSurfaceKHR vkCreateXcbSurfaceKHR =
|
PFN_vkCreateXcbSurfaceKHR vkCreateXcbSurfaceKHR =
|
||||||
(PFN_vkCreateXcbSurfaceKHR)vkGetInstanceProcAddr((VkInstance)instance,
|
(PFN_vkCreateXcbSurfaceKHR)vkGetInstanceProcAddr(instance,
|
||||||
"vkCreateXcbSurfaceKHR");
|
"vkCreateXcbSurfaceKHR");
|
||||||
VkXcbSurfaceCreateInfoKHR createInfo;
|
VkXcbSurfaceCreateInfoKHR createInfo;
|
||||||
VkResult result;
|
VkResult result;
|
||||||
|
@ -213,7 +213,7 @@ SDL_bool X11_Vulkan_CreateSurface(_THIS,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR =
|
PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR =
|
||||||
(PFN_vkCreateXlibSurfaceKHR)vkGetInstanceProcAddr((VkInstance)instance,
|
(PFN_vkCreateXlibSurfaceKHR)vkGetInstanceProcAddr(instance,
|
||||||
"vkCreateXlibSurfaceKHR");
|
"vkCreateXlibSurfaceKHR");
|
||||||
VkXlibSurfaceCreateInfoKHR createInfo;
|
VkXlibSurfaceCreateInfoKHR createInfo;
|
||||||
VkResult result;
|
VkResult result;
|
||||||
|
|
Loading…
Reference in New Issue