]> Sergey Matveev's repositories - tofuproxy.git/blobdiff - cmd/zstd/unzstd.c
Get rid of endian.h dependency
[tofuproxy.git] / cmd / zstd / unzstd.c
index 1ecbbda182799bc7e930d99e4415c8b898806598..823515c1f898585e4065a5d874cfe506f1748ecc 100644 (file)
@@ -1,6 +1,6 @@
 /*
 unzstd -- .warc.zst decompressor
-Copyright (C) 2021 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2021-2023 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -23,7 +23,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/endian.h>
 
 #include <zstd.h>
 
@@ -34,6 +33,13 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include <sysexits.h>
 #endif // __FreeBSD__
 
+static uint32_t
+le32dec(const char buf[4])
+{
+    return (uint32_t)(buf[3]) << 24 | (uint32_t)(buf[2]) << 16 |
+           (uint32_t)(buf[1]) << 8 | (uint32_t)(buf[0]);
+}
+
 int
 main(int argc, char **argv)
 {