OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include <time.h> | 11 #include <time.h> |
12 | 12 |
13 #if defined(WEBRTC_WIN) | 13 #if defined(WEBRTC_WIN) |
14 #define WIN32_LEAN_AND_MEAN | 14 #define WIN32_LEAN_AND_MEAN |
15 #include <windows.h> | 15 #include <windows.h> |
16 #include <winsock2.h> | 16 #include <winsock2.h> |
17 #include <ws2tcpip.h> | 17 #include <ws2tcpip.h> |
18 #define SECURITY_WIN32 | 18 #define SECURITY_WIN32 |
19 #include <security.h> | 19 #include <security.h> |
20 #endif | 20 #endif |
21 | 21 |
22 #include <algorithm> | 22 #include <algorithm> |
23 | 23 |
| 24 #include "webrtc/base/arraysize.h" |
24 #include "webrtc/base/base64.h" | 25 #include "webrtc/base/base64.h" |
25 #include "webrtc/base/common.h" | 26 #include "webrtc/base/common.h" |
26 #include "webrtc/base/cryptstring.h" | 27 #include "webrtc/base/cryptstring.h" |
27 #include "webrtc/base/httpcommon-inl.h" | 28 #include "webrtc/base/httpcommon-inl.h" |
28 #include "webrtc/base/httpcommon.h" | 29 #include "webrtc/base/httpcommon.h" |
29 #include "webrtc/base/messagedigest.h" | 30 #include "webrtc/base/messagedigest.h" |
30 #include "webrtc/base/socketaddress.h" | 31 #include "webrtc/base/socketaddress.h" |
31 #include "webrtc/base/stringencode.h" | 32 #include "webrtc/base/stringencode.h" |
32 #include "webrtc/base/stringutils.h" | 33 #include "webrtc/base/stringutils.h" |
33 | 34 |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 if (!isdigit(zone[1]) || !isdigit(zone[2]) | 371 if (!isdigit(zone[1]) || !isdigit(zone[2]) |
371 || !isdigit(zone[3]) || !isdigit(zone[4])) { | 372 || !isdigit(zone[3]) || !isdigit(zone[4])) { |
372 return false; | 373 return false; |
373 } | 374 } |
374 int hours = (zone[1] - '0') * 10 + (zone[2] - '0'); | 375 int hours = (zone[1] - '0') * 10 + (zone[2] - '0'); |
375 int minutes = (zone[3] - '0') * 10 + (zone[4] - '0'); | 376 int minutes = (zone[3] - '0') * 10 + (zone[4] - '0'); |
376 int offset = (hours * 60 + minutes) * 60; | 377 int offset = (hours * 60 + minutes) * 60; |
377 gmt = non_gmt + ((zone[0] == '+') ? offset : -offset); | 378 gmt = non_gmt + ((zone[0] == '+') ? offset : -offset); |
378 } else { | 379 } else { |
379 size_t zindex; | 380 size_t zindex; |
380 if (!find_string(zindex, zone, kTimeZones, ARRAY_SIZE(kTimeZones))) { | 381 if (!find_string(zindex, zone, kTimeZones, arraysize(kTimeZones))) { |
381 return false; | 382 return false; |
382 } | 383 } |
383 gmt = non_gmt + kTimeZoneOffsets[zindex] * 60 * 60; | 384 gmt = non_gmt + kTimeZoneOffsets[zindex] * 60 * 60; |
384 } | 385 } |
385 // TODO: Android should support timezone, see b/2441195 | 386 // TODO: Android should support timezone, see b/2441195 |
386 #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) || defined(WEBRTC_ANDROID) || de
fined(BSD) | 387 #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) || defined(WEBRTC_ANDROID) || de
fined(BSD) |
387 tm *tm_for_timezone = localtime(&gmt); | 388 tm *tm_for_timezone = localtime(&gmt); |
388 *seconds = gmt + tm_for_timezone->tm_gmtoff; | 389 *seconds = gmt + tm_for_timezone->tm_gmtoff; |
389 #else | 390 #else |
390 #if _MSC_VER >= 1900 | 391 #if _MSC_VER >= 1900 |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 } | 1046 } |
1046 #endif | 1047 #endif |
1047 #endif // WEBRTC_WIN | 1048 #endif // WEBRTC_WIN |
1048 | 1049 |
1049 return HAR_IGNORE; | 1050 return HAR_IGNORE; |
1050 } | 1051 } |
1051 | 1052 |
1052 ////////////////////////////////////////////////////////////////////// | 1053 ////////////////////////////////////////////////////////////////////// |
1053 | 1054 |
1054 } // namespace rtc | 1055 } // namespace rtc |
OLD | NEW |