mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-07 15:10:49 +00:00
Use SDL string functions
This commit is contained in:
parent
725c79f3ac
commit
f2695856d6
1 changed files with 5 additions and 6 deletions
|
|
@ -495,15 +495,14 @@ static char *xdg_user_dir_lookup (const char *type)
|
|||
return NULL;
|
||||
|
||||
/* Special case desktop for historical compatibility */
|
||||
if (SDL_strcmp(type, "DESKTOP") == 0)
|
||||
{
|
||||
user_dir = (char*) SDL_malloc(SDL_strlen(home_dir) +
|
||||
SDL_strlen("/Desktop") + 1);
|
||||
if (SDL_strcmp(type, "DESKTOP") == 0) {
|
||||
size_t length = SDL_strlen(home_dir) + SDL_strlen("/Desktop") + 1;
|
||||
user_dir = (char*) SDL_malloc(length);
|
||||
if (!user_dir)
|
||||
return NULL;
|
||||
|
||||
strcpy(user_dir, home_dir);
|
||||
strcat(user_dir, "/Desktop");
|
||||
SDL_strlcpy(user_dir, home_dir, length);
|
||||
SDL_strlcat(user_dir, "/Desktop", length);
|
||||
return user_dir;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue