diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-03-29 09:35:51 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:19:00 -0500 |
commit | bc2b6436d0f5f3e9ffdfaeb7f1b32996a83d5478 (patch) | |
tree | 45124e070043ee0fd3774d74b4cfdcf1c8919c27 /source3/printing | |
parent | b9461058d59f8e4f4b69c31592bd12a179b2d8ac (diff) | |
download | samba-bc2b6436d0f5f3e9ffdfaeb7f1b32996a83d5478.tar.gz samba-bc2b6436d0f5f3e9ffdfaeb7f1b32996a83d5478.tar.bz2 samba-bc2b6436d0f5f3e9ffdfaeb7f1b32996a83d5478.zip |
r22009: change TDB_DATA from char * to unsigned char *
and fix all compiler warnings in the users
metze
(This used to be commit 3a28443079c141a6ce8182c65b56ca210e34f37f)
Diffstat (limited to 'source3/printing')
-rw-r--r-- | source3/printing/notify.c | 6 | ||||
-rw-r--r-- | source3/printing/nt_printing.c | 55 | ||||
-rw-r--r-- | source3/printing/printing.c | 34 |
3 files changed, 48 insertions, 47 deletions
diff --git a/source3/printing/notify.c b/source3/printing/notify.c index 7d5b702781..2db8768395 100644 --- a/source3/printing/notify.c +++ b/source3/printing/notify.c @@ -31,7 +31,7 @@ static struct notify_queue { struct notify_queue *next, *prev; struct spoolss_notify_msg *msg; struct timeval tv; - char *buf; + uint8 *buf; size_t buflen; } *notify_queue_head = NULL; @@ -75,7 +75,7 @@ BOOL print_notify_messages_pending(void) static BOOL flatten_message(struct notify_queue *q) { struct spoolss_notify_msg *msg = q->msg; - char *buf = NULL; + uint8 *buf = NULL; size_t buflen = 0, len; again: @@ -99,7 +99,7 @@ again: msg->len, msg->notify.data); if (buflen != len) { - buf = (char *)TALLOC_REALLOC(send_ctx, buf, len); + buf = (uint8 *)TALLOC_REALLOC(send_ctx, buf, len); if (!buf) return False; buflen = len; diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 2bddf4d530..7a3d14703f 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -279,7 +279,7 @@ static BOOL upgrade_to_version_3(void) dbuf = tdb_fetch(tdb_drivers, kbuf); - if (strncmp(kbuf.dptr, FORMS_PREFIX, strlen(FORMS_PREFIX)) == 0) { + if (strncmp((const char *)kbuf.dptr, FORMS_PREFIX, strlen(FORMS_PREFIX)) == 0) { DEBUG(0,("upgrade_to_version_3:moving form\n")); if (tdb_store(tdb_forms, kbuf, dbuf, TDB_REPLACE) != 0) { SAFE_FREE(dbuf.dptr); @@ -293,7 +293,7 @@ static BOOL upgrade_to_version_3(void) } } - if (strncmp(kbuf.dptr, PRINTERS_PREFIX, strlen(PRINTERS_PREFIX)) == 0) { + if (strncmp((const char *)kbuf.dptr, PRINTERS_PREFIX, strlen(PRINTERS_PREFIX)) == 0) { DEBUG(0,("upgrade_to_version_3:moving printer\n")); if (tdb_store(tdb_printers, kbuf, dbuf, TDB_REPLACE) != 0) { SAFE_FREE(dbuf.dptr); @@ -307,7 +307,7 @@ static BOOL upgrade_to_version_3(void) } } - if (strncmp(kbuf.dptr, SECDESC_PREFIX, strlen(SECDESC_PREFIX)) == 0) { + if (strncmp((const char *)kbuf.dptr, SECDESC_PREFIX, strlen(SECDESC_PREFIX)) == 0) { DEBUG(0,("upgrade_to_version_3:moving secdesc\n")); if (tdb_store(tdb_printers, kbuf, dbuf, TDB_REPLACE) != 0) { SAFE_FREE(dbuf.dptr); @@ -352,7 +352,7 @@ static int sec_desc_upg_fn( TDB_CONTEXT *the_tdb, TDB_DATA key, return 0; } - if ( strncmp( key.dptr, SECDESC_PREFIX, strlen(SECDESC_PREFIX) ) != 0 ) { + if ( strncmp((const char *) key.dptr, SECDESC_PREFIX, strlen(SECDESC_PREFIX) ) != 0 ) { return 0; } @@ -361,11 +361,12 @@ static int sec_desc_upg_fn( TDB_CONTEXT *the_tdb, TDB_DATA key, ZERO_STRUCT( ps ); prs_init( &ps, 0, ctx, UNMARSHALL ); - prs_give_memory( &ps, data.dptr, data.dsize, False ); + prs_give_memory( &ps, (char *)data.dptr, data.dsize, False ); if ( !sec_io_desc_buf( "sec_desc_upg_fn", &sd_orig, &ps, 1 ) ) { /* delete bad entries */ - DEBUG(0,("sec_desc_upg_fn: Failed to parse original sec_desc for %si. Deleting....\n", key.dptr )); + DEBUG(0,("sec_desc_upg_fn: Failed to parse original sec_desc for %si. Deleting....\n", + (const char *)key.dptr )); tdb_delete( tdb_printers, key ); prs_mem_free( &ps ); return 0; @@ -439,7 +440,7 @@ static int sec_desc_upg_fn( TDB_CONTEXT *the_tdb, TDB_DATA key, return 0; } - data.dptr = prs_data_p( &ps ); + data.dptr = (uint8 *)prs_data_p( &ps ); data.dsize = sd_size; result = tdb_store( tdb_printers, key, data, TDB_REPLACE ); @@ -489,11 +490,11 @@ static int normalize_printers_fn( TDB_CONTEXT *the_tdb, TDB_DATA key, /* upgrade printer records and security descriptors */ - if ( strncmp( key.dptr, PRINTERS_PREFIX, strlen(PRINTERS_PREFIX) ) == 0 ) { - new_key = make_printer_tdbkey( key.dptr+strlen(PRINTERS_PREFIX) ); + if ( strncmp((const char *) key.dptr, PRINTERS_PREFIX, strlen(PRINTERS_PREFIX) ) == 0 ) { + new_key = make_printer_tdbkey( (const char *)key.dptr+strlen(PRINTERS_PREFIX) ); } - else if ( strncmp( key.dptr, SECDESC_PREFIX, strlen(SECDESC_PREFIX) ) == 0 ) { - new_key = make_printers_secdesc_tdbkey( key.dptr+strlen(SECDESC_PREFIX) ); + else if ( strncmp((const char *) key.dptr, SECDESC_PREFIX, strlen(SECDESC_PREFIX) ) == 0 ) { + new_key = make_printers_secdesc_tdbkey( (const char *)key.dptr+strlen(SECDESC_PREFIX) ); } else { /* ignore this record */ @@ -786,14 +787,14 @@ int get_ntforms(nt_forms_struct **list) kbuf.dptr; newkey = tdb_nextkey(tdb_forms, kbuf), safe_free(kbuf.dptr), kbuf=newkey) { - if (strncmp(kbuf.dptr, FORMS_PREFIX, strlen(FORMS_PREFIX)) != 0) + if (strncmp((const char *)kbuf.dptr, FORMS_PREFIX, strlen(FORMS_PREFIX)) != 0) continue; dbuf = tdb_fetch(tdb_forms, kbuf); if (!dbuf.dptr) continue; - fstrcpy(form.name, kbuf.dptr+strlen(FORMS_PREFIX)); + fstrcpy(form.name, (const char *)kbuf.dptr+strlen(FORMS_PREFIX)); ret = tdb_unpack(dbuf.dptr, dbuf.dsize, "dddddddd", &i, &form.flag, &form.width, &form.length, &form.left, &form.top, &form.right, &form.bottom); @@ -826,14 +827,14 @@ int write_ntforms(nt_forms_struct **list, int number) for (i=0;i<number;i++) { /* save index, so list is rebuilt in correct order */ - len = tdb_pack(buf, sizeof(buf), "dddddddd", + len = tdb_pack((uint8 *)buf, sizeof(buf), "dddddddd", i, (*list)[i].flag, (*list)[i].width, (*list)[i].length, (*list)[i].left, (*list)[i].top, (*list)[i].right, (*list)[i].bottom); if (len > sizeof(buf)) break; slprintf(key, sizeof(key)-1, "%s%s", FORMS_PREFIX, (*list)[i].name); dbuf.dsize = len; - dbuf.dptr = buf; + dbuf.dptr = (uint8 *)buf; if (tdb_store_bystring(tdb_forms, key, dbuf, TDB_REPLACE) != 0) break; } @@ -974,7 +975,7 @@ int get_ntdrivers(fstring **list, const char *architecture, uint32 version) kbuf.dptr; newkey = tdb_nextkey(tdb_drivers, kbuf), safe_free(kbuf.dptr), kbuf=newkey) { - if (strncmp(kbuf.dptr, key, strlen(key)) != 0) + if (strncmp((const char *)kbuf.dptr, key, strlen(key)) != 0) continue; if((*list = SMB_REALLOC_ARRAY(*list, fstring, total+1)) == NULL) { @@ -982,7 +983,7 @@ int get_ntdrivers(fstring **list, const char *architecture, uint32 version) return -1; } - fstrcpy((*list)[total], kbuf.dptr+strlen(key)); + fstrcpy((*list)[total], (const char *)kbuf.dptr+strlen(key)); total++; } @@ -1929,7 +1930,7 @@ static uint32 add_a_printer_driver_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 *driver) pstring directory; fstring temp_name; pstring key; - char *buf; + uint8 *buf; int i, ret; TDB_DATA dbuf; @@ -2006,7 +2007,7 @@ static uint32 add_a_printer_driver_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 *driver) } if (len != buflen) { - buf = (char *)SMB_REALLOC(buf, len); + buf = (uint8 *)SMB_REALLOC(buf, len); if (!buf) { DEBUG(0,("add_a_printer_driver_3: failed to enlarge buffer\n!")); ret = -1; @@ -2208,7 +2209,7 @@ static uint32 dump_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL driver, uint32 /**************************************************************************** ****************************************************************************/ -int pack_devicemode(NT_DEVICEMODE *nt_devmode, char *buf, int buflen) +int pack_devicemode(NT_DEVICEMODE *nt_devmode, uint8 *buf, int buflen) { int len = 0; @@ -2272,7 +2273,7 @@ int pack_devicemode(NT_DEVICEMODE *nt_devmode, char *buf, int buflen) Pack all values in all printer keys ***************************************************************************/ -static int pack_values(NT_PRINTER_DATA *data, char *buf, int buflen) +static int pack_values(NT_PRINTER_DATA *data, uint8 *buf, int buflen) { int len = 0; int i, j; @@ -2362,7 +2363,7 @@ uint32 del_a_printer(const char *sharename) ****************************************************************************/ static WERROR update_a_printer_2(NT_PRINTER_INFO_LEVEL_2 *info) { - char *buf; + uint8 *buf; int buflen, len; WERROR ret; TDB_DATA kbuf, dbuf; @@ -2429,7 +2430,7 @@ static WERROR update_a_printer_2(NT_PRINTER_INFO_LEVEL_2 *info) len += pack_values( info->data, buf+len, buflen-len ); if (buflen != len) { - buf = (char *)SMB_REALLOC(buf, len); + buf = (uint8 *)SMB_REALLOC(buf, len); if (!buf) { DEBUG(0,("update_a_printer_2: failed to enlarge buffer!\n")); ret = WERR_NOMEM; @@ -2587,7 +2588,7 @@ static void free_nt_printer_info_level_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr) /**************************************************************************** ****************************************************************************/ -int unpack_devicemode(NT_DEVICEMODE **nt_devmode, char *buf, int buflen) +int unpack_devicemode(NT_DEVICEMODE **nt_devmode, const uint8 *buf, int buflen) { int len = 0; int extra_len = 0; @@ -3524,7 +3525,7 @@ REGISTRY_VALUE* get_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, Unpack a list of registry values frem the TDB ***************************************************************************/ -static int unpack_values(NT_PRINTER_DATA *printer_data, char *buf, int buflen) +static int unpack_values(NT_PRINTER_DATA *printer_data, const uint8 *buf, int buflen) { int len = 0; uint32 type; @@ -4206,7 +4207,7 @@ BOOL del_driver_init(char *drivername) static uint32 update_driver_init_2(NT_PRINTER_INFO_LEVEL_2 *info) { pstring key; - char *buf; + uint8 *buf; int buflen, len, ret; TDB_DATA dbuf; @@ -4220,7 +4221,7 @@ static uint32 update_driver_init_2(NT_PRINTER_INFO_LEVEL_2 *info) len += pack_values( info->data, buf+len, buflen-len ); if (buflen < len) { - buf = (char *)SMB_REALLOC(buf, len); + buf = (uint8 *)SMB_REALLOC(buf, len); if (!buf) { DEBUG(0, ("update_driver_init_2: failed to enlarge buffer!\n")); ret = -1; diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 5aac04aa8d..8b61f07680 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -76,7 +76,7 @@ uint16 pjobid_to_rap(const char* sharename, uint32 jobid) ZERO_STRUCT( jinfo ); fstrcpy( jinfo.sharename, sharename ); jinfo.jobid = jobid; - key.dptr = (char*)&jinfo; + key.dptr = (uint8 *)&jinfo; key.dsize = sizeof(jinfo); data = tdb_fetch(rap_tdb, key); @@ -93,7 +93,7 @@ uint16 pjobid_to_rap(const char* sharename, uint32 jobid) if (rap_jobid == 0) rap_jobid = ++next_rap_jobid; SSVAL(buf,0,rap_jobid); - data.dptr = (char*)buf; + data.dptr = buf; data.dsize = sizeof(rap_jobid); tdb_store(rap_tdb, key, data, TDB_REPLACE); tdb_store(rap_tdb, data, key, TDB_REPLACE); @@ -114,7 +114,7 @@ BOOL rap_to_pjobid(uint16 rap_jobid, fstring sharename, uint32 *pjobid) return False; SSVAL(buf,0,rap_jobid); - key.dptr = (char*)buf; + key.dptr = buf; key.dsize = sizeof(rap_jobid); data = tdb_fetch(rap_tdb, key); if ( data.dptr && data.dsize == sizeof(struct rap_jobid_key) ) @@ -149,7 +149,7 @@ static void rap_jobid_delete(const char* sharename, uint32 jobid) ZERO_STRUCT( jinfo ); fstrcpy( jinfo.sharename, sharename ); jinfo.jobid = jobid; - key.dptr = (char*)&jinfo; + key.dptr = (uint8 *)&jinfo; key.dsize = sizeof(jinfo); data = tdb_fetch(rap_tdb, key); @@ -166,7 +166,7 @@ static void rap_jobid_delete(const char* sharename, uint32 jobid) rap_jobid = SVAL(data.dptr, 0); SAFE_FREE(data.dptr); SSVAL(buf,0,rap_jobid); - data.dptr = (char*)buf; + data.dptr = buf; data.dsize = sizeof(rap_jobid); tdb_delete(rap_tdb, key); tdb_delete(rap_tdb, data); @@ -273,7 +273,7 @@ static TDB_DATA print_key(uint32 jobid) TDB_DATA ret; SIVAL(&j, 0, jobid); - ret.dptr = (char *)&j; + ret.dptr = (uint8 *)&j; ret.dsize = sizeof(j); return ret; } @@ -282,7 +282,7 @@ static TDB_DATA print_key(uint32 jobid) unpack a pjob from a tdb buffer ***********************************************************************/ -int unpack_pjob( char* buf, int buflen, struct printjob *pjob ) +int unpack_pjob( uint8 *buf, int buflen, struct printjob *pjob ) { int len = 0; int used; @@ -518,7 +518,7 @@ static BOOL pjob_store(const char* sharename, uint32 jobid, struct printjob *pjo TDB_DATA old_data, new_data; BOOL ret = False; struct tdb_print_db *pdb = get_print_db_byname(sharename); - char *buf = NULL; + uint8 *buf = NULL; int len, newlen, buflen; @@ -554,7 +554,7 @@ static BOOL pjob_store(const char* sharename, uint32 jobid, struct printjob *pjo len += pack_devicemode(pjob->nt_devmode, buf+len, buflen-len); if (buflen != len) { - buf = (char *)SMB_REALLOC(buf, len); + buf = (uint8 *)SMB_REALLOC(buf, len); if (!buf) { DEBUG(0,("pjob_store: failed to enlarge buffer!\n")); goto done; @@ -917,7 +917,7 @@ static void set_updating_pid(const fstring sharename, BOOL updating) } SIVAL( buffer, 0, updating_pid); - data.dptr = (char *)buffer; + data.dptr = buffer; data.dsize = 4; /* we always assume this is a 4 byte value */ tdb_store(pdb->tdb, key, data, TDB_REPLACE); @@ -984,7 +984,7 @@ static void store_queue_struct(struct tdb_print_db *pdb, struct traverse_struct queue[i].fs_file); } - if ((data.dptr = (char *)SMB_MALLOC(data.dsize)) == NULL) + if ((data.dptr = (uint8 *)SMB_MALLOC(data.dsize)) == NULL) return; len = 0; @@ -1234,7 +1234,7 @@ static void print_queue_update_internal( const char *sharename, key = string_tdb_data(keystr); status.qcount = qcount; - data.dptr = (char *)&status; + data.dptr = (uint8 *)&status; data.dsize = sizeof(status); tdb_store(pdb->tdb, key, data, TDB_REPLACE); @@ -1357,7 +1357,7 @@ static void print_queue_receive(int msg_type, struct process_id src, int printing_type; size_t len; - len = tdb_unpack( (char *)buf, msglen, "fdPP", + len = tdb_unpack( buf, msglen, "fdPP", sharename, &printing_type, lpqcommand, @@ -1442,7 +1442,7 @@ static void print_queue_update(int snum, BOOL force) fstring key; fstring sharename; pstring lpqcommand, lprmcommand; - char *buffer = NULL; + uint8 *buffer = NULL; size_t len = 0; size_t newlen; struct tdb_print_db *pdb; @@ -1496,7 +1496,7 @@ static void print_queue_update(int snum, BOOL force) lpqcommand, lprmcommand ); - buffer = SMB_XMALLOC_ARRAY( char, len ); + buffer = SMB_XMALLOC_ARRAY( uint8, len ); /* now pack the buffer */ newlen = tdb_pack( buffer, len, "fdPP", @@ -1604,7 +1604,7 @@ BOOL print_notify_register_pid(int snum) if (i == data.dsize) { /* We weren't in the list. Realloc. */ - data.dptr = (char *)SMB_REALLOC(data.dptr, data.dsize + 8); + data.dptr = (uint8 *)SMB_REALLOC(data.dptr, data.dsize + 8); if (!data.dptr) { DEBUG(0,("print_notify_register_pid: Relloc fail for printer %s\n", printername)); @@ -2299,7 +2299,7 @@ static BOOL add_to_jobs_changed(struct tdb_print_db *pdb, uint32 jobid) uint32 store_jobid; SIVAL(&store_jobid, 0, jobid); - data.dptr = (char *)&store_jobid; + data.dptr = (uint8 *)&store_jobid; data.dsize = 4; DEBUG(10,("add_to_jobs_changed: Added jobid %u\n", (unsigned int)jobid )); |