Skip to content

Commit

Permalink
remove rz_mem_swaporcopy
Browse files Browse the repository at this point in the history
  • Loading branch information
wargio committed Oct 20, 2022
1 parent ab5c0cb commit 7685bfe
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 13 deletions.
1 change: 0 additions & 1 deletion librz/include/rz_util/rz_mem.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion librz/type/format.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
11 changes: 0 additions & 11 deletions librz/util/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7685bfe

Please sign in to comment.