Skip to content

Commit 1bbf2f9

Browse files
authored
Merge pull request #9 from OutpostUniverse/updateWhitespace
Update whitespace
2 parents 188f360 + 6e39f29 commit 1bbf2f9

10 files changed

Lines changed: 127 additions & 86 deletions

CClmReader.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,14 @@ HRESULT CClmReader::get_FileName(int index, BSTR *fileName)
6060
// Allocate space for the string
6161
SysReAllocStringLen(fileName, NULL, stringLength);
6262
// Convert the string to Unicode
63-
MultiByteToWideChar(CP_ACP, 0, indexTable[index].fileName,
64-
stringLength, *fileName, stringLength);
63+
MultiByteToWideChar(
64+
CP_ACP,
65+
0,
66+
indexTable[index].fileName,
67+
stringLength,
68+
*fileName,
69+
stringLength
70+
);
6571

6672
return S_OK;
6773
}
@@ -112,9 +118,11 @@ HRESULT CClmReader::OpenStreamRead(BSTR fileName, StreamReader **stream)
112118
// CLM file much less memory intensive.
113119

114120
// Create a memory stream reading with the file contents
115-
memStream = new CMemoryStreamReader(indexTable[fileIndex].size,
116-
(char*)(dataBuffer[fileIndex]),
117-
bAttachToBuffer);
121+
memStream = new CMemoryStreamReader(
122+
indexTable[fileIndex].size,
123+
(char*)(dataBuffer[fileIndex]),
124+
bAttachToBuffer
125+
);
118126
if (memStream == NULL)
119127
{
120128
// Check if buffer is discardable

CFileStreamReader.cpp

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,15 @@ CFileStreamReader::CFileStreamReader(BSTR fileName) : m_cRef(1)
113113
status = 0;
114114

115115
// Open the file
116-
hFile = CreateFileW(fileName, // lpFileName
117-
GENERIC_READ, // dwDesired access
118-
FILE_SHARE_READ,// dwShareMode
119-
NULL, // lpSecurityAttributes
120-
OPEN_EXISTING, // dwCreationDisposition
121-
FILE_ATTRIBUTE_NORMAL |
122-
FILE_FLAG_SEQUENTIAL_SCAN,
123-
// dwFlagsAndAttributes
124-
NULL // hTemplate
125-
);
116+
hFile = CreateFileW(
117+
fileName, // lpFileName
118+
GENERIC_READ, // dwDesired access
119+
FILE_SHARE_READ,// dwShareMode
120+
NULL, // lpSecurityAttributes
121+
OPEN_EXISTING, // dwCreationDisposition
122+
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, // dwFlagsAndAttributes
123+
NULL // hTemplate
124+
);
126125

127126
// Check if the file was opened successfully
128127
if (hFile == INVALID_HANDLE_VALUE)
@@ -141,16 +140,15 @@ CFileStreamReader::CFileStreamReader(BSTR fileName) : m_cRef(1)
141140
WideCharToMultiByte(CP_ACP, 0, fileName, stringLength, tempString, stringLength, 0, 0);
142141

143142
// Try to open the file with ANSI version of CreateFile
144-
hFile = CreateFileA(tempString, // lpFileName
145-
GENERIC_READ, // dwDesired access
146-
FILE_SHARE_READ,// dwShareMode
147-
NULL, // lpSecurityAttributes
148-
OPEN_EXISTING, // dwCreationDisposition
149-
FILE_ATTRIBUTE_NORMAL |
150-
FILE_FLAG_SEQUENTIAL_SCAN,
151-
// dwFlagsAndAttributes
152-
NULL // hTemplate
153-
);
143+
hFile = CreateFileA(
144+
tempString, // lpFileName
145+
GENERIC_READ, // dwDesired access
146+
FILE_SHARE_READ,// dwShareMode
147+
NULL, // lpSecurityAttributes
148+
OPEN_EXISTING, // dwCreationDisposition
149+
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, // dwFlagsAndAttributes
150+
NULL // hTemplate
151+
);
154152

155153
// Check for errors
156154
if (hFile == INVALID_HANDLE_VALUE)

CFileStreamWriter.cpp

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,15 @@ CFileStreamWriter::CFileStreamWriter(BSTR fileName) : m_cRef(1)
4444
status = 0;
4545

4646
// Open the file
47-
hFile = CreateFileW(fileName, // lpFileName
48-
GENERIC_WRITE, // dwDesired access
49-
0, // dwShareMode
50-
NULL, // lpSecurityAttributes
51-
CREATE_ALWAYS, // dwCreationDisposition
52-
FILE_ATTRIBUTE_NORMAL |
53-
FILE_FLAG_SEQUENTIAL_SCAN,
54-
// dwFlagsAndAttributes
55-
NULL // hTemplate
56-
);
47+
hFile = CreateFileW(
48+
fileName, // lpFileName
49+
GENERIC_WRITE, // dwDesired access
50+
0, // dwShareMode
51+
NULL, // lpSecurityAttributes
52+
CREATE_ALWAYS, // dwCreationDisposition
53+
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, // dwFlagsAndAttributes
54+
NULL // hTemplate
55+
);
5756

5857
// Check if the file was opened successfully
5958
if (hFile == INVALID_HANDLE_VALUE)
@@ -72,16 +71,15 @@ CFileStreamWriter::CFileStreamWriter(BSTR fileName) : m_cRef(1)
7271
WideCharToMultiByte(CP_ACP, 0, fileName, stringLength, tempString, stringLength, 0, 0);
7372

7473
// Try to open the file with ANSI version of CreateFile
75-
hFile = CreateFileA(tempString, // lpFileName
76-
GENERIC_WRITE, // dwDesired access
77-
0, // dwShareMode
78-
NULL, // lpSecurityAttributes
79-
CREATE_ALWAYS, // dwCreationDisposition
80-
FILE_ATTRIBUTE_NORMAL |
81-
FILE_FLAG_SEQUENTIAL_SCAN,
82-
// dwFlagsAndAttributes
83-
NULL // hTemplate
84-
);
74+
hFile = CreateFileA(
75+
tempString, // lpFileName
76+
GENERIC_WRITE, // dwDesired access
77+
0, // dwShareMode
78+
NULL, // lpSecurityAttributes
79+
CREATE_ALWAYS, // dwCreationDisposition
80+
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, // dwFlagsAndAttributes
81+
NULL // hTemplate
82+
);
8583

8684
// Check for errors
8785
if (hFile == INVALID_HANDLE_VALUE)

CMapFile.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -808,8 +808,14 @@ HRESULT CMapFile::get_TileGroupName(int tileGroupIndex, BSTR *tileGroupName)
808808
int nameLen = tileGroupInfo[tileGroupIndex].nameLen;
809809
SysReAllocStringLen(tileGroupName, NULL, nameLen);
810810
// Convert the name to unicode
811-
MultiByteToWideChar(CP_ACP, 0, tileGroupInfo[tileGroupIndex].name, nameLen,
812-
*tileGroupName, nameLen);
811+
MultiByteToWideChar(
812+
CP_ACP,
813+
0,
814+
tileGroupInfo[tileGroupIndex].name,
815+
nameLen,
816+
*tileGroupName,
817+
nameLen
818+
);
813819

814820
return S_OK;
815821
}
@@ -1130,7 +1136,7 @@ HRESULT CMapFile::InterfaceSupportsErrorInfo(REFIID riid)
11301136
// ***********************
11311137

