r18787 - gnucash/trunk - Re-indentation of source code, next batch.
Christian Stimming
cstim at code.gnucash.org
Tue Mar 2 16:40:02 EST 2010
Author: cstim
Date: 2010-03-02 16:40:02 -0500 (Tue, 02 Mar 2010)
New Revision: 18787
Trac: http://svn.gnucash.org/trac/changeset/18787
Modified:
gnucash/trunk/lib/libc/gmtime_r.c
gnucash/trunk/lib/libc/gmtime_r.h
gnucash/trunk/lib/libc/libc-missing-noop.c
gnucash/trunk/lib/libc/localtime_r.c
gnucash/trunk/lib/libc/scm_strptime.c
gnucash/trunk/lib/libc/setenv.c
gnucash/trunk/lib/libc/setenv.h
gnucash/trunk/lib/libc/strptime.c
gnucash/trunk/lib/libc/strptime.h
gnucash/trunk/src/RecnWindow.h
gnucash/trunk/src/app-utils/gnc-sx-instance-model.c
gnucash/trunk/src/backend/xml/gnc-backend-xml.c
gnucash/trunk/src/gnc-ui.h
gnucash/trunk/src/html/gnc-html-webkit.c
gnucash/trunk/src/import-export/csv/gnc-csv-model.c
gnucash/trunk/src/import-export/import-backend.c
gnucash/trunk/src/libqof/qof/gnc-date.c
gnucash/trunk/src/libqof/qof/guid.c
gnucash/trunk/src/libqof/qof/qoflog.c
gnucash/trunk/src/test-core/test-main.c
Log:
Re-indentation of source code, next batch.
This also strips trailing whitespaces from lines where they existed.
This re-indentation was done using astyle-1.24 using the following options:
astyle --indent=spaces=4 --brackets=break --pad-oper --pad-header --suffix=none
Modified: gnucash/trunk/lib/libc/gmtime_r.c
===================================================================
--- gnucash/trunk/lib/libc/gmtime_r.c 2010-03-02 21:23:52 UTC (rev 18786)
+++ gnucash/trunk/lib/libc/gmtime_r.c 2010-03-02 21:40:02 UTC (rev 18787)
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -36,14 +36,16 @@
static int time_mutex_inited = 0;
struct tm *tmp;
- if (!time_mutex_inited) {
+ if (!time_mutex_inited)
+ {
time_mutex_inited = 1;
pthread_mutex_init(&time_mutex, NULL);
}
pthread_mutex_lock(&time_mutex);
tmp = gmtime(timep);
- if (tmp) {
+ if (tmp)
+ {
memcpy(p_tm, tmp, sizeof(struct tm));
tmp = p_tm;
}
@@ -57,10 +59,11 @@
{
static struct tm* tmp;
tmp = gmtime(timep);
- if (tmp) {
+ if (tmp)
+ {
memcpy(p_tm, tmp, sizeof(struct tm));
tmp = p_tm;
- }
+ }
return tmp;
}
#endif /* HAVE_PTHREAD_MUTEX_INIT */
Modified: gnucash/trunk/lib/libc/gmtime_r.h
===================================================================
--- gnucash/trunk/lib/libc/gmtime_r.h 2010-03-02 21:23:52 UTC (rev 18786)
+++ gnucash/trunk/lib/libc/gmtime_r.h 2010-03-02 21:40:02 UTC (rev 18787)
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Modified: gnucash/trunk/lib/libc/libc-missing-noop.c
===================================================================
--- gnucash/trunk/lib/libc/libc-missing-noop.c 2010-03-02 21:23:52 UTC (rev 18786)
+++ gnucash/trunk/lib/libc/libc-missing-noop.c 2010-03-02 21:40:02 UTC (rev 18787)
@@ -2,5 +2,5 @@
void gnc_libc_missing_noop (void)
{
- return;
+ return;
}
Modified: gnucash/trunk/lib/libc/localtime_r.c
===================================================================
--- gnucash/trunk/lib/libc/localtime_r.c 2010-03-02 21:23:52 UTC (rev 18786)
+++ gnucash/trunk/lib/libc/localtime_r.c 2010-03-02 21:40:02 UTC (rev 18787)
@@ -11,24 +11,26 @@
struct tm *
localtime_r(const time_t *const timep, struct tm *p_tm)
{
- static pthread_mutex_t time_mutex;
- static int time_mutex_inited = 0;
- struct tm *tmp;
+ static pthread_mutex_t time_mutex;
+ static int time_mutex_inited = 0;
+ struct tm *tmp;
- if (!time_mutex_inited) {
- time_mutex_inited = 1;
- pthread_mutex_init(&time_mutex, NULL);
- }
+ if (!time_mutex_inited)
+ {
+ time_mutex_inited = 1;
+ pthread_mutex_init(&time_mutex, NULL);
+ }
- pthread_mutex_lock(&time_mutex);
- tmp = localtime(timep);
- if (tmp) {
- memcpy(p_tm, tmp, sizeof(struct tm));
- tmp = p_tm;
- }
- pthread_mutex_unlock(&time_mutex);
+ pthread_mutex_lock(&time_mutex);
+ tmp = localtime(timep);
+ if (tmp)
+ {
+ memcpy(p_tm, tmp, sizeof(struct tm));
+ tmp = p_tm;
+ }
+ pthread_mutex_unlock(&time_mutex);
- return tmp;
+ return tmp;
}
#else
struct tm *
@@ -36,10 +38,11 @@
{
static struct tm* tmp;
tmp = localtime(timep);
- if (tmp) {
- memcpy(p_tm, tmp, sizeof(struct tm));
- tmp = p_tm;
- }
+ if (tmp)
+ {
+ memcpy(p_tm, tmp, sizeof(struct tm));
+ tmp = p_tm;
+ }
return tmp;
}
#endif /* HAVE_PTHREAD_MUTEX_INIT */
Modified: gnucash/trunk/lib/libc/scm_strptime.c
===================================================================
--- gnucash/trunk/lib/libc/scm_strptime.c 2010-03-02 21:23:52 UTC (rev 18786)
+++ gnucash/trunk/lib/libc/scm_strptime.c 2010-03-02 21:40:02 UTC (rev 18787)
@@ -1,15 +1,15 @@
/* Copyright (C) 1995,1996,1997,1998, 1999, 2000 Free Software Foundation, Inc.
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
@@ -110,67 +110,67 @@
static SCM
filltime (struct tm *bd_time, int zoff, char *zname)
{
- SCM result = scm_make_vector (SCM_MAKINUM(11), SCM_UNDEFINED);
+ SCM result = scm_make_vector (SCM_MAKINUM(11), SCM_UNDEFINED);
- SCM_VELTS (result)[0] = SCM_MAKINUM (bd_time->tm_sec);
- SCM_VELTS (result)[1] = SCM_MAKINUM (bd_time->tm_min);
- SCM_VELTS (result)[2] = SCM_MAKINUM (bd_time->tm_hour);
- SCM_VELTS (result)[3] = SCM_MAKINUM (bd_time->tm_mday);
- SCM_VELTS (result)[4] = SCM_MAKINUM (bd_time->tm_mon);
- SCM_VELTS (result)[5] = SCM_MAKINUM (bd_time->tm_year);
- SCM_VELTS (result)[6] = SCM_MAKINUM (bd_time->tm_wday);
- SCM_VELTS (result)[7] = SCM_MAKINUM (bd_time->tm_yday);
- SCM_VELTS (result)[8] = SCM_MAKINUM (bd_time->tm_isdst);
- SCM_VELTS (result)[9] = SCM_MAKINUM (zoff);
- SCM_VELTS (result)[10] = zname ? scm_makfrom0str (zname) : SCM_BOOL_F;
- return result;
+ SCM_VELTS (result)[0] = SCM_MAKINUM (bd_time->tm_sec);
+ SCM_VELTS (result)[1] = SCM_MAKINUM (bd_time->tm_min);
+ SCM_VELTS (result)[2] = SCM_MAKINUM (bd_time->tm_hour);
+ SCM_VELTS (result)[3] = SCM_MAKINUM (bd_time->tm_mday);
+ SCM_VELTS (result)[4] = SCM_MAKINUM (bd_time->tm_mon);
+ SCM_VELTS (result)[5] = SCM_MAKINUM (bd_time->tm_year);
+ SCM_VELTS (result)[6] = SCM_MAKINUM (bd_time->tm_wday);
+ SCM_VELTS (result)[7] = SCM_MAKINUM (bd_time->tm_yday);
+ SCM_VELTS (result)[8] = SCM_MAKINUM (bd_time->tm_isdst);
+ SCM_VELTS (result)[9] = SCM_MAKINUM (zoff);
+ SCM_VELTS (result)[10] = zname ? scm_makfrom0str (zname) : SCM_BOOL_F;
+ return result;
}
#ifndef HAVE_STRPTIME
SCM_DEFINE (scm_strptime, "strptime", 2, 0, 0,
(SCM format, SCM string),
- "Performs the reverse action to @code{strftime}, parsing @var{string}\n"
- "according to the specification supplied in @var{template}. The\n"
- "interpretation of month and day names is dependent on the current\n"
- "locale. The\n"
- "value returned is a pair. The CAR has an object with time components \n"
- "in the form returned by @code{localtime} or @code{gmtime},\n"
- "but the time zone components\n"
- "are not usefully set.\n"
- "The CDR reports the number of characters from @var{string} which\n"
- "vwere used for the conversion.")
+ "Performs the reverse action to @code{strftime}, parsing @var{string}\n"
+ "according to the specification supplied in @var{template}. The\n"
+ "interpretation of month and day names is dependent on the current\n"
+ "locale. The\n"
+ "value returned is a pair. The CAR has an object with time components \n"
+ "in the form returned by @code{localtime} or @code{gmtime},\n"
+ "but the time zone components\n"
+ "are not usefully set.\n"
+ "The CDR reports the number of characters from @var{string} which\n"
+ "vwere used for the conversion.")
#define FUNC_NAME s_scm_strptime
{
- struct tm t;
- char *fmt, *str, *rest;
+ struct tm t;
+ char *fmt, *str, *rest;
- SCM_VALIDATE_ROSTRING (1,format);
- SCM_VALIDATE_ROSTRING (2,string);
+ SCM_VALIDATE_ROSTRING (1, format);
+ SCM_VALIDATE_ROSTRING (2, string);
- SCM_COERCE_SUBSTR (format);
- SCM_COERCE_SUBSTR (string);
- fmt = SCM_ROCHARS (format);
- str = SCM_ROCHARS (string);
+ SCM_COERCE_SUBSTR (format);
+ SCM_COERCE_SUBSTR (string);
+ fmt = SCM_ROCHARS (format);
+ str = SCM_ROCHARS (string);
- /* initialize the struct tm */
+ /* initialize the struct tm */
#define tm_init(field) t.field = 0
- tm_init (tm_sec);
- tm_init (tm_min);
- tm_init (tm_hour);
- tm_init (tm_mday);
- tm_init (tm_mon);
- tm_init (tm_year);
- tm_init (tm_wday);
- tm_init (tm_yday);
+ tm_init (tm_sec);
+ tm_init (tm_min);
+ tm_init (tm_hour);
+ tm_init (tm_mday);
+ tm_init (tm_mon);
+ tm_init (tm_year);
+ tm_init (tm_wday);
+ tm_init (tm_yday);
#undef tm_init
- t.tm_isdst = -1;
- SCM_DEFER_INTS;
- if ((rest = strptime (str, fmt, &t)) == NULL)
- SCM_SYSERROR;
+ t.tm_isdst = -1;
+ SCM_DEFER_INTS;
+ if ((rest = strptime (str, fmt, &t)) == NULL)
+ SCM_SYSERROR;
- SCM_ALLOW_INTS;
- return scm_cons (filltime (&t, 0, NULL), SCM_MAKINUM (rest - str));
+ SCM_ALLOW_INTS;
+ return scm_cons (filltime (&t, 0, NULL), SCM_MAKINUM (rest - str));
}
#undef FUNC_NAME
#endif /* HAVE_STRPTIME */
Modified: gnucash/trunk/lib/libc/setenv.c
===================================================================
--- gnucash/trunk/lib/libc/setenv.c 2010-03-02 21:23:52 UTC (rev 18786)
+++ gnucash/trunk/lib/libc/setenv.c 2010-03-02 21:40:02 UTC (rev 18787)
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -47,46 +47,46 @@
int
setenv(const char *name, const char *value, int overwrite)
{
- const char *old_value = getenv(name);
- int result = 0;
+ const char *old_value = getenv(name);
+ int result = 0;
- if ((name == NULL) || (value == NULL)) return -1;
+ if ((name == NULL) || (value == NULL)) return -1;
- if(overwrite || (!old_value))
- {
- char *new_value = g_strdup_printf("%s=%s", name, value);
- if(putenv(new_value) != 0) result = -1;
- if(old_value)
+ if (overwrite || (!old_value))
{
- /* for now, do nothing, but it would be nice if we could figure
- out a safe way to reclaim any memory that *we* allocated,
- taking in to account whether or not other code (in other
- system libs) is allowed to have cached a pointer into the
- value via getenv -- is that kosher?
-
- Also we have to *know* that we allocated the memory.
- */
+ char *new_value = g_strdup_printf("%s=%s", name, value);
+ if (putenv(new_value) != 0) result = -1;
+ if (old_value)
+ {
+ /* for now, do nothing, but it would be nice if we could figure
+ out a safe way to reclaim any memory that *we* allocated,
+ taking in to account whether or not other code (in other
+ system libs) is allowed to have cached a pointer into the
+ value via getenv -- is that kosher?
+
+ Also we have to *know* that we allocated the memory.
+ */
+ }
}
- }
- return result;
+ return result;
}
int
unsetenv(const char *name)
{
- int result = 0;
- char *putenv_str;
-
- if(name == NULL) return -1;
- if(strchr(name, '=') != NULL) return -1;
- if(*name == '\0') return -1;
-
- putenv_str = g_strdup_printf("%s=", name);
- if(!putenv_str) return -1;
+ int result = 0;
+ char *putenv_str;
- result = putenv(putenv_str);
- g_free(putenv_str);
- return result;
+ if (name == NULL) return -1;
+ if (strchr(name, '=') != NULL) return -1;
+ if (*name == '\0') return -1;
+
+ putenv_str = g_strdup_printf("%s=", name);
+ if (!putenv_str) return -1;
+
+ result = putenv(putenv_str);
+ g_free(putenv_str);
+ return result;
}
#endif
Modified: gnucash/trunk/lib/libc/setenv.h
===================================================================
--- gnucash/trunk/lib/libc/setenv.h 2010-03-02 21:23:52 UTC (rev 18786)
+++ gnucash/trunk/lib/libc/setenv.h 2010-03-02 21:40:02 UTC (rev 18787)
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Modified: gnucash/trunk/lib/libc/strptime.c
===================================================================
--- gnucash/trunk/lib/libc/strptime.c 2010-03-02 21:23:52 UTC (rev 18786)
+++ gnucash/trunk/lib/libc/strptime.c 2010-03-02 21:40:02 UTC (rev 18787)
@@ -57,147 +57,155 @@
char *
get_win32_locale_string (int lctype)
{
- int nbytes = GetLocaleInfo (GetThreadLocale (), lctype, NULL, 0);
- char *tem;
+ int nbytes = GetLocaleInfo (GetThreadLocale (), lctype, NULL, 0);
+ char *tem;
- if (nbytes == 0)
- return "???";
+ if (nbytes == 0)
+ return "???";
- tem = malloc (nbytes);
+ tem = malloc (nbytes);
- if (GetLocaleInfo (GetThreadLocale (), lctype, tem, nbytes) == 0) {
- free (tem);
- tem = malloc (4);
- strcpy (tem, "???");
- }
+ if (GetLocaleInfo (GetThreadLocale (), lctype, tem, nbytes) == 0)
+ {
+ free (tem);
+ tem = malloc (4);
+ strcpy (tem, "???");
+ }
- return tem;
+ return tem;
}
static void
append_char (char **str, int *size, int *i, char c)
{
- if (*size <= *i + 1) {
- char *new;
- *size *= 2;
- new = malloc (*size);
- strncpy (new, *str, *i);
- free (*str);
- *str = new;
- }
- (*str)[*i] = c;
- (*str)[++(*i)] = '\0';
+ if (*size <= *i + 1)
+ {
+ char *new;
+ *size *= 2;
+ new = malloc (*size);
+ strncpy (new, *str, *i);
+ free (*str);
+ *str = new;
+ }
+ (*str)[*i] = c;
+ (*str)[++(*i)] = '\0';
}
char *
translate_win32_picture (const char *picture)
{
- int size = strlen (picture) * 2;
- char *str = malloc (size);
- int i = 0;
+ int size = strlen (picture) * 2;
+ char *str = malloc (size);
+ int i = 0;
- str[0] = '\0';
+ str[0] = '\0';
- while (*picture) {
- const char *q = picture + 1;
- int count;
+ while (*picture)
+ {
+ const char *q = picture + 1;
+ int count;
- while (*picture == *q)
- q++;
- count = q - picture;
+ while (*picture == *q)
+ q++;
+ count = q - picture;
- switch (*picture) {
- case '\'':
- picture++;
- while (*picture && *picture != '\'') {
- append_char (&str, &size, &i, *picture);
- picture++;
- }
- break;
- case 'd':
- switch (count) {
- case 1:
- case 2:
- append_char (&str, &size, &i, '%');
- append_char (&str, &size, &i, 'd');
- break;
- case 3:
- case 4:
- append_char (&str, &size, &i, '%');
- append_char (&str, &size, &i, 'a');
- break;
- }
- picture += count - 1;
- break;
- case 'M':
- switch (count) {
- case 1:
- case 2:
- append_char (&str, &size, &i, '%');
- append_char (&str, &size, &i, 'm');
- break;
- case 3:
- case 4:
- append_char (&str, &size, &i, '%');
- append_char (&str, &size, &i, 'b');
- break;
- }
- picture += count - 1;
- break;
- case 'y':
- switch (count) {
- case 1: /* Last digit of year. Ugh... */
- case 2:
- append_char (&str, &size, &i, '%');
- append_char (&str, &size, &i, 'y');
- break;
- case 4:
- append_char (&str, &size, &i, '%');
- append_char (&str, &size, &i, 'Y');
- break;
- }
- picture += count - 1;
- break;
- case 'g':
- /* Era. Huh. Just ignore, as the era stuff
- * implementation below depends on glibc.
- */
- picture += count - 1;
- break;
- case 'h':
- append_char (&str, &size, &i, '%');
- append_char (&str, &size, &i, 'I');
- picture += count - 1;
- break;
- case 'H':
- append_char (&str, &size, &i, '%');
- append_char (&str, &size, &i, 'H');
- picture += count - 1;
- break;
- case 'm':
- append_char (&str, &size, &i, '%');
- append_char (&str, &size, &i, 'M');
- picture += count - 1;
- break;
- case 's':
- append_char (&str, &size, &i, '%');
- append_char (&str, &size, &i, 'S');
- picture += count - 1;
- break;
- case 't':
- append_char (&str, &size, &i, '%');
- append_char (&str, &size, &i, 'p');
- picture += count - 1;
- break;
- default:
- append_char (&str, &size, &i, *picture);
- break;
+ switch (*picture)
+ {
+ case '\'':
+ picture++;
+ while (*picture && *picture != '\'')
+ {
+ append_char (&str, &size, &i, *picture);
+ picture++;
+ }
+ break;
+ case 'd':
+ switch (count)
+ {
+ case 1:
+ case 2:
+ append_char (&str, &size, &i, '%');
+ append_char (&str, &size, &i, 'd');
+ break;
+ case 3:
+ case 4:
+ append_char (&str, &size, &i, '%');
+ append_char (&str, &size, &i, 'a');
+ break;
+ }
+ picture += count - 1;
+ break;
+ case 'M':
+ switch (count)
+ {
+ case 1:
+ case 2:
+ append_char (&str, &size, &i, '%');
+ append_char (&str, &size, &i, 'm');
+ break;
+ case 3:
+ case 4:
+ append_char (&str, &size, &i, '%');
+ append_char (&str, &size, &i, 'b');
+ break;
+ }
+ picture += count - 1;
+ break;
+ case 'y':
+ switch (count)
+ {
+ case 1: /* Last digit of year. Ugh... */
+ case 2:
+ append_char (&str, &size, &i, '%');
+ append_char (&str, &size, &i, 'y');
+ break;
+ case 4:
+ append_char (&str, &size, &i, '%');
+ append_char (&str, &size, &i, 'Y');
+ break;
+ }
+ picture += count - 1;
+ break;
+ case 'g':
+ /* Era. Huh. Just ignore, as the era stuff
+ * implementation below depends on glibc.
+ */
+ picture += count - 1;
+ break;
+ case 'h':
+ append_char (&str, &size, &i, '%');
+ append_char (&str, &size, &i, 'I');
+ picture += count - 1;
+ break;
+ case 'H':
+ append_char (&str, &size, &i, '%');
+ append_char (&str, &size, &i, 'H');
+ picture += count - 1;
+ break;
+ case 'm':
+ append_char (&str, &size, &i, '%');
+ append_char (&str, &size, &i, 'M');
+ picture += count - 1;
+ break;
+ case 's':
+ append_char (&str, &size, &i, '%');
+ append_char (&str, &size, &i, 'S');
+ picture += count - 1;
+ break;
+ case 't':
+ append_char (&str, &size, &i, '%');
+ append_char (&str, &size, &i, 'p');
+ picture += count - 1;
+ break;
+ default:
+ append_char (&str, &size, &i, *picture);
+ break;
+ }
+ if (*picture)
+ picture++;
}
- if (*picture)
- picture++;
- }
- return str;
+ return str;
}
#endif /* OS_WIN32 */
@@ -326,24 +334,24 @@
# define strncasecmp(s1, s2, n) __strncasecmp (s1, s2, n)
#else
static char const weekday_name[][10] =
- {
+{
"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"
- };
+};
static char const ab_weekday_name[][4] =
- {
+{
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
- };
+};
static char const month_name[][10] =
- {
+{
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
- };
+};
static char const ab_month_name[][4] =
- {
+{
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
- };
+};
# define HERE_D_T_FMT "%a %b %e %H:%M:%S %Y"
# define HERE_D_FMT "%m/%d/%y"
# define HERE_AM_STR "AM"
@@ -352,12 +360,12 @@
# define HERE_T_FMT "%H:%M:%S"
const unsigned short int __mon_yday[2][13] =
- {
+{
/* Normal years. */
{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
/* Leap years. */
{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
- };
+};
#endif
/* Status of lookup: do we use the locale data or the raw data? */
@@ -375,26 +383,26 @@
static void
day_of_the_week (struct tm *tm)
{
- /* We know that January 1st 1970 was a Thursday (= 4). Compute the
- the difference between this data in the one on TM and so determine
- the weekday. */
- int corr_year = 1900 + tm->tm_year - (tm->tm_mon < 2);
- int wday = (-473
- + (365 * (tm->tm_year - 70))
- + (corr_year / 4)
- - ((corr_year / 4) / 25) + ((corr_year / 4) % 25 < 0)
- + (((corr_year / 4) / 25) / 4)
- + __mon_yday[0][tm->tm_mon]
- + tm->tm_mday - 1);
- tm->tm_wday = ((wday % 7) + 7) % 7;
+ /* We know that January 1st 1970 was a Thursday (= 4). Compute the
+ the difference between this data in the one on TM and so determine
+ the weekday. */
+ int corr_year = 1900 + tm->tm_year - (tm->tm_mon < 2);
+ int wday = (-473
+ + (365 * (tm->tm_year - 70))
+ + (corr_year / 4)
+ - ((corr_year / 4) / 25) + ((corr_year / 4) % 25 < 0)
+ + (((corr_year / 4) / 25) / 4)
+ + __mon_yday[0][tm->tm_mon]
+ + tm->tm_mday - 1);
+ tm->tm_wday = ((wday % 7) + 7) % 7;
}
/* Compute the day of the year. */
static void
day_of_the_year (struct tm *tm)
{
- tm->tm_yday = (__mon_yday[__isleap (1900 + tm->tm_year)][tm->tm_mon]
- + (tm->tm_mday - 1));
+ tm->tm_yday = (__mon_yday[__isleap (1900 + tm->tm_year)][tm->tm_mon]
+ + (tm->tm_mday - 1));
}
static char *
@@ -402,976 +410,976 @@
internal_function
#endif
strptime_internal __P ((const char *rp, const char *fmt, struct tm *tm,
- enum locale_status *decided, int era_cnt));
+ enum locale_status *decided, int era_cnt));
static char *
#ifdef _LIBC
internal_function
#endif
strptime_internal (rp, fmt, tm, decided, era_cnt)
- const char *rp;
- const char *fmt;
- struct tm *tm;
- enum locale_status *decided;
- int era_cnt;
+const char *rp;
+const char *fmt;
+struct tm *tm;
+enum locale_status *decided;
+int era_cnt;
{
- const char *rp_backup;
- int cnt;
- size_t val;
- int have_I, is_pm;
- int century, want_century;
- int want_era;
- int have_wday, want_xday;
- int have_yday;
- int have_mon, have_mday;
+ const char *rp_backup;
+ int cnt;
+ size_t val;
+ int have_I, is_pm;
+ int century, want_century;
+ int want_era;
+ int have_wday, want_xday;
+ int have_yday;
+ int have_mon, have_mday;
#ifdef _NL_CURRENT
- size_t num_eras;
+ size_t num_eras;
#endif
- struct era_entry *era;
+ struct era_entry *era;
- have_I = is_pm = 0;
- century = -1;
- want_century = 0;
- want_era = 0;
- era = NULL;
+ have_I = is_pm = 0;
+ century = -1;
+ want_century = 0;
+ want_era = 0;
+ era = NULL;
- have_wday = want_xday = have_yday = have_mon = have_mday = 0;
+ have_wday = want_xday = have_yday = have_mon = have_mday = 0;
- while (*fmt != '\0')
+ while (*fmt != '\0')
{
- /* A white space in the format string matches 0 more or white
- space in the input string. */
- if (isspace (*fmt))
- {
- while (isspace (*rp))
- ++rp;
- ++fmt;
- continue;
- }
+ /* A white space in the format string matches 0 more or white
+ space in the input string. */
+ if (isspace (*fmt))
+ {
+ while (isspace (*rp))
+ ++rp;
+ ++fmt;
+ continue;
+ }
- /* Any character but `%' must be matched by the same character
- in the iput string. */
- if (*fmt != '%')
- {
- match_char (*fmt++, *rp++);
- continue;
- }
+ /* Any character but `%' must be matched by the same character
+ in the iput string. */
+ if (*fmt != '%')
+ {
+ match_char (*fmt++, *rp++);
+ continue;
+ }
- ++fmt;
+ ++fmt;
#ifndef _NL_CURRENT
- /* We need this for handling the `E' modifier. */
- start_over:
+ /* We need this for handling the `E' modifier. */
+start_over:
#endif
- /* Make back up of current processing pointer. */
- rp_backup = rp;
+ /* Make back up of current processing pointer. */
+ rp_backup = rp;
- switch (*fmt++)
- {
- case '%':
- /* Match the `%' character itself. */
- match_char ('%', *rp++);
- break;
- case 'a':
- case 'A':
- /* Match day of week. */
- for (cnt = 0; cnt < 7; ++cnt)
- {
+ switch (*fmt++)
+ {
+ case '%':
+ /* Match the `%' character itself. */
+ match_char ('%', *rp++);
+ break;
+ case 'a':
+ case 'A':
+ /* Match day of week. */
+ for (cnt = 0; cnt < 7; ++cnt)
+ {
#ifdef _NL_CURRENT
- if (*decided !=raw)
- {
- if (match_string (_NL_CURRENT (LC_TIME, DAY_1 + cnt), rp))
- {
- if (*decided == not
- && strcmp (_NL_CURRENT (LC_TIME, DAY_1 + cnt),
- weekday_name[cnt]))
- *decided = loc;
- break;
- }
- if (match_string (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt), rp))
- {
- if (*decided == not
- && strcmp (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt),
- ab_weekday_name[cnt]))
- *decided = loc;
- break;
- }
- }
+ if (*decided != raw)
+ {
+ if (match_string (_NL_CURRENT (LC_TIME, DAY_1 + cnt), rp))
+ {
+ if (*decided == not
+ && strcmp (_NL_CURRENT (LC_TIME, DAY_1 + cnt),
+ weekday_name[cnt]))
+ *decided = loc;
+ break;
+ }
+ if (match_string (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt), rp))
+ {
+ if (*decided == not
+ && strcmp (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt),
+ ab_weekday_name[cnt]))
+ *decided = loc;
+ break;
+ }
+ }
#elif defined (OS_WIN32)
- if (*decided !=raw)
- {
- char *locale_string = get_win32_locale_string (LOCALE_SDAYNAME1 + cnt);
- if (match_string (locale_string, rp))
- {
- if (*decided == not
- && strcmp (locale_string, weekday_name[cnt]))
- *decided = loc;
- free (locale_string);
- break;
- }
- free (locale_string);
- locale_string = get_win32_locale_string (LOCALE_SABBREVDAYNAME1 + cnt);
- if (match_string (locale_string, rp))
- {
- if (*decided == not
- && strcmp (locale_string, ab_weekday_name[cnt]))
- *decided = loc;
- free (locale_string);
- break;
- }
- free (locale_string);
- }
+ if (*decided != raw)
+ {
+ char *locale_string = get_win32_locale_string (LOCALE_SDAYNAME1 + cnt);
+ if (match_string (locale_string, rp))
+ {
+ if (*decided == not
+ && strcmp (locale_string, weekday_name[cnt]))
+ *decided = loc;
+ free (locale_string);
+ break;
+ }
+ free (locale_string);
+ locale_string = get_win32_locale_string (LOCALE_SABBREVDAYNAME1 + cnt);
+ if (match_string (locale_string, rp))
+ {
+ if (*decided == not
+ && strcmp (locale_string, ab_weekday_name[cnt]))
+ *decided = loc;
+ free (locale_string);
+ break;
+ }
+ free (locale_string);
+ }
#endif
- if (*decided != loc
- && (match_string (weekday_name[cnt], rp)
- || match_string (ab_weekday_name[cnt], rp)))
- {
- *decided = raw;
- break;
- }
- }
- if (cnt == 7)
- /* Does not match a weekday name. */
- return NULL;
- tm->tm_wday = cnt;
- have_wday = 1;
- break;
- case 'b':
- case 'B':
- case 'h':
- /* Match month name. */
- for (cnt = 0; cnt < 12; ++cnt)
- {
+ if (*decided != loc
+ && (match_string (weekday_name[cnt], rp)
+ || match_string (ab_weekday_name[cnt], rp)))
+ {
+ *decided = raw;
+ break;
+ }
+ }
+ if (cnt == 7)
+ /* Does not match a weekday name. */
+ return NULL;
+ tm->tm_wday = cnt;
+ have_wday = 1;
+ break;
+ case 'b':
+ case 'B':
+ case 'h':
+ /* Match month name. */
+ for (cnt = 0; cnt < 12; ++cnt)
+ {
#ifdef _NL_CURRENT
- if (*decided !=raw)
- {
- if (match_string (_NL_CURRENT (LC_TIME, MON_1 + cnt), rp))
- {
- if (*decided == not
- && strcmp (_NL_CURRENT (LC_TIME, MON_1 + cnt),
- month_name[cnt]))
- *decided = loc;
- break;
- }
- if (match_string (_NL_CURRENT (LC_TIME, ABMON_1 + cnt), rp))
- {
- if (*decided == not
- && strcmp (_NL_CURRENT (LC_TIME, ABMON_1 + cnt),
- ab_month_name[cnt]))
- *decided = loc;
- break;
- }
- }
+ if (*decided != raw)
+ {
+ if (match_string (_NL_CURRENT (LC_TIME, MON_1 + cnt), rp))
+ {
+ if (*decided == not
+ && strcmp (_NL_CURRENT (LC_TIME, MON_1 + cnt),
+ month_name[cnt]))
+ *decided = loc;
+ break;
+ }
+ if (match_string (_NL_CURRENT (LC_TIME, ABMON_1 + cnt), rp))
+ {
+ if (*decided == not
+ && strcmp (_NL_CURRENT (LC_TIME, ABMON_1 + cnt),
+ ab_month_name[cnt]))
+ *decided = loc;
+ break;
+ }
+ }
#elif defined (OS_WIN32)
- if (*decided !=raw)
- {
- char *locale_string = get_win32_locale_string (LOCALE_SMONTHNAME1 + cnt);
- if (match_string (locale_string, rp))
- {
- if (*decided == not
- && strcmp (locale_string, month_name[cnt]))
- *decided = loc;
- free (locale_string);
- break;
- }
- free (locale_string);
- locale_string = get_win32_locale_string (LOCALE_SABBREVMONTHNAME1 + cnt);
- if (match_string (locale_string, rp))
- {
- if (*decided == not
- && strcmp (locale_string, ab_month_name[cnt]))
- *decided = loc;
- free (locale_string);
- break;
- }
- free (locale_string);
- }
+ if (*decided != raw)
+ {
+ char *locale_string = get_win32_locale_string (LOCALE_SMONTHNAME1 + cnt);
+ if (match_string (locale_string, rp))
+ {
+ if (*decided == not
+ && strcmp (locale_string, month_name[cnt]))
+ *decided = loc;
+ free (locale_string);
+ break;
+ }
+ free (locale_string);
+ locale_string = get_win32_locale_string (LOCALE_SABBREVMONTHNAME1 + cnt);
+ if (match_string (locale_string, rp))
+ {
+ if (*decided == not
+ && strcmp (locale_string, ab_month_name[cnt]))
+ *decided = loc;
+ free (locale_string);
+ break;
+ }
+ free (locale_string);
+ }
#endif
- if (match_string (month_name[cnt], rp)
- || match_string (ab_month_name[cnt], rp))
- {
- *decided = raw;
- break;
- }
- }
- if (cnt == 12)
- /* Does not match a month name. */
- return NULL;
- tm->tm_mon = cnt;
- want_xday = 1;
- break;
- case 'c':
- /* Match locale's date and time format. */
+ if (match_string (month_name[cnt], rp)
+ || match_string (ab_month_name[cnt], rp))
+ {
+ *decided = raw;
+ break;
+ }
+ }
+ if (cnt == 12)
+ /* Does not match a month name. */
+ return NULL;
+ tm->tm_mon = cnt;
+ want_xday = 1;
+ break;
+ case 'c':
+ /* Match locale's date and time format. */
#ifdef _NL_CURRENT
- if (*decided != raw)
- {
- if (!recursive (_NL_CURRENT (LC_TIME, D_T_FMT)))
- {
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- if (*decided == not &&
- strcmp (_NL_CURRENT (LC_TIME, D_T_FMT), HERE_D_T_FMT))
- *decided = loc;
- want_xday = 1;
- break;
- }
- *decided = raw;
- }
+ if (*decided != raw)
+ {
+ if (!recursive (_NL_CURRENT (LC_TIME, D_T_FMT)))
+ {
+ if (*decided == loc)
+ return NULL;
+ else
+ rp = rp_backup;
+ }
+ else
+ {
+ if (*decided == not &&
+ strcmp (_NL_CURRENT (LC_TIME, D_T_FMT), HERE_D_T_FMT))
+ *decided = loc;
+ want_xday = 1;
+ break;
+ }
+ *decided = raw;
+ }
#elif defined (OS_WIN32)
- if (*decided != raw)
- {
- char *date_locale_string = get_win32_locale_string (LOCALE_SSHORTDATE);
- char *time_locale_string = get_win32_locale_string (LOCALE_STIMEFORMAT);
- int date_len = strlen (date_locale_string);
- int time_len = strlen (time_locale_string);
- char *d_t_fmt = malloc (date_len + time_len + 2);
- char *posix_d_t_fmt;
+ if (*decided != raw)
+ {
+ char *date_locale_string = get_win32_locale_string (LOCALE_SSHORTDATE);
+ char *time_locale_string = get_win32_locale_string (LOCALE_STIMEFORMAT);
+ int date_len = strlen (date_locale_string);
+ int time_len = strlen (time_locale_string);
+ char *d_t_fmt = malloc (date_len + time_len + 2);
+ char *posix_d_t_fmt;
- strncpy (d_t_fmt, date_locale_string, date_len);
- strncat (d_t_fmt, " ", 1);
- strncat (d_t_fmt, time_locale_string, time_len);
- free (date_locale_string);
- free (time_locale_string);
+ strncpy (d_t_fmt, date_locale_string, date_len);
+ strncat (d_t_fmt, " ", 1);
+ strncat (d_t_fmt, time_locale_string, time_len);
+ free (date_locale_string);
+ free (time_locale_string);
- posix_d_t_fmt = translate_win32_picture (d_t_fmt);
+ posix_d_t_fmt = translate_win32_picture (d_t_fmt);
- free (d_t_fmt);
-
- if (!recursive (posix_d_t_fmt))
- {
- if (*decided == loc)
- {
- free (posix_d_t_fmt);
- return NULL;
- }
- else
- {
- rp = rp_backup;
- }
- }
- else
- {
- if (*decided == not &&
- strcmp (posix_d_t_fmt, HERE_D_T_FMT))
- *decided = loc;
- want_xday = 1;
- free (posix_d_t_fmt);
- break;
- }
- free (posix_d_t_fmt);
- *decided = raw;
- }
+ free (d_t_fmt);
+
+ if (!recursive (posix_d_t_fmt))
+ {
+ if (*decided == loc)
+ {
+ free (posix_d_t_fmt);
+ return NULL;
+ }
+ else
+ {
+ rp = rp_backup;
+ }
+ }
+ else
+ {
+ if (*decided == not &&
+ strcmp (posix_d_t_fmt, HERE_D_T_FMT))
+ *decided = loc;
+ want_xday = 1;
+ free (posix_d_t_fmt);
+ break;
+ }
+ free (posix_d_t_fmt);
+ *decided = raw;
+ }
#endif
- if (!recursive (HERE_D_T_FMT))
- return NULL;
- want_xday = 1;
- break;
- case 'C':
- /* Match century number. */
+ if (!recursive (HERE_D_T_FMT))
+ return NULL;
+ want_xday = 1;
+ break;
+ case 'C':
+ /* Match century number. */
#ifdef _NL_CURRENT
- match_century:
+match_century:
#endif
- get_number (0, 99, 2);
- century = val;
- want_xday = 1;
- break;
- case 'd':
- case 'e':
- /* Match day of month. */
- get_number (1, 31, 2);
- tm->tm_mday = val;
- have_mday = 1;
- want_xday = 1;
- break;
- case 'F':
- if (!recursive ("%Y-%m-%d"))
- return NULL;
- want_xday = 1;
- break;
- case 'x':
+ get_number (0, 99, 2);
+ century = val;
+ want_xday = 1;
+ break;
+ case 'd':
+ case 'e':
+ /* Match day of month. */
+ get_number (1, 31, 2);
+ tm->tm_mday = val;
+ have_mday = 1;
+ want_xday = 1;
+ break;
+ case 'F':
+ if (!recursive ("%Y-%m-%d"))
+ return NULL;
+ want_xday = 1;
+ break;
+ case 'x':
#ifdef _NL_CURRENT
- if (*decided != raw)
- {
- if (!recursive (_NL_CURRENT (LC_TIME, D_FMT)))
- {
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- if (*decided == not
- && strcmp (_NL_CURRENT (LC_TIME, D_FMT), HERE_D_FMT))
- *decided = loc;
- want_xday = 1;
- break;
- }
- *decided = raw;
- }
+ if (*decided != raw)
+ {
+ if (!recursive (_NL_CURRENT (LC_TIME, D_FMT)))
+ {
+ if (*decided == loc)
+ return NULL;
+ else
+ rp = rp_backup;
+ }
+ else
+ {
+ if (*decided == not
+ && strcmp (_NL_CURRENT (LC_TIME, D_FMT), HERE_D_FMT))
+ *decided = loc;
+ want_xday = 1;
+ break;
+ }
+ *decided = raw;
+ }
#elif defined (OS_WIN32)
- if (*decided != raw)
- {
- char *locale_string = get_win32_locale_string (LOCALE_SSHORTDATE);
- char *posix_d_fmt = translate_win32_picture (locale_string);
+ if (*decided != raw)
+ {
+ char *locale_string = get_win32_locale_string (LOCALE_SSHORTDATE);
+ char *posix_d_fmt = translate_win32_picture (locale_string);
- free (locale_string);
+ free (locale_string);
- if (!recursive (posix_d_fmt))
- {
- if (*decided == loc)
- {
- free(posix_d_fmt);
- return NULL;
- }
- else
- {
- rp = rp_backup;
- }
- }
- else
- {
- if (*decided == not
- && strcmp (posix_d_fmt, HERE_D_FMT))
- *decided = loc;
- want_xday = 1;
- free(posix_d_fmt);
- break;
- }
- free(posix_d_fmt);
- *decided = raw;
- }
+ if (!recursive (posix_d_fmt))
+ {
+ if (*decided == loc)
+ {
+ free(posix_d_fmt);
+ return NULL;
+ }
+ else
+ {
+ rp = rp_backup;
+ }
+ }
+ else
+ {
+ if (*decided == not
+ && strcmp (posix_d_fmt, HERE_D_FMT))
+ *decided = loc;
+ want_xday = 1;
+ free(posix_d_fmt);
+ break;
+ }
+ free(posix_d_fmt);
+ *decided = raw;
+ }
#endif
- /* Fall through. */
- case 'D':
- /* Match standard day format. */
- if (!recursive (HERE_D_FMT))
- return NULL;
- want_xday = 1;
- break;
- case 'k':
- case 'H':
- /* Match hour in 24-hour clock. */
- get_number (0, 23, 2);
- tm->tm_hour = val;
- have_I = 0;
- break;
- case 'I':
- /* Match hour in 12-hour clock. */
- get_number (1, 12, 2);
- tm->tm_hour = val % 12;
- have_I = 1;
- break;
- case 'j':
- /* Match day number of year. */
- get_number (1, 366, 3);
- tm->tm_yday = val - 1;
- have_yday = 1;
- break;
- case 'm':
- /* Match number of month. */
- get_number (1, 12, 2);
- tm->tm_mon = val - 1;
- have_mon = 1;
- want_xday = 1;
- break;
- case 'M':
- /* Match minute. */
- get_number (0, 59, 2);
- tm->tm_min = val;
- break;
- case 'n':
- case 't':
- /* Match any white space. */
- while (isspace (*rp))
- ++rp;
- break;
- case 'p':
- /* Match locale's equivalent of AM/PM. */
+ /* Fall through. */
+ case 'D':
+ /* Match standard day format. */
+ if (!recursive (HERE_D_FMT))
+ return NULL;
+ want_xday = 1;
+ break;
+ case 'k':
+ case 'H':
+ /* Match hour in 24-hour clock. */
+ get_number (0, 23, 2);
+ tm->tm_hour = val;
+ have_I = 0;
+ break;
+ case 'I':
+ /* Match hour in 12-hour clock. */
+ get_number (1, 12, 2);
+ tm->tm_hour = val % 12;
+ have_I = 1;
+ break;
+ case 'j':
+ /* Match day number of year. */
+ get_number (1, 366, 3);
+ tm->tm_yday = val - 1;
+ have_yday = 1;
+ break;
+ case 'm':
+ /* Match number of month. */
+ get_number (1, 12, 2);
+ tm->tm_mon = val - 1;
+ have_mon = 1;
+ want_xday = 1;
+ break;
+ case 'M':
+ /* Match minute. */
+ get_number (0, 59, 2);
+ tm->tm_min = val;
+ break;
+ case 'n':
+ case 't':
+ /* Match any white space. */
+ while (isspace (*rp))
+ ++rp;
+ break;
+ case 'p':
+ /* Match locale's equivalent of AM/PM. */
#ifdef _NL_CURRENT
- if (*decided != raw)
- {
- if (match_string (_NL_CURRENT (LC_TIME, AM_STR), rp))
- {
- if (strcmp (_NL_CURRENT (LC_TIME, AM_STR), HERE_AM_STR))
- *decided = loc;
- break;
- }
- if (match_string (_NL_CURRENT (LC_TIME, PM_STR), rp))
- {
- if (strcmp (_NL_CURRENT (LC_TIME, PM_STR), HERE_PM_STR))
- *decided = loc;
- is_pm = 1;
- break;
- }
- *decided = raw;
- }
+ if (*decided != raw)
+ {
+ if (match_string (_NL_CURRENT (LC_TIME, AM_STR), rp))
+ {
+ if (strcmp (_NL_CURRENT (LC_TIME, AM_STR), HERE_AM_STR))
+ *decided = loc;
+ break;
+ }
+ if (match_string (_NL_CURRENT (LC_TIME, PM_STR), rp))
+ {
+ if (strcmp (_NL_CURRENT (LC_TIME, PM_STR), HERE_PM_STR))
+ *decided = loc;
+ is_pm = 1;
+ break;
+ }
+ *decided = raw;
+ }
#elif defined (OS_WIN32)
- if (*decided != raw)
- {
- char *locale_string = get_win32_locale_string (LOCALE_S1159);
- if (match_string (locale_string, rp))
- {
- if (strcmp (locale_string, HERE_AM_STR))
- *decided = loc;
- free (locale_string);
- break;
- }
- free (locale_string);
- locale_string = get_win32_locale_string (LOCALE_S2359);
- if (match_string (locale_string, rp))
- {
- if (strcmp (locale_string, HERE_PM_STR))
- *decided = loc;
- is_pm = 1;
- free (locale_string);
- break;
- }
- *decided = raw;
- free (locale_string);
- }
+ if (*decided != raw)
+ {
+ char *locale_string = get_win32_locale_string (LOCALE_S1159);
+ if (match_string (locale_string, rp))
+ {
+ if (strcmp (locale_string, HERE_AM_STR))
+ *decided = loc;
+ free (locale_string);
+ break;
+ }
+ free (locale_string);
+ locale_string = get_win32_locale_string (LOCALE_S2359);
+ if (match_string (locale_string, rp))
+ {
+ if (strcmp (locale_string, HERE_PM_STR))
+ *decided = loc;
+ is_pm = 1;
+ free (locale_string);
+ break;
+ }
+ *decided = raw;
+ free (locale_string);
+ }
#endif
- if (!match_string (HERE_AM_STR, rp))
- if (match_string (HERE_PM_STR, rp))
- is_pm = 1;
- else
- return NULL;
- break;
- case 'r':
+ if (!match_string (HERE_AM_STR, rp))
+ if (match_string (HERE_PM_STR, rp))
+ is_pm = 1;
+ else
+ return NULL;
+ break;
+ case 'r':
#ifdef _NL_CURRENT
- if (*decided != raw)
- {
- if (!recursive (_NL_CURRENT (LC_TIME, T_FMT_AMPM)))
- {
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- if (*decided == not &&
- strcmp (_NL_CURRENT (LC_TIME, T_FMT_AMPM),
- HERE_T_FMT_AMPM))
- *decided = loc;
- break;
- }
- *decided = raw;
- }
+ if (*decided != raw)
+ {
+ if (!recursive (_NL_CURRENT (LC_TIME, T_FMT_AMPM)))
+ {
+ if (*decided == loc)
+ return NULL;
+ else
+ rp = rp_backup;
+ }
+ else
+ {
+ if (*decided == not &&
+ strcmp (_NL_CURRENT (LC_TIME, T_FMT_AMPM),
+ HERE_T_FMT_AMPM))
+ *decided = loc;
+ break;
+ }
+ *decided = raw;
+ }
#elif defined (OS_WIN32)
- if (*decided != raw)
- {
- char *locale_string = get_win32_locale_string (LOCALE_STIMEFORMAT);
- int locale_len = strlen (locale_string);
- char *t_p_fmt = malloc (locale_len + 4);
- char *posix_t_p_fmt;
+ if (*decided != raw)
+ {
+ char *locale_string = get_win32_locale_string (LOCALE_STIMEFORMAT);
+ int locale_len = strlen (locale_string);
+ char *t_p_fmt = malloc (locale_len + 4);
+ char *posix_t_p_fmt;
- strncpy (t_p_fmt, locale_string, locale_len);
- strncat (t_p_fmt, " tt", 3);
+ strncpy (t_p_fmt, locale_string, locale_len);
+ strncat (t_p_fmt, " tt", 3);
- posix_t_p_fmt = translate_win32_picture (t_p_fmt);
+ posix_t_p_fmt = translate_win32_picture (t_p_fmt);
- free (t_p_fmt);
+ free (t_p_fmt);
- if (!recursive (posix_t_p_fmt))
- {
- if (*decided == loc)
- {
- free (posix_t_p_fmt);
- return NULL;
- }
- else
- {
- rp = rp_backup;
- }
- }
- else
- {
- if (*decided == not &&
- strcmp (posix_t_p_fmt,
- HERE_T_FMT_AMPM))
- *decided = loc;
- free (posix_t_p_fmt);
- break;
- }
- free (posix_t_p_fmt);
- *decided = raw;
- }
+ if (!recursive (posix_t_p_fmt))
+ {
+ if (*decided == loc)
+ {
+ free (posix_t_p_fmt);
+ return NULL;
+ }
+ else
+ {
+ rp = rp_backup;
+ }
+ }
+ else
+ {
+ if (*decided == not &&
+ strcmp (posix_t_p_fmt,
+ HERE_T_FMT_AMPM))
+ *decided = loc;
+ free (posix_t_p_fmt);
+ break;
+ }
+ free (posix_t_p_fmt);
+ *decided = raw;
+ }
#endif
- if (!recursive (HERE_T_FMT_AMPM))
- return NULL;
- break;
- case 'R':
- if (!recursive ("%H:%M"))
- return NULL;
- break;
- case 's':
- {
- /* The number of seconds may be very high so we cannot use
- the `get_number' macro. Instead read the number
- character for character and construct the result while
- doing this. */
- time_t secs = 0;
- if (*rp < '0' || *rp > '9')
- /* We need at least one digit. */
- return NULL;
+ if (!recursive (HERE_T_FMT_AMPM))
+ return NULL;
+ break;
+ case 'R':
+ if (!recursive ("%H:%M"))
+ return NULL;
+ break;
+ case 's':
+ {
+ /* The number of seconds may be very high so we cannot use
+ the `get_number' macro. Instead read the number
+ character for character and construct the result while
+ doing this. */
+ time_t secs = 0;
+ if (*rp < '0' || *rp > '9')
+ /* We need at least one digit. */
+ return NULL;
- do
- {
- secs *= 10;
- secs += *rp++ - '0';
- }
- while (*rp >= '0' && *rp <= '9');
+ do
+ {
+ secs *= 10;
+ secs += *rp++ - '0';
+ }
+ while (*rp >= '0' && *rp <= '9');
- if (localtime_r (&secs, tm) == NULL)
- /* Error in function. */
- return NULL;
- }
- break;
- case 'S':
- get_number (0, 61, 2);
- tm->tm_sec = val;
- break;
- case 'X':
+ if (localtime_r (&secs, tm) == NULL)
+ /* Error in function. */
+ return NULL;
+ }
+ break;
+ case 'S':
+ get_number (0, 61, 2);
+ tm->tm_sec = val;
+ break;
+ case 'X':
#ifdef _NL_CURRENT
- if (*decided != raw)
- {
- if (!recursive (_NL_CURRENT (LC_TIME, T_FMT)))
- {
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- if (strcmp (_NL_CURRENT (LC_TIME, T_FMT), HERE_T_FMT))
- *decided = loc;
- break;
- }
- *decided = raw;
- }
+ if (*decided != raw)
+ {
+ if (!recursive (_NL_CURRENT (LC_TIME, T_FMT)))
+ {
+ if (*decided == loc)
+ return NULL;
+ else
+ rp = rp_backup;
+ }
+ else
+ {
+ if (strcmp (_NL_CURRENT (LC_TIME, T_FMT), HERE_T_FMT))
+ *decided = loc;
+ break;
+ }
+ *decided = raw;
+ }
#elif defined (OS_WIN32)
- if (*decided != raw)
- {
- char *locale_string = get_win32_locale_string (LOCALE_STIMEFORMAT);
- char *posix_t_fmt = translate_win32_picture (locale_string);
+ if (*decided != raw)
+ {
+ char *locale_string = get_win32_locale_string (LOCALE_STIMEFORMAT);
+ char *posix_t_fmt = translate_win32_picture (locale_string);
- free (locale_string);
+ free (locale_string);
- if (!recursive (posix_t_fmt))
- {
- if (*decided == loc)
- {
- free (posix_t_fmt);
- return NULL;
- }
- else
- {
- rp = rp_backup;
- }
- }
- else
- {
- if (strcmp (posix_t_fmt, HERE_T_FMT))
- *decided = loc;
- free (posix_t_fmt);
- break;
- }
- free (posix_t_fmt);
- *decided = raw;
- }
+ if (!recursive (posix_t_fmt))
+ {
+ if (*decided == loc)
+ {
+ free (posix_t_fmt);
+ return NULL;
+ }
+ else
+ {
+ rp = rp_backup;
+ }
+ }
+ else
+ {
+ if (strcmp (posix_t_fmt, HERE_T_FMT))
+ *decided = loc;
+ free (posix_t_fmt);
+ break;
+ }
+ free (posix_t_fmt);
+ *decided = raw;
+ }
#endif
- /* Fall through. */
- case 'T':
- if (!recursive (HERE_T_FMT))
- return NULL;
- break;
- case 'u':
- get_number (1, 7, 1);
- tm->tm_wday = val % 7;
- have_wday = 1;
- break;
- case 'g':
- get_number (0, 99, 2);
- /* XXX This cannot determine any field in TM. */
- break;
- case 'G':
- if (*rp < '0' || *rp > '9')
- return NULL;
- /* XXX Ignore the number since we would need some more
- information to compute a real date. */
- do
- ++rp;
- while (*rp >= '0' && *rp <= '9');
- break;
- case 'U':
- case 'V':
- case 'W':
- get_number (0, 53, 2);
- /* XXX This cannot determine any field in TM without some
- information. */
- break;
- case 'w':
- /* Match number of weekday. */
- get_number (0, 6, 1);
- tm->tm_wday = val;
- have_wday = 1;
- break;
- case 'y':
+ /* Fall through. */
+ case 'T':
+ if (!recursive (HERE_T_FMT))
+ return NULL;
+ break;
+ case 'u':
+ get_number (1, 7, 1);
+ tm->tm_wday = val % 7;
+ have_wday = 1;
+ break;
+ case 'g':
+ get_number (0, 99, 2);
+ /* XXX This cannot determine any field in TM. */
+ break;
+ case 'G':
+ if (*rp < '0' || *rp > '9')
+ return NULL;
+ /* XXX Ignore the number since we would need some more
+ information to compute a real date. */
+ do
+ ++rp;
+ while (*rp >= '0' && *rp <= '9');
+ break;
+ case 'U':
+ case 'V':
+ case 'W':
+ get_number (0, 53, 2);
+ /* XXX This cannot determine any field in TM without some
+ information. */
+ break;
+ case 'w':
+ /* Match number of weekday. */
+ get_number (0, 6, 1);
+ tm->tm_wday = val;
+ have_wday = 1;
+ break;
+ case 'y':
#ifdef _NL_CURRENT
- match_year_in_century:
+match_year_in_century:
#endif
- /* Match year within century. */
- get_number (0, 99, 2);
- /* The "Year 2000: The Millennium Rollover" paper suggests that
- values in the range 69-99 refer to the twentieth century. */
- tm->tm_year = val >= 69 ? val : val + 100;
- /* Indicate that we want to use the century, if specified. */
- want_century = 1;
- want_xday = 1;
- break;
- case 'Y':
- /* Match year including century number. */
- get_number (0, 9999, 4);
- tm->tm_year = val - 1900;
- want_century = 0;
- want_xday = 1;
- break;
- case 'Z':
- /* XXX How to handle this? */
- break;
- case 'E':
+ /* Match year within century. */
+ get_number (0, 99, 2);
+ /* The "Year 2000: The Millennium Rollover" paper suggests that
+ values in the range 69-99 refer to the twentieth century. */
+ tm->tm_year = val >= 69 ? val : val + 100;
+ /* Indicate that we want to use the century, if specified. */
+ want_century = 1;
+ want_xday = 1;
+ break;
+ case 'Y':
+ /* Match year including century number. */
+ get_number (0, 9999, 4);
+ tm->tm_year = val - 1900;
+ want_century = 0;
+ want_xday = 1;
+ break;
+ case 'Z':
+ /* XXX How to handle this? */
+ break;
+ case 'E':
#ifdef _NL_CURRENT
- switch (*fmt++)
- {
- case 'c':
- /* Match locale's alternate date and time format. */
- if (*decided != raw)
- {
- const char *fmt = _NL_CURRENT (LC_TIME, ERA_D_T_FMT);
+ switch (*fmt++)
+ {
+ case 'c':
+ /* Match locale's alternate date and time format. */
+ if (*decided != raw)
+ {
+ const char *fmt = _NL_CURRENT (LC_TIME, ERA_D_T_FMT);
- if (*fmt == '\0')
- fmt = _NL_CURRENT (LC_TIME, D_T_FMT);
+ if (*fmt == '\0')
+ fmt = _NL_CURRENT (LC_TIME, D_T_FMT);
- if (!recursive (fmt))
- {
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- if (strcmp (fmt, HERE_D_T_FMT))
- *decided = loc;
- want_xday = 1;
- break;
- }
- *decided = raw;
- }
- /* The C locale has no era information, so use the
- normal representation. */
- if (!recursive (HERE_D_T_FMT))
- return NULL;
- want_xday = 1;
- break;
- case 'C':
- if (*decided != raw)
- {
- if (era_cnt >= 0)
- {
- era = _nl_select_era_entry (era_cnt);
- if (match_string (era->era_name, rp))
- {
- *decided = loc;
- break;
- }
- else
- return NULL;
- }
- else
- {
- num_eras = _NL_CURRENT_WORD (LC_TIME,
- _NL_TIME_ERA_NUM_ENTRIES);
- for (era_cnt = 0; era_cnt < (int) num_eras;
- ++era_cnt, rp = rp_backup)
- {
- era = _nl_select_era_entry (era_cnt);
- if (match_string (era->era_name, rp))
- {
- *decided = loc;
- break;
- }
- }
- if (era_cnt == (int) num_eras)
- {
- era_cnt = -1;
- if (*decided == loc)
- return NULL;
- }
- else
- break;
- }
+ if (!recursive (fmt))
+ {
+ if (*decided == loc)
+ return NULL;
+ else
+ rp = rp_backup;
+ }
+ else
+ {
+ if (strcmp (fmt, HERE_D_T_FMT))
+ *decided = loc;
+ want_xday = 1;
+ break;
+ }
+ *decided = raw;
+ }
+ /* The C locale has no era information, so use the
+ normal representation. */
+ if (!recursive (HERE_D_T_FMT))
+ return NULL;
+ want_xday = 1;
+ break;
+ case 'C':
+ if (*decided != raw)
+ {
+ if (era_cnt >= 0)
+ {
+ era = _nl_select_era_entry (era_cnt);
+ if (match_string (era->era_name, rp))
+ {
+ *decided = loc;
+ break;
+ }
+ else
+ return NULL;
+ }
+ else
+ {
+ num_eras = _NL_CURRENT_WORD (LC_TIME,
+ _NL_TIME_ERA_NUM_ENTRIES);
+ for (era_cnt = 0; era_cnt < (int) num_eras;
+ ++era_cnt, rp = rp_backup)
+ {
+ era = _nl_select_era_entry (era_cnt);
+ if (match_string (era->era_name, rp))
+ {
+ *decided = loc;
+ break;
+ }
+ }
+ if (era_cnt == (int) num_eras)
+ {
+ era_cnt = -1;
+ if (*decided == loc)
+ return NULL;
+ }
+ else
+ break;
+ }
- *decided = raw;
- }
- /* The C locale has no era information, so use the
- normal representation. */
- goto match_century;
- case 'y':
- if (*decided == raw)
- goto match_year_in_century;
+ *decided = raw;
+ }
+ /* The C locale has no era information, so use the
+ normal representation. */
+ goto match_century;
+ case 'y':
+ if (*decided == raw)
+ goto match_year_in_century;
- get_number(0, 9999, 4);
- tm->tm_year = val;
- want_era = 1;
- want_xday = 1;
- break;
- case 'Y':
- if (*decided != raw)
- {
- num_eras = _NL_CURRENT_WORD (LC_TIME,
- _NL_TIME_ERA_NUM_ENTRIES);
- for (era_cnt = 0; era_cnt < (int) num_eras;
- ++era_cnt, rp = rp_backup)
- {
- era = _nl_select_era_entry (era_cnt);
- if (recursive (era->era_format))
- break;
- }
- if (era_cnt == (int) num_eras)
- {
- era_cnt = -1;
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- *decided = loc;
- era_cnt = -1;
- break;
- }
+ get_number(0, 9999, 4);
+ tm->tm_year = val;
+ want_era = 1;
+ want_xday = 1;
+ break;
+ case 'Y':
+ if (*decided != raw)
+ {
+ num_eras = _NL_CURRENT_WORD (LC_TIME,
+ _NL_TIME_ERA_NUM_ENTRIES);
+ for (era_cnt = 0; era_cnt < (int) num_eras;
+ ++era_cnt, rp = rp_backup)
+ {
+ era = _nl_select_era_entry (era_cnt);
+ if (recursive (era->era_format))
+ break;
+ }
+ if (era_cnt == (int) num_eras)
+ {
+ era_cnt = -1;
+ if (*decided == loc)
+ return NULL;
+ else
+ rp = rp_backup;
+ }
+ else
+ {
+ *decided = loc;
+ era_cnt = -1;
+ break;
+ }
- *decided = raw;
- }
- get_number (0, 9999, 4);
- tm->tm_year = val - 1900;
- want_century = 0;
- want_xday = 1;
- break;
- case 'x':
- if (*decided != raw)
- {
- const char *fmt = _NL_CURRENT (LC_TIME, ERA_D_FMT);
+ *decided = raw;
+ }
+ get_number (0, 9999, 4);
+ tm->tm_year = val - 1900;
+ want_century = 0;
+ want_xday = 1;
+ break;
+ case 'x':
+ if (*decided != raw)
+ {
+ const char *fmt = _NL_CURRENT (LC_TIME, ERA_D_FMT);
- if (*fmt == '\0')
- fmt = _NL_CURRENT (LC_TIME, D_FMT);
+ if (*fmt == '\0')
+ fmt = _NL_CURRENT (LC_TIME, D_FMT);
- if (!recursive (fmt))
- {
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- if (strcmp (fmt, HERE_D_FMT))
- *decided = loc;
- break;
- }
- *decided = raw;
- }
- if (!recursive (HERE_D_FMT))
- return NULL;
- break;
- case 'X':
- if (*decided != raw)
- {
- const char *fmt = _NL_CURRENT (LC_TIME, ERA_T_FMT);
+ if (!recursive (fmt))
+ {
+ if (*decided == loc)
+ return NULL;
+ else
+ rp = rp_backup;
+ }
+ else
+ {
+ if (strcmp (fmt, HERE_D_FMT))
+ *decided = loc;
+ break;
+ }
+ *decided = raw;
+ }
+ if (!recursive (HERE_D_FMT))
+ return NULL;
+ break;
+ case 'X':
+ if (*decided != raw)
+ {
+ const char *fmt = _NL_CURRENT (LC_TIME, ERA_T_FMT);
- if (*fmt == '\0')
- fmt = _NL_CURRENT (LC_TIME, T_FMT);
+ if (*fmt == '\0')
+ fmt = _NL_CURRENT (LC_TIME, T_FMT);
- if (!recursive (fmt))
- {
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- if (strcmp (fmt, HERE_T_FMT))
- *decided = loc;
- break;
- }
- *decided = raw;
- }
- if (!recursive (HERE_T_FMT))
- return NULL;
- break;
- default:
- return NULL;
- }
- break;
+ if (!recursive (fmt))
+ {
+ if (*decided == loc)
+ return NULL;
+ else
+ rp = rp_backup;
+ }
+ else
+ {
+ if (strcmp (fmt, HERE_T_FMT))
+ *decided = loc;
+ break;
+ }
+ *decided = raw;
+ }
+ if (!recursive (HERE_T_FMT))
+ return NULL;
+ break;
+ default:
+ return NULL;
+ }
+ break;
#else
- /* We have no information about the era format. Just use
- the normal format. */
- if (*fmt != 'c' && *fmt != 'C' && *fmt != 'y' && *fmt != 'Y'
- && *fmt != 'x' && *fmt != 'X')
- /* This is an illegal format. */
- return NULL;
+ /* We have no information about the era format. Just use
+ the normal format. */
+ if (*fmt != 'c' && *fmt != 'C' && *fmt != 'y' && *fmt != 'Y'
+ && *fmt != 'x' && *fmt != 'X')
+ /* This is an illegal format. */
+ return NULL;
- goto start_over;
+ goto start_over;
#endif
- case 'O':
- switch (*fmt++)
- {
- case 'd':
- case 'e':
- /* Match day of month using alternate numeric symbols. */
- get_alt_number (1, 31, 2);
- tm->tm_mday = val;
- have_mday = 1;
- want_xday = 1;
- break;
- case 'H':
- /* Match hour in 24-hour clock using alternate numeric
- symbols. */
- get_alt_number (0, 23, 2);
- tm->tm_hour = val;
- have_I = 0;
- break;
- case 'I':
- /* Match hour in 12-hour clock using alternate numeric
- symbols. */
- get_alt_number (1, 12, 2);
- tm->tm_hour = val - 1;
- have_I = 1;
- break;
- case 'm':
- /* Match month using alternate numeric symbols. */
- get_alt_number (1, 12, 2);
- tm->tm_mon = val - 1;
- have_mon = 1;
- want_xday = 1;
- break;
- case 'M':
- /* Match minutes using alternate numeric symbols. */
- get_alt_number (0, 59, 2);
- tm->tm_min = val;
- break;
- case 'S':
- /* Match seconds using alternate numeric symbols. */
- get_alt_number (0, 61, 2);
- tm->tm_sec = val;
- break;
- case 'U':
- case 'V':
- case 'W':
- get_alt_number (0, 53, 2);
- /* XXX This cannot determine any field in TM without
- further information. */
- break;
- case 'w':
- /* Match number of weekday using alternate numeric symbols. */
- get_alt_number (0, 6, 1);
- tm->tm_wday = val;
- have_wday = 1;
- break;
- case 'y':
- /* Match year within century using alternate numeric symbols. */
- get_alt_number (0, 99, 2);
- tm->tm_year = val >= 69 ? val : val + 100;
- want_xday = 1;
- break;
- default:
- return NULL;
- }
- break;
- default:
- return NULL;
- }
+ case 'O':
+ switch (*fmt++)
+ {
+ case 'd':
+ case 'e':
+ /* Match day of month using alternate numeric symbols. */
+ get_alt_number (1, 31, 2);
+ tm->tm_mday = val;
+ have_mday = 1;
+ want_xday = 1;
+ break;
+ case 'H':
+ /* Match hour in 24-hour clock using alternate numeric
+ symbols. */
+ get_alt_number (0, 23, 2);
+ tm->tm_hour = val;
+ have_I = 0;
+ break;
+ case 'I':
+ /* Match hour in 12-hour clock using alternate numeric
+ symbols. */
+ get_alt_number (1, 12, 2);
+ tm->tm_hour = val - 1;
+ have_I = 1;
+ break;
+ case 'm':
+ /* Match month using alternate numeric symbols. */
+ get_alt_number (1, 12, 2);
+ tm->tm_mon = val - 1;
+ have_mon = 1;
+ want_xday = 1;
+ break;
+ case 'M':
+ /* Match minutes using alternate numeric symbols. */
+ get_alt_number (0, 59, 2);
+ tm->tm_min = val;
+ break;
+ case 'S':
+ /* Match seconds using alternate numeric symbols. */
+ get_alt_number (0, 61, 2);
+ tm->tm_sec = val;
+ break;
+ case 'U':
+ case 'V':
+ case 'W':
+ get_alt_number (0, 53, 2);
+ /* XXX This cannot determine any field in TM without
+ further information. */
+ break;
+ case 'w':
+ /* Match number of weekday using alternate numeric symbols. */
+ get_alt_number (0, 6, 1);
+ tm->tm_wday = val;
+ have_wday = 1;
+ break;
+ case 'y':
+ /* Match year within century using alternate numeric symbols. */
+ get_alt_number (0, 99, 2);
+ tm->tm_year = val >= 69 ? val : val + 100;
+ want_xday = 1;
+ break;
+ default:
+ return NULL;
+ }
+ break;
+ default:
+ return NULL;
+ }
}
- if (have_I && is_pm)
- tm->tm_hour += 12;
+ if (have_I && is_pm)
+ tm->tm_hour += 12;
- if (century != -1)
+ if (century != -1)
{
- if (want_century)
- tm->tm_year = tm->tm_year % 100 + (century - 19) * 100;
- else
- /* Only the century, but not the year. Strange, but so be it. */
- tm->tm_year = (century - 19) * 100;
+ if (want_century)
+ tm->tm_year = tm->tm_year % 100 + (century - 19) * 100;
+ else
+ /* Only the century, but not the year. Strange, but so be it. */
+ tm->tm_year = (century - 19) * 100;
}
#ifdef _NL_CURRENT
- if (era_cnt != -1)
+ if (era_cnt != -1)
{
- era = _nl_select_era_entry(era_cnt);
- if (want_era)
- tm->tm_year = (era->start_date[0]
- + ((tm->tm_year - era->offset)
- * era->absolute_direction));
- else
- /* Era start year assumed. */
- tm->tm_year = era->start_date[0];
+ era = _nl_select_era_entry(era_cnt);
+ if (want_era)
+ tm->tm_year = (era->start_date[0]
+ + ((tm->tm_year - era->offset)
+ * era->absolute_direction));
+ else
+ /* Era start year assumed. */
+ tm->tm_year = era->start_date[0];
}
- else
+ else
#endif
- if (want_era)
- return NULL;
+ if (want_era)
+ return NULL;
- if (want_xday && !have_wday)
+ if (want_xday && !have_wday)
{
- if ( !(have_mon && have_mday) && have_yday)
- {
- /* We don't have tm_mon and/or tm_mday, compute them. */
- int t_mon = 0;
- while (__mon_yday[__isleap(1900 + tm->tm_year)][t_mon] <= tm->tm_yday)
- t_mon++;
- if (!have_mon)
- tm->tm_mon = t_mon - 1;
- if (!have_mday)
- tm->tm_mday =
- (tm->tm_yday
- - __mon_yday[__isleap(1900 + tm->tm_year)][t_mon - 1] + 1);
- }
- day_of_the_week (tm);
+ if ( !(have_mon && have_mday) && have_yday)
+ {
+ /* We don't have tm_mon and/or tm_mday, compute them. */
+ int t_mon = 0;
+ while (__mon_yday[__isleap(1900 + tm->tm_year)][t_mon] <= tm->tm_yday)
+ t_mon++;
+ if (!have_mon)
+ tm->tm_mon = t_mon - 1;
+ if (!have_mday)
+ tm->tm_mday =
+ (tm->tm_yday
+ - __mon_yday[__isleap(1900 + tm->tm_year)][t_mon - 1] + 1);
+ }
+ day_of_the_week (tm);
}
- if (want_xday && !have_yday)
- day_of_the_year (tm);
+ if (want_xday && !have_yday)
+ day_of_the_year (tm);
- return (char *) rp;
+ return (char *) rp;
}
char *
strptime (buf, format, tm)
- const char *buf;
- const char *format;
- struct tm *tm;
+const char *buf;
+const char *format;
+struct tm *tm;
{
- enum locale_status decided;
+ enum locale_status decided;
#ifdef _NL_CURRENT
- decided = not;
+ decided = not;
#elif defined (OS_WIN32)
- decided = not;
+ decided = not;
#else
- decided = raw;
+ decided = raw;
#endif
- return strptime_internal (buf, format, tm, &decided, -1);
+ return strptime_internal (buf, format, tm, &decided, -1);
}
#endif /* !HAVE_STRPTIME */
Modified: gnucash/trunk/lib/libc/strptime.h
===================================================================
--- gnucash/trunk/lib/libc/strptime.h 2010-03-02 21:23:52 UTC (rev 18786)
+++ gnucash/trunk/lib/libc/strptime.h 2010-03-02 21:40:02 UTC (rev 18787)
@@ -10,12 +10,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
Modified: gnucash/trunk/src/RecnWindow.h
===================================================================
--- gnucash/trunk/src/RecnWindow.h 2010-03-02 21:23:52 UTC (rev 18786)
+++ gnucash/trunk/src/RecnWindow.h 2010-03-02 21:40:02 UTC (rev 18787)
@@ -50,20 +50,20 @@
RecnWindow *recnWindow (gncUIWidget parent, Account *account);
/********************************************************************\
- * recnWindowWithBalance
+ * recnWindowWithBalance
*
* Opens up the window to reconcile an account, but with ending
* balance and statement date already given.
- *
+ *
* Args: parent - The parent widget of the new window
- * account - The account to reconcile
- * new_ending - The amount for ending balance
- * statement_date - The date of the statement
+ * account - The account to reconcile
+ * new_ending - The amount for ending balance
+ * statement_date - The date of the statement
* Return: recnData - the instance of this RecnWindow
\********************************************************************/
-RecnWindow *recnWindowWithBalance (GtkWidget *parent,
- Account *account,
- gnc_numeric new_ending,
- time_t statement_date);
+RecnWindow *recnWindowWithBalance (GtkWidget *parent,
+ Account *account,
+ gnc_numeric new_ending,
+ time_t statement_date);
#endif
Modified: gnucash/trunk/src/app-utils/gnc-sx-instance-model.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-sx-instance-model.c 2010-03-02 21:23:52 UTC (rev 18786)
+++ gnucash/trunk/src/app-utils/gnc-sx-instance-model.c 2010-03-02 21:40:02 UTC (rev 18787)
@@ -339,7 +339,7 @@
static gint
_compare_GncSxVariables(gconstpointer a, gconstpointer b)
{
- return strcmp(((const GncSxVariable*)a)->name, ((const GncSxVariable*)b)->name);
+ return strcmp(((const GncSxVariable*)a)->name, ((const GncSxVariable*)b)->name);
}
static void
Modified: gnucash/trunk/src/backend/xml/gnc-backend-xml.c
===================================================================
--- gnucash/trunk/src/backend/xml/gnc-backend-xml.c 2010-03-02 21:23:52 UTC (rev 18786)
+++ gnucash/trunk/src/backend/xml/gnc-backend-xml.c 2010-03-02 21:40:02 UTC (rev 18787)
@@ -243,9 +243,9 @@
rc = g_stat (be->dirname, &statbuf);
if (rc != 0
#ifndef _MSC_VER
- || !S_ISDIR(statbuf.st_mode)
+ || !S_ISDIR(statbuf.st_mode)
#endif
- )
+ )
{
/* Error on stat or if it isn't a directory means we
cannot find this filename */
@@ -273,9 +273,9 @@
}
if (rc == 0
#ifndef _MSC_VER
- && S_ISDIR(statbuf.st_mode)
+ && S_ISDIR(statbuf.st_mode)
#endif
- )
+ )
{
/* FIXME: What is actually checked here? Whether the
fullpath erroneously points to a directory or what?
Modified: gnucash/trunk/src/gnc-ui.h
===================================================================
--- gnucash/trunk/src/gnc-ui.h 2010-03-02 21:23:52 UTC (rev 18786)
+++ gnucash/trunk/src/gnc-ui.h 2010-03-02 21:40:02 UTC (rev 18787)
@@ -70,36 +70,36 @@
extern gboolean
gnc_verify_dialog(gncUIWidget parent,
- gboolean yes_is_default,
- const char *format, ...) G_GNUC_PRINTF (3, 4);
+ gboolean yes_is_default,
+ const char *format, ...) G_GNUC_PRINTF (3, 4);
extern gint
gnc_ok_cancel_dialog(gncUIWidget parent,
- gint default_result,
- const char *format, ...) G_GNUC_PRINTF (3,4);
+ gint default_result,
+ const char *format, ...) G_GNUC_PRINTF (3, 4);
extern void
gnc_warning_dialog(gncUIWidget parent,
- const char *format, ...) G_GNUC_PRINTF (2, 3);
+ const char *format, ...) G_GNUC_PRINTF (2, 3);
extern void
gnc_error_dialog(GtkWidget *parent,
- const char *format, ...) G_GNUC_PRINTF (2, 3);
+ const char *format, ...) G_GNUC_PRINTF (2, 3);
extern void
gnc_gnome_help (const char *file_name, const char *target_link);
int gnc_choose_radio_option_dialog (gncUIWidget parent,
- const char *title,
- const char *msg,
- const char *button_name,
- int default_value,
- GList *radio_list);
+ const char *title,
+ const char *msg,
+ const char *button_name,
+ int default_value,
+ GList *radio_list);
gboolean gnc_dup_trans_dialog (gncUIWidget parent, time_t *date_p,
const char *num, char **out_num);
@@ -108,12 +108,12 @@
typedef enum
{
- GNC_PRICE_EDIT,
- GNC_PRICE_NEW,
+ GNC_PRICE_EDIT,
+ GNC_PRICE_NEW,
} GNCPriceEditType;
void gnc_price_edit_dialog (gncUIWidget parent, QofSession *session,
- GNCPrice *price, GNCPriceEditType type);
+ GNCPrice *price, GNCPriceEditType type);
GNCPrice* gnc_price_edit_by_guid (GtkWidget * parent, const GUID * guid);
void gnc_prices_dialog (gncUIWidget parent);
void gnc_commodities_dialog (gncUIWidget parent);
Modified: gnucash/trunk/src/html/gnc-html-webkit.c
===================================================================
--- gnucash/trunk/src/html/gnc-html-webkit.c 2010-03-02 21:23:52 UTC (rev 18786)
+++ gnucash/trunk/src/html/gnc-html-webkit.c 2010-03-02 21:40:02 UTC (rev 18787)
@@ -991,9 +991,9 @@
static void
impl_webkit_print( GncHtml* self )
{
- extern void webkit_web_frame_print( WebKitWebFrame* frame );
- extern GtkPrintOperationResult webkit_web_frame_print_full( WebKitWebFrame* frame,
- GtkPrintOperation* op, GtkPrintOperationAction action, GError** error );
+ extern void webkit_web_frame_print( WebKitWebFrame * frame );
+ extern GtkPrintOperationResult webkit_web_frame_print_full( WebKitWebFrame * frame,
+ GtkPrintOperation * op, GtkPrintOperationAction action, GError** error );
GncHtmlWebkitPrivate* priv;
WebKitWebFrame* frame;
@@ -1006,17 +1006,18 @@
frame = webkit_web_view_get_main_frame( priv->web_view );
#if PRINT_WITH_OP
- gtk_print_operation_set_unit( op, GTK_UNIT_POINTS );
+ gtk_print_operation_set_unit( op, GTK_UNIT_POINTS );
webkit_web_frame_print_full( frame, op, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, &error );
g_object_unref( op );
- if( error != NULL ) {
+ if ( error != NULL )
+ {
GtkWidget* window = gtk_widget_get_toplevel( GTK_WIDGET(priv->web_view) );
GtkWidget* dialog = gtk_message_dialog_new( GTK_WIDGET_TOPLEVEL(window) ? GTK_WINDOW(window) : NULL,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- "%s", error->message );
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "%s", error->message );
g_error_free( error );
g_signal_connect( dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL);
Modified: gnucash/trunk/src/import-export/csv/gnc-csv-model.c
===================================================================
--- gnucash/trunk/src/import-export/csv/gnc-csv-model.c 2010-03-02 21:23:52 UTC (rev 18786)
+++ gnucash/trunk/src/import-export/csv/gnc-csv-model.c 2010-03-02 21:40:02 UTC (rev 18787)
@@ -765,7 +765,8 @@
int i;
/* possible_errors lists the ways in which a list can fail this test. */
enum PossibleErrorTypes {NO_DATE, NO_AMOUNT, NUM_OF_POSSIBLE_ERRORS};
- gchar* possible_errors[NUM_OF_POSSIBLE_ERRORS] = {
+ gchar* possible_errors[NUM_OF_POSSIBLE_ERRORS] =
+ {
N_("No date column."),
N_("No balance, deposit, or withdrawal column.")
};
@@ -857,7 +858,7 @@
QofBook* book = gnc_account_get_book(list->account);
gnc_commodity* currency = xaccAccountGetCommodity(list->account);
gnc_numeric amount = double_to_gnc_numeric(0.0, xaccAccountGetCommoditySCU(list->account),
- GNC_RND_ROUND);
+ GNC_RND_ROUND);
/* This flag is set to TRUE if we can use the "Deposit" or "Withdrawal" column. */
gboolean amount_set = FALSE;
@@ -905,9 +906,9 @@
if (prop->value != NULL)
{
amount = gnc_numeric_add(*((gnc_numeric*)(prop->value)),
- amount,
- xaccAccountGetCommoditySCU(list->account),
- GNC_RND_ROUND);
+ amount,
+ xaccAccountGetCommoditySCU(list->account),
+ GNC_RND_ROUND);
amount_set = TRUE;
/* We will use the "Deposit" and "Withdrawal" columns in preference to "Balance". */
trans_line->balance_set = FALSE;
@@ -918,9 +919,9 @@
if (prop->value != NULL)
{
amount = gnc_numeric_add(gnc_numeric_neg(*((gnc_numeric*)(prop->value))),
- amount,
- xaccAccountGetCommoditySCU(list->account),
- GNC_RND_ROUND);
+ amount,
+ xaccAccountGetCommoditySCU(list->account),
+ GNC_RND_ROUND);
amount_set = TRUE;
/* We will use the "Deposit" and "Withdrawal" columns in preference to "Balance". */
trans_line->balance_set = FALSE;
@@ -957,7 +958,7 @@
* @return 0 on success, 1 on failure
*/
int gnc_csv_parse_to_trans(GncCsvParseData* parse_data, Account* account,
-gboolean redo_errors)
+ gboolean redo_errors)
{
gboolean hasBalanceColumn;
int i, j, max_cols = 0;
@@ -1041,7 +1042,7 @@
{
errors = TRUE;
error_message = g_strdup_printf(_("%s column could not be understood."),
- _(gnc_csv_column_type_strs[property->type]));
+ _(gnc_csv_column_type_strs[property->type]));
trans_property_free(property);
break;
}
@@ -1061,7 +1062,7 @@
if (errors)
{
parse_data->error_lines = g_list_append(parse_data->error_lines,
- GINT_TO_POINTER(i));
+ GINT_TO_POINTER(i));
/* If there's already an error message, we need to replace it. */
if (line->len > (int)(parse_data->orig_row_lengths->data[i]))
{
@@ -1086,7 +1087,7 @@
/* If we can just put it at the end, do so and increment last_transaction. */
if (last_transaction == NULL ||
- xaccTransGetDate(((GncCsvTransLine*)(last_transaction->data))->trans) <= xaccTransGetDate(trans_line->trans))
+ xaccTransGetDate(((GncCsvTransLine*)(last_transaction->data))->trans) <= xaccTransGetDate(trans_line->trans))
{
parse_data->transactions = g_list_append(parse_data->transactions, trans_line);
/* If this is the first transaction, we need to get last_transaction on track. */
@@ -1100,7 +1101,7 @@
{
GList* insertion_spot = last_transaction;
while (insertion_spot != NULL &&
- xaccTransGetDate(((GncCsvTransLine*)(insertion_spot->data))->trans) > xaccTransGetDate(trans_line->trans))
+ xaccTransGetDate(((GncCsvTransLine*)(insertion_spot->data))->trans) > xaccTransGetDate(trans_line->trans))
{
insertion_spot = g_list_previous(insertion_spot);
}
@@ -1151,8 +1152,8 @@
* imported. This will be sum of all the previous transactions for
* any given transaction. */
gnc_numeric balance_offset = double_to_gnc_numeric(0.0,
- xaccAccountGetCommoditySCU(account),
- GNC_RND_ROUND);
+ xaccAccountGetCommoditySCU(account),
+ GNC_RND_ROUND);
while (transactions != NULL)
{
GncCsvTransLine* trans_line = (GncCsvTransLine*)transactions->data;
@@ -1161,15 +1162,15 @@
time_t date = xaccTransGetDate(trans_line->trans);
/* Find what the balance should be by adding the offset to the actual balance. */
gnc_numeric existing_balance = gnc_numeric_add(balance_offset,
- xaccAccountGetBalanceAsOfDate(account, date),
- xaccAccountGetCommoditySCU(account),
- GNC_RND_ROUND);
+ xaccAccountGetBalanceAsOfDate(account, date),
+ xaccAccountGetCommoditySCU(account),
+ GNC_RND_ROUND);
/* The amount of the transaction is the difference between the new and existing balance. */
gnc_numeric amount = gnc_numeric_sub(trans_line->balance,
- existing_balance,
- xaccAccountGetCommoditySCU(account),
- GNC_RND_ROUND);
+ existing_balance,
+ xaccAccountGetCommoditySCU(account),
+ GNC_RND_ROUND);
SplitList* splits = xaccTransGetSplitList(trans_line->trans);
while (splits)
@@ -1183,9 +1184,9 @@
/* This new transaction needs to be added to the balance offset. */
balance_offset = gnc_numeric_add(balance_offset,
- amount,
- xaccAccountGetCommoditySCU(account),
- GNC_RND_ROUND);
+ amount,
+ xaccAccountGetCommoditySCU(account),
+ GNC_RND_ROUND);
}
transactions = g_list_next(transactions);
}
Modified: gnucash/trunk/src/import-export/import-backend.c
===================================================================
--- gnucash/trunk/src/import-export/import-backend.c 2010-03-02 21:23:52 UTC (rev 18786)
+++ gnucash/trunk/src/import-export/import-backend.c 2010-03-02 21:40:02 UTC (rev 18787)
@@ -762,10 +762,10 @@
/* Append that to the list. Do not use g_list_append because
- it is slow. The list is sorted afterwards anyway. */
+ it is slow. The list is sorted afterwards anyway. */
trans_info->match_list =
g_list_prepend(trans_info->match_list,
- match_info);
+ match_info);
}
}/* end split_find_match */
Modified: gnucash/trunk/src/libqof/qof/gnc-date.c
===================================================================
--- gnucash/trunk/src/libqof/qof/gnc-date.c 2010-03-02 21:23:52 UTC (rev 18786)
+++ gnucash/trunk/src/libqof/qof/gnc-date.c 2010-03-02 21:40:02 UTC (rev 18787)
@@ -449,7 +449,7 @@
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 */
+ says, it's not a Y2K thing */
gnc_tm_set_day_start (&tm_str);
t = mktime (&tm_str);
Modified: gnucash/trunk/src/libqof/qof/guid.c
===================================================================
--- gnucash/trunk/src/libqof/qof/guid.c 2010-03-02 21:23:52 UTC (rev 18786)
+++ gnucash/trunk/src/libqof/qof/guid.c 2010-03-02 21:40:02 UTC (rev 18787)
@@ -258,7 +258,7 @@
total += strlen(de);
result = g_snprintf(filename, sizeof(filename),
- "%s/%s", dirname, de);
+ "%s/%s", dirname, de);
if ((result < 0) || (result >= (int)sizeof(filename)))
continue;
@@ -378,7 +378,7 @@
/* process and parent ids */
{
#ifdef HAVE_UNISTD_H
- pid_t pid;
+ pid_t pid;
pid = getpid();
md5_process_bytes(&pid, sizeof(pid), &guid_context);
@@ -390,7 +390,7 @@
bytes += sizeof(pid);
#endif
#endif
- }
+ }
/* user info */
{
Modified: gnucash/trunk/src/libqof/qof/qoflog.c
===================================================================
--- gnucash/trunk/src/libqof/qof/qoflog.c 2010-03-02 21:23:52 UTC (rev 18786)
+++ gnucash/trunk/src/libqof/qof/qoflog.c 2010-03-02 21:40:02 UTC (rev 18787)
@@ -43,9 +43,10 @@
# include <sys/time.h>
#else
/* We simply define the struct timeval on our own here. */
-struct timeval {
- long tv_sec; /* seconds */
- long tv_usec; /* and microseconds */
+struct timeval
+{
+ long tv_sec; /* seconds */
+ long tv_usec; /* and microseconds */
};
/* include <Winsock2.h> */
#endif
Modified: gnucash/trunk/src/test-core/test-main.c
===================================================================
--- gnucash/trunk/src/test-core/test-main.c 2010-03-02 21:23:52 UTC (rev 18786)
+++ gnucash/trunk/src/test-core/test-main.c 2010-03-02 21:40:02 UTC (rev 18787)
@@ -161,10 +161,10 @@
gnc_module_system_init();
- qof_backend_module_init();
+ qof_backend_module_init();
-/* gnc_gnome_init (argc, argv, VERSION); */
-/* gnc_gui_init(); */
-/* scm_boot_guile(argc, argv, inner_main, 0); */
+ /* gnc_gnome_init (argc, argv, VERSION); */
+ /* gnc_gui_init(); */
+ /* scm_boot_guile(argc, argv, inner_main, 0); */
exit(0); /* never reached */
}
More information about the gnucash-changes
mailing list