|
|
|
@ -10,9 +10,13 @@ CFGFileParser::CFGFileParser(const char* filename){
@@ -10,9 +10,13 @@ CFGFileParser::CFGFileParser(const char* filename){
|
|
|
|
|
cfg_file = fopen(filename, "rb"); // On NT, opening in text mode translates \n into \r\n
|
|
|
|
|
stat(filename, cfg_fileinfo); |
|
|
|
|
buffer = static_cast<char*>(tlsf_malloc(cfg_fileinfo->st_size & INT_MAX)); |
|
|
|
|
bytesRead = fread(buffer, sizeof(char) & INT_MAX, cfg_fileinfo->st_size & INT_MAX, cfg_file); |
|
|
|
|
if (!bytesRead) { |
|
|
|
|
std::cout << "no config" << std::endl; |
|
|
|
|
if (cfg_file) { |
|
|
|
|
bytesRead = fread(buffer, sizeof(char) & INT_MAX, cfg_fileinfo->st_size & INT_MAX, cfg_file); |
|
|
|
|
if (!bytesRead) { |
|
|
|
|
std::cout << "can't read config" << std::endl; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
std::cout << "can't open config" << std::endl; |
|
|
|
|
} |
|
|
|
|
fclose(cfg_file); |
|
|
|
|
} |
|
|
|
@ -101,4 +105,4 @@ bool CFGFileParser::ParseText() {
@@ -101,4 +105,4 @@ bool CFGFileParser::ParseText() {
|
|
|
|
|
// object supplied by the user.
|
|
|
|
|
void CFGFileParser::WriteConfig(BrowserConfiguration &config){ |
|
|
|
|
config.Settings = cfg->Settings; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|