diff options
Diffstat (limited to 'src/analysis')
| -rw-r--r-- | src/analysis/db/items/comment.c | 28 | 
1 files changed, 18 insertions, 10 deletions
| diff --git a/src/analysis/db/items/comment.c b/src/analysis/db/items/comment.c index 59fc6b7..394abe2 100644 --- a/src/analysis/db/items/comment.c +++ b/src/analysis/db/items/comment.c @@ -38,6 +38,7 @@  #include "../../human/asm/lang.h"  #include "../../../common/array.h"  #include "../../../common/extstr.h" +#include "../../../glibext/gbinarycursor.h"  #include "../../../glibext/linegen-int.h" @@ -133,10 +134,10 @@ static void g_db_comment_update_count_lines(GDbComment *);  static size_t g_db_comment_count_lines(const GDbComment *);  /* Retrouve l'emplacement correspondant à une position donnée. */ -static void g_db_comment_compute_addr(const GDbComment *, gint, vmpa2t *, size_t, size_t); +static void g_db_comment_compute_cursor(const GDbComment *, gint, size_t, size_t, GLineCursor **);  /* Détermine si le conteneur s'inscrit dans une plage donnée. */ -static int g_db_comment_contains_addr(const GDbComment *, const vmpa2t *, size_t, size_t); +static int g_db_comment_contains_cursor(const GDbComment *, size_t, size_t, const GLineCursor *);  /* Renseigne sur les propriétés liées à un générateur. */  static BufferLineFlags g_db_comment_get_flags(const GDbComment *, size_t, size_t); @@ -276,8 +277,8 @@ static void g_db_comment_init(GDbComment *comment)  static void g_db_comment_interface_init(GLineGeneratorInterface *iface)  {      iface->count = (linegen_count_lines_fc)g_db_comment_count_lines; -    iface->compute = (linegen_compute_fc)g_db_comment_compute_addr; -    iface->contains = (linegen_contains_fc)g_db_comment_contains_addr; +    iface->compute = (linegen_compute_fc)g_db_comment_compute_cursor; +    iface->contains = (linegen_contains_fc)g_db_comment_contains_cursor;      iface->get_flags = (linegen_get_flags_fc)g_db_comment_get_flags;      iface->print = (linegen_print_fc)g_db_comment_print; @@ -1310,9 +1311,9 @@ static size_t g_db_comment_count_lines(const GDbComment *comment)  *                                                                             *  *  Paramètres  : comment = générateur à consulter.                            *  *                x       = position géographique sur la ligne concernée.      * -*                addr    = position en mémoire à analyser.                    *  *                index   = indice de cette même ligne dans le tampon global.  *  *                repeat  = indice d'utilisations successives du générateur.   * +*                cursor  = emplacement à constituer. [OUT]                    *  *                                                                             *  *  Description : Retrouve l'emplacement correspondant à une position donnée.  *  *                                                                             * @@ -1322,9 +1323,11 @@ static size_t g_db_comment_count_lines(const GDbComment *comment)  *                                                                             *  ******************************************************************************/ -static void g_db_comment_compute_addr(const GDbComment *comment, gint x, vmpa2t *addr, size_t index, size_t repeat) +static void g_db_comment_compute_cursor(const GDbComment *comment, gint x, size_t index, size_t repeat, GLineCursor **cursor)  { -    copy_vmpa(addr, &comment->addr); +    *cursor = g_binary_cursor_new(); + +    g_binary_cursor_update(G_BINARY_CURSOR(*cursor), &comment->addr);  } @@ -1332,9 +1335,9 @@ static void g_db_comment_compute_addr(const GDbComment *comment, gint x, vmpa2t  /******************************************************************************  *                                                                             *  *  Paramètres  : comment = générateur à consulter.                            * -*                addr    = position en mémoire à analyser.                    *  *                index   = indice de cette même ligne dans le tampon global.  *  *                repeat  = indice d'utilisations successives du générateur.   * +*                cursor  = emplacement à analyser.                            *  *                                                                             *  *  Description : Détermine si le conteneur s'inscrit dans une plage donnée.   *  *                                                                             * @@ -1344,11 +1347,16 @@ static void g_db_comment_compute_addr(const GDbComment *comment, gint x, vmpa2t  *                                                                             *  ******************************************************************************/ -static int g_db_comment_contains_addr(const GDbComment *comment, const vmpa2t *addr, size_t index, size_t repeat) +static int g_db_comment_contains_cursor(const GDbComment *comment, size_t index, size_t repeat, const GLineCursor *cursor)  {      int result;                             /* Conclusion à retourner      */ +    vmpa2t addr;                            /* Autre emplacement à comparer*/ + +    assert(G_IS_BINARY_CURSOR(cursor)); + +    g_binary_cursor_get_info(G_BINARY_CURSOR(cursor), &addr); -    result = cmp_vmpa(addr, &comment->addr); +    result = cmp_vmpa(&addr, &comment->addr);      return result; | 
