mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-11 00:07:09 -06:00
18.05
This commit is contained in:
@@ -545,6 +545,8 @@ public:
|
||||
|
||||
void ReplaceOneCharAtPos(unsigned pos, wchar_t c) { _chars[pos] = c; }
|
||||
|
||||
wchar_t *GetBuf() { return _chars; }
|
||||
|
||||
wchar_t *GetBuf(unsigned minLen)
|
||||
{
|
||||
if (minLen > _limit)
|
||||
@@ -571,7 +573,7 @@ public:
|
||||
}
|
||||
|
||||
UString &operator=(wchar_t c);
|
||||
UString &operator=(char c) { return (*this)=((wchar_t)c); }
|
||||
UString &operator=(char c) { return (*this)=((wchar_t)(unsigned char)c); }
|
||||
UString &operator=(const wchar_t *s);
|
||||
UString &operator=(const UString &s);
|
||||
void SetFrom(const wchar_t *s, unsigned len); // no check
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <stddef.h> // for wchar_t
|
||||
#include <string.h>
|
||||
// #include <stdint.h> // for uintptr_t
|
||||
|
||||
#include "MyGuidDef.h"
|
||||
|
||||
@@ -53,6 +54,8 @@ typedef long BOOL;
|
||||
|
||||
// typedef size_t ULONG_PTR;
|
||||
typedef size_t DWORD_PTR;
|
||||
// typedef uintptr_t UINT_PTR;
|
||||
// typedef ptrdiff_t UINT_PTR;
|
||||
|
||||
typedef Int64 LONGLONG;
|
||||
typedef UInt64 ULONGLONG;
|
||||
@@ -81,6 +84,8 @@ typedef struct _FILETIME
|
||||
typedef ULONG PROPID;
|
||||
typedef LONG SCODE;
|
||||
|
||||
#define ERROR_NEGATIVE_SEEK 131L
|
||||
|
||||
#define S_OK ((HRESULT)0x00000000L)
|
||||
#define S_FALSE ((HRESULT)0x00000001L)
|
||||
#define E_NOTIMPL ((HRESULT)0x80004001L)
|
||||
|
||||
@@ -75,6 +75,65 @@ void CStdOutStream::PrintUString(const UString &s, AString &temp)
|
||||
*this << (const char *)temp;
|
||||
}
|
||||
|
||||
|
||||
static const wchar_t kReplaceChar = '_';
|
||||
|
||||
void CStdOutStream::Normalize_UString__LF_Allowed(UString &s)
|
||||
{
|
||||
unsigned len = s.Len();
|
||||
wchar_t *d = s.GetBuf();
|
||||
|
||||
if (IsTerminalMode)
|
||||
for (unsigned i = 0; i < len; i++)
|
||||
{
|
||||
wchar_t c = d[i];
|
||||
if (c <= 13 && c >= 7 && c != '\n')
|
||||
d[i] = kReplaceChar;
|
||||
}
|
||||
}
|
||||
|
||||
void CStdOutStream::Normalize_UString(UString &s)
|
||||
{
|
||||
unsigned len = s.Len();
|
||||
wchar_t *d = s.GetBuf();
|
||||
|
||||
if (IsTerminalMode)
|
||||
for (unsigned i = 0; i < len; i++)
|
||||
{
|
||||
wchar_t c = d[i];
|
||||
if (c <= 13 && c >= 7)
|
||||
d[i] = kReplaceChar;
|
||||
}
|
||||
else
|
||||
for (unsigned i = 0; i < len; i++)
|
||||
{
|
||||
wchar_t c = d[i];
|
||||
if (c == '\n')
|
||||
d[i] = kReplaceChar;
|
||||
}
|
||||
}
|
||||
|
||||
void CStdOutStream::NormalizePrint_UString(const UString &s, UString &tempU, AString &tempA)
|
||||
{
|
||||
tempU = s;
|
||||
Normalize_UString(tempU);
|
||||
PrintUString(tempU, tempA);
|
||||
}
|
||||
|
||||
void CStdOutStream::NormalizePrint_UString(const UString &s)
|
||||
{
|
||||
NormalizePrint_wstr(s);
|
||||
}
|
||||
|
||||
void CStdOutStream::NormalizePrint_wstr(const wchar_t *s)
|
||||
{
|
||||
UString tempU = s;
|
||||
Normalize_UString(tempU);
|
||||
AString tempA;
|
||||
PrintUString(tempU, tempA);
|
||||
}
|
||||
|
||||
|
||||
CStdOutStream & CStdOutStream::operator<<(Int32 number) throw()
|
||||
{
|
||||
char s[32];
|
||||
|
||||
@@ -13,7 +13,9 @@ class CStdOutStream
|
||||
FILE *_stream;
|
||||
bool _streamIsOpen;
|
||||
public:
|
||||
CStdOutStream(): _stream(0), _streamIsOpen(false) {};
|
||||
bool IsTerminalMode;
|
||||
|
||||
CStdOutStream(): _stream(0), _streamIsOpen(false), IsTerminalMode(false) {};
|
||||
CStdOutStream(FILE *stream): _stream(stream), _streamIsOpen(false) {};
|
||||
~CStdOutStream() { Close(); }
|
||||
|
||||
@@ -50,6 +52,13 @@ public:
|
||||
|
||||
CStdOutStream & operator<<(const wchar_t *s);
|
||||
void PrintUString(const UString &s, AString &temp);
|
||||
|
||||
void Normalize_UString__LF_Allowed(UString &s);
|
||||
void Normalize_UString(UString &s);
|
||||
|
||||
void NormalizePrint_UString(const UString &s, UString &tempU, AString &tempA);
|
||||
void NormalizePrint_UString(const UString &s);
|
||||
void NormalizePrint_wstr(const wchar_t *s);
|
||||
};
|
||||
|
||||
CStdOutStream & endl(CStdOutStream & outStream) throw();
|
||||
|
||||
Reference in New Issue
Block a user