Major POSIX overhaul

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6416 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2013-12-08 14:34:38 +00:00
parent 1e55e30ff4
commit be6c7e6a1d
35 changed files with 1718 additions and 1412 deletions

View file

@ -77,6 +77,7 @@ inline bool UTF8_GetTrailCount(unsigned char chFirst, unsigned char &cb)
#include <stdlib.h>
#include <stdio.h>
#include "tstring.h"
#include "util.h" // iconvdescriptor & my_fopen
#ifdef _WIN32
#include <io.h> // For _setmode
#include <fcntl.h> // For _O_BINARY
@ -84,8 +85,6 @@ inline bool UTF8_GetTrailCount(unsigned char chFirst, unsigned char &cb)
FILE* my_fopen(const TCHAR *path, const char *mode); // from util.h
void RawTStrToASCII(const TCHAR*in,char*out,UINT maxcch);
void UTF16InplaceEndianSwap(void*Buffer, UINT cch);
UINT StrLenUTF16(const void*str);
bool StrSetUTF16LE(tstring&dest, const void*src);
@ -141,7 +140,7 @@ class WCToUTF16LEHlpr {
public:
WCToUTF16LEHlpr() : m_s(0) {}
bool Create(const TCHAR*in)
bool Create(const TCHAR*in, unsigned int codepage = CP_ACP)
#if !defined(_WIN32) || !defined(_UNICODE)
;
#else
@ -159,6 +158,8 @@ public:
const unsigned short* Get() const { return m_s; }
UINT GetLen() const { return StrLenUTF16(m_s); }
UINT GetSize() const { return (GetLen()+1) * 2; }
unsigned short* Detach() { unsigned short *r = m_s; m_s = 0; return r; }
void CopyTo(unsigned short*Dest) const { memcpy(Dest, Get(), GetSize()); }
};
class NStreamEncoding {