如何在x64上使用boost:gil:png_write_view避免此警告
How can I avoid this warning with boost:gil:png_write_view on x64
以下代码发出警告:
boost::gil::rgb8_image_t img(10, 10);
boost::gil::png_write_view("TenByTen.png", view(img));
当使用64位以下的VS 2010编译时。上面写着:
boostgilextensioniopng_io_private.hpp(341): warning C4244: 'argument' : conversion from '__int64' to 'png_uint_32', possible loss of data
boostgilextensioniopng_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。
似乎从(至少)Boost v1.35(例如。http://objectmix.com/c/733997-how-use-graphics.html#post2586573)。
检查Boost-trac数据库,我看到其他模块的类似票证,但没有GIL。也许最好的办法就是开一张新票。
同时,由于它看起来不是"灾难性的",您可以用这种方式包装#include
:
#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不允许您区分应用程序/头文件)
相关文章:
- 尝试链接我的着色器时,我收到错误代码"error c5145 must write to gl_position"
- 当客户端在 write() 期间终止连接时,由对等套接字错误重置连接
- 如何从未知视图中声明范围::v3::View 变量
- Qt 写入 xml: QIODevice::write (QFile, "D:/logs.xml" ): 设备未打开
- write() 和 read() 中几乎没有混淆
- OpenCV-contrib/Python/Windows:Tracker.write() 在 matrix_wrap.
- bsoncxx: document::view vs document::value
- asio::read() 需要很长时间,使用 asio::write 没有问题
- 封送指向结构异常"cannot Read or Write protected memory"的指针数组的指针数组
- BLE gattServer.write()重载函数
- C++ write(); 反向写入给定的字节值
- 在并行算法中使用 ranges::view::iota
- 使用 QFile::write 的正确方法?
- 复制 Simd::View 的一部分
- C++ UDP 广播使用 ::write
- 是否可以从从 QPrintPreviewDialog 调用的 QPrinter 对话框中删除"Write to PDF"?
- 为什么 fstream.read 和 fstream.write 使用 char 而不是无符号字符?
- 使用 insertion(<<) 运算符和 "write" 函数在 C++ 中显示数据有什么区别?
- 一次读取一个字符的文件,直到使用 read(2) 和 write(2) 换行符
- char* 如何读取十六进制的这个整数?它在 ostream::write() 中是如何工作的