Skip to content
Browse files

Fix a few issues in test raised by the stricter gcc flags. Closes iss…

…ue 1085.

- Some of the cpp tests still fail to compile, but that's covered in issue 1066.
- I tweaked the SConscript to be a little happier with OS X and cppunit and imagemagick
in /opt/local.  These should be benign on other systems but let me know if they aren't
and I'll back tweak them or back them out.

git-svn-id: http://zxing.googlecode.com/svn/trunk@2057 59b500cc-1b3d-0410-9834-0bbf25fbcc57
  • Loading branch information...
1 parent c0633c6 commit 7891b1fb5cd9798dd5213c3f8d7c8df69cf84ce4 smparkes@smparkes.net committed Nov 30, 2011
View
9 cpp/SConscript
@@ -24,7 +24,7 @@ flags.append("-Wextra -Werror")
# flags.append("-pedantic")
compile_options['CXXFLAGS'] = ' '.join(flags)
-compile_options['LINKFLAGS'] = "-ldl"
+compile_options['LINKFLAGS'] = "-ldl -L/usr/lib -L/opt/local/lib"
def all_files(dir, ext='.cpp', level=6):
files = []
@@ -35,8 +35,9 @@ def all_files(dir, ext='.cpp', level=6):
magick_include = ['/usr/include/ImageMagick/', '/opt/local/include/ImageMagick/']
-magick_libs = ['Magick++', 'MagickWand', 'MagickCore']
+magick_libs = ['Magick++', 'MagickWand', 'MagickCore', 'iconv']
+cppunit_include = ['/opt/local/include/']
cppunit_libs = ['cppunit']
zxing_files = all_files('core/src')
@@ -45,10 +46,10 @@ zxing_include = ['core/src']
zxing_libs = env.Library('zxing', source=zxing_files, CPPPATH=zxing_include, **compile_options)
app_files = ['magick/src/MagickBitmapSource.cpp', 'magick/src/main.cpp']
-app_executable = env.Program('zxing', app_files, CPPPATH=magick_include + zxing_include, LIBS=magick_libs + zxing_libs, **compile_options)
+app_executable = env.Program('zxing', app_files, CPPPATH=magick_include + zxing_include, LIBS=zxing_libs + magick_libs, **compile_options)
test_files = all_files('core/tests/src')
-test_executable = env.Program('testrunner', test_files, CPPPATH=zxing_include, LIBS=zxing_libs + cppunit_libs, **compile_options)
+test_executable = env.Program('testrunner', test_files, CPPPATH=zxing_include + cppunit_include, LIBS=zxing_libs + cppunit_libs, **compile_options)
Alias('lib', zxing_libs)
View
2 cpp/core/tests/src/TestRunner.cpp
@@ -21,7 +21,7 @@
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>
-int main(int argc, char **argv) {
+int main(int, char**) {
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest(registry.makeTest());
View
8 cpp/core/tests/src/qrcode/decoder/DataMaskTest.cpp
@@ -1,7 +1,5 @@
+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
/*
- * DataMaskTest.cpp
- * zxing
- *
* Created by Christian Brunschen on 19/05/2008.
* Copyright 2008 ZXing authors All rights reserved.
*
@@ -36,15 +34,15 @@ class Mask0Condition : public MaskCondition {
class Mask1Condition : public MaskCondition {
public:
Mask1Condition() { }
- bool isMasked(int i, int j) {
+ bool isMasked(int i, int) {
return i % 2 == 0;
}
};
class Mask2Condition : public MaskCondition {
public:
Mask2Condition() { }
- bool isMasked(int i, int j) {
+ bool isMasked(int, int j) {
return j % 3 == 0;
}
};
View
2 cpp/magick/src/main.cpp
@@ -116,7 +116,7 @@ int test_image(Image& image, bool hybrid, string expected = "") {
res = -6;
if (!raw_dump) {
cout << (hybrid ? "Hybrid" : "Global") << " binarizer failed:\n";
- if (expected.length() >= 0) {
+ if (!expected.empty()) {
cout << " Expected: " << expected << "\n";
}
cout << " Detected: " << cell_result << endl;

0 comments on commit 7891b1f

Please sign in to comment.
Something went wrong with that request. Please try again.