Opened 20 years ago
Last modified 19 years ago
#619 closed defect (fixed)
pb when trying to create an image on a full disk
Reported by: | Owned by: | warmerdam | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | GDAL_Raster | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: | wjimage@… |
Description
When creating an image on a disk where there is not enough space left to write the image, no "failed" error code is returned. The version used is GDAL 1.2.2.0 See code snippet : void testGDAL() { GDALAllRegister(); GDALDriver *poDriver; char **papszMetadata; poDriver = GetGDALDriverManager()->GetDriverByName("BMP"); if( poDriver == NULL ) return; papszMetadata = poDriver->GetMetadata(); if( !CSLFetchBoolean( papszMetadata, GDAL_DCAP_CREATE, FALSE ) ) { printf( "Driver %s does not support Create() method.\n" ); return; } int x = 40; int y = 40; GDALDataset* m_gdalDataSet = poDriver->Create( "T:\\foo.bmp", x, y, 3, GDT_Byte, NULL); if ( m_gdalDataSet == NULL ) return; GDALRasterBand *poBand = m_gdalDataSet->GetRasterBand(1); if ( poBand == NULL ) return; unsigned char* value = (unsigned char*)malloc(x*y); memset(value,255,x*y); CPLErr err = poBand->RasterIO( GF_Write, 0, 0, x, y, value, x, y, GDT_Byte, 0, 0 ); free(value); if ( err != CE_None ) { return; } m_gdalDataSet->FlushCache(); GDALClose(m_gdalDataSet); }; as output (in stdout) I have : ERROR 3: Can't write block with X offset 0 and Y offset 0 ERROR 3: Can't write block with X offset 0 and Y offset 1 ERROR 3: Can't write block with X offset 0 and Y offset 2 ERROR 3: Can't write block with X offset 0 and Y offset 3 (...) ERROR 3: Can't write block with X offset 0 and Y offset 33 ERROR 3: Can't write block with X offset 0 and Y offset 34 RasterIO returns CE_None and the created file is wrong. Stephane.
Change History (5)
comment:2 by , 20 years ago
Hi Frank, thanks a lot for your fix. Just one question : what about the other formats ? Best Regards, Stephane
comment:3 by , 20 years ago
Stephane, The quality of IO error checking in other drivers varies, but I'm not really prepared to start doing a comprehensive review at this point. The techniques I applied in the BMP driver have been used in some of the other drivers.
comment:4 by , 20 years ago
Hi Frank, Thank you for this explaination. I'm not asking you to work on the other formats. It was just for me to know. Thanks again for the fix. Stephane
Note:
See TracTickets
for help on using tickets.