mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-07 03:48:14 +00:00
Use SDL string functions
This commit is contained in:
@@ -495,15 +495,14 @@ static char *xdg_user_dir_lookup (const char *type)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Special case desktop for historical compatibility */
|
/* Special case desktop for historical compatibility */
|
||||||
if (SDL_strcmp(type, "DESKTOP") == 0)
|
if (SDL_strcmp(type, "DESKTOP") == 0) {
|
||||||
{
|
size_t length = SDL_strlen(home_dir) + SDL_strlen("/Desktop") + 1;
|
||||||
user_dir = (char*) SDL_malloc(SDL_strlen(home_dir) +
|
user_dir = (char*) SDL_malloc(length);
|
||||||
SDL_strlen("/Desktop") + 1);
|
|
||||||
if (!user_dir)
|
if (!user_dir)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
strcpy(user_dir, home_dir);
|
SDL_strlcpy(user_dir, home_dir, length);
|
||||||
strcat(user_dir, "/Desktop");
|
SDL_strlcat(user_dir, "/Desktop", length);
|
||||||
return user_dir;
|
return user_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user