| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/common/sandbox_mac.h" | 5 #include "chrome/common/sandbox_mac.h" |
| 6 | 6 |
| 7 #include "base/debug_util.h" | 7 #include "base/debug_util.h" |
| 8 | 8 |
| 9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
| 10 extern "C" { | 10 extern "C" { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 if (c < 128) { // EscapeSingleChar only handles ASCII. | 87 if (c < 128) { // EscapeSingleChar only handles ASCII. |
| 88 char as_char = static_cast<char>(c); | 88 char as_char = static_cast<char>(c); |
| 89 if (EscapeSingleChar(as_char, dst)) { | 89 if (EscapeSingleChar(as_char, dst)) { |
| 90 continue; | 90 continue; |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 if (c < 32 || c > 126) { | 94 if (c < 32 || c > 126) { |
| 95 // Any characters that aren't printable ASCII get the \u treatment. | 95 // Any characters that aren't printable ASCII get the \u treatment. |
| 96 unsigned int as_uint = static_cast<unsigned int>(c); | 96 unsigned int as_uint = static_cast<unsigned int>(c); |
| 97 StringAppendF(dst, "\\u%04X", as_uint); | 97 base::StringAppendF(dst, "\\u%04X", as_uint); |
| 98 continue; | 98 continue; |
| 99 } | 99 } |
| 100 | 100 |
| 101 // If we got here we know that the character in question is strictly | 101 // If we got here we know that the character in question is strictly |
| 102 // in the ASCII range so there's no need to do any kind of encoding | 102 // in the ASCII range so there's no need to do any kind of encoding |
| 103 // conversion. | 103 // conversion. |
| 104 dst->push_back(static_cast<char>(c)); | 104 dst->push_back(static_cast<char>(c)); |
| 105 } | 105 } |
| 106 return true; | 106 return true; |
| 107 } | 107 } |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 if (HANDLE_EINTR(fcntl(fd, F_GETPATH, canonical_path)) != 0) { | 538 if (HANDLE_EINTR(fcntl(fd, F_GETPATH, canonical_path)) != 0) { |
| 539 PLOG(FATAL) << "GetCanonicalSandboxPath() failed for: " | 539 PLOG(FATAL) << "GetCanonicalSandboxPath() failed for: " |
| 540 << path->value(); | 540 << path->value(); |
| 541 return; | 541 return; |
| 542 } | 542 } |
| 543 | 543 |
| 544 *path = FilePath(canonical_path); | 544 *path = FilePath(canonical_path); |
| 545 } | 545 } |
| 546 | 546 |
| 547 } // namespace sandbox | 547 } // namespace sandbox |
| OLD | NEW |