diff options
| author | Cyrille Bagard <nocbos@gmail.com> | 2019-09-11 22:08:42 (GMT) | 
|---|---|---|
| committer | Cyrille Bagard <nocbos@gmail.com> | 2019-09-11 22:08:42 (GMT) | 
| commit | 1c2949f6828b995c7b9f8feba8fd7214f52f8f4d (patch) | |
| tree | 0bdff13f6ac8d87725d6783a2f1ecc7511426cd1 /src/analysis/db/items | |
| parent | 83faef9c8f78b20cb031af686f763cfb215cf9d7 (diff) | |
Built suitable dynamic labels for bookmarks.
Diffstat (limited to 'src/analysis/db/items')
| -rw-r--r-- | src/analysis/db/items/bookmark.c | 27 | ||||
| -rw-r--r-- | src/analysis/db/items/comment.c | 9 | ||||
| -rw-r--r-- | src/analysis/db/items/move.c | 9 | ||||
| -rw-r--r-- | src/analysis/db/items/switcher.c | 9 | 
4 files changed, 41 insertions, 13 deletions
| diff --git a/src/analysis/db/items/bookmark.c b/src/analysis/db/items/bookmark.c index 819528d..5715737 100644 --- a/src/analysis/db/items/bookmark.c +++ b/src/analysis/db/items/bookmark.c @@ -83,7 +83,7 @@ static bool g_db_bookmark_unpack(GDbBookmark *, packed_buffer *);  static bool g_db_bookmark_pack(const GDbBookmark *, packed_buffer *);  /* Construit la description humaine d'un signet sur un tampon. */ -static void g_db_bookmark_build_label(GDbBookmark *); +static char *g_db_bookmark_build_label(GDbBookmark *);  /* Exécute un signet sur un tampon de binaire chargé. */  static bool g_db_bookmark_run(GDbBookmark *, GLoadedBinary *, bool *, bool); @@ -414,15 +414,34 @@ static bool g_db_bookmark_pack(const GDbBookmark *bookmark, packed_buffer *pbuf)  *                                                                             *  *  Description : Construit la description humaine d'un signet sur un tampon.  *  *                                                                             * -*  Retour      : -                                                            * +*  Retour      : Chaîne de caractère correspondante.                          *  *                                                                             *  *  Remarques   : -                                                            *  *                                                                             *  ******************************************************************************/ -static void g_db_bookmark_build_label(GDbBookmark *bookmark) +static char *g_db_bookmark_build_label(GDbBookmark *bookmark)  { -    asprintf(&G_DB_ITEM(bookmark)->label, _("Bookmark \"%s\""), get_rle_string(&bookmark->comment)); +    char *result;                           /* Description à retourner     */ +    DbItemFlags flags;                      /* Propriétés de l'élément     */ +    const char *prefix;                     /* Préfixe à ajouter           */ +    const char *text;                       /* Commentaire associé         */ + +    flags = g_db_item_get_flags(G_DB_ITEM(bookmark)); + +    if (flags & DIF_ERASER) +        prefix = _("Removed"); +    else +        prefix = _("Created"); + +    text = get_rle_string(&bookmark->comment); + +    if (text != NULL) +        asprintf(&result, _("%s bookmark \"%s\""), prefix, text); +    else +        asprintf(&result, _("%s empty bookmark"), prefix); + +    return result;  } diff --git a/src/analysis/db/items/comment.c b/src/analysis/db/items/comment.c index 331ff2d..22ae46f 100644 --- a/src/analysis/db/items/comment.c +++ b/src/analysis/db/items/comment.c @@ -102,7 +102,7 @@ static bool g_db_comment_unpack(GDbComment *, packed_buffer *);  static bool g_db_comment_pack(GDbComment *, packed_buffer *);  /* Construit la description humaine d'un commentaire. */ -static void g_db_comment_build_label(GDbComment *); +static char *g_db_comment_build_label(GDbComment *);  /* Exécute l'impression de commentaire dans du code de binaire. */  static bool g_db_comment_run(GDbComment *, GLoadedBinary *, bool); @@ -581,14 +581,15 @@ static bool g_db_comment_pack(GDbComment *comment, packed_buffer *pbuf)  *                                                                             *  *  Description : Construit la description humaine d'un commentaire.           *  *                                                                             * -*  Retour      : -                                                            * +*  Retour      : Chaîne de caractère correspondante.                          *  *                                                                             *  *  Remarques   : -                                                            *  *                                                                             *  ******************************************************************************/ -static void g_db_comment_build_label(GDbComment *comment) +static char *g_db_comment_build_label(GDbComment *comment)  { +#if 0      VMPA_BUFFER(loc);                       /* Indication de position      */      size_t count;                           /* Nombre d'éléments textuels  */ @@ -608,6 +609,8 @@ static void g_db_comment_build_label(GDbComment *comment)          else              asprintf(&G_DB_ITEM(comment)->label, _("Enter comment area at %s"), loc);      } +#endif +    return NULL;  } diff --git a/src/analysis/db/items/move.c b/src/analysis/db/items/move.c index 0c53e67..c213786 100644 --- a/src/analysis/db/items/move.c +++ b/src/analysis/db/items/move.c @@ -84,7 +84,7 @@ static bool g_db_move_unpack(GDbMove *, packed_buffer *);  static bool g_db_move_pack(const GDbMove *, packed_buffer *);  /* Construit la description humaine d'un déplacement. */ -static void g_db_move_build_label(GDbMove *); +static char *g_db_move_build_label(GDbMove *);  /* Exécute un déplacement dans une zone de code. */  static bool g_db_move_run(const GDbMove *, GLineCursor *); @@ -380,14 +380,15 @@ static bool g_db_move_pack(const GDbMove *move, packed_buffer *pbuf)  *                                                                             *  *  Description : Construit la description humaine d'un déplacement.           *  *                                                                             * -*  Retour      : -                                                            * +*  Retour      : Chaîne de caractère correspondante.                          *  *                                                                             *  *  Remarques   : -                                                            *  *                                                                             *  ******************************************************************************/ -static void g_db_move_build_label(GDbMove *move) +static char *g_db_move_build_label(GDbMove *move)  { +#if 0      char *src_label;                        /* Indication de position #1   */      char *dest_label;                       /* Indication de position #2   */ @@ -398,6 +399,8 @@ static void g_db_move_build_label(GDbMove *move)      free(src_label);      free(dest_label); +#endif +    return NULL;  } diff --git a/src/analysis/db/items/switcher.c b/src/analysis/db/items/switcher.c index b786182..49486f4 100644 --- a/src/analysis/db/items/switcher.c +++ b/src/analysis/db/items/switcher.c @@ -84,7 +84,7 @@ static bool g_db_switcher_unpack(GDbSwitcher *, packed_buffer *);  static bool g_db_switcher_pack(const GDbSwitcher *, packed_buffer *);  /* Construit la description humaine d'un signet sur un tampon. */ -static void g_db_switcher_build_label(GDbSwitcher *); +static char *g_db_switcher_build_label(GDbSwitcher *);  /* Exécute une bascule d'affichage d'opérande sur un binaire. */  static bool g_db_switcher_run(GDbSwitcher *, GLoadedBinary *, ImmOperandDisplay *, ImmOperandDisplay); @@ -450,14 +450,15 @@ static bool g_db_switcher_pack(const GDbSwitcher *switcher, packed_buffer *pbuf)  *                                                                             *  *  Description : Construit la description humaine d'un signet sur un tampon.  *  *                                                                             * -*  Retour      : -                                                            * +*  Retour      : Description humaine mise en place à libérer après usage.     *  *                                                                             *  *  Remarques   : -                                                            *  *                                                                             *  ******************************************************************************/ -static void g_db_switcher_build_label(GDbSwitcher *switcher) +static char *g_db_switcher_build_label(GDbSwitcher *switcher)  { +#if 0      VMPA_BUFFER(loc);                       /* Indication de position      */      vmpa2_to_string(&switcher->addr, MDS_UNDEFINED, loc, NULL); @@ -483,6 +484,8 @@ static void g_db_switcher_build_label(GDbSwitcher *switcher)              assert(false);              break;      } +#endif +    return NULL;  } | 
