]> granicus.if.org Git - graphviz/commitdiff
Fixed ID type for Win64
authorAndreas Pehnack <andreas@synalysis.com>
Wed, 4 Feb 2015 20:43:51 +0000 (21:43 +0100)
committerAndreas Pehnack <andreas@synalysis.com>
Wed, 4 Feb 2015 20:43:51 +0000 (21:43 +0100)
13 files changed:
lib/cgraph/agxbuf.c
lib/cgraph/agxbuf.h
lib/cgraph/cghdr.h
lib/cgraph/cgraph.h
lib/cgraph/edge.c
lib/cgraph/graph.c
lib/cgraph/id.c
lib/cgraph/imap.c
lib/cgraph/node.c
lib/cgraph/obj.c
lib/cgraph/pend.c
lib/cgraph/subg.c
lib/cgraph/write.c

index c12ab6558d16f230a7ee9f66fe845e3fc4dd6be8..3b2bd3a7cfee923ce242a65b67a5cc7b26f9b0a9 100644 (file)
@@ -41,11 +41,11 @@ void agxbinit(agxbuf * xb, unsigned int hint, unsigned char *init)
 /* agxbmore;
  * Expand buffer to hold at least ssz more bytes.
  */
-int agxbmore(agxbuf * xb, unsigned int ssz)
+int agxbmore(agxbuf * xb, size_t ssz)
 {
-    int cnt;                   /* current no. of characters in buffer */
-    int size;                  /* current buffer size */
-    int nsize;                 /* new buffer size */
+    size_t cnt;                        /* current no. of characters in buffer */
+    size_t size;               /* current buffer size */
+    size_t nsize;              /* new buffer size */
     unsigned char *nbuf;       /* new buffer */
 
     size = xb->eptr - xb->buf;
@@ -69,7 +69,7 @@ int agxbmore(agxbuf * xb, unsigned int ssz)
 /* agxbput_n:
  * Append string s of length n onto xb
  */
-int agxbput_n(agxbuf * xb, const char *s, unsigned int ssz)
+size_t agxbput_n(agxbuf * xb, const char *s, size_t ssz)
 {
     if (xb->ptr + ssz > xb->eptr)
        agxbmore(xb, ssz);
@@ -81,9 +81,9 @@ int agxbput_n(agxbuf * xb, const char *s, unsigned int ssz)
 /* agxbput:
  * Append string s into xb
  */
-int agxbput(agxbuf * xb, const char *s)
+size_t agxbput(agxbuf * xb, const char *s)
 {
-    unsigned int ssz = strlen(s);
+    size_t ssz = strlen(s);
 
     return agxbput_n(xb, s, ssz);
 }
index 9ffc39026a61339e3b691dfd46e57bbca5a76bfa..36203f2ced98ba9d8fd3a1f3f58dbc15e59270a5 100644 (file)
@@ -38,12 +38,12 @@ extern "C" {
 /* agxbput_n:
  * Append string s of length n into xb
  */
-    extern int agxbput_n(agxbuf * xb, const char *s, unsigned int n);
+    extern size_t agxbput_n(agxbuf * xb, const char *s, size_t n);
 
 /* agxbput:
  * Append string s into xb
  */
-    extern int agxbput(agxbuf * xb, const char *s);
+    extern size_t agxbput(agxbuf * xb, const char *s);
 
 /* agxbfree:
  * Free any malloced resources.
@@ -58,7 +58,7 @@ extern "C" {
 /* agxbmore:
  * Expand buffer to hold at least ssz more bytes.
  */
-    extern int agxbmore(agxbuf * xb, int unsigned ssz);
+    extern int agxbmore(agxbuf * xb, size_t ssz);
 
 /* agxbputc:
  * Add character to buffer.
index be7063e982d4c4e0a422a6a5a986dc61166a3904..883ef236309e7c1c3e1450289064144879924e81 100644 (file)
@@ -110,7 +110,7 @@ int agstrclose(Agraph_t * g);
 void agmarkhtmlstr(char *s);
 
        /* object set management */
-Agnode_t *agfindnode_by_id(Agraph_t * g, unsigned long id);
+Agnode_t *agfindnode_by_id(Agraph_t * g, IDTYPE id);
 Dtcompar_f agdictorder(Agraph_t *, Dict_t *, Dtcompar_f);
 int agedgecmpf(Dict_t * d, void *arg_e0, void *arg_e1, Dtdisc_t * disc);
 int agnamecmpf(Dict_t * d, void *, void *, Dtdisc_t * disc);
@@ -146,16 +146,16 @@ void aglexbad(void);
 
        /* ID management */
 int agmapnametoid(Agraph_t * g, int objtype, char *str,
-                 unsigned long *result, int allocflag);
-int agallocid(Agraph_t * g, int objtype, unsigned long request);
-void agfreeid(Agraph_t * g, int objtype, unsigned long id);
+          IDTYPE *result, int allocflag);
+int agallocid(Agraph_t * g, int objtype, IDTYPE request);
+void agfreeid(Agraph_t * g, int objtype, IDTYPE id);
 char *agprintid(Agobj_t * obj);
 int aginternalmaplookup(Agraph_t * g, int objtype, char *str,
-                       unsigned long *result);
+            IDTYPE *result);
 void aginternalmapinsert(Agraph_t * g, int objtype, char *str,
-                        unsigned long result);
-char *aginternalmapprint(Agraph_t * g, int objtype, unsigned long id);
-int aginternalmapdelete(Agraph_t * g, int objtype, unsigned long id);
+             IDTYPE result);
+char *aginternalmapprint(Agraph_t * g, int objtype, IDTYPE id);
+int aginternalmapdelete(Agraph_t * g, int objtype, IDTYPE id);
 void aginternalmapclose(Agraph_t * g);
 void agregister(Agraph_t * g, int objtype, void *obj);
 
