summaryrefslogtreecommitdiffstats
path: root/source3/rpc_parse/parse_spoolss.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2002-05-13 14:41:55 +0000
committerGerald Carter <jerry@samba.org>2002-05-13 14:41:55 +0000
commitd53afaaff1da1967500788f7b1540297f3000972 (patch)
treea992dca794abb3828192540140b938f0062180c2 /source3/rpc_parse/parse_spoolss.c
parentc5ee0761908fc0ae7662d74f15f9ecb981a6ad88 (diff)
downloadsamba-d53afaaff1da1967500788f7b1540297f3000972.tar.gz
samba-d53afaaff1da1967500788f7b1540297f3000972.tar.xz
samba-d53afaaff1da1967500788f7b1540297f3000972.zip
compile fix merge from SAMBA_2_2
(This used to be commit 2676be4e419878fbf74b619949e1d84c6186691c)
Diffstat (limited to 'source3/rpc_parse/parse_spoolss.c')
-rw-r--r--source3/rpc_parse/parse_spoolss.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index 155fa7b3c9..997d29be89 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -558,15 +558,26 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo
fstring name;
uint32* field;
} opt_fields[DM_NUM_OPTIONAL_FIELDS] = {
- { "icmmethod", &devmode->icmmethod },
- { "icmintent", &devmode->icmintent },
- { "mediatype", &devmode->mediatype },
- { "dithertype", &devmode->dithertype },
- { "reserved1", &devmode->reserved1 },
- { "reserved2", &devmode->reserved2 },
- { "panningwidth", &devmode->panningwidth },
- { "panningheight", &devmode->panningheight }
+ { "icmmethod", NULL },
+ { "icmintent", NULL },
+ { "mediatype", NULL },
+ { "dithertype", NULL },
+ { "reserved1", NULL },
+ { "reserved2", NULL },
+ { "panningwidth", NULL },
+ { "panningheight", NULL }
};
+
+ /* assign at run time to keep non-gcc vompilers happy */
+
+ opt_fields[0].field = &devmode->icmmethod;
+ opt_fields[1].field = &devmode->icmintent;
+ opt_fields[2].field = &devmode->mediatype;
+ opt_fields[3].field = &devmode->dithertype;
+ opt_fields[4].field = &devmode->reserved1;
+ opt_fields[5].field = &devmode->reserved2;
+ opt_fields[6].field = &devmode->panningwidth;
+ opt_fields[7].field = &devmode->panningheight;
prs_debug(ps, depth, desc, "spoolss_io_devmode");
@@ -667,7 +678,7 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo
/* Sanity check - we only have uint32's left tp parse */
- if ( available_space && ((available_space % 4) != 0) ) {
+ if ( available_space && ((available_space % sizeof(uint32)) != 0) ) {
DEBUG(0,("spoolss_io_devmode: available_space [%d] no in multiple of 4 bytes (size = %d)!\n",
available_space, devmode->size));
DEBUG(0,("spoolss_io_devmode: please report to samba-technical@samba.org!\n"));
@@ -679,7 +690,7 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo
* zero'd by the caller.
*/
- while (available_space && (i<DM_NUM_OPTIONAL_FIELDS))
+ while ((available_space > 0) && (i < DM_NUM_OPTIONAL_FIELDS))
{
if (!prs_uint32(opt_fields[i].name, ps, depth, opt_fields[i].field))
return False;
@@ -699,7 +710,6 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo
}
-parse_driverextra:
if (devmode->driverextra!=0) {
if (UNMARSHALLING(ps)) {
devmode->private=(uint8 *)prs_alloc_mem(ps, devmode->driverextra*sizeof(uint8));