• R/O
  • SSH
  • HTTPS

gtaconfig: Commit


Commit MetaInfo

Revision21 (tree)
Time2018-11-21 23:59:59
Authorquiret

Log Message

- adjusted gtaconfig to the new Eir SDK version

Change Summary

Incremental Difference

--- src/StdInc.h (revision 20)
+++ src/StdInc.h (revision 21)
@@ -1,10 +1,37 @@
11 #ifdef _MSC_VER
22 #pragma warning(disable: 4996)
3-#endif //_MSC_VER
4-
5-#include <CFileSystemInterface.h>
6-
7-#include "../include/gtaconfig/include.h"
8-
9-// gtaconfig would like to have a global called "fileRoot".
3+#endif //_MSC_VER
4+
5+#include <CFileSystemInterface.h>
6+
7+#include "../include/gtaconfig/include.h"
8+
9+// Default allocator for this library.
10+struct ConfigHeapAllocator
11+{
12+ AINLINE static void* Allocate( void *refPtr, size_t memSize, size_t alignment )
13+ {
14+#ifdef _MSC_VER
15+ return _aligned_malloc( memSize, alignment );
16+#else
17+ return aligned_alloc( alignment, memSize );
18+#endif
19+ }
20+
21+ AINLINE static bool Resize( void *refPtr, void *memPtr, size_t memSize )
22+ {
23+ return false;
24+ }
25+
26+ AINLINE static void Free( void *refPtr, void *memPtr )
27+ {
28+#ifdef _MSC_VER
29+ _aligned_free( memPtr );
30+#else
31+ free( memPtr );
32+#endif
33+ }
34+};
35+
36+// gtaconfig would like to have a global called "fileRoot".
1037 extern CFileTranslator *fileRoot;
--- src/config.cpp (revision 20)
+++ src/config.cpp (revision 21)
@@ -62,7 +62,7 @@
6262
6363 bool Config::GetConfigLine( CFile *stream, std::string& configLineOut )
6464 {
65- std::string configLine;
65+ eir::String <char, ConfigHeapAllocator> configLine;
6666
6767 bool getLine = FileSystem::FileGetString( stream, configLine );
6868
@@ -69,8 +69,8 @@
6969 if ( getLine )
7070 {
7171 // We can hack here. I guess.
72- char *cfgLineBuf = (char*)configLine.c_str();
73- int cfgLineCount = (int)configLine.size();
72+ char *cfgLineBuf = (char*)configLine.GetConstString();
73+ int cfgLineCount = (int)configLine.GetLength();
7474
7575 if ( cfgLineCount > 0 )
7676 {
@@ -78,7 +78,7 @@
7878
7979 const char *cfgStart = GetConfigLineStartOffset( cfgLineBuf );
8080
81- configLineOut = std::string( cfgStart, configLine.size() - ( cfgStart - cfgLineBuf ) );
81+ configLineOut = std::string( cfgStart, configLine.GetLength() - ( cfgStart - cfgLineBuf ) );
8282 }
8383 else
8484 {
--- src/csv.cpp (revision 20)
+++ src/csv.cpp (revision 21)
@@ -214,9 +214,9 @@
214214
215215 void CCSV::ParsingError( const char *msg )
216216 {
217- std::string ansiPath = m_file->GetPath().convert_ansi();
217+ auto ansiPath = m_file->GetPath().convert_ansi();
218218
219- printf( "CSV ERROR - %s (line %u): %s\n", FileSystem::GetFileNameItem( ansiPath.c_str(), true ).c_str(), m_currentLine, msg );
219+ printf( "CSV ERROR - %s (line %u): %s\n", FileSystem::GetFileNameItem( ansiPath.GetConstString(), true ).c_str(), m_currentLine, msg );
220220 }
221221
222222 bool CCSV::ExpectTokenCount( unsigned int numTokens )
--- src/csv.h (revision 20)
+++ src/csv.h (revision 21)
@@ -5,6 +5,8 @@
55 #ifndef _CSV_
66 #define _CSV_
77
8+#include <vector>
9+
810 #define CSVERR_FILEOPEN 0
911
1012 #define CSV_DEFAULT_SEPERATION ','
Show on old repository browser