From 19e06988520133ca644c533c8f6932738788a7a5 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 25 Jan 2004 13:54:10 +0100 Subject: [PATCH] rnd-20040125-4-src --- src/conftime.h | 2 +- src/files.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/conftime.h b/src/conftime.h index 39be8fc7..63f8de9c 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2004-01-25 02:38]" +#define COMPILE_DATE_STRING "[2004-01-25 13:45]" diff --git a/src/files.c b/src/files.c index 61deafb4..e365cd1f 100644 --- a/src/files.c +++ b/src/files.c @@ -328,7 +328,7 @@ static char *getLevelFilenameFromBasename(char *basename) static int getFileTypeFromBasename(char *basename) { - char *filename = getLevelFilenameFromBasename(basename); + static char *filename = NULL; struct stat file_status; /* ---------- try to determine file type from filename ---------- */ @@ -340,6 +340,9 @@ static int getFileTypeFromBasename(char *basename) /* ---------- try to determine file type from filesize ---------- */ + checked_free(filename); + filename = getPath2(getCurrentLevelDir(), basename); + if (stat(filename, &file_status) == 0) { /* check for typical filesize of a Supaplex level package file */ @@ -353,10 +356,10 @@ static int getFileTypeFromBasename(char *basename) static char *getSingleLevelBasename(int nr, int type) { static char basename[MAX_FILENAME_LEN]; + char *level_filename = getStringCopy(leveldir_current->level_filename); - if (leveldir_current->level_filename == NULL) - leveldir_current->level_filename = - getStringCat2("%03d.", LEVELFILE_EXTENSION); + if (level_filename == NULL) + level_filename = getStringCat2("%03d.", LEVELFILE_EXTENSION); switch (type) { @@ -373,10 +376,12 @@ static char *getSingleLevelBasename(int nr, int type) case LEVEL_FILE_TYPE_UNKNOWN: default: - sprintf(basename, leveldir_current->level_filename, nr); + sprintf(basename, level_filename, nr); break; } + free(level_filename); + return basename; } -- 2.34.1