Reduce number of compile-time warnings (continued)

This commit is contained in:
Joseph Henry
2021-04-30 16:38:21 -07:00
parent 6763ced6f5
commit 3e304cb25a
8 changed files with 12 additions and 12 deletions

View File

@@ -57,7 +57,7 @@ int main(int argc, char** argv)
uint64_t node_id = zts_node_get_id(); uint64_t node_id = zts_node_get_id();
printf("My public identity (node ID) is %llx\n", node_id); printf("My public identity (node ID) is %llx\n", node_id);
char keypair[ZTS_ID_STR_BUF_LEN] = { 0 }; char keypair[ZTS_ID_STR_BUF_LEN] = { 0 };
uint16_t len = ZTS_ID_STR_BUF_LEN; unsigned int len = ZTS_ID_STR_BUF_LEN;
if (zts_node_get_id_pair(keypair, &len) != ZTS_ERR_OK) { if (zts_node_get_id_pair(keypair, &len) != ZTS_ERR_OK) {
printf("Error getting identity keypair. Exiting.\n"); printf("Error getting identity keypair. Exiting.\n");
} }

View File

@@ -69,7 +69,7 @@ int main(int argc, char** argv)
printf("My public identity (node ID) is %llx\n", zts_node_get_id()); printf("My public identity (node ID) is %llx\n", zts_node_get_id());
char keypair[ZTS_ID_STR_BUF_LEN] = { 0 }; char keypair[ZTS_ID_STR_BUF_LEN] = { 0 };
uint16_t len = ZTS_ID_STR_BUF_LEN; unsigned int len = ZTS_ID_STR_BUF_LEN;
if (zts_node_get_id_pair(keypair, &len) != ZTS_ERR_OK) { if (zts_node_get_id_pair(keypair, &len) != ZTS_ERR_OK) {
printf("Error getting identity keypair. Exiting.\n"); printf("Error getting identity keypair. Exiting.\n");
} }

View File

@@ -88,11 +88,11 @@ int main()
// Generate roots // Generate roots
zts_util_sign_root_set( zts_util_sign_root_set(
&roots_data_out, roots_data_out,
&roots_len, &roots_len,
&prev_key, prev_key,
&prev_key_len, &prev_key_len,
&curr_key, curr_key,
&curr_key_len, &curr_key_len,
id, id,
ts, ts,

View File

@@ -20,7 +20,7 @@ int main(int argc, char** argv)
char* storage_path = argv[1]; char* storage_path = argv[1];
long long int net_id = strtoull(argv[2], NULL, 16); // At least 64 bits long long int net_id = strtoull(argv[2], NULL, 16); // At least 64 bits
char* local_addr = argv[3]; char* local_addr = argv[3];
int local_port = atoi(argv[4]); unsigned short local_port = atoi(argv[4]);
int fd, accfd; int fd, accfd;
int err = ZTS_ERR_OK; int err = ZTS_ERR_OK;
@@ -96,7 +96,7 @@ int main(int argc, char** argv)
// zts_accept(int fd, struct zts_sockaddr* addr, zts_socklen_t* addrlen) // zts_accept(int fd, struct zts_sockaddr* addr, zts_socklen_t* addrlen)
char ipstr[ZTS_INET6_ADDRSTRLEN] = { 0 }; char ipstr[ZTS_INET6_ADDRSTRLEN] = { 0 };
int port = 0; unsigned int port = 0;
printf("Accepting on listening socket...\n"); printf("Accepting on listening socket...\n");
if ((accfd = zts_simple_accept(fd, ipstr, ZTS_INET6_ADDRSTRLEN, &port)) < 0) { if ((accfd = zts_simple_accept(fd, ipstr, ZTS_INET6_ADDRSTRLEN, &port)) < 0) {
printf("Error (fd=%d, ret=%d, zts_errno=%d). Exiting.\n", fd, err, zts_errno); printf("Error (fd=%d, ret=%d, zts_errno=%d). Exiting.\n", fd, err, zts_errno);

View File

@@ -33,12 +33,12 @@ void on_zts_event(void* msgPtr)
if (msg->event_code == ZTS_EVENT_STORE_IDENTITY_PUBLIC) { if (msg->event_code == ZTS_EVENT_STORE_IDENTITY_PUBLIC) {
printf("ZTS_EVENT_STORE_IDENTITY_PUBLIC (len=%d)\n", msg->len); printf("ZTS_EVENT_STORE_IDENTITY_PUBLIC (len=%d)\n", msg->len);
printf("identity.public = [ %.*s ]\n", len, msg->cache); printf("identity.public = [ %.*s ]\n", len, (char*)msg->cache);
memcpy(cache_data, msg->cache, len); memcpy(cache_data, msg->cache, len);
} }
if (msg->event_code == ZTS_EVENT_STORE_IDENTITY_SECRET) { if (msg->event_code == ZTS_EVENT_STORE_IDENTITY_SECRET) {
printf("ZTS_EVENT_STORE_IDENTITY_SECRET (len=%d)\n", msg->len); printf("ZTS_EVENT_STORE_IDENTITY_SECRET (len=%d)\n", msg->len);
printf("identity.secret = [ %.*s ]\n", len, msg->cache); printf("identity.secret = [ %.*s ]\n", len, (char*)msg->cache);
memcpy(cache_data, msg->cache, len); memcpy(cache_data, msg->cache, len);
// Same data can be retrieved via: zts_node_get_id_pair() // Same data can be retrieved via: zts_node_get_id_pair()
} }

View File

@@ -20,7 +20,7 @@ int main(int argc, char** argv)
char* storage_path = argv[1]; char* storage_path = argv[1];
long long int net_id = strtoull(argv[2], NULL, 16); // At least 64 bits long long int net_id = strtoull(argv[2], NULL, 16); // At least 64 bits
char* local_addr = argv[3]; char* local_addr = argv[3];
int local_port = atoi(argv[4]); unsigned int local_port = atoi(argv[4]);
int fd, accfd; int fd, accfd;
int err = ZTS_ERR_OK; int err = ZTS_ERR_OK;

View File

@@ -29,7 +29,7 @@ int main(int argc, char** argv)
printf("My public identity (node ID) is %llx\n", zts_node_get_id()); printf("My public identity (node ID) is %llx\n", zts_node_get_id());
char keypair[ZTS_ID_STR_BUF_LEN] = { 0 }; char keypair[ZTS_ID_STR_BUF_LEN] = { 0 };
uint16_t len = ZTS_ID_STR_BUF_LEN; unsigned int len = ZTS_ID_STR_BUF_LEN;
if (zts_node_get_id_pair(keypair, &len) != ZTS_ERR_OK) { if (zts_node_get_id_pair(keypair, &len) != ZTS_ERR_OK) {
printf("Error getting identity keypair. Exiting.\n"); printf("Error getting identity keypair. Exiting.\n");
} }

View File

@@ -261,7 +261,7 @@ void VirtualTap::threadMain() throw()
#if defined(__WINDOWS__) #if defined(__WINDOWS__)
Sleep(ZTS_TAP_THREAD_POLLING_INTERVAL); Sleep(ZTS_TAP_THREAD_POLLING_INTERVAL);
#else #else
struct timespec sleepValue = { 0 }; struct timespec sleepValue = { 0, 0 };
sleepValue.tv_nsec = ZTS_TAP_THREAD_POLLING_INTERVAL * 500000; sleepValue.tv_nsec = ZTS_TAP_THREAD_POLLING_INTERVAL * 500000;
nanosleep(&sleepValue, NULL); nanosleep(&sleepValue, NULL);
#endif #endif