d3ee0c781e
Fix the following musl build failure: In file included from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/sysroot/usr/include/pthread.h:31, from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/include/c++/9.4.0/armeb-buildroot-linux-musleabi/bits/gthr-default.h:35, from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/include/c++/9.4.0/armeb-buildroot-linux-musleabi/bits/gthr.h:148, from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/include/c++/9.4.0/ext/atomicity.h:35, from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/include/c++/9.4.0/bits/basic_string.h:39, from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/include/c++/9.4.0/string:55, from Source/Utilities.h:44, from Source/FreeImage/PluginPSD.cpp:27: Source/FreeImage/PluginPSD.cpp: In function 'BOOL Save(FreeImageIO*, FIBITMAP*, fi_handle, int, int, void*)': Source/FreeImage/PluginPSD.cpp:130:10: error: cannot convert 'std::nullptr_t' to 'BOOL' {aka 'int'} in return 130 | return NULL; | ^~~~ Fixes: - http://autobuild.buildroot.org/results/f9c4ba83a506d374d8a28673aac619d8ff80f3da Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
95 lines
3.5 KiB
Diff
95 lines
3.5 KiB
Diff
fixed C++11 warnings
|
|
|
|
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
|
[Retrieved from: https://sourceforge.net/p/freeimage/svn/1896]
|
|
|
|
Index: trunk/Source/FreeImage/CacheFile.cpp
|
|
===================================================================
|
|
--- trunk/Source/FreeImage/CacheFile.cpp (révision 1895)
|
|
+++ trunk/Source/FreeImage/CacheFile.cpp (révision 1896)
|
|
@@ -147,10 +147,14 @@
|
|
m_current_block->data = new BYTE[BLOCK_SIZE];
|
|
|
|
fseek(m_file, m_current_block->nr * BLOCK_SIZE, SEEK_SET);
|
|
- fread(m_current_block->data, BLOCK_SIZE, 1, m_file);
|
|
-
|
|
- m_page_cache_mem.splice(m_page_cache_mem.begin(), m_page_cache_disk, it->second);
|
|
- m_page_map[nr] = m_page_cache_mem.begin();
|
|
+ if (fread(m_current_block->data, BLOCK_SIZE, 1, m_file) == 1) {
|
|
+ m_page_cache_mem.splice(m_page_cache_mem.begin(), m_page_cache_disk, it->second);
|
|
+ m_page_map[nr] = m_page_cache_mem.begin();
|
|
+ }
|
|
+ else {
|
|
+ FreeImage_OutputMessageProc(FIF_UNKNOWN, "Failed to lock a block in CacheFile");
|
|
+ return NULL;
|
|
+ }
|
|
}
|
|
|
|
// if the memory cache size is too large, swap an item to disc
|
|
Index: trunk/Source/FreeImage/MultiPage.cpp
|
|
===================================================================
|
|
--- trunk/Source/FreeImage/MultiPage.cpp (révision 1895)
|
|
+++ trunk/Source/FreeImage/MultiPage.cpp (révision 1896)
|
|
@@ -271,8 +271,8 @@
|
|
}
|
|
}
|
|
|
|
- std::auto_ptr<FIMULTIBITMAP> bitmap (new FIMULTIBITMAP);
|
|
- std::auto_ptr<MULTIBITMAPHEADER> header (new MULTIBITMAPHEADER);
|
|
+ std::unique_ptr<FIMULTIBITMAP> bitmap (new FIMULTIBITMAP);
|
|
+ std::unique_ptr<MULTIBITMAPHEADER> header (new MULTIBITMAPHEADER);
|
|
header->m_filename = filename;
|
|
// io is default
|
|
header->node = node;
|
|
@@ -339,8 +339,8 @@
|
|
PluginNode *node = list->FindNodeFromFIF(fif);
|
|
|
|
if (node) {
|
|
- std::auto_ptr<FIMULTIBITMAP> bitmap (new FIMULTIBITMAP);
|
|
- std::auto_ptr<MULTIBITMAPHEADER> header (new MULTIBITMAPHEADER);
|
|
+ std::unique_ptr<FIMULTIBITMAP> bitmap (new FIMULTIBITMAP);
|
|
+ std::unique_ptr<MULTIBITMAPHEADER> header (new MULTIBITMAPHEADER);
|
|
header->io = *io;
|
|
header->node = node;
|
|
header->fif = fif;
|
|
Index: trunk/Source/FreeImage/PSDParser.cpp
|
|
===================================================================
|
|
--- trunk/Source/FreeImage/PSDParser.cpp (révision 1895)
|
|
+++ trunk/Source/FreeImage/PSDParser.cpp (révision 1896)
|
|
@@ -97,7 +97,7 @@
|
|
template <int N>
|
|
class PSDGetValue {
|
|
public:
|
|
- static inline int get(const BYTE * iprBuffer) {} // error
|
|
+ static inline int get(const BYTE * iprBuffer) { return -1; } // error
|
|
};
|
|
|
|
template <>
|
|
Index: trunk/Source/FreeImage/PluginPSD.cpp
|
|
===================================================================
|
|
--- trunk/Source/FreeImage/PluginPSD.cpp (révision 1895)
|
|
+++ trunk/Source/FreeImage/PluginPSD.cpp (révision 1896)
|
|
@@ -127,7 +127,7 @@
|
|
static BOOL DLL_CALLCONV
|
|
Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data) {
|
|
if(!handle) {
|
|
- return NULL;
|
|
+ return FALSE;
|
|
}
|
|
try {
|
|
psdParser parser;
|
|
Index: trunk/Source/FreeImage/PluginHDR.cpp
|
|
===================================================================
|
|
--- trunk/Source/FreeImage/PluginHDR.cpp (révision 1895)
|
|
+++ trunk/Source/FreeImage/PluginHDR.cpp (révision 1896)
|
|
@@ -244,7 +244,8 @@
|
|
}
|
|
else if((buf[0] == '#') && (buf[1] == 0x20)) {
|
|
header_info->valid |= RGBE_VALID_COMMENT;
|
|
- strcpy(header_info->comment, buf);
|
|
+ strncpy(header_info->comment, buf, HDR_MAXLINE - 1);
|
|
+ header_info->comment[HDR_MAXLINE - 1] = '\0';
|
|
}
|
|
}
|
|
if(!bHeaderFound || !bFormatFound) {
|