comparison src/loadso/windows/SDL_loadso.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 c71e05b4dc2e
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
43 const char *loaderror = "Unknown error"; 43 const char *loaderror = "Unknown error";
44 44
45 #if defined(_WIN32_WCE) 45 #if defined(_WIN32_WCE)
46 char errbuf[512]; 46 char errbuf[512];
47 47
48 wchar_t *errbuf_t = malloc(512 * sizeof(wchar_t)); 48 wchar_t *errbuf_t = SDL_malloc(512 * sizeof(wchar_t));
49 wchar_t *sofile_t = malloc((MAX_PATH+1) * sizeof(wchar_t)); 49 wchar_t *sofile_t = SDL_malloc((MAX_PATH+1) * sizeof(wchar_t));
50 50
51 MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, sofile, -1, sofile_t, MAX_PATH); 51 MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, sofile, -1, sofile_t, MAX_PATH);
52 handle = (void *)LoadLibrary(sofile_t); 52 handle = (void *)LoadLibrary(sofile_t);
53 53
54 /* Generate an error message if all loads failed */ 54 /* Generate an error message if all loads failed */
60 errbuf_t, SDL_TABLESIZE(errbuf), NULL); 60 errbuf_t, SDL_TABLESIZE(errbuf), NULL);
61 WideCharToMultiByte(CP_ACP, 0, errbuf_t, -1, errbuf, 511, NULL, NULL); 61 WideCharToMultiByte(CP_ACP, 0, errbuf_t, -1, errbuf, 511, NULL, NULL);
62 loaderror = errbuf; 62 loaderror = errbuf;
63 } 63 }
64 64
65 free(sofile_t); 65 SDL_free(sofile_t);
66 free(errbuf_t); 66 SDL_free(errbuf_t);
67 67
68 #else /*if defined(WIN32)*/ 68 #else /*if defined(WIN32)*/
69 char errbuf[512]; 69 char errbuf[512];
70 70
71 handle = (void *)LoadLibrary(sofile); 71 handle = (void *)LoadLibrary(sofile);
92 void *symbol = NULL; 92 void *symbol = NULL;
93 const char *loaderror = "Unknown error"; 93 const char *loaderror = "Unknown error";
94 94
95 #if defined(_WIN32_WCE) 95 #if defined(_WIN32_WCE)
96 char errbuf[512]; 96 char errbuf[512];
97 int length = strlen(name); 97 int length = SDL_strlen(name);
98 98
99 wchar_t *name_t = malloc((length + 1) * sizeof(wchar_t)); 99 wchar_t *name_t = SDL_malloc((length + 1) * sizeof(wchar_t));
100 wchar_t *errbuf_t = malloc(512 * sizeof(wchar_t)); 100 wchar_t *errbuf_t = SDL_malloc(512 * sizeof(wchar_t));
101 101
102 MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, name, -1, name_t, length); 102 MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, name, -1, name_t, length);
103 103
104 symbol = (void *)GetProcAddress((HMODULE)handle, name_t); 104 symbol = (void *)GetProcAddress((HMODULE)handle, name_t);
105 if ( symbol == NULL ) { 105 if ( symbol == NULL ) {
110 errbuf_t, SDL_TABLESIZE(errbuf), NULL); 110 errbuf_t, SDL_TABLESIZE(errbuf), NULL);
111 WideCharToMultiByte(CP_ACP, 0, errbuf_t, -1, errbuf, 511, NULL, NULL); 111 WideCharToMultiByte(CP_ACP, 0, errbuf_t, -1, errbuf, 511, NULL, NULL);
112 loaderror = errbuf; 112 loaderror = errbuf;
113 } 113 }
114 114
115 free(name_t); 115 SDL_free(name_t);
116 free(errbuf_t); 116 SDL_free(errbuf_t);
117 117
118 #else /*if defined(WIN32)*/ 118 #else /*if defined(WIN32)*/
119 char errbuf[512]; 119 char errbuf[512];
120 120
121 symbol = (void *)GetProcAddress((HMODULE)handle, name); 121 symbol = (void *)GetProcAddress((HMODULE)handle, name);