80 #include <sys/types.h> 84 #define TEST_PATTERN 1.3333 85 #ifdef HAVE_LONG_LONG_INT 86 #define LONG_LONG_TEST 0x0102030405060708LL 88 #define LONG_TEST 0x01020304 89 #define INT_TEST 0x01020304 90 #define SHORT_TEST 0x0102 100 static const unsigned char dbl_cmpr[] =
101 { 0x3f, 0xf5, 0x55, 0x32, 0x61, 0x7c, 0x1b, 0xda };
103 static const unsigned char flt_cmpr[] = { 0x3f, 0xaa, 0xa9, 0x93 };
104 static const unsigned char off_t_cmpr[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 };
105 static const unsigned char lng_cmpr[] = { 0x01, 0x02, 0x03, 0x04 };
106 static const unsigned char int_cmpr[] = { 0x01, 0x02, 0x03, 0x04 };
107 static const unsigned char shrt_cmpr[] = { 0x01, 0x02 };
135 static int find_offset(
const unsigned char *basis,
unsigned char search_value,
140 for (i = 0; i < size; i++)
141 if (basis[i] == search_value)
147 static int find_offsets(
const void *pattern,
unsigned char *cnvrt,
148 const unsigned char *cmpr,
int port_size,
149 int nat_size,
const char *
typename)
154 for (i = 0; i < port_size; i++) {
155 int off = find_offset(pattern, cmpr[i], nat_size);
165 for (i = 0; i < port_size; i++) {
166 if (cnvrt[i] != (nat_size - port_size + i))
168 if (cnvrt[i] != (port_size - 1 - i))
214 #ifdef HAVE_LONG_LONG_INT 217 G_fatal_error(
"Internal error: can't construct an off_t literal");
#define ENDIAN_LITTLE
Endian check.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
unsigned char lng_cnvrt[sizeof(long)]
#define PORT_DOUBLE
Sizes of types used in portable format (different names used in Vlib/ and diglib/ for the same thing)...
unsigned char off_t_cnvrt[sizeof(off_t)]
unsigned char dbl_cnvrt[sizeof(double)]
unsigned char int_cnvrt[sizeof(int)]
unsigned char shrt_cnvrt[sizeof(short)]
unsigned char flt_cnvrt[sizeof(float)]
void port_init(void)
Initialize Port_info structures.