summaryrefslogtreecommitdiff
path: root/src/glibext/gbufferline.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-07-24 18:43:55 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-07-24 18:43:55 (GMT)
commit156d2e2f6beda2302552ac79678494d914fda05b (patch)
tree021825960b7ac3315a336fc085a4f1d07c05df39 /src/glibext/gbufferline.c
parent21537636cd8318cf5a720211619ad3c3023b52e9 (diff)
Replaced all remaining raw accesses to binary contents with the GBinContent wrapper in binary formats.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@555 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/glibext/gbufferline.c')
-rw-r--r--src/glibext/gbufferline.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/glibext/gbufferline.c b/src/glibext/gbufferline.c
index 238bfb3..859b6ac 100644
--- a/src/glibext/gbufferline.c
+++ b/src/glibext/gbufferline.c
@@ -621,8 +621,7 @@ void g_buffer_line_fill_mrange(GBufferLine *line, MemoryDataSize psize, MemoryDa
* Paramètres : line = ligne à venir compléter. *
* psize = taille souhaitée de l'impression des positions. *
* vsize = taille souhaitée de l'impression des adresses. *
-* content = contenu binaire global. *
-* length = taille de l'extrait de code à afficher. *
+* content = contenu binaire global à venir lire. *
* full = la portion est assez courte pour être entière ? *
* *
* Description : Construit le tronc commun d'une ligne d'instruction. *
@@ -633,17 +632,17 @@ void g_buffer_line_fill_mrange(GBufferLine *line, MemoryDataSize psize, MemoryDa
* *
******************************************************************************/
-void g_buffer_line_fill_for_instr(GBufferLine *line, MemoryDataSize psize, MemoryDataSize vsize, const bin_t *content, off_t length, bool full)
+void g_buffer_line_fill_for_instr(GBufferLine *line, MemoryDataSize psize, MemoryDataSize vsize, const GBinContent *content, bool full)
{
+ phys_t length; /* Taille de la couverture */
size_t required; /* Taille de traitement requise*/
char static_buffer[64]; /* Petit tampon local rapide */
char *bin_code; /* Tampon utilisé pour le code */
- off_t start; /* Début de traitement */
- off_t end; /* Limite de traitement */
- off_t i; /* Boucle de parcours #1 */
- char *iter; /* Boucle de parcours #2 */
+ vmpa2t pos; /* Boucle de parcours #1 */
+ phys_t i; /* Boucle de parcours #2 */
+ char *iter; /* Boucle de parcours #3 */
int ret; /* Progression dans l'écriture */
- bin_t byte; /* Octet à représenter */
+ uint8_t byte; /* Octet à représenter */
static const char *charset = "0123456789abcdef";
@@ -653,6 +652,8 @@ void g_buffer_line_fill_for_instr(GBufferLine *line, MemoryDataSize psize, Memor
/* Détermination du réceptacle */
+ length = get_mrange_length(&line->range);
+
required = length * 3 + 3;
if (required <= sizeof(static_buffer))
@@ -662,17 +663,22 @@ void g_buffer_line_fill_for_instr(GBufferLine *line, MemoryDataSize psize, Memor
/* Code brut */
- start = get_phy_addr(get_mrange_addr(&line->range));
- end = start + length;
+ copy_vmpa(&pos, get_mrange_addr(&line->range));
- for (i = start, iter = bin_code; i < end; i++, iter += ret)
+ for (i = 0, iter = bin_code; i < length; i++, iter += ret)
{
- byte = content[i];
-
- iter[0] = charset[byte >> 4];
- iter[1] = charset[byte & 0x0f];
+ if (!g_binary_content_read_u8(content, &pos, &byte))
+ {
+ iter[0] = '?';
+ iter[1] = '?';
+ }
+ else
+ {
+ iter[0] = charset[byte >> 4];
+ iter[1] = charset[byte & 0x0f];
+ }
- if ((i + 1) < end)
+ if ((i + 1) < length)
{
iter[2] = ' ';
ret = 3;