Custom.cfg (#213)

Added custom configs.

These are used for replacing some hardcoded strings inside bot code, currently custom cvar for parachute detection is available, as well as custom c4 model names.

Added editorconfig, and fixed CRLF for files (was a mix between LF & CRLF).
Fixed use-after-free sanitizer error with chatlib.
Fixed configs files loaded with memory-loader does not process last line in config files.
This commit is contained in:
jeefo 2020-12-15 15:28:58 +03:00 committed by GitHub
commit 075bff2988
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 533 additions and 404 deletions

View file

@ -71,6 +71,8 @@ public:
int ch = 0;
SmallArray <char> data (255);
line.clear ();
while ((ch = get ()) != EOF && !eof ()) {
data.push (static_cast <char> (ch));
@ -78,9 +80,10 @@ public:
break;
}
}
line.assign (data.data (), data.length ());
return !eof ();
if (!data.empty ()) {
line.assign (data.data (), data.length ());
}
return !line.empty ();
}
template <typename ...Args> size_t puts (const char *fmt, Args &&...args) {
@ -282,10 +285,7 @@ public:
if (!contents_ || seek_ >= length_) {
return Eof;
}
auto ch = contents_[seek_];
++seek_;
return static_cast <char> (ch);
return static_cast <char> (contents_[seek_++]);
}
char *getString (char *buffer, size_t count) {
@ -315,16 +315,20 @@ public:
char ch;
SmallArray <char> data (255);
while ((ch = get ()) != Eof) {
line.clear ();
while ((ch = get ()) != Eof && !eof ()) {
data.push (ch);
if (ch == '\n') {
break;
}
}
line.assign (data.data (), data.length ());
return !eof ();
if (!data.empty ()) {
line.assign (data.data (), data.length ());
}
return !line.empty ();
}
size_t read (void *buffer, size_t size, size_t count = 1) {