OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "public/fpdfview.h" | 7 #include "public/fpdfview.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 void SetLastError(int err) { | 275 void SetLastError(int err) { |
276 g_LastError = err; | 276 g_LastError = err; |
277 } | 277 } |
278 | 278 |
279 int GetLastError() { | 279 int GetLastError() { |
280 return g_LastError; | 280 return g_LastError; |
281 } | 281 } |
282 #endif // _WIN32 | 282 #endif // _WIN32 |
283 | 283 |
284 void ProcessParseError(CPDF_Parser::Error err) { | 284 void ProcessParseError(CPDF_Parser::Error err) { |
285 FX_DWORD err_code; | 285 FX_DWORD err_code = FPDF_ERR_SUCCESS; |
286 // Translate FPDFAPI error code to FPDFVIEW error code | 286 // Translate FPDFAPI error code to FPDFVIEW error code |
287 switch (err) { | 287 switch (err) { |
288 case CPDF_Parser::SUCCESS: | 288 case CPDF_Parser::SUCCESS: |
289 err_code = FPDF_ERR_SUCCESS; | 289 err_code = FPDF_ERR_SUCCESS; |
290 break; | 290 break; |
291 case CPDF_Parser::FILE_ERROR: | 291 case CPDF_Parser::FILE_ERROR: |
292 err_code = FPDF_ERR_FILE; | 292 err_code = FPDF_ERR_FILE; |
293 break; | 293 break; |
294 case CPDF_Parser::FORMAT_ERROR: | 294 case CPDF_Parser::FORMAT_ERROR: |
295 err_code = FPDF_ERR_FORMAT; | 295 err_code = FPDF_ERR_FORMAT; |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 if (!buffer) { | 1158 if (!buffer) { |
1159 *buflen = len; | 1159 *buflen = len; |
1160 } else if (*buflen >= len) { | 1160 } else if (*buflen >= len) { |
1161 memcpy(buffer, utf16Name.c_str(), len); | 1161 memcpy(buffer, utf16Name.c_str(), len); |
1162 *buflen = len; | 1162 *buflen = len; |
1163 } else { | 1163 } else { |
1164 *buflen = -1; | 1164 *buflen = -1; |
1165 } | 1165 } |
1166 return (FPDF_DEST)pDestObj; | 1166 return (FPDF_DEST)pDestObj; |
1167 } | 1167 } |
OLD | NEW |