diff options
Diffstat (limited to 'src/glibext')
| -rw-r--r-- | src/glibext/Makefile.am | 1 | ||||
| -rw-r--r-- | src/glibext/gnhash.c | 52 | ||||
| -rw-r--r-- | src/glibext/gnhash.h | 37 | 
3 files changed, 90 insertions, 0 deletions
diff --git a/src/glibext/Makefile.am b/src/glibext/Makefile.am index 1e21b58..2365190 100644 --- a/src/glibext/Makefile.am +++ b/src/glibext/Makefile.am @@ -7,6 +7,7 @@ libglibext_la_SOURCES =					\  	gbufferline.h gbufferline.c			\  	gbuffersegment.h gbuffersegment.c	\  	gcodebuffer.h gcodebuffer.c			\ +	gnhash.h gnhash.c					\  	proto.h  libglibext_la_LDFLAGS =  diff --git a/src/glibext/gnhash.c b/src/glibext/gnhash.c new file mode 100644 index 0000000..cdd4dd1 --- /dev/null +++ b/src/glibext/gnhash.c @@ -0,0 +1,52 @@ + +/* OpenIDA - Outil d'analyse de fichiers binaires + * gnhash.c - nouvelle fonction offrant une empreinte constante + * + * Copyright (C) 2010 Cyrille Bagard + * + *  This file is part of OpenIDA. + * + *  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 <http://www.gnu.org/licenses/>. + */ + + +#include "gnhash.h" + + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : v = pointeur quelconque.                                     * +*                                                                             * +*  Description : Convertit un pointeur en une empreinte constante.            * +*                                                                             * +*  Retour      : 2.                                                           * +*                                                                             * +*  Remarques   : L'algorithme actuel (12/11/10) de la GLib impose qu'une      * +*                même empreinte impose une même clef. Deux clefs distinctes,  * +*                pourtant égales, ont deux empreintes distinctes, donc on     * +*                définit une seule empreinte possible. Pas terrible, mais     * +*                cela répond au besoin (association simple clef <-> valeur).  * +*                                                                             * +******************************************************************************/ + +guint g_constant_hash(gconstpointer v) +{ +    /** +     * La valeur doit être supérieure à 1 pour ne +     * pas être totalement inéfficace. +     */ +    return 2; + +} diff --git a/src/glibext/gnhash.h b/src/glibext/gnhash.h new file mode 100644 index 0000000..4c49357 --- /dev/null +++ b/src/glibext/gnhash.h @@ -0,0 +1,37 @@ + +/* OpenIDA - Outil d'analyse de fichiers binaires + * gnhash.h - prototype pour une nouvelle fonction offrant une empreinte constante + * + * Copyright (C) 2010 Cyrille Bagard + * + *  This file is part of OpenIDA. + * + *  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 <http://www.gnu.org/licenses/>. + */ + + +#ifndef _GLIBEXT_GNHASH_H +#define _GLIBEXT_GNHASH_H + + +#include <glib-object.h> + + + +/* Convertit un pointeur en une empreinte constante. */ +guint g_constant_hash(gconstpointer); + + + +#endif  /* _GLIBEXT_GNHASH_H */  | 
