1 /* 2 Copyright (C) 2006, 2008, 2011, 2012 Rocky Bernstein <rocky@gnu.org> 3 4 This program is free software: you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation, either version 3 of the License, or 7 (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 /* 19 This file contains definitions to fill in for differences or 20 deficiencies to OS or compiler irregularities. If this file is 21 included other routines can be more portable. 22 */ 23 24 #ifndef CDIO_DRIVER_PORTABLE_H_ 25 #define CDIO_DRIVER_PORTABLE_H_ 26 27 #if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__) 28 # include "config.h" 29 # define __CDIO_CONFIG_H__ 1 30 #endif 31 32 #if !defined(HAVE_FTRUNCATE) 33 # if defined (_WIN32) 34 # define ftruncate chsize 35 # endif 36 #endif /*HAVE_FTRUNCATE*/ 37 38 #if !defined(HAVE_SNPRINTF) 39 # if defined (_MSC_VER) 40 # define snprintf _snprintf 41 # endif 42 #endif /*HAVE_SNPRINTF*/ 43 44 #if !defined(HAVE_VSNPRINTF) 45 # if defined (_MSC_VER) 46 # define vsnprintf _vsnprintf 47 # endif 48 #endif /*HAVE_SNPRINTF*/ 49 50 #if !defined(HAVE_DRAND48) && defined(HAVE_RAND) 51 # define drand48() (rand() / (double)RAND_MAX) 52 #endif 53 54 #endif /* CDIO_DRIVER_PORTABLE_H_ */ 55