| 14400 | } |
| 14401 | |
| 14402 | static const char *scanformat (lua_State *L, const char *strfrmt, char *form) { |
| 14403 | const char *p = strfrmt; |
| 14404 | while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++; /* skip flags */ |
| 14405 | if ((size_t)(p - strfrmt) >= sizeof(FLAGS)) |
| 14406 | luaL_error(L, "invalid format (repeated flags)"); |
| 14407 | if (isdigit(uchar(*p))) p++; /* skip width */ |
| 14408 | if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ |
| 14409 | if (*p == '.') { |
| 14410 | p++; |
| 14411 | if (isdigit(uchar(*p))) p++; /* skip precision */ |
| 14412 | if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ |
| 14413 | } |
| 14414 | if (isdigit(uchar(*p))) |
| 14415 | luaL_error(L, "invalid format (width or precision too long)"); |
| 14416 | *(form++) = '%'; |
| 14417 | strncpy(form, strfrmt, p - strfrmt + 1); |
| 14418 | form += p - strfrmt + 1; |
| 14419 | *form = '\0'; |
| 14420 | return p; |
| 14421 | } |
| 14422 | |
| 14423 | |
| 14424 | static void addintlen (char *form) { |
no test coverage detected