Patchwork [15/26] acpi: wmi: make size a size_t

login
register
mail settings
Submitter Colin King
Date Oct. 14, 2012, 8:32 p.m.
Message ID <1350246738-31699-16-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/191415/
State Accepted
Headers show

Comments

Colin King - Oct. 14, 2012, 8:32 p.m.
From: Colin Ian King <colin.king@canonical.com>

Make size a size_t and use appropriate printf format specifiers
for this.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpi/wmi/wmi.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Alex Hung - Oct. 15, 2012, 8:27 a.m.
On 10/15/2012 04:32 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Make size a size_t and use appropriate printf format specifiers
> for this.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpi/wmi/wmi.c |   10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/acpi/wmi/wmi.c b/src/acpi/wmi/wmi.c
> index 588f8cf..578abe9 100644
> --- a/src/acpi/wmi/wmi.c
> +++ b/src/acpi/wmi/wmi.c
> @@ -112,9 +112,9 @@ static char *wmi_wdg_flags_to_text(const fwts_wmi_flags flags)
>   }
>
>   static void wmi_parse_wdg_data(fwts_framework *fw,
> -	const int size, const uint8_t *wdg_data, bool *result)
> +	const size_t size, const uint8_t *wdg_data, bool *result)
>   {
> -	int i;
> +	size_t i;
>   	int advice_given = 0;
>
>   	fwts_guid_info *info = (fwts_guid_info *)wdg_data;
> @@ -191,7 +191,7 @@ static void wmi_parse_wdg_data(fwts_framework *fw,
>   }
>
>   static void wmi_get_wdg_data(fwts_framework *fw,
> -	fwts_list_link *item, const int size, uint8_t *wdg_data)
> +	fwts_list_link *item, const size_t size, uint8_t *wdg_data)
>   {
>   	char *str;
>   	uint8_t *data = wdg_data;
> @@ -228,7 +228,7 @@ static void wmi_get_wdg_data(fwts_framework *fw,
>   			if (data > wdg_data + size) {
>   				fwts_failed(fw, LOG_LEVEL_HIGH,
>   					"WMI_WDGBufferBad",
> -					"_WDG buffer was more than %d bytes "
> +					"_WDG buffer was more than %zu bytes "
>   					"long!", size);
>   				fwts_tag_failed(fw, FWTS_TAG_ACPI_BAD_LENGTH);
>   				return;
> @@ -242,7 +242,7 @@ static void wmi_parse_for_wdg(fwts_framework *fw,
>   	fwts_list_link *item, int *count, bool *result)
>   {
>   	uint8_t *wdg_data;
> -	int size;
> +	size_t size;
>   	char *str = fwts_text_list_text(item);
>
>   	/* Parse Name(_WDG, Buffer, (0xXX) */
>

Acked-by: Alex Hung <alex.hung@canonical.com>
Keng-Yu Lin - Oct. 17, 2012, 7:46 a.m.
On Mon, Oct 15, 2012 at 4:32 AM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Make size a size_t and use appropriate printf format specifiers
> for this.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpi/wmi/wmi.c |   10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/acpi/wmi/wmi.c b/src/acpi/wmi/wmi.c
> index 588f8cf..578abe9 100644
> --- a/src/acpi/wmi/wmi.c
> +++ b/src/acpi/wmi/wmi.c
> @@ -112,9 +112,9 @@ static char *wmi_wdg_flags_to_text(const fwts_wmi_flags flags)
>  }
>
>  static void wmi_parse_wdg_data(fwts_framework *fw,
> -       const int size, const uint8_t *wdg_data, bool *result)
> +       const size_t size, const uint8_t *wdg_data, bool *result)
>  {
> -       int i;
> +       size_t i;
>         int advice_given = 0;
>
>         fwts_guid_info *info = (fwts_guid_info *)wdg_data;
> @@ -191,7 +191,7 @@ static void wmi_parse_wdg_data(fwts_framework *fw,
>  }
>
>  static void wmi_get_wdg_data(fwts_framework *fw,
> -       fwts_list_link *item, const int size, uint8_t *wdg_data)
> +       fwts_list_link *item, const size_t size, uint8_t *wdg_data)
>  {
>         char *str;
>         uint8_t *data = wdg_data;
> @@ -228,7 +228,7 @@ static void wmi_get_wdg_data(fwts_framework *fw,
>                         if (data > wdg_data + size) {
>                                 fwts_failed(fw, LOG_LEVEL_HIGH,
>                                         "WMI_WDGBufferBad",
> -                                       "_WDG buffer was more than %d bytes "
> +                                       "_WDG buffer was more than %zu bytes "
>                                         "long!", size);
>                                 fwts_tag_failed(fw, FWTS_TAG_ACPI_BAD_LENGTH);
>                                 return;
> @@ -242,7 +242,7 @@ static void wmi_parse_for_wdg(fwts_framework *fw,
>         fwts_list_link *item, int *count, bool *result)
>  {
>         uint8_t *wdg_data;
> -       int size;
> +       size_t size;
>         char *str = fwts_text_list_text(item);
>
>         /* Parse Name(_WDG, Buffer, (0xXX) */
> --
> 1.7.10.4
>
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>

Patch

diff --git a/src/acpi/wmi/wmi.c b/src/acpi/wmi/wmi.c
index 588f8cf..578abe9 100644
--- a/src/acpi/wmi/wmi.c
+++ b/src/acpi/wmi/wmi.c
@@ -112,9 +112,9 @@  static char *wmi_wdg_flags_to_text(const fwts_wmi_flags flags)
 }
 
 static void wmi_parse_wdg_data(fwts_framework *fw,
-	const int size, const uint8_t *wdg_data, bool *result)
+	const size_t size, const uint8_t *wdg_data, bool *result)
 {
-	int i;
+	size_t i;
 	int advice_given = 0;
 
 	fwts_guid_info *info = (fwts_guid_info *)wdg_data;
@@ -191,7 +191,7 @@  static void wmi_parse_wdg_data(fwts_framework *fw,
 }
 
 static void wmi_get_wdg_data(fwts_framework *fw,
-	fwts_list_link *item, const int size, uint8_t *wdg_data)
+	fwts_list_link *item, const size_t size, uint8_t *wdg_data)
 {
 	char *str;
 	uint8_t *data = wdg_data;
@@ -228,7 +228,7 @@  static void wmi_get_wdg_data(fwts_framework *fw,
 			if (data > wdg_data + size) {
 				fwts_failed(fw, LOG_LEVEL_HIGH,
 					"WMI_WDGBufferBad",
-					"_WDG buffer was more than %d bytes "
+					"_WDG buffer was more than %zu bytes "
 					"long!", size);
 				fwts_tag_failed(fw, FWTS_TAG_ACPI_BAD_LENGTH);
 				return;
@@ -242,7 +242,7 @@  static void wmi_parse_for_wdg(fwts_framework *fw,
 	fwts_list_link *item, int *count, bool *result)
 {
 	uint8_t *wdg_data;
-	int size;
+	size_t size;
 	char *str = fwts_text_list_text(item);
 
 	/* Parse Name(_WDG, Buffer, (0xXX) */