Message ID | 20180815131129.24146-21-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
Series | [01/27] lib: fwts_framework: ensure src pointer is const | expand |
On 2018-08-15 06:11 AM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Add in missing const, cleans up warnings. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/acpi/stao/stao.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/src/acpi/stao/stao.c b/src/acpi/stao/stao.c > index 56df440b..537e364f 100644 > --- a/src/acpi/stao/stao.c > +++ b/src/acpi/stao/stao.c > @@ -50,12 +50,12 @@ static int stao_init(fwts_framework *fw) > */ > static bool stao_acpi_string( > fwts_framework *fw, > - char *str, > - char *end, > + const char *str, > + const char *end, > bool *passed, > size_t *len) > { > - char *ptr = str; > + const char *ptr = str; > > while (*ptr) { > if (ptr > end) { > @@ -82,7 +82,7 @@ static int stao_test1(fwts_framework *fw) > { > const fwts_acpi_table_stao *stao = (const fwts_acpi_table_stao *)table->data; > bool passed = true; > - char *ptr, *end; > + const char *ptr, *end; > int strings = 0; > > if (stao->header.length > (uint32_t)table->length) { > @@ -101,8 +101,8 @@ static int stao_test1(fwts_framework *fw) > fwts_log_info_verbatim(fw, "STAO Status Override Table:"); > fwts_log_info_verbatim(fw, " UART: 0x%2.2" PRIx8, stao->uart); > > - ptr = (char *)stao->namelist; > - end = (char *)table->data + stao->header.length; > + ptr = (const char *)stao->namelist; > + end = (const char *)table->data + stao->header.length; > > while (ptr < end) { > size_t len; > @@ -118,8 +118,8 @@ static int stao_test1(fwts_framework *fw) > if (!strings) > goto done; > > - ptr = (char *)stao->namelist; > - end = (char *)table->data + table->length; > + ptr = (const char *)stao->namelist; > + end = (const char *)table->data + table->length; > > while (ptr < end) { > bool found; > Acked-by: Alex Hung <alex.hung@canonical.com>
On 08/15/2018 09:11 PM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Add in missing const, cleans up warnings. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/acpi/stao/stao.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/src/acpi/stao/stao.c b/src/acpi/stao/stao.c > index 56df440b..537e364f 100644 > --- a/src/acpi/stao/stao.c > +++ b/src/acpi/stao/stao.c > @@ -50,12 +50,12 @@ static int stao_init(fwts_framework *fw) > */ > static bool stao_acpi_string( > fwts_framework *fw, > - char *str, > - char *end, > + const char *str, > + const char *end, > bool *passed, > size_t *len) > { > - char *ptr = str; > + const char *ptr = str; > > while (*ptr) { > if (ptr > end) { > @@ -82,7 +82,7 @@ static int stao_test1(fwts_framework *fw) > { > const fwts_acpi_table_stao *stao = (const fwts_acpi_table_stao *)table->data; > bool passed = true; > - char *ptr, *end; > + const char *ptr, *end; > int strings = 0; > > if (stao->header.length > (uint32_t)table->length) { > @@ -101,8 +101,8 @@ static int stao_test1(fwts_framework *fw) > fwts_log_info_verbatim(fw, "STAO Status Override Table:"); > fwts_log_info_verbatim(fw, " UART: 0x%2.2" PRIx8, stao->uart); > > - ptr = (char *)stao->namelist; > - end = (char *)table->data + stao->header.length; > + ptr = (const char *)stao->namelist; > + end = (const char *)table->data + stao->header.length; > > while (ptr < end) { > size_t len; > @@ -118,8 +118,8 @@ static int stao_test1(fwts_framework *fw) > if (!strings) > goto done; > > - ptr = (char *)stao->namelist; > - end = (char *)table->data + table->length; > + ptr = (const char *)stao->namelist; > + end = (const char *)table->data + table->length; > > while (ptr < end) { > bool found; Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff --git a/src/acpi/stao/stao.c b/src/acpi/stao/stao.c index 56df440b..537e364f 100644 --- a/src/acpi/stao/stao.c +++ b/src/acpi/stao/stao.c @@ -50,12 +50,12 @@ static int stao_init(fwts_framework *fw) */ static bool stao_acpi_string( fwts_framework *fw, - char *str, - char *end, + const char *str, + const char *end, bool *passed, size_t *len) { - char *ptr = str; + const char *ptr = str; while (*ptr) { if (ptr > end) { @@ -82,7 +82,7 @@ static int stao_test1(fwts_framework *fw) { const fwts_acpi_table_stao *stao = (const fwts_acpi_table_stao *)table->data; bool passed = true; - char *ptr, *end; + const char *ptr, *end; int strings = 0; if (stao->header.length > (uint32_t)table->length) { @@ -101,8 +101,8 @@ static int stao_test1(fwts_framework *fw) fwts_log_info_verbatim(fw, "STAO Status Override Table:"); fwts_log_info_verbatim(fw, " UART: 0x%2.2" PRIx8, stao->uart); - ptr = (char *)stao->namelist; - end = (char *)table->data + stao->header.length; + ptr = (const char *)stao->namelist; + end = (const char *)table->data + stao->header.length; while (ptr < end) { size_t len; @@ -118,8 +118,8 @@ static int stao_test1(fwts_framework *fw) if (!strings) goto done; - ptr = (char *)stao->namelist; - end = (char *)table->data + table->length; + ptr = (const char *)stao->namelist; + end = (const char *)table->data + table->length; while (ptr < end) { bool found;