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

David Bremner david at tethera.net
Wed Dec 14 15:20:20 PST 2011


On Thu, 15 Dec 2011 00:36:38 +0400, Dmitry Kurochkin <dmitry.kurochkin at 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.


More information about the notmuch mailing list