1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-02 06:03:50 +00:00

science/netcdf: move byteswap4 and byteswap8 fuctions higher so that they are declared when necessary

dfilter.c:366:2: warning: implicit declaration of function 'byteswap4' is invalid in C99 [-Wimplicit-function-declaration]
        byteswap4(mem); /* step 1: byte-swap each piece */
        ^
dfilter.c:368:2: warning: implicit declaration of function 'byteswap8' is invalid in C99 [-Wimplicit-function-declaration]
        byteswap8(mem); /* step 2: convert to little endian format */
        ^
dfilter.c:370:2: warning: implicit declaration of function 'byteswap8' is invalid in C99 [-Wimplicit-function-declaration]
        byteswap8(mem); /* step 1: convert to little endian format */
        ^
dfilter.c:371:2: warning: implicit declaration of function 'byteswap4' is invalid in C99 [-Wimplicit-function-declaration]
        byteswap4(mem); /* step 2: byte-swap each piece */
        ^
dfilter.c:681:1: error: static declaration of 'byteswap8' follows non-static declaration
byteswap8(unsigned char* mem)
^
dfilter.c:368:2: note: previous implicit declaration is here
        byteswap8(mem); /* step 2: convert to little endian format */
        ^
dfilter.c:700:1: error: static declaration of 'byteswap4' follows non-static declaration
byteswap4(unsigned char* mem)
^
dfilter.c:366:2: note: previous implicit declaration is here
        byteswap4(mem); /* step 1: byte-swap each piece */
        ^
4 warnings and 2 errors generated.
This commit is contained in:
Piotr Kubaj 2021-02-15 16:31:32 +00:00
parent 8b5f6e9867
commit 8a252152e3
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=565316

View File

@ -0,0 +1,85 @@
--- libdispatch/dfilter.c.orig 2021-02-15 16:07:29 UTC
+++ libdispatch/dfilter.c
@@ -358,6 +358,42 @@ done:
return stat;
}
+
+#ifdef WORDS_BIGENDIAN
+/* Byte swap an 8-byte integer in place */
+static void
+byteswap8(unsigned char* mem)
+{
+ unsigned char c;
+ c = mem[0];
+ mem[0] = mem[7];
+ mem[7] = c;
+ c = mem[1];
+ mem[1] = mem[6];
+ mem[6] = c;
+ c = mem[2];
+ mem[2] = mem[5];
+ mem[5] = c;
+ c = mem[3];
+ mem[3] = mem[4];
+ mem[4] = c;
+}
+
+/* Byte swap an 8-byte integer in place */
+static void
+byteswap4(unsigned char* mem)
+{
+ unsigned char c;
+ c = mem[0];
+ mem[0] = mem[3];
+ mem[3] = c;
+ c = mem[1];
+ mem[1] = mem[2];
+ mem[2] = c;
+}
+#endif
+
+
EXTERNL void
NC4_filterfix8(unsigned char* mem, int decode)
{
@@ -674,39 +710,3 @@ gettype(const int q0, const int q1, int* isunsignedp)
if(isunsignedp) *isunsignedp = isunsigned;
return type;
}
-
-#ifdef WORDS_BIGENDIAN
-/* Byte swap an 8-byte integer in place */
-static void
-byteswap8(unsigned char* mem)
-{
- unsigned char c;
- c = mem[0];
- mem[0] = mem[7];
- mem[7] = c;
- c = mem[1];
- mem[1] = mem[6];
- mem[6] = c;
- c = mem[2];
- mem[2] = mem[5];
- mem[5] = c;
- c = mem[3];
- mem[3] = mem[4];
- mem[4] = c;
-}
-
-/* Byte swap an 8-byte integer in place */
-static void
-byteswap4(unsigned char* mem)
-{
- unsigned char c;
- c = mem[0];
- mem[0] = mem[3];
- mem[3] = c;
- c = mem[1];
- mem[1] = mem[2];
- mem[2] = c;
-}
-#endif
-
-