Mercurial > hg > xmms-sid
annotate src/xs_support.h @ 878:9d31c1344f26
Add xs_fsize() to the public functions.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 09 Nov 2012 05:14:41 +0200 |
parents | 3c3569894b23 |
children | 2a50d36215c3 |
rev | line source |
---|---|
526
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
1 #ifndef XS_SUPPORT_H |
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
2 #define XS_SUPPORT_H |
4 | 3 |
4 #ifdef __cplusplus | |
5 extern "C" { | |
6 #endif | |
7 | |
466
00a32ab5887d
Moved some things from xmms-sid.h to xs_support.h; File handling functions
Matti Hamalainen <ccr@tnsp.org>
parents:
452
diff
changeset
|
8 #ifdef HAVE_CONFIG_H |
00a32ab5887d
Moved some things from xmms-sid.h to xs_support.h; File handling functions
Matti Hamalainen <ccr@tnsp.org>
parents:
452
diff
changeset
|
9 #include <config.h> |
00a32ab5887d
Moved some things from xmms-sid.h to xs_support.h; File handling functions
Matti Hamalainen <ccr@tnsp.org>
parents:
452
diff
changeset
|
10 #endif |
00a32ab5887d
Moved some things from xmms-sid.h to xs_support.h; File handling functions
Matti Hamalainen <ccr@tnsp.org>
parents:
452
diff
changeset
|
11 |
00a32ab5887d
Moved some things from xmms-sid.h to xs_support.h; File handling functions
Matti Hamalainen <ccr@tnsp.org>
parents:
452
diff
changeset
|
12 #include <glib.h> |
226
858c09f59011
Moved some functions from xs_length.c here.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
13 #include <stdio.h> |
4 | 14 |
532 | 15 #ifdef AUDACIOUS_PLUGIN |
16 #include <audacious/plugin.h> | |
17 #include <audacious/output.h> | |
18 #else | |
19 #include <xmms/plugin.h> | |
535 | 20 #include <xmms/util.h> |
611
a751d2b85a7d
Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
537
diff
changeset
|
21 #include <xmms/titlestring.h> |
532 | 22 #endif |
23 | |
466
00a32ab5887d
Moved some things from xmms-sid.h to xs_support.h; File handling functions
Matti Hamalainen <ccr@tnsp.org>
parents:
452
diff
changeset
|
24 #ifdef HAVE_ASSERT_H |
00a32ab5887d
Moved some things from xmms-sid.h to xs_support.h; File handling functions
Matti Hamalainen <ccr@tnsp.org>
parents:
452
diff
changeset
|
25 #include <assert.h> |
00a32ab5887d
Moved some things from xmms-sid.h to xs_support.h; File handling functions
Matti Hamalainen <ccr@tnsp.org>
parents:
452
diff
changeset
|
26 #else |
00a32ab5887d
Moved some things from xmms-sid.h to xs_support.h; File handling functions
Matti Hamalainen <ccr@tnsp.org>
parents:
452
diff
changeset
|
27 #define assert(x) /* stub */ |
00a32ab5887d
Moved some things from xmms-sid.h to xs_support.h; File handling functions
Matti Hamalainen <ccr@tnsp.org>
parents:
452
diff
changeset
|
28 #endif |
00a32ab5887d
Moved some things from xmms-sid.h to xs_support.h; File handling functions
Matti Hamalainen <ccr@tnsp.org>
parents:
452
diff
changeset
|
29 |
218 | 30 #ifdef HAVE_STRING_H |
31 #include <string.h> | |
32 #else | |
33 #ifdef HAVE_STRINGS_H | |
34 #include <strings.h> | |
35 #endif | |
36 #endif | |
37 | |
38 #ifdef HAVE_MEMORY_H | |
39 #include <memory.h> | |
40 #endif | |
41 | |
452
aec9f4beb401
New file reading functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
398
diff
changeset
|
42 |
619
6f9c5bb127e6
Moved NLS macros to xs_support.h
Matti Hamalainen <ccr@tnsp.org>
parents:
611
diff
changeset
|
43 /* Standard gettext macros |
6f9c5bb127e6
Moved NLS macros to xs_support.h
Matti Hamalainen <ccr@tnsp.org>
parents:
611
diff
changeset
|
44 */ |
6f9c5bb127e6
Moved NLS macros to xs_support.h
Matti Hamalainen <ccr@tnsp.org>
parents:
611
diff
changeset
|
45 #ifdef ENABLE_NLS |
6f9c5bb127e6
Moved NLS macros to xs_support.h
Matti Hamalainen <ccr@tnsp.org>
parents:
611
diff
changeset
|
46 # include <libintl.h> |
6f9c5bb127e6
Moved NLS macros to xs_support.h
Matti Hamalainen <ccr@tnsp.org>
parents:
611
diff
changeset
|
47 # undef _ |
6f9c5bb127e6
Moved NLS macros to xs_support.h
Matti Hamalainen <ccr@tnsp.org>
parents:
611
diff
changeset
|
48 # define _(String) dgettext (PACKAGE, String) |
6f9c5bb127e6
Moved NLS macros to xs_support.h
Matti Hamalainen <ccr@tnsp.org>
parents:
611
diff
changeset
|
49 # ifdef gettext_noop |
6f9c5bb127e6
Moved NLS macros to xs_support.h
Matti Hamalainen <ccr@tnsp.org>
parents:
611
diff
changeset
|
50 # define N_(String) gettext_noop (String) |
6f9c5bb127e6
Moved NLS macros to xs_support.h
Matti Hamalainen <ccr@tnsp.org>
parents:
611
diff
changeset
|
51 # else |
6f9c5bb127e6
Moved NLS macros to xs_support.h
Matti Hamalainen <ccr@tnsp.org>
parents:
611
diff
changeset
|
52 # define N_(String) (String) |
6f9c5bb127e6
Moved NLS macros to xs_support.h
Matti Hamalainen <ccr@tnsp.org>
parents:
611
diff
changeset
|
53 # endif |
611
a751d2b85a7d
Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
537
diff
changeset
|
54 #else |
619
6f9c5bb127e6
Moved NLS macros to xs_support.h
Matti Hamalainen <ccr@tnsp.org>
parents:
611
diff
changeset
|
55 # define _LIBINTL_H |
6f9c5bb127e6
Moved NLS macros to xs_support.h
Matti Hamalainen <ccr@tnsp.org>
parents:
611
diff
changeset
|
56 # define textdomain(String) (String) |
6f9c5bb127e6
Moved NLS macros to xs_support.h
Matti Hamalainen <ccr@tnsp.org>
parents:
611
diff
changeset
|
57 # define gettext(String) (String) |
6f9c5bb127e6
Moved NLS macros to xs_support.h
Matti Hamalainen <ccr@tnsp.org>
parents:
611
diff
changeset
|
58 # define dgettext(Domain,Message) (Message) |
6f9c5bb127e6
Moved NLS macros to xs_support.h
Matti Hamalainen <ccr@tnsp.org>
parents:
611
diff
changeset
|
59 # define dcgettext(Domain,Message,Type) (Message) |
6f9c5bb127e6
Moved NLS macros to xs_support.h
Matti Hamalainen <ccr@tnsp.org>
parents:
611
diff
changeset
|
60 # define bindtextdomain(Domain,Directory) (Domain) |
6f9c5bb127e6
Moved NLS macros to xs_support.h
Matti Hamalainen <ccr@tnsp.org>
parents:
611
diff
changeset
|
61 # define _(String) (String) |
6f9c5bb127e6
Moved NLS macros to xs_support.h
Matti Hamalainen <ccr@tnsp.org>
parents:
611
diff
changeset
|
62 # define N_(String) (String) |
611
a751d2b85a7d
Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
537
diff
changeset
|
63 #endif |
a751d2b85a7d
Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
537
diff
changeset
|
64 |
619
6f9c5bb127e6
Moved NLS macros to xs_support.h
Matti Hamalainen <ccr@tnsp.org>
parents:
611
diff
changeset
|
65 |
771
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
66 /* Typedefs |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
67 */ |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
68 #ifdef AUDACIOUS_PLUGIN |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
69 #include <audacious/audutil.h> |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
70 #define XS_MD5HASH_LENGTH AUD_MD5HASH_LENGTH |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
71 #define XS_MD5HASH_LENGTH_CH AUD_MD5HASH_LENGTH_CH |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
72 #define xs_md5hash_t aud_md5hash_t |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
73 #define xs_md5state_t aud_md5state_t |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
74 #define xs_md5_init aud_md5_init |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
75 #define xs_md5_append aud_md5_append |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
76 #define xs_md5_finish aud_md5_finish |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
77 #else |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
78 |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
79 typedef struct md5_state_s { |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
80 guint32 bits[2]; /* message length in bits, lsw first */ |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
81 guint32 buf[4]; /* digest buffer */ |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
82 guint8 in[64]; /* accumulate block */ |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
83 } xs_md5state_t; |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
84 |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
85 #define XS_MD5HASH_LENGTH (16) |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
86 #define XS_MD5HASH_LENGTH_CH (XS_MD5HASH_LENGTH * 2) |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
87 |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
88 typedef guint8 xs_md5hash_t[XS_MD5HASH_LENGTH]; |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
89 |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
90 #endif /* AUDACIOUS_PLUGIN */ |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
91 |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
92 |
516
c192468eb8ce
Audacious VFS support functions finished.
Matti Hamalainen <ccr@tnsp.org>
parents:
506
diff
changeset
|
93 /* VFS replacement functions |
c192468eb8ce
Audacious VFS support functions finished.
Matti Hamalainen <ccr@tnsp.org>
parents:
506
diff
changeset
|
94 */ |
c192468eb8ce
Audacious VFS support functions finished.
Matti Hamalainen <ccr@tnsp.org>
parents:
506
diff
changeset
|
95 #ifdef __AUDACIOUS_NEWVFS__ |
751 | 96 #define XSFile VFSFile |
652 | 97 #define xs_fopen(a,b) aud_vfs_fopen(a,b) |
98 #define xs_fclose(a) aud_vfs_fclose(a) | |
99 #define xs_fgetc(a) aud_vfs_getc(a) | |
100 #define xs_fread(a,b,c,d) aud_vfs_fread(a,b,c,d) | |
101 #define xs_feof(a) aud_vfs_feof(a) | |
516
c192468eb8ce
Audacious VFS support functions finished.
Matti Hamalainen <ccr@tnsp.org>
parents:
506
diff
changeset
|
102 #define xs_ferror(a) (0) |
652 | 103 #define xs_ftell(a) aud_vfs_ftell(a) |
104 #define xs_fseek(a,b,c) aud_vfs_fseek(a,b,c) | |
866
6b47d9813067
Add xs_fsize() helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
781
diff
changeset
|
105 #define xs_fsize(a) aud_vfs_fsize(a) |
516
c192468eb8ce
Audacious VFS support functions finished.
Matti Hamalainen <ccr@tnsp.org>
parents:
506
diff
changeset
|
106 #else |
751 | 107 #define XSFile FILE |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
652
diff
changeset
|
108 #define xs_fopen(a,b) fopen(a,b) |
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
652
diff
changeset
|
109 #define xs_fclose(a) fclose(a) |
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
652
diff
changeset
|
110 #define xs_fgetc(a) fgetc(a) |
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
652
diff
changeset
|
111 #define xs_fread(a,b,c,d) fread(a,b,c,d) |
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
652
diff
changeset
|
112 #define xs_feof(a) feof(a) |
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
652
diff
changeset
|
113 #define xs_ferror(a) ferror(a) |
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
652
diff
changeset
|
114 #define xs_ftell(a) ftell(a) |
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
652
diff
changeset
|
115 #define xs_fseek(a,b,c) fseek(a,b,c) |
878
9d31c1344f26
Add xs_fsize() to the public functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
868
diff
changeset
|
116 off_t xs_fsize(XSFile *f); |
516
c192468eb8ce
Audacious VFS support functions finished.
Matti Hamalainen <ccr@tnsp.org>
parents:
506
diff
changeset
|
117 #endif |
868 | 118 |
751 | 119 guint16 xs_fread_be16(XSFile *); |
120 guint32 xs_fread_be32(XSFile *); | |
867
051ef70d0123
Improve xs_fload_buffer() and add xs_fload_buffer_path().
Matti Hamalainen <ccr@tnsp.org>
parents:
866
diff
changeset
|
121 gboolean xs_fload_buffer(const gchar *filename, |
051ef70d0123
Improve xs_fload_buffer() and add xs_fload_buffer_path().
Matti Hamalainen <ccr@tnsp.org>
parents:
866
diff
changeset
|
122 guint8 **pbuf, size_t *bufSize, const size_t maxSize, gboolean failMaxSize); |
051ef70d0123
Improve xs_fload_buffer() and add xs_fload_buffer_path().
Matti Hamalainen <ccr@tnsp.org>
parents:
866
diff
changeset
|
123 gboolean xs_fload_buffer_path(const gchar *ppath, const gchar *pfilename, |
051ef70d0123
Improve xs_fload_buffer() and add xs_fload_buffer_path().
Matti Hamalainen <ccr@tnsp.org>
parents:
866
diff
changeset
|
124 guint8 **pbuf, size_t *bufSize, const size_t maxSize, gboolean failMaxSize); |
398 | 125 |
516
c192468eb8ce
Audacious VFS support functions finished.
Matti Hamalainen <ccr@tnsp.org>
parents:
506
diff
changeset
|
126 |
c192468eb8ce
Audacious VFS support functions finished.
Matti Hamalainen <ccr@tnsp.org>
parents:
506
diff
changeset
|
127 /* Misc functions |
c192468eb8ce
Audacious VFS support functions finished.
Matti Hamalainen <ccr@tnsp.org>
parents:
506
diff
changeset
|
128 */ |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
129 gint xs_pstrcpy(gchar **, const gchar *); |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
130 gint xs_pstrcat(gchar **, const gchar *); |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
131 void xs_pnstrcat(gchar *, size_t, const gchar *); |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
132 void xs_findnext(const gchar *, size_t *); |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
133 void xs_findeol(const gchar *, size_t *); |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
134 void xs_findnum(const gchar *, size_t *); |
4 | 135 |
714
229fa2d043b9
Moved filter routines to xs_support.[ch].
Matti Hamalainen <ccr@tnsp.org>
parents:
706
diff
changeset
|
136 |
781
69ab3df105c1
Fix an #ifdef, it was reversed.
Matti Hamalainen <ccr@tnsp.org>
parents:
771
diff
changeset
|
137 #ifndef AUDACIOUS_PLUGIN |
771
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
138 void xs_md5_init(xs_md5state_t *ctx); |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
139 void xs_md5_append(xs_md5state_t *ctx, const guint8 *buf, guint len); |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
140 void xs_md5_finish(xs_md5state_t *ctx, xs_md5hash_t digest); |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
141 #endif |
469b341734b2
Move MD5 implementation into xs_support, and some related Audacious
Matti Hamalainen <ccr@tnsp.org>
parents:
763
diff
changeset
|
142 |
4 | 143 #ifdef __cplusplus |
144 } | |
145 #endif | |
526
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
516
diff
changeset
|
146 #endif /* XS_SUPPORT_H */ |