diff options
| author | 2016-09-24 18:50:43 -0400 | |
|---|---|---|
| committer | 2016-09-24 18:50:43 -0400 | |
| commit | 89512850bc1b0f2dcb1b3aab0778d66b23543a2d (patch) | |
| tree | 2be04091ca67cf842ad3400b0ff5ad906dc6a514 /src/tools/imgtool/imgtool.cpp | |
| parent | c2e7dfc18309ebfdb3fdd59aebd3d9eb608cf747 (diff) | |
Retired imgtool_basename(), in favor of core_filename_extract_base()
Diffstat (limited to 'src/tools/imgtool/imgtool.cpp')
| -rw-r--r-- | src/tools/imgtool/imgtool.cpp | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/src/tools/imgtool/imgtool.cpp b/src/tools/imgtool/imgtool.cpp index 71aecb39f6e..bda9a0b83bf 100644 --- a/src/tools/imgtool/imgtool.cpp +++ b/src/tools/imgtool/imgtool.cpp @@ -164,23 +164,6 @@ static imgtoolerr_t markerrorsource(imgtoolerr_t err) return err; } -char *imgtool_basename(char *filename) -{ - char *c; - - // NULL begets NULL - if (!filename) - return nullptr; - - // start at the end and return when we hit a slash or colon - for (c = filename + strlen(filename) - 1; c >= filename; c--) - if (*c == '\\' || *c == '/' || *c == ':') - return c + 1; - - // otherwise, return the whole thing - return filename; -} - /*------------------------------------------------- internal_error - debug function for raising internal errors @@ -2102,9 +2085,13 @@ imgtoolerr_t imgtool_partition_put_file(imgtool_partition *partition, const char imgtool_stream *f = nullptr; imgtool_charset charset; char *alloc_newfname = nullptr; + std::string basename; if (!newfname) - newfname = (const char *) imgtool_basename((char *) source); + { + basename = core_filename_extract_base(source); + newfname = basename.c_str(); + } charset = (imgtool_charset) (int) imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_CHARSET); if (charset != IMGTOOL_CHARSET_UTF8) |
