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 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 bool Pathname::SetFilename(const std::string& filename) { | 218 bool Pathname::SetFilename(const std::string& filename) { |
219 std::string::size_type pos = filename.rfind(EXT_DELIM); | 219 std::string::size_type pos = filename.rfind(EXT_DELIM); |
220 if ((pos == std::string::npos) || (pos == 0)) { | 220 if ((pos == std::string::npos) || (pos == 0)) { |
221 return SetExtension(EMPTY_STR) && SetBasename(filename); | 221 return SetExtension(EMPTY_STR) && SetBasename(filename); |
222 } else { | 222 } else { |
223 return SetExtension(filename.substr(pos)) && SetBasename(filename.substr(0,
pos)); | 223 return SetExtension(filename.substr(pos)) && SetBasename(filename.substr(0,
pos)); |
224 } | 224 } |
225 } | 225 } |
226 | 226 |
227 #if defined(WEBRTC_WIN) | 227 #if defined(WEBRTC_WIN) |
228 bool Pathname::GetDrive(char *drive, uint32 bytes) const { | 228 bool Pathname::GetDrive(char* drive, uint32_t bytes) const { |
229 return GetDrive(drive, bytes, folder_); | 229 return GetDrive(drive, bytes, folder_); |
230 } | 230 } |
231 | 231 |
232 // static | 232 // static |
233 bool Pathname::GetDrive(char *drive, uint32 bytes, | 233 bool Pathname::GetDrive(char* drive, |
| 234 uint32_t bytes, |
234 const std::string& pathname) { | 235 const std::string& pathname) { |
235 // need at lease 4 bytes to save c: | 236 // need at lease 4 bytes to save c: |
236 if (bytes < 4 || pathname.size() < 3) { | 237 if (bytes < 4 || pathname.size() < 3) { |
237 return false; | 238 return false; |
238 } | 239 } |
239 | 240 |
240 memcpy(drive, pathname.c_str(), 3); | 241 memcpy(drive, pathname.c_str(), 3); |
241 drive[3] = 0; | 242 drive[3] = 0; |
242 // sanity checking | 243 // sanity checking |
243 return (isalpha(drive[0]) && | 244 return (isalpha(drive[0]) && |
244 drive[1] == ':' && | 245 drive[1] == ':' && |
245 drive[2] == '\\'); | 246 drive[2] == '\\'); |
246 } | 247 } |
247 #endif | 248 #endif |
248 | 249 |
249 /////////////////////////////////////////////////////////////////////////////// | 250 /////////////////////////////////////////////////////////////////////////////// |
250 | 251 |
251 } // namespace rtc | 252 } // namespace rtc |
OLD | NEW |