index f1e2bde028fbe9061a7741356198eb3ca7b1b576..4acd88a1e77453e5815581dbca95b9a9cca5f91b 100644 (file)
@@ -37,6 +37,9 @@ extern "C" {
 #define NILedge                        NIL(Agedge_t*)
 #define NILsym                 NIL(Agsym_t*)
 
+/* avoid loss when casting pointer to unsigned long on Win64 */
+typedef uintptr_t IDTYPE;
+
 /* forward struct type declarations */
 typedef struct Agtag_s Agtag_t;
 typedef struct Agobj_s Agobj_t;        /* generic object header */
@@ -80,7 +83,7 @@ struct Agtag_s {
     unsigned mtflock:1;                /* move-to-front lock, see above */
     unsigned attrwf:1;         /* attrs written (parity, write.c) */
     unsigned seq:(sizeof(unsigned) * 8 - 4);   /* sequence no. */
-    unsigned long id;          /* client  ID */
+    IDTYPE id;                 /* client  ID */
 };
 
        /* object tags */
@@ -157,11 +160,11 @@ struct Agmemdisc_s {              /* memory allocator */
 
 struct Agiddisc_s {            /* object ID allocator */
     void *(*open) (Agraph_t * g, Agdisc_t*);   /* associated with a graph */
-    long (*map) (void *state, int objtype, char *str, unsigned long *id,
+    long (*map) (void *state, int objtype, char *str, IDTYPE *id,
                 int createflag);
-    long (*alloc) (void *state, int objtype, unsigned long id);
-    void (*free) (void *state, int objtype, unsigned long id);
-    char *(*print) (void *state, int objtype, unsigned long id);
+    long (*alloc) (void *state, int objtype, IDTYPE id);
+    void (*free) (void *state, int objtype, IDTYPE id);
+    char *(*print) (void *state, int objtype, IDTYPE id);
     void (*close) (void *state);
     void (*idregister) (void *state, int objtype, void *obj);
 };
@@ -273,7 +276,7 @@ extern int agissimple(Agraph_t * g);
 
 /* nodes */
 extern Agnode_t *agnode(Agraph_t * g, char *name, int createflag);
-extern Agnode_t *agidnode(Agraph_t * g, unsigned long id, int createflag);
+extern Agnode_t *agidnode(Agraph_t * g, IDTYPE id, int createflag);
 extern Agnode_t *agsubnode(Agraph_t * g, Agnode_t * n, int createflag);
 extern Agnode_t *agfstnode(Agraph_t * g);
 extern Agnode_t *agnxtnode(Agraph_t * g, Agnode_t * n);
@@ -286,7 +289,7 @@ extern Agsubnode_t *agsubrep(Agraph_t * g, Agnode_t * n);
 extern Agedge_t *agedge(Agraph_t * g, Agnode_t * t, Agnode_t * h,
                        char *name, int createflag);
 extern Agedge_t *agidedge(Agraph_t * g, Agnode_t * t, Agnode_t * h,
-                         unsigned long id, int createflag);
+              IDTYPE id, int createflag);
 extern Agedge_t *agsubedge(Agraph_t * g, Agedge_t * e, int createflag);
 extern Agedge_t *agfstin(Agraph_t * g, Agnode_t * n);
 extern Agedge_t *agnxtin(Agraph_t * g, Agedge_t * e);
@@ -363,7 +366,7 @@ extern int agsafeset(void* obj, char* name, char* value, char* def);
 
 /* defintions for subgraphs */
 extern Agraph_t *agsubg(Agraph_t * g, char *name, int cflag);  /* constructor */
-extern Agraph_t *agidsubg(Agraph_t * g, unsigned long id, int cflag);  /* constructor */
+extern Agraph_t *agidsubg(Agraph_t * g, IDTYPE id, int cflag); /* constructor */
 extern Agraph_t *agfstsubg(Agraph_t * g), *agnxtsubg(Agraph_t * subg);
 extern Agraph_t *agparent(Agraph_t * g);
 
index 1a60e7ac8b10788703fae75c184dc106809a695e..4810f3f1dd991bef1b6033af5862c16b72136dd7 100644 (file)
@@ -144,7 +144,7 @@ static Agedge_t *agfindedge_by_key(Agraph_t * g, Agnode_t * t, Agnode_t * h,
 }
 
 static Agedge_t *agfindedge_by_id(Agraph_t * g, Agnode_t * t, Agnode_t * h,
-                                 unsigned long id)
+                  IDTYPE id)
 {
     Agtag_t tag;
 
@@ -211,7 +211,7 @@ static void subedge(Agraph_t * g, Agedge_t * e)
 }
 
 static Agedge_t *newedge(Agraph_t * g, Agnode_t * t, Agnode_t * h,
-                        unsigned long id)
+             IDTYPE id)
 {
     Agedgepair_t *e2;
     Agedge_t *in, *out;
@@ -257,7 +257,7 @@ static int ok_to_make_edge(Agraph_t * g, Agnode_t * t, Agnode_t * h)
 }
 
 Agedge_t *agidedge(Agraph_t * g, Agnode_t * t, Agnode_t * h,
-                  unsigned long id, int cflag)
+           IDTYPE id, int cflag)
 {
     Agraph_t *root;
     Agedge_t *e;
@@ -282,7 +282,7 @@ Agedge_t *agedge(Agraph_t * g, Agnode_t * t, Agnode_t * h, char *name,
                 int cflag)
 {
     Agedge_t *e;
-    unsigned long id;
+    IDTYPE id;
     int have_id;
 
     have_id = agmapnametoid(g, AGEDGE, name, &id, FALSE);
@@ -404,7 +404,7 @@ Agedge_t *agsubedge(Agraph_t * g, Agedge_t * e, int cflag)
 /* edge comparison.  OBJTYPE(e) == 0 means ID is a wildcard. */
 int agedgeidcmpf(Dict_t * d, void *arg_e0, void *arg_e1, Dtdisc_t * disc)
 {
-    long v;
+    long long v;
     Agedge_t *e0, *e1;
 
     NOTUSED(d);
@@ -424,7 +424,7 @@ int agedgeidcmpf(Dict_t * d, void *arg_e0, void *arg_e1, Dtdisc_t * disc)
 /* edge comparison.  for ordered traversal. */
 int agedgeseqcmpf(Dict_t * d, void *arg_e0, void *arg_e1, Dtdisc_t * disc)
 {
-    long v;
+    long long v;
     Agedge_t *e0, *e1;
 
     NOTUSED(d);
index bb892d3c7614055a6bf5dbfb4b63253bb55b159b..71875e2c890a8786873204d4e96fd38b0b8fc39d 100644 (file)
@@ -45,7 +45,7 @@ Agraph_t *agopen(char *name, Agdesc_t desc, Agdisc_t * arg_disc)
 {
     Agraph_t *g;
     Agclos_t *clos;
-    unsigned long gid;
+    IDTYPE gid;
 
     clos = agclos(arg_disc);
     g = clos->disc.mem->alloc(clos->state.mem, sizeof(Agraph_t));
@@ -241,7 +241,7 @@ int agdegree(Agraph_t * g, Agnode_t * n, int want_in, int want_out)
 
 int agraphidcmpf(Dict_t * d, void *arg0, void *arg1, Dtdisc_t * disc)
 {
-    long       v;
+    ptrdiff_t  v;
     Agraph_t *sg0, *sg1;
     sg0 = (Agraph_t *) arg0;
     sg1 = (Agraph_t *) arg1;
index cde61ada747c5773d397ff1a966f43cf8bfb1a59..694220ef39d41ff7c085892bd55436e42ec3c3c2 100644 (file)
@@ -21,30 +21,30 @@ static void *idopen(Agraph_t * g, Agdisc_t* disc)
     return g;
 }
 
-static long idmap(void *state, int objtype, char *str, unsigned long *id,
+static long idmap(void *state, int objtype, char *str, IDTYPE *id,
                  int createflag)
 {
     char *s;
-    static unsigned long ctr = 1;
+    static IDTYPE ctr = 1;
 
     NOTUSED(objtype);
     if (str) {
-       Agraph_t *g;
-       g = state;
-       if (createflag)
-           s = agstrdup(g, str);
-       else
-           s = agstrbind(g, str);
-       *id = (unsigned long) s;
+        Agraph_t *g;
+        g = state;
+        if (createflag)
+            s = agstrdup(g, str);
+        else
+            s = agstrbind(g, str);
+        *id = (IDTYPE) s;
     } else {
-       *id = ctr;
-       ctr += 2;
+        *id = ctr;
+        ctr += 2;
     }
     return TRUE;
 }
 
        /* we don't allow users to explicitly set IDs, either */
-static long idalloc(void *state, int objtype, unsigned long request)
+static long idalloc(void *state, int objtype, IDTYPE request)
 {
     NOTUSED(state);
     NOTUSED(objtype);
@@ -52,14 +52,14 @@ static long idalloc(void *state, int objtype, unsigned long request)
     return FALSE;
 }
 
-static void idfree(void *state, int objtype, unsigned long id)
+static void idfree(void *state, int objtype, IDTYPE id)
 {
     NOTUSED(objtype);
     if (id % 2 == 0)
        agstrfree((Agraph_t *) state, (char *) id);
 }
 
-static char *idprint(void *state, int objtype, unsigned long id)
+static char *idprint(void *state, int objtype, IDTYPE id)
 {
     NOTUSED(state);
     NOTUSED(objtype);
@@ -94,7 +94,7 @@ Agiddisc_t AgIdDisc = {
 /* aux functions incl. support for disciplines with anonymous IDs */
 
 int agmapnametoid(Agraph_t * g, int objtype, char *str,
-                 unsigned long *result, int createflag)
+          IDTYPE *result, int createflag)
 {
     int rv;
 
@@ -123,12 +123,12 @@ int agmapnametoid(Agraph_t * g, int objtype, char *str,
     return rv;
 }
 
-int agallocid(Agraph_t * g, int objtype, unsigned long request)
+int agallocid(Agraph_t * g, int objtype, IDTYPE request)
 {
     return AGDISC(g, id)->alloc(AGCLOS(g, id), objtype, request);
 }
 
-void agfreeid(Agraph_t * g, int objtype, unsigned long id)
+void agfreeid(Agraph_t * g, int objtype, IDTYPE id)
 {
     (void) aginternalmapdelete(g, objtype, id);
     (AGDISC(g, id)->free) (AGCLOS(g, id), objtype, id);
index 2ba4a0bd16106841a9251669856dd2b82344d2bd..7b006e1fb67ececd32bef8de7e0e38cdd53e61e3 100644 (file)
@@ -16,7 +16,7 @@
 typedef struct IMapEntry_s {
     Dtlink_t namedict_link;
     Dtlink_t iddict_link;
-    unsigned long id;
+    IDTYPE id;
     char *str;
 } IMapEntry_t;
 
@@ -28,7 +28,18 @@ static int idcmpf(Dict_t * d, void *arg_p0, void *arg_p1, Dtdisc_t * disc)
     p0 = arg_p0;
     p1 = arg_p1;
     NOTUSED(disc);
-    return (p0->id - p1->id);
+    if (p0->id > p1->id)
+    {
+        return 1;
+    }
+    else if (p0->id < p1->id)
+    {
+        return -1;
+    }
+    else
+    {
+        return 0;
+    }
 }
 
 /* note, OK to compare pointers into shared string pool 
@@ -43,7 +54,18 @@ static int namecmpf(Dict_t * d, void *arg_p0, void *arg_p1,
     p0 = arg_p0;
     p1 = arg_p1;
     NOTUSED(disc);
-    return (p0->str - p1->str);
+    if (p0->str > p1->str)
+    {
+        return 1;
+    }
+    else if (p0->str < p1->str)
+    {
+        return -1;
+    }
+    else
+    {
+        return 0;
+    }
 }
 
 static Dtdisc_t LookupByName = {
@@ -71,7 +93,7 @@ static Dtdisc_t LookupById = {
 };
 
 int aginternalmaplookup(Agraph_t * g, int objtype, char *str,
-                       unsigned long *result)
+            IDTYPE *result)
 {
     Dict_t *d;
     IMapEntry_t *sym, template;
@@ -94,7 +116,7 @@ int aginternalmaplookup(Agraph_t * g, int objtype, char *str,
 
 /* caller GUARANTEES that this is a new entry */
 void aginternalmapinsert(Agraph_t * g, int objtype, char *str,
-                        unsigned long id)
+             IDTYPE id)
 {
     IMapEntry_t *ent;
     Dict_t *d_name_to_id, *d_id_to_name;
@@ -115,7 +137,7 @@ void aginternalmapinsert(Agraph_t * g, int objtype, char *str,
     dtinsert(d_id_to_name, ent);
 }
 
-static IMapEntry_t *find_isym(Agraph_t * g, int objtype, unsigned long id)
+static IMapEntry_t *find_isym(Agraph_t * g, int objtype, IDTYPE id)
 {
     Dict_t *d;
     IMapEntry_t *isym, itemplate;
@@ -130,7 +152,7 @@ static IMapEntry_t *find_isym(Agraph_t * g, int objtype, unsigned long id)
     return isym;
 }
 
-char *aginternalmapprint(Agraph_t * g, int objtype, unsigned long id)
+char *aginternalmapprint(Agraph_t * g, int objtype, IDTYPE id)
 {
     IMapEntry_t *isym;
 
@@ -140,7 +162,7 @@ char *aginternalmapprint(Agraph_t * g, int objtype, unsigned long id)
 }
 
 
-int aginternalmapdelete(Agraph_t * g, int objtype, unsigned long id)
+int aginternalmapdelete(Agraph_t * g, int objtype, IDTYPE id)
 {
     IMapEntry_t *isym;
 
index 3d9c483ba0c83d202e4304aad0617f9db40fee50..ecc99ce4e571f270f7e9879c8d99c72cadd5ecb0 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <cghdr.h>
 
-Agnode_t *agfindnode_by_id(Agraph_t * g, unsigned long id)
+Agnode_t *agfindnode_by_id(Agraph_t * g, IDTYPE id)
 {
     Agsubnode_t *sn;
     static Agsubnode_t template;
@@ -27,7 +27,7 @@ Agnode_t *agfindnode_by_id(Agraph_t * g, unsigned long id)
 
 Agnode_t *agfindnode_by_name(Agraph_t * g, char *name)
 {
-    unsigned long id;
+    IDTYPE id;
 
     if (agmapnametoid(g, AGNODE, name, &id, FALSE))
        return agfindnode_by_id(g, id);
@@ -67,7 +67,7 @@ Agnode_t *agprvnode(Agraph_t * g, Agnode_t * n)
 
 
 /* internal node constructor */
-static Agnode_t *newnode(Agraph_t * g, unsigned long id, unsigned long seq)
+static Agnode_t *newnode(Agraph_t * g, IDTYPE id, unsigned long seq)
 {
     Agnode_t *n;
 
@@ -116,7 +116,7 @@ static void initnode(Agraph_t * g, Agnode_t * n)
 }
 
 /* external node constructor - create by id */
-Agnode_t *agidnode(Agraph_t * g, unsigned long id, int cflag)
+Agnode_t *agidnode(Agraph_t * g, IDTYPE id, int cflag)
 {
     Agraph_t *root;
     Agnode_t *n;
@@ -143,7 +143,7 @@ Agnode_t *agnode(Agraph_t * g, char *name, int cflag)
 {
     Agraph_t *root;
     Agnode_t *n;
-    unsigned long id;
+    IDTYPE id;
 
     root = agroot(g);
     /* probe for existing node */
@@ -231,7 +231,7 @@ static void dict_relabel(Agnode_t * n, void *arg)
 int agrelabel_node(Agnode_t * n, char *newname)
 {
     Agraph_t *g;
-    unsigned long new_id;
+    IDTYPE new_id;
 
     g = agroot(agraphof(n));
     if (agfindnode_by_name(g, newname))
@@ -273,7 +273,7 @@ Agnode_t *agsubnode(Agraph_t * g, Agnode_t * n0, int cflag)
 
 int agsubnodeidcmpf(Dict_t * d, void *arg0, void *arg1, Dtdisc_t * disc)
 {
-    long       v;
+    long long  v;
     Agsubnode_t *sn0, *sn1;
     sn0 = (Agsubnode_t *) arg0;
     sn1 = (Agsubnode_t *) arg1;
index b5141aa04f138052c66f01fb20e9216e493dca2f..7b1c8c1010d5ae31f7adf116be4d97a831f34bd8 100755 (executable)
@@ -37,7 +37,7 @@ int agdelete(Agraph_t * g, void *obj)
 int agrename(Agobj_t * obj, char *newname)
 {
     Agraph_t *g;
-    unsigned long old_id, new_id;
+    IDTYPE old_id, new_id;
 
     switch (AGTYPE(obj)) {
     case AGRAPH:
index d42f87b847701a772e476d304ad16ea70368e394..6df7a9634f938bf4444ad8621e53278220dec909 100644 (file)
@@ -23,7 +23,7 @@ typedef struct symlist_s {
 /* this record describes one pending callback on one object */
 typedef struct {
     Dtlink_t link;
-    unsigned long key;         /* universal key for main or sub-object */
+    IDTYPE key;                /* universal key for main or sub-object */
     Agraph_t *g;
     Agobj_t *obj;
     symlist_t *symlist;                /* attributes involved */
@@ -129,7 +129,7 @@ static Dict_t *dictof(pendingset_t * ds, Agobj_t * obj, int kind)
     return *dict_ref;
 }
 
-static unsigned long genkey(Agobj_t * obj)
+static IDTYPE genkey(Agobj_t * obj)
 {
     return obj->tag.id;
 }
index 6ef5d02d29f533f586476ff58e0176aab2a76df4..4d0d3da0505cf0e2a884d387531d8678559e0d52 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <cghdr.h>
 
-static Agraph_t *agfindsubg_by_id(Agraph_t * g, unsigned long id)
+static Agraph_t *agfindsubg_by_id(Agraph_t * g, IDTYPE id)
 {
     Agraph_t template;
 
@@ -22,7 +22,7 @@ static Agraph_t *agfindsubg_by_id(Agraph_t * g, unsigned long id)
     return (Agraph_t *) dtsearch(g->g_dict, &template);
 }
 
-static Agraph_t *localsubg(Agraph_t * g, unsigned long id)
+static Agraph_t *localsubg(Agraph_t * g, IDTYPE id)
 {
     Agraph_t *subg;
 
@@ -40,7 +40,7 @@ static Agraph_t *localsubg(Agraph_t * g, unsigned long id)
     return agopen1(subg);
 }
 
-Agraph_t *agidsubg(Agraph_t * g, unsigned long id, int cflag)
+Agraph_t *agidsubg(Agraph_t * g, IDTYPE id, int cflag)
 {
     Agraph_t *subg;
     subg = agfindsubg_by_id(g, id);
@@ -51,7 +51,7 @@ Agraph_t *agidsubg(Agraph_t * g, unsigned long id, int cflag)
 
 Agraph_t *agsubg(Agraph_t * g, char *name, int cflag)
 {
-    unsigned long id;
+    IDTYPE id;
     Agraph_t *subg;
 
     if (name && agmapnametoid(g, AGRAPH, name, &id, FALSE)) {
index 671819be46392abb2ddcf894cf329661b8f7138d..77ffbffc73217413107ba7054508d5ad7d8d43b4 100644 (file)
@@ -185,8 +185,8 @@ char *agstrcanon(char *arg, char *buf)
 static char *getoutputbuffer(char *str)
 {
     static char *rv;
-    static int len;
-    int req;
+    static size_t len = 0;
+    size_t req;
 
     req = MAX(2 * strlen(str) + 2, BUFSIZ);
     if (req > len) {