Closed kloczek closed 3 years ago
On openSUSE
unicode.c: In function '_WCHARSIZE': unicode.c:695:1: warning: control reaches end of non-void function [-Wreturn-type] 695 | } | ^ unicode.c: In function '_WCHARSIZE_ALLOC': unicode.c:707:1: warning: control reaches end of non-void function [-Wreturn-type] 707 | } | ^ unicode.c: In function 'DM_GetWCharAt': unicode.c:2161:1: warning: control reaches end of non-void function [-Wreturn-type] 2161 | } | ^
are treated as error, so they breaks building iODBC. I use this patch to fix the warnings by setting UTF8 as default:
diff -Nur libiodbc-3.52.14/iodbcinst/unicode.c new/iodbcinst/unicode.c
--- libiodbc-3.52.14/iodbcinst/unicode.c 2021-02-17 14:39:22.000000000 +0100
+++ new/iodbcinst/unicode.c 2021-05-31 18:26:17.332781996 +0200
@@ -688,9 +688,10 @@
{
switch(charset)
{
- case CP_UTF8: return 1;
case CP_UTF16: return sizeof(ucs2_t);
case CP_UCS4: return sizeof(ucs4_t);
+ case CP_UTF8:
+ default: return 1;
}
}
@@ -700,9 +701,10 @@
{
switch(charset)
{
- case CP_UTF8: return UTF8_MAX_CHAR_LEN;
case CP_UTF16: return sizeof(ucs2_t) * 2;
case CP_UCS4: return sizeof(ucs4_t);
+ case CP_UTF8:
+ default: return UTF8_MAX_CHAR_LEN;
}
}
@@ -2131,13 +2133,16 @@
switch(charset)
{
+ case CP_UTF16: return (SQLWCHAR)u2[pos];
+ case CP_UCS4: return (SQLWCHAR)u4[pos];
case CP_UTF8:
- {
+ default:
+ {
int mask, len, i=0;
SQLWCHAR wc = 0;
SQLCHAR *u8str = (SQLCHAR*)str;
while(i < pos)
- {
+ {
UTF8_COMPUTE(*u8str, mask, len);
if (len == -1)
break;
@@ -2155,8 +2160,6 @@
}
return wc;
}
- case CP_UTF16: return (SQLWCHAR)u2[pos];
- case CP_UCS4: return (SQLWCHAR)u4[pos];
}
}
@pkleef @smalinin @timhaynesopenlink -- Please take a look at this.
The default charset is UCS4, so the pacth was changed for use CP_UCS4 as default and applied.
gcc 11.0.1