[glib/pgriffis/wip/resolver-https] More review fixes



commit ab79537c3a11f7d92ac37548913cd2ecc7a179ac
Author: Patrick Griffis <pgriffis igalia com>
Date:   Wed Dec 15 11:04:39 2021 -0600

    More review fixes

 gio/tests/gresolver.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/gio/tests/gresolver.c b/gio/tests/gresolver.c
index 08ebd1043..78c8248ea 100644
--- a/gio/tests/gresolver.c
+++ b/gio/tests/gresolver.c
@@ -38,18 +38,18 @@ static void
 dns_builder_add_uint16 (GByteArray *builder,
                         guint16     value)
 {
-  dns_builder_add_uint8 (builder, (value & 0xFF00) >> 8);
-  dns_builder_add_uint8 (builder, (value & 0xFF));
+    dns_builder_add_uint8 (builder, (value >> 8)  & 0xFF);
+    dns_builder_add_uint8 (builder, (value)       & 0xFF);
 }
 
 static void
 dns_builder_add_uint32 (GByteArray *builder,
                         guint32     value)
 {
-    dns_builder_add_uint8 (builder, (value & 0xFF000000) >> 24);
-    dns_builder_add_uint8 (builder, (value & 0xFF0000) >> 16);
-    dns_builder_add_uint8 (builder, (value & 0xFF00) >> 16);
-    dns_builder_add_uint8 (builder, (value & 0xFF) >> 16);
+    dns_builder_add_uint8 (builder, (value >> 24) & 0xFF);
+    dns_builder_add_uint8 (builder, (value >> 16) & 0xFF);
+    dns_builder_add_uint8 (builder, (value >> 8)  & 0xFF);
+    dns_builder_add_uint8 (builder, (value)       & 0xFF);
 }
 
 static void
@@ -64,7 +64,7 @@ dns_builder_add_length_prefixed_string (GByteArray *builder,
     dns_builder_add_uint8 (builder, length);
 
     /* Don't include trailing NUL */
-    g_byte_array_append (builder, string, length);
+    g_byte_array_append (builder, (const guchar *)string, length);
 }
 
 static void
@@ -77,7 +77,7 @@ dns_builder_add_domain (GByteArray *builder,
   ret = dn_comp (string, buffer, sizeof (buffer), NULL, NULL);
   g_assert (ret != -1);
 
-  g_byte_array_append (builder, (char *)buffer, ret);
+  g_byte_array_append (builder, buffer, ret);
 }
 
 static void
@@ -313,7 +313,7 @@ test_https_invalid_3 (TestData      *fixture,
 
   /* Creating an invalid target string will be caught. */
   dns_builder_add_uint8 (https_answer, 100);
-  g_byte_array_append (https_answer, "test", 4);
+  g_byte_array_append (https_answer, (const guchar *)"test", 4);
 
   dns_builder_add_answer_data (fixture->answer, https_answer);
   records = g_resolver_records_from_res_query ("example.org", 65,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]