Skip to content

Commit eb6788c

Browse files
winesynclearn-more
authored andcommitted
[WINESYNC] msi: Remove ref_count from MSICOLUMNINFO.
Signed-off-by: Piotr Caban <[email protected]> Signed-off-by: Hans Leidekker <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 7200257d0428b1e9b4da72e8c4e39f9cf27455e6 by Piotr Caban <[email protected]>
1 parent caa225a commit eb6788c

File tree

2 files changed

+19
-37
lines changed

2 files changed

+19
-37
lines changed

dll/win32/msi/alter.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ static UINT ALTER_execute( struct tagMSIVIEW *view, MSIRECORD *record )
147147

148148
TRACE("%p %p\n", av, record);
149149

150+
if (av->colinfo)
151+
return alter_add_column(av);
152+
150153
if (av->hold == 1)
151154
av->table->ops->add_ref(av->table);
152155
else if (av->hold == -1)
@@ -156,9 +159,6 @@ static UINT ALTER_execute( struct tagMSIVIEW *view, MSIRECORD *record )
156159
av->table = NULL;
157160
}
158161

159-
if (av->colinfo)
160-
return alter_add_column(av);
161-
162162
return ERROR_SUCCESS;
163163
}
164164

dll/win32/msi/table.c

Lines changed: 16 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ typedef struct tagMSICOLUMNINFO
5454
LPCWSTR colname;
5555
UINT type;
5656
UINT offset;
57-
INT ref_count;
5857
BOOL temporary;
5958
MSICOLUMNHASHENTRY **hash_table;
6059
} MSICOLUMNINFO;
@@ -80,14 +79,14 @@ static const WCHAR szNumber[] = {'N','u','m','b','e','r',0};
8079
static const WCHAR szType[] = {'T','y','p','e',0};
8180

8281
static const MSICOLUMNINFO _Columns_cols[4] = {
83-
{ szColumns, 1, szTable, MSITYPE_VALID | MSITYPE_STRING | MSITYPE_KEY | 64, 0, 0, 0, NULL },
84-
{ szColumns, 2, szNumber, MSITYPE_VALID | MSITYPE_KEY | 2, 2, 0, 0, NULL },
85-
{ szColumns, 3, szName, MSITYPE_VALID | MSITYPE_STRING | 64, 4, 0, 0, NULL },
86-
{ szColumns, 4, szType, MSITYPE_VALID | 2, 6, 0, 0, NULL },
82+
{ szColumns, 1, szTable, MSITYPE_VALID | MSITYPE_STRING | MSITYPE_KEY | 64, 0, 0, NULL },
83+
{ szColumns, 2, szNumber, MSITYPE_VALID | MSITYPE_KEY | 2, 2, 0, NULL },
84+
{ szColumns, 3, szName, MSITYPE_VALID | MSITYPE_STRING | 64, 4, 0, NULL },
85+
{ szColumns, 4, szType, MSITYPE_VALID | 2, 6, 0, NULL },
8786
};
8887

8988
static const MSICOLUMNINFO _Tables_cols[1] = {
90-
{ szTables, 1, szName, MSITYPE_VALID | MSITYPE_STRING | MSITYPE_KEY | 64, 0, 0, 0, NULL },
89+
{ szTables, 1, szName, MSITYPE_VALID | MSITYPE_STRING | MSITYPE_KEY | 64, 0, 0, NULL },
9190
};
9291

