comparison Plugins/Input/mpg123/xmms-id3.h @ 240:18cb7405b5e9 trunk

[svn] Revert unicode fixes, cause player to bomb out.
author nenolod
date Sun, 27 Nov 2005 11:43:05 -0800
parents 539a0fa7f030
children f12d7e208b43
comparison
equal deleted inserted replaced
239:ac4c3da7c263 240:18cb7405b5e9
147 #define ID3_ENCODING_UTF16 0x01 147 #define ID3_ENCODING_UTF16 0x01
148 #define ID3_ENCODING_UTF16BE 0x02 148 #define ID3_ENCODING_UTF16BE 0x02
149 #define ID3_ENCODING_UTF8 0x03 149 #define ID3_ENCODING_UTF8 0x03
150 150
151 151
152 /*
153 * Handy macros which help us writing more secure length-aware code
154 * which involves reading the frame's data buffer.
155 */
156
157 #define ID3_FRAME_DEFINE_CURSOR(frame) \
158 gsize length = frame->fr_size; \
159 guint8* cursor = frame->fr_data;
160
161 #define ID3_FRAME_READ_OR_RETVAL(variable, retval) \
162 if (length < sizeof(variable)) \
163 return retval; \
164 memcpy((void*)&variable, (void*)cursor, sizeof(variable)); \
165 cursor += sizeof(variable); \
166 length -= sizeof(variable);
167 152
168 /* 153 /*
169 * ID3 frame id numbers. 154 * ID3 frame id numbers.
170 */ 155 */
171 #define ID3_FRAME_ID(a,b,c,d) ((a << 24) | (b << 16) | (c << 8) | d) 156 #define ID3_FRAME_ID(a,b,c,d) ((a << 24) | (b << 16) | (c << 8) | d)
331 #define ID3_WCM ID3_FRAME_ID_22('W', 'C', 'M') 316 #define ID3_WCM ID3_FRAME_ID_22('W', 'C', 'M')
332 #define ID3_WCP ID3_FRAME_ID_22('W', 'C', 'P') 317 #define ID3_WCP ID3_FRAME_ID_22('W', 'C', 'P')
333 #define ID3_WPB ID3_FRAME_ID_22('W', 'P', 'B') 318 #define ID3_WPB ID3_FRAME_ID_22('W', 'P', 'B')
334 #define ID3_WXX ID3_FRAME_ID_22('W', 'X', 'X') 319 #define ID3_WXX ID3_FRAME_ID_22('W', 'X', 'X')
335 320
336 /*
337 * Handy macros which help us writing more secure length-aware code
338 * which involves reading the frame's data buffer.
339 */
340
341 #define ID3_FRAME_DEFINE_CURSOR(frame) \
342 gsize length = frame->fr_size; \
343 guint8* cursor = frame->fr_data;
344
345 #define ID3_FRAME_READ_OR_RETVAL(variable, retval) \
346 if (length < sizeof(variable)) \
347 return retval; \
348 memcpy((void*)&variable, (void*)cursor, sizeof(variable)); \
349 cursor += sizeof(variable); \
350 length -= sizeof(variable);
351 321
352 /* 322 /*
353 * Prototypes. 323 * Prototypes.
354 */ 324 */
355 325
360 int id3_set_output(struct id3_tag *, char *); 330 int id3_set_output(struct id3_tag *, char *);
361 int id3_close(struct id3_tag *); 331 int id3_close(struct id3_tag *);
362 int id3_tell(struct id3_tag *); 332 int id3_tell(struct id3_tag *);
363 int id3_alter_file(struct id3_tag *); 333 int id3_alter_file(struct id3_tag *);
364 int id3_write_tag(struct id3_tag *, int); 334 int id3_write_tag(struct id3_tag *, int);
365 char *id3_utf16_to_ascii(void *);
366 335
367 /* From id3_frame.c */ 336 /* From id3_frame.c */
368 int id3_read_frame(struct id3_tag *id3); 337 int id3_read_frame(struct id3_tag *id3);
369 struct id3_frame *id3_get_frame(struct id3_tag *, guint32, int); 338 struct id3_frame *id3_get_frame(struct id3_tag *, guint32, int);
370 int id3_delete_frame(struct id3_frame *frame); 339 int id3_delete_frame(struct id3_frame *frame);
372 int id3_decompress_frame(struct id3_frame *); 341 int id3_decompress_frame(struct id3_frame *);
373 void id3_destroy_frames(struct id3_tag *id); 342 void id3_destroy_frames(struct id3_tag *id);
374 void id3_frame_clear_data(struct id3_frame *frame); 343 void id3_frame_clear_data(struct id3_frame *frame);
375 344
376 /* From id3_frame_text.c */ 345 /* From id3_frame_text.c */
377 gsize id3_string_size(guint8 encoding, const void* text, gsize max_size); 346 char *id3_utf16_to_ascii(void *);
378 gchar* id3_string_decode(guint8 encoding, const void* text, gsize max_size);
379 gint8 id3_get_encoding(struct id3_frame *); 347 gint8 id3_get_encoding(struct id3_frame *);
380 int id3_set_encoding(struct id3_frame *, gint8); 348 int id3_set_encoding(struct id3_frame *, gint8);
381 char *id3_get_text(struct id3_frame *); 349 char *id3_get_text(struct id3_frame *);
382 char *id3_get_text_desc(struct id3_frame *); 350 char *id3_get_text_desc(struct id3_frame *);
383 int id3_get_text_number(struct id3_frame *); 351 int id3_get_text_number(struct id3_frame *);