}
}
if (i == n) {
- p = str;
- width = strtol(p, &p, 10);
+ width = strtol(str, &p, 10);
if (*p)
p++;
height = strtol(p, &p, 10);
val = 0;
for(i = 0; i < len_max; i++) {
c = *p;
- if (!isdigit(c))
+ if (!av_isdigit(c))
break;
val = (val * 10) + c - '0';
p++;
char lastch;
int negative = 0;
-#undef time
time_t now = time(0);
len = strlen(timestr);
/* parse timestr as HH:MM:SS */
q = small_strptime(p, time_fmt[0], &dt);
if (!q) {
+ char *o;
/* parse timestr as S+ */
- dt.tm_sec = strtol(p, (char **)&q, 10);
- if (q == p) {
+ dt.tm_sec = strtol(p, &o, 10);
+ if (o == p) {
/* the parsing didn't succeed */
*timeval = INT64_MIN;
return AVERROR(EINVAL);
}
dt.tm_min = 0;
dt.tm_hour = 0;
+ q = o;
}
}
int val, n;
q++;
for (val = 0, n = 100000; n >= 1; n /= 10, q++) {
- if (!isdigit(*q))
+ if (!av_isdigit(*q))
break;
val += n * (*q - '0');
}
#ifdef TEST
-#undef printf
-
int main(void)
{
printf("Testing av_parse_video_rate()\n");
{
int i;
- const char *rates[] = {
+ static const char *const rates[] = {
"-inf",
"inf",
"nan",
for (i = 0; i < FF_ARRAY_ELEMS(rates); i++) {
int ret;
- AVRational q = (AVRational){0, 0};
- ret = av_parse_video_rate(&q, rates[i]),
- printf("'%s' -> %d/%d ret:%d\n",
- rates[i], q.num, q.den, ret);
+ AVRational q = { 0, 0 };
+ ret = av_parse_video_rate(&q, rates[i]);
+ printf("'%s' -> %d/%d %s\n",
+ rates[i], q.num, q.den, ret ? "ERROR" : "OK");
}
}
{
int i;
uint8_t rgba[4];
- const char *color_names[] = {
+ static const char *const color_names[] = {
"foo",
"red",
"Red ",
for (i = 0; i < FF_ARRAY_ELEMS(color_names); i++) {
if (av_parse_color(rgba, color_names[i], -1, NULL) >= 0)
- printf("%s -> R(%d) G(%d) B(%d) A(%d)\n", color_names[i], rgba[0], rgba[1], rgba[2], rgba[3]);
+ printf("%s -> R(%d) G(%d) B(%d) A(%d)\n",
+ color_names[i], rgba[0], rgba[1], rgba[2], rgba[3]);
}
}