DXGL r27 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r26‎ | r27 | r28 >
Date:16:38, 18 December 2011
Author:admin
Status:new
Tags:
Comment:
Add Code::Blocks project and fix MinGW compilation for cfgmgr
Modified paths:
  • /cfgmgr/cfgmgr.cbp (added) (history)
  • /cfgmgr/cfgmgr.cpp (modified) (history)
  • /cfgmgr/cfgmgr.depend (added) (history)
  • /cfgmgr/stdafx.h (modified) (history)
  • /dxgl.workspace (added) (history)

Diff [purge]

Index: cfgmgr/cfgmgr.cbp
@@ -0,0 +1,47 @@
 2+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
 3+<CodeBlocks_project_file>
 4+ <FileVersion major="1" minor="6" />
 5+ <Project>
 6+ <Option title="cfgmgr" />
 7+ <Option pch_mode="2" />
 8+ <Option compiler="gcc" />
 9+ <Build>
 10+ <Target title="Debug">
 11+ <Option output="libcfgmgr" prefix_auto="1" extension_auto="1" />
 12+ <Option working_dir="" />
 13+ <Option object_output="obj\Debug\" />
 14+ <Option type="2" />
 15+ <Option compiler="gcc" />
 16+ <Option createDefFile="1" />
 17+ <Compiler>
 18+ <Add option="-Wall" />
 19+ <Add option="-g" />
 20+ </Compiler>
 21+ </Target>
 22+ <Target title="Release">
 23+ <Option output="libcfgmgr" prefix_auto="1" extension_auto="1" />
 24+ <Option working_dir="" />
 25+ <Option object_output="obj\Release\" />
 26+ <Option type="2" />
 27+ <Option compiler="gcc" />
 28+ <Option createDefFile="1" />
 29+ <Compiler>
 30+ <Add option="-Wall" />
 31+ <Add option="-O2" />
 32+ </Compiler>
 33+ <Linker>
 34+ <Add option="-s" />
 35+ </Linker>
 36+ </Target>
 37+ </Build>
 38+ <Unit filename="main.c">
 39+ <Option compilerVar="CC" />
 40+ </Unit>
 41+ <Extensions>
 42+ <code_completion />
 43+ <envvars />
 44+ <debugger />
 45+ <lib_finder disable_auto="1" />
 46+ </Extensions>
 47+ </Project>
 48+</CodeBlocks_project_file>
Index: cfgmgr/cfgmgr.cpp
@@ -45,7 +45,7 @@
4646 }
4747 }
4848
49 -int FindStringInMultiSz(LPTSTR multisz, LPTSTR comp)
 49+int FindStringInMultiSz(LPTSTR multisz, LPCTSTR comp)
5050 {
5151 LPTSTR str = multisz;
5252 while(str[0] != 0)
@@ -56,7 +56,7 @@
5757 return 0;
5858 }
5959
60 -void AddStringToMultiSz(LPTSTR multisz, LPTSTR string)
 60+void AddStringToMultiSz(LPTSTR multisz, LPCTSTR string)
6161 {
6262 LPTSTR str = multisz;
6363 while(str[0] != 0)
@@ -67,7 +67,7 @@
6868 }
6969
7070
71 -bool ReadBool(HKEY hKey, bool original, bool &mask, LPTSTR value)
 71+bool ReadBool(HKEY hKey, bool original, bool &mask, LPCTSTR value)
7272 {
7373 DWORD dwOut;
7474 DWORD sizeout = 4;
@@ -86,7 +86,7 @@
8787 }
8888 }
8989
90 -DWORD ReadDWORD(HKEY hKey, DWORD original, DWORD &mask, LPTSTR value)
 90+DWORD ReadDWORD(HKEY hKey, DWORD original, DWORD &mask, LPCTSTR value)
9191 {
9292 DWORD dwOut;
9393 DWORD sizeout = 4;
@@ -104,7 +104,7 @@
105105 }
106106 }
107107
108 -void ReadPath(HKEY hKey, TCHAR *path, TCHAR *mask, LPTSTR value)
 108+void ReadPath(HKEY hKey, TCHAR *path, TCHAR *mask, LPCTSTR value)
