diff src/joystick/win32/SDL_mmjoystick.c @ 1336:3692456e7b0f

Use SDL_ prefixed versions of C library functions. FIXME: Change #include <stdlib.h> to #include "SDL_stdlib.h" Change #include <string.h> to #include "SDL_string.h" Make sure nothing else broke because of this...
author Sam Lantinga <slouken@libsdl.org>
date Tue, 07 Feb 2006 06:59:48 +0000
parents 450721ad5436
children 604d73db6802
line wrap: on
line diff
--- a/src/joystick/win32/SDL_mmjoystick.c	Mon Feb 06 17:28:04 2006 +0000
+++ b/src/joystick/win32/SDL_mmjoystick.c	Tue Feb 07 06:59:48 2006 +0000
@@ -82,7 +82,7 @@
 	unsigned char regvalue[256];
 	unsigned char regname[256];
 
-	snprintf((char *) regkey, SDL_arraysize(regkey), "%s\\%s\\%s",
+	SDL_snprintf((char *) regkey, SDL_arraysize(regkey), "%s\\%s\\%s",
 		REGSTR_PATH_JOYCONFIG,
 		szRegKey,
 		REGSTR_KEY_JOYCURR);
@@ -95,7 +95,7 @@
 			joystick's properties
 		*/
 		regsize = sizeof(regname);
-		snprintf((char *) regvalue, SDL_arraysize(regvalue),
+		SDL_snprintf((char *) regvalue, SDL_arraysize(regvalue),
 			"Joystick%d%s", index+1,
 			REGSTR_VAL_JOYOEMNAME);
 		regresult = RegQueryValueExA(hKey,
@@ -105,7 +105,7 @@
 		if (regresult == ERROR_SUCCESS)
 		{
 			/* open that registry key */
-			snprintf((char *) regkey, SDL_arraysize(regkey), "%s\\%s",
+			SDL_snprintf((char *) regkey, SDL_arraysize(regkey), "%s\\%s",
 				REGSTR_PATH_JOYOEM, regname);
 			regresult = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
 				(char *) regkey, 0, KEY_READ, &hKey);
@@ -124,7 +124,7 @@
 						allocate enough memory
 						for the OEM name text ...
 					*/
-					name = (char *) malloc(regsize);
+					name = (char *) SDL_malloc(regsize);
 					/* ... and read it from the registry */
 					regresult =
 						RegQueryValueExA(hKey,
@@ -227,13 +227,13 @@
 	axis_max[5] = SYS_Joystick[index].wVmax;
 
 	/* allocate memory for system specific hardware data */
-	joystick->hwdata = (struct joystick_hwdata *) malloc(sizeof(*joystick->hwdata));
+	joystick->hwdata = (struct joystick_hwdata *) SDL_malloc(sizeof(*joystick->hwdata));
 	if (joystick->hwdata == NULL)
 	{
 		SDL_OutOfMemory();
 		return(-1);
 	}
-	memset(joystick->hwdata, 0, sizeof(*joystick->hwdata));
+	SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata));
 
 	/* set hardware data */
 	joystick->hwdata->id = SYS_JoystickID[index];
@@ -359,7 +359,7 @@
 {
 	if (joystick->hwdata != NULL) {
 		/* free system specific hardware data */
-		free(joystick->hwdata);
+		SDL_free(joystick->hwdata);
 	}
 }
 
@@ -369,7 +369,7 @@
 	int i;
 	for (i = 0; i < MAX_JOYSTICKS; i++) {
 		if ( SYS_JoystickName[i] != NULL ) {
-			free(SYS_JoystickName[i]);
+			SDL_free(SYS_JoystickName[i]);
 		}
 	}
 }
@@ -406,14 +406,14 @@
 		break;
 
 		default:
-			snprintf(errbuf, SDL_arraysize(errbuf),
+			SDL_snprintf(errbuf, SDL_arraysize(errbuf),
 			         "%s: Unknown Multimedia system error: 0x%x",
 								function, code);
 		break;
 	}
 
 	if ( ! errbuf[0] ) {
-		snprintf(errbuf, SDL_arraysize(errbuf), "%s: %s", function, error);
+		SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: %s", function, error);
 	}
 	SDL_SetError("%s", errbuf);
 }