From 9d7d0cbe132e6660885b72d6c46a2bbc982dca25 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Tue, 26 Feb 2013 09:02:02 -0600 Subject: [PATCH] vboot_display: fix -Wwrite-strings compiler errors VbHWID() returns a fixed string which can also be a returning a string that lives in the read only text segment or read only flash. Because of this the compiler will rightfully error when built with -Werror and -Wwrite-strings because the const qualifier is being ignored. Correct this and the ripple effect in VbRenderTextAtPos(). VbRenderTextAtPos() should be using constant strings anyhow. BUG=chrome-os-partner:17695 BRANCH=None TEST=built fwlib with -Werror -Wwrite-strings. Compiles correctly. make runtests still passes as well. Change-Id: Id03a783d2d9b5de4cc3b3ce0fa6d74934751cca4 Signed-off-by: Aaron Durbin Reviewed-on: https://gerrit.chromium.org/gerrit/44043 Reviewed-by: Bill Richardson Reviewed-by: Randall Spangler --- firmware/lib/include/vboot_display.h | 4 ++-- firmware/lib/vboot_display.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/firmware/lib/include/vboot_display.h b/firmware/lib/include/vboot_display.h index 52730b9e1f..17ce48b835 100644 --- a/firmware/lib/include/vboot_display.h +++ b/firmware/lib/include/vboot_display.h @@ -34,7 +34,7 @@ ImageInfo *VbFindFontGlyph(VbFont_t *font, uint32_t ascii, /** * Try to display the specified text at a particular position. */ -void VbRenderTextAtPos(char *text, int right_to_left, +void VbRenderTextAtPos(const char *text, int right_to_left, uint32_t x, uint32_t y, VbFont_t *font); /** @@ -45,7 +45,7 @@ const char *RecoveryReasonString(uint8_t code); /** * Return a fixed string representing the HWID. */ -char *VbHWID(VbCommonParams *cparams); +const char *VbHWID(VbCommonParams *cparams); /** * Get the number of localizations in the GBB bitmap data. diff --git a/firmware/lib/vboot_display.c b/firmware/lib/vboot_display.c index 7c916d017d..9abc51d9d1 100644 --- a/firmware/lib/vboot_display.c +++ b/firmware/lib/vboot_display.c @@ -46,7 +46,7 @@ VbError_t VbGetLocalizationCount(VbCommonParams *cparams, uint32_t *count) return VBERROR_SUCCESS; } -char *VbHWID(VbCommonParams *cparams) +const char *VbHWID(VbCommonParams *cparams) { GoogleBinaryBlockHeader *gbb = (GoogleBinaryBlockHeader *)cparams->gbb_data; @@ -120,7 +120,7 @@ ImageInfo *VbFindFontGlyph(VbFont_t *font, uint32_t ascii, return &(entry->info); } -void VbRenderTextAtPos(char *text, int right_to_left, +void VbRenderTextAtPos(const char *text, int right_to_left, uint32_t x, uint32_t y, VbFont_t *font) { int i; @@ -182,7 +182,7 @@ VbError_t VbDisplayScreenFromGBB(VbCommonParams *cparams, uint32_t screen, uint32_t offset; uint32_t i; VbFont_t *font; - char *text_to_show; + const char *text_to_show; int rtol = 0; char outbuf[OUTBUF_LEN] = ""; uint32_t used = 0;