Mercurial > audlegacy-plugins
annotate src/flac112/file.c @ 269:69f309c8bd71 trunk
[svn] - properly calculate points
author | nenolod |
---|---|
date | Sun, 19 Nov 2006 08:23:35 -0800 |
parents | 4b31176c198a |
children |
rev | line source |
---|---|
104
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
1 /* grabbag - Convenience lib for various routines common to several tools |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
2 * Copyright (C) 2002,2003,2004,2005 Josh Coalson |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
3 * |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
5 * modify it under the terms of the GNU General Public License |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
6 * as published by the Free Software Foundation; either version 2 |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
7 * of the License, or (at your option) any later version. |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
8 * |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
9 * This program is distributed in the hope that it will be useful, |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
12 * GNU General Public License for more details. |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
13 * |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
14 * You should have received a copy of the GNU General Public License |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
15 * along with this program; if not, write to the Free Software |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
17 */ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
18 |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
19 #if defined _MSC_VER || defined __MINGW32__ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
20 #include <sys/utime.h> /* for utime() */ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
21 #include <io.h> /* for chmod(), _setmode(), unlink() */ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
22 #include <fcntl.h> /* for _O_BINARY */ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
23 #else |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
24 #include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
25 #include <utime.h> /* for utime() */ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
26 #endif |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
27 #ifdef __CYGWIN__ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
28 #include <io.h> /* for setmode(), O_BINARY */ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
29 #include <fcntl.h> /* for _O_BINARY */ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
30 #endif |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
31 #include <sys/stat.h> /* for stat(), maybe chmod() */ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
32 #if defined _WIN32 && !defined __CYGWIN__ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
33 #else |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
34 #include <unistd.h> /* for unlink() */ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
35 #endif |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
36 #include <stdio.h> |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
37 #include <stdlib.h> |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
38 #include <string.h> /* for strrchr() */ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
39 #include "grabbag.h" |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
40 |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
41 |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
42 void grabbag__file_copy_metadata(const char *srcpath, const char *destpath) |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
43 { |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
44 struct stat srcstat; |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
45 struct utimbuf srctime; |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
46 |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
47 if(0 == stat(srcpath, &srcstat)) { |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
48 srctime.actime = srcstat.st_atime; |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
49 srctime.modtime = srcstat.st_mtime; |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
50 (void)chmod(destpath, srcstat.st_mode); |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
51 (void)utime(destpath, &srctime); |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
52 } |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
53 } |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
54 |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
55 off_t grabbag__file_get_filesize(const char *srcpath) |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
56 { |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
57 struct stat srcstat; |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
58 |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
59 if(0 == stat(srcpath, &srcstat)) |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
60 return srcstat.st_size; |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
61 else |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
62 return -1; |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
63 } |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
64 |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
65 const char *grabbag__file_get_basename(const char *srcpath) |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
66 { |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
67 const char *p; |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
68 |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
69 p = strrchr(srcpath, '/'); |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
70 if(0 == p) { |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
71 p = strrchr(srcpath, '\\'); |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
72 if(0 == p) |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
73 return srcpath; |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
74 } |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
75 return ++p; |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
76 } |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
77 |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
78 FLAC__bool grabbag__file_change_stats(const char *filename, FLAC__bool read_only) |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
79 { |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
80 struct stat stats; |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
81 |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
82 if(0 == stat(filename, &stats)) { |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
83 #if !defined _MSC_VER && !defined __MINGW32__ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
84 if(read_only) { |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
85 stats.st_mode &= ~S_IWUSR; |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
86 stats.st_mode &= ~S_IWGRP; |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
87 stats.st_mode &= ~S_IWOTH; |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
88 } |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
89 else { |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
90 stats.st_mode |= S_IWUSR; |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
91 } |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
92 #else |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
93 if(read_only) |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
94 stats.st_mode &= ~S_IWRITE; |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
95 else |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
96 stats.st_mode |= S_IWRITE; |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
97 #endif |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
98 if(0 != chmod(filename, stats.st_mode)) |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
99 return false; |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
100 } |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
101 else |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
102 return false; |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
103 |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
104 return true; |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
105 } |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
106 |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
107 FLAC__bool grabbag__file_remove_file(const char *filename) |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
108 { |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
109 return grabbag__file_change_stats(filename, /*read_only=*/false) && 0 == unlink(filename); |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
110 } |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
111 |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
112 FILE *grabbag__file_get_binary_stdin() |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
113 { |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
114 /* if something breaks here it is probably due to the presence or |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
115 * absence of an underscore before the identifiers 'setmode', |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
116 * 'fileno', and/or 'O_BINARY'; check your system header files. |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
117 */ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
118 #if defined _MSC_VER || defined __MINGW32__ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
119 _setmode(_fileno(stdin), _O_BINARY); |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
120 #elif defined __CYGWIN__ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
121 /* almost certainly not needed for any modern Cygwin, but let's be safe... */ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
122 setmode(_fileno(stdin), _O_BINARY); |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
123 #endif |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
124 |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
125 return stdin; |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
126 } |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
127 |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
128 FILE *grabbag__file_get_binary_stdout() |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
129 { |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
130 /* if something breaks here it is probably due to the presence or |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
131 * absence of an underscore before the identifiers 'setmode', |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
132 * 'fileno', and/or 'O_BINARY'; check your system header files. |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
133 */ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
134 #if defined _MSC_VER || defined __MINGW32__ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
135 _setmode(_fileno(stdout), _O_BINARY); |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
136 #elif defined __CYGWIN__ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
137 /* almost certainly not needed for any modern Cygwin, but let's be safe... */ |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
138 setmode(_fileno(stdout), _O_BINARY); |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
139 #endif |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
140 |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
141 return stdout; |
4b31176c198a
[svn] - 1.1.2 compatible plugin (I HATE YOU FLAC PEOPLE)
nenolod
parents:
diff
changeset
|
142 } |