Skip to content
Snippets Groups Projects
Commit 28cc873f authored by Thomas Jahns's avatar Thomas Jahns :cartwheel:
Browse files

Fix implicit conversions in test and example programs.

parent 00e22346
No related branches found
No related tags found
No related merge requests found
......@@ -82,20 +82,20 @@ static void modelRun(MPI_Comm commModel)
varID[i] = vlistDefVar ( vlistID, gridID, zaxisID[i], TIME_VARIABLE );
#ifdef USE_MPI
{
int start = uniform_partition_start((int [2]){ 0, varSize[i] - 1 },
int start = uniform_partition_start((int [2]){ 0, (int)varSize[i] - 1 },
comm_size, rank),
chunkSize = uniform_partition_start((int [2]){ 0, varSize[i] - 1 },
comm_size, rank + 1) - start;
fprintf(stderr, "%d: start=%d, chunkSize = %d\n", rank,
start, chunkSize);
Xt_idxlist idxlist
= xt_idxstripes_new(&(struct Xt_stripe){ .start = start,
.nstrides = chunkSize, .stride = 1 }, 1);
varDeco[i] = (struct var1DDeco){
.start = start,
.chunkSize = chunkSize,
.partDesc = idxlist
};
chunkSize = uniform_partition_start((int [2]){ 0, (int)varSize[i] - 1 },
comm_size, rank + 1) - start;
fprintf(stderr, "%d: start=%d, chunkSize = %d\n", rank,
start, chunkSize);
Xt_idxlist idxlist
= xt_idxstripes_new(&(struct Xt_stripe){ .start = start,
.nstrides = chunkSize, .stride = 1 }, 1);
varDeco[i] = (struct var1DDeco){
.start = start,
.chunkSize = chunkSize,
.partDesc = idxlist
};
}
#endif
}
......@@ -197,14 +197,15 @@ int main (int argc, char *argv[])
switch (opt) {
case 'p':
{
int i, found=0;
for (i = 0;
int found=0;
for (size_t i = 0;
i < sizeof (mode_map) / sizeof (mode_map[0]);
++i)
if (!strcmp(optarg, mode_map[i].text))
{
found = 1;
IOMode = mode_map[i].mode;
break;
}
if (!found)
{
......@@ -215,7 +216,13 @@ int main (int argc, char *argv[])
break;
case 'w':
{
nProcsIO = strtol(optarg, NULL, 0);
long temp = strtol(optarg, NULL, 0);
if (temp < 0 || temp > INT_MAX/2)
{
fprintf(stderr, "Unsupported number of I/O servers: %ld\n", temp);
exit(EXIT_FAILURE);
}
nProcsIO = (int)temp;
break;
}
}
......@@ -244,8 +251,8 @@ static int
uniform_partition_start(int set_interval[2], int nparts, int part_idx)
{
int part_offset
= (((long long)set_interval[1] - (long long)set_interval[0] + 1LL)
* (long long)part_idx) / (long long)nparts;
= (int)((((long long)set_interval[1] - (long long)set_interval[0] + 1LL)
* (long long)part_idx) / (long long)nparts);
int start = set_interval[0] + part_offset;
return start;
}
......
......@@ -108,9 +108,9 @@ static void modelRun(MPI_Comm commModel)
varSize[i][j] = nlon * nlat * (size_t)nlev[i][j];
#ifdef USE_MPI
{
int start = uniform_partition_start((int [2]){ 0, varSize[i][j] - 1 },
int start = uniform_partition_start((int [2]){ 0, (int)varSize[i][j] - 1 },
comm_size, rank),
chunkSize = uniform_partition_start((int [2]){ 0, varSize[i][j] - 1 },
chunkSize = uniform_partition_start((int [2]){ 0, (int)varSize[i][j] - 1 },
comm_size, rank + 1) - start;
if (maxChunkSize < chunkSize)
maxChunkSize = chunkSize;
......@@ -289,8 +289,8 @@ static int
uniform_partition_start(int set_interval[2], int nparts, int part_idx)
{
int part_offset
= (((long long)set_interval[1] - (long long)set_interval[0] + 1LL)
* (long long)part_idx) / (long long)nparts;
= (int)((((long long)set_interval[1] - (long long)set_interval[0] + 1LL)
* (long long)part_idx) / (long long)nparts);
int start = set_interval[0] + part_offset;
return start;
}
......
......@@ -206,7 +206,7 @@ static void modelRun ( MPI_Comm comm )
reshPackBufferCreate(&sendBuffer, &bufferSize, &comm);
xmpi ( MPI_Send ( sendBuffer, bufferSize, MPI_PACKED, 0, 0, comm ));
recvBuffer = xmalloc ( bufferSize * sizeof ( char ));
recvBuffer = xmalloc((size_t)bufferSize);
xmpi ( MPI_Recv ( recvBuffer, bufferSize, MPI_PACKED, 0,
0, comm, &status ));
......
......@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
size_t num_ref_entries;
struct cksum_table *ref_var_table
= read_table(table_fname, &num_ref_entries);
if (num_ref_entries == -1)
if (num_ref_entries == (size_t)-1)
exit(EXIT_FAILURE);
retcode
= compare_checksums(file_vars, nvars, "file",
......
......@@ -148,7 +148,7 @@ main(int argc, char *argv[])
case 'f':
{
int found = 0;
for (i = 0;
for (size_t i = 0;
i < sizeof (suffix2type) / sizeof (suffix2type[0]);
++i)
if (!strcmp(optarg, suffix2type[i].suffix))
......
......@@ -9,7 +9,7 @@
#include "cdi.h"
#include "dmemory.h"
int main(int argc, char *argv[])
int main()
{
char fname[] = "test.grb";
int filetype = FILETYPE_GRB;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment