Squashed commit of the following:
commit
9ad1c364f5631e22d35a19f76defd88305cbeb06
Author: Carter Waxman <cwaxman@cisco.com>
Date: Tue Jul 18 10:29:02 2017 -0400
snort2lua: Fixed incorrect file names errors
std::string DataApi::get_file_line()
{
std::string error_string = "Failed to convert ";
- error_string += current_file + ":";
+ error_string += *current_file + ":";
error_string += std::to_string(current_line);
return error_string;
}
void failed_conversion(const std::istringstream& stream, const std::string unkown_option);
void set_current_file(std::string& file)
- { current_file = file; }
+ { current_file = &file; }
void set_current_line(unsigned line)
{ current_line = line; }
private:
-
enum class PrintMode
{
DEFAULT,
Comments* errors;
bool curr_data_bad; // keep track whether current 'conversion' is already bad
- std::string current_file;
+ std::string* current_file;
unsigned current_line;
std::string get_file_line();
int Converter::parse_file(std::string input_file)
{
- data_api.set_current_file(input_file);
-
std::ifstream in;
std::string orig_text;
std::getline(in, tmp);
util::rtrim(tmp);
+ data_api.set_current_file(input_file); //Set at each line to handle recursion correctly
data_api.set_current_line(++line_num);
std::size_t first_non_white_char = tmp.find_first_not_of(' ');