| 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) { |