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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 if (filepath.GetLength() > 1 && filepath[1] == ':') { | 134 if (filepath.GetLength() > 1 && filepath[1] == ':') { |
135 result = L"/"; | 135 result = L"/"; |
136 result += filepath[0]; | 136 result += filepath[0]; |
137 if (filepath[2] != '\\') { | 137 if (filepath[2] != '\\') { |
138 result += '/'; | 138 result += '/'; |
139 } | 139 } |
140 result += ChangeSlash(filepath.c_str() + 2); | 140 result += ChangeSlash(filepath.c_str() + 2); |
141 } else if (filepath.GetLength() > 1 && filepath[0] == '\\' && filepath[1] ==
'\\') { | 141 } else if (filepath.GetLength() > 1 && filepath[0] == '\\' && filepath[1] ==
'\\') { |
142 result = ChangeSlash(filepath.c_str() + 1); | 142 result = ChangeSlash(filepath.c_str() + 1); |
143 } else { | 143 } else { |
144 result = ChangeSlash(filepath); | 144 result = ChangeSlash(filepath.c_str()); |
145 } | 145 } |
146 if (pFileSpec->GetType() == PDFOBJ_STRING) { | 146 if (pFileSpec->GetType() == PDFOBJ_STRING) { |
147 pFileSpec->SetString(CFX_ByteString::FromUnicode(result)); | 147 pFileSpec->SetString(CFX_ByteString::FromUnicode(result)); |
148 } else if (pFileSpec->GetType() == PDFOBJ_DICTIONARY) { | 148 } else if (pFileSpec->GetType() == PDFOBJ_DICTIONARY) { |
149 ((CPDF_Dictionary*)pFileSpec)->SetAtString(FX_BSTRC("F"), CFX_ByteString
::FromUnicode(result)); | 149 ((CPDF_Dictionary*)pFileSpec)->SetAtString(FX_BSTRC("F"), CFX_ByteString
::FromUnicode(result)); |
150 ((CPDF_Dictionary*)pFileSpec)->SetAtString(FX_BSTRC("UF"), PDF_EncodeTex
t(result)); | 150 ((CPDF_Dictionary*)pFileSpec)->SetAtString(FX_BSTRC("UF"), PDF_EncodeTex
t(result)); |
151 ((CPDF_Dictionary*)pFileSpec)->RemoveAt(FX_BSTRC("FS")); | 151 ((CPDF_Dictionary*)pFileSpec)->RemoveAt(FX_BSTRC("FS")); |
152 } | 152 } |
153 } | 153 } |
154 CFX_WideString FPDF_FileSpec_GetWin32Path(const CPDF_Object* pFileSpec) | 154 CFX_WideString FPDF_FileSpec_GetWin32Path(const CPDF_Object* pFileSpec) |
(...skipping 11 matching lines...) Expand all Loading... |
166 if (wsFileName.IsEmpty() && pDict->KeyExist(FX_BSTRC("DOS"))) { | 166 if (wsFileName.IsEmpty() && pDict->KeyExist(FX_BSTRC("DOS"))) { |
167 wsFileName = CFX_WideString::FromLocal(pDict->GetString(FX_BSTRC("DO
S"))); | 167 wsFileName = CFX_WideString::FromLocal(pDict->GetString(FX_BSTRC("DO
S"))); |
168 } | 168 } |
169 } | 169 } |
170 else if (!pFileSpec) | 170 else if (!pFileSpec) |
171 wsFileName = CFX_WideString(); | 171 wsFileName = CFX_WideString(); |
172 else { | 172 else { |
173 wsFileName = CFX_WideString::FromLocal(pFileSpec->GetString()); | 173 wsFileName = CFX_WideString::FromLocal(pFileSpec->GetString()); |
174 } | 174 } |
175 if (wsFileName[0] != '/') { | 175 if (wsFileName[0] != '/') { |
176 return ChangeSlash(wsFileName); | 176 return ChangeSlash(wsFileName.c_str()); |
177 } | 177 } |
178 if (wsFileName[2] == '/') { | 178 if (wsFileName[2] == '/') { |
179 CFX_WideString result; | 179 CFX_WideString result; |
180 result += wsFileName[1]; | 180 result += wsFileName[1]; |
181 result += ':'; | 181 result += ':'; |
182 result += ChangeSlash(wsFileName.c_str() + 2); | 182 result += ChangeSlash(wsFileName.c_str() + 2); |
183 return result; | 183 return result; |
184 } else { | 184 } else { |
185 CFX_WideString result; | 185 CFX_WideString result; |
186 result += '\\'; | 186 result += '\\'; |
187 result += ChangeSlash(wsFileName); | 187 result += ChangeSlash(wsFileName.c_str()); |
188 return result; | 188 return result; |
189 } | 189 } |
190 } | 190 } |
OLD | NEW |