On Tue, Sep 20, 2011 at 5:13 PM, Bollinger, John C <john.bollin...@stjude.org> wrote: > Hello All, > > As I wrote a few minutes ago, I am attempting to build PDFedit v 0.4.5 on > CentOS 5, using the distro's provided GCC 4.1.2 toolchain. The method > CPageContents::addInlineImage() is giving me some trouble, the bulk of which > I raised in my previous mail. In addition, however, I see some worrisome > warnings in the same method: > > g++ -c -g -O2 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fno-strict-aliasing > -fexceptions -fstack-protector -pipe -posix -ansi -std=c++98 -pedantic -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 cpagecontents.o cpagecontents.cc > cpagecontents.cc: In member function 'void > pdfobjects::CPageContents::addInlineImage(const std::vector<char, > std::allocator<char> >&, const libs::Point&, const libs::Point&)': > cpagecontents.cc:543: warning: passing 'const double' for argument 1 to > 'pdfobjects::CObjectSimple<Tp>::CObjectSimple(const typename > pdfobjects::PropertyTraitSimple<Tp>::value&) [with pdfobjects::PropertyType > Tp = pInt]' > [...] > cpagecontents.cc:544: warning: passing 'const double' for argument 1 to > 'pdfobjects::CObjectSimple<Tp>::CObjectSimple(const typename > pdfobjects::PropertyTraitSimple<Tp>::value&) [with pdfobjects::PropertyType > Tp = pInt]' > > These arise from the following two lines of code: > > image_dict.addProperty ("W", CInt (image_size.x)); > image_dict.addProperty ("H", CInt (image_size.y)); > > Evidently, image_size.x and image_size.y are of type (const double), but they > are passed to a constructor expecting an int&. I'm neither sure what is > needed, nor sure what actually happens here (and that in itself is a minor > problem). Given that we're dealing with references, however, I can't think > of an approach the compiler could take to the issue that would be likely to > have a satisfactory result. > > The most obvious fix would be to change the CInts to CReals, but I don't know > whether that would cause trouble elsewhere in the program.CInt > (static_cast<int>(image_size.x)) CInt (static_cast<int>(image_size.x)) and CInt (static_cast<int>(image_size.y)) ? Otherwise, you might need to change Tp to float or double (which seems like a lot more work).
Since PDFs are widely abused as vectors (and it is CentOS), you might want to verify image_size.x and image_size.y are within bounds of the [integer] data type if you choose to cast. numeric_limits is your friend. Jeff ------------------------------------------------------------------------------ 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 Pdfedit-support@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pdfedit-support