Lines Matching refs:cc

239 _win_iconv_open(register Conv_t* cc, const char* t, const char* f)
244 if ((cc->from.index = _win_codeset(f)) < 0)
246 if ((cc->to.index = _win_codeset(t)) < 0)
249 error(DEBUG_TRACE, "AHA#%d _win_iconv_open f=0x%04x t=0x%04x\n", __LINE__, cc->from.index, cc->to.index);
251 return (_ast_iconv_t)cc;
262 Conv_t* cc = (Conv_t*)cd;
272 error(DEBUG_TRACE, "AHA#%d _win_iconv from=0x%04x to=0x%04x\n", __LINE__, cc->from.index, cc->to.index);
274 if (cc->from.index == cc->to.index)
292 if (cc->to.index == CP_UCS2)
294 if ((tz = MultiByteToWideChar(cc->from.index, 0, (LPCSTR)*fb, (int)*fn, (LPWSTR)*tb, *tn)) && tz <= *tn)
311 while (!(tz = MultiByteToWideChar(cc->from.index, 0, (LPCSTR)*fb, (int)fz, (LPWSTR)*tb, 0)))
335 if (cc->from.index == CP_UCS2)
340 else if (!(un = MultiByteToWideChar(cc->from.index, 0, (LPCSTR)*fb, (int)*fn, (LPWSTR)*tb, 0)))
344 else if (!(un = MultiByteToWideChar(cc->from.index, 0, (LPCSTR)*fb, (int)*fn, (LPWSTR)ub, un)))
351 if (tz = WideCharToMultiByte(cc->to.index, 0, (LPCWSTR)ub, un, *tb, *tn, 0, 0))
365 while (!(fz = MultiByteToWideChar(cc->from.index, 0, (LPCSTR)*fb, (int)bz, (LPWSTR)ub, un)))
368 if (!(tz = WideCharToMultiByte(cc->to.index, 0, (LPCWSTR)ub, fz, *tb, 0, 0, 0)))
386 if (!(tz = WideCharToMultiByte(cc->to.index, 0, (LPCWSTR)ub, fz, *tb, tz, 0, 0)))
1049 register Conv_t* cc;
1084 if ((cc = freelist[i]) && streq(to, cc->to.name) && streq(fr, cc->from.name))
1092 if (cc->cvt != (iconv_t)(-1))
1093 iconv(cc->cvt, NiL, NiL, NiL, NiL);
1095 return cc;
1102 if (!(cc = newof(0, Conv_t, 1, strlen(to) + strlen(fr) + 2)))
1104 cc->to.name = (char*)(cc + 1);
1105 cc->from.name = strcopy(cc->to.name, to) + 1;
1106 strcpy(cc->from.name, fr);
1107 cc->cvt = (iconv_t)(-1);
1114 cc->from.map = ccmap(fc, tc);
1116 else if ((cc->cvt = iconv_open(t, f)) != (iconv_t)(-1) || (cc->cvt = iconv_open(to, fr)) != (iconv_t)(-1))
1117 cc->from.fun = (_ast_iconv_f)iconv;
1120 else if ((cc->cvt = _win_iconv_open(cc, t, f)) != (_ast_iconv_t)(-1) || (cc->cvt = _win_iconv_open(cc, to, fr)) != (_ast_iconv_t)(-1))
1121 cc->from.fun = (_ast_iconv_f)_win_iconv;
1128 cc->from.fun = utf2bin;
1131 cc->from.fun = ume2bin;
1134 cc->from.fun = ucs2bin;
1137 cc->from.fun = scu2bin;
1144 cc->from.map = ccmap(fc, CC_ASCII);
1150 cc->to.fun = bin2utf;
1153 cc->to.fun = bin2ume;
1156 cc->to.fun = bin2ucs;
1159 cc->to.fun = bin2scu;
1166 cc->to.map = ccmap(CC_ASCII, tc);
1170 return (iconv_t)cc;
1182 Conv_t* cc;
1189 if (!(cc = (Conv_t*)cd))
1225 freelist[freeindex = i] = cc;
1237 Conv_t* cc = (Conv_t*)cd;
1257 if (cc)
1259 if (cc->from.fun)
1261 if (cc->to.fun)
1263 if (!cc->buf && !(cc->buf = oldof(0, char, cc->size = SF_BUFSIZE, 0)))
1268 b = cc->buf;
1269 i = cc->size;
1272 if ((*cc->from.fun)(cc->cvt, &tfb, &tfn, &b, &i) == (size_t)(-1))
1274 tfn = b - cc->buf;
1275 tfb = cc->buf;
1276 n = (*cc->to.fun)(cc->cvt, &tfb, &tfn, tb, tn);
1277 i = tfb - cc->buf;
1282 if ((*cc->from.fun)(cc->cvt, fb, fn, tb, tn) == (size_t)(-1))
1285 if (m = cc->to.map)
1293 else if (cc->to.fun)
1295 if (!(m = cc->from.map))
1296 return (*cc->to.fun)(cc->cvt, fb, fn, tb, tn);
1297 if (!cc->buf && !(cc->buf = oldof(0, char, cc->size = SF_BUFSIZE, 0)))
1302 if ((n = *fn) > cc->size)
1303 n = cc->size;
1306 t = (unsigned char*)(b = cc->buf);
1309 n = (*cc->to.fun)(cc->cvt, &b, fn, tb, tn);
1310 *fb += b - cc->buf;
1316 if (cc && (m = cc->from.map))