pidgin/pidgin

Fix sametime mime generation tests on clang.

2019-11-15, Elliott Sales de Andrade
7690a049a466
Parents fb4b0ae193c0
Children 94867e3f638a
Fix sametime mime generation tests on clang.

Apparently, it re-orders the random generator calls, resulting in
different test results, but we don't really care about actual numbers.
--- a/libpurple/protocols/sametime/im_mime.c Fri Nov 15 01:07:08 2019 -0600
+++ b/libpurple/protocols/sametime/im_mime.c Fri Nov 15 05:16:04 2019 -0500
@@ -217,8 +217,9 @@
static char *
im_mime_content_id(void)
{
- return g_strdup_printf("%03x@%05xmeanwhile",
- g_random_int() & 0xfff, g_random_int() & 0xfffff);
+ gint id = g_random_int();
+ return g_strdup_printf("%03x@%05xmeanwhile", (id & 0xfff00000) >> 20,
+ id & 0xfffff);
}
@@ -226,8 +227,9 @@
static char *
im_mime_boundary(void)
{
- return g_strdup_printf("related_MW%03x_%04x",
- g_random_int() & 0xfff, g_random_int() & 0xffff);
+ gint id = g_random_int();
+ return g_strdup_printf("related_MW%03x_%04x", (id & 0xfff0000) >> 16,
+ id & 0xffff);
}
/** create MIME image from purple image */
--- a/libpurple/protocols/sametime/tests/data/mime-basic.h Fri Nov 15 01:07:08 2019 -0600
+++ b/libpurple/protocols/sametime/tests/data/mime-basic.h Fri Nov 15 05:16:04 2019 -0500
@@ -3,32 +3,32 @@
.name = "empty",
.html = "",
.mime =
- "Content-Type: multipart/related; boundary=related_MWa2f_0aac\r\n"
+ "Content-Type: multipart/related; boundary=related_MWc7f_0aac\r\n"
"Mime-Version: 1.0\r\n"
"Content-Disposition: inline\r\n"
"\r\n"
- "--related_MWa2f_0aac\r\n"
+ "--related_MWc7f_0aac\r\n"
"Content-Type: text/html; charset=us-ascii\r\n"
"Content-Disposition: inline\r\n"
"Content-Transfer-Encoding: 7bit\r\n"
"\r\n"
"\r\n"
- "--related_MWa2f_0aac--\r\n"
+ "--related_MWc7f_0aac--\r\n"
},
{
/* A simple string. */
.name = "simple",
.html = "This is a test of the MIME encoding using a short message.",
.mime =
- "Content-Type: multipart/related; boundary=related_MWa2f_0aac\r\n"
+ "Content-Type: multipart/related; boundary=related_MWc7f_0aac\r\n"
"Mime-Version: 1.0\r\n"
"Content-Disposition: inline\r\n"
"\r\n"
- "--related_MWa2f_0aac\r\n"
+ "--related_MWc7f_0aac\r\n"
"Content-Type: text/html; charset=us-ascii\r\n"
"Content-Disposition: inline\r\n"
"Content-Transfer-Encoding: 7bit\r\n"
"\r\n"
"This is a test of the MIME encoding using a short message.\r\n"
- "--related_MWa2f_0aac--\r\n"
+ "--related_MWc7f_0aac--\r\n"
},
--- a/libpurple/protocols/sametime/tests/data/mime-image.h Fri Nov 15 01:07:08 2019 -0600
+++ b/libpurple/protocols/sametime/tests/data/mime-image.h Fri Nov 15 05:16:04 2019 -0500
@@ -5,29 +5,29 @@
"This is a test of the MIME encoding with an image: "
"<img src=\"" PURPLE_IMAGE_STORE_PROTOCOL "%u\">",
.mime =
- "Content-Type: multipart/related; boundary=related_MWa2f_0aac\r\n"
+ "Content-Type: multipart/related; boundary=related_MWc7f_0aac\r\n"
"Mime-Version: 1.0\r\n"
"Content-Disposition: inline\r\n"
"\r\n"
- "--related_MWa2f_0aac\r\n"
+ "--related_MWc7f_0aac\r\n"
"Content-Type: text/html; charset=us-ascii\r\n"
"Content-Disposition: inline\r\n"
"Content-Transfer-Encoding: 7bit\r\n"
"\r\n"
"This is a test of the MIME encoding with an image: "
- "<img src=\"cid:cc0@6a675meanwhile\">\r\n"
- "--related_MWa2f_0aac\r\n"
+ "<img src=\"cid:97c@4aa2fmeanwhile\">\r\n"
+ "--related_MWc7f_0aac\r\n"
"Content-Type: image/png; "
"name=c6e846b12072e3bdf2c8f768e776deaa94c970ad.png\r\n"
"Content-Disposition: attachment;\r\n"
"\tfilename=c6e846b12072e3bdf2c8f768e776deaa94c970ad.png\r\n"
"Content-Transfer-Encoding: base64\r\n"
- "Content-Id: <cc0@6a675meanwhile>\r\n"
+ "Content-Id: <97c@4aa2fmeanwhile>\r\n"
"\r\n"
"iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAIAAAD91JpzAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA\r\n"
"B3RJTUUH4AoCFjAiKKTJ3QAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUH\r\n"
"AAAAFklEQVQI12P4//8/AwMD47NMtZtOCwAvqQYvitHGswAAAABJRU5ErkJggg==\r\n"
"\r\n"
- "--related_MWa2f_0aac--\r\n",
+ "--related_MWc7f_0aac--\r\n",
.with_image = TRUE
},
--- a/libpurple/protocols/sametime/tests/data/mime-multiline.h Fri Nov 15 01:07:08 2019 -0600
+++ b/libpurple/protocols/sametime/tests/data/mime-multiline.h Fri Nov 15 05:16:04 2019 -0500
@@ -5,34 +5,34 @@
"This is a test of the MIME encoding using a multiline message.\n"
"This is the second line of the message.",
.mime =
- "Content-Type: multipart/related; boundary=related_MWa2f_0aac\r\n"
+ "Content-Type: multipart/related; boundary=related_MWc7f_0aac\r\n"
"Mime-Version: 1.0\r\n"
"Content-Disposition: inline\r\n"
"\r\n"
- "--related_MWa2f_0aac\r\n"
+ "--related_MWc7f_0aac\r\n"
"Content-Type: text/html; charset=us-ascii\r\n"
"Content-Disposition: inline\r\n"
"Content-Transfer-Encoding: 7bit\r\n"
"\r\n"
"This is a test of the MIME encoding using a multiline message.\r\n"
"This is the second line of the message.\r\n"
- "--related_MWa2f_0aac--\r\n"
+ "--related_MWc7f_0aac--\r\n"
},
{
/* A message that ends with a newline. */
.name = "trailing-newline",
.html = "This is a test of the MIME encoding using a multiline message.\n",
.mime =
- "Content-Type: multipart/related; boundary=related_MWa2f_0aac\r\n"
+ "Content-Type: multipart/related; boundary=related_MWc7f_0aac\r\n"
"Mime-Version: 1.0\r\n"
"Content-Disposition: inline\r\n"
"\r\n"
- "--related_MWa2f_0aac\r\n"
+ "--related_MWc7f_0aac\r\n"
"Content-Type: text/html; charset=us-ascii\r\n"
"Content-Disposition: inline\r\n"
"Content-Transfer-Encoding: 7bit\r\n"
"\r\n"
"This is a test of the MIME encoding using a multiline message.\r\n"
"\r\n"
- "--related_MWa2f_0aac--\r\n"
+ "--related_MWc7f_0aac--\r\n"
},
--- a/libpurple/protocols/sametime/tests/data/mime-utf8.h Fri Nov 15 01:07:08 2019 -0600
+++ b/libpurple/protocols/sametime/tests/data/mime-utf8.h Fri Nov 15 05:16:04 2019 -0500
@@ -3,11 +3,11 @@
.name = "utf8-hello",
.html = "Hello world, Καλημέρα κόσμε, コンニチハ.",
.mime =
- "Content-Type: multipart/related; boundary=related_MWa2f_0aac\r\n"
+ "Content-Type: multipart/related; boundary=related_MWc7f_0aac\r\n"
"Mime-Version: 1.0\r\n"
"Content-Disposition: inline\r\n"
"\r\n"
- "--related_MWa2f_0aac\r\n"
+ "--related_MWc7f_0aac\r\n"
"Content-Type: text/html; charset=us-ascii\r\n"
"Content-Disposition: inline\r\n"
"Content-Transfer-Encoding: 7bit\r\n"
@@ -16,7 +16,7 @@
"&#922;&#945;&#955;&#951;&#956;&#8051;&#961;&#945; "
"&#954;&#8057;&#963;&#956;&#949;, "
"&#12467;&#12531;&#12491;&#12481;&#12495;.\r\n"
- "--related_MWa2f_0aac--\r\n"
+ "--related_MWc7f_0aac--\r\n"
},
{
/* Hello world in UTF-8. */
@@ -27,11 +27,11 @@
"–—‘“”„†•…‰™œŠŸž€ ΑΒΓΔΩαβγδω АБВГДабвгд "
"∀∂∈ℝ∧∪≡∞ ↑↗↨↻⇣ ┐┼╔╘░►☺♀ fi�⑀₂ἠḂӥẄɐː⍎אԱა",
.mime =
- "Content-Type: multipart/related; boundary=related_MWa2f_0aac\r\n"
+ "Content-Type: multipart/related; boundary=related_MWc7f_0aac\r\n"
"Mime-Version: 1.0\r\n"
"Content-Disposition: inline\r\n"
"\r\n"
- "--related_MWa2f_0aac\r\n"
+ "--related_MWc7f_0aac\r\n"
"Content-Type: text/html; charset=us-ascii\r\n"
"Content-Disposition: inline\r\n"
"Content-Transfer-Encoding: 7bit\r\n"
@@ -45,5 +45,5 @@
"&#8593;&#8599;&#8616;&#8635;&#8675; "
"&#9488;&#9532;&#9556;&#9560;&#9617;&#9658;&#9786;&#9792; "
"&#64257;&#65533;&#9280;&#8322;&#7968;&#7682;&#1253;&#7812;&#592;&#720;&#9038;&#1488;&#1329;&#4304;\r\n"
- "--related_MWa2f_0aac--\r\n"
+ "--related_MWc7f_0aac--\r\n"
},