OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef PDF_PDFIUM_PDFIUM_API_STRING_BUFFER_ADAPTER_H_ | 5 #ifndef PDF_PDFIUM_PDFIUM_API_STRING_BUFFER_ADAPTER_H_ |
6 #define PDF_PDFIUM_PDFIUM_API_STRING_BUFFER_ADAPTER_H_ | 6 #define PDF_PDFIUM_PDFIUM_API_STRING_BUFFER_ADAPTER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include <stddef.h> |
| 9 |
| 10 #include "base/macros.h" |
9 #include "base/numerics/safe_math.h" | 11 #include "base/numerics/safe_math.h" |
10 | 12 |
11 namespace chrome_pdf { | 13 namespace chrome_pdf { |
12 | 14 |
13 // Helper to deal with the fact that many PDFium APIs write the null-terminator | 15 // Helper to deal with the fact that many PDFium APIs write the null-terminator |
14 // into string buffers that are passed to them, but the PDF plugin likes to pass | 16 // into string buffers that are passed to them, but the PDF plugin likes to pass |
15 // in std::strings / base::string16s, where one should not count on the internal | 17 // in std::strings / base::string16s, where one should not count on the internal |
16 // string buffers to be null-terminated. | 18 // string buffers to be null-terminated. |
17 | 19 |
18 template <class StringType> | 20 template <class StringType> |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 Close(unsigned_size.ValueOrDie()); | 92 Close(unsigned_size.ValueOrDie()); |
91 } | 93 } |
92 | 94 |
93 private: | 95 private: |
94 PDFiumAPIStringBufferAdapter<StringType> adapter_; | 96 PDFiumAPIStringBufferAdapter<StringType> adapter_; |
95 }; | 97 }; |
96 | 98 |
97 } // namespace chrome_pdf | 99 } // namespace chrome_pdf |
98 | 100 |
99 #endif // PDF_PDFIUM_PDFIUM_API_STRING_BUFFER_ADAPTER_H_ | 101 #endif // PDF_PDFIUM_PDFIUM_API_STRING_BUFFER_ADAPTER_H_ |
OLD | NEW |