11321138
CMapFile::CMapFile(TileSetSource *tileSetSource, int width, int height) :
1133-
m_cRef(1)
1139+
m_cRef(1)
11341140
{
11351141
// Round width up to the next power of 2
11361142
width = RoundUpPowerOf2(width);
@@ -1188,8 +1194,12 @@ CMapFile::CMapFile(TileSetSource *tileSetSource, int width, int height) :
11881194
g_cLocks++;
11891195
}
11901196

1191-
CMapFile::CMapFile(TileSetSource *tileSetSource, StreamReader *stream,
1192-
enum MapLoadSaveFormat loadFlags) : m_cRef(1)
1197+
CMapFile::CMapFile(
1198+
TileSetSource *tileSetSource,
1199+
StreamReader *stream,
1200+
enum MapLoadSaveFormat loadFlags
1201+
) :
1202+
m_cRef(1)
11931203
{
11941204
// Initialize variables
11951205
tileData = NULL;

CTileSet.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ int CTileSet::SaveTileSet(StreamWriter *stream)
570570
// Write the file header "PBMP" section
571571
sectHead.tag = 'PMBP'; // PBMP tag
572572
sectHead.size = sizeof(sectHead)*4 + sizeOfPixelData + sizeof(headInfo) + 8 +
573-
bmInfo->bmiHeader.biClrUsed*sizeof(RGBQUAD);
573+
bmInfo->bmiHeader.biClrUsed*sizeof(RGBQUAD);
574574
numSectionsLeft = 2; // Number of sections (palette, and pixel data)
575575
// Check if palette section is needed
576576
if (bmInfo->bmiHeader.biClrUsed == 0)
@@ -593,7 +593,7 @@ int CTileSet::SaveTileSet(StreamWriter *stream)
593593
// Write the Palette section
594594
sectHead.tag = 'LAPP'; // PPAL tag
595595
sectHead.size = bmInfo->bmiHeader.biClrUsed*sizeof(RGBQUAD) +
596-
sizeof(sectHead)*2 + 8;
596+
sizeof(sectHead)*2 + 8;
597597
stream->Write(sizeof(sectHead), (int)&sectHead, &numBytesWritten);
598598
// Write the "head" section of the "PPAL" section
599599
sectHead.tag = 'daeh'; // head tag
@@ -615,8 +615,11 @@ int CTileSet::SaveTileSet(StreamWriter *stream)
615615
destPal->rgbBlue = srcPal->rgbRed;
616616
destPal->rgbReserved = srcPal->rgbReserved;
617617
}
618-
stream->Write(bmInfo->bmiHeader.biClrUsed*sizeof(RGBQUAD),
619-
(int)&tempPal, &numBytesWritten);
618+
stream->Write(
619+
bmInfo->bmiHeader.biClrUsed*sizeof(RGBQUAD),
620+
(int)&tempPal,
621+
&numBytesWritten
622+
);
620623
}
621624

