diff --git a/common/io/readvector.cpp b/common/io/readvector.cpp index c73cb8b8..6b59ef35 100644 --- a/common/io/readvector.cpp +++ b/common/io/readvector.cpp @@ -36,8 +36,6 @@ static void readvector(FILE *fp, struct ParserState *s, std::vector& v) { T value; int count, i; - int ret; - int ok; count = 1; s->error = 0; @@ -60,7 +58,7 @@ static void readvector(FILE *fp, struct ParserState *s, std::vector& v) template static void parse_next_token(FILE *fp, struct ParserState *s, T *v, int *r) { - char str[bufsz], *ptr; + char str[bufsz]; char rstr[bufsz]; char vstr[bufsz]; @@ -111,9 +109,9 @@ static void split_token_string(char *str, char *rstr, char *vstr) rstr[0]='\0'; } - while(*vstr++=*str++) + while((*vstr++=*str++) ) { - ; + continue ; } *vstr='\0'; } @@ -224,11 +222,12 @@ static char *get_token_string(FILE *fp, struct ParserState *s, char *str) static void skip_line(FILE *fp, struct ParserState *s) { + static_cast(s); int c; while((c = fgetc(fp))!=EOF && c != '\n') { ; } - +} /* ------------------------------------------------------------------ */ @@ -255,28 +254,11 @@ template void read_vector_from_file(const char *fn, std::vector& v) { FILE *fp = fopen(fn, "r"); - struct ParserState s = {1, 0}; + struct ParserState s = { 0 }; readvector(fp, &s, v); fclose(fp); } - -#if 1 -int main() -{ - std::vector v; - read_vector_from_file("example/zcorn.txt", zcorn); - std::vector actnum; - read_vector_from_file("example/actnum.txt", actnum); - for (int i=0; i(const char *fn, std::vector& v); +template void read_vector_from_file(const char *fn, std::vector& v);