#endif
#include <stdio.h>
+#include <stdint.h>
#include <stdbool.h>
#include <ctype.h> /* For isprint */
#include <zlib.h> /* For crc32 routine */
struct memwin_infos_t {
GtkWidget *memlist;
int data_rows;
- u_int32_t *crc;
+ uint32_t *crc;
int crc_init;
};
gpointer memory_id_ptr;
GtkTreeIter iter;
int address;
- u_int8_t old;
+ uint8_t old;
int new;
char *str;
/* Get base address. */
gtk_tree_model_get(model, &iter, COL_ADDRESS, &str, -1);
+
+ /* No need to check error, has already been validated. */
address = asciihex2int(str);
/* Convert column number (1, 2, 3...) to index (0, 1, 2...) */
/* Convert new value (asciihex) to integer. */
new = asciihex2int(new_str);
- if ((new < 0) || (new > 255)) {
- log_info(" new value: out of range");
- new = old; /* Put back old value... */
+ if (asciihex2int_get_error()) {
+ log_warn(" new value: invalid");
+ return;
+ } else if ((new < 0) || (new > 255)) {
+ log_warn(" new value: out of range");
+ return;
} else {
log_info(" new value: $%02X", new);
}
if (memwin_infos->crc)
free(memwin_infos->crc);
- memwin_infos->crc = malloc(memwin_infos->data_rows * sizeof(u_int32_t));
+ memwin_infos->crc = malloc(memwin_infos->data_rows * sizeof(uint32_t));
memwin_infos->crc_init = false;
}
memwin_row_changed(enum mem_id_t memory_id, int row, unsigned int address)
{
int row_changed;
- u_int32_t crc_new = 0;
- u_int8_t *buf8;
+ uint32_t crc_new = 0;
+ uint8_t *buf8;
buf8 = mem_getbuf(memory_id, address);
crc_new = crc32(0L, Z_NULL, 0);
gtk_list_store_set(store, &iter, COL_ADDRESS, str, -1);
for (col = 0; col < cfg->bytes_per_row; col++) {
- u_int8_t data;
+ uint8_t data;
data = mem_read8(memory_id, address + col);