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 <adurbin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44043
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Aaron Durbin
2013-02-26 09:02:02 -06:00
committed by ChromeBot
parent 612797edfa
commit 9d7d0cbe13
2 changed files with 5 additions and 5 deletions

View File

@@ -34,7 +34,7 @@ ImageInfo *VbFindFontGlyph(VbFont_t *font, uint32_t ascii,
/** /**
* Try to display the specified text at a particular position. * 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); 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. * 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. * Get the number of localizations in the GBB bitmap data.

View File

@@ -46,7 +46,7 @@ VbError_t VbGetLocalizationCount(VbCommonParams *cparams, uint32_t *count)
return VBERROR_SUCCESS; return VBERROR_SUCCESS;
} }
char *VbHWID(VbCommonParams *cparams) const char *VbHWID(VbCommonParams *cparams)
{ {
GoogleBinaryBlockHeader *gbb = GoogleBinaryBlockHeader *gbb =
(GoogleBinaryBlockHeader *)cparams->gbb_data; (GoogleBinaryBlockHeader *)cparams->gbb_data;
@@ -120,7 +120,7 @@ ImageInfo *VbFindFontGlyph(VbFont_t *font, uint32_t ascii,
return &(entry->info); 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) uint32_t x, uint32_t y, VbFont_t *font)
{ {
int i; int i;
@@ -182,7 +182,7 @@ VbError_t VbDisplayScreenFromGBB(VbCommonParams *cparams, uint32_t screen,
uint32_t offset; uint32_t offset;
uint32_t i; uint32_t i;
VbFont_t *font; VbFont_t *font;
char *text_to_show; const char *text_to_show;
int rtol = 0; int rtol = 0;
char outbuf[OUTBUF_LEN] = ""; char outbuf[OUTBUF_LEN] = "";
uint32_t used = 0; uint32_t used = 0;