[macruby-changes] [4425] MacRuby/trunk/file.c

source_changes at macosforge.org source_changes at macosforge.org
Mon Aug 16 13:15:55 PDT 2010


Revision: 4425
          http://trac.macosforge.org/projects/ruby/changeset/4425
Author:   lsansonetti at apple.com
Date:     2010-08-16 13:15:54 -0700 (Mon, 16 Aug 2010)
Log Message:
-----------
fixed a 1.9 bug in File.basename (patch imported from 1.9 upstream by watson1978 at gmail.com)

Modified Paths:
--------------
    MacRuby/trunk/file.c

Modified: MacRuby/trunk/file.c
===================================================================
--- MacRuby/trunk/file.c	2010-08-12 01:23:10 UTC (rev 4424)
+++ MacRuby/trunk/file.c	2010-08-16 20:15:54 UTC (rev 4425)
@@ -2615,16 +2615,20 @@
 static int
 rmext(const char *p, int l1, const char *e)
 {
-    int l2;
+    int l0, l2;
 
     if (!e) return 0;
 
+    for (l0 = 0; l0 < l1; ++l0) {
+	if (p[l0] != '.') break;
+    }
+
     l2 = strlen(e);
     if (l2 == 2 && e[1] == '*') {
 	unsigned char c = *e;
 	e = p + l1;
 	do {
-	    if (e <= p) return 0;
+	    if (e <= p + l0) return 0;
 	} while (*--e != c);
 	return e - p;
     }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100816/d434d462/attachment.html>


More information about the macruby-changes mailing list