Skip to content

Commit

Permalink
warning: implicit conversion loses integer precision
Browse files Browse the repository at this point in the history
  • Loading branch information
wkliao committed Dec 4, 2024
1 parent 845909c commit f0ecd92
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion utils/dat2decomp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ int add_decomp(int ncid,
else if (ndims == 3)
printf("label D%d: dims = %lld x %lld x %lld (in C order)\n", label, dims[2], dims[1], dims[0]);
}
dimX = dims[0]; /* the least significant dimension */
dimX = (int)dims[0]; /* the least significant dimension */

/* gsize is total number of elements in the global array */
gsize = dims[0];
Expand Down
2 changes: 1 addition & 1 deletion utils/dat2nc.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ int add_decomp(int ncid, const char *infname, int label) {
else if (ndims == 3)
printf("label D%d: dims = %lld x %lld x %lld (in C order)\n", label, dims[2], dims[1], dims[0]);
}
dimX = dims[0]; /* the least significant dimension */
dimX = (int)dims[0]; /* the least significant dimension */

/* gsize is total number of elements in the global array */
gsize = dims[0];
Expand Down
8 changes: 4 additions & 4 deletions utils/pnetcdf_blob_replay.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ int set_decomp(int ncid,
/* number of dimensions, dimension IDs, and dimension sizes */
err = ncmpi_inq_attlen(ncid, varid, "global_dimids", &tmp);
CHECK_VAR_ERR(ncid, varid)
dp->ndims = tmp;
dp->ndims = (int)tmp;
int dimids[3]; /* number of fix-sized dimensions is <= 3 */
err = ncmpi_get_att(ncid, varid, "global_dimids", dimids);
CHECK_VAR_ERR(ncid, varid)
Expand Down Expand Up @@ -349,7 +349,7 @@ int copy_dims(int in_ncid,
err = ncmpi_inq_dim(in_ncid, i, name, dims+i);
CHECK_NC_ERR

int name_len = strlen(name);
size_t name_len = strlen(name);
if (strcmp(name, "nblobs") == 0 ||
(name[0] == 'D' && strcmp(name+name_len-7, ".nelems") == 0) ||
(name[0] == 'D' && strcmp(name+name_len-10, ".max_nreqs") == 0))
Expand Down Expand Up @@ -453,7 +453,7 @@ int set_vars(int in_ncid,

#ifndef NUM_DECOMP_AUX_VARS
/* skip copying decomposition variables */
int name_len = strlen(name);
size_t name_len = strlen(name);
if ((name[0] == 'D' && name_len > 6 && strcmp(name+name_len-6, ".nreqs" ) == 0) ||
(name[0] == 'D' && name_len > 11 && strcmp(name+name_len-11,".blob_start") == 0) ||
(name[0] == 'D' && name_len > 11 && strcmp(name+name_len-11,".blob_count") == 0) ||
Expand Down Expand Up @@ -491,7 +491,7 @@ int set_vars(int in_ncid,
}
else if (err == NC_NOERR) {
/* define variable using the global dimensions */
var[i].ndims = tmp;
var[i].ndims = (int)tmp;
err = ncmpi_get_att_int(in_ncid, i, "global_dimids", dimids);
CHECK_VAR_ERR(in_ncid, i)
err = ncmpi_def_var(out_ncid, name, xtype, var[i].ndims, dimids,
Expand Down

0 comments on commit f0ecd92

Please sign in to comment.