From Kyle Ambroff-Kao <kyle@xxxxxxxxxxxxxx>:
Kyle Ambroff-Kao has uploaded this change for review. (
https://review.haiku-os.org/c/haiku/+/2515 ;)
Change subject: tests/HttpTest: Fix build on x86_gcc2
......................................................................
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
---
M src/tests/kits/net/service/HttpTest.cpp
M src/tests/kits/net/service/TestServer.cpp
2 files changed, 14 insertions(+), 6 deletions(-)
git pull ssh://git.haiku-os.org:22/haiku refs/changes/15/2515/1
diff --git a/src/tests/kits/net/service/HttpTest.cpp
b/src/tests/kits/net/service/HttpTest.cpp
index 1dc17df..f27c80f 100644
--- a/src/tests/kits/net/service/HttpTest.cpp
+++ b/src/tests/kits/net/service/HttpTest.cpp
@@ -318,11 +318,18 @@
// 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());
}
diff --git a/src/tests/kits/net/service/TestServer.cpp
b/src/tests/kits/net/service/TestServer.cpp
index 240c697..d2551f9 100644
--- a/src/tests/kits/net/service/TestServer.cpp
+++ b/src/tests/kits/net/service/TestServer.cpp
@@ -7,6 +7,7 @@
*/
#include "TestServer.h"
+#include <errno.h>
#include <netinet/in.h>
#include <posix/libgen.h>
#include <sstream>
@@ -208,7 +209,7 @@
// 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;
--
To view, visit https://review.haiku-os.org/c/haiku/+/2515
To unsubscribe, or for help writing mail filters, visit
https://review.haiku-os.org/settings
Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: Ice344f6b0f93bf72d9120674607878c4c3e8ef54
Gerrit-Change-Number: 2515
Gerrit-PatchSet: 1
Gerrit-Owner: Kyle Ambroff-Kao <kyle@xxxxxxxxxxxxxx>
Gerrit-MessageType: newchange