stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elemi...@apache.org
Subject svn commit: r662845 - in /stdcxx/branches/4.2.x: examples/include/ examples/tutorial/ tests/iostream/ tests/localization/ tests/regress/ tests/utilities/
Date Tue, 03 Jun 2008 17:24:08 GMT
Author: elemings
Date: Tue Jun  3 10:24:08 2008
New Revision: 662845

URL: http://svn.apache.org/viewvc?rev=662845&view=rev
Log:
2008-06-03  Eric Lemings <eric.lemings@roguewave.com>

	STDCXX-550
	* tests/iostream/27.istream.manip.cpp (test_ws): Cast RHS
	`err_after' from `size_t' type to `int' type of LHS
	`Streambuf::throw_after_' and `Streambuf::fail_after_' members.
	(No easy way to change the type of either side.)
	* tests/iostream/27.istream.unformatted.get.cpp (check_failure):
	Change `actual' type from `int' to `std::streamsize' result type
	of expression in RHS of assignment.
	(test_get_void, test_get_char, test_get_char_array)
	(test_get_streambuf): Cast `gcount' argument to `int' used by
	6th parameter in `check_failure()' function.
	(test_get_char_array<charT, Traits>): Use `int' type instead of
	`std::streamsize' since `test_get_char_array()' function doesn't
	use the latter for parameter types.
	* tests/iostream/27.stringbuf.virtuals.cpp (PubBuf::capacity):
	Cast result of pointer arithmetic expression to `int' return
	type of function.
	(test_virtual): Explicitly cast RHS of assignment `warg_len' to
	`int' type of LHS `arg0'.  Also cast `arg0' to `std::streamsize'
	type for 2nd parameter in `std::streambuf<T>::sputn()' function.
	Cast return type of said function to `int' type of LHS `ret'
	variable.
	(test_xsputn)[TEST]: Cast result of `sizeof' expression to
	`int' type used by 7th parameter of `test_virtual' function.
	* tests/iostream/27.filebuf.codecvt.cpp (cformat::do_length):
	Cast result of pointer arithmetic expression to `int' return
	type of function.
	(run_test): Change `buflen' type from `int' to `std::size_t'
	to hold result of `strlen()' function.

	* tests/localization/22.locale.codecvt.mt.cpp (thread_func):
	Change `inx' type from `int' to `std::size_t' for `nlocales'.
	* tests/localization/22.locale.time.get.cpp (test_english): Cast
	return value of `strftime()' function to `int' type used by
	corresponding parameter in `do_test()' function.
	* tests/localization/22.locale.money.put.mt.cpp (MyMoneyData):
	Change type of `money_index_' member from `unsigned' to `size_t'.

	* tests/regress/21.string.io.stdcxx-206.cpp (test): Replaced
	`sizeof(buf)' expression with `bufsize' enumerator.
	* tests/regress/27.stringbuf.overflow.stdcxx-149.cpp (main):
	Cast result of pointer arithmetic to `int' type for
	`write_positions' in LHS of copy assignment.

	* tests/utilities/20.operators.cpp (RandomNumberGenerator):
	Change parameter type of RNG from hard-coded `int' to template
	parameter `T'.
	(test_random_access_iterators): Instantiate RNG using difference
	type of iterator rather than value type as specified by
	`random_shuffle' requirements.

	* examples/include/teller.h, examples/tutorial/teller.cpp:
	Change return type of `lcg_rand()' function from 'unsigned long'
	to plain `int'.  (It's already explicitly cast in the return
	statement to an `int' anyways.)


Modified:
    stdcxx/branches/4.2.x/examples/include/teller.h
    stdcxx/branches/4.2.x/examples/tutorial/teller.cpp
    stdcxx/branches/4.2.x/tests/iostream/27.filebuf.codecvt.cpp
    stdcxx/branches/4.2.x/tests/iostream/27.istream.manip.cpp
    stdcxx/branches/4.2.x/tests/iostream/27.istream.unformatted.get.cpp
    stdcxx/branches/4.2.x/tests/iostream/27.stringbuf.virtuals.cpp
    stdcxx/branches/4.2.x/tests/localization/22.locale.codecvt.mt.cpp
    stdcxx/branches/4.2.x/tests/localization/22.locale.money.put.mt.cpp
    stdcxx/branches/4.2.x/tests/localization/22.locale.time.get.cpp
    stdcxx/branches/4.2.x/tests/regress/21.string.io.stdcxx-206.cpp
    stdcxx/branches/4.2.x/tests/regress/27.stringbuf.overflow.stdcxx-149.cpp
    stdcxx/branches/4.2.x/tests/utilities/20.operators.cpp

