Commit 99425265 by Alexander Monakov Committed by Alexander Monakov

1.c (test01): Clarify size definition.

2010-04-27  Alexander Monakov  <amonakov@ispras.ru>

	* testsuite/22_locale/codecvt/unshift/char/1.c (test01): Clarify size
	definition.  Use memcpy and memcmp to avoid access beyond allocated
	memory.

From-SVN: r158780
parent ecb9d36f
2010-04-27 Alexander Monakov <amonakov@ispras.ru>
* testsuite/22_locale/codecvt/unshift/char/1.c (test01): Clarify size
definition. Use memcpy and memcmp to avoid access beyond allocated
memory.
2010-04-27 Jonathan Wakely <jwakely.gcc@gmail.com>
* doc/xml/manual/status_cxx200x.xml: Update to match n3092.
......
......@@ -35,7 +35,7 @@ void test01()
bool test __attribute__((unused)) = true;
const char* c_lit = "black pearl jasmine tea";
const char* from_next;
int size = 23;
int size = std::strlen(c_lit);
char* c_arr = new char[size];
char* c_ref = new char[size];
char* to_next;
......@@ -68,10 +68,10 @@ void test01()
VERIFY( to_next == c_arr );
// unshift
strcpy(c_arr, c_lit);
memcpy(c_arr, c_lit, size);
result r3 = cvt->unshift(state, c_arr, c_arr + size, to_next);
VERIFY( r3 == codecvt_base::noconv );
VERIFY( !strcmp(c_arr, c_lit) );
VERIFY( !memcmp(c_arr, c_lit, size) );
VERIFY( to_next == c_arr );
delete [] c_arr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment