/* capture_stop_conditions.c
* Implementation for 'stop condition handler'.
*
- * $Id$
- *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include "config.h"
+
#include <time.h>
#include <string.h>
#include <stdlib.h>
gint32 elapsed_time;
/* check timeout here */
if(data->timeout_s == 0) return FALSE; /* 0 == infinite */
- elapsed_time = time(NULL) - data->start_time;
- if(elapsed_time > data->timeout_s) return TRUE;
+ elapsed_time = (gint32) (time(NULL) - data->start_time);
+ if(elapsed_time >= data->timeout_s) return TRUE;
return FALSE;
} /* END _cnd_eval_timeout()*/
/* structure that contains user supplied data for this condition */
typedef struct _cnd_capturesize_dat{
- long max_capture_size;
+ guint64 max_capture_size;
}cnd_capturesize_dat;
/*
if((data = (cnd_capturesize_dat*)g_malloc(sizeof(cnd_capturesize_dat))) == NULL)
return NULL;
/* initialize user data */
- data->max_capture_size = va_arg(ap, long);
+ data->max_capture_size = va_arg(ap, guint64);
+ if (data->max_capture_size > ((guint64)INT_MAX + 1))
+ data->max_capture_size = (guint64)INT_MAX + 1;
cnd_set_user_data(cnd, (void*)data);
return cnd;
} /* END _cnd_constr_capturesize() */
cnd_capturesize_dat* data = (cnd_capturesize_dat*)cnd_get_user_data(cnd);
/* check capturesize here */
if(data->max_capture_size == 0) return FALSE; /* 0 == infinite */
- if(va_arg(ap, long) >= data->max_capture_size){
+ if(va_arg(ap, guint64) >= data->max_capture_size){
return TRUE;
}
return FALSE;