r15796 - gnucash/trunk - Use qof_strftime instead of strftime in the C source code.

Andreas Köhler andi5 at cvs.gnucash.org
Wed Apr 4 14:49:01 EDT 2007


Author: andi5
Date: 2007-04-04 14:48:48 -0400 (Wed, 04 Apr 2007)
New Revision: 15796
Trac: http://svn.gnucash.org/trac/changeset/15796

Modified:
   gnucash/trunk/lib/libqof/backend/file/qsf-backend.c
   gnucash/trunk/lib/libqof/backend/file/qsf-xml-map.c
   gnucash/trunk/lib/libqof/qof/qofbookmerge.c
   gnucash/trunk/lib/libqof/qof/qoflog.c
   gnucash/trunk/lib/libqof/qof/qofutil.c
   gnucash/trunk/src/backend/file/sixtp-utils.c
   gnucash/trunk/src/business/business-ledger/gncEntryLedgerModel.c
   gnucash/trunk/src/calculation/amort_opt.c
   gnucash/trunk/src/calculation/amort_prt.c
   gnucash/trunk/src/engine/FreqSpec.c
   gnucash/trunk/src/engine/Recurrence.c
   gnucash/trunk/src/gnome-utils/gnc-date-edit.c
   gnucash/trunk/src/gnome-utils/gnc-date-format.c
   gnucash/trunk/src/gnome-utils/gnc-dense-cal.c
   gnucash/trunk/src/import-export/import-backend.c
   gnucash/trunk/src/register/ledger-core/split-register-model.c
Log:
Use qof_strftime instead of strftime in the C source code.


Modified: gnucash/trunk/lib/libqof/backend/file/qsf-backend.c
===================================================================
--- gnucash/trunk/lib/libqof/backend/file/qsf-backend.c	2007-04-04 18:48:42 UTC (rev 15795)
+++ gnucash/trunk/lib/libqof/backend/file/qsf-backend.c	2007-04-04 18:48:48 UTC (rev 15796)
@@ -188,10 +188,10 @@
 	qsf_time_now_t = time(NULL);
 	qsf_ts = g_new(Timespec, 1);
 	timespecFromTime_t(qsf_ts, qsf_time_now_t);
-	strftime(qsf_enquiry_date, QSF_DATE_LENGTH, QSF_XSD_TIME, gmtime(&qsf_time_now_t));
-	strftime(qsf_time_match, QSF_DATE_LENGTH, qsf_time_precision, gmtime(&qsf_time_now_t));
-	strftime(qsf_time_string, QSF_DATE_LENGTH, "%F", gmtime(&qsf_time_now_t));
-	strftime(qsf_time_now, QSF_DATE_LENGTH, QSF_XSD_TIME, gmtime(&qsf_time_now_t));
+	qof_strftime(qsf_enquiry_date, QSF_DATE_LENGTH, QSF_XSD_TIME, gmtime(&qsf_time_now_t));
+	qof_strftime(qsf_time_match, QSF_DATE_LENGTH, qsf_time_precision, gmtime(&qsf_time_now_t));
+	qof_strftime(qsf_time_string, QSF_DATE_LENGTH, "%F", gmtime(&qsf_time_now_t));
+	qof_strftime(qsf_time_now, QSF_DATE_LENGTH, QSF_XSD_TIME, gmtime(&qsf_time_now_t));
 	g_hash_table_insert(params->qsf_default_hash, "qsf_enquiry_date", qsf_enquiry_date);
 	g_hash_table_insert(params->qsf_default_hash, "qsf_time_now", &qsf_time_now_t);
 	g_hash_table_insert(params->qsf_default_hash, "qsf_time_string", qsf_time_string);

Modified: gnucash/trunk/lib/libqof/backend/file/qsf-xml-map.c
===================================================================
--- gnucash/trunk/lib/libqof/backend/file/qsf-xml-map.c	2007-04-04 18:48:42 UTC (rev 15795)
+++ gnucash/trunk/lib/libqof/backend/file/qsf-xml-map.c	2007-04-04 18:48:48 UTC (rev 15796)
@@ -52,7 +52,7 @@
 	xmlNewProp(output_parent, BAD_CAST QSF_OBJECT_TYPE,
 		xmlGetProp(import_node, BAD_CAST MAP_VALUE_ATTR));
 	qsf_time = (time_t*)g_hash_table_lookup(qsf_default_hash, default_name);
-	strftime(date_as_string, QSF_DATE_LENGTH, QSF_XSD_TIME, gmtime(qsf_time));
+	qof_strftime(date_as_string, QSF_DATE_LENGTH, QSF_XSD_TIME, gmtime(qsf_time));
 	xmlNodeAddContent(output_parent, BAD_CAST date_as_string);
 }
 
