diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-06-09 00:08:19 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-06-09 00:08:19 +0400 |
commit | c8b4cf92067ffeb625aa39003baf5d8f7c3f0025 (patch) | |
tree | c6c50dbc3d90a65fca6c1ca56a93e4a57cf7e154 /source/blender/blenlib | |
parent | e93db433a086a3e739c0f4026cd500f0b595b0f1 (diff) | |
parent | d76a6f5231c015c35123d22e1f5c3ffcdfbf9bbd (diff) |
2.50:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r19820:HEAD
Notes:
* Game and sequencer RNA, and sequencer header are now out of date
a bit after changes in trunk.
* I didn't know how to port these bugfixes, most likely they are
not needed anymore.
* Fix "duplicate strip" always increase the user count for ipo.
* IPO pinning on sequencer strips was lost during Undo.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_string.h | 1 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_vfontdata.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/storage.c | 7 | ||||
-rw-r--r-- | source/blender/blenlib/intern/string.c | 48 | ||||
-rw-r--r-- | source/blender/blenlib/intern/util.c | 3 |
5 files changed, 52 insertions, 9 deletions
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h index ce9dd44601b..4e5bf650196 100644 --- a/source/blender/blenlib/BLI_string.h +++ b/source/blender/blenlib/BLI_string.h @@ -96,6 +96,7 @@ int BLI_strcaseeq(const char *a, const char *b); char *BLI_strcasestr(const char *s, const char *find); int BLI_strcasecmp(const char *s1, const char *s2); int BLI_strncasecmp(const char *s1, const char *s2, int n); +int BLI_natstrcmp(const char *s1, const char *s2); void BLI_timestr(double _time, char *str); /* time var is global */ diff --git a/source/blender/blenlib/BLI_vfontdata.h b/source/blender/blenlib/BLI_vfontdata.h index 8838b1992e4..bd89959801a 100644 --- a/source/blender/blenlib/BLI_vfontdata.h +++ b/source/blender/blenlib/BLI_vfontdata.h @@ -54,7 +54,7 @@ typedef struct VFontData { typedef struct VChar { struct VChar *next, *prev; ListBase nurbsbase; - unsigned long index; + intptr_t index; float resol; float width; float *points; diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 9204ab18bfa..688a4ab901b 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -154,7 +154,7 @@ int BLI_compare(struct direntry *entry1, struct direntry *entry2) if( strcmp(entry1->relname, "..")==0 ) return (-1); if( strcmp(entry2->relname, "..")==0 ) return (1); - return (BLI_strcasecmp(entry1->relname,entry2->relname)); + return (BLI_natstrcmp(entry1->relname,entry2->relname)); } @@ -330,7 +330,7 @@ void BLI_builddir(char *dirname, char *relname) void BLI_adddirstrings() { char datum[100]; - char buf[250]; + char buf[512]; char size[250]; static char * types[8] = {"---", "--x", "-w-", "-wx", "r--", "r-x", "rw-", "rwx"}; int num, mode; @@ -427,9 +427,6 @@ void BLI_adddirstrings() sprintf(size, "%10d", (int) st_size); } - sprintf(buf,"%s %s %10s %s", files[num].date, files[num].time, size, - files[num].relname); - sprintf(buf,"%s %s %s %7s %s %s %10s %s", file->mode1, file->mode2, file->mode3, files[num].owner, files[num].date, files[num].time, size, files[num].relname); diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index 843f6b62735..fa4bcbc26bc 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -170,6 +170,54 @@ int BLI_strncasecmp(const char *s1, const char *s2, int n) { return 0; } +/* natural string compare, keeping numbers in order */ +int BLI_natstrcmp(const char *s1, const char *s2) +{ + int d1= 0, d2= 0; + + /* if both chars are numeric, to a strtol(). + then increase string deltas as long they are + numeric, else do a tolower and char compare */ + + while(1) { + char c1 = tolower(s1[d1]); + char c2 = tolower(s2[d2]); + + if( isdigit(c1) && isdigit(c2) ) { + int val1, val2; + + val1= (int)strtol(s1+d1, (char **)NULL, 10); + val2= (int)strtol(s2+d2, (char **)NULL, 10); + + if (val1<val2) { + return -1; + } else if (val1>val2) { + return 1; + } + d1++; + while( isdigit(s1[d1]) ) + d1++; + d2++; + while( isdigit(s2[d2]) ) + d2++; + + c1 = tolower(s1[d1]); + c2 = tolower(s2[d2]); + } + + if (c1<c2) { + return -1; + } else if (c1>c2) { + return 1; + } else if (c1==0) { + break; + } + d1++; + d2++; + } + return 0; +} + void BLI_timestr(double _time, char *str) { /* format 00:00:00.00 (hr:min:sec) string has to be 12 long */ diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c index 137a32c4689..df4ad4e7c75 100644 --- a/source/blender/blenlib/intern/util.c +++ b/source/blender/blenlib/intern/util.c @@ -1472,9 +1472,6 @@ char* BLI_getbundle(void) { } #endif - - - #ifdef WITH_ICONV #include "iconv.h" #include "localcharset.h" |