Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Weikert <elubie@gmx.net>2009-05-27 01:34:20 +0400
committerAndrea Weikert <elubie@gmx.net>2009-05-27 01:34:20 +0400
commitb89fb7d8fdea03549f0108554c5631b19f4be770 (patch)
tree853c1d35f8539dc2b10a2ce2922e310d1a9f04f7 /source/blender/editors/space_file/file_draw.c
parent3159f4a243c8f08db39ac42995a30f884daed649 (diff)
2.5 filebrowser
- some cleanup of ugly conditional.
Diffstat (limited to 'source/blender/editors/space_file/file_draw.c')
-rw-r--r--source/blender/editors/space_file/file_draw.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 1db950c8f97..bbe8245a3f7 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -182,12 +182,17 @@ static float shorten_string(char* string, float w, int flag)
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 @@ static float shorten_string(char* string, float w, int flag)
}
} 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) {