[PATCH 2/2] Increase the buffer for the gas text in planner

Dirk Hohndel dirk at hohndel.org
Sun Feb 3 02:27:47 PST 2013


Good catch!

/D

Sergey Starosek <sergey.starosek at gmail.com> writes:

> UTF-8 strings could create more characters.
>
> Signed-off-by: Sergey Starosek <sergey.starosek at gmail.com>
> ---
>  planner.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/planner.c b/planner.c
> index 9c47d32..c972b0d 100644
> --- a/planner.c
> +++ b/planner.c
> @@ -536,7 +536,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive)
>  	for (gasidx = 0; gasidx < MAX_CYLINDERS; gasidx++) {
>  		double volume;
>  		const char *unit;
> -		char gas[12];
> +		char gas[64];
>  		if (consumption[gasidx] == 0)
>  			continue;
>  		len = strlen(buffer);
> @@ -729,7 +729,7 @@ static int validate_gas(const char *text, int *o2_p, int *he_p)
>  		return 0;
>  
>  	if (!strcasecmp(text, _("air"))) {
> -		o2 = O2_IN_AIR; he = 0; text += 3;
> +		o2 = O2_IN_AIR; he = 0; text += strlen(_("air"));
>  	} else if (!strncasecmp(text, _("ean"), 3)) {
>  		o2 = get_permille(text+3, &text); he = 0;
>  	} else {
> _______________________________________________
> subsurface mailing list
> subsurface at hohndel.org
> http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface



More information about the subsurface mailing list