summaryrefslogtreecommitdiff
path: root/ff2png.c
diff options
context:
space:
mode:
Diffstat (limited to 'ff2png.c')
-rw-r--r--ff2png.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ff2png.c b/ff2png.c
index be6912e..8cded89 100644
--- a/ff2png.c
+++ b/ff2png.c
@@ -1,6 +1,6 @@
/* See LICENSE file for copyright and license details. */
-#define _BSD_SOURCE
-#include <endian.h>
+#include <arpa/inet.h>
+
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -34,8 +34,8 @@ main(int argc, char *argv[])
fprintf(stderr, "invalid magic in header\n");
return 1;
}
- width = be32toh(*((uint32_t *)(hdr + 8)));
- height = be32toh(*((uint32_t *)(hdr + 12)));
+ width = ntohl(*((uint32_t *)(hdr + 8)));
+ height = ntohl(*((uint32_t *)(hdr + 12)));
/* load png */
png_struct_p = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
@@ -65,7 +65,7 @@ main(int argc, char *argv[])
return 1;
}
/* ((2^16-1) / 255) == 257 */
- png_row[j] = (uint8_t)(be16toh(tmp16) / 257);
+ png_row[j] = (uint8_t)(ntohs(tmp16) / 257);
}
png_write_row(png_struct_p, png_row);
}