~ubuntu-branches/debian/sid/audacious-plugins/sid

« back to all changes in this revision

Viewing changes to src/vfstrace/vfstrace.c

  • Committer: Bazaar Package Importer
  • Author(s): Bilal Akhtar
  • Date: 2011-04-10 18:56:21 UTC
  • mfrom: (1.1.14 upstream) (2.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20110410185621-7eg1k5a7v3f4aqrn
Tags: 2.4.4-1
* New upstream release.
  - Fix FTBFS with GCC 4.5 (Closes: #621989)
* Upload to unstable.
* debian/control:
  - Update versioned dependencies according to upstream changes.
  - Bump Standards-Version to 3.9.2 (no changes needed).
  - Since the package will be building against the new FFMpeg libs,
    fix the problem of depending on old uninstallable libav*
    packages (Closes: #617603)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*  Audacious
2
 
 *  Copyright (c) 2009 William Pitcock
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 2 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, write to the Free Software
16
 
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
 
 */
18
 
 
19
 
#include <audacious/plugin.h>
20
 
#include "config.h"
21
 
#ifdef HAVE_INTTYPES_H
22
 
#include <inttypes.h>
23
 
#else
24
 
#define PRIu64 "llu"
25
 
#endif
26
 
 
27
 
VFSFile *(*vfs_fopen_impl)(const gchar *path, const gchar *mode) = NULL;
28
 
gint (*vfs_fclose_impl)(VFSFile * file) = NULL;
29
 
gsize (*vfs_fread_impl)(gpointer ptr, gsize size, gsize nmemb, VFSFile *file) = NULL;
30
 
gsize (*vfs_fwrite_impl)(gconstpointer ptr, gsize size, gsize nmemb, VFSFile *file) = NULL;
31
 
gint (*vfs_getc_impl)(VFSFile *stream) = NULL;
32
 
gint (*vfs_ungetc_impl)(gint c, VFSFile *stream) = NULL;
33
 
gint (*vfs_fseek_impl)(VFSFile *file, glong offset, gint whence) = NULL;
34
 
void (*vfs_rewind_impl)(VFSFile *file) = NULL;
35
 
glong (*vfs_ftell_impl)(VFSFile *file) = NULL;
36
 
gboolean (*vfs_feof_impl)(VFSFile *file) = NULL;
37
 
gboolean (*vfs_truncate_impl)(VFSFile *file, glong length) = NULL;
38
 
off_t (*vfs_fsize_impl)(VFSFile *file) = NULL;
39
 
 
40
 
VFSFile *
41
 
vt_vfs_fopen_impl(const gchar *path, const gchar *mode)
42
 
{
43
 
    VFSFile *ret;
44
 
 
45
 
    ret = vfs_fopen_impl(path, mode);
46
 
    g_print("%p fopen       : path:%s : mode:%s : ret:%p\n", ret, path, mode, ret);
47
 
 
48
 
    return ret;
49
 
}
50
 
 
51
 
gint
52
 
vt_vfs_fclose_impl(VFSFile *file)
53
 
{
54
 
    gint ret;
55
 
 
56
 
    ret = vfs_fclose_impl(file);
57
 
    g_print("%p fclose      : file:%p : ret:%d\n", file, file, ret);
58
 
 
59
 
    return ret;
60
 
}
61
 
 
62
 
gsize
63
 
vt_vfs_fread_impl(gpointer ptr, gsize size, gsize nmemb, VFSFile *file)
64
 
{
65
 
    gsize ret;
66
 
 
67
 
    ret = vfs_fread_impl(ptr, size, nmemb, file);
68
 
    g_print("%p fread       : size:%" PRIu64 " : nmemb:%" PRIu64 " : ret:%" PRIu64 "\n",
69
 
        file, (guint64) size, (guint64) nmemb, (guint64) ret);
70
 
 
71
 
    return ret;
72
 
}
73
 
 
74
 
gsize
75
 
vt_vfs_fwrite_impl(gconstpointer ptr, gsize size, gsize nmemb, VFSFile *file)
76
 
{
77
 
    gsize ret;
78
 
 
79
 
    ret = vfs_fwrite_impl(ptr, size, nmemb, file);
80
 
    g_print("%p fwrite      : size:%" PRIu64 " : nmemb:%" PRIu64 " : ret:%" PRIu64 "\n",
81
 
        file, (guint64) size, (guint64) nmemb, (guint64) ret);
82
 
 
83
 
    return ret;
84
 
}
85
 
 
86
 
gint
87
 
vt_vfs_getc_impl(VFSFile *stream)
88
 
{
89
 
    gint ret;
90
 
 
91
 
    ret = vfs_getc_impl(stream);
92
 
    g_print("%p getc        : ret:%d\n", stream, ret);
93
 
 
94
 
    return ret;
95
 
}
96
 
 
97
 
gint
98
 
vt_vfs_ungetc_impl(gint c, VFSFile *stream)
99
 
{
100
 
    gint ret;
101
 
 
102
 
    ret = vfs_ungetc_impl(c, stream);
103
 
    g_print("%p ungetc      : c:%d : ret:%d\n", stream, c, ret);
104
 
 
105
 
    return ret;
106
 
}
107
 
 
108
 
gint
109
 
vt_vfs_fseek_impl(VFSFile *file, glong offset, gint whence)
110
 
{
111
 
    gint ret;
112
 
 
113
 
    ret = vfs_fseek_impl(file, offset, whence);
114
 
    g_print("%p fseek       : offset:%ld : whence:%d : ret:%d\n", file, offset, whence, ret);
115
 
 
116
 
    return ret;
117
 
}
118
 
 
119
 
void
120
 
vt_vfs_rewind_impl(VFSFile *file)
121
 
{
122
 
    vfs_rewind_impl(file);
123
 
    g_print("%p rewind\n", file);
124
 
}
125
 
 
126
 
glong
127
 
vt_vfs_ftell_impl(VFSFile *file)
128
 
{
129
 
    glong ret;
130
 
 
131
 
    ret = vfs_ftell_impl(file);
132
 
    g_print("%p ftell       : ret:%ld\n", file, ret);
133
 
 
134
 
    return ret;
135
 
}
136
 
 
137
 
gboolean
138
 
vt_vfs_feof_impl(VFSFile *file)
139
 
{
140
 
    gboolean ret;
141
 
 
142
 
    ret = vfs_feof_impl(file);
143
 
    g_print("%p feof        : ret:%d\n", file, ret);
144
 
 
145
 
    return ret;
146
 
}
147
 
 
148
 
gboolean
149
 
vt_vfs_truncate_impl(VFSFile *file, glong length)
150
 
{
151
 
    gboolean ret;
152
 
 
153
 
    ret = vfs_truncate_impl(file, length);
154
 
    g_print("%p truncate    : length:%ld : ret:%d\n", file, length, ret);
155
 
 
156
 
    return ret;
157
 
}
158
 
 
159
 
off_t
160
 
vt_vfs_fsize_impl(VFSFile *file)
161
 
{
162
 
    off_t ret;
163
 
 
164
 
    ret = vfs_fsize_impl(file);
165
 
    g_print("%p fsize       : ret:%lu\n", file, ret);
166
 
 
167
 
    return ret;
168
 
}
169
 
 
170
 
void
171
 
patch_vfs(void)
172
 
{
173
 
    vfs_fopen_impl = aud_vfs_fopen;
174
 
    vfs_fclose_impl = aud_vfs_fclose;
175
 
    vfs_fread_impl = aud_vfs_fread;
176
 
    vfs_fwrite_impl = aud_vfs_fwrite;
177
 
    vfs_getc_impl = aud_vfs_getc;
178
 
    vfs_ungetc_impl = aud_vfs_ungetc;
179
 
    vfs_fseek_impl = aud_vfs_fseek;
180
 
    vfs_rewind_impl = aud_vfs_rewind;
181
 
    vfs_ftell_impl = aud_vfs_ftell;
182
 
    vfs_feof_impl = aud_vfs_feof;
183
 
    vfs_truncate_impl = aud_vfs_truncate;
184
 
    vfs_fsize_impl = aud_vfs_fsize;
185
 
 
186
 
    aud_vfs_fopen = vt_vfs_fopen_impl;
187
 
    aud_vfs_fclose = vt_vfs_fclose_impl;
188
 
    aud_vfs_fread = vt_vfs_fread_impl;
189
 
    aud_vfs_fwrite = vt_vfs_fwrite_impl;
190
 
    aud_vfs_getc = vt_vfs_getc_impl;
191
 
    aud_vfs_ungetc = vt_vfs_ungetc_impl;
192
 
    aud_vfs_fseek = vt_vfs_fseek_impl;
193
 
    aud_vfs_rewind = vt_vfs_rewind_impl;
194
 
    aud_vfs_ftell = vt_vfs_ftell_impl;
195
 
    aud_vfs_feof = vt_vfs_feof_impl;
196
 
    aud_vfs_truncate = vt_vfs_truncate_impl;
197
 
    aud_vfs_fsize = vt_vfs_fsize_impl;
198
 
}
199
 
 
200
 
void
201
 
unpatch_vfs(void)
202
 
{
203
 
    aud_vfs_fopen = vfs_fopen_impl;
204
 
    aud_vfs_fclose = vfs_fclose_impl;
205
 
    aud_vfs_fread = vfs_fread_impl;
206
 
    aud_vfs_fwrite = vfs_fwrite_impl;
207
 
    aud_vfs_getc = vfs_getc_impl;
208
 
    aud_vfs_ungetc = vfs_ungetc_impl;
209
 
    aud_vfs_fseek = vfs_fseek_impl;
210
 
    aud_vfs_rewind = vfs_rewind_impl;
211
 
    aud_vfs_ftell = vfs_ftell_impl;
212
 
    aud_vfs_feof = vfs_feof_impl;
213
 
    aud_vfs_truncate = vfs_truncate_impl;
214
 
    aud_vfs_fsize = vfs_fsize_impl;
215
 
}
216
 
 
217
 
static GeneralPlugin vfstrace_plugin =
218
 
{
219
 
     .description = "VFSTrace",
220
 
     .init = patch_vfs,
221
 
     .cleanup = unpatch_vfs,
222
 
};
223
 
 
224
 
GeneralPlugin *vfstrace_gplist[] = { &vfstrace_plugin, NULL };
225
 
SIMPLE_GENERAL_PLUGIN(vfstrace, vfstrace_gplist);
226