mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Joining basically works
This commit is contained in:
@@ -48,7 +48,7 @@ std::string csv_dequote(std::string s) {
|
||||
return out;
|
||||
}
|
||||
|
||||
std::string getline(FILE *f) {
|
||||
std::string csv_getline(FILE *f) {
|
||||
std::string out;
|
||||
int c;
|
||||
while ((c = getc(f)) != EOF) {
|
||||
@@ -60,7 +60,7 @@ std::string getline(FILE *f) {
|
||||
return out;
|
||||
}
|
||||
|
||||
void readcsv(char *fn, std::vector<std::string> &header, std::map<std::string, std::vector<std::string>> &mapping) {
|
||||
void readcsv(const char *fn, std::vector<std::string> &header, std::map<std::string, std::vector<std::string>> &mapping) {
|
||||
FILE *f = fopen(fn, "r");
|
||||
if (f == NULL) {
|
||||
perror(fn);
|
||||
@@ -68,14 +68,14 @@ void readcsv(char *fn, std::vector<std::string> &header, std::map<std::string, s
|
||||
}
|
||||
|
||||
std::string s;
|
||||
if ((s = getline(f)).size() > 0) {
|
||||
if ((s = csv_getline(f)).size() > 0) {
|
||||
header = csv_split(s.c_str());
|
||||
|
||||
for (size_t i = 0; i < header.size(); i++) {
|
||||
header[i] = csv_dequote(header[i]);
|
||||
}
|
||||
}
|
||||
while ((s = getline(f)).size() > 0) {
|
||||
while ((s = csv_getline(f)).size() > 0) {
|
||||
std::vector<std::string> line = csv_split(s.c_str());
|
||||
if (line.size() > 0) {
|
||||
line[0] = csv_dequote(line[0]);
|
||||
|
||||
Reference in New Issue
Block a user