Chris@0: /* C code produced by gperf version 3.0.1 */ Chris@0: /* Command-line: gperf -tCcTonD -K id -N id3_compat_lookup -s -3 -k '*' compat.gperf */ Chris@0: Chris@0: #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ Chris@0: && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ Chris@0: && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ Chris@0: && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ Chris@0: && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ Chris@0: && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ Chris@0: && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ Chris@0: && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ Chris@0: && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ Chris@0: && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ Chris@0: && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ Chris@0: && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ Chris@0: && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ Chris@0: && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ Chris@0: && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ Chris@0: && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ Chris@0: && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ Chris@0: && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ Chris@0: && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ Chris@0: && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ Chris@0: && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ Chris@0: && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ Chris@0: && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) Chris@0: /* The character set is not based on ISO-646. */ Chris@0: error "gperf generated tables don't work with this execution character set. Please report a bug to ." Chris@0: #endif Chris@0: Chris@0: #line 1 "compat.gperf" Chris@0: Chris@0: /* Chris@0: * libid3tag - ID3 tag manipulation library Chris@0: * Copyright (C) 2000-2004 Underbit Technologies, Inc. Chris@0: * Chris@0: * This program is free software; you can redistribute it and/or modify Chris@0: * it under the terms of the GNU General Public License as published by Chris@0: * the Free Software Foundation; either version 2 of the License, or Chris@0: * (at your option) any later version. Chris@0: * Chris@0: * This program is distributed in the hope that it will be useful, Chris@0: * but WITHOUT ANY WARRANTY; without even the implied warranty of Chris@0: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Chris@0: * GNU General Public License for more details. Chris@0: * Chris@0: * You should have received a copy of the GNU General Public License Chris@0: * along with this program; if not, write to the Free Software Chris@0: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Chris@0: * Chris@0: * Id: compat.gperf,v 1.11 2004/01/23 09:41:32 rob Exp Chris@0: */ Chris@0: Chris@0: # ifdef HAVE_CONFIG_H Chris@0: # include "config.h" Chris@0: # endif Chris@0: Chris@0: # include "global.h" Chris@0: Chris@0: # include Chris@0: # include Chris@0: Chris@0: # ifdef HAVE_ASSERT_H Chris@0: # include Chris@0: # endif Chris@0: Chris@0: # include "id3tag.h" Chris@0: # include "compat.h" Chris@0: # include "frame.h" Chris@0: # include "field.h" Chris@0: # include "parse.h" Chris@0: # include "ucs4.h" Chris@0: Chris@0: # define EQ(id) #id, 0 Chris@0: # define OBSOLETE 0, 0 Chris@0: # define TX(id) #id, translate_##id Chris@0: Chris@0: static id3_compat_func_t translate_TCON; Chris@0: Chris@0: #define TOTAL_KEYWORDS 73 Chris@0: #define MIN_WORD_LENGTH 3 Chris@0: #define MAX_WORD_LENGTH 4 Chris@0: #define MIN_HASH_VALUE 6 Chris@0: #define MAX_HASH_VALUE 127 Chris@0: /* maximum key range = 122, duplicates = 0 */ Chris@0: Chris@0: #ifdef __GNUC__ Chris@0: __inline Chris@0: #else Chris@0: #ifdef __cplusplus Chris@0: inline Chris@0: #endif Chris@0: #endif Chris@0: static unsigned int Chris@0: hash (str, len) Chris@0: register const char *str; Chris@0: register unsigned int len; Chris@0: { Chris@0: static const unsigned char asso_values[] = Chris@0: { Chris@0: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, Chris@0: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, Chris@0: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, Chris@0: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, Chris@0: 128, 128, 128, 128, 128, 128, 128, 128, 128, 64, Chris@0: 58, 20, 15, 128, 128, 128, 128, 128, 128, 128, Chris@0: 128, 128, 128, 128, 128, 10, 18, 3, 6, 1, Chris@0: 47, 0, 128, 42, 62, 30, 31, 0, 19, 52, Chris@0: 10, 24, 8, 30, 5, 3, 30, 8, 25, 47, Chris@0: 3, 128, 128, 128, 128, 128, 128, 128, 128, 128, Chris@0: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, Chris@0: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, Chris@0: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, Chris@0: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, Chris@0: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, Chris@0: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, Chris@0: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, Chris@0: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, Chris@0: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, Chris@0: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, Chris@0: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, Chris@0: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, Chris@0: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, Chris@0: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, Chris@0: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, Chris@0: 128, 128, 128, 128, 128, 128, 128 Chris@0: }; Chris@0: register int hval = 0; Chris@0: Chris@0: switch (len) Chris@0: { Chris@0: default: Chris@0: hval += asso_values[(unsigned char)str[3]]; Chris@0: /*FALLTHROUGH*/ Chris@0: case 3: Chris@0: hval += asso_values[(unsigned char)str[2]]; Chris@0: /*FALLTHROUGH*/ Chris@0: case 2: Chris@0: hval += asso_values[(unsigned char)str[1]+1]; Chris@0: /*FALLTHROUGH*/ Chris@0: case 1: Chris@0: hval += asso_values[(unsigned char)str[0]]; Chris@0: break; Chris@0: } Chris@0: return hval; Chris@0: } Chris@0: Chris@0: #ifdef __GNUC__ Chris@0: __inline Chris@0: #endif Chris@0: const struct id3_compat * Chris@0: id3_compat_lookup (str, len) Chris@0: register const char *str; Chris@0: register unsigned int len; Chris@0: { Chris@0: static const struct id3_compat wordlist[] = Chris@0: { Chris@0: #line 97 "compat.gperf" Chris@0: {"TLE", EQ(TLEN) /* Length */}, Chris@0: #line 68 "compat.gperf" Chris@0: {"ETC", EQ(ETCO) /* Event timing codes */}, Chris@0: #line 126 "compat.gperf" Chris@0: {"ULT", EQ(USLT) /* Unsynchronised lyric/text transcription */}, Chris@0: #line 123 "compat.gperf" Chris@0: {"TYE", OBSOLETE /* Year [obsolete] */}, Chris@0: #line 92 "compat.gperf" Chris@0: {"TFT", EQ(TFLT) /* File type */}, Chris@0: #line 84 "compat.gperf" Chris@0: {"TCM", EQ(TCOM) /* Composer */}, Chris@0: #line 66 "compat.gperf" Chris@0: {"EQU", OBSOLETE /* Equalization [obsolete] */}, Chris@0: #line 63 "compat.gperf" Chris@0: {"COM", EQ(COMM) /* Comments */}, Chris@0: #line 130 "compat.gperf" Chris@0: {"WCM", EQ(WCOM) /* Commercial information */}, Chris@0: #line 96 "compat.gperf" Chris@0: {"TLA", EQ(TLAN) /* Language(s) */}, Chris@0: #line 88 "compat.gperf" Chris@0: {"TDA", OBSOLETE /* Date [obsolete] */}, Chris@0: #line 124 "compat.gperf" Chris@0: {"TYER", OBSOLETE /* Year [obsolete] */}, Chris@0: #line 83 "compat.gperf" Chris@0: {"TBP", EQ(TBPM) /* BPM (beats per minute) */}, Chris@0: #line 87 "compat.gperf" Chris@0: {"TCR", EQ(TCOP) /* Copyright message */}, Chris@0: #line 104 "compat.gperf" Chris@0: {"TOT", EQ(TOAL) /* Original album/movie/show title */}, Chris@0: #line 89 "compat.gperf" Chris@0: {"TDAT", OBSOLETE /* Date [obsolete] */}, Chris@0: #line 67 "compat.gperf" Chris@0: {"EQUA", OBSOLETE /* Equalization [obsolete] */}, Chris@0: #line 102 "compat.gperf" Chris@0: {"TOR", EQ(TDOR) /* Original release year [obsolete] */}, Chris@0: #line 131 "compat.gperf" Chris@0: {"WCP", EQ(WCOP) /* Copyright/legal information */}, Chris@0: #line 99 "compat.gperf" Chris@0: {"TOA", EQ(TOPE) /* Original artist(s)/performer(s) */}, Chris@0: #line 78 "compat.gperf" Chris@0: {"RVA", OBSOLETE /* Relative volume adjustment [obsolete] */}, Chris@0: #line 120 "compat.gperf" Chris@0: {"TT3", EQ(TIT3) /* Subtitle/description refinement */}, Chris@0: #line 98 "compat.gperf" Chris@0: {"TMT", EQ(TMED) /* Media type */}, Chris@0: #line 76 "compat.gperf" Chris@0: {"POP", EQ(POPM) /* Popularimeter */}, Chris@0: #line 74 "compat.gperf" Chris@0: {"MLL", EQ(MLLT) /* MPEG location lookup table */}, Chris@0: #line 79 "compat.gperf" Chris@0: {"RVAD", OBSOLETE /* Relative volume adjustment [obsolete] */}, Chris@0: #line 65 "compat.gperf" Chris@0: {"CRM", OBSOLETE /* Encrypted meta frame [obsolete] */}, Chris@0: #line 128 "compat.gperf" Chris@0: {"WAR", EQ(WOAR) /* Official artist/performer webpage */}, Chris@0: #line 80 "compat.gperf" Chris@0: {"SLT", EQ(SYLT) /* Synchronised lyric/text */}, Chris@0: #line 81 "compat.gperf" Chris@0: {"STC", EQ(SYTC) /* Synchronised tempo codes */}, Chris@0: #line 95 "compat.gperf" Chris@0: {"TKE", EQ(TKEY) /* Initial key */}, Chris@0: #line 111 "compat.gperf" Chris@0: {"TRC", EQ(TSRC) /* ISRC (international standard recording code) */}, Chris@0: #line 109 "compat.gperf" Chris@0: {"TPA", EQ(TPOS) /* Part of a set */}, Chris@0: #line 117 "compat.gperf" Chris@0: {"TSS", EQ(TSSE) /* Software/hardware and settings used for encoding */}, Chris@0: #line 112 "compat.gperf" Chris@0: {"TRD", OBSOLETE /* Recording dates [obsolete] */}, Chris@0: #line 64 "compat.gperf" Chris@0: {"CRA", EQ(AENC) /* Audio encryption */}, Chris@0: #line 108 "compat.gperf" Chris@0: {"TP4", EQ(TPE4) /* Interpreted, remixed, or otherwise modified by */}, Chris@0: #line 125 "compat.gperf" Chris@0: {"UFI", EQ(UFID) /* Unique file identifier */}, Chris@0: #line 101 "compat.gperf" Chris@0: {"TOL", EQ(TOLY) /* Original lyricist(s)/text writer(s) */}, Chris@0: #line 110 "compat.gperf" Chris@0: {"TPB", EQ(TPUB) /* Publisher */}, Chris@0: #line 73 "compat.gperf" Chris@0: {"MCI", EQ(MCDI) /* Music CD identifier */}, Chris@0: #line 107 "compat.gperf" Chris@0: {"TP3", EQ(TPE3) /* Conductor/performer refinement */}, Chris@0: #line 132 "compat.gperf" Chris@0: {"WPB", EQ(WPUB) /* Publishers official webpage */}, Chris@0: #line 113 "compat.gperf" Chris@0: {"TRDA", OBSOLETE /* Recording dates [obsolete] */}, Chris@0: #line 115 "compat.gperf" Chris@0: {"TSI", OBSOLETE /* Size [obsolete] */}, Chris@0: #line 90 "compat.gperf" Chris@0: {"TDY", EQ(TDLY) /* Playlist delay */}, Chris@0: #line 82 "compat.gperf" Chris@0: {"TAL", EQ(TALB) /* Album/movie/show title */}, Chris@0: #line 116 "compat.gperf" Chris@0: {"TSIZ", OBSOLETE /* Size [obsolete] */}, Chris@0: #line 129 "compat.gperf" Chris@0: {"WAS", EQ(WOAS) /* Official audio source webpage */}, Chris@0: #line 121 "compat.gperf" Chris@0: {"TXT", EQ(TEXT) /* Lyricist/text writer */}, Chris@0: #line 62 "compat.gperf" Chris@0: {"CNT", EQ(PCNT) /* Play counter */}, Chris@0: #line 100 "compat.gperf" Chris@0: {"TOF", EQ(TOFN) /* Original filename */}, Chris@0: #line 85 "compat.gperf" Chris@0: {"TCO", TX(TCON) /* Content type */}, Chris@0: #line 114 "compat.gperf" Chris@0: {"TRK", EQ(TRCK) /* Track number/position in set */}, Chris@0: #line 119 "compat.gperf" Chris@0: {"TT2", EQ(TIT2) /* Title/songname/content description */}, Chris@0: #line 93 "compat.gperf" Chris@0: {"TIM", OBSOLETE /* Time [obsolete] */}, Chris@0: #line 94 "compat.gperf" Chris@0: {"TIME", OBSOLETE /* Time [obsolete] */}, Chris@0: #line 103 "compat.gperf" Chris@0: {"TORY", EQ(TDOR) /* Original release year [obsolete] */}, Chris@0: #line 91 "compat.gperf" Chris@0: {"TEN", EQ(TENC) /* Encoded by */}, Chris@0: #line 118 "compat.gperf" Chris@0: {"TT1", EQ(TIT1) /* Content group description */}, Chris@0: #line 127 "compat.gperf" Chris@0: {"WAF", EQ(WOAF) /* Official audio file webpage */}, Chris@0: #line 75 "compat.gperf" Chris@0: {"PIC", EQ(APIC) /* Attached picture */}, Chris@0: #line 122 "compat.gperf" Chris@0: {"TXX", EQ(TXXX) /* User defined text information frame */}, Chris@0: #line 133 "compat.gperf" Chris@0: {"WXX", EQ(WXXX) /* User defined URL link frame */}, Chris@0: #line 86 "compat.gperf" Chris@0: {"TCON", TX(TCON) /* Content type */}, Chris@0: #line 77 "compat.gperf" Chris@0: {"REV", EQ(RVRB) /* Reverb */}, Chris@0: #line 106 "compat.gperf" Chris@0: {"TP2", EQ(TPE2) /* Band/orchestra/accompaniment */}, Chris@0: #line 105 "compat.gperf" Chris@0: {"TP1", EQ(TPE1) /* Lead performer(s)/soloist(s) */}, Chris@0: #line 61 "compat.gperf" Chris@0: {"BUF", EQ(RBUF) /* Recommended buffer size */}, Chris@0: #line 70 "compat.gperf" Chris@0: {"IPL", EQ(TIPL) /* Involved people list */}, Chris@0: #line 69 "compat.gperf" Chris@0: {"GEO", EQ(GEOB) /* General encapsulated object */}, Chris@0: #line 72 "compat.gperf" Chris@0: {"LNK", EQ(LINK) /* Linked information */}, Chris@0: #line 71 "compat.gperf" Chris@0: {"IPLS", EQ(TIPL) /* Involved people list */} Chris@0: }; Chris@0: Chris@0: static const short lookup[] = Chris@0: { Chris@0: -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, Chris@0: 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, Chris@0: 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, Chris@0: -1, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, Chris@0: 48, 49, -1, -1, 50, -1, 51, 52, -1, 53, 54, 55, 56, -1, Chris@0: 57, 58, 59, 60, -1, 61, -1, 62, -1, -1, 63, -1, 64, -1, Chris@0: -1, 65, -1, 66, -1, -1, -1, -1, -1, 67, -1, 68, -1, 69, Chris@0: -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, Chris@0: -1, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, Chris@0: -1, 72 Chris@0: }; Chris@0: Chris@0: if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) Chris@0: { Chris@0: register int key = hash (str, len); Chris@0: Chris@0: if (key <= MAX_HASH_VALUE && key >= 0) Chris@0: { Chris@0: register int index = lookup[key]; Chris@0: Chris@0: if (index >= 0) Chris@0: { Chris@0: register const char *s = wordlist[index].id; Chris@0: Chris@0: if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0') Chris@0: return &wordlist[index]; Chris@0: } Chris@0: } Chris@0: } Chris@0: return 0; Chris@0: } Chris@0: #line 134 "compat.gperf" Chris@0: Chris@0: Chris@0: static Chris@0: int translate_TCON(struct id3_frame *frame, char const *oldid, Chris@0: id3_byte_t const *data, id3_length_t length) Chris@0: { Chris@0: id3_byte_t const *end; Chris@0: enum id3_field_textencoding encoding; Chris@0: id3_ucs4_t *string = 0, *ptr, *endptr; Chris@0: int result = 0; Chris@0: Chris@0: /* translate old TCON syntax into multiple strings */ Chris@0: Chris@0: assert(frame->nfields == 2); Chris@0: Chris@0: encoding = ID3_FIELD_TEXTENCODING_ISO_8859_1; Chris@0: Chris@0: end = data + length; Chris@0: Chris@0: if (id3_field_parse(&frame->fields[0], &data, end - data, &encoding) == -1) Chris@0: goto fail; Chris@0: Chris@0: string = id3_parse_string(&data, end - data, encoding, 0); Chris@0: if (string == 0) Chris@0: goto fail; Chris@0: Chris@0: ptr = string; Chris@0: while (*ptr == '(') { Chris@0: if (*++ptr == '(') Chris@0: break; Chris@0: Chris@0: endptr = ptr; Chris@0: while (*endptr && *endptr != ')') Chris@0: ++endptr; Chris@0: Chris@0: if (*endptr) Chris@0: *endptr++ = 0; Chris@0: Chris@0: if (id3_field_addstring(&frame->fields[1], ptr) == -1) Chris@0: goto fail; Chris@0: Chris@0: ptr = endptr; Chris@0: } Chris@0: Chris@0: if (*ptr && id3_field_addstring(&frame->fields[1], ptr) == -1) Chris@0: goto fail; Chris@0: Chris@0: if (0) { Chris@0: fail: Chris@0: result = -1; Chris@0: } Chris@0: Chris@0: if (string) Chris@0: free(string); Chris@0: Chris@0: return result; Chris@0: } Chris@0: Chris@0: /* Chris@0: * NAME: compat->fixup() Chris@0: * DESCRIPTION: finish compatibility translations Chris@0: */ Chris@0: int id3_compat_fixup(struct id3_tag *tag) Chris@0: { Chris@0: struct id3_frame *frame; Chris@0: unsigned int index; Chris@0: id3_ucs4_t timestamp[17] = { 0 }; Chris@0: int result = 0; Chris@0: Chris@0: /* create a TDRC frame from obsolete TYER/TDAT/TIME frames */ Chris@0: Chris@0: /* Chris@0: * TYE/TYER: YYYY Chris@0: * TDA/TDAT: DDMM Chris@0: * TIM/TIME: HHMM Chris@0: * Chris@0: * TDRC: yyyy-MM-ddTHH:mm Chris@0: */ Chris@0: Chris@0: index = 0; Chris@0: while ((frame = id3_tag_findframe(tag, ID3_FRAME_OBSOLETE, index++))) { Chris@0: char const *id; Chris@0: id3_byte_t const *data, *end; Chris@0: id3_length_t length; Chris@0: enum id3_field_textencoding encoding; Chris@0: id3_ucs4_t *string; Chris@0: Chris@0: id = id3_field_getframeid(&frame->fields[0]); Chris@0: assert(id); Chris@0: Chris@0: if (strcmp(id, "TYER") != 0 && strcmp(id, "YTYE") != 0 && Chris@0: strcmp(id, "TDAT") != 0 && strcmp(id, "YTDA") != 0 && Chris@0: strcmp(id, "TIME") != 0 && strcmp(id, "YTIM") != 0) Chris@0: continue; Chris@0: Chris@0: data = id3_field_getbinarydata(&frame->fields[1], &length); Chris@0: assert(data); Chris@0: Chris@0: if (length < 1) Chris@0: continue; Chris@0: Chris@0: end = data + length; Chris@0: Chris@0: encoding = id3_parse_uint(&data, 1); Chris@0: string = id3_parse_string(&data, end - data, encoding, 0); Chris@0: Chris@0: if (id3_ucs4_length(string) < 4) { Chris@0: free(string); Chris@0: continue; Chris@0: } Chris@0: Chris@0: if (strcmp(id, "TYER") == 0 || Chris@0: strcmp(id, "YTYE") == 0) { Chris@0: timestamp[0] = string[0]; Chris@0: timestamp[1] = string[1]; Chris@0: timestamp[2] = string[2]; Chris@0: timestamp[3] = string[3]; Chris@0: } Chris@0: else if (strcmp(id, "TDAT") == 0 || Chris@0: strcmp(id, "YTDA") == 0) { Chris@0: timestamp[4] = '-'; Chris@0: timestamp[5] = string[2]; Chris@0: timestamp[6] = string[3]; Chris@0: timestamp[7] = '-'; Chris@0: timestamp[8] = string[0]; Chris@0: timestamp[9] = string[1]; Chris@0: } Chris@0: else { /* TIME or YTIM */ Chris@0: timestamp[10] = 'T'; Chris@0: timestamp[11] = string[0]; Chris@0: timestamp[12] = string[1]; Chris@0: timestamp[13] = ':'; Chris@0: timestamp[14] = string[2]; Chris@0: timestamp[15] = string[3]; Chris@0: } Chris@0: Chris@0: free(string); Chris@0: } Chris@0: Chris@0: if (timestamp[0]) { Chris@0: id3_ucs4_t *strings; Chris@0: Chris@0: frame = id3_frame_new("TDRC"); Chris@0: if (frame == 0) Chris@0: goto fail; Chris@0: Chris@0: strings = timestamp; Chris@0: Chris@0: if (id3_field_settextencoding(&frame->fields[0], Chris@0: ID3_FIELD_TEXTENCODING_ISO_8859_1) == -1 || Chris@0: id3_field_setstrings(&frame->fields[1], 1, &strings) == -1 || Chris@0: id3_tag_attachframe(tag, frame) == -1) { Chris@0: id3_frame_delete(frame); Chris@0: goto fail; Chris@0: } Chris@0: } Chris@0: Chris@0: if (0) { Chris@0: fail: Chris@0: result = -1; Chris@0: } Chris@0: Chris@0: return result; Chris@0: }