亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? encoding.c

?? Vovida 社區開源的 SIP 協議源碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* * encoding.c : implements the encoding conversion functions needed for XML * * Related specs:  * rfc2044        (UTF-8 and UTF-16) F. Yergeau Alis Technologies * [ISO-10646]    UTF-8 and UTF-16 in Annexes * [ISO-8859-1]   ISO Latin-1 characters codes. * [UNICODE]      The Unicode Consortium, "The Unicode Standard -- *                Worldwide Character Encoding -- Version 1.0", Addison- *                Wesley, Volume 1, 1991, Volume 2, 1992.  UTF-8 is *                described in Unicode Technical Report #4. * [US-ASCII]     Coded Character Set--7-bit American Standard Code for *                Information Interchange, ANSI X3.4-1986. * * Original code for IsoLatin1 and UTF-16 by "Martin J. Duerst" <duerst@w3.org> * * See Copyright for the status of this software. * * Daniel.Veillard@w3.org */#ifdef WIN32#include "win32config.h"#else#include "config.h"#endif#include <stdio.h>#include <string.h>#ifdef HAVE_CTYPE_H#include <ctype.h>#endif#ifdef HAVE_STDLIB_H#include <stdlib.h>#endif#include <libxml/encoding.h>#include <libxml/xmlmemory.h>xmlCharEncodingHandlerPtr xmlUTF16LEHandler = NULL;xmlCharEncodingHandlerPtr xmlUTF16BEHandler = NULL;/* * From rfc2044: encoding of the Unicode values on UTF-8: * * UCS-4 range (hex.)           UTF-8 octet sequence (binary) * 0000 0000-0000 007F   0xxxxxxx * 0000 0080-0000 07FF   110xxxxx 10xxxxxx * 0000 0800-0000 FFFF   1110xxxx 10xxxxxx 10xxxxxx  * * I hope we won't use values > 0xFFFF anytime soon ! *//** * xmlCheckUTF8: Check utf-8 string for legality. * @utf: Pointer to putative utf-8 encoded string. * * Checks @utf for being valid utf-8. @utf is assumed to be * null-terminated. This function is not super-strict, as it will * allow longer utf-8 sequences than necessary. Note that Java is * capable of producing these sequences if provoked. Also note, this * routine checks for the 4-byte maxiumum size, but does not check for * 0x10ffff maximum value. * * Return value: true if @utf is valid. **/intxmlCheckUTF8(const unsigned char *utf){    int ix;    unsigned char c;    for (ix = 0; (c = utf[ix]);) {        if (c & 0x80) {	    if ((utf[ix + 1] & 0xc0) != 0x80)	        return(0);	    if ((c & 0xe0) == 0xe0) {	        if ((utf[ix + 2] & 0xc0) != 0x80)		    return(0);	        if ((c & 0xf0) == 0xf0) {		    if ((c & 0xf8) != 0xf0 || (utf[ix + 3] & 0xc0) != 0x80)		        return(0);		    ix += 4;		    /* 4-byte code */	        } else		  /* 3-byte code */		    ix += 3;	    } else	      /* 2-byte code */	        ix += 2;	} else	    /* 1-byte code */	    ix++;      }      return(1);}/** * isolat1ToUTF8: * @out:  a pointer to an array of bytes to store the result * @outlen:  the length of @out * @in:  a pointer to an array of ISO Latin 1 chars * @inlen:  the length of @in * * Take a block of ISO Latin 1 chars in and try to convert it to an UTF-8 * block of chars out. * Returns the number of byte written, or -1 by lack of space. */intisolat1ToUTF8(unsigned char* out, int outlen,              const unsigned char* in, int *inlen) {    unsigned char* outstart= out;    unsigned char* outend= out+outlen;    const unsigned char* inend= in+*inlen;    unsigned char c;    while (in < inend) {        c= *in++;        if (c < 0x80) {            if (out >= outend)  return(-1);            *out++ = c;        }        else {            if (out >= outend)  return(-1);            *out++ = 0xC0 | (c >> 6);            if (out >= outend)  return(-1);            *out++ = 0x80 | (0x3F & c);        }    }    return(out-outstart);}/** * UTF8Toisolat1: * @out:  a pointer to an array of bytes to store the result * @outlen:  the length of @out * @in:  a pointer to an array of UTF-8 chars * @inlen:  the length of @in * * Take a block of UTF-8 chars in and try to convert it to an ISO Latin 1 * block of chars out. * TODO: UTF8Toisolat1 need a fallback mechanism ... * * Returns the number of byte written, or -1 by lack of space, or -2 *     if the transcoding fails (for *in is not valid utf8 string or *     the result of transformation can't fit into the encoding we want) * The value of @inlen after return is the number of octets consumed *     as the return value is positive, else unpredictiable. */intUTF8Toisolat1(unsigned char* out, int outlen,              const unsigned char* in, int *inlen) {    unsigned char* outstart= out;    unsigned char* outend= out+outlen;    const unsigned char* inend= in+*inlen;    unsigned char c;    while (in < inend) {        c= *in++;        if (c < 0x80) {            if (out >= outend)  return(-1);            *out++= c;        }	else if (in == inend) {            *inlen -= 1;            break;	}	else if (((c & 0xFC) == 0xC0) && ((*in & 0xC0) == 0x80)) {	    /* a two byte utf-8 and can be encoding as isolate1 */            *out++= ((c & 0x03) << 6) | (*in++ & 0x3F);	}	else	    return(-2);	/* TODO : some should be represent as "&#x____;" */    }    return(out-outstart);}/** * UTF16LEToUTF8: * @out:  a pointer to an array of bytes to store the result * @outlen:  the length of @out * @inb:  a pointer to an array of UTF-16LE passwd as a byte array * @inlenb:  the length of @in in UTF-16LE chars * * Take a block of UTF-16LE ushorts in and try to convert it to an UTF-8 * block of chars out. This function assume the endian properity * is the same between the native type of this machine and the * inputed one. * * Returns the number of byte written, or -1 by lack of space, or -2 *     if the transcoding fails (for *in is not valid utf16 string) *     The value of *inlen after return is the number of octets consumed *     as the return value is positive, else unpredictiable. */intUTF16LEToUTF8(unsigned char* out, int outlen,            const unsigned char* inb, int *inlenb){    unsigned char* outstart= out;    unsigned char* outend= out+outlen;    unsigned short* in = (unsigned short*) inb;    unsigned short* inend;    unsigned int c, d, inlen;    unsigned char *tmp;    int bits;    if ((*inlenb % 2) == 1)        (*inlenb)--;    inlen = *inlenb / 2;    inend= in + inlen;    while (in < inend) {#ifdef BIG_ENDIAN	tmp = (unsigned char *) in;	c = *tmp++;	c = c | (((unsigned int)*tmp) << 8);	in++;#else /* BIG_ENDIAN */        c= *in++;#endif /* BIG_ENDIAN */        if ((c & 0xFC00) == 0xD800) {    /* surrogates */            if (in >= inend) {           /* (in > inend) shouldn't happens */                (*inlenb) -= 2;                break;            }#ifdef BIG_ENDIAN            tmp = (unsigned char *) in;            d = *tmp++;	    d = d | (((unsigned int)*tmp) << 8);	    in++;#else /* BIG_ENDIAN */            d = *in++;#endif /* BIG_ENDIAN */            if ((d & 0xFC00) == 0xDC00) {                c &= 0x03FF;                c <<= 10;                c |= d & 0x03FF;                c += 0x10000;            }            else	        return(-2);        }	/* assertion: c is a single UTF-4 value */        if (out >= outend)	    return(-1);        if      (c <    0x80) {  *out++=  c;                bits= -6; }        else if (c <   0x800) {  *out++= ((c >>  6) & 0x1F) | 0xC0;  bits=  0; }        else if (c < 0x10000) {  *out++= ((c >> 12) & 0x0F) | 0xE0;  bits=  6; }        else                  {  *out++= ((c >> 18) & 0x07) | 0xF0;  bits= 12; }         for ( ; bits >= 0; bits-= 6) {            if (out >= outend)	        return(-1);            *out++= ((c >> bits) & 0x3F) | 0x80;        }    }    return(out-outstart);}/** * UTF8ToUTF16LE: * @outb:  a pointer to an array of bytes to store the result * @outlen:  the length of @outb * @in:  a pointer to an array of UTF-8 chars * @inlen:  the length of @in * * Take a block of UTF-8 chars in and try to convert it to an UTF-16LE * block of chars out. * TODO: UTF8ToUTF16LE need a fallback mechanism ... * * Returns the number of byte written, or -1 by lack of space, or -2 *     if the transcoding failed.  */intUTF8ToUTF16LE(unsigned char* outb, int outlen,            const unsigned char* in, int *inlen){    unsigned short* out = (unsigned short*) outb;    unsigned short* outstart= out;    unsigned short* outend;    const unsigned char* inend= in+*inlen;    unsigned int c, d, trailing;#ifdef BIG_ENDIAN    unsigned char *tmp;    unsigned short tmp1, tmp2;#endif /* BIG_ENDIAN */    outlen /= 2; /* convert in short length */    outend = out + outlen;    while (in < inend) {      d= *in++;      if      (d < 0x80)  { c= d; trailing= 0; }      else if (d < 0xC0)          return(-2);    /* trailing byte in leading position */      else if (d < 0xE0)  { c= d & 0x1F; trailing= 1; }      else if (d < 0xF0)  { c= d & 0x0F; trailing= 2; }      else if (d < 0xF8)  { c= d & 0x07; trailing= 3; }      else          return(-2);    /* no chance for this in UTF-16 */      if (inend - in < trailing) {          *inlen -= (inend - in);          break;      }       for ( ; trailing; trailing--) {          if ((in >= inend) || (((d= *in++) & 0xC0) != 0x80))	      return(-1);          c <<= 6;          c |= d & 0x3F;      }      /* assertion: c is a single UTF-4 value */        if (c < 0x10000) {            if (out >= outend)	        return(-1);#ifdef BIG_ENDIAN            tmp = (unsigned char *) out;            *tmp = c ;            *(tmp + 1) = c >> 8 ;            out++;#else /* BIG_ENDIAN */            *out++ = c;#endif /* BIG_ENDIAN */        }        else if (c < 0x110000) {            if (out+1 >= outend)	        return(-1);            c -= 0x10000;#ifdef BIG_ENDIAN            tmp1 = 0xD800 | (c >> 10);            tmp = (unsigned char *) out;            *tmp = tmp1;            *(tmp + 1) = tmp1 >> 8;            out++;            tmp2 = 0xDC00 | (c & 0x03FF);            tmp = (unsigned char *) out;            *tmp  = tmp2;            *(tmp + 1) = tmp2 >> 8;            out++;#else /* BIG_ENDIAN */            *out++ = 0xD800 | (c >> 10);            *out++ = 0xDC00 | (c & 0x03FF);#endif /* BIG_ENDIAN */        }        else	    return(-1);    }    return(out-outstart);}/** * UTF16BEToUTF8: * @out:  a pointer to an array of bytes to store the result * @outlen:  the length of @out * @inb:  a pointer to an array of UTF-16 passwd as a byte array * @inlenb:  the length of @in in UTF-16 chars * * Take a block of UTF-16 ushorts in and try to convert it to an UTF-8 * block of chars out. This function assume the endian properity * is the same between the native type of this machine and the * inputed one. * * Returns the number of byte written, or -1 by lack of space, or -2 *     if the transcoding fails (for *in is not valid utf16 string) * The value of *inlen after return is the number of octets consumed *     as the return value is positive, else unpredictiable. */intUTF16BEToUTF8(unsigned char* out, int outlen,            const unsigned char* inb, int *inlenb){    unsigned char* outstart= out;    unsigned char* outend= out+outlen;    unsigned short* in = (unsigned short*) inb;    unsigned short* inend;    unsigned int c, d, inlen;#ifdef BIG_ENDIAN#else /* BIG_ENDIAN */    unsigned char *tmp;#endif /* BIG_ENDIAN */        int bits;    if ((*inlenb % 2) == 1)        (*inlenb)--;    inlen = *inlenb / 2;    inend= in + inlen;    while (in < inend) {#ifdef BIG_ENDIAN            c= *in++;#else        tmp = (unsigned char *) in;	c = *tmp++;	c = c << 8;	c = c | (unsigned int) *tmp;	in++;#endif	        if ((c & 0xFC00) == 0xD800) {    /* surrogates */	    if (in >= inend) {           /* (in > inend) shouldn't happens */	        (*inlenb) -= 2;		break;	    }#ifdef BIG_ENDIAN            d= *in++;#else            tmp = (unsigned char *) in;	    d = *tmp++;	    d = d << 8;	    d = d | (unsigned int) *tmp;	    in++;#endif	                if ((d & 0xFC00) == 0xDC00) {                c &= 0x03FF;                c <<= 10;                c |= d & 0x03FF;                c += 0x10000;            }            else 	        return(-2);        }	/* assertion: c is a single UTF-4 value */        if (out >= outend) 	    return(-1);        if      (c <    0x80) {  *out++=  c;                bits= -6; }        else if (c <   0x800) {  *out++= ((c >>  6) & 0x1F) | 0xC0;  bits=  0; }        else if (c < 0x10000) {  *out++= ((c >> 12) & 0x0F) | 0xE0;  bits=  6; }        else                  {  *out++= ((c >> 18) & 0x07) | 0xF0;  bits= 12; }         for ( ; bits >= 0; bits-= 6) {            if (out >= outend) 	        return(-1);            *out++= ((c >> bits) & 0x3F) | 0x80;        }    }    return(out-outstart);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人午夜激情在线| 丰满少妇在线播放bd日韩电影| 亚洲午夜激情网页| 午夜欧美在线一二页| 国内一区二区在线| 91福利视频网站| 精品国产三级电影在线观看| 18成人在线观看| 久久99国产精品久久| 波多野结衣欧美| 欧美一区二区在线免费观看| 中文幕一区二区三区久久蜜桃| 亚洲图片欧美色图| 国产福利一区在线观看| 欧美日韩国产高清一区| 日本一区二区成人| 久久成人免费日本黄色| caoporen国产精品视频| 一本久久综合亚洲鲁鲁五月天| 精品久久久久香蕉网| 亚洲成人一区二区在线观看| 大美女一区二区三区| 日韩一区二区免费在线电影| 亚洲图片你懂的| 国产一区999| 日韩欧美一级片| 亚洲大型综合色站| 91在线观看高清| 国产日韩欧美一区二区三区乱码| 日本欧美久久久久免费播放网| 色狠狠一区二区| 一区视频在线播放| 国产成人免费视频网站高清观看视频| 欧美视频一区二区三区在线观看| 久久久精品2019中文字幕之3| 日韩精品每日更新| 欧美视频日韩视频在线观看| 国产精品美女视频| 成人听书哪个软件好| 欧美一区二区三区免费在线看 | 一本久久a久久免费精品不卡| 精品国产免费视频| 激情欧美一区二区三区在线观看| av在线不卡网| 欧美国产成人在线| 国产成人日日夜夜| 国产亚洲一区字幕| 国产精品一区久久久久| 久久久精品影视| 国产电影一区在线| 国产精品看片你懂得| 国产成人久久精品77777最新版本| 久久在线免费观看| 国产一区二区三区| 国产性做久久久久久| 国产一区二区三区免费看| 久久网站热最新地址| 国产成人夜色高潮福利影视| 久久看人人爽人人| 成人午夜碰碰视频| 一区二区三区免费| 欧美日韩国产在线播放网站| 日本va欧美va精品| 精品国产乱码久久久久久老虎| 国产一区二区三区久久悠悠色av| 久久亚洲影视婷婷| www.亚洲色图| 性感美女极品91精品| 欧美高清www午色夜在线视频| 亚洲伦理在线免费看| 欧美日韩一区 二区 三区 久久精品| 午夜精品123| 国产婷婷色一区二区三区四区| 成人少妇影院yyyy| 偷拍日韩校园综合在线| 日韩欧美国产午夜精品| 成人免费视频一区二区| 亚洲一区视频在线观看视频| 欧美一区二区成人| 国产精品77777竹菊影视小说| 综合久久久久久久| 色综合久久中文字幕| 美女网站色91| 中文字幕一区二区在线观看| 555夜色666亚洲国产免| 国产真实乱对白精彩久久| 亚洲精品乱码久久久久久黑人| 88在线观看91蜜桃国自产| 国产精品一区二区在线播放| 自拍偷拍国产亚洲| 26uuu另类欧美| 欧美性猛交一区二区三区精品| 狠狠v欧美v日韩v亚洲ⅴ| 亚洲欧美经典视频| 69堂国产成人免费视频| 成人综合在线网站| 青青国产91久久久久久| 亚洲品质自拍视频| 久久久精品国产免大香伊| 欧美日韩性生活| 91亚洲午夜精品久久久久久| 日韩不卡一二三区| 国产精品久久久久久亚洲毛片 | 久久久精品免费观看| 91国在线观看| 成人黄色综合网站| 麻豆一区二区99久久久久| 一区二区三区四区av| 欧美极品美女视频| 精品日韩在线一区| 欧美美女一区二区| 99免费精品视频| 国产在线精品一区二区不卡了 | 欧美一区二区日韩一区二区| 91日韩在线专区| 丁香婷婷深情五月亚洲| 韩国一区二区三区| 免费人成精品欧美精品| 亚洲成人激情av| 亚洲与欧洲av电影| 亚洲欧洲日本在线| 国产午夜精品美女毛片视频| 欧美mv和日韩mv的网站| 91精品国产综合久久福利| 欧美亚洲日本一区| 色激情天天射综合网| 91视频在线观看免费| 成人网在线免费视频| 国产成人免费视频精品含羞草妖精| 美女一区二区视频| 麻豆免费看一区二区三区| 日韩成人av影视| 亚洲一区二区视频| 亚洲一二三四区| 亚洲国产色一区| 亚洲一区在线电影| 亚洲va韩国va欧美va精品| 亚洲成av人**亚洲成av**| 亚洲国产视频一区二区| 天天射综合影视| 亚洲aⅴ怡春院| 亚洲一本大道在线| 午夜激情一区二区| 五月天丁香久久| 喷水一区二区三区| 国产精品一区一区三区| 成+人+亚洲+综合天堂| 99在线精品观看| 色婷婷av久久久久久久| 在线一区二区三区| 3751色影院一区二区三区| 日韩免费观看高清完整版| 欧美久久一二区| 制服丝袜亚洲色图| 欧美吻胸吃奶大尺度电影| 国产日韩欧美一区二区三区综合| 欧美日韩国产首页| 久久亚洲二区三区| 亚洲男人的天堂网| 久久99精品久久久久久久久久久久| 国产精品自拍在线| 欧美性猛片xxxx免费看久爱| 精品国产精品网麻豆系列| 亚洲色图欧美在线| 麻豆国产一区二区| 在线亚洲高清视频| 久久久欧美精品sm网站| 亚洲激情六月丁香| 国产成人久久精品77777最新版本| 91九色02白丝porn| 国产喷白浆一区二区三区| 蜜臀久久99精品久久久久宅男 | 国产综合成人久久大片91| 日本大香伊一区二区三区| 精品盗摄一区二区三区| 亚洲www啪成人一区二区麻豆| av亚洲精华国产精华精华| 精品国产伦理网| 日日夜夜免费精品| 欧美亚洲综合在线| 亚洲欧洲综合另类| 成人激情综合网站| 国产免费成人在线视频| 国内不卡的二区三区中文字幕| 欧美日韩mp4| 亚洲制服丝袜在线| 91免费国产在线观看| 中文字幕av资源一区| 国精产品一区一区三区mba视频| 日韩一级大片在线| 日韩av不卡在线观看| 欧美夫妻性生活| 午夜激情久久久| 欧美老肥妇做.爰bbww视频| 亚洲一区二区三区在线| 欧美主播一区二区三区| 一级做a爱片久久| 欧洲中文字幕精品| 亚洲一级二级三级在线免费观看| 91高清视频免费看|