Skip to content

Commit b05fce0

Browse files
committed
Code clean up and worked on tests
1 parent ad89905 commit b05fce0

24 files changed

Lines changed: 1251 additions & 883 deletions

ChangeLog

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
TODO
2+
* add threads RW lock to item
3+
* remove libpff_item_clone
24
* pypff fix get_root_item
35

46
IOError: pypff_file_get_item_type_object: unable to retrieve item type.
@@ -10,7 +12,6 @@ libpff_item_get_type: unable to determine item type.
1012

1113
* refactor libpff_message_get_entry_value_utf8_string to match naming schema
1214
* add specific entry value flag for string types?
13-
* add fallback inflate implementation
1415
* add libpff_item_values_get_record_entry_by_type specific for string types?
1516
* API add
1617
- libpff_multi_value_get_value_16bit

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ AC_PREREQ( 2.59 )
22

33
AC_INIT(
44
[libpff],
5-
[20200719],
5+
[20200720],
66
[joachim.metz@gmail.com])
77

88
AC_CONFIG_SRCDIR(

include/libpff.h.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ int libpff_item_get_value_type(
627627

628628
/* Retrieves the value of a specific entry
629629
*
630-
* When the LIBPFF_ENTRY_VALUE_FLAG_MATCH_ANY_VALUE_TYPE is set
630+
* When the LIBPFF_ENTRY_VALUE_FLAG_MATCH_ANY_VALUE_TYPE flag is set
631631
* the value type is ignored and set. The default behavior is a strict
632632
* matching of the value type. In this case the value type must be filled
633633
* with the corresponding value type
@@ -1630,7 +1630,7 @@ int libpff_record_set_get_entry_by_index(
16301630

16311631
/* Retrieves the record entry matching the entry and value type pair from the record set
16321632
*
1633-
* When the LIBPFF_ENTRY_VALUE_FLAG_MATCH_ANY_VALUE_TYPE is set
1633+
* When the LIBPFF_ENTRY_VALUE_FLAG_MATCH_ANY_VALUE_TYPE flag is set
16341634
* the value type is ignored and set. The default behavior is a strict
16351635
* matching of the value type. In this case the value type must be filled
16361636
* with the corresponding value type
@@ -1653,7 +1653,7 @@ int libpff_record_set_get_entry_by_type(
16531653

16541654
/* Retrieves the record entry matching the UTF-8 encoded name from the record set.
16551655
*
1656-
* When the LIBPFF_ENTRY_VALUE_FLAG_MATCH_ANY_VALUE_TYPE is set
1656+
* When the LIBPFF_ENTRY_VALUE_FLAG_MATCH_ANY_VALUE_TYPE flag is set
16571657
* the value type is ignored and set. The default behavior is a strict
16581658
* matching of the value type. In this case the value type must be filled
16591659
* with the corresponding value type
@@ -1672,7 +1672,7 @@ int libpff_record_set_get_entry_by_utf8_name(
16721672

16731673
/* Retrieves the record entry matching the UTF-16 encoded name from the record set.
16741674
*
1675-
* When the LIBPFF_ENTRY_VALUE_FLAG_MATCH_ANY_VALUE_TYPE is set
1675+
* When the LIBPFF_ENTRY_VALUE_FLAG_MATCH_ANY_VALUE_TYPE flag is set
16761676
* the value type is ignored and set. The default behavior is a strict
16771677
* matching of the value type. In this case the value type must be filled
16781678
* with the corresponding value type

libpff/libpff_attachment.c

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,6 @@ int libpff_attachment_get_item(
731731
{
732732
libcdata_tree_node_t *embedded_item_tree_node = NULL;
733733
libpff_internal_item_t *internal_item = NULL;
734-
libpff_item_descriptor_t *embedded_item_descriptor = NULL;
735734
libpff_local_descriptor_value_t *local_descriptor_value = NULL;
736735
libpff_record_entry_t *record_entry = NULL;
737736
libpff_record_set_t *record_set = NULL;
@@ -756,17 +755,6 @@ int libpff_attachment_get_item(
756755
}
757756
internal_item = (libpff_internal_item_t *) attachment;
758757

759-
if( internal_item->internal_file == NULL )
760-
{
761-
libcerror_error_set(
762-
error,
763-
LIBCERROR_ERROR_DOMAIN_RUNTIME,
764-
LIBCERROR_RUNTIME_ERROR_VALUE_MISSING,
765-
"%s: invalid attachment - missing internal file.",
766-
function );
767-
768-
return( -1 );
769-
}
770758
if( internal_item->item_values == NULL )
771759
{
772760
libcerror_error_set(
@@ -859,7 +847,7 @@ int libpff_attachment_get_item(
859847
/* TODO add support for recovered embedded items */
860848

861849
result = libpff_item_tree_get_node_by_identifier(
862-
internal_item->internal_file->item_tree,
850+
internal_item->item_tree,
863851
embedded_object_item_identifier,
864852
&embedded_item_tree_node,
865853
error );
@@ -997,29 +985,15 @@ int libpff_attachment_get_item(
997985
goto on_error;
998986
}
999987
}
1000-
if( libcdata_tree_node_get_value(
1001-
embedded_item_tree_node,
1002-
(intptr_t **) &embedded_item_descriptor,
1003-
error ) != 1 )
1004-
{
1005-
libcerror_error_set(
1006-
error,
1007-
LIBCERROR_ERROR_DOMAIN_RUNTIME,
1008-
LIBCERROR_RUNTIME_ERROR_GET_FAILED,
1009-
"%s: unable to retrieve embedded item descriptor.",
1010-
function );
1011-
1012-
goto on_error;
1013-
}
1014988
if( libpff_item_initialize(
1015989
attached_item,
1016990
internal_item->io_handle,
1017991
internal_item->file_io_handle,
1018-
internal_item->internal_file,
1019992
internal_item->name_to_id_map_list,
993+
internal_item->descriptors_index,
1020994
internal_item->offsets_index,
995+
internal_item->item_tree,
1021996
embedded_item_tree_node,
1022-
embedded_item_descriptor,
1023997
LIBPFF_ITEM_FLAGS_DEFAULT,
1024998
error ) != 1 )
1025999
{

0 commit comments

Comments
 (0)