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

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

?? uniconv.cpp

?? IBM的解析xml的工具Xerces的源代碼
?? CPP
字號:
/* * Copyright 2002-2004 The Apache Software Foundation. *  * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *  *      http://www.apache.org/licenses/LICENSE-2.0 *  * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *//* * $Id: uniconv.cpp,v 1.3 2004/09/08 13:56:46 peiyongz Exp $ */#include <stdlib.h>#include <stdio.h>#include <string.h>#include <errno.h>#include <ctype.h>#include <cunhc.h>#include "ccsid.h"#include "uniconv.h"XERCES_CPP_NAMESPACE_BEGIN#define WORK_BUFFER_SIZE 16*1024#define DDA_NEEDED CUNBCPRM_DDA_REQ#define RETRY_THRESHOLD 10000// This is utility routine which strips '-', '_' and spaces from the name and// also upper cases the name. It also returns the length of the string.static int stripNameCopy(const char *s,char *d,int max){   int si=0;   int di=0;   while ( (s[si] != '\0') && (di < max) ) {      if ( (s[si] == ' ') || (s[si] == '_') || (s[si] == '-') )         si++;      else {         d[di] = toupper(s[si]);         si++;di++;      }   }   d[di] = 0;   if (s[si] != '\0')      return -1;   return si;}// This takes a name and does a lookup into the ccsid table (from ccsid.h)// to find the corresponding ccsid. It also checks if the string ends in s390// and returns that information to the caller.// The lookup into the table is done via a binary search since we know that the// table was nicely sorted for us.static int getccsid(const char *s,int * is390){   char tmpstr[_AE_MAX_CODESET_NAME_LENGTH];   int start;   int limit;   int index;   int result;   int thelen;   // Clean up the name....   if (s == NULL)      return -1;   if ((thelen = stripNameCopy(s,tmpstr,_AE_MAX_CODESET_NAME_LENGTH-1)) == -1)      return -1;   // Check for the S390 string in the name   *is390 = 0;   if ( (strstr((char *)tmpstr, "S390")) != NULL )      *is390 = 1;   // Now lookup the name via a binary search   start = 0;   limit = _AE_NUM_OF_CODESETS;   index = limit/2;   while ( ((result=strcoll(tmpstr, CCSID_MAPPING[index].NAME)) != 0) &&            (start < limit-1) ) {      if (result < 0)         limit = index;      else          start = index;      index = (start+limit)/2;   }   if (result != 0 && start >= limit-1)      return -1;   return CCSID_MAPPING[index].CCSID;}// **********************************************************************// These are the character conversion services// **********************************************************************// "Open" the conversion. Allocate memory to hold the handle which// unicode services requires. Call unicode services with a 0 length// so that it can initialize it's handle.// Note that unicode services must always be called in a loop since// it could be busy reloading its tables.uniconv_t uniconv_open(const char *destenc, const char *srcenc) {   CUNBCPRM  defparms = {CUNBCPRM_DEFAULT};   CUNBCPRM * tmpp;   void * handle_area;   char *cptr;   int srcis390;   int destis390;   errno = 0;   handle_area = malloc (sizeof(CUNBCPRM)+DDA_NEEDED+WORK_BUFFER_SIZE+8);   tmpp = (CUNBCPRM *) handle_area;   if (tmpp==NULL)      return (uniconv_t)-1;   // initialize the parm area with defaults, then start filling it   // in with our values.   memcpy(tmpp,&defparms,sizeof(defparms));   tmpp->Src_Buf_Len= 0;   // get the ccsids.   if ( ((tmpp->Src_CCSID=getccsid(srcenc,&srcis390)) == -1) ||        ((tmpp->Targ_CCSID=getccsid(destenc,&destis390)) == -1) ) {      errno=ENOENT;      free(handle_area);      return (uniconv_t)-1;   }   tmpp->Wrk_Buf_Ptr=(void*) (((unsigned int) handle_area) + sizeof(CUNBCPRM)+DDA_NEEDED +8);   tmpp->Wrk_Buf_Len=WORK_BUFFER_SIZE;   // Doubleword align the DDA area   tmpp->DDA_Buf_Ptr=(void*) ((unsigned int) handle_area + sizeof(CUNBCPRM) +7);   tmpp->DDA_Buf_Ptr = (void*) ((unsigned int) tmpp->DDA_Buf_Ptr & ~7);   tmpp->DDA_Buf_Len=DDA_NEEDED;   // This flag tells the services to automatically refresh the handle if it   // becomes invalid.   tmpp->Flag1|=CUNBCPRM_REFRESH_AT_INV_HANDLE_START;   tmpp->Flag1|=CUNBCPRM_SUB_ACTION_SUBSTITUTE;   /* Determine which technique to use */   if ( (srcis390) || (destis390) )      // This technique causes it to swap LF and NL.      memcpy(tmpp->Technique,"L       ",8);   else      memcpy(tmpp->Technique,"        ",8);   // Retry if the services are busy reloading their tables.   int retry_count = 0;   while (retry_count < RETRY_THRESHOLD) {      CUNLCNV(tmpp);      if (tmpp->Return_Code == CUN_RC_OK)         break;      else if ( (tmpp->Return_Code == CUN_RC_WARN) &&                ( (tmpp->Reason_Code == CUN_RS_NO_HANDLE) ||                  (tmpp->Reason_Code == CUN_RS_INV_HANDLE_NOSET) ||                  (tmpp->Reason_Code == CUN_RS_INV_HANDLE_SET) ) )         // Let it loop around again         retry_count++;      else         break;   }   if (tmpp->Return_Code != CUN_RC_OK) {      free(handle_area);      errno=EINVAL;      handle_area = (uniconv_t)-1;   }   return handle_area;}// All that is required for close is to free the handle buffer.int uniconv_close(uniconv_t handle_area) {   errno = 0;   if (((int)handle_area) <= 0) {      errno=EBADF;      return -1;   }   free(handle_area);   return 0;}// This does the real conversion.// Note that unicode services must always be called in a loop since// it could be busy reloading its tables.int uniconv(uniconv_t cd, char **inbuf,  size_t *inbytesleft,                          char **outbuf, size_t *outbytesleft) {   CUNBCPRM * tmpp;   size_t startinlen = *inbytesleft;   size_t startoutlen = *outbytesleft;   errno = 0;   if (((int)cd) <= 0) {      errno=EBADF;      return -1;   }   // Fill in the parameter area with current values   tmpp = (CUNBCPRM *) cd;   tmpp->Src_Buf_Ptr = *inbuf;   tmpp->Src_Buf_Len = *inbytesleft;   tmpp->Targ_Buf_Ptr = *outbuf;   tmpp->Targ_Buf_Len = *outbytesleft;   // Retry if the services are busy reloading their tables.   int retry_count = 0;   while (retry_count < RETRY_THRESHOLD) {      CUNLCNV(tmpp);      if (tmpp->Return_Code == CUN_RC_OK)         break;      else if ( (tmpp->Return_Code == CUN_RC_WARN) &&                ( (tmpp->Reason_Code == CUN_RS_NO_HANDLE) ||                  (tmpp->Reason_Code == CUN_RS_INV_HANDLE_NOSET) ||                  (tmpp->Reason_Code == CUN_RS_INV_HANDLE_SET) ) )         // Let it loop around again         retry_count++;      else         break;   }   *inbuf        = (char *)tmpp->Src_Buf_Ptr;   *inbytesleft  = tmpp->Src_Buf_Len;   *outbuf       = (char *)tmpp->Targ_Buf_Ptr;   *outbytesleft = tmpp->Targ_Buf_Len;   if (tmpp->Return_Code != CUN_RC_OK) {      if (tmpp->Reason_Code == CUN_RS_TRG_EXH)         errno=E2BIG;      else if (tmpp->Reason_Code == CUN_RS_MBC_INCOMPLETE)         errno=EINVAL;      else {         errno=EBADF;         return -1;      }   }   return (startinlen-*inbytesleft);}// **********************************************************************// These are the case conversion services.// **********************************************************************// This "opens" the case conversion. It allocates the parameter area// then does a dummy call to unicode services so that it can set up// the handle.// Note that unicode services must always be called in a loop since// it could be busy reloading its tables.static inline uniconv_t uniconv_case_open(unsigned char direction) {CUNBAPRM  defparms = {CUNBAPRM_DEFAULT};CUNBAPRM * tmpp;void * handle_area;   errno = 0;   handle_area = malloc (sizeof(CUNBAPRM)+CUNBAPRM_DDA_REQ);   tmpp = (CUNBAPRM *) handle_area;   if (tmpp==NULL)      return (uniconv_t)-1;   // initialize the parm area with defaults, then start filling it   // in with our values.   memcpy(tmpp,&defparms,sizeof(defparms));   tmpp->DDA_Buf_Ptr=(void*) ((unsigned int) handle_area + sizeof(CUNBAPRM));   tmpp->DDA_Buf_Len=CUNBAPRM_DDA_REQ;   // This flag tells the services to automatically refresh the handle if it   // becomes invalid.   tmpp->Flag1|=CUNBAPRM_REFRESH_AT_INV_HANDLE_START;   unichar_t inchar = 0x61;   unichar_t outchar;   tmpp->Src_Buf_Ptr=&inchar;   tmpp->Targ_Buf_Ptr=&outchar;   tmpp->Targ_Buf_Len=sizeof(unichar_t);   tmpp->Src_Buf_Len=sizeof(unichar_t);   tmpp->Conv_Type=direction;   // Retry if the services are busy reloading their tables.   int retry_count = 0;   while (true) {      CUNLASE ( tmpp );      if (tmpp->Return_Code == CUN_RC_OK) {         break;      } else if ( (tmpp->Return_Code == CUN_RC_WARN) &&                  ( (tmpp->Reason_Code == CUN_RS_NO_HANDLE) ||                    (tmpp->Reason_Code == CUN_RS_INV_HANDLE_NOSET) ||                    (tmpp->Reason_Code == CUN_RS_INV_HANDLE_SET) ) ) {         // Let it loop around again         retry_count++;         if (retry_count > RETRY_THRESHOLD) {            errno = ENOSYS;            break;         }      } else {         errno = ENOSYS;         break;      }   }   if (tmpp->Return_Code != CUN_RC_OK) {      free(handle_area);      errno=EINVAL;      handle_area = (uniconv_t)-1;   }   return handle_area;}// These are the actual external interfaces for the open functionuniconv_t uniconv_toupper_open() {   return uniconv_case_open(CUNBAPRM_TO_UPPER);}uniconv_t uniconv_tolower_open() {   return uniconv_case_open(CUNBAPRM_TO_LOWER);}// This closes the case conversion. All it does is free the handle buffer.int _uniconv_case_close(uniconv_t handle_area) {   errno = 0;   if (((int)handle_area) <= 0) {      errno=EBADF;      return -1;   }   free(handle_area);   return 0;}// This does the actual case conversion. The direction is already// stored in the handle buffer.// Note that unicode services must always be called in a loop since// it could be busy reloading its tables.unichar_t uniconv_caseit (uniconv_t cd,unichar_t inchar) {   unichar_t outchar;   CUNBAPRM * tmpp;   errno = 0;   if (((int)cd) <= 0) {      errno=EBADF;      return -1;   }   tmpp = (CUNBAPRM *) cd;   tmpp->Src_Buf_Ptr=&inchar;   tmpp->Targ_Buf_Ptr=&outchar;   tmpp->Targ_Buf_Len=sizeof(unichar_t);   tmpp->Src_Buf_Len=sizeof(unichar_t);   // Retry if the services are busy reloading their tables.   int retry_count = 0;   while (true) {      CUNLASE ( tmpp );      if (tmpp->Return_Code == CUN_RC_OK) {         break;      }      else if ( (tmpp->Return_Code == CUN_RC_WARN) &&                ( (tmpp->Reason_Code == CUN_RS_NO_HANDLE) ||                  (tmpp->Reason_Code == CUN_RS_INV_HANDLE_NOSET) ||                  (tmpp->Reason_Code == CUN_RS_INV_HANDLE_SET) ) ) {         // Let it loop around again         retry_count++;         if (retry_count > RETRY_THRESHOLD) {            errno = ENOSYS;            break;         }      } else {         errno = ENOSYS;         break;      }   }   return outchar;}XERCES_CPP_NAMESPACE_END

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区二区三区视频在线| 91精品国产色综合久久ai换脸 | 国产精品国产馆在线真实露脸| 国产一区二区日韩精品| 久久精品亚洲精品国产欧美 | 国产一区二区三区日韩 | 成人av第一页| 亚洲国产成人av好男人在线观看| 欧美精品三级日韩久久| 久久精品国产精品青草| 国产欧美日韩不卡免费| 91免费观看视频在线| 五月天视频一区| 久久综合九色综合97婷婷 | 激情小说亚洲一区| 国产精品激情偷乱一区二区∴| 欧美极品少妇xxxxⅹ高跟鞋| 国产不卡视频在线播放| 亚洲欧美电影一区二区| 欧美美女黄视频| 国产一区二区三区四区五区入口| 国产精品嫩草久久久久| 欧美日韩国产另类不卡| 国产成人丝袜美腿| 亚洲一级二级在线| 久久久久青草大香线综合精品| 99久久精品99国产精品| 午夜私人影院久久久久| 久久久久久久久一| 欧美色电影在线| 国产成人免费视频网站高清观看视频| 一区二区三区中文字幕在线观看| 日韩一卡二卡三卡四卡| 色av一区二区| 国产精品12区| 蜜桃精品视频在线| 亚洲一区二区影院| 欧美激情一区二区三区不卡| 欧美剧情电影在线观看完整版免费励志电影| 久久国内精品自在自线400部| 亚洲欧美日韩国产另类专区| 久久影院午夜片一区| 欧美精品欧美精品系列| 色噜噜久久综合| 春色校园综合激情亚洲| 激情五月婷婷综合| 日本欧美久久久久免费播放网| 亚洲色大成网站www久久九九| 337p粉嫩大胆噜噜噜噜噜91av | 国产乱人伦偷精品视频免下载| 亚洲在线视频免费观看| 久久网站最新地址| 日韩欧美一区电影| 欧美性大战久久久久久久蜜臀| zzijzzij亚洲日本少妇熟睡| 国产伦精品一区二区三区免费| 日韩影院精彩在线| 午夜欧美视频在线观看 | 亚洲视频小说图片| 亚洲国产精品激情在线观看| 精品久久久久久久久久久久包黑料 | 亚洲精品乱码久久久久久久久| 久久午夜国产精品| 精品三级在线观看| 日韩精品一区在线| 精品久久国产字幕高潮| 日韩一区二区视频| 欧美一激情一区二区三区| 欧美电影一区二区三区| 7777女厕盗摄久久久| 91.麻豆视频| 欧美猛男超大videosgay| 欧美视频中文字幕| 欧美日韩国产影片| 欧美剧在线免费观看网站| 欧美夫妻性生活| 日韩欧美中文字幕一区| 欧美成人精品二区三区99精品| 欧美成人一区二区| 国产亚洲精品aa午夜观看| 久久久久久久性| 最新国产精品久久精品| 亚洲精品国产高清久久伦理二区| 亚洲激情成人在线| 爽好久久久欧美精品| 久久超碰97人人做人人爱| 国产一区欧美日韩| 95精品视频在线| 欧美亚洲禁片免费| 欧美一区二区视频在线观看2020 | 日本va欧美va精品发布| 免费成人av在线| 狠狠色丁香婷婷综合| 国产精品夜夜嗨| 99麻豆久久久国产精品免费优播| 91麻豆国产香蕉久久精品| 欧美探花视频资源| 精品少妇一区二区三区免费观看 | 中文字幕日韩精品一区| 有码一区二区三区| 蜜臀av一区二区三区| 国产一区二区不卡老阿姨| a在线欧美一区| 欧美美女一区二区三区| 久久亚洲私人国产精品va媚药| 中文在线资源观看网站视频免费不卡| 1000部国产精品成人观看| 午夜视频在线观看一区二区| 精品在线观看免费| 99久久精品免费| 欧美一二三四区在线| 国产精品久久久久久久久图文区| 一区二区欧美精品| 国产精华液一区二区三区| 在线观看日韩电影| 26uuu久久天堂性欧美| 亚洲精品国产精品乱码不99| 美腿丝袜一区二区三区| 91在线国产福利| 日韩女优电影在线观看| 1000精品久久久久久久久| 美国十次综合导航| 一本色道久久综合亚洲aⅴ蜜桃| 欧美二区三区91| 亚洲欧美日韩在线| 国产一区二区三区香蕉 | 欧美大片免费久久精品三p| 自拍偷拍亚洲综合| 国产一区中文字幕| 欧美乱妇一区二区三区不卡视频| 日本一区二区三区视频视频| 日本aⅴ亚洲精品中文乱码| 本田岬高潮一区二区三区| 精品国产一区二区在线观看| 一区二区三区视频在线观看| 国产精品一区二区视频| 欧美精品1区2区3区| 亚洲视频在线一区观看| 国产乱子轮精品视频| 日韩视频免费观看高清在线视频| 亚洲精品日日夜夜| www.日韩大片| 国产亚洲综合性久久久影院| 日韩av电影免费观看高清完整版| 91老师片黄在线观看| 欧美国产日本韩| 国产精品一色哟哟哟| 欧美成人性战久久| 美脚の诱脚舐め脚责91| 欧美精品一二三| 亚洲成人综合在线| 在线免费一区三区| 亚洲精品视频在线看| 91在线小视频| 最新久久zyz资源站| k8久久久一区二区三区| 国产欧美一区二区精品久导航| 免费看黄色91| 欧美一级日韩免费不卡| 人妖欧美一区二区| 91精品国产高清一区二区三区 | 国模一区二区三区白浆| 欧美一区二区在线不卡| 热久久国产精品| 欧美久久久一区| 亚洲成av人片一区二区三区| 欧美日韩综合在线免费观看| 亚洲成a人片在线不卡一二三区 | 美女网站在线免费欧美精品| 欧美福利一区二区| 麻豆精品一二三| 日韩免费高清av| 激情都市一区二区| 久久人人97超碰com| 国产一区不卡视频| 久久久久久9999| av动漫一区二区| 亚洲日本va午夜在线影院| 91九色最新地址| 日韩精品一二三四| 久久只精品国产| voyeur盗摄精品| 亚洲在线观看免费视频| 欧美一区二区三区男人的天堂| 精油按摩中文字幕久久| 国产精品视频一二| 欧美在线观看视频一区二区| 视频一区二区不卡| 久久日一线二线三线suv| 99天天综合性| 亚洲成人av福利| 久久众筹精品私拍模特| 91日韩精品一区| 免费的成人av| 国产精品伦一区| 欧美日韩黄色一区二区| 国产乱码精品一区二区三| 亚洲男人的天堂一区二区| 欧美午夜一区二区三区| 国产精品中文字幕一区二区三区|