Skip to content

Commit

Permalink
Goodbye const warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Gillies committed Oct 19, 2021
1 parent fbfbf6e commit 1c078d9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions rasterio/_base.pyx
Expand Up @@ -124,8 +124,8 @@ def _raster_driver_extensions():
cdef int iii = 0
cdef int driver_count = GDALGetDriverCount()
cdef GDALDriverH driver = NULL
cdef char* c_extensions = NULL
cdef char* c_drivername = NULL
cdef const char* c_extensions = NULL
cdef const char* c_drivername = NULL
driver_extensions = {}
for iii in range(driver_count):
driver = GDALGetDriver(iii)
Expand Down Expand Up @@ -216,7 +216,7 @@ cdef GDALDatasetH open_dataset(
flags = flags | 0x02

with nogil:
hds = GDALOpenEx(fname, flags, drivers, options, NULL)
hds = GDALOpenEx(fname, flags, <const char **>drivers, <const char **>options, NULL)
try:
return exc_wrap_pointer(hds)
finally:
Expand Down Expand Up @@ -814,7 +814,7 @@ cdef class DatasetBase:
int
"""
cdef GDALMajorObjectH obj = NULL
cdef char *value = NULL
cdef const char *value = NULL
cdef const char *key_c = NULL

obj = self.band(bidx)
Expand Down Expand Up @@ -1120,7 +1120,7 @@ cdef class DatasetBase:
cdef char *item = NULL
cdef const char *domain = NULL
cdef char *key = NULL
cdef char *val = NULL
cdef const char *val = NULL

if bidx > 0:
obj = self.band(bidx)
Expand Down Expand Up @@ -1172,7 +1172,7 @@ cdef class DatasetBase:
"""
cdef GDALMajorObjectH band = NULL
cdef GDALMajorObjectH obj = NULL
cdef char *value = NULL
cdef const char *value = NULL
cdef const char *name = NULL
cdef const char *domain = NULL

Expand Down
2 changes: 1 addition & 1 deletion rasterio/_crs.pyx
Expand Up @@ -22,7 +22,7 @@ log = logging.getLogger(__name__)

def gdal_version():
"""Return the version as a major.minor.patchlevel string."""
cdef char *info_c = NULL
cdef const char *info_c = NULL
info_c = GDALVersionInfo("RELEASE_NAME")
info_b = info_c
return info_b.decode("utf-8")
Expand Down
2 changes: 1 addition & 1 deletion rasterio/_env.pyx
Expand Up @@ -433,6 +433,6 @@ def set_proj_data_search_path(path):
path_b = path.encode("utf-8")
path_c = path_b
paths = CSLAddString(paths, path_c)
OSRSetPROJSearchPaths(paths)
OSRSetPROJSearchPaths(<const char *const *>paths)
ELSE:
os.environ["PROJ_LIB"] = path

0 comments on commit 1c078d9

Please sign in to comment.