Changeset: ad4b109d0f82 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ad4b109d0f82 Modified Files: monetdb5/modules/mal/tablet.c Branch: Jul2015 Log Message:
Do not assume sizeof(long)==8.
Also, no need for unsigned in this case, plus it's useful to have a
default case.
diffs (54 lines):
diff --git a/monetdb5/modules/mal/tablet.c b/monetdb5/modules/mal/tablet.c
--- a/monetdb5/modules/mal/tablet.c
+++ b/monetdb5/modules/mal/tablet.c
@@ -1832,22 +1832,42 @@ SQLload_file(Client cntxt, Tablet *as, b
int width;
for (attr = 0; attr < as->nr_attrs; attr++) {
- if( as->format[attr].c->ttype == TYPE_str)
- width = as->format[attr].c->T->width;
- else
- width =
ATOMsize(as->format[attr].c->ttype);
+ width = as->format[attr].c->T->width;
switch (width){
case 1:
- trimerrors(unsigned char);
+ trimerrors(bte);
break;
case 2:
- trimerrors(unsigned short);
+ trimerrors(sht);
break;
case 4:
- trimerrors(unsigned int);
+ trimerrors(int);
break;
case 8:
- trimerrors(unsigned long);
+ trimerrors(lng);
+ break;
+#ifdef HAVE_HGE
+ case 16:
+ trimerrors(hge);
+ break;
+#endif
+ default:
+ {
+ char *src, *dst;
+ leftover=
BATcount(task->as->format[attr].c);
+ limit = leftover - cntstart;
+ dst = src=
BUNtloc(task->as->format[attr].ci,cntstart);
+ for(j = 0; j < (int) limit;
j++, src += width){
+ if ( task->rowerror[j]){
+ leftover--;
+ continue;
+ }
+ if (dst != src)
+ memcpy(dst,
src, width);
+ dst += width;
+ }
+
BATsetcount(task->as->format[attr].c, leftover );
+ }
break;
}
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list
