Resolv: Replace BSD types with regular C99 types

Replace BSD types (u_long, u_int, u_char) with regular C99 types

Bug: 140910031
Test: built, flashed, booted
Test: atest
Change-Id: I88829906f8e5be89ef3d5b222ebd4e4091a41b57
diff --git a/res_debug.cpp b/res_debug.cpp
index f249456..383c445 100644
--- a/res_debug.cpp
+++ b/res_debug.cpp
@@ -111,6 +111,7 @@
 #include <android-base/stringprintf.h>
 #include <ctype.h>
 #include <errno.h>
+#include <inttypes.h>
 #include <math.h>
 #include <netdb.h>
 #include <netdutils/Slice.h>
@@ -161,14 +162,13 @@
             StringAppendF(&s, ";;\t%s, type = %s, class = %s\n", ns_rr_name(rr),
                           p_type(ns_rr_type(rr)), p_class(ns_rr_class(rr)));
         else if (section == ns_s_ar && ns_rr_type(rr) == ns_t_opt) {
-            size_t rdatalen, ttl;
+            size_t rdatalen;
             uint16_t optcode, optlen;
 
             rdatalen = ns_rr_rdlen(rr);
-            ttl = ns_rr_ttl(rr);
-            StringAppendF(&s, "; EDNS: version: %zu, udp=%u, flags=%04zx\n", (ttl >> 16) & 0xff,
-                          ns_rr_class(rr), ttl & 0xffff);
-            const u_char* cp = ns_rr_rdata(rr);
+            StringAppendF(&s, "; EDNS: version: %" PRIu32 ", udp=%u, flags=%" PRIu32 "\n",
+                          (rr.ttl >> 16) & 0xff, ns_rr_class(rr), rr.ttl & 0xffff);
+            const uint8_t* cp = ns_rr_rdata(rr);
             while (rdatalen <= ns_rr_rdlen(rr) && rdatalen >= 4) {
                 int i;
 
@@ -210,7 +210,7 @@
             }
         } else {
             auto buf = std::make_unique<char[]>(buflen);
-            n = ns_sprintrr(handle, &rr, NULL, NULL, buf.get(), (u_int)buflen);
+            n = ns_sprintrr(handle, &rr, NULL, NULL, buf.get(), (uint32_t)buflen);
             if (n < 0) {
                 if (errno == ENOSPC) {
                     if (buflen < 131072) {
@@ -236,12 +236,12 @@
  * Print the contents of a query.
  * This is intended to be primarily a debugging routine.
  */
-void res_pquery(const u_char* msg, int len) {
+void res_pquery(const uint8_t* msg, int len) {
     if (!WOULD_LOG(VERBOSE)) return;
 
     ns_msg handle;
     int qdcount, ancount, nscount, arcount;
-    u_int opcode, rcode, id;
+    uint32_t opcode, rcode, id;
 
     if (ns_initparse(msg, len, &handle) < 0) {
         PLOG(VERBOSE) << "ns_initparse failed";