Compare checksums without respecting case-sensitivity

Upper-case checksums would always fail to verify.
This commit is contained in:
Christian Dywan 2011-08-02 22:55:46 +02:00
parent 8c7f255c7e
commit d3f27e54f8

View file

@ -150,7 +150,8 @@ midori_transferbar_download_notify_status_cb (WebKitDownload* download,
(guchar*)contents, length); (guchar*)contents, length);
g_free (filename); g_free (filename);
g_free (contents); g_free (contents);
if (!y || !g_str_equal (fingerprint[1], checksum)) /* Checksums are case-insensitive */
if (!y || g_ascii_strcasecmp (fingerprint[1], checksum) != 0)
gtk_image_set_from_stock (GTK_IMAGE (icon), gtk_image_set_from_stock (GTK_IMAGE (icon),
GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_MENU); GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_MENU);
g_free (checksum); g_free (checksum);
@ -169,7 +170,8 @@ midori_transferbar_download_notify_status_cb (WebKitDownload* download,
gchar* checksum = g_compute_checksum_for_data (G_CHECKSUM_SHA1, gchar* checksum = g_compute_checksum_for_data (G_CHECKSUM_SHA1,
(guchar*)contents, length); (guchar*)contents, length);
g_free (contents); g_free (contents);
if (!y || !g_str_equal (fingerprint[1], checksum)) /* Checksums are case-insensitive */
if (!y || g_ascii_strcasecmp (fingerprint[1], checksum) != 0)
gtk_image_set_from_stock (GTK_IMAGE (icon), gtk_image_set_from_stock (GTK_IMAGE (icon),
GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_MENU); GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_MENU);
g_free (checksum); g_free (checksum);