@@ -569,7 +569,7 @@
 	regfree(&reg);
 	/** QSF_DATE_LENGTH preset for all internal and QSF_XSD_TIME string formats.
 	 */
-	strftime(qsf_time_now_as_string, QSF_DATE_LENGTH, (char*)format, gmtime(output));
+	qof_strftime(qsf_time_now_as_string, QSF_DATE_LENGTH, (char*)format, gmtime(output));
 	LEAVE (" ok");
 }
 

Modified: gnucash/trunk/lib/libqof/qof/qofbookmerge.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofbookmerge.c	2007-04-04 18:48:42 UTC (rev 15795)
+++ gnucash/trunk/lib/libqof/qof/qofbookmerge.c	2007-04-04 18:48:48 UTC (rev 15796)
@@ -845,7 +845,7 @@
 			date_getter = (Timespec (*)(QofEntity*, QofParam*))qtparam->param_getfcn;
 			param_ts = date_getter(qtEnt, qtparam);
 			param_t = timespecToTime_t(param_ts);
-			strftime(param_date, QOF_DATE_STRING_LENGTH, QOF_UTC_DATE_FORMAT, gmtime(&param_t));
+			qof_strftime(param_date, QOF_DATE_STRING_LENGTH, QOF_UTC_DATE_FORMAT, gmtime(&param_t));
 			param_string = g_strdup(param_date);
 			return param_string;
 		}

Modified: gnucash/trunk/lib/libqof/qof/qoflog.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qoflog.c	2007-04-04 18:48:42 UTC (rev 15795)
+++ gnucash/trunk/lib/libqof/qof/qoflog.c	2007-04-04 18:48:48 UTC (rev 15796)
@@ -103,7 +103,7 @@
           gchar *level_str = qof_log_level_to_string(log_level);
           now = time(NULL);
           localtime_r(&now, &now_tm);
