summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/rockaux.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lua/rockaux.c')
-rw-r--r--apps/plugins/lua/rockaux.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/apps/plugins/lua/rockaux.c b/apps/plugins/lua/rockaux.c
index 058ad313fa..929dea798b 100644
--- a/apps/plugins/lua/rockaux.c
+++ b/apps/plugins/lua/rockaux.c
@@ -106,7 +106,8 @@ int splash_scroller(int timeout, const char* str)
106 { 106 {
107 brk = strpbrk_n(ch+1, max_ch, break_chars); 107 brk = strpbrk_n(ch+1, max_ch, break_chars);
108 chars_next_break = (brk - ch); 108 chars_next_break = (brk - ch);
109 if (chars_next_break < 2 || w + (ch_w * chars_next_break) > max_w) 109 if (brk &&
110 (chars_next_break < 2 || w + (ch_w * chars_next_break) > max_w))
110 { 111 {
111 if (!isprint(line[linepos])) 112 if (!isprint(line[linepos]))
112 { 113 {
@@ -226,7 +227,7 @@ int get_current_path(lua_State *L, int level)
226 } 227 }
227 } 228 }
228 229
229 lua_pushnil(L); 230 lua_pushnil(L);
230 return 1; 231 return 1;
231} 232}
232 233
@@ -250,25 +251,32 @@ int filetol(int fd, long *num)
250 251
251 while (rb->read(fd, &chbuf, 1) == 1) 252 while (rb->read(fd, &chbuf, 1) == 1)
252 { 253 {
253 if(!isspace(chbuf) || retn == 1) 254 if(retn || !isspace(chbuf))
254 { 255 {
255 if(chbuf == '0') /* strip preceeding zeros */ 256 switch(chbuf)
256 { 257 {
257 *num = 0; 258 case '-':
258 retn = 1; 259 {
259 } 260 if (retn) /* 0 preceeds, this negative sign must be in error */
260 else if(chbuf == '-' && retn != 1) 261 goto get_digits;
261 neg = true; 262 neg = true;
262 else 263 continue;
263 { 264 }
264 rb->lseek(fd, -1, SEEK_CUR); 265 case '0': /* strip preceeding zeros */
265 break; 266 {
267 *num = 0;
268 retn = 1;
269 continue;
270 }
271 default:
272 goto get_digits;
266 } 273 }
267 } 274 }
268 } 275 }
269 276
270 while (rb->read(fd, &chbuf, 1) == 1) 277 while (rb->read(fd, &chbuf, 1) == 1)
271 { 278 {
279get_digits:
272 if(!isdigit(chbuf)) 280 if(!isdigit(chbuf))
273 { 281 {
274 rb->lseek(fd, -1, SEEK_CUR); 282 rb->lseek(fd, -1, SEEK_CUR);