diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2015-10-05 03:00:00 +0300 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:16:56 +0300 |
commit | 6543c280208393fa32cb0094f770d14c1cfb13b2 (patch) | |
tree | beb90f5e81e85e7957463ee5ad89cab0b3566560 /CPP/7zip/UI/Agent | |
parent | f6444c32568553e0261ca0105083658f12be6284 (diff) |
15.0815.08
Diffstat (limited to 'CPP/7zip/UI/Agent')
-rw-r--r-- | CPP/7zip/UI/Agent/AgentOut.cpp | 2 | ||||
-rw-r--r-- | CPP/7zip/UI/Agent/AgentProxy.cpp | 25 |
2 files changed, 23 insertions, 4 deletions
diff --git a/CPP/7zip/UI/Agent/AgentOut.cpp b/CPP/7zip/UI/Agent/AgentOut.cpp index 0468fdd1..1302d8c7 100644 --- a/CPP/7zip/UI/Agent/AgentOut.cpp +++ b/CPP/7zip/UI/Agent/AgentOut.cpp @@ -265,7 +265,7 @@ STDMETHODIMP CAgent::DoOperation( UInt32 value; RINOK(outArchive->GetFileTimeType(&value)); - switch(value) + switch (value) { case NFileTimeType::kWindows: case NFileTimeType::kDOS: diff --git a/CPP/7zip/UI/Agent/AgentProxy.cpp b/CPP/7zip/UI/Agent/AgentProxy.cpp index 543cfbaa..9a977c70 100644 --- a/CPP/7zip/UI/Agent/AgentProxy.cpp +++ b/CPP/7zip/UI/Agent/AgentProxy.cpp @@ -3,10 +3,16 @@ #include "StdAfx.h" // #include <stdio.h> +#ifdef _WIN32 +#include <wchar.h> +#else +#include <ctype.h> +#endif #include "../../../../C/Sort.h" #include "../../../../C/CpuArch.h" +#include "../../../Common/UTFConvert.h" #include "../../../Common/Wildcard.h" #include "../../../Windows/PropVariant.h" @@ -555,7 +561,10 @@ HRESULT CProxyArc2::Load(const CArc &arc, IProgress *progress) } Files.Alloc(numItems); - + + UString tempUString; + AString tempAString; + UInt32 i; for (i = 0; i < numItems; i++) { @@ -567,12 +576,12 @@ HRESULT CProxyArc2::Load(const CArc &arc, IProgress *progress) CProxyFile2 &file = Files[i]; - #ifdef MY_CPU_LE const void *p; UInt32 size; UInt32 propType; RINOK(arc.GetRawProps->GetRawProp(i, kpidName, &p, &size, &propType)); + #ifdef MY_CPU_LE if (p && propType == PROP_DATA_TYPE_wchar_t_PTR_Z_LE) { file.Name = (const wchar_t *)p; @@ -582,6 +591,16 @@ HRESULT CProxyArc2::Load(const CArc &arc, IProgress *progress) } else #endif + if (p && propType == NPropDataType::kUtf8z) + { + tempAString = (const char *)p; + ConvertUTF8ToUnicode(tempAString, tempUString); + file.NameLen = tempUString.Len(); + file.Name = new wchar_t[file.NameLen + 1]; + file.NeedDeleteName = true; + wmemcpy((wchar_t *)file.Name, tempUString.Ptr(), file.NameLen + 1); + } + else { NCOM::CPropVariant prop; RINOK(arc.Archive->GetProperty(i, kpidName, &prop)); @@ -595,7 +614,7 @@ HRESULT CProxyArc2::Load(const CArc &arc, IProgress *progress) file.NameLen = MyStringLen(s); file.Name = new wchar_t[file.NameLen + 1]; file.NeedDeleteName = true; - MyStringCopy((wchar_t *)file.Name, s); + wmemcpy((wchar_t *)file.Name, s, file.NameLen + 1); } UInt32 parent = (UInt32)(Int32)-1; |