622625
// Write the "data" section of the "PBMP" section
@@ -685,7 +688,7 @@ int CTileSet::SaveBitmapFile(StreamWriter *stream)
685688
// Preapre the bitmap file header
686689
bmFileHeader.bfType = 'MB'; // "BM"
687690
bmFileHeader.bfSize = sizeof(bmFileHeader) + sizeof(bmInfo->bmiHeader) +
688-
sizeof(RGBQUAD)*bmInfo->bmiHeader.biClrUsed + sizeOfPixelData;
691+
sizeof(RGBQUAD)*bmInfo->bmiHeader.biClrUsed + sizeOfPixelData;
689692
bmFileHeader.bfReserved1 = 0;
690693
bmFileHeader.bfReserved2 = 0;
691694
bmFileHeader.bfOffBits = bmFileHeader.bfSize - sizeOfPixelData;
@@ -729,8 +732,8 @@ void CTileSet::CalcMiniMapColors(int startTile, int endTile)
729732
{
730733
// Add the color components of this pixel
731734
pixelDataOffset = tileNum*tileByteSize +
732-
y*scanlineByteWidth +
733-
((x*headInfo.bitDepth) >> 3);
735+
y*scanlineByteWidth +
736+
((x*headInfo.bitDepth) >> 3);
734737
switch(headInfo.bitDepth)
735738
{
736739
case 8:

CTileSetManager.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,8 +1193,14 @@ int CTileSetManager::Load(StreamReader *stream)
11931193
// Allocate space for a BSTR to hold the name
11941194
tileSetInfo[i].wideTileSetName = SysAllocStringLen(NULL, temp);
11951195
// Convert the name to unicode
1196-
MultiByteToWideChar(CP_ACP, 0, tileSetInfo[i].tileSetName, temp,
1197-
tileSetInfo[i].wideTileSetName, temp);
1196+
MultiByteToWideChar(
1197+
CP_ACP,
1198+
0,
1199+
tileSetInfo[i].tileSetName,
1200+
temp,
1201+
tileSetInfo[i].wideTileSetName,
1202+
temp
1203+
);
11981204
// Load the associated tile set
11991205
tileSource->LoadTileSet(tileSetInfo[i].wideTileSetName, &tileSet->tileSet);
12001206
// Make sure the tile set was found

CTileSetManager.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,9 @@ class CTileSetManager : public TileSetManager, public ISupportErrorInfo
295295
short numTileReplacements;
296296
short cycleDelay;
297297
};
298-
struct TerrainTypeItemTable // Holds sets of related tiles
299-
// LavaWalls/MicrobeWalls/NormalWalls/DamagedWalls/ReallyDamagedWalls/Tubes
298+
// Holds sets of related tiles
299+
// LavaWalls/MicrobeWalls/NormalWalls/DamagedWalls/ReallyDamagedWalls/Tubes
300+
struct TerrainTypeItemTable
300301
{
301302
short tile[0x10]; // tile for each direction facing
302303
};

CTileSetSource.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ CTileSetSource::CTileSetSource(IResourceManager *resourceManager) : m_cRef(1)
3939
{
4040
head = NULL; // Initialize linked list of loaded files to empty
4141

42-
resManager = resourceManager; // CTileSetSource is owned by IResourceManager
43-
// so the reference count should not be incremented
44-
// (Don't want circular references)
42+
// CTileSetSource is owned by IResourceManager
43+
// so the reference count should not be incremented
44+
// (Don't want circular references)
45+
resManager = resourceManager;
4546

4647
g_cLocks++;
4748
}

CVolReader.cpp

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,14 @@ HRESULT CVolReader::get_FileName(int index, BSTR *fileName)
5858
// Allocate space for the string
5959
SysReAllocStringLen(fileName, NULL, stringLength);
6060
// Convert the string to Unicode
61-
MultiByteToWideChar(CP_ACP, 0, string, stringLength,
62-
*fileName, stringLength);
61+
MultiByteToWideChar(
62+
CP_ACP,
63+
0,
64+
string,
65+
stringLength,
66+
*fileName,
67+
stringLength
68+
);
6369

6470
return S_OK;
6571
}
@@ -133,9 +139,11 @@ HRESULT CVolReader::OpenStreamRead(BSTR fileName, StreamReader **stream)
133139
// Copy the data into a memory stream
134140
CMemoryStreamReader *rawStream;
135141

