From: Michal H. <ms...@gm...> - 2011-09-22 17:22:15
|
On Thu, Sep 22, 2011 at 12:04:14PM -0500, Bollinger, John C wrote: > > Still being unable to access the PDFedit bug tracker, I hope this is a > reasonable location to offer one more bug report (and a patch). > > While attempting to build the 0.4.5 tools on CentOS 5 / x86_64 using > the distro's standard CGG 4.1.2 toolchain, I receive the following > compilation error: > > g++ -c -g -O2 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fno-strict-aliasing -fexceptions -fstack-protector -pipe -posix -ansi -std=c++98 -I. -I/home/jbolling/rpm/BUILD/pdfedit-0.4.5/src -I/home/jbolling/rpm/BUILD/pdfedit-0.4.5/src/xpdf/ -I/usr/include -I/usr/include/freetype2 -I/usr/include -o replace_text.o replace_text.cc > replace_text.cc: In function 'int main(int, char**)': > replace_text.cc:140: error: no matching function for call to 'min(size_t&, unsigned int)' Yet another gcc 4.1 issue, I would say. > > The source line in question is the innocuous looking: > > to = std::min(to, pdf->getPageCount()+1); > > The problem is that 'to' has type size_t, whereas pdf->getPageCount() > has type unsigned int, and these are not equivalent in the compilation > environment. (size_t is a 64-bit unsigned integer, whereas unsigned > int is only 32 bits wide.) This is already fixed in the CVS as: to = std::min(static_cast<unsigned int>(to), pdf->getPageCount()+1); > The problem could, and perhaps should, be fixed by changing the > data type of one or the other of these expressions so that they are > compatible, but a quick and not-too-dirty solution is to just do this: > > diff -Naur pdfedit-0.4.5-base/src/tools/replace_text.cc pdfedit-0.4.5-mod/src/tools/replace_text.cc > --- pdfedit-0.4.5-base/src/tools/replace_text.cc 2010-02-23 12:28:09.000000000 -0600 > +++ pdfedit-0.4.5-mod/src/tools/replace_text.cc 2011-09-22 11:20:19.000000000 -0500 > @@ -137,7 +137,7 @@ > > > // sane values > - to = std::min(to, pdf->getPageCount()+1); > + to = std::min(to, static_cast<size_t>(pdf->getPageCount()+1)); > > // now the hard stuff comes - do this crazy loops intentionally > for (size_t things_to_replace = 0; things_to_replace < withs.size(); ++things_to_replace) > === end of patch === > > > Best, > > John Bollinger > > > Email Disclaimer: www.stjude.org/emaildisclaimer > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > Pdfedit-support mailing list > Pdf...@li... > https://lists.sourceforge.net/lists/listinfo/pdfedit-support -- Michal Hocko |