2005-01-20 23:22:22 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
2004-07-13 13:54:09 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation;
|
|
|
|
// either version 2.1 of the License, or (at your option) any later version.
|
2004-07-13 13:54:09 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This software is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
2003-12-11 17:55:07 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
|
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
2003-09-02 19:34:26 +00:00
|
|
|
#ifndef _STD_FIXES_H_
|
|
|
|
#define _STD_FIXES_H_
|
|
|
|
|
2005-02-09 19:39:04 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
2004-06-09 20:04:09 +00:00
|
|
|
#ifndef CONFIG_TEST
|
|
|
|
|
2003-09-02 19:34:26 +00:00
|
|
|
#ifndef HAVE_STD_MIN
|
|
|
|
namespace std {
|
|
|
|
|
|
|
|
#ifdef min
|
|
|
|
#undef min
|
|
|
|
#endif
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
inline T min(const T &a, const T &b) {
|
|
|
|
return ((a<b)?a:b);
|
|
|
|
}
|
|
|
|
}
|
2005-02-09 19:39:04 +00:00
|
|
|
#endif /* HAVE_STD_MIN */
|
2003-09-02 19:34:26 +00:00
|
|
|
|
2003-09-02 23:26:38 +00:00
|
|
|
#ifndef HAVE_STD_MAX
|
2003-09-02 19:34:26 +00:00
|
|
|
namespace std {
|
|
|
|
#ifdef max
|
|
|
|
#undef max
|
|
|
|
#endif
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
inline T max(const T &a, const T &b) {
|
|
|
|
return ((a>b)?a:b);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2005-02-09 19:39:04 +00:00
|
|
|
#endif /* HAVE_STD_MAX */
|
2003-09-02 19:34:26 +00:00
|
|
|
|
2003-09-02 23:26:38 +00:00
|
|
|
#ifndef HAVE_STD_TRANSFORM
|
|
|
|
#include <algorithm>
|
|
|
|
#include <iterator>
|
|
|
|
|
|
|
|
namespace std {
|
|
|
|
#ifdef transform
|
|
|
|
#undef transform
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
template <typename i_iterator, typename o_iterator, typename OP>
|
|
|
|
o_iterator transform(i_iterator first, i_iterator last, o_iterator res, OP op) {
|
|
|
|
for (;first != last; first++) {
|
|
|
|
*(res++)=op(*first);
|
|
|
|
}
|
|
|
|
return (res);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2005-02-09 19:39:04 +00:00
|
|
|
#endif /* HAVE_STD_TRANSFORM */
|
|
|
|
#endif /* CONFIG_TEST */
|
2003-09-06 03:34:14 +00:00
|
|
|
|
2005-05-06 00:36:07 +00:00
|
|
|
#if defined(__cplusplus) && defined(LARGEFILE_BREAKS_CXX) && \
|
|
|
|
(defined(_LARGE_FILES) || (_FILE_OFFSET_BITS==64)) \
|
|
|
|
&& !defined(_USING_FCGI_)
|
2003-09-06 03:34:14 +00:00
|
|
|
|
2004-07-14 20:55:26 +00:00
|
|
|
#include <stdio.h>
|
2004-10-05 00:27:39 +00:00
|
|
|
#include <fcntl.h>
|
2003-09-06 03:34:14 +00:00
|
|
|
|
|
|
|
#undef fopen
|
|
|
|
#undef freopen
|
|
|
|
#undef tmpfile
|
|
|
|
#undef fgetpos
|
|
|
|
#undef fsetpos
|
|
|
|
#undef fseeko
|
|
|
|
#undef ftello
|
2004-10-05 00:27:39 +00:00
|
|
|
#undef open
|
|
|
|
#undef creat
|
2003-09-06 03:34:14 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
FILE *fopen(const char *, const char *);
|
|
|
|
FILE *freopen(const char *, const char *, FILE *);
|
|
|
|
FILE *tmpfile(void);
|
|
|
|
int fgetpos(FILE *, fpos64_t *);
|
|
|
|
int fsetpos(FILE *, const fpos64_t *);
|
|
|
|
int fseeko(FILE *, const off64_t, int);
|
|
|
|
off64_t ftello(FILE *);
|
2004-10-05 00:27:39 +00:00
|
|
|
int open(const char *, int, mode_t mode=0);
|
|
|
|
int creat(const char *, mode_t mode);
|
2003-09-06 03:34:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline FILE *fopen(const char *path, const char *mode) { return fopen64(path,
|
|
|
|
mode); }
|
|
|
|
inline FILE *freopen(const char *path, const char *mode, FILE *file) { return
|
|
|
|
freopen64(path,mode,file); }
|
|
|
|
inline FILE *tmpfile(void) {return tmpfile64();}
|
|
|
|
inline int fgetpos(FILE *file, fpos64_t *pos) { return fgetpos64(file,pos); }
|
|
|
|
inline int fsetpos(FILE *file, const fpos64_t *pos) { return fsetpos64(file,pos); }
|
|
|
|
inline int fseeko(FILE *file, const off64_t pos, int whence) {return fseeko64(file,pos,whence);}
|
|
|
|
inline off64_t ftello(FILE *file) {return ftello64(file);}
|
2004-10-05 00:27:39 +00:00
|
|
|
inline int open(const char *filename, int flags, mode_t mode) { return open64(filename,flags,mode); }
|
|
|
|
inline int creat(const char *filename, mode_t mode) { return creat64(filename,mode); }
|
2003-09-06 03:34:14 +00:00
|
|
|
|
|
|
|
#endif
|
2005-02-09 19:39:04 +00:00
|
|
|
#endif /* __cplusplus */
|
|
|
|
#endif /* STD_FIXES_H */
|
2003-09-02 19:34:26 +00:00
|
|
|
|