aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-06-24 13:30:41 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-06-24 13:30:41 +0200
commitb066de22decf2d19e55e9b54811f3482a39c5968 (patch)
tree5126b91c14b774a3a5fe9ffd375886558af8bd3d
parent4465f3fb659fce53a03f29a5cb3ce55c510cd855 (diff)
Move byte order conversion to traits set_value/set_image functions
-rw-r--r--odb/pgsql/statement.cxx18
-rw-r--r--odb/pgsql/traits.hxx5
2 files changed, 12 insertions, 11 deletions
diff --git a/odb/pgsql/statement.cxx b/odb/pgsql/statement.cxx
index f3d37d9..68c9ace 100644
--- a/odb/pgsql/statement.cxx
+++ b/odb/pgsql/statement.cxx
@@ -182,36 +182,36 @@ namespace odb
{
case bind::smallint:
{
- *static_cast<short*> (b.buffer) = endian_traits::ntoh (
- *reinterpret_cast<const short*> (v));
+ *static_cast<short*> (b.buffer) =
+ *reinterpret_cast<const short*> (v);
break;
}
case bind::integer:
{
- *static_cast<int*> (b.buffer) = endian_traits::ntoh (
- *reinterpret_cast<const int*> (v));
+ *static_cast<int*> (b.buffer) =
+ *reinterpret_cast<const int*> (v);
break;
}
case bind::bigint:
{
*static_cast<long long*> (b.buffer) =
- endian_traits::ntoh (*reinterpret_cast<const long long*> (v));
+ *reinterpret_cast<const long long*> (v);
break;
}
case bind::real:
{
- *static_cast<float*> (b.buffer) = endian_traits::ntoh (
- *reinterpret_cast<const float*> (v));
+ *static_cast<float*> (b.buffer) =
+ *reinterpret_cast<const float*> (v);
break;
}
case bind::double_:
{
- *static_cast<double*> (b.buffer) = endian_traits::ntoh (
- *reinterpret_cast<const double*> (v));
+ *static_cast<double*> (b.buffer) =
+ *reinterpret_cast<const double*> (v);
break;
}
diff --git a/odb/pgsql/traits.hxx b/odb/pgsql/traits.hxx
index a1e3cf6..7d2bce0 100644
--- a/odb/pgsql/traits.hxx
+++ b/odb/pgsql/traits.hxx
@@ -19,6 +19,7 @@
#include <odb/pgsql/pgsql-types.hxx>
#include <odb/pgsql/details/export.hxx>
+#include <odb/pgsql/details/endian-traits.hxx>
namespace odb
{
@@ -129,7 +130,7 @@ namespace odb
set_value (T& v, const image_type& i, bool is_null)
{
if (!is_null)
- v = T (i);
+ v = T (details::endian_traits::ntoh (i));
else
v = T ();
}
@@ -138,7 +139,7 @@ namespace odb
set_image (image_type& i, bool& is_null, T v)
{
is_null = false;
- i = image_type (v);
+ i = image_type (details::endian_traits::hton (v));
}
};