Changeset: 6f71fd507d16 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6f71fd507d16 Modified Files: clients/mapilib/mapi.c common/utils/conversion.c sql/backends/monet5/sql_result.c Branch: protocol Log Message:
Compilation fixes. diffs (101 lines): diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c --- a/clients/mapilib/mapi.c +++ b/clients/mapilib/mapi.c @@ -4166,14 +4166,14 @@ static char* mapi_convert_blob(struct Ma return NULL; } if (24 + 3 * length > (lng) col->dynamic_write_bufsiz) { - col->dynamic_write_bufsiz = (size_t) 24 + 3 * length; + col->dynamic_write_bufsiz = (size_t) (24 + 3 * length); if (col->dynamic_write_buf) free(col->dynamic_write_buf); col->dynamic_write_buf = malloc(col->dynamic_write_bufsiz); if (!col->dynamic_write_buf) { return NULL; } } - if (conversion_blob_to_string(col->dynamic_write_buf, (int) col->dynamic_write_bufsiz, col->buffer_ptr + sizeof(lng), length) < 0) { + if (conversion_blob_to_string(col->dynamic_write_buf, (int) col->dynamic_write_bufsiz, col->buffer_ptr + sizeof(lng), (size_t) length) < 0) { return NULL; } return (char*) col->dynamic_write_buf; @@ -6236,7 +6236,7 @@ mapi_set_compute_column_width(Mapi mid, #define NUMERIC_CONVERSION(fromtpe, totpe, fromname, toname, MIN_VALUE, MAX_VALUE) \ case SQL_BINARY_##fromname: { \ - *retval = (totpe) *((fromtpe*)col->buffer_ptr); \ + *retval = (totpe) (*((fromtpe*)col->buffer_ptr)); \ return MOK; \ } diff --git a/common/utils/conversion.c b/common/utils/conversion.c --- a/common/utils/conversion.c +++ b/common/utils/conversion.c @@ -373,7 +373,7 @@ conversion_epoch_optional_tz_to_string(c conversion_timestamp_get_data(*src, timezone_diff, &year, &month, &day, &hour, &min, &sec, &nanosecond); - if ((res = snprintf(dst, len, "%d-%02d-%02d %02d:%02d:%02d.%06d", year, month, day, hour, min, sec, nanosecond)) < 0) { + if ((res = snprintf(dst, len, "%d-%02d-%02d %02d:%02d:%02d.%06d", year, (int) month, (int) day, (int) hour, (int) min, (int) sec, (int) nanosecond)) < 0) { return res; } digits--; diff --git a/sql/backends/monet5/sql_result.c b/sql/backends/monet5/sql_result.c --- a/sql/backends/monet5/sql_result.c +++ b/sql/backends/monet5/sql_result.c @@ -25,6 +25,20 @@ #define llabs(x) ((x) < 0 ? -(x) : (x)) #endif +// stpcpy definition, for systems that do not have stpcpy +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +mystpcpy (char *yydest, const char *yysrc) { + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} + static int dec_tostr(void *extra, char **Buf, int *len, int type, const void *a) { @@ -1842,7 +1856,7 @@ static int type_supports_binary_transfer type->eclass == EC_TIMESTAMP; } -static size_t max(size_t a, size_t b) { +static size_t mymax(size_t a, size_t b) { return a > b ? a : b; } @@ -1941,7 +1955,7 @@ int mvc_export_resultset_prot10(mvc *m, nil_len = typelen; } - if (!mnstr_writeLng(s, (lng) max(max(strlen(c->tn), strlen(c->name)), strlen(type->sqlname)) + 1) || + if (!mnstr_writeLng(s, (lng) mymax(mymax(strlen(c->tn), strlen(c->name)), strlen(type->sqlname)) + 1) || !write_str_term(s, c->tn) || !write_str_term(s, c->name) || !write_str_term(s, type->sqlname) || !mnstr_writeInt(s, typelen) || !mnstr_writeInt(s, c->type.digits) || !mnstr_writeInt(s, type->eclass == EC_SEC ? 3 : c->type.scale)) { fres = -1; @@ -2156,7 +2170,7 @@ int mvc_export_resultset_prot10(mvc *m, char *bufptr = buf; // for small fixed size strings we use fixed width for(crow = srow; crow < row; crow++) { - buf = stpcpy(buf, (char*) BUNtail(iterators[i], crow)); + buf = mystpcpy(buf, (char*) BUNtail(iterators[i], crow)); bufptr += c->type.digits; while(buf < bufptr) { *buf++ = '\0'; @@ -2188,7 +2202,7 @@ int mvc_export_resultset_prot10(mvc *m, buf += sizeof(lng); for (crow = srow; crow < row; crow++) { char *str = (char*) BUNtail(iterators[i], crow); - buf = stpcpy(buf, str) + 1; + buf = mystpcpy(buf, str) + 1; } // after the loop we know the size of the column, so write it *((lng*)startbuf) = buf - (startbuf + sizeof(lng)); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list