summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-03-08 22:05:09 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-03-08 22:05:09 (GMT)
commit29a22c425f492427f45b71de937f2d99587c8d34 (patch)
tree36e8bb3ef73bc91e812ed63205d10bfced578660 /src/common
parent674739bedc853681be5a2657a7a4f497d6e82c9b (diff)
Added a partial support of the Itanium C++ ABI mangling.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@52 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/common')
-rwxr-xr-xsrc/common/Makefile.am3
-rw-r--r--src/common/extstr.c85
-rw-r--r--src/common/extstr.h37
3 files changed, 124 insertions, 1 deletions
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index a27a192..6ad3fc3 100755
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -3,7 +3,8 @@ lib_LIBRARIES = libcommon.a
libcommon_a_SOURCES = \
dllist.h dllist.c \
- endianness.h endianness.c
+ endianness.h endianness.c \
+ extstr.h extstr.c
libcommon_a_CFLAGS = $(AM_CFLAGS)
diff --git a/src/common/extstr.c b/src/common/extstr.c
new file mode 100644
index 0000000..aba9830
--- /dev/null
+++ b/src/common/extstr.c
@@ -0,0 +1,85 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * extstr.c - extension des fonctions relatives aux chaînes
+ *
+ * Copyright (C) 2008 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 "extstr.h"
+
+
+#include <malloc.h>
+#include <string.h>
+
+
+
+/******************************************************************************
+* *
+* Paramètres : str1 = chaîne de caractères à compléter. *
+* str2 = chaîne de caractères à ajouter. *
+* *
+* Description : Complète une chaîne de caractères avec une autre. *
+* *
+* Retour : Chaîne de caractères complétée, à libérer de la mémoire. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+char *stradd(char *str1, const char *str2)
+{
+ char *result; /* Chaîne à renvoyer */
+
+ result = (char *)realloc(str1, (strlen(str1) + strlen(str2) + 1) * sizeof(char));
+
+ strcat(result, str2);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : str1 = chaîne de caractères à compléter. *
+* str2 = chaîne de caractères à ajouter. *
+* *
+* Description : Fait précéder une chaîne de caractères par une autre. *
+* *
+* Retour : Chaîne de caractères complétée, à libérer de la mémoire. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+char *strprep(char *str1, const char *str2)
+{
+ char *result; /* Chaîne à renvoyer */
+ size_t len2; /* Taille de la seconde chaîne */
+
+ result = (char *)realloc(str1, (strlen(str1) + strlen(str2) + 1) * sizeof(char));
+
+ len2 = strlen(str2);
+
+ memmove(&result[len2], result, strlen(result) + 1);
+ memcpy(result, str2, len2);
+
+ return result;
+
+}
diff --git a/src/common/extstr.h b/src/common/extstr.h
new file mode 100644
index 0000000..8975000
--- /dev/null
+++ b/src/common/extstr.h
@@ -0,0 +1,37 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * extstr.h - prototypes pour une extension des fonctions relatives aux chaînes
+ *
+ * Copyright (C) 2008 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 _COMMON_EXTSTR_H
+#define _COMMON_EXTSTR_H
+
+
+
+/* Complète une chaîne de caractères avec une autre. */
+char *stradd(char *str1, const char *str2);
+
+/* Fait précéder une chaîne de caractères par une autre. */
+char *strprep(char *, const char *);
+
+
+
+#endif /* _COMMON_EXTSTR_H */