From: Tatsuo Ishii Date: Fri, 13 Sep 2002 06:41:18 +0000 (+0000) Subject: Change Assert(len > 0) to Assert(len >= 0) X-Git-Tag: REL7_3~491 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3357577247d187feee74198bc8a9934235c67f90;p=postgresql Change Assert(len > 0) to Assert(len >= 0) Change PG_RETURN_INT32(0) to PG_RETURN_VOID() --- diff --git a/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c b/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c index 4f3199e889..a83eaae1f4 100644 --- a/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c +++ b/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c,v 1.3 2002/09/04 20:31:31 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -41,11 +41,11 @@ ascii_to_mic(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_SQL_ASCII); Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL); - Assert(len > 0); + Assert(len >= 0); pg_ascii2mic(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -57,9 +57,9 @@ mic_to_ascii(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL); Assert(PG_GETARG_INT32(1) == PG_SQL_ASCII); - Assert(len > 0); + Assert(len >= 0); pg_mic2ascii(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } diff --git a/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c b/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c index 7d4b8f423c..edf0710242 100644 --- a/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c +++ b/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c,v 1.3 2002/09/04 20:31:31 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -88,11 +88,11 @@ koi8r_to_mic(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_KOI8R); Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL); - Assert(len > 0); + Assert(len >= 0); koi8r2mic(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -104,11 +104,11 @@ mic_to_koi8r(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL); Assert(PG_GETARG_INT32(1) == PG_KOI8R); - Assert(len > 0); + Assert(len >= 0); mic2koi8r(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -120,11 +120,11 @@ iso_to_mic(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_ISO_8859_5); Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL); - Assert(len > 0); + Assert(len >= 0); iso2mic(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -136,11 +136,11 @@ mic_to_iso(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL); Assert(PG_GETARG_INT32(1) == PG_ISO_8859_5); - Assert(len > 0); + Assert(len >= 0); mic2iso(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -152,11 +152,11 @@ win1251_to_mic(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_WIN1251); Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL); - Assert(len > 0); + Assert(len >= 0); win12512mic(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -168,11 +168,11 @@ mic_to_win1251(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL); Assert(PG_GETARG_INT32(1) == PG_WIN1251); - Assert(len > 0); + Assert(len >= 0); mic2win1251(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -184,11 +184,11 @@ alt_to_mic(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_ALT); Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL); - Assert(len > 0); + Assert(len >= 0); alt2mic(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -200,11 +200,11 @@ mic_to_alt(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL); Assert(PG_GETARG_INT32(1) == PG_ALT); - Assert(len > 0); + Assert(len >= 0); mic2alt(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -217,14 +217,14 @@ koi8r_to_win1251(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_KOI8R); Assert(PG_GETARG_INT32(1) == PG_WIN1251); - Assert(len > 0); + Assert(len >= 0); buf = palloc(len * ENCODING_GROWTH_RATE); koi8r2mic(src, buf, len); mic2win1251(buf, dest, strlen(buf)); pfree(buf); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -237,14 +237,14 @@ win1251_to_koi8r(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_WIN1251); Assert(PG_GETARG_INT32(1) == PG_KOI8R); - Assert(len > 0); + Assert(len >= 0); buf = palloc(len * ENCODING_GROWTH_RATE); win12512mic(src, buf, len); mic2koi8r(buf, dest, strlen(buf)); pfree(buf); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -257,14 +257,14 @@ koi8r_to_alt(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_KOI8R); Assert(PG_GETARG_INT32(1) == PG_ALT); - Assert(len > 0); + Assert(len >= 0); buf = palloc(len * ENCODING_GROWTH_RATE); koi8r2mic(src, buf, len); mic2alt(buf, dest, strlen(buf)); pfree(buf); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -277,14 +277,14 @@ alt_to_koi8r(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_ALT); Assert(PG_GETARG_INT32(1) == PG_KOI8R); - Assert(len > 0); + Assert(len >= 0); buf = palloc(len * ENCODING_GROWTH_RATE); alt2mic(src, buf, len); mic2koi8r(buf, dest, strlen(buf)); pfree(buf); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -297,14 +297,14 @@ alt_to_win1251(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_ALT); Assert(PG_GETARG_INT32(1) == PG_WIN1251); - Assert(len > 0); + Assert(len >= 0); buf = palloc(len * ENCODING_GROWTH_RATE); alt2mic(src, buf, len); mic2win1251(buf, dest, strlen(buf)); pfree(buf); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -317,14 +317,14 @@ win1251_to_alt(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_WIN1251); Assert(PG_GETARG_INT32(1) == PG_ALT); - Assert(len > 0); + Assert(len >= 0); buf = palloc(len * ENCODING_GROWTH_RATE); win12512mic(src, buf, len); mic2alt(buf, dest, strlen(buf)); pfree(buf); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -337,14 +337,14 @@ iso_to_koi8r(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_ISO_8859_5); Assert(PG_GETARG_INT32(1) == PG_KOI8R); - Assert(len > 0); + Assert(len >= 0); buf = palloc(len * ENCODING_GROWTH_RATE); iso2mic(src, buf, len); mic2koi8r(buf, dest, strlen(buf)); pfree(buf); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -357,14 +357,14 @@ koi8r_to_iso(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_KOI8R); Assert(PG_GETARG_INT32(1) == PG_ISO_8859_5); - Assert(len > 0); + Assert(len >= 0); buf = palloc(len * ENCODING_GROWTH_RATE); koi8r2mic(src, buf, len); mic2iso(buf, dest, strlen(buf)); pfree(buf); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -377,14 +377,14 @@ iso_to_win1251(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_ISO_8859_5); Assert(PG_GETARG_INT32(1) == PG_WIN1251); - Assert(len > 0); + Assert(len >= 0); buf = palloc(len * ENCODING_GROWTH_RATE); iso2mic(src, buf, len); mic2win1251(buf, dest, strlen(buf)); pfree(buf); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -397,14 +397,14 @@ win1251_to_iso(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_WIN1251); Assert(PG_GETARG_INT32(1) == PG_ISO_8859_5); - Assert(len > 0); + Assert(len >= 0); buf = palloc(len * ENCODING_GROWTH_RATE); win12512mic(src, buf, len); mic2win1251(buf, dest, strlen(buf)); pfree(buf); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -417,14 +417,14 @@ iso_to_alt(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_ISO_8859_5); Assert(PG_GETARG_INT32(1) == PG_ALT); - Assert(len > 0); + Assert(len >= 0); buf = palloc(len * ENCODING_GROWTH_RATE); iso2mic(src, buf, len); mic2alt(buf, dest, strlen(buf)); pfree(buf); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -437,14 +437,14 @@ alt_to_iso(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_ALT); Assert(PG_GETARG_INT32(1) == PG_ISO_8859_5); - Assert(len > 0); + Assert(len >= 0); buf = palloc(len * ENCODING_GROWTH_RATE); alt2mic(src, buf, len); mic2alt(buf, dest, strlen(buf)); pfree(buf); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } /* diff --git a/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c b/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c index bddaddf3d0..e757d34102 100644 --- a/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c +++ b/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c,v 1.3 2002/09/04 20:31:31 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -44,11 +44,11 @@ euc_cn_to_mic(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_EUC_CN); Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL); - Assert(len > 0); + Assert(len >= 0); euc_cn2mic(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -60,11 +60,11 @@ mic_to_euc_cn(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL); Assert(PG_GETARG_INT32(1) == PG_EUC_CN); - Assert(len > 0); + Assert(len >= 0); mic2euc_cn(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } /* @@ -75,7 +75,7 @@ euc_cn2mic(unsigned char *euc, unsigned char *p, int len) { int c1; - while (len > 0 && (c1 = *euc++)) + while (len >= 0 && (c1 = *euc++)) { if (c1 & 0x80) { @@ -101,7 +101,7 @@ mic2euc_cn(unsigned char *mic, unsigned char *p, int len) { int c1; - while (len > 0 && (c1 = *mic)) + while (len >= 0 && (c1 = *mic)) { len -= pg_mic_mblen(mic++); diff --git a/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c b/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c index 6ba2407b75..6c5ccc332a 100644 --- a/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c +++ b/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c,v 1.3 2002/09/04 20:31:31 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -69,14 +69,14 @@ euc_jp_to_sjis(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_EUC_JP); Assert(PG_GETARG_INT32(1) == PG_SJIS); - Assert(len > 0); + Assert(len >= 0); buf = palloc(len * ENCODING_GROWTH_RATE); euc_jp2mic(src, buf, len); mic2sjis(buf, dest, strlen(buf)); pfree(buf); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -89,14 +89,14 @@ sjis_to_euc_jp(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_SJIS); Assert(PG_GETARG_INT32(1) == PG_EUC_JP); - Assert(len > 0); + Assert(len >= 0); buf = palloc(len * ENCODING_GROWTH_RATE); sjis2mic(src, buf, len); mic2euc_jp(buf, dest, strlen(buf)); pfree(buf); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -108,11 +108,11 @@ euc_jp_to_mic(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_EUC_JP); Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL); - Assert(len > 0); + Assert(len >= 0); euc_jp2mic(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -124,11 +124,11 @@ mic_to_euc_jp(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL); Assert(PG_GETARG_INT32(1) == PG_EUC_JP); - Assert(len > 0); + Assert(len >= 0); mic2sjis(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -140,11 +140,11 @@ sjis_to_mic(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_SJIS); Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL); - Assert(len > 0); + Assert(len >= 0); sjis2mic(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -156,11 +156,11 @@ mic_to_sjis(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL); Assert(PG_GETARG_INT32(1) == PG_SJIS); - Assert(len > 0); + Assert(len >= 0); mic2sjis(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } /* @@ -177,7 +177,7 @@ sjis2mic(unsigned char *sjis, unsigned char *p, int len) k2; /* Eiji Tokuya patched end */ - while (len > 0 && (c1 = *sjis++)) + while (len >= 0 && (c1 = *sjis++)) { if (c1 >= 0xa1 && c1 <= 0xdf) { @@ -303,7 +303,7 @@ mic2sjis(unsigned char *mic, unsigned char *p, int len) c2, k; - while (len > 0 && (c1 = *mic)) + while (len >= 0 && (c1 = *mic)) { len -= pg_mic_mblen(mic++); @@ -383,7 +383,7 @@ euc_jp2mic(unsigned char *euc, unsigned char *p, int len) { int c1; - while (len > 0 && (c1 = *euc++)) + while (len >= 0 && (c1 = *euc++)) { if (c1 == SS2) { /* 1 byte kana? */ @@ -422,7 +422,7 @@ mic2euc_jp(unsigned char *mic, unsigned char *p, int len) { int c1; - while (len > 0 && (c1 = *mic)) + while (len >= 0 && (c1 = *mic)) { len -= pg_mic_mblen(mic++); diff --git a/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c b/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c index c850cfa2be..079686d65e 100644 --- a/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c +++ b/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c,v 1.3 2002/09/04 20:31:31 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -44,11 +44,11 @@ euc_kr_to_mic(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_EUC_KR); Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL); - Assert(len > 0); + Assert(len >= 0); euc_kr2mic(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -60,11 +60,11 @@ mic_to_euc_kr(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL); Assert(PG_GETARG_INT32(1) == PG_EUC_KR); - Assert(len > 0); + Assert(len >= 0); mic2euc_kr(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } /* @@ -75,7 +75,7 @@ euc_kr2mic(unsigned char *euc, unsigned char *p, int len) { int c1; - while (len > 0 && (c1 = *euc++)) + while (len >= 0 && (c1 = *euc++)) { if (c1 & 0x80) { @@ -101,7 +101,7 @@ mic2euc_kr(unsigned char *mic, unsigned char *p, int len) { int c1; - while (len > 0 && (c1 = *mic)) + while (len >= 0 && (c1 = *mic)) { len -= pg_mic_mblen(mic++); diff --git a/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c b/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c index a4e1a007d9..d76fffbfff 100644 --- a/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c +++ b/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c,v 1.3 2002/09/04 20:31:31 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -57,14 +57,14 @@ euc_tw_to_big5(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_EUC_TW); Assert(PG_GETARG_INT32(1) == PG_BIG5); - Assert(len > 0); + Assert(len >= 0); buf = palloc(len * ENCODING_GROWTH_RATE); euc_tw2mic(src, buf, len); mic2big5(buf, dest, strlen(buf)); pfree(buf); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -77,14 +77,14 @@ big5_to_euc_tw(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_BIG5); Assert(PG_GETARG_INT32(1) == PG_EUC_TW); - Assert(len > 0); + Assert(len >= 0); buf = palloc(len * ENCODING_GROWTH_RATE); big52mic(src, buf, len); mic2euc_tw(buf, dest, strlen(buf)); pfree(buf); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -96,11 +96,11 @@ euc_tw_to_mic(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_EUC_TW); Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL); - Assert(len > 0); + Assert(len >= 0); euc_tw2mic(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -112,11 +112,11 @@ mic_to_euc_tw(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL); Assert(PG_GETARG_INT32(1) == PG_EUC_TW); - Assert(len > 0); + Assert(len >= 0); mic2big5(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -128,11 +128,11 @@ big5_to_mic(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_BIG5); Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL); - Assert(len > 0); + Assert(len >= 0); big52mic(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -144,11 +144,11 @@ mic_to_big5(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL); Assert(PG_GETARG_INT32(1) == PG_BIG5); - Assert(len > 0); + Assert(len >= 0); mic2big5(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } /* @@ -159,7 +159,7 @@ euc_tw2mic(unsigned char *euc, unsigned char *p, int len) { int c1; - while (len > 0 && (c1 = *euc++)) + while (len >= 0 && (c1 = *euc++)) { if (c1 == SS2) { @@ -201,7 +201,7 @@ mic2euc_tw(unsigned char *mic, unsigned char *p, int len) { int c1; - while (len > 0 && (c1 = *mic)) + while (len >= 0 && (c1 = *mic)) { len -= pg_mic_mblen(mic++); @@ -250,7 +250,7 @@ big52mic(unsigned char *big5, unsigned char *p, int len) char bogusBuf[3]; int i; - while (len > 0 && (c1 = *big5++)) + while (len >= 0 && (c1 = *big5++)) { if (c1 <= 0x7fU) { /* ASCII */ @@ -302,7 +302,7 @@ mic2big5(unsigned char *mic, unsigned char *p, int len) unsigned short big5buf, cnsBuf; - while (len > 0 && (c1 = *mic)) + while (len >= 0 && (c1 = *mic)) { l = pg_mic_mblen(mic++); len -= l; diff --git a/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c b/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c index 31227761dd..0c382f151b 100644 --- a/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c +++ b/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c,v 1.3 2002/09/04 20:31:31 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -56,11 +56,11 @@ latin2_to_mic(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_LATIN2); Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL); - Assert(len > 0); + Assert(len >= 0); latin22mic(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -72,11 +72,11 @@ mic_to_latin2(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL); Assert(PG_GETARG_INT32(1) == PG_LATIN2); - Assert(len > 0); + Assert(len >= 0); mic2latin2(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -88,11 +88,11 @@ win1250_to_mic(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_WIN1250); Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL); - Assert(len > 0); + Assert(len >= 0); win12502mic(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -104,11 +104,11 @@ mic_to_win1250(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL); Assert(PG_GETARG_INT32(1) == PG_WIN1250); - Assert(len > 0); + Assert(len >= 0); mic2win1250(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -121,14 +121,14 @@ latin2_to_win1250(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_LATIN2); Assert(PG_GETARG_INT32(1) == PG_WIN1250); - Assert(len > 0); + Assert(len >= 0); buf = palloc(len * ENCODING_GROWTH_RATE); latin22mic(src, buf, len); mic2win1250(buf, dest, strlen(buf)); pfree(buf); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -141,14 +141,14 @@ win1250_to_latin2(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_WIN1250); Assert(PG_GETARG_INT32(1) == PG_LATIN2); - Assert(len > 0); + Assert(len >= 0); buf = palloc(len * ENCODING_GROWTH_RATE); win12502mic(src, buf, len); mic2latin2(buf, dest, strlen(buf)); pfree(buf); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } static void diff --git a/src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c b/src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c index d08470d5d0..17c98b0115 100644 --- a/src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c +++ b/src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c,v 1.3 2002/09/04 20:31:31 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -56,11 +56,11 @@ latin1_to_mic(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_LATIN1); Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL); - Assert(len > 0); + Assert(len >= 0); latin12mic(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -72,11 +72,11 @@ mic_to_latin1(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL); Assert(PG_GETARG_INT32(1) == PG_LATIN1); - Assert(len > 0); + Assert(len >= 0); mic2latin1(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -88,11 +88,11 @@ latin3_to_mic(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_LATIN3); Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL); - Assert(len > 0); + Assert(len >= 0); latin32mic(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -104,11 +104,11 @@ mic_to_latin3(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL); Assert(PG_GETARG_INT32(1) == PG_LATIN3); - Assert(len > 0); + Assert(len >= 0); mic2latin3(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -120,11 +120,11 @@ latin4_to_mic(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_LATIN4); Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL); - Assert(len > 0); + Assert(len >= 0); latin42mic(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -136,11 +136,11 @@ mic_to_latin4(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL); Assert(PG_GETARG_INT32(1) == PG_LATIN4); - Assert(len > 0); + Assert(len >= 0); mic2latin4(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } static void diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c b/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c index 71448e3280..b3f529a4ab 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c,v 1.3 2002/09/04 20:31:31 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -41,11 +41,11 @@ ascii_to_utf8(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_SQL_ASCII); Assert(PG_GETARG_INT32(1) == PG_UTF8); - Assert(len > 0); + Assert(len >= 0); pg_ascii2mic(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -57,9 +57,9 @@ utf8_to_ascii(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_UTF8); Assert(PG_GETARG_INT32(1) == PG_SQL_ASCII); - Assert(len > 0); + Assert(len >= 0); pg_mic2ascii(src, dest, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c b/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c index f2adecb2fe..5c9aad04d2 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c,v 1.3 2002/09/04 20:31:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -42,12 +42,12 @@ big5_to_utf8(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_BIG5); Assert(PG_GETARG_INT32(1) == PG_UTF8); - Assert(len > 0); + Assert(len >= 0); LocalToUtf(src, dest, LUmapBIG5, sizeof(LUmapBIG5) / sizeof(pg_local_to_utf), PG_BIG5, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -59,10 +59,10 @@ utf8_to_big5(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_UTF8); Assert(PG_GETARG_INT32(1) == PG_BIG5); - Assert(len > 0); + Assert(len >= 0); UtfToLocal(src, dest, ULmapBIG5, sizeof(ULmapBIG5) / sizeof(pg_utf_to_local), len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c b/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c index 31693a14f6..e88201c9b0 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c,v 1.3 2002/09/04 20:31:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -55,12 +55,12 @@ utf8_to_koi8r(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_UTF8); Assert(PG_GETARG_INT32(1) == PG_KOI8R); - Assert(len > 0); + Assert(len >= 0); UtfToLocal(src, dest, ULmap_KOI8R, sizeof(ULmap_KOI8R) / sizeof(pg_utf_to_local), len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -72,12 +72,12 @@ koi8r_to_utf8(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_KOI8R); Assert(PG_GETARG_INT32(1) == PG_UTF8); - Assert(len > 0); + Assert(len >= 0); LocalToUtf(src, dest, LUmapKOI8R, sizeof(LUmapKOI8R) / sizeof(pg_local_to_utf), PG_KOI8R, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -89,12 +89,12 @@ utf8_to_win1251(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_UTF8); Assert(PG_GETARG_INT32(1) == PG_WIN1251); - Assert(len > 0); + Assert(len >= 0); UtfToLocal(src, dest, ULmap_WIN1251, sizeof(ULmap_WIN1251) / sizeof(pg_utf_to_local), len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -106,12 +106,12 @@ win1251_to_utf8(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_WIN1251); Assert(PG_GETARG_INT32(1) == PG_UTF8); - Assert(len > 0); + Assert(len >= 0); LocalToUtf(src, dest, LUmapWIN1251, sizeof(LUmapWIN1251) / sizeof(pg_local_to_utf), PG_WIN1251, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -123,12 +123,12 @@ utf8_to_alt(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_UTF8); Assert(PG_GETARG_INT32(1) == PG_ALT); - Assert(len > 0); + Assert(len >= 0); UtfToLocal(src, dest, ULmap_ALT, sizeof(ULmap_ALT) / sizeof(pg_utf_to_local), len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -140,10 +140,10 @@ alt_to_utf8(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_ALT); Assert(PG_GETARG_INT32(1) == PG_UTF8); - Assert(len > 0); + Assert(len >= 0); LocalToUtf(src, dest, LUmapALT, sizeof(LUmapALT) / sizeof(pg_local_to_utf), PG_ALT, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c b/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c index cfedb309ea..2a5f02416f 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c,v 1.3 2002/09/04 20:31:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -42,12 +42,12 @@ euc_cn_to_utf8(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_EUC_CN); Assert(PG_GETARG_INT32(1) == PG_UTF8); - Assert(len > 0); + Assert(len >= 0); LocalToUtf(src, dest, LUmapEUC_CN, sizeof(LUmapEUC_CN) / sizeof(pg_local_to_utf), PG_EUC_CN, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -59,10 +59,10 @@ utf8_to_euc_cn(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_UTF8); Assert(PG_GETARG_INT32(1) == PG_EUC_CN); - Assert(len > 0); + Assert(len >= 0); UtfToLocal(src, dest, ULmapEUC_CN, sizeof(ULmapEUC_CN) / sizeof(pg_utf_to_local), len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c b/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c index 7ea81cd897..f58aa497b4 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c,v 1.3 2002/09/04 20:31:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -42,12 +42,12 @@ euc_jp_to_utf8(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_EUC_JP); Assert(PG_GETARG_INT32(1) == PG_UTF8); - Assert(len > 0); + Assert(len >= 0); LocalToUtf(src, dest, LUmapEUC_JP, sizeof(LUmapEUC_JP) / sizeof(pg_local_to_utf), PG_EUC_JP, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -59,10 +59,10 @@ utf8_to_euc_jp(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_UTF8); Assert(PG_GETARG_INT32(1) == PG_EUC_JP); - Assert(len > 0); + Assert(len >= 0); UtfToLocal(src, dest, ULmapEUC_JP, sizeof(ULmapEUC_JP) / sizeof(pg_utf_to_local), len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c b/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c index 6700b738a2..cd19dce348 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c,v 1.3 2002/09/04 20:31:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -42,12 +42,12 @@ euc_kr_to_utf8(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_EUC_KR); Assert(PG_GETARG_INT32(1) == PG_UTF8); - Assert(len > 0); + Assert(len >= 0); LocalToUtf(src, dest, LUmapEUC_KR, sizeof(LUmapEUC_KR) / sizeof(pg_local_to_utf), PG_EUC_KR, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -59,10 +59,10 @@ utf8_to_euc_kr(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_UTF8); Assert(PG_GETARG_INT32(1) == PG_EUC_KR); - Assert(len > 0); + Assert(len >= 0); UtfToLocal(src, dest, ULmapEUC_KR, sizeof(ULmapEUC_KR) / sizeof(pg_utf_to_local), len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c b/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c index b094cf145b..c6116ae6a3 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c,v 1.3 2002/09/04 20:31:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -42,12 +42,12 @@ euc_tw_to_utf8(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_EUC_TW); Assert(PG_GETARG_INT32(1) == PG_UTF8); - Assert(len > 0); + Assert(len >= 0); LocalToUtf(src, dest, LUmapEUC_TW, sizeof(LUmapEUC_TW) / sizeof(pg_local_to_utf), PG_EUC_TW, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -59,10 +59,10 @@ utf8_to_euc_tw(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_UTF8); Assert(PG_GETARG_INT32(1) == PG_EUC_TW); - Assert(len > 0); + Assert(len >= 0); UtfToLocal(src, dest, ULmapEUC_TW, sizeof(ULmapEUC_TW) / sizeof(pg_utf_to_local), len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c b/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c index bc293a4305..611d0a0cac 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c,v 1.3 2002/09/04 20:31:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -42,12 +42,12 @@ gb18030_to_utf8(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_GB18030); Assert(PG_GETARG_INT32(1) == PG_UTF8); - Assert(len > 0); + Assert(len >= 0); LocalToUtf(src, dest, LUmapGB18030, sizeof(LUmapGB18030) / sizeof(pg_local_to_utf), PG_GB18030, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -59,10 +59,10 @@ utf8_to_gb18030(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_UTF8); Assert(PG_GETARG_INT32(1) == PG_GB18030); - Assert(len > 0); + Assert(len >= 0); UtfToLocal(src, dest, ULmapGB18030, sizeof(ULmapGB18030) / sizeof(pg_utf_to_local), len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c b/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c index 94392a4ba8..85b0480bef 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c,v 1.3 2002/09/04 20:31:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -42,12 +42,12 @@ gbk_to_utf8(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_GBK); Assert(PG_GETARG_INT32(1) == PG_UTF8); - Assert(len > 0); + Assert(len >= 0); LocalToUtf(src, dest, LUmapGBK, sizeof(LUmapGBK) / sizeof(pg_local_to_utf), PG_GBK, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -59,10 +59,10 @@ utf8_to_gbk(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_UTF8); Assert(PG_GETARG_INT32(1) == PG_GBK); - Assert(len > 0); + Assert(len >= 0); UtfToLocal(src, dest, ULmapGBK, sizeof(ULmapGBK) / sizeof(pg_utf_to_local), len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c b/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c index f8d331e853..7e19421c89 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c,v 1.3 2002/09/04 20:31:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -133,11 +133,11 @@ iso8859_to_utf8(PG_FUNCTION_ARGS) int len = PG_GETARG_INT32(4); Assert(PG_GETARG_INT32(1) == PG_UTF8); - Assert(len > 0); + Assert(len >= 0); LocalToUtf(src, dest, maps[encoding].map1, maps[encoding].size1, encoding, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -149,9 +149,9 @@ utf8_to_iso8859(PG_FUNCTION_ARGS) int len = PG_GETARG_INT32(4); Assert(PG_GETARG_INT32(0) == PG_UTF8); - Assert(len > 0); + Assert(len >= 0); UtfToLocal(src, dest, maps[encoding].map2, maps[encoding].size2, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c b/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c index 03302345d8..ed36bc33ce 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c,v 1.3 2002/09/04 20:31:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -42,7 +42,7 @@ iso8859_1_to_utf8(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_LATIN1); Assert(PG_GETARG_INT32(1) == PG_UTF8); - Assert(len > 0); + Assert(len >= 0); while (len-- > 0 && (c = *src++)) { @@ -56,7 +56,7 @@ iso8859_1_to_utf8(PG_FUNCTION_ARGS) } *dest = '\0'; - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -71,9 +71,9 @@ utf8_to_iso8859_1(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_UTF8); Assert(PG_GETARG_INT32(1) == PG_LATIN1); - Assert(len > 0); + Assert(len >= 0); - while (len > 0 && (c = *src++)) + while (len >= 0 && (c = *src++)) { if ((c & 0xe0) == 0xc0) { @@ -93,5 +93,5 @@ utf8_to_iso8859_1(PG_FUNCTION_ARGS) } *dest = '\0'; - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c b/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c index c385922bfc..dc9ec630c2 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c,v 1.3 2002/09/04 20:31:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -42,12 +42,12 @@ johab_to_utf8(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_JOHAB); Assert(PG_GETARG_INT32(1) == PG_UTF8); - Assert(len > 0); + Assert(len >= 0); LocalToUtf(src, dest, LUmapJOHAB, sizeof(LUmapJOHAB) / sizeof(pg_local_to_utf), PG_JOHAB, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -59,10 +59,10 @@ utf8_to_johab(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_UTF8); Assert(PG_GETARG_INT32(1) == PG_JOHAB); - Assert(len > 0); + Assert(len >= 0); UtfToLocal(src, dest, ULmapJOHAB, sizeof(ULmapJOHAB) / sizeof(pg_utf_to_local), len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c b/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c index e42822e3e9..ae53ed71bf 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c,v 1.3 2002/09/04 20:31:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -42,12 +42,12 @@ sjis_to_utf8(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_SJIS); Assert(PG_GETARG_INT32(1) == PG_UTF8); - Assert(len > 0); + Assert(len >= 0); LocalToUtf(src, dest, LUmapSJIS, sizeof(LUmapSJIS) / sizeof(pg_local_to_utf), PG_SJIS, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -59,10 +59,10 @@ utf8_to_sjis(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_UTF8); Assert(PG_GETARG_INT32(1) == PG_SJIS); - Assert(len > 0); + Assert(len >= 0); UtfToLocal(src, dest, ULmapSJIS, sizeof(ULmapSJIS) / sizeof(pg_utf_to_local), len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_tcvn/utf8_and_tcvn.c b/src/backend/utils/mb/conversion_procs/utf8_and_tcvn/utf8_and_tcvn.c index a6b47d8e1a..df1cfe6c13 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_tcvn/utf8_and_tcvn.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_tcvn/utf8_and_tcvn.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_tcvn/Attic/utf8_and_tcvn.c,v 1.3 2002/09/04 20:31:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_tcvn/Attic/utf8_and_tcvn.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -42,12 +42,12 @@ tcvn_to_utf8(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_TCVN); Assert(PG_GETARG_INT32(1) == PG_UTF8); - Assert(len > 0); + Assert(len >= 0); LocalToUtf(src, dest, LUmapTCVN, sizeof(LUmapTCVN) / sizeof(pg_local_to_utf), PG_TCVN, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -59,10 +59,10 @@ utf8_to_tcvn(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_UTF8); Assert(PG_GETARG_INT32(1) == PG_TCVN); - Assert(len > 0); + Assert(len >= 0); UtfToLocal(src, dest, ULmapTCVN, sizeof(ULmapTCVN) / sizeof(pg_utf_to_local), len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c b/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c index afd3c68990..95ba7a7134 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c,v 1.3 2002/09/04 20:31:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c,v 1.4 2002/09/13 06:41:17 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -42,12 +42,12 @@ uhc_to_utf8(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_UHC); Assert(PG_GETARG_INT32(1) == PG_UTF8); - Assert(len > 0); + Assert(len >= 0); LocalToUtf(src, dest, LUmapUHC, sizeof(LUmapUHC) / sizeof(pg_local_to_utf), PG_UHC, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -59,10 +59,10 @@ utf8_to_uhc(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_UTF8); Assert(PG_GETARG_INT32(1) == PG_UHC); - Assert(len > 0); + Assert(len >= 0); UtfToLocal(src, dest, ULmapUHC, sizeof(ULmapUHC) / sizeof(pg_utf_to_local), len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_win1250/utf8_and_win1250.c b/src/backend/utils/mb/conversion_procs/utf8_and_win1250/utf8_and_win1250.c index eab60c2115..ca04e9eba1 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_win1250/utf8_and_win1250.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_win1250/utf8_and_win1250.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1250/Attic/utf8_and_win1250.c,v 1.3 2002/09/04 20:31:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1250/Attic/utf8_and_win1250.c,v 1.4 2002/09/13 06:41:18 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -43,12 +43,12 @@ utf_to_win1250(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_UTF8); Assert(PG_GETARG_INT32(1) == PG_WIN1250); - Assert(len > 0); + Assert(len >= 0); UtfToLocal(src, dest, ULmapWIN1250, sizeof(ULmapWIN1250) / sizeof(pg_utf_to_local), len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -60,10 +60,10 @@ win1250_to_utf(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_WIN1250); Assert(PG_GETARG_INT32(1) == PG_UTF8); - Assert(len > 0); + Assert(len >= 0); LocalToUtf(src, dest, LUmapWIN1250, sizeof(LUmapWIN1250) / sizeof(pg_local_to_utf), PG_WIN1250, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_win1256/utf8_and_win1256.c b/src/backend/utils/mb/conversion_procs/utf8_and_win1256/utf8_and_win1256.c index 073e11ee26..1a9f326cc0 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_win1256/utf8_and_win1256.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_win1256/utf8_and_win1256.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1256/Attic/utf8_and_win1256.c,v 1.3 2002/09/04 20:31:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1256/Attic/utf8_and_win1256.c,v 1.4 2002/09/13 06:41:18 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -43,12 +43,12 @@ utf_to_win1256(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_UTF8); Assert(PG_GETARG_INT32(1) == PG_WIN1256); - Assert(len > 0); + Assert(len >= 0); UtfToLocal(src, dest, ULmapWIN1256, sizeof(ULmapWIN1256) / sizeof(pg_utf_to_local), len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -60,10 +60,10 @@ win1256_to_utf(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_WIN1256); Assert(PG_GETARG_INT32(1) == PG_UTF8); - Assert(len > 0); + Assert(len >= 0); LocalToUtf(src, dest, LUmapWIN1256, sizeof(LUmapWIN1256) / sizeof(pg_local_to_utf), PG_WIN1256, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_win874/utf8_and_win874.c b/src/backend/utils/mb/conversion_procs/utf8_and_win874/utf8_and_win874.c index 38a3f2b5a6..12e709572f 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_win874/utf8_and_win874.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_win874/utf8_and_win874.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win874/Attic/utf8_and_win874.c,v 1.3 2002/09/04 20:31:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win874/Attic/utf8_and_win874.c,v 1.4 2002/09/13 06:41:18 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -43,12 +43,12 @@ utf_to_win874(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_UTF8); Assert(PG_GETARG_INT32(1) == PG_WIN874); - Assert(len > 0); + Assert(len >= 0); UtfToLocal(src, dest, ULmapWIN874, sizeof(ULmapWIN874) / sizeof(pg_utf_to_local), len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); } Datum @@ -60,10 +60,10 @@ win874_to_utf(PG_FUNCTION_ARGS) Assert(PG_GETARG_INT32(0) == PG_WIN874); Assert(PG_GETARG_INT32(1) == PG_UTF8); - Assert(len > 0); + Assert(len >= 0); LocalToUtf(src, dest, LUmapWIN874, sizeof(LUmapWIN874) / sizeof(pg_local_to_utf), PG_WIN874, len); - PG_RETURN_INT32(0); + PG_RETURN_VOID(); }