From 886b70e167bafd1a7f1d3790010c4de0b958be94 Mon Sep 17 00:00:00 2001 From: "dswitkin@google.com" Date: Wed, 25 Aug 2010 19:03:32 +0000 Subject: [PATCH] Minor formatting cleanup. git-svn-id: https://zxing.googlecode.com/svn/trunk@1562 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- cpp/core/src/zxing/common/BitArray.cpp | 15 +++++++++++++-- cpp/core/src/zxing/common/BitMatrix.cpp | 4 +--- .../src/zxing/common/GlobalHistogramBinarizer.cpp | 4 +--- cpp/core/src/zxing/oned/UPCEANReader.cpp | 2 +- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/cpp/core/src/zxing/common/BitArray.cpp b/cpp/core/src/zxing/common/BitArray.cpp index 6ba7fd22f..e5bfb5b32 100644 --- a/cpp/core/src/zxing/common/BitArray.cpp +++ b/cpp/core/src/zxing/common/BitArray.cpp @@ -2,8 +2,7 @@ * BitArray.cpp * zxing * - * Created by Christian Brunschen on 09/05/2008. - * Copyright 2008 Google UK. All rights reserved. + * Copyright 2010 ZXing authors. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +24,7 @@ using namespace std; namespace zxing { + static unsigned int logDigits(unsigned digits) { unsigned log = 0; unsigned val = 1; @@ -34,9 +34,11 @@ static unsigned int logDigits(unsigned digits) { } return log; } + const unsigned int BitArray::bitsPerWord_ = numeric_limits::digits; const unsigned int BitArray::logBits_ = logDigits(bitsPerWord_); const unsigned int BitArray::bitsMask_ = (1 << logBits_) - 1; + size_t BitArray::wordsForBits(size_t bits) { int arraySize = bits >> logBits_; if (bits - (arraySize << logBits_) != 0) { @@ -48,26 +50,33 @@ size_t BitArray::wordsForBits(size_t bits) { BitArray::BitArray(size_t size) : size_(size), bits_(wordsForBits(size), (const unsigned int)0) { } + BitArray::~BitArray() { } + size_t BitArray::getSize() { return size_; } + bool BitArray::get(size_t i) { return (bits_[i >> logBits_] & (1 << (i & bitsMask_))) != 0; } + void BitArray::set(size_t i) { bits_[i >> logBits_] |= 1 << (i & bitsMask_); } + void BitArray::setBulk(size_t i, unsigned int newBits) { bits_[i >> logBits_] = newBits; } + void BitArray::clear() { size_t max = bits_.size(); for (size_t i = 0; i < max; i++) { bits_[i] = 0; } } + bool BitArray::isRange(size_t start, size_t end, bool value) { if (end < start) { throw IllegalArgumentException("end must be after start"); @@ -103,9 +112,11 @@ bool BitArray::isRange(size_t start, size_t end, bool value) { } return true; } + vector& BitArray::getBitArray() { return bits_; } + void BitArray::reverse() { std::vector newBits(bits_.size(),(const unsigned int) 0); for (size_t i = 0; i < size_; i++) { diff --git a/cpp/core/src/zxing/common/BitMatrix.cpp b/cpp/core/src/zxing/common/BitMatrix.cpp index 6fea10498..afb5d42e3 100644 --- a/cpp/core/src/zxing/common/BitMatrix.cpp +++ b/cpp/core/src/zxing/common/BitMatrix.cpp @@ -2,8 +2,7 @@ * BitMatrix.cpp * zxing * - * Created by Christian Brunschen on 12/05/2008. - * Copyright 2008 Google UK. All rights reserved. + * Copyright 2010 ZXing authors. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +37,6 @@ unsigned int logDigits(unsigned digits) { return log; } - const unsigned int bitsPerWord = numeric_limits::digits; const unsigned int logBits = logDigits(bitsPerWord); const unsigned int bitsMask = (1 << logBits) - 1; diff --git a/cpp/core/src/zxing/common/GlobalHistogramBinarizer.cpp b/cpp/core/src/zxing/common/GlobalHistogramBinarizer.cpp index cb7654f84..10d20d9ad 100644 --- a/cpp/core/src/zxing/common/GlobalHistogramBinarizer.cpp +++ b/cpp/core/src/zxing/common/GlobalHistogramBinarizer.cpp @@ -2,9 +2,7 @@ * GlobalHistogramBinarizer.cpp * zxing * - * Created by Ralf Kistner on 16/10/2009. - * Copyright 2008 ZXing authors All rights reserved. - * Modified by Lukasz Warchol on 02/02/2010. + * Copyright 2010 ZXing authors. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cpp/core/src/zxing/oned/UPCEANReader.cpp b/cpp/core/src/zxing/oned/UPCEANReader.cpp index 6f08e750c..76defafd7 100644 --- a/cpp/core/src/zxing/oned/UPCEANReader.cpp +++ b/cpp/core/src/zxing/oned/UPCEANReader.cpp @@ -40,7 +40,7 @@ namespace zxing { */ const int L_PATTERNS_LEN = 10; const int L_PATTERNS_SUB_LEN = 4; - const int L_PATTERNS[10][4] = { + const int L_PATTERNS[L_PATTERNS_LEN][L_PATTERNS_SUB_LEN] = { {3, 2, 1, 1}, // 0 {2, 2, 2, 1}, // 1 {2, 1, 2, 2}, // 2