Skip to content

Commit

Permalink
msDrawRasterBuildRasterPath(): micro-optimization: do not attempt to …
Browse files Browse the repository at this point in the history
…open non-exiting file (MapServer#7215)

For a mapfile *without* SHAPEPATH and with a raster layer pointing to a
tileindex layer (e.g. PostGIS), we currently try to access an inexisting
file with the name of that tileindex layer.

Really a micro-optimization. Nothing critical. Found when investigated
other useless file opening attempts.
  • Loading branch information
rouault authored Jan 31, 2025
1 parent 5a8db73 commit 68c2a2f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/mapraster.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,11 @@ int msDrawRasterBuildRasterPath(mapObj *map, layerObj *layer,
char szPath[MS_MAXPATHLEN] /* output */) {
/*
** If using a tileindex then build the path relative to that file if SHAPEPATH
*is not set.
* is not set, provided that layer->tileindex does not refer to a layer (to
* save a useless file opening attempt)
*/
if (layer->tileindex && !map->shapepath) {
if (layer->tileindex && !map->shapepath &&
msGetLayerIndex(map, layer->tileindex) < 0) {
char tiAbsFilePath[MS_MAXPATHLEN];
char *tiAbsDirPath = NULL;

Expand Down

0 comments on commit 68c2a2f

Please sign in to comment.