From 68c2a2f760950e5c8934c4a69b42b8a16c5dba1e Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Fri, 31 Jan 2025 19:05:12 +0100 Subject: [PATCH] msDrawRasterBuildRasterPath(): micro-optimization: do not attempt to open non-exiting file (#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. --- src/mapraster.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mapraster.c b/src/mapraster.c index 61c9f8c67a..f27d002a94 100644 --- a/src/mapraster.c +++ b/src/mapraster.c @@ -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;