mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Antony Pavlov <antonynpavlov@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: picopng does not support big-endian CPUs
Date: Mon, 26 Jan 2015 08:58:25 +0100	[thread overview]
Message-ID: <20150126075825.GG12209@pengutronix.de> (raw)
In-Reply-To: <20150125222629.c52501c7d776cabf4317c82f@gmail.com>

On Sun, Jan 25, 2015 at 10:26:29PM +0400, Antony Pavlov wrote:
> Hi All!
> 
> Current lib/gui/picopng.c has problems on big-endian CPUs.
> 
> Here are two examples from PNG_readPngHeader():
> 
> 	if (*(uint64_t *) in != PNG_SIGNATURE) {
> ...
> 	if (*(uint32_t *) &in[12] != CHUNK_IHDR) {
> 
> 
> Using memcmp in this situation is much better, e.g.
> 
> +	uint8_t png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
> ...
> +	if (memcmp(in, png_signature, 8)) {
> 
> 
> +	uint8_t chunk_header[4] = {0x49, 0x48, 0x44, 0x52};
> ...
> +	if (memcmp(&in[12], chunk_header, 4)) {
> 
> 
> Current lodepng works fine on big-endian, but can we disable picopng
> in Kconfig for big-endian CPUs?

Can't we just fix it? Are there more difficult places than the ones
above? If it turns out to be difficult I'm fine with adding a dependency
to CPU_BIG_ENDIAN.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2015-01-26  7:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-25 18:26 Antony Pavlov
2015-01-26  7:58 ` Sascha Hauer [this message]
2015-01-26  9:06   ` Jean-Christophe PLAGNIOL-VILLARD

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=20150126075825.GG12209@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /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