view src/common.h @ 355:d1f930be4711

From Jeffrey Morlan: pst_build_id_ptr and pst_build_desc_ptr require that the first child of a BTree page have the same starting ID as itself. This is not required by the spec, and is not true in many real-world PSTs (presumably, the original first child of the page got deleted). Because of this, many emails are not being extracted from these PSTs. It also triggers an infinite loop in lspst (a separate bug, also fixed)
author Carl Byington <carl@five-ten-sg.com>
date Wed, 06 Jul 2016 10:12:22 -0700
parents 5a82d41c883d
children 506e266f930d
line wrap: on
line source


#ifndef __PST_COMMON_H
#define __PST_COMMON_H


#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <time.h>


#ifndef  _MSC_VER
    #include <stdint.h>
    #include <inttypes.h>
#else
    typedef signed char        int8_t;
    typedef unsigned char      uint8_t;
	typedef unsigned short     uint16_t;
	typedef short              int16_t;
    typedef unsigned int       uint32_t;
	typedef int                int32_t;
	typedef unsigned long long uint64_t;
	typedef long long          int64_t;
#endif

#ifndef _WIN32
    typedef struct {
        uint32_t  dwLowDateTime;
        uint32_t  dwHighDateTime;
    } FILETIME;
    // According to Jan Wolter, sys/param.h is the most portable source of endian
    // information on UNIX systems. see http://www.unixpapa.com/incnote/byteorder.html
    #include <sys/param.h>
#else
    #include <windows.h>
#endif

#if defined(_WIN32) || defined(__DJGPP__)
    #ifndef LITTLE_ENDIAN
        #define LITTLE_ENDIAN 1234
    #endif
    #ifndef BIG_ENDIAN
        #define BIG_ENDIAN 4321
    #endif
    #define BYTE_ORDER LITTLE_ENDIAN
#endif


#endif

#if defined (__SVR4) && defined (__sun)
    #define LITTLE_ENDIAN 1234
    #define BYTE_ORDER LITTLE_ENDIAN
#endif