Changeset: 5b6e555b6a59 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5b6e555b6a59
Modified Files:
        gdk/gdk.h
        gdk/gdk_atoms.c
        sql/backends/monet5/UDF/pyapi3/conversion3.c
Branch: default
Log Message:

Blobs are really sequences of uint8_t (unsigned char).


diffs (65 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -479,12 +479,12 @@ typedef union {
 #else
        lng l[2];               /* force alignment, not otherwise used */
 #endif
-       uint8_t u[UUID_SIZE];
+       uint8_t u[UUID_SIZE] __attribute__((__nonstring__));
 } uuid;
 
 typedef struct {
        size_t nitems;
-       char data[] __attribute__((__nonstring__));
+       uint8_t data[] __attribute__((__nonstring__));
 } blob;
 gdk_export size_t blobsize(size_t nitems) __attribute__((__const__));
 
diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c
--- a/gdk/gdk_atoms.c
+++ b/gdk/gdk_atoms.c
@@ -1532,11 +1532,8 @@ BLOBtostr(str *tostr, size_t *l, const v
        s = *tostr;
 
        for (i = 0; i < p->nitems; i++) {
-               int val = (p->data[i] >> 4) & 15;
-
-               *s++ = hexit[val];
-               val = p->data[i] & 15;
-               *s++ = hexit[val];
+               *s++ = hexit[(p->data[i] >> 4) & 15];
+               *s++ = hexit[p->data[i] & 15];
        }
        *s = '\0';
        return (ssize_t) (s - *tostr);
@@ -1593,7 +1590,7 @@ BLOBfromstr(const char *instr, size_t *l
           // Read the values of the blob.
         */
        for (i = 0; i < nitems; ++i) {
-               char res = 0;
+               int res = 0;
 
                for (;;) {
                        if (*s >= '0' && *s <= '9') {
@@ -1627,7 +1624,7 @@ BLOBfromstr(const char *instr, size_t *l
                }
                s++;
 
-               result->data[i] = res;
+               result->data[i] = (uint8_t) res;
        }
        while (GDKisspace(*s))
                s++;
diff --git a/sql/backends/monet5/UDF/pyapi3/conversion3.c 
b/sql/backends/monet5/UDF/pyapi3/conversion3.c
--- a/sql/backends/monet5/UDF/pyapi3/conversion3.c
+++ b/sql/backends/monet5/UDF/pyapi3/conversion3.c
@@ -229,7 +229,7 @@ PyArrayObject_FromBAT(PyInput *inp, size
                                data[p] = Py_None;
                                Py_INCREF(Py_None);
                        } else {
-                               data[p] = 
PyByteArray_FromStringAndSize(t->data, t->nitems);
+                               data[p] = PyByteArray_FromStringAndSize((char 
*) t->data, t->nitems);
                        }
                }
                bat_iterator_end(&li);
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to