Changeset: a87b4b1b5bb7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a87b4b1b5bb7
Modified Files:
        clients/Tests/exports.stable.out
        gdk/ChangeLog
        gdk/gdk.h
        gdk/gdk_aggr.c
        gdk/gdk_atoms.c
        gdk/gdk_atoms.h
        geom/monetdb5/geom.c
        geom/monetdb5/geom.h
        monetdb5/mal/mal_atom.c
        monetdb5/modules/atoms/blob.c
        monetdb5/modules/kernel/algebra.c
        monetdb5/modules/mal/mal_io.c
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql_result.c
        sql/storage/bat/bat_table.c
        testing/malcheck.py
Branch: default
Log Message:

ATOMlen is now a size_t, atomDesc.size is now unsigned short.
Various more changes (int to size_t) having to do with this.


diffs (truncated from 383 to 300 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -15,7 +15,7 @@ ptr ATOMdup(int id, const void *val);
 bte ATOMelmshift(int sz);
 ssize_t ATOMformat(int id, const void *val, char **buf);
 int ATOMindex(const char *nme);
-int ATOMlen(int id, const void *v);
+size_t ATOMlen(int id, const void *v);
 str ATOMname(int id);
 ptr ATOMnil(int id);
 int ATOMprint(int id, const void *val, stream *fd);
@@ -481,7 +481,7 @@ ssize_t shtToStr(str *dst, size_t *len, 
 const sht sht_nil;
 ssize_t strFromStr(const char *src, size_t *len, str *dst);
 BUN strHash(const char *s);
-int strLen(const char *s);
+size_t strLen(const char *s);
 int strNil(const char *s);
 const char str_nil[2];
 gdk_return void_inplace(BAT *b, oid id, const void *val, bit force) 
__attribute__((__warn_unused_result__));
@@ -828,7 +828,7 @@ ssize_t BLOBfromstr(const char *instr, s
 int BLOBget(Heap *h, int *bun, int *l, blob **val);
 BUN BLOBhash(const blob *b);
 void BLOBheap(Heap *heap, size_t capacity);
-int BLOBlength(const blob *p);
+size_t BLOBlength(const blob *p);
 str BLOBnitems(int *ret, blob *b);
 const blob *BLOBnull(void);
 str BLOBprelude(void *ret);
diff --git a/gdk/ChangeLog b/gdk/ChangeLog
--- a/gdk/ChangeLog
+++ b/gdk/ChangeLog
@@ -2,6 +2,9 @@
 # This file is updated with Maddlog
 
 * Thu Sep 14 2017 Sjoerd Mullender <[email protected]>
+- The length "method" for atoms now returns a size_t, the "len" field of
+  a ValRecord is now a size_t, the "size" field of the atomDesc structure
+  is now unsigned short.
 - Removed the "align" field from the ATOM descriptor (atomDesc) structure.
 - The atomtostr and atomfromstr "methods" for atoms now return ssize_t
   and require a pointer to size_t for the size of the buffer.
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -727,7 +727,8 @@ typedef struct {
                hge hval;
 #endif
        } val;
-       int len, vtype;
+       size_t len;
+       int vtype;
 } *ValPtr, ValRecord;
 
 /* interface definitions */
@@ -1742,7 +1743,7 @@ gdk_export BAT *BBPquickdesc(bat b, int 
  * @tab ATOMput         (int id, Heap *hp, BUN pos_dst, ptr val_src);
  * @item int
  * @tab ATOMdel         (int id, Heap *hp, BUN v_src);
- * @item int
+ * @item size_t
  * @tab ATOMlen         (int id, ptr val);
  * @item ptr
  * @tab ATOMnil         (int id);
@@ -1846,7 +1847,7 @@ typedef struct {
        char name[IDLENGTH];
        short storage;          /* stored as another type? */
        short linear;           /* atom can be ordered linearly */
-       short size;             /* fixed size of atom */
+       unsigned short size;    /* fixed size of atom */
 
        /* automatically generated fields */
        const void *atomNull;   /* global nil value */
@@ -1865,7 +1866,7 @@ typedef struct {
        /* varsized atom-only ADT functions */
        var_t (*atomPut) (Heap *, var_t *off, const void *src);
        void (*atomDel) (Heap *, var_t *atom);
-       int (*atomLen) (const void *atom);
+       size_t (*atomLen) (const void *atom);
        void (*atomHeap) (Heap *, size_t);
 } atomDesc;
 
@@ -1876,7 +1877,7 @@ gdk_export int ATOMallocate(const char *
 gdk_export int ATOMindex(const char *nme);
 
 gdk_export str ATOMname(int id);
-gdk_export int ATOMlen(int id, const void *v);
+gdk_export size_t ATOMlen(int id, const void *v);
 gdk_export ptr ATOMnil(int id);
 gdk_export int ATOMcmp(int id, const void *v_1, const void *v_2);
 gdk_export int ATOMprint(int id, const void *val, stream *fd);
diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -2289,27 +2289,29 @@ BATminmax(BAT *b, void *aggr,
 {
        oid pos;
        const void *res;
-       int s;
+       size_t s;
        BATiter bi;
 
        if ((VIEWtparent(b) == 0 ||
             BATcount(b) == BATcount(BBPdescriptor(VIEWtparent(b)))) &&
            BATcheckimprints(b)) {
                Imprints *imprints = VIEWtparent(b) ? 
BBPdescriptor(VIEWtparent(b))->timprints : b->timprints;
+               int i;
+
                pos = oid_nil;
                if (minmax == do_groupmin) {
                        /* find first non-empty bin */
-                       for (s = 0; s < imprints->bits; s++) {
-                               if (imprints->stats[s + 128]) {
-                                       pos = imprints->stats[s] + b->hseqbase;
+                       for (i = 0; i < imprints->bits; i++) {
+                               if (imprints->stats[i + 128]) {
+                                       pos = imprints->stats[i] + b->hseqbase;
                                        break;
                                }
                        }
                } else {
                        /* find last non-empty bin */
-                       for (s = imprints->bits - 1; s >= 0; s--) {
-                               if (imprints->stats[s + 128]) {
-                                       pos = imprints->stats[s + 64] + 
b->hseqbase;
+                       for (i = imprints->bits - 1; i >= 0; i--) {
+                               if (imprints->stats[i + 128]) {
+                                       pos = imprints->stats[i + 64] + 
b->hseqbase;
                                        break;
                                }
                        }
diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c
--- a/gdk/gdk_atoms.c
+++ b/gdk/gdk_atoms.c
@@ -250,7 +250,7 @@ ptr
 ATOMnil(int t)
 {
        const void *src = ATOMnilptr(t);
-       int len = ATOMlen(ATOMtype(t), src);
+       size_t len = ATOMlen(ATOMtype(t), src);
        ptr dst = GDKmalloc(len);
 
        if (dst)
@@ -261,10 +261,10 @@ ATOMnil(int t)
 /*
  * @- Atomic ADT functions
  */
-int
+size_t
 ATOMlen(int t, const void *src)
 {
-       int (*l)(const void *) = BATatoms[t].atomLen;
+       size_t (*l)(const void *) = BATatoms[t].atomLen;
 
        return l ? (*l) (src) : ATOMsize(t);
 }
@@ -370,7 +370,7 @@ ATOMformat(int t, const void *p, char **
 ptr
 ATOMdup(int t, const void *p)
 {
-       int len = ATOMlen(t, p);
+       size_t len = ATOMlen(t, p);
        ptr n = GDKmalloc(len);
 
        if (n)
@@ -1116,10 +1116,10 @@ strNil(const char *s)
        return GDK_STRNIL(s);
 }
 
-int
+size_t
 strLen(const char *s)
 {
-       return (int) GDK_STRLEN(s);
+       return GDK_STRLEN(s);
 }
 
 static int
@@ -2133,7 +2133,7 @@ atomDesc BATatoms[MAXATOMS] = {
         0,                     /* atomUnfix */
         (var_t (*)(Heap *, var_t *, const void *)) strPut,  /* atomPut */
         0,                     /* atomDel */
-        (int (*)(const void *)) strLen,                     /* atomLen */
+        (size_t (*)(const void *)) strLen,                  /* atomLen */
         strHeap,               /* atomHeap */
        },
 };
diff --git a/gdk/gdk_atoms.h b/gdk/gdk_atoms.h
--- a/gdk/gdk_atoms.h
+++ b/gdk/gdk_atoms.h
@@ -93,7 +93,7 @@ gdk_export ssize_t dblToStr(str *dst, si
 gdk_export ssize_t GDKstrFromStr(unsigned char *dst, const unsigned char *src, 
ssize_t len);
 gdk_export ssize_t strFromStr(const char *src, size_t *len, str *dst);
 gdk_export BUN strHash(const char *s);
-gdk_export int strLen(const char *s);
+gdk_export size_t strLen(const char *s);
 gdk_export int strNil(const char *s);
 gdk_export size_t escapedStrlen(const char *src, const char *sep1, const char 
*sep2, int quote);
 gdk_export size_t escapedStr(char *dst, const char *src, size_t dstlen, const 
char *sep1, const char *sep2, int quote);
diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -5221,12 +5221,12 @@ wkbDEL(Heap *h, var_t *index)
        HEAP_free(h, *index);
 }
 
-int
+size_t
 wkbLENGTH(const wkb *p)
 {
        var_t len = wkb_size(p->len);
        assert(len <= GDK_int_max);
-       return (int) len;
+       return (size_t) len;
 }
 
 void
@@ -5631,12 +5631,12 @@ wkbaDEL(Heap *h, var_t *index)
        HEAP_free(h, *index);
 }
 
-int
+size_t
 wkbaLENGTH(const wkba *p)
 {
        var_t len = wkba_size(p->itemsNum);
        assert(len <= GDK_int_max);
-       return (int) len;
+       return (size_t) len;
 }
 
 void
diff --git a/geom/monetdb5/geom.h b/geom/monetdb5/geom.h
--- a/geom/monetdb5/geom.h
+++ b/geom/monetdb5/geom.h
@@ -82,8 +82,8 @@ geom_export var_t wkbaPUT(Heap *h, var_t
 geom_export void wkbDEL(Heap *h, var_t *index);
 geom_export void wkbaDEL(Heap *h, var_t *index);
 
-geom_export int wkbLENGTH(const wkb *p);
-geom_export int wkbaLENGTH(const wkba *p);
+geom_export size_t wkbLENGTH(const wkb *p);
+geom_export size_t wkbaLENGTH(const wkba *p);
 
 geom_export void wkbHEAP(Heap *heap, size_t capacity);
 geom_export void wkbaHEAP(Heap *heap, size_t capacity);
diff --git a/monetdb5/mal/mal_atom.c b/monetdb5/mal/mal_atom.c
--- a/monetdb5/mal/mal_atom.c
+++ b/monetdb5/mal/mal_atom.c
@@ -89,7 +89,7 @@ malAtomProperty(MalBlkPtr mb, InstrPtr p
                break;
        case 'l':
                if (idcmp("length", name) == 0 && pci->argc == 1) {
-                       BATatoms[tpe].atomLen = (int (*)(const void *))pci->fcn;
+                       BATatoms[tpe].atomLen = (size_t (*)(const void 
*))pci->fcn;
                        setAtomName(pci);
                        return MAL_SUCCEED;
                }
diff --git a/monetdb5/modules/atoms/blob.c b/monetdb5/modules/atoms/blob.c
--- a/monetdb5/modules/atoms/blob.c
+++ b/monetdb5/modules/atoms/blob.c
@@ -44,7 +44,7 @@ mal_export BUN BLOBhash(const blob *b);
 mal_export const blob *BLOBnull(void);
 mal_export var_t BLOBput(Heap *h, var_t *bun, const blob *val);
 mal_export void BLOBdel(Heap *h, var_t *index);
-mal_export int BLOBlength(const blob *p);
+mal_export size_t BLOBlength(const blob *p);
 mal_export void BLOBheap(Heap *heap, size_t capacity);
 mal_export str BLOBtoblob(blob **retval, str *s);
 mal_export str BLOBfromblob(str *retval, blob **b);
@@ -171,12 +171,12 @@ BLOBwrite(const blob *a, stream *s, size
        return GDK_SUCCEED;
 }
 
-int
+size_t
 BLOBlength(const blob *p)
 {
        var_t l = blobsize(p->nitems); /* 64bit: check for overflow */
        assert(l <= GDK_int_max);
-       return (int) l; /* 64bit: check for overflow */
+       return (size_t) l;
 }
 
 void
@@ -357,7 +357,7 @@ BLOBfromblob(str *retval, blob **b)
 str
 BLOBtoblob(blob **retval, str *s)
 {
-       int len = strLen(*s);
+       size_t len = strLen(*s);
        blob *b = (blob *) GDKmalloc(blobsize(len));
 
        if( b == NULL)
diff --git a/monetdb5/modules/kernel/algebra.c 
b/monetdb5/modules/kernel/algebra.c
--- a/monetdb5/modules/kernel/algebra.c
+++ b/monetdb5/modules/kernel/algebra.c
@@ -902,7 +902,7 @@ doALGfetch(ptr ret, BAT *b, BUN pos)
        assert(pos <= BUN_MAX);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to