From 03d016a47ad15d48972f8cdb79ac8a2e8b38775d Mon Sep 17 00:00:00 2001 From: borutr Date: Mon, 29 Jan 2007 16:47:44 +0000 Subject: [PATCH] * src/SDCCmain.c, src/SDCCutil.c: dbuf_splitFile: file extension component contains the extension separator. git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4606 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 5 +++++ src/SDCCmain.c | 7 +++---- src/SDCCutil.c | 7 ++----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9c5b9577..08425d16 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-01-29 Borut Razem + + * src/SDCCmain.c, src/SDCCutil.c: dbuf_splitFile: file extension + component contains the extension separator. + 2007-01-28 Borut Razem * sim/ucsim/cmd.src/cmdutil.cc: NUL device is detected as CG_FILE type diff --git a/src/SDCCmain.c b/src/SDCCmain.c index 073e4608..347c0443 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -628,7 +628,7 @@ processFile (char *s) /* otherwise depending on the file type */ extp = dbuf_c_str (&ext); - if (extp[1] == '\0' && (extp[0] == 'c' || extp[0] == 'C')) + if (STRCASECMP (extp, ".c") == 0) { char *p; @@ -674,8 +674,7 @@ processFile (char *s) /* if the extention is type .rel or .r or .REL or .R additional object file will be passed to the linker */ - if ((extp[1] == '\0' && (extp[0] == 'r' || extp[0] == 'R')) || - strcmp (extp, "rel") == 0 || strcmp (extp, "REL") == 0 || + if (STRCASECMP (extp, ".r") == 0 || STRCASECMP (extp, ".rel") == 0 || strcmp (extp, port->linker.rel_ext) == 0) { dbuf_destroy (&ext); @@ -686,7 +685,7 @@ processFile (char *s) } /* if .lib or .LIB */ - if (strcmp (extp, "lib") == 0 || strcmp (extp, ".LIB") == 0) + if (STRCASECMP (extp, ".lib") == 0) { dbuf_destroy (&ext); dbuf_destroy (&path); diff --git a/src/SDCCutil.c b/src/SDCCutil.c index 6673b363..d34ad733 100644 --- a/src/SDCCutil.c +++ b/src/SDCCutil.c @@ -158,7 +158,7 @@ dbuf_splitPath(const char *path, struct dbuf_s *dir, struct dbuf_s *file) } /** Split the path string to the file name (including directory) and file extension components. - The file name component doesn't contain trailing extension separator. + File extension component contains the extension separator. Returns true if the path contains the extension separator. */ int dbuf_splitFile(const char *path, struct dbuf_s *file, struct dbuf_s *ext) @@ -187,10 +187,7 @@ dbuf_splitFile(const char *path, struct dbuf_s *file, struct dbuf_s *ext) if (NULL != ext) { - int len; - - ++p; - len = end - p; + int len = end - p; if (0 < len) dbuf_append(ext, p, len); -- 2.30.2