Skip to content

Commit

Permalink
more explicit cast
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsumner committed Jun 6, 2024
1 parent 42e9312 commit 9dd261f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion inst/include/gdalapplib/gdalapplib.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ inline List gdalwarp_applib(CharacterVector source_filename,
// if supplied check that it's valid
OGRSpatialReference *oTargetSRS = nullptr;
oTargetSRS = new OGRSpatialReference;
OGRErr target_chk = oTargetSRS->SetFromUserInput(target_crs[0]);
OGRErr target_chk = oTargetSRS->SetFromUserInput((const char*)target_crs[0]);
if (oTargetSRS != nullptr) {
delete oTargetSRS;
}
Expand Down
4 changes: 2 additions & 2 deletions inst/include/gdalraster/gdalraster.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ inline GDALDatasetH gdalH_open_avrt(const char* dsn,
if (!projection[0].empty()) {
// have to validate this
OGRSpatialReference *srs = new OGRSpatialReference;
if (srs->SetFromUserInput(projection[0]) != OGRERR_NONE) {
if (srs->SetFromUserInput((const char*)projection[0]) != OGRERR_NONE) {
Rprintf("cannot set projection (CRS) from input 'projection' argument, ignoring: '%s'\n", (const char*)projection[0]);
} else {
translate_argv.AddString("-a_srs");
Expand All @@ -219,7 +219,7 @@ inline GDALDatasetH gdalH_open_avrt(const char* dsn,
if (geolocation.size() == 2) {
OGRSpatialReference *geolsrs = new OGRSpatialReference;
char *pszGeoSrsWKT = nullptr;
geolsrs->SetFromUserInput("OGC:CRS84");
geolsrs->SetFromUserInput("EPSG:4326");
geolsrs->exportToWkt(&pszGeoSrsWKT);

oDS->SetMetadataItem( "SRS", pszGeoSrsWKT, "GEOLOCATION" );
Expand Down
2 changes: 1 addition & 1 deletion inst/include/gdalreadwrite/gdalreadwrite.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ inline CharacterVector gdal_create(CharacterVector filename, CharacterVector dri
//GDALDataType gdt_type = GDT_Float32;
OGRSpatialReference* oTargetSRS = nullptr;
oTargetSRS = new OGRSpatialReference;
OGRErr target_chk = oTargetSRS->SetFromUserInput(projection[0]);
OGRErr target_chk = oTargetSRS->SetFromUserInput((const char*)projection[0]);
if (target_chk != OGRERR_NONE) {
if (oTargetSRS != nullptr) {
delete oTargetSRS;
Expand Down
2 changes: 1 addition & 1 deletion inst/include/gdalwarpgeneral/gdalwarpgeneral.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ inline List gdal_warp_general(CharacterVector dsn,
if (!target_crs[0].empty()) {
OGRSpatialReference oTargetSRS;
//const char * strforuin = (const char *)target_crs[0];
OGRErr target_chk = oTargetSRS.SetFromUserInput(target_crs[0]);
OGRErr target_chk = oTargetSRS.SetFromUserInput((const char*)target_crs[0]);
if (target_chk != OGRERR_NONE) Rcpp::stop("cannot initialize target projection");
const char *st = NULL;
st = ((GDALDataset *)poSrcDS[0])->GetProjectionRef();
Expand Down
2 changes: 1 addition & 1 deletion inst/include/gdalwarpmem/gdalwarpmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ inline List gdal_warp_in_memory(CharacterVector source_filename,
// if supplied check that it's valid
OGRSpatialReference *oTargetSRS = nullptr;
oTargetSRS = new OGRSpatialReference;
OGRErr target_chk = oTargetSRS->SetFromUserInput(target_WKT[0]);
OGRErr target_chk = oTargetSRS->SetFromUserInput((const char*)target_WKT[0]);
delete oTargetSRS;
if (target_chk != OGRERR_NONE) {

Expand Down

0 comments on commit 9dd261f

Please sign in to comment.