<commit_before>/*
 * Copyright (C) 2017-2020 <NAME> <<EMAIL>>
 *
 * SPDX-License-Identifier: LGPL-2.1+
 */

#define G_LOG_DOMAIN				"FuKeyring"

#include <config.h>

#include "fwupd-error.h"

#include "fu-keyring-utils.h"

/**
 * fu_keyring_get_release_flags:
 * @release: A #XbNode, e.g. %FWUPD_KEYRING_KIND_GPG
 * @flags: A #FwupdReleaseFlags, e.g. %FWUPD_RELEASE_FLAG_TRUSTED_PAYLOAD
 * @error: A #GError, or %NULL
 *
 * Uses the correct keyring to get the trust flags for a given release.
 *
 * Returns: %TRUE if @flags has been set
 **/
gboolean
fu_keyring_get_release_flags (XbNode *release,
			      FwupdReleaseFlags *flags,
			      GError **error)
{
	GBytes *blob;

	blob = g_object_get_data (G_OBJECT (release), "fwupd::ReleaseFlags");
	if (blob == NULL) {
		g_debug ("no fwupd::ReleaseFlags set by loader");
		return TRUE;
	}
	if (g_bytes_get_size (blob) != sizeof(FwupdReleaseFlags)) {
		g_set_error_literal (error,
				     FWUPD_ERROR,
				     FWUPD_ERROR_INVALID_FILE,
				     "invalid fwupd::ReleaseFlags set by loader");
		return FALSE;
	}
	memcpy (flags, g_bytes_get_data (blob, NULL), sizeof(FwupdReleaseFlags));
	return TRUE;
}<commit_msg>trivial: Do not inform if no fwupd::ReleaseFlags were set<commit_after>/*
 * Copyright (C) 2017-2020 <NAME> <<EMAIL>>
 *
 * SPDX-License-Identifier: LGPL-2.1+
 */

#define G_LOG_DOMAIN				"FuKeyring"

#include <config.h>

#include "fwupd-error.h"

#include "fu-keyring-utils.h"

/**
 * fu_keyring_get_release_flags:
 * @release: A #XbNode, e.g. %FWUPD_KEYRING_KIND_GPG
 * @flags: A #FwupdReleaseFlags, e.g. %FWUPD_RELEASE_FLAG_TRUSTED_PAYLOAD
 * @error: A #GError, or %NULL
 *
 * Uses the correct keyring to get the trust flags for a given release.
 *
 * Returns: %TRUE if @flags has been set
 **/
gboolean
fu_keyring_get_release_flags (XbNode *release,
			      FwupdReleaseFlags *flags,
			      GError **error)
{
	GBytes *blob;

	blob = g_object_get_data (G_OBJECT (release), "fwupd::ReleaseFlags");
	if (blob == NULL)
		return TRUE;
	if (g_bytes_get_size (blob) != sizeof(FwupdReleaseFlags)) {
		g_set_error_literal (error,
				     FWUPD_ERROR,
				     FWUPD_ERROR_INVALID_FILE,
				     "invalid fwupd::ReleaseFlags set by loader");
		return FALSE;
	}
	memcpy (flags, g_bytes_get_data (blob, NULL), sizeof(FwupdReleaseFlags));
	return TRUE;
}
{'fraction_non_alphanumeric': 0.12721765469493726, 'fraction_numerical': 0.00865426222414539, 'mean_word_length': 4.115044247787611, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4974448', 'n_tokens_mistral': 966, 'n_tokens_neox': 892, 'n_words': 206}