| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "pdf/pdfium/pdfium_engine.h" | 5 #include "pdf/pdfium/pdfium_engine.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include "base/i18n/icu_encoding_detection.h" | 9 #include "base/i18n/icu_encoding_detection.h" |
| 10 #include "base/i18n/icu_string_conversions.h" | 10 #include "base/i18n/icu_string_conversions.h" |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 (*text)[position.next_whitespace_position] = L'\n'; | 492 (*text)[position.next_whitespace_position] = L'\n'; |
| 493 text->insert(position.next_whitespace_position, kCr); | 493 text->insert(position.next_whitespace_position, kCr); |
| 494 } | 494 } |
| 495 text->erase(position.position, 1); | 495 text->erase(position.position, 1); |
| 496 hyphen_positions.pop_back(); | 496 hyphen_positions.pop_back(); |
| 497 } | 497 } |
| 498 | 498 |
| 499 // Adobe Reader also get rid of trailing spaces right before a CRLF. | 499 // Adobe Reader also get rid of trailing spaces right before a CRLF. |
| 500 static const base::char16 kSpaceCrCn[] = {L' ', L'\r', L'\n', L'\0'}; | 500 static const base::char16 kSpaceCrCn[] = {L' ', L'\r', L'\n', L'\0'}; |
| 501 static const base::char16 kCrCn[] = {L'\r', L'\n', L'\0'}; | 501 static const base::char16 kCrCn[] = {L'\r', L'\n', L'\0'}; |
| 502 ReplaceSubstringsAfterOffset(text, 0, kSpaceCrCn, kCrCn); | 502 base::ReplaceSubstringsAfterOffset(text, 0, kSpaceCrCn, kCrCn); |
| 503 } | 503 } |
| 504 | 504 |
| 505 // Replace CR/LF with just LF on POSIX. | 505 // Replace CR/LF with just LF on POSIX. |
| 506 void FormatStringForOS(base::string16* text) { | 506 void FormatStringForOS(base::string16* text) { |
| 507 #if defined(OS_POSIX) | 507 #if defined(OS_POSIX) |
| 508 static const base::char16 kCr[] = {L'\r', L'\0'}; | 508 static const base::char16 kCr[] = {L'\r', L'\0'}; |
| 509 static const base::char16 kBlank[] = {L'\0'}; | 509 static const base::char16 kBlank[] = {L'\0'}; |
| 510 base::ReplaceChars(*text, kCr, kBlank, text); | 510 base::ReplaceChars(*text, kCr, kBlank, text); |
| 511 #elif defined(OS_WIN) | 511 #elif defined(OS_WIN) |
| 512 // Do nothing | 512 // Do nothing |
| (...skipping 3518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4031 double* height) { | 4031 double* height) { |
| 4032 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); | 4032 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); |
| 4033 if (!doc) | 4033 if (!doc) |
| 4034 return false; | 4034 return false; |
| 4035 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 4035 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
| 4036 FPDF_CloseDocument(doc); | 4036 FPDF_CloseDocument(doc); |
| 4037 return success; | 4037 return success; |
| 4038 } | 4038 } |
| 4039 | 4039 |
| 4040 } // namespace chrome_pdf | 4040 } // namespace chrome_pdf |
| OLD | NEW |