Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Unified Diff: utility/bmpblk_utility.cc

Issue 6541001: Allow yaml file to specify default compression for images (Closed) Base URL: http://git.chromium.org/git/vboot_reference.git@master
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: utility/bmpblk_utility.cc
diff --git a/utility/bmpblk_utility.cc b/utility/bmpblk_utility.cc
index 8605dde046fa4d699197a7d238ef4ea5db69875b..078a5cebbe8fab423e83c3f955fbaeeb5300aae0 100644
--- a/utility/bmpblk_utility.cc
+++ b/utility/bmpblk_utility.cc
@@ -139,6 +139,8 @@ void BmpBlockUtil::parse_first_layer(yaml_parser_t *parser) {
keyword = (char*)event.data.scalar.value;
if (keyword == "bmpblock") {
parse_bmpblock(parser);
+ } else if (keyword == "compression") {
+ parse_compression(parser);
} else if (keyword == "images") {
parse_images(parser);
} else if (keyword == "screens") {
@@ -174,6 +176,24 @@ void BmpBlockUtil::parse_bmpblock(yaml_parser_t *parser) {
yaml_event_delete(&event);
}
+void BmpBlockUtil::parse_compression(yaml_parser_t *parser) {
+ yaml_event_t event;
+ yaml_parser_parse(parser, &event);
+ if (event.type != YAML_SCALAR_EVENT) {
+ error("Syntax error in parsing bmpblock.\n");
+ }
+ char *comp_str = (char *)event.data.scalar.value;
+ char *e = 0;
+ uint32_t comp = (uint32_t)strtoul(comp_str, &e, 0);
+ if (!*comp_str || (e && *e) || comp >= MAX_COMPRESS) {
+ error("Invalid compression specified in config file\n");
+ }
+ if (!set_compression_) {
+ compression_ = comp;
+ }
+ yaml_event_delete(&event);
+}
+
void BmpBlockUtil::parse_images(yaml_parser_t *parser) {
yaml_event_t event;
string image_name, image_filename;

Powered by Google App Engine
This is Rietveld 408576698