id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
773	"RasterIO() ""expansion"" doesn't work right in most cases."	warmerdam	warmerdam	"{{{
Hi Frank again,

OK, the Fill() seems to be a reasonable way to assure that
you put some appropriate ""background"" value. That's OK.
However, I'm still noticing something wrong regarding my
original posting: replicating a value. The attached test
program creates a 10x6 1-band raster of type byte; fills
it with '_' and then calls RasterIO to set the upper left
7x3 region with 'X':

$ g++ rasteriotest.cc -lgdal -Wall
$ ./a.out
result = 0
$ cat raster
_____________X______________________________________________

but it should be:
XXXXXXXXXXXXXXXXXXXXX_______________________________________

Right?



... test code:

#include ""gdal.h""           
#include ""gdal_priv.h""
#include <iostream>
#include <cassert>
using namespace std; 

/*
	RasterIO bug?
		$ g++ rasteriotest.cc -lgdal -Wall
		$ ./a.out
		result = 0
		$ cat raster
		_____________X______________________________________________
		
		but it should be:
		XXXXXXXXXXXXXXXXXXXXX_______________________________________
*/
int main() {
	GDALAllRegister();
	GDALDriver* hDriver = GetGDALDriverManager()->GetDriverByName(""ENVI"");
	assert(hDriver);
	GDALDataset* dataset = hDriver->Create(
	   ""raster"",
	   10,       //nXSize
	   6,       //nYSize
	   1,          //nBands
	   GDT_Byte,  //GDALDataType
	   NULL        //papszParmList
	);
	dataset->GetRasterBand(1)->Fill('_');
	char value = 'X';
	int result = dataset->RasterIO(
		GF_Write,
		0,          //nXOff,
		0,             //nYOff,
		7,           //nXSize,
		3,           //nYSize,
		&value,        //pData,
		1,             //nBufXSize,
		1,             //nBufYSize,
		GDT_Byte,     //eBufType,
		1,             //nBandCount,
		NULL,          //panBandMap,
		0,             //nPixelSpace,
		0,             //nLineSpace,
		0              //nBandSpace
	);     
	cout<< ""result = "" <<result<< endl;
	dataset->FlushCache();
	delete dataset;
	return 0;
}
}}}"	defect	closed	high	1.6.0	GDAL_Raster	unspecified	normal	fixed	rasterio expansion	
