comparison util.c @ 876:540cc4a7d626

Fix Android build breakage
author Michael Pavone <pavone@retrodev.com>
date Mon, 09 Nov 2015 20:55:17 -0800
parents 54ffba3768d6
children a77670cd178d
comparison
equal deleted inserted replaced
875:54ffba3768d6 876:540cc4a7d626
11 11
12 #include "blastem.h" //for headless global 12 #include "blastem.h" //for headless global
13 #include "render.h" //for render_errorbox 13 #include "render.h" //for render_errorbox
14 #include "util.h" 14 #include "util.h"
15 15
16 char * alloc_concat(char * first, char * second) 16 char * alloc_concat(char const * first, char const * second)
17 { 17 {
18 int flen = strlen(first); 18 int flen = strlen(first);
19 int slen = strlen(second); 19 int slen = strlen(second);
20 char * ret = malloc(flen + slen + 1); 20 char * ret = malloc(flen + slen + 1);
21 memcpy(ret, first, flen); 21 memcpy(ret, first, flen);
22 memcpy(ret+flen, second, slen+1); 22 memcpy(ret+flen, second, slen+1);
23 return ret; 23 return ret;
24 } 24 }
25 25
26 char * alloc_concat_m(int num_parts, char ** parts) 26 char * alloc_concat_m(int num_parts, char const ** parts)
27 { 27 {
28 int total = 0; 28 int total = 0;
29 for (int i = 0; i < num_parts; i++) { 29 for (int i = 0; i < num_parts; i++) {
30 total += strlen(parts[i]); 30 total += strlen(parts[i]);
31 } 31 }
325 #ifdef __ANDROID__ 325 #ifdef __ANDROID__
326 326
327 #include <SDL.h> 327 #include <SDL.h>
328 char *read_bundled_file(char *name, long *sizeret) 328 char *read_bundled_file(char *name, long *sizeret)
329 { 329 {
330 SDL_RWops *rw = SDL_RWFromFile(config_path, "rb"); 330 SDL_RWops *rw = SDL_RWFromFile(name, "rb");
331 if (!rw) { 331 if (!rw) {
332 if (sizeret) { 332 if (sizeret) {
333 *sizeret = -1; 333 *sizeret = -1;
334 } 334 }
335 return NULL; 335 return NULL;
351 } 351 }
352 SDL_RWclose(rw); 352 SDL_RWclose(rw);
353 return ret; 353 return ret;
354 } 354 }
355 355
356 char *get_config_dir() 356 char const *get_config_dir()
357 { 357 {
358 return SDL_AndroidGetInternalStoragePath(); 358 return SDL_AndroidGetInternalStoragePath();
359 } 359 }
360 360
361 #else 361 #else
397 ret = NULL; 397 ret = NULL;
398 } 398 }
399 return ret; 399 return ret;
400 } 400 }
401 401
402 char *get_config_dir() 402 char const *get_config_dir()
403 { 403 {
404 static char* confdir; 404 static char* confdir;
405 if (!confdir) { 405 if (!confdir) {
406 char *homedir = get_home_dir(); 406 char *homedir = get_home_dir();
407 if (homedir) { 407 if (homedir) {