diff --git a/devices/center_of_mass.c b/devices/center_of_mass.c index 1db063c..4a8561f 100644 --- a/devices/center_of_mass.c +++ b/devices/center_of_mass.c @@ -80,17 +80,17 @@ int center_of_mass_init(struct aylp_device *self) // keys starting with _ are comments } else if (!strcmp(key, "region_height")) { data->region_height = json_object_get_uint64(val); - log_trace("region_height = %llu", data->region_height); + log_trace("region_height = %zu", data->region_height); } else if (!strcmp(key, "region_width")) { data->region_width = json_object_get_uint64(val); - log_trace("region_width = %llu", data->region_width); + log_trace("region_width = %zu", data->region_width); } else if (!strcmp(key, "thread_count")) { data->thread_count = json_object_get_uint64(val); if (data->thread_count == 0) { log_error("Correcting 0 threads to 1 thread"); data->thread_count = 1; } - log_trace("thread_count = %llu", data->thread_count); + log_trace("thread_count = %zu", data->thread_count); } else { log_warn("Unknown parameter \"%s\"", key); } @@ -116,7 +116,7 @@ int center_of_mass_init(struct aylp_device *self) return -1; } } - log_info("Started %llu threads", data->thread_count); + log_info("Started %zu threads", data->thread_count); self->process = ¢er_of_mass_process_threaded; self->close = ¢er_of_mass_close_threaded; } else { @@ -144,7 +144,7 @@ int center_of_mass_process(struct aylp_device *self, struct aylp_state *state) size_t subap_count = y_subap_count * x_subap_count; if (UNLIKELY(!subap_count)) { log_error("Refusing to process zero subapertures; " - "region size is %llu by %llu but image is %llu by %llu", + "region size is %zu by %zu but image is %zu by %zu", data->region_height, data->region_width, max_y, max_x ); return -1; @@ -216,7 +216,7 @@ int center_of_mass_process_threaded( size_t n_tasks = y_subap_count * x_subap_count; if (!n_tasks) { log_error("Refusing to process zero subapertures; " - "region size is %llu by %llu but image is %llu by %llu", + "region size is %zu by %zu but image is %zu by %zu", data->region_height, data->region_width, max_y, max_x ); return -1; diff --git a/devices/delay.c b/devices/delay.c index dcdb28c..7561a91 100644 --- a/devices/delay.c +++ b/devices/delay.c @@ -22,10 +22,10 @@ int delay_init(struct aylp_device *self) // keys starting with _ are comments } else if (!strcmp(key, "s")) { ts->tv_sec = (time_t)json_object_get_uint64(val); - log_trace("s = %u", ts->tv_sec); + log_trace("s = %lu", ts->tv_sec); } else if (!strcmp(key, "ns")) { ts->tv_nsec = (long)json_object_get_int64(val); - log_trace("ns = %u", ts->tv_nsec); + log_trace("ns = %lu", ts->tv_nsec); } else { log_warn("Unknown parameter \"%s\"", key); } diff --git a/devices/file_sink.c b/devices/file_sink.c index 6b38f1c..2b4aa7b 100644 --- a/devices/file_sink.c +++ b/devices/file_sink.c @@ -62,7 +62,7 @@ int file_sink_process(struct aylp_device *self, struct aylp_state *state) n += fwrite(data->bytes.data, 1, data->bytes.size, data->fp); size_t n_expect = sizeof(struct aylp_header) + data->bytes.size; if (n < n_expect) { - log_error("Short write: %d of %d", n, n_expect); + log_error("Short write: %zu of %zu", n, n_expect); return -1; } if (needs_free) { diff --git a/devices/logger.c b/devices/logger.c index 1504997..9bbb39d 100644 --- a/devices/logger.c +++ b/devices/logger.c @@ -23,24 +23,24 @@ int logger_process(struct aylp_device *self, struct aylp_state *state) UNUSED(self); switch (state->header.type) { case AYLP_T_VECTOR: - log_info("Seeing vector of size %llu:", state->vector->size); + log_info("Seeing vector of size %zu:", state->vector->size); logn_info(""); pretty_vector(state->vector); break; case AYLP_T_MATRIX: - log_info("Seeing matrix of size %llux%llu:", + log_info("Seeing matrix of size %zux%zu:", state->matrix->size1, state->matrix->size2 ); pretty_matrix(state->matrix); break; case AYLP_T_MATRIX_UCHAR: - log_info("Seeing matrix of size %llux%llu:", + log_info("Seeing matrix of size %zux%zu:", state->matrix_uchar->size1, state->matrix_uchar->size2 ); pretty_matrix_uchar(state->matrix_uchar); break; default: - log_warn("Seeing type %hX but don't know how to print it", + log_warn("Seeing type %hhX but don't know how to print it", state->header.type ); if (!state->header.type) diff --git a/devices/pid.c b/devices/pid.c index 7698e7a..03f6996 100644 --- a/devices/pid.c +++ b/devices/pid.c @@ -35,7 +35,7 @@ int pid_init(struct aylp_device *self) else if (!strcmp(s, "matrix")) data->type = AYLP_T_MATRIX; else log_error("Unrecognized type: %s", s); - log_trace("type = %s (0x%X)", s, data->type); + log_trace("type = %s (0x%hhX)", s, data->type); } else if (!strcmp(key, "p")) { data->p = json_object_get_double(val); log_trace("p = %G", data->p); diff --git a/devices/test_source.c b/devices/test_source.c index 04e4e15..9a2911e 100644 --- a/devices/test_source.c +++ b/devices/test_source.c @@ -38,29 +38,29 @@ int test_source_init(struct aylp_device *self) else if (!strcmp(s, "matrix_uchar")) data->type = AYLP_T_MATRIX_UCHAR; else log_error("Unrecognized type: %s", s); - log_trace("type = %s (0x%X)", s, data->type); + log_trace("type = %s (0x%hhX)", s, data->type); } else if (!strcmp(key, "kind")) { const char *s = json_object_get_string(val); // TODO: add KIND_NOISE? if (!strcmp(s, "constant")) data->kind = KIND_CONSTANT; else if (!strcmp(s, "sine")) data->kind = KIND_SINE; else log_error("Unrecognized kind: %s", s); - log_trace("kind = %s (0x%X)", s, data->kind); + log_trace("kind = %s (0x%hhX)", s, data->kind); } else if (!strcmp(key, "size1")) { data->size1 = json_object_get_uint64(val); - log_trace("size1 = %llu", data->size1); + log_trace("size1 = %zu", data->size1); } else if (!strcmp(key, "size2")) { data->size2 = json_object_get_uint64(val); - log_trace("size2 = %llu", data->size2); + log_trace("size2 = %zu", data->size2); } else if (!strcmp(key, "frequency")) { data->frequency = json_object_get_double(val); - log_trace("frequency = %E", data->frequency); + log_trace("frequency = %G", data->frequency); } else if (!strcmp(key, "amplitude")) { data->amplitude = json_object_get_double(val); - log_trace("amplitude = %E", data->amplitude); + log_trace("amplitude = %G", data->amplitude); } else if (!strcmp(key, "offset")) { data->offset = json_object_get_double(val); - log_trace("offset = %E", data->offset); + log_trace("offset = %G", data->offset); } else { log_warn("Unknown parameter \"%s\"", key); } diff --git a/devices/udp_sink.c b/devices/udp_sink.c index b91517e..382401f 100644 --- a/devices/udp_sink.c +++ b/devices/udp_sink.c @@ -92,7 +92,7 @@ int udp_sink_process(struct aylp_device *self, struct aylp_state *state) data->iovecs[1].iov_len = data->bytes.size; // write all the data in one go size_t n = data->iovecs[0].iov_len + data->iovecs[1].iov_len; - log_trace("Writing %llu bytes to UDP", n); + log_trace("Writing %zu bytes to UDP", n); ssize_t err = writev(data->sock, data->iovecs, 2); if (err < 0) { // if n > SSIZE_MAX, this will fire, so we don't need to check @@ -102,7 +102,7 @@ int udp_sink_process(struct aylp_device *self, struct aylp_state *state) if (err == -1) { log_error("Couldn't send data: %s", strerror(errno)); } else { - log_error("Short write: %d of %d", err, n); + log_error("Short write: %zu of %zu", err, n); } } if (needs_free) { diff --git a/devices/vonkarman_stream.c b/devices/vonkarman_stream.c index 7405cbc..a91fec2 100644 --- a/devices/vonkarman_stream.c +++ b/devices/vonkarman_stream.c @@ -72,7 +72,7 @@ static int generate_phase_screen(struct aylp_device *self) // by the spectrum as we go. size_t M = data->phase_screen->size1; size_t N = data->phase_screen->size2; - log_trace("Allocated %u by %u matrix for phase screen", M, N); + log_trace("Allocated %zu by %zu matrix for phase screen", M, N); for (size_t x=0; xpitch); } else if (!strcmp(key, "screen_size")) { data->screen_size = json_object_get_uint64(val); - log_trace("screen_size = %u", data->screen_size); + log_trace("screen_size = %zu", data->screen_size); } else if (!strcmp(key, "win_height")) { data->win_height = json_object_get_uint64(val); - log_trace("win_height = %u", data->win_height); + log_trace("win_height = %zu", data->win_height); } else if (!strcmp(key, "win_width")) { data->win_width = json_object_get_uint64(val); - log_trace("win_width = %u", data->win_width); + log_trace("win_width = %zu", data->win_width); } else if (!strcmp(key, "start_y")) { data->cur_y = json_object_get_uint64(val); - log_trace("start_y = %u", data->cur_y); + log_trace("start_y = %zu", data->cur_y); } else if (!strcmp(key, "start_x")) { data->cur_x = json_object_get_uint64(val); - log_trace("start_x = %u", data->cur_x); + log_trace("start_x = %zu", data->cur_x); } else if (!strcmp(key, "step_y")) { data->cur_step_y = json_object_get_int(val); - log_trace("step_y = %u", data->cur_step_y); + log_trace("step_y = %d", data->cur_step_y); } else if (!strcmp(key, "step_x")) { data->cur_step_x = json_object_get_int(val); - log_trace("step_x = %u", data->cur_step_x); + log_trace("step_x = %d", data->cur_step_x); } else { log_warn("Unknown parameter \"%s\"", key); } @@ -306,7 +306,7 @@ int vonkarman_stream_process(struct aylp_device *self, struct aylp_state *state) } data->cur_y += data->cur_step_y; data->cur_x += data->cur_step_x; - log_trace("Window at y,x indices %lu,%lu", data->cur_y, data->cur_x); + log_trace("Window at y,x indices %zu,%zu", data->cur_y, data->cur_x); data->sub_view = gsl_matrix_submatrix( data->phase_screen, data->cur_y, data->cur_x, diff --git a/libaylp/block.c b/libaylp/block.c index 1526c2f..98d7ed7 100644 --- a/libaylp/block.c +++ b/libaylp/block.c @@ -22,14 +22,14 @@ int get_contiguous_bytes(gsl_block_uchar *bytes, struct aylp_state *state) case AYLP_T_BLOCK: { bytes->size = sizeof(double) * state->block->size; bytes->data = (unsigned char *)state->block->data; - log_trace("got block of %llu doubles", state->block->size); + log_trace("got block of %zu doubles", state->block->size); return 0; } case AYLP_T_VECTOR: { gsl_vector *v = state->vector; bytes->size = sizeof(double) * v->size; if (LIKELY(v->stride == 1)) { - log_trace("got contiguous vector of %llu doubles", + log_trace("got contiguous vector of %zu doubles", state->vector->size ); bytes->data = (unsigned char *)v->data; @@ -41,7 +41,7 @@ int get_contiguous_bytes(gsl_block_uchar *bytes, struct aylp_state *state) v->data[i * v->stride] ; } - log_trace("got non-contiguous vector of %llu doubles", + log_trace("got non-contiguous vector of %zu doubles", state->vector->size ); return 1; @@ -53,7 +53,7 @@ int get_contiguous_bytes(gsl_block_uchar *bytes, struct aylp_state *state) if (LIKELY(m->tda == m->size2)) { // rows are contiguous bytes->data = (unsigned char *)m->data; - log_trace("got contiguous matrix of %llu by %llu " + log_trace("got contiguous matrix of %zu by %zu " "doubles", state->matrix->size1, state->matrix->size2 ); @@ -61,7 +61,7 @@ int get_contiguous_bytes(gsl_block_uchar *bytes, struct aylp_state *state) } else { // rows are not contiguous bytes->data = xmalloc(bytes->size); - log_trace("got non-contiguous matrix of %llu by %llu " + log_trace("got non-contiguous matrix of %zu by %zu " "doubles", state->matrix->size1, state->matrix->size2 ); @@ -77,7 +77,7 @@ int get_contiguous_bytes(gsl_block_uchar *bytes, struct aylp_state *state) case AYLP_T_BLOCK_UCHAR: { bytes->size = state->block_uchar->size; bytes->data = state->block_uchar->data; - log_trace("got block of %llu uchars", bytes->size); + log_trace("got block of %zu uchars", bytes->size); return 0; } case AYLP_T_MATRIX_UCHAR: { @@ -86,14 +86,14 @@ int get_contiguous_bytes(gsl_block_uchar *bytes, struct aylp_state *state) if (LIKELY(m->tda == m->size2)) { // rows are contiguous bytes->data = m->data; - log_trace("got contiguous matrix of %llu uchars", + log_trace("got contiguous matrix of %zu uchars", bytes->size ); return 0; } else { // rows are not contiguous bytes->data = xmalloc(bytes->size); - log_trace("got non-contiguous matrix of %llu uchars", + log_trace("got non-contiguous matrix of %zu uchars", bytes->size ); for (size_t i = 0; i < m->size1; i++) { @@ -106,7 +106,7 @@ int get_contiguous_bytes(gsl_block_uchar *bytes, struct aylp_state *state) } } default: { - log_fatal("Bug: unsupported type 0x%hX", state->header.type); + log_fatal("Bug: unsupported type 0x%hhX", state->header.type); exit(EXIT_FAILURE); return -1; }