From 7685bfe90e4d96d31b60cf5de40201c0215c1972 Mon Sep 17 00:00:00 2001 From: wargio Date: Thu, 20 Oct 2022 15:12:16 +0200 Subject: [PATCH] remove rz_mem_swaporcopy --- librz/include/rz_util/rz_mem.h | 1 - librz/type/format.c | 2 +- librz/util/mem.c | 11 ----------- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/librz/include/rz_util/rz_mem.h b/librz/include/rz_util/rz_mem.h index 11991b3b862..8dc26d57979 100644 --- a/librz/include/rz_util/rz_mem.h +++ b/librz/include/rz_util/rz_mem.h @@ -32,7 +32,6 @@ RZ_API void rz_mem_copybits(ut8 *dst, const ut8 *src, int bits); RZ_API void rz_mem_copybits_delta(ut8 *dst, int doff, const ut8 *src, int soff, int bits); RZ_API void rz_mem_copyloop(ut8 *dest, const ut8 *orig, int dsize, int osize); RZ_API void *rz_mem_copy(void *dest, size_t dmax, const void *src, size_t smax); -RZ_API void rz_mem_swaporcopy(ut8 *dest, const ut8 *src, int len, bool big_endian); RZ_API void rz_mem_swapendian(ut8 *dest, const ut8 *orig, int size); RZ_API int rz_mem_cmp_mask(const ut8 *dest, const ut8 *orig, const ut8 *mask, int len); RZ_API const ut8 *rz_mem_mem(const ut8 *haystack, int hlen, const ut8 *needle, int nlen); diff --git a/librz/type/format.c b/librz/type/format.c index b3288b3ab84..a3b6fd7584b 100644 --- a/librz/type/format.c +++ b/librz/type/format.c @@ -1077,7 +1077,7 @@ static void rz_type_format_double(RzStrBuf *outbuf, int endian, int mode, while (size--) { // XXX this 999 is scary updateAddr(buf + i, 9999, endian, &addr, NULL); - rz_mem_swaporcopy((ut8 *)&val_f, buf + i, sizeof(double), endian); + val_f = rz_read_at_ble_double(buf, i, endian); if (elem == -1 || elem == 0) { rz_strbuf_appendf(outbuf, "%.17g", val_f); if (elem == 0) { diff --git a/librz/util/mem.c b/librz/util/mem.c index 03e1e363361..79d140b70ba 100644 --- a/librz/util/mem.c +++ b/librz/util/mem.c @@ -186,17 +186,6 @@ RZ_API int rz_mem_set_num(ut8 *dest, int dest_size, ut64 num) { return true; } -// The default endian is LE for streams. -// This function either swaps or copies len bytes depending on bool big_endian -// TODO: Remove completely -RZ_API void rz_mem_swaporcopy(ut8 *dest, const ut8 *src, int len, bool big_endian) { - if (big_endian) { - rz_mem_swapendian(dest, src, len); - } else { - memcpy(dest, src, len); - } -} - // This function unconditionally swaps endian of size bytes of orig -> dest // TODO: Remove completely RZ_API void rz_mem_swapendian(ut8 *dest, const ut8 *orig, int size) {