OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 return nullptr; | 103 return nullptr; |
104 } | 104 } |
105 | 105 |
106 if (misc->Unicode == 0) { | 106 if (misc->Unicode == 0) { |
107 size_t string_length = misc->Length - offsetof(IMAGE_DEBUG_MISC, Data) - 1; | 107 size_t string_length = misc->Length - offsetof(IMAGE_DEBUG_MISC, Data) - 1; |
108 if (misc->Data[string_length] != '\0') { | 108 if (misc->Data[string_length] != '\0') { |
109 EXPECT_EQ('\0', misc->Data[string_length]); | 109 EXPECT_EQ('\0', misc->Data[string_length]); |
110 return nullptr; | 110 return nullptr; |
111 } | 111 } |
112 } else if (misc->Unicode == 1) { | 112 } else if (misc->Unicode == 1) { |
113 if (misc->Length % sizeof(char16) != 0) { | 113 if (misc->Length % sizeof(base::char16) != 0) { |
114 EXPECT_EQ(0u, misc->Length % sizeof(char16)); | 114 EXPECT_EQ(0u, misc->Length % sizeof(base::char16)); |
115 return nullptr; | 115 return nullptr; |
116 } | 116 } |
117 | 117 |
118 size_t string_length = | 118 size_t string_length = (misc->Length - offsetof(IMAGE_DEBUG_MISC, Data)) / |
119 (misc->Length - offsetof(IMAGE_DEBUG_MISC, Data)) / sizeof(char16) - 1; | 119 sizeof(base::char16) - |
120 const char16* data16 = reinterpret_cast<const char16*>(misc->Data); | 120 1; |
| 121 const base::char16* data16 = |
| 122 reinterpret_cast<const base::char16*>(misc->Data); |
121 if (data16[string_length] != '\0') { | 123 if (data16[string_length] != '\0') { |
122 EXPECT_EQ('\0', data16[string_length]); | 124 EXPECT_EQ('\0', data16[string_length]); |
123 return nullptr; | 125 return nullptr; |
124 } | 126 } |
125 } else { | 127 } else { |
126 ADD_FAILURE() << "misc->Unicode " << misc->Unicode; | 128 ADD_FAILURE() << "misc->Unicode " << misc->Unicode; |
127 return nullptr; | 129 return nullptr; |
128 } | 130 } |
129 | 131 |
130 return misc; | 132 return misc; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 size_t TestUInt32MinidumpWritable::SizeOfObject() { | 320 size_t TestUInt32MinidumpWritable::SizeOfObject() { |
319 return sizeof(value_); | 321 return sizeof(value_); |
320 } | 322 } |
321 | 323 |
322 bool TestUInt32MinidumpWritable::WriteObject(FileWriterInterface* file_writer) { | 324 bool TestUInt32MinidumpWritable::WriteObject(FileWriterInterface* file_writer) { |
323 return file_writer->Write(&value_, sizeof(value_)); | 325 return file_writer->Write(&value_, sizeof(value_)); |
324 } | 326 } |
325 | 327 |
326 } // namespace test | 328 } // namespace test |
327 } // namespace crashpad | 329 } // namespace crashpad |
OLD | NEW |