Re: [Powertop] [PATCH 1/2] Updates to support Android platform

Chris Ferron <chris.e.ferron at linux.intel.com> Mon, 17 Sep 2012 09:28:16 -0700
Newsgroups dev.linux.lists.powertop
Message-ID <[email protected]>
On 09/17/2012 07:34 AM, Rajagopal Venkat wrote:
>   
>   #include "devices/device.h"
> diff --git a/src/process/do_process.cpp b/src/process/do_process.cpp
> index eaef7f1..c9d6b0b 100644
> --- a/src/process/do_process.cpp
> +++ b/src/process/do_process.cpp
> @@ -869,7 +869,7 @@ void process_update_display(void)
>   		if (!show_power)
>   			strcpy(power, "          ");
>   		sprintf(name, "%s", all_power[i]->type());
> -		while (mbstowcs(NULL,name,0) < 14) strcat(name, " ");
> +		while (mbstowcs(NULL,name,20) < 14) strcat(name, " ");
>   
mbstowcs(NULL,name,0) is a test. return will be count. while catches the 
error.

>   
>   		if (all_power[i]->events() == 0 && all_power[i]->usage() == 0 && all_power[i]->Witts() == 0)
> @@ -882,7 +882,7 @@ void process_update_display(void)
>   			else
>   				sprintf(usage, "%5i%s", (int)all_power[i]->usage(), all_power[i]->usage_units());
>   		}
> -		while (mbstowcs(NULL,usage,0) < 14) strcat(usage, " ");
> +		while (mbstowcs(NULL,usage,20) < 14) strcat(usage, " ");
>   		sprintf(events, "%5.1f", all_power[i]->events());
>   		if (!all_power[i]->show_events())
>   			events[0] = 0;