Skip to content

Commit

Permalink
Remove references to strncasecmp; strdup
Browse files Browse the repository at this point in the history
Update tinydir submodule to remove strncasecmp
Said functions are causing compiler problems
  • Loading branch information
cxong committed Feb 12, 2014
1 parent a6304ce commit f8731a1
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ cdogs-sdl
*.tar.gz
cdogs-sdl-editor
libcdogs.a
libcdogsedlib.a
autosave_test
color_test
config_test
Expand Down
4 changes: 2 additions & 2 deletions src/cdogs/files.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,14 +513,14 @@ const char *GetHomeDirectory(void)
p = getenv("CDOGS_CONFIG_DIR");
if (p != NULL && strlen(p) != 0)
{
cdogs_homepath = strdup(p);
CSTRDUP(cdogs_homepath, p);
return cdogs_homepath;
}

p = getenv(HOME_DIR_ENV);
if (p != NULL && strlen(p) != 0)
{
cdogs_homepath = calloc(strlen(p) + 1, sizeof(char));
CCALLOC(cdogs_homepath, strlen(p) + 1);
strncpy(cdogs_homepath, p, strlen(p));
strncat(cdogs_homepath, "/", 1);
return cdogs_homepath;
Expand Down
3 changes: 2 additions & 1 deletion src/cdogs/map_new.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,8 @@ int MapNewSave(const char *filename, CampaignSetting *c)
char *text = NULL;
char buf[CDOGS_PATH_MAX];
json_t *root;
if (SDL_strcasecmp(StrGetFileExt(filename), "cpn") == 0)
if (strcmp(StrGetFileExt(filename), "cpn") == 0 ||
strcmp(StrGetFileExt(filename), "CPN") == 0)
{
strcpy(buf, filename);
}
Expand Down
2 changes: 1 addition & 1 deletion src/cdogs/pic_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static void PicManagerLoadDirImpl(
goto bail;
}
if (file.is_reg &&
SDL_strcasecmp(StrGetFileExt(file.name), "png") == 0)
IMG_isPNG(SDL_RWFromFile(file.path, "rb")))
{
if (prefix)
{
Expand Down
4 changes: 2 additions & 2 deletions src/cdogs/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ extern int debug_level;
}
#define CSTRDUP(_var, _str)\
{\
_var = strdup(_str); \
_CCHECKALLOC("CSTRDUP", _var, (strlen(_str) + 1))\
CMALLOC(_var, strlen(_str) + 1);\
strcpy(_var, _str);\
}

#define CFREE(_var)\
Expand Down
2 changes: 1 addition & 1 deletion src/tinydir
Submodule tinydir updated 1 files
+1 −7 tinydir.h

0 comments on commit f8731a1

Please sign in to comment.