dlls/msi/helpers.c -- remove two useless checks (and dead code)
Gerald Pfeifer
gerald at pfeifer.com
Tue Jan 1 11:18:51 CST 2008
On Sat, 3 Nov 2007, Gerald Pfeifer wrote:
> In both those code paths size is an unsigned type, so the check for
> non-negativity does not make any sense.
Okay, so let me split this patch into two pieces and start with the
first.
I traced back the setting of size via MSI_FormatRecordW() and
deformat_string_internal() and in no case do get to -1 or another
negative error marker. Both by type (DWORD) and assignments size
is always >= 0, so the check can be omitted
Gerald
ChangeLog:
Remove an extraneous safety check and simplify deformat_string().
Index: dlls/msi/helpers.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/helpers.c,v
retrieving revision 1.71
diff -u -3 -p -r1.71 helpers.c
--- dlls/msi/helpers.c 1 Nov 2007 12:41:11 -0000 1.71
+++ dlls/msi/helpers.c 1 Jan 2008 17:06:44 -0000
@@ -368,18 +368,16 @@ DWORD deformat_string(MSIPACKAGE *packag
MSI_RecordSetStringW(rec,0,ptr);
MSI_FormatRecordW(package,rec,NULL,&size);
- if (size >= 0)
- {
- size++;
- *data = msi_alloc(size*sizeof(WCHAR));
- if (size > 1)
- MSI_FormatRecordW(package,rec,*data,&size);
- else
- *data[0] = 0;
- msiobj_release( &rec->hdr );
- return sizeof(WCHAR)*size;
- }
+
+ size++;
+ *data = msi_alloc(size*sizeof(WCHAR));
+ if (size > 1)
+ MSI_FormatRecordW(package,rec,*data,&size);
+ else
+ *data[0] = 0;
+
msiobj_release( &rec->hdr );
+ return sizeof(WCHAR)*size;
}
*data = NULL;
More information about the wine-patches
mailing list