1 /*  cdrdao - write audio CD-Rs in disc-at-once mode
2  *
3  *  Copyright (C) 1998-2001  Andreas Mueller <andreas@daneb.de>
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 
20 #ifndef __UTIL_H__
21 #define __UTIL_H__
22 
23 #include <stdio.h>
24 #include <stdlib.h>
25 
26 #include <string>
27 
28 class Sample;
29 
30 char *strdupCC(const char *s);
31 char *strdup3CC(const char *s1, const char *s2, const char *s3);
32 char *strdupvCC(const char *s1, ...);
33 
34 long fullRead(int fd, void *buf, long count);
35 long fullWrite(int fd, const void *buf, long count);
36 long readLong(FILE *fp);
37 short readShort(FILE *fp);
38 
39 void swapSamples(Sample *buf, unsigned long len);
40 
41 unsigned char int2bcd(int);
42 int bcd2int(unsigned char);
43 
44 const char *stripCwd(const char *fname);
45 
46 typedef enum {
47   FE_UNKNOWN = 0,
48   FE_TOC,
49   FE_CUE,
50   FE_WAV,
51   FE_MP3,
52   FE_OGG,
53   FE_M3U,
54 } FileExtension;
55 
56 FileExtension fileExtension(const char* fname);
57 
58 bool resolveFilename(std::string& dest, const char* file, const char* path);
59 
60 #endif
61 
62