validate: Change IssueId type to guint32

Which is a bit more bindings-friendly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1810>
This commit is contained in:
Philippe Normand 2022-03-02 12:52:37 +00:00
parent 616d1dd6ba
commit 5ea0c20a33
5 changed files with 19 additions and 20 deletions

View file

@ -137,8 +137,8 @@ void
gst_validate_override_change_severity (GstValidateOverride * override,
GstValidateIssueId issue_id, GstValidateReportLevel new_level)
{
g_hash_table_insert (override->priv->level_override, (gpointer) issue_id,
(gpointer) new_level);
g_hash_table_insert (override->priv->level_override,
GINT_TO_POINTER (issue_id), (gpointer) new_level);
}
/*
@ -153,7 +153,7 @@ gst_validate_override_get_severity (GstValidateOverride * override,
GstValidateReportLevel *level = NULL;
if (g_hash_table_lookup_extended (override->priv->level_override,
(gpointer) issue_id, NULL, (gpointer) & level)) {
GINT_TO_POINTER (issue_id), NULL, (gpointer) & level)) {
return GPOINTER_TO_INT (level);
}

View file

@ -144,7 +144,7 @@ G_DEFINE_BOXED_TYPE (GstValidateIssue, gst_validate_issue,
(GBoxedCopyFunc) gst_validate_issue_ref,
(GBoxedFreeFunc) gst_validate_issue_unref);
GstValidateIssueId
guint32
gst_validate_issue_get_id (GstValidateIssue * issue)
{
return issue->issue_id;
@ -247,10 +247,10 @@ void
gst_validate_issue_register (GstValidateIssue * issue)
{
g_return_if_fail (g_hash_table_lookup (_gst_validate_issues,
(gpointer) gst_validate_issue_get_id (issue)) == NULL);
GINT_TO_POINTER (gst_validate_issue_get_id (issue))) == NULL);
g_hash_table_insert (_gst_validate_issues,
(gpointer) gst_validate_issue_get_id (issue), issue);
GINT_TO_POINTER (gst_validate_issue_get_id (issue)), issue);
}
#define REGISTER_VALIDATE_ISSUE(lvl,id,sum,desc) \
@ -673,7 +673,7 @@ gst_validate_report_deinit (void)
GstValidateIssue *
gst_validate_issue_from_id (GstValidateIssueId issue_id)
{
return g_hash_table_lookup (_gst_validate_issues, (gpointer) issue_id);
return g_hash_table_lookup (_gst_validate_issues, GINT_TO_POINTER (issue_id));
}
/* TODO how are these functions going to work with extensions */
@ -754,7 +754,7 @@ gst_validate_report_check_abort (GstValidateReport * report)
return FALSE;
}
GstValidateIssueId
guint32
gst_validate_report_get_issue_id (GstValidateReport * report)
{
return gst_validate_issue_get_id (report->issue);
@ -1386,7 +1386,7 @@ gst_validate_skip_test (const gchar * format, ...)
static void
print_issue (gpointer key, GstValidateIssue * issue, gpointer user_data)
{
gst_validate_printf (NULL, "\n# `%s` (%" G_GUINTPTR_FORMAT ")\n\n",
gst_validate_printf (NULL, "\n# `%s` (%" G_GUINT32_FORMAT ")\n\n",
g_quark_to_string (issue->issue_id), issue->issue_id);
gst_validate_printf (NULL, "%c%s\n\n", g_ascii_toupper (issue->summary[0]),
&issue->summary[1]);

View file

@ -25,7 +25,7 @@
#include <glib-object.h>
typedef struct _GstValidateReport GstValidateReport;
typedef guintptr GstValidateIssueId;
typedef GQuark GstValidateIssueId;
#include <gst/gst.h>
#include <gst/validate/validate-prelude.h>
@ -241,7 +241,7 @@ struct _GstValidateReport {
void gst_validate_report_add_message (GstValidateReport *report,
const gchar *message);
#define GST_VALIDATE_ISSUE_FORMAT G_GUINTPTR_FORMAT " (%s) : %s: %s"
#define GST_VALIDATE_ISSUE_FORMAT G_GUINT32_FORMAT " (%s) : %s: %s"
#define GST_VALIDATE_ISSUE_ARGS(i) gst_validate_issue_get_id (i), \
gst_validate_report_level_get_name (i->default_level), \
i->area, \
@ -257,7 +257,7 @@ void gst_validate_report_init (void);
GST_VALIDATE_API
GstValidateIssue *gst_validate_issue_from_id (GstValidateIssueId issue_id);
GST_VALIDATE_API
GstValidateIssueId gst_validate_issue_get_id (GstValidateIssue * issue);
guint32 gst_validate_issue_get_id (GstValidateIssue * issue);
GST_VALIDATE_API
void gst_validate_issue_register (GstValidateIssue * issue);
GST_VALIDATE_API
@ -282,7 +282,7 @@ GST_VALIDATE_API
GstValidateReport *gst_validate_report_ref (GstValidateReport * report);
GST_VALIDATE_API
GstValidateIssueId gst_validate_report_get_issue_id (GstValidateReport * report);
guint32 gst_validate_report_get_issue_id (GstValidateReport * report);
GST_VALIDATE_API
gboolean gst_validate_report_check_abort (GstValidateReport * report);
@ -333,4 +333,3 @@ void gst_validate_skip_test (const gchar* format, ...);
G_END_DECLS
#endif /* __GST_VALIDATE_REPORT_H__ */

View file

@ -161,7 +161,7 @@ gst_validate_reporter_get_report (GstValidateReporter * reporter,
GstValidateReporterPrivate *priv = gst_validate_reporter_get_priv (reporter);
GST_VALIDATE_REPORTER_REPORTS_LOCK (reporter);
report = g_hash_table_lookup (priv->reports, (gconstpointer) issue_id);
report = g_hash_table_lookup (priv->reports, GINT_TO_POINTER (issue_id));
GST_VALIDATE_REPORTER_REPORTS_UNLOCK (reporter);
return report;
@ -216,7 +216,7 @@ gst_validate_report_valist (GstValidateReporter * reporter,
goto done;
}
prev_report = g_hash_table_lookup (priv->reports, (gconstpointer) issue_id);
prev_report = g_hash_table_lookup (priv->reports, GINT_TO_POINTER (issue_id));
runner = gst_validate_reporter_get_runner (reporter);
if (prev_report && prev_report->level != GST_VALIDATE_REPORT_LEVEL_EXPECTED) {
@ -240,7 +240,7 @@ gst_validate_report_valist (GstValidateReporter * reporter,
}
GST_VALIDATE_REPORTER_REPORTS_LOCK (reporter);
g_hash_table_insert (priv->reports, (gpointer) issue_id, report);
g_hash_table_insert (priv->reports, GINT_TO_POINTER (issue_id), report);
GST_VALIDATE_REPORTER_REPORTS_UNLOCK (reporter);
if (runner && int_ret == GST_VALIDATE_REPORTER_REPORT) {

View file

@ -564,10 +564,10 @@ synthesize_reports (GstValidateRunner * runner, GstValidateReport * report)
GST_VALIDATE_RUNNER_LOCK (runner);
reports =
g_hash_table_lookup (runner->priv->reports_by_type,
(gconstpointer) issue_id);
GINT_TO_POINTER (issue_id));
reports = g_list_append (reports, gst_validate_report_ref (report));
g_hash_table_insert (runner->priv->reports_by_type, (gpointer) issue_id,
reports);
g_hash_table_insert (runner->priv->reports_by_type,
GINT_TO_POINTER (issue_id), reports);
GST_VALIDATE_RUNNER_UNLOCK (runner);
}