Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Feb 2021 16:31:33 +0000 (UTC)
From:      Piotr Kubaj <pkubaj@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r565316 - head/science/netcdf/files
Message-ID:  <202102151631.11FGVXdk062439@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pkubaj
Date: Mon Feb 15 16:31:32 2021
New Revision: 565316
URL: https://svnweb.freebsd.org/changeset/ports/565316

Log:
  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.

Added:
  head/science/netcdf/files/
  head/science/netcdf/files/patch-libdispatch_dfilter.c   (contents, props changed)

Added: head/science/netcdf/files/patch-libdispatch_dfilter.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/science/netcdf/files/patch-libdispatch_dfilter.c	Mon Feb 15 16:31:32 2021	(r565316)
@@ -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
+-
+-



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202102151631.11FGVXdk062439>