wbemprox: Avoid evaluating row conditions twice.
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
22ae86f65c
commit
08d928171c
|
@ -3026,7 +3026,7 @@ static enum fill_status fill_printer( struct table *table, const struct expr *co
|
||||||
WCHAR id[20];
|
WCHAR id[20];
|
||||||
|
|
||||||
EnumPrintersW( PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &size, &count );
|
EnumPrintersW( PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &size, &count );
|
||||||
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) return FILL_STATUS_FAILED;
|
if (!count) return FILL_STATUS_UNFILTERED;
|
||||||
|
|
||||||
if (!(info = heap_alloc( size ))) return FILL_STATUS_FAILED;
|
if (!(info = heap_alloc( size ))) return FILL_STATUS_FAILED;
|
||||||
if (!EnumPrintersW( PRINTER_ENUM_LOCAL, NULL, 2, (BYTE *)info, size, &size, &count ))
|
if (!EnumPrintersW( PRINTER_ENUM_LOCAL, NULL, 2, (BYTE *)info, size, &size, &count ))
|
||||||
|
@ -3093,7 +3093,11 @@ static enum fill_status fill_process( struct table *table, const struct expr *co
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (!resize_table( table, row + 1, sizeof(*rec) )) goto done;
|
if (!resize_table( table, row + 1, sizeof(*rec) ))
|
||||||
|
{
|
||||||
|
status = FILL_STATUS_FAILED;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
rec = (struct record_process *)(table->data + offset);
|
rec = (struct record_process *)(table->data + offset);
|
||||||
rec->caption = heap_strdupW( entry.szExeFile );
|
rec->caption = heap_strdupW( entry.szExeFile );
|
||||||
|
@ -3118,7 +3122,6 @@ static enum fill_status fill_process( struct table *table, const struct expr *co
|
||||||
|
|
||||||
TRACE("created %u rows\n", row);
|
TRACE("created %u rows\n", row);
|
||||||
table->num_rows = row;
|
table->num_rows = row;
|
||||||
status = FILL_STATUS_UNFILTERED;
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
CloseHandle( snap );
|
CloseHandle( snap );
|
||||||
|
|
|
@ -404,13 +404,15 @@ HRESULT eval_cond( const struct table *table, UINT row, const struct expr *cond,
|
||||||
HRESULT execute_view( struct view *view )
|
HRESULT execute_view( struct view *view )
|
||||||
{
|
{
|
||||||
UINT i, j = 0, len;
|
UINT i, j = 0, len;
|
||||||
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
||||||
|
|
||||||
if (!view->table) return S_OK;
|
if (!view->table) return S_OK;
|
||||||
if (view->table->fill)
|
if (view->table->fill)
|
||||||
{
|
{
|
||||||
clear_table( view->table );
|
clear_table( view->table );
|
||||||
view->table->fill( view->table, view->cond );
|
status = view->table->fill( view->table, view->cond );
|
||||||
}
|
}
|
||||||
|
if (status == FILL_STATUS_FAILED) return WBEM_E_FAILED;
|
||||||
if (!view->table->num_rows) return S_OK;
|
if (!view->table->num_rows) return S_OK;
|
||||||
|
|
||||||
len = min( view->table->num_rows, 16 );
|
len = min( view->table->num_rows, 16 );
|
||||||
|
@ -429,7 +431,8 @@ HRESULT execute_view( struct view *view )
|
||||||
if (!(tmp = heap_realloc( view->result, len * sizeof(UINT) ))) return E_OUTOFMEMORY;
|
if (!(tmp = heap_realloc( view->result, len * sizeof(UINT) ))) return E_OUTOFMEMORY;
|
||||||
view->result = tmp;
|
view->result = tmp;
|
||||||
}
|
}
|
||||||
if ((hr = eval_cond( view->table, i, view->cond, &val, &type )) != S_OK) return hr;
|
if (status == FILL_STATUS_FILTERED) val = 1;
|
||||||
|
else if ((hr = eval_cond( view->table, i, view->cond, &val, &type )) != S_OK) return hr;
|
||||||
if (val) view->result[j++] = i;
|
if (val) view->result[j++] = i;
|
||||||
}
|
}
|
||||||
view->count = j;
|
view->count = j;
|
||||||
|
|
Loading…
Reference in New Issue