summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/kaitai/parsers/enum.c2
-rw-r--r--plugins/kaitai/parsers/struct.c2
-rw-r--r--plugins/pychrysalide/analysis/scan/scanner.c46
3 files changed, 48 insertions, 2 deletions
diff --git a/plugins/kaitai/parsers/enum.c b/plugins/kaitai/parsers/enum.c
index 267aaba..27e5660 100644
--- a/plugins/kaitai/parsers/enum.c
+++ b/plugins/kaitai/parsers/enum.c
@@ -351,7 +351,7 @@ static int compare_enum_values_by_sized_label(const sized_string_t *l, const enu
{
int result; /* Bilan à retourner */
- result = szstrcmp(l, (*b)->label);
+ result = strncmp(l->data, (*b)->label, l->len); // FIXME
return result;
diff --git a/plugins/kaitai/parsers/struct.c b/plugins/kaitai/parsers/struct.c
index 26089d3..128a788 100644
--- a/plugins/kaitai/parsers/struct.c
+++ b/plugins/kaitai/parsers/struct.c
@@ -578,7 +578,7 @@ GKaitaiEnum *g_kaitai_structure_get_enum(const GKaitaiStruct *kstruct, const siz
{
other = g_kaitai_enum_get_name(kstruct->enums[i]);
- if (szstrcmp(name, other) == 0)
+ if (strncmp(name->data, other, name->len) == 0) // FIXME
{
result = kstruct->enums[i];
g_object_ref(G_OBJECT(result));
diff --git a/plugins/pychrysalide/analysis/scan/scanner.c b/plugins/pychrysalide/analysis/scan/scanner.c
index bf5a5f5..befbc80 100644
--- a/plugins/pychrysalide/analysis/scan/scanner.c
+++ b/plugins/pychrysalide/analysis/scan/scanner.c
@@ -188,6 +188,51 @@ static PyObject *py_content_scanner_analyze(PyObject *self, PyObject *args)
/******************************************************************************
* *
+* Paramètres : self = objet Python concerné par l'appel. *
+* closure = non utilisé ici. *
+* *
+* Description : Indique le chemin d'un éventuel fichier de source. *
+* *
+* Retour : Chemin d'un éventuel fichier de définitions ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_content_scanner_get_filename(PyObject *self, void *closure)
+{
+ PyObject *result; /* Valeur à retourner */
+ GContentScanner *scanner; /* Analyseur à consulter */
+ const char *filename; /* Chemin d'accès à transmettre*/
+
+#define CONTENT_SCANNER_FILENAME_ATTRIB PYTHON_GET_DEF_FULL \
+( \
+ filename, py_content_scanner, \
+ "Provide the access path to the source file of the rules'" \
+ " definition, or *None* if these rules have not been loaded"\
+ " from memory." \
+)
+
+ scanner = G_CONTENT_SCANNER(pygobject_get(self));
+
+ filename = g_content_scanner_get_filename(scanner);
+
+ if (filename != NULL)
+ result = PyUnicode_FromString(filename);
+
+ else
+ {
+ result = Py_None;
+ Py_INCREF(result);
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : - *
* *
* Description : Fournit un accès à une définition de type à diffuser. *
@@ -206,6 +251,7 @@ PyTypeObject *get_python_content_scanner_type(void)
};
static PyGetSetDef py_content_scanner_getseters[] = {
+ CONTENT_SCANNER_FILENAME_ATTRIB,
{ NULL }
};