On Nov 3, 2007 1:10 PM, Gerald Pfeifer <[EMAIL PROTECTED]> wrote: > While removing the dead code I noticed that we can actually also > strengthen the const-ness of this function. > > Gerald > > ChangeLog: > Remove a check which never could trigger (due to the domain of the > variable in question) and increase const-ness of STREAMS_CreateView(). > > Index: dlls/msi/streams.c > =================================================================== > RCS file: /home/wine/wine/dlls/msi/streams.c,v > retrieving revision 1.7 > diff -u -3 -p -r1.7 streams.c > --- dlls/msi/streams.c 18 Oct 2007 13:00:57 -0000 1.7 > +++ dlls/msi/streams.c 3 Nov 2007 18:06:27 -0000 > @@ -430,7 +430,7 @@ static UINT add_streams_to_table(MSISTRE > return count; > } > > -UINT STREAMS_CreateView(MSIDATABASE *db, MSIVIEW **view) > +UINT STREAMS_CreateView(const MSIDATABASE *db, MSIVIEW **view) > { > MSISTREAMSVIEW *sv; > > @@ -444,9 +444,6 @@ UINT STREAMS_CreateView(MSIDATABASE *db, > sv->db = db; > sv->num_rows = add_streams_to_table(sv); > > - if (sv->num_rows < 0) > - return ERROR_FUNCTION_FAILED; > - > *view = (MSIVIEW *)sv; > > return ERROR_SUCCESS; >
This change is wrong. If you'd actually read what the code intended to do instead of just fixing warnings, you'd see that add_streams_to_table returns -1 on error. While the check for < 0 is not correct, removing the check entirely is wrong. The check should be if (sv->num_rows == -1) return ERROR_FUNCTION_FAILED. -- James Hawkins