diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-03-03 22:48:21 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-03-03 22:48:21 -0800 |
commit | 087940ec9ee6ee8f989eac49453ebe6be761fa6b (patch) | |
tree | b5c1f9bf1d1ceb7eee929f20b787c766d4a86d50 /reader.cpp | |
parent | 8a46931e3426b724f8502cb77f4a6787e5294c40 (diff) |
Fix a bug where wfopen would always fail
Removed some buffer_t
Diffstat (limited to 'reader.cpp')
-rw-r--r-- | reader.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -3360,7 +3360,7 @@ static int read_ni( int fd, io_data_t *io ) parser_t &parser = parser_t::principal_parser(); FILE *in_stream; wchar_t *buff=0; - buffer_t acc; + std::vector<char> acc; int des = fd == 0 ? dup(0) : fd; int res=0; @@ -3371,8 +3371,6 @@ static int read_ni( int fd, io_data_t *io ) return 1; } - b_init( &acc ); - in_stream = fdopen( des, "r" ); if( in_stream != 0 ) { @@ -3394,17 +3392,17 @@ static int read_ni( int fd, io_data_t *io ) /* Reset buffer on error. We won't evaluate incomplete files. */ - acc.used=0; + acc.clear(); break; } - b_append( &acc, buff, c ); + acc.insert(acc.end(), buff, buff + c); } - b_append( &acc, "\0", 1 ); - acc_used = acc.used; - str = str2wcs( acc.buff ); - b_destroy( &acc ); + acc.push_back(0); + acc_used = acc.size(); + str = str2wcs(&acc.at(0)); + acc.clear(); if( fclose( in_stream )) { |