Cast first argument for %.*s to int

This commit is contained in:
Tobias Brunner
2013-01-24 23:35:42 +01:00
parent bacbf91c5c
commit 677812dc66
5 changed files with 18 additions and 18 deletions
+2 -2
View File
@@ -68,8 +68,8 @@ METHOD(imv_os_database_t, check_packages, status_t,
pos = memchr(os_version.ptr, ' ', os_version.len); pos = memchr(os_version.ptr, ' ', os_version.len);
os_version_len = pos ? (pos - 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); product = malloc(os_name.len + 1 + os_version_len + 1);
sprintf(product, "%.*s %.*s", os_name.len, os_name.ptr, sprintf(product, "%.*s %.*s", (int)os_name.len, os_name.ptr,
os_version_len, os_version.ptr); (int)os_version_len, os_version.ptr);
} }
DBG1(DBG_IMV, "processing installed '%s' packages", product); DBG1(DBG_IMV, "processing installed '%s' packages", product);
+2 -2
View File
@@ -448,8 +448,8 @@ METHOD(imv_os_state_t, set_info, void,
/* OS info is a concatenation of OS name and OS version */ /* OS info is a concatenation of OS name and OS version */
free(this->info); free(this->info);
this->info = malloc(len); this->info = malloc(len);
snprintf(this->info, len, "%.*s %.*s", name.len, name.ptr, snprintf(this->info, len, "%.*s %.*s", (int)name.len, name.ptr,
version.len, version.ptr); (int)version.len, version.ptr);
this->type = type; this->type = type;
this->name = chunk_clone(name); this->name = chunk_clone(name);
this->version = chunk_clone(version); this->version = chunk_clone(version);
+4 -4
View File
@@ -221,8 +221,8 @@ static void process_packages(char *filename, char *product, bool update)
pos = strchr(line, ' '); pos = strchr(line, ' ');
if (!pos) if (!pos)
{ {
fprintf(stderr, "could not extract package name from '%.*s'", fprintf(stderr, "could not extract package name from '%.*s'\n",
strlen(line)-1, line); (int)(strlen(line)-1), line);
errored++; errored++;
continue; continue;
} }
@@ -240,8 +240,8 @@ static void process_packages(char *filename, char *product, bool update)
} }
else else
{ {
fprintf(stderr, "could not extract package version from '%.*s'\n", fprintf(stderr, "could not extract package version from "
strlen(line)-1, line); "'%.*s'\n", (int)(strlen(line)-1), line);
errored++; errored++;
continue; continue;
} }
@@ -827,7 +827,7 @@ METHOD(attest_db_t, list_devices, void,
{ {
if (id != last_id) 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++; device_count++;
last_id = id; last_id = id;
} }
+2 -2
View File
@@ -344,8 +344,8 @@ METHOD(pts_t, set_platform_info, void,
/* platform info is a concatenation of OS name and OS version */ /* platform info is a concatenation of OS name and OS version */
free(this->platform_info); free(this->platform_info);
this->platform_info = malloc(len); this->platform_info = malloc(len);
snprintf(this->platform_info, len, "%.*s %.*s", name.len, name.ptr, snprintf(this->platform_info, len, "%.*s %.*s", (int)name.len, name.ptr,
version.len, version.ptr); (int)version.len, version.ptr);
} }
METHOD(pts_t, get_tpm_version_info, bool, METHOD(pts_t, get_tpm_version_info, bool,