Revision: 13905
http://swig.svn.sourceforge.net/swig/?rev=13905&view=rev
Author: wsfulton
Date: 2012-11-18 00:45:39 +0000 (Sun, 18 Nov 2012)
Log Message:
-----------
Fix Swig_file_extension when the path has a . and there is no extension in the filename
Modified Paths:
--------------
trunk/Source/Swig/include.c
Modified: trunk/Source/Swig/include.c
===================================================================
--- trunk/Source/Swig/include.c 2012-11-18 00:45:18 UTC (rev 13904)
+++ trunk/Source/Swig/include.c 2012-11-18 00:45:39 UTC (rev 13905)
@@ -323,19 +323,11 @@
* ----------------------------------------------------------------------------- */
String *Swig_file_extension(const_String_or_char_ptr filename) {
- const char *d;
- const char *c = Char(filename);
- int len = Len(filename);
- if (strlen(c)) {
- d = c + len - 1;
- while (d != c) {
- if (*d == '.')
- return NewString(d);
- d--;
- }
- return NewString(c + len);
- }
- return NewString(c);
+ String *name = Swig_file_filename(filename);
+ const char *c = strrchr(Char(name), '.');
+ String *extension = c ? NewString(c) : NewString("");
+ Delete(name);
+ return extension;
}
/* -----------------------------------------------------------------------------
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|