Lines Matching refs:fn
66 #define RETURN(e,n,fn) \
67 if (*fn && !e) e = E2BIG; \
260 _win_iconv(_ast_iconv_t cd, char** fb, size_t* fn, char** tb, size_t* tn)
280 fz = tz = (*fn < *tn) ? *fn : *tn;
286 un = *fn;
294 if ((tz = MultiByteToWideChar(cc->from.index, 0, (LPCSTR)*fb, (int)*fn, (LPWSTR)*tb, *tn)) && tz <= *tn)
296 fz = *fn;
307 pz = *fn / 2;
308 fz = *fn - pz;
312 if (++fz >= *fn)
337 un = *fn / sizeof(WCHAR);
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)))
352 fz = *fn;
361 pz = *fn / 2;
362 bz = *fn - pz;
366 if (++bz > *fn)
389 error(DEBUG_TRACE, "AHA#%d _win_iconv *fn=%u fz=%u[%u] *tn=%u tz=%u\n", __LINE__, *fn, fz, fz * sizeof(WCHAR), *tn, tz);
400 *fn -= fz;
531 utf2bin(_ast_iconv_t cd, char** fb, size_t* fn, char** tb, size_t* tn)
545 fe = f + (*fn);
593 *fn -= (char*)f - (*fb);
597 RETURN(e, n, fn);
605 bin2utf(_ast_iconv_t cd, char** fb, size_t* fn, char** tb, size_t* tn)
618 fe = f + (*fn);
667 *fn -= (n = (char*)f - (*fb));
671 RETURN(e, n, fn);
715 ume2bin(_ast_iconv_t cd, char** fb, size_t* fn, char** tb, size_t* tn)
731 fe = f + (*fn);
779 *fn -= (char*)f - (*fb);
783 RETURN(e, n, fn);
791 bin2ume(_ast_iconv_t cd, char** fb, size_t* fn, char** tb, size_t* tn)
806 fe = f + (*fn);
853 *fn -= (n = (char*)f - (*fb));
857 RETURN(e, n, fn);
865 ucs2bin(_ast_iconv_t cd, char** fb, size_t* fn, char** tb, size_t* tn)
877 fe = f + (*fn);
898 *fn -= (char*)f - (*fb);
902 RETURN(e, n, fn);
910 bin2ucs(_ast_iconv_t cd, char** fb, size_t* fn, char** tb, size_t* tn)
923 fe = f + (*fn);
944 *fn -= (n = (char*)f - (*fb));
948 RETURN(e, n, fn);
956 scu2bin(_ast_iconv_t cd, char** fb, size_t* fn, char** tb, size_t* tn)
968 fe = f + (*fn);
989 *fn -= (char*)f - (*fb);
993 RETURN(e, n, fn);
1001 bin2scu(_ast_iconv_t cd, char** fb, size_t* fn, char** tb, size_t* tn)
1014 fe = f + (*fn);
1035 *fn -= (n = (char*)f - (*fb));
1039 RETURN(e, n, fn);
1230 * copy *fb size *fn to *tb size *tn
1231 * fb,fn tb,tn updated on return
1235 _ast_iconv(_ast_iconv_t cd, char** fb, size_t* fn, char** tb, size_t* tn)
1271 tfn = *fn;
1279 *fn -= i;
1282 if ((*cc->from.fun)(cc->cvt, fb, fn, tb, tn) == (size_t)(-1))
1296 return (*cc->to.fun)(cc->cvt, fb, fn, tb, tn);
1302 if ((n = *fn) > cc->size)
1309 n = (*cc->to.fun)(cc->cvt, &b, fn, tb, tn);
1314 if (n > *fn)
1315 n = *fn;
1327 *fn -= n;
1336 * write *fb size *fn to op
1337 * fb,fn updated on return
1342 _ast_iconv_write(_ast_iconv_t cd, Sfio_t* op, char** fb, size_t* fn, Iconv_disc_t* disc)
1368 while (ok && *fn > 0)
1381 while (*fn > 0 && _ast_iconv(cd, fb, fn, &ts, &tn) == (size_t)(-1))
1386 error(DEBUG_TRACE, "AHA#%d iconv_write %d => %d `%-.*s'", __LINE__, *fn, tn, *fn, *fb);
1387 _r = _ast_iconv(cd, fb, fn, &ts, &tn);
1388 error(DEBUG_TRACE, "AHA#%d iconv_write %d => %d [%d]", __LINE__, *fn, tn, _r);
1389 if (_r != (size_t)(-1) || !fn)
1413 (*fn)--;
1445 size_t fn;
1470 fn = n;
1479 fn = fo;
1488 while (fn > 0 && _ast_iconv(cd, &fs, &fn, &ts, &tn) == (size_t)(-1))
1495 if (fe == ft + (fo - fn))
1499 (*disc->errorf)(NiL, disc, ERROR_SYSTEM|2, "incomplete multibyte sequence at offset %I*u", sizeof(ft), ft + (fo - fn));
1506 (*disc->errorf)(NiL, disc, ERROR_SYSTEM|2, "invalid multibyte sequence at offset %I*u", sizeof(ft), ft + (fo - fn));
1517 fn--;
1531 for (i = fn; --i >= (fs - fb);)
1540 if (fn == fo)
1541 fn++;