diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-10-02 01:48:15 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-10-02 01:48:15 +0000 |
commit | 8535db1bd8fd6b5da3ff2c785bdd7512f53779e3 (patch) | |
tree | 52abb6724e038e513c4ff77d9476c17f0bb298a9 /dcopc/marshal.c | |
parent | 95b02a470fa233548b3c3be0cff13caf4c88ba21 (diff) | |
download | tdebindings-8535db1bd8fd6b5da3ff2c785bdd7512f53779e3.tar.gz tdebindings-8535db1bd8fd6b5da3ff2c785bdd7512f53779e3.zip |
Apply initial code patches to the mozilla kparts plugin to allow for code compilablility
This does not enable the build system for the plugin at this time
Thanks go to Julius Schwartzenberg for his effort to fix this plugin, especially on the DCOP side of things!
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1256724 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'dcopc/marshal.c')
-rw-r--r-- | dcopc/marshal.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/dcopc/marshal.c b/dcopc/marshal.c index e0de9296..4cc804de 100644 --- a/dcopc/marshal.c +++ b/dcopc/marshal.c @@ -27,6 +27,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <stdlib.h> #include <string.h> +/* The code in previous revisions was broken on little endian system, also see KDE bug #32463 */ +/* The current code was not tested on big endian system, so it could be another issue and big */ +/* endian systems would need the same code as the little endian ones */ +#include <endian.h> + dcop_data *dcop_data_new() { dcop_data *res = g_new( dcop_data, 1 ); @@ -90,10 +95,21 @@ gboolean dcop_marshal_uint32( dcop_data *data, unsigned int val ) g_assert( sizeof( unsigned int ) == 4 ); +#ifdef __BIG_ENDIAN__ buf[0] = val; buf[1] = val >> 8; buf[2] = val >> 16; buf[3] = val >> 24; +#endif +#ifdef __LITTLE_ENDIAN__ + buf[3] = val; + buf[2] = val >> 8; + buf[1] = val >> 16; + buf[0] = val >> 24; +#endif +#if (!defined(__LITTLE_ENDIAN) && !defined(__BIG_ENDIAN)) +#error "You cannot compile the DCOP C bindings without defining either __LITTLE_ENDIAN or __BIG_ENDIAN" +#endif return dcop_marshal_raw( data, buf, 4 ); } @@ -105,10 +121,21 @@ gboolean dcop_demarshal_uint32( dcop_data *data, unsigned int *val ) if ( !dcop_data_check_size( data, 4 ) ) return FALSE; +#ifdef __BIG_ENDIAN__ *val = (data->cur[3] << 24) | (data->cur[2] << 16) | (data->cur[1] << 8) | data->cur[0]; +#endif +#ifdef __LITTLE_ENDIAN__ + *val = (data->cur[0] << 24) | + (data->cur[1] << 16) | + (data->cur[2] << 8) | + data->cur[3]; +#endif +#if (!defined(__LITTLE_ENDIAN) && !defined(__BIG_ENDIAN)) +#error "You cannot compile the DCOP C bindings without defining either __LITTLE_ENDIAN or __BIG_ENDIAN" +#endif data->cur += 4; return TRUE; |