From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Cc: "Rémi Rérolle" <remi.rerolle@gmail.com>, buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH 1/1] package/libfreeimage: fix musl build
Date: Sat, 28 May 2022 22:13:33 +0200 [thread overview]
Message-ID: <20220528201333.GJ301044@scaer> (raw)
In-Reply-To: <20220524172819.2361896-1-fontaine.fabrice@gmail.com>
Fabrice, All,
On 2022-05-24 19:28 +0200, Fabrice Fontaine spake thusly:
> 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>
Applied to master, thanks.
Regards,
Yann E. MORIN.
> ---
> .../0004-fixed-C-11-warnings.patch | 94 +++++++++++++++++++
> 1 file changed, 94 insertions(+)
> create mode 100644 package/libfreeimage/0004-fixed-C-11-warnings.patch
>
> diff --git a/package/libfreeimage/0004-fixed-C-11-warnings.patch b/package/libfreeimage/0004-fixed-C-11-warnings.patch
> new file mode 100644
> index 0000000000..cf9c47303a
> --- /dev/null
> +++ b/package/libfreeimage/0004-fixed-C-11-warnings.patch
> @@ -0,0 +1,94 @@
> +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) {
> --
> 2.35.1
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2022-05-28 20:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-24 17:28 [Buildroot] [PATCH 1/1] package/libfreeimage: fix musl build Fabrice Fontaine
2022-05-28 20:13 ` Yann E. MORIN [this message]
2022-06-06 10:17 ` Peter Korsgaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220528201333.GJ301044@scaer \
--to=yann.morin.1998@free.fr \
--cc=buildroot@buildroot.org \
--cc=fontaine.fabrice@gmail.com \
--cc=remi.rerolle@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox