以下代码发出警告:
boost::gil::rgb8_image_t img(10, 10);
boost::gil::png_write_view("TenByTen.png", view(img));
使用VS 2010在64位下编译时。它说:
\boost\gil\extension\io\png_io_private.hpp(341): warning C4244: 'argument' : conversion from '__int64' to 'png_uint_32', possible loss of data
\boost\gil\extension\io\png_io.hpp(202) : see reference to function template instantiation 'void boost::gil::detail::png_writer::apply<View>(const View &)' being compiled
with
[
View=boost::gil::image_view<boost::gil::rgb8_loc_t>
]
main.cpp(20) : see reference to function template instantiation 'void boost::gil::png_write_view<boost::gil::image_view<Loc>>(const char *,const View &)' being compiled
with
[
Loc=boost::gil::rgb8_loc_t,
View=boost::gil::image_view<boost::gil::rgb8_loc_t>
]
似乎很明显,在apply()中,对png_set_IHDR()的调用应该给出一个png_uint_32,但是view.width()似乎是一个带符号的__int64(可能是一个ptrdiff_t)。
有人知道我能做些什么吗? 我想这个提升:gil意味着在64位下工作。
我使用boost 1_50。
答案 0 :(得分:0)
似乎从(至少)Boost v1.35(例如http://objectmix.com/c/733997-how-use-graphics.html#post2586573)知道具体问题。
检查Boost trac database我看到其他模块的类似门票但GIL没有。 可能最好的事情是打开一张新票。
与此同时,由于它似乎不是“灾难性的”,你可以用这种方式包裹#include
:
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4244) // Perhaps also 4100, 4127, 4512
// GIL headers
# pragma warning(pop)
#endif
另见How to: Enable and Disable Code Analysis for Specific C/C++ Warnings
(使用clang / gcc你有-isystem
开关,但我认为Visual Studio不允许你区分应用程序/头文件)