Skip to content

Commit

Permalink
Initialize variables reported in the Lint Checker report (#8578)
Browse files Browse the repository at this point in the history
  • Loading branch information
joa-quim authored Sep 5, 2024
1 parent 1b852f1 commit db2ee65
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/gmt_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1372,21 +1372,21 @@ GMT_LOCAL int gmtio_h_read (struct GMT_CTRL *GMT, FILE *fp, uint64_t n, double *
}

/*! . */
GMT_LOCAL int gmtio_h_read_swab (struct GMT_CTRL *GMT, FILE *fp, uint64_t n, double *d) {
GMT_LOCAL int gmtio_h_read_swab(struct GMT_CTRL *GMT, FILE *fp, uint64_t n, double *d) {
/* read byteswapped int16_t */
uint64_t i;
uint16_t u;
uint16_t u = 0;
size_t k;
int16_t *s = (int16_t *)&u;
for (i = 0; i < n; ++i) {
if ((k = gmt_M_fread (&u, sizeof (uint16_t), 1U, fp)) != 1) {
if ((k = gmt_M_fread (&u, sizeof(uint16_t), 1U, fp)) != 1) {
GMT->current.io.status = GMT_IO_EOF;
return (GMT_DATA_READ_ERROR);
return GMT_DATA_READ_ERROR;
}
u = bswap16 (u);
d[i] = (double) *s;
d[i] = (double)*s;
}
return (GMT_OK);
return GMT_OK;
}

/*! . */
Expand Down Expand Up @@ -3446,7 +3446,7 @@ GMT_LOCAL void gmtio_check_abstime_format_is_suitable (struct GMT_CTRL *GMT, cha
char copy[GMT_LEN32] = {""}, s1[GMT_LEN16] = {""}, *c = NULL;
int n, d0, d1, d2;
unsigned int k, n_delim_template[3] = {0, 0, 0}, n_delim_token[3] = {0, 0, 0};
unsigned int token_delim, template_delim, delim;
unsigned int token_delim = 0, template_delim, delim;

if (strncmp (GMT->current.setting.format_date_in, "yyyy-mm-dd", 10U)) return; /* No longer set to default so we trust user */

Expand Down Expand Up @@ -3502,7 +3502,7 @@ GMT_LOCAL unsigned int gmtio_examine_current_record (struct GMT_CTRL *GMT, char
unsigned int ret_val = GMT_READ_DATA, pos = 0, col = 0, k, *type = NULL;
unsigned int n_numeric_cols = (GMT->parent->n_numerical_columns == GMT_NOTSET) ? UINT_MAX : GMT->parent->n_numerical_columns;
int got;
enum gmt_col_enum phys_col_type;
enum gmt_col_enum phys_col_type = GMT_IS_UNKNOWN;
bool found_text = false;
char token[GMT_BUFSIZ], message[GMT_BUFSIZ] = {""};
double value;
Expand Down
4 changes: 2 additions & 2 deletions src/gmt_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -3398,8 +3398,8 @@ void gmt_translate_point (struct GMT_CTRL *GMT, double A[3], double B[3], double
GMT_LOCAL void gmtmap_translate_point_geodesic (struct GMT_CTRL *GMT, double lon1, double lat1, double azimuth, double distance_m, double *lon2, double *lat2, double *back_azimuth) {
/* Use Vincenty (1975) solution to the direct geodesic problem. Unstable for near antipodal points */
double a = GMT->current.proj.EQ_RAD, f = GMT->current.setting.ref_ellipsoid[GMT->current.setting.proj_ellipsoid].flattening, f1 = 1.0 - f;
double b = a * f1, s = distance_m, alpha1 = azimuth * D2R, s_alpha1, c_alpha1, tan_U1, c_U1, s_U1, sigma1, s_alpha, cosSqAlpha, cos2SigmaM, tmp;
double uSq, A, B, sigma, sigmaP, deltaSigma, sinSigma, cosSigma, lambda, C, L;
double b = a * f1, s = distance_m, alpha1 = azimuth * D2R, s_alpha1, c_alpha1, tan_U1, c_U1, s_U1, sigma1, s_alpha, cosSqAlpha, cos2SigmaM = 0.0, tmp;
double uSq, A, B, sigma, sigmaP, deltaSigma, sinSigma = 0.0, cosSigma = 0.0, lambda, C, L;

sincos (alpha1, &s_alpha1, &c_alpha1);
tan_U1 = f1 * tand (lat1);
Expand Down

0 comments on commit db2ee65

Please sign in to comment.