Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Peter Ross authored on 2012/07/02 09:28:31... | ... |
@@ -368,28 +368,30 @@ static int read_probe(AVProbeData *p) |
368 | 368 |
|
369 | 369 |
/** |
370 | 370 |
* Convert win32 FILETIME to ISO-8601 string |
371 |
+ * @return <0 on error |
|
371 | 372 |
*/ |
372 |
-static void filetime_to_iso8601(char *buf, int buf_size, int64_t value) |
|
373 |
+static int filetime_to_iso8601(char *buf, int buf_size, int64_t value) |
|
373 | 374 |
{ |
374 | 375 |
time_t t = (value / 10000000LL) - 11644473600LL; |
375 | 376 |
struct tm *tm = gmtime(&t); |
376 |
- if (tm) |
|
377 |
- strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t)); |
|
378 |
- else |
|
379 |
- buf[0] = '\0'; |
|
377 |
+ if (!tm) |
|
378 |
+ return -1; |
|
379 |
+ strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t)); |
|
380 |
+ return 0; |
|
380 | 381 |
} |
381 | 382 |
|
382 | 383 |
/** |
383 | 384 |
* Convert crazy time (100ns since 1 Jan 0001) to ISO-8601 string |
385 |
+ * @return <0 on error |
|
384 | 386 |
*/ |
385 |
-static void crazytime_to_iso8601(char *buf, int buf_size, int64_t value) |
|
387 |
+static int crazytime_to_iso8601(char *buf, int buf_size, int64_t value) |
|
386 | 388 |
{ |
387 | 389 |
time_t t = (value / 10000000LL) - 719162LL*86400LL; |
388 | 390 |
struct tm *tm = gmtime(&t); |
389 |
- if (tm) |
|
390 |
- strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t)); |
|
391 |
- else |
|
392 |
- buf[0] = '\0'; |
|
391 |
+ if (!tm) |
|
392 |
+ return -1; |
|
393 |
+ strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t)); |
|
394 |
+ return 0; |
|
393 | 395 |
} |
394 | 396 |
|
395 | 397 |
/** |
... | ... |
@@ -460,10 +462,16 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int ty |
460 | 460 |
int64_t num = avio_rl64(pb); |
461 | 461 |
if (!strcmp(key, "WM/EncodingTime") || |
462 | 462 |
!strcmp(key, "WM/MediaOriginalBroadcastDateTime")) |
463 |
- filetime_to_iso8601(buf, buf_size, num); |
|
463 |
+ if (filetime_to_iso8601(buf, buf_size, num) < 0) { |
|
464 |
+ av_free(buf); |
|
465 |
+ return; |
|
466 |
+ } |
|
464 | 467 |
else if (!strcmp(key, "WM/WMRVEncodeTime") || |
465 | 468 |
!strcmp(key, "WM/WMRVEndTime")) |
466 |
- crazytime_to_iso8601(buf, buf_size, num); |
|
469 |
+ if (crazytime_to_iso8601(buf, buf_size, num) < 0) { |
|
470 |
+ av_free(buf); |
|
471 |
+ return; |
|
472 |
+ } |
|
467 | 473 |
else if (!strcmp(key, "WM/WMRVExpirationDate")) { |
468 | 474 |
if (oledate_to_iso8601(buf, buf_size, num) < 0 ) { |
469 | 475 |
av_free(buf); |