Revision: 20438
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20438
Author:   elubie
Date:     2009-05-26 23:34:20 +0200 (Tue, 26 May 2009)

Log Message:
-----------
2.5 filebrowser
- some cleanup of ugly conditional.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/space_file/file_draw.c

Modified: 
branches/blender2.5/blender/source/blender/editors/space_file/file_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_file/file_draw.c   
2009-05-26 21:32:19 UTC (rev 20437)
+++ branches/blender2.5/blender/source/blender/editors/space_file/file_draw.c   
2009-05-26 21:34:20 UTC (rev 20438)
@@ -182,12 +182,17 @@
        float sw = 0;
        float pad = 0;
 
+       if (w <= 0) {
+               *string = '\0';
+               return 0.0;
+       }
+
        sw = file_string_width(string);
        if (flag == FILE_SHORTEN_FRONT) {
                char *s = string;
                BLI_strncpy(temp, "...", 4);
                pad = file_string_width(temp);
-               while (s && *s && (w > 0) && (sw+pad>w)) {
+               while ((*s) && (sw+pad>w)) {
                        s++;
                        sw = file_string_width(s);
                        shortened = 1;
@@ -200,14 +205,13 @@
                }
        } else {
                char *s = string;
-               if (w>0) {
-                       while (sw>w) {
-                               int slen = strlen(string);
-                               string[slen-1] = '\0';
-                               sw = file_string_width(s);
-                               shortened = 1;
-                       }
+               while (sw>w) {
+                       int slen = strlen(string);
+                       string[slen-1] = '\0';
+                       sw = file_string_width(s);
+                       shortened = 1;
                }
+
                if (shortened) {
                        int slen = strlen(string);
                        if (slen > 3) {


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to