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/fpdfapi/fpdf_serial.h" | 7 #include "../../../include/fpdfapi/fpdf_serial.h" |
8 CFDF_Document::CFDF_Document() : CPDF_IndirectObjects(NULL) | 8 CFDF_Document::CFDF_Document() : CPDF_IndirectObjects(NULL) |
9 { | 9 { |
10 m_pRootDict = NULL; | 10 m_pRootDict = NULL; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 168 } |
169 void FPDF_FileSpec_SetWin32Path(CPDF_Object* pFileSpec, const CFX_WideString& fi
lepath) | 169 void FPDF_FileSpec_SetWin32Path(CPDF_Object* pFileSpec, const CFX_WideString& fi
lepath) |
170 { | 170 { |
171 CFX_WideString result; | 171 CFX_WideString result; |
172 if (filepath.GetLength() > 1 && filepath[1] == ':') { | 172 if (filepath.GetLength() > 1 && filepath[1] == ':') { |
173 result = L"/"; | 173 result = L"/"; |
174 result += filepath[0]; | 174 result += filepath[0]; |
175 if (filepath[2] != '\\') { | 175 if (filepath[2] != '\\') { |
176 result += '/'; | 176 result += '/'; |
177 } | 177 } |
178 result += ChangeSlash((FX_LPCWSTR)filepath + 2); | 178 result += ChangeSlash(filepath.c_str() + 2); |
179 } else if (filepath.GetLength() > 1 && filepath[0] == '\\' && filepath[1] ==
'\\') { | 179 } else if (filepath.GetLength() > 1 && filepath[0] == '\\' && filepath[1] ==
'\\') { |
180 result = ChangeSlash((FX_LPCWSTR)filepath + 1); | 180 result = ChangeSlash(filepath.c_str() + 1); |
181 } else { | 181 } else { |
182 result = ChangeSlash(filepath); | 182 result = ChangeSlash(filepath); |
183 } | 183 } |
184 if (pFileSpec->GetType() == PDFOBJ_STRING) { | 184 if (pFileSpec->GetType() == PDFOBJ_STRING) { |
185 pFileSpec->SetString(CFX_ByteString::FromUnicode(result)); | 185 pFileSpec->SetString(CFX_ByteString::FromUnicode(result)); |
186 } else if (pFileSpec->GetType() == PDFOBJ_DICTIONARY) { | 186 } else if (pFileSpec->GetType() == PDFOBJ_DICTIONARY) { |
187 ((CPDF_Dictionary*)pFileSpec)->SetAtString(FX_BSTRC("F"), CFX_ByteString
::FromUnicode(result)); | 187 ((CPDF_Dictionary*)pFileSpec)->SetAtString(FX_BSTRC("F"), CFX_ByteString
::FromUnicode(result)); |
188 ((CPDF_Dictionary*)pFileSpec)->SetAtString(FX_BSTRC("UF"), PDF_EncodeTex
t(result)); | 188 ((CPDF_Dictionary*)pFileSpec)->SetAtString(FX_BSTRC("UF"), PDF_EncodeTex
t(result)); |
189 ((CPDF_Dictionary*)pFileSpec)->RemoveAt(FX_BSTRC("FS")); | 189 ((CPDF_Dictionary*)pFileSpec)->RemoveAt(FX_BSTRC("FS")); |
190 } | 190 } |
(...skipping 19 matching lines...) Expand all Loading... |
210 else { | 210 else { |
211 wsFileName = CFX_WideString::FromLocal(pFileSpec->GetString()); | 211 wsFileName = CFX_WideString::FromLocal(pFileSpec->GetString()); |
212 } | 212 } |
213 if (wsFileName[0] != '/') { | 213 if (wsFileName[0] != '/') { |
214 return ChangeSlash(wsFileName); | 214 return ChangeSlash(wsFileName); |
215 } | 215 } |
216 if (wsFileName[2] == '/') { | 216 if (wsFileName[2] == '/') { |
217 CFX_WideString result; | 217 CFX_WideString result; |
218 result += wsFileName[1]; | 218 result += wsFileName[1]; |
219 result += ':'; | 219 result += ':'; |
220 result += ChangeSlash(((FX_LPCWSTR)wsFileName) + 2); | 220 result += ChangeSlash(wsFileName.c_str() + 2); |
221 return result; | 221 return result; |
222 } else { | 222 } else { |
223 CFX_WideString result; | 223 CFX_WideString result; |
224 result += '\\'; | 224 result += '\\'; |
225 result += ChangeSlash(wsFileName); | 225 result += ChangeSlash(wsFileName); |
226 return result; | 226 return result; |
227 } | 227 } |
228 } | 228 } |
OLD | NEW |