[Debtags-commits] [svn] r1762 - in tagcoll/2.0: . tagcoll
Enrico Zini
enrico at costa.debian.org
Thu May 11 02:42:06 UTC 2006
Author: enrico
Date: Thu May 11 02:42:06 2006
New Revision: 1762
Modified:
tagcoll/2.0/ (props changed)
tagcoll/2.0/tagcoll/TextFormat.cc
tagcoll/2.0/tagcoll/TextFormat.tcc
Log:
r2697 at viaza: enrico | 2006-05-10 16:58:06 -0500
Library tests pass
Modified: tagcoll/2.0/tagcoll/TextFormat.cc
==============================================================================
--- tagcoll/2.0/tagcoll/TextFormat.cc (original)
+++ tagcoll/2.0/tagcoll/TextFormat.cc Thu May 11 02:42:06 2006
@@ -283,10 +283,10 @@
void to::test<3>()
{
string reference =
- "foo:\n"
+ "foo\n"
"foo: antani\n"
"foo: antani, blinda\n"
- "foo, bar: antani, blinda\n";
+ "bar, foo: antani, blinda\n";
char buf[1000];
FILE* out = fmemopen(buf, 1000, "w");
ensure(out != 0);
Modified: tagcoll/2.0/tagcoll/TextFormat.tcc
==============================================================================
--- tagcoll/2.0/tagcoll/TextFormat.tcc (original)
+++ tagcoll/2.0/tagcoll/TextFormat.tcc Thu May 11 02:42:06 2006
@@ -52,6 +52,12 @@
namespace tagcoll {
namespace textformat {
+inline static void outString(const std::string& str, FILE* out, const char* what)
+{
+ if (fwrite(str.data(), str.size(), 1, out) != 1)
+ throw wibble::exception::System(string("writing ") + what);
+}
+
template<typename Items, typename Tags>
StdioWriter& StdioWriter::operator=(const std::pair<Items, Tags>& data)
{
@@ -61,8 +67,7 @@
if (i != data.first.begin())
if (fputs(", ", out) == EOF)
throw wibble::exception::System("writing comma after item");
- if (fwrite(i->data(), i->size(), 1, out) != i->size())
- throw wibble::exception::System("writing item");
+ outString(*i, out, "item");
}
if (data.second.begin() != data.second.end())
{
@@ -74,8 +79,7 @@
if (i != data.second.begin())
if (fputs(", ", out) == EOF)
throw wibble::exception::System("writing comma after tag");
- if (fwrite(i->data(), i->size(), 1, out) != i->size())
- throw wibble::exception::System("writing tag");
+ outString(*i, out, "tag");
}
}
if (fputc('\n', out) == EOF)
More information about the Debtags-commits
mailing list