mirror of
https://github.com/zxing/zxing.git
synced 2025-02-02 05:41:08 -08:00
update
C++ changes for r2269 git-svn-id: https://zxing.googlecode.com/svn/trunk@2329 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
53e6b62f9f
commit
67e77e3b88
|
@ -1,3 +1,4 @@
|
||||||
|
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||||
/*
|
/*
|
||||||
* BitSource.cpp
|
* BitSource.cpp
|
||||||
* zxing
|
* zxing
|
||||||
|
@ -19,15 +20,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <zxing/common/BitSource.h>
|
#include <zxing/common/BitSource.h>
|
||||||
|
#include <sstream>
|
||||||
#include <zxing/common/IllegalArgumentException.h>
|
#include <zxing/common/IllegalArgumentException.h>
|
||||||
|
|
||||||
namespace zxing {
|
namespace zxing {
|
||||||
|
|
||||||
int BitSource::readBits(int numBits) {
|
int BitSource::readBits(int numBits) {
|
||||||
if (numBits < 0 || numBits > 32) {
|
if (numBits < 0 || numBits > 32 || numBits > available()) {
|
||||||
throw IllegalArgumentException("cannot read <1 or >32 bits");
|
std::ostringstream oss;
|
||||||
} else if (numBits > available()) {
|
oss << numBits;
|
||||||
throw IllegalArgumentException("reading more bits than are available");
|
throw IllegalArgumentException(oss.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
Loading…
Reference in a new issue