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
|
||||
* zxing
|
||||
|
@ -19,15 +20,16 @@
|
|||
*/
|
||||
|
||||
#include <zxing/common/BitSource.h>
|
||||
#include <sstream>
|
||||
#include <zxing/common/IllegalArgumentException.h>
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue