commit 1367695b58142d73ad701f34f04fe45c4ad2782b from: Christian Weisgerber date: Sat Sep 26 20:53:13 2020 UTC fix potential type mismatches between format specifiers and arguments Cast printf arguments of type time_t and off_t to long long to match the %lld format specifier on platforms where this might not be the case. In parse.y, switch the number variable to long long because all its interactions are with that type anyway. ok millert stsp commit - bfa12d5e80568029d33f5d0f2e9cee54bc20db27 commit + 1367695b58142d73ad701f34f04fe45c4ad2782b blob - 7b11e29ef0e1d99c72f6544888fcce187e4467ea blob + d493fceb5e36c0e2b7129cfa0950467e1fba2e30 --- got/got.c +++ got/got.c @@ -9481,11 +9481,11 @@ cat_commit(struct got_object_id *id, struct got_reposi } fprintf(outfile, "%s%s %lld +0000\n", GOT_COMMIT_LABEL_AUTHOR, got_object_commit_get_author(commit), - got_object_commit_get_author_time(commit)); + (long long)got_object_commit_get_author_time(commit)); fprintf(outfile, "%s%s %lld +0000\n", GOT_COMMIT_LABEL_COMMITTER, got_object_commit_get_author(commit), - got_object_commit_get_committer_time(commit)); + (long long)got_object_commit_get_committer_time(commit)); logmsg = got_object_commit_get_logmsg_raw(commit); fprintf(outfile, "messagelen %zd\n", strlen(logmsg)); @@ -9540,7 +9540,7 @@ cat_tag(struct got_object_id *id, struct got_repositor fprintf(outfile, "%s%s %lld +0000\n", GOT_TAG_LABEL_TAGGER, got_object_tag_get_tagger(tag), - got_object_tag_get_tagger_time(tag)); + (long long)got_object_tag_get_tagger_time(tag)); tagmsg = got_object_tag_get_message(tag); fprintf(outfile, "messagelen %zd\n", strlen(tagmsg)); blob - 73b108d609463ae2121d561cbfcf7c2bc6924d2b blob + a1f3f64950abf6a28988d7499f93bc440c52d438 --- lib/object_create.c +++ lib/object_create.c @@ -142,7 +142,7 @@ got_object_blob_file_create(struct got_object_id **id, } if (asprintf(&header, "%s %lld", GOT_OBJ_LABEL_BLOB, - sb.st_size) == -1) { + (long long)sb.st_size) == -1) { err = got_error_from_errno("asprintf"); goto done; } @@ -438,12 +438,12 @@ got_object_commit_create(struct got_object_id **id, } if (asprintf(&author_str, "%s%s %lld +0000\n", - GOT_COMMIT_LABEL_AUTHOR, author, author_time) == -1) + GOT_COMMIT_LABEL_AUTHOR, author, (long long)author_time) == -1) return got_error_from_errno("asprintf"); if (asprintf(&committer_str, "%s%s %lld +0000\n", GOT_COMMIT_LABEL_COMMITTER, committer ? committer : author, - committer ? committer_time : author_time) + (long long)(committer ? committer_time : author_time)) == -1) { err = got_error_from_errno("asprintf"); goto done; @@ -644,7 +644,7 @@ got_object_tag_create(struct got_object_id **id, } if (asprintf(&tagger_str, "%s%s %lld +0000\n", - GOT_TAG_LABEL_TAGGER, tagger, tagger_time) == -1) + GOT_TAG_LABEL_TAGGER, tagger, (long long)tagger_time) == -1) return got_error_from_errno("asprintf"); msg0 = strdup(tagmsg); blob - 2a929a4ab71f2ead616af3510f5381d8284396b6 blob + 5288649cc83bfaff88b857271cffd172e4221974 --- libexec/got-index-pack/got-index-pack.c +++ libexec/got-index-pack/got-index-pack.c @@ -244,7 +244,8 @@ read_packed_object(struct got_pack *pack, struct got_i free(data); break; } - if (asprintf(&header, "%s %lld", obj_label, obj->size) == -1) { + if (asprintf(&header, "%s %lld", obj_label, + (long long)obj->size) == -1) { err = got_error_from_errno("asprintf"); free(data); break; blob - 2ae503c4da4198a918f6bbb1bed217eb6bbba8b0 blob + df2c1d75f7705837e1cd37d49b209df5a83700c3 --- libexec/got-read-gotconfig/parse.y +++ libexec/got-read-gotconfig/parse.y @@ -84,7 +84,7 @@ static const struct got_error* new_remote(struct gotco typedef struct { union { - int64_t number; + long long number; char *string; struct node_branch *branch; } v;