Added typecasts to make C++ happy.
[yaz-moved-to-github.git] / client / admin.c
index 4e68348..46cf777 100644 (file)
@@ -1,6 +1,15 @@
 /*
  * $Log: admin.c,v $
- * Revision 1.7  2000-04-05 07:39:54  adam
+ * Revision 1.10  2001-07-19 19:51:41  adam
+ * Added typecasts to make C++ happy.
+ *
+ * Revision 1.9  2001/02/21 13:46:53  adam
+ * C++ fixes.
+ *
+ * Revision 1.8  2000/04/17 14:21:38  adam
+ * WIN32 update.
+ *
+ * Revision 1.7  2000/04/05 07:39:54  adam
  * Added shared library support (libtool).
  *
  * Revision 1.6  2000/03/20 19:06:25  adam
 #include <stdlib.h>
 #include <time.h>
 #include <assert.h>
+
+#ifdef WIN32
+
+#else
 #include <dirent.h>
 #include <fnmatch.h>
 #include <sys/stat.h>
+#endif
+
 #include <yaz/yaz-util.h>
 
 #include <yaz/tcpip.h>
@@ -192,6 +207,15 @@ int cmd_adm_drop(char* arg)
    N.B. That in this case, the import may contain instructions to delete records as well as new or updates
    to existing records */
 
+#ifdef WIN32
+int cmd_adm_import(char *arg)
+{
+    printf ("not available on WIN32\n");
+    return 0;
+}
+
+#else
+
 int cmd_adm_import(char *arg)
 {
     char type_str[20], dir_str[1024], pattern_str[1024];
@@ -201,6 +225,7 @@ int cmd_adm_import(char *arg)
     struct dirent *ent;
     int chunk = 10;
     Z_APDU *apdu = 0;
+    Z_Segment *segment = 0;
     ODR out = getODROutputStream();
 
     if (arg && sscanf (arg, "%19s %1023s %1023s", type_str,
@@ -231,9 +256,8 @@ int cmd_adm_import(char *arg)
 
            if (S_ISREG(status.st_mode) && (inf = fopen(fname, "r")))
            {
-               Z_Segment *segment;
                Z_NamePlusRecord *rec;
-               Odr_oct *oct = odr_malloc (out, sizeof(*oct));
+               Odr_oct *oct = (Odr_oct *) odr_malloc (out, sizeof(*oct));
 
                if (!apdu)
                {
@@ -252,7 +276,7 @@ int cmd_adm_import(char *arg)
                rec->u.intermediateFragment->u.notExternallyTagged = oct;
                
                oct->len = oct->size = status.st_size;
-               oct->buf = odr_malloc (out, oct->size);
+               oct->buf = (unsigned char *) odr_malloc (out, oct->size);
                fread (oct->buf, 1, oct->size, inf);
                fclose (inf);
                
@@ -273,14 +297,12 @@ int cmd_adm_import(char *arg)
     closedir(dir);
     return 2;
 }
+#endif
 
 int cmd_adm_import2(char* arg)
 {
-    /* Size of chunks we wish to read from import file */
-    size_t chunk_size = 8192;
-
-    /* Buffer for reading chunks of data from import file */
-    char chunk_buffer[chunk_size];
+   /* Buffer for reading chunks of data from import file */
+    char chunk_buffer[8192];
     
     if ( arg )
     {