[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32230] trunk/blender/source/blender/ blenlib/intern/string.c: minor bugfix [#24085] NULL character is last

Campbell Barton ideasman42 at gmail.com
Fri Oct 1 15:30:14 CEST 2010


Revision: 32230
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32230
Author:   campbellbarton
Date:     2010-10-01 15:30:09 +0200 (Fri, 01 Oct 2010)

Log Message:
-----------
minor bugfix [#24085] NULL character is last
so "blah.blend" comes before "blah 1.blend"

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/string.c

Modified: trunk/blender/source/blender/blenlib/intern/string.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/string.c	2010-10-01 13:27:59 UTC (rev 32229)
+++ trunk/blender/source/blender/blenlib/intern/string.c	2010-10-01 13:30:09 UTC (rev 32230)
@@ -311,9 +311,14 @@
 			c1 = tolower(s1[d1]);
 			c2 = tolower(s2[d2]);
 		}
-		
-		if (c1<c2) {
+	
+		/* first check for '.' so "foo.bar" comes before "foo 1.bar" */	
+		if(c1=='.' && c2!='.')
 			return -1;
+		if(c1!='.' && c2=='.')
+			return 1;
+		else if (c1<c2) {
+			return -1;
 		} else if (c1>c2) {
 			return 1;
 		} else if (c1==0) {





More information about the Bf-blender-cvs mailing list