First round of fixing up implicit 64->32 bit conversions
diff --git a/src/core/transport/chttp2/frame_goaway.c b/src/core/transport/chttp2/frame_goaway.c
index d40e6fd..1a6d80d 100644
--- a/src/core/transport/chttp2/frame_goaway.c
+++ b/src/core/transport/chttp2/frame_goaway.c
@@ -143,7 +143,7 @@
         transport_parsing->goaway_received = 1;
         transport_parsing->goaway_last_stream_index = p->last_stream_id;
         gpr_slice_unref(transport_parsing->goaway_text);
-        transport_parsing->goaway_error = p->error_code;
+        transport_parsing->goaway_error = (grpc_status_code)p->error_code;
         transport_parsing->goaway_text =
             gpr_slice_new(p->debug_data, p->debug_length, gpr_free);
         p->debug_data = NULL;
@@ -160,7 +160,9 @@
                                gpr_slice_buffer *slice_buffer) {
   gpr_slice header = gpr_slice_malloc(9 + 4 + 4);
   gpr_uint8 *p = GPR_SLICE_START_PTR(header);
-  gpr_uint32 frame_length = 4 + 4 + GPR_SLICE_LENGTH(debug_data);
+  gpr_uint32 frame_length;
+  GPR_ASSERT(GPR_SLICE_LENGTH(debug_data) < GPR_UINT32_MAX - 4 - 4);
+  frame_length = 4 + 4 + (gpr_uint32)GPR_SLICE_LENGTH(debug_data);
 
   /* frame header: length */
   *p++ = frame_length >> 16;
diff --git a/src/core/transport/chttp2/frame_settings.c b/src/core/transport/chttp2/frame_settings.c
index 927ae55..f70776b 100644
--- a/src/core/transport/chttp2/frame_settings.c
+++ b/src/core/transport/chttp2/frame_settings.c
@@ -76,7 +76,7 @@
 gpr_slice grpc_chttp2_settings_create(gpr_uint32 *old, const gpr_uint32 *new,
                                       gpr_uint32 force_mask, size_t count) {
   size_t i;
-  size_t n = 0;
+  gpr_uint32 n = 0;
   gpr_slice output;
   gpr_uint8 *p;
 
diff --git a/src/core/transport/chttp2/hpack_parser.c b/src/core/transport/chttp2/hpack_parser.c
index f806f59..93a452f 100644
--- a/src/core/transport/chttp2/hpack_parser.c
+++ b/src/core/transport/chttp2/hpack_parser.c
@@ -1085,7 +1085,8 @@
 static void append_bytes(grpc_chttp2_hpack_parser_string *str,
                          const gpr_uint8 *data, size_t length) {
   if (length + str->length > str->capacity) {
-    str->capacity = str->length + length;
+    GPR_ASSERT(str->length + length <= GPR_UINT32_MAX);
+    str->capacity = (gpr_uint32)(str->length + length);
     str->str = gpr_realloc(str->str, str->capacity);
   }
   memcpy(str->str + str->length, data, length);
diff --git a/src/core/transport/chttp2/parsing.c b/src/core/transport/chttp2/parsing.c
index b0f884e..a29987a 100644
--- a/src/core/transport/chttp2/parsing.c
+++ b/src/core/transport/chttp2/parsing.c
@@ -131,7 +131,7 @@
      published later */
   if (transport_parsing->goaway_received) {
     grpc_chttp2_add_incoming_goaway(transport_global,
-                                    transport_parsing->goaway_error,
+                                    (gpr_uint32)transport_parsing->goaway_error,
                                     transport_parsing->goaway_text);
     transport_parsing->goaway_text = gpr_empty_slice();
     transport_parsing->goaway_received = 0;
@@ -212,7 +212,7 @@
     if (stream_parsing->saw_rst_stream) {
       stream_global->cancelled = 1;
       stream_global->cancelled_status = grpc_chttp2_http2_error_to_grpc_status(
-          stream_parsing->rst_stream_reason);
+          (grpc_chttp2_error_code)stream_parsing->rst_stream_reason);
       if (stream_parsing->rst_stream_reason == GRPC_CHTTP2_NO_ERROR) {
         stream_global->published_cancelled = 1;
       }
diff --git a/src/core/transport/chttp2/stream_encoder.c b/src/core/transport/chttp2/stream_encoder.c
index bcae93d..8c30af6 100644
--- a/src/core/transport/chttp2/stream_encoder.c
+++ b/src/core/transport/chttp2/stream_encoder.c
@@ -74,8 +74,9 @@
 } framer_state;
 
 /* fills p (which is expected to be 9 bytes long) with a data frame header */
-static void fill_header(gpr_uint8 *p, gpr_uint8 type, gpr_uint32 id,
-                        gpr_uint32 len, gpr_uint8 flags) {
+static void fill_header(gpr_uint8 *p, gpr_uint8 type, gpr_uint32 id, size_t len,
+                        gpr_uint8 flags) {
+  GPR_ASSERT(len < 16777316);
   *p++ = len >> 16;
   *p++ = len >> 8;
   *p++ = len;
@@ -185,8 +186,8 @@
   gpr_uint32 key_hash = elem->key->hash;
   gpr_uint32 elem_hash = GRPC_MDSTR_KV_HASH(key_hash, elem->value->hash);
   gpr_uint32 new_index = c->tail_remote_index + c->table_elems + 1;
-  gpr_uint32 elem_size = 32 + GPR_SLICE_LENGTH(elem->key->slice) +
-                         GPR_SLICE_LENGTH(elem->value->slice);
+  size_t elem_size = 32 + GPR_SLICE_LENGTH(elem->key->slice) +
+                     GPR_SLICE_LENGTH(elem->value->slice);
   grpc_mdelem *elem_to_unref;
 
   /* Reserve space for this element in the remote table: if this overflows
@@ -270,7 +271,7 @@
 
 static void emit_indexed(grpc_chttp2_hpack_compressor *c, gpr_uint32 index,
                          framer_state *st) {
-  size_t len = GRPC_CHTTP2_VARINT_LENGTH(index, 1);
+  gpr_uint32 len = GRPC_CHTTP2_VARINT_LENGTH(index, 1);
   GRPC_CHTTP2_WRITE_VARINT(index, 1, 0x80, add_tiny_header_data(st, len), len);
 }
 
@@ -291,11 +292,13 @@
   gpr_uint32 len_pfx = GRPC_CHTTP2_VARINT_LENGTH(key_index, 2);
   gpr_uint8 huffman_prefix;
   gpr_slice value_slice = get_wire_value(elem, &huffman_prefix);
-  gpr_uint32 len_val = GPR_SLICE_LENGTH(value_slice);
-  gpr_uint32 len_val_len = GRPC_CHTTP2_VARINT_LENGTH(len_val, 1);
+  size_t len_val = GPR_SLICE_LENGTH(value_slice);
+  gpr_uint32 len_val_len;
+  GPR_ASSERT(len_val <= GPR_UINT32_MAX);
+  len_val_len = GRPC_CHTTP2_VARINT_LENGTH((gpr_uint32)len_val, 1);
   GRPC_CHTTP2_WRITE_VARINT(key_index, 2, 0x40,
                            add_tiny_header_data(st, len_pfx), len_pfx);
-  GRPC_CHTTP2_WRITE_VARINT(len_val, 1, 0x00,
+  GRPC_CHTTP2_WRITE_VARINT((gpr_uint32)len_val, 1, 0x00,
                            add_tiny_header_data(st, len_val_len), len_val_len);
   add_header_data(st, gpr_slice_ref(value_slice));
 }
@@ -306,23 +309,27 @@
   gpr_uint32 len_pfx = GRPC_CHTTP2_VARINT_LENGTH(key_index, 4);
   gpr_uint8 huffman_prefix;
   gpr_slice value_slice = get_wire_value(elem, &huffman_prefix);
-  gpr_uint32 len_val = GPR_SLICE_LENGTH(value_slice);
-  gpr_uint32 len_val_len = GRPC_CHTTP2_VARINT_LENGTH(len_val, 1);
+  size_t len_val = GPR_SLICE_LENGTH(value_slice);
+  gpr_uint32 len_val_len;
+  GPR_ASSERT(len_val <= GPR_UINT32_MAX);
+  len_val_len = GRPC_CHTTP2_VARINT_LENGTH((gpr_uint32)len_val, 1);
   GRPC_CHTTP2_WRITE_VARINT(key_index, 4, 0x00,
                            add_tiny_header_data(st, len_pfx), len_pfx);
-  GRPC_CHTTP2_WRITE_VARINT(len_val, 1, 0x00,
+  GRPC_CHTTP2_WRITE_VARINT((gpr_uint32)len_val, 1, 0x00,
                            add_tiny_header_data(st, len_val_len), len_val_len);
   add_header_data(st, gpr_slice_ref(value_slice));
 }
 
 static void emit_lithdr_incidx_v(grpc_chttp2_hpack_compressor *c,
                                  grpc_mdelem *elem, framer_state *st) {
-  gpr_uint32 len_key = GPR_SLICE_LENGTH(elem->key->slice);
+  gpr_uint32 len_key = (gpr_uint32)GPR_SLICE_LENGTH(elem->key->slice);
   gpr_uint8 huffman_prefix;
   gpr_slice value_slice = get_wire_value(elem, &huffman_prefix);
-  gpr_uint32 len_val = GPR_SLICE_LENGTH(value_slice);
+  gpr_uint32 len_val = (gpr_uint32)GPR_SLICE_LENGTH(value_slice);
   gpr_uint32 len_key_len = GRPC_CHTTP2_VARINT_LENGTH(len_key, 1);
   gpr_uint32 len_val_len = GRPC_CHTTP2_VARINT_LENGTH(len_val, 1);
+  GPR_ASSERT(len_key <= GPR_UINT32_MAX);
+  GPR_ASSERT(GPR_SLICE_LENGTH(value_slice) <= GPR_UINT32_MAX);
   *add_tiny_header_data(st, 1) = 0x40;
   GRPC_CHTTP2_WRITE_VARINT(len_key, 1, 0x00,
                            add_tiny_header_data(st, len_key_len), len_key_len);
@@ -334,12 +341,14 @@
 
 static void emit_lithdr_noidx_v(grpc_chttp2_hpack_compressor *c,
                                 grpc_mdelem *elem, framer_state *st) {
-  gpr_uint32 len_key = GPR_SLICE_LENGTH(elem->key->slice);
+  gpr_uint32 len_key = (gpr_uint32)GPR_SLICE_LENGTH(elem->key->slice);
   gpr_uint8 huffman_prefix;
   gpr_slice value_slice = get_wire_value(elem, &huffman_prefix);
-  gpr_uint32 len_val = GPR_SLICE_LENGTH(value_slice);
+  gpr_uint32 len_val = (gpr_uint32)GPR_SLICE_LENGTH(value_slice);
   gpr_uint32 len_key_len = GRPC_CHTTP2_VARINT_LENGTH(len_key, 1);
   gpr_uint32 len_val_len = GRPC_CHTTP2_VARINT_LENGTH(len_val, 1);
+  GPR_ASSERT(len_key <= GPR_UINT32_MAX);
+  GPR_ASSERT(GPR_SLICE_LENGTH(value_slice) <= GPR_UINT32_MAX);
   *add_tiny_header_data(st, 1) = 0x00;
   GRPC_CHTTP2_WRITE_VARINT(len_key, 1, 0x00,
                            add_tiny_header_data(st, len_key_len), len_key_len);
@@ -565,7 +574,7 @@
   framer_state st;
   gpr_slice slice;
   grpc_stream_op *op;
-  gpr_uint32 max_take_size;
+  size_t max_take_size;
   gpr_uint32 curop = 0;
   gpr_uint32 unref_op;
   grpc_mdctx *mdctx = compressor->mdctx;
diff --git a/src/core/transport/chttp2/timeout_encoding.c b/src/core/transport/chttp2/timeout_encoding.c
index 40fcdc2..8a9b290 100644
--- a/src/core/transport/chttp2/timeout_encoding.c
+++ b/src/core/transport/chttp2/timeout_encoding.c
@@ -123,7 +123,7 @@
     enc_nanos(buffer, timeout.tv_nsec);
   } else if (timeout.tv_sec < 1000 && timeout.tv_nsec != 0) {
     enc_micros(buffer,
-               timeout.tv_sec * 1000000 +
+               (int)(timeout.tv_sec * 1000000) +
                    (timeout.tv_nsec / 1000 + (timeout.tv_nsec % 1000 != 0)));
   } else {
     enc_seconds(buffer, timeout.tv_sec + (timeout.tv_nsec != 0));
diff --git a/src/core/transport/chttp2/writing.c b/src/core/transport/chttp2/writing.c
index ac79044..c015e82 100644
--- a/src/core/transport/chttp2/writing.c
+++ b/src/core/transport/chttp2/writing.c
@@ -32,10 +32,13 @@
  */
 
 #include "src/core/transport/chttp2/internal.h"
-#include "src/core/transport/chttp2/http2_errors.h"
+
+#include <limits.h>
 
 #include <grpc/support/log.h>
 
+#include "src/core/transport/chttp2/http2_errors.h"
+
 static void finalize_outbuf(grpc_chttp2_transport_writing *transport_writing);
 
 int grpc_chttp2_unlocking_check_writes(
@@ -78,12 +81,13 @@
     stream_writing->send_closed = GRPC_DONT_SEND_CLOSED;
 
     if (stream_global->outgoing_sopb) {
-      window_delta =
-          grpc_chttp2_preencode(stream_global->outgoing_sopb->ops,
-                                &stream_global->outgoing_sopb->nops,
-                                GPR_MIN(transport_global->outgoing_window,
-                                        stream_global->outgoing_window),
-                                &stream_writing->sopb);
+      window_delta = grpc_chttp2_preencode(
+          stream_global->outgoing_sopb->ops,
+          &stream_global->outgoing_sopb->nops,
+          (gpr_uint32)GPR_MIN(GPR_MIN(transport_global->outgoing_window,
+                                      stream_global->outgoing_window),
+                              GPR_UINT32_MAX),
+          &stream_writing->sopb);
       GRPC_CHTTP2_FLOWCTL_TRACE_TRANSPORT(
           "write", transport_global, outgoing_window, -(gpr_int64)window_delta);
       GRPC_CHTTP2_FLOWCTL_TRACE_STREAM("write", transport_global, stream_global,
diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c
index c1a3c04..c803305 100644
--- a/src/core/transport/chttp2_transport.c
+++ b/src/core/transport/chttp2_transport.c
@@ -692,7 +692,8 @@
           op->max_recv_bytes - stream_global->max_recv_bytes);
       stream_global->unannounced_incoming_window +=
           op->max_recv_bytes - stream_global->max_recv_bytes;
-      stream_global->max_recv_bytes = op->max_recv_bytes;
+      stream_global->max_recv_bytes =
+          (gpr_uint32)(GPR_MIN(op->max_recv_bytes, GPR_UINT32_MAX));
     }
     grpc_chttp2_incoming_metadata_live_op_buffer_end(
         &stream_global->outstanding_metadata);
@@ -761,7 +762,7 @@
     t->global.sent_goaway = 1;
     grpc_chttp2_goaway_append(
         t->global.last_incoming_stream_id,
-        grpc_chttp2_grpc_status_to_http2_error(op->goaway_status),
+        (gpr_uint32)grpc_chttp2_grpc_status_to_http2_error(op->goaway_status),
         gpr_slice_ref(*op->goaway_message), &t->global.qbuf);
     close_transport = !grpc_chttp2_has_streams(t);
   }
@@ -829,8 +830,9 @@
 
   new_stream_count = grpc_chttp2_stream_map_size(&t->parsing_stream_map) +
                      grpc_chttp2_stream_map_size(&t->new_stream_map);
+  GPR_ASSERT(new_stream_count <= GPR_UINT32_MAX);
   if (new_stream_count != t->global.concurrent_stream_count) {
-    t->global.concurrent_stream_count = new_stream_count;
+    t->global.concurrent_stream_count = (gpr_uint32)new_stream_count;
     maybe_start_some_streams(&t->global);
   }
 }
@@ -943,7 +945,8 @@
     gpr_slice_buffer_add(
         &transport_global->qbuf,
         grpc_chttp2_rst_stream_create(
-            stream_global->id, grpc_chttp2_grpc_status_to_http2_error(status)));
+            stream_global->id,
+            (gpr_uint32)grpc_chttp2_grpc_status_to_http2_error(status)));
   }
   grpc_chttp2_list_add_read_write_state_changed(transport_global,
                                                 stream_global);
@@ -989,11 +992,11 @@
   *p++ = 's';
   if (status < 10) {
     *p++ = 1;
-    *p++ = '0' + status;
+    *p++ = (gpr_uint8)('0' + status);
   } else {
     *p++ = 2;
-    *p++ = '0' + (status / 10);
-    *p++ = '0' + (status % 10);
+    *p++ = (gpr_uint8)('0' + (status / 10));
+    *p++ = (gpr_uint8)('0' + (status % 10));
   }
   GPR_ASSERT(p == GPR_SLICE_END_PTR(status_hdr));
   len += GPR_SLICE_LENGTH(status_hdr);
@@ -1121,7 +1124,7 @@
     grpc_chttp2_stream_map_move_into(&t->new_stream_map,
                                      &t->parsing_stream_map);
     t->global.concurrent_stream_count =
-        grpc_chttp2_stream_map_size(&t->parsing_stream_map);
+        (gpr_uint32)grpc_chttp2_stream_map_size(&t->parsing_stream_map);
     if (t->parsing.initial_window_update != 0) {
       grpc_chttp2_stream_map_for_each(&t->parsing_stream_map,
                                       update_global_window, t);
diff --git a/src/core/transport/transport.h b/src/core/transport/transport.h
index 92c1f38..6e1ec2f 100644
--- a/src/core/transport/transport.h
+++ b/src/core/transport/transport.h
@@ -75,7 +75,7 @@
   /** The number of bytes this peer is currently prepared to receive.
       These bytes will be eventually used to replenish per-stream flow control
       windows. */
-  gpr_uint32 max_recv_bytes;
+  size_t max_recv_bytes;
   grpc_iomgr_closure *on_done_recv;
 
   grpc_pollset *bind_pollset;