Skip to content

Commit

Permalink
Silence compiler warnings in examples.
Browse files Browse the repository at this point in the history
Signed-off-by: Samuel K. Gutierrez <samuel@lanl.gov>
(cherry picked from commit 83ddaf9)
  • Loading branch information
samuelkgutierrez authored and rhc54 committed Feb 9, 2023
1 parent dc2bfed commit 8f1a613
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
10 changes: 8 additions & 2 deletions examples/dmodex.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
* Copyright (c) 2019-2022 IBM Corporation. All rights reserved.
* Copyright (c) 2021-2022 Nanook Consulting All rights reserved.
* Copyright (c) 2023 Triad National Security, LLC. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand All @@ -38,7 +39,7 @@ static pmix_proc_t myproc;

int main(int argc, char **argv)
{
int rc;
int rc, np;
pmix_value_t value;
pmix_value_t *val = NULL;
char tmp[1024];
Expand Down Expand Up @@ -144,7 +145,12 @@ int main(int argc, char **argv)
}
PMIX_ARGV_FREE(peers);

snprintf(proc.nspace, PMIX_MAX_NSLEN, "%s", myproc.nspace);
np = snprintf(proc.nspace, PMIX_MAX_NSLEN, "%s", myproc.nspace);
if (np >= PMIX_MAX_NSLEN) {
fprintf(stderr, "Client ns %s rank %d: snprintf failed\n", myproc.nspace, myproc.rank);
exit(0);
}

PMIX_INFO_LOAD(&timeout, PMIX_TIMEOUT, &tlimit, PMIX_INT);
/* get the committed data - ask for someone who doesn't exist as well */
for (n = 0; n < nprocs; n++) {
Expand Down
7 changes: 4 additions & 3 deletions examples/nodeid.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* Copyright (c) 2023 Triad National Security, LLC. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -77,18 +78,18 @@ int main(int argc, char **argv)
proc.rank = n;
rc = PMIx_Get(&proc, PMIX_NODEID, NULL, 0, &val);
if (PMIX_SUCCESS != rc) {
fprintf(stderr, "[%s:%u] PMIx_Get failed for nodeid on rank %u: %s\n",
fprintf(stderr, "[%s:%u] PMIx_Get failed for nodeid on rank %zd: %s\n",
myproc.nspace, myproc.rank, n, PMIx_Error_string(rc));
break;
}
PMIX_VALUE_GET_NUMBER(rc, val, nodeid, uint32_t);
if (PMIX_SUCCESS != rc) {
fprintf(stderr, "[%s:%u] Got bad nodeid for rank %u: %s\n",
fprintf(stderr, "[%s:%u] Got bad nodeid for rank %zd: %s\n",
myproc.nspace, myproc.rank, n, PMIx_Error_string(rc));
goto done;
}
if (0 == myproc.rank) {
fprintf(stderr, "[%s:%u] Peer %u is running on node %u\n",
fprintf(stderr, "[%s:%u] Peer %zd is running on node %u\n",
myproc.nspace, myproc.rank, n, nodeid);
}
PMIX_VALUE_RELEASE(val);
Expand Down
3 changes: 2 additions & 1 deletion examples/pset.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* Copyright (c) 2023 Triad National Security, LLC. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -76,7 +77,7 @@ int main(int argc, char **argv)
myproc.nspace, myproc.rank, PMIx_Data_type_string(val->type));
goto done;
}
fprintf(stderr, "Client %s:%d PMIx_Get returned %d members\n", myproc.nspace, myproc.rank,
fprintf(stderr, "Client %s:%d PMIx_Get returned %zd members\n", myproc.nspace, myproc.rank,
val->data.darray->size);
pptr = (pmix_proc_t*)val->data.darray->array;
for (n=0; n < val->data.darray->size; n++) {
Expand Down

0 comments on commit 8f1a613

Please sign in to comment.