commit | c213719ac84714129edae9e37f6a9b5929fa6921 | [log] [tgz] |
---|---|---|
author | Florian Mayer <fmayer@google.com> | Tue Mar 05 17:03:10 2019 +0000 |
committer | Florian Mayer <fmayer@google.com> | Tue Mar 19 17:04:46 2019 +0000 |
tree | ea2d3577e5eaa5ecd93fa31e106e52660cdac72c | |
parent | b86d88b668df30fe472edd3e4bd7df64c536e97b [diff] |
Add versionCode parser for package list. Bug: 123186697 Change-Id: I9194cc55abd943c4b8b2f9d29dcad035170f2736
diff --git a/libpackagelistparser/include/packagelistparser/packagelistparser.h b/libpackagelistparser/include/packagelistparser/packagelistparser.h index 8bcc1e2..3cb6b9a 100644 --- a/libpackagelistparser/include/packagelistparser/packagelistparser.h +++ b/libpackagelistparser/include/packagelistparser/packagelistparser.h
@@ -54,6 +54,7 @@ gid_list gids; void *private_data; bool profileable_from_shell; + long version_code; }; /**
diff --git a/libpackagelistparser/packagelistparser.c b/libpackagelistparser/packagelistparser.c index 4ce2363..edc533c 100644 --- a/libpackagelistparser/packagelistparser.c +++ b/libpackagelistparser/packagelistparser.c
@@ -239,6 +239,15 @@ pkg_info->profileable_from_shell = (bool)tmp; } + cur = strsep(&next, " \t\r\n"); + if (cur) { + tmp = strtoul(cur, &endptr, 10); + if (*endptr != '\0') { + errmsg = "Could not convert field \"versionCode\" to integer value"; + goto err; + } + pkg_info->version_code = tmp; + } rc = callback(pkg_info, userdata); if (rc == false) {