From 92243bbcde2f22b3ada7b665acc70382de369ddb Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Mon, 10 Dec 2012 00:01:22 +0100 Subject: Rename libmsi_record_create() to libmsi_record_new() --- include/libmsi-record.h | 2 +- libmsi/insert.c | 4 ++-- libmsi/libmsi-database.c | 4 ++-- libmsi/libmsi-query.c | 4 ++-- libmsi/libmsi-record.c | 4 ++-- libmsi/msipriv.h | 2 +- libmsi/select.c | 4 ++-- libmsi/table.c | 14 ++++++------- libmsi/update.c | 2 +- libmsi/where.c | 2 +- tests/testdatabase.c | 54 ++++++++++++++++++++++++------------------------ tests/testrecord.c | 16 +++++++------- tools/msibuild.c | 2 +- tools/msiinfo.c | 2 +- 14 files changed, 58 insertions(+), 58 deletions(-) diff --git a/include/libmsi-record.h b/include/libmsi-record.h index c59a043..0b21019 100644 --- a/include/libmsi-record.h +++ b/include/libmsi-record.h @@ -21,7 +21,7 @@ #include "libmsi-types.h" -LibmsiRecord * libmsi_record_create (guint count); +LibmsiRecord * libmsi_record_new (guint count); LibmsiResult libmsi_record_clear_data (LibmsiRecord *); LibmsiResult libmsi_record_set_int (LibmsiRecord *,unsigned,int); LibmsiResult libmsi_record_set_string (LibmsiRecord *,unsigned,const char *); diff --git a/libmsi/insert.c b/libmsi/insert.c index c18b4db..777fc48 100644 --- a/libmsi/insert.c +++ b/libmsi/insert.c @@ -67,7 +67,7 @@ LibmsiRecord *msi_query_merge_record( unsigned fields, const column_info *vl, Li LibmsiRecord *merged; unsigned wildcard_count = 1, i; - merged = libmsi_record_create( fields ); + merged = libmsi_record_new( fields ); for( i=1; i <= fields; i++ ) { if( !vl ) @@ -144,7 +144,7 @@ static unsigned msi_arrange_record(LibmsiInsertView *iv, LibmsiRecord **values) if (col_count == val_count && msi_columns_in_order(iv, col_count)) return LIBMSI_RESULT_SUCCESS; - padded = libmsi_record_create(col_count); + padded = libmsi_record_new(col_count); if (!padded) return LIBMSI_RESULT_OUTOFMEMORY; diff --git a/libmsi/libmsi-database.c b/libmsi/libmsi-database.c index 9c8bc3c..e4bafc0 100644 --- a/libmsi/libmsi-database.c +++ b/libmsi/libmsi-database.c @@ -1174,7 +1174,7 @@ static unsigned construct_record(unsigned num_columns, WCHAR **types, { unsigned i; - *rec = libmsi_record_create(num_columns); + *rec = libmsi_record_new(num_columns); if (!*rec) return LIBMSI_RESULT_OUTOFMEMORY; @@ -2540,7 +2540,7 @@ unsigned _libmsi_database_get_primary_keys( LibmsiDatabase *db, TRACE("Found %d primary keys\n", info.n ); /* allocate a record and fill in the names of the tables */ - info.rec = libmsi_record_create( info.n ); + info.rec = libmsi_record_new( info.n ); info.n = 0; r = _libmsi_query_iterate_records( query, 0, msi_primary_key_iterator, &info ); if( r == LIBMSI_RESULT_SUCCESS ) diff --git a/libmsi/libmsi-query.c b/libmsi/libmsi-query.c index d020e16..b5a48ad 100644 --- a/libmsi/libmsi-query.c +++ b/libmsi/libmsi-query.c @@ -254,7 +254,7 @@ unsigned msi_view_get_row(LibmsiDatabase *db, LibmsiView *view, unsigned row, Li if (row >= row_count) return LIBMSI_RESULT_NO_MORE_ITEMS; - *rec = libmsi_record_create(col_count); + *rec = libmsi_record_new(col_count); if (!*rec) return LIBMSI_RESULT_FUNCTION_FAILED; @@ -469,7 +469,7 @@ unsigned _libmsi_query_get_column_info( LibmsiQuery *query, LibmsiColInfo info, if( !count ) return LIBMSI_RESULT_INVALID_PARAMETER; - rec = libmsi_record_create( count ); + rec = libmsi_record_new( count ); if( !rec ) return LIBMSI_RESULT_FUNCTION_FAILED; diff --git a/libmsi/libmsi-record.c b/libmsi/libmsi-record.c index 6aefe53..225475e 100644 --- a/libmsi/libmsi-record.c +++ b/libmsi/libmsi-record.c @@ -70,7 +70,7 @@ void _libmsi_record_destroy( LibmsiObject *arg ) _libmsi_free_field( &rec->fields[i] ); } -LibmsiRecord *libmsi_record_create( unsigned cParams ) +LibmsiRecord *libmsi_record_new( unsigned cParams ) { LibmsiRecord *rec; unsigned len; @@ -657,7 +657,7 @@ LibmsiRecord *_libmsi_record_clone(LibmsiRecord *rec) unsigned r, i, count; count = libmsi_record_get_field_count(rec); - clone = libmsi_record_create(count); + clone = libmsi_record_new(count); if (!clone) return NULL; diff --git a/libmsi/msipriv.h b/libmsi/msipriv.h index 297f089..d9fb5e8 100644 --- a/libmsi/msipriv.h +++ b/libmsi/msipriv.h @@ -120,7 +120,7 @@ typedef struct _LibmsiField typedef struct _LibmsiRecord { LibmsiObject hdr; - unsigned count; /* as passed to libmsi_record_create */ + unsigned count; /* as passed to libmsi_record_new */ LibmsiField fields[1]; /* nb. array size is count+1 */ } LibmsiRecord; diff --git a/libmsi/select.c b/libmsi/select.c index 3866cae..949a70a 100644 --- a/libmsi/select.c +++ b/libmsi/select.c @@ -121,7 +121,7 @@ static unsigned select_view_set_row( LibmsiView *view, unsigned row, LibmsiRecor return r; /* expand the record to the right size for the underlying table */ - expanded = libmsi_record_create( col_count ); + expanded = libmsi_record_new( col_count ); if ( !expanded ) return LIBMSI_RESULT_FUNCTION_FAILED; @@ -158,7 +158,7 @@ static unsigned select_view_insert_row( LibmsiView *view, LibmsiRecord *record, if (r != LIBMSI_RESULT_SUCCESS) return r; - outrec = libmsi_record_create( table_cols + 1 ); + outrec = libmsi_record_new( table_cols + 1 ); for (i=0; inum_cols; i++) { diff --git a/libmsi/table.c b/libmsi/table.c index 4b8cc16..75122f6 100644 --- a/libmsi/table.c +++ b/libmsi/table.c @@ -854,7 +854,7 @@ unsigned msi_create_table( LibmsiDatabase *db, const WCHAR *name, column_info *c if( r ) goto err; - rec = libmsi_record_create( 1 ); + rec = libmsi_record_new( 1 ); if( !rec ) goto err; @@ -885,7 +885,7 @@ unsigned msi_create_table( LibmsiDatabase *db, const WCHAR *name, column_info *c if( r ) goto err; - rec = libmsi_record_create( 4 ); + rec = libmsi_record_new( 4 ); if( !rec ) goto err; @@ -1307,7 +1307,7 @@ static unsigned _libmsi_add_stream( LibmsiDatabase *db, const WCHAR *name, IStre TRACE("%p %s %p\n", db, debugstr_w(name), data); - rec = libmsi_record_create( 2 ); + rec = libmsi_record_new( 2 ); if ( !rec ) return LIBMSI_RESULT_OUTOFMEMORY; @@ -1881,7 +1881,7 @@ static unsigned table_view_remove_column(LibmsiView *view, const WCHAR *table, u LibmsiView *columns = NULL; unsigned row, r; - rec = libmsi_record_create(2); + rec = libmsi_record_new(2); if (!rec) return LIBMSI_RESULT_OUTOFMEMORY; @@ -1953,7 +1953,7 @@ static unsigned table_view_add_column(LibmsiView *view, const WCHAR *table, unsi LibmsiRecord *rec; unsigned r, i; - rec = libmsi_record_create(4); + rec = libmsi_record_new(4); if (!rec) return LIBMSI_RESULT_OUTOFMEMORY; @@ -2004,7 +2004,7 @@ static unsigned table_view_drop(LibmsiView *view) return r; } - rec = libmsi_record_create(1); + rec = libmsi_record_new(1); if (!rec) return LIBMSI_RESULT_OUTOFMEMORY; @@ -2229,7 +2229,7 @@ static LibmsiRecord *msi_get_transform_record( const LibmsiTableView *tv, const mask = rawdata[0] | (rawdata[1] << 8); rawdata += 2; - rec = libmsi_record_create( tv->num_cols ); + rec = libmsi_record_new( tv->num_cols ); if( !rec ) return rec; diff --git a/libmsi/update.c b/libmsi/update.c index a7f54e8..7a2a523 100644 --- a/libmsi/update.c +++ b/libmsi/update.c @@ -78,7 +78,7 @@ static unsigned update_view_execute( LibmsiView *view, LibmsiRecord *record ) if (where_count > 0) { - where = libmsi_record_create(where_count); + where = libmsi_record_new(where_count); if (where) for (i = 1; i <= where_count; i++) diff --git a/libmsi/where.c b/libmsi/where.c index 5491bfa..62cfe75 100644 --- a/libmsi/where.c +++ b/libmsi/where.c @@ -323,7 +323,7 @@ static unsigned where_view_set_row( LibmsiView *view, unsigned row, LibmsiRecord continue; } - reduced = libmsi_record_create(col_count); + reduced = libmsi_record_new(col_count); if (!reduced) return LIBMSI_RESULT_FUNCTION_FAILED; diff --git a/tests/testdatabase.c b/tests/testdatabase.c index 5e24374..7d20d49 100644 --- a/tests/testdatabase.c +++ b/tests/testdatabase.c @@ -406,7 +406,7 @@ static void test_msiinsert(void) ok(r == LIBMSI_RESULT_BAD_QUERY_SYNTAX, "libmsi_database_open_query failed\n"); /* construct a record to insert */ - hrec = libmsi_record_create(4); + hrec = libmsi_record_new(4); r = libmsi_record_set_int(hrec, 1, 2); ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_record_set_int failed\n"); r = libmsi_record_set_string(hrec, 2, "Adam"); @@ -480,7 +480,7 @@ static unsigned try_insert_query( LibmsiDatabase *hdb, const char *szQuery ) LibmsiRecord *hrec = 0; unsigned r; - hrec = libmsi_record_create( 1 ); + hrec = libmsi_record_new( 1 ); libmsi_record_set_string( hrec, 1, "Hello"); r = try_query_param( hdb, szQuery, hrec ); @@ -1208,7 +1208,7 @@ static void test_streamtable(void) /* insert a file into the _Streams table */ create_file( "test.txt" ); - rec = libmsi_record_create( 2 ); + rec = libmsi_record_new( 2 ); libmsi_record_set_string( rec, 1, "data" ); r = libmsi_record_load_stream( rec, 2, "test.txt" ); @@ -1231,7 +1231,7 @@ static void test_streamtable(void) /* insert another one */ create_file( "test1.txt" ); - rec = libmsi_record_create( 2 ); + rec = libmsi_record_new( 2 ); libmsi_record_set_string( rec, 1, "data1" ); r = libmsi_record_load_stream( rec, 2, "test1.txt" ); @@ -1305,7 +1305,7 @@ static void test_streamtable(void) /* perform an update */ create_file( "test2.txt" ); - rec = libmsi_record_create( 1 ); + rec = libmsi_record_new( 1 ); r = libmsi_record_load_stream( rec, 1, "test2.txt" ); ok( r == LIBMSI_RESULT_SUCCESS, "Failed to add stream data to the record: %d\n", r); @@ -1389,7 +1389,7 @@ static void test_binary(void) ok( r == LIBMSI_RESULT_SUCCESS, "Cannot create Binary table: %d\n", r ); create_file( "test.txt" ); - rec = libmsi_record_create( 1 ); + rec = libmsi_record_new( 1 ); r = libmsi_record_load_stream( rec, 1, "test.txt" ); ok( r == LIBMSI_RESULT_SUCCESS, "Failed to add stream data to the record: %d\n", r); unlink( "test.txt" ); @@ -1679,7 +1679,7 @@ static void test_where(void) ok( r == LIBMSI_RESULT_NO_MORE_ITEMS, "query failed: %d\n", r ); libmsi_unref( rec ); - rec = libmsi_record_create(1); + rec = libmsi_record_new(1); libmsi_record_set_string(rec, 1, ""); sql = "SELECT * FROM `Media` WHERE `DiskPrompt` = ?"; @@ -2170,7 +2170,7 @@ static void test_markers(void) hdb = create_db(); ok( hdb, "failed to create db\n"); - rec = libmsi_record_create(3); + rec = libmsi_record_new(3); libmsi_record_set_string(rec, 1, "Table"); libmsi_record_set_string(rec, 2, "Apples"); libmsi_record_set_string(rec, 3, "Oranges"); @@ -2182,7 +2182,7 @@ static void test_markers(void) libmsi_unref(rec); /* try table name as marker */ - rec = libmsi_record_create(1); + rec = libmsi_record_new(1); libmsi_record_set_string(rec, 1, "Fable"); sql = "CREATE TABLE `?` ( `One` SHORT NOT NULL, `Two` CHAR(255) PRIMARY KEY `One`)"; r = run_query(hdb, rec, sql); @@ -2209,7 +2209,7 @@ static void test_markers(void) libmsi_unref(rec); /* try column names as markers */ - rec = libmsi_record_create(2); + rec = libmsi_record_new(2); libmsi_record_set_string(rec, 1, "One"); libmsi_record_set_string(rec, 2, "Two"); sql = "CREATE TABLE `Mable` ( `?` SHORT NOT NULL, `?` CHAR(255) PRIMARY KEY `One`)"; @@ -2218,7 +2218,7 @@ static void test_markers(void) libmsi_unref(rec); /* try names with backticks */ - rec = libmsi_record_create(3); + rec = libmsi_record_new(3); libmsi_record_set_string(rec, 1, "One"); libmsi_record_set_string(rec, 2, "Two"); libmsi_record_set_string(rec, 3, "One"); @@ -2238,7 +2238,7 @@ static void test_markers(void) libmsi_unref(rec); /* try one long marker */ - rec = libmsi_record_create(1); + rec = libmsi_record_new(1); libmsi_record_set_string(rec, 1, "`One` SHORT NOT NULL, `Two` CHAR(255) PRIMARY KEY `One`"); sql = "CREATE TABLE `Mable` ( ? )"; r = run_query(hdb, rec, sql); @@ -2246,7 +2246,7 @@ static void test_markers(void) libmsi_unref(rec); /* try all names as markers */ - rec = libmsi_record_create(4); + rec = libmsi_record_new(4); libmsi_record_set_string(rec, 1, "Mable"); libmsi_record_set_string(rec, 2, "One"); libmsi_record_set_string(rec, 3, "Two"); @@ -2265,7 +2265,7 @@ static void test_markers(void) ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r); /* try values as markers */ - rec = libmsi_record_create(2); + rec = libmsi_record_new(2); libmsi_record_set_int(rec, 1, 4); libmsi_record_set_string(rec, 2, "hi"); sql = "INSERT INTO `Table` ( `One`, `Two` ) VALUES ( ?, '?' )"; @@ -2274,7 +2274,7 @@ static void test_markers(void) libmsi_unref(rec); /* try column names and values as markers */ - rec = libmsi_record_create(4); + rec = libmsi_record_new(4); libmsi_record_set_string(rec, 1, "One"); libmsi_record_set_string(rec, 2, "Two"); libmsi_record_set_int(rec, 3, 5); @@ -2285,7 +2285,7 @@ static void test_markers(void) libmsi_unref(rec); /* try column names as markers */ - rec = libmsi_record_create(2); + rec = libmsi_record_new(2); libmsi_record_set_string(rec, 1, "One"); libmsi_record_set_string(rec, 2, "Two"); sql = "INSERT INTO `Table` ( `?`, `?` ) VALUES ( 3, 'yellow' )"; @@ -2294,7 +2294,7 @@ static void test_markers(void) libmsi_unref(rec); /* try table name as a marker */ - rec = libmsi_record_create(1); + rec = libmsi_record_new(1); libmsi_record_set_string(rec, 1, "Table"); sql = "INSERT INTO `?` ( `One`, `Two` ) VALUES ( 2, 'green' )"; r = run_query(hdb, rec, sql); @@ -2302,7 +2302,7 @@ static void test_markers(void) libmsi_unref(rec); /* try table name and values as markers */ - rec = libmsi_record_create(3); + rec = libmsi_record_new(3); libmsi_record_set_string(rec, 1, "Table"); libmsi_record_set_int(rec, 2, 10); libmsi_record_set_string(rec, 3, "haha"); @@ -2312,7 +2312,7 @@ static void test_markers(void) libmsi_unref(rec); /* try all markers */ - rec = libmsi_record_create(5); + rec = libmsi_record_new(5); libmsi_record_set_string(rec, 1, "Table"); libmsi_record_set_string(rec, 1, "One"); libmsi_record_set_string(rec, 1, "Two"); @@ -2324,7 +2324,7 @@ static void test_markers(void) libmsi_unref(rec); /* insert an integer as a string */ - rec = libmsi_record_create(2); + rec = libmsi_record_new(2); libmsi_record_set_string(rec, 1, "11"); libmsi_record_set_string(rec, 2, "hi"); sql = "INSERT INTO `Table` ( `One`, `Two` ) VALUES ( ?, '?' )"; @@ -2333,7 +2333,7 @@ static void test_markers(void) libmsi_unref(rec); /* leave off the '' for the string */ - rec = libmsi_record_create(2); + rec = libmsi_record_new(2); libmsi_record_set_int(rec, 1, 12); libmsi_record_set_string(rec, 2, "hi"); sql = "INSERT INTO `Table` ( `One`, `Two` ) VALUES ( ?, ? )"; @@ -2620,7 +2620,7 @@ static void test_try_transform(void) r = run_query(hdb, 0, sql); ok(r == LIBMSI_RESULT_SUCCESS, "failed to add table\n"); - hrec = libmsi_record_create(2); + hrec = libmsi_record_new(2); r = libmsi_record_set_int(hrec, 1, 2); ok(r == LIBMSI_RESULT_SUCCESS, "failed to set integer\n"); @@ -4157,7 +4157,7 @@ static void test_update(void) r = run_query(hdb, 0, sql); ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r); - rec = libmsi_record_create(2); + rec = libmsi_record_new(2); libmsi_record_set_int(rec, 1, 8); libmsi_record_set_string(rec, 2, "two"); @@ -4731,7 +4731,7 @@ static void test_select_markers(void) "( `One`, `Two`, `Three` ) VALUES ( 'banana', 'three', 3 )"); ok(r == LIBMSI_RESULT_SUCCESS, "cannot add file to the Media table: %d\n", r); - rec = libmsi_record_create(2); + rec = libmsi_record_new(2); libmsi_record_set_string(rec, 1, "apple"); libmsi_record_set_string(rec, 2, "two"); @@ -4786,7 +4786,7 @@ static void test_select_markers(void) libmsi_query_close(query); libmsi_unref(query); - rec = libmsi_record_create(2); + rec = libmsi_record_new(2); libmsi_record_set_string(rec, 1, "one"); libmsi_record_set_int(rec, 2, 1); @@ -6195,7 +6195,7 @@ static void test_storages_table(void) create_storage("storage.bin"); - hrec = libmsi_record_create(2); + hrec = libmsi_record_new(2); libmsi_record_set_string(hrec, 1, "stgname"); r = libmsi_record_load_stream(hrec, 2, "storage.bin"); @@ -7020,7 +7020,7 @@ static void test_dbmerge(void) ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r); create_file("binary.dat"); - hrec = libmsi_record_create(1); + hrec = libmsi_record_new(1); libmsi_record_load_stream(hrec, 1, "binary.dat"); sql = "INSERT INTO `One` ( `A`, `B` ) VALUES ( 1, ? )"; diff --git a/tests/testrecord.c b/tests/testrecord.c index f88f43d..07defc0 100644 --- a/tests/testrecord.c +++ b/tests/testrecord.c @@ -77,9 +77,9 @@ static void test_msirecord(void) ok(r == LIBMSI_RESULT_INVALID_HANDLE, "libmsi_record_set_int returned wrong error\n"); r = libmsi_record_set_int(0,-1,0); ok(r == LIBMSI_RESULT_INVALID_HANDLE, "libmsi_record_set_int returned wrong error\n"); - h = libmsi_record_create(-1); + h = libmsi_record_new(-1); ok(h==0, "created record with -1 elements\n"); - h = libmsi_record_create(0x10000); + h = libmsi_record_new(0x10000); ok(h==0, "created record with 0x10000 elements\n"); r = libmsi_record_clear_data(0); ok(r == LIBMSI_RESULT_INVALID_HANDLE, "libmsi_record_clear_data returned wrong error\n"); @@ -88,7 +88,7 @@ static void test_msirecord(void) /* check behaviour of a record with 0 elements */ - h = libmsi_record_create(0); + h = libmsi_record_new(0); ok(h!=0, "couldn't create record with zero elements\n"); r = libmsi_record_get_field_count(h); ok(r==0, "field count should be zero\n"); @@ -303,7 +303,7 @@ static void test_msirecord(void) return; /* streams can't be inserted in field 0 for some reason */ - h = libmsi_record_create(2); + h = libmsi_record_new(2); ok(h, "couldn't create a two field record\n"); r = libmsi_record_load_stream(h, 0, filename); ok(r == LIBMSI_RESULT_INVALID_PARAMETER, "added stream to field 0\n"); @@ -366,7 +366,7 @@ static void test_MsiRecordGetString(void) unsigned sz; unsigned r; - rec = libmsi_record_create(2); + rec = libmsi_record_new(2); ok(rec != 0, "Expected a valid handle\n"); sz = sizeof(buf); @@ -390,7 +390,7 @@ static void test_MsiRecordGetString(void) libmsi_unref(rec); - rec = libmsi_record_create(1); + rec = libmsi_record_new(1); ok(rec != 0, "Expected a valid handle\n"); r = libmsi_record_set_int(rec, 1, 5); @@ -427,7 +427,7 @@ static void test_MsiRecordGetInteger(void) int val; unsigned r; - rec = libmsi_record_create(1); + rec = libmsi_record_new(1); ok(rec != 0, "Expected a valid handle\n"); r = libmsi_record_set_string(rec, 1, "5"); @@ -461,7 +461,7 @@ static void test_fieldzero(void) unsigned sz; unsigned r; - rec = libmsi_record_create(1); + rec = libmsi_record_new(1); ok(rec != 0, "Expected a valid handle\n"); r = libmsi_record_get_integer(rec, 0); diff --git a/tools/msibuild.c b/tools/msibuild.c index b996ba5..b6016c6 100644 --- a/tools/msibuild.c +++ b/tools/msibuild.c @@ -167,7 +167,7 @@ static int add_stream(const char *stream, const char *file) LibmsiRecord *rec; LibmsiQuery *query; - rec = libmsi_record_create(2); + rec = libmsi_record_new(2); libmsi_record_set_string(rec, 1, stream); r = libmsi_record_load_stream(rec, 2, file); if (r != LIBMSI_RESULT_SUCCESS) diff --git a/tools/msiinfo.c b/tools/msiinfo.c index d50ab52..58fd85b 100644 --- a/tools/msiinfo.c +++ b/tools/msiinfo.c @@ -385,7 +385,7 @@ static int cmd_extract(struct Command *cmd, int argc, char **argv) print_libmsi_error(r); } - rec = libmsi_record_create(1); + rec = libmsi_record_new(1); libmsi_record_set_string(rec, 1, argv[2]); r = libmsi_query_execute(query, rec); libmsi_unref(rec); -- cgit