chiark
/
gitweb
/
~ian
/
sgt-puzzles.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Forbid undo of new-game if it would change the params.
[sgt-puzzles.git]
/
misc.c
diff --git
a/misc.c
b/misc.c
index c7210165635e5749cbf6cd1f74a91eb17a7dc41a..c1a595fefa77a4dffa1b560f03f7d416e2ba52eb 100644
(file)
--- a/
misc.c
+++ b/
misc.c
@@
-361,15
+361,14
@@
void draw_text_outline(drawing *dr, int x, int y, int fonttype,
}
}
-/* kludge for
non-compliant sprintf()
*/
+/* kludge for
sprintf() in Rockbox not supporting "%-8.8s"
*/
void copy_left_justified(char *buf, size_t sz, const char *str)
{
void copy_left_justified(char *buf, size_t sz, const char *str)
{
+ size_t len = strlen(str);
+ assert(sz > 0);
memset(buf, ' ', sz - 1);
memset(buf, ' ', sz - 1);
- int len = strlen(str);
- if(len <= sz - 1)
- memcpy(buf, str, len);
- else
- fatal("overrun");
+ assert(len <= sz - 1);
+ memcpy(buf, str, len);
buf[sz - 1] = 0;
}
buf[sz - 1] = 0;
}