Skip to content

Commit

Permalink
mass clean up and reduce warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
IntelOrca committed May 12, 2014
1 parent 8f1bde0 commit 8dcca91
Show file tree
Hide file tree
Showing 28 changed files with 249 additions and 332 deletions.
6 changes: 4 additions & 2 deletions projects/openrct2.vcxproj
Expand Up @@ -74,7 +74,6 @@
<ClCompile Include="..\src\sawyercoding.c" />
<ClCompile Include="..\src\scenario.c" />
<ClCompile Include="..\src\screenshot.c" />
<ClCompile Include="..\src\settings.c" />
<ClCompile Include="..\src\strings.c" />
<ClCompile Include="..\src\title.c" />
<ClCompile Include="..\src\track.c" />
Expand Down Expand Up @@ -160,6 +159,7 @@
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<StructMemberAlignment>1Byte</StructMemberAlignment>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
Expand All @@ -172,13 +172,15 @@
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<SDLCheck>
</SDLCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<StructMemberAlignment>1Byte</StructMemberAlignment>
<TreatSpecificWarningsAsErrors>4013</TreatSpecificWarningsAsErrors>
<OmitFramePointers>
</OmitFramePointers>
<BufferSecurityCheck>false</BufferSecurityCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
Expand Down
3 changes: 0 additions & 3 deletions projects/openrct2.vcxproj.filters
Expand Up @@ -269,9 +269,6 @@
<ClCompile Include="..\src\window_save_prompt.c">
<Filter>Windows</Filter>
</ClCompile>
<ClCompile Include="..\src\settings.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\window_news.c">
<Filter>Windows</Filter>
</ClCompile>
Expand Down
24 changes: 12 additions & 12 deletions src/config.c
Expand Up @@ -137,10 +137,10 @@ void config_save()
HANDLE hFile;
DWORD bytesWritten;

hFile = CreateFile(get_file_path(PATH_ID_GAMECFG), GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
hFile = CreateFile(get_file_path(PATH_ID_GAMECFG), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE) {
WriteFile(hFile, &MagicNumber, 4, &bytesWritten, NULL);
WriteFile(hFile, 0x009AAC5C, 2155, &bytesWritten, NULL);
WriteFile(hFile, (LPCVOID)0x009AAC5C, 2155, &bytesWritten, NULL);
CloseHandle(hFile);
}
}
Expand Down Expand Up @@ -252,7 +252,7 @@ static void config_create_default(char *path)
*/
static void config_parse_settings(FILE *fp)
{
int c = NULL, pos = 0;
int pos = 0;
char *setting;
char *value;
char *section;
Expand Down Expand Up @@ -389,36 +389,36 @@ static int config_parse_setting(FILE *fp, char *setting){
* @param value a pointer to where to store the value
* @return < 0 if EOF is reached
*/
static int config_parse_value(FILE *fp, char *value){
static int config_parse_value(FILE *fp, char *value)
{
long start, end;
int size, c, pos = 0;

start = ftell(fp);
c = fgetc(fp);
while (isspace(c)){
while (isspace(c)) {
start = ftell(fp);
c = fgetc(fp);

}

while (c != EOF && c != '\n'){
while (c != EOF && c != '\n') {
c = fgetc(fp);
}

end = ftell(fp);
size = end - start;
if (size > MAX_CONFIG_LENGTH){
if (size > MAX_CONFIG_LENGTH)
config_error("One of your settings is too long");
}

fseek(fp, start, SEEK_SET);
c = fgetc(fp);
while (c != EOF && c != '\n'){

while (c != EOF && c != '\n') {
value[pos] = (char)c;
c = fgetc(fp);
pos++;
}
value[pos] = '\0';
return;
return 0;
}

/**
Expand Down

0 comments on commit 8dcca91

Please sign in to comment.