From 484b47bc5d4531bb03857412a4eedc30e889dd66 Mon Sep 17 00:00:00 2001 From: "theraysmith@gmail.com" Date: Tue, 29 Apr 2014 04:30:47 +0000 Subject: [PATCH] Fixed tfscanf return value with * modifier git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@1087 d0cd1f9f-072b-0410-8dd7-cf729c803f20 --- ccutil/scanutils.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ccutil/scanutils.cpp b/ccutil/scanutils.cpp index 21220a02b..4708bbc65 100644 --- a/ccutil/scanutils.cpp +++ b/ccutil/scanutils.cpp @@ -399,11 +399,11 @@ static int tvfscanf(FILE* stream, const char *format, va_list ap) { break; } val = streamtoumax(stream, base); - converted++; // fall through set_integer: if (!(flags & FL_SPLAT)) { + converted++; switch(rank) { case RANK_CHAR: *va_arg(ap, unsigned char *) @@ -451,8 +451,8 @@ static int tvfscanf(FILE* stream, const char *format, va_list ap) { *va_arg(ap, float *) = static_cast(fval); else if (rank == RANK_LONG) *va_arg(ap, double *) = static_cast(fval); + converted++; } - converted++; } break; @@ -464,10 +464,11 @@ static int tvfscanf(FILE* stream, const char *format, va_list ap) { bail = BAIL_EOF; break; } - if (!(flags & FL_SPLAT)) *sarg++ = q; + if (!(flags & FL_SPLAT)) { + *sarg++ = q; + converted++; + } } - if (!bail) - converted++; break; case 's': // String