Modified: stdcxx/branches/4.2.x/examples/include/teller.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/examples/include/teller.h?rev=662845&r1=662844&r2=662845&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/examples/include/teller.h (original)
+++ stdcxx/branches/4.2.x/examples/include/teller.h Tue Jun  3 10:24:08 2008
@@ -30,7 +30,7 @@
 #ifndef TELLER_H_INCLUDED
 #define TELLER_H_INCLUDED
 
-inline unsigned long int lcg_rand (int n);
+inline int lcg_rand (int n);
 
 class Customer
 {

Modified: stdcxx/branches/4.2.x/examples/tutorial/teller.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/examples/tutorial/teller.cpp?rev=662845&r1=662844&r2=662845&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/examples/tutorial/teller.cpp (original)
+++ stdcxx/branches/4.2.x/examples/tutorial/teller.cpp Tue Jun  3 10:24:08 2008
@@ -36,7 +36,7 @@
 //  of a linear congruential pseudorandom number generator.
 //  (Apologies to D. Lehmer, D. Knuth, R. Sedgewick, et al.)
 static unsigned long int lcg_seed = 0;
-inline unsigned long int lcg_rand (int n)
+inline int lcg_rand (int n)
 {
     lcg_seed = ((lcg_seed * 11321) + 1) % 32575;
     return (int) (((double) lcg_seed / 32575.0) * n);

Modified: stdcxx/branches/4.2.x/tests/iostream/27.filebuf.codecvt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/iostream/27.filebuf.codecvt.cpp?rev=662845&r1=662844&r2=662845&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/iostream/27.filebuf.codecvt.cpp (original)
+++ stdcxx/branches/4.2.x/tests/iostream/27.filebuf.codecvt.cpp Tue Jun  3 10:24:08 2008
@@ -581,7 +581,7 @@
     do_in (st, from, from_end, from_next,
            to_next, to_next + max, to_next);
 
-    return to_next - (intern_type*)0;
+    return int (to_next - (intern_type*)0);
 }
 
 /***********************************************************************/
@@ -1059,7 +1059,7 @@
     // will be populated with file offsets and escape sequences
     char buffer [4096] = { '\0' };
 
-    int buflen = 0;
+    std::size_t buflen = 0;
 
     // generate file contents using UD conversion
     if (1) {

Modified: stdcxx/branches/4.2.x/tests/iostream/27.istream.manip.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/iostream/27.istream.manip.cpp?rev=662845&r1=662844&r2=662845&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/iostream/27.istream.manip.cpp (original)
+++ stdcxx/branches/4.2.x/tests/iostream/27.istream.manip.cpp Tue Jun  3 10:24:08 2008
@@ -205,14 +205,14 @@
         // have the stream buffer object's underflow() fail (by throwing
         // an exception if possible) after j characters have been extracted
         // (this object calls underflow() for every char)
-        sb.throw_after_ = err_after;
+        sb.throw_after_ = int (err_after);
         err_type        = "threw";
     }
     else {
         // have the stream buffer object's underflow() fail by returning
         // eof after j characters have been extracted (this object calls
         // underflow() for every char)
-        sb.fail_after_ = err_after;
+        sb.fail_after_ = int (err_after);
         err_type       = "returned EOF";
     }
 

Modified: stdcxx/branches/4.2.x/tests/iostream/27.istream.unformatted.get.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/iostream/27.istream.unformatted.get.cpp?rev=662845&r1=662844&r2=662845&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/iostream/27.istream.unformatted.get.cpp (original)
+++ stdcxx/branches/4.2.x/tests/iostream/27.istream.unformatted.get.cpp Tue Jun  3 10:24:08
2008
@@ -98,7 +98,7 @@
         // verify that the original gcount of 0 was unaffected
         // (for non-array forms of unformatted input functions)
         // or that it increased exactly `fail_when_'
-        const int actual = strm.gcount () - gcount;
+        const std::streamsize actual = strm.gcount () - gcount;
 
         rw_assert (!actual || actual == sb.fail_when_ - 1, 0, lineno,
                    "line %d: basic_istream<%s>::%s changed "
@@ -121,7 +121,7 @@
 
         // verify that gcount has the expected value
 
-        const int actual = strm.gcount () - gcount;
+        const std::streamsize actual = strm.gcount () - gcount;
 
         rw_assert (nexpect == actual, 0, lineno,
                    "line %d: basic_istream<%s>::%s changed "
@@ -205,8 +205,8 @@
 
     TRY_GET (got = strm.get ());
 
-    check_failure (sb, cname, lineno, "get()", strm, gcount, !rdstate,
-                   rdstate, exceptions, caught);
+    check_failure (sb, cname, lineno, "get()", strm, int (gcount),
+                   !rdstate, rdstate, exceptions, caught);
 
     // verify that the extracted value is the one expected
 
@@ -316,7 +316,7 @@
     TRY_GET (strm.get (got));
 
     check_failure (sb, cname, lineno, "get(char_type&)", strm,
-                   gcount, !rdstate, rdstate, exceptions, caught);
+                   int (gcount), !rdstate, rdstate, exceptions, caught);
 
     // verify that the extracted value is the one expected
 
@@ -456,7 +456,7 @@
         TRY_GET (strm.get (got, std::streamsize (nread)));
     }
 
-    check_failure (sb, cname, lineno, fun, strm, gcount, nexpect,
+    check_failure (sb, cname, lineno, fun, strm, int (gcount), nexpect,
                    rdstate, exceptions, caught);
 
     // verify that number and values of the extracted characters
@@ -539,10 +539,10 @@
     TEST (T, "ghij",  4, 4, eof, 3, Good,       Bad,  Underflow | Throw, 4);
     TEST (T, "hijk",  4, 5, eof, 3, Bad,        Bad,  Underflow | Throw, 4);
 
-    const std::streamsize N = std::streamsize (MAXCHARS);
+    const int N = int (MAXCHARS);
     char *buf = new char [N];
 
-    for (std::streamsize i = 0; i != N; ++i) {
+    for (int i = 0; i != N; ++i) {
         buf [i] = char (i);
     }
 
@@ -557,7 +557,7 @@
     TEST (T, "12347", 5, 6, eof, 5, Good, Good, 0, -1);
     TEST (T, "12348", 5, 7, eof, 5, Eof,  Good, 0, -1);
     
-    for (std::streamsize i = 0; i < N; i += 256) {
+    for (int i = 0; i < N; i += 256) {
         TEST (T, buf, N, N, eof, '\n' + i, Good, Good, 0, -1);
 
         buf ['\n' + i] = '\0';
@@ -646,8 +646,8 @@
         TRY_GET (strm.get (outbuf));
     }
 
-    check_failure (inbuf, cname, lineno, fun, strm, gcount, nexpect,
-                   rdstate, exceptions, caught);
+    check_failure (inbuf, cname, lineno, fun, strm, int (gcount),
+                   nexpect, rdstate, exceptions, caught);
 
     // verify that number and values of the extracted characters
     // matches the expected number and values

Modified: stdcxx/branches/4.2.x/tests/iostream/27.stringbuf.virtuals.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/iostream/27.stringbuf.virtuals.cpp?rev=662845&r1=662844&r2=662845&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/iostream/27.stringbuf.virtuals.cpp (original)
+++ stdcxx/branches/4.2.x/tests/iostream/27.stringbuf.virtuals.cpp Tue Jun  3 10:24:08 2008
@@ -98,7 +98,7 @@
         Base buf (std::ios::out);
         while (n--)
             buf.sputc ('c');
-        return ((PubBuf&)buf).Epptr () - ((PubBuf&)buf).Pbase ();
+        return int (((PubBuf&)buf).Epptr () - ((PubBuf&)buf).Pbase ());
     }
 };
 
@@ -236,14 +236,14 @@
         if (pfid->strarg_) {
             rw_expand (warg, pfid->strarg_, _RWSTD_SIZE_MAX, &warg_len);
             if (std::strchr (pfid->strarg_, '@'))
-                arg0 = warg_len;
+                arg0 = int (warg_len);
 
             RW_ASSERT (std::size_t (arg0) < sizeof wstr / sizeof *wstr);
-            ret = pbuf->sputn (warg, arg0);
+            ret = int (pbuf->sputn (warg, std::streamsize (arg0)));
         }
         else {
             // invoke sputn() with pbase as an argument
-            ret = pbuf->sputn (pbuf->Pbase (), arg0);
+            ret = int (pbuf->sputn (pbuf->Pbase (), std::streamsize (arg0)));
         }
 
         break;
@@ -463,7 +463,7 @@
 #define TEST(str, mode, gbump, sarg, result, pback, read, write)        \
     pfid->strarg_ = sarg;                                                \
     test_virtual (pfid, __LINE__, str, sizeof str - 1, mode,            \
-                  gbump, sizeof sarg - 1, IGN, IGN, result,             \
+                  gbump, int (sizeof sarg - 1), IGN, IGN, result,       \
                   pback, read, write)
 
     //    +-------------------------------------------- initial sequence

Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.codecvt.mt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.codecvt.mt.cpp?rev=662845&r1=662844&r2=662845&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.codecvt.mt.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.codecvt.mt.cpp Tue Jun  3 10:24:08
2008
@@ -322,7 +322,7 @@
         if (rw_thread_pool_timeout_expired ())
             break;
 
-        const int inx = i % nlocales;
+        const std::size_t inx = i % nlocales;
         const MyCodecvtData& data = my_codecvt_data [inx];
 
         // construct a named locale, get a reference to the codecvt

Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.money.put.mt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.money.put.mt.cpp?rev=662845&r1=662844&r2=662845&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.money.put.mt.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.money.put.mt.cpp Tue Jun  3 10:24:08
2008
@@ -125,7 +125,7 @@
     PutId type_;
 
     // index into string array [n,w]_money_vals
-    unsigned money_index_;
+    std::size_t money_index_;
 
     // narrow representations of money_
     char ncs_ [BufferSize];

Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.time.get.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.time.get.cpp?rev=662845&r1=662844&r2=662845&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.time.get.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.time.get.cpp Tue Jun  3 10:24:08 2008
@@ -930,7 +930,7 @@
         // Tru64 UNIX)
         char buf [32];
         const std::tm tmb = mktm (0, 0, 1);
-        len = std::strftime (buf, sizeof buf, "%X", &tmb);
+        len = int (std::strftime (buf, sizeof buf, "%X", &tmb));
     }
 
     const int hour = 11 == len ? 12 : 0;

Modified: stdcxx/branches/4.2.x/tests/regress/21.string.io.stdcxx-206.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/regress/21.string.io.stdcxx-206.cpp?rev=662845&r1=662844&r2=662845&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/regress/21.string.io.stdcxx-206.cpp (original)
+++ stdcxx/branches/4.2.x/tests/regress/21.string.io.stdcxx-206.cpp Tue Jun  3 10:24:08 2008
@@ -32,8 +32,9 @@
 
 void test (const std::string& str, const std::streamsize width)
 {
-    char buf[10];
-    std::ostrstream os (buf, sizeof(buf));
+    enum { bufsize = 10 };
+    char buf[bufsize];
+    std::ostrstream os (buf, bufsize);
 
     os.width (width);
     os.exceptions (std::ios_base::failbit | std::ios_base::badbit);

Modified: stdcxx/branches/4.2.x/tests/regress/27.stringbuf.overflow.stdcxx-149.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/regress/27.stringbuf.overflow.stdcxx-149.cpp?rev=662845&r1=662844&r2=662845&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/regress/27.stringbuf.overflow.stdcxx-149.cpp (original)
+++ stdcxx/branches/4.2.x/tests/regress/27.stringbuf.overflow.stdcxx-149.cpp Tue Jun  3 10:24:08
2008
@@ -45,7 +45,7 @@
 
     buf.overflow ('x');
 
-    const int write_positions = buf.epptr () - buf.pbase ();
+    const int write_positions = int (buf.epptr () - buf.pbase ());
 
     const int pass = 1 < write_positions;
 

Modified: stdcxx/branches/4.2.x/tests/utilities/20.operators.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/utilities/20.operators.cpp?rev=662845&r1=662844&r2=662845&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/utilities/20.operators.cpp (original)
+++ stdcxx/branches/4.2.x/tests/utilities/20.operators.cpp Tue Jun  3 10:24:08 2008
@@ -169,7 +169,7 @@
 template <class T>
 struct RandomNumberGenerator
 {
-    T operator() (int) const {
+    T operator() (T) const {
         return T ();
     }
 };
@@ -397,7 +397,7 @@
 
     typedef RandomAccessIterator I;
 
-    RandomNumberGenerator<T> rndgen;
+    RandomNumberGenerator<typename I::difference_type> rndgen;
 
     std::random_shuffle (I (), I ());
     std::random_shuffle (I (), I (), rndgen);



Mime
View raw message