]> git.proxmox.com Git - proxmox-mini-journalreader.git/commitdiff
fix implicit type conversions
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 16 May 2019 10:22:16 +0000 (12:22 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 16 May 2019 14:48:58 +0000 (16:48 +0200)
by either fixing the type, or manually casting

this makes the types more explicit

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/mini-journalreader.c

index fd229b9447de40d26caab454f3c214b20fd4739d..0747d7ca7d0733ab1e31dd150e5ce8299d613b81 100644 (file)
@@ -39,12 +39,12 @@ static uint64_t get_timestamp(sd_journal *j) {
     int r = sd_journal_get_realtime_usec(j, &timestamp);
     if (r < 0) {
         fprintf(stderr, "Failed  %s\n", strerror(-r));
-        return -1;
+        return (uint64_t)-1;
     }
     return timestamp;
 }
 
-static void print_to_buf(const char * string, uint32_t length) {
+static void print_to_buf(const char * string, size_t length) {
     if (!length) {
         return;
     }
@@ -157,7 +157,7 @@ static bool print_field(sd_journal *j, const char *field) {
         return false;
     }
 
-    int fieldlen = strlen(field)+1;
+    size_t fieldlen = strlen(field)+1;
     d += fieldlen;
     l -= fieldlen;
     print_to_buf(d, l);
@@ -228,7 +228,7 @@ int main(int argc, char *argv[]) {
 
     progname = argv[0];
 
-    while ((c = getopt (argc, argv, "b:e:d:n:f:t:h")) != -1) {
+    while ((c = (char)getopt (argc, argv, "b:e:d:n:f:t:h")) != -1) {
         switch (c) {
             case 'b':
                 begin = arg_to_uint64(optarg);