From d13cca33624339d73e70df6c917d4aad595f2a27 Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Wed, 7 May 2014 22:58:32 +0200 Subject: [PATCH] The basename default should be the filename itself --- CLTool/src/tc.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/CLTool/src/tc.cpp b/CLTool/src/tc.cpp index bff90f2..fcd38aa 100644 --- a/CLTool/src/tc.cpp +++ b/CLTool/src/tc.cpp @@ -91,7 +91,7 @@ void ExtractBasename(const char *filename, char *buf, size_t bufSz) { size_t len = strlen(filename); const char *end = filename + len; const char *ext = end; - const char *base = NULL; + const char *base = filename; while(--end != filename && !base) { if(*end == '.') { ext = end; @@ -100,11 +100,6 @@ void ExtractBasename(const char *filename, char *buf, size_t bufSz) { } } - if(!base) { - fprintf(stderr, "Filename (%s) has no extension, we don't know how to deal with it!\n", filename); - exit(1); - } - size_t numChars = ext - base + 1; size_t toCopy = ::std::min(numChars, bufSz); memcpy(buf, base, toCopy);