mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
Fix failure of new wchar->mb functions to advance from pointer.
Bug spotted by Tom Lane.
This commit is contained in:
parent
2eeb5eb23f
commit
f6a05fd973
@ -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)
|
|||||||
|
|
||||||
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)
|
|||||||
*to++ = lb;
|
*to++ = lb;
|
||||||
cnt += 1;
|
cnt += 1;
|
||||||
}
|
}
|
||||||
|
from++;
|
||||||
len--;
|
len--;
|
||||||
}
|
}
|
||||||
*to = 0;
|
*to = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user