136-
rawStream = new CMemoryStreamReader(indexTable[fileIndex].fileSize,
137-
(char*)buffer,
138-
bAttachToBuffer);
142+
rawStream = new CMemoryStreamReader(
143+
indexTable[fileIndex].fileSize,
144+
(char*)buffer,
145+
bAttachToBuffer
146+
);
139147
if (rawStream == NULL)
140148
{
141149
if (bAttachToBuffer == 1)
@@ -399,9 +407,11 @@ int CVolReader::GetFileIndex(BSTR fileName)
399407
// Get the midpoint
400408
middleIndex = (startIndex + endIndex) >> 1;
401409
// Check if strings match
402-
result = strncmp((char*)stringBuffer + indexTable[middleIndex].fileNameOffset,
403-
tempString,
404-
stringLength);
410+
result = strncmp(
411+
(char*)stringBuffer + indexTable[middleIndex].fileNameOffset,
412+
tempString,
413+
stringLength
414+
);
405415
if (result == 0)
406416
{
407417
// String match

OP2Editor.cpp

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,17 @@ STDAPI DllRegisterServer(void)
7070
int retVal;
7171

7272
pathLen = GetModuleFileName(g_hInstance, path, MAX_PATH);
73-
retVal = RegCreateKeyEx(HKEY_CLASSES_ROOT,
74-
TEXT("CLSID\\{C8DE4CDE-4554-4fe9-8688-A90D91EBCA0B}\\InprocServer32"),
75-
0,
76-
TEXT(""),
77-
REG_OPTION_NON_VOLATILE,
78-
KEY_ALL_ACCESS,
79-
NULL,
80-
&hSubKey,
81-
&creationDisposition);
73+
retVal = RegCreateKeyEx(
74+
HKEY_CLASSES_ROOT,
75+
TEXT("CLSID\\{C8DE4CDE-4554-4fe9-8688-A90D91EBCA0B}\\InprocServer32"),
76+
0,
77+
TEXT(""),
78+
REG_OPTION_NON_VOLATILE,
79+
KEY_ALL_ACCESS,
80+
NULL,
81+
&hSubKey,
82+
&creationDisposition
83+
);
8284
if (retVal != ERROR_SUCCESS)
8385
return HRESULT_FROM_WIN32(retVal);
8486
retVal = RegSetValueEx(hSubKey, TEXT(""), 0, REG_SZ, (BYTE*)path, pathLen);
@@ -92,10 +94,14 @@ STDAPI DllUnregisterServer(void)
9294
{
9395
int retVal;
9496

95-
retVal = RegDeleteKey(HKEY_CLASSES_ROOT,
96-
TEXT("CLSID\\{C8DE4CDE-4554-4fe9-8688-A90D91EBCA0B}\\InprocServer32"));
97-
retVal = RegDeleteKey(HKEY_CLASSES_ROOT,
98-
TEXT("CLSID\\{C8DE4CDE-4554-4fe9-8688-A90D91EBCA0B}"));
97+
retVal = RegDeleteKey(
98+
HKEY_CLASSES_ROOT,
99+
TEXT("CLSID\\{C8DE4CDE-4554-4fe9-8688-A90D91EBCA0B}\\InprocServer32")
100+
);
101+
retVal = RegDeleteKey(
102+
HKEY_CLASSES_ROOT,
103+
TEXT("CLSID\\{C8DE4CDE-4554-4fe9-8688-A90D91EBCA0B}")
104+
);
99105

100-
return HRESULT_FROM_WIN32(retVal);
106+
return HRESULT_FROM_WIN32(retVal);
101107
}

0 commit comments

Comments
 (0)