mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-07 16:07:05 -06:00
4.58 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
bd1fa36322
commit
3901bf0ab8
@@ -7,8 +7,4 @@ extern "C"
|
||||
#include "../../C/7zCrc.h"
|
||||
}
|
||||
|
||||
class CCRCTableInit
|
||||
{
|
||||
public:
|
||||
CCRCTableInit() { CrcGenerateTable(); }
|
||||
} g_CRCTableInit;
|
||||
struct CCRCTableInit { CCRCTableInit() { CrcGenerateTable(); } } g_CRCTableInit;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "MyWindows.h"
|
||||
#include "../Windows/FileIO.h"
|
||||
|
||||
#include "ListFileUtils.h"
|
||||
|
||||
@@ -26,23 +26,31 @@ UString MultiByteToUnicodeString(const AString &srcString, UINT codePage)
|
||||
return resultString;
|
||||
}
|
||||
|
||||
AString UnicodeStringToMultiByte(const UString &srcString, UINT codePage)
|
||||
AString UnicodeStringToMultiByte(const UString &s, UINT codePage, char defaultChar, bool &defaultCharWasUsed)
|
||||
{
|
||||
AString resultString;
|
||||
if(!srcString.IsEmpty())
|
||||
AString dest;
|
||||
defaultCharWasUsed = false;
|
||||
if (!s.IsEmpty())
|
||||
{
|
||||
int numRequiredBytes = srcString.Length() * 2;
|
||||
char defaultChar = '_';
|
||||
int numChars = WideCharToMultiByte(codePage, 0, srcString,
|
||||
srcString.Length(), resultString.GetBuffer(numRequiredBytes),
|
||||
numRequiredBytes + 1, &defaultChar, NULL);
|
||||
int numRequiredBytes = s.Length() * 2;
|
||||
BOOL defUsed;
|
||||
int numChars = WideCharToMultiByte(codePage, 0, s, s.Length(),
|
||||
dest.GetBuffer(numRequiredBytes), numRequiredBytes + 1,
|
||||
&defaultChar, &defUsed);
|
||||
defaultCharWasUsed = (defUsed != FALSE);
|
||||
#ifndef _WIN32_WCE
|
||||
if(numChars == 0)
|
||||
throw 282229;
|
||||
#endif
|
||||
resultString.ReleaseBuffer(numChars);
|
||||
dest.ReleaseBuffer(numChars);
|
||||
}
|
||||
return resultString;
|
||||
return dest;
|
||||
}
|
||||
|
||||
AString UnicodeStringToMultiByte(const UString &srcString, UINT codePage)
|
||||
{
|
||||
bool defaultCharWasUsed;
|
||||
return UnicodeStringToMultiByte(srcString, codePage, '_', defaultCharWasUsed);
|
||||
}
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
|
||||
@@ -8,8 +8,10 @@
|
||||
#include "Types.h"
|
||||
|
||||
UString MultiByteToUnicodeString(const AString &srcString, UINT codePage = CP_ACP);
|
||||
AString UnicodeStringToMultiByte(const UString &srcString, UINT codePage, char defaultChar, bool &defaultCharWasUsed);
|
||||
AString UnicodeStringToMultiByte(const UString &srcString, UINT codePage = CP_ACP);
|
||||
|
||||
|
||||
inline const wchar_t* GetUnicodeString(const wchar_t* unicodeString)
|
||||
{ return unicodeString; }
|
||||
inline const UString& GetUnicodeString(const UString &unicodeString)
|
||||
|
||||
@@ -3,55 +3,9 @@
|
||||
#ifndef __COMMON_TYPES_H
|
||||
#define __COMMON_TYPES_H
|
||||
|
||||
#ifndef _7ZIP_BYTE_DEFINED
|
||||
#define _7ZIP_BYTE_DEFINED
|
||||
typedef unsigned char Byte;
|
||||
#endif
|
||||
#include "../../C/Types.h"
|
||||
|
||||
#ifndef _7ZIP_INT16_DEFINED
|
||||
#define _7ZIP_INT16_DEFINED
|
||||
typedef short Int16;
|
||||
#endif
|
||||
|
||||
#ifndef _7ZIP_UINT16_DEFINED
|
||||
#define _7ZIP_UINT16_DEFINED
|
||||
typedef unsigned short UInt16;
|
||||
#endif
|
||||
|
||||
#ifndef _7ZIP_INT32_DEFINED
|
||||
#define _7ZIP_INT32_DEFINED
|
||||
typedef int Int32;
|
||||
#endif
|
||||
|
||||
#ifndef _7ZIP_UINT32_DEFINED
|
||||
#define _7ZIP_UINT32_DEFINED
|
||||
typedef unsigned int UInt32;
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#ifndef _7ZIP_INT64_DEFINED
|
||||
#define _7ZIP_INT64_DEFINED
|
||||
typedef __int64 Int64;
|
||||
#endif
|
||||
|
||||
#ifndef _7ZIP_UINT64_DEFINED
|
||||
#define _7ZIP_UINT64_DEFINED
|
||||
typedef unsigned __int64 UInt64;
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifndef _7ZIP_INT64_DEFINED
|
||||
#define _7ZIP_INT64_DEFINED
|
||||
typedef long long int Int64;
|
||||
#endif
|
||||
|
||||
#ifndef _7ZIP_UINT64_DEFINED
|
||||
#define _7ZIP_UINT64_DEFINED
|
||||
typedef unsigned long long int UInt64;
|
||||
#endif
|
||||
typedef int HRes;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user