Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Shawn Webb
Fwupd
Commits
e979bb32
Commit
e979bb32
authored
Jun 07, 2017
by
Richard Hughes
Browse files
trivial: Never allow duplicate checksums to be added to devices or releases
parent
cffef265
Changes
2
Hide whitespace changes
Inline
Side-by-side
libfwupd/fwupd-device.c
View file @
e979bb32
...
...
@@ -88,6 +88,11 @@ fwupd_device_add_checksum (FwupdDevice *device, const gchar *checksum)
FwupdDevicePrivate
*
priv
=
GET_PRIVATE
(
device
);
g_return_if_fail
(
FWUPD_IS_DEVICE
(
device
));
g_return_if_fail
(
checksum
!=
NULL
);
for
(
guint
i
=
0
;
i
<
priv
->
checksums
->
len
;
i
++
)
{
const
gchar
*
checksum_tmp
=
g_ptr_array_index
(
priv
->
checksums
,
i
);
if
(
g_strcmp0
(
checksum_tmp
,
checksum
)
==
0
)
return
;
}
g_ptr_array_add
(
priv
->
checksums
,
g_strdup
(
checksum
));
}
...
...
libfwupd/fwupd-release.c
View file @
e979bb32
...
...
@@ -192,6 +192,11 @@ fwupd_release_add_checksum (FwupdRelease *release, const gchar *checksum)
FwupdReleasePrivate
*
priv
=
GET_PRIVATE
(
release
);
g_return_if_fail
(
FWUPD_IS_RELEASE
(
release
));
g_return_if_fail
(
checksum
!=
NULL
);
for
(
guint
i
=
0
;
i
<
priv
->
checksums
->
len
;
i
++
)
{
const
gchar
*
checksum_tmp
=
g_ptr_array_index
(
priv
->
checksums
,
i
);
if
(
g_strcmp0
(
checksum_tmp
,
checksum
)
==
0
)
return
;
}
g_ptr_array_add
(
priv
->
checksums
,
g_strdup
(
checksum
));
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment