Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation issues with GCC 4.8 #4

Merged
merged 2 commits into from
Mar 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ Release/
*.out
*.app

# Test outputs
*.gcda
*.gcno
*.gcov

# =========================
# Operating System Files
# =========================
Expand Down
6 changes: 2 additions & 4 deletions src/csv_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace csv {
}

void CSVGuesser::guess_delim() {
/** Guess the delimiter of a DSV by scanning the first 100 lines by
/** Guess the delimiter of a CSV by scanning the first 100 lines by
* First assuming that the header is on the first row
* If the first guess returns too few rows, then we move to the second
* guess method
Expand All @@ -44,7 +44,7 @@ namespace csv {
*/

CSVFormat format = DEFAULT_CSV;
char current_delim;
char current_delim{','};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes possible use without initialization.

int max_rows = 0;
int temp_rows = 0;
size_t max_cols = 0;
Expand Down Expand Up @@ -79,7 +79,6 @@ namespace csv {
*/

CSVFormat format = DEFAULT_CSV;
char current_delim;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was unused in this context, so I deleted it.

size_t max_rlen = 0;
size_t header = 0;

Expand All @@ -104,7 +103,6 @@ namespace csv {
if (max->second > guess.records.size() &&
(max->first > max_rlen)) {
max_rlen = max->first;
current_delim = guess.delimiter;
header = guess.row_when[max_rlen];
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/csv_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace csv {
/** Open a file for writing
* @param[out] outfile Path of the file to be written to
*/
this->outfile = std::ofstream(outfile, std::ios_base::binary);
this->outfile.open(outfile, std::ios_base::binary);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GCC 4.8's libstdc++'s ofstream doesn't support copy or move, so just use open().

}

void CSVWriter::write_row(vector<string> record, bool quote_minimal) {
Expand Down