9392
#define MAX_STREAM_NAME 0x1f
@@ -694,7 +693,6 @@ static UINT get_tablecolumns( MSIDATABASE *db, LPCWSTR szTableName, MSICOLUMNINF
694693
colinfo[col - 1].type = read_table_int( table->data, i, table->colinfo[3].offset,
695694
sizeof(USHORT) ) - (1 << 15);
696695
colinfo[col - 1].offset = 0;
697-
colinfo[col - 1].ref_count = 0;
698696
colinfo[col - 1].hash_table = NULL;
699697
}
700698
n++;
@@ -765,7 +763,6 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info,
765763
table->colinfo[ i ].colname = msi_string_lookup( db->strings, col_id, NULL );
766764
table->colinfo[ i ].type = col->type;
767765
table->colinfo[ i ].offset = 0;
768-
table->colinfo[ i ].ref_count = 0;
769766
table->colinfo[ i ].hash_table = NULL;
770767
table->colinfo[ i ].temporary = col->temporary;
771768
}
@@ -1949,16 +1946,8 @@ static UINT TABLE_delete( struct tagMSIVIEW *view )
19491946
static UINT TABLE_add_ref(struct tagMSIVIEW *view)
19501947
{
19511948
MSITABLEVIEW *tv = (MSITABLEVIEW*)view;
1952-
UINT i;
19531949

19541950
TRACE("%p %d\n", view, tv->table->ref_count);
1955-
1956-
for (i = 0; i < tv->table->col_count; i++)
1957-
{
1958-
if (tv->table->colinfo[i].type & MSITYPE_TEMPORARY)
1959-
InterlockedIncrement(&tv->table->colinfo[i].ref_count);
1960-
}
1961-
19621951
return InterlockedIncrement(&tv->table->ref_count);
19631952
}
19641953

@@ -2022,25 +2011,25 @@ static UINT TABLE_release(struct tagMSIVIEW *view)
20222011

20232012
TRACE("%p %d\n", view, ref);
20242013

2025-
for (i = tv->table->col_count - 1; i >= 0; i--)
2014+
ref = InterlockedDecrement(&tv->table->ref_count);
2015+
if (ref == 0)
20262016
{
2027-
if (tv->table->colinfo[i].type & MSITYPE_TEMPORARY)
2017+
for (i = tv->table->col_count - 1; i >= 0; i--)
20282018
{
2029-
ref = InterlockedDecrement(&tv->table->colinfo[i].ref_count);
2030-
if (ref == 0)
2019+
if (tv->table->colinfo[i].type & MSITYPE_TEMPORARY)
20312020
{
20322021
r = TABLE_remove_column(view, tv->table->colinfo[i].tablename,
20332022
tv->table->colinfo[i].number);
20342023
if (r != ERROR_SUCCESS)
20352024
break;
20362025
}
2026+
else
2027+
{
2028+
break;
2029+
}
20372030
}
2038-
}
20392031

2040-
ref = InterlockedDecrement(&tv->table->ref_count);
2041-
if (ref == 0)
2042-
{
2043-
if (!tv->table->row_count)
2032+
if (!tv->table->col_count)
20442033
{
20452034
list_remove(&tv->table->entry);
20462035
free_table(tv->table);
@@ -2057,7 +2046,7 @@ static UINT TABLE_add_column(struct tagMSIVIEW *view, LPCWSTR table, UINT number
20572046
MSITABLEVIEW *tv = (MSITABLEVIEW*)view;
20582047
MSITABLE *msitable;
20592048
MSIRECORD *rec;
2060-
UINT r, i;
2049+
UINT r;
20612050

20622051
rec = MSI_CreateRecord(4);
20632052
if (!rec)
@@ -2078,14 +2067,7 @@ static UINT TABLE_add_column(struct tagMSIVIEW *view, LPCWSTR table, UINT number
20782067
goto done;
20792068

20802069
msitable = find_cached_table(tv->db, table);
2081-
for (i = 0; i < msitable->col_count; i++)
2082-
{
2083-
if (!wcscmp( msitable->colinfo[i].colname, column ))
2084-
{
2085-
InterlockedIncrement(&msitable->colinfo[i].ref_count);
2086-
break;
2087-
}
2088-
}
2070+
InterlockedIncrement(&msitable->ref_count);
20892071

20902072
done:
20912073
msiobj_release(&rec->hdr);

0 commit comments

Comments
 (0)