1 // $Id: c_wrapper.cpp,v 1.22 2002/09/21 17:23:32 t1mpy Exp $
2 
3 // id3lib: a C++ library for creating and manipulating id3v1/v2 tags
4 // Copyright 1999, 2000  Scott Thomas Haug
5 // Copyright 2002 Thijmen Klok (thijmen@id3lib.org)
6 
7 // This library is free software; you can redistribute it and/or modify it
8 // under the terms of the GNU Library General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or (at your
10 // option) any later version.
11 //
12 // This library is distributed in the hope that it will be useful, but WITHOUT
13 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
15 // License for more details.
16 //
17 // You should have received a copy of the GNU Library General Public License
18 // along with this library; if not, write to the Free Software Foundation,
19 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 
21 // The id3lib authors encourage improvements and optimisations to be sent to
22 // the id3lib coordinator.  Please see the README file for details on where to
23 // send such submissions.  See the AUTHORS file for a list of people who have
24 // contributed to id3lib.  See the ChangeLog file for a list of changes to
25 // id3lib.  These files are distributed with id3lib at
26 // http://download.sourceforge.net/id3lib/
27 
28 //#include <string.h>
29 #include "id3.h"
30 #include "tag.h"
31 #include "field.h"
32 
33 #if defined HAVE_CONFIG_H
34 #include <config.h>
35 #endif
36 
37 #ifdef __cplusplus
38 extern "C"
39 {
40 #endif /* __cplusplus */
41 
42   // tag wrappers
43 
44 #define ID3_CATCH(code) try { code; } catch (...) { }
45 
46   ID3_C_EXPORT ID3Tag* CCONV
ID3Tag_New(void)47   ID3Tag_New(void)
48   {
49     ID3_Tag* tag = NULL;
50     ID3_CATCH(tag = new ID3_Tag);
51     return reinterpret_cast<ID3Tag *>(tag);
52   }
53 
54 
55   ID3_C_EXPORT void CCONV
ID3Tag_Delete(ID3Tag * tag)56   ID3Tag_Delete(ID3Tag *tag)
57   {
58     if (tag)
59     {
60       ID3_CATCH(delete reinterpret_cast<ID3_Tag*>(tag));
61     }
62   }
63 
64 
65   ID3_C_EXPORT void CCONV
ID3Tag_Clear(ID3Tag * tag)66   ID3Tag_Clear(ID3Tag *tag)
67   {
68     if (tag)
69     {
70       ID3_CATCH(reinterpret_cast<ID3_Tag*>(tag)->Clear());
71     }
72   }
73 
74 
75   ID3_C_EXPORT bool CCONV
ID3Tag_HasChanged(const ID3Tag * tag)76   ID3Tag_HasChanged(const ID3Tag *tag)
77   {
78     bool changed = false;
79 
80     if (tag)
81     {
82       ID3_CATCH(changed = reinterpret_cast<const ID3_Tag * >(tag)->HasChanged());
83     }
84 
85     return changed;
86   }
87 
88 
89   ID3_C_EXPORT void CCONV
ID3Tag_SetUnsync(ID3Tag * tag,bool unsync)90   ID3Tag_SetUnsync(ID3Tag *tag, bool unsync)
91   {
92     if (tag)
93     {
94       ID3_CATCH(reinterpret_cast<ID3_Tag *>(tag)->SetUnsync(unsync));
95     }
96   }
97 
98 
99   ID3_C_EXPORT void CCONV
ID3Tag_SetExtendedHeader(ID3Tag * tag,bool ext)100   ID3Tag_SetExtendedHeader(ID3Tag *tag, bool ext)
101   {
102     if (tag)
103     {
104       ID3_CATCH(reinterpret_cast<ID3_Tag *>(tag)->SetExtendedHeader(ext));
105     }
106   }
107 
108   ID3_C_EXPORT void CCONV
ID3Tag_SetPadding(ID3Tag * tag,bool pad)109   ID3Tag_SetPadding(ID3Tag *tag, bool pad)
110   {
111     if (tag)
112     {
113       ID3_CATCH(reinterpret_cast<ID3_Tag *>(tag)->SetPadding(pad));
114     }
115   }
116 
117 
118   ID3_C_EXPORT void CCONV
ID3Tag_AddFrame(ID3Tag * tag,const ID3Frame * frame)119   ID3Tag_AddFrame(ID3Tag *tag, const ID3Frame *frame)
120   {
121     if (tag)
122     {
123       ID3_CATCH(reinterpret_cast<ID3_Tag *>(tag)->AddFrame(reinterpret_cast<const ID3_Frame *>(frame)));
124     }
125   }
126 
127 
128   ID3_C_EXPORT bool CCONV
ID3Tag_AttachFrame(ID3Tag * tag,ID3Frame * frame)129   ID3Tag_AttachFrame(ID3Tag *tag, ID3Frame *frame)
130   {
131     bool b = false;
132     if (tag)
133     {
134       ID3_CATCH(b = reinterpret_cast<ID3_Tag *>(tag)->AttachFrame(reinterpret_cast<ID3_Frame *>(frame)));
135     }
136     return b;
137   }
138 
139 
140   ID3_C_EXPORT void CCONV
ID3Tag_AddFrames(ID3Tag * tag,const ID3Frame * frames,size_t num)141   ID3Tag_AddFrames(ID3Tag *tag, const ID3Frame *frames, size_t num)
142   {
143     if (tag)
144     {
145       ID3_CATCH(reinterpret_cast<ID3_Tag *>(tag)->AddFrames(reinterpret_cast<const ID3_Frame *>(frames), num));
146     }
147   }
148 
149 
150   ID3_C_EXPORT ID3Frame* CCONV
ID3Tag_RemoveFrame(ID3Tag * tag,const ID3Frame * frame)151   ID3Tag_RemoveFrame(ID3Tag *tag, const ID3Frame *frame)
152   {
153     ID3_Frame* rem_frame = NULL;
154     if (tag)
155     {
156       ID3_CATCH(rem_frame = reinterpret_cast<ID3_Tag *>(tag)->RemoveFrame(reinterpret_cast<const ID3_Frame *>(frame)));
157     }
158     return reinterpret_cast<ID3Frame*>(rem_frame);
159   }
160 
161 
162   ID3_C_EXPORT ID3_Err CCONV
ID3Tag_Parse(ID3Tag * tag,const uchar header[ID3_TAGHEADERSIZE],const uchar * buffer)163   ID3Tag_Parse(ID3Tag *tag, const uchar header[ ID3_TAGHEADERSIZE ],
164                const uchar *buffer)
165   {
166     size_t size = 0;
167     if (tag)
168     {
169       ID3_CATCH(size = reinterpret_cast<ID3_Tag *>(tag)->Parse(header, buffer));
170     }
171     return ID3E_NoError;
172   }
173 
174 
175   ID3_C_EXPORT size_t CCONV
ID3Tag_Link(ID3Tag * tag,const char * fileName)176   ID3Tag_Link(ID3Tag *tag, const char *fileName)
177   {
178     size_t offset = 0;
179     if (tag)
180     {
181       ID3_CATCH(offset = reinterpret_cast<ID3_Tag *>(tag)->Link(fileName));
182     }
183     return offset;
184   }
185 
186   ID3_C_EXPORT size_t CCONV
ID3Tag_LinkWithFlags(ID3Tag * tag,const char * fileName,flags_t flags)187   ID3Tag_LinkWithFlags(ID3Tag *tag, const char *fileName, flags_t flags)
188   {
189     size_t offset = 0;
190     if (tag)
191     {
192       ID3_CATCH(offset = reinterpret_cast<ID3_Tag *>(tag)->Link(fileName,flags));
193     }
194     return offset;
195   }
196 
197 
198 
199   ID3_C_EXPORT ID3_Err CCONV
ID3Tag_Update(ID3Tag * tag)200   ID3Tag_Update(ID3Tag *tag)
201   {
202     flags_t flags = 0;
203     if (tag)
204     {
205       ID3_CATCH(flags = reinterpret_cast<ID3_Tag *>(tag)->Update());
206     }
207     return ID3E_NoError;
208   }
209 
210   ID3_C_EXPORT ID3_Err CCONV
ID3Tag_UpdateByTagType(ID3Tag * tag,flags_t tag_type)211   ID3Tag_UpdateByTagType(ID3Tag *tag, flags_t tag_type)
212   {
213     flags_t flags = 0;
214     if (tag)
215     {
216       ID3_CATCH(flags = reinterpret_cast<ID3_Tag *>(tag)->Update(tag_type));
217     }
218     return ID3E_NoError;
219   }
220 
221 
222   ID3_C_EXPORT ID3_Err CCONV
ID3Tag_Strip(ID3Tag * tag,flags_t ulTagFlags)223   ID3Tag_Strip(ID3Tag *tag, flags_t ulTagFlags)
224   {
225     if (tag)
226     {
227       ID3_CATCH(reinterpret_cast<ID3_Tag *>(tag)->Strip(ulTagFlags));
228     }
229     return ID3E_NoError;
230   }
231 
232 
233   ID3_C_EXPORT ID3Frame* CCONV
ID3Tag_FindFrameWithID(const ID3Tag * tag,ID3_FrameID id)234   ID3Tag_FindFrameWithID(const ID3Tag *tag, ID3_FrameID id)
235   {
236     ID3_Frame *frame = NULL;
237 
238     if (tag)
239     {
240       ID3_CATCH(frame = reinterpret_cast<const ID3_Tag *>(tag)->Find(id));
241     }
242 
243     return reinterpret_cast<ID3Frame *>(frame);
244   }
245 
246 
247   ID3_C_EXPORT ID3Frame* CCONV
ID3Tag_FindFrameWithINT(const ID3Tag * tag,ID3_FrameID id,ID3_FieldID fld,uint32 data)248   ID3Tag_FindFrameWithINT(const ID3Tag *tag, ID3_FrameID id,
249                           ID3_FieldID fld, uint32 data)
250   {
251     ID3_Frame *frame = NULL;
252 
253     if (tag)
254     {
255       ID3_CATCH(frame = reinterpret_cast<const ID3_Tag *>(tag)->Find(id, fld, data));
256     }
257 
258     return reinterpret_cast<ID3Frame *>(frame);
259   }
260 
261 
262   ID3_C_EXPORT ID3Frame* CCONV
ID3Tag_FindFrameWithASCII(const ID3Tag * tag,ID3_FrameID id,ID3_FieldID fld,const char * data)263   ID3Tag_FindFrameWithASCII(const ID3Tag *tag, ID3_FrameID id,
264                             ID3_FieldID fld, const char *data)
265   {
266     ID3_Frame *frame = NULL;
267 
268     if (tag)
269     {
270       ID3_CATCH(frame = reinterpret_cast<const ID3_Tag *>(tag)->Find(id, fld, data));
271     }
272 
273     return reinterpret_cast<ID3Frame *>(frame);
274   }
275 
276 
277   ID3_C_EXPORT ID3Frame* CCONV
ID3Tag_FindFrameWithUNICODE(const ID3Tag * tag,ID3_FrameID id,ID3_FieldID fld,const unicode_t * data)278   ID3Tag_FindFrameWithUNICODE(const ID3Tag *tag, ID3_FrameID id,
279                               ID3_FieldID fld, const unicode_t *data)
280   {
281     ID3_Frame *frame = NULL;
282 
283     if (tag)
284     {
285       ID3_CATCH(frame = reinterpret_cast<const ID3_Tag *>(tag)->Find(id, fld, data));
286     }
287 
288     return reinterpret_cast<ID3Frame *>(frame);
289   }
290 
291 
292   ID3_C_EXPORT size_t CCONV
ID3Tag_NumFrames(const ID3Tag * tag)293   ID3Tag_NumFrames(const ID3Tag *tag)
294   {
295     size_t num = 0;
296 
297     if (tag)
298     {
299       ID3_CATCH(num = reinterpret_cast<const ID3_Tag *>(tag)->NumFrames());
300     }
301 
302     return num;
303   }
304 
305 
306   ID3_C_EXPORT bool CCONV
ID3Tag_HasTagType(const ID3Tag * tag,ID3_TagType tt)307   ID3Tag_HasTagType(const ID3Tag *tag, ID3_TagType tt)
308   {
309     bool has_tt = false;
310 
311     if (tag)
312     {
313       ID3_CATCH(has_tt = reinterpret_cast<const ID3_Tag *>(tag)->HasTagType(tt));
314     }
315 
316     return has_tt;
317   }
318 
319   ID3_C_EXPORT ID3TagIterator* CCONV
ID3Tag_CreateIterator(ID3Tag * tag)320   ID3Tag_CreateIterator(ID3Tag* tag)
321   {
322     ID3_Tag::Iterator* iter = NULL;
323 
324     if (tag)
325     {
326       ID3_CATCH(iter = reinterpret_cast<ID3_Tag*>(tag)->CreateIterator());
327     }
328 
329     return reinterpret_cast<ID3TagIterator*>(iter);
330   }
331 
332   ID3_C_EXPORT ID3TagConstIterator* CCONV
ID3Tag_CreateConstIterator(const ID3Tag * tag)333   ID3Tag_CreateConstIterator(const ID3Tag* tag)
334   {
335     ID3_Tag::ConstIterator* iter = NULL;
336 
337     if (tag)
338     {
339       ID3_CATCH(iter = reinterpret_cast<const ID3_Tag*>(tag)->CreateIterator());
340     }
341 
342     return reinterpret_cast<ID3TagConstIterator*>(iter);
343   }
344 
345   ID3_C_EXPORT void CCONV
ID3TagIterator_Delete(ID3TagIterator * iter)346   ID3TagIterator_Delete(ID3TagIterator *iter)
347   {
348     if (iter)
349     {
350       ID3_CATCH(delete reinterpret_cast<ID3_Tag::Iterator*>(iter));
351     }
352   }
353 
354   ID3_C_EXPORT ID3Frame* CCONV
ID3TagIterator_GetNext(ID3TagIterator * iter)355   ID3TagIterator_GetNext(ID3TagIterator *iter)
356   {
357     ID3_Frame* frame = NULL;
358     if (iter)
359     {
360       ID3_CATCH(frame = reinterpret_cast<ID3_Tag::Iterator*>(iter)->GetNext());
361     }
362     return reinterpret_cast<ID3Frame*>(frame);
363   }
364 
365   ID3_C_EXPORT void CCONV
ID3TagConstIterator_Delete(ID3TagConstIterator * iter)366   ID3TagConstIterator_Delete(ID3TagConstIterator *iter)
367   {
368     if (iter)
369     {
370       ID3_CATCH(delete reinterpret_cast<ID3_Tag::ConstIterator*>(iter));
371     }
372   }
373 
374   ID3_C_EXPORT const ID3Frame* CCONV
ID3TagConstIterator_GetNext(ID3TagConstIterator * iter)375   ID3TagConstIterator_GetNext(ID3TagConstIterator *iter)
376   {
377     const ID3_Frame* frame = NULL;
378     if (iter)
379     {
380       ID3_CATCH(frame = reinterpret_cast<ID3_Tag::ConstIterator*>(iter)->GetNext());
381     }
382     return reinterpret_cast<const ID3Frame*>(frame);
383   }
384 
385   // frame wrappers
386 
387   ID3_C_EXPORT ID3Frame* CCONV
ID3Frame_New(void)388   ID3Frame_New(void)
389   {
390     ID3_Frame* frame = NULL;
391     ID3_CATCH(frame = new ID3_Frame);
392     return reinterpret_cast<ID3Frame *>(frame);
393   }
394 
395   ID3_C_EXPORT ID3Frame* CCONV
ID3Frame_NewID(ID3_FrameID id)396   ID3Frame_NewID(ID3_FrameID id)
397   {
398     ID3_Frame* frame = NULL;
399     ID3_CATCH(frame = new ID3_Frame(id));
400     return reinterpret_cast<ID3Frame *>(frame);
401   }
402 
403   ID3_C_EXPORT void CCONV
ID3Frame_Delete(ID3Frame * frame)404   ID3Frame_Delete(ID3Frame *frame)
405   {
406     if (frame)
407     {
408       ID3_CATCH(delete reinterpret_cast<ID3_Frame *>(frame));
409     }
410   }
411 
412 
413   ID3_C_EXPORT void CCONV
ID3Frame_Clear(ID3Frame * frame)414   ID3Frame_Clear(ID3Frame *frame)
415   {
416     if (frame)
417     {
418       ID3_CATCH(reinterpret_cast<ID3_Frame *>(frame)->Clear());
419     }
420   }
421 
422 
423   ID3_C_EXPORT void CCONV
ID3Frame_SetID(ID3Frame * frame,ID3_FrameID id)424   ID3Frame_SetID(ID3Frame *frame, ID3_FrameID id)
425   {
426     if (frame)
427     {
428       ID3_CATCH(reinterpret_cast<ID3_Frame *>(frame)->SetID(id));
429     }
430   }
431 
432 
433   ID3_C_EXPORT ID3_FrameID CCONV
ID3Frame_GetID(const ID3Frame * frame)434   ID3Frame_GetID(const ID3Frame *frame)
435   {
436     ID3_FrameID id = ID3FID_NOFRAME;
437 
438     if (frame)
439     {
440       ID3_CATCH(id = reinterpret_cast<const ID3_Frame *>(frame)->GetID());
441     }
442 
443     return id;
444   }
445 
446 
447   ID3_C_EXPORT ID3Field* CCONV
ID3Frame_GetField(const ID3Frame * frame,ID3_FieldID name)448   ID3Frame_GetField(const ID3Frame *frame, ID3_FieldID name)
449   {
450     ID3_Field *field = NULL;
451 
452     if (frame)
453     {
454       ID3_CATCH(field = reinterpret_cast<const ID3_Frame *>(frame)->GetField(name));
455     }
456 
457     return reinterpret_cast<ID3Field *>(field);
458   }
459 
460 
461   ID3_C_EXPORT void CCONV
ID3Frame_SetCompression(ID3Frame * frame,bool comp)462   ID3Frame_SetCompression(ID3Frame *frame, bool comp)
463   {
464     if (frame)
465     {
466       ID3_CATCH(reinterpret_cast<ID3_Frame *>(frame)->SetCompression(comp));
467     }
468   }
469 
470 
471   ID3_C_EXPORT bool CCONV
ID3Frame_GetCompression(const ID3Frame * frame)472   ID3Frame_GetCompression(const ID3Frame *frame)
473   {
474     bool compressed = false;
475     if (frame)
476     {
477       ID3_CATCH(compressed = reinterpret_cast<const ID3_Frame *>(frame)->GetCompression());
478     }
479     return compressed;
480   }
481 
482 
483   // field wrappers
484 
485 
486   ID3_C_EXPORT void CCONV
ID3Field_Clear(ID3Field * field)487   ID3Field_Clear(ID3Field *field)
488   {
489     if (field)
490     {
491       ID3_CATCH(reinterpret_cast<ID3_Field *>(field)->Clear());
492     }
493   }
494 
495 
496   ID3_C_EXPORT size_t CCONV
ID3Field_Size(const ID3Field * field)497   ID3Field_Size(const ID3Field *field)
498   {
499     size_t size = 0;
500 
501     if (field)
502     {
503       ID3_CATCH(size = reinterpret_cast<const ID3_Field *>(field)->Size());
504     }
505 
506     return size;
507   }
508 
509 
510   ID3_C_EXPORT size_t CCONV
ID3Field_GetNumTextItems(const ID3Field * field)511   ID3Field_GetNumTextItems(const ID3Field *field)
512   {
513     size_t items = 0;
514 
515     if (field)
516     {
517       ID3_CATCH(items = reinterpret_cast<const ID3_Field *>(field)->GetNumTextItems());
518     }
519 
520     return items;
521   }
522 
523 
524   ID3_C_EXPORT void CCONV
ID3Field_SetINT(ID3Field * field,uint32 data)525   ID3Field_SetINT(ID3Field *field, uint32 data)
526   {
527     if (field)
528     {
529       ID3_CATCH(reinterpret_cast<ID3_Field *>(field)->Set(data));
530     }
531   }
532 
533 
534   ID3_C_EXPORT uint32 CCONV
ID3Field_GetINT(const ID3Field * field)535   ID3Field_GetINT(const ID3Field *field)
536   {
537     uint32 value = 0;
538 
539     if (field)
540     {
541       ID3_CATCH(value = reinterpret_cast<const ID3_Field *>(field)->Get());
542     }
543 
544     return value;
545   }
546 
547 
548   ID3_C_EXPORT void CCONV
ID3Field_SetUNICODE(ID3Field * field,const unicode_t * string)549   ID3Field_SetUNICODE(ID3Field *field, const unicode_t *string)
550   {
551     if (field)
552     {
553       ID3_CATCH(reinterpret_cast<ID3_Field *>(field)->Set(string));
554     }
555   }
556 
557 
558   ID3_C_EXPORT size_t CCONV
ID3Field_GetUNICODE(const ID3Field * field,unicode_t * buffer,size_t maxChars)559   ID3Field_GetUNICODE(const ID3Field *field, unicode_t *buffer, size_t maxChars)
560   {
561     size_t numChars = 0;
562 
563     if (field)
564     {
565       ID3_CATCH(numChars = reinterpret_cast<const ID3_Field *>(field)->Get(buffer, maxChars));
566     }
567 
568     return numChars;
569   }
570 
571 
572   ID3_C_EXPORT size_t CCONV
ID3Field_GetUNICODEItem(const ID3Field * field,unicode_t * buffer,size_t maxChars,size_t itemNum)573   ID3Field_GetUNICODEItem(const ID3Field *field, unicode_t *buffer,
574                           size_t maxChars, size_t itemNum)
575   {
576     size_t numChars = 0;
577 
578     if (field)
579     {
580       ID3_CATCH(numChars = reinterpret_cast<const ID3_Field *>(field)->Get(buffer, maxChars, itemNum));
581     }
582 
583     return numChars;
584   }
585 
586 
587   ID3_C_EXPORT void CCONV
ID3Field_AddUNICODE(ID3Field * field,const unicode_t * string)588   ID3Field_AddUNICODE(ID3Field *field, const unicode_t *string)
589   {
590     if (field)
591     {
592       ID3_CATCH(reinterpret_cast<ID3_Field *>(field)->Add(string));
593     }
594   }
595 
596 
597   ID3_C_EXPORT void CCONV
ID3Field_SetASCII(ID3Field * field,const char * string)598   ID3Field_SetASCII(ID3Field *field, const char *string)
599   {
600     if (field)
601     {
602       ID3_CATCH(reinterpret_cast<ID3_Field *>(field)->Set(string));
603     }
604   }
605 
606 
607   ID3_C_EXPORT size_t CCONV
ID3Field_GetASCII(const ID3Field * field,char * buffer,size_t maxChars)608   ID3Field_GetASCII(const ID3Field *field, char *buffer, size_t maxChars)
609   {
610     size_t numChars = 0;
611 
612     if (field)
613     {
614       ID3_CATCH(numChars = reinterpret_cast<const ID3_Field *>(field)->Get(buffer, maxChars));
615     }
616 
617     return numChars;
618   }
619 
620   ID3_C_EXPORT size_t CCONV
ID3Field_GetASCIIItem(const ID3Field * field,char * buffer,size_t maxChars,size_t itemNum)621   ID3Field_GetASCIIItem(const ID3Field *field, char *buffer,
622                         size_t maxChars, size_t itemNum)
623   {
624     size_t numChars = 0;
625 
626     if (field)
627     {
628       ID3_CATCH(numChars = reinterpret_cast<const ID3_Field *>(field)->Get(buffer, maxChars, itemNum));
629     }
630 
631     return numChars;
632   }
633 
634 
635   ID3_C_EXPORT void CCONV
ID3Field_AddASCII(ID3Field * field,const char * string)636   ID3Field_AddASCII(ID3Field *field, const char *string)
637   {
638     if (field)
639     {
640       ID3_CATCH(reinterpret_cast<ID3_Field *>(field)->Add(string));
641     }
642   }
643 
644 
645   ID3_C_EXPORT void CCONV
ID3Field_SetBINARY(ID3Field * field,const uchar * data,size_t size)646   ID3Field_SetBINARY(ID3Field *field, const uchar *data, size_t size)
647   {
648     if (field)
649     {
650       ID3_CATCH(reinterpret_cast<ID3_Field *>(field)->Set(data, size));
651     }
652   }
653 
654 
655   ID3_C_EXPORT void CCONV
ID3Field_GetBINARY(const ID3Field * field,uchar * buffer,size_t buffLength)656   ID3Field_GetBINARY(const ID3Field *field, uchar *buffer, size_t buffLength)
657   {
658     if (field)
659     {
660       ID3_CATCH(reinterpret_cast<const ID3_Field *>(field)->Get(buffer, buffLength));
661     }
662   }
663 
664 
665   ID3_C_EXPORT void CCONV
ID3Field_FromFile(ID3Field * field,const char * fileName)666   ID3Field_FromFile(ID3Field *field, const char *fileName)
667   {
668     if (field)
669     {
670       ID3_CATCH(reinterpret_cast<ID3_Field *>(field)->FromFile(fileName));
671     }
672   }
673 
674 
675   ID3_C_EXPORT void CCONV
ID3Field_ToFile(const ID3Field * field,const char * fileName)676   ID3Field_ToFile(const ID3Field *field, const char *fileName)
677   {
678     if (field)
679     {
680       ID3_CATCH(reinterpret_cast<const ID3_Field *>(field)->ToFile(fileName));
681     }
682   }
683 
684 #ifdef __cplusplus
685 }
686 #endif /* __cplusplus */
687 
688