Skip to content

Commit

Permalink
Format with clang-format-12
Browse files Browse the repository at this point in the history
  • Loading branch information
judfs committed Aug 5, 2023
1 parent 5338826 commit 48bbec1
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 12 deletions.
6 changes: 3 additions & 3 deletions lcm-logger/glib_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ int signal_pipe_attach_glib(signal_pipe_glib_handler_t func, gpointer user_data)
return -1;

g_sp.ioc = g_io_channel_unix_new(g_sp.fds[0]);
g_io_channel_set_flags(g_sp.ioc,
(GIOFlags)(g_io_channel_get_flags(g_sp.ioc) | G_IO_FLAG_NONBLOCK), NULL);
g_sp.ios = g_io_add_watch(g_sp.ioc, (GIOCondition)(G_IO_IN | G_IO_PRI),
g_io_channel_set_flags(
g_sp.ioc, (GIOFlags) (g_io_channel_get_flags(g_sp.ioc) | G_IO_FLAG_NONBLOCK), NULL);
g_sp.ios = g_io_add_watch(g_sp.ioc, (GIOCondition) (G_IO_IN | G_IO_PRI),
(GIOFunc) signal_handler_glib, NULL);

g_sp.userfunc = func;
Expand Down
3 changes: 2 additions & 1 deletion lcm-logger/lcm_logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ int main(int argc, char *argv[])

// Arg Parsing:
// https://www.gnu.org/software/libc/manual/html_node/Getopt.html
// https://linux.die.net/man/3/getopt
char *optstring = "ac:fhil:m:qsu:v";

// Keep sorted based on the 4th (`val`) arg which needs to be a unique character (int) per
Expand Down Expand Up @@ -537,7 +538,7 @@ int main(int argc, char *argv[])
}

logger.time0 = g_get_real_time();
logger.max_write_queue_size = (int64_t)(max_write_queue_size_mb * (1 << 20));
logger.max_write_queue_size = (int64_t) (max_write_queue_size_mb * (1 << 20));

if (0 != open_logfile(&logger))
return 1;
Expand Down
2 changes: 1 addition & 1 deletion lcm/eventlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ int lcm_eventlog_seek_to_timestamp(lcm_eventlog_t *l, int64_t timestamp)

while (1) {
frac = 0.5 * (frac1 + frac2);
off_t offset = (off_t)(frac * file_len);
off_t offset = (off_t) (frac * file_len);
fseeko(l->f, offset, SEEK_SET);
cur_time = get_event_time(l);
if (cur_time < 0)
Expand Down
2 changes: 1 addition & 1 deletion lcm/ioutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static inline int fread64(FILE *f, int64_t *v64)
// See Section 5.8 paragraph 3 of the standard
// http://open-std.org/JTC1/SC22/WG21/docs/papers/2015/n4527.pdf
// use uint for shifting instead if int
*v64 = (int64_t)(((uint64_t) v1) << 32) | (((int64_t) v2) & 0xffffffff);
*v64 = (int64_t) (((uint64_t) v1) << 32) | (((int64_t) v2) & 0xffffffff);

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions liblcm-test/lcm-logfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ int main(int argc, char **argv)
double start_time = strtod(optarg, &eptr);
if (*eptr != 0)
usage();
start_utime = (int64_t)(start_time * 1000000);
start_utime = (int64_t) (start_time * 1000000);
} break;
case 'e': {
char *eptr = NULL;
double end_time = strtod(optarg, &eptr);
if (*eptr != 0)
usage();
end_utime = (int64_t)(end_time * 1000000);
end_utime = (int64_t) (end_time * 1000000);
have_end_utime = 1;
} break;
case 'i':
Expand Down
4 changes: 2 additions & 2 deletions test/c/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ int check_lcmtest_primitives_list_t(const lcmtest_primitives_list_t *msg, int ex
const lcmtest_primitives_t *ex = &msg->items[n];
CHECK_FIELD(ex->i8, -(n % 100), "%d");
CHECK_FIELD(ex->i16, -n * 10, "%d");
CHECK_FIELD(ex->i64, (int64_t)(-n * 10000), "%" PRId64);
CHECK_FIELD(ex->i64, (int64_t) (-n * 10000), "%" PRId64);
CHECK_FIELD(ex->position[0], (double) -n, "%f");
CHECK_FIELD(ex->position[1], (double) -n, "%f");
CHECK_FIELD(ex->position[2], (double) -n, "%f");
Expand Down Expand Up @@ -269,7 +269,7 @@ int check_lcmtest_primitives_t(const lcmtest_primitives_t *msg, int expected)
int n = expected;
CHECK_FIELD(msg->i8, n % 100, "%d");
CHECK_FIELD(msg->i16, n * 10, "%d");
CHECK_FIELD(msg->i64, (int64_t)(n * 10000), "%" PRId64);
CHECK_FIELD(msg->i64, (int64_t) (n * 10000), "%" PRId64);
CHECK_FIELD(msg->position[0], (double) n, "%f");
CHECK_FIELD(msg->position[1], (double) n, "%f");
CHECK_FIELD(msg->position[2], (double) n, "%f");
Expand Down
4 changes: 2 additions & 2 deletions test/cpp/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ int CheckLcmType(const lcmtest::primitives_list_t *msg, int expected)
const lcmtest::primitives_t *ex = &msg->items[n];
CHECK_FIELD(ex->i8, -(n % 100), "%d");
CHECK_FIELD(ex->i16, -n * 10, "%d");
CHECK_FIELD(ex->i64, (int64_t)(-n * 10000), "%" PRId64);
CHECK_FIELD(ex->i64, (int64_t) (-n * 10000), "%" PRId64);
CHECK_FIELD(ex->position[0], (double) -n, "%f");
CHECK_FIELD(ex->position[1], (double) -n, "%f");
CHECK_FIELD(ex->position[2], (double) -n, "%f");
Expand Down Expand Up @@ -246,7 +246,7 @@ int CheckLcmType(const lcmtest::primitives_t *msg, int expected)
int n = expected;
CHECK_FIELD(msg->i8, n % 100, "%d");
CHECK_FIELD(msg->i16, n * 10, "%d");
CHECK_FIELD(msg->i64, (int64_t)(n * 10000), "%" PRId64);
CHECK_FIELD(msg->i64, (int64_t) (n * 10000), "%" PRId64);
CHECK_FIELD(msg->position[0], (double) n, "%f");
CHECK_FIELD(msg->position[1], (double) n, "%f");
CHECK_FIELD(msg->position[2], (double) n, "%f");
Expand Down

0 comments on commit 48bbec1

Please sign in to comment.