comparison src/stdlib/SDL_getenv.c @ 1472:4aac8563c296

Fixed more Win64 portability issues
author Sam Lantinga <slouken@libsdl.org>
date Mon, 06 Mar 2006 08:11:10 +0000
parents 84de7511f79f
children 782fd950bd46 c121d94672cb e85e65aec22f
comparison
equal deleted inserted replaced
1471:9fb0eee04dd9 1472:4aac8563c296
67 /* Retrieve a variable named "name" from the environment */ 67 /* Retrieve a variable named "name" from the environment */
68 char *SDL_getenv(const char *name) 68 char *SDL_getenv(const char *name)
69 { 69 {
70 size_t bufferlen; 70 size_t bufferlen;
71 71
72 bufferlen = GetEnvironmentVariable(name, SDL_envmem, SDL_envmemlen); 72 bufferlen = GetEnvironmentVariable(name, SDL_envmem, (DWORD)SDL_envmemlen);
73 if ( bufferlen == 0 ) { 73 if ( bufferlen == 0 ) {
74 return NULL; 74 return NULL;
75 } 75 }
76 if ( bufferlen > SDL_envmemlen ) { 76 if ( bufferlen > SDL_envmemlen ) {
77 char *newmem = (char *)SDL_realloc(SDL_envmem, bufferlen); 77 char *newmem = (char *)SDL_realloc(SDL_envmem, bufferlen);
78 if ( newmem == NULL ) { 78 if ( newmem == NULL ) {
79 return NULL; 79 return NULL;
80 } 80 }
81 SDL_envmem = newmem; 81 SDL_envmem = newmem;
82 SDL_envmemlen = bufferlen; 82 SDL_envmemlen = bufferlen;
83 GetEnvironmentVariable(name, SDL_envmem, SDL_envmemlen); 83 GetEnvironmentVariable(name, SDL_envmem, (DWORD)SDL_envmemlen);
84 } 84 }
85 return SDL_envmem; 85 return SDL_envmem;
86 } 86 }
87 87
88 #else /* roll our own */ 88 #else /* roll our own */