comparison utils.c @ 2559:c57d3d6c8f44 libavformat

Make parse_date return INT64_MIN in case of unparsable input. Patch by Stefano Sabatini: [stefano sabatini-lala poste it] Original thread: [FFmpeg-devel] [PATCH] Enhace documentation forlibavformat/utils.c:parse_date Date: 08/17/2007 09:40 PM
author benoit
date Wed, 19 Sep 2007 12:38:07 +0000
parents 0c4febec2258
children 2842354cb9a4
comparison
equal deleted inserted replaced
2558:74c1aa100084 2559:c57d3d6c8f44
2619 /* parse datestr as HH:MM:SS */ 2619 /* parse datestr as HH:MM:SS */
2620 q = small_strptime(p, time_fmt[0], &dt); 2620 q = small_strptime(p, time_fmt[0], &dt);
2621 if (!q) { 2621 if (!q) {
2622 /* parse datestr as S+ */ 2622 /* parse datestr as S+ */
2623 dt.tm_sec = strtol(p, (char **)&q, 10); 2623 dt.tm_sec = strtol(p, (char **)&q, 10);
2624 if (q == p)
2625 /* the parsing didn't succeed */
2626 return INT64_MIN;
2624 dt.tm_min = 0; 2627 dt.tm_min = 0;
2625 dt.tm_hour = 0; 2628 dt.tm_hour = 0;
2626 } 2629 }
2627 } 2630 }
2628 2631
2629 /* Now we have all the fields that we can get */ 2632 /* Now we have all the fields that we can get */
2630 if (!q) { 2633 if (!q) {
2631 if (duration) 2634 return INT64_MIN;
2632 return 0;
2633 else
2634 return now * INT64_C(1000000);
2635 } 2635 }
2636 2636
2637 if (duration) { 2637 if (duration) {
2638 t = dt.tm_hour * 3600 + dt.tm_min * 60 + dt.tm_sec; 2638 t = dt.tm_hour * 3600 + dt.tm_min * 60 + dt.tm_sec;
2639 } else { 2639 } else {