r22186 - gnucash/trunk - Fix double definition of DEBUG_MEMORY

John Ralls jralls at code.gnucash.org
Mon May 21 11:32:52 EDT 2012


Author: jralls
Date: 2012-05-21 11:32:52 -0400 (Mon, 21 May 2012)
New Revision: 22186
Trac: http://svn.gnucash.org/trac/changeset/22186

Modified:
   gnucash/trunk/configure.ac
   gnucash/trunk/src/backend/dbi/gnc-backend-dbi.c
Log:
Fix double definition of DEBUG_MEMORY

Modified: gnucash/trunk/configure.ac
===================================================================
--- gnucash/trunk/configure.ac	2012-05-20 21:24:14 UTC (rev 22185)
+++ gnucash/trunk/configure.ac	2012-05-21 15:32:52 UTC (rev 22186)
@@ -584,7 +584,8 @@
      CFLAGS="${CFLAGS} -g ${USER_OPTIMIZATION}"
      LDFLAGS="${LDFLAGS} -g"
      AC_DEFINE(DEBUG_MEMORY,1,[Enable debug memory])
-     AC_DEFINE(DEBUG_MEMORY,0,[Enable debug memory])
+  ],
+  [     AC_DEFINE(DEBUG_MEMORY,0,[Enable debug memory])
   ])
 
 AC_ARG_ENABLE( profile,

Modified: gnucash/trunk/src/backend/dbi/gnc-backend-dbi.c
===================================================================
--- gnucash/trunk/src/backend/dbi/gnc-backend-dbi.c	2012-05-20 21:24:14 UTC (rev 22185)
+++ gnucash/trunk/src/backend/dbi/gnc-backend-dbi.c	2012-05-21 15:32:52 UTC (rev 22186)
@@ -2008,16 +2008,26 @@
         {
             return NULL;
         }
-        else
-        {
-            time = dbi_result_get_datetime( dbi_row->result, col_name );
+	time = dbi_result_get_datetime( dbi_row->result, col_name );
+	/* Protect gmtime from time values < 0 to work around a mingw
+	   bug that fills struct_tm with garbage values which in turn
+	   creates a string that GDate can't parse. */
+	if (time >= 0)
+	  {
             (void)gmtime_r( &time, &tm_struct );
             (void)g_value_init( value, G_TYPE_STRING );
             g_value_take_string( value,
                                  g_strdup_printf( "%d%02d%02d%02d%02d%02d",
-                                                  1900 + tm_struct.tm_year, tm_struct.tm_mon + 1, tm_struct.tm_mday,
-                                                  tm_struct.tm_hour, tm_struct.tm_min, tm_struct.tm_sec ) );
-        }
+                                                  1900 + tm_struct.tm_year,
+						  tm_struct.tm_mon + 1,
+						  tm_struct.tm_mday,
+                                                  tm_struct.tm_hour,
+						  tm_struct.tm_min,
+						  tm_struct.tm_sec ) );
+	  }
+	else
+	  g_value_take_string (value, "19691231235959");
+        
         break;
     default:
         PERR( "Field %s: unknown DBI_TYPE: %d\n", col_name, type );



More information about the gnucash-changes mailing list