projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gui: Fix temporary filtering by a variable's value.
[pspp]
/
src
/
libpspp
/
str.c
diff --git
a/src/libpspp/str.c
b/src/libpspp/str.c
index c630cf9ada761aa89b260197ca0718b1e9ff4344..7e722c17e6b92602798725e3bdd618327a46691f 100644
(file)
--- a/
src/libpspp/str.c
+++ b/
src/libpspp/str.c
@@
-270,17
+270,22
@@
str_format_26adic (unsigned long int number, char buffer[], size_t size)
while (number-- > 0)
{
if (length >= size)
while (number-- > 0)
{
if (length >= size)
-
return false
;
+
goto overflow
;
buffer[length++] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[number % 26];
number /= 26;
}
if (length >= size)
buffer[length++] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[number % 26];
number /= 26;
}
if (length >= size)
-
return false
;
+
goto overflow
;
buffer[length] = '\0';
buf_reverse (buffer, length);
return true;
buffer[length] = '\0';
buf_reverse (buffer, length);
return true;
+
+overflow:
+ if (length > 0)
+ buffer[0] = '\0';
+ return false;
}
/* Sets the SIZE bytes starting at BLOCK to C,
}
/* Sets the SIZE bytes starting at BLOCK to C,