Skip to content

Commit 4873040

Browse files
authored
mapwms.cpp: fix compiler warnings emitted by MSVC (#7413)
Fixes #7412
1 parent f15dd70 commit 4873040

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

src/mapwms.cpp

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -923,11 +923,11 @@ static bool msWMSValidateDimensionValue(const char *value,
923923
}
924924
} else if (isextentarange) {
925925
/*single user value, single/multiple range extent*/
926-
const float currentval = atof(uservalues[0].c_str());
926+
const double currentval = atof(uservalues[0].c_str());
927927

928928
for (const auto &extentrange : aextentranges) {
929-
const float minval = extentrange.x;
930-
const float maxval = extentrange.y;
929+
const double minval = extentrange.x;
930+
const double maxval = extentrange.y;
931931
if (currentval >= minval && currentval <= maxval) {
932932
uservaluevalid = true;
933933
break;
@@ -937,12 +937,12 @@ static bool msWMSValidateDimensionValue(const char *value,
937937
} else if (ranges.size() == 2 || ranges.size() == 3) { /*range*/
938938
/*user input=single range. In this case the extents must
939939
be of a range type.*/
940-
const float mincurrentval = atof(ranges[0].c_str());
941-
const float maxcurrentval = atof(ranges[1].c_str());
940+
const double mincurrentval = atof(ranges[0].c_str());
941+
const double maxcurrentval = atof(ranges[1].c_str());
942942
if (isextentarange) {
943943
for (const auto &extentrange : aextentranges) {
944-
const float minval = extentrange.x;
945-
const float maxval = extentrange.y;
944+
const double minval = extentrange.x;
945+
const double maxval = extentrange.y;
946946

947947
if (minval <= mincurrentval && maxval >= maxcurrentval &&
948948
minval <= maxval) {
@@ -981,9 +981,9 @@ static bool msWMSValidateDimensionValue(const char *value,
981981
/*user input is multiple values, extent is defined as one or multiple
982982
* ranges*/
983983
for (const auto &extentrange : aextentranges) {
984-
const float minval = extentrange.x;
985-
const float maxval = extentrange.y;
986-
const float currentval = atof(uservalue.c_str());
984+
const double minval = extentrange.x;
985+
const double maxval = extentrange.y;
986+
const double currentval = atof(uservalue.c_str());
987987
if (minval <= currentval && maxval >= currentval &&
988988
minval <= maxval) {
989989
valueisvalid = true;
@@ -1002,15 +1002,15 @@ static bool msWMSValidateDimensionValue(const char *value,
10021002
/*each ranges should be valid*/
10031003
const auto onerange = msStringSplit(uservalue.c_str(), '/');
10041004
if (onerange.size() == 2 || onerange.size() == 3) {
1005-
const float mincurrentval = atof(onerange[0].c_str());
1006-
const float maxcurrentval = atof(onerange[1].c_str());
1005+
const double mincurrentval = atof(onerange[0].c_str());
1006+
const double maxcurrentval = atof(onerange[1].c_str());
10071007

10081008
/*extent must be defined also as a rangle*/
10091009
if (isextentarange) {
10101010
bool found = false;
10111011
for (const auto &extentrange : aextentranges) {
1012-
const float mincurrentrange = extentrange.x;
1013-
const float maxcurrentrange = extentrange.y;
1012+
const double mincurrentrange = extentrange.x;
1013+
const double maxcurrentrange = extentrange.y;
10141014

10151015
if (mincurrentval >= mincurrentrange &&
10161016
maxcurrentval <= maxcurrentrange &&
@@ -4087,7 +4087,6 @@ static int msWMSGetCapabilities(mapObj *map, int nVersion, cgiRequestObj *req,
40874087

40884088
std::string legendurl(script_url_encoded);
40894089
legendurl += "version=";
4090-
char szVersionBuf[OWS_VERSION_MAXLEN];
40914090
legendurl += msOWSGetVersionString(nVersion, szVersionBuf);
40924091
legendurl += "&amp;service=WMS&amp;request=GetLegendGraphic&amp;";
40934092
if (nVersion >= OWS_1_3_0) {
@@ -4806,9 +4805,9 @@ static int msWMSFeatureInfo(mapObj *map, int nVersion, char **names,
48064805

48074806
/* It's a valid Cascading WMS GetFeatureInfo request */
48084807
if (wms_layer)
4809-
return msWMSLayerExecuteRequest(map, numOWSLayers, point.x, point.y,
4810-
feature_count, info_format,
4811-
WMS_GETFEATUREINFO);
4808+
return msWMSLayerExecuteRequest(
4809+
map, numOWSLayers, static_cast<int>(point.x), static_cast<int>(point.y),
4810+
feature_count, info_format, WMS_GETFEATUREINFO);
48124811
if (use_bbox == MS_FALSE) {
48134812

48144813
if (point.x == -1.0 || point.y == -1.0) {
@@ -5541,8 +5540,8 @@ static int msWMSGetContentDependentLegend(mapObj *map, int nVersion,
55415540
** msWMSGetStyles() : return an SLD document for all layers that
55425541
** have a status set to on or default.
55435542
*/
5544-
static int msWMSGetStyles(mapObj *map, int nVersion, char **names,
5545-
char **values, int numentries,
5543+
static int msWMSGetStyles(mapObj *map, int nVersion, const char *const *names,
5544+
const char *const *values, int numentries,
55465545
const char *wms_exception_format,
55475546
owsRequestObj *ows_request)
55485547

@@ -5574,8 +5573,8 @@ static int msWMSGetStyles(mapObj *map, int nVersion, char **names,
55745573
auto iter = mapNameToNode.find(msStringToLower(wmslayer));
55755574
if (iter != mapNameToNode.end()) {
55765575
const auto layerIndices = iter->second->collectLayerIndices();
5577-
for (int i : layerIndices) {
5578-
layerObj *lp = GET_LAYER(map, i);
5576+
for (int layerIdx : layerIndices) {
5577+
layerObj *lp = GET_LAYER(map, layerIdx);
55795578
if (msIntegerInArray(lp->index, ows_request->enabled_layers,
55805579
ows_request->numlayers)) {
55815580
lp->status = MS_ON;

0 commit comments

Comments
 (0)