tests/HttpTest: Fix build on x86_gcc2

* std::istreambuf_iterator<T> template isn't available until C++11.
* std::vector<T>::cbegin() is not available
* Add missing include of errno.h

Change-Id: Ice344f6b0f93bf72d9120674607878c4c3e8ef54
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2515
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Kyle Ambroff-Kao 2020-04-25 18:14:34 -07:00 committed by waddlesplash
parent a688d43f35
commit 6f9f7e02a8
2 changed files with 14 additions and 6 deletions

View File

@ -318,11 +318,18 @@ HttpTest::UploadTest()
// the server received it.
std::string fileContents;
{
std::ifstream inputStream(testFilePath);
CPPUNIT_ASSERT(inputStream.is_open());
fileContents = std::string(
std::istreambuf_iterator<char>(inputStream),
std::istreambuf_iterator<char>());
std::ifstream inputStream(
testFilePath.c_str(),
std::ios::in | std::ios::binary);
CPPUNIT_ASSERT(inputStream);
inputStream.seekg(0, std::ios::end);
fileContents.resize(inputStream.tellg());
inputStream.seekg(0, std::ios::beg);
inputStream.read(&fileContents[0], fileContents.size());
inputStream.close();
CPPUNIT_ASSERT(!fileContents.empty());
}

View File

@ -7,6 +7,7 @@
*/
#include "TestServer.h"
#include <errno.h>
#include <netinet/in.h>
#include <posix/libgen.h>
#include <sstream>
@ -208,7 +209,7 @@ status_t ChildProcess::Start(const std::vector<std::string>& args)
// If we reach this point we failed to load the Python image.
std::ostringstream ostr;
for (std::vector<std::string>::const_iterator iter = args.cbegin();
for (std::vector<std::string>::const_iterator iter = args.begin();
iter != args.end();
++iter) {
ostr << " " << *iter;