Mercurial > audlegacy
annotate src/audacious/vfs_buffered_file.c @ 2373:ad1d7687814c trunk
[svn] made strings.h for existing strings.c, cleanups
author | mf0102 |
---|---|
date | Sat, 20 Jan 2007 04:48:41 -0800 |
parents | d68e6f302855 |
children | 6c5d4d28cc6b |
rev | line source |
---|---|
2341
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
1 /* Audacious |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
2 * Copyright (c) 2006-2007 William Pitcock |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
3 * |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
6 * the Free Software Foundation; under version 2 of the License. |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
7 * |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
8 * This program is distributed in the hope that it will be useful, |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
11 * GNU General Public License for more details. |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
12 * |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
13 * You should have received a copy of the GNU General Public License |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
14 * along with this program; if not, write to the Free Software |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
16 * 02110-1301, USA. |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
17 */ |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
18 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
19 #include <glib.h> |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
20 #include <string.h> |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
21 #include "vfs.h" |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
22 #include "vfs_buffer.h" |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
23 #include "vfs_buffered_file.h" |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
24 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
25 VFSFile * |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
26 buffered_file_vfs_fopen_impl(const gchar * path, |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
27 const gchar * mode) |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
28 { |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
29 return NULL; |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
30 } |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
31 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
32 gint |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
33 buffered_file_vfs_fclose_impl(VFSFile * file) |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
34 { |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
35 g_return_val_if_fail(file != NULL, -1); |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
36 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
37 if (file->handle) |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
38 { |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
39 VFSBufferedFile *handle = (VFSBufferedFile *) file->handle; |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
40 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
41 vfs_fclose(handle->fd); |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
42 vfs_fclose(handle->buffer); |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
43 g_free(handle->mem); |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
44 g_free(handle); |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
45 } |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
46 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
47 return 0; |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
48 } |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
49 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
50 size_t |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
51 buffered_file_vfs_fread_impl(gpointer i_ptr, |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
52 size_t size, |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
53 size_t nmemb, |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
54 VFSFile * file) |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
55 { |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
56 VFSBufferedFile *handle = (VFSBufferedFile *) file->handle; |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
57 |
2372 | 58 /* is this request within the buffered area, or should we switch to |
59 * an FD? --nenolod | |
60 */ | |
61 if ((vfs_ftell(handle->buffer)) + (size * nmemb) >= | |
62 ((VFSBuffer *) handle->buffer->handle)->size) | |
63 handle->which = TRUE; | |
64 | |
2341
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
65 return vfs_fread(i_ptr, size, nmemb, handle->which == TRUE ? handle->fd : handle->buffer); |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
66 } |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
67 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
68 size_t |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
69 buffered_file_vfs_fwrite_impl(gconstpointer i_ptr, |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
70 size_t size, |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
71 size_t nmemb, |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
72 VFSFile * file) |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
73 { |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
74 VFSBufferedFile *handle = (VFSBufferedFile *) file->handle; |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
75 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
76 return vfs_fwrite(i_ptr, size, nmemb, handle->fd); |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
77 } |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
78 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
79 gint |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
80 buffered_file_vfs_getc_impl(VFSFile *stream) |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
81 { |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
82 VFSBufferedFile *handle = (VFSBufferedFile *) stream->handle; |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
83 |
2371 | 84 /* is this request within the buffered area, or should we switch to |
85 * an FD? --nenolod | |
86 */ | |
2372 | 87 if ((vfs_ftell(handle->buffer)) + 1 >= |
2371 | 88 ((VFSBuffer *) handle->buffer->handle)->size) |
89 handle->which = TRUE; | |
90 | |
2341
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
91 return vfs_getc(handle->which == TRUE ? handle->fd : handle->buffer); |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
92 } |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
93 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
94 gint |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
95 buffered_file_vfs_ungetc_impl(gint c, VFSFile *stream) |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
96 { |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
97 return -1; |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
98 } |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
99 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
100 gint |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
101 buffered_file_vfs_fseek_impl(VFSFile * file, |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
102 glong offset, |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
103 gint whence) |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
104 { |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
105 VFSBufferedFile *handle = (VFSBufferedFile *) file->handle; |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
106 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
107 vfs_fseek(handle->buffer, offset, whence); |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
108 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
109 /* if we go OOB, switch to live FD */ |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
110 if (vfs_ftell(handle->buffer) > ((VFSBuffer *) handle->buffer->handle)->size) |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
111 { |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
112 vfs_rewind(handle->buffer); |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
113 handle->which = TRUE; |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
114 vfs_fseek(handle->buffer, offset, whence); |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
115 } |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
116 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
117 return 0; |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
118 } |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
119 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
120 void |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
121 buffered_file_vfs_rewind_impl(VFSFile * file) |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
122 { |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
123 VFSBufferedFile *handle = (VFSBufferedFile *) file->handle; |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
124 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
125 vfs_rewind(handle->buffer); |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
126 handle->which = FALSE; |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
127 } |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
128 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
129 glong |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
130 buffered_file_vfs_ftell_impl(VFSFile * file) |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
131 { |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
132 VFSBufferedFile *handle = (VFSBufferedFile *) file->handle; |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
133 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
134 return vfs_ftell(handle->which == TRUE ? handle->fd : handle->buffer); |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
135 } |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
136 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
137 gboolean |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
138 buffered_file_vfs_feof_impl(VFSFile * file) |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
139 { |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
140 VFSBufferedFile *handle = (VFSBufferedFile *) file->handle; |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
141 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
142 return vfs_feof(handle->which == TRUE ? handle->fd : handle->buffer); |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
143 } |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
144 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
145 gint |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
146 buffered_file_vfs_truncate_impl(VFSFile * file, glong size) |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
147 { |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
148 return 0; |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
149 } |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
150 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
151 VFSConstructor buffered_file_const = { |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
152 NULL, // not a normal VFS class |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
153 buffered_file_vfs_fopen_impl, |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
154 buffered_file_vfs_fclose_impl, |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
155 buffered_file_vfs_fread_impl, |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
156 buffered_file_vfs_fwrite_impl, |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
157 buffered_file_vfs_getc_impl, |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
158 buffered_file_vfs_ungetc_impl, |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
159 buffered_file_vfs_fseek_impl, |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
160 buffered_file_vfs_rewind_impl, |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
161 buffered_file_vfs_ftell_impl, |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
162 buffered_file_vfs_feof_impl, |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
163 buffered_file_vfs_truncate_impl |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
164 }; |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
165 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
166 VFSFile * |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
167 vfs_buffered_file_new_from_uri(gchar *uri) |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
168 { |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
169 VFSFile *handle; |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
170 VFSBufferedFile *fd; |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
171 gsize sz; |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
172 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
173 g_return_val_if_fail(uri != NULL, NULL); |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
174 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
175 handle = g_new0(VFSFile, 1); |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
176 fd = g_new0(VFSBufferedFile, 1); |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
177 fd->mem = g_malloc0(32768); |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
178 fd->fd = vfs_fopen(uri, "rb"); |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
179 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
180 sz = vfs_fread(fd->mem, 1, 32768, fd->fd); |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
181 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
182 fd->buffer = vfs_buffer_new(fd->mem, sz); |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
183 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
184 handle->handle = fd; |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
185 handle->base = &buffered_file_const; |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
186 |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
187 return handle; |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
188 } |
02a850a2533b
[svn] - automatically buffering deriv-class of VFSFile. will be used to speed up probing of network sources.
nenolod
parents:
diff
changeset
|
189 |