Changeset 12359

Show
Ignore:
Timestamp:
10/09/07 13:54:26 (1 year ago)
Author:
warmerdam
Message:

avoid static variables (#1883)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.4/gdal/ogr/ogrsf_frmts/mitab/mitab_datfile.cpp

    r6276 r12359  
    820820const char *TABDATFile::ReadCharField(int nWidth) 
    821821{ 
    822     // We know that character strings are limited to 254 chars in MapInfo 
    823     static char szBuf[256]; 
    824  
    825822    // If current record has been deleted, then return an acceptable  
    826823    // default value. 
     
    842839    } 
    843840 
    844     if (m_poRecordBlock->ReadBytes(nWidth, (GByte*)szBuf) != 0) 
     841    if (m_poRecordBlock->ReadBytes(nWidth, (GByte*)m_szBuffer) != 0) 
    845842        return ""; 
    846843 
    847     szBuf[nWidth] = '\0'; 
     844    m_szBuffer[nWidth] = '\0'; 
    848845 
    849846    // NATIVE tables are padded with '\0' chars, but DBF tables are padded 
     
    851848    if (m_eTableType == TABTableDBF) 
    852849    { 
    853         int nLen = strlen(szBuf)-1; 
    854         while(nLen>=0 && szBuf[nLen] == ' ') 
    855             szBuf[nLen--] = '\0'; 
    856     } 
    857  
    858     return szBuf
     850        int nLen = strlen(m_szBuffer)-1; 
     851        while(nLen>=0 && m_szBuffer[nLen] == ' ') 
     852            m_szBuffer[nLen--] = '\0'; 
     853    } 
     854 
     855    return m_szBuffer
    859856} 
    860857 
     
    10121009{ 
    10131010    int nDay, nMonth, nYear; 
    1014     static char szBuf[20]; 
    10151011 
    10161012    // If current record has been deleted, then return an acceptable  
     
    10391035        return ""; 
    10401036 
    1041     sprintf(szBuf, "%4.4d%2.2d%2.2d", nYear, nMonth, nDay); 
    1042  
    1043     return szBuf
     1037    sprintf(m_szBuffer, "%4.4d%2.2d%2.2d", nYear, nMonth, nDay); 
     1038 
     1039    return m_szBuffer
    10441040} 
    10451041 
  • branches/1.4/gdal/ogr/ogrsf_frmts/mitab/mitab_priv.h

    r11168 r12359  
    14821482    int         WriteHeader(); 
    14831483 
     1484        // We know that character strings are limited to 254 chars in MapInfo 
     1485        // Using a buffer pr. class instance to avoid threading issues with the library 
     1486        char            m_szBuffer[256]; 
     1487 
    14841488   public: 
    14851489    TABDATFile();