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

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

?? binurlinputstream.cpp

?? IBM的解析xml的工具Xerces的源代碼
?? CPP
字號:
/* * Copyright 1999-2000,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. *//** * $Log: BinURLInputStream.cpp,v $ * Revision 1.8  2004/09/08 13:56:36  peiyongz * Apache License Version 2.0 * * Revision 1.7  2004/05/05 22:08:07  amassari * Content reported by a web site as text/xml is now read correctly; added an extra way of getting the size of the document in case no redirection has been performed * * Revision 1.6  2004/01/16 14:29:21  amassari * Removed usage of undeclared macro MIN * * Revision 1.5  2003/12/24 15:24:13  cargilld * More updates to memory management so that the static memory manager. * * Revision 1.4  2003/05/17 05:54:18  knoaman * Update NetAccessors to use the memory manager. * * Revision 1.3  2002/12/06 16:42:13  tng * Fix the error messages thrown from net accessor module. * * Revision 1.2  2002/11/04 15:11:39  tng * C++ Namespace Support. * * Revision 1.1.1.1  2002/02/01 22:22:22  peiyongz * sane_include * * Revision 1.6  2001/11/28 19:14:59  knoaman * Bug 2238: fix by Artur Klauser * Some broken proxy servers (e.g. the one behind which I happen to reside, * which apparently is Server: Microsoft-IIS/5.0) * implement wrong boundary conditions for range requests. In particular, * (1) request ranges straddling the content length of the document *     give bogus header information *       Content-Range: bytes X-Y/Z *     where Y > Z, and give 0 bytes of actual message content. * (2) request ranges beyond the content length of the document do not *     give an error response as asked for in RFC2616 (http/1.1) * * Since the NetAccessor code was just trying to fall off the end of the * document with the last range request (ie. hitting case 1 above), it * never gets the last chunk of data from this proxy server. * * Revision 1.5  2001/11/28 19:11:33  knoaman * Bug 2237: fix by Artur Klauser * * Revision 1.4  2001/03/02 14:39:21  tng * Enabling libWWW NetAccessor support under UNIX. Tested with latest tarball of libWWW * (w3c-libwww-5.3.2) under RedHat Linux 6.1.  Added by Martin Kalen. * * There is one MAJOR problem with the use of libwww and the patches * below, which someone with knowledge of libwww filters etc. might want * to look into. Default behavior for content-type text/xml is to consume * all xml data before it reaches the simple HTML presenter. Hence, only * files with content-type text/html will actually reach the xerces-c * library. If you have a *.xml file on the webbserver, processing of the * file will throw an exception stating "The main XML document cannot be * empty" (correct in a xerces point of view since if you enable debug * build you will see that libwww "eats" all text/xml). * * See "Diffs for enabling libWWW NetAccessor support under UNIX" posted in March 1, 2001 * in the xerces-c-dev mailing list for further information. * * Revision 1.3  2000/05/15 22:31:31  andyh * Replace #include<memory.h> with <string.h> everywhere. * * Revision 1.2  2000/02/26 07:56:36  rahulj * Fixed the license header as pointed out by Bill Schindler <developer@bitranch.com> * * Revision 1.1  2000/02/17 22:06:19  rahulj * Moved the four LibWWW files to its own sub-directory in the * NetAccessor directory. * * * Revision 1.1  2000/01/15 01:08:04  rahulj * Added support for HTTP to the parser. * Error handling is not very good. Also cannot guarantee that * there are no memory leaks. * Only tested under NT 4.0 SP 5 using libWWW 5.2.8. * */#include <xercesc/util/XMLNetAccessor.hpp>#include <xercesc/util/NetAccessors/libWWW/BinURLInputStream.hpp>#include <xercesc/util/XMLString.hpp>#include <xercesc/util/XMLExceptMsgs.hpp>#include <strings.h>#include <WWWInit.h>XERCES_CPP_NAMESPACE_BEGIN//// This define specifies the size of the buffer used to read chunks// out of the URL input stream.//#define URLISBUFMAXSIZE        8192//// We assume here that the URL is essentially composed of just ASCII characters// and hence converting it to a 'char *' requires just to drop the leading zero// byte. The reason, we can get away with this is that libWWW currently provides// no wide character API's.//// The input Unicode string is assumed to be 0 terminated.// The caller is responsible to free the memory allocated to store the resultant// 'char *' string.//static char* localTranscode(const XMLCh* latinStrInUnicode                            , MemoryManager* const  manager){    unsigned int   lent = XMLString::stringLen(latinStrInUnicode);    char*  retval = (char*) manager->allocate    (        (lent + 1) * sizeof(char)    );//new char[lent + 1];    unsigned int  i = 0;    for (i = 0; i < lent; i++)        retval[i] = (char) latinStrInUnicode[i]; // drop the leading byte.    retval[lent] = 0;    return retval;}BinURLInputStream::BinURLInputStream(const XMLURL& urlSource)      : fBuffer(0)      , fBufferSize(0)      , fBufferIndex(0)      , fRemoteFileSize(0)      , fAnchor(0)      , fBytesProcessed(0)      , fMemoryManager(urlSource.getMemoryManager()){    fBuffer = (XMLByte*) fMemoryManager->allocate    (        URLISBUFMAXSIZE * sizeof(XMLByte)    );//new XMLByte[URLISBUFMAXSIZE];    const XMLCh*  uri = urlSource.getURLText();    char*   uriAsCharStar = localTranscode(uri, fMemoryManager);    //    // First find the size of the remote resource being asked for.    // We use the ContentCounter stream provided by libWWW.    //    fAnchor = HTAnchor_findAddress(uriAsCharStar);    HTRequest*   request = HTRequest_new();    HTRequest_setOutputFormat(request, WWW_SOURCE);    HTStream*    counterStrm = HTContentCounter(HTBlackHole(), request, 0xFFFF);    BOOL  status = HTLoadToStream(uriAsCharStar, counterStrm, request);    if (status == YES)    {        HTParentAnchor * anchor = HTRequest_anchor(request);        fRemoteFileSize=HTAnchor_length(anchor);        if(fRemoteFileSize < 0)        {            // Patch by Artur Klauser            // When a redirection is processed in libWWW, it seems that            // HTAnchor_length(anchor) == -1 on the original anchor, whereas            // HTResponse_length(response) gives the correct content length of            // the redirection target. This has confused fRemoteFileSize and it was            // not checked for a -1 response at all.            HTResponse * response = HTRequest_response (request);            fRemoteFileSize = HTResponse_length(response);            if (fRemoteFileSize < 0) {                ThrowXMLwithMemMgr(NetAccessorException, XMLExcepts::NetAcc_LengthError, fMemoryManager);            }        }    }    // Cleanup, before you throw any errors.    fMemoryManager->deallocate(uriAsCharStar);    HTRequest_delete(request);    // Don't know whether I am supposed to delete counterStrm.    if (status == NO)    {        ThrowXMLwithMemMgr(NetAccessorException, XMLExcepts::NetAcc_LengthError, fMemoryManager);    }}BinURLInputStream::~BinURLInputStream(){    fMemoryManager->deallocate(fBuffer);//delete [] fBuffer;    fBuffer = 0;    // Do not delete the fAnchor. Its deleted when the destructor of    // libWWWNetAccessor is called.}void BinURLInputStream::reset(){    fBufferSize = 0;    fBytesProcessed = 0;    fBufferIndex = 0;    memset((void*) fBuffer, 0x00, sizeof(XMLByte) * URLISBUFMAXSIZE);}unsigned int BinURLInputStream::curPos() const{    return fBytesProcessed;}unsigned int BinURLInputStream::bytesAvail() const{    unsigned int  retval = fBufferSize - fBufferIndex;    return retval;}unsigned int BinURLInputStream::readBytes(XMLByte* const  toFill                                  , const unsigned int    maxToRead){    unsigned int  retval = 0;    unsigned int  bytesAsked = maxToRead;    unsigned int  bytesForCopy = 0;    // Wipe out the old stuff from the destination buffer to fill.    memset((void*)toFill, 0x00, sizeof(XMLByte) * maxToRead);    // You can only read till the end of the remote resource file.    // So, adjust the count of bytes you want to read now.    if (fBytesProcessed + bytesAsked >= fRemoteFileSize)    {        bytesAsked = fRemoteFileSize - fBytesProcessed;    }    if (fBufferSize > 0)        bytesForCopy = fBufferSize - fBufferIndex;    if (bytesAsked <= bytesForCopy)    {        // ...then you can satisfy this request completely from fBuffer.        // Simply copy over the bytes to the destination array.        memcpy((void*) toFill, (void*) (fBuffer + fBufferIndex), bytesAsked);        fBufferIndex += bytesAsked;        if (fBufferIndex >= fBufferSize)        {            fBufferSize = 0;            fBufferIndex = 0;        }        fBytesProcessed += bytesAsked;        retval = bytesAsked;    }    else    {        // ...will need to read some more bytes out of the stream.        unsigned int    bufToFillIndex = 0;        HTRequest*      request = HTRequest_new();        HTChunk*        result = NULL;        char            ranges[64];        // First copy over what is left in fBuffer, before reading another        // chunk out of the stream.        if (bytesForCopy != 0)        {            memcpy((void*) toFill, (void*) (fBuffer + fBufferSize), bytesForCopy);            fBufferSize = 0;            fBufferIndex = 0;            fBytesProcessed += bytesForCopy;            bufToFillIndex = bytesForCopy;            retval = bytesForCopy;        }        unsigned int    bytesRemainingForCopy = bytesAsked - bytesForCopy;        // Now read a new chunk from the stream. HTTP lets you specify the        // range of bytes that you would like.        sprintf(ranges, "%ld-%ld", fBytesProcessed,                fRemoteFileSize<(fBytesProcessed + URLISBUFMAXSIZE)? fRemoteFileSize - 1:  fBytesProcessed + URLISBUFMAXSIZE - 1);        HTRequest_addRange(request, "bytes", ranges);        HTRequest_setOutputFormat(request, WWW_SOURCE);        result = HTLoadAnchorToChunk(fAnchor, request);        fBufferSize = HTChunk_size(result);        if (fBufferSize > 0)        {            // Store the read chunk in fBuffer.            memset((void*) fBuffer, 0x00, URLISBUFMAXSIZE);            memcpy((void*) fBuffer, (void*) HTChunk_data(result), fBufferSize);            fBufferIndex = 0;        }        HTRequest_delete(request);        HTChunk_delete(result);        // Now fill the destination buffer with the new data just read.        bytesForCopy = fBufferSize;        if (bytesRemainingForCopy > fBufferSize)        {            bytesRemainingForCopy = fBufferSize;        }        memcpy((void*) (toFill + bufToFillIndex),               (void*) fBuffer,               bytesRemainingForCopy);        // Update counters.        retval += bytesRemainingForCopy;        fBufferIndex += bytesRemainingForCopy;        fBytesProcessed += bytesRemainingForCopy;    }    return retval;}XERCES_CPP_NAMESPACE_END

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品性做久久久久久| 一区二区三区影院| 国产乱人伦偷精品视频不卡| 精品国精品自拍自在线| 狠狠色丁香久久婷婷综合_中| 日韩美女视频在线| 国产乱码精品一品二品| 国产精品你懂的在线欣赏| 色网综合在线观看| 三级影片在线观看欧美日韩一区二区| 8v天堂国产在线一区二区| 六月婷婷色综合| 中文字幕巨乱亚洲| 日本韩国欧美一区| 蜜臀av一区二区在线观看| 久久综合九色综合97婷婷女人| 成人国产一区二区三区精品| 亚洲自拍偷拍av| 久久这里只精品最新地址| 成人18视频在线播放| 一区二区激情视频| 日韩免费一区二区三区在线播放| 成人综合在线视频| 日韩精品视频网站| 欧美极品少妇xxxxⅹ高跟鞋 | 一区二区三区日韩在线观看| 7777女厕盗摄久久久| 国产福利91精品一区二区三区| 一区二区三区在线观看国产| 日韩一级高清毛片| 91蜜桃在线免费视频| 美女精品自拍一二三四| 亚洲三级在线看| 日韩免费成人网| 欧美体内she精视频| 国产成人av一区| 成人黄色av电影| 理论片日本一区| 一区二区三区在线视频观看58| 久久综合九色综合欧美98| 欧美色精品在线视频| 风流少妇一区二区| 日韩成人免费电影| 夜夜亚洲天天久久| 欧美国产一区二区| 亚洲精品在线观看网站| 欧美在线不卡一区| 国产成人免费视频网站高清观看视频| 日韩精品电影在线观看| 日韩一区在线播放| 欧美成人精精品一区二区频| 欧美日韩免费高清一区色橹橹 | 亚洲综合一区二区三区| 国产精品国产三级国产aⅴ无密码| 制服丝袜av成人在线看| 99精品久久99久久久久| 国产成人精品影视| 久草热8精品视频在线观看| 日韩高清一区二区| 亚洲国产精品一区二区www| 综合久久久久久| 亚洲欧洲无码一区二区三区| 久久久久久久久久电影| 欧美电影免费观看高清完整版| 欧美日韩不卡视频| 欧美色倩网站大全免费| 91国在线观看| 在线亚洲精品福利网址导航| 成人av网站在线观看| 成人在线综合网站| 国产成人超碰人人澡人人澡| 黄色日韩三级电影| 国产一区二区三区免费在线观看| 久久精品国产亚洲高清剧情介绍 | 国内精品不卡在线| 激情丁香综合五月| 国产一区二区三区香蕉| 九九热在线视频观看这里只有精品| 日韩和欧美一区二区三区| 亚洲成a人在线观看| 视频在线在亚洲| 三级久久三级久久| 久久97超碰色| 国产成人亚洲综合a∨婷婷| 国产剧情一区二区三区| 成人午夜视频在线观看| 9久草视频在线视频精品| 99精品一区二区三区| 91视频91自| 欧美日韩国产天堂| 欧美xxxxxxxx| 国产女同互慰高潮91漫画| √…a在线天堂一区| 亚洲精品高清在线| 日韩av中文字幕一区二区| 韩日欧美一区二区三区| 丁香激情综合五月| 欧美性一二三区| 日韩一区二区免费在线观看| 日韩女优电影在线观看| 亚洲国产精品成人综合| 亚洲一区二区av电影| 日韩电影在线看| 国产伦精品一区二区三区视频青涩| 国产宾馆实践打屁股91| 日本二三区不卡| 精品久久一区二区三区| 中文字幕一区av| 五月激情丁香一区二区三区| 激情伊人五月天久久综合| 国产99一区视频免费| 欧美日韩中文国产| 久久综合色之久久综合| 亚洲最快最全在线视频| 精品一区二区三区免费观看| 99热国产精品| 精品欧美乱码久久久久久1区2区 | 亚洲一区影音先锋| 激情综合网av| 在线区一区二视频| 精品成人私密视频| 亚洲一区二区三区影院| 国产精品主播直播| 欧美日韩国产大片| 国产午夜精品一区二区三区四区| 亚洲国产视频一区| 粉嫩久久99精品久久久久久夜| 欧美日韩大陆在线| 亚洲天堂精品在线观看| 九一九一国产精品| 欧美色图免费看| 中文字幕精品三区| 男男视频亚洲欧美| 欧美丝袜自拍制服另类| 国产精品美女久久久久aⅴ| 日本大胆欧美人术艺术动态| 91亚洲资源网| 国产欧美精品区一区二区三区| 亚洲chinese男男1069| 成人成人成人在线视频| 欧美大片免费久久精品三p| 一区二区久久久久| a4yy欧美一区二区三区| 亚洲精品一区二区三区福利| 亚洲动漫第一页| 色综合亚洲欧洲| 国产精品高清亚洲| 国产精品77777| 日韩欧美一区二区久久婷婷| 亚洲综合清纯丝袜自拍| 成人国产精品视频| 国产嫩草影院久久久久| 国内成人免费视频| 欧美大片国产精品| 免费在线观看不卡| 日韩一区二区高清| 日本成人中文字幕在线视频| 欧美手机在线视频| 亚洲图片一区二区| 91成人免费在线| 一片黄亚洲嫩模| 91国偷自产一区二区三区成为亚洲经典| 久久人人超碰精品| 久久精品国产成人一区二区三区| 正在播放亚洲一区| 日本不卡中文字幕| 日韩欧美国产综合在线一区二区三区| 香蕉久久夜色精品国产使用方法| 欧美午夜片在线观看| 亚洲成人一区在线| 欧美日韩大陆在线| 青青青伊人色综合久久| 欧美一区二区三区色| 美女一区二区久久| 久久综合久久鬼色中文字| 国产精品1区2区3区在线观看| 2021国产精品久久精品| 国产精品99久久久久久有的能看| 日本一二三四高清不卡| 99这里都是精品| 亚洲激情自拍偷拍| 在线成人av影院| 久久99精品久久只有精品| 国产日产欧美一区| av影院午夜一区| 亚洲蜜臀av乱码久久精品| 欧美伊人久久久久久久久影院| 日韩av在线发布| 久久蜜臀中文字幕| 不卡av免费在线观看| 亚洲第一狼人社区| 欧美一区二区免费| a级精品国产片在线观看| 亚洲男帅同性gay1069| 欧美高清性hdvideosex| 韩国精品主播一区二区在线观看| 中文字幕高清不卡| 欧美三级资源在线| 国产麻豆精品一区二区| 亚洲欧美国产三级|