From a6bedf6104ccd7d8050e9d6a58f32c0827e3383c Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Wed, 25 Mar 2015 22:24:41 +0000 Subject: Fixed a regression by taking care of results before going to a error exit. git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@494 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a --- ChangeLog | 9 +++ tools/d2c/conv.c | 2 +- tools/d2c/macros.c | 167 ----------------------------------------------------- tools/d2c/macros.h | 30 ---------- 4 files changed, 10 insertions(+), 198 deletions(-) delete mode 100644 tools/d2c/macros.c delete mode 100644 tools/d2c/macros.h diff --git a/ChangeLog b/ChangeLog index 64ba27d..e0c3655 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +15-03-25 Cyrille Bagard + + * tools/d2c/conv.c: + Fix a regression by taking care of results before going to a error exit. + + * tools/d2c/macros.c: + * tools/d2c/macros.h: + Deleted entries: replaced a long time ago by the 'pproc.[ch]' files. + 15-03-21 Cyrille Bagard * src/analysis/blocks/flow.c: diff --git a/tools/d2c/conv.c b/tools/d2c/conv.c index 9947593..3fae6df 100644 --- a/tools/d2c/conv.c +++ b/tools/d2c/conv.c @@ -358,7 +358,7 @@ bool define_conv_func(conv_func *func, bool last, bool internal, int fd, const c { /* Si l'on doit manipuler une propriété d'instructon... */ if (internal) - result = call_instr_func(callable, func->args, fd, bits, list, pp); + result = checked_call_instr_func(callable, func->args, fd, bits, list, pp); /* Si on doit constituer un opérande à ajouter... */ else diff --git a/tools/d2c/macros.c b/tools/d2c/macros.c deleted file mode 100644 index b1c44f0..0000000 --- a/tools/d2c/macros.c +++ /dev/null @@ -1,167 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * pproc.c - remplacements à la volée de chaînes de caractères - * - * Copyright (C) 2014 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * OpenIDA is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * OpenIDA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see . - */ - - -#include "pproc.h" - - -#include - - - - - - -/* Conversion des chaînes en chaînes */ -typedef struct _string_exch -{ - const char *src; /* Chaîne à trouver */ - const char *dest; /* Chaîne de remplacement */ - -} string_exch; - - -/* Pré-processeur avec support des macros */ -struct _pre_processor -{ - string_exch *macros; /* Remplacements de chaînes */ - size_t macros_count; /* Nombre de ces remplacements */ - - - -} - - - - - - -/****************************************************************************** -* * -* Paramètres : - * -* * -* Description : Crée un nouveau suivi de l'encodage d'une instruction. * -* * -* Retour : Nouvelle structure prête à emploi. * -* * -* Remarques : - * -* * -******************************************************************************/ - -encoding_spec *create_encoding_spec(void) -{ - encoding_spec *result; /* Définition vierge à renvoyer*/ - - result = (encoding_spec *)calloc(1, sizeof(encoding_spec)); - - result->bits = create_coding_bits(); - result->syntax = create_asm_syntax(); - result->conversions = create_conv_list(); - result->rules = create_decoding_rules(); - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : spec = spécification d'encodage à libérer de la mémoire. * -* * -* Description : Supprime de la mémoire un suivi d'encodage d'une instruction.* -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void delete_encoding_spec(encoding_spec *spec) -{ - delete_coding_bits(spec->bits); - delete_asm_syntax(spec->syntax); - delete_conv_list(spec->conversions); - delete_decoding_rules(spec->rules); - - free(spec); - -} - - - -/****************************************************************************** -* * -* Paramètres : coder = gestion par la machine en remplacement de l'humain. * -* src = chaîne à remplacer dans les définitions. * -* dest = chaîne de remplacement. * -* * -* Description : Constitue la matière d'un système de macros. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void define_macro_for_coder(rented_coder *coder, const char *src, const char *dest) -{ - string_exch *macro; /* Nouvelle macro à constituer */ - - coder->macros = (string_exch *)realloc(coder->macros, ++coder->macros_count * sizeof(string_exch)); - - macro = &coder->macros[coder->macros_count - 1]; - - macro->src = src; - macro->dest = dest; - -} - - -/****************************************************************************** -* * -* Paramètres : coder = gestion par la machine en remplacement de l'humain. * -* src = chaîne à remplacer dans les définitions. * -* * -* Description : Recherche l'existence d'une macro pour un remplacement. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static const char *find_macro_in_coder(const rented_coder *coder, const char *src) -{ - const char *result; /* Trouvaille à renvoyer */ - size_t i; /* Boucle de parcours */ - - result = NULL; - - for (i = 0; i < coder->macros_count && result == NULL; i++) - if (strcmp(coder->macros[i].src, src) == 0) - result = coder->macros[i].dest; - - return result; - -} - - diff --git a/tools/d2c/macros.h b/tools/d2c/macros.h deleted file mode 100644 index 3755f00..0000000 --- a/tools/d2c/macros.h +++ /dev/null @@ -1,30 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * macros.h - prototypes pour les remplacements à la volée de chaînes de caractères - * - * Copyright (C) 2014 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * OpenIDA is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * OpenIDA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see . - */ - - -#ifndef _TOOLS_MACROS_H -#define _TOOLS_MACROS_H - - - - -#endif /* _TOOLS_MACROS_H */ -- cgit v0.11.2-87-g4458