removed prs_data(), prs_free_data(), and prs_realloc_data()
authorGerald Carter <jerry@samba.org>
Fri, 14 Jul 2000 16:58:03 +0000 (16:58 +0000)
committerGerald Carter <jerry@samba.org>
Fri, 14 Jul 2000 16:58:03 +0000 (16:58 +0000)
as these were unneeded and replaced by the real functions
already in HEAD.

Added a few more functions to parse_spoolss.c to help with the
rpcclient merge from TNG.
(This used to be commit 3bc9af4c1dbdb664970541f6091982ffccc87b31)

source3/rpc_parse/parse_prs.c
source3/rpc_parse/parse_spoolss.c

index 5b5834084f893c63f1dda54c1f65ad64d781bc1e..1bda5ef506839871f8371e19382816139a075036 100644 (file)
@@ -897,99 +897,6 @@ BOOL prs_uint32_post(char *name, prs_struct *ps, int depth, uint32 *data32,
        return True;
 }
 
-/*******************************************************************
- frees a memory buffer.
- ********************************************************************/
-void prs_free_data(prs_struct *buf)
-{
-        if (buf == NULL)
-                return;
-
-        if (buf->data_p != NULL)
-        {
-                free(buf->data_p);
-                buf->data_p = NULL;
-        }
-        buf->buffer_size = 0;
-}
-
-/*******************************************************************
- reallocate a memory buffer
-********************************************************************/
-BOOL prs_realloc_data(prs_struct *buf, size_t new_size)
-{
-        char *new_data;
-
-        /* prs_sma_init();  JERRY */
-
-        prs_debug(buf, 200, "prs_realloc_data - before", "prs_realloc_data");
-
-        SMB_ASSERT(((ssize_t) new_size) >= 0);
-
-        if (new_size == 0)
-        {
-                prs_free_data(buf);
-                return True;
-        }
-
-        /* new_data = sma_realloc(prs_sma_region, buf->data_p, new_size); */
-        new_data = realloc(buf->data_p, new_size);
-
-        if (new_data != NULL)
-        {
-                if (new_size > buf->buffer_size)
-                {
-                        memset(&new_data[buf->buffer_size], 0,
-                               new_size - buf->buffer_size);
-                }
-                buf->data_p = new_data;
-                buf->buffer_size = new_size;
-        }
-        else if (buf->buffer_size >= new_size)
-        {
-                DEBUG(3, ("prs_realloc_data: warning - "
-                          "could not realloc to %d\n", new_size));
-        }
-        else
-        {
-                DEBUG(3, ("prs_realloc_data: error - "
-                          "could not realloc to %d\n", new_size));
-
-                prs_free_data(buf);
-                return False;
-        }
-
-        prs_debug(buf, 200, "prs_realloc_data - after", "prs_realloc_data");
-        return True;
-}
-
-/*******************************************************************
- return the memory location specified by offset; may return NULL.
- ********************************************************************/
-char *prs_data(const prs_struct *buf, uint32 offset)
-{
-
-       /* do we have something to look at? */
-       if (buf == NULL)
-               return NULL;
-
-       /* check to make sure the offset is within range */
-       if ((offset < 0) || (offset >= buf->buffer_size))
-               return NULL;
-
-       /* locate the memory address */
-        if (buf->data_p != NULL)
-        {
-                return &(buf->data_p[offset]);
-        }
-
-       /* default return */
-        return NULL;
-}
-
-
-
-
 /* useful function to store a structure in rpc wire format */
 int tdb_prs_store(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps)
 {
index c0c6e36ae1e1c95cc84502387f7577e8637fedd1..9f5fdccfe7dd5a9e37fce07e96c79ec324ef5bd8 100644 (file)
 
 #include "includes.h"
 
-#ifdef TNG
-       #define prs_uint16 _prs_uint16
-       #define prs_uint32 _prs_uint32
-       #define prs_uint8s _prs_uint8s
-       #define prs_uint16s _prs_uint16s
-       #define prs_unistr _prs_unistr
-       #define init_unistr2 make_unistr2
-       #define init_buf_unistr2 make_buf_unistr2
-#endif
-
-
 extern int DEBUGLEVEL;
 /*******************************************************************
 return the length of a UNISTR string.
@@ -325,7 +314,7 @@ static BOOL smb_io_notify_info_data(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs
        prs_debug(ps, depth, desc, "smb_io_notify_info_data");
        depth++;
 
-       how_many_words=data->size;      
+       how_many_words=data->size;
        if (how_many_words==POINTER) {
                how_many_words=TWO_VALUE;
        }
@@ -785,6 +774,26 @@ BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_
        return True;
 }
 
+/*******************************************************************
+ * make a structure.
+ ********************************************************************/
+BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u,
+                                const POLICY_HND *handle,
+                                const UNISTR2 *valuename,
+                                uint32 size)
+{
+        if (q_u == NULL) return False;
+
+        DEBUG(5,("make_spoolss_q_getprinterdata\n"));
+
+        q_u->handle = *handle;
+        copy_unistr2(&q_u->valuename, valuename);
+        q_u->size = size;
+
+        return True;
+}
+
+
 /*******************************************************************
  * read a structure.
  * called from spoolss_q_getprinterdata (srv_spoolss.c)
@@ -3252,6 +3261,24 @@ BOOL new_spoolss_io_r_enumprinterdrivers(char *desc, SPOOL_R_ENUMPRINTERDRIVERS
        return True;            
 }
 
+/*******************************************************************
+ * init a structure.
+ ********************************************************************/
+BOOL make_spoolss_q_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u,
+                                const char *name,
+                                const char *environment,
+                                uint32 level,
+                                NEW_BUFFER *buffer, uint32 offered)
+{
+        init_buf_unistr2(&q_u->name, &q_u->name_ptr, name);
+        init_buf_unistr2(&q_u->environment, &q_u->environment_ptr, environment);
+
+        q_u->level=level;
+        q_u->buffer=buffer;
+        q_u->offered=offered;
+
+        return True;
+}
 
 /*******************************************************************
  Parse a SPOOL_Q_ENUMPRINTERDRIVERS structure.
@@ -4208,6 +4235,27 @@ BOOL uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni,
        return True;
 }
 
+/*******************************************************************
+ * init a structure.
+ ********************************************************************/
+BOOL make_spoolss_q_getprinterdriverdir(SPOOL_Q_GETPRINTERDRIVERDIR *q_u,
+                                fstring servername, fstring env_name, uint32 level,
+                                NEW_BUFFER *buffer, uint32 offered)
+{
+        q_u->name_ptr = (servername != NULL) ? 1 : 0;
+        init_unistr2(&(q_u->name), servername, strlen(servername));
+
+        q_u->environment_ptr = (env_name != NULL) ? 1 : 0;
+        init_unistr2(&(q_u->environment), env_name, strlen(env_name));
+
+        q_u->level=level;
+        q_u->buffer=buffer;
+        q_u->offered=offered;
+
+        return True;
+}
+
+
 /*******************************************************************
  Parse a SPOOL_Q_GETPRINTERDRIVERDIR structure.
 ********************************************************************/