aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Łyszczek <michal.lyszczek@bofc.pl>2018-04-20 18:46:42 +0200
committerMichał Łyszczek <michal.lyszczek@bofc.pl>2018-04-20 18:55:10 +0200
commit39f0ab0c98c27aff9ef6fa3020e484fa8b2b2b55 (patch)
treefc93fbde66d1c172244988ab63133b73d5c830b9
parent441e58f5ad7390d4dc0a8d9e0bd92126b6ec1c62 (diff)
downloadembedlog-39f0ab0c98c27aff9ef6fa3020e484fa8b2b2b55.tar.gz
embedlog-39f0ab0c98c27aff9ef6fa3020e484fa8b2b2b55.tar.bz2
embedlog-39f0ab0c98c27aff9ef6fa3020e484fa8b2b2b55.zip
fix compilation warnings
dont try to add credits for snprintf it this is not used (silents compiler warning about unused variable)
-rw-r--r--include/embedlog.h12
-rw-r--r--src/el-file.c4
-rw-r--r--src/el-print.c1
-rw-r--r--src/el-private.h2
-rw-r--r--src/el-ts.c9
-rw-r--r--src/snprintf.c2
6 files changed, 17 insertions, 13 deletions
diff --git a/include/embedlog.h b/include/embedlog.h
index 853e769..8615020 100644
--- a/include/embedlog.h
+++ b/include/embedlog.h
@@ -155,12 +155,12 @@ struct el_options
unsigned int file_sync_level:3;
int serial_fd;
- int frotate_number;
- int fcurrent_rotate;
- long frotate_size;
- long file_sync_every;
- long written_after_sync;
- long fpos;
+ unsigned int frotate_number;
+ unsigned int fcurrent_rotate;
+ unsigned long frotate_size;
+ unsigned long file_sync_every;
+ unsigned long written_after_sync;
+ unsigned long fpos;
FILE *file;
char *current_log;
const char *fname;
diff --git a/src/el-file.c b/src/el-file.c
index b278692..0b1cda6 100644
--- a/src/el-file.c
+++ b/src/el-file.c
@@ -192,7 +192,7 @@ static int el_file_rotate
struct el_options *options
)
{
- int i; /* simple iterator for loop */
+ unsigned int i; /* simple iterator for loop */
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
@@ -562,7 +562,7 @@ int el_file_putb
if (options->frotate_number)
{
- if (options->fpos != 0 && options->fpos + mlen > options->frotate_size)
+ if (options->fpos != 0 && options->fpos + mlen > options->frotate_size)
{
/*
* we get here only when frotate is enabled, and writing to
diff --git a/src/el-print.c b/src/el-print.c
index 6f08c74..61d9a8e 100644
--- a/src/el-print.c
+++ b/src/el-print.c
@@ -380,7 +380,6 @@ int el_ovprint
char buf[EL_BUF_MAX + 2]; /* buffer for message to print */
size_t w; /* bytes written to buf */
size_t flen; /* length of the fmt output */
- size_t fmtlen; /* length of fmt string */
int e; /* error code */
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
diff --git a/src/el-private.h b/src/el-private.h
index 45313a9..c1c2d9b 100644
--- a/src/el-private.h
+++ b/src/el-private.h
@@ -267,7 +267,7 @@ int el_tty_close(struct el_options *options);
#endif
int el_log_allowed(struct el_options *options, enum el_level level);
-size_t el_timestamp(struct el_options *options, char *buf, int binary);
+size_t el_timestamp(struct el_options *options, void *buf, int binary);
#if LLONG_MAX
size_t el_encode_number(unsigned long long number, void *out);
diff --git a/src/el-ts.c b/src/el-ts.c
index fc29e93..503c437 100644
--- a/src/el-ts.c
+++ b/src/el-ts.c
@@ -103,7 +103,7 @@ static void el_ts_clock_gettime
size_t el_timestamp
(
struct el_options *options, /* options defining printing style */
- char *buf, /* buffer where timestamp will be stored */
+ void *b, /* buffer where timestamp will be stored */
int binary /* 1 if timestamp should be binary */
)
{
@@ -111,6 +111,7 @@ size_t el_timestamp
time_t s; /* timestamp seconds */
long ns; /* timestamp nanoseconds */
size_t tl; /* timestamp length */
+ char *buf; /* b threated as known type */
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
if (options->timestamp == EL_TS_OFF)
@@ -122,6 +123,8 @@ size_t el_timestamp
return 0;
}
+ buf = b;
+
/*
* first we get seconds and nanoseconds from proper timer
*/
@@ -171,9 +174,9 @@ size_t el_timestamp
*/
# ifdef LLONG_MAX
- tl = el_encode_number((unsigned long long)s, buf);
+ tl = el_encode_number((unsigned long long)s, (unsigned char *)buf);
# else
- tl = el_encode_number((unsigned long)s, buf);
+ tl = el_encode_number((unsigned long)s, (unsigned char*)buf);
# endif
/*
diff --git a/src/snprintf.c b/src/snprintf.c
index 2eb2926..f26389c 100644
--- a/src/snprintf.c
+++ b/src/snprintf.c
@@ -411,10 +411,12 @@ int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap);
/* declarations */
+#if !defined(HAVE_SNPRINTF)
static char credits[] = "\n\
@(#)snprintf.c, v2.2: Mark Martinec, <mark.martinec@ijs.si>\n\
@(#)snprintf.c, v2.2: Copyright 1999, Mark Martinec. Frontier Artistic License applies.\n\
@(#)snprintf.c, v2.2: http://www.ijs.si/software/snprintf/\n";
+#endif
#if defined(NEED_ASPRINTF)
int asprintf(char **ptr, const char *fmt, /*args*/ ...) {