summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-01-03 08:28:12 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-01-03 08:28:12 +0000
commit634c54310c92c48dd4eceec602e230a021bdcfc5 (patch)
tree9f5732a180b8daacf176e42511b0a72c972c7a4b /source3/printing
parent47a7f0cfb5006fb41239a6cd81cce5e35fde750a (diff)
downloadsamba-634c54310c92c48dd4eceec602e230a021bdcfc5.tar.gz
samba-634c54310c92c48dd4eceec602e230a021bdcfc5.tar.bz2
samba-634c54310c92c48dd4eceec602e230a021bdcfc5.zip
Merge from HEAD - make Samba compile with -Wwrite-strings without additional
warnings. (Adds a lot of const). Andrew Bartlett (This used to be commit 3a7458f9472432ef12c43008414925fd1ce8ea0c)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/lpq_parse.c8
-rw-r--r--source3/printing/nt_printing.c42
-rw-r--r--source3/printing/printing.c12
3 files changed, 31 insertions, 31 deletions
diff --git a/source3/printing/lpq_parse.c b/source3/printing/lpq_parse.c
index 59a844689c..4b91b8ac9a 100644
--- a/source3/printing/lpq_parse.c
+++ b/source3/printing/lpq_parse.c
@@ -20,7 +20,7 @@
#include "includes.h"
-static char *Months[13] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+static const char *Months[13] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "Err"};
@@ -947,9 +947,9 @@ static BOOL parse_lpq_os2(char *line,print_queue_struct *buf,BOOL first)
return(True);
}
-static char *stat0_strings[] = { "enabled", "online", "idle", "no entries", "free", "ready", NULL };
-static char *stat1_strings[] = { "offline", "disabled", "down", "off", "waiting", "no daemon", NULL };
-static char *stat2_strings[] = { "jam", "paper", "error", "responding", "not accepting", "not running", "turned off", NULL };
+static const char *stat0_strings[] = { "enabled", "online", "idle", "no entries", "free", "ready", NULL };
+static const char *stat1_strings[] = { "offline", "disabled", "down", "off", "waiting", "no daemon", NULL };
+static const char *stat2_strings[] = { "jam", "paper", "error", "responding", "not accepting", "not running", "turned off", NULL };
#ifdef DEVELOPER
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 31f480a4dd..f04992ac82 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -77,7 +77,7 @@ STANDARD_MAPPING printserver_std_mapping = {
forms it wants and in the ORDER it wants them (note: DEVMODE papersize is an
array index). Letter is always first, so (for the current code) additions
always put things in the correct order. */
-static nt_forms_struct default_forms[] = {
+static const nt_forms_struct default_forms[] = {
{"Letter",0x1,0x34b5c,0x44368,0x0,0x0,0x34b5c,0x44368},
{"Letter Small",0x1,0x34b5c,0x44368,0x0,0x0,0x34b5c,0x44368},
{"Tabloid",0x1,0x44368,0x696b8,0x0,0x0,0x44368,0x696b8},
@@ -264,7 +264,7 @@ static BOOL upgrade_to_version_3(void)
BOOL nt_printing_init(void)
{
static pid_t local_pid;
- char *vstring = "INFO/version";
+ const char *vstring = "INFO/version";
if (tdb_drivers && tdb_printers && tdb_forms && local_pid == sys_getpid())
return True;
@@ -635,7 +635,7 @@ get the nt drivers list
traverse the database and look-up the matching names
****************************************************************************/
-int get_ntdrivers(fstring **list, char *architecture, uint32 version)
+int get_ntdrivers(fstring **list, const char *architecture, uint32 version)
{
int total=0;
fstring short_archi;
@@ -668,11 +668,11 @@ int get_ntdrivers(fstring **list, char *architecture, uint32 version)
function to do the mapping between the long architecture name and
the short one.
****************************************************************************/
-BOOL get_short_archi(char *short_archi, char *long_archi)
+BOOL get_short_archi(char *short_archi, const char *long_archi)
{
struct table {
- char *long_archi;
- char *short_archi;
+ const char *long_archi;
+ const char *short_archi;
};
struct table archi_table[]=
@@ -1714,7 +1714,7 @@ static uint32 add_a_printer_driver_6(NT_PRINTER_DRIVER_INFO_LEVEL_6 *driver)
/****************************************************************************
****************************************************************************/
-static WERROR get_a_printer_driver_3_default(NT_PRINTER_DRIVER_INFO_LEVEL_3 **info_ptr, fstring driver, fstring arch)
+static WERROR get_a_printer_driver_3_default(NT_PRINTER_DRIVER_INFO_LEVEL_3 **info_ptr, const char *driver, const char *arch)
{
NT_PRINTER_DRIVER_INFO_LEVEL_3 info;
@@ -1741,7 +1741,7 @@ static WERROR get_a_printer_driver_3_default(NT_PRINTER_DRIVER_INFO_LEVEL_3 **in
/****************************************************************************
****************************************************************************/
-static WERROR get_a_printer_driver_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 **info_ptr, fstring drivername, fstring arch, uint32 version)
+static WERROR get_a_printer_driver_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 **info_ptr, fstring drivername, const char *arch, uint32 version)
{
NT_PRINTER_DRIVER_INFO_LEVEL_3 driver;
TDB_DATA kbuf, dbuf;
@@ -2314,7 +2314,7 @@ int unpack_devicemode(NT_DEVICEMODE **nt_devmode, char *buf, int buflen)
allocate and initialize a new slot in
***************************************************************************/
-static int add_new_printer_key( NT_PRINTER_DATA *data, char *name )
+static int add_new_printer_key( NT_PRINTER_DATA *data, const char *name )
{
NT_PRINTER_KEY *d;
int key_index;
@@ -2348,7 +2348,7 @@ static int add_new_printer_key( NT_PRINTER_DATA *data, char *name )
search for a registry key name in the existing printer data
***************************************************************************/
-int lookup_printerkey( NT_PRINTER_DATA *data, char *name )
+int lookup_printerkey( NT_PRINTER_DATA *data, const char *name )
{
int key_index = -1;
int i;
@@ -2376,7 +2376,7 @@ int lookup_printerkey( NT_PRINTER_DATA *data, char *name )
/****************************************************************************
***************************************************************************/
-uint32 get_printer_subkeys( NT_PRINTER_DATA *data, char* key, fstring **subkeys )
+uint32 get_printer_subkeys( NT_PRINTER_DATA *data, const char* key, fstring **subkeys )
{
int i, j;
int key_len;
@@ -2505,7 +2505,8 @@ static BOOL map_nt_printer_info2_to_dsspooler(NT_PRINTER_INFO_LEVEL_2 *info2)
{
REGVAL_CTR *ctr = NULL;
fstring longname;
- char *ascii_str;
+ char *allocated_string = NULL;
+ const char *ascii_str;
int i;
if ((i = lookup_printerkey(&info2->data, SPOOL_DSSPOOLER_KEY)) < 0)
@@ -2518,10 +2519,9 @@ static BOOL map_nt_printer_info2_to_dsspooler(NT_PRINTER_INFO_LEVEL_2 *info2)
get_myfullname(longname);
map_sz_into_ctr(ctr, SPOOL_REG_SERVERNAME, longname);
- asprintf(&ascii_str, "\\\\%s\\%s", longname, info2->sharename);
- map_sz_into_ctr(ctr, SPOOL_REG_UNCNAME, ascii_str);
- safe_free(ascii_str);
-
+ asprintf(&allocated_string, "\\\\%s\\%s", longname, info2->sharename);
+ map_sz_into_ctr(ctr, SPOOL_REG_UNCNAME, allocated_string);
+ SAFE_FREE(allocated_string);
map_dword_into_ctr(ctr, SPOOL_REG_VERSIONNUMBER, 4);
map_sz_into_ctr(ctr, SPOOL_REG_DRIVERNAME, info2->drivername);
@@ -2760,7 +2760,7 @@ BOOL is_printer_published(int snum, GUID *guid)
/****************************************************************************
***************************************************************************/
-WERROR delete_all_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, char *key )
+WERROR delete_all_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key )
{
NT_PRINTER_DATA *data;
int i;
@@ -2858,7 +2858,7 @@ WERROR delete_all_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, char *key )
/****************************************************************************
***************************************************************************/
-WERROR delete_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, char *key, char *value )
+WERROR delete_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, const char *value )
{
WERROR result = WERR_OK;
int key_index;
@@ -2885,7 +2885,7 @@ WERROR delete_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, char *key, char *value
/****************************************************************************
***************************************************************************/
-WERROR add_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, char *key, char *value,
+WERROR add_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, const char *value,
uint32 type, uint8 *data, int real_len )
{
WERROR result = WERR_OK;
@@ -2917,7 +2917,7 @@ WERROR add_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, char *key, char *value,
/****************************************************************************
***************************************************************************/
-REGISTRY_VALUE* get_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, char *key, char *value )
+REGISTRY_VALUE* get_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, const char *value )
{
int key_index;
@@ -3901,7 +3901,7 @@ uint32 add_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL driver, uint32 level)
/****************************************************************************
****************************************************************************/
WERROR get_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL *driver, uint32 level,
- fstring drivername, fstring architecture, uint32 version)
+ fstring drivername, const char *architecture, uint32 version)
{
WERROR result;
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index cde1646107..711d99f394 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -165,7 +165,7 @@ static int get_queue_status(int, print_status_struct *);
BOOL print_backend_init(void)
{
- char *sversion = "INFO/version";
+ const char *sversion = "INFO/version";
pstring printing_path;
int services = lp_numservices();
int snum;
@@ -1291,10 +1291,10 @@ BOOL print_job_delete(struct current_user *user, int snum, uint32 jobid, WERROR
*errcode = WERR_ACCESS_DENIED;
/* BEGIN_ADMIN_LOG */
- sys_adminlog( LOG_ERR, (char *)
- "Permission denied-- user not allowed to delete, \
+ sys_adminlog( LOG_ERR,
+ "Permission denied-- user not allowed to delete, \
pause, or resume print job. User name: %s. Printer name: %s.",
- uidtoname(user->uid), PRINTERNAME(snum) );
+ uidtoname(user->uid), PRINTERNAME(snum) );
/* END_ADMIN_LOG */
return False;
@@ -1356,7 +1356,7 @@ BOOL print_job_pause(struct current_user *user, int snum, uint32 jobid, WERROR *
DEBUG(3, ("pause denied by security descriptor\n"));
/* BEGIN_ADMIN_LOG */
- sys_adminlog( LOG_ERR, (char *)
+ sys_adminlog( LOG_ERR,
"Permission denied-- user not allowed to delete, \
pause, or resume print job. User name: %s. Printer name: %s.",
uidtoname(user->uid), PRINTERNAME(snum) );
@@ -1407,7 +1407,7 @@ BOOL print_job_resume(struct current_user *user, int snum, uint32 jobid, WERROR
*errcode = WERR_ACCESS_DENIED;
/* BEGIN_ADMIN_LOG */
- sys_adminlog( LOG_ERR, (char *)
+ sys_adminlog( LOG_ERR,
"Permission denied-- user not allowed to delete, \
pause, or resume print job. User name: %s. Printer name: %s.",
uidtoname(user->uid), PRINTERNAME(snum) );