Corrected compilation on linux - added conditional min macros.

This commit is contained in:
skarg
2008-10-29 03:49:43 +00:00
parent 2797764d65
commit 23d2cd6592
4 changed files with 24 additions and 2 deletions
+5
View File
@@ -47,6 +47,11 @@
#include "mstp.h"
#include "mstptext.h"
#ifndef max
#define max(a,b) (((a) (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
/* local port data - shared with RS-485 */
static volatile struct mstp_port_struct_t MSTP_Port;
/* buffers needed by mstp port struct */
+5
View File
@@ -48,6 +48,11 @@
#include "mstptext.h"
#include "bacint.h"
#ifndef max
#define max(a,b) (((a) (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
/* local port data - shared with RS-485 */
static volatile struct mstp_port_struct_t MSTP_Port;
/* buffers needed by mstp port struct */
+9 -2
View File
@@ -54,6 +54,11 @@
#include "mstp.h"
#include "mstptext.h"
#ifndef max
#define max(a,b) (((a) (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
/* local port data - shared with RS-485 */
static volatile struct mstp_port_struct_t MSTP_Port;
/* buffers needed by mstp port struct */
@@ -185,6 +190,7 @@ static void write_received_packet(
uint32_t orig_len; /* actual length of packet */
uint8_t header[8]; /* MS/TP header */
struct timeval tv;
size_t max_data = 0;
if (pFile) {
gettimeofday(&tv, NULL);
@@ -211,8 +217,8 @@ static void write_received_packet(
fwrite(header, sizeof(header), 1, pFile);
if (mstp_port->DataLength) {
fwrite(mstp_port->InputBuffer, max_data, 1, pFile);
fwrite(&(mstp_port->DataCRCActualMSB), 1, 1, pFile);
fwrite(&(mstp_port->DataCRCActualLSB), 1, 1, pFile);
fwrite((char *)&(mstp_port->DataCRCActualMSB), 1, 1, pFile);
fwrite((char *)&(mstp_port->DataCRCActualLSB), 1, 1, pFile);
}
} else {
fprintf(stderr, "rx_fsm: failed to open %s: %s\n", Capture_Filename,
@@ -236,6 +242,7 @@ static void print_received_packet(
{
unsigned i = 0;
int timestamp = 0;
size_t max_data = 0;
timestamp = timestamp_ms();
fprintf(stderr, "%03d ", timestamp);
+5
View File
@@ -52,6 +52,11 @@
#include "mstptext.h"
#include "crc.h"
#ifndef max
#define max(a,b) (((a) (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
/* file format for libpcap/winpcap */
/* from http://wiki.wireshark.org/Development/LibpcapFileFormat */
typedef struct pcap_hdr_s {