archrelease: copy trunk to extra-x86_64
[arch-packages.git] / id3lib / trunk / 60-add-c-wrapper-functions.patch
blobd72e81c0ec7d5f8ed6dcc3218174e526abbfc137
1 This patch adds C wrapper functions for field encoding.
3 It was first introduced in version 3.8.3-8 and fixes
4 http://bugs.debian.org/281292
5 --- a/include/id3.h
6 +++ b/include/id3.h
7 @@ -104,6 +104,9 @@
8 ID3_C_EXPORT void CCONV ID3Field_GetBINARY (const ID3Field *field, uchar *buffer, size_t buffLength);
9 ID3_C_EXPORT void CCONV ID3Field_FromFile (ID3Field *field, const char *fileName);
10 ID3_C_EXPORT void CCONV ID3Field_ToFile (const ID3Field *field, const char *fileName);
11 + ID3_C_EXPORT bool CCONV ID3Field_SetEncoding (ID3Field *field, ID3_TextEnc enc);
12 + ID3_C_EXPORT ID3_TextEnc CCONV ID3Field_GetEncoding (const ID3Field *field);
13 + ID3_C_EXPORT bool CCONV ID3Field_IsEncodable (const ID3Field *field);
15 /* field-info wrappers */
16 ID3_C_EXPORT char* CCONV ID3FrameInfo_ShortName (ID3_FrameID frameid);
17 --- a/src/c_wrapper.cpp
18 +++ b/src/c_wrapper.cpp
19 @@ -681,6 +681,39 @@
23 + ID3_C_EXPORT bool CCONV
24 + ID3Field_SetEncoding(ID3Field *field, ID3_TextEnc enc)
25 + {
26 + bool changed = false;
27 + if (field)
28 + {
29 + ID3_CATCH(changed = reinterpret_cast<ID3_Field *>(field)->SetEncoding(enc));
30 + }
31 + return changed;
32 + }
34 + ID3_C_EXPORT ID3_TextEnc CCONV
35 + ID3Field_GetEncoding(const ID3Field *field)
36 + {
37 + ID3_TextEnc enc = ID3TE_NONE;
38 + if (field)
39 + {
40 + ID3_CATCH(enc = reinterpret_cast<const ID3_Field *>(field)->GetEncoding());
41 + }
42 + return enc;
43 + }
45 + ID3_C_EXPORT bool CCONV
46 + ID3Field_IsEncodable(const ID3Field *field)
47 + {
48 + bool isEncodable = false;
49 + if (field)
50 + {
51 + ID3_CATCH(isEncodable = reinterpret_cast<const ID3_Field *>(field)->IsEncodable());
52 + }
53 + return isEncodable;
54 + }
56 #ifdef __cplusplus
58 #endif /* __cplusplus */