forked from len0rd/rockbox
Revert r21863 partly: fixes Lua
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21883 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
0e5942ffea
commit
be54b7f6a2
3 changed files with 5 additions and 3 deletions
|
@ -181,7 +181,8 @@ const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) {
|
||||||
|
|
||||||
void luaO_chunkid (char *out, const char *source, size_t bufflen) {
|
void luaO_chunkid (char *out, const char *source, size_t bufflen) {
|
||||||
if (*source == '=') {
|
if (*source == '=') {
|
||||||
strlcpy(out, source+1, bufflen); /* remove first char */
|
strncpy(out, source+1, bufflen); /* remove first char */
|
||||||
|
out[bufflen-1] = '\0'; /* ensures null termination */
|
||||||
}
|
}
|
||||||
else { /* out = "source", or "...source" */
|
else { /* out = "source", or "...source" */
|
||||||
if (*source == '@') {
|
if (*source == '@') {
|
||||||
|
|
|
@ -737,7 +737,9 @@ static const char *scanformat (lua_State *L, const char *strfrmt, char *form) {
|
||||||
if (isdigit(uchar(*p)))
|
if (isdigit(uchar(*p)))
|
||||||
luaL_error(L, "invalid format (width or precision too long)");
|
luaL_error(L, "invalid format (width or precision too long)");
|
||||||
*(form++) = '%';
|
*(form++) = '%';
|
||||||
strlcpy(form, strfrmt, p - strfrmt + 1);
|
strncpy(form, strfrmt, p - strfrmt + 1);
|
||||||
|
form += p - strfrmt + 1;
|
||||||
|
*form = '\0';
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,6 @@ long pow(long x, long y);
|
||||||
#define strchr rb->strchr
|
#define strchr rb->strchr
|
||||||
#define strcmp rb->strcmp
|
#define strcmp rb->strcmp
|
||||||
#define strcpy rb->strcpy
|
#define strcpy rb->strcpy
|
||||||
#define strlcpy rb->strlcpy
|
|
||||||
#define strlen rb->strlen
|
#define strlen rb->strlen
|
||||||
|
|
||||||
#endif /* _ROCKCONF_H_ */
|
#endif /* _ROCKCONF_H_ */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue