Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bugzilla DB migration completed. Please report issues to Infra team via email via infra@gentoo.org or IRC
View | Details | Raw Unified | Return to bug 574900 | Differences between
and this patch

Collapse All | Expand All

(-)a/CPP/7zip/Archive/Zip/ZipIn.cpp (+24 lines)
Lines 2-7 Link Here
2
2
3
#include "StdAfx.h"
3
#include "StdAfx.h"
4
4
5
#include <iconv.h>
6
#include <natspec.h>
7
5
// #include <stdio.h>
8
// #include <stdio.h>
6
9
7
#include "../../../Common/DynamicBuffer.h"
10
#include "../../../Common/DynamicBuffer.h"
Lines 13-18 Link Here
13
16
14
#include "ZipIn.h"
17
#include "ZipIn.h"
15
18
19
#include "myPrivate.h" // global_use_utf16_conversion
20
16
#define Get16(p) GetUi16(p)
21
#define Get16(p) GetUi16(p)
17
#define Get32(p) GetUi32(p)
22
#define Get32(p) GetUi32(p)
18
#define Get64(p) GetUi64(p)
23
#define Get64(p) GetUi64(p)
Lines 91-96 HRESULT CInArchive::Open(IInStream *stream, const UInt64 *searchHeaderSizeLimit) Link Here
91
  RINOK(FindAndReadMarker(stream, searchHeaderSizeLimit));
96
  RINOK(FindAndReadMarker(stream, searchHeaderSizeLimit));
92
  RINOK(stream->Seek(m_Position, STREAM_SEEK_SET, NULL));
97
  RINOK(stream->Seek(m_Position, STREAM_SEEK_SET, NULL));
93
  Stream = stream;
98
  Stream = stream;
99
100
101
  /* Guess archive filename charset */
102
  archive_oem_charset = natspec_get_charset_by_locale(NATSPEC_DOSCS, "");
94
  return S_OK;
103
  return S_OK;
95
}
104
}
96
105
Lines 445-450 void CInArchive::ReadFileName(unsigned size, AString &s) Link Here
445
  s.ReleaseBuffer();
454
  s.ReleaseBuffer();
446
}
455
}
447
456
457
void CInArchive::RecodeFileName(CItem &item) {
458
  if (item.IsUtf8()) return;
459
460
  /* Convert filename from archive charset to current locale's charset */
461
  char *p = natspec_convert(item.Name.Ptr(), NULL, archive_oem_charset, 0);
462
  if (p) {
463
    item.Name = p;
464
    item.SetUtf8(true);
465
    USING_UTF8 = true;
466
    free(p);
467
  }
468
}
469
448
bool CInArchive::ReadExtra(unsigned extraSize, CExtraBlock &extraBlock,
470
bool CInArchive::ReadExtra(unsigned extraSize, CExtraBlock &extraBlock,
449
    UInt64 &unpackSize, UInt64 &packSize, UInt64 &localHeaderOffset, UInt32 &diskStartNumber)
471
    UInt64 &unpackSize, UInt64 &packSize, UInt64 &localHeaderOffset, UInt32 &diskStartNumber)
450
{
472
{
Lines 565-570 bool CInArchive::ReadLocalItem(CItemEx &item) Link Here
565
  }
587
  }
566
  if (item.Name.Len() != nameSize)
588
  if (item.Name.Len() != nameSize)
567
    return false;
589
    return false;
590
  RecodeFileName(item);
568
  return item.LocalFullHeaderSize <= ((UInt32)1 << 16);
591
  return item.LocalFullHeaderSize <= ((UInt32)1 << 16);
569
}
592
}
570
593
Lines 738-743 HRESULT CInArchive::ReadCdItem(CItemEx &item) Link Here
738
  item.ExternalAttrib = Get32(p + 34);
761
  item.ExternalAttrib = Get32(p + 34);
739
  item.LocalHeaderPos = Get32(p + 38);
762
  item.LocalHeaderPos = Get32(p + 38);
740
  ReadFileName(nameSize, item.Name);
763
  ReadFileName(nameSize, item.Name);
764
  RecodeFileName(item);
741
  
765
  
742
  if (extraSize > 0)
766
  if (extraSize > 0)
743
  {
767
  {
(-)a/CPP/7zip/Archive/Zip/ZipIn.h (+3 lines)
Lines 184-189 public: Link Here
184
      return false;
184
      return false;
185
    return true;
185
    return true;
186
  }
186
  }
187
188
  const char *archive_oem_charset;
189
  void RecodeFileName(CItem &item);
187
};
190
};
188
  
191
  
189
}}
192
}}
(-)a/CPP/7zip/Archive/Zip/ZipItem.cpp (+2 lines)
Lines 10-15 Link Here
10
namespace NArchive {
10
namespace NArchive {
11
namespace NZip {
11
namespace NZip {
12
12
13
bool USING_UTF8 = true;
14
13
using namespace NFileHeader;
15
using namespace NFileHeader;
14
16
15
bool CExtraSubBlock::ExtractNtfsTime(unsigned index, FILETIME &ft) const
17
bool CExtraSubBlock::ExtractNtfsTime(unsigned index, FILETIME &ft) const
(-)a/CPP/7zip/Archive/Zip/ZipItem.h (+2 lines)
Lines 15-20 Link Here
15
namespace NArchive {
15
namespace NArchive {
16
namespace NZip {
16
namespace NZip {
17
17
18
extern bool USING_UTF8;
19
18
struct CVersion
20
struct CVersion
19
{
21
{
20
  Byte Version;
22
  Byte Version;
(-)a/CPP/7zip/Archive/Zip/ZipOut.cpp (+20 lines)
Lines 2-11 Link Here
2
2
3
#include "StdAfx.h"
3
#include "StdAfx.h"
4
4
5
#include <iconv.h>
6
#include <natspec.h>
7
5
#include "../../Common/OffsetStream.h"
8
#include "../../Common/OffsetStream.h"
6
9
7
#include "ZipOut.h"
10
#include "ZipOut.h"
8
11
12
#include "myPrivate.h" // global_use_utf16_conversion
13
9
namespace NArchive {
14
namespace NArchive {
10
namespace NZip {
15
namespace NZip {
11
16
Lines 18-26 HRESULT COutArchive::Create(IOutStream *outStream) Link Here
18
  m_OutBuffer.SetStream(outStream);
23
  m_OutBuffer.SetStream(outStream);
19
  m_OutBuffer.Init();
24
  m_OutBuffer.Init();
20
25
26
  /* Guess archive filename charset */
27
  archive_oem_charset = natspec_get_charset_by_locale(NATSPEC_DOSCS, "");
28
21
  return m_Stream->Seek(0, STREAM_SEEK_CUR, &m_Base);
29
  return m_Stream->Seek(0, STREAM_SEEK_CUR, &m_Base);
22
}
30
}
23
31
32
void COutArchive::RecodeFileName(CItem &item) {
33
  if (USING_UTF8) return;
34
35
  /* Convert filename from current locale charset to archive charset. */
36
  char *p = natspec_convert(item.Name.Ptr(), archive_oem_charset, NULL, 0);
37
  if (p) {
38
    item.Name = p;
39
    item.SetUtf8(false);
40
    free(p);
41
  }
42
}
43
24
void COutArchive::MoveCurPos(UInt64 distanceToMove)
44
void COutArchive::MoveCurPos(UInt64 distanceToMove)
25
{
45
{
26
  m_CurPos += distanceToMove; // test overflow
46
  m_CurPos += distanceToMove; // test overflow
(-)a/CPP/7zip/Archive/Zip/ZipOut.h (+3 lines)
Lines 81-86 public: Link Here
81
81
82
  void CreateStreamForCompressing(IOutStream **outStream);
82
  void CreateStreamForCompressing(IOutStream **outStream);
83
  void CreateStreamForCopying(ISequentialOutStream **outStream);
83
  void CreateStreamForCopying(ISequentialOutStream **outStream);
84
85
  const char *archive_oem_charset;
86
  void RecodeFileName(CItem &item);
84
};
87
};
85
88
86
}}
89
}}
(-)a/CPP/7zip/Archive/Zip/ZipUpdate.cpp (+5 lines)
Lines 86-91 static void SetFileHeader( Link Here
86
  }
86
  }
87
  else
87
  else
88
    isDir = item.IsDir();
88
    isDir = item.IsDir();
89
  
90
  archive.RecodeFileName(item);
89
91
90
  item.LocalHeaderPos = archive.GetCurPos();
92
  item.LocalHeaderPos = archive.GetCurPos();
91
  item.MadeByVersion.HostOS = kMadeByHostOS;
93
  item.MadeByVersion.HostOS = kMadeByHostOS;
Lines 353-358 static HRESULT UpdateItemOldData( Link Here
353
    item.Ntfs_ATime = ui.Ntfs_ATime;
355
    item.Ntfs_ATime = ui.Ntfs_ATime;
354
    item.Ntfs_CTime = ui.Ntfs_CTime;
356
    item.Ntfs_CTime = ui.Ntfs_CTime;
355
    item.NtfsTimeIsDefined = ui.NtfsTimeIsDefined;
357
    item.NtfsTimeIsDefined = ui.NtfsTimeIsDefined;
358
    archive.RecodeFileName(item);
356
359
357
    item.CentralExtra.RemoveUnknownSubBlocks();
360
    item.CentralExtra.RemoveUnknownSubBlocks();
358
    item.LocalExtra.RemoveUnknownSubBlocks();
361
    item.LocalExtra.RemoveUnknownSubBlocks();
Lines 367-372 static HRESULT UpdateItemOldData( Link Here
367
  {
370
  {
368
    CUpdateRange range(inArchive->GetOffsetInStream(itemEx.LocalHeaderPos), itemEx.GetLocalFullSize());
371
    CUpdateRange range(inArchive->GetOffsetInStream(itemEx.LocalHeaderPos), itemEx.GetLocalFullSize());
369
    
372
    
373
    archive.RecodeFileName(item);
374
    
370
    // set new header position
375
    // set new header position
371
    item.LocalHeaderPos = archive.GetCurPos();
376
    item.LocalHeaderPos = archive.GetCurPos();
372
    
377
    
(-)a/makefile.linux_amd64_asm (-1 / +1 lines)
Lines 19-25 ASM=yasm -f elf -m amd64 -Dx64 Link Here
19
19
20
PRE_COMPILED_HEADER=StdAfx.h.gch
20
PRE_COMPILED_HEADER=StdAfx.h.gch
21
21
22
LOCAL_LIBS=-lpthread
22
LOCAL_LIBS=-lpthread -lnatspec
23
LOCAL_LIBS_DLL=$(LOCAL_LIBS) -ldl
23
LOCAL_LIBS_DLL=$(LOCAL_LIBS) -ldl
24
24
25
CPU=x64
25
CPU=x64
(-)a/makefile.linux_any_cpu_gcc_4.X (-1 / +1 lines)
Lines 19-25 LINK_SHARED=-fPIC -shared Link Here
19
19
20
PRE_COMPILED_HEADER=StdAfx.h.gch
20
PRE_COMPILED_HEADER=StdAfx.h.gch
21
21
22
LOCAL_LIBS=-lpthread
22
LOCAL_LIBS=-lpthread -lnatspec
23
LOCAL_LIBS_DLL=$(LOCAL_LIBS) -ldl
23
LOCAL_LIBS_DLL=$(LOCAL_LIBS) -ldl
24
24
25
OBJ_CRC32=$(OBJ_CRC32_C)
25
OBJ_CRC32=$(OBJ_CRC32_C)
(-)a/makefile.linux_x86_asm_gcc_4.X (-1 / +1 lines)
Lines 22-28 ASM=nasm -f elf Link Here
22
22
23
PRE_COMPILED_HEADER=StdAfx.h.gch
23
PRE_COMPILED_HEADER=StdAfx.h.gch
24
24
25
LOCAL_LIBS=-lpthread
25
LOCAL_LIBS=-lpthread -lnatspec
26
LOCAL_LIBS_DLL=$(LOCAL_LIBS) -ldl
26
LOCAL_LIBS_DLL=$(LOCAL_LIBS) -ldl
27
27
28
CPU=x86
28
CPU=x86

Return to bug 574900