Lines 162-167
Link Here
|
162 |
FILE *f; |
162 |
FILE *f; |
163 |
gchar buf[130]; |
163 |
gchar buf[130]; |
164 |
gint i; |
164 |
gint i; |
|
|
165 |
#ifdef ENABLE_JAPANESE_TAGS |
166 |
gchar tmpbuf[31]; |
167 |
gchar *ctp; |
168 |
|
169 |
tmpbuf[30] = '\0'; |
170 |
#endif |
165 |
|
171 |
|
166 |
f = fopen(path,"r+"); |
172 |
f = fopen(path,"r+"); |
167 |
if (!f) |
173 |
if (!f) |
Lines 222-227
Link Here
|
222 |
} |
228 |
} |
223 |
|
229 |
|
224 |
strncpy(buf, "TAG", 3); |
230 |
strncpy(buf, "TAG", 3); |
|
|
231 |
#ifdef ENABLE_JAPANESE_TAGS |
232 |
if (title && *title) { |
233 |
strncpy(tmpbuf, title, 30); |
234 |
ctp = to_string_sjis_from_euc(tmpbuf); |
235 |
if (ctp) { |
236 |
strncpy(buf + 3, ctp, 30); |
237 |
free(ctp); |
238 |
} |
239 |
else { |
240 |
printf("fail to convert title tag encoding\n"); |
241 |
fclose(f); |
242 |
return FALSE; |
243 |
} |
244 |
} |
245 |
if (artist && *artist) { |
246 |
strncpy(tmpbuf, artist, 30); |
247 |
ctp = to_string_sjis_from_euc(tmpbuf); |
248 |
if (ctp) { |
249 |
strncpy(buf + 33, ctp, 30); |
250 |
free(ctp); |
251 |
} |
252 |
else { |
253 |
printf("fail to convert artist tag encoding\n"); |
254 |
fclose(f); |
255 |
return FALSE; |
256 |
} |
257 |
} |
258 |
if (album && *album) { |
259 |
strncpy(tmpbuf, album, 30); |
260 |
ctp = to_string_sjis_from_euc(tmpbuf); |
261 |
if (ctp) { |
262 |
strncpy(buf + 63, ctp, 30); |
263 |
free(ctp); |
264 |
} |
265 |
else { |
266 |
printf("fail to convert album tag encoding\n"); |
267 |
fclose(f); |
268 |
return FALSE; |
269 |
} |
270 |
} |
271 |
if (year) strncpy(buf + 93, year, 4); |
272 |
if (comment && track == 0 && strlen(ctp) > 28) |
273 |
{ |
274 |
/* comment is longer than 28 and no track number, |
275 |
* write a v1.0 tag to enable larger comments |
276 |
*/ |
277 |
strncpy(tmpbuf, comment, 30); |
278 |
ctp = to_string_sjis_from_euc(tmpbuf); |
279 |
if (ctp) |
280 |
{ |
281 |
strncpy(buf + 97, ctp, 30); |
282 |
free(ctp); |
283 |
} |
284 |
else |
285 |
{ |
286 |
printf("fail to convert comment tag encoding\n"); |
287 |
fclose(f); |
288 |
return FALSE; |
289 |
} |
290 |
|
291 |
} |
292 |
else |
293 |
{ |
294 |
buf[126] = track; |
295 |
|
296 |
strncpy(tmpbuf, comment, 30); |
297 |
ctp = to_string_sjis_from_euc(tmpbuf); |
298 |
if (ctp) |
299 |
{ |
300 |
strncpy(buf + 97, ctp, 28); |
301 |
free(ctp); |
302 |
} |
303 |
else |
304 |
{ |
305 |
printf("fail to convert comment tag encoding\n"); |
306 |
fclose(f); |
307 |
return FALSE; |
308 |
} |
309 |
} |
310 |
#else |
225 |
if (title) strncpy(buf + 3, title, 30); |
311 |
if (title) strncpy(buf + 3, title, 30); |
226 |
if (artist) strncpy(buf + 33, artist, 30); |
312 |
if (artist) strncpy(buf + 33, artist, 30); |
227 |
if (album) strncpy(buf + 63, album, 30); |
313 |
if (album) strncpy(buf + 63, album, 30); |
Lines 239-244
Link Here
|
239 |
if (comment) strncpy(buf + 97, comment, 28); |
325 |
if (comment) strncpy(buf + 97, comment, 28); |
240 |
buf[126] = track; |
326 |
buf[126] = track; |
241 |
} |
327 |
} |
|
|
328 |
#endif |
242 |
|
329 |
|
243 |
buf[127] = genre; |
330 |
buf[127] = genre; |