Changeset 13422

Show
Ignore:
Timestamp:
12/21/07 07:55:55 (5 months ago)
Author:
rouault
Message:

Prevent opening in update mode && fix reading of blocks in creation mode

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/gdal/frmts/adrg/adrgdataset.cpp

    r13418 r13422  
    213213    } 
    214214    CPLDebug("ADRG", "(%d,%d) -> nBlock = %d", nBlockXOff, nBlockYOff, nBlock); 
    215      
    216     if (poDS->bCreation) 
    217     { 
    218         memset(pImage, 0, 128 * 128); 
    219         return CE_None; 
    220     } 
    221      
     215 
    222216    if (poDS->TILEINDEX) 
    223217    { 
     
    12681262    CPLString fileName(poOpenInfo->pszFilename); 
    12691263    CPLString NAM; 
    1270      
     1264 
     1265    if( poOpenInfo->eAccess == GA_Update ) 
     1266    { 
     1267        CPLError( CE_Failure, CPLE_NotSupported,  
     1268                  "The ADRG driver does not support update access to existing" 
     1269                  " datasets.\n" ); 
     1270        return NULL; 
     1271    } 
     1272 
    12711273    if (EQUAL(CPLGetExtension((const char*)fileName), "thf")) 
    12721274    { 
     
    14721474     
    14731475    CPLString imgFilename = CPLResetExtension(pszFilename, "IMG"); 
    1474     FILE* fdIMG = VSIFOpenL((const char*)imgFilename, "wb"); 
     1476    FILE* fdIMG = VSIFOpenL((const char*)imgFilename, "w+b"); 
    14751477    if (fdIMG == NULL) 
    14761478    {