[git commit] ios: Fix typo in operator!=

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Tue Apr 17 07:00:00 UTC 2012


commit: http://git.uclibc.org/uClibc++/commit/?id=4780e6ab9652202a3faa75bec51ca6901acfbb0d
branch: http://git.uclibc.org/uClibc++/commit/?id=refs/heads/master

operator != did use a EQ_EXPR instead of NE_EXPR

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
 include/ios                  |    3 +--
 tests/iotest.cpp             |   16 ++++++++++++----
 tests/testoutput/iotest.good |    3 +++
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/include/ios b/include/ios
index 3e27e10..b1bf847 100644
--- a/include/ios
+++ b/include/ios
@@ -473,7 +473,7 @@ namespace std{
 			return st == rhs.st;
 		}
 		_UCXXEXPORT bool operator!=(const fpos &rhs){
-			return st == rhs.st;
+			return st != rhs.st;
 		}
 		_UCXXEXPORT fpos & operator+(const streamoff & o){
 			st += o;
@@ -487,7 +487,6 @@ namespace std{
 			return st - rhs.st;
 		}
 
-		
 	private:
 		stateT st;
 	};
diff --git a/tests/iotest.cpp b/tests/iotest.cpp
index 34b9984..830c52d 100644
--- a/tests/iotest.cpp
+++ b/tests/iotest.cpp
@@ -103,12 +103,22 @@ int main(){
 	std::istream & s_r = std::cin;
 
 	cur = s_r.tellg();
+	std::streampos o_pos(cur);
+
 	std::cout << "Current position in stream: " << cur << std::endl;
 	s_r.seekg(0, std::ios::end);
 	end = s_r.tellg();
+	std::streampos n_pos(end);
 	s_r.seekg(cur);
 	std::cout << "Remaining bytes: " << end-cur << std::endl;
 
+	std::cout << "fpos o_pos == n_pos ? " <<
+		(o_pos == n_pos ? "true" : "false") << std::endl;
+	std::cout << "fpos !(o_pos == n_pos) ? " <<
+		(!(o_pos == n_pos) ? "true" : "false") << std::endl;
+	std::cout << "fpos o_pos != n_pos ? " <<
+		(o_pos != n_pos ? "true" : "false") << std::endl;
+
 	std::cout << "Test of reading istream into a function: " << std::endl;
 	s_r >> myIstreamTestFunction;
 	std::cout << "Test of reading ios into a function: " << std::endl;
@@ -116,11 +126,9 @@ int main(){
 
 	testFieldWidth();
 
+	TestFramework::AssertReturns<bool>(canSeeIosBaseProperties, true);
 
-        TestFramework::AssertReturns<bool>(canSeeIosBaseProperties, true);
-
-        TestFramework::results();
-
+	TestFramework::results();
 
 
 	return 0;
diff --git a/tests/testoutput/iotest.good b/tests/testoutput/iotest.good
index cf7f5a1..d3e4469 100644
--- a/tests/testoutput/iotest.good
+++ b/tests/testoutput/iotest.good
@@ -10,6 +10,9 @@ Checking ostream_iterator
 Checking length of remaining input
 Current position in stream: 15
 Remaining bytes: 45
+fpos o_pos == n_pos ? false
+fpos !(o_pos == n_pos) ? true
+fpos o_pos != n_pos ? true
 Test of reading istream into a function: 
 Number of characters most recently read in: 0
 Test of reading ios into a function: 


More information about the uClibc-cvs mailing list