-          strftime(timestamp_buf, 9, "%T", &now_tm);
+          qof_strftime(timestamp_buf, 9, "%T", &now_tm);
 
           fprintf(fout, "* %s %*s <%s> %*s%s%s",
                   timestamp_buf,

Modified: gnucash/trunk/lib/libqof/qof/qofutil.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofutil.c	2007-04-04 18:48:42 UTC (rev 15795)
+++ gnucash/trunk/lib/libqof/qof/qofutil.c	2007-04-04 18:48:48 UTC (rev 15796)
@@ -426,7 +426,7 @@
 			date_getter = (Timespec (*)(QofEntity*, QofParam*))param->param_getfcn;
 			param_ts = date_getter(ent, param);
 			param_t = timespecToTime_t(param_ts);
-			strftime(param_date, MAX_DATE_LENGTH, 
+			qof_strftime(param_date, MAX_DATE_LENGTH, 
                 QOF_UTC_DATE_FORMAT, gmtime(&param_t));
 			param_string = g_strdup(param_date);
             known_type = TRUE;

Modified: gnucash/trunk/src/backend/file/sixtp-utils.c
===================================================================
--- gnucash/trunk/src/backend/file/sixtp-utils.c	2007-04-04 18:48:42 UTC (rev 15795)
+++ gnucash/trunk/src/backend/file/sixtp-utils.c	2007-04-04 18:48:48 UTC (rev 15796)
@@ -531,8 +531,8 @@
   if (!localtime_r(&tmp_time, &parsed_time))
     return FALSE;
 
-  num_chars = strftime(str, TIMESPEC_SEC_FORMAT_MAX,
-                       TIMESPEC_TIME_FORMAT, &parsed_time);
+  num_chars = qof_strftime(str, TIMESPEC_SEC_FORMAT_MAX,
+                           TIMESPEC_TIME_FORMAT, &parsed_time);
   if (num_chars == 0)
     return FALSE;
 

Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedgerModel.c
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedgerModel.c	2007-04-04 18:48:42 UTC (rev 15795)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedgerModel.c	2007-04-04 18:48:48 UTC (rev 15796)
@@ -562,7 +562,7 @@
   gnc_date_cell_get_date ((DateCell *) cell, &ts);
   tt = ts.tv_sec;
   tm = localtime (&tt);
-  strftime (string, sizeof(string), "%A %d %B %Y", tm);
+  qof_strftime (string, sizeof(string), "%A %d %B %Y", tm);
 
   return g_strdup (string);
 }

Modified: gnucash/trunk/src/calculation/amort_opt.c
===================================================================
--- gnucash/trunk/src/calculation/amort_opt.c	2007-04-04 18:48:42 UTC (rev 15795)
+++ gnucash/trunk/src/calculation/amort_opt.c	2007-04-04 18:48:48 UTC (rev 15796)
@@ -60,9 +60,9 @@
     times_I->tm_yday = amortsched->yday_I;
 
     printf("\n******************************");
-    strftime(buffer,(size_t)50,"%c",times_E);
+    qof_strftime(buffer,(size_t)50,"%c",times_E);
     printf("\nEffective       Date: %s\n",buffer);
-    strftime(buffer,(size_t)50,"%c",times_I);
+    qof_strftime(buffer,(size_t)50,"%c",times_I);
     printf("Initial Payment Date: %s\n",buffer);
     free(times_E);
     free(times_I);

Modified: gnucash/trunk/src/calculation/amort_prt.c
===================================================================
--- gnucash/trunk/src/calculation/amort_prt.c	2007-04-04 18:48:42 UTC (rev 15795)
+++ gnucash/trunk/src/calculation/amort_prt.c	2007-04-04 18:48:48 UTC (rev 15796)
@@ -65,9 +65,9 @@
     times_I->tm_yday = amortsched->yday_I;
 
     fprintf(ofile,"Amortization Table\n");
-    strftime(datel,(size_t)100,"%c",times_E);
+    qof_strftime(datel,(size_t)100,"%c",times_E);
     fprintf(ofile,"Effective       Date: %s\n",datel);
-    strftime(datel,(size_t)100,"%c",times_I);
+    qof_strftime(datel,(size_t)100,"%c",times_I);
     fprintf(ofile,"Initial Payment Date: %s\n",datel);
     fprintf(ofile,"Compounding Frequency per year: %u\n",amortsched->CF);
     fprintf(ofile,"Payment     Frequency per year: %u\n",amortsched->PF);

Modified: gnucash/trunk/src/engine/FreqSpec.c
===================================================================
--- gnucash/trunk/src/engine/FreqSpec.c	2007-04-04 18:48:42 UTC (rev 15795)
+++ gnucash/trunk/src/engine/FreqSpec.c	2007-04-04 18:48:48 UTC (rev 15796)
@@ -131,7 +131,7 @@
   struct tm t;
   memset( &t, 0, sizeof( t ) );
   t.tm_wday = day;
-  strftime(wday_name, WDAY_NAME_WIDTH, "%A", &t);
+  qof_strftime(wday_name, WDAY_NAME_WIDTH, "%A", &t);
   return wday_name;
 }
  
@@ -142,7 +142,7 @@
   static gchar month_name[WDAY_BUF_WIDTH];
   struct tm t;
   t.tm_mon = month;
-  strftime(month_name, WDAY_NAME_WIDTH, "%B", &t);
+  qof_strftime(month_name, WDAY_NAME_WIDTH, "%B", &t);
   return month_name;
 }
 #endif
@@ -154,7 +154,7 @@
   struct tm t;
   memset( &t, 0, sizeof( t ) );
   t.tm_mon = month;
-  strftime(month_name, WDAY_NAME_WIDTH, "%b", &t);
+  qof_strftime(month_name, WDAY_NAME_WIDTH, "%b", &t);
   return month_name;
 }
 

Modified: gnucash/trunk/src/engine/Recurrence.c
===================================================================
--- gnucash/trunk/src/engine/Recurrence.c	2007-04-04 18:48:42 UTC (rev 15795)
+++ gnucash/trunk/src/engine/Recurrence.c	2007-04-04 18:48:48 UTC (rev 15796)
@@ -407,7 +407,7 @@
     memset(buf, 0, buf_len);
     memset(&my_tm, 0, sizeof(struct tm));
     my_tm.tm_wday = dow;
-    i = strftime(buf, buf_len - 1, "%a", &my_tm);
+    i = qof_strftime(buf, buf_len - 1, "%a", &my_tm);
     buf[i] = 0;
 }
 

Modified: gnucash/trunk/src/gnome-utils/gnc-date-edit.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-date-edit.c	2007-04-04 18:48:42 UTC (rev 15795)
+++ gnucash/trunk/src/gnome-utils/gnc-date-edit.c	2007-04-04 18:48:48 UTC (rev 15796)
@@ -331,9 +331,9 @@
 		hit = g_new (hour_info_t, 1);
 
 		if (gde->flags & GNC_DATE_EDIT_24_HR)
-			strftime (buffer, sizeof (buffer), "%H:00", mtm);
+			qof_strftime (buffer, sizeof (buffer), "%H:00", mtm);
 		else
