From 1ae6bae12398d95969e0c20539bb2b8587781137 Mon Sep 17 00:00:00 2001
From: Uwe Schulzweida <uwe.schulzweida@mpimet.mpg.de>
Date: Fri, 17 Jun 2022 14:43:13 +0200
Subject: [PATCH] Rename cdf_create() to cdf__create().

---
 src/cdf.c     | 22 ++++++++++------------
 src/cdf_int.c |  2 +-
 src/cdf_int.h |  2 +-
 src/stream.c  |  6 +++++-
 4 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/src/cdf.c b/src/cdf.c
index e9f91b8d1..40a0cf202 100644
--- a/src/cdf.c
+++ b/src/cdf.c
@@ -128,7 +128,7 @@ cdfOpenFile(const char *filename, const char *mode, int *filetype)
           if (*filetype == CDI_FILETYPE_NC4C) writemode |= (NC_NETCDF4 | NC_CLASSIC_MODEL);
           if (*filetype == CDI_FILETYPE_NCZARR) writemode |= NC_NETCDF4;
 #endif
-          cdf_create(filename, writemode, &ncid);
+          cdf__create(filename, writemode, &ncid);
           if (CDI_Version_Info) cdfComment(ncid);
           cdf_put_att_text(ncid, NC_GLOBAL, "Conventions", 6, "CF-1.6");
           break;
@@ -213,19 +213,17 @@ cdf4Open(const char *filename, const char *mode, int *filetype)
   if (CDF_Debug) Message("Open %s with mode %c", filename, *mode);
 
 #ifdef HAVE_NETCDF4
-  {
-    if (cdf4CheckLibVersions() == 0)
-      {
-        const int fileID = cdfOpenFile(filename, mode, filetype);
-        if (CDF_Debug) Message("File %s opened with id %d", filename, fileID);
-        return fileID;
-      }
-
-    return CDI_EUFTYPE;
-  }
-#endif
+  if (cdf4CheckLibVersions() == 0)
+    {
+      const int fileID = cdfOpenFile(filename, mode, filetype);
+      if (CDF_Debug) Message("File %s opened with id %d", filename, fileID);
+      return fileID;
+    }
 
+  return CDI_EUFTYPE;
+#else
   return CDI_ELIBNAVAIL;
+#endif
 }
 
 static void
diff --git a/src/cdf_int.c b/src/cdf_int.c
index f1eb4bfbe..e2c3f9fb3 100644
--- a/src/cdf_int.c
+++ b/src/cdf_int.c
@@ -26,7 +26,7 @@ has_uri(const char *uri)
 }
 
 void
-cdf_create(const char *path, int cmode, int *ncidp)
+cdf__create(const char *path, int cmode, int *ncidp)
 {
   int status = -1;
   size_t chunksizehint = 0;
diff --git a/src/cdf_int.h b/src/cdf_int.h
index b279aa452..9d7ac8628 100644
--- a/src/cdf_int.h
+++ b/src/cdf_int.h
@@ -5,7 +5,7 @@
 
 #include <netcdf.h>
 
-void cdf_create(const char *path, int cmode, int *idp);
+void cdf__create(const char *path, int cmode, int *idp);
 int cdf_open(const char *path, int omode, int *idp);
 void cdf_close(int ncid);
 
diff --git a/src/stream.c b/src/stream.c
index 8add1ad78..43e4fcc0c 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -736,12 +736,16 @@ streamOpenA(const char *filename, const char *filemode, int filetype)
       }
     case CDI_FILETYPE_NC4:
     case CDI_FILETYPE_NC4C:
-    case CDI_FILETYPE_NCZARR:
       {
         fileID = cdf4Open(filename, filemode, &filetype);
         streamptr->ncmode = 2;
         break;
       }
+    case CDI_FILETYPE_NCZARR:
+      {
+        Message("%s not available in append mode!", strfiletype(filetype));
+        return CDI_ELIBNAVAIL;
+      }
 #endif
     default:
       {
-- 
GitLab