Cast first argument for %.*s to int
authorTobias Brunner <tobias@strongswan.org>
Thu, 24 Jan 2013 17:59:03 +0000 (18:59 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 24 Jan 2013 22:35:42 +0000 (23:35 +0100)
src/libimcv/plugins/imv_os/imv_os_database.c
src/libimcv/plugins/imv_os/imv_os_state.c
src/libimcv/plugins/imv_os/pacman.c
src/libpts/plugins/imv_attestation/attest_db.c
src/libpts/pts/pts.c

index eb4c2ac..c6db995 100644 (file)
@@ -68,8 +68,8 @@ METHOD(imv_os_database_t, check_packages, status_t,
                pos = memchr(os_version.ptr, ' ', os_version.len);
                os_version_len = pos ? (pos - os_version.ptr) : os_version.len;
                product = malloc(os_name.len + 1 + os_version_len + 1);
-               sprintf(product, "%.*s %.*s", os_name.len, os_name.ptr,
-                                                                         os_version_len, os_version.ptr); 
+               sprintf(product, "%.*s %.*s", (int)os_name.len, os_name.ptr,
+                                                                         (int)os_version_len, os_version.ptr);
        }
        DBG1(DBG_IMV, "processing installed '%s' packages", product);
 
@@ -148,7 +148,7 @@ METHOD(imv_os_database_t, check_packages, status_t,
                        }
                }
                e->destroy(e);
-               
+
                if (found)
                {
                        if (match)
index f169836..ca6e050 100644 (file)
@@ -448,8 +448,8 @@ METHOD(imv_os_state_t, set_info, void,
        /* OS info is a concatenation of OS name and OS version */
        free(this->info);
        this->info = malloc(len);
-       snprintf(this->info, len, "%.*s %.*s", name.len, name.ptr,
-                                                                                  version.len, version.ptr);
+       snprintf(this->info, len, "%.*s %.*s", (int)name.len, name.ptr,
+                                                                                  (int)version.len, version.ptr);
        this->type = type;
        this->name = chunk_clone(name);
        this->version = chunk_clone(version);
index feb3ff3..f5f5288 100644 (file)
@@ -97,13 +97,13 @@ static time_t extract_time(char *line)
        char* months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
                                           "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
        int i;
-       
+
        if (sscanf(line, "Generated: %3s %3s %2d %2d:%2d:%2d %4d UTC", wday, mon,
                           &t.tm_mday, &t.tm_hour, &t.tm_min, &t.tm_sec, &t.tm_year) != 7)
        {
                return UNDEFINED_TIME;
        }
-       t.tm_isdst = 0; 
+       t.tm_isdst = 0;
        t.tm_year -= 1900;
        t.tm_mon = 12;
 
@@ -173,7 +173,7 @@ static void process_packages(char *filename, char *product, bool update)
                e->destroy(e);
        }
        if (!pid)
-       {       
+       {
                if (db->execute(db, &pid, "INSERT INTO products (name) VALUES (?)",
                                                DB_TEXT, product) != 1)
                {
@@ -221,8 +221,8 @@ static void process_packages(char *filename, char *product, bool update)
                pos = strchr(line, ' ');
                if (!pos)
                {
-                       fprintf(stderr, "could not extract package name from '%.*s'",
-                                       strlen(line)-1, line);
+                       fprintf(stderr, "could not extract package name from '%.*s'\n",
+                                       (int)(strlen(line)-1), line);
                        errored++;
                        continue;
                }
@@ -240,8 +240,8 @@ static void process_packages(char *filename, char *product, bool update)
                        }
                        else
                        {
-                               fprintf(stderr, "could not extract package version from '%.*s'\n",
-                                       strlen(line)-1, line);
+                               fprintf(stderr, "could not extract package version from "
+                                               "'%.*s'\n", (int)(strlen(line)-1), line);
                                errored++;
                                continue;
                        }
@@ -275,7 +275,7 @@ static void process_packages(char *filename, char *product, bool update)
                        e->destroy(e);
                }
                if (!gid && security)
-               {       
+               {
                        if (db->execute(db, &gid, "INSERT INTO packages (name) VALUES (?)",
                                                                DB_TEXT, package) != 1)
                        {
@@ -289,7 +289,7 @@ static void process_packages(char *filename, char *product, bool update)
                }
 
                /* check for package versions already in database */
-               e = db->query(db, 
+               e = db->query(db,
                                "SELECT id, release, security, time FROM versions "
                                "WHERE package = ? AND product = ?",
                                DB_INT, gid, DB_INT, pid, DB_INT, DB_TEXT, DB_INT, DB_INT);
@@ -350,7 +350,7 @@ static void process_packages(char *filename, char *product, bool update)
                }
 
                if ((!vid && security) || (vid && !vid_update))
-               {       
+               {
                        printf("%s (%s) %s\n", package, version, security ? "[s]" : "");
 
                        if (db->execute(db, &vid,
index 1a902e5..91e9766 100644 (file)
@@ -827,7 +827,7 @@ METHOD(attest_db_t, list_devices, void,
                {
                        if (id != last_id)
                        {
-                               printf("%4d: %.*s\n", id, value.len, value.ptr);
+                               printf("%4d: %.*s\n", id, (int)value.len, value.ptr);
                                device_count++;
                                last_id = id;
                        }
index ec5ac1e..84a9961 100644 (file)
@@ -344,8 +344,8 @@ METHOD(pts_t, set_platform_info, void,
        /* platform info is a concatenation of OS name and OS version */
        free(this->platform_info);
        this->platform_info = malloc(len);
-       snprintf(this->platform_info, len, "%.*s %.*s", name.len, name.ptr,
-                                                                                                       version.len, version.ptr);
+       snprintf(this->platform_info, len, "%.*s %.*s", (int)name.len, name.ptr,
+                       (int)version.len, version.ptr);
 }
 
 METHOD(pts_t, get_tpm_version_info, bool,