comparison src/joystick/macos/SDL_sysjoystick.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 c9b51268668f
children c71e05b4dc2e
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
135 /* convert pascal string to c-string */ 135 /* convert pascal string to c-string */
136 len = SYS_DevDef[index].deviceName[0]; 136 len = SYS_DevDef[index].deviceName[0];
137 if ( len >= sizeof(name) ) { 137 if ( len >= sizeof(name) ) {
138 len = (sizeof(name) - 1); 138 len = (sizeof(name) - 1);
139 } 139 }
140 memcpy(name, &SYS_DevDef[index].deviceName[1], len); 140 SDL_memcpy(name, &SYS_DevDef[index].deviceName[1], len);
141 name[len] = '\0'; 141 name[len] = '\0';
142 142
143 return name; 143 return name;
144 } 144 }
145 145
159 numAxis = numButtons = numHats = numBalls = 0; 159 numAxis = numButtons = numHats = numBalls = 0;
160 160
161 index = joystick->index; 161 index = joystick->index;
162 162
163 /* allocate memory for system specific hardware data */ 163 /* allocate memory for system specific hardware data */
164 joystick->hwdata = (struct joystick_hwdata *) malloc(sizeof(*joystick->hwdata)); 164 joystick->hwdata = (struct joystick_hwdata *) SDL_malloc(sizeof(*joystick->hwdata));
165 if (joystick->hwdata == NULL) 165 if (joystick->hwdata == NULL)
166 { 166 {
167 SDL_OutOfMemory(); 167 SDL_OutOfMemory();
168 return(-1); 168 return(-1);
169 } 169 }
170 memset(joystick->hwdata, 0, sizeof(*joystick->hwdata)); 170 SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata));
171 strcpy(joystick->hwdata->name, SDL_SYS_JoystickName(index)); 171 SDL_strcpy(joystick->hwdata->name, SDL_SYS_JoystickName(index));
172 joystick->name = joystick->hwdata->name; 172 joystick->name = joystick->hwdata->name;
173 173
174 ISpElementList_ExtractByKind( 174 ISpElementList_ExtractByKind(
175 SYS_Elements[index], 175 SYS_Elements[index],
176 kISpElementKind_Axis, 176 kISpElementKind_Axis,