diff options
author | Lopfest <lopfest@gmail.com> | 2016-02-20 23:59:56 +0100 |
---|---|---|
committer | Lopfest <lopfest@gmail.com> | 2016-02-20 23:59:56 +0100 |
commit | facdc62b433787326673a4db05aab76d75e1283f (patch) | |
tree | f76f4e3467e3fe909da8b4e5bc5962712642e493 /src/server/database/Updater/UpdateFetcher.cpp | |
parent | d11eb335c996b398f4f8bdb10558dfba9af637f4 (diff) | |
parent | 716c952cb9f7bc0f75308bb4a716cdfe7de17281 (diff) |
Merge remote-tracking branch 'upstream/6.x' into HEAD
Diffstat (limited to 'src/server/database/Updater/UpdateFetcher.cpp')
-rw-r--r-- | src/server/database/Updater/UpdateFetcher.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/server/database/Updater/UpdateFetcher.cpp b/src/server/database/Updater/UpdateFetcher.cpp index fd0dbdd4b5a..001fdf20610 100644 --- a/src/server/database/Updater/UpdateFetcher.cpp +++ b/src/server/database/Updater/UpdateFetcher.cpp @@ -142,14 +142,12 @@ UpdateFetcher::SQLUpdate UpdateFetcher::ReadSQLUpdate(boost::filesystem::path co std::ifstream in(file.c_str()); WPFatal(in.is_open(), "Could not read an update file."); - auto const start_pos = in.tellg(); - in.ignore(std::numeric_limits<std::streamsize>::max()); - auto const char_count = in.gcount(); - in.seekg(start_pos); + auto update = [&in] { + std::ostringstream ss; + ss << in.rdbuf(); + return Trinity::make_unique<std::string>(ss.str()); + }(); - SQLUpdate const update(new std::string(char_count, char{})); - - in.read(&(*update)[0], update->size()); in.close(); return update; } |