ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

compat.h
Go to the documentation of this file.
00001 /*
00002     compat: Some compatibility functions and header inclusions.
00003     Basic standard C stuff, that may barely be above/around C89.
00004 
00005     The mpg123 code is determined to keep it's legacy. A legacy of old, old UNIX.
00006     It is envisioned to include this compat header instead of any of the "standard" headers, to catch compatibility issues.
00007     So, don't include stdlib.h or string.h ... include compat.h.
00008 
00009     copyright 2007-8 by the mpg123 project - free software under the terms of the LGPL 2.1
00010     see COPYING and AUTHORS files in distribution or http://mpg123.org
00011     initially written by Thomas Orgis
00012 */
00013 
00014 #ifndef MPG123_COMPAT_H
00015 #define MPG123_COMPAT_H
00016 
00017 #include "config.h"
00018 
00019 #ifdef HAVE_STDLIB_H
00020 /* realloc, size_t */
00021 #include <stdlib.h>
00022 #endif
00023 
00024 #include        <stdio.h>
00025 #include        <math.h>
00026 
00027 #ifdef HAVE_SIGNAL_H
00028 #include <signal.h>
00029 #else
00030 #ifdef HAVE_SYS_SIGNAL_H
00031 #include <sys/signal.h>
00032 #endif
00033 #endif
00034 
00035 #ifdef HAVE_UNISTD_H
00036 #include <unistd.h>
00037 #endif
00038 
00039 /* Types, types, types. */
00040 /* Do we actually need these two in addition to sys/types.h? As replacement? */
00041 #ifdef HAVE_SYS_TYPES_H
00042 #include <sys/types.h>
00043 #endif
00044 #ifdef HAVE_INTTYPES_H
00045 #include <inttypes.h>
00046 #endif
00047 #ifdef HAVE_STDINT_H
00048 #include <stdint.h>
00049 #endif
00050 /* We want SIZE_MAX, etc. */
00051 #ifdef HAVE_LIMITS_H
00052 #include <limits.h>
00053 #endif
00054  
00055 #ifndef SIZE_MAX
00056 #define SIZE_MAX ((size_t)-1)
00057 #endif
00058 #ifndef ULONG_MAX
00059 #define ULONG_MAX ((unsigned long)-1)
00060 #endif
00061 
00062 #ifdef HAVE_STRING_H
00063 #include <string.h>
00064 #endif
00065 
00066 #ifdef OS2
00067 #include <float.h>
00068 #endif
00069 
00070 #ifdef HAVE_SYS_TIME_H
00071 #include <sys/time.h>
00072 #endif
00073 /* For select(), I need select.h according to POSIX 2001, else: sys/time.h sys/types.h unistd.h */
00074 #ifdef HAVE_SYS_SELECT_H
00075 #include <sys/select.h>
00076 #endif
00077 
00078 /* To parse big numbers... */
00079 #ifdef HAVE_ATOLL
00080 #define atobigint atoll
00081 #else
00082 #define atobigint atol
00083 #endif
00084 
00085 // typedef unsigned char byte;
00086 
00087 /* A safe realloc also for very old systems where realloc(NULL, size) returns NULL. */
00088 void *safe_realloc(void *ptr, size_t size);
00089 #ifndef HAVE_STRERROR
00090 const char *strerror(int errnum);
00091 #endif
00092 
00093 #ifndef HAVE_STRDUP
00094 char *strdup(const char *s);
00095 #endif
00096 
00097 /* If we have the size checks enabled, try to derive some sane printfs.
00098    Simple start: Use max integer type and format if long is not big enough.
00099    I am hesitating to use %ll without making sure that it's there... */
00100 #if !(defined PLAIN_C89) && (defined SIZEOF_OFF_T) && (SIZEOF_OFF_T > SIZEOF_LONG) && (defined PRIiMAX)
00101 # define OFF_P PRIiMAX
00102 typedef intmax_t off_p;
00103 #else
00104 # define OFF_P "li"
00105 typedef long off_p;
00106 #endif
00107 
00108 #if !(defined PLAIN_C89) && (defined SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > SIZEOF_LONG) && (defined PRIuMAX)
00109 # define SIZE_P PRIuMAX
00110 typedef uintmax_t size_p;
00111 #else
00112 # define SIZE_P "lu"
00113 typedef unsigned long size_p;
00114 #endif
00115 
00116 #if !(defined PLAIN_C89) && (defined SIZEOF_SSIZE_T) && (SIZEOF_SSIZE_T > SIZEOF_LONG) && (defined PRIiMAX)
00117 # define SSIZE_P PRIuMAX
00118 typedef intmax_t ssize_p;
00119 #else
00120 # define SSIZE_P "li"
00121 typedef long ssize_p;
00122 #endif
00123 
00131 int compat_open(const char *filename, int mode);
00132 
00139 int compat_close(int infd);
00140 
00141 /* Those do make sense in a separate file, but I chose to include them in compat.c because that's the one source whose object is shared between mpg123 and libmpg123 -- and both need the functionality internally. */
00142 
00143 #ifdef WANT_WIN32_UNICODE
00144 
00155 int win32_wide_utf8 (const wchar_t * const wptr, const char **const mbptr, size_t * const buflen);
00156 
00169 int win32_utf8_wide (const char *const mbptr, const wchar_t ** const wptr, size_t * const buflen);
00170 #endif
00171 
00172 /* That one comes from Tellie on OS/2, needed in resolver. */
00173 #ifdef __KLIBC__
00174 typedef int socklen_t;
00175 #endif
00176 
00177 #endif

Generated on Sun May 27 2012 04:19:09 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.