Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
compiler: clang
run_tests: true
meson_options: -Dbuildtype=release
enabled: ${{ github.event_name != 'pull_request' && needs.changes.outputs.edited == 'true' }}
enabled: ${{ (github.event_name != 'pull_request' || contains(github.head_ref, 'clang')) && needs.changes.outputs.edited == 'true' }}
timeout: 45
allow_failure: false
- name: linux-meson-gcc-tests
Expand Down
2 changes: 1 addition & 1 deletion librz/include/rz_util/rz_hex.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RZ_API int rz_hex_pair2bin(const char *arg);
RZ_API int rz_hex_str2binmask(const char *in, ut8 *out, ut8 *mask);
RZ_API int rz_hex_str2bin(const char *in, ut8 *out);
RZ_API int rz_hex_bin2str(const ut8 *in, int len, char *out);
RZ_API void rz_hex_ut2st_str(const ut64 in, RZ_INOUT char *out, const int len);
RZ_API void rz_hex_ut2st_str(const ut32 in, RZ_INOUT char *out, const int len);
RZ_API char *rz_hex_bin2strdup(const ut8 *in, int len);
RZ_API bool rz_hex_to_byte(ut8 *val, ut8 c);
RZ_API int rz_hex_str_is_valid(const char *s);
Expand Down
16 changes: 8 additions & 8 deletions librz/util/hex.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,21 +394,21 @@ RZ_API int rz_hex_bin2str(const ut8 *in, int len, char *out) {
}

/**
* \brief Takes an unsigned integer and returns the signed integer in hex format as string.
* E.g.: 0xffffffffffffffff -> "-0x1"
* \brief Takes an unsigned 32bit integer with MSB set to 1 and returns the signed integer in hex format as string.
* E.g.: 0xffffffff -> "-0x1"
*
* \param in The integer to convert to the signed string.
* \param out The buffer to write the signed hex string to.
* \param len Length of the out buffer.
* \return char* The signed integer as hex string.
*/
RZ_API void rz_hex_ut2st_str(const ut64 in, RZ_INOUT char *out, const int len) {
if (len < 20) {
RZ_LOG_FATAL("Output buffer too small for 64bit value.\n");
RZ_API void rz_hex_ut2st_str(const ut32 in, RZ_INOUT char *out, const int len) {
char tmp[12];
if (len < sizeof(tmp)) {
RZ_LOG_FATAL("Output buffer too small for negative 32bit value.\n");
}
char tmp[20];
sprintf(tmp, "-0x%x", abs((st64)in));
memcpy(out, tmp, 20);
snprintf(tmp, sizeof(tmp), "-0x%" PFMT32x, ~in + 1);
memcpy(out, tmp, sizeof(tmp));
return;
}

Expand Down