-			strftime (buffer, sizeof (buffer), "%I:00 %p ", mtm);
+			qof_strftime (buffer, sizeof (buffer), "%I:00 %p ", mtm);
 		hit->hour = g_strdup (buffer);
 		hit->gde  = gde;
 
@@ -355,11 +355,11 @@
 			mtm->tm_min = j;
 			hit = g_new (hour_info_t, 1);
 			if (gde->flags & GNC_DATE_EDIT_24_HR)
-				strftime (buffer, sizeof (buffer),
-                                          "%H:%M", mtm);
+				qof_strftime (buffer, sizeof (buffer),
+					      "%H:%M", mtm);
 			else
-				strftime (buffer, sizeof (buffer),
-                                          "%I:%M %p", mtm);
+				qof_strftime (buffer, sizeof (buffer),
+					      "%I:%M %p", mtm);
 			hit->hour = g_strdup (buffer);
 			hit->gde  = gde;
 
@@ -505,9 +505,9 @@
 
 	/* Set the time */
 	if (gde->flags & GNC_DATE_EDIT_24_HR)
-		strftime (buffer, sizeof (buffer), "%H:%M", mytm);
+		qof_strftime (buffer, sizeof (buffer), "%H:%M", mytm);
 	else
-		strftime (buffer, sizeof (buffer), "%I:%M %p", mytm);
+		qof_strftime (buffer, sizeof (buffer), "%I:%M %p", mytm);
 	gtk_entry_set_text (GTK_ENTRY (gde->time_entry), buffer);
 }
 

Modified: gnucash/trunk/src/gnome-utils/gnc-date-format.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-date-format.c	2007-04-04 18:48:42 UTC (rev 15795)
+++ gnucash/trunk/src/gnome-utils/gnc-date-format.c	2007-04-04 18:48:48 UTC (rev 15796)
@@ -514,7 +514,7 @@
   /* Visual feedback on what the date will look like. */
   secs_now = time(NULL);
   localtime_r(&secs_now, &today);
-  strftime(date_string, MAX_DATE_LEN, format, &today);
+  qof_strftime(date_string, MAX_DATE_LEN, format, &today);
   gtk_label_set_text(GTK_LABEL(priv->sample_label), date_string);
   g_free(format);
 }

Modified: gnucash/trunk/src/gnome-utils/gnc-dense-cal.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-dense-cal.c	2007-04-04 18:48:42 UTC (rev 15795)
+++ gnucash/trunk/src/gnome-utils/gnc-dense-cal.c	2007-04-04 18:48:48 UTC (rev 15796)
@@ -176,7 +176,7 @@
     memset(buf, 0, MONTH_NAME_BUFSIZE);
     memset(&my_tm, 0, sizeof(struct tm));
     my_tm.tm_wday = wday;
-    i = strftime (buf, MONTH_NAME_BUFSIZE-1, "%a", &my_tm);
+    i = qof_strftime (buf, MONTH_NAME_BUFSIZE-1, "%a", &my_tm);
     /* Wild hack to use only the first two letters */
     buf[2]='\0';
     return buf;

Modified: gnucash/trunk/src/import-export/import-backend.c
===================================================================
--- gnucash/trunk/src/import-export/import-backend.c	2007-04-04 18:48:42 UTC (rev 15795)
+++ gnucash/trunk/src/import-export/import-backend.c	2007-04-04 18:48:48 UTC (rev 15796)
@@ -415,7 +415,7 @@
    */
   transtime = xaccTransGetDate(transaction);
   tm_struct = gmtime(&transtime);
-  if(!strftime(local_day_of_week, sizeof(local_day_of_week), "%A", tm_struct))
+  if(!qof_strftime(local_day_of_week, sizeof(local_day_of_week), "%A", tm_struct))
     {
       PERR("TransactionGetTokens: error, strftime failed\n");
     }

Modified: gnucash/trunk/src/register/ledger-core/split-register-model.c
===================================================================
--- gnucash/trunk/src/register/ledger-core/split-register-model.c	2007-04-04 18:48:42 UTC (rev 15795)
+++ gnucash/trunk/src/register/ledger-core/split-register-model.c	2007-04-04 18:48:48 UTC (rev 15796)
@@ -789,7 +789,7 @@
 
   tm = localtime (&tt);
 
-  strftime (string, sizeof (string), "%A %d %B %Y", tm);
+  qof_strftime (string, sizeof (string), "%A %d %B %Y", tm);
 
   return g_strdup (string);
 }



More information about the gnucash-changes mailing list