Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Readability: remove redundant cast to the same type
  • Loading branch information
1bsyl committed Oct 30, 2019
1 parent 56cbe12 commit b458d7a
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/audio/SDL_audiotypecvt.c
Expand Up @@ -614,7 +614,7 @@ static void SDLCALL
SDL_Convert_F32_to_U8_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
{
const float *src = (const float *) cvt->buf;
Uint8 *dst = (Uint8 *) cvt->buf;
Uint8 *dst = cvt->buf;
int i;

LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8 (using SSE2)");
Expand Down
4 changes: 2 additions & 2 deletions src/audio/alsa/SDL_alsa_audio.c
Expand Up @@ -349,7 +349,7 @@ static void
ALSA_PlayDevice(_THIS)
{
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;
snd_pcm_uframes_t frames_left = ((snd_pcm_uframes_t) this->spec.samples);

Expand Down Expand Up @@ -398,7 +398,7 @@ static int
ALSA_CaptureFromDevice(_THIS, void *buffer, int buflen)
{
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;
const int total_frames = buflen / frame_size;
snd_pcm_uframes_t frames_left = total_frames;
Expand Down
4 changes: 2 additions & 2 deletions src/events/SDL_keyboard.c
Expand Up @@ -878,7 +878,7 @@ SDL_GetKeyFromScancode(SDL_Scancode scancode)
{
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");
return 0;
}
Expand All @@ -905,7 +905,7 @@ const char *
SDL_GetScancodeName(SDL_Scancode scancode)
{
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");
return "";
}
Expand Down
2 changes: 1 addition & 1 deletion src/file/SDL_rwops.c
Expand Up @@ -478,7 +478,7 @@ mem_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum)

total_bytes = (maxnum * size);
if ((maxnum <= 0) || (size <= 0)
|| ((total_bytes / maxnum) != (size_t) size)) {
|| ((total_bytes / maxnum) != size)) {
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/filesystem/unix/SDL_sysfilesystem.c
Expand Up @@ -140,7 +140,7 @@ SDL_GetBasePath(void)
if (retval == NULL) {
/* older kernels don't have /proc/self ... try PID version... */
char path[64];
const int rc = (int) SDL_snprintf(path, sizeof(path),
const int rc = SDL_snprintf(path, sizeof(path),
"/proc/%llu/exe",
(unsigned long long) getpid());
if ( (rc > 0) && (rc < sizeof(path)) ) {
Expand Down
2 changes: 1 addition & 1 deletion src/stdlib/SDL_string.c
Expand Up @@ -818,7 +818,7 @@ int SDL_atoi(const char *string)
double SDL_atof(const char *string)
{
#ifdef HAVE_ATOF
return (double) atof(string);
return atof(string);
#else
return SDL_strtod(string, NULL);
#endif /* HAVE_ATOF */
Expand Down
4 changes: 2 additions & 2 deletions src/test/SDL_test_fuzzer.c
Expand Up @@ -307,7 +307,7 @@ SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool v
/* max value for Uint64 */
const Uint64 maxValue = UINT64_MAX;
return SDLTest_GenerateUnsignedBoundaryValues(maxValue,
(Uint64) boundary1, (Uint64) boundary2,
boundary1, boundary2,
validDomain);
}

Expand Down Expand Up @@ -457,7 +457,7 @@ SDLTest_RandomUnitFloat()
float
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
Expand Down
10 changes: 5 additions & 5 deletions src/test/SDL_test_harness.c
Expand Up @@ -434,7 +434,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
/* Count the total number of tests */
suiteCounter = 0;
while (testSuites[suiteCounter]) {
testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
testSuite = testSuites[suiteCounter];
suiteCounter++;
testCounter = 0;
while (testSuite->testCases[testCounter])
Expand All @@ -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 */
suiteCounter = 0;
while (testSuites[suiteCounter] && suiteFilter == 0) {
testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
testSuite = testSuites[suiteCounter];
suiteCounter++;
if (testSuite->name != NULL && SDL_strcmp(filter, testSuite->name) == 0) {
/* Matched a suite name */
Expand Down Expand Up @@ -496,8 +496,8 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
/* Loop over all suites */
suiteCounter = 0;
while(testSuites[suiteCounter]) {
testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
currentSuiteName = (char *)((testSuite->name) ? testSuite->name : SDLTEST_INVALID_NAME_FORMAT);
testSuite = testSuites[suiteCounter];
currentSuiteName = (testSuite->name ? testSuite->name : SDLTEST_INVALID_NAME_FORMAT);
suiteCounter++;

/* Filter suite if flag set and we have a name */
Expand Down Expand Up @@ -527,7 +527,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
while(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++;

/* Filter tests if flag set and we have a name */
Expand Down
2 changes: 1 addition & 1 deletion src/thread/pthread/SDL_systhread.c
Expand Up @@ -113,7 +113,7 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args)

/* Set caller-requested stack size. Otherwise: use the system default. */
if (thread->stacksize) {
pthread_attr_setstacksize(&type, (size_t) thread->stacksize);
pthread_attr_setstacksize(&type, thread->stacksize);
}

/* Create the thread and go! */
Expand Down
2 changes: 1 addition & 1 deletion src/video/SDL_blit_N.c
Expand Up @@ -1466,7 +1466,7 @@ Blit_RGB565_32(SDL_BlitInfo * info, const Uint32 * map)
/* Set up some basic variables */
width = info->dst_w;
height = info->dst_h;
src = (Uint8 *) info->src;
src = info->src;
srcskip = info->src_skip;
dst = (Uint32 *) info->dst;
dstskip = info->dst_skip / 4;
Expand Down
2 changes: 1 addition & 1 deletion src/video/SDL_blit_slow.c
Expand Up @@ -56,7 +56,7 @@ SDL_Blit_Slow(SDL_BlitInfo * info)

while (info->dst_h--) {
Uint8 *src = 0;
Uint8 *dst = (Uint8 *) info->dst;
Uint8 *dst = info->dst;
int n = info->dst_w;
srcx = -1;
posx = 0x10000L;
Expand Down
4 changes: 2 additions & 2 deletions src/video/SDL_shape.c
Expand Up @@ -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);
switch(shape->format->BytesPerPixel) {
case(1):
pixel_value = *(Uint8*)pixel;
pixel_value = *pixel;
break;
case(2):
pixel_value = *(Uint16*)pixel;
Expand Down Expand Up @@ -141,7 +141,7 @@ RecursivelyCalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* mask,SDL_Rec
pixel = (Uint8 *)(mask->pixels) + (y*mask->pitch) + (x*mask->format->BytesPerPixel);
switch(mask->format->BytesPerPixel) {
case(1):
pixel_value = *(Uint8*)pixel;
pixel_value = *pixel;
break;
case(2):
pixel_value = *(Uint16*)pixel;
Expand Down
2 changes: 1 addition & 1 deletion src/video/wayland/SDL_waylandvulkan.c
Expand Up @@ -153,7 +153,7 @@ SDL_bool Wayland_Vulkan_CreateSurface(_THIS,
(PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr;
PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR =
(PFN_vkCreateWaylandSurfaceKHR)vkGetInstanceProcAddr(
(VkInstance)instance,
instance,
"vkCreateWaylandSurfaceKHR");
VkWaylandSurfaceCreateInfoKHR createInfo;
VkResult result;
Expand Down
4 changes: 2 additions & 2 deletions src/video/x11/SDL_x11vulkan.c
Expand Up @@ -182,7 +182,7 @@ SDL_bool X11_Vulkan_CreateSurface(_THIS,
if(videoData->vulkan_xlib_xcb_library)
{
PFN_vkCreateXcbSurfaceKHR vkCreateXcbSurfaceKHR =
(PFN_vkCreateXcbSurfaceKHR)vkGetInstanceProcAddr((VkInstance)instance,
(PFN_vkCreateXcbSurfaceKHR)vkGetInstanceProcAddr(instance,
"vkCreateXcbSurfaceKHR");
VkXcbSurfaceCreateInfoKHR createInfo;
VkResult result;
Expand Down Expand Up @@ -213,7 +213,7 @@ SDL_bool X11_Vulkan_CreateSurface(_THIS,
else
{
PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR =
(PFN_vkCreateXlibSurfaceKHR)vkGetInstanceProcAddr((VkInstance)instance,
(PFN_vkCreateXlibSurfaceKHR)vkGetInstanceProcAddr(instance,
"vkCreateXlibSurfaceKHR");
VkXlibSurfaceCreateInfoKHR createInfo;
VkResult result;
Expand Down

0 comments on commit b458d7a

Please sign in to comment.