Skip to content

Commit

Permalink
Merge branch 'wcs_vsi_write_file' into branch-6-0
Browse files Browse the repository at this point in the history
Conflicts:
	HISTORY.TXT
  • Loading branch information
Schpidi committed Aug 28, 2012
2 parents 4a34233 + 5b21f45 commit 8596a7a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
2 changes: 2 additions & 0 deletions HISTORY.TXT
Expand Up @@ -14,6 +14,8 @@ For a complete change history, please see the Git log comments.
Current Version (future 6.0.4, GIT branch-6-0):
-----------------------------------------------

- Fixed bugs with WCS 1.1/2.0 with VSIMEM (#4369)

- Fixed "msGetMarkerSize() called on unloaded pixmap symbol" in mapsymbol.c (#4225)

- Fixed PHP MapScript support for PHP 5.4 (#4309)
Expand Down
13 changes: 8 additions & 5 deletions mapwcs11.c
Expand Up @@ -1169,6 +1169,7 @@ int msWCSReturnCoverage11( wcsParamsObj *params, mapObj *map,
{
int status, i;
char *filename = NULL;
char *base_dir = NULL;
const char *encoding;
const char *fo_filename;

Expand Down Expand Up @@ -1205,11 +1206,12 @@ int msWCSReturnCoverage11( wcsParamsObj *params, mapObj *map,
if( GDALGetMetadataItem( hDriver, GDAL_DCAP_VIRTUALIO, NULL )
!= NULL )
{
base_dir = msTmpFile(map, map->mappath, "/vsimem/wcsout", NULL);
if( fo_filename )
filename = msStrdup(CPLFormFilename("/vsimem/wcsout",
filename = msStrdup(CPLFormFilename(base_dir,
fo_filename,NULL));
else
filename = msStrdup(CPLFormFilename("/vsimem/wcsout",
filename = msStrdup(CPLFormFilename(base_dir,
"out", pszExtension ));

/* CleanVSIDir( "/vsimem/wcsout" ); */
Expand Down Expand Up @@ -1307,7 +1309,7 @@ int msWCSReturnCoverage11( wcsParamsObj *params, mapObj *map,
/* -------------------------------------------------------------------- */
#ifdef GDAL_DCAP_VIRTUALIO
{
char **all_files = CPLReadDir( "/vsimem/wcsout" );
char **all_files = CPLReadDir( base_dir );
int count = CSLCount(all_files);

if( msIO_needBinaryStdout() == MS_FAILURE )
Expand Down Expand Up @@ -1370,7 +1372,7 @@ int msWCSReturnCoverage11( wcsParamsObj *params, mapObj *map,
10, 10 );

fp = VSIFOpenL(
CPLFormFilename("/vsimem/wcsout", all_files[i], NULL),
CPLFormFilename(base_dir, all_files[i], NULL),
"rb" );
if( fp == NULL )
{
Expand All @@ -1386,9 +1388,10 @@ int msWCSReturnCoverage11( wcsParamsObj *params, mapObj *map,

VSIFCloseL( fp );

VSIUnlink( all_files[i] );
VSIUnlink( CPLFormFilename(base_dir, all_files[i], NULL) );
}

msFree(base_dir);
CSLDestroy( all_files );
msReleaseLock( TLOCK_GDAL );

Expand Down
13 changes: 8 additions & 5 deletions mapwcs20.c
Expand Up @@ -1960,6 +1960,7 @@ static int msWCSWriteFile20(mapObj* map, imageObj* image, wcs20ParamsObjPtr para
{
int status;
char* filename = NULL;
char *base_dir = NULL;
const char *fo_filename;
int i;

Expand Down Expand Up @@ -1994,11 +1995,12 @@ static int msWCSWriteFile20(mapObj* map, imageObj* image, wcs20ParamsObjPtr para
if( GDALGetMetadataItem( hDriver, GDAL_DCAP_VIRTUALIO, NULL )
!= NULL )
{
base_dir = msTmpFile(map, map->mappath, "/vsimem/wcsout", NULL);
if( fo_filename )
filename = msStrdup(CPLFormFilename("/vsimem/wcsout",
filename = msStrdup(CPLFormFilename(base_dir,
fo_filename,NULL));
else
filename = msStrdup(CPLFormFilename("/vsimem/wcsout",
filename = msStrdup(CPLFormFilename(base_dir,
"out", pszExtension ));

/* CleanVSIDir( "/vsimem/wcsout" ); */
Expand Down Expand Up @@ -2066,7 +2068,7 @@ static int msWCSWriteFile20(mapObj* map, imageObj* image, wcs20ParamsObjPtr para
/* -------------------------------------------------------------------- */
#ifdef GDAL_DCAP_VIRTUALIO
{
char **all_files = CPLReadDir( "/vsimem/wcsout" );
char **all_files = CPLReadDir( base_dir );
int count = CSLCount(all_files);

if( msIO_needBinaryStdout() == MS_FAILURE )
Expand Down Expand Up @@ -2136,7 +2138,7 @@ static int msWCSWriteFile20(mapObj* map, imageObj* image, wcs20ParamsObjPtr para
10, 10 );

fp = VSIFOpenL(
CPLFormFilename("/vsimem/wcsout", all_files[i], NULL),
CPLFormFilename(base_dir, all_files[i], NULL),
"rb" );
if( fp == NULL )
{
Expand All @@ -2152,9 +2154,10 @@ static int msWCSWriteFile20(mapObj* map, imageObj* image, wcs20ParamsObjPtr para

VSIFCloseL( fp );

VSIUnlink( all_files[i] );
VSIUnlink( CPLFormFilename(base_dir, all_files[i], NULL) );
}

msFree(base_dir);
msFree(filename);
CSLDestroy( all_files );
msReleaseLock( TLOCK_GDAL );
Expand Down

0 comments on commit 8596a7a

Please sign in to comment.