Skip to content

Commit

Permalink
Merge 4c59b22 into cherry-pick-backport-5884-to-branch-7-4-89fc375a-7…
Browse files Browse the repository at this point in the history
…415-433e-93fb-a840a9ebe0e9 [skip ci]

skip-checks: true
  • Loading branch information
backporting[bot] committed Sep 30, 2019
2 parents c2dab38 + 4c59b22 commit b3e1682
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
10 changes: 5 additions & 5 deletions mapgdal.c
Expand Up @@ -112,13 +112,13 @@ void msGDALCleanup( void )
}

/************************************************************************/
/* CleanVSIDir() */
/* msCleanVSIDir() */
/* */
/* For the temporary /vsimem/msout directory we need to be sure */
/* things are clean before we start, and after we are done. */
/************************************************************************/

void CleanVSIDir( const char *pszDir )
void msCleanVSIDir( const char *pszDir )

{
char **papszFiles = CPLReadDir( pszDir );
Expand All @@ -129,7 +129,7 @@ void CleanVSIDir( const char *pszDir )
|| strcasecmp(papszFiles[i],"..") == 0 )
continue;

VSIUnlink( papszFiles[i] );
VSIUnlink( CPLFormFilename(pszDir, papszFiles[i], NULL) );
}

CSLDestroy( papszFiles );
Expand Down Expand Up @@ -192,7 +192,7 @@ int msSaveImageGDAL( mapObj *map, imageObj *image, const char *filenameIn )

if( bUseXmp == MS_FALSE && GDALGetMetadataItem( hOutputDriver, GDAL_DCAP_VIRTUALIO, NULL )
!= NULL ) {
CleanVSIDir( "/vsimem/msout" );
msCleanVSIDir( "/vsimem/msout" );
filenameToFree = msTmpFile(map, NULL, "/vsimem/msout/", pszExtension );
}

Expand Down Expand Up @@ -503,7 +503,7 @@ int msSaveImageGDAL( mapObj *map, imageObj *image, const char *filenameIn )
VSIFCloseL( fp );

VSIUnlink( filename );
CleanVSIDir( "/vsimem/msout" );
msCleanVSIDir( "/vsimem/msout" );

msFree( filenameToFree );
}
Expand Down
3 changes: 3 additions & 0 deletions mapserver.h
Expand Up @@ -2783,6 +2783,9 @@ void msPopulateTextSymbolForLabelAndString(textSymbolObj *ts, labelObj *l, char
/* ==================================================================== */
MS_DLL_EXPORT int msSaveImageGDAL( mapObj *map, imageObj *image, const char *filename );
MS_DLL_EXPORT int msInitDefaultGDALOutputFormat( outputFormatObj *format );
#ifdef USE_GDAL
void msCleanVSIDir( const char *pszDir );
#endif

/* ==================================================================== */
/* prototypes for functions in mapogroutput.c */
Expand Down
4 changes: 1 addition & 3 deletions mapwmslayer.c
Expand Up @@ -44,8 +44,6 @@
# include "cpl_vsi.h"
#endif

void CleanVSIDir( const char *pszDir );

/**********************************************************************
* msInitWmsParamsObj()
*
Expand Down Expand Up @@ -1363,7 +1361,7 @@ int msDrawWMSLayerLow(int nLayerId, httpRequestObj *pasReqInfo,
* to attach a "VSI" name to this buffer.
* ------------------------------------------------------------------ */
if( pasReqInfo[iReq].pszOutputFile == NULL ) {
CleanVSIDir( "/vsimem/msout" );
msCleanVSIDir( "/vsimem/msout" );
mem_filename = msTmpFile(map, NULL, "/vsimem/msout/", "img.tmp" );

VSIFCloseL(
Expand Down

0 comments on commit b3e1682

Please sign in to comment.