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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? mitab_rawbinblock.cpp

?? 支持各種柵格圖像和矢量圖像讀取的庫
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
/********************************************************************** * $Id: mitab_rawbinblock.cpp,v 1.8 2005/10/06 19:15:31 dmorissette Exp $ * * Name:     mitab_rawbinblock.cpp * Project:  MapInfo TAB Read/Write library * Language: C++ * Purpose:  Implementation of the TABRawBinBlock class used to handle *           reading/writing blocks in the .MAP files * Author:   Daniel Morissette, dmorissette@dmsolutions.ca * ********************************************************************** * Copyright (c) 1999, 2000, Daniel Morissette * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: *  * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. *  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER  * DEALINGS IN THE SOFTWARE. ********************************************************************** * * $Log: mitab_rawbinblock.cpp,v $ * Revision 1.10  2007/02/22 18:35:53  dmorissette * Fixed problem writing collections where MITAB was sometimes trying to * read past EOF in write mode (bug 1657). * * Revision 1.8  2005/10/06 19:15:31  dmorissette * Collections: added support for reading/writing pen/brush/symbol ids and * for writing collection objects to .TAB/.MAP (bug 1126) * * Revision 1.7  2004/12/01 18:25:03  dmorissette * Fixed potential memory leaks in error conditions (bug 881) * * Revision 1.6  2004/06/30 20:29:04  dmorissette * Fixed refs to old address danmo@videotron.ca * * Revision 1.5  2000/02/28 17:06:06  daniel * Added m_bModified flag * * Revision 1.4  2000/01/15 22:30:45  daniel * Switch to MIT/X-Consortium OpenSource license * * Revision 1.3  1999/09/26 14:59:37  daniel * Implemented write support * * Revision 1.2  1999/09/16 02:39:17  daniel * Completed read support for most feature types * * Revision 1.1  1999/07/12 04:18:25  daniel * Initial checkin * **********************************************************************/#include "mitab.h"/*===================================================================== *                      class TABRawBinBlock *====================================================================*//********************************************************************** *                   TABRawBinBlock::TABRawBinBlock() * * Constructor. **********************************************************************/TABRawBinBlock::TABRawBinBlock(TABAccess eAccessMode /*= TABRead*/,                               GBool bHardBlockSize /*= TRUE*/){    m_fp = NULL;    m_pabyBuf = NULL;    m_nFirstBlockPtr = 0;    m_nBlockSize = m_nSizeUsed = m_nFileOffset = m_nCurPos = 0;    m_bHardBlockSize = bHardBlockSize;    m_bModified = FALSE;    m_eAccess = eAccessMode; }/********************************************************************** *                   TABRawBinBlock::~TABRawBinBlock() * * Destructor. **********************************************************************/TABRawBinBlock::~TABRawBinBlock(){    if (m_pabyBuf)        CPLFree(m_pabyBuf);}/********************************************************************** *                   TABRawBinBlock::ReadFromFile() * * Load data from the specified file location and initialize the block. * * Returns 0 if succesful or -1 if an error happened, in which case  * CPLError() will have been called. **********************************************************************/int     TABRawBinBlock::ReadFromFile(FILE *fpSrc, int nOffset,                                      int nSize /*= 512*/){    GByte *pabyBuf;    if (fpSrc == NULL || nSize == 0)    {        CPLError(CE_Failure, CPLE_AssertionFailed,                  "TABRawBinBlock::ReadFromFile(): Assertion Failed!");        return -1;    }    m_fp = fpSrc;    m_nFileOffset = nOffset;    m_nCurPos = 0;    m_bModified = FALSE;        /*----------------------------------------------------------------     * Alloc a buffer to contain the data     *---------------------------------------------------------------*/    pabyBuf = (GByte*)CPLMalloc(nSize*sizeof(GByte));    /*----------------------------------------------------------------     * Read from the file     *---------------------------------------------------------------*/    if (VSIFSeek(fpSrc, nOffset, SEEK_SET) != 0 ||        (m_nSizeUsed = VSIFRead(pabyBuf, sizeof(GByte), nSize, fpSrc) ) == 0 ||        (m_bHardBlockSize && m_nSizeUsed != nSize ) )    {        CPLError(CE_Failure, CPLE_FileIO,                 "ReadFromFile() failed reading %d bytes at offset %d.",                 nSize, nOffset);        CPLFree(pabyBuf);        return -1;    }    /*----------------------------------------------------------------     * Init block with the data we just read     *---------------------------------------------------------------*/    return InitBlockFromData(pabyBuf, nSize, FALSE, fpSrc, nOffset);}/********************************************************************** *                   TABRawBinBlock::CommitToFile() * * Commit the current state of the binary block to the file to which  * it has been previously attached. * * Derived classes may want to (optionally) reimplement this method if * they need to do special processing before committing the block to disk. * * For files created with bHardBlockSize=TRUE, a complete block of * the specified size is always written, otherwise only the number of * used bytes in the block will be written to disk. * * Returns 0 if succesful or -1 if an error happened, in which case  * CPLError() will have been called. **********************************************************************/int     TABRawBinBlock::CommitToFile(){    int nStatus = 0;    if (m_fp == NULL || m_nBlockSize <= 0 || m_pabyBuf == NULL ||        m_nFileOffset < 0)    {        CPLError(CE_Failure, CPLE_AssertionFailed,         "TABRawBinBlock::CommitToFile(): Block has not been initialized yet!");        return -1;    }    /*----------------------------------------------------------------     * If block has not been modified, then just return... nothing to do.     *---------------------------------------------------------------*/    if (!m_bModified)        return 0;    /*----------------------------------------------------------------     * Move the output file pointer to the right position...      *---------------------------------------------------------------*/    if (VSIFSeek(m_fp, m_nFileOffset, SEEK_SET) != 0)    {        /*------------------------------------------------------------         * Moving pointer failed... we may need to pad with zeros if          * block destination is beyond current end of file.         *-----------------------------------------------------------*/        int nCurPos;        nCurPos = VSIFTell(m_fp);        if (nCurPos < m_nFileOffset &&            VSIFSeek(m_fp, 0L, SEEK_END) == 0 &&            (nCurPos = VSIFTell(m_fp)) < m_nFileOffset)        {            GByte cZero = 0;            while(nCurPos < m_nFileOffset && nStatus == 0)            {                if (VSIFWrite(&cZero, 1, 1, m_fp) != 1)                {                    CPLError(CE_Failure, CPLE_FileIO,                             "Failed writing 1 byte at offset %d.", nCurPos);                    nStatus = -1;                    break;                }                nCurPos++;            }        }                    if (nCurPos != m_nFileOffset)            nStatus = -1; // Error message will follow below    }    /*----------------------------------------------------------------     * At this point we are ready to write to the file.     *     * If m_bHardBlockSize==FALSE, then we do not write a complete block;     * we write only the part of the block that was used.     *---------------------------------------------------------------*/    int numBytesToWrite = m_bHardBlockSize?m_nBlockSize:m_nSizeUsed;    if (nStatus != 0 ||        VSIFWrite(m_pabyBuf,sizeof(GByte),                    numBytesToWrite, m_fp) != (size_t)numBytesToWrite )    {        CPLError(CE_Failure, CPLE_FileIO,                 "Failed writing %d bytes at offset %d.",                 numBytesToWrite, m_nFileOffset);        return -1;    }    fflush(m_fp);    m_bModified = FALSE;    return 0;}/********************************************************************** *                   TABRawBinBlock::InitBlockFromData() * * Set the binary data buffer and initialize the block. * * Calling ReadFromFile() will automatically call InitBlockFromData() to * complete the initialization of the block after the data is read from the * file.  Derived classes should implement their own version of  * InitBlockFromData() if they need specific initialization... in this * case the derived InitBlockFromData() should call TABRawBinBlock::InitBlockFromData() * before doing anything else. * * By default, the buffer will be copied, but if bMakeCopy = FALSE then * it won't be copied, and the object will keep a reference to the * user's buffer... and this object will eventually free the user's buffer. * * Returns 0 if succesful or -1 if an error happened, in which case  * CPLError() will have been called. **********************************************************************/int     TABRawBinBlock::InitBlockFromData(GByte *pabyBuf, int nSize,                                       GBool bMakeCopy /* = TRUE */,                                      FILE *fpSrc /* = NULL */,                                       int nOffset /* = 0 */){    m_fp = fpSrc;    m_nFileOffset = nOffset;    m_nCurPos = 0;    m_bModified = FALSE;        /*----------------------------------------------------------------     * Alloc or realloc the buffer to contain the data if necessary     *---------------------------------------------------------------*/    if (!bMakeCopy)    {        if (m_pabyBuf != NULL)            CPLFree(m_pabyBuf);        m_pabyBuf = pabyBuf;        m_nSizeUsed = m_nBlockSize = nSize;    }    else if (m_pabyBuf == NULL || nSize != m_nBlockSize)    {        m_pabyBuf = (GByte*)CPLRealloc(m_pabyBuf, nSize*sizeof(GByte));        m_nSizeUsed = m_nBlockSize = nSize;        memcpy(m_pabyBuf, pabyBuf, m_nBlockSize);    }    /*----------------------------------------------------------------     * Extract block type... header block (first block in a file) has     * no block type, so we assign one by default.     *---------------------------------------------------------------*/    if (m_nFileOffset == 0)        m_nBlockType = TABMAP_HEADER_BLOCK;    else    {        // Block type will be validated only if GetBlockType() is called        m_nBlockType = (int)m_pabyBuf[0];    }    return 0;}/********************************************************************** *                   TABRawBinBlock::InitNewBlock() * * Initialize the block so that it knows to which file is is attached, * its block size, etc. * * This is an alternative to calling ReadFromFile() or InitBlockFromData() * that puts the block in a stable state without loading any initial * data in it. * * Returns 0 if succesful or -1 if an error happened, in which case  * CPLError() will have been called. **********************************************************************/int     TABRawBinBlock::InitNewBlock(FILE *fpSrc, int nBlockSize,                                   int nFileOffset /* = 0*/){    m_fp = fpSrc;    m_nBlockSize = nBlockSize;    m_nSizeUsed = 0;    m_nCurPos = 0;    m_bModified = FALSE;    if (nFileOffset > 0)        m_nFileOffset = nFileOffset;    else        m_nFileOffset = 0;    m_nBlockType = -1;    m_pabyBuf = (GByte*)CPLRealloc(m_pabyBuf, m_nBlockSize*sizeof(GByte));    memset(m_pabyBuf, 0, m_nBlockSize);    return 0;}/********************************************************************** *                   TABRawBinBlock::GetBlockType() * * Return the block type for the current object.

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99久久综合色| 日韩一卡二卡三卡国产欧美| 色域天天综合网| 欧美综合久久久| 欧美色国产精品| 在线观看亚洲一区| 日韩三区在线观看| 国产精品日韩精品欧美在线| 亚洲美女在线国产| 天天色综合天天| 亚洲影院久久精品| 国产美女视频91| 91看片淫黄大片一级| 在线欧美小视频| 欧美一区二区三区视频| 久久久久久久久久久久电影| 精品不卡在线视频| 亚洲欧美一区二区三区国产精品| 亚洲第四色夜色| 国产成人在线视频免费播放| 欧美综合亚洲图片综合区| 51精品视频一区二区三区| 欧美va天堂va视频va在线| 日本一区二区三级电影在线观看 | 丝袜亚洲另类欧美| 国产在线不卡一卡二卡三卡四卡| www.欧美日韩国产在线| 欧美电影一区二区三区| 国产精品天美传媒沈樵| 亚洲欧洲国产专区| 午夜a成v人精品| 成人黄色一级视频| 91精品国产综合久久香蕉麻豆| 久久精品夜色噜噜亚洲a∨| 亚洲最大成人综合| 国产经典欧美精品| 91精品欧美一区二区三区综合在 | 91麻豆国产福利精品| 91福利在线导航| 不卡区在线中文字幕| 国产日韩欧美a| 国产日韩精品一区二区三区在线| 日韩激情视频在线观看| 色综合久久66| 一本色道久久综合亚洲91| 中文字幕综合网| 91黄色激情网站| 色久综合一二码| 色综合久久中文字幕| 亚洲激情第一区| 亚洲福利一二三区| 成人精品在线视频观看| 欧美激情一区二区三区在线| 国产一区二区三区| 天天爽夜夜爽夜夜爽精品视频| 日本一区免费视频| 粉嫩一区二区三区性色av| 国模套图日韩精品一区二区| 亚洲欧美日韩国产成人精品影院 | 久久综合色天天久久综合图片| 亚洲国产成人自拍| 国产高清久久久| 亚洲成人久久影院| 国产精品另类一区| 日韩欧美激情在线| 91女神在线视频| 五月天网站亚洲| 久久久久综合网| 色综合久久久网| 亚洲永久免费av| 国产日产欧产精品推荐色| 日韩一区二区三区电影| 国模少妇一区二区三区| 国产成人精品亚洲777人妖| 国产成人在线影院| 欧美三级一区二区| 99riav久久精品riav| 色猫猫国产区一区二在线视频| 色综合av在线| 2023国产精品| 国产欧美一区二区精品婷婷| 国产午夜精品在线观看| 欧美日韩另类国产亚洲欧美一级| 激情综合色丁香一区二区| 日韩伦理电影网| 国产麻豆精品theporn| 色老汉av一区二区三区| 欧美色综合网站| 日本一区免费视频| 色88888久久久久久影院按摩| 亚洲男女毛片无遮挡| 欧美男同性恋视频网站| 国产精品69久久久久水密桃| 亚洲裸体xxx| 欧美一级生活片| 波多野结衣精品在线| 午夜一区二区三区在线观看| 精品国产乱码久久久久久夜甘婷婷 | 色妞www精品视频| 久久精品99国产国产精| 中文字幕第一区综合| 欧美撒尿777hd撒尿| 国内精品伊人久久久久av一坑| 亚洲欧洲日韩综合一区二区| 日韩欧美国产三级电影视频| 色先锋久久av资源部| 国产一区二区在线观看免费| 亚洲在线视频网站| 欧美激情一区二区三区蜜桃视频| 欧美日韩情趣电影| gogogo免费视频观看亚洲一| 美女视频免费一区| 亚洲自拍偷拍麻豆| 成人免费一区二区三区在线观看| 精品国产一区二区在线观看| 欧美日韩一级二级三级| eeuss国产一区二区三区| 国产一区二区伦理片| 美腿丝袜亚洲综合| 午夜婷婷国产麻豆精品| 一区二区三区在线影院| 亚洲欧洲精品天堂一级| 欧美经典一区二区三区| 精品国产伦一区二区三区观看方式 | 粉嫩av亚洲一区二区图片| 免费国产亚洲视频| 久久久亚洲精品一区二区三区 | 国产精品久久久久久久岛一牛影视| 一本久道久久综合中文字幕| 亚洲欧洲国产日韩| 成人91在线观看| 久久精品视频免费| 成人激情综合网站| 国产精品一二三区在线| 日本网站在线观看一区二区三区| 一个色妞综合视频在线观看| 日韩码欧中文字| 国产精品久久久久久妇女6080| 国产网红主播福利一区二区| 久久久久久亚洲综合| 日韩精品一区二区在线观看| 91精品国产综合久久精品性色| 在线观看成人免费视频| 色婷婷综合久久久久中文| 91网站在线播放| 日本电影欧美片| 欧美综合亚洲图片综合区| 欧美日韩国产一二三| 6080日韩午夜伦伦午夜伦| 日韩午夜在线观看| 久久婷婷国产综合国色天香| 久久久久国产精品人| 国产精品免费丝袜| 亚洲男女一区二区三区| 亚洲3atv精品一区二区三区| 天堂午夜影视日韩欧美一区二区| 肉肉av福利一精品导航| 国产综合色产在线精品| 成人中文字幕合集| 色偷偷久久一区二区三区| 欧美日韩一级大片网址| 日韩午夜av一区| 国产欧美一区二区精品久导航| 国产精品乱人伦| 一区二区不卡在线播放| 日韩制服丝袜av| 久久国产欧美日韩精品| 成人综合婷婷国产精品久久免费| 成人精品免费看| 91精品福利在线| 51精品秘密在线观看| 国产色一区二区| 亚洲一区二区三区爽爽爽爽爽| 亚洲一区二区不卡免费| 极品少妇xxxx精品少妇| 成人高清免费观看| 日韩视频免费直播| 韩国成人精品a∨在线观看| 成人午夜精品在线| 天堂va蜜桃一区二区三区漫画版| 免费久久99精品国产| 成人免费毛片app| 欧美日韩精品一区二区在线播放| 精品三级av在线| 亚洲乱码国产乱码精品精98午夜| 日本不卡不码高清免费观看| 成人高清视频免费观看| 91.成人天堂一区| **欧美大码日韩| 国产在线精品不卡| 精品视频在线视频| 中文字幕欧美三区| 青青草一区二区三区| av不卡在线播放| 精品日韩在线一区| 亚洲综合视频在线| 成人免费高清在线观看| 欧美变态tickling挠脚心| 一区二区三区 在线观看视频| 国产精品18久久久久久久久久久久|