summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-08-03 09:08:04 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-08-03 09:08:04 +0900
commit256450d294a7f7f6b0fd3bb96e05b1671db2bd92 (patch)
treee69544184a1a6a2f74dc4167832a2bb6e7887cda
parenteed23765f91edb441e5d9fb01fb78c1129ea293a (diff)
eina debug - remove other swap and comment on the weirdness of this
-rw-r--r--src/lib/eina/eina_debug.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/lib/eina/eina_debug.c b/src/lib/eina/eina_debug.c
index b71a263670..ca1bdad6c6 100644
--- a/src/lib/eina/eina_debug.c
+++ b/src/lib/eina/eina_debug.c
@@ -311,18 +311,8 @@ _callbacks_register_cb(Eina_Debug_Session *session, int src_id EINA_UNUSED, void
311 311
312 uint64_t info_64; 312 uint64_t info_64;
313 memcpy(&info_64, buffer, sizeof(uint64_t)); 313 memcpy(&info_64, buffer, sizeof(uint64_t));
314 // This is super dodgey. like really dodgey. it HAPPENS to work on 314 // cast to a ptr, so on 32bit we just take the lower 32bits and on 64
315 // little endian. definitely on 64bit because the SWAP is a nop and the 315 // we take all of it so we're fine
316 // pointer the buffer points to can be just used as-is, but if this
317 // was bigendian the swap would mess up the ptr and crash (on 64bit) as
318 // it'd swap everything around. on little endian 32bit it will happen to
319 // work as it takes the lower 32bits, but on big endian... bork bork.
320 //
321 // so obviously... don't swap, then it'll always take the LOWER 32bits
322 // on 32bit and should work... since buffer obviously is pointing to
323 // a 64bit type that contains a pointer to something... and on 64bit it'll
324 // just work as-is as sizes match.
325// info_64 = SWAP_64(info_64);
326 info = (_opcode_reply_info *)info_64; 316 info = (_opcode_reply_info *)info_64;
327 317
328 if (!info) return EINA_FALSE; 318 if (!info) return EINA_FALSE;
@@ -373,8 +363,9 @@ _opcodes_registration_send(Eina_Debug_Session *session,
373 363
374 buf = malloc(size); 364 buf = malloc(size);
375 365
366 // cast to a ptr, so on 32bit we just pad out the upper 32bits with 0
367 // and on 64bit we are fine as we use all of it
376 uint64_t info_64 = (uint64_t)(uintptr_t)info; 368 uint64_t info_64 = (uint64_t)(uintptr_t)info;
377 info_64 = SWAP_64(info_64);
378 memcpy(buf, &info_64, sizeof(uint64_t)); 369 memcpy(buf, &info_64, sizeof(uint64_t));
379 int size_curr = sizeof(uint64_t); 370 int size_curr = sizeof(uint64_t);
380 371