109109 {
110110 DWORD sizeout = MAX_PATH*sizeof(TCHAR);
111111 DWORD regsz = REG_SZ;
@@ -175,7 +175,7 @@
176176 }
177177 }
178178
179 -void WriteBool(HKEY hKey, bool value, bool mask, LPTSTR name)
 179+void WriteBool(HKEY hKey, bool value, bool mask, LPCTSTR name)
180180 {
181181 const DWORD one = 1;
182182 const DWORD zero = 0;
@@ -187,14 +187,14 @@
188188 else RegDeleteValue(hKey,name);
189189 }
190190
191 -void WriteDWORD(HKEY hKey, DWORD value, DWORD mask, LPTSTR name)
 191+void WriteDWORD(HKEY hKey, DWORD value, DWORD mask, LPCTSTR name)
192192 {
193193 if(mask) RegSetValueEx(hKey,name,0,REG_DWORD,(BYTE*)&value,4);
194194 else RegDeleteValue(hKey,name);
195195 }
196 -void WritePath(HKEY hKey, const TCHAR *path, const TCHAR *mask, LPTSTR name)
 196+void WritePath(HKEY hKey, const TCHAR *path, const TCHAR *mask, LPCTSTR name)
197197 {
198 - if(mask[0]) RegSetValueEx(hKey,name,0,REG_SZ,(BYTE*)path,(_tcsnlen(path,MAX_PATH+1)+1)*sizeof(TCHAR));
 198+ if(mask[0]) RegSetValueEx(hKey,name,0,REG_SZ,(BYTE*)path,(_tcslen(path)+1)*sizeof(TCHAR));
199199 else RegDeleteValue(hKey,name);
200200 }
201201
@@ -216,7 +216,7 @@
217217 WriteDWORD(hKey,cfg->SortModes,cfgmask->SortModes,_T("SortModes"));
218218 WriteBool(hKey,cfg->AllColorDepths,cfgmask->AllColorDepths,_T("AllColorDepths"));
219219 WriteBool(hKey,cfg->ExtraModes,cfgmask->ExtraModes,_T("ExtraModes"));
220 - WriteDWORD(hKey,cfg->vsync,cfgmask->vsync,_T("VSync"));
 220+ WriteDWORD(hKey,cfg->vsync,cfgmask->vsync,_T("VSync"));
221221 }
222222
223223 tstring newregname;
@@ -341,4 +341,4 @@
342342 RegCreateKeyEx(HKEY_CURRENT_USER,regkey.c_str(),NULL,NULL,0,KEY_ALL_ACCESS,NULL,&hKey,NULL);
343343 WriteSettings(hKey,cfg,mask,false);
344344 RegCloseKey(hKey);
345 -}
\ No newline at end of file
 345+}
Index: cfgmgr/cfgmgr.depend
@@ -0,0 +1,25 @@
 2+# depslib dependency file v1.0
 3+1324171697 source:c:\programming\projects\dxgl\cfgmgr\crc32.cpp
 4+ "stdafx.h"
 5+ <stdio.h>
 6+ <stdlib.h>
 7+
 8+1324226084 c:\programming\projects\dxgl\cfgmgr\stdafx.h
 9+ <stdlib.h>
 10+ <cstdio>
 11+ <Windows.h>
 12+ <string>
 13+
 14+1324171697 source:c:\programming\projects\dxgl\cfgmgr\stdafx.cpp
 15+ "stdafx.h"
 16+
 17+1324226069 source:c:\programming\projects\dxgl\cfgmgr\cfgmgr.cpp
 18+ "stdafx.h"
 19+ "crc32.h"
 20+ "cfgmgr.h"
 21+ <tchar.h>
 22+
 23+1324171697 c:\programming\projects\dxgl\cfgmgr\crc32.h
 24+
 25+1324171697 c:\programming\projects\dxgl\cfgmgr\cfgmgr.h
 26+
Index: cfgmgr/stdafx.h
@@ -21,5 +21,9 @@
2222 #define _CRT_SECURE_NO_WARNINGS
2323
2424 #include <stdlib.h>
 25+#include <cstdio>
2526 #include <Windows.h>
2627 #include <string>
 28+#ifndef LSTATUS
 29+typedef LONG LSTATUS;
 30+#endif
Index: dxgl.workspace
@@ -0,0 +1,4 @@
 2+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
 3+<CodeBlocks_workspace_file>
 4+ <Workspace title="DXGL" />
 5+</CodeBlocks_workspace_file>