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

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

?? cpl_conv.cpp

?? mitab,讀取MapInfo的地圖文件
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
/******************************************************************************
 * $Id: cpl_conv.cpp 12407 2007-10-13 17:33:44Z rouault $
 *
 * Project:  CPL - Common Portability Library
 * Purpose:  Convenience functions.
 * Author:   Frank Warmerdam, warmerdam@pobox.com
 *
 ******************************************************************************
 * Copyright (c) 1998, Frank Warmerdam
 *
 * 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.
 ****************************************************************************/

#include "cpl_conv.h"
#include "cpl_string.h"
#include "cpl_vsi.h"
#include "cpl_multiproc.h"

CPL_CVSID("$Id: cpl_conv.cpp 12407 2007-10-13 17:33:44Z rouault $");

#if defined(WIN32CE)
#  include "cpl_wince.h"
#  include <wce_errno.h>
#endif

static void *hConfigMutex = NULL;
static volatile char **papszConfigOptions = NULL;

static void *hSharedFileMutex = NULL;
static volatile int nSharedFileCount = 0;
static volatile CPLSharedFileInfo *pasSharedFileList = NULL;


/************************************************************************/
/*                             CPLCalloc()                              */
/************************************************************************/

/**
 * Safe version of calloc().
 *
 * This function is like the C library calloc(), but raises a CE_Fatal
 * error with CPLError() if it fails to allocate the desired memory.  It
 * should be used for small memory allocations that are unlikely to fail
 * and for which the application is unwilling to test for out of memory
 * conditions.  It uses VSICalloc() to get the memory, so any hooking of
 * VSICalloc() will apply to CPLCalloc() as well.  CPLFree() or VSIFree()
 * can be used free memory allocated by CPLCalloc().
 *
 * @param nCount number of objects to allocate.
 * @param nSize size (in bytes) of object to allocate.
 * @return pointer to newly allocated memory, only NULL if nSize * nCount is
 * NULL.
 */

void *CPLCalloc( size_t nCount, size_t nSize )

{
    void        *pReturn;

    if( nSize * nCount == 0 )
        return NULL;
    
    pReturn = VSICalloc( nCount, nSize );
    if( pReturn == NULL )
    {
        CPLError( CE_Fatal, CPLE_OutOfMemory,
                  "CPLCalloc(): Out of memory allocating %d bytes.\n",
                  nSize * nCount );
    }

    return pReturn;
}

/************************************************************************/
/*                             CPLMalloc()                              */
/************************************************************************/

/**
 * Safe version of malloc().
 *
 * This function is like the C library malloc(), but raises a CE_Fatal
 * error with CPLError() if it fails to allocate the desired memory.  It
 * should be used for small memory allocations that are unlikely to fail
 * and for which the application is unwilling to test for out of memory
 * conditions.  It uses VSIMalloc() to get the memory, so any hooking of
 * VSIMalloc() will apply to CPLMalloc() as well.  CPLFree() or VSIFree()
 * can be used free memory allocated by CPLMalloc().
 *
 * @param nSize size (in bytes) of memory block to allocate.
 * @return pointer to newly allocated memory, only NULL if nSize is zero.
 */

void *CPLMalloc( size_t nSize )

{
    void        *pReturn;

    CPLVerifyConfiguration();

    if( nSize == 0 )
        return NULL;

    if( nSize < 0 )
    {
        CPLError( CE_Failure, CPLE_AppDefined,
                  "CPLMalloc(%d): Silly size requested.\n",
                  nSize );
        return NULL;
    }
    
    pReturn = VSIMalloc( nSize );
    if( pReturn == NULL )
    {
        CPLError( CE_Fatal, CPLE_OutOfMemory,
                  "CPLMalloc(): Out of memory allocating %d bytes.\n",
                  nSize );
    }

    return pReturn;
}

/************************************************************************/
/*                             CPLRealloc()                             */
/************************************************************************/

/**
 * Safe version of realloc().
 *
 * This function is like the C library realloc(), but raises a CE_Fatal
 * error with CPLError() if it fails to allocate the desired memory.  It
 * should be used for small memory allocations that are unlikely to fail
 * and for which the application is unwilling to test for out of memory
 * conditions.  It uses VSIRealloc() to get the memory, so any hooking of
 * VSIRealloc() will apply to CPLRealloc() as well.  CPLFree() or VSIFree()
 * can be used free memory allocated by CPLRealloc().
 *
 * It is also safe to pass NULL in as the existing memory block for
 * CPLRealloc(), in which case it uses VSIMalloc() to allocate a new block.
 *
 * @param pData existing memory block which should be copied to the new block.
 * @param nNewSize new size (in bytes) of memory block to allocate.
 * @return pointer to allocated memory, only NULL if nNewSize is zero.
 */


