From 5b4db6b70ff599bcf79fdef642fc93fd96c5bddc Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Sun, 7 Aug 2022 09:11:05 +0200 Subject: [PATCH] package/libfreeimage: fix patch CRLF line endings libfreeimage is a mixed CRLF-LF source code. The patch introduced by commit d3ee0c781e44 (package/libfreeimage: fix musl build) was missing the CRLF where they were needed (because patchwork mangles them?). Fix the three hunks in two files that have the issue. Reported-by: Giulio Benetti Signed-off-by: Yann E. MORIN --- .../0004-fixed-C-11-warnings.patch | 76 +++++++++---------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/package/libfreeimage/0004-fixed-C-11-warnings.patch b/package/libfreeimage/0004-fixed-C-11-warnings.patch index 449af621d0..cf9c47303a 100644 --- a/package/libfreeimage/0004-fixed-C-11-warnings.patch +++ b/package/libfreeimage/0004-fixed-C-11-warnings.patch @@ -8,50 +8,50 @@ 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 + 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 bitmap (new FIMULTIBITMAP); -- std::auto_ptr header (new MULTIBITMAPHEADER); -+ std::unique_ptr bitmap (new FIMULTIBITMAP); -+ std::unique_ptr header (new MULTIBITMAPHEADER); - header->m_filename = filename; - // io is default - header->node = node; + } + } + +- std::auto_ptr bitmap (new FIMULTIBITMAP); +- std::auto_ptr header (new MULTIBITMAPHEADER); ++ std::unique_ptr bitmap (new FIMULTIBITMAP); ++ std::unique_ptr 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 bitmap (new FIMULTIBITMAP); -- std::auto_ptr header (new MULTIBITMAPHEADER); -+ std::unique_ptr bitmap (new FIMULTIBITMAP); -+ std::unique_ptr header (new MULTIBITMAPHEADER); - header->io = *io; - header->node = node; - header->fif = fif; + PluginNode *node = list->FindNodeFromFIF(fif); + + if (node) { +- std::auto_ptr bitmap (new FIMULTIBITMAP); +- std::auto_ptr header (new MULTIBITMAPHEADER); ++ std::unique_ptr bitmap (new FIMULTIBITMAP); ++ std::unique_ptr 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)