Переглянути джерело

Add "const" to function parameters where appropriate

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@53676 15284696-431f-4ddb-bdfa-cd5b030d7da7
Glynn Clements 12 роки тому
батько
коміт
970eb3790a
6 змінених файлів з 19 додано та 19 видалено
  1. 8 8
      include/defs/gprojects.h
  2. 4 4
      lib/proj/convert.c
  3. 1 1
      lib/proj/datum.c
  4. 2 2
      lib/proj/do_proj.c
  5. 1 1
      lib/proj/ellipse.c
  6. 3 3
      lib/proj/get_proj.c

+ 8 - 8
include/defs/gprojects.h

@@ -2,21 +2,21 @@
 #define GRASS_GPROJECTSDEFS_H
 
 /* do_proj.c */
-int pj_do_proj(double *, double *, struct pj_info *, struct pj_info *);
+int pj_do_proj(double *, double *, const struct pj_info *, const struct pj_info *);
 int pj_do_transform(int, double *, double *, double *,
-		    struct pj_info *, struct pj_info *);
+		    const struct pj_info *, const struct pj_info *);
 
 /* get_proj.c */
-int pj_get_kv(struct pj_info *, struct Key_Value *, struct Key_Value *);
+int pj_get_kv(struct pj_info *, const struct Key_Value *, const struct Key_Value *);
 int pj_get_string(struct pj_info *, char *);
 int GPJ_get_equivalent_latlong(struct pj_info *, struct pj_info *);
 const char *set_proj_lib(const char *);
-int pj_print_proj_params(struct pj_info *, struct pj_info *);
+int pj_print_proj_params(const struct pj_info *, const struct pj_info *);
 
 /* convert.c */
-char *GPJ_grass_to_wkt(struct Key_Value *, struct Key_Value *, int, int);
+char *GPJ_grass_to_wkt(const struct Key_Value *, const struct Key_Value *, int, int);
 #ifdef HAVE_OGR
-OGRSpatialReferenceH GPJ_grass_to_osr(struct Key_Value *, struct Key_Value *);
+OGRSpatialReferenceH GPJ_grass_to_osr(const struct Key_Value *, const struct Key_Value *);
 const char *GPJ_set_csv_loc(const char *);
 int GPJ_osr_to_grass(struct Cell_head *, struct Key_Value **,
 		     struct Key_Value **, OGRSpatialReferenceH, int);
@@ -28,7 +28,7 @@ int GPJ_wkt_to_grass(struct Cell_head *, struct Key_Value **,
 int GPJ_get_datum_by_name(const char *, struct gpj_datum *);
 int GPJ_get_default_datum_params_by_name(const char *, char **);
 int GPJ_get_datum_params(char **, char **);
-int GPJ__get_datum_params(struct Key_Value *, char **, char **);
+int GPJ__get_datum_params(const struct Key_Value *, char **, char **);
 void GPJ_free_datum(struct gpj_datum *);
 struct gpj_datum_transform_list *GPJ_get_datum_transform_by_name(const char *);
 void GPJ_free_datum_transform(struct gpj_datum_transform_list *);
@@ -36,7 +36,7 @@ void GPJ_free_datum_transform(struct gpj_datum_transform_list *);
 /* ellipse.c */
 int GPJ_get_ellipsoid_by_name(const char *, struct gpj_ellps *);
 int GPJ_get_ellipsoid_params(double *, double *, double *);
-int GPJ__get_ellipsoid_params(struct Key_Value *,
+int GPJ__get_ellipsoid_params(const struct Key_Value *,
 			      double *, double *, double *);
 void GPJ_free_ellps(struct gpj_ellps *);
 

+ 4 - 4
lib/proj/convert.c

@@ -52,8 +52,8 @@ static void DatumNameMassage(char **);
  *         WKT format
  * \return NULL on error
  */
-char *GPJ_grass_to_wkt(struct Key_Value *proj_info,
-		       struct Key_Value *proj_units,
+char *GPJ_grass_to_wkt(const struct Key_Value *proj_info,
+		       const struct Key_Value *proj_units,
 		       int esri_style, int prettify)
 {
 #ifdef HAVE_OGR
@@ -94,8 +94,8 @@ char *GPJ_grass_to_wkt(struct Key_Value *proj_info,
  * \return OGRSpatialReferenceH object representing the co-ordinate system
  *         defined by proj_info and proj_units or NULL if it fails
  */
-OGRSpatialReferenceH GPJ_grass_to_osr(struct Key_Value * proj_info,
-				      struct Key_Value * proj_units)
+OGRSpatialReferenceH GPJ_grass_to_osr(const struct Key_Value * proj_info,
+				      const struct Key_Value * proj_units)
 {
     struct pj_info pjinfo;
     char *proj4, *proj4mod, *wkt, *modwkt, *startmod, *lastpart;

+ 1 - 1
lib/proj/datum.c

@@ -170,7 +170,7 @@ int GPJ_get_datum_params(char **name, char **params)
  * 
  **/
 
-int GPJ__get_datum_params(struct Key_Value *projinfo,
+int GPJ__get_datum_params(const struct Key_Value *projinfo,
 			  char **datumname, char **params)
 {
     int returnval = -1;

+ 2 - 2
lib/proj/do_proj.c

@@ -61,7 +61,7 @@ static double METERS_in = 1.0, METERS_out = 1.0;
  **/
 
 int pj_do_proj(double *x, double *y,
-	       struct pj_info *info_in, struct pj_info *info_out)
+	       const struct pj_info *info_in, const struct pj_info *info_out)
 {
     int ok;
     double u, v;
@@ -132,7 +132,7 @@ int pj_do_proj(double *x, double *y,
  **/
 
 int pj_do_transform(int count, double *x, double *y, double *h,
-		    struct pj_info *info_in, struct pj_info *info_out)
+		    const struct pj_info *info_in, const struct pj_info *info_out)
 {
     int ok;
     int has_h = 1;

+ 1 - 1
lib/proj/ellipse.c

@@ -49,7 +49,7 @@ int GPJ_get_ellipsoid_params(double *a, double *e2, double *rf)
 }
 
 int
-GPJ__get_ellipsoid_params(struct Key_Value *proj_keys,
+GPJ__get_ellipsoid_params(const struct Key_Value *proj_keys,
 			  double *a, double *e2, double *rf)
 {
     struct gpj_ellps estruct;

+ 3 - 3
lib/proj/get_proj.c

@@ -56,8 +56,8 @@ static int nopt1;
  *          1 otherwise
  **/
 
-int pj_get_kv(struct pj_info *info, struct Key_Value *in_proj_keys,
-	      struct Key_Value *in_units_keys)
+int pj_get_kv(struct pj_info *info, const struct Key_Value *in_proj_keys,
+	      const struct Key_Value *in_units_keys)
 {
     const char *str;
     int i;
@@ -391,7 +391,7 @@ const char *set_proj_lib(const char *name)
  *         returned NULL for either co-ordinate system)
  **/
 
-int pj_print_proj_params(struct pj_info *iproj, struct pj_info *oproj)
+int pj_print_proj_params(const struct pj_info *iproj, const struct pj_info *oproj)
 {
     char *str;