1

以下代码发出警告:

boost::gil::rgb8_image_t img(10, 10);
boost::gil::png_write_view("TenByTen.png", view(img));

在 64 位下使用 VS 2010 编译时。它说:

\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)。

有人知道我能做些什么吗?我猜 boost:gil 应该在 64 位下工作。

我使用升压 1_50。

4

1 回答 1

0

似乎从(至少)Boost v1.35(例如http://objectmix.com/c/733997-how-use-graphics.html#post2586573)中可以知道具体问题。

检查Boost trac 数据库我看到其他模块的类似票证,但 GIL 没有。可能最好的事情是打开一张新票。

同时,由于它看起来不是“灾难性的”,你可以用#include这种方式包装 (s):

#ifdef _MSC_VER
#  pragma warning(push)
#  pragma warning(disable: 4244)  // Perhaps also 4100, 4127, 4512
// GIL headers
#  pragma warning(pop)
#endif

另请参阅如何:针对特定 C/C++ 警告启用和禁用代码分析

(使用 clang/gcc 你有-isystem开关,但我不认为 Visual Studio 让你区分应用程序/头文件)

于 2014-10-20T14:17:27.773 回答