"Fossies" - the Fresh Open Source Software Archive

Member "geoipupdate-3.1.1/bin/types.h" (12 Jan 2018, 3579 Bytes) of package /linux/misc/geoipupdate-3.1.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "types.h" see the Fossies "Dox" file reference documentation.

    1 /* types.h - some common typedefs
    2  *  Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
    3  *
    4  * This file is part of GNUPG.
    5  *
    6  * GNUPG is free software; you can redistribute it and/or modify
    7  * it under the terms of the GNU General Public License as published by
    8  * the Free Software Foundation; either version 2 of the License, or
    9  * (at your option) any later version.
   10  *
   11  * GNUPG is distributed in the hope that it will be useful,
   12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14  * GNU General Public License for more details.
   15  *
   16  * You should have received a copy of the GNU General Public License
   17  * along with this program; if not, write to the Free Software
   18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
   19  */
   20 
   21 #ifndef G10_TYPES_H
   22 #define G10_TYPES_H
   23 
   24 #ifdef HAVE_INTTYPES_H
   25 /* For uint64_t */
   26 #include <inttypes.h>
   27 #endif
   28 
   29 /* The AC_CHECK_SIZEOF() in configure fails for some machines.
   30  * we provide some fallback values here */
   31 #if !SIZEOF_UNSIGNED_SHORT
   32 #undef SIZEOF_UNSIGNED_SHORT
   33 #define SIZEOF_UNSIGNED_SHORT 2
   34 #endif
   35 #if !SIZEOF_UNSIGNED_INT
   36 #undef SIZEOF_UNSIGNED_INT
   37 #define SIZEOF_UNSIGNED_INT 4
   38 #endif
   39 #if !SIZEOF_UNSIGNED_LONG
   40 #undef SIZEOF_UNSIGNED_LONG
   41 #define SIZEOF_UNSIGNED_LONG 4
   42 #endif
   43 
   44 #include <sys/types.h>
   45 
   46 #ifndef HAVE_BYTE_TYPEDEF
   47 #undef byte /* maybe there is a macro with this name */
   48 #ifndef __riscos__
   49 typedef unsigned char byte;
   50 #else
   51 /* Norcroft treats char  = unsigned char  as legal assignment
   52                but char* = unsigned char* as illegal assignment
   53    and the same applies to the signed variants as well  */
   54 typedef char byte;
   55 #endif
   56 #define HAVE_BYTE_TYPEDEF
   57 #endif
   58 
   59 #ifndef HAVE_USHORT_TYPEDEF
   60 #undef ushort /* maybe there is a macro with this name */
   61 typedef unsigned short ushort;
   62 #define HAVE_USHORT_TYPEDEF
   63 #endif
   64 
   65 #ifndef HAVE_ULONG_TYPEDEF
   66 #undef ulong /* maybe there is a macro with this name */
   67 typedef unsigned long ulong;
   68 #define HAVE_ULONG_TYPEDEF
   69 #endif
   70 
   71 #ifndef HAVE_U16_TYPEDEF
   72 #undef u16 /* maybe there is a macro with this name */
   73 #if SIZEOF_UNSIGNED_INT == 2
   74 typedef unsigned int u16;
   75 #elif SIZEOF_UNSIGNED_SHORT == 2
   76 typedef unsigned short u16;
   77 #else
   78 #error no typedef for u16
   79 #endif
   80 #define HAVE_U16_TYPEDEF
   81 #endif
   82 
   83 #ifndef HAVE_U32_TYPEDEF
   84 #undef u32 /* maybe there is a macro with this name */
   85 #if SIZEOF_UNSIGNED_INT == 4
   86 typedef unsigned int u32;
   87 #elif SIZEOF_UNSIGNED_LONG == 4
   88 typedef unsigned long u32;
   89 #else
   90 #error no typedef for u32
   91 #endif
   92 #define HAVE_U32_TYPEDEF
   93 #endif
   94 
   95 /****************
   96  * Warning: Some systems segfault when this u64 typedef and
   97  * the dummy code in cipher/md.c is not available.  Examples are
   98  * Solaris and IRIX.
   99  */
  100 #ifndef HAVE_U64_TYPEDEF
  101 #undef u64 /* maybe there is a macro with this name */
  102 #if SIZEOF_UINT64_T == 8
  103 typedef uint64_t u64;
  104 #define U64_C(c) (UINT64_C(c))
  105 #define HAVE_U64_TYPEDEF
  106 #elif SIZEOF_UNSIGNED_INT == 8
  107 typedef unsigned int u64;
  108 #define U64_C(c) (c##U)
  109 #define HAVE_U64_TYPEDEF
  110 #elif SIZEOF_UNSIGNED_LONG == 8
  111 typedef unsigned long u64;
  112 #define U64_C(c) (c##UL)
  113 #define HAVE_U64_TYPEDEF
  114 #elif SIZEOF_UNSIGNED_LONG_LONG == 8
  115 typedef unsigned long long u64;
  116 #define U64_C(c) (c##ULL)
  117 #define HAVE_U64_TYPEDEF
  118 #endif
  119 #endif
  120 
  121 typedef union {
  122     int a;
  123     short b;
  124     char c[1];
  125     long d;
  126 #ifdef HAVE_U64_TYPEDEF
  127     u64 e;
  128 #endif
  129     float f;
  130     double g;
  131 } PROPERLY_ALIGNED_TYPE;
  132 
  133 typedef struct string_list {
  134     struct string_list *next;
  135     unsigned int flags;
  136     char d[1];
  137 } * STRLIST;
  138 
  139 #endif /*G10_TYPES_H*/