Attention to bug 170444

Derek Atkins warlord at MIT.EDU
Sun Aug 28 23:04:05 EDT 2005


Thomas,

Quoting Thomas Bushnell BSG <tb at becket.net>:

> --- gnucash-1.8.10.orig/src/engine/date.c
> +++ gnucash-1.8.10/src/engine/date.c
> @@ -362,19 +362,25 @@
>       sprintf (buff, "%2d.%2d.%-4d", day, month, year);
>       break;
>     case DATE_FORMAT_ISO:
> +  iso_date:
>       sprintf (buff, "%04d-%02d-%02d", year, month, day);
>       break;
>     case DATE_FORMAT_LOCALE:
>       {
>         struct tm tm_str;
> +	time_t t;
> +	int n;
>
>         tm_str.tm_mday = day;
>         tm_str.tm_mon = month - 1;    /* tm_mon = 0 through 11 */
>         tm_str.tm_year = year - 1900; /* this is what the standard
>                                        * says, it's not a Y2K thing */
> -
> 	gnc_tm_set_day_start (&tm_str);
> -        strftime (buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm_str);
> +	t = mktime (&tm_str);
> +	localtime_r (&t, &tm_str);
> +        n = strftime (buff, MAX_DATE_LENGTH, GNC_D_FMT, &tm_str);
> +	if (n == 0)
> +	  goto iso_date;
>       }
>       break;

Any reason not to change this to remove the goto?  We could just 
reorder the two
case statements and change the code from:

  if (n == 0)
    goto iso_date;
  }
  break;

to...

  if (n != 0)
    break;
  }
  /* FALLTHROUGH */

I'll try to apply this to 1.8 and g2 either tonight or, more likely, tomorrow.

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available



More information about the gnucash-devel mailing list