mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Turn on more conservative warnings in C++ and a few related cleanups.
Not quite gcc -pedantic clean: there are some variable-length auto arrays that aren't standard C++. I don't want to touch those at this point. git-svn-id: https://zxing.googlecode.com/svn/trunk@2056 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
5e3fdcb31e
commit
06ac4a110d
|
@ -19,6 +19,10 @@ else:
|
|||
if env['PIC']:
|
||||
flags.append("-fPIC")
|
||||
|
||||
flags.append("-Wextra -Werror")
|
||||
# Can't enable unless we get rid of the dynamic variable length arrays
|
||||
# flags.append("-pedantic")
|
||||
|
||||
compile_options['CXXFLAGS'] = ' '.join(flags)
|
||||
compile_options['LINKFLAGS'] = "-ldl"
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
/*
|
||||
* BarcodeFormat.cpp
|
||||
* zxing
|
||||
*
|
||||
* Created by Christian Brunschen on 13/05/2008.
|
||||
* Copyright 2008 ZXing authors All rights reserved.
|
||||
*
|
||||
|
|
|
@ -35,6 +35,10 @@ bool LuminanceSource::isCropSupported() const {
|
|||
}
|
||||
|
||||
Ref<LuminanceSource> LuminanceSource::crop(int left, int top, int width, int height) {
|
||||
(void)left;
|
||||
(void)top;
|
||||
(void)width;
|
||||
(void)height;
|
||||
throw IllegalArgumentException("This luminance source does not support cropping.");
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ int WhiteRectangleDetector::CORR = 1;
|
|||
WhiteRectangleDetector::WhiteRectangleDetector(Ref<BitMatrix> image) : image_(image) {
|
||||
width_ = image->getWidth();
|
||||
height_ = image->getHeight();
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
/*
|
||||
* DataMatrixReader.cpp
|
||||
* zxing
|
||||
|
@ -32,6 +33,7 @@ DataMatrixReader::DataMatrixReader() :
|
|||
}
|
||||
|
||||
Ref<Result> DataMatrixReader::decode(Ref<BinaryBitmap> image, DecodeHints hints) {
|
||||
(void)hints;
|
||||
#ifdef DEBUG
|
||||
cout << "decoding image " << image.object_ << ":\n" << flush;
|
||||
#endif
|
||||
|
|
|
@ -25,6 +25,11 @@ namespace zxing{
|
|||
namespace multi {
|
||||
using namespace zxing::qrcode;
|
||||
|
||||
const float MultiFinderPatternFinder::MAX_MODULE_COUNT_PER_EDGE = 180;
|
||||
const float MultiFinderPatternFinder::MIN_MODULE_COUNT_PER_EDGE = 9;
|
||||
const float MultiFinderPatternFinder::DIFF_MODSIZE_CUTOFF_PERCENT = 0.05f;
|
||||
const float MultiFinderPatternFinder::DIFF_MODSIZE_CUTOFF = 0.5f;
|
||||
|
||||
bool compareModuleSize(Ref<FinderPattern> a, Ref<FinderPattern> b){
|
||||
float value = a->getEstimatedModuleSize() - b->getEstimatedModuleSize();
|
||||
return value < 0.0;
|
||||
|
|
|
@ -27,10 +27,10 @@ class MultiFinderPatternFinder : zxing::qrcode::FinderPatternFinder {
|
|||
private:
|
||||
std::vector<std::vector<Ref<zxing::qrcode::FinderPattern> > > selectBestPatterns();
|
||||
|
||||
static const float MAX_MODULE_COUNT_PER_EDGE = 180;
|
||||
static const float MIN_MODULE_COUNT_PER_EDGE = 9;
|
||||
static const float DIFF_MODSIZE_CUTOFF_PERCENT = 0.05f;
|
||||
static const float DIFF_MODSIZE_CUTOFF = 0.5f;
|
||||
static const float MAX_MODULE_COUNT_PER_EDGE;
|
||||
static const float MIN_MODULE_COUNT_PER_EDGE;
|
||||
static const float DIFF_MODSIZE_CUTOFF_PERCENT;
|
||||
static const float DIFF_MODSIZE_CUTOFF;
|
||||
|
||||
public:
|
||||
MultiFinderPatternFinder(Ref<BitMatrix> image, Ref<ResultPointCallback> resultPointCallback);
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
#ifndef __CODE_128_READER_H__
|
||||
#define __CODE_128_READER_H__
|
||||
/*
|
||||
* Code128Reader.h
|
||||
* ZXing
|
||||
*
|
||||
* Copyright 2010 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -28,10 +26,8 @@ namespace zxing {
|
|||
class Code128Reader : public OneDReader {
|
||||
|
||||
private:
|
||||
//static const unsigned int MAX_AVG_VARIANCE = (unsigned int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.25f);
|
||||
enum {MAX_AVG_VARIANCE = (unsigned int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.25f)};
|
||||
//static const int MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.7f);
|
||||
enum {MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.7f)};
|
||||
enum {MAX_AVG_VARIANCE = (unsigned int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 250/1000)};
|
||||
enum {MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 700/1000)};
|
||||
static const int CODE_SHIFT = 98;
|
||||
|
||||
static const int CODE_CODE_C = 99;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
/*
|
||||
* EAN13Reader.cpp
|
||||
* ZXing
|
||||
*
|
||||
* Copyright 2010 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -31,6 +29,7 @@ namespace zxing {
|
|||
|
||||
int EAN13Reader::decodeMiddle(Ref<BitArray> row, int startGuardBegin, int startGuardEnd,
|
||||
std::string& resultString) {
|
||||
(void)startGuardBegin;
|
||||
const int countersLen = 4;
|
||||
int counters[countersLen] = { 0, 0, 0, 0 };
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
/*
|
||||
* EAN8Reader.cpp
|
||||
* ZXing
|
||||
*
|
||||
* Copyright 2010 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -27,6 +25,7 @@ namespace zxing {
|
|||
|
||||
int EAN8Reader::decodeMiddle(Ref<BitArray> row, int startGuardBegin, int startGuardEnd,
|
||||
std::string& resultString){
|
||||
(void)startGuardBegin;
|
||||
const int countersLen = 4;
|
||||
int counters[countersLen] = { 0, 0, 0, 0 };
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
/*
|
||||
* ITFReader.cpp
|
||||
* ZXing
|
||||
*
|
||||
* Copyright 2010 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -240,6 +238,8 @@ namespace zxing {
|
|||
* @throws ReaderException if the quiet zone cannot be found, a ReaderException is thrown.
|
||||
*/
|
||||
void ITFReader::validateQuietZone(Ref<BitArray> row, int startPattern) {
|
||||
(void)row;
|
||||
(void)startPattern;
|
||||
//#pragma mark needs some corrections
|
||||
// int quietCount = narrowLineWidth * 10; // expect to find this many pixels of quiet zone
|
||||
//
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
#ifndef __ITF_READER_H__
|
||||
#define __ITF_READER_H__
|
||||
|
||||
/*
|
||||
* ITFReader.h
|
||||
* ZXing
|
||||
*
|
||||
* Copyright 2010 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -29,10 +27,8 @@ namespace zxing {
|
|||
class ITFReader : public OneDReader {
|
||||
|
||||
private:
|
||||
//static const unsigned int MAX_AVG_VARIANCE = (unsigned int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.42f);
|
||||
enum {MAX_AVG_VARIANCE = (unsigned int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.42f)};
|
||||
//static const int MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.8f);
|
||||
enum {MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.8f)};
|
||||
enum {MAX_AVG_VARIANCE = (unsigned int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 420/1000)};
|
||||
enum {MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 800/1000)};
|
||||
// Stores the actual narrow line width of the image being decoded.
|
||||
int narrowLineWidth;
|
||||
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
#ifndef __UPC_EAN_READER_H__
|
||||
#define __UPC_EAN_READER_H__
|
||||
|
||||
/*
|
||||
* UPCEANReader.h
|
||||
* ZXing
|
||||
*
|
||||
* Copyright 2010 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -34,10 +32,8 @@ namespace zxing {
|
|||
class UPCEANReader : public OneDReader {
|
||||
|
||||
private:
|
||||
//static const unsigned int MAX_AVG_VARIANCE = (unsigned int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.42f);
|
||||
enum {MAX_AVG_VARIANCE = (unsigned int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.42f)};
|
||||
//static const int MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.7f);
|
||||
enum {MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.7f)};
|
||||
enum {MAX_AVG_VARIANCE = (unsigned int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 420/1000)};
|
||||
enum {MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 700/1000)};
|
||||
|
||||
static bool findStartGuardPattern(Ref<BitArray> row, int* rangeStart, int* rangeEnd);
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
/*
|
||||
* UPCEReader.cpp
|
||||
* ZXing
|
||||
*
|
||||
* Copyright 2010 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -44,6 +42,7 @@ namespace zxing {
|
|||
|
||||
int UPCEReader::decodeMiddle(Ref<BitArray> row, int startGuardBegin, int startGuardEnd,
|
||||
std::string& resultString) {
|
||||
(void)startGuardBegin;
|
||||
const int countersLen = 4;
|
||||
int counters[countersLen] = { 0, 0, 0, 0 };
|
||||
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
#define __UPC_E_READER_H__
|
||||
|
||||
/*
|
||||
* UPCEReader.h
|
||||
* ZXing
|
||||
*
|
||||
* Copyright 2010 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
*/
|
||||
class DataMask001 : public DataMask {
|
||||
public:
|
||||
bool isMasked(size_t x, size_t y) {
|
||||
bool isMasked(size_t x, size_t) {
|
||||
// return (x & 0x01) == 0;
|
||||
return (x % 2) == 0;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public:
|
|||
*/
|
||||
class DataMask010 : public DataMask {
|
||||
public:
|
||||
bool isMasked(size_t x, size_t y) {
|
||||
bool isMasked(size_t, size_t y) {
|
||||
return y % 3 == 0;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
/*
|
||||
* QREdgeDetector.cpp
|
||||
* zxing
|
||||
*
|
||||
* Created by Ralf Kistner on 7/12/2009.
|
||||
* Copyright 2008 ZXing authors All rights reserved.
|
||||
*
|
||||
|
@ -61,6 +59,7 @@ Ref<PerspectiveTransform> QREdgeDetector::createTransform(Ref<ResultPoint> topLe
|
|||
|
||||
|
||||
Point QREdgeDetector::findCorner(const BitMatrix& image, Point topLeft, Point topRight, Point bottomLeft, int dimension) {
|
||||
(void)dimension;
|
||||
Point bottomRight = guessLastPattern(topLeft, topRight, bottomLeft);
|
||||
|
||||
Line bottomEst = findPatternEdge(image, bottomLeft, topLeft, bottomRight, false);
|
||||
|
|
Loading…
Reference in a new issue