mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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 git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18787 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -36,14 +36,16 @@ gmtime_r(const time_t *const timep, struct tm *p_tm)
|
||||
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,7 +59,8 @@ gmtime_r(const time_t *const timep, struct tm *p_tm)
|
||||
{
|
||||
static struct tm* tmp;
|
||||
tmp = gmtime(timep);
|
||||
if (tmp) {
|
||||
if (tmp)
|
||||
{
|
||||
memcpy(p_tm, tmp, sizeof(struct tm));
|
||||
tmp = p_tm;
|
||||
}
|
||||
|
||||
@@ -15,14 +15,16 @@ localtime_r(const time_t *const timep, struct tm *p_tm)
|
||||
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 = localtime(timep);
|
||||
if (tmp) {
|
||||
if (tmp)
|
||||
{
|
||||
memcpy(p_tm, tmp, sizeof(struct tm));
|
||||
tmp = p_tm;
|
||||
}
|
||||
@@ -36,7 +38,8 @@ localtime_r(const time_t *const timep, struct tm *p_tm)
|
||||
{
|
||||
static struct tm* tmp;
|
||||
tmp = localtime(timep);
|
||||
if (tmp) {
|
||||
if (tmp)
|
||||
{
|
||||
memcpy(p_tm, tmp, sizeof(struct tm));
|
||||
tmp = p_tm;
|
||||
}
|
||||
|
||||
@@ -144,8 +144,8 @@ SCM_DEFINE (scm_strptime, "strptime", 2, 0, 0,
|
||||
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);
|
||||
|
||||
@@ -52,11 +52,11 @@ setenv(const char *name, const char *value, int overwrite)
|
||||
|
||||
if ((name == NULL) || (value == NULL)) return -1;
|
||||
|
||||
if(overwrite || (!old_value))
|
||||
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 (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,
|
||||
@@ -77,12 +77,12 @@ 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;
|
||||
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;
|
||||
if (!putenv_str) return -1;
|
||||
|
||||
result = putenv(putenv_str);
|
||||
g_free(putenv_str);
|
||||
|
||||
@@ -65,7 +65,8 @@ get_win32_locale_string (int lctype)
|
||||
|
||||
tem = malloc (nbytes);
|
||||
|
||||
if (GetLocaleInfo (GetThreadLocale (), lctype, tem, nbytes) == 0) {
|
||||
if (GetLocaleInfo (GetThreadLocale (), lctype, tem, nbytes) == 0)
|
||||
{
|
||||
free (tem);
|
||||
tem = malloc (4);
|
||||
strcpy (tem, "???");
|
||||
@@ -77,7 +78,8 @@ get_win32_locale_string (int lctype)
|
||||
static void
|
||||
append_char (char **str, int *size, int *i, char c)
|
||||
{
|
||||
if (*size <= *i + 1) {
|
||||
if (*size <= *i + 1)
|
||||
{
|
||||
char *new;
|
||||
*size *= 2;
|
||||
new = malloc (*size);
|
||||
@@ -98,7 +100,8 @@ translate_win32_picture (const char *picture)
|
||||
|
||||
str[0] = '\0';
|
||||
|
||||
while (*picture) {
|
||||
while (*picture)
|
||||
{
|
||||
const char *q = picture + 1;
|
||||
int count;
|
||||
|
||||
@@ -106,16 +109,19 @@ translate_win32_picture (const char *picture)
|
||||
q++;
|
||||
count = q - picture;
|
||||
|
||||
switch (*picture) {
|
||||
switch (*picture)
|
||||
{
|
||||
case '\'':
|
||||
picture++;
|
||||
while (*picture && *picture != '\'') {
|
||||
while (*picture && *picture != '\'')
|
||||
{
|
||||
append_char (&str, &size, &i, *picture);
|
||||
picture++;
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
switch (count) {
|
||||
switch (count)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
append_char (&str, &size, &i, '%');
|
||||
@@ -130,7 +136,8 @@ translate_win32_picture (const char *picture)
|
||||
picture += count - 1;
|
||||
break;
|
||||
case 'M':
|
||||
switch (count) {
|
||||
switch (count)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
append_char (&str, &size, &i, '%');
|
||||
@@ -145,7 +152,8 @@ translate_win32_picture (const char *picture)
|
||||
picture += count - 1;
|
||||
break;
|
||||
case 'y':
|
||||
switch (count) {
|
||||
switch (count)
|
||||
{
|
||||
case 1: /* Last digit of year. Ugh... */
|
||||
case 2:
|
||||
append_char (&str, &size, &i, '%');
|
||||
@@ -326,24 +334,24 @@ extern const unsigned short int __mon_yday[2][13];
|
||||
# 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 @@ static char const ab_month_name[][4] =
|
||||
# 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? */
|
||||
@@ -409,11 +417,11 @@ static char *
|
||||
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;
|
||||
@@ -460,7 +468,7 @@ strptime_internal (rp, fmt, tm, decided, era_cnt)
|
||||
++fmt;
|
||||
#ifndef _NL_CURRENT
|
||||
/* We need this for handling the `E' modifier. */
|
||||
start_over:
|
||||
start_over:
|
||||
#endif
|
||||
|
||||
/* Make back up of current processing pointer. */
|
||||
@@ -478,7 +486,7 @@ strptime_internal (rp, fmt, tm, decided, era_cnt)
|
||||
for (cnt = 0; cnt < 7; ++cnt)
|
||||
{
|
||||
#ifdef _NL_CURRENT
|
||||
if (*decided !=raw)
|
||||
if (*decided != raw)
|
||||
{
|
||||
if (match_string (_NL_CURRENT (LC_TIME, DAY_1 + cnt), rp))
|
||||
{
|
||||
@@ -498,7 +506,7 @@ strptime_internal (rp, fmt, tm, decided, era_cnt)
|
||||
}
|
||||
}
|
||||
#elif defined (OS_WIN32)
|
||||
if (*decided !=raw)
|
||||
if (*decided != raw)
|
||||
{
|
||||
char *locale_string = get_win32_locale_string (LOCALE_SDAYNAME1 + cnt);
|
||||
if (match_string (locale_string, rp))
|
||||
@@ -543,7 +551,7 @@ strptime_internal (rp, fmt, tm, decided, era_cnt)
|
||||
for (cnt = 0; cnt < 12; ++cnt)
|
||||
{
|
||||
#ifdef _NL_CURRENT
|
||||
if (*decided !=raw)
|
||||
if (*decided != raw)
|
||||
{
|
||||
if (match_string (_NL_CURRENT (LC_TIME, MON_1 + cnt), rp))
|
||||
{
|
||||
@@ -563,7 +571,7 @@ strptime_internal (rp, fmt, tm, decided, era_cnt)
|
||||
}
|
||||
}
|
||||
#elif defined (OS_WIN32)
|
||||
if (*decided !=raw)
|
||||
if (*decided != raw)
|
||||
{
|
||||
char *locale_string = get_win32_locale_string (LOCALE_SMONTHNAME1 + cnt);
|
||||
if (match_string (locale_string, rp))
|
||||
@@ -674,7 +682,7 @@ strptime_internal (rp, fmt, tm, decided, era_cnt)
|
||||
case 'C':
|
||||
/* Match century number. */
|
||||
#ifdef _NL_CURRENT
|
||||
match_century:
|
||||
match_century:
|
||||
#endif
|
||||
get_number (0, 99, 2);
|
||||
century = val;
|
||||
@@ -1025,7 +1033,7 @@ strptime_internal (rp, fmt, tm, decided, era_cnt)
|
||||
break;
|
||||
case 'y':
|
||||
#ifdef _NL_CURRENT
|
||||
match_year_in_century:
|
||||
match_year_in_century:
|
||||
#endif
|
||||
/* Match year within century. */
|
||||
get_number (0, 99, 2);
|
||||
@@ -1358,9 +1366,9 @@ strptime_internal (rp, fmt, tm, decided, era_cnt)
|
||||
|
||||
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;
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ gnc_verify_dialog(gncUIWidget parent,
|
||||
extern gint
|
||||
gnc_ok_cancel_dialog(gncUIWidget parent,
|
||||
gint default_result,
|
||||
const char *format, ...) G_GNUC_PRINTF (3,4);
|
||||
const char *format, ...) G_GNUC_PRINTF (3, 4);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -991,9 +991,9 @@ impl_webkit_export_to_file( GncHtml* self, const char *filepath )
|
||||
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;
|
||||
@@ -1010,7 +1010,8 @@ impl_webkit_print( GncHtml* self )
|
||||
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,
|
||||
|
||||
@@ -765,7 +765,8 @@ static gboolean trans_property_list_verify_essentials(TransPropertyList* list, g
|
||||
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.")
|
||||
};
|
||||
@@ -957,7 +958,7 @@ static GncCsvTransLine* trans_property_list_to_trans(TransPropertyList* list, gc
|
||||
* @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;
|
||||
|
||||
@@ -449,7 +449,7 @@ qof_print_date_dmy_buff (char * buff, size_t len, int day, int month, int year)
|
||||
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);
|
||||
|
||||
@@ -43,7 +43,8 @@
|
||||
# include <sys/time.h>
|
||||
#else
|
||||
/* We simply define the struct timeval on our own here. */
|
||||
struct timeval {
|
||||
struct timeval
|
||||
{
|
||||
long tv_sec; /* seconds */
|
||||
long tv_usec; /* and microseconds */
|
||||
};
|
||||
|
||||
@@ -163,8 +163,8 @@ main(int argc, char ** argv)
|
||||
|
||||
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 */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user