svn commit: samba r22897 - in
branches/SAMBA_3_0_26/source/utils: .
Michael Adam
ma at sernet.de
Tue May 15 13:43:01 GMT 2007
On Tue, May 15, 2007 at 10:28:32PM +1000, Andrew Bartlett wrote:
> On Tue, 2007-05-15 at 11:12 +0000, obnox at samba.org wrote:
> >
> > Log:
> > Fix c++ warnings (add explicit casts).
>
> These calls would be much safer down without the casts, and with
> talloc() and a structure assignment. This would also tag the structure
> with the correct name.
>
> I'm particularly worried by the cast being to (struct devicemode *), but
> the sizeof() being for DEVICEMODE. This is exactly the type of bug that
> the new talloc() was written to avoid.
Firstly, we have "typedef struct devicemode DEVICEMODE;"
and secondly, i only pulled this to sync with 3_0.
Of course you are right, and conceptional enhancements should follow!
Michael
> > Changeset:
> > Modified: branches/SAMBA_3_0_26/source/utils/net_rpc_printer.c
> > ===================================================================
> > --- branches/SAMBA_3_0_26/source/utils/net_rpc_printer.c 2007-05-15 11:00:20 UTC (rev 22896)
> > +++ branches/SAMBA_3_0_26/source/utils/net_rpc_printer.c 2007-05-15 11:12:10 UTC (rev 22897)
> > @@ -2166,7 +2166,7 @@
> > if (ctr_enum.printers_2[i].devmode != NULL) {
> >
> > /* copy devmode (info level 2) */
> > - ctr_dst.printers_2->devmode =
> > + ctr_dst.printers_2->devmode = (struct devicemode *)
> > TALLOC_MEMDUP(mem_ctx,
> > ctr_enum.printers_2[i].devmode,
> > sizeof(DEVICEMODE));
>
> --
> Andrew Bartlett http://samba.org/~abartlet/
> Authentication Developer, Samba Team http://samba.org
> Samba Developer, Red Hat Inc. http://redhat.com
More information about the samba-technical
mailing list