Skip to Content.
Sympa Menu

freetds - [freetds] [PATCH] Invalid gmtime() call

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Andrew Victor" <avictor.za AT gmail.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: [freetds] [PATCH] Invalid gmtime() call
  • Date: Tue, 26 Aug 2008 12:41:07 +0200

hi,

There is an invalid / unnecessary call to gmtime() in cs_dt_crack().
The input parameter 'time_t tmp_secs_from_epoch' is never initialized,
and result 'struct tm* t' is never used.

So the gmtime() call and variables can just be removed.


Regards,
Andrew Victor
diff -urN freetds-0.82/src/ctlib/cs.c freetds-0.82.new/src/ctlib/cs.c
--- freetds-0.82/src/ctlib/cs.c	2007-12-23 23:12:02.000000000 +0200
+++ freetds-0.82.new/src/ctlib/cs.c	2008-08-26 09:21:00.000000000 +0200
@@ -824,8 +824,6 @@
 {
 TDS_DATETIME *dt;
 TDS_DATETIME4 *dt4;
-time_t tmp_secs_from_epoch;
-struct tm *t;
 TDSDATEREC dr;
 
 	if (datetype == CS_DATETIME_TYPE) {
@@ -837,7 +835,6 @@
 	} else {
 		return CS_FAIL;
 	}
-	t = (struct tm *) gmtime(&tmp_secs_from_epoch);
 	daterec->dateyear = dr.year;
 	daterec->datemonth = dr.month;
 	daterec->datedmonth = dr.day;



Archive powered by MHonArc 2.6.24.

Top of Page