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 <[email protected]>
This commit is contained in:
Kyle Ambroff-Kao
2020-04-26 16:53:07 +00:00
committed by waddlesplash
parent a688d43f35
commit 6f9f7e02a8
2 changed files with 14 additions and 6 deletions
+12 -5
View File
@@ -318,11 +318,18 @@ HttpTest::UploadTest()
// the server received it. // the server received it.
std::string fileContents; std::string fileContents;
{ {
std::ifstream inputStream(testFilePath); std::ifstream inputStream(
CPPUNIT_ASSERT(inputStream.is_open()); testFilePath.c_str(),
fileContents = std::string( std::ios::in | std::ios::binary);
std::istreambuf_iterator<char>(inputStream), CPPUNIT_ASSERT(inputStream);
std::istreambuf_iterator<char>());
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()); CPPUNIT_ASSERT(!fileContents.empty());
} }
+2 -1
View File
@@ -7,6 +7,7 @@
*/ */
#include "TestServer.h" #include "TestServer.h"
#include <errno.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <posix/libgen.h> #include <posix/libgen.h>
#include <sstream> #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. // If we reach this point we failed to load the Python image.
std::ostringstream ostr; 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 != args.end();
++iter) { ++iter) {
ostr << " " << *iter; ostr << " " << *iter;