Module: wine Branch: refs/heads/master Commit: f69d7bf0f33b3ef75d81df718c4010dc8a1943c9 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=f69d7bf0f33b3ef75d81df71...
Author: Mike McCormack mike@codeweavers.com Date: Tue Jan 10 12:10:19 2006 +0100
msi: Count the number of columns requested and allocate that many, as columns may be select more than once in from a table.
---
dlls/msi/select.c | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/dlls/msi/select.c b/dlls/msi/select.c index 9bc2b96..7c79260 100644 --- a/dlls/msi/select.c +++ b/dlls/msi/select.c @@ -245,20 +245,23 @@ static UINT SELECT_AddColumn( MSISELECTV return ERROR_SUCCESS; }
+int select_count_columns( column_info *col ) +{ + int n; + for (n = 0; col; col = col->next) + n++; + return n; +} + UINT SELECT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table, column_info *columns ) { MSISELECTVIEW *sv = NULL; - UINT count = 0, r; + UINT count = 0, r = ERROR_SUCCESS;
TRACE("%p\n", sv );
- r = table->ops->get_dimensions( table, NULL, &count ); - if( r != ERROR_SUCCESS ) - { - ERR("can't get table dimensions\n"); - return r; - } + count = select_count_columns( columns );
sv = msi_alloc_zero( sizeof *sv + count*sizeof (UINT) ); if( !sv )