Re: [Alpha Patch 2/2] test: update dump-restore tests for 8 bit characters.

Subject: Re: [Alpha Patch 2/2] test: update dump-restore tests for 8 bit characters.

Date: Wed, 14 Dec 2011 19:20:20 -0400

To: Dmitry Kurochkin, notmuch@notmuchmail.org

Cc: pere@hungry.com

From: David Bremner


On Thu, 15 Dec 2011 00:36:38 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> 
> I did not do a proper review.  But I think the encoder and decoder
> should accept and return the same type, either char* or unsigned char*.
> The decision should be based on what type strings (that would be fed to
> the encoder and decoder) have in notmuch code.  I guess it is char*, so
> the encoder and decoder should take and return char*.  Internally we
> would cast char* to unsigned char*.

After staring at the draft C99 standard a bit, I'm inclined to agree. I
think char is the generic, which to my horror is really either unsigned
char or signed char is an implementation dependent way.

The info I was missing was in the description of <string.h>

,----
| 3 For all functions in this subclause, each character shall be interpreted as if it had the type
|  unsigned char (and therefore every possible object representation is valid and has a
| different value).
`----

I'll fix this in git, but I probably won't bother with another round of
patches yet.

Thread: