OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 13 matching lines...) Expand all Loading... |
24 */ | 24 */ |
25 | 25 |
26 #include "core/html/MediaFragmentURIParser.h" | 26 #include "core/html/MediaFragmentURIParser.h" |
27 | 27 |
28 #include "wtf/text/CString.h" | 28 #include "wtf/text/CString.h" |
29 #include "wtf/text/StringBuilder.h" | 29 #include "wtf/text/StringBuilder.h" |
30 #include "wtf/text/WTFString.h" | 30 #include "wtf/text/WTFString.h" |
31 | 31 |
32 namespace blink { | 32 namespace blink { |
33 | 33 |
34 const int secondsPerHour = 3600; | |
35 const int secondsPerMinute = 60; | |
36 const unsigned nptIdentiferLength = 4; // "npt:" | 34 const unsigned nptIdentiferLength = 4; // "npt:" |
37 | 35 |
38 static String collectDigits(const LChar* input, | 36 static String collectDigits(const LChar* input, |
39 unsigned length, | 37 unsigned length, |
40 unsigned& position) { | 38 unsigned& position) { |
41 StringBuilder digits; | 39 StringBuilder digits; |
42 | 40 |
43 // http://www.ietf.org/rfc/rfc2326.txt | 41 // http://www.ietf.org/rfc/rfc2326.txt |
44 // DIGIT ; any positive number | 42 // DIGIT ; any positive number |
45 while (position < length && isASCIIDigit(input[position])) | 43 while (position < length && isASCIIDigit(input[position])) |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 value3 = digits3.toInt(); | 301 value3 = digits3.toInt(); |
304 } else { | 302 } else { |
305 value3 = value2; | 303 value3 = value2; |
306 value2 = value1; | 304 value2 = value1; |
307 value1 = 0; | 305 value1 = 0; |
308 } | 306 } |
309 | 307 |
310 if (offset < length && timeString[offset] == '.') | 308 if (offset < length && timeString[offset] == '.') |
311 fraction = collectFraction(timeString, length, offset).toDouble(); | 309 fraction = collectFraction(timeString, length, offset).toDouble(); |
312 | 310 |
| 311 const int secondsPerHour = 3600; |
| 312 const int secondsPerMinute = 60; |
313 time = (value1 * secondsPerHour) + (value2 * secondsPerMinute) + value3 + | 313 time = (value1 * secondsPerHour) + (value2 * secondsPerMinute) + value3 + |
314 fraction; | 314 fraction; |
315 return true; | 315 return true; |
316 } | 316 } |
317 | 317 |
318 } // namespace blink | 318 } // namespace blink |
OLD | NEW |