comparison src/video/bwindow/SDL_sysvideo.cc @ 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 604d73db6802
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
80 return(1); 80 return(1);
81 } 81 }
82 82
83 static void BE_DeleteDevice(SDL_VideoDevice *device) 83 static void BE_DeleteDevice(SDL_VideoDevice *device)
84 { 84 {
85 free(device->hidden); 85 SDL_free(device->hidden);
86 free(device); 86 SDL_free(device);
87 } 87 }
88 88
89 static SDL_VideoDevice *BE_CreateDevice(int devindex) 89 static SDL_VideoDevice *BE_CreateDevice(int devindex)
90 { 90 {
91 SDL_VideoDevice *device; 91 SDL_VideoDevice *device;
92 92
93 /* Initialize all variables that we clean on shutdown */ 93 /* Initialize all variables that we clean on shutdown */
94 device = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice)); 94 device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
95 if ( device ) { 95 if ( device ) {
96 memset(device, 0, (sizeof *device)); 96 SDL_memset(device, 0, (sizeof *device));
97 device->hidden = (struct SDL_PrivateVideoData *) 97 device->hidden = (struct SDL_PrivateVideoData *)
98 malloc((sizeof *device->hidden)); 98 SDL_malloc((sizeof *device->hidden));
99 } 99 }
100 if ( (device == NULL) || (device->hidden == NULL) ) { 100 if ( (device == NULL) || (device->hidden == NULL) ) {
101 SDL_OutOfMemory(); 101 SDL_OutOfMemory();
102 if ( device ) { 102 if ( device ) {
103 free(device); 103 SDL_free(device);
104 } 104 }
105 return(0); 105 return(0);
106 } 106 }
107 memset(device->hidden, 0, (sizeof *device->hidden)); 107 SDL_memset(device->hidden, 0, (sizeof *device->hidden));
108 108
109 /* Set the function pointers */ 109 /* Set the function pointers */
110 /* Initialization/Query functions */ 110 /* Initialization/Query functions */
111 device->VideoInit = BE_VideoInit; 111 device->VideoInit = BE_VideoInit;
112 device->ListModes = BE_ListModes; 112 device->ListModes = BE_ListModes;
231 } 231 }
232 } 232 }
233 } 233 }
234 234
235 /* Set up the new video mode rectangle */ 235 /* Set up the new video mode rectangle */
236 mode = (SDL_Rect *)malloc(sizeof *mode); 236 mode = (SDL_Rect *)SDL_malloc(sizeof *mode);
237 if ( mode == NULL ) { 237 if ( mode == NULL ) {
238 SDL_OutOfMemory(); 238 SDL_OutOfMemory();
239 return(-1); 239 return(-1);
240 } 240 }
241 mode->x = 0; 241 mode->x = 0;
247 #endif 247 #endif
248 248
249 /* Allocate the new list of modes, and fill in the new mode */ 249 /* Allocate the new list of modes, and fill in the new mode */
250 next_mode = SDL_nummodes[index]; 250 next_mode = SDL_nummodes[index];
251 SDL_modelist[index] = (SDL_Rect **) 251 SDL_modelist[index] = (SDL_Rect **)
252 realloc(SDL_modelist[index], (1+next_mode+1)*sizeof(SDL_Rect *)); 252 SDL_realloc(SDL_modelist[index], (1+next_mode+1)*sizeof(SDL_Rect *));
253 if ( SDL_modelist[index] == NULL ) { 253 if ( SDL_modelist[index] == NULL ) {
254 SDL_OutOfMemory(); 254 SDL_OutOfMemory();
255 SDL_nummodes[index] = 0; 255 SDL_nummodes[index] = 0;
256 free(mode); 256 SDL_free(mode);
257 return(-1); 257 return(-1);
258 } 258 }
259 SDL_modelist[index][next_mode] = mode; 259 SDL_modelist[index][next_mode] = mode;
260 SDL_modelist[index][next_mode+1] = NULL; 260 SDL_modelist[index][next_mode+1] = NULL;
261 SDL_nummodes[index]++; 261 SDL_nummodes[index]++;
640 while (get_next_image_info(0,&cookie,&info) == B_OK) { 640 while (get_next_image_info(0,&cookie,&info) == B_OK) {
641 void *location = NULL; 641 void *location = NULL;
642 if (get_image_symbol((image_id)cookie,"glBegin",B_SYMBOL_TYPE_ANY,&location) == B_OK) { 642 if (get_image_symbol((image_id)cookie,"glBegin",B_SYMBOL_TYPE_ANY,&location) == B_OK) {
643 _this->gl_config.dll_handle = (void*)cookie; 643 _this->gl_config.dll_handle = (void*)cookie;
644 _this->gl_config.driver_loaded = 1; 644 _this->gl_config.driver_loaded = 1;
645 strncpy(_this->gl_config.driver_path, "libGL.so", sizeof(_this->gl_config.driver_path)-1); 645 SDL_strncpy(_this->gl_config.driver_path, "libGL.so", sizeof(_this->gl_config.driver_path)-1);
646 } 646 }
647 } 647 }
648 } 648 }
649 } else { 649 } else {
650 /* 650 /*
668 668
669 } 669 }
670 670
671 if ((_this->gl_config.dll_handle = (void*)load_add_on(path)) != (void*)B_ERROR) { 671 if ((_this->gl_config.dll_handle = (void*)load_add_on(path)) != (void*)B_ERROR) {
672 _this->gl_config.driver_loaded = 1; 672 _this->gl_config.driver_loaded = 1;
673 strncpy(_this->gl_config.driver_path, path, sizeof(_this->gl_config.driver_path)-1); 673 SDL_strncpy(_this->gl_config.driver_path, path, sizeof(_this->gl_config.driver_path)-1);
674 }*/ 674 }*/
675 } 675 }
676 676
677 if (_this->gl_config.dll_handle != NULL) { 677 if (_this->gl_config.dll_handle != NULL) {
678 return 0; 678 return 0;
679 } else { 679 } else {
680 _this->gl_config.dll_handle = NULL; 680 _this->gl_config.dll_handle = NULL;
681 _this->gl_config.driver_loaded = 0; 681 _this->gl_config.driver_loaded = 0;
682 strcpy(_this->gl_config.driver_path, ""); 682 SDL_strcpy(_this->gl_config.driver_path, "");
683 return -1; 683 return -1;
684 } 684 }
685 } 685 }
686 686
687 void* BE_GL_GetProcAddress(_THIS, const char *proc) 687 void* BE_GL_GetProcAddress(_THIS, const char *proc)
803 SDL_BlankCursor = NULL; 803 SDL_BlankCursor = NULL;
804 } 804 }
805 for ( i=0; i<NUM_MODELISTS; ++i ) { 805 for ( i=0; i<NUM_MODELISTS; ++i ) {
806 if ( SDL_modelist[i] ) { 806 if ( SDL_modelist[i] ) {
807 for ( j=0; SDL_modelist[i][j]; ++j ) { 807 for ( j=0; SDL_modelist[i][j]; ++j ) {
808 free(SDL_modelist[i][j]); 808 SDL_free(SDL_modelist[i][j]);
809 } 809 }
810 free(SDL_modelist[i]); 810 SDL_free(SDL_modelist[i]);
811 SDL_modelist[i] = NULL; 811 SDL_modelist[i] = NULL;
812 } 812 }
813 } 813 }
814 /* Restore the original video mode */ 814 /* Restore the original video mode */
815 if ( _this->screen ) { 815 if ( _this->screen ) {