From 42c305c79bb4d486d55519dbe1a7de12b8c3b02e Mon Sep 17 00:00:00 2001 From: zimoch Date: Tue, 15 May 2012 09:20:22 +0000 Subject: [PATCH] Skip leading whitespaces only if neither 0 nor 1 are whitespaces. --- src/BinaryConverter.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/BinaryConverter.cc b/src/BinaryConverter.cc index cab0b2e..7645ce9 100644 --- a/src/BinaryConverter.cc +++ b/src/BinaryConverter.cc @@ -130,9 +130,10 @@ scanLong(const StreamFormat& format, const char* input, long& value) int width = format.width; if (width == 0) width = -1; int length = 0; - while (isspace(input[length])) length++; // skip whitespaces char zero = format.info[0]; char one = format.info[1]; + if (!isspace(zero) && !isspace(one)) + while (isspace(input[length])) length++; // skip whitespaces if (input[length] != zero && input[length] != one) return -1; if (format.flags & alt_flag) {