mirror of
				https://github.com/libsdl-org/SDL.git
				synced 2025-10-26 12:27:44 +00:00 
			
		
		
		
	SDL_CloseJoystick() should return void, not int
This commit is contained in:
		| @@ -970,14 +970,12 @@ extern DECLSPEC int SDLCALL SDL_SendJoystickEffect(SDL_Joystick *joystick, const | |||||||
|  * Close a joystick previously opened with SDL_OpenJoystick(). |  * Close a joystick previously opened with SDL_OpenJoystick(). | ||||||
|  * |  * | ||||||
|  * \param joystick The joystick device to close |  * \param joystick The joystick device to close | ||||||
|  * \returns 0 on success or a negative error code on failure; call |  | ||||||
|  *          SDL_GetError() for more information. |  | ||||||
|  * |  * | ||||||
|  * \since This function is available since SDL 3.0.0. |  * \since This function is available since SDL 3.0.0. | ||||||
|  * |  * | ||||||
|  * \sa SDL_OpenJoystick |  * \sa SDL_OpenJoystick | ||||||
|  */ |  */ | ||||||
| extern DECLSPEC int SDLCALL SDL_CloseJoystick(SDL_Joystick *joystick); | extern DECLSPEC void SDLCALL SDL_CloseJoystick(SDL_Joystick *joystick); | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Get the battery level of a joystick as SDL_JoystickPowerLevel. |  * Get the battery level of a joystick as SDL_JoystickPowerLevel. | ||||||
|   | |||||||
| @@ -146,7 +146,7 @@ SDL_DYNAPI_PROC(void,SDL_ClearHints,(void),(),) | |||||||
| SDL_DYNAPI_PROC(int,SDL_ClearQueuedAudio,(SDL_AudioDeviceID a),(a),return) | SDL_DYNAPI_PROC(int,SDL_ClearQueuedAudio,(SDL_AudioDeviceID a),(a),return) | ||||||
| SDL_DYNAPI_PROC(void,SDL_CloseAudioDevice,(SDL_AudioDeviceID a),(a),) | SDL_DYNAPI_PROC(void,SDL_CloseAudioDevice,(SDL_AudioDeviceID a),(a),) | ||||||
| SDL_DYNAPI_PROC(void,SDL_CloseGamepad,(SDL_Gamepad *a),(a),) | SDL_DYNAPI_PROC(void,SDL_CloseGamepad,(SDL_Gamepad *a),(a),) | ||||||
| SDL_DYNAPI_PROC(int,SDL_CloseJoystick,(SDL_Joystick *a),(a),return) | SDL_DYNAPI_PROC(void,SDL_CloseJoystick,(SDL_Joystick *a),(a),) | ||||||
| SDL_DYNAPI_PROC(void,SDL_CloseSensor,(SDL_Sensor *a),(a),) | SDL_DYNAPI_PROC(void,SDL_CloseSensor,(SDL_Sensor *a),(a),) | ||||||
| SDL_DYNAPI_PROC(SDL_BlendMode,SDL_ComposeCustomBlendMode,(SDL_BlendFactor a, SDL_BlendFactor b, SDL_BlendOperation c, SDL_BlendFactor d, SDL_BlendFactor e, SDL_BlendOperation f),(a,b,c,d,e,f),return) | SDL_DYNAPI_PROC(SDL_BlendMode,SDL_ComposeCustomBlendMode,(SDL_BlendFactor a, SDL_BlendFactor b, SDL_BlendOperation c, SDL_BlendFactor d, SDL_BlendFactor e, SDL_BlendOperation f),(a,b,c,d,e,f),return) | ||||||
| SDL_DYNAPI_PROC(int,SDL_CondBroadcast,(SDL_cond *a),(a),return) | SDL_DYNAPI_PROC(int,SDL_CondBroadcast,(SDL_cond *a),(a),return) | ||||||
|   | |||||||
| @@ -1217,7 +1217,7 @@ int SDL_SendJoystickEffect(SDL_Joystick *joystick, const void *data, int size) | |||||||
| /* | /* | ||||||
|  * Close a joystick previously opened with SDL_OpenJoystick() |  * Close a joystick previously opened with SDL_OpenJoystick() | ||||||
|  */ |  */ | ||||||
| int SDL_CloseJoystick(SDL_Joystick *joystick) | void SDL_CloseJoystick(SDL_Joystick *joystick) | ||||||
| { | { | ||||||
|     SDL_Joystick *joysticklist; |     SDL_Joystick *joysticklist; | ||||||
|     SDL_Joystick *joysticklistprev; |     SDL_Joystick *joysticklistprev; | ||||||
| @@ -1225,12 +1225,12 @@ int SDL_CloseJoystick(SDL_Joystick *joystick) | |||||||
|  |  | ||||||
|     SDL_LockJoysticks(); |     SDL_LockJoysticks(); | ||||||
|     { |     { | ||||||
|         CHECK_JOYSTICK_MAGIC(joystick, -1); |         CHECK_JOYSTICK_MAGIC(joystick,); | ||||||
|  |  | ||||||
|         /* First decrement ref count */ |         /* First decrement ref count */ | ||||||
|         if (--joystick->ref_count > 0) { |         if (--joystick->ref_count > 0) { | ||||||
|             SDL_UnlockJoysticks(); |             SDL_UnlockJoysticks(); | ||||||
|             return 0; |             return; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (joystick->rumble_expiration) { |         if (joystick->rumble_expiration) { | ||||||
| @@ -1277,7 +1277,6 @@ int SDL_CloseJoystick(SDL_Joystick *joystick) | |||||||
|         SDL_free(joystick); |         SDL_free(joystick); | ||||||
|     } |     } | ||||||
|     SDL_UnlockJoysticks(); |     SDL_UnlockJoysticks(); | ||||||
|     return 0; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void SDL_QuitJoysticks(void) | void SDL_QuitJoysticks(void) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Sam Lantinga
					Sam Lantinga