Ethereal-dev: Re: SV: SV: SV: [Ethereal-dev] iax2 dissector patch

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Richard van der Hoff <richardv@xxxxxxxxxxxxx>
Date: Thu, 18 Aug 2005 13:38:14 +0100
Anders Broman wrote:
Hi,
I've checked it in together with the negative relative time fixes.

Thanks for that Anders, but it seems part of the patch - the bit to fix filtering on negative relative times - got omitted. Here it is again - please could you/someone else check this in?

Thanks,

Richard


--
Richard van der Hoff <richardv@xxxxxxxxxxxxx>
Systems Analyst
Tel: +44 (0) 845 666 7778
http://www.mxtelecom.com
Index: epan/ftypes/ftype-time.c
===================================================================
RCS file: /cvs/ethereal/epan/ftypes/ftype-time.c,v
retrieving revision 1.1.1.4
retrieving revision 1.2
diff -u -r1.1.1.4 -r1.2
--- epan/ftypes/ftype-time.c	4 Jul 2005 18:17:35 -0000	1.1.1.4
+++ epan/ftypes/ftype-time.c	5 Jul 2005 02:59:11 -0000	1.2
@@ -170,9 +170,15 @@
 relative_val_from_unparsed(fvalue_t *fv, char *s, gboolean allow_partial_value _U_, LogFunc logfunc)
 {
 	char    *curptr, *endptr;
-
+        gboolean negative = FALSE;
+        
 	curptr = s;
 
+        if(*curptr == '-') {
+            negative = TRUE;
+            curptr++;
+        }
+        
 	/*
 	 * If it doesn't begin with ".", it should contain a seconds
 	 * value.
@@ -212,9 +218,10 @@
 		fv->value.time.nsecs = 0;
 	}
 
-	/*
-	 * XXX - what about negative values?
-	 */
+        if(negative) {
+            fv->value.time.secs = -fv->value.time.secs;
+            fv->value.time.nsecs = -fv->value.time.nsecs;
+        }
 	return TRUE;
 
 fail: