Changeset: c15ea2e68434 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c15ea2e68434
Modified Files:
        monetdb5/mal/mal_import.c
Branch: Apr2019
Log Message:

Compilation fixes for bug 6720.


diffs (56 lines):

diff --git a/monetdb5/mal/mal_import.c b/monetdb5/mal/mal_import.c
--- a/monetdb5/mal/mal_import.c
+++ b/monetdb5/mal/mal_import.c
@@ -267,7 +267,7 @@ evalFile(str fname, int listing)
                if (fd)
                        close_stream(fd);
                throw(MAL,"mal.eval", "WARNING: could not open file '%s'\n", 
fname);
-       } 
+       }
 
        c= MCinitClient((oid)0, bstream_create(fd, 128 * BLOCK),0);
        if( c == NULL){
@@ -296,13 +296,14 @@ evalFile(str fname, int listing)
 }
 
 /* patch a newline character if needed */
-static str mal_cmdline(char *s, int *len)
+static str
+mal_cmdline(char *s, size_t *len)
 {
-       if (s[*len - 1] != '\n') {
-               char *n = GDKmalloc(*len + 1 + 1);
+       if (*len && s[*len - 1] != '\n') {
+               char *n = GDKmalloc(*len + 2);
                if (n == NULL)
                        return s;
-               strncpy(n, s, *len);
+               memcpy(n, s, *len);
                n[*len] = '\n';
                n[*len + 1] = 0;
                (*len)++;
@@ -313,9 +314,9 @@ static str mal_cmdline(char *s, int *len
 
 str
 compileString(Symbol *fcn, Client cntxt, str s)
-{      
+{
        Client c;
-       int len = (int) strlen(s);
+       size_t len = strlen(s);
        buffer *b;
        str msg = MAL_SUCCEED;
        str qry;
@@ -390,8 +391,10 @@ compileString(Symbol *fcn, Client cntxt,
 
 str
 callString(Client cntxt, str s, int listing)
-{      Client c;
-       int i, len = (int) strlen(s);
+{
+       Client c;
+       int i;
+       size_t len = strlen(s);
        buffer *b;
        str old =s;
        str msg = MAL_SUCCEED, qry;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to