|
33 | 33 | #include "mapthread.h" |
34 | 34 | #include "mapows.h" |
35 | 35 |
|
36 | | -#define __USE_LARGEFILE64 1 |
37 | 36 | #include "ogr_api.h" |
38 | 37 | #include "ogr_srs_api.h" |
39 | 38 | #include "cpl_conv.h" |
40 | 39 | #include "cpl_vsi.h" |
41 | 40 | #include "cpl_string.h" |
42 | 41 |
|
| 42 | +#include <string> |
| 43 | + |
43 | 44 | /************************************************************************/ |
44 | 45 | /* msInitDefaultOGROutputFormat() */ |
45 | 46 | /************************************************************************/ |
@@ -717,21 +718,19 @@ int msOGRWriteFromQuery( mapObj *map, outputFormatObj *format, int sendheaders ) |
717 | 718 | CSLFetchNameValueDef(layer_options, "NATIVE_DATA", "{}"); |
718 | 719 | if( pszNativeData[strlen(pszNativeData)-1] == '}' ) |
719 | 720 | { |
720 | | - char szTemp[32]; |
721 | | - char* pszTemplate = msSmallMalloc(strlen(pszNativeData) + 32); |
722 | | - strcpy(pszTemplate, pszNativeData); |
723 | | - pszTemplate[strlen(pszTemplate)-1] = 0; |
| 721 | + std::string tmpl(pszNativeData); |
| 722 | + tmpl.resize(tmpl.size() - 1); |
724 | 723 | if( strlen(pszNativeData) > 2 ) |
725 | | - strcat(pszTemplate, ","); |
726 | | - sprintf(szTemp, "\"numberMatched\":%d}", nMatchingFeatures); |
727 | | - strcat(pszTemplate, szTemp); |
| 724 | + tmpl += ','; |
| 725 | + tmpl += "\"numberMatched\":"; |
| 726 | + tmpl += std::to_string(nMatchingFeatures); |
| 727 | + tmpl += '}'; |
728 | 728 | layer_options = CSLSetNameValue(layer_options, |
729 | 729 | "NATIVE_MEDIA_TYPE", |
730 | 730 | "application/vnd.geo+json"); |
731 | 731 | layer_options = CSLSetNameValue(layer_options, |
732 | 732 | "NATIVE_DATA", |
733 | | - pszTemplate); |
734 | | - msFree(pszTemplate); |
| 733 | + tmpl.c_str()); |
735 | 734 | } |
736 | 735 | } |
737 | 736 | if(!strcasecmp("true",msGetOutputFormatOption(format,"USE_FEATUREID","false"))) { |
@@ -1129,11 +1128,11 @@ int msOGRWriteFromQuery( mapObj *map, outputFormatObj *format, int sendheaders ) |
1129 | 1128 | msShapeGetClass(layer, map, &resultshape, NULL, -1); |
1130 | 1129 |
|
1131 | 1130 | if( resultshape.classindex >= 0 |
1132 | | - && (layer->class[resultshape.classindex]->text.string |
| 1131 | + && (layer->_class[resultshape.classindex]->text.string |
1133 | 1132 | || layer->labelitem) |
1134 | | - && layer->class[resultshape.classindex]->numlabels > 0 |
1135 | | - && layer->class[resultshape.classindex]->labels[0]->size != -1 ) { |
1136 | | - resultshape.text = msShapeGetLabelAnnotation(layer,&resultshape,layer->class[resultshape.classindex]->labels[0]); |
| 1133 | + && layer->_class[resultshape.classindex]->numlabels > 0 |
| 1134 | + && layer->_class[resultshape.classindex]->labels[0]->size != -1 ) { |
| 1135 | + resultshape.text = msShapeGetLabelAnnotation(layer,&resultshape,layer->_class[resultshape.classindex]->labels[0]); |
1137 | 1136 | } |
1138 | 1137 |
|
1139 | 1138 | /* |
|
0 commit comments