| 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 "../include/fsdk_define.h" | 7 #include "../include/fsdk_define.h" |
| 8 #include "../include/fpdfdoc.h" | 8 #include "../include/fpdfdoc.h" |
| 9 | 9 |
| 10 static int this_module = 0; | 10 static int this_module = 0; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 CPDF_Document* pDoc = (CPDF_Document*)doc; | 242 CPDF_Document* pDoc = (CPDF_Document*)doc; |
| 243 // Get info dictionary | 243 // Get info dictionary |
| 244 CPDF_Dictionary* pInfo = pDoc->GetInfo(); | 244 CPDF_Dictionary* pInfo = pDoc->GetInfo(); |
| 245 if (pInfo == NULL) return 0; | 245 if (pInfo == NULL) return 0; |
| 246 | 246 |
| 247 CFX_WideString text = pInfo->GetUnicodeText(tag); | 247 CFX_WideString text = pInfo->GetUnicodeText(tag); |
| 248 | 248 |
| 249 // Use UTF-16LE encoding | 249 // Use UTF-16LE encoding |
| 250 CFX_ByteString bstr = text.UTF16LE_Encode(); | 250 CFX_ByteString bstr = text.UTF16LE_Encode(); |
| 251 unsigned long len = bstr.GetLength(); | 251 unsigned long len = bstr.GetLength(); |
| 252 » if (buffer != NULL || buflen >= len+2) { | 252 » if (buffer != NULL && buflen >= len+2) { |
| 253 FXSYS_memcpy(buffer, (FX_LPCSTR)bstr, len); | 253 FXSYS_memcpy(buffer, (FX_LPCSTR)bstr, len); |
| 254 // use double zero as trailer | 254 // use double zero as trailer |
| 255 ((FX_BYTE*)buffer)[len] = ((FX_BYTE*)buffer)[len+1] = 0; | 255 ((FX_BYTE*)buffer)[len] = ((FX_BYTE*)buffer)[len+1] = 0; |
| 256 } | 256 } |
| 257 return len+2; | 257 return len+2; |
| 258 } | 258 } |
| 259 | 259 |
| OLD | NEW |