Commit f6a05fd9 authored by Robert Haas's avatar Robert Haas

Fix failure of new wchar->mb functions to advance from pointer.

Bug spotted by Tom Lane.
parent 2eeb5eb2
...@@ -380,6 +380,7 @@ pg_wchar2euc_with_len(const pg_wchar *from, unsigned char *to, int len) ...@@ -380,6 +380,7 @@ pg_wchar2euc_with_len(const pg_wchar *from, unsigned char *to, int len)
*to++ = *from; *to++ = *from;
cnt++; cnt++;
} }
from++;
len--; len--;
} }
*to = 0; *to = 0;
...@@ -518,9 +519,10 @@ pg_wchar2utf_with_len(const pg_wchar *from, unsigned char *to, int len) ...@@ -518,9 +519,10 @@ pg_wchar2utf_with_len(const pg_wchar *from, unsigned char *to, int len)
unicode_to_utf8(*from, to); unicode_to_utf8(*from, to);
char_len = pg_utf_mblen(to); char_len = pg_utf_mblen(to);
len--;
cnt += char_len; cnt += char_len;
to += char_len; to += char_len;
from++;
len--;
} }
*to = 0; *to = 0;
return cnt; return cnt;
...@@ -854,6 +856,7 @@ pg_wchar2mule_with_len(const pg_wchar *from, unsigned char *to, int len) ...@@ -854,6 +856,7 @@ pg_wchar2mule_with_len(const pg_wchar *from, unsigned char *to, int len)
*to++ = lb; *to++ = lb;
cnt += 1; cnt += 1;
} }
from++;
len--; len--;
} }
*to = 0; *to = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment