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

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

?? utf.c

?? sqlite 3.3.8 支持加密的版本
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
** 2004 April 13
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains routines used to translate between UTF-8, 
** UTF-16, UTF-16BE, and UTF-16LE.
**
** $Id: utf.c,v 1.23 2006/10/12 21:34:22 rmsimpson Exp $
**
** Notes on UTF-8:
**
**   Byte-0    Byte-1    Byte-2    Byte-3    Value
**  0xxxxxxx                                 00000000 00000000 0xxxxxxx
**  110yyyyy  10xxxxxx                       00000000 00000yyy yyxxxxxx
**  1110zzzz  10yyyyyy  10xxxxxx             00000000 zzzzyyyy yyxxxxxx
**  11110uuu  10uuzzzz  10yyyyyy  10xxxxxx   000uuuuu zzzzyyyy yyxxxxxx
**
**
** Notes on UTF-16:  (with wwww+1==uuuuu)
**
**      Word-0               Word-1          Value
**  110110ww wwzzzzyy   110111yy yyxxxxxx    000uuuuu zzzzyyyy yyxxxxxx
**  zzzzyyyy yyxxxxxx                        00000000 zzzzyyyy yyxxxxxx
**
**
** BOM or Byte Order Mark:
**     0xff 0xfe   little-endian utf-16 follows
**     0xfe 0xff   big-endian utf-16 follows
**
**
** Handling of malformed strings:
**
** SQLite accepts and processes malformed strings without an error wherever
** possible. However this is not possible when converting between UTF-8 and
** UTF-16.
**
** When converting malformed UTF-8 strings to UTF-16, one instance of the
** replacement character U+FFFD for each byte that cannot be interpeted as
** part of a valid unicode character.
**
** When converting malformed UTF-16 strings to UTF-8, one instance of the
** replacement character U+FFFD for each pair of bytes that cannot be
** interpeted as part of a valid unicode character.
**
** This file contains the following public routines:
**
** sqlite3VdbeMemTranslate() - Translate the encoding used by a Mem* string.
** sqlite3VdbeMemHandleBom() - Handle byte-order-marks in UTF16 Mem* strings.
** sqlite3utf16ByteLen()     - Calculate byte-length of a void* UTF16 string.
** sqlite3utf8CharLen()      - Calculate char-length of a char* UTF8 string.
** sqlite3utf8LikeCompare()  - Do a LIKE match given two UTF8 char* strings.
**
*/
#include "sqliteInt.h"
#include <assert.h>
#include "vdbeInt.h"

/*
** This table maps from the first byte of a UTF-8 character to the number
** of trailing bytes expected. A value '255' indicates that the table key
** is not a legal first byte for a UTF-8 character.
*/
static const u8 xtra_utf8_bytes[256]  = {
/* 0xxxxxxx */
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,

/* 10wwwwww */
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,

/* 110yyyyy */
1, 1, 1, 1, 1, 1, 1, 1,     1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,     1, 1, 1, 1, 1, 1, 1, 1,

/* 1110zzzz */
2, 2, 2, 2, 2, 2, 2, 2,     2, 2, 2, 2, 2, 2, 2, 2,

/* 11110yyy */
3, 3, 3, 3, 3, 3, 3, 3,     255, 255, 255, 255, 255, 255, 255, 255,
};

/*
** This table maps from the number of trailing bytes in a UTF-8 character
** to an integer constant that is effectively calculated for each character
** read by a naive implementation of a UTF-8 character reader. The code
** in the READ_UTF8 macro explains things best.
*/
static const int xtra_utf8_bits[4] =  {
0,
12416,          /* (0xC0 << 6) + (0x80) */
925824,         /* (0xE0 << 12) + (0x80 << 6) + (0x80) */
63447168        /* (0xF0 << 18) + (0x80 << 12) + (0x80 << 6) + 0x80 */
};

#define READ_UTF8(zIn, c) { \
  int xtra;                                            \
  c = *(zIn)++;                                        \
  xtra = xtra_utf8_bytes[c];                           \
  switch( xtra ){                                      \
    case 255: c = (int)0xFFFD; break;                  \
    case 3: c = (c<<6) + *(zIn)++;                     \
    case 2: c = (c<<6) + *(zIn)++;                     \
    case 1: c = (c<<6) + *(zIn)++;                     \
    c -= xtra_utf8_bits[xtra];                         \
  }                                                    \
}
int sqlite3ReadUtf8(const unsigned char *z){
  int c;
  READ_UTF8(z, c);
  return c;
}

#define SKIP_UTF8(zIn) {                               \
  zIn += (xtra_utf8_bytes[*(u8 *)zIn] + 1);            \
}

#define WRITE_UTF8(zOut, c) {                          \
  if( c<0x00080 ){                                     \
    *zOut++ = (c&0xFF);                                \
  }                                                    \
  else if( c<0x00800 ){                                \
    *zOut++ = 0xC0 + ((c>>6)&0x1F);                    \
    *zOut++ = 0x80 + (c & 0x3F);                       \
  }                                                    \
  else if( c<0x10000 ){                                \
    *zOut++ = 0xE0 + ((c>>12)&0x0F);                   \
    *zOut++ = 0x80 + ((c>>6) & 0x3F);                  \
    *zOut++ = 0x80 + (c & 0x3F);                       \
  }else{                                               \
    *zOut++ = 0xF0 + ((c>>18) & 0x07);                 \
    *zOut++ = 0x80 + ((c>>12) & 0x3F);                 \
    *zOut++ = 0x80 + ((c>>6) & 0x3F);                  \
    *zOut++ = 0x80 + (c & 0x3F);                       \
  }                                                    \
}

#define WRITE_UTF16LE(zOut, c) {                                \
  if( c<=0xFFFF ){                                              \
    *zOut++ = (c&0x00FF);                                       \
    *zOut++ = ((c>>8)&0x00FF);                                  \
  }else{                                                        \
    *zOut++ = (((c>>10)&0x003F) + (((c-0x10000)>>10)&0x00C0));  \
    *zOut++ = (0x00D8 + (((c-0x10000)>>18)&0x03));              \
    *zOut++ = (c&0x00FF);                                       \
    *zOut++ = (0x00DC + ((c>>8)&0x03));                         \
  }                                                             \
}

#define WRITE_UTF16BE(zOut, c) {                                \
  if( c<=0xFFFF ){                                              \
    *zOut++ = ((c>>8)&0x00FF);                                  \
    *zOut++ = (c&0x00FF);                                       \
  }else{                                                        \
    *zOut++ = (0x00D8 + (((c-0x10000)>>18)&0x03));              \
    *zOut++ = (((c>>10)&0x003F) + (((c-0x10000)>>10)&0x00C0));  \
    *zOut++ = (0x00DC + ((c>>8)&0x03));                         \
    *zOut++ = (c&0x00FF);                                       \
  }                                                             \
}

#define READ_UTF16LE(zIn, c){                                         \
  c = (*zIn++);                                                       \
  c += ((*zIn++)<<8);                                                 \
  if( c>=0xD800 && c<=0xE000 ){                                       \
    int c2 = (*zIn++);                                                \
    c2 += ((*zIn++)<<8);                                              \
    c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10);   \
  }                                                                   \
}

#define READ_UTF16BE(zIn, c){                                         \
  c = ((*zIn++)<<8);                                                  \
  c += (*zIn++);                                                      \
  if( c>=0xD800 && c<=0xE000 ){                                       \
    int c2 = ((*zIn++)<<8);                                           \
    c2 += (*zIn++);                                                   \
    c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10);   \
  }                                                                   \
}

#define SKIP_UTF16BE(zIn){                                            \
  if( *zIn>=0xD8 && (*zIn<0xE0 || (*zIn==0xE0 && *(zIn+1)==0x00)) ){  \
    zIn += 4;                                                         \
  }else{                                                              \
    zIn += 2;                                                         \
  }                                                                   \
}
#define SKIP_UTF16LE(zIn){                                            \
  zIn++;                                                              \
  if( *zIn>=0xD8 && (*zIn<0xE0 || (*zIn==0xE0 && *(zIn-1)==0x00)) ){  \
    zIn += 3;                                                         \
  }else{                                                              \
    zIn += 1;                                                         \
  }                                                                   \
}

#define RSKIP_UTF16LE(zIn){                                            \
  if( *zIn>=0xD8 && (*zIn<0xE0 || (*zIn==0xE0 && *(zIn-1)==0x00)) ){  \
    zIn -= 4;                                                         \
  }else{                                                              \
    zIn -= 2;                                                         \
  }                                                                   \
}
#define RSKIP_UTF16BE(zIn){                                            \
  zIn--;                                                              \
  if( *zIn>=0xD8 && (*zIn<0xE0 || (*zIn==0xE0 && *(zIn+1)==0x00)) ){  \
    zIn -= 3;                                                         \
  }else{                                                              \
    zIn -= 1;                                                         \
  }                                                                   \
}

/*
** If the TRANSLATE_TRACE macro is defined, the value of each Mem is
** printed on stderr on the way into and out of sqlite3VdbeMemTranslate().
*/ 
/* #define TRANSLATE_TRACE 1 */

#ifndef SQLITE_OMIT_UTF16
/*
** This routine transforms the internal text encoding used by pMem to
** desiredEnc. It is an error if the string is already of the desired
** encoding, or if *pMem does not contain a string value.
*/
int sqlite3VdbeMemTranslate(Mem *pMem, u8 desiredEnc){
  unsigned char zShort[NBFS]; /* Temporary short output buffer */
  int len;                    /* Maximum length of output string in bytes */
  unsigned char *zOut;                  /* Output buffer */
  unsigned char *zIn;                   /* Input iterator */
  unsigned char *zTerm;                 /* End of input */
  unsigned char *z;                     /* Output iterator */
  unsigned int c;

  assert( pMem->flags&MEM_Str );
  assert( pMem->enc!=desiredEnc );
  assert( pMem->enc!=0 );
  assert( pMem->n>=0 );

#if defined(TRANSLATE_TRACE) && defined(SQLITE_DEBUG)
  {
    char zBuf[100];
    sqlite3VdbeMemPrettyPrint(pMem, zBuf);
    fprintf(stderr, "INPUT:  %s\n", zBuf);
  }
#endif

  /* If the translation is between UTF-16 little and big endian, then 
  ** all that is required is to swap the byte order. This case is handled
  ** differently from the others.
  */
  if( pMem->enc!=SQLITE_UTF8 && desiredEnc!=SQLITE_UTF8 ){
    u8 temp;
    int rc;
    rc = sqlite3VdbeMemMakeWriteable(pMem);
    if( rc!=SQLITE_OK ){
      assert( rc==SQLITE_NOMEM );
      return SQLITE_NOMEM;
    }
    zIn = (u8*)pMem->z;
    zTerm = &zIn[pMem->n];
    while( zIn<zTerm ){
      temp = *zIn;
      *zIn = *(zIn+1);
      zIn++;
      *zIn++ = temp;
    }
    pMem->enc = desiredEnc;
    goto translate_out;
  }

  /* Set len to the maximum number of bytes required in the output buffer. */
  if( desiredEnc==SQLITE_UTF8 ){
    /* When converting from UTF-16, the maximum growth results from
    ** translating a 2-byte character to a 4-byte UTF-8 character.
    ** A single byte is required for the output string
    ** nul-terminator.
    */
    len = pMem->n * 2 + 1;
  }else{
    /* When converting from UTF-8 to UTF-16 the maximum growth is caused
    ** when a 1-byte UTF-8 character is translated into a 2-byte UTF-16
    ** character. Two bytes are required in the output buffer for the
    ** nul-terminator.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美激情一区二区三区不卡 | 日本一区二区三区视频视频| 国产成人午夜99999| 午夜精品久久一牛影视| 国产精品国产三级国产专播品爱网| 亚洲国产精品国自产拍av| 国产日本一区二区| 不卡视频在线观看| 欧美伦理影视网| 久久精品久久99精品久久| 欧美成人精品高清在线播放| 毛片av一区二区| 欧美不卡123| 国产成人综合在线观看| 国产精品视频免费| 午夜精彩视频在线观看不卡| 亚洲成人免费在线观看| www.成人网.com| 一级日本不卡的影视| 欧美日韩亚洲另类| 麻豆成人综合网| 中文字幕不卡在线| 欧美日韩亚洲国产综合| 精彩视频一区二区| 国产精品久久久久婷婷二区次| 91在线观看污| 日产欧产美韩系列久久99| 久久久91精品国产一区二区精品| 成人黄色av网站在线| 亚洲国产乱码最新视频| 久久五月婷婷丁香社区| 91免费看`日韩一区二区| 午夜欧美一区二区三区在线播放| 欧美电视剧在线看免费| 97国产精品videossex| 日韩制服丝袜av| 亚洲国产激情av| 欧美三级电影网| 国产精品一区在线观看你懂的| 亚洲精品免费电影| 精品少妇一区二区| 一本色道**综合亚洲精品蜜桃冫| 奇米亚洲午夜久久精品| 日韩一区在线看| www一区二区| 欧美日韩一区小说| eeuss鲁片一区二区三区| 久久国产日韩欧美精品| 亚洲欧美日韩在线不卡| 26uuu亚洲综合色| 欧美日本一区二区在线观看| 成人理论电影网| 蜜桃久久久久久久| 亚洲精品免费播放| 国产精品少妇自拍| 精品国产三级电影在线观看| 91精彩视频在线| 97国产一区二区| 国产馆精品极品| 六月丁香婷婷色狠狠久久| 一区二区三区 在线观看视频| 日本一区二区久久| 欧美成人性福生活免费看| 欧美日韩国产免费一区二区| 99精品久久99久久久久| 国产sm精品调教视频网站| 极品少妇一区二区三区精品视频| 日韩激情视频网站| 亚洲一区二区三区中文字幕在线| 国产精品久久久久久久久搜平片| 久久午夜免费电影| 久久久久成人黄色影片| 日韩欧美久久一区| 日韩午夜激情免费电影| 91精品国产综合久久香蕉麻豆| 91搞黄在线观看| 91一区二区在线| av电影在线观看一区| av中文一区二区三区| 波多野结衣欧美| 成人午夜视频网站| 成人午夜激情视频| 北条麻妃一区二区三区| av动漫一区二区| 国产99久久久国产精品| 美国十次了思思久久精品导航| 麻豆一区二区三| 久久精品噜噜噜成人88aⅴ| 日韩国产一二三区| 蜜臀av性久久久久蜜臀av麻豆| 久久精品国产久精国产| 国产蜜臀av在线一区二区三区| 国产婷婷一区二区| 国产精品欧美一区二区三区| 国产精品美女www爽爽爽| 国产精品久久久久精k8| 亚洲精品免费在线| 久久蜜臀精品av| 久久久久久久综合色一本| 成人性生交大片免费看在线播放 | 欧美一区二区视频网站| 欧美一二三区在线| 欧美刺激脚交jootjob| 久久精品夜色噜噜亚洲aⅴ| 国产亚洲综合在线| 亚洲人精品午夜| 日日夜夜一区二区| 国产麻豆一精品一av一免费| 成人免费福利片| 精品视频一区二区不卡| 日韩限制级电影在线观看| 欧美激情综合网| 亚洲一区二区视频在线观看| 美女视频黄久久| 成人综合婷婷国产精品久久免费| 99精品视频在线观看免费| 91.com在线观看| 中文字幕乱码亚洲精品一区| 伊人性伊人情综合网| 久久99精品视频| 99riav一区二区三区| 日韩欧美黄色影院| ...xxx性欧美| 麻豆91在线观看| 91久久精品网| 国产亚洲短视频| 首页国产欧美久久| 成人免费观看视频| 日韩欧美国产不卡| 亚洲资源中文字幕| 国产精品18久久久久久vr| 在线看日本不卡| 国产精品天美传媒沈樵| 日本最新不卡在线| 日韩免费视频一区二区| 亚洲视频一二三| 激情另类小说区图片区视频区| 91免费精品国自产拍在线不卡| 国产丝袜欧美中文另类| 蜜桃久久av一区| 欧美日韩色一区| 亚洲天堂a在线| 国产综合色精品一区二区三区| 日本电影亚洲天堂一区| 中文字幕av不卡| 久久国产精品区| 69久久夜色精品国产69蝌蚪网| 亚洲人成精品久久久久| 国产精品一区一区三区| 日韩免费一区二区| 天堂av在线一区| 91成人在线观看喷潮| 成人免费一区二区三区视频| 国产成人综合网站| 日韩精品一区二区三区视频在线观看| 亚洲视频一二三| 亚洲国产精品黑人久久久| 一本久道中文字幕精品亚洲嫩 | 国产九九视频一区二区三区| 欧美日本乱大交xxxxx| 一级精品视频在线观看宜春院| 国产精品主播直播| 久久午夜老司机| 91女神在线视频| 日本成人在线电影网| 国产一区二区电影| 欧美国产日韩a欧美在线观看 | 欧美久久久久久蜜桃| 韩国女主播成人在线| 老司机午夜精品| 首页国产欧美日韩丝袜| 欧美午夜视频网站| 亚洲永久精品大片| 欧美在线视频日韩| 亚洲一级二级三级在线免费观看| 一本一本大道香蕉久在线精品| 综合网在线视频| 91蜜桃在线免费视频| 亚洲精品ww久久久久久p站| 色婷婷综合视频在线观看| 亚洲精品视频在线观看网站| 一本高清dvd不卡在线观看| 亚洲综合视频在线观看| 91久久香蕉国产日韩欧美9色| 亚洲国产欧美在线| 在线电影一区二区三区| 美女网站在线免费欧美精品| 精品国产百合女同互慰| 大胆亚洲人体视频| 亚洲精品日日夜夜| 欧美日韩精品一区二区三区| 美女mm1313爽爽久久久蜜臀| 久久久噜噜噜久久中文字幕色伊伊| 高清不卡在线观看| 亚洲欧美激情在线| 欧美精品一级二级| 国产一区91精品张津瑜| 国产精品乱码妇女bbbb| 日本道在线观看一区二区| 日韩精品成人一区二区在线|