Skip to content

Commit 6b03335

Browse files
committed
go wild turning tchar into char
1 parent 2cccfab commit 6b03335

19 files changed

+180
-180
lines changed

extern/StormLib/src/FileStream.cpp

+22-22
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static bool BaseFile_Create(TFileStream * pStream)
132132
return true;
133133
}
134134

135-
static bool BaseFile_Open(TFileStream * pStream, const TCHAR * szFileName, DWORD dwStreamFlags)
135+
static bool BaseFile_Open(TFileStream * pStream, const char * szFileName, DWORD dwStreamFlags)
136136
{
137137
#ifdef STORMLIB_WINDOWS
138138
{
@@ -669,7 +669,7 @@ static void BaseMap_Init(TFileStream * pStream)
669669
//-----------------------------------------------------------------------------
670670
// Local functions - base HTTP file support
671671

672-
static const TCHAR * BaseHttp_ExtractServerName(const TCHAR * szFileName, TCHAR * szServerName)
672+
static const char * BaseHttp_ExtractServerName(const char * szFileName, char * szServerName)
673673
{
674674
// Check for HTTP
675675
if(!_tcsnicmp(szFileName, _T("http://"), 7))
@@ -692,7 +692,7 @@ static const TCHAR * BaseHttp_ExtractServerName(const TCHAR * szFileName, TCHAR
692692
return szFileName;
693693
}
694694

695-
static bool BaseHttp_Open(TFileStream * pStream, const TCHAR * szFileName, DWORD dwStreamFlags)
695+
static bool BaseHttp_Open(TFileStream * pStream, const char * szFileName, DWORD dwStreamFlags)
696696
{
697697
#ifdef STORMLIB_WINDOWS
698698

@@ -714,7 +714,7 @@ static bool BaseHttp_Open(TFileStream * pStream, const TCHAR * szFileName, DWORD
714714
0);
715715
if(pStream->Base.Http.hInternet != NULL)
716716
{
717-
TCHAR szServerName[MAX_PATH];
717+
char szServerName[MAX_PATH];
718718
DWORD dwFlags = INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_NO_UI | INTERNET_FLAG_NO_CACHE_WRITE;
719719

720720
// Initiate connection with the server
@@ -739,7 +739,7 @@ static bool BaseHttp_Open(TFileStream * pStream, const TCHAR * szFileName, DWORD
739739
DWORD dwFileSize = 0;
740740
DWORD dwDataSize;
741741
DWORD dwIndex = 0;
742-
TCHAR StatusCode[0x08];
742+
char StatusCode[0x08];
743743

744744
// Check if the file succeeded to open
745745
dwDataSize = sizeof(StatusCode);
@@ -816,7 +816,7 @@ static bool BaseHttp_Read(
816816
HINTERNET hRequest;
817817
LPCTSTR szFileName;
818818
LPBYTE pbBuffer = (LPBYTE)pvBuffer;
819-
TCHAR szRangeRequest[0x80];
819+
char szRangeRequest[0x80];
820820
DWORD dwStartOffset = (DWORD)ByteOffset;
821821
DWORD dwEndOffset = dwStartOffset + dwBytesToRead;
822822

@@ -1090,13 +1090,13 @@ static STREAM_INIT StreamBaseInit[4] =
10901090
// The stream structure is created as flat block, variable length
10911091
// The file name is placed after the end of the stream structure data
10921092
static TFileStream * AllocateFileStream(
1093-
const TCHAR * szFileName,
1093+
const char * szFileName,
10941094
size_t StreamSize,
10951095
DWORD dwStreamFlags)
10961096
{
10971097
TFileStream * pMaster = NULL;
10981098
TFileStream * pStream;
1099-
const TCHAR * szNextFile = szFileName;
1099+
const char * szNextFile = szFileName;
11001100
size_t FileNameSize;
11011101

11021102
// Sanity check
@@ -1107,7 +1107,7 @@ static TFileStream * AllocateFileStream(
11071107
// In that case, we use the part after "*" as master file name
11081108
while(szNextFile[0] != 0 && szNextFile[0] != _T('*'))
11091109
szNextFile++;
1110-
FileNameSize = (size_t)((szNextFile - szFileName) * sizeof(TCHAR));
1110+
FileNameSize = (size_t)((szNextFile - szFileName) * sizeof(char));
11111111

11121112
// If we have a next file, we need to open it as master stream
11131113
// Note that we don't care if the master stream exists or not,
@@ -1126,7 +1126,7 @@ static TFileStream * AllocateFileStream(
11261126
}
11271127

11281128
// Allocate the stream structure for the given stream type
1129-
pStream = (TFileStream *)STORM_ALLOC(BYTE, StreamSize + FileNameSize + sizeof(TCHAR));
1129+
pStream = (TFileStream *)STORM_ALLOC(BYTE, StreamSize + FileNameSize + sizeof(char));
11301130
if(pStream != NULL)
11311131
{
11321132
// Zero the entire structure
@@ -1135,9 +1135,9 @@ static TFileStream * AllocateFileStream(
11351135
pStream->dwFlags = dwStreamFlags;
11361136

11371137
// Initialize the file name
1138-
pStream->szFileName = (TCHAR *)((BYTE *)pStream + StreamSize);
1138+
pStream->szFileName = (char *)((BYTE *)pStream + StreamSize);
11391139
memcpy(pStream->szFileName, szFileName, FileNameSize);
1140-
pStream->szFileName[FileNameSize / sizeof(TCHAR)] = 0;
1140+
pStream->szFileName[FileNameSize / sizeof(char)] = 0;
11411141

11421142
// Initialize the stream functions
11431143
StreamBaseInit[dwStreamFlags & 0x03](pStream);
@@ -1440,7 +1440,7 @@ static bool FlatStream_CreateMirror(TBlockStream * pStream)
14401440
return true;
14411441
}
14421442

1443-
static TFileStream * FlatStream_Open(const TCHAR * szFileName, DWORD dwStreamFlags)
1443+
static TFileStream * FlatStream_Open(const char * szFileName, DWORD dwStreamFlags)
14441444
{
14451445
TBlockStream * pStream;
14461446
ULONGLONG ByteOffset = 0;
@@ -1860,7 +1860,7 @@ static bool PartStream_CreateMirror(TBlockStream * pStream)
18601860
}
18611861

18621862

1863-
static TFileStream * PartStream_Open(const TCHAR * szFileName, DWORD dwStreamFlags)
1863+
static TFileStream * PartStream_Open(const char * szFileName, DWORD dwStreamFlags)
18641864
{
18651865
TBlockStream * pStream;
18661866

@@ -2177,7 +2177,7 @@ static bool MpqeStream_BlockRead(
21772177
return true;
21782178
}
21792179

2180-
static TFileStream * MpqeStream_Open(const TCHAR * szFileName, DWORD dwStreamFlags)
2180+
static TFileStream * MpqeStream_Open(const char * szFileName, DWORD dwStreamFlags)
21812181
{
21822182
TEncryptedStream * pStream;
21832183

@@ -2306,14 +2306,14 @@ static void Block4Stream_Close(TBlockStream * pStream)
23062306
return;
23072307
}
23082308

2309-
static TFileStream * Block4Stream_Open(const TCHAR * szFileName, DWORD dwStreamFlags)
2309+
static TFileStream * Block4Stream_Open(const char * szFileName, DWORD dwStreamFlags)
23102310
{
23112311
TBaseProviderData * NewBaseArray = NULL;
23122312
ULONGLONG RemainderBlock;
23132313
ULONGLONG BlockCount;
23142314
ULONGLONG FileSize;
23152315
TBlockStream * pStream;
2316-
TCHAR * szNameBuff;
2316+
char * szNameBuff;
23172317
size_t nNameLength;
23182318
DWORD dwBaseFiles = 0;
23192319
DWORD dwBaseFlags;
@@ -2340,7 +2340,7 @@ static TFileStream * Block4Stream_Open(const TCHAR * szFileName, DWORD dwStreamF
23402340
pStream->BlockRead = (BLOCK_READ)Block4Stream_BlockRead;
23412341

23422342
// Allocate work space for numeric names
2343-
szNameBuff = STORM_ALLOC(TCHAR, nNameLength + 4);
2343+
szNameBuff = STORM_ALLOC(char, nNameLength + 4);
23442344
if(szNameBuff != NULL)
23452345
{
23462346
// Set the base flags
@@ -2441,7 +2441,7 @@ static TFileStream * Block4Stream_Open(const TCHAR * szFileName, DWORD dwStreamF
24412441
*/
24422442

24432443
TFileStream * FileStream_CreateFile(
2444-
const TCHAR * szFileName,
2444+
const char * szFileName,
24452445
DWORD dwStreamFlags)
24462446
{
24472447
TFileStream * pStream;
@@ -2497,7 +2497,7 @@ TFileStream * FileStream_CreateFile(
24972497
*/
24982498

24992499
TFileStream * FileStream_OpenFile(
2500-
const TCHAR * szFileName,
2500+
const char * szFileName,
25012501
DWORD dwStreamFlags)
25022502
{
25032503
DWORD dwProvider = dwStreamFlags & STREAM_PROVIDERS_MASK;
@@ -2533,7 +2533,7 @@ TFileStream * FileStream_OpenFile(
25332533
*
25342534
* \a pStream Pointer to an open stream
25352535
*/
2536-
const TCHAR * FileStream_GetFileName(TFileStream * pStream)
2536+
const char * FileStream_GetFileName(TFileStream * pStream)
25372537
{
25382538
assert(pStream != NULL);
25392539
return pStream->szFileName;
@@ -2546,7 +2546,7 @@ const TCHAR * FileStream_GetFileName(TFileStream * pStream)
25462546
* \a pdwStreamProvider Pointer to a DWORD variable that receives stream provider (STREAM_PROVIDER_XXX)
25472547
*/
25482548

2549-
size_t FileStream_Prefix(const TCHAR * szFileName, DWORD * pdwProvider)
2549+
size_t FileStream_Prefix(const char * szFileName, DWORD * pdwProvider)
25502550
{
25512551
size_t nPrefixLength1 = 0;
25522552
size_t nPrefixLength2 = 0;

extern/StormLib/src/FileStream.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ typedef bool (*STREAM_CREATE)(
2424

2525
typedef bool (*STREAM_OPEN)(
2626
struct TFileStream * pStream, // Pointer to an unopened stream
27-
const TCHAR * szFileName, // Pointer to file name to be open
27+
const char * szFileName, // Pointer to file name to be open
2828
DWORD dwStreamFlags // Stream flags
2929
);
3030

@@ -179,7 +179,7 @@ struct TFileStream
179179

180180
// Stream provider data
181181
TFileStream * pMaster; // Master stream (e.g. MPQ on a web server)
182-
TCHAR * szFileName; // File name (self-relative pointer)
182+
char * szFileName; // File name (self-relative pointer)
183183

184184
ULONGLONG StreamSize; // Stream size (can be less than file size)
185185
ULONGLONG StreamPos; // Stream position

extern/StormLib/src/SBaseCommon.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@ void StringCreatePseudoFileName(char * szBuffer, size_t cchMaxChars, unsigned in
149149

150150
//-----------------------------------------------------------------------------
151151
// Utility functions (UNICODE) only exist in the ANSI version of the library
152-
// In ANSI builds, TCHAR = char, so we don't need these functions implemented
152+
// In ANSI builds, char = char, so we don't need these functions implemented
153153

154154
#if 0
155-
void StringCopy(TCHAR * szTarget, size_t cchTarget, const char * szSource)
155+
void StringCopy(char * szTarget, size_t cchTarget, const char * szSource)
156156
{
157157
if(cchTarget > 0)
158158
{
@@ -166,7 +166,7 @@ void StringCopy(TCHAR * szTarget, size_t cchTarget, const char * szSource)
166166
}
167167
}
168168

169-
void StringCopy(char * szTarget, size_t cchTarget, const TCHAR * szSource)
169+
void StringCopy(char * szTarget, size_t cchTarget, const char * szSource)
170170
{
171171
if(cchTarget > 0)
172172
{
@@ -180,7 +180,7 @@ void StringCopy(char * szTarget, size_t cchTarget, const TCHAR * szSource)
180180
}
181181
}
182182

183-
void StringCopy(TCHAR * szTarget, size_t cchTarget, const TCHAR * szSource)
183+
void StringCopy(char * szTarget, size_t cchTarget, const char * szSource)
184184
{
185185
if(cchTarget > 0)
186186
{
@@ -189,12 +189,12 @@ void StringCopy(TCHAR * szTarget, size_t cchTarget, const TCHAR * szSource)
189189
if(cchSource >= cchTarget)
190190
cchSource = cchTarget - 1;
191191

192-
memcpy(szTarget, szSource, cchSource * sizeof(TCHAR));
192+
memcpy(szTarget, szSource, cchSource * sizeof(char));
193193
szTarget[cchSource] = 0;
194194
}
195195
}
196196

197-
void StringCat(TCHAR * szTarget, size_t cchTargetMax, const TCHAR * szSource)
197+
void StringCat(char * szTarget, size_t cchTargetMax, const char * szSource)
198198
{
199199
// Get the current length of the target
200200
size_t cchTarget = _tcslen(szTarget);

extern/StormLib/src/SFileAddFile.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ bool WINAPI SFileFinishFile(HANDLE hFile)
887887

888888
bool WINAPI SFileAddFileEx(
889889
HANDLE hMpq,
890-
const TCHAR * szFileName,
890+
const char * szFileName,
891891
const char * szArchivedName,
892892
DWORD dwFlags,
893893
DWORD dwCompression, // Compression of the first sector
@@ -1025,7 +1025,7 @@ bool WINAPI SFileAddFileEx(
10251025
}
10261026

10271027
// Adds a data file into the archive
1028-
bool WINAPI SFileAddFile(HANDLE hMpq, const TCHAR * szFileName, const char * szArchivedName, DWORD dwFlags)
1028+
bool WINAPI SFileAddFile(HANDLE hMpq, const char * szFileName, const char * szArchivedName, DWORD dwFlags)
10291029
{
10301030
return SFileAddFileEx(hMpq,
10311031
szFileName,
@@ -1036,7 +1036,7 @@ bool WINAPI SFileAddFile(HANDLE hMpq, const TCHAR * szFileName, const char * szA
10361036
}
10371037

10381038
// Adds a WAVE file into the archive
1039-
bool WINAPI SFileAddWave(HANDLE hMpq, const TCHAR * szFileName, const char * szArchivedName, DWORD dwFlags, DWORD dwQuality)
1039+
bool WINAPI SFileAddWave(HANDLE hMpq, const char * szFileName, const char * szArchivedName, DWORD dwFlags, DWORD dwQuality)
10401040
{
10411041
DWORD dwCompression = 0;
10421042

extern/StormLib/src/SFileCompactArchive.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static DWORD CheckIfAllFilesKnown(TMPQArchive * ha)
4646
return dwErrCode;
4747
}
4848

49-
static DWORD CheckIfAllKeysKnown(TMPQArchive * ha, const TCHAR * szListFile, LPDWORD pFileKeys)
49+
static DWORD CheckIfAllKeysKnown(TMPQArchive * ha, const char * szListFile, LPDWORD pFileKeys)
5050
{
5151
TFileEntry * pFileTableEnd = ha->pFileTable + ha->dwFileTableSize;
5252
TFileEntry * pFileEntry;
@@ -523,14 +523,14 @@ bool WINAPI SFileSetCompactCallback(HANDLE hMpq, SFILE_COMPACT_CALLBACK pfnCompa
523523
return true;
524524
}
525525

526-
bool WINAPI SFileCompactArchive(HANDLE hMpq, const TCHAR * szListFile, bool /* bReserved */)
526+
bool WINAPI SFileCompactArchive(HANDLE hMpq, const char * szListFile, bool /* bReserved */)
527527
{
528528
TFileStream * pTempStream = NULL;
529529
TMPQArchive * ha = (TMPQArchive *)hMpq;
530530
ULONGLONG ByteOffset;
531531
ULONGLONG ByteCount;
532532
LPDWORD pFileKeys = NULL;
533-
TCHAR szTempFile[MAX_PATH+1] = _T("");
533+
char szTempFile[MAX_PATH+1] = _T("");
534534
DWORD dwErrCode = ERROR_SUCCESS;
535535

536536
// Test the valid parameters

extern/StormLib/src/SFileCreateArchive.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static DWORD WriteNakedMPQHeader(TMPQArchive * ha)
6969
//-----------------------------------------------------------------------------
7070
// Creates a new MPQ archive.
7171

72-
bool WINAPI SFileCreateArchive(const TCHAR * szMpqName, DWORD dwCreateFlags, DWORD dwMaxFileCount, HANDLE * phMpq)
72+
bool WINAPI SFileCreateArchive(const char * szMpqName, DWORD dwCreateFlags, DWORD dwMaxFileCount, HANDLE * phMpq)
7373
{
7474
SFILE_CREATE_MPQ CreateInfo;
7575

@@ -98,7 +98,7 @@ bool WINAPI SFileCreateArchive(const TCHAR * szMpqName, DWORD dwCreateFlags, DWO
9898
return SFileCreateArchive2(szMpqName, &CreateInfo, phMpq);
9999
}
100100

101-
bool WINAPI SFileCreateArchive2(const TCHAR * szMpqName, PSFILE_CREATE_MPQ pCreateInfo, HANDLE * phMpq)
101+
bool WINAPI SFileCreateArchive2(const char * szMpqName, PSFILE_CREATE_MPQ pCreateInfo, HANDLE * phMpq)
102102
{
103103
TFileStream * pStream = NULL; // File stream
104104
TMPQArchive * ha = NULL; // MPQ archive handle

extern/StormLib/src/SFileExtractFile.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "StormLib.h"
1313
#include "StormCommon.h"
1414

15-
bool WINAPI SFileExtractFile(HANDLE hMpq, const char * szToExtract, const TCHAR * szExtracted, DWORD dwSearchScope)
15+
bool WINAPI SFileExtractFile(HANDLE hMpq, const char * szToExtract, const char * szExtracted, DWORD dwSearchScope)
1616
{
1717
TFileStream * pLocalFile = NULL;
1818
HANDLE hMpqFile = NULL;

extern/StormLib/src/SFileFindFile.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ static void FreeMPQSearch(TMPQSearch *& hs)
380380
//-----------------------------------------------------------------------------
381381
// Public functions
382382

383-
HANDLE WINAPI SFileFindFirstFile(HANDLE hMpq, const char * szMask, SFILE_FIND_DATA * lpFindFileData, const TCHAR * szListFile)
383+
HANDLE WINAPI SFileFindFirstFile(HANDLE hMpq, const char * szMask, SFILE_FIND_DATA * lpFindFileData, const char * szListFile)
384384
{
385385
TMPQArchive * ha = (TMPQArchive *)hMpq;
386386
TMPQSearch * hs = NULL;

extern/StormLib/src/SFileGetFileInfo.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ static bool GetInfo_PatchChain(TMPQFile * hf, void * pvFileInfo, DWORD cbFileInf
157157
cchCharsNeeded += _tcslen(FileStream_GetFileName(hfTemp->ha->pStream)) + 1;
158158

159159
// Verify whether the caller gave us valid buffer with enough size
160-
if(!GetInfo_BufferCheck(pvFileInfo, cbFileInfo, (DWORD)(cchCharsNeeded * sizeof(TCHAR)), pcbLengthNeeded))
160+
if(!GetInfo_BufferCheck(pvFileInfo, cbFileInfo, (DWORD)(cchCharsNeeded * sizeof(char)), pcbLengthNeeded))
161161
return false;
162162

163163
// Copy each patch name
@@ -168,7 +168,7 @@ static bool GetInfo_PatchChain(TMPQFile * hf, void * pvFileInfo, DWORD cbFileInf
168168
nLength = _tcslen(szPatchName) + 1;
169169

170170
// Copy the file name
171-
memcpy(szFileInfo, szPatchName, nLength * sizeof(TCHAR));
171+
memcpy(szFileInfo, szPatchName, nLength * sizeof(char));
172172
szFileInfo += nLength;
173173
}
174174

@@ -194,7 +194,7 @@ bool WINAPI SFileGetFileInfo(
194194
LPDWORD pcbLengthNeeded)
195195
{
196196
MPQ_SIGNATURE_INFO SignatureInfo;
197-
const TCHAR * szSrcFileInfo;
197+
const char * szSrcFileInfo;
198198
TMPQArchive * ha = NULL;
199199
TFileEntry * pFileEntry = NULL;
200200
TMPQHeader * pHeader = NULL;
@@ -224,7 +224,7 @@ bool WINAPI SFileGetFileInfo(
224224
{
225225
case SFileMpqFileName:
226226
szSrcFileInfo = FileStream_GetFileName(ha->pStream);
227-
cbSrcFileInfo = (DWORD)((_tcslen(szSrcFileInfo) + 1) * sizeof(TCHAR));
227+
cbSrcFileInfo = (DWORD)((_tcslen(szSrcFileInfo) + 1) * sizeof(char));
228228
return GetInfo(pvFileInfo, cbFileInfo, szSrcFileInfo, cbSrcFileInfo, pcbLengthNeeded);
229229

230230
case SFileMpqStreamBitmap:
@@ -595,7 +595,7 @@ bool WINAPI SFileGetFileName(HANDLE hFile, char * szFileName)
595595
{
596596
if(szFileName != NULL)
597597
{
598-
const TCHAR * szStreamName = FileStream_GetFileName(hf->pStream);
598+
const char * szStreamName = FileStream_GetFileName(hf->pStream);
599599
StringCopy(szFileName, MAX_PATH, szStreamName);
600600
}
601601
dwErrCode = ERROR_SUCCESS;

0 commit comments

Comments
 (0)