48# include <sys/types.h>
64#define REMOVE_FILE(tmpfname) \
65 rw_warn (0 == std::remove (tmpfname), __FILE__, __LINE__, \
66 "std::remove(\"%s\") failed: %m", tmpfname)
75 typedef std::basic_filebuf<charT, std::char_traits<charT> > Filebuf;
82 "std::basic_filebuf<%s>::basic_filebuf()", tname);
90 rw_assert (!fb.is_open (), __FILE__, __LINE__,
91 "basic_filebuf<%s>::basic_filebuf().is_open() == "
92 "false, got true", tname);
97 rw_assert (next_fd [0] == next_fd [1] && fdcount [0] == fdcount [1],
99 "%d file descriptor leak(s) detected after construction",
100 fdcount [1] - fdcount [0]);
107 rw_info (0, __FILE__, __LINE__,
108 "std::basic_filebuf<%s>::~basic_filebuf()", tname);
110 rw_assert (next_fd [0] == next_fd [1] && fdcount [0] == fdcount [1],
112 "%d file descriptor leak(s) detected after destruction",
113 fdcount [1] - fdcount [0]);
116 const char*
const tmpfname =
rw_tmpnam (0);
126 Filebuf *
tmp = fb.open (tmpfname, std::ios::out);
130 "basic_filebuf<%s>::open(\"%s\", std::ios_base::out) "
131 "failed", tname, tmpfname);
136 && fdcount [0] + 1 == fdcount [1], __FILE__, __LINE__,
137 "%d file descriptor mismatch detected after open()",
138 fdcount [1] - fdcount [0]);
144 rw_assert (next_fd [0] == next_fd [1] && fdcount [0] == fdcount [1],
146 "%d file descriptor leak(s) detected after destruction",
147 fdcount [1] - fdcount [0]);
150#ifndef _RWSTD_NO_EXT_FILEBUF
153 rw_info (0, __FILE__, __LINE__,
154 "std::basic_filebuf<%s>::basic_filebuf(FILE*) "
155 "[extension]", tname);
160 std::FILE*
const fp = std::fopen (tmpfname,
"w");
167 rw_assert (fb.is_open (), __FILE__, __LINE__,
168 "basic_filebuf<%s>::basic_filebuf (FILE*).is_open() "
169 "== true, got false", tname);
173 rw_assert (next_fd [0] == next_fd [1] && fdcount [0] == fdcount [1],
175 "%d file descriptor mismatch detected after open()",
176 fdcount [1] - fdcount [0]);
182 rw_assert (fdcount [0] == fdcount [1] + 1, __FILE__, __LINE__,
183 "%d file descriptor leak(s) detected after destruction",
184 fdcount [1] - fdcount [0]);
189 "macro stdin unexpectedly not #defined, "
190 "basic_filebuf<%s>::basic_filebuf (FILE*) "
191 "extension not tested", tname);
196 rw_info (0, __FILE__, __LINE__,
197 "std::basic_filebuf<%s>::basic_filebuf(int) "
198 "[extension]", tname);
203 std::FILE*
const fp = std::fopen (tmpfname,
"w");
206 pfb =
new Filebuf (fp);
211 Filebuf fb (pfb->fd ());
215 rw_assert (fb.is_open (), __FILE__, __LINE__,
216 "basic_filebuf<%s>::basic_filebuf (int).is_open() "
217 "== true, got false", tname);
219 rw_assert (next_fd [0] == next_fd [1] && fdcount [0] == fdcount [1],
221 "%d file descriptor mismatch detected after open()",
222 fdcount [1] - fdcount [0]);
228 rw_assert (fdcount [0] == fdcount [1] + 1, __FILE__, __LINE__,
229 "%d file descriptor leak(s) detected after destruction",
230 fdcount [1] - fdcount [0]);
252template <
class charT>
254test_open (
const char* tname)
256 typedef std::basic_filebuf<charT, std::char_traits<charT> > Filebuf;
258 const char*
const tmpfname =
rw_tmpnam (0);
264 rw_info (0, __FILE__, __LINE__,
265 "std::basic_filebuf<%s>::is_open ()", tname);
267 rw_info (0, __FILE__, __LINE__,
268 "std::basic_filebuf<%s>::open (const char*, "
269 "ios_base::openmode)", tname);
318#define BEGIN_MODE(openmode, ext) \
320 rw_info (0, __FILE__, __LINE__, "%{Io} %s", mode, ext)
322#define ASSERT_OPEN(expr, mode, txt) \
323 rw_assert (expr, __FILE__, __LINE__, \
324 "basic_filebuf<%s>::open (\"%s\", %{Io}) %s ", \
325 tname, tmpfname, mode, txt) \
327 std::ios_base::openmode
mode;
329 const std::ios::openmode iomodes[] = {
330 std::ios::openmode ()
332#ifndef _RWSTD_NO_EXT_STDIO
340 const std::size_t niomodes =
sizeof iomodes /
sizeof *iomodes;
343 std::size_t
size = 0;
348 for (std::size_t minx = 0; minx != niomodes; ++minx) {
350 BEGIN_MODE (std::ios::out | iomodes [minx],
"");
353 Filebuf ().open (tmpfname,
mode);
362 "unexpectedly created a non-empty file");
367 Filebuf ().open (tmpfname,
mode);
376 "unexpectedly created a non-empty file");
382 for (std::size_t minx = 0; minx != niomodes; ++minx) {
384 BEGIN_MODE (std::ios::out | std::ios::app | iomodes [minx],
"");
389 Filebuf ().open (tmpfname,
mode);
402 Filebuf ().open (tmpfname,
mode);
411 "unexpectedly truncated a non-empty file");
417 for (std::size_t minx = 0; minx != niomodes; ++minx) {
419 BEGIN_MODE (std::ios::out | std::ios::trunc | iomodes [minx],
"");
425 Filebuf ().open (tmpfname,
mode);
443 for (std::size_t minx = 0; minx != niomodes; ++minx) {
446 BEGIN_MODE (std::ios::nocreate | iomodes [minx],
"[extension]");
450 fb.open (tmpfname,
mode);
454 "unexpectedly succeeded to open a non-existent file");
460 BEGIN_MODE (std::ios::out | std::ios::nocreate,
"[extension]");
472 fb.open (tmpfname,
mode);
476 "unexpectedly succeeded to open a non-existent file");
490 fb.open (tmpfname,
mode);
494 "unexpectedly succeeded to open an existing file");
501#ifndef _RWSTD_NO_EXT_STDIO
506 BEGIN_MODE (std::ios::stdio | std::ios::out | std::ios::nocreate,
516 fb.open (tmpfname,
mode);
520 "unexpectedly succeeded to open a non-existent file");
534 BEGIN_MODE (std::ios::out | std::ios::nocreate | std::ios::trunc,
538 std::remove (tmpfname);
545 fb.open (tmpfname,
mode);
549 "unexpectedly succeeded to open a non-existent file");
560 std::remove (tmpfname);
562 for (std::size_t minx = 0; minx != niomodes; ++minx) {
565 BEGIN_MODE (std::ios::noreplace | iomodes [minx],
"[extension]");
569 fb.open (tmpfname,
mode);
573 "unexpectedly succeeded to open a non-existent file");
581 BEGIN_MODE (std::ios::out | std::ios::noreplace,
"[extension]");
590 fb.open (tmpfname,
mode);
594 "unexpectedly succeeded to open an existing file");
607 BEGIN_MODE (std::ios::out | std::ios::trunc | std::ios::noreplace,
616 fb.open (tmpfname,
mode);
620 "failed to open an existing file");
635 const std::size_t readbuf_size =
sizeof readbuf /
sizeof *readbuf;
637 for (std::size_t minx = 0; minx != niomodes; ++minx) {
639 BEGIN_MODE (std::ios::in | iomodes [minx],
"");
645 const charT foobar[] = {
'f',
'o',
'o',
'b',
'a',
'r' };
647 if (fb.open (tmpfname,
mode)) {
649 rw_assert (fb.is_open (), __FILE__, __LINE__,
650 "basic_filebuf<%s>::is_open()", tname);
652 std::memset (readbuf, 0,
sizeof readbuf);
653 fb.sgetn (readbuf, readbuf_size);
656 mode,
"failed to open an existing file for reading");
666 for (std::size_t minx = 0; minx != niomodes; ++minx) {
668 BEGIN_MODE (std::ios::in | std::ios::out | iomodes [minx],
"");
674 if (fb.open (tmpfname,
mode)) {
676 rw_assert (fb.is_open (), __FILE__, __LINE__,
677 "basic_filebuf<%s>::is_open()", tname);
679 const charT FOO[] = {
'F',
'O',
'O' };
680 const charT bar[] = {
'b',
'a',
'r' };
682 if (3 != fb.sputn (FOO,
sizeof FOO /
sizeof *FOO))
684 "failed to open an existing file for writing "
691 std::memset (readbuf, 0,
sizeof readbuf);
692 const std::streamsize got = fb.sgetn (readbuf, readbuf_size);
697 "sgetn() retrieved the wrong data)");
701 "sgetn() == 3, got %td: %{*.*Ac}, "
703 got,
int (
sizeof (
charT)), got, readbuf,
704 int (
sizeof (
charT)),
716 for (std::size_t minx = 0; minx != niomodes; ++minx) {
718 BEGIN_MODE ( std::ios::in | std::ios::out | std::ios::trunc
719 | iomodes [minx],
"");
725 if (fb.open (tmpfname,
mode)) {
727 rw_assert (fb.is_open (), __FILE__, __LINE__,
728 "basic_filebuf<%s>::is_open()", tname);
730 const charT FOO[] = {
'F',
'O',
'O' };
732 std::memset (readbuf, 0,
sizeof readbuf);
733 if (0 != fb.sgetn (readbuf, readbuf_size))
735 "failed to truncate a non-empty file");
737 if (3 != fb.sputn (FOO,
sizeof FOO /
sizeof *FOO))
739 "failed to open an existing file for writing "
744 fb.pubseekoff (0, std::ios::beg);
746 std::memset (readbuf, 0,
sizeof readbuf);
747 if (3 != fb.sgetn (readbuf, readbuf_size))
749 "failed to open an existing file for reading "
750 "(sgetn() failed after a sputn())");
753 "failed to open an existing file for reading "
754 "and writing (sgetn() retrieved the wrong data)");
765 for (std::size_t minx = 0; minx != niomodes; ++minx) {
767 BEGIN_MODE (std::ios::binary | std::ios::in | iomodes [minx],
"");
773 const char bindata[] =
"\nf\ro\n\ro\r\n\b\n\ra\r\rr";
776 size =
rw_fwrite (tmpfname, bindata,
sizeof bindata - 1,
"wb");
780 if (fb.open (tmpfname,
mode)) {
782 rw_assert (fb.is_open (), __FILE__, __LINE__,
783 "basic_filebuf<%s>::is_open()", tname);
785 std::memset (readbuf, 0,
sizeof readbuf);
786 const std::streamsize
N = fb.sgetn (readbuf, readbuf_size);
788 if (
N != std::streamsize (
size))
790 "basic_filebuf<%s>::sgetn (%p, %d) == %d, "
791 "got %d", tname, readbuf,
792 readbuf_size,
size,
N);
794 for (std::streamsize
i = 0;
i !=
N; ++
i) {
796 if (
char (readbuf [
i]) != bindata [
i]) {
799 "basic_filebuf<%s>::sgetn() data "
800 "mismatch: got \"%s\", expected \"%s\"",
801 tname, readbuf, bindata);
814 for (std::size_t minx = 0; minx != niomodes; ++minx) {
816 BEGIN_MODE (std::ios::binary | std::ios::out | iomodes [minx],
"");
820 if (fb.open (tmpfname,
mode)) {
822 rw_assert (fb.is_open (), __FILE__, __LINE__,
823 "basic_filebuf<%s>::is_open()", tname);
825 const charT XYZ[] = {
826 '\n',
'X',
'\r',
'Y',
'\n',
'\r',
'Z',
'\r',
'\n',
'\0'
829 const std::streamsize
N =
sizeof XYZ /
sizeof *XYZ - 1;
831 if (
N != fb.sputn (XYZ,
N))
833 "failed to open an existing file for writing "
842 "basic_filebuf<%s>::sputn() wrote %d bytes, "
846 for (std::streamsize
i = 0;
i !=
N; ++
i) {
848 if (
buf [
i] !=
char (XYZ [
i])) {
851 "basic_filebuf<%s>::sputn() data "
852 "mismatch: wrote \"%s\", expected \"%s\"",
868 for (std::size_t minx = 0; minx != niomodes; ++minx) {
871 ", file name = 0 [extension]");
880 fb.open ((
const char*)0,
mode);
882 rw_assert (fb.is_open (), __FILE__, __LINE__,
883 "basic_filebuf<%s>::is_open()", tname);
892 for (std::size_t minx = 0; minx != niomodes; ++minx) {
895 ", file name = 0 [extension]");
902 fb.open ((
const char*)0,
mode);
904 rw_assert (fb.is_open (), __FILE__, __LINE__,
905 "basic_filebuf<%s>::is_open()", tname);
914 for (std::size_t minx = 0; minx != niomodes; ++minx) {
916 BEGIN_MODE (std::ios::in | std::ios::out | iomodes [minx],
917 ", file name = 0 [extension]");
920 fb.open ((
const char*)0,
mode);
922 rw_assert (fb.is_open (), __FILE__, __LINE__,
923 "basic_filebuf<%s>::is_open()", tname);
935 BEGIN_MODE (std::ios::ate | std::ios::out,
"");
939 if (mkfifo (tmpfname, S_IRWXU))
941 "mkfifo (\"%s\", S_IRWXU) failed", tmpfname);
944 const pid_t childpid = fork ();
950 const Filebuf*
const fbp = fb.open (tmpfname,
mode);
955 "basic_filebuf<%s>::open(\"%s\", ios::ate | "
956 "ios::out) == 0 after a failed seek to end",
963 "basic_filebuf<%s>::is_open() == false"
964 " after a failed call to open", tname);
970 else if (0 == childpid) {
974 if (fb.open (tmpfname, std::ios::in))
978 "basic_filebuf<%s>::open(\"%s\", "
979 "ios::in) failed in child process",
985 rw_assert (
false, __FILE__, __LINE__,
"fork() failed");
993 rw_info (0, __FILE__, __LINE__,
994 "std::basic_filebuf<%s>::close ()", tname);
998 if (mkfifo (tmpfname, S_IRWXU))
1000 "mkfifo (\"%s\", S_IRWXU) failed", tmpfname);
1007 const pid_t childpid = fork ();
1013 if (fb.open (tmpfname, std::ios::out)) {
1016 fb.sputc (
charT ());
1026 "basic_filebuf<%s>::close() unexpectedly "
1031 "basic_filebuf<%s>::open (\"%s\", ios::out) "
1032 " != 0; got 0", tname, tmpfname);
1034 else if (0 == childpid) {
1038 if (!fb.open (tmpfname, std::ios::in))
1040 "basic_filebuf<%s>::open(\"%s\", "
1041 "ios::in) failed in child process",
1047 rw_assert (
false, __FILE__, __LINE__,
"fork() failed");
1058template <
class charT>
1060test_sync (
const char* tname)
1062 typedef std::basic_filebuf<charT, std::char_traits<charT> > Filebuf;
1064 rw_info (0, __FILE__, __LINE__,
1065 "std::basic_filebuf<%s>::sync ()", tname);
1067 const char*
const tmpfname =
rw_tmpnam (0);
1075 static const charT foo[] = {
'f',
'o',
'o' };
1076 static const charT BAR[] = {
'B',
'A',
'R' };
1081 if (fb.open (tmpfname, std::ios::in)) {
1083 rw_assert (fb.is_open (), __FILE__, __LINE__,
1084 "basic_filebuf<%s>::is_open()", tname);
1086 charT readbuf [256] = { 0 };
1091 std::streamsize got = fb.sgetn (readbuf, 3);
1096 "sgetn() == 3, got %d", got);
1100 "sgetn() retrieved \"%s\", expected \"%s\")",
1109 const int res = fb.pubsync ();
1112 "pubsync() == 0, got %d",
res);
1114 std::memset (readbuf, 0,
sizeof readbuf);
1118 got = fb.sgetn (readbuf, 3);
1123 "sgetn() == 3, got %d", got);
1125 rw_assert (!std::memcmp (readbuf, BAR,
sizeof BAR),
1127 "sgetn() retrieved \"%s\", expected \"%s\")",
1132 "failed to open an existing file");
1139 static const charT foo[] = {
'f',
'o',
'o' };
1144 if (fb.open (tmpfname, std::ios::in)) {
1146 rw_assert (fb.is_open (), __FILE__, __LINE__,
1147 "basic_filebuf<%s>::is_open()", tname);
1149 charT readbuf [256] = { 0 };
1154 std::streamsize got = fb.sgetn (readbuf, 3);
1159 "sgetn() == 3, got %d", got);
1163 "sgetn() retrieved \"%s\", expected \"%s\")",
1174 const int res = fb.pubsync ();
1177 "pubsync() == 0, got %d",
res);
1179 std::memset (readbuf, 0,
sizeof readbuf);
1183 got = fb.sgetn (readbuf, 3);
1188 "sgetn() == 0, got %d", got);
1191 const typename Filebuf::off_type
off =
1192 fb.pubseekoff (0, std::ios::end);
1195 "pubseekoff(0, ios::end) == 2, got %d",
off);
1199 "failed to open an existing file");
1207template <
class charT>
1209test_attach (
const char* tname)
1211#ifndef _RWSTD_NO_EXT_FILEBUF
1216 rw_info (0, __FILE__, __LINE__,
1217 "std::basic_filebuf<%s>::attach (int) [extension]", tname);
1219 rw_info (0, __FILE__, __LINE__,
1220 "std::basic_filebuf<%s>::fd () [extension]", tname);
1222 typedef std::basic_filebuf<charT, std::char_traits<charT> > Filebuf;
1241 "open (\"%s\", O_RDWR) < 0; "
1249 Filebuf *pfb = fb.attach (fd);
1254 "basic_filebuf<%s>::attach(int = %d) == %p, got 0",
1260 "basic_filebuf<%s>::fd() == %d, got %d",
1261 tname, fd, fb.fd ());
1266 "basic_filebuf<%s>::is_open() == true, "
1267 "got false after a successful call to attach(%d)",
1282 "basic_filebuf<%s>::attach(int = %d) caused "
1283 "a file descriptor leak after object destruction",
1289 Filebuf *pfb = fb.attach (fd);
1294 "basic_filebuf<%s>::attach(int = %d) == %p, got 0",
1300 "basic_filebuf<%s>::fd() == %d, got %d",
1301 tname, fd, fb.fd ());
1306 "basic_filebuf<%s>::is_open() == true, "
1307 "got false after a successful call to attach(%d)",
1316 "basic_filebuf<%s>::close() == %p, got 0",
1323 "basic_filebuf<%s>::fd() < 0, got %d after "
1324 "a call to close()",
1330 "basic_filebuf<%s>::is_open() == false, "
1331 "got true after a successful call to close()",
1344 "basic_filebuf<%s>::attach(int = %d) caused "
1345 "a file descriptor leak after object destruction",
1351 Filebuf *pfb = fb.attach (fd);
1356 "basic_filebuf<%s>::attach(int = %d) == %p, got 0",
1359 pfb = fb.attach (fd);
1365 "basic_filebuf<%s>::attach(int = %d) == 0, got %p",
1370 pfb = fb.attach (fd);
1374 "basic_filebuf<%s>::attach(int = %d) == 0, got %p",
1385 rw_info (0, __FILE__, __LINE__,
1386 "std::basic_filebuf<%s>::detach () [extension]", tname);
1405 "basic_filebuf<%s>::attach(int = %d) caused "
1406 "a file descriptor leak after object destruction",
1414 const int old_fd = fb.detach ();
1419 "basic_filebuf<%s>::detach() == %d, got %d",
1425 "basic_filebuf<%s>::is_open() == false, "
1426 "got true after a call to detach()", tname);
1432 "basic_filebuf<%s>::fd() < 0, got %d after "
1433 "a call to detach()()", tname, fb.fd ());
1444 "basic_filebuf<%s>::~basic_filebuf() attempted to "
1445 "close a detached file descriptor", tname);
1452 "basic_filebuf<%s>::fd() < 0, got %d for an "
1453 "object that's not open", tname, fb.fd ());
1455 const int old_fd = fb.detach ();
1461 "basic_filebuf<%s>::detach() < 0, got %d",
1465 const char*
const tmpfname =
rw_tmpnam (0);
1475 const int fd =
open (tmpfname, O_CREAT | O_WRONLY, 0666);
1478 rw_warn (
false, __FILE__, __LINE__,
1479 "open (\"%s\", O_CREAT | O_WRONLY, 0666) "
1480 "failed: %m", tmpfname);
1486 const charT data[] = {
'0',
'1',
'2',
'\0' };
1487 const std::size_t nelems =
sizeof data /
sizeof *
data - 1;
1490 const std::size_t wrote = fb.sputn (
data, nelems);
1492 if (wrote != nelems)
1494 "sputn(\"%s\", %d) == %d, got %d",
1495 data, nelems, nelems, wrote);
1498 const int old_fd = fb.detach ();
1501 "basic_filebuf<%s>::detach() == %d, got %d",
1507 std::size_t nbytes = 0;
1508 const char*
const buf =
1511 if ( !
buf || nbytes != nelems
1514 "basic_filebuf<%s>::detach() failed to flush "
1515 "data to the attached file descriptor; "
1516 "read %lu bytes: %s, expected \"012\"",
1517 tname, nbytes,
buf);
1526 const int fd =
open (tmpfname, O_CREAT | O_WRONLY, 0666);
1534 if (fd !=
open (tmpfname, O_RDONLY)) {
1536 "open (\"%s\", O_RDONLY) != %d; aborting test",
1541 static const charT data[] = {
'0',
'1',
'2',
'\0' };
1542 static const std::size_t nelems =
sizeof data /
sizeof *
data - 1;
1545 if (nelems != std::size_t (fb.sputn (
data, nelems)))
1546 rw_assert (
false, __FILE__, __LINE__,
"sputn() failed");
1549 const int bad_fd = fb.detach ();
1555 "basic_filebuf<%s>::detach() < 0, got %d after "
1556 "a failure to write to read-only file descriptor",
1562 std::size_t nbytes = 0;
1569 "basic_filebuf<%s>::detach() unexpectedly wrote "
1570 "%u bytes to a read-only file: \"%s\"",
1571 tname, nbytes,
buf);
1575 if (fd !=
open (tmpfname, O_WRONLY)) {
1577 "open (\"%s\", O_WRONLY) != %d; aborting test",
1583 const int good_fd = fb.detach ();
1588 "basic_filebuf<%s>::detach() == %d, got %d",
1589 tname, fd, good_fd);
1594 "basic_filebuf<%s>::is_open() unexpectedly "
1595 "true after a successful call to detach()",
1603 if ( !
buf || nbytes != nelems
1606 "basic_filebuf<%s>::detach() failed to flush "
1607 "data to the attached file descriptor; "
1608 "read %lu bytes: %s, expected %s",
1640template <
class charT>
1641struct CodeCvt: std::codecvt<charT, char, std::mbstate_t>
1643 typedef std::codecvt<charT, char, std::mbstate_t>
Base;
1658 virtual std::codecvt_base::result
1663 virtual std::codecvt_base::result
1668 virtual std::codecvt_base::result
1693extern const char*
const escapes[] = {
1694 "<ESC-CNTRL>",
"<ESC-PUNCT>",
"<ESC-DIGIT>",
1695 "<ESC-UPPER>",
"<ESC-LOWER>",
"<ESC-HEXCODE>"
1701 "<NUL>",
"<SOH>",
"<STX>",
"<ETX>",
"<EOT>",
"<ENQ>",
"<ACK>",
"<BEL>",
1702 "<BS>",
"<HT>",
"\n",
"<VT>",
"<FF>",
"<CR>" ,
"<SO>",
"<SI>",
1703 "<DLE>",
"<DC1>",
"<DC2>",
"<DC3>",
"<DC4>",
"<NAK>",
"<SYN>",
"<ETB>",
1704 "<CAN>",
"<EM>",
"<SUB>",
"<ESC>",
"<FS>",
"<GS>",
"<RS>",
"<US>",
1707 "<exclamation-mark>",
1714 "<left-parenthesis>",
1715 "<right-parenthesis>",
1723 "0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
1729 "<greater-than-sign>",
1733 "A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
1734 "N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
1736 "<left-square-bracket>",
1738 "<right-square-bracket>",
1743 "a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
1744 "n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
1746 "<left-curly-bracket>",
1748 "<right-curly-bracket>",
1756template <
class charT>
1757std::codecvt_base::result
1766 std::codecvt_base::result
res = std::codecvt_base::ok;
1768 char hexbuf [5] =
"";
1770 int int_state = hexcode;
1772 for (from_next = from, to_next = to; from_next != from_end; ++from_next) {
1774 typedef std::char_traits<intern_type>
Traits;
1776 const std::size_t uch = std::size_t (Traits::to_int_type (*from_next));
1781 else if (uch >=
' ' && uch <=
'/') {
1784 else if (uch >=
'0' && uch <=
'9') {
1787 else if (uch >=
':' && uch <=
'@') {
1790 else if (uch >=
'A' && uch <=
'Z') {
1793 else if (uch >=
'[' && uch <=
'`') {
1796 else if (uch >=
'a' && uch <=
'z') {
1799 else if (uch >=
'{' && uch <=
'~') {
1802 else if (uch ==
'\x7f') {
1805 else if (uch <= 0xff) {
1806 int_state = hexcode;
1808 if (to_end - to_next < 4) {
1809 res = std::codecvt_base::partial;
1814 static const char hexdigits[] =
"0123456789abcdef";
1818 hexbuf [2] = hexdigits [uch >> 8];
1819 hexbuf [3] = hexdigits [uch & 0x0fU];
1823 res = std::codecvt_base::error;
1827 if (
int (*(
char*)&state) != int_state) {
1829 const std::size_t
len = std::strlen (
escapes [int_state]);
1831 if (
len > std::size_t (to_end - to_next)) {
1832 res = std::codecvt_base::partial;
1836 std::memcpy (to_next,
escapes [int_state],
len);
1839 *(
char*)&state =
char (int_state);
1842 const char*
const outs = *hexbuf ? hexbuf :
charnames [uch];
1844 const std::size_t
len = std::strlen (outs);
1846 if (
len > std::size_t (to_end - to_next)) {
1847 res = std::codecvt_base::partial;
1851 std::memcpy (to_next, outs,
len);
1865 const char*
const chartbl[], std::size_t tblsize)
1869 std::size_t hits [
nchars] = { 0 };
1871 const char*
cur = *pbeg;
1875 const std::size_t
inx =
cur - *pbeg;
1877 std::size_t nmatches = 0;
1879 for (std::size_t
i = 0;
i != tblsize; ++
i) {
1880 if (hits [
i] ==
inx && chartbl [
i] && *
cur == chartbl [
i][
inx]) {
1890 std::size_t nmatches = 0;
1891 std::size_t imaxhits = 0;
1892 std::size_t
inx = std::size_t (-1);
1894 for (std::size_t
i = 0;
i != tblsize; ++
i) {
1899 if (hits [
i] > hits [imaxhits])
1902 if (hits [
i] == std::strlen (chartbl [
i])) {
1904 if (std::size_t (-1) ==
inx)
1907 if (hits [
i] == hits [
inx]) {
1911 else if (hits [
i] > hits [
inx]) {
1916 else if (std::size_t (-1) !=
inx && hits [
i] > hits [
inx]) {
1922 if (
inx != std::size_t (-1) && 1 == nmatches)
1925 if (hits [imaxhits] == std::size_t (
end - *pbeg))
1932template <
class charT>
1933std::codecvt_base::result
1942 std::codecvt_base::result
res = std::codecvt_base::ok;
1944 for (to_next = to, from_next = from; to_next != to_end; ++to_next) {
1948 if (from_next == from_end)
1951 const std::size_t navail = from_end - from_next;
1956 if (navail <= 5 && !std::memcmp (from_next,
"<ESC-", navail))
1957 return std::codecvt_base::partial;
1959 if (navail > 5 && !std::memcmp (from_next,
"<ESC-", 5)) {
1967 for (std::size_t
i = 0;
i != nescapes; ++
i) {
1969 const std::size_t
len = std::strlen (
escapes [
i]);
1976 *(
char*)&state =
char (
i);
1989 return std::codecvt_base::partial;
1993 std::size_t chinx = std::size_t (-1);
1994 std::size_t choff = 0;
1996 const char*
const from_next_save = from_next;
1998 switch (*(
char*)&state) {
2002 if ( std::size_t (-1) == chinx
2003 && 5 <= from_end - from_next
2004 && !std::memcmp (from_next,
"<DEL>", 5)) {
2012 static const char*
const pun[] = {
2013 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2014 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2016 "<exclamation-mark>",
2023 "<left-parenthesis>",
2024 "<right-parenthesis>",
2031 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2036 "<greater-than-sign>",
2039 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2040 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2041 "<left-square-bracket>",
2043 "<right-square-bracket>",
2047 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2048 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2049 "<left-curly-bracket>",
2051 "<right-curly-bracket>",
2056 chinx =
find_char (&from_next, from_end,
2057 pun,
sizeof pun /
sizeof *pun);
2065 if (*from_next >=
'0' && *from_next <=
'9')
2066 chinx = *from_next++ -
'0';
2076 if (*from_next >=
'a' && *from_next <=
'z')
2077 chinx = *from_next++ -
'a';
2087 if (*from_next >=
'A' && *from_next <=
'Z')
2088 chinx = *from_next++ -
'A';
2095 if (from_end - from_next < 4)
2096 return std::codecvt_base::partial;
2098 if ( from_next [0] !=
'\\' || from_next [1] !=
'x'
2099 || !( (from_next [2] >=
'0' && from_next [2] <=
'9')
2100 || (from_next [2] >=
'A' && from_next [2] <=
'F')
2101 || (from_next [2] >=
'a' && from_next [2] <=
'f'))
2102 || !( (from_next [3] >=
'0' && from_next [3] <=
'9')
2103 || (from_next [3] >=
'A' && from_next [3] <=
'F')
2104 || (from_next [3] >=
'a' && from_next [3] <=
'f')))
2105 return std::codecvt_base::error;
2109 for (
unsigned i = 2;
i != 4; ++
i) {
2111 if (from_next [
i] >=
'0' && from_next [
i] <=
'9')
2112 chinx += from_next [
i] -
'0';
2113 else if (from_next [
i] >=
'A' && from_next [
i] <=
'F')
2114 chinx += 10 + (from_next [
i] -
'A');
2116 chinx += 10 + (from_next [
i] -
'a');
2123 chinx = std::size_t (-1);
2127 if (std::size_t (-1) == chinx) {
2128 res = std::codecvt_base::error;
2134 if (from_next == from_next_save) {
2135 res = std::codecvt_base::partial;
2139 *to_next =
charT (chinx + choff);
2146template <
class charT>
2147std::codecvt_base::result
2156 if (!*(
char*)&state)
2157 return std::codecvt_base::noconv;
2159 const std::size_t
len = std::strlen (
escapes [0]);
2161 if (
len > std::size_t (to_end - to_next))
2162 return std::codecvt_base::partial;
2167 std::memset (&state, 0,
sizeof state);
2169 return std::codecvt_base::ok;
2173template <
class charT>
2185get_codecvt_result (std::codecvt_base::result
res)
2188 case std::codecvt_base::error:
return "std::codecvt_base::error";
2189 case std::codecvt_base::noconv:
return "std::codecvt_base::noconv";
2190 case std::codecvt_base::ok:
return "std::codecvt_base::ok";
2191 case std::codecvt_base::partial:
return "std::codecvt_base::partial";
2198template <
class charT>
2200test_codecvt (
const char* tname)
2202 rw_info (0, __FILE__, __LINE__,
2203 "std::basic_filebuf<%s> with a state-dependent encoding",
2206 rw_info (0, __FILE__, __LINE__,
2207 "sgetn() with state-dependent code conversion");
2211 typedef std::basic_filebuf<charT, std::char_traits<charT> > Filebuf;
2212 typedef typename Filebuf::off_type off_type;
2217 if (!noconv_in.open (__FILE__, std::ios::binary | std::ios::in)) {
2219 "basic_filebuf<%s>::open (\"%s\", "
2220 "ios_base::binary | ios_base::in) failed",
2226 const std::streamsize noconv_fsize =
2227 noconv_in.pubseekoff (0, std::ios::end);
2229 if (noconv_fsize <= 0) {
2231 "basic_filebuf<%s>::pubseekoff "
2232 "(0, ios_base::end) >= 0, got %i",
2233 tname, noconv_fsize);
2237 if (0 != noconv_in.pubseekoff (0, std::ios::beg)) {
2239 "basic_filebuf<%s>::pubseekoff "
2240 "(0, ios_base::beg) failed", tname);
2244 const char*
const tmpfname =
rw_tmpnam (0);
2252 charT *noconv_intbuf =
new charT [noconv_fsize];
2257 std::streamsize nread = noconv_in.sgetn (noconv_intbuf, noconv_fsize);
2259 if (nread != noconv_fsize) {
2261 "basic_filebuf<%s>::sgetn (%p, %i) == %i), got %i",
2262 tname, noconv_intbuf,
2263 noconv_fsize, noconv_fsize, nread);
2264 delete[] noconv_intbuf;
2274 conv_out.pubimbue (std::locale (std::locale::classic (), &
cvt));
2276 if (!conv_out.open (tmpfname, std::ios::binary | std::ios::out)) {
2278 "basic_filebuf<%s>::open (\"%s\", ios_base::out) "
2279 "failed", tname, tmpfname);
2280 delete[] noconv_intbuf;
2287 const std::streamsize nwrote = conv_out.sputn (noconv_intbuf, nread);
2289 if (nread != nwrote) {
2291 "basic_filebuf<%s>::sputn (\"%s\", %i) == %i), "
2293 noconv_intbuf, nread, nread, nwrote);
2294 delete[] noconv_intbuf;
2299 if (!conv_out.close ())
2300 rw_warn (
false, __FILE__, __LINE__,
2301 "basic_filebuf<%s>(\"%s\").close() failed",
2306 if (!nin.open (tmpfname, std::ios::binary | std::ios::in)) {
2308 "basic_filebuf<%s>::open (\"%s\", ios_base::in) failed",
2310 delete[] noconv_intbuf;
2315 const std::streamsize conv_fsize = nin.pubseekoff (0, std::ios::end);
2317 if (conv_fsize <= noconv_fsize) {
2319 "filebuf::pubseekoff (0, ios_base::end) > %i, got %i",
2320 noconv_fsize, conv_fsize);
2321 delete[] noconv_intbuf;
2325 if (0 != nin.pubseekoff (0, std::ios::beg)) {
2327 "filebuf::pubseekoff (0, ios_base::beg) failed");
2328 delete[] noconv_intbuf;
2334 char *noconv_extbuf =
new char [conv_fsize];
2335 std::memset (noconv_extbuf, 0, conv_fsize);
2338 nread = nin.sgetn (noconv_extbuf, conv_fsize);
2340 if (nread != conv_fsize) {
2342 "filebuf::sgetn (%p, %i) == %i, got %i",
2343 noconv_extbuf, conv_fsize, conv_fsize, nread);
2344 delete[] noconv_intbuf;
2345 delete[] noconv_extbuf;
2350 rw_warn (
false, __FILE__, __LINE__,
2351 "basic_filebuf<%s>(\"%s\").close() failed",
2354 std::mbstate_t state;
2355 std::memset (&state, 0,
sizeof state);
2357 const char *from = noconv_extbuf;
2358 const char *from_end = noconv_extbuf + nread;
2359 const char *from_next = 0;
2363 charT *conv_intbuf =
new charT [noconv_fsize];
2364 std::memset (conv_intbuf, 0, noconv_fsize *
sizeof *conv_intbuf);
2366 charT *to = conv_intbuf;
2367 charT *to_end = conv_intbuf + noconv_fsize;
2371 const std::codecvt_base::result cvtres =
2372 cvt.in (state, from, from_end, from_next, to, to_end, to_next);
2374 if (std::codecvt_base::ok != cvtres) {
2376 "CodeCvt<%s>::in ({ %d, ... }, %p, %p, %p, %p, %p, %p) "
2377 "== std::codecvt_base::ok, got %s",
2378 tname, *(
unsigned char*)&state,
2379 from, from_end, from_next, to, to_end, to_next,
2380 get_codecvt_result (cvtres));
2381 delete[] noconv_intbuf;
2382 delete[] noconv_extbuf;
2383 delete[] conv_intbuf;
2387 const std::streamsize n_ext_cvt = from_next - from;
2388 const std::streamsize n_int_cvt = to_next - to;
2390 rw_assert (n_ext_cvt == conv_fsize, __FILE__, __LINE__,
2391 "CodeCvt<%s>::in() converted %i external characters, "
2392 "expected %i", tname, n_ext_cvt, conv_fsize);
2394 rw_assert (n_int_cvt == noconv_fsize, __FILE__, __LINE__,
2395 "CodeCvt<%s>::in() produced %i internal characters, "
2396 "expected %i", tname, n_int_cvt, noconv_fsize);
2404 rw_assert (!std::memcmp (noconv_intbuf, conv_intbuf, n_int_cvt),
2405 __FILE__, __LINE__,
"code conversion mismatch");
2413 conv_in.pubimbue (std::locale (std::locale::classic (), &
cvt));
2415 conv_in.open (tmpfname, std::ios::in);
2417 std::memset (conv_intbuf, 0, noconv_fsize *
sizeof *conv_intbuf);
2419 nread = conv_in.sgetn (conv_intbuf, noconv_fsize);
2421 if (nread != noconv_fsize) {
2423 "basic_filebuf<%s>::sgetn (%p, %i) == %i, got %i",
2424 tname, conv_intbuf, noconv_fsize,
2425 noconv_fsize, nread);
2426 delete[] noconv_intbuf;
2427 delete[] noconv_extbuf;
2428 delete[] conv_intbuf;
2432 rw_assert (!std::memcmp (noconv_intbuf, conv_intbuf,
2433 n_int_cvt *
sizeof *noconv_intbuf),
2434 __FILE__, __LINE__,
"code conversion mismatch");
2436 if (!noconv_in.close ())
2437 rw_warn (
false, __FILE__, __LINE__,
2438 "basic_filebuf<%s>(" __FILE__
").close() failed",
2441 if (!conv_in.close ())
2442 rw_warn (
false, __FILE__, __LINE__,
2443 "basic_filebuf<%s>(\"%s\").close() failed",
2446 rw_info (0, __FILE__, __LINE__,
2447 "pubseekoff() and pubseekpos() with state-dependent "
2450 noconv_in.open (__FILE__, std::ios::binary | std::ios::in);
2451 conv_in.open (tmpfname, std::ios::binary | std::ios::in);
2453 for (std::streamsize
i = 0;
i < noconv_fsize;
i += noconv_fsize / 13) {
2455 typedef typename Filebuf::pos_type pos_type;
2457 noconv_in.pubseekoff (0, std::ios::beg);
2458 conv_in.pubseekoff (0, std::ios::beg);
2460 std::memset (noconv_intbuf, 0, noconv_fsize *
sizeof *noconv_intbuf);
2461 std::memset (conv_intbuf, 0, noconv_fsize *
sizeof *conv_intbuf);
2463 nread = noconv_in.sgetn (noconv_intbuf,
i);
2467 "basic_filebuf<%s>::sgetn (%p, %d) == %d, "
2468 "got %d", tname, noconv_intbuf,
i,
i, nread);
2472 nread = conv_in.sgetn (conv_intbuf,
i);
2476 "basic_filebuf<%s>::sgetn (%p, %d) == %d, "
2477 "got %d", tname, conv_intbuf,
i,
i, nread);
2481 if (std::memcmp (noconv_intbuf, conv_intbuf,
2482 i *
sizeof *conv_intbuf)) {
2484 "%d. code conversion mismatch",
i);
2488 const pos_type noconv_pos =
2489 noconv_in.pubseekoff (0, std::ios::cur);
2491 const pos_type conv_pos =
2492 conv_in.pubseekoff (0, std::ios::cur);
2494 std::memset (noconv_intbuf, 0, noconv_fsize *
sizeof *noconv_intbuf);
2495 std::memset (conv_intbuf, 0, noconv_fsize *
sizeof *conv_intbuf);
2497 nread = noconv_in.sgetn (noconv_intbuf, noconv_fsize);
2499 if (noconv_fsize -
i != nread) {
2501 "basic_filebuf<%s>::sgetn (%p, %d) == %d, "
2502 "got %d", tname, noconv_intbuf,
2503 noconv_fsize, noconv_fsize -
i, nread);
2507 nread = conv_in.sgetn (conv_intbuf, noconv_fsize);
2509 if (noconv_fsize -
i != nread) {
2511 "basic_filebuf<%s>::sgetn (%p, %d) == %d, "
2512 "got %d", tname, conv_intbuf,
2513 noconv_fsize, noconv_fsize -
i, nread);
2517 if (std::memcmp (noconv_intbuf, conv_intbuf,
2518 nread *
sizeof *noconv_intbuf)) {
2520 "%d. data mismatch after conversion",
i);
2524 if (!noconv_in.close ())
2525 rw_warn (
false, __FILE__, __LINE__,
2526 "basic_filebuf<%s>(" __FILE__
").close() failed",
2529 if (!conv_in.close ())
2530 rw_warn (
false, __FILE__, __LINE__,
2531 "basic_filebuf<%s>(\"%s\").close() failed",
2534 noconv_in.open (__FILE__, std::ios::binary | std::ios::in);
2535 conv_in.open (tmpfname, std::ios::binary | std::ios::in);
2537 const pos_type noconv_pos_new = noconv_in.pubseekpos (noconv_pos);
2539 if (noconv_pos_new != noconv_pos) {
2541 std::mbstate_t noconv_state = noconv_pos.state ();
2542 std::mbstate_t noconv_state_new = noconv_pos_new.state ();
2545 "basic_filebuf<%s>::pubseekpos ({ %d, %d }, "
2546 "ios_base::cur) == { %d, %d }, got { %d, %d }",
2548 off_type (noconv_pos), *(
char*)&noconv_state,
2549 off_type (noconv_pos), *(
char*)&noconv_state,
2550 off_type (noconv_pos_new),
2551 *(
char*)&noconv_state_new);
2555 const pos_type conv_pos_new = conv_in.pubseekpos (conv_pos);
2557 if (conv_pos_new != conv_pos) {
2558 std::mbstate_t conv_state = noconv_pos.state ();
2559 std::mbstate_t conv_state_new = noconv_pos_new.state ();
2562 "basic_filebuf<%s>::pubseekpos ({ %d, %d }, "
2563 "ios_base::cur) == { %d, %d }, got { %d, %d }",
2565 off_type (conv_pos), *(
char*)&conv_state,
2566 off_type (conv_pos), *(
char*)&conv_state,
2567 off_type (conv_pos_new),
2568 *(
char*)&conv_state_new);
2572 std::memset (noconv_intbuf, 0, noconv_fsize *
sizeof *noconv_intbuf);
2573 nread = noconv_in.sgetn (noconv_intbuf, noconv_fsize);
2575 if (noconv_fsize -
i != nread) {
2577 "basic_filebuf<%s>::sgetn (%p, %d) == %d, "
2578 "got %d (no code conversion)",
2579 tname, noconv_intbuf,
2580 noconv_fsize, noconv_fsize -
i, nread);
2584 if (std::memcmp (noconv_intbuf, conv_intbuf,
2585 nread *
sizeof *noconv_intbuf)) {
2587 "data mismatch (no code conversion)");
2591 std::memset (conv_intbuf, 0, noconv_fsize *
sizeof *conv_intbuf);
2592 nread = conv_in.sgetn (conv_intbuf, noconv_fsize);
2594 if (noconv_fsize -
i != nread) {
2596 "basic_filebuf<%s>::sgetn (%p, %d) == %d, "
2597 "got %d (with code conversion)",
2599 noconv_fsize, noconv_fsize -
i, nread);
2603 if (std::memcmp (noconv_intbuf, conv_intbuf,
2604 nread *
sizeof *noconv_intbuf)) {
2606 "code conversion mismatch");
2611 delete[] noconv_intbuf;
2612 delete[] noconv_extbuf;
2613 delete[] conv_intbuf;
2615 if (!noconv_in.close ())
2616 rw_warn (
false, __FILE__, __LINE__,
2617 "basic_filebuf<%s>(" __FILE__
").close() failed",
2620 if (!conv_in.close ())
2621 rw_warn (
false, __FILE__, __LINE__,
2622 "basic_filebuf<%s>(\"%s\").close() failed",
2631template <
class charT>
2633test_codecvt_with_seek ()
2635 rw_info (0, __FILE__, __LINE__,
2636 "interleaved input, output, and seeks in ios_base::app "
2637 "mode with state-dependent code conversion");
2639 typedef std::basic_filebuf<charT, std::char_traits<charT> > FileBuf;
2644 inbuf.open (__FILE__, std::ios::in);
2646 const std::streamsize
N = 0xfffff;
2650 const std::streamsize
nchars = inbuf.sgetn (
buf,
N);
2654 "sgetn(..., %d) > 0, got %d",
N,
nchars);
2664 iobuf.pubimbue (std::locale (std::locale::classic (),
new CodeCvt<charT>));
2666 const char*
const tmpfname =
rw_tmpnam (0);
2674 std::remove (tmpfname);
2677 if (!iobuf.open (tmpfname, std::ios::in | std::ios::out | std::ios::app)) {
2679 "open (\"%s\", ios::in | ios::out | ios::app) failed",
2690 const std::streamsize nput = iobuf.sputn (pb,
n -
i);
2692 iobuf.pubseekoff (0, std::ios::beg);
2695 const std::streamsize nget = iobuf.sgetn (localbuf,
n -
i);
2698 if (nget !=
n -
i || std::memcmp (
buf, localbuf, nget *
sizeof *
buf)) {
2701 "sgetn(..., %d) == %d, got %d (or inconsistent data)",
2702 n -
i,
n -
i, nget);
2709 iobuf.pubseekoff (0, std::ios::beg);
2719 inbuf.pubimbue (std::locale (std::locale::classic (),
2723 if (!inbuf.open (tmpfname, std::ios::in)) {
2724 rw_assert (
false, __FILE__, __LINE__,
"");
2734 std::streamsize ncvt = inbuf.sgetn (cvtbuf,
N);
2739 "sgetn(..., %d) == %d, got %d (or inconsistent data)",
2756template <
class charT>
2760 rw_info (0, __FILE__, __LINE__,
"std::basic_filebuf<%s>", tname);
2763 test_ctors<charT> (tname);
2766 test_open<charT> (tname);
2769 test_sync<charT> (tname);
2772 test_attach<charT> (tname);
2776 test_codecvt<charT> (tname);
2777 test_codecvt_with_seek<charT> ();
2784 do_test<char> (
"char");
2786#ifndef _RWSTD_NO_WCHAR_T
2788 do_test<wchar_t> (
"wchar_t");
2799 return rw_test (argc, argv, __FILE__,
void do_test(int line, const char *src, std::size_t resoff, ForwardIterator dummy_iter, const T *, const char *predname)
void run_test(const ForwardIterator &dummy, T *, Predicate *pred)
const char *const escapes[]
#define ASSERT_OPEN(expr, mode, txt)
const char *const charnames[]
#define BEGIN_MODE(openmode, ext)
std::size_t find_char(const char **pbeg, const char *end, const char *const chartbl[], std::size_t tblsize)
#define REMOVE_FILE(tmpfname)
#define _RWSTD_UNUSED(arg)
#define _RWSTD_STATIC_CAST(T, x)
_TEST_EXPORT int rw_test(int argc, char *argv[], const char *filename, const char *clause, const char *comment, int(*testfun)(int, char **), const char *optspec,...)
_TEST_EXPORT int rw_info(int, const char *, int, const char *,...)
_TEST_EXPORT int rw_assert(int, const char *, int, const char *,...)
_TEST_EXPORT int rw_warn(int, const char *, int, const char *,...)
_TEST_EXPORT const char * rw_tmpnam(char *)
_TEST_EXPORT _RWSTD_SIZE_T rw_fwrite(const char *, const void *, _RWSTD_SIZE_T=~0, const char *="w")
_TEST_EXPORT int rw_nextfd(int *)
_TEST_EXPORT void * rw_fread(const char *, _RWSTD_SIZE_T *=0, const char *="r")
_TEST_EXPORT int rw_strncmp(const char *, const char *, _RWSTD_SIZE_T=_RWSTD_SIZE_MAX, int=CMP_NULTERM)
std::codecvt< charT, char, std::mbstate_t > Base
virtual bool do_always_noconv() const _THROWS(())
CodeCvt(std::size_t ref=0)
Base::intern_type intern_type
Base::extern_type extern_type
virtual int do_length(state_type &, const extern_type *, const extern_type *, std::size_t) const
virtual int do_encoding() const _THROWS(())
Base::state_type state_type
virtual std::codecvt_base::result do_in(state_type &, const extern_type *, const extern_type *, const extern_type *&, intern_type *, intern_type *, intern_type *&) const
virtual std::codecvt_base::result do_out(state_type &, const intern_type *, const intern_type *, const intern_type *&, extern_type *, extern_type *, extern_type *&) const
virtual int do_max_length() const _THROWS(())
virtual std::codecvt_base::result do_unshift(state_type &, extern_type *, extern_type *, extern_type *&) const