author Philipp Wiesemann <>
Thu, 16 Apr 2015 22:04:35 +0200
changeset 9563 537881242756
parent 9507 b1e690e9c5b3
child 10890 a2ec89f77e6b
permissions -rw-r--r--
Fixed return value of SDL_SaveBMP_RW() depending on set errors after NULL input.

If SDL_SaveBMP_RW() was called with NULL passed as SDL_RWops argument, different
values were returned depending on SDL_GetError(). If no error was set before the
call (or SDL_ClearError() was called) then 0 was returned. This is wrong because
nothing was saved. If an error was set before the call then -1 was returned.

This was fixed by directly returning -1 for NULL input instead of deciding based
on SDL_GetError(). No new error is set because this would otherwise override a
maybe more useful error set in SDL_RWFromFile() which is used by SDL_SaveBMP().
     2                          Simple DirectMedia Layer
     4                                   (SDL)
     6                                 Version 2.0
     8 ---
    11 Simple DirectMedia Layer is a cross-platform development library designed
    12 to provide low level access to audio, keyboard, mouse, joystick, and graphics
    13 hardware via OpenGL and Direct3D. It is used by video playback software,
    14 emulators, and popular games including Valve's award winning catalog
    15 and many Humble Bundle games.
    17 More extensive documentation is available in the docs directory, starting
    18 with
    20 Enjoy!
    21 	Sam Lantinga				(