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 #include "webrtc/base/win32.h" | 14 #include "webrtc/base/win32.h" |
15 #endif | 15 #endif |
16 | 16 |
17 #include <algorithm> | 17 #include <algorithm> |
| 18 #include "webrtc/base/arraysize.h" |
18 #include "webrtc/base/common.h" | 19 #include "webrtc/base/common.h" |
19 #include "webrtc/base/diskcache.h" | 20 #include "webrtc/base/diskcache.h" |
20 #include "webrtc/base/fileutils.h" | 21 #include "webrtc/base/fileutils.h" |
21 #include "webrtc/base/pathutils.h" | 22 #include "webrtc/base/pathutils.h" |
22 #include "webrtc/base/stream.h" | 23 #include "webrtc/base/stream.h" |
23 #include "webrtc/base/stringencode.h" | 24 #include "webrtc/base/stringencode.h" |
24 #include "webrtc/base/stringutils.h" | 25 #include "webrtc/base/stringutils.h" |
25 | 26 |
26 #if !defined(NDEBUG) | 27 #if !defined(NDEBUG) |
27 #define TRANSPARENT_CACHE_NAMES 1 | 28 #define TRANSPARENT_CACHE_NAMES 1 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 encode(buffer, buffer_size, id.data(), id.length(), | 257 encode(buffer, buffer_size, id.data(), id.length(), |
257 unsafe_filename_characters(), '%'); | 258 unsafe_filename_characters(), '%'); |
258 // TODO: ASSERT(strlen(buffer) < FileSystem::MaxBasenameLength()); | 259 // TODO: ASSERT(strlen(buffer) < FileSystem::MaxBasenameLength()); |
259 #else // !TRANSPARENT_CACHE_NAMES | 260 #else // !TRANSPARENT_CACHE_NAMES |
260 // We might want to just use a hash of the filename at some point, both for | 261 // We might want to just use a hash of the filename at some point, both for |
261 // obfuscation, and to avoid both filename length and escaping issues. | 262 // obfuscation, and to avoid both filename length and escaping issues. |
262 ASSERT(false); | 263 ASSERT(false); |
263 #endif // !TRANSPARENT_CACHE_NAMES | 264 #endif // !TRANSPARENT_CACHE_NAMES |
264 | 265 |
265 char extension[32]; | 266 char extension[32]; |
266 sprintfn(extension, ARRAY_SIZE(extension), ".%u", index); | 267 sprintfn(extension, arraysize(extension), ".%u", index); |
267 | 268 |
268 Pathname pathname; | 269 Pathname pathname; |
269 pathname.SetFolder(folder_); | 270 pathname.SetFolder(folder_); |
270 pathname.SetBasename(buffer); | 271 pathname.SetBasename(buffer); |
271 pathname.SetExtension(extension); | 272 pathname.SetExtension(extension); |
272 | 273 |
273 #ifdef TRANSPARENT_CACHE_NAMES | 274 #ifdef TRANSPARENT_CACHE_NAMES |
274 delete [] buffer; | 275 delete [] buffer; |
275 #endif // TRANSPARENT_CACHE_NAMES | 276 #endif // TRANSPARENT_CACHE_NAMES |
276 | 277 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 entry2->last_modified = time(0); | 340 entry2->last_modified = time(0); |
340 entry2->lock_state = LS_UNLOCKED; | 341 entry2->lock_state = LS_UNLOCKED; |
341 this2->CheckLimit(); | 342 this2->CheckLimit(); |
342 } | 343 } |
343 } | 344 } |
344 } | 345 } |
345 | 346 |
346 /////////////////////////////////////////////////////////////////////////////// | 347 /////////////////////////////////////////////////////////////////////////////// |
347 | 348 |
348 } // namespace rtc | 349 } // namespace rtc |
OLD | NEW |