Kaynağa Gözat

lib/proj: fix results for ll equivalents (#1444)

* use correctly initialized variable
* fix missing pj initialization in d.where
Markus Metz 4 yıl önce
ebeveyn
işleme
e0b3fc55c0
2 değiştirilmiş dosya ile 6 ekleme ve 4 silme
  1. 2 0
      display/d.where/main.c
  2. 4 4
      lib/proj/do_proj.c

+ 2 - 0
display/d.where/main.c

@@ -113,6 +113,8 @@ int main(int argc, char **argv)
 	if (pj_get_kv(&iproj, in_proj_info, in_unit_info) < 0)
 	if (pj_get_kv(&iproj, in_proj_info, in_unit_info) < 0)
 	    G_fatal_error(_("Can't get projection key values of current location"));
 	    G_fatal_error(_("Can't get projection key values of current location"));
 
 
+	oproj.pj = NULL;
+
 	if (wgs84->answer) {
 	if (wgs84->answer) {
 	    struct Key_Value *out_proj_info, *out_unit_info;
 	    struct Key_Value *out_proj_info, *out_unit_info;
 
 

+ 4 - 4
lib/proj/do_proj.c

@@ -960,7 +960,7 @@ int GPJ_transform(const struct pj_info *info_in,
 	    in_deg2rad = 0;
 	    in_deg2rad = 0;
 	}
 	}
 #endif
 #endif
-	if (info_out->proj[0]) {
+	if (info_out->pj) {
 	    METERS_out = info_out->meters;
 	    METERS_out = info_out->meters;
 	    out_is_ll = !strncmp(info_out->proj, "ll", 2);
 	    out_is_ll = !strncmp(info_out->proj, "ll", 2);
 #if PROJ_VERSION_MAJOR >= 6
 #if PROJ_VERSION_MAJOR >= 6
@@ -989,7 +989,7 @@ int GPJ_transform(const struct pj_info *info_in,
 	    out_rad2deg = 0;
 	    out_rad2deg = 0;
 	}
 	}
 #endif
 #endif
-	if (info_out->proj[0]) {
+	if (info_out->pj) {
 	    METERS_in = info_out->meters;
 	    METERS_in = info_out->meters;
 	    in_is_ll = !strncmp(info_out->proj, "ll", 2);
 	    in_is_ll = !strncmp(info_out->proj, "ll", 2);
 #if PROJ_VERSION_MAJOR >= 6
 #if PROJ_VERSION_MAJOR >= 6
@@ -1179,7 +1179,7 @@ int GPJ_transform_array(const struct pj_info *info_in,
 	    in_deg2rad = 0;
 	    in_deg2rad = 0;
 	}
 	}
 #endif
 #endif
-	if (info_out->proj[0]) {
+	if (info_out->pj) {
 	    METERS_out = info_out->meters;
 	    METERS_out = info_out->meters;
 	    out_is_ll = !strncmp(info_out->proj, "ll", 2);
 	    out_is_ll = !strncmp(info_out->proj, "ll", 2);
 #if PROJ_VERSION_MAJOR >= 6
 #if PROJ_VERSION_MAJOR >= 6
@@ -1208,7 +1208,7 @@ int GPJ_transform_array(const struct pj_info *info_in,
 	    out_rad2deg = 0;
 	    out_rad2deg = 0;
 	}
 	}
 #endif
 #endif
-	if (info_out->proj[0]) {
+	if (info_out->pj) {
 	    METERS_in = info_out->meters;
 	    METERS_in = info_out->meters;
 	    in_is_ll = !strncmp(info_out->proj, "ll", 2);
 	    in_is_ll = !strncmp(info_out->proj, "ll", 2);
 #if PROJ_VERSION_MAJOR >= 6
 #if PROJ_VERSION_MAJOR >= 6