Compare commits

..

4 Commits

Author SHA1 Message Date
frsyuki
a5705183d6 0.3.5 2009-08-07 13:32:32 +09:00
frsyuki
95a6316cc7 cpp: fix msgpack::type::make_define() 2009-08-07 13:32:07 +09:00
frsyuki
be32e3b1fb cpp: add missing msgpack::type::make_tuple() 2009-08-07 13:31:42 +09:00
frsyuki
b4cb5e23c0 fix Makefile.am 2009-08-07 11:28:23 +09:00
5 changed files with 21 additions and 24 deletions

View File

@@ -1,6 +1,6 @@
AC_INIT(msgpack/unpack_template.h)
AC_CONFIG_AUX_DIR(ac)
AM_INIT_AUTOMAKE(msgpack, 0.3.4)
AM_INIT_AUTOMAKE(msgpack, 0.3.5)
AC_CONFIG_HEADER(config.h)
AC_SUBST(CFLAGS)

View File

@@ -39,10 +39,12 @@ msgpack/zone.hpp: msgpack/zone.hpp.erb
MOSTLYCLEANFILES = \
msgpack/type/tuple.hpp \
msgpack/type/define.hpp \
msgpack/zone.hpp
EXTRA_DIST = \
msgpack/type/tuple.hpp.erb \
msgpack/type/define.hpp.erb \
msgpack/zone.hpp.erb
libmsgpack_la_LIBADD = -L../c -lmsgpackc

View File

@@ -52,7 +52,6 @@ struct define<> {
if(o.type != type::ARRAY) { throw type_error(); }
}
};
<%0.upto(GENERATION_LIMIT) {|i|%>
template <typename A0<%1.upto(i) {|j|%>, typename A<%=j%><%}%>>
struct define<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> {
@@ -79,11 +78,10 @@ struct define<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> {
};
<%}%>
define<> make_define()
inline define<> make_define()
{
return define<>();
}
<%0.upto(GENERATION_LIMIT) {|i|%>
template <typename A0<%1.upto(i) {|j|%>, typename A<%=j%><%}%>>
define<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> make_define(A0& a0<%1.upto(i) {|j|%>, A<%=j%>& a<%=j%><%}%>)
@@ -92,7 +90,6 @@ define<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> make_define(A0& a0<%1.upto(i) {|j|%>,
}
<%}%>
} // namespace type
} // namespace msgpack

View File

@@ -64,7 +64,6 @@ struct tuple_type<const T&> {
typedef const T& transparent_reference;
};
<%0.upto(GENERATION_LIMIT) {|i|%>
<%0.upto(i) {|j|%>
template <typename A0<%1.upto(i) {|k|%>, typename A<%=k%><%}%>>
@@ -78,7 +77,6 @@ private:
<%}%>
<%}%>
<%0.upto(GENERATION_LIMIT) {|i|%>
<%0.upto(i) {|j|%>
template <typename A0<%1.upto(i) {|k|%>, typename A<%=k%><%}%>>
@@ -91,16 +89,6 @@ private:
<%}%>
<%}%>
<%0.upto(GENERATION_LIMIT) {|i|%>
template <typename A0<%1.upto(i) {|j|%>, typename A<%=j%><%}%>>
tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> make_tuple(typename tuple_type<A0>::transparent_reference a0<%1.upto(i) {|j|%>, typename tuple_type<A<%=j%>>::transparent_reference a<%=j%><%}%>)
{
return tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>>(a0<%1.upto(i) {|j|%>, a<%=j%><%}%>);
}
<%}%>
template <>
struct tuple<> {
typedef tuple<> value_type;
@@ -122,6 +110,18 @@ struct tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> {
};
<%}%>
inline tuple<> make_tuple()
{
return tuple<>();
}
<%0.upto(GENERATION_LIMIT) {|i|%>
template <typename A0<%1.upto(i) {|j|%>, typename A<%=j%><%}%>>
tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> make_tuple(typename tuple_type<A0>::transparent_reference a0<%1.upto(i) {|j|%>, typename tuple_type<A<%=j%>>::transparent_reference a<%=j%><%}%>)
{
return tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>>(a0<%1.upto(i) {|j|%>, a<%=j%><%}%>);
}
<%}%>
} // namespace type
@@ -144,7 +144,6 @@ type::tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>>& operator>> (
}
<%}%>
template <typename Stream>
const packer<Stream>& operator<< (
packer<Stream>& o,
@@ -164,7 +163,6 @@ const packer<Stream>& operator<< (
}
<%}%>
} // namespace msgpack
#endif /* msgpack/type/tuple.hpp */

View File

@@ -22,14 +22,14 @@ public:
ssize_t count =
read(m_sock, m_pac.buffer(), m_pac.buffer_capacity());
if(count < 0) {
if(count <= 0) {
if(count == 0) {
throw std::runtime_error("connection closed");
}
if(errno == EAGAIN || errno == EINTR) {
return;
} else {
throw std::runtime_error(strerror(errno));
}
} else if(count == 0) {
throw std::runtime_error("connection closed");
throw std::runtime_error(strerror(errno));
}
m_pac.buffer_consumed(count);