Submitter | elson.wei@gmail.com |
---|---|
Date | Sept. 12, 2013, 6:35 a.m. |
Message ID | <323830f2c65ece0e6111.1378967758@ElsonWei-NB.PrimeVOLT> |
Download | mbox | patch |
Permalink | /patch/2429/ |
State | Rejected |
Headers | show |
Comments
On 2013-09-12 08:35, elson.wei@gmail.com wrote: > # HG changeset patch > # User Wei, Elson <elson.wei@gmail.com> > # Date 1378967736 -28800 > # Thu Sep 12 14:35:36 2013 +0800 > # Node ID 323830f2c65ece0e6111aae2b11d219d23b68d12 > # Parent d69e06724b96a985f29fd493a5dfe356a75af387 > parsers: use char instead of int8_t > > MS Windows SDK v7.0 doesn't have stdint.h in which int8_t is defined. > For compatibility, changes the type of "hextable" back to char[]. > > diff --git a/mercurial/parsers.c b/mercurial/parsers.c > --- a/mercurial/parsers.c > +++ b/mercurial/parsers.c > @@ -14,7 +14,7 @@ > > #include "util.h" > > -static int8_t hextable[256] = { > +static char hextable[256] = { > -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, > -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, > -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, > @@ -35,7 +35,7 @@ > > static inline int hexdigit(const char *p, Py_ssize_t off) > { > - int8_t val = hextable[(unsigned char)p[off]]; > + char val = hextable[(unsigned char)p[off]]; > > if (val >= 0) { > return val; Perhaps, this could be resolved by adding a typedef for int8_t to util.h, where we already have uint8_t (line 124).
On Thu, Sep 12, 2013 at 14:35:58 +0800, elson.wei@gmail.com wrote: > # HG changeset patch > # User Wei, Elson <elson.wei@gmail.com> > # Date 1378967736 -28800 > # Thu Sep 12 14:35:36 2013 +0800 > # Node ID 323830f2c65ece0e6111aae2b11d219d23b68d12 > # Parent d69e06724b96a985f29fd493a5dfe356a75af387 > parsers: use char instead of int8_t > > MS Windows SDK v7.0 doesn't have stdint.h in which int8_t is defined. > For compatibility, changes the type of "hextable" back to char[]. > That's going to break platforms where char is unsigned. Cheers, Julien
Patch
diff --git a/mercurial/parsers.c b/mercurial/parsers.c --- a/mercurial/parsers.c +++ b/mercurial/parsers.c @@ -14,7 +14,7 @@ #include "util.h" -static int8_t hextable[256] = { +static char hextable[256] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -35,7 +35,7 @@ static inline int hexdigit(const char *p, Py_ssize_t off) { - int8_t val = hextable[(unsigned char)p[off]]; + char val = hextable[(unsigned char)p[off]]; if (val >= 0) { return val;