Fix build with Clang on FreeBSD
diff --git a/breakpoints.c b/breakpoints.c
index 8db4e26..88ada7f 100644
--- a/breakpoints.c
+++ b/breakpoints.c
@@ -382,7 +382,7 @@
struct entry_breakpoint *entry_bp = NULL;
int bp_state = 0;
int result = -1;
- switch (lib != NULL) {
+ switch ((int)(lib != NULL)) {
fail:
switch (bp_state) {
case 2:
diff --git a/glob.c b/glob.c
index b26637f..06fec47 100644
--- a/glob.c
+++ b/glob.c
@@ -27,7 +27,7 @@
static ssize_t
match_character_class(const char *glob, size_t length, size_t from)
{
- size_t i;
+ size_t i = 0;
if (length > 0)
for (i = from + 2; i < length - 1 && glob[++i] != ':'; )
;
diff --git a/lens_default.c b/lens_default.c
index ed3d0e1..9f60dae 100644
--- a/lens_default.c
+++ b/lens_default.c
@@ -673,7 +673,7 @@
unsigned neg = bits > sz * 4 ? 0xff : 0x00;
int o = 0;
- if (acc_fprintf(&o, stream, "%s<", "~" + (neg == 0x00)) < 0)
+ if (acc_fprintf(&o, stream, "%s<", &"~"[neg == 0x00]) < 0)
return -1;
size_t bitno = 0;
diff --git a/options.c b/options.c
index eaf32fa..693676b 100644
--- a/options.c
+++ b/options.c
@@ -291,7 +291,7 @@
enum filter_rule_type type = FR_ADD;
while (*expr != 0) {
- size_t s = strcspn(expr, "-+@" + (operators ? 0 : 2));
+ size_t s = strcspn(expr, &"-+@"[operators ? 0 : 2]);
char *symname = expr;
char *libname;
char *next = expr + s + 1;
@@ -310,7 +310,7 @@
} else {
assert(expr[s] == '@');
expr[s] = 0;
- s = strcspn(next, "-+" + (operators ? 0 : 2));
+ s = strcspn(next, &"-+"[operators ? 0 : 2]);
if (s == 0) {
libname = "*";
expr = next;
diff --git a/output.c b/output.c
index fe62bb4..04a0138 100644
--- a/output.c
+++ b/output.c
@@ -95,7 +95,8 @@
old_tv.tv_sec = tv.tv_sec;
old_tv.tv_usec = tv.tv_usec;
current_column += fprintf(options.output, "%3lu.%06d ",
- diff.tv_sec, (int)diff.tv_usec);
+ (unsigned long)diff.tv_sec,
+ (int)diff.tv_usec);
}
if (opt_t) {
struct timeval tv;
@@ -104,7 +105,8 @@
gettimeofday(&tv, &tz);
if (opt_t > 2) {
current_column += fprintf(options.output, "%lu.%06d ",
- tv.tv_sec, (int)tv.tv_usec);
+ (unsigned long)tv.tv_sec,
+ (int)tv.tv_usec);
} else if (opt_t > 1) {
struct tm *tmp = localtime(&tv.tv_sec);
current_column +=
@@ -597,7 +599,7 @@
if (opt_T) {
fprintf(options.output, " <%lu.%06d>",
- current_time_spent.tv_sec,
+ (unsigned long)current_time_spent.tv_sec,
(int)current_time_spent.tv_usec);
}
fprintf(options.output, "\n");