Changeset: 6fe8d8f7a358 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6fe8d8f7a358
Modified Files:
        monetdb5/modules/atoms/Makefile.ag
        monetdb5/modules/atoms/blob.c
        monetdb5/modules/atoms/mtime.c
        monetdb5/modules/atoms/mtime.h
Branch: protocol
Log Message:

Can't link to NOINST library from other NOINST library.


diffs (108 lines):

diff --git a/monetdb5/modules/atoms/Makefile.ag 
b/monetdb5/modules/atoms/Makefile.ag
--- a/monetdb5/modules/atoms/Makefile.ag
+++ b/monetdb5/modules/atoms/Makefile.ag
@@ -28,7 +28,6 @@ lib_atoms = {
                url.c url.h \
                uuid.c \
                xml.c xml.h
-       LIBS = ../../../common/utils/libconversion
 }
 
 headers_mal = {
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
@@ -31,7 +31,6 @@
  */
 #include "monetdb_config.h"
 #include "blob.h"
-#include <conversion.h>
 
 int TYPE_blob;
 int TYPE_sqlblob;
@@ -211,6 +210,8 @@ blob_tostr(str *tostr, int *l, blob *p)
 int
 sqlblob_tostr(str *tostr, int *l, const blob *p)
 {
+       char *s;
+       size_t i;
        size_t expectedlen;
 
        if (p->nitems == ~(size_t) 0)
@@ -225,8 +226,23 @@ sqlblob_tostr(str *tostr, int *l, const 
                        return 0;
                *l = (int) expectedlen;
        }
+       if (p->nitems == ~(size_t) 0) {
+               strcpy(*tostr, "nil");
+               return 3;
+       }
 
-       return conversion_blob_to_string(*tostr, expectedlen, p->data, 
p->nitems);
+       strcpy(*tostr, "\0");
+       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 = '\0';
+       return (int) (s - *tostr); /* 64bit: check for overflow */
 }
 
 static int
diff --git a/monetdb5/modules/atoms/mtime.c b/monetdb5/modules/atoms/mtime.c
--- a/monetdb5/modules/atoms/mtime.c
+++ b/monetdb5/modules/atoms/mtime.c
@@ -190,7 +190,6 @@
 
 #include "monetdb_config.h"
 #include "mtime.h"
-#include <conversion.h>
 
 #ifndef HAVE_STRPTIME
 extern char *strptime(const char *, const char *, struct tm *);
@@ -631,16 +630,24 @@ date_fromstr(const char *buf, int *len, 
 int
 date_tostr(str *buf, int *len, const date *val)
 {
+       int day, month, year;
+
+       fromdate(*val, &day, &month, &year);
        /* longest possible string: "-5867411-01-01" i.e. 14 chars
           without NUL (see definition of YEAR_MIN/YEAR_MAX above) */
-       if (*len < dateStrlen) {
+       if (*len < 15) {
                if (*buf)
                        GDKfree(*buf);
                *buf = (str) GDKmalloc(*len = 15);
                if( *buf == NULL)
                        return 0;
        }
-       return conversion_date_to_string(*buf, *len, val, date_nil);
+       if (*val == date_nil || !DATE(day, month, year)) {
+               strcpy(*buf, "nil");
+               return 3;
+       }
+       sprintf(*buf, "%d-%02d-%02d", year, month, day);
+       return (int) strlen(*buf);
 }
 
 /*
diff --git a/monetdb5/modules/atoms/mtime.h b/monetdb5/modules/atoms/mtime.h
--- a/monetdb5/modules/atoms/mtime.h
+++ b/monetdb5/modules/atoms/mtime.h
@@ -37,10 +37,6 @@
 # endif
 #endif
 
-/*
- * @- date
- * Dates are stored as the amount of days since the 0000-01-01
- */
 typedef int date;
 #define date_nil               ((date) int_nil)
 #define date_isnil(X)  ((X) == date_nil)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to