Adds 2017 to copyrights
[src/app-framework-main.git] / src / wgtpkg-files.c
index ed63726..503a84b 100644 (file)
@@ -1,5 +1,7 @@
 /*
- Copyright 2015 IoT.bzh
+ Copyright 2015, 2016, 2017 IoT.bzh
+
+ author: José Bollo <jose.bollo@iot.bzh>
 
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
 #include <string.h>
 #include <errno.h>
 #include <assert.h>
-#include <syslog.h>
 #include <dirent.h>
 #include <stdio.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <limits.h>
 
 #include "verbose.h"
-#include "wgtpkg.h"
+#include "wgtpkg-workdir.h"
+#include "wgtpkg-files.h"
 
 struct fdb {
        unsigned int count;
@@ -55,7 +58,7 @@ static unsigned int what_signature(const char *name)
        while ('0' <= name[len] && name[len] <= '9') {
                nid = 10 * id + (unsigned int)(name[len++] - '0');
                if (nid < id || nid == UINT_MAX) {
-                       syslog(LOG_WARNING, "number too big for %s", name);
+                       WARNING("number too big for %s", name);
                        return 0;
                }
                id = nid;
@@ -249,9 +252,10 @@ void file_clear_flags()
                allfiles.files[i]->flags &= flag_signature;
 }
 
-static int fill_files_rec(char name[PATH_MAX], int offset)
+static int fill_files_rec(char name[PATH_MAX], unsigned offset)
 {
-       int len, err, fd;
+       int err, fd;
+       unsigned len;
        DIR *dir;
        struct dirent *ent;
 
@@ -271,7 +275,7 @@ static int fill_files_rec(char name[PATH_MAX], int offset)
 
        ent = readdir(dir);
        while (ent != NULL) {
-               len = strlen(ent->d_name);
+               len = (unsigned)strlen(ent->d_name);
                if (ent->d_name[0] == '.' && (len == 1 || 
                        (ent->d_name[1] == '.' && len == 2)))
                        ;