We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 944

Summary: Warning when using gcc -Wconversion in SDL_endian.h
Product: SDL Reporter: Tatu Kilappa <tatu.kilappa>
Component: *don't know*Assignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: trivial    
Priority: P2 CC: esigra
Version: HG 1.2   
Hardware: All   
OS: All   

Description Tatu Kilappa 2010-02-11 12:13:20 UTC
When compiling with -Wconversion, gcc complains about a cast in SDL_endian.h that might change the result as we are casting from an int into an Uint16. This is of course not visible unless we are on a non-x86 platform where the assembler is not available.

While it's not really an error, the warning is really annoying. To fix, change SDL_endian.h line 87 to:

  return(Uint16)((x<<8)|(x>>8));

Thank you.

--
-Tatu Kilappa <tatu.kilappa@gmail.com>
Comment 1 Sam Lantinga 2010-04-13 22:02:31 UTC
This is fixed, thanks!

changeset:   4432:77ebcd41b577
tag:         tip
parent:      4429:faa9fc8e7f67
user:        Sam Lantinga <slouken@libsdl.org>
date:        Tue Apr 13 22:01:14 2010 -0700
summary:     Fixed bug 944

changeset:   4431:d660ca4f7b1f
branch:      SDL-1.2
user:        Sam Lantinga <slouken@libsdl.org>
date:        Tue Apr 13 21:46:10 2010 -0700
summary:     Fixed bug 944
Comment 2 esigra 2010-04-17 03:53:57 UTC
If this header file is supposed to be includable from C++ code, the code should of course use one of the SDL_*_cast macros from SDL_stdinc.h.
Comment 3 Sam Lantinga 2010-04-23 02:14:43 UTC
Good point, thanks!

changeset:   4439:ab63fdcf66af
tag:         tip
parent:      4437:25e45611fa3d
user:        Sam Lantinga <slouken@libsdl.org>
date:        Fri Apr 23 02:15:05 2010 -0700
summary:     esigra      2010-04-17 03:53:57 PDT

changeset:   4438:7a53f8efc017
branch:      SDL-1.2
parent:      4431:d660ca4f7b1f
user:        Sam Lantinga <slouken@libsdl.org>
date:        Fri Apr 23 02:14:06 2010 -0700
summary:     esigra      2010-04-17 03:53:57 PDT