void * CPLRealloc( void * pData, size_t nNewSize )

{
    void        *pReturn;

    if ( nNewSize == 0 )
    {
        VSIFree(pData);
        return NULL;
    }

    if( nNewSize < 0 )
    {
        CPLError( CE_Failure, CPLE_AppDefined,
                  "CPLRealloc(%d): Silly size requested.\n",
                  nNewSize );
        return NULL;
    }
    
    if( pData == NULL )
        pReturn = VSIMalloc( nNewSize );
    else
        pReturn = VSIRealloc( pData, nNewSize );
    
    if( pReturn == NULL )
    {
        CPLError( CE_Fatal, CPLE_OutOfMemory,
                  "CPLRealloc(): Out of memory allocating %d bytes.\n",
                  nNewSize );
    }

    return pReturn;
}

/************************************************************************/
/*                             CPLStrdup()                              */
/************************************************************************/

/**
 * Safe version of strdup() function.
 *
 * This function is similar to the C library strdup() function, but if
 * the memory allocation fails it will issue a CE_Fatal error with
 * CPLError() instead of returning NULL.  It uses VSIStrdup(), so any
 * hooking of that function will apply to CPLStrdup() as well.  Memory
 * allocated with CPLStrdup() can be freed with CPLFree() or VSIFree().
 *
 * It is also safe to pass a NULL string into CPLStrdup().  CPLStrdup()
 * will allocate and return a zero length string (as opposed to a NULL
 * string).
 *
 * @param pszString input string to be duplicated.  May be NULL.
 * @return pointer to a newly allocated copy of the string.  Free with
 * CPLFree() or VSIFree().
 */

char *CPLStrdup( const char * pszString )

{
    char        *pszReturn;

    if( pszString == NULL )
        pszString = "";

    pszReturn = VSIStrdup( pszString );
        
    if( pszReturn == NULL )
    {
        CPLError( CE_Fatal, CPLE_OutOfMemory,
                  "CPLStrdup(): Out of memory allocating %d bytes.\n",
                  strlen(pszString) );
        
    }
    
    return( pszReturn );
}

/************************************************************************/
/*                             CPLStrlwr()                              */
/************************************************************************/

/**
 * Convert each characters of the string to lower case.
 *
 * For example, "ABcdE" will be converted to "abcde".
 * This function is locale dependent.
 *
 * @param pszString input string to be converted.
 * @return pointer to the same string, pszString.
 */

char *CPLStrlwr( char *pszString )

{
    if (pszString)
    {
        char *pszTemp = pszString;

        while (*pszTemp)
        {
            *pszTemp = tolower (*pszTemp);
            pszTemp++;
        }
    }

    return pszString;
}

/************************************************************************/
/*                              CPLFGets()                              */
/*                                                                      */
/*      Note: CR = \r = ASCII 13                                        */
/*            LF = \n = ASCII 10                                        */
/************************************************************************/

/**
 * Reads in at most one less than nBufferSize characters from the fp
 * stream and stores them into the buffer pointed to by pszBuffer.
 * Reading stops after an EOF or a newline. If a newline is read, it
 * is _not_ stored into the buffer. A '\0' is stored after the last
 * character in the buffer. All three types of newline terminators
 * recognized by the CPLFGets(): single '\r' and '\n' and '\r\n'
 * combination.
 *
 * @param pszBuffer pointer to the targeting character buffer.
 * @param nBufferSize maximum size of the string to read (not including
 * termonating '\0').
 * @param fp file pointer to read from.
 * @return pointer to the pszBuffer containing a string read
 * from the file or NULL if the error or end of file was encountered.
 */

char *CPLFGets( char *pszBuffer, int nBufferSize, FILE * fp )

{
    int nActuallyRead, nOriginalOffset;

    if ( nBufferSize == 0 || pszBuffer == NULL || fp == NULL )
        return NULL;

/* -------------------------------------------------------------------- */
/*      Let the OS level call read what it things is one line.  This    */
/*      will include the newline.  On windows, if the file happens      */
/*      to be in text mode, the CRLF will have been converted to        */
/*      just the newline (LF).  If it is in binary mode it may well     */
/*      have both.                                                      */
/* -------------------------------------------------------------------- */
    nOriginalOffset = VSIFTell( fp );
    if( VSIFGets( pszBuffer, nBufferSize, fp ) == NULL )
        return NULL;
    
    nActuallyRead = strlen(pszBuffer);
    if ( nActuallyRead == 0 )
        return NULL;

/* -------------------------------------------------------------------- */
/*      If we found \r and out buffer is full, it is possible there     */
/*      is also a pending \n.  Check for it.                            */
/* -------------------------------------------------------------------- */
    if( nBufferSize == nActuallyRead+1
        && pszBuffer[nActuallyRead-1] == 13 )
    {
        int chCheck;
        chCheck = fgetc( fp );
        if( chCheck != 10 )
        {
            // unget the character.
            VSIFSeek( fp, nOriginalOffset+nActuallyRead, SEEK_SET );
        }
    }

/* -------------------------------------------------------------------- */
/*      Trim off \n, \r or \r\n if it appears at the end.  We don't     */
/*      need to do any "seeking" since we want the newline eaten.       */
/* -------------------------------------------------------------------- */
    if( nActuallyRead > 1 
        && pszBuffer[nActuallyRead-1] == 10 
        && pszBuffer[nActuallyRead-2] == 13 )
    {
        pszBuffer[nActuallyRead-2] = '\0';
    }
    else if( pszBuffer[nActuallyRead-1] == 10 
             || pszBuffer[nActuallyRead-1] == 13 )
    {
        pszBuffer[nActuallyRead-1] = '\0';
    }

/* -------------------------------------------------------------------- */
/*      Search within the string for a \r (MacOS convention             */
/*      apparently), and if we find it we need to trim the string,      */
/*      and seek back.                                                  */
/* -------------------------------------------------------------------- */
    char *pszExtraNewline = strchr( pszBuffer, 13 );
    
    if( pszExtraNewline != NULL )
    {
        int chCheck;

        nActuallyRead = pszExtraNewline - pszBuffer + 1;
        
        *pszExtraNewline = '\0';
        VSIFSeek( fp, nOriginalOffset + nActuallyRead - 1, SEEK_SET );

        /* 
         * This hackery is necessary to try and find our correct
         * spot on win32 systems with text mode line translation going 
         * on.  Sometimes the fseek back overshoots, but it doesn't
         * "realize it" till a character has been read. Try to read till
         * we get to the right spot and get our CR. 
         */ 
        chCheck = fgetc( fp );
        while( (chCheck != 13 && chCheck != EOF)
               || VSIFTell(fp) < nOriginalOffset + nActuallyRead )
        {
            static volatile int bWarned = FALSE;

            if( !bWarned )

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国模套图日韩精品一区二区| 国产亚洲欧美日韩俺去了| 成人免费视频一区二区| 美女视频网站久久| 毛片av一区二区三区| 婷婷丁香久久五月婷婷| 日日骚欧美日韩| 日韩高清在线不卡| 久久精品免费观看| 极品美女销魂一区二区三区免费| 青青草国产成人av片免费| 亚洲h在线观看| 日韩和欧美一区二区三区| 日本中文字幕一区二区有限公司| 婷婷丁香久久五月婷婷| 久久99精品久久久久婷婷| 精品一区二区免费视频| 国产成人午夜99999| 成人动漫精品一区二区| 日本丶国产丶欧美色综合| 色视频一区二区| 欧美裸体bbwbbwbbw| 日韩一级片网站| 欧美激情一区二区三区不卡| 亚洲色图清纯唯美| 日本三级韩国三级欧美三级| 国产精品一区二区你懂的| 91亚洲国产成人精品一区二区三| 欧美三级乱人伦电影| 欧美电影免费观看高清完整版在线| 久久综合九色综合97婷婷女人| 国产精品久久久一本精品 | 精品一区二区免费| 国产91丝袜在线播放九色| 色狠狠色噜噜噜综合网| 91麻豆精品91久久久久久清纯| 久久久久久一级片| 亚洲国产精品久久久久婷婷884 | 国产成人在线观看免费网站| 国产精品99久久久久久有的能看| 成人免费视频视频| 波多野结衣在线aⅴ中文字幕不卡| 在线精品视频免费观看| 在线综合+亚洲+欧美中文字幕| 日韩一区二区三区四区| 欧美韩国日本综合| 一级做a爱片久久| 日本成人在线视频网站| 国产成人自拍网| 在线观看一区日韩| 精品动漫一区二区三区在线观看| 久久综合九色综合97婷婷女人| 亚洲国产精品自拍| 国产激情一区二区三区| 日韩精品在线看片z| 欧美激情一二三区| 日韩中文字幕麻豆| 国产尤物一区二区在线| 91黄色激情网站| 日韩女优av电影在线观看| 亚洲欧美成aⅴ人在线观看| 天堂va蜜桃一区二区三区| 国产激情91久久精品导航| 欧美在线高清视频| 国产欧美一区二区精品秋霞影院| 亚洲乱码精品一二三四区日韩在线 | 99久久99久久免费精品蜜臀| 欧美群妇大交群中文字幕| 国产精品毛片久久久久久| 日韩高清在线观看| 欧美日韩一区二区三区免费看 | 国产日韩欧美制服另类| 亚洲va韩国va欧美va| a级高清视频欧美日韩| 日韩精品一区二区三区老鸭窝 | 欧美精品高清视频| 国产精品毛片大码女人| 亚洲国产成人tv| 懂色av中文一区二区三区| 久久中文娱乐网| 视频在线观看国产精品| 91视频91自| 国产精品沙发午睡系列990531| 免费在线观看成人| 欧美日韩精品一区二区三区四区 | 亚洲国产一区二区三区青草影视| 精品亚洲国内自在自线福利| 99久久精品免费精品国产| 欧美精品一区二区三| 奇米888四色在线精品| 欧美午夜在线一二页| 久久精品999| 欧美大片一区二区三区| 亚洲丶国产丶欧美一区二区三区| 99riav久久精品riav| 亚洲国产激情av| 国产高清一区日本| 国产性色一区二区| 国产白丝精品91爽爽久久| 久久亚洲欧美国产精品乐播| 精品一区二区免费在线观看| 2014亚洲片线观看视频免费| 久久99精品久久久久久国产越南| 精品国产乱子伦一区| 极品少妇一区二区三区精品视频 | 蜜臀av一区二区三区| 精品国产免费视频| 丁香婷婷深情五月亚洲| 国产午夜久久久久| 99久久国产综合色|国产精品| 亚洲欧美日韩国产一区二区三区 | 亚洲欧美韩国综合色| 91蝌蚪国产九色| 亚洲影院久久精品| 欧美日韩视频在线第一区| 亚洲国产精品影院| 日韩免费一区二区| 狠狠久久亚洲欧美| 中文字幕一区二区三区视频| 色综合久久99| 美女视频黄免费的久久| 久久久久高清精品| 色拍拍在线精品视频8848| 午夜成人在线视频| 精品久久久久久久久久久久包黑料| 紧缚捆绑精品一区二区| 国产精品久久久久永久免费观看| 色丁香久综合在线久综合在线观看| 日韩在线一区二区| 久久精品视频一区二区三区| 91啪在线观看| 狠狠色丁香婷综合久久| 亚洲欧美日本韩国| va亚洲va日韩不卡在线观看| 亚洲国产精品视频| 欧美国产精品中文字幕| 精品视频一区二区不卡| 国产一区二区三区精品欧美日韩一区二区三区 | 91福利国产精品| 亚洲在线视频一区| 欧美美女喷水视频| 成人一区二区三区视频| 日日夜夜免费精品| 亚洲精品午夜久久久| 久久久久久毛片| 欧美中文字幕一区二区三区亚洲 | 91黄色小视频| 国产精品一区二区三区四区 | 午夜电影网一区| 亚洲欧美日韩成人高清在线一区| 久久夜色精品国产欧美乱极品| 成人动漫中文字幕| 亚洲色图一区二区| 国产精品久久久久久久久图文区| 91精品国产一区二区三区| 一本久久a久久免费精品不卡| 国产一区二区三区电影在线观看| 五月天欧美精品| 一区二区三区日韩| 亚洲三级小视频| 国产精品美女久久久久久久久| 精品剧情在线观看| 欧美大片顶级少妇| 91精品国产乱| 欧美色国产精品| 国产成人福利片| 一区二区高清免费观看影视大全 | 毛片av一区二区| 七七婷婷婷婷精品国产| 婷婷一区二区三区| 日韩和的一区二区| 亚洲成av人在线观看| 亚洲一区二区三区免费视频| 亚洲精品欧美二区三区中文字幕| 中文字幕中文字幕中文字幕亚洲无线| 久久久久久久免费视频了| 久久久噜噜噜久久中文字幕色伊伊| 精品国产乱码久久久久久夜甘婷婷| 91国产免费看| 欧美大度的电影原声| 日韩午夜电影av| 欧美tk—视频vk| 久久嫩草精品久久久精品一| 久久久久久免费| **网站欧美大片在线观看| 中文字幕一区二区不卡 | 色综合久久66| 91九色最新地址| 91精品国产综合久久久久久漫画| 欧美一卡二卡在线观看| 26uuu欧美| 久久久久一区二区三区四区| ●精品国产综合乱码久久久久| 亚洲乱码中文字幕综合| 天堂在线一区二区| 国产在线麻豆精品观看| av在线一区二区| 欧美伦理影视网| 国产日产欧美精品一区二区三区| 1024成人网|