Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v.kriging: fix compilation warnings #934

Open
wants to merge 3 commits into
base: grass8
Choose a base branch
from

Conversation

tmszi
Copy link
Member

@tmszi tmszi commented Jul 26, 2023

Fix compilation warnings:

utils_kriging.c: In function ‘crossvalidation’:
utils_kriging.c:716:32: warning: passing argument 3 of ‘submatrix’ from incompatible pointer type [-Wincompatible-pointer-types]
  716 |                                &xD->report);   // create submatrix using indices
      |                                ^~~~~~~~~~~
      |                                |
      |                                struct write **
utils_kriging.c:415:37: note: expected ‘struct write *’ but argument is of type ‘struct write **’
  415 |                       struct write *report)
      |                       ~~~~~~~~~~~~~~^~~~~~
utils_kriging.c: In function ‘compare_NN’:
utils_kriging.c:837:26: warning: initialization of ‘double *’ from incompatible pointer type ‘int *’ [-Wincompatible-pointer-types]
  837 |     double *list_value = list->value;
      |                          ^~~~
utils_kriging.c:838:30: warning: initialization of ‘double *’ from incompatible pointer type ‘int *’ [-Wincompatible-pointer-types]
  838 |     double *list_new_value = list_new->value;
      |                              ^~~~~~~~
utils_kriging.c: In function ‘make_subsamples’:
utils_kriging.c:862:28: warning: initialization of ‘struct write *’ from incompatible pointer type ‘struct write **’ [-Wincompatible-pointer-types]
  862 |     struct write *report = &xD->report;
      |                            ^
utils_raster.c: In function ‘open_layer’:
utils_raster.c:6:28: warning: initialization of ‘struct write *’ from incompatible pointer type ‘struct write **’ [-Wincompatible-pointer-types]
    6 |     struct write *report = &xD->report;
      |                            ^
utils_raster.c: In function ‘write2layer’:
utils_raster.c:37:28: warning: initialization of ‘struct write *’ from incompatible pointer type ‘struct write **’ [-Wincompatible-pointer-types]
   37 |     struct write *report = &xD->report;

line 100 print warning too:

utils_kriging.c: In function ‘LMS_variogram’:
utils_kriging.c:100:73: warning: format ‘%f’ expects a matching ‘double’ argument [-Wformat=]
  100 |             fprintf(report->fp, "gamma(h, vert) = %f * h + %f * vert + %f\n",
      |                                                                        ~^
      |                                                                         |
      |                                                                         double

line 94 and 100 look the same (fprintf() func has same string arg):

if (report->name) {
if (var_par->function == 5) {
fprintf(report->fp, "Parameters of bivariate variogram:\n");
fprintf(report->fp, "gamma(h, vert) = %f * h + %f * vert + %f\n",
var_par->T->vals[0], var_par->T->vals[1],
var_par->T->vals[2]);
}
else {
fprintf(report->fp, "Parameters of univariate variogram:\n");
fprintf(report->fp, "gamma(h, vert) = %f * h + %f * vert + %f\n",
var_par->T->vals[0], var_par->T->vals[1]);
}
} // end if: report

Is there a difference between the number of bivariate and univariate variogram parameters?

- passing argument 3 of ‘submatrix’ from incompatible pointer type
- expected ‘struct write *’ but argument is of type ‘struct write **
- initialization of ‘double *’ from incompatible pointer type ‘int *
- initialization of ‘struct write *’ from incompatible pointer type ‘struct write **
@tmszi tmszi added bug Something isn't working help wanted Extra attention is needed C Related code is in C backport_needed PR needs to be backported to grass7 addon branch labels Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport_needed PR needs to be backported to grass7 addon branch bug Something isn't working C Related code is in C help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants