pidgin/pidgin

Fix sametime mime generation tests on clang.

19 months ago, 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"