From 67e77e3b888858f45e20f02b129bb3c7d5497b2e Mon Sep 17 00:00:00 2001 From: "smparkes@smparkes.net" Date: Tue, 26 Jun 2012 17:30:48 +0000 Subject: [PATCH] update C++ changes for r2269 git-svn-id: https://zxing.googlecode.com/svn/trunk@2329 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- cpp/core/src/zxing/common/BitSource.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cpp/core/src/zxing/common/BitSource.cpp b/cpp/core/src/zxing/common/BitSource.cpp index d0ff48438..e3af37432 100644 --- a/cpp/core/src/zxing/common/BitSource.cpp +++ b/cpp/core/src/zxing/common/BitSource.cpp @@ -1,3 +1,4 @@ +// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- /* * BitSource.cpp * zxing @@ -19,15 +20,16 @@ */ #include +#include #include namespace zxing { int BitSource::readBits(int numBits) { - if (numBits < 0 || numBits > 32) { - throw IllegalArgumentException("cannot read <1 or >32 bits"); - } else if (numBits > available()) { - throw IllegalArgumentException("reading more bits than are available"); + if (numBits < 0 || numBits > 32 || numBits > available()) { + std::ostringstream oss; + oss << numBits; + throw IllegalArgumentException(oss.str().c_str()); } int result = 0;