Skip to content

Commit

Permalink
Fixed wrong hex display
Browse files Browse the repository at this point in the history
  • Loading branch information
DevManu-de committed Aug 17, 2023
1 parent a09ab87 commit 378022b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"makefile.launchConfigurations": [
{
"cwd": "/home/manuel/Documents/code/c/projects/hexify/output",
"binaryPath": "/home/manuel/Documents/code/c/projects/hexify/output/hexify",
"binaryArgs": []
}
],
"cmake.configureOnOpen": true
}
2 changes: 1 addition & 1 deletion include/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#define VERSION "0.2.2"

typedef char byte;
typedef unsigned char byte;

enum errcodes {

Expand Down
4 changes: 2 additions & 2 deletions src/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ void gui_draw_hex(byte *file, size_t file_current_offset, size_t file_size) {
for (i = 0; i < file_draw_size; ++line) {
/* Prints the characters in and byte numbers */
for (size_t j = 0; (j < hex_per_line) && (i + j < file_draw_size); ++j) {
/* Display the hex numbers and 0 if number is negativ*/
wprintw(hex, "%02x", file[i+j] < 0 ? 0 : file[i+j]);
/* Display the hex numbers */
wprintw(hex, "%02X", file[i+j]);
if (j < hex_per_line-1) {
wprintw(hex, " ");
} else {
Expand Down

0 comments on commit 378022b

Please sign in to comment.