Port a patch from Fuchsia that fixes warnings about null pointer arithmetic

See https://fuchsia.googlesource.com/third_party/libpng/+/2b87a483ab1bc15410d16b1b9f6452cf9488240c

Change-Id: Ibc3363e9a8f1586230b3bd60b1bf64e9a4e1697a
Reviewed-on: https://flutter-review.googlesource.com/c/third_party/libpng/+/17183
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Jason Simmons <jsimmons@google.com>
diff --git a/pngpriv.h b/pngpriv.h
index 583c26f..43b00b1 100644
--- a/pngpriv.h
+++ b/pngpriv.h
@@ -43,6 +43,7 @@
 /* Standard library headers not required by png.h: */
 #  include <stdlib.h>
 #  include <string.h>
+#  include <stdint.h>
 #endif
 
 #define PNGLIB_BUILD /*libpng is being built, not used*/
@@ -603,8 +604,7 @@
 /* This implicitly assumes alignment is always to a power of 2. */
 #ifdef png_alignof
 #  define png_isaligned(ptr, type)\
-   (((type)((const char*)ptr-(const char*)0) & \
-   (type)(png_alignof(type)-1)) == 0)
+   ((((uintptr_t)ptr) & (png_alignof(type)-1)) == 0)
 #else
 #  define png_isaligned(ptr, type) 0
 #endif
diff --git a/pngrutil.c b/pngrutil.c
index d5fa08c..fecbb4f 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -4621,11 +4621,11 @@
        */
       {
          png_bytep temp = png_ptr->big_row_buf + 32;
-         int extra = (int)((temp - (png_bytep)0) & 0x0f);
+         int extra = (int)(((uintptr_t)temp) & 0x0f);
          png_ptr->row_buf = temp - extra - 1/*filter byte*/;
 
          temp = png_ptr->big_prev_row + 32;
-         extra = (int)((temp - (png_bytep)0) & 0x0f);
+         extra = (int)(((uintptr_t)temp) & 0x0f);
          png_ptr->prev_row = temp - extra - 1/*filter byte*/;
       }