提交 c2e4110a 编写于 作者: D dapan1121

fix: fix mbs2ucs4 issue

上级 ad958177
...@@ -161,6 +161,13 @@ void taosConvDestroy() { ...@@ -161,6 +161,13 @@ void taosConvDestroy() {
} }
void taosAcquireConv(int32_t *idx) { void taosAcquireConv(int32_t *idx) {
if (0 == gConvMaxNum) {
gConv = taosMemoryCalloc(1, sizeof(SConv));
gConv[0].conv = iconv_open(DEFAULT_UNICODE_ENCODEC, tsCharset);
*idx = 0;
return;
}
while (true) { while (true) {
int32_t used = atomic_add_fetch_32(&convUsed, 1); int32_t used = atomic_add_fetch_32(&convUsed, 1);
if (used > gConvMaxNum) { if (used > gConvMaxNum) {
...@@ -189,6 +196,12 @@ void taosAcquireConv(int32_t *idx) { ...@@ -189,6 +196,12 @@ void taosAcquireConv(int32_t *idx) {
} }
void taosReleaseConv(int32_t idx) { void taosReleaseConv(int32_t idx) {
if (0 == gConvMaxNum) {
iconv_close(gConv[0].conv);
taosMemoryFreeClear(gConv);
return;
}
atomic_store_8(&gConv[idx].inUse, 0); atomic_store_8(&gConv[idx].inUse, 0);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册