Skip to content

Commit

Permalink
Apply const qualifiers in Mapscript for strings (#6908)
Browse files Browse the repository at this point in the history
  • Loading branch information
geographika committed Jun 22, 2023
1 parent ac60539 commit ceba662
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions mapscript/swiginc/label.i
Expand Up @@ -85,7 +85,7 @@
}

/// Get the attribute binding for a specified label property. Returns NULL if there is no binding for this property.
char *getBinding(int binding)
const char *getBinding(int binding)
{
if(binding < 0 || binding >= MS_LABEL_BINDING_LENGTH) return NULL;

Expand All @@ -94,7 +94,7 @@

/// Set the attribute binding for a specified label property. Binding constants look like this: ``MS_LABEL_BINDING_[attribute name]``:
/// >>> new_label.setBinding(MS_LABEL_BINDING_COLOR, "FIELD_NAME_COLOR")
int setBinding(int binding, char *item)
int setBinding(int binding, const char *item)
{
if(!item) return MS_FAILURE;
if(binding < 0 || binding >= MS_LABEL_BINDING_LENGTH) return MS_FAILURE;
Expand Down
12 changes: 6 additions & 6 deletions mapscript/swiginc/map.i
Expand Up @@ -31,7 +31,7 @@
{

/// Create a new instance of :class:`mapObj`. Note that the *filename* is optional.
mapObj(char *filename="", configObj *config=NULL)
mapObj(const char *filename="", configObj *config=NULL)
{
if (filename && strlen(filename))
return msLoadMap(filename, NULL, config);
Expand All @@ -42,7 +42,7 @@

#ifdef SWIGCSHARP

mapObj(char *filename)
mapObj(const char *filename)
{
if (filename && strlen(filename))
return msLoadMap(filename, NULL, NULL);
Expand Down Expand Up @@ -249,7 +249,7 @@
:func:`mapObj.setImageType` remains in the module but its use
is deprecated in favor of :func:`mapObj.selectOutputFormat`.
*/
void setImageType( char * imagetype ) {
void setImageType( const char * imagetype ) {
outputFormatObj *format;

format = msSelectOutputFormat( self, imagetype );
Expand All @@ -268,7 +268,7 @@
Set the map's active output format to the internal format named imagetype.
Built-in formats are "PNG", "PNG24", "JPEG", "GIF", "GTIFF".
*/
void selectOutputFormat( char *imagetype )
void selectOutputFormat( const char *imagetype )
{
outputFormatObj *format;

Expand Down Expand Up @@ -656,7 +656,7 @@
case insensitive and allows an output format to be found either by driver
(like 'AGG/PNG') or name (like 'png').
*/
outputFormatObj *getOutputFormatByName(char *name) {
outputFormatObj *getOutputFormatByName(const char *name) {
return msSelectOutputFormat(self, name);
}

Expand All @@ -668,7 +668,7 @@

/// Removes the format named name from the map's output format list.
/// Returns :data:`MS_SUCCESS` or :data:`MS_FAILURE`
int removeOutputFormat(char *name) {
int removeOutputFormat(const char *name) {
return msRemoveOutputFormat(self, name);
}

Expand Down
4 changes: 2 additions & 2 deletions mapscript/swiginc/style.i
Expand Up @@ -158,7 +158,7 @@
}

/// Remove the attribute binding for a specified style property.
int setBinding(int binding, char *item)
int setBinding(int binding, const char *item)
{
if(!item) return MS_FAILURE;
if(binding < 0 || binding >= MS_STYLE_BINDING_LENGTH) return MS_FAILURE;
Expand All @@ -178,7 +178,7 @@

/// Get the attribute binding for a specified style property.
/// Returns NULL if there is no binding for this property.
char *getBinding(int binding)
const char *getBinding(int binding)
{
if(binding < 0 || binding >= MS_STYLE_BINDING_LENGTH) return NULL;

Expand Down

0 comments on commit ceba662

Please sign in to comment.