bug-ocrad
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-ocrad] Version 0.21-pre1 of GNU Ocrad released


From: Antonio Diaz Diaz
Subject: Re: [Bug-ocrad] Version 0.21-pre1 of GNU Ocrad released
Date: Sat, 21 Aug 2010 18:42:30 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.7.11) Gecko/20050905

Hello Tilman,

Tilman Hausherr wrote:
- The crashes seem to be solved, i.e. the problem-images don't crash. I
did not look into the source to check whether you used my "symptom"
fixes or made your own or both, because you certainly know what you're
doing.

I have really fixed them, not only the symptoms. Of course, some of those fixes can be further improved.


Another change you might want to make is to start to eliminate some
warnings:

What warnings?
---------------------------
$ ./configure CXXFLAGS='-Wall -W -O2 --pedantic -Wno-long-long'

creating config.status
creating Makefile
VPATH = .
prefix = /usr/local
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
datadir = $(prefix)/share
includedir = ${prefix}/include
infodir = $(datadir)/info
libdir = ${exec_prefix}/lib
mandir = $(datadir)/man
sysconfdir = $(prefix)/etc
CXX = g++
CPPFLAGS =
CXXFLAGS = -Wall -W -O2 --pedantic -Wno-long-long
LDFLAGS =
OK. Now you can run make.
$ make check 2>&1 | tee x
g++  -Wall -W -O2 --pedantic -Wno-long-long -c -o common.o common.cc
g++  -Wall -W -O2 --pedantic -Wno-long-long -c -o mask.o mask.cc
g++  -Wall -W -O2 --pedantic -Wno-long-long -c -o rational.o rational.cc
g++  -Wall -W -O2 --pedantic -Wno-long-long -c -o rectangle.o rectangle.cc
g++  -Wall -W -O2 --pedantic -Wno-long-long -c -o track.o track.cc
g++  -Wall -W -O2 --pedantic -Wno-long-long -c -o ucs.o ucs.cc
g++  -Wall -W -O2 --pedantic -Wno-long-long -c -o page_image.o page_image.cc
g++ -Wall -W -O2 --pedantic -Wno-long-long -c -o page_image_io.o page_image_io.cc
g++  -Wall -W -O2 --pedantic -Wno-long-long -c -o bitmap.o bitmap.cc
g++  -Wall -W -O2 --pedantic -Wno-long-long -c -o blob.o blob.cc
g++  -Wall -W -O2 --pedantic -Wno-long-long -c -o profile.o profile.cc
g++  -Wall -W -O2 --pedantic -Wno-long-long -c -o feats.o feats.cc
g++ -Wall -W -O2 --pedantic -Wno-long-long -c -o feats_test0.o feats_test0.cc g++ -Wall -W -O2 --pedantic -Wno-long-long -c -o feats_test1.o feats_test1.cc
g++  -Wall -W -O2 --pedantic -Wno-long-long -c -o character.o character.cc
g++ -Wall -W -O2 --pedantic -Wno-long-long -c -o character_r11.o character_r11.cc g++ -Wall -W -O2 --pedantic -Wno-long-long -c -o character_r12.o character_r12.cc g++ -Wall -W -O2 --pedantic -Wno-long-long -c -o character_r13.o character_r13.cc
g++  -Wall -W -O2 --pedantic -Wno-long-long -c -o textline.o textline.cc
g++ -Wall -W -O2 --pedantic -Wno-long-long -c -o textline_r2.o textline_r2.cc
g++  -Wall -W -O2 --pedantic -Wno-long-long -c -o textblock.o textblock.cc
g++  -Wall -W -O2 --pedantic -Wno-long-long -c -o textpage.o textpage.cc
g++  -Wall -W -O2 --pedantic -Wno-long-long -c -o arg_parser.o arg_parser.cc
g++ -Wall -W -O2 --pedantic -Wno-long-long -DPROGVERSION=\"0.21-pre1\" -c -o main.o main.cc g++ -o ocrad common.o mask.o rational.o rectangle.o track.o ucs.o page_image.o page_image_io.o bitmap.o blob.o profile.o feats.o feats_test0.o feats_test1.o character.o character_r11.o character_r12.o character_r13.o textline.o textline_r2.o textblock.o textpage.o arg_parser.o main.o
g++  -Wall -W -O2 --pedantic -Wno-long-long -c -o ocradlib.o ocradlib.cc
ar -rcs libocrad.a common.o mask.o rational.o rectangle.o track.o ucs.o page_image.o page_image_io.o bitmap.o blob.o profile.o feats.o feats_test0.o feats_test1.o character.o character_r11.o character_r12.o character_r13.o textline.o textline_r2.o textblock.o textpage.o ocradlib.o g++ -Wall -W -O2 --pedantic -Wno-long-long -DPROGVERSION=\"0.21-pre1\" -c -o ocrcheck.o ocrcheck.cc
g++  -o ocrcheck ocrcheck.o libocrad.a
testing ocrad-0.21-pre1.........................................................................................................................................
tests completed successfully.
$
---------------------------


replace
        const double cmom_max = cmom[maxval];
with
        const double cmom_max = (double) cmom[maxval];

Didn't the authors of your compiler ever heard about implicit type conversion?
http://en.wikipedia.org/wiki/Type_conversion#Implicit_type_conversion


there are more warnings (especially when compiling for 64bit, because
you're not using size_t type for numbers based on sizes), but this is a
small start.

No, this is the end. I do not plan to use size_t, off_t and the like anytime soon. In page_image_io.cc (line 247) I verify that the number of pixels in the image is no larger than INT_MAX and then I use int for all sizes, avoiding more conversion issues while being sure that overflows won't happen.

On projects where 32 bit sizes are not enough I simply use long long instead of int.


While most warnings are just that, they "mask" warnings
that might really have a meaning, and they're scary for newbies.

Then, please, show me the warnings with real meaning. About the newbies, I hope they get scared enough as to migrate to GCC or even to GNU/Linux. :-)


Regards,
Antonio.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]