diff options
author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2012-12-11 14:10:46 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-12-12 09:57:21 +0100 |
commit | 75e5665a7ebd9ddc1cd8054c20c9750dced3d8b8 (patch) | |
tree | 2fbb548570dfa254d5ddc74e41e44218a7820de5 | |
parent | a779cc4642e9bbfa56766c66b5c296e1c62dba82 (diff) | |
download | msitools-75e5665a7ebd9ddc1cd8054c20c9750dced3d8b8.tar.gz msitools-75e5665a7ebd9ddc1cd8054c20c9750dced3d8b8.tar.xz msitools-75e5665a7ebd9ddc1cd8054c20c9750dced3d8b8.zip |
Remove unused libmsi_record_get_field_size()
-rw-r--r-- | include/libmsi-record.h | 1 | ||||
-rw-r--r-- | libmsi/libmsi-record.c | 35 | ||||
-rw-r--r-- | tests/testrecord.c | 18 |
3 files changed, 0 insertions, 54 deletions
diff --git a/include/libmsi-record.h b/include/libmsi-record.h index ab3f078..f3f3989 100644 --- a/include/libmsi-record.h +++ b/include/libmsi-record.h @@ -48,7 +48,6 @@ LibmsiResult libmsi_record_set_string (LibmsiRecord *,unsigned,const char * LibmsiResult libmsi_record_get_string (const LibmsiRecord *,unsigned,char *,unsigned *); unsigned libmsi_record_get_field_count (const LibmsiRecord *); int libmsi_record_get_integer (const LibmsiRecord *,unsigned); -unsigned libmsi_record_get_field_size (const LibmsiRecord *,unsigned); gboolean libmsi_record_is_null (const LibmsiRecord *,unsigned); LibmsiResult libmsi_record_load_stream (LibmsiRecord *,unsigned,const char *); diff --git a/libmsi/libmsi-record.c b/libmsi/libmsi-record.c index cac5070..3e2d541 100644 --- a/libmsi/libmsi-record.c +++ b/libmsi/libmsi-record.c @@ -419,41 +419,6 @@ unsigned _libmsi_record_get_stringW(const LibmsiRecord *rec, unsigned iField, return ret; } -static unsigned msi_get_stream_size( IStream *stm ) -{ - STATSTG stat; - HRESULT r; - - r = IStream_Stat( stm, &stat, STATFLAG_NONAME ); - if( FAILED(r) ) - return 0; - return stat.cbSize.QuadPart; -} - -unsigned libmsi_record_get_field_size(const LibmsiRecord *rec, unsigned iField) -{ - TRACE("%p %d\n", rec, iField); - - if( !rec ) - return 0; - - if( iField > rec->count ) - return 0; - - switch( rec->fields[iField].type ) - { - case LIBMSI_FIELD_TYPE_INT: - return sizeof (int); - case LIBMSI_FIELD_TYPE_WSTR: - return strlenW( rec->fields[iField].u.szwVal ); - case LIBMSI_FIELD_TYPE_NULL: - break; - case LIBMSI_FIELD_TYPE_STREAM: - return msi_get_stream_size( rec->fields[iField].u.stream ); - } - return 0; -} - LibmsiResult libmsi_record_set_string( LibmsiRecord *rec, unsigned iField, const char *szValue ) { WCHAR *str; diff --git a/tests/testrecord.c b/tests/testrecord.c index 2800039..373cc2d 100644 --- a/tests/testrecord.c +++ b/tests/testrecord.c @@ -79,8 +79,6 @@ static void test_msirecord(void) ok(r == LIBMSI_RESULT_INVALID_HANDLE, "libmsi_record_set_int returned wrong error\n"); r = libmsi_record_clear_data(0); ok(r == LIBMSI_RESULT_INVALID_HANDLE, "libmsi_record_clear_data returned wrong error\n"); - r = libmsi_record_get_field_size(0,0); - ok(r == 0, "libmsi_record_get_field_size returned wrong error\n"); /* check behaviour of a record with 0 elements */ @@ -94,8 +92,6 @@ static void test_msirecord(void) ok(r, "out of range record wasn't null\n"); r = libmsi_record_is_null(h,-1); ok(r, "out of range record wasn't null\n"); - r = libmsi_record_get_field_size(h,0); - ok(r==0, "size of null record is 0\n"); sz = sizeof buf; strcpy(buf,"x"); r = libmsi_record_get_string(h, 0, buf, &sz); @@ -108,8 +104,6 @@ static void test_msirecord(void) ok(r == LIBMSI_RESULT_SUCCESS, "Failed to set integer at 0 to 0\n"); r = libmsi_record_is_null(h,0); ok(r==0, "new record is null after setting an integer\n"); - r = libmsi_record_get_field_size(h,0); - ok(r==sizeof(unsigned), "size of integer record is 4\n"); r = libmsi_record_set_int(h, 0, 1); ok(r == LIBMSI_RESULT_SUCCESS, "Failed to set integer at 0 to 1\n"); r = libmsi_record_set_int(h, 1, 1); @@ -126,8 +120,6 @@ static void test_msirecord(void) ok(r == LIBMSI_RESULT_SUCCESS, "Failed to set null string at 0\n"); r = libmsi_record_is_null(h, 0); ok(r == true, "null string not null field\n"); - r = libmsi_record_get_field_size(h, 0); - ok(r == 0, "size of string record is strlen\n"); buf[0] = 0; sz = sizeof buf; r = libmsi_record_get_string(h, 0, buf, &sz); @@ -138,8 +130,6 @@ static void test_msirecord(void) ok(r == LIBMSI_RESULT_SUCCESS, "Failed to set empty string at 0\n"); r = libmsi_record_is_null(h, 0); ok(r == true, "null string not null field\n"); - r = libmsi_record_get_field_size(h, 0); - ok(r == 0, "size of string record is strlen\n"); buf[0] = 0; sz = sizeof buf; r = libmsi_record_get_string(h, 0, buf, &sz); @@ -152,8 +142,6 @@ static void test_msirecord(void) ok(r == LIBMSI_RESULT_SUCCESS, "Failed to set string at 0\n"); r = libmsi_record_get_integer(h, 0); ok(r == LIBMSI_NULL_INT, "should get invalid integer\n"); - r = libmsi_record_get_field_size(h,0); - ok(r==sizeof str-1, "size of string record is strlen\n"); buf[0]=0; sz = sizeof buf; r = libmsi_record_get_string(h,0,buf,&sz); @@ -284,10 +272,6 @@ static void test_msirecord(void) r = libmsi_record_save_stream(h, 0, buf, &sz); ok(r == LIBMSI_RESULT_INVALID_DATATYPE, "read non-stream type\n"); ok(sz == sizeof buf, "set sz\n"); - r = libmsi_record_get_field_size( h, -1); - ok(r == 0,"libmsi_record_get_field_size returned wrong size\n"); - r = libmsi_record_get_field_size( h, 0); - ok(r == 4,"libmsi_record_get_field_size returned wrong size\n"); /* same record, now close it */ g_object_unref(h); @@ -345,8 +329,6 @@ static void test_msirecord(void) r = libmsi_record_save_stream(h, 1, NULL, &sz); ok(r == LIBMSI_RESULT_SUCCESS, "bytes left wrong after reset\n"); ok(sz==26,"couldn't get size of stream\n"); - r = libmsi_record_get_field_size(h,1); - ok(r == 26,"libmsi_record_get_field_size returned wrong size\n"); /* now close the stream record */ g_object_unref(h); |