forked from len0rd/rockbox
puzzles: misc. changes and sync with upstream
This brings puzzles up-to-date with Simon's tree, along with the rockbox-specific changes I made. Note that I also got rid of some of the ugly floating-point code in rbwrappers.c and replaced it with wrappers for our fixed-point library. Change-Id: Ibfb79acb15517116a26de1c3ea89e025146b9e2e
This commit is contained in:
parent
4dd300d9f0
commit
3c514f8e20
20 changed files with 102 additions and 702 deletions
|
|
@ -361,16 +361,21 @@ 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)
|
||||
{
|
||||
size_t len = strlen(str);
|
||||
assert(sz > 0);
|
||||
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;
|
||||
}
|
||||
|
||||
/* another kludge for platforms without %g support in *printf() */
|
||||
int ftoa(char *buf, float f)
|
||||
{
|
||||
return sprintf(buf, "%d.%06d", (int)f, (int)((f - (int)f)*1e6));
|
||||
}
|
||||
|
||||
/* vim: set shiftwidth=4 tabstop=8: */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue