Use new parameter validation macro

This commit is contained in:
Sam Lantinga
2025-09-16 21:51:03 -07:00
parent ee1c90a358
commit 25b2d2c821
60 changed files with 1113 additions and 1133 deletions
+2 -2
View File
@@ -148,7 +148,7 @@ static bool SDL_ValidMetadataProperty(const char *name)
bool SDL_SetAppMetadataProperty(const char *name, const char *value)
{
if (!SDL_ValidMetadataProperty(name)) {
CHECK_PARAM(!SDL_ValidMetadataProperty(name)) {
return SDL_InvalidParamError("name");
}
@@ -157,7 +157,7 @@ bool SDL_SetAppMetadataProperty(const char *name, const char *value)
const char *SDL_GetAppMetadataProperty(const char *name)
{
if (!SDL_ValidMetadataProperty(name)) {
CHECK_PARAM(!SDL_ValidMetadataProperty(name)) {
SDL_InvalidParamError("name");
return NULL;
}
+7 -6
View File
@@ -292,7 +292,7 @@ static bool maybe_resize(SDL_HashTable *ht)
bool SDL_InsertIntoHashTable(SDL_HashTable *table, const void *key, const void *value, bool replace)
{
if (!table) {
CHECK_PARAM(!table) {
return SDL_InvalidParamError("table");
}
@@ -338,7 +338,7 @@ bool SDL_InsertIntoHashTable(SDL_HashTable *table, const void *key, const void *
bool SDL_FindInHashTable(const SDL_HashTable *table, const void *key, const void **value)
{
if (!table) {
CHECK_PARAM(!table) {
if (value) {
*value = NULL;
}
@@ -364,7 +364,7 @@ bool SDL_FindInHashTable(const SDL_HashTable *table, const void *key, const void
bool SDL_RemoveFromHashTable(SDL_HashTable *table, const void *key)
{
if (!table) {
CHECK_PARAM(!table) {
return SDL_InvalidParamError("table");
}
@@ -384,9 +384,10 @@ bool SDL_RemoveFromHashTable(SDL_HashTable *table, const void *key)
bool SDL_IterateHashTable(const SDL_HashTable *table, SDL_HashTableIterateCallback callback, void *userdata)
{
if (!table) {
CHECK_PARAM(!table) {
return SDL_InvalidParamError("table");
} else if (!callback) {
}
CHECK_PARAM(!callback) {
return SDL_InvalidParamError("callback");
}
@@ -410,7 +411,7 @@ bool SDL_IterateHashTable(const SDL_HashTable *table, SDL_HashTableIterateCallba
bool SDL_HashTableEmpty(SDL_HashTable *table)
{
if (!table) {
CHECK_PARAM(!table) {
return SDL_InvalidParamError("table");
}
+5 -4
View File
@@ -104,7 +104,7 @@ static const char *GetHintEnvironmentVariable(const char *name)
bool SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPriority priority)
{
if (!name || !*name) {
CHECK_PARAM(!name || !*name) {
return SDL_InvalidParamError("name");
}
@@ -165,7 +165,7 @@ bool SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPriori
bool SDL_ResetHint(const char *name)
{
if (!name || !*name) {
CHECK_PARAM(!name || !*name) {
return SDL_InvalidParamError("name");
}
@@ -316,9 +316,10 @@ bool SDL_GetHintBoolean(const char *name, bool default_value)
bool SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata)
{
if (!name || !*name) {
CHECK_PARAM(!name || !*name) {
return SDL_InvalidParamError("name");
} else if (!callback) {
}
CHECK_PARAM(!callback) {
return SDL_InvalidParamError("callback");
}
+1 -1
View File
@@ -461,7 +461,7 @@ bool SDL_SetLogPriorityPrefix(SDL_LogPriority priority, const char *prefix)
{
char *prefix_copy;
if (priority <= SDL_LOG_PRIORITY_INVALID || priority >= SDL_LOG_PRIORITY_COUNT) {
CHECK_PARAM(priority <= SDL_LOG_PRIORITY_INVALID || priority >= SDL_LOG_PRIORITY_COUNT) {
return SDL_InvalidParamError("priority");
}
+12 -12
View File
@@ -250,10 +250,10 @@ static bool SDLCALL CopyOneProperty(void *userdata, const SDL_HashTable *table,
bool SDL_CopyProperties(SDL_PropertiesID src, SDL_PropertiesID dst)
{
if (!src) {
CHECK_PARAM(!src) {
return SDL_InvalidParamError("src");
}
if (!dst) {
CHECK_PARAM(!dst) {
return SDL_InvalidParamError("dst");
}
@@ -261,11 +261,11 @@ bool SDL_CopyProperties(SDL_PropertiesID src, SDL_PropertiesID dst)
SDL_Properties *dst_properties = NULL;
SDL_FindInHashTable(SDL_properties, (const void *)(uintptr_t)src, (const void **)&src_properties);
if (!src_properties) {
CHECK_PARAM(!src_properties) {
return SDL_InvalidParamError("src");
}
SDL_FindInHashTable(SDL_properties, (const void *)(uintptr_t)dst, (const void **)&dst_properties);
if (!dst_properties) {
CHECK_PARAM(!dst_properties) {
return SDL_InvalidParamError("dst");
}
@@ -287,12 +287,12 @@ bool SDL_LockProperties(SDL_PropertiesID props)
{
SDL_Properties *properties = NULL;
if (!props) {
CHECK_PARAM(!props) {
return SDL_InvalidParamError("props");
}
SDL_FindInHashTable(SDL_properties, (const void *)(uintptr_t)props, (const void **)&properties);
if (!properties) {
CHECK_PARAM(!properties) {
return SDL_InvalidParamError("props");
}
@@ -321,17 +321,17 @@ static bool SDL_PrivateSetProperty(SDL_PropertiesID props, const char *name, SDL
SDL_Properties *properties = NULL;
bool result = true;
if (!props) {
CHECK_PARAM(!props) {
SDL_FreePropertyWithCleanup(NULL, property, NULL, true);
return SDL_InvalidParamError("props");
}
if (!name || !*name) {
CHECK_PARAM(!name || !*name) {
SDL_FreePropertyWithCleanup(NULL, property, NULL, true);
return SDL_InvalidParamError("name");
}
SDL_FindInHashTable(SDL_properties, (const void *)(uintptr_t)props, (const void **)&properties);
if (!properties) {
CHECK_PARAM(!properties) {
SDL_FreePropertyWithCleanup(NULL, property, NULL, true);
return SDL_InvalidParamError("props");
}
@@ -755,15 +755,15 @@ bool SDL_EnumerateProperties(SDL_PropertiesID props, SDL_EnumeratePropertiesCall
{
SDL_Properties *properties = NULL;
if (!props) {
CHECK_PARAM(!props) {
return SDL_InvalidParamError("props");
}
if (!callback) {
CHECK_PARAM(!callback) {
return SDL_InvalidParamError("callback");
}
SDL_FindInHashTable(SDL_properties, (const void *)(uintptr_t)props, (const void **)&properties);
if (!properties) {
CHECK_PARAM(!properties) {
return SDL_InvalidParamError("props");
}
+14 -10
View File
@@ -136,11 +136,11 @@ int SDL_GetNumAudioDrivers(void)
const char *SDL_GetAudioDriver(int index)
{
if (index >= 0 && index < SDL_GetNumAudioDrivers()) {
return deduped_bootstrap[index]->name;
CHECK_PARAM(index < 0 || index >= SDL_GetNumAudioDrivers()) {
SDL_InvalidParamError("index");
return NULL;
}
SDL_InvalidParamError("index");
return NULL;
return deduped_bootstrap[index]->name;
}
const char *SDL_GetCurrentAudioDriver(void)
@@ -1576,7 +1576,7 @@ const char *SDL_GetAudioDeviceName(SDL_AudioDeviceID devid)
bool SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid, SDL_AudioSpec *spec, int *sample_frames)
{
if (!spec) {
CHECK_PARAM(!spec) {
return SDL_InvalidParamError("spec");
}
@@ -1937,7 +1937,7 @@ float SDL_GetAudioDeviceGain(SDL_AudioDeviceID devid)
bool SDL_SetAudioDeviceGain(SDL_AudioDeviceID devid, float gain)
{
if (gain < 0.0f) {
CHECK_PARAM(gain < 0.0f) {
return SDL_InvalidParamError("gain");
}
@@ -1986,11 +1986,15 @@ bool SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream * const *stre
if (num_streams == 0) {
return true; // nothing to do
} else if (num_streams < 0) {
}
CHECK_PARAM(num_streams < 0) {
return SDL_InvalidParamError("num_streams");
} else if (!streams) {
}
CHECK_PARAM(!streams) {
return SDL_InvalidParamError("streams");
} else if (SDL_IsAudioDevicePhysical(devid)) {
}
CHECK_PARAM(SDL_IsAudioDevicePhysical(devid)) {
return SDL_SetError("Audio streams are bound to device ids from SDL_OpenAudioDevice, not raw physical devices");
}
@@ -2150,7 +2154,7 @@ SDL_AudioDeviceID SDL_GetAudioStreamDevice(SDL_AudioStream *stream)
{
SDL_AudioDeviceID result = 0;
if (!stream) {
CHECK_PARAM(!stream) {
SDL_InvalidParamError("stream");
return 0;
}
+72 -43
View File
@@ -474,10 +474,11 @@ SDL_AudioStream *SDL_CreateAudioStream(const SDL_AudioSpec *src_spec, const SDL_
SDL_PropertiesID SDL_GetAudioStreamProperties(SDL_AudioStream *stream)
{
if (!stream) {
CHECK_PARAM(!stream) {
SDL_InvalidParamError("stream");
return 0;
}
SDL_LockMutex(stream->lock);
if (stream->props == 0) {
stream->props = SDL_CreateProperties();
@@ -488,9 +489,10 @@ SDL_PropertiesID SDL_GetAudioStreamProperties(SDL_AudioStream *stream)
bool SDL_SetAudioStreamGetCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata)
{
if (!stream) {
CHECK_PARAM(!stream) {
return SDL_InvalidParamError("stream");
}
SDL_LockMutex(stream->lock);
stream->get_callback = callback;
stream->get_callback_userdata = userdata;
@@ -500,9 +502,10 @@ bool SDL_SetAudioStreamGetCallback(SDL_AudioStream *stream, SDL_AudioStreamCallb
bool SDL_SetAudioStreamPutCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata)
{
if (!stream) {
CHECK_PARAM(!stream) {
return SDL_InvalidParamError("stream");
}
SDL_LockMutex(stream->lock);
stream->put_callback = callback;
stream->put_callback_userdata = userdata;
@@ -512,25 +515,27 @@ bool SDL_SetAudioStreamPutCallback(SDL_AudioStream *stream, SDL_AudioStreamCallb
bool SDL_LockAudioStream(SDL_AudioStream *stream)
{
if (!stream) {
CHECK_PARAM(!stream) {
return SDL_InvalidParamError("stream");
}
SDL_LockMutex(stream->lock);
return true;
}
bool SDL_UnlockAudioStream(SDL_AudioStream *stream)
{
if (!stream) {
CHECK_PARAM(!stream) {
return SDL_InvalidParamError("stream");
}
SDL_UnlockMutex(stream->lock);
return true;
}
bool SDL_GetAudioStreamFormat(SDL_AudioStream *stream, SDL_AudioSpec *src_spec, SDL_AudioSpec *dst_spec)
{
if (!stream) {
CHECK_PARAM(!stream) {
if (src_spec) {
SDL_zerop(src_spec);
}
@@ -560,7 +565,7 @@ bool SDL_GetAudioStreamFormat(SDL_AudioStream *stream, SDL_AudioSpec *src_spec,
bool SDL_SetAudioStreamFormat(SDL_AudioStream *stream, const SDL_AudioSpec *src_spec, const SDL_AudioSpec *dst_spec)
{
if (!stream) {
CHECK_PARAM(!stream) {
return SDL_InvalidParamError("stream");
}
@@ -569,21 +574,25 @@ bool SDL_SetAudioStreamFormat(SDL_AudioStream *stream, const SDL_AudioSpec *src_
// like 196608000Hz. File a bug. :P
if (src_spec) {
if (!SDL_IsSupportedAudioFormat(src_spec->format)) {
CHECK_PARAM(!SDL_IsSupportedAudioFormat(src_spec->format)) {
return SDL_InvalidParamError("src_spec->format");
} else if (!SDL_IsSupportedChannelCount(src_spec->channels)) {
}
CHECK_PARAM(!SDL_IsSupportedChannelCount(src_spec->channels)) {
return SDL_InvalidParamError("src_spec->channels");
} else if (src_spec->freq <= 0) {
}
CHECK_PARAM(src_spec->freq <= 0) {
return SDL_InvalidParamError("src_spec->freq");
}
}
if (dst_spec) {
if (!SDL_IsSupportedAudioFormat(dst_spec->format)) {
CHECK_PARAM(!SDL_IsSupportedAudioFormat(dst_spec->format)) {
return SDL_InvalidParamError("dst_spec->format");
} else if (!SDL_IsSupportedChannelCount(dst_spec->channels)) {
}
CHECK_PARAM(!SDL_IsSupportedChannelCount(dst_spec->channels)) {
return SDL_InvalidParamError("dst_spec->channels");
} else if (dst_spec->freq <= 0) {
}
CHECK_PARAM(dst_spec->freq <= 0) {
return SDL_InvalidParamError("dst_spec->freq");
}
}
@@ -622,7 +631,7 @@ bool SDL_SetAudioStreamFormat(SDL_AudioStream *stream, const SDL_AudioSpec *src_
bool SetAudioStreamChannelMap(SDL_AudioStream *stream, const SDL_AudioSpec *spec, int **stream_chmap, const int *chmap, int channels, int isinput)
{
if (!stream) {
CHECK_PARAM(!stream) {
return SDL_InvalidParamError("stream");
}
@@ -708,7 +717,7 @@ int *SDL_GetAudioStreamOutputChannelMap(SDL_AudioStream *stream, int *count)
float SDL_GetAudioStreamFrequencyRatio(SDL_AudioStream *stream)
{
if (!stream) {
CHECK_PARAM(!stream) {
SDL_InvalidParamError("stream");
return 0.0f;
}
@@ -722,7 +731,7 @@ float SDL_GetAudioStreamFrequencyRatio(SDL_AudioStream *stream)
bool SDL_SetAudioStreamFrequencyRatio(SDL_AudioStream *stream, float freq_ratio)
{
if (!stream) {
CHECK_PARAM(!stream) {
return SDL_InvalidParamError("stream");
}
@@ -745,7 +754,7 @@ bool SDL_SetAudioStreamFrequencyRatio(SDL_AudioStream *stream, float freq_ratio)
float SDL_GetAudioStreamGain(SDL_AudioStream *stream)
{
if (!stream) {
CHECK_PARAM(!stream) {
SDL_InvalidParamError("stream");
return -1.0f;
}
@@ -759,9 +768,10 @@ float SDL_GetAudioStreamGain(SDL_AudioStream *stream)
bool SDL_SetAudioStreamGain(SDL_AudioStream *stream, float gain)
{
if (!stream) {
CHECK_PARAM(!stream) {
return SDL_InvalidParamError("stream");
} else if (gain < 0.0f) {
}
CHECK_PARAM(gain < 0.0f) {
return SDL_InvalidParamError("gain");
}
@@ -847,13 +857,17 @@ static void SDLCALL FreeAllocatedAudioBuffer(void *userdata, const void *buf, in
bool SDL_PutAudioStreamData(SDL_AudioStream *stream, const void *buf, int len)
{
if (!stream) {
CHECK_PARAM(!stream) {
return SDL_InvalidParamError("stream");
} else if (!buf) {
}
CHECK_PARAM(!buf) {
return SDL_InvalidParamError("buf");
} else if (len < 0) {
}
CHECK_PARAM(len < 0) {
return SDL_InvalidParamError("len");
} else if (len == 0) {
}
if (len == 0) {
return true; // nothing to do.
}
@@ -965,13 +979,17 @@ static void InterleaveAudioChannels(void *output, const void * const *channel_bu
bool SDL_PutAudioStreamPlanarData(SDL_AudioStream *stream, const void * const *channel_buffers, int num_channels, int num_samples)
{
if (!stream) {
CHECK_PARAM(!stream) {
return SDL_InvalidParamError("stream");
} else if (!channel_buffers) {
}
CHECK_PARAM(!channel_buffers) {
return SDL_InvalidParamError("channel_buffers");
} else if (num_samples < 0) {
}
CHECK_PARAM(num_samples < 0) {
return SDL_InvalidParamError("num_samples");
} else if (num_samples == 0) {
}
if (num_samples == 0) {
return true; // nothing to do.
}
@@ -1039,13 +1057,17 @@ static void SDLCALL DontFreeThisAudioBuffer(void *userdata, const void *buf, int
bool SDL_PutAudioStreamDataNoCopy(SDL_AudioStream *stream, const void *buf, int len, SDL_AudioStreamDataCompleteCallback callback, void *userdata)
{
if (!stream) {
CHECK_PARAM(!stream) {
return SDL_InvalidParamError("stream");
} else if (!buf) {
}
CHECK_PARAM(!buf) {
return SDL_InvalidParamError("buf");
} else if (len < 0) {
}
CHECK_PARAM(len < 0) {
return SDL_InvalidParamError("len");
} else if (len == 0) {
}
if (len == 0) {
if (callback) {
callback(userdata, buf, len);
}
@@ -1057,7 +1079,7 @@ bool SDL_PutAudioStreamDataNoCopy(SDL_AudioStream *stream, const void *buf, int
bool SDL_FlushAudioStream(SDL_AudioStream *stream)
{
if (!stream) {
CHECK_PARAM(!stream) {
return SDL_InvalidParamError("stream");
}
@@ -1320,16 +1342,20 @@ int SDL_GetAudioStreamDataAdjustGain(SDL_AudioStream *stream, void *voidbuf, int
SDL_Log("AUDIOSTREAM: want to get %d converted bytes", len);
#endif
if (!stream) {
CHECK_PARAM(!stream) {
SDL_InvalidParamError("stream");
return -1;
} else if (!buf) {
}
CHECK_PARAM(!buf) {
SDL_InvalidParamError("buf");
return -1;
} else if (len < 0) {
}
CHECK_PARAM(len < 0) {
SDL_InvalidParamError("len");
return -1;
} else if (len == 0) {
}
if (len == 0) {
return 0; // nothing to do.
}
@@ -1427,7 +1453,7 @@ int SDL_GetAudioStreamData(SDL_AudioStream *stream, void *voidbuf, int len)
// number of converted/resampled bytes available for output
int SDL_GetAudioStreamAvailable(SDL_AudioStream *stream)
{
if (!stream) {
CHECK_PARAM(!stream) {
SDL_InvalidParamError("stream");
return -1;
}
@@ -1453,7 +1479,7 @@ int SDL_GetAudioStreamAvailable(SDL_AudioStream *stream)
// number of sample frames that are currently queued as input.
int SDL_GetAudioStreamQueued(SDL_AudioStream *stream)
{
if (!stream) {
CHECK_PARAM(!stream) {
SDL_InvalidParamError("stream");
return -1;
}
@@ -1470,7 +1496,7 @@ int SDL_GetAudioStreamQueued(SDL_AudioStream *stream)
bool SDL_ClearAudioStream(SDL_AudioStream *stream)
{
if (!stream) {
CHECK_PARAM(!stream) {
return SDL_InvalidParamError("stream");
}
@@ -1522,13 +1548,16 @@ bool SDL_ConvertAudioSamples(const SDL_AudioSpec *src_spec, const Uint8 *src_dat
*dst_len = 0;
}
if (!src_data) {
CHECK_PARAM(!src_data) {
return SDL_InvalidParamError("src_data");
} else if (src_len < 0) {
}
CHECK_PARAM(src_len < 0) {
return SDL_InvalidParamError("src_len");
} else if (!dst_data) {
}
CHECK_PARAM(!dst_data) {
return SDL_InvalidParamError("dst_data");
} else if (!dst_len) {
}
CHECK_PARAM(!dst_len) {
return SDL_InvalidParamError("dst_len");
}
+7 -4
View File
@@ -2092,16 +2092,19 @@ bool SDL_LoadWAV_IO(SDL_IOStream *src, bool closeio, SDL_AudioSpec *spec, Uint8
}
// Make sure we are passed a valid data source
if (!src) {
CHECK_PARAM(!src) {
SDL_InvalidParamError("src");
goto done;
} else if (!spec) {
}
CHECK_PARAM(!spec) {
SDL_InvalidParamError("spec");
goto done;
} else if (!audio_buf) {
}
CHECK_PARAM(!audio_buf) {
SDL_InvalidParamError("audio_buf");
goto done;
} else if (!audio_len) {
}
CHECK_PARAM(!audio_len) {
SDL_InvalidParamError("audio_len");
goto done;
}
+38 -31
View File
@@ -69,11 +69,11 @@ int SDL_GetNumCameraDrivers(void)
const char *SDL_GetCameraDriver(int index)
{
if (index >= 0 && index < SDL_GetNumCameraDrivers()) {
return bootstrap[index]->name;
CHECK_PARAM(index < 0 || index >= SDL_GetNumCameraDrivers()) {
SDL_InvalidParamError("index");
return NULL;
}
SDL_InvalidParamError("index");
return NULL;
return bootstrap[index]->name;
}
const char *SDL_GetCurrentCameraDriver(void)
@@ -657,9 +657,10 @@ bool SDL_GetCameraFormat(SDL_Camera *camera, SDL_CameraSpec *spec)
{
bool result;
if (!camera) {
CHECK_PARAM(!camera) {
return SDL_InvalidParamError("camera");
} else if (!spec) {
}
CHECK_PARAM(!spec) {
return SDL_InvalidParamError("spec");
}
@@ -1255,7 +1256,7 @@ SDL_Surface *SDL_AcquireCameraFrame(SDL_Camera *camera, Uint64 *timestampNS)
*timestampNS = 0;
}
if (!camera) {
CHECK_PARAM(!camera) {
SDL_InvalidParamError("camera");
return NULL;
}
@@ -1340,49 +1341,55 @@ void SDL_ReleaseCameraFrame(SDL_Camera *camera, SDL_Surface *frame)
SDL_CameraID SDL_GetCameraID(SDL_Camera *camera)
{
SDL_CameraID result = 0;
if (!camera) {
SDL_CameraID result;
CHECK_PARAM(!camera) {
SDL_InvalidParamError("camera");
} else {
SDL_Camera *device = camera; // currently there's no separation between physical and logical device.
ObtainPhysicalCameraObj(device);
result = device->instance_id;
ReleaseCamera(device);
return 0;
}
SDL_Camera *device = camera; // currently there's no separation between physical and logical device.
ObtainPhysicalCameraObj(device);
result = device->instance_id;
ReleaseCamera(device);
return result;
}
SDL_PropertiesID SDL_GetCameraProperties(SDL_Camera *camera)
{
SDL_PropertiesID result = 0;
if (!camera) {
SDL_PropertiesID result;
CHECK_PARAM(!camera) {
SDL_InvalidParamError("camera");
} else {
SDL_Camera *device = camera; // currently there's no separation between physical and logical device.
ObtainPhysicalCameraObj(device);
if (device->props == 0) {
device->props = SDL_CreateProperties();
}
result = device->props;
ReleaseCamera(device);
return 0;
}
SDL_Camera *device = camera; // currently there's no separation between physical and logical device.
ObtainPhysicalCameraObj(device);
if (device->props == 0) {
device->props = SDL_CreateProperties();
}
result = device->props;
ReleaseCamera(device);
return result;
}
SDL_CameraPermissionState SDL_GetCameraPermissionState(SDL_Camera *camera)
{
SDL_CameraPermissionState result;
if (!camera) {
CHECK_PARAM(!camera) {
SDL_InvalidParamError("camera");
result = SDL_CAMERA_PERMISSION_STATE_DENIED;
} else {
SDL_Camera *device = camera; // currently there's no separation between physical and logical device.
ObtainPhysicalCameraObj(device);
result = device->permission;
ReleaseCamera(device);
return SDL_CAMERA_PERMISSION_STATE_DENIED;
}
SDL_Camera *device = camera; // currently there's no separation between physical and logical device.
ObtainPhysicalCameraObj(device);
result = device->permission;
ReleaseCamera(device);
return result;
}
+1 -1
View File
@@ -2113,7 +2113,7 @@ void Android_JNI_HapticStop(int device_id)
bool SDL_SendAndroidMessage(Uint32 command, int param)
{
if (command < 0x8000) {
CHECK_PARAM(command < 0x8000) {
return SDL_InvalidParamError("command");
}
return Android_JNI_SendMessage(command, param);
+1 -1
View File
@@ -1131,7 +1131,7 @@ static int SDL_PeepEventsInternal(SDL_Event *events, int numevents, SDL_EventAct
return -1;
}
if (action == SDL_ADDEVENT) {
if (!events) {
CHECK_PARAM(!events) {
SDL_UnlockMutex(SDL_EventQ.lock);
return SDL_InvalidParamError("events");
}
+5 -4
View File
@@ -290,7 +290,7 @@ static const struct
static SDL_Keycode SDL_GetDefaultKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate)
{
if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_SCANCODE_COUNT) {
CHECK_PARAM(((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_SCANCODE_COUNT) {
SDL_InvalidParamError("scancode");
return SDLK_UNKNOWN;
}
@@ -1053,7 +1053,7 @@ static const char *SDL_extended_key_names[] = {
bool SDL_SetScancodeName(SDL_Scancode scancode, const char *name)
{
if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_SCANCODE_COUNT) {
CHECK_PARAM(((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_SCANCODE_COUNT) {
return SDL_InvalidParamError("scancode");
}
@@ -1064,7 +1064,8 @@ bool SDL_SetScancodeName(SDL_Scancode scancode, const char *name)
const char *SDL_GetScancodeName(SDL_Scancode scancode)
{
const char *name;
if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_SCANCODE_COUNT) {
CHECK_PARAM(((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_SCANCODE_COUNT) {
SDL_InvalidParamError("scancode");
return "";
}
@@ -1081,7 +1082,7 @@ SDL_Scancode SDL_GetScancodeFromName(const char *name)
{
int i;
if (!name || !*name) {
CHECK_PARAM(!name || !*name) {
SDL_InvalidParamError("name");
return SDL_SCANCODE_UNKNOWN;
}
+3 -3
View File
@@ -1558,7 +1558,7 @@ SDL_Cursor *SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y)
SDL_Surface *temp = NULL;
SDL_Cursor *cursor;
if (!surface) {
CHECK_PARAM(!surface) {
SDL_InvalidParamError("surface");
return NULL;
}
@@ -1569,8 +1569,8 @@ SDL_Cursor *SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y)
hot_y = (int)SDL_GetNumberProperty(props, SDL_PROP_SURFACE_HOTSPOT_Y_NUMBER, hot_y);
// Sanity check the hot spot
if ((hot_x < 0) || (hot_y < 0) ||
(hot_x >= surface->w) || (hot_y >= surface->h)) {
CHECK_PARAM((hot_x < 0) || (hot_y < 0) ||
(hot_x >= surface->w) || (hot_y >= surface->h)) {
SDL_SetError("Cursor hot spot doesn't lie within cursor");
return NULL;
}
+16 -13
View File
@@ -27,7 +27,7 @@
bool SDL_RemovePath(const char *path)
{
if (!path) {
CHECK_PARAM(!path) {
return SDL_InvalidParamError("path");
}
return SDL_SYS_RemovePath(path);
@@ -35,9 +35,10 @@ bool SDL_RemovePath(const char *path)
bool SDL_RenamePath(const char *oldpath, const char *newpath)
{
if (!oldpath) {
CHECK_PARAM(!oldpath) {
return SDL_InvalidParamError("oldpath");
} else if (!newpath) {
}
CHECK_PARAM(!newpath) {
return SDL_InvalidParamError("newpath");
}
return SDL_SYS_RenamePath(oldpath, newpath);
@@ -45,9 +46,10 @@ bool SDL_RenamePath(const char *oldpath, const char *newpath)
bool SDL_CopyFile(const char *oldpath, const char *newpath)
{
if (!oldpath) {
CHECK_PARAM(!oldpath) {
return SDL_InvalidParamError("oldpath");
} else if (!newpath) {
}
CHECK_PARAM(!newpath) {
return SDL_InvalidParamError("newpath");
}
return SDL_SYS_CopyFile(oldpath, newpath);
@@ -55,7 +57,7 @@ bool SDL_CopyFile(const char *oldpath, const char *newpath)
bool SDL_CreateDirectory(const char *path)
{
if (!path) {
CHECK_PARAM(!path) {
return SDL_InvalidParamError("path");
}
@@ -116,9 +118,10 @@ bool SDL_CreateDirectory(const char *path)
bool SDL_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata)
{
if (!path) {
CHECK_PARAM(!path) {
return SDL_InvalidParamError("path");
} else if (!callback) {
}
CHECK_PARAM(!callback) {
return SDL_InvalidParamError("callback");
}
return SDL_SYS_EnumerateDirectory(path, callback, userdata);
@@ -133,10 +136,9 @@ bool SDL_GetPathInfo(const char *path, SDL_PathInfo *info)
}
SDL_zerop(info);
if (!path) {
CHECK_PARAM(!path) {
return SDL_InvalidParamError("path");
}
return SDL_SYS_GetPathInfo(path, info);
}
@@ -364,7 +366,7 @@ char **SDL_InternalGlobDirectory(const char *path, const char *pattern, SDL_Glob
}
*count = 0;
if (!path) {
CHECK_PARAM(!path) {
SDL_InvalidParamError("path");
return NULL;
}
@@ -488,7 +490,8 @@ static char *CachedUserFolders[SDL_FOLDER_COUNT];
const char *SDL_GetUserFolder(SDL_Folder folder)
{
const int idx = (int) folder;
if ((idx < 0) || (idx >= SDL_arraysize(CachedUserFolders))) {
CHECK_PARAM((idx < 0) || (idx >= SDL_arraysize(CachedUserFolders))) {
SDL_InvalidParamError("folder");
return NULL;
}
@@ -502,7 +505,7 @@ const char *SDL_GetUserFolder(SDL_Folder folder)
char *SDL_GetPrefPath(const char *org, const char *app)
{
if (!app) {
CHECK_PARAM(!app) {
SDL_InvalidParamError("app");
return NULL;
}
+155 -135
View File
File diff suppressed because it is too large Load Diff
+19 -19
View File
@@ -107,10 +107,10 @@ static int SDL_Haptic_Get_Naxes(Uint16 vid, Uint16 pid)
static SDL_Haptic *SDL_haptics = NULL;
#define CHECK_HAPTIC_MAGIC(haptic, result) \
if (!SDL_ObjectValid(haptic, SDL_OBJECT_TYPE_HAPTIC)) { \
SDL_InvalidParamError("haptic"); \
return result; \
#define CHECK_HAPTIC_MAGIC(haptic, result) \
CHECK_PARAM(!SDL_ObjectValid(haptic, SDL_OBJECT_TYPE_HAPTIC)) { \
SDL_InvalidParamError("haptic"); \
return result; \
}
bool SDL_InitHaptics(void)
@@ -512,7 +512,7 @@ bool SDL_HapticEffectSupported(SDL_Haptic *haptic, const SDL_HapticEffect *effec
{
CHECK_HAPTIC_MAGIC(haptic, false);
if (!effect) {
CHECK_PARAM(!effect) {
return false;
}
@@ -528,7 +528,7 @@ SDL_HapticEffectID SDL_CreateHapticEffect(SDL_Haptic *haptic, const SDL_HapticEf
CHECK_HAPTIC_MAGIC(haptic, -1);
if (!effect) {
CHECK_PARAM(!effect) {
SDL_InvalidParamError("effect");
return -1;
}
@@ -577,25 +577,25 @@ bool SDL_UpdateHapticEffect(SDL_Haptic *haptic, SDL_HapticEffectID effect, const
{
CHECK_HAPTIC_MAGIC(haptic, false);
CHECK_PARAM(!ValidEffect(haptic, effect)) {
return false;
}
CHECK_PARAM(!data) {
return SDL_InvalidParamError("data");
}
// Can't change type dynamically.
CHECK_PARAM(data->type != haptic->effects[effect].effect.type) {
return SDL_SetError("Haptic: Updating effect type is illegal.");
}
#ifdef SDL_JOYSTICK_HIDAPI
if (SDL_HIDAPI_HapticIsHidapi(haptic)) {
return SDL_HIDAPI_HapticUpdateEffect(haptic, effect, data);
}
#endif
if (!ValidEffect(haptic, effect)) {
return false;
}
if (!data) {
return SDL_InvalidParamError("data");
}
// Can't change type dynamically.
if (data->type != haptic->effects[effect].effect.type) {
return SDL_SetError("Haptic: Updating effect type is illegal.");
}
// Updates the effect
if (!SDL_SYS_HapticUpdateEffect(haptic, &haptic->effects[effect], data)) {
return false;
+15 -10
View File
@@ -42,10 +42,11 @@ static const char *AsyncFileModeValid(const char *mode)
SDL_AsyncIO *SDL_AsyncIOFromFile(const char *file, const char *mode)
{
if (!file) {
CHECK_PARAM(!file) {
SDL_InvalidParamError("file");
return NULL;
} else if (!mode) {
}
CHECK_PARAM(!mode) {
SDL_InvalidParamError("mode");
return NULL;
}
@@ -78,7 +79,7 @@ SDL_AsyncIO *SDL_AsyncIOFromFile(const char *file, const char *mode)
Sint64 SDL_GetAsyncIOSize(SDL_AsyncIO *asyncio)
{
if (!asyncio) {
CHECK_PARAM(!asyncio) {
SDL_InvalidParamError("asyncio");
return -1;
}
@@ -87,11 +88,13 @@ Sint64 SDL_GetAsyncIOSize(SDL_AsyncIO *asyncio)
static bool RequestAsyncIO(bool reading, SDL_AsyncIO *asyncio, void *ptr, Uint64 offset, Uint64 size, SDL_AsyncIOQueue *queue, void *userdata)
{
if (!asyncio) {
CHECK_PARAM(!asyncio) {
return SDL_InvalidParamError("asyncio");
} else if (!ptr) {
}
CHECK_PARAM(!ptr) {
return SDL_InvalidParamError("ptr");
} else if (!queue) {
}
CHECK_PARAM(!queue) {
return SDL_InvalidParamError("queue");
}
@@ -143,9 +146,10 @@ bool SDL_WriteAsyncIO(SDL_AsyncIO *asyncio, void *ptr, Uint64 offset, Uint64 siz
bool SDL_CloseAsyncIO(SDL_AsyncIO *asyncio, bool flush, SDL_AsyncIOQueue *queue, void *userdata)
{
if (!asyncio) {
CHECK_PARAM(!asyncio) {
return SDL_InvalidParamError("asyncio");
} else if (!queue) {
}
CHECK_PARAM(!queue) {
return SDL_InvalidParamError("queue");
}
@@ -298,9 +302,10 @@ void SDL_QuitAsyncIO(void)
bool SDL_LoadFileAsync(const char *file, SDL_AsyncIOQueue *queue, void *userdata)
{
if (!file) {
CHECK_PARAM(!file) {
return SDL_InvalidParamError("file");
} else if (!queue) {
}
CHECK_PARAM(!queue) {
return SDL_InvalidParamError("queue");
}
+36 -23
View File
@@ -875,11 +875,11 @@ SDL_IOStream *SDL_IOFromFile(const char *file, const char *mode)
{
SDL_IOStream *iostr = NULL;
if (!file || !*file) {
CHECK_PARAM(!file || !*file) {
SDL_InvalidParamError("file");
return NULL;
}
if (!mode || !*mode) {
CHECK_PARAM(!mode || !*mode) {
SDL_InvalidParamError("mode");
return NULL;
}
@@ -991,10 +991,11 @@ SDL_IOStream *SDL_IOFromFile(const char *file, const char *mode)
SDL_IOStream *SDL_IOFromMem(void *mem, size_t size)
{
if (!mem) {
CHECK_PARAM(!mem) {
SDL_InvalidParamError("mem");
return NULL;
} else if (!size) {
}
CHECK_PARAM(!size) {
SDL_InvalidParamError("size");
return NULL;
}
@@ -1032,10 +1033,11 @@ SDL_IOStream *SDL_IOFromMem(void *mem, size_t size)
SDL_IOStream *SDL_IOFromConstMem(const void *mem, size_t size)
{
if (!mem) {
CHECK_PARAM(!mem) {
SDL_InvalidParamError("mem");
return NULL;
} else if (!size) {
}
CHECK_PARAM(!size) {
SDL_InvalidParamError("size");
return NULL;
}
@@ -1178,7 +1180,7 @@ SDL_IOStream *SDL_IOFromDynamicMem(void)
SDL_IOStatus SDL_GetIOStatus(SDL_IOStream *context)
{
if (!context) {
CHECK_PARAM(!context) {
SDL_InvalidParamError("context");
return SDL_IO_STATUS_ERROR;
}
@@ -1187,11 +1189,11 @@ SDL_IOStatus SDL_GetIOStatus(SDL_IOStream *context)
SDL_IOStream *SDL_OpenIO(const SDL_IOStreamInterface *iface, void *userdata)
{
if (!iface) {
CHECK_PARAM(!iface) {
SDL_InvalidParamError("iface");
return NULL;
}
if (iface->version < sizeof(*iface)) {
CHECK_PARAM(iface->version < sizeof(*iface)) {
// Update this to handle older versions of this interface
SDL_SetError("Invalid interface, should be initialized with SDL_INIT_INTERFACE()");
return NULL;
@@ -1227,7 +1229,7 @@ void *SDL_LoadFile_IO(SDL_IOStream *src, size_t *datasize, bool closeio)
char *data = NULL, *newdata;
bool loading_chunks = false;
if (!src) {
CHECK_PARAM(!src) {
SDL_InvalidParamError("src");
goto done;
}
@@ -1308,12 +1310,12 @@ bool SDL_SaveFile_IO(SDL_IOStream *src, const void *data, size_t datasize, bool
size_t size_total = 0;
bool success = true;
if (!src) {
CHECK_PARAM(!src) {
SDL_InvalidParamError("src");
goto done;
}
if (!data && datasize > 0) {
CHECK_PARAM(!data && datasize > 0) {
SDL_InvalidParamError("data");
goto done;
}
@@ -1356,7 +1358,7 @@ bool SDL_SaveFile(const char *file, const void *data, size_t datasize)
SDL_PropertiesID SDL_GetIOProperties(SDL_IOStream *context)
{
if (!context) {
CHECK_PARAM(!context) {
SDL_InvalidParamError("context");
return 0;
}
@@ -1369,9 +1371,10 @@ SDL_PropertiesID SDL_GetIOProperties(SDL_IOStream *context)
Sint64 SDL_GetIOSize(SDL_IOStream *context)
{
if (!context) {
CHECK_PARAM(!context) {
return SDL_InvalidParamError("context");
}
if (!context->iface.size) {
Sint64 pos, size;
@@ -1389,10 +1392,12 @@ Sint64 SDL_GetIOSize(SDL_IOStream *context)
Sint64 SDL_SeekIO(SDL_IOStream *context, Sint64 offset, SDL_IOWhence whence)
{
if (!context) {
CHECK_PARAM(!context) {
SDL_InvalidParamError("context");
return -1;
} else if (!context->iface.seek) {
}
if (!context->iface.seek) {
SDL_Unsupported();
return -1;
}
@@ -1406,14 +1411,18 @@ Sint64 SDL_TellIO(SDL_IOStream *context)
size_t SDL_ReadIO(SDL_IOStream *context, void *ptr, size_t size)
{
if (!context) {
CHECK_PARAM(!context) {
SDL_InvalidParamError("context");
return 0;
} else if (!context->iface.read) {
}
if (!context->iface.read) {
context->status = SDL_IO_STATUS_WRITEONLY;
SDL_Unsupported();
return 0;
} else if (size == 0) {
}
if (size == 0) {
return 0; // context->status doesn't change for this.
}
@@ -1425,14 +1434,18 @@ size_t SDL_ReadIO(SDL_IOStream *context, void *ptr, size_t size)
size_t SDL_WriteIO(SDL_IOStream *context, const void *ptr, size_t size)
{
if (!context) {
CHECK_PARAM(!context) {
SDL_InvalidParamError("context");
return 0;
} else if (!context->iface.write) {
}
if (!context->iface.write) {
context->status = SDL_IO_STATUS_READONLY;
SDL_Unsupported();
return 0;
} else if (size == 0) {
}
if (size == 0) {
return 0; // context->status doesn't change for this.
}
@@ -1481,7 +1494,7 @@ bool SDL_FlushIO(SDL_IOStream *context)
{
bool result = true;
if (!context) {
CHECK_PARAM(!context) {
return SDL_InvalidParamError("context");
}
+8 -8
View File
@@ -147,12 +147,12 @@ struct SDL_Gamepad
#undef _guarded
#define CHECK_GAMEPAD_MAGIC(gamepad, result) \
if (!SDL_ObjectValid(gamepad, SDL_OBJECT_TYPE_GAMEPAD) || \
!SDL_IsJoystickValid(gamepad->joystick)) { \
SDL_InvalidParamError("gamepad"); \
SDL_UnlockJoysticks(); \
return result; \
#define CHECK_GAMEPAD_MAGIC(gamepad, result) \
CHECK_PARAM(!SDL_ObjectValid(gamepad, SDL_OBJECT_TYPE_GAMEPAD) || \
!SDL_IsJoystickValid(gamepad->joystick)) { \
SDL_InvalidParamError("gamepad"); \
SDL_UnlockJoysticks(); \
return result; \
}
static SDL_vidpid_list SDL_allowed_gamepads = {
@@ -2455,7 +2455,7 @@ static int SDL_PrivateAddGamepadMapping(const char *mappingString, SDL_GamepadMa
SDL_AssertJoysticksLocked();
if (!mappingString) {
CHECK_PARAM(!mappingString) {
SDL_InvalidParamError("mappingString");
return -1;
}
@@ -2790,7 +2790,7 @@ bool SDL_SetGamepadMapping(SDL_JoystickID instance_id, const char *mapping)
SDL_GUID guid = SDL_GetJoystickGUIDForID(instance_id);
bool result = false;
if (SDL_memcmp(&guid, &s_zeroGUID, sizeof(guid)) == 0) {
CHECK_PARAM(SDL_memcmp(&guid, &s_zeroGUID, sizeof(guid)) == 0) {
return SDL_InvalidParamError("instance_id");
}
+10 -10
View File
@@ -615,18 +615,18 @@ static SDL_vidpid_list zero_centered_devices = {
false
};
#define CHECK_JOYSTICK_MAGIC(joystick, result) \
if (!SDL_ObjectValid(joystick, SDL_OBJECT_TYPE_JOYSTICK)) { \
SDL_InvalidParamError("joystick"); \
SDL_UnlockJoysticks(); \
return result; \
#define CHECK_JOYSTICK_MAGIC(joystick, result) \
CHECK_PARAM(!SDL_ObjectValid(joystick, SDL_OBJECT_TYPE_JOYSTICK)) { \
SDL_InvalidParamError("joystick"); \
SDL_UnlockJoysticks(); \
return result; \
}
#define CHECK_JOYSTICK_VIRTUAL(joystick, result) \
if (!joystick->is_virtual) { \
SDL_SetError("joystick isn't virtual"); \
SDL_UnlockJoysticks(); \
return result; \
#define CHECK_JOYSTICK_VIRTUAL(joystick, result) \
CHECK_PARAM(!joystick->is_virtual) { \
SDL_SetError("joystick isn't virtual"); \
SDL_UnlockJoysticks(); \
return result; \
}
bool SDL_JoysticksInitialized(void)
+2 -2
View File
@@ -138,11 +138,11 @@ SDL_JoystickID SDL_JoystickAttachVirtualInner(const SDL_VirtualJoystickDesc *des
SDL_AssertJoysticksLocked();
if (!desc) {
CHECK_PARAM(!desc) {
SDL_InvalidParamError("desc");
return 0;
}
if (desc->version < sizeof(*desc)) {
CHECK_PARAM(desc->version < sizeof(*desc)) {
// Update this to handle older versions of this interface
SDL_SetError("Invalid desc, should be initialized with SDL_INIT_INTERFACE()");
return 0;
+1 -1
View File
@@ -29,7 +29,7 @@
SDL_SharedObject *SDL_LoadObject(const char *sofile)
{
if (!sofile) {
CHECK_PARAM(!sofile) {
SDL_InvalidParamError("sofile");
return NULL;
}
+1 -1
View File
@@ -24,7 +24,7 @@
bool SDL_OpenURL(const char *url)
{
if (!url) {
CHECK_PARAM(!url) {
return SDL_InvalidParamError("url");
}
return SDL_SYS_OpenURL(url);
+9 -9
View File
@@ -25,7 +25,7 @@
SDL_Process *SDL_CreateProcess(const char * const *args, bool pipe_stdio)
{
if (!args || !args[0] || !args[0][0]) {
CHECK_PARAM(!args || !args[0] || !args[0][0]) {
SDL_InvalidParamError("args");
return NULL;
}
@@ -47,12 +47,12 @@ SDL_Process *SDL_CreateProcessWithProperties(SDL_PropertiesID props)
const char * const *args = SDL_GetPointerProperty(props, SDL_PROP_PROCESS_CREATE_ARGS_POINTER, NULL);
#if defined(SDL_PLATFORM_WINDOWS)
const char *cmdline = SDL_GetStringProperty(props, SDL_PROP_PROCESS_CREATE_CMDLINE_STRING, NULL);
if ((!args || !args[0] || !args[0][0]) && (!cmdline || !cmdline[0])) {
CHECK_PARAM((!args || !args[0] || !args[0][0]) && (!cmdline || !cmdline[0])) {
SDL_SetError("Either SDL_PROP_PROCESS_CREATE_ARGS_POINTER or SDL_PROP_PROCESS_CREATE_CMDLINE_STRING must be valid");
return NULL;
}
#else
if (!args || !args[0] || !args[0][0]) {
CHECK_PARAM(!args || !args[0] || !args[0][0]) {
SDL_InvalidParamError("SDL_PROP_PROCESS_CREATE_ARGS_POINTER");
return NULL;
}
@@ -81,7 +81,7 @@ SDL_Process *SDL_CreateProcessWithProperties(SDL_PropertiesID props)
SDL_PropertiesID SDL_GetProcessProperties(SDL_Process *process)
{
if (!process) {
CHECK_PARAM(!process) {
return SDL_InvalidParamError("process");
}
return process->props;
@@ -98,7 +98,7 @@ void *SDL_ReadProcess(SDL_Process *process, size_t *datasize, int *exitcode)
*exitcode = -1;
}
if (!process) {
CHECK_PARAM(!process) {
SDL_InvalidParamError("process");
return NULL;
}
@@ -118,7 +118,7 @@ void *SDL_ReadProcess(SDL_Process *process, size_t *datasize, int *exitcode)
SDL_IOStream *SDL_GetProcessInput(SDL_Process *process)
{
if (!process) {
CHECK_PARAM(!process) {
SDL_InvalidParamError("process");
return NULL;
}
@@ -134,7 +134,7 @@ SDL_IOStream *SDL_GetProcessInput(SDL_Process *process)
SDL_IOStream *SDL_GetProcessOutput(SDL_Process *process)
{
if (!process) {
CHECK_PARAM(!process) {
SDL_InvalidParamError("process");
return NULL;
}
@@ -150,7 +150,7 @@ SDL_IOStream *SDL_GetProcessOutput(SDL_Process *process)
bool SDL_KillProcess(SDL_Process *process, bool force)
{
if (!process) {
CHECK_PARAM(!process) {
return SDL_InvalidParamError("process");
}
@@ -163,7 +163,7 @@ bool SDL_KillProcess(SDL_Process *process, bool force)
bool SDL_WaitProcess(SDL_Process *process, bool block, int *exitcode)
{
if (!process) {
CHECK_PARAM(!process) {
return SDL_InvalidParamError("process");
}
+330 -495
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -238,7 +238,7 @@ bool SDL_BlendFillRect(SDL_Surface *dst, const SDL_Rect *rect, SDL_BlendMode ble
{
SDL_Rect clipped;
if (!SDL_SurfaceValid(dst)) {
CHECK_PARAM(!SDL_SurfaceValid(dst)) {
return SDL_InvalidParamError("SDL_BlendFillRect(): dst");
}
@@ -306,7 +306,7 @@ bool SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count, SDL_
bool (*func)(SDL_Surface * dst, const SDL_Rect *rect, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) = NULL;
bool result = true;
if (!SDL_SurfaceValid(dst)) {
CHECK_PARAM(!SDL_SurfaceValid(dst)) {
return SDL_InvalidParamError("SDL_BlendFillRects(): dst");
}
+1 -1
View File
@@ -923,7 +923,7 @@ bool SDL_BlendLine(SDL_Surface *dst, int x1, int y1, int x2, int y2, SDL_BlendMo
{
BlendLineFunc func;
if (!SDL_SurfaceValid(dst)) {
CHECK_PARAM(!SDL_SurfaceValid(dst)) {
return SDL_InvalidParamError("SDL_BlendLine(): dst");
}
+2 -2
View File
@@ -236,7 +236,7 @@ static bool SDL_BlendPoint_RGBA(SDL_Surface *dst, int x, int y, SDL_BlendMode bl
bool SDL_BlendPoint(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
if (!SDL_SurfaceValid(dst)) {
CHECK_PARAM(!SDL_SurfaceValid(dst)) {
return SDL_InvalidParamError("SDL_BlendPoint(): dst");
}
@@ -302,7 +302,7 @@ bool SDL_BlendPoints(SDL_Surface *dst, const SDL_Point *points, int count, SDL_B
bool (*func)(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) = NULL;
bool result = true;
if (!SDL_SurfaceValid(dst)) {
CHECK_PARAM(!SDL_SurfaceValid(dst)) {
return SDL_InvalidParamError("SDL_BlendPoints(): dst");
}
+2 -2
View File
@@ -137,7 +137,7 @@ bool SDL_DrawLine(SDL_Surface *dst, int x1, int y1, int x2, int y2, Uint32 color
{
DrawLineFunc func;
if (!SDL_SurfaceValid(dst)) {
CHECK_PARAM(!SDL_SurfaceValid(dst)) {
return SDL_InvalidParamError("SDL_DrawLine(): dst");
}
@@ -164,7 +164,7 @@ bool SDL_DrawLines(SDL_Surface *dst, const SDL_Point *points, int count, Uint32
bool draw_end;
DrawLineFunc func;
if (!SDL_SurfaceValid(dst)) {
CHECK_PARAM(!SDL_SurfaceValid(dst)) {
return SDL_InvalidParamError("SDL_DrawLines(): dst");
}
+2 -2
View File
@@ -27,7 +27,7 @@
bool SDL_DrawPoint(SDL_Surface *dst, int x, int y, Uint32 color)
{
if (!SDL_SurfaceValid(dst)) {
CHECK_PARAM(!SDL_SurfaceValid(dst)) {
return SDL_InvalidParamError("SDL_DrawPoint(): dst");
}
@@ -66,7 +66,7 @@ bool SDL_DrawPoints(SDL_Surface *dst, const SDL_Point *points, int count, Uint32
int i;
int x, y;
if (!SDL_SurfaceValid(dst)) {
CHECK_PARAM(!SDL_SurfaceValid(dst)) {
return SDL_InvalidParamError("SDL_DrawPoints(): dst");
}
+3 -3
View File
@@ -1121,12 +1121,12 @@ bool SW_CreateRendererForSurface(SDL_Renderer *renderer, SDL_Surface *surface, S
{
SW_RenderData *data;
if (!SDL_SurfaceValid(surface)) {
CHECK_PARAM(!SDL_SurfaceValid(surface)) {
return SDL_InvalidParamError("surface");
}
if (SDL_BITSPERPIXEL(surface->format) < 8 ||
SDL_BITSPERPIXEL(surface->format) > 32) {
CHECK_PARAM(SDL_BITSPERPIXEL(surface->format) < 8 ||
SDL_BITSPERPIXEL(surface->format) > 32) {
return SDL_SetError("Unsupported surface format");
}
+2 -2
View File
@@ -502,10 +502,10 @@ bool SDL_SW_BlitTriangle(
bool has_modulation;
if (!SDL_SurfaceValid(src)) {
CHECK_PARAM(!SDL_SurfaceValid(src)) {
return SDL_InvalidParamError("src");
}
if (!SDL_SurfaceValid(dst)) {
CHECK_PARAM(!SDL_SurfaceValid(dst)) {
return SDL_InvalidParamError("dst");
}
+5 -5
View File
@@ -57,11 +57,11 @@ static int SDL_sensors_locked;
static bool SDL_sensors_initialized;
static SDL_Sensor *SDL_sensors SDL_GUARDED_BY(SDL_sensor_lock) = NULL;
#define CHECK_SENSOR_MAGIC(sensor, result) \
if (!SDL_ObjectValid(sensor, SDL_OBJECT_TYPE_SENSOR)) { \
SDL_InvalidParamError("sensor"); \
SDL_UnlockSensors(); \
return result; \
#define CHECK_SENSOR_MAGIC(sensor, result) \
CHECK_PARAM(!SDL_ObjectValid(sensor, SDL_OBJECT_TYPE_SENSOR)) { \
SDL_InvalidParamError("sensor"); \
SDL_UnlockSensors(); \
return result; \
}
bool SDL_SensorsInitialized(void)
+9 -6
View File
@@ -222,7 +222,7 @@ char **SDL_GetEnvironmentVariables(SDL_Environment *env)
{
char **result = NULL;
if (!env) {
CHECK_PARAM(!env) {
SDL_InvalidParamError("env");
return NULL;
}
@@ -253,11 +253,13 @@ bool SDL_SetEnvironmentVariable(SDL_Environment *env, const char *name, const ch
{
bool result = false;
if (!env) {
CHECK_PARAM(!env) {
return SDL_InvalidParamError("env");
} else if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL) {
}
CHECK_PARAM(!name || *name == '\0' || SDL_strchr(name, '=') != NULL) {
return SDL_InvalidParamError("name");
} else if (!value) {
}
CHECK_PARAM(!value) {
return SDL_InvalidParamError("value");
}
@@ -292,9 +294,10 @@ bool SDL_UnsetEnvironmentVariable(SDL_Environment *env, const char *name)
{
bool result = false;
if (!env) {
CHECK_PARAM(!env) {
return SDL_InvalidParamError("env");
} else if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL) {
}
CHECK_PARAM(!name || *name == '\0' || SDL_strchr(name, '=') != NULL) {
return SDL_InvalidParamError("name");
}
+4 -4
View File
@@ -6419,16 +6419,16 @@ bool SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
SDL_realloc_func realloc_func,
SDL_free_func free_func)
{
if (!malloc_func) {
CHECK_PARAM(!malloc_func) {
return SDL_InvalidParamError("malloc_func");
}
if (!calloc_func) {
CHECK_PARAM(!calloc_func) {
return SDL_InvalidParamError("calloc_func");
}
if (!realloc_func) {
CHECK_PARAM(!realloc_func) {
return SDL_InvalidParamError("realloc_func");
}
if (!free_func) {
CHECK_PARAM(!free_func) {
return SDL_InvalidParamError("free_func");
}
+54 -29
View File
@@ -49,12 +49,12 @@ struct SDL_Storage
};
#define CHECK_STORAGE_MAGIC() \
if (!storage) { \
CHECK_PARAM(!storage) { \
return SDL_SetError("Invalid storage container"); \
}
#define CHECK_STORAGE_MAGIC_RET(result) \
if (!storage) { \
CHECK_PARAM(!storage) { \
SDL_SetError("Invalid storage container"); \
return result; \
}
@@ -183,11 +183,11 @@ SDL_Storage *SDL_OpenStorage(const SDL_StorageInterface *iface, void *userdata)
{
SDL_Storage *storage;
if (!iface) {
CHECK_PARAM(!iface) {
SDL_InvalidParamError("iface");
return NULL;
}
if (iface->version < sizeof(*iface)) {
CHECK_PARAM(iface->version < sizeof(*iface)) {
// Update this to handle older versions of this interface
SDL_SetError("Invalid interface, should be initialized with SDL_INIT_INTERFACE()");
return NULL;
@@ -245,11 +245,14 @@ bool SDL_ReadStorageFile(SDL_Storage *storage, const char *path, void *destinati
{
CHECK_STORAGE_MAGIC()
if (!path) {
CHECK_PARAM(!path) {
return SDL_InvalidParamError("path");
} else if (!ValidateStoragePath(path)) {
}
CHECK_PARAM(!ValidateStoragePath(path)) {
return false;
} else if (!storage->iface.read_file) {
}
if (!storage->iface.read_file) {
return SDL_Unsupported();
}
@@ -260,11 +263,14 @@ bool SDL_WriteStorageFile(SDL_Storage *storage, const char *path, const void *so
{
CHECK_STORAGE_MAGIC()
if (!path) {
CHECK_PARAM(!path) {
return SDL_InvalidParamError("path");
} else if (!ValidateStoragePath(path)) {
}
CHECK_PARAM(!ValidateStoragePath(path)) {
return false;
} else if (!storage->iface.write_file) {
}
if (!storage->iface.write_file) {
return SDL_Unsupported();
}
@@ -275,11 +281,14 @@ bool SDL_CreateStorageDirectory(SDL_Storage *storage, const char *path)
{
CHECK_STORAGE_MAGIC()
if (!path) {
CHECK_PARAM(!path) {
return SDL_InvalidParamError("path");
} else if (!ValidateStoragePath(path)) {
}
CHECK_PARAM(!ValidateStoragePath(path)) {
return false;
} else if (!storage->iface.mkdir) {
}
if (!storage->iface.mkdir) {
return SDL_Unsupported();
}
@@ -307,11 +316,14 @@ bool SDL_RemoveStoragePath(SDL_Storage *storage, const char *path)
{
CHECK_STORAGE_MAGIC()
if (!path) {
CHECK_PARAM(!path) {
return SDL_InvalidParamError("path");
} else if (!ValidateStoragePath(path)) {
}
CHECK_PARAM(!ValidateStoragePath(path)) {
return false;
} else if (!storage->iface.remove) {
}
if (!storage->iface.remove) {
return SDL_Unsupported();
}
@@ -322,15 +334,20 @@ bool SDL_RenameStoragePath(SDL_Storage *storage, const char *oldpath, const char
{
CHECK_STORAGE_MAGIC()
if (!oldpath) {
CHECK_PARAM(!oldpath) {
return SDL_InvalidParamError("oldpath");
} else if (!newpath) {
}
CHECK_PARAM(!newpath) {
return SDL_InvalidParamError("newpath");
} else if (!ValidateStoragePath(oldpath)) {
}
if (!ValidateStoragePath(oldpath)) {
return false;
} else if (!ValidateStoragePath(newpath)) {
}
if (!ValidateStoragePath(newpath)) {
return false;
} else if (!storage->iface.rename) {
}
if (!storage->iface.rename) {
return SDL_Unsupported();
}
@@ -341,15 +358,20 @@ bool SDL_CopyStorageFile(SDL_Storage *storage, const char *oldpath, const char *
{
CHECK_STORAGE_MAGIC()
if (!oldpath) {
CHECK_PARAM(!oldpath) {
return SDL_InvalidParamError("oldpath");
} else if (!newpath) {
}
CHECK_PARAM(!newpath) {
return SDL_InvalidParamError("newpath");
} else if (!ValidateStoragePath(oldpath)) {
}
if (!ValidateStoragePath(oldpath)) {
return false;
} else if (!ValidateStoragePath(newpath)) {
}
if (!ValidateStoragePath(newpath)) {
return false;
} else if (!storage->iface.copy) {
}
if (!storage->iface.copy) {
return SDL_Unsupported();
}
@@ -367,11 +389,14 @@ bool SDL_GetStoragePathInfo(SDL_Storage *storage, const char *path, SDL_PathInfo
CHECK_STORAGE_MAGIC()
if (!path) {
CHECK_PARAM(!path) {
return SDL_InvalidParamError("path");
} else if (!ValidateStoragePath(path)) {
}
CHECK_PARAM(!ValidateStoragePath(path)) {
return false;
} else if (!storage->iface.info) {
}
if (!storage->iface.info) {
return SDL_Unsupported();
}
+2 -2
View File
@@ -41,7 +41,7 @@ void *SDL_GetTLS(SDL_TLSID *id)
SDL_TLSData *storage;
int storage_index;
if (id == NULL) {
CHECK_PARAM(id == NULL) {
SDL_InvalidParamError("id");
return NULL;
}
@@ -59,7 +59,7 @@ bool SDL_SetTLS(SDL_TLSID *id, const void *value, SDL_TLSDestructorCallback dest
SDL_TLSData *storage;
int storage_index;
if (id == NULL) {
CHECK_PARAM(id == NULL) {
return SDL_InvalidParamError("id");
}
+3 -3
View File
@@ -168,13 +168,13 @@ bool SDL_DateTimeToTime(const SDL_DateTime *dt, SDL_Time *ticks)
static const Sint64 min_seconds = SDL_NS_TO_SECONDS(SDL_MIN_TIME) + 1;
bool result = true;
if (!dt) {
CHECK_PARAM(!dt) {
return SDL_InvalidParamError("dt");
}
if (!ticks) {
CHECK_PARAM(!ticks) {
return SDL_InvalidParamError("ticks");
}
if (!SDL_DateTimeIsValid(dt)) {
CHECK_PARAM(!SDL_DateTimeIsValid(dt)) {
// The validation function sets the error string.
return false;
}
+2 -2
View File
@@ -108,7 +108,7 @@ void SDL_GetSystemTimeLocalePreferences(SDL_DateFormat *df, SDL_TimeFormat *tf)
bool SDL_GetCurrentTime(SDL_Time *ticks)
{
if (!ticks) {
CHECK_PARAM(!ticks) {
return SDL_InvalidParamError("ticks");
}
@@ -123,7 +123,7 @@ bool SDL_GetCurrentTime(SDL_Time *ticks)
bool SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime *dt, bool localTime)
{
if (!dt) {
CHECK_PARAM(!dt) {
return SDL_InvalidParamError("dt");
}
+1 -1
View File
@@ -152,7 +152,7 @@ void SDL_GetSystemTimeLocalePreferences(SDL_DateFormat *df, SDL_TimeFormat *tf)
bool SDL_GetCurrentTime(SDL_Time *ticks)
{
if (!ticks) {
CHECK_PARAM(!ticks) {
return SDL_InvalidParamError("ticks");
}
+2 -2
View File
@@ -34,7 +34,7 @@ void SDL_GetSystemTimeLocalePreferences(SDL_DateFormat *df, SDL_TimeFormat *tf)
bool SDL_GetCurrentTime(SDL_Time *ticks)
{
if (!ticks) {
CHECK_PARAM(!ticks) {
return SDL_InvalidParamError("ticks");
}
@@ -45,7 +45,7 @@ bool SDL_GetCurrentTime(SDL_Time *ticks)
bool SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime *dt, bool localTime)
{
if (!dt) {
CHECK_PARAM(!dt) {
return SDL_InvalidParamError("dt");
}
+2 -2
View File
@@ -69,7 +69,7 @@ bool SDL_GetCurrentTime(SDL_Time *ticks)
{
u64 sceTicks;
if (!ticks) {
CHECK_PARAM(!ticks) {
return SDL_InvalidParamError("ticks");
}
@@ -99,7 +99,7 @@ bool SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime *dt, bool localTime)
u64 local;
int ret = 0;
if (!dt) {
CHECK_PARAM(!dt) {
return SDL_InvalidParamError("dt");
}
+2 -2
View File
@@ -101,7 +101,7 @@ found_date:
bool SDL_GetCurrentTime(SDL_Time *ticks)
{
if (!ticks) {
CHECK_PARAM(!ticks) {
return SDL_InvalidParamError("ticks");
}
#ifdef HAVE_CLOCK_GETTIME
@@ -158,7 +158,7 @@ bool SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime *dt, bool localTime)
#endif
struct tm *tm = NULL;
if (!dt) {
CHECK_PARAM(!dt) {
return SDL_InvalidParamError("dt");
}
+2 -2
View File
@@ -75,7 +75,7 @@ bool SDL_GetCurrentTime(SDL_Time *ticks)
{
SceRtcTick sceTicks;
if (!ticks) {
CHECK_PARAM(!ticks) {
return SDL_InvalidParamError("ticks");
}
@@ -104,7 +104,7 @@ bool SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime *dt, bool localTime)
SceRtcTick sceTicks, sceLocalTicks;
int ret = 0;
if (!dt) {
CHECK_PARAM(!dt) {
return SDL_InvalidParamError("dt");
}
+2 -2
View File
@@ -79,7 +79,7 @@ bool SDL_GetCurrentTime(SDL_Time *ticks)
{
FILETIME ft;
if (!ticks) {
CHECK_PARAM(!ticks) {
return SDL_InvalidParamError("ticks");
}
@@ -115,7 +115,7 @@ bool SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime *dt, bool localTime)
SYSTEMTIME *st = NULL;
Uint32 low, high;
if (!dt) {
CHECK_PARAM(!dt) {
return SDL_InvalidParamError("dt");
}
+4 -4
View File
@@ -301,7 +301,7 @@ static SDL_TimerID SDL_CreateTimer(Uint64 interval, SDL_TimerCallback callback_m
SDL_Timer *timer;
SDL_TimerMap *entry;
if (!callback_ms && !callback_ns) {
CHECK_PARAM(!callback_ms && !callback_ns) {
SDL_InvalidParamError("callback");
return 0;
}
@@ -374,7 +374,7 @@ bool SDL_RemoveTimer(SDL_TimerID id)
SDL_TimerMap *prev, *entry;
bool canceled = false;
if (!id) {
CHECK_PARAM(!id) {
return SDL_InvalidParamError("id");
}
@@ -467,7 +467,7 @@ static SDL_TimerID SDL_CreateTimer(Uint64 interval, SDL_TimerCallback callback_m
SDL_TimerData *data = &SDL_timer_data;
SDL_TimerMap *entry;
if (!callback_ms && !callback_ns) {
CHECK_PARAM(!callback_ms && !callback_ns) {
SDL_InvalidParamError("callback");
return 0;
}
@@ -507,7 +507,7 @@ bool SDL_RemoveTimer(SDL_TimerID id)
SDL_TimerData *data = &SDL_timer_data;
SDL_TimerMap *prev, *entry;
if (!id) {
CHECK_PARAM(!id) {
return SDL_InvalidParamError("id");
}
+11 -11
View File
@@ -203,7 +203,7 @@ void SDL_SetTrayTooltip(SDL_Tray *tray, const char *tooltip)
SDL_TrayMenu *SDL_CreateTrayMenu(SDL_Tray *tray)
{
if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) {
CHECK_PARAM(!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) {
SDL_InvalidParamError("tray");
return NULL;
}
@@ -230,7 +230,7 @@ SDL_TrayMenu *SDL_CreateTrayMenu(SDL_Tray *tray)
SDL_TrayMenu *SDL_GetTrayMenu(SDL_Tray *tray)
{
if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) {
CHECK_PARAM(!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) {
SDL_InvalidParamError("tray");
return NULL;
}
@@ -240,7 +240,7 @@ SDL_TrayMenu *SDL_GetTrayMenu(SDL_Tray *tray)
SDL_TrayMenu *SDL_CreateTraySubmenu(SDL_TrayEntry *entry)
{
if (!entry) {
CHECK_PARAM(!entry) {
SDL_InvalidParamError("entry");
return NULL;
}
@@ -277,7 +277,7 @@ SDL_TrayMenu *SDL_CreateTraySubmenu(SDL_TrayEntry *entry)
SDL_TrayMenu *SDL_GetTraySubmenu(SDL_TrayEntry *entry)
{
if (!entry) {
CHECK_PARAM(!entry) {
SDL_InvalidParamError("entry");
return NULL;
}
@@ -287,7 +287,7 @@ SDL_TrayMenu *SDL_GetTraySubmenu(SDL_TrayEntry *entry)
const SDL_TrayEntry **SDL_GetTrayEntries(SDL_TrayMenu *menu, int *count)
{
if (!menu) {
CHECK_PARAM(!menu) {
SDL_InvalidParamError("menu");
return NULL;
}
@@ -337,12 +337,12 @@ void SDL_RemoveTrayEntry(SDL_TrayEntry *entry)
SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *label, SDL_TrayEntryFlags flags)
{
if (!menu) {
CHECK_PARAM(!menu) {
SDL_InvalidParamError("menu");
return NULL;
}
if (pos < -1 || pos > menu->nEntries) {
CHECK_PARAM(pos < -1 || pos > menu->nEntries) {
SDL_InvalidParamError("pos");
return NULL;
}
@@ -405,7 +405,7 @@ void SDL_SetTrayEntryLabel(SDL_TrayEntry *entry, const char *label)
const char *SDL_GetTrayEntryLabel(SDL_TrayEntry *entry)
{
if (!entry) {
CHECK_PARAM(!entry) {
SDL_InvalidParamError("entry");
return NULL;
}
@@ -476,7 +476,7 @@ void SDL_ClickTrayEntry(SDL_TrayEntry *entry)
SDL_TrayMenu *SDL_GetTrayEntryParent(SDL_TrayEntry *entry)
{
if (!entry) {
CHECK_PARAM(!entry) {
SDL_InvalidParamError("entry");
return NULL;
}
@@ -486,7 +486,7 @@ SDL_TrayMenu *SDL_GetTrayEntryParent(SDL_TrayEntry *entry)
SDL_TrayEntry *SDL_GetTrayMenuParentEntry(SDL_TrayMenu *menu)
{
if (!menu) {
CHECK_PARAM(!menu) {
SDL_InvalidParamError("menu");
return NULL;
}
@@ -496,7 +496,7 @@ SDL_TrayEntry *SDL_GetTrayMenuParentEntry(SDL_TrayMenu *menu)
SDL_Tray *SDL_GetTrayMenuParentTray(SDL_TrayMenu *menu)
{
if (!menu) {
CHECK_PARAM(!menu) {
SDL_InvalidParamError("menu");
return NULL;
}
+10 -10
View File
@@ -359,7 +359,7 @@ void SDL_SetTrayTooltip(SDL_Tray *tray, const char *tooltip)
SDL_TrayMenu *SDL_CreateTrayMenu(SDL_Tray *tray)
{
if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) {
CHECK_PARAM(!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) {
SDL_InvalidParamError("tray");
return NULL;
}
@@ -388,7 +388,7 @@ SDL_TrayMenu *SDL_CreateTrayMenu(SDL_Tray *tray)
SDL_TrayMenu *SDL_GetTrayMenu(SDL_Tray *tray)
{
if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) {
CHECK_PARAM(!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) {
SDL_InvalidParamError("tray");
return NULL;
}
@@ -398,7 +398,7 @@ SDL_TrayMenu *SDL_GetTrayMenu(SDL_Tray *tray)
SDL_TrayMenu *SDL_CreateTraySubmenu(SDL_TrayEntry *entry)
{
if (!entry) {
CHECK_PARAM(!entry) {
SDL_InvalidParamError("entry");
return NULL;
}
@@ -439,7 +439,7 @@ SDL_TrayMenu *SDL_CreateTraySubmenu(SDL_TrayEntry *entry)
SDL_TrayMenu *SDL_GetTraySubmenu(SDL_TrayEntry *entry)
{
if (!entry) {
CHECK_PARAM(!entry) {
SDL_InvalidParamError("entry");
return NULL;
}
@@ -449,7 +449,7 @@ SDL_TrayMenu *SDL_GetTraySubmenu(SDL_TrayEntry *entry)
const SDL_TrayEntry **SDL_GetTrayEntries(SDL_TrayMenu *menu, int *count)
{
if (!menu) {
CHECK_PARAM(!menu) {
SDL_InvalidParamError("menu");
return NULL;
}
@@ -502,12 +502,12 @@ void SDL_RemoveTrayEntry(SDL_TrayEntry *entry)
SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *label, SDL_TrayEntryFlags flags)
{
if (!menu) {
CHECK_PARAM(!menu) {
SDL_InvalidParamError("menu");
return NULL;
}
if (pos < -1 || pos > menu->nEntries) {
CHECK_PARAM(pos < -1 || pos > menu->nEntries) {
SDL_InvalidParamError("pos");
return NULL;
}
@@ -600,7 +600,7 @@ void SDL_SetTrayEntryLabel(SDL_TrayEntry *entry, const char *label)
const char *SDL_GetTrayEntryLabel(SDL_TrayEntry *entry)
{
if (!entry) {
CHECK_PARAM(!entry) {
SDL_InvalidParamError("entry");
return NULL;
}
@@ -705,7 +705,7 @@ void SDL_ClickTrayEntry(SDL_TrayEntry *entry)
SDL_TrayMenu *SDL_GetTrayEntryParent(SDL_TrayEntry *entry)
{
if (!entry) {
CHECK_PARAM(!entry) {
SDL_InvalidParamError("entry");
return NULL;
}
@@ -720,7 +720,7 @@ SDL_TrayEntry *SDL_GetTrayMenuParentEntry(SDL_TrayMenu *menu)
SDL_Tray *SDL_GetTrayMenuParentTray(SDL_TrayMenu *menu)
{
if (!menu) {
CHECK_PARAM(!menu) {
SDL_InvalidParamError("menu");
return NULL;
}
+11 -11
View File
@@ -311,7 +311,7 @@ void SDL_SetTrayTooltip(SDL_Tray *tray, const char *tooltip)
SDL_TrayMenu *SDL_CreateTrayMenu(SDL_Tray *tray)
{
if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) {
CHECK_PARAM(!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) {
SDL_InvalidParamError("tray");
return NULL;
}
@@ -331,7 +331,7 @@ SDL_TrayMenu *SDL_CreateTrayMenu(SDL_Tray *tray)
SDL_TrayMenu *SDL_GetTrayMenu(SDL_Tray *tray)
{
if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) {
CHECK_PARAM(!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) {
SDL_InvalidParamError("tray");
return NULL;
}
@@ -341,7 +341,7 @@ SDL_TrayMenu *SDL_GetTrayMenu(SDL_Tray *tray)
SDL_TrayMenu *SDL_CreateTraySubmenu(SDL_TrayEntry *entry)
{
if (!entry) {
CHECK_PARAM(!entry) {
SDL_InvalidParamError("entry");
return NULL;
}
@@ -356,7 +356,7 @@ SDL_TrayMenu *SDL_CreateTraySubmenu(SDL_TrayEntry *entry)
SDL_TrayMenu *SDL_GetTraySubmenu(SDL_TrayEntry *entry)
{
if (!entry) {
CHECK_PARAM(!entry) {
SDL_InvalidParamError("entry");
return NULL;
}
@@ -366,7 +366,7 @@ SDL_TrayMenu *SDL_GetTraySubmenu(SDL_TrayEntry *entry)
const SDL_TrayEntry **SDL_GetTrayEntries(SDL_TrayMenu *menu, int *count)
{
if (!menu) {
CHECK_PARAM(!menu) {
SDL_InvalidParamError("menu");
return NULL;
}
@@ -419,12 +419,12 @@ void SDL_RemoveTrayEntry(SDL_TrayEntry *entry)
SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *label, SDL_TrayEntryFlags flags)
{
if (!menu) {
CHECK_PARAM(!menu) {
SDL_InvalidParamError("menu");
return NULL;
}
if (pos < -1 || pos > menu->nEntries) {
CHECK_PARAM(pos < -1 || pos > menu->nEntries) {
SDL_InvalidParamError("pos");
return NULL;
}
@@ -550,7 +550,7 @@ void SDL_SetTrayEntryLabel(SDL_TrayEntry *entry, const char *label)
const char *SDL_GetTrayEntryLabel(SDL_TrayEntry *entry)
{
if (!entry) {
CHECK_PARAM(!entry) {
SDL_InvalidParamError("entry");
return NULL;
}
@@ -633,7 +633,7 @@ void SDL_ClickTrayEntry(SDL_TrayEntry *entry)
SDL_TrayMenu *SDL_GetTrayEntryParent(SDL_TrayEntry *entry)
{
if (!entry) {
CHECK_PARAM(!entry) {
SDL_InvalidParamError("entry");
return NULL;
}
@@ -643,7 +643,7 @@ SDL_TrayMenu *SDL_GetTrayEntryParent(SDL_TrayEntry *entry)
SDL_TrayEntry *SDL_GetTrayMenuParentEntry(SDL_TrayMenu *menu)
{
if (!menu) {
CHECK_PARAM(!menu) {
SDL_InvalidParamError("menu");
return NULL;
}
@@ -653,7 +653,7 @@ SDL_TrayEntry *SDL_GetTrayMenuParentEntry(SDL_TrayMenu *menu)
SDL_Tray *SDL_GetTrayMenuParentTray(SDL_TrayMenu *menu)
{
if (!menu) {
CHECK_PARAM(!menu) {
SDL_InvalidParamError("menu");
return NULL;
}
+3 -3
View File
@@ -216,7 +216,7 @@ SDL_Surface *SDL_LoadBMP_IO(SDL_IOStream *src, bool closeio)
// Make sure we are passed a valid data source
surface = NULL;
if (!src) {
CHECK_PARAM(!src) {
SDL_InvalidParamError("src");
goto done;
}
@@ -630,11 +630,11 @@ bool SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, bool closeio)
Uint32 bV5Reserved = 0;
// Make sure we have somewhere to save
if (!SDL_SurfaceValid(surface)) {
CHECK_PARAM(!SDL_SurfaceValid(surface)) {
SDL_InvalidParamError("surface");
goto done;
}
if (!dst) {
CHECK_PARAM(!dst) {
SDL_InvalidParamError("dst");
goto done;
}

Some files were not shown because too many files have changed in this diff Show More