On Mon, Nov 12, 2018 at 07:46:45PM +0100, Paul B Mahol wrote: > Copied and adopted from musl implementation. > * converted all 'long double' to 'double' > > Signed-off-by: Paul B Mahol <one...@gmail.com> > --- > libavutil/avstring.c | 961 +++++++++++++++++++++++++++++++++++++++++++ > libavutil/avstring.h | 6 + > 2 files changed, 967 insertions(+) [...] > +static int ff_vfscanf(FFFILE *f, const char *fmt, va_list ap) > +{ > + int width; > + int size; > + int base; > + const unsigned char *p; > + int c, t; > + char *s; > + void *dest=NULL; > + int invert; > + int matches=0; > + unsigned long long x; > + double y; > + off_t pos = 0; > + unsigned char scanset[257]; > + size_t i, k; > + > + for (p=(const unsigned char *)fmt; *p; p++) { > + > + if (av_isspace(*p)) { > + while (av_isspace(p[1])) p++; > + shlim(f, 0); > + while (av_isspace(shgetc(f))); > + shunget(f); > + pos += shcnt(f); > + continue; > + } > + if (*p != '%' || p[1] == '%') { > + shlim(f, 0); > + if (*p == '%') { > + p++; > + while (av_isspace((c=shgetc(f)))); > + } else { > + c = shgetc(f); > + } > + if (c!=*p) { > + shunget(f); > + if (c<0) goto input_fail; > + goto match_fail; > + } > + pos += shcnt(f); > + continue; > + } > + > + p++; > + if (*p=='*') { > + dest = 0; p++; > + } else if (av_isdigit(*p) && p[1]=='$') { > + dest = arg_n(ap, *p-'0'); p+=2; > + } else { > + dest = va_arg(ap, void *); > + } > + > + for (width=0; av_isdigit(*p); p++) { > + width = 10*width + *p - '0'; > + } > + > + if (*p=='m') { > + s = 0; > + p++; > + } > + > + size = SIZE_def; > + switch (*p++) { > + case 'h': > + if (*p == 'h') p++, size = SIZE_hh; > + else size = SIZE_h; > + break; > + case 'l': > + if (*p == 'l') p++, size = SIZE_ll; > + else size = SIZE_l; > + break; > + case 'j': > + size = SIZE_ll; > + break; > + case 'z': > + case 't': > + size = SIZE_l; > + break; > + case 'L': > + size = SIZE_L; > + break; > + case 'd': case 'i': case 'o': case 'u': case 'x': > + case 'a': case 'e': case 'f': case 'g': > + case 'A': case 'E': case 'F': case 'G': case 'X': > + case 's': case 'c': case '[': > + case 'S': case 'C': > + case 'p': case 'n': > + p--; > + break; > + default: > + goto fmt_fail; > + } > + > + t = *p; > + > + /* C or S */ > + if ((t&0x2f) == 3) { > + t |= 32; > + size = SIZE_l; > + } > + > + switch (t) { > + case 'c': > + if (width < 1) width = 1; > + case '[': > + break; > + case 'n': > + store_int(dest, size, pos); > + /* do not increment match count, etc! */ > + continue; > + default: > + shlim(f, 0); > + while (av_isspace(shgetc(f))); > + shunget(f); > + pos += shcnt(f); > + } > + > + shlim(f, width); > + if (shgetc(f) < 0) goto input_fail; > + shunget(f); > + > + switch (t) { > + case 's': > + case 'c': > + case '[': > + if (t == 'c' || t == 's') { > + memset(scanset, -1, sizeof scanset); > + scanset[0] = 0; > + if (t == 's') { > + scanset[1+'\t'] = 0; > + scanset[1+'\n'] = 0; > + scanset[1+'\v'] = 0; > + scanset[1+'\f'] = 0; > + scanset[1+'\r'] = 0; > + scanset[1+' '] = 0; > + } > + } else { > + if (*++p == '^') p++, invert = 1; > + else invert = 0; > + memset(scanset, invert, sizeof scanset); > + scanset[0] = 0; > + if (*p == '-') p++, scanset[1+'-'] = 1-invert; > + else if (*p == ']') p++, scanset[1+']'] = 1-invert; > + for (; *p != ']'; p++) { > + if (!*p) goto fmt_fail; > + if (*p=='-' && p[1] && p[1] != ']') > + for (c=p++[-1]; c<*p; c++) > + scanset[1+c] = 1-invert; > + scanset[1+*p] = 1-invert; > + } > + } > + s = 0; > + i = 0;
> + k = t=='c' ? width+1U : 31; k is set but not used [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Observe your enemies, for they first find out your faults. -- Antisthenes
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel