Skip to content

Commit

Permalink
Worked on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Nov 11, 2016
1 parent 32828fb commit 3222929
Show file tree
Hide file tree
Showing 148 changed files with 10,442 additions and 1,039 deletions.
22 changes: 21 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,36 @@ stamp-h[1-9]
/pfftools/pffexport
/pfftools/pffinfo
/tests/input
/tests/pff_test_attached_file_io_handle
/tests/pff_test_column_definition
/tests/pff_test_data_array
/tests/pff_test_data_array_entry
/tests/pff_test_data_block
/tests/pff_test_descriptors_index
/tests/pff_test_error
/tests/pff_test_file
/tests/pff_test_index
/tests/pff_test_index_node
/tests/pff_test_index_value
/tests/pff_test_io_handle
/tests/pff_test_item
/tests/pff_test_item_descriptor
/tests/pff_test_item_values
/tests/pff_test_local_descriptor_node
/tests/pff_test_local_descriptors
/tests/pff_test_local_descriptor_value
/tests/pff_test_multi_value
/tests/pff_test_name_to_id_map_entry
/tests/pff_test_open_close
/tests/pff_test_notify
/tests/pff_test_offsets_index
/tests/pff_test_read_items
/tests/pff_test_record_entry
/tests/pff_test_record_set
/tests/pff_test_reference_descriptor
/tests/pff_test_support
/tests/pff_test_table
/tests/pff_test_table_block_index
/tests/pff_test_table_index_value
/tests/tmp*

# Local library dependencies specific files
Expand Down
54 changes: 46 additions & 8 deletions autogen.ps1
Original file line number Diff line number Diff line change
@@ -1,15 +1,53 @@
# Script to generate the necessary files for a msvscpp build
#
# Version: 20150105
# Version: 20161110

$WinFlex = "..\win_flex_bison\win_flex.exe"
$WinBison = "..\win_flex_bison\win_bison.exe"

$Library = Get-Content -Path configure.ac | select -skip 3 -first 1 | % { $_ -Replace " \[","" } | % { $_ -Replace "\],","" }
$Version = Get-Content -Path configure.ac | select -skip 4 -first 1 | % { $_ -Replace " \[","" } | % { $_ -Replace "\],","" }
$Prefix = ${Library}.Substring(3)

Get-Content -Path "include\${Library}.h.in" > "include\${Library}.h"
Get-Content -Path "include\${Library}\definitions.h.in" | % { $_ -Replace "@VERSION@","${Version}" } > "include\${Library}\definitions.h"
Get-Content -Path "include\${Library}\features.h.in" | % { $_ -Replace "@[A-Z0-9_]*@","0" } > "include\${Library}\features.h"
Get-Content -Path "include\${Library}\types.h.in" | % { $_ -Replace "@[A-Z0-9_]*@","0" } > "include\${Library}\types.h"
Get-Content -Path "common\types.h.in" | % { $_ -Replace "@PACKAGE@","${Library}" } > "common\types.h"
Get-Content -Path "${Library}\${Library}_definitions.h.in" | % { $_ -Replace "@VERSION@","${Version}" } > "${Library}\${Library}_definitions.h"
Get-Content -Path "${Library}\${Library}.rc.in" | % { $_ -Replace "@VERSION@","${Version}" } > "${Library}\${Library}.rc"

If (Test-Path "${Prefix}.net")
{
Get-Content -Path "${Prefix}.net\${Prefix}.net.rc.in" | % { $_ -Replace "@VERSION@","${Version}" } > "${Prefix}.net\${Prefix}.net.rc"
}

$NamePrefix = ""

ForEach (${DirectoryElement} in Get-ChildItem -Path "${Library}\*.l")
{
$OutputFile = ${DirectoryElement} -Replace ".l$",".c"

$NamePrefix = Split-Path -path ${DirectoryElement} -leaf
$NamePrefix = ${NamePrefix} -Replace "^${Library}_",""
$NamePrefix = ${NamePrefix} -Replace ".l$","_"

# PowerShell will raise NativeCommandError if win_flex writes to stdout or stderr
# therefore 2>&1 is added and the output is stored in a variable.
$Output = Invoke-Expression -Command "& '${WinFlex}' -Cf ${DirectoryElement} 2>&1"
Write-Host ${Output}

# Moving manually since win_flex -o <filename> does not provide the expected behavior.
Move-Item "lex.yy.c" ${OutputFile} -force
}

ForEach (${DirectoryElement} in Get-ChildItem -Path "${Library}\*.y")
{
$OutputFile = ${DirectoryElement} -Replace ".y$",".c"

Get-Content -Path include\${Library}.h.in > include\${Library}.h
Get-Content -Path include\${Library}\definitions.h.in | % { $_ -Replace "@VERSION@",${Version} } > include\${Library}\definitions.h
Get-Content -Path include\${Library}\features.h.in | % { $_ -Replace "@[A-Z0-9_]*@","0" } > include\${Library}\features.h
Get-Content -Path include\${Library}\types.h.in | % { $_ -Replace "@[A-Z0-9_]*@","0" } > include\${Library}\types.h
Get-Content -Path common\types.h.in | % { $_ -Replace "@PACKAGE@",${Library} } > common\types.h
Get-Content -Path ${Library}\${Library}_definitions.h.in | % { $_ -Replace "@VERSION@",${Version} } > ${Library}\${Library}_definitions.h
Get-Content -Path ${Library}\${Library}.rc.in | % { $_ -Replace "@VERSION@",${Version} } > ${Library}\${Library}.rc
# PowerShell will raise NativeCommandError if win_bison writes to stdout or stderr
# therefore 2>&1 is added and the output is stored in a variable.
$Output = Invoke-Expression -Command "& '${WinBison}' -d -v -l -p ${NamePrefix} -o ${OutputFile} ${DirectoryElement} 2>&1"
Write-Host ${Output}
}

2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ AC_PREREQ( 2.59 )

AC_INIT(
[libpff],
[20161108],
[20161111],
[[email protected]])

AC_CONFIG_SRCDIR(
Expand Down
54 changes: 27 additions & 27 deletions include/libpff/definitions.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,33 +87,33 @@ enum LIBPFF_ENCRYPTION_TYPES

/* The item types
* These item types partially map to the message classes
* LIBPFF_ITEM_TYPE_UNDEFINED (initialization value)
* LIBPFF_ITEM_TYPE_ACTIVITY IPM.Activity
* LIBPFF_ITEM_TYPE_APPOINTMENT IPM.Appointment
* LIBPFF_ITEM_TYPE_ATTACHMENT (attachment)
* LIBPFF_ITEM_TYPE_ATTACHMENTS (attachments)
* LIBPFF_ITEM_TYPE_COMMON IPM
* LIBPFF_ITEM_TYPE_CONFIGURATION IPM.Configuration.*
* LIBPFF_ITEM_TYPE_CONFLICT_MESSAGE IPM.Conflict.Message
* LIBPFF_ITEM_TYPE_CONTACT IPM.Contact
* LIBPFF_ITEM_TYPE_DISTRIBUTION_LIST IPM.DistList
* LIBPFF_ITEM_TYPE_DOCUMENT IPM.Document.*
* LIBPFF_ITEM_TYPE_EMAIL IPM.Note, REPORT.IPM.Note.*
* LIBPFF_ITEM_TYPE_EMAIL_SMIME IPM.Note.SMIME.*
* LIBPFF_ITEM_TYPE_FAX IPM.FAX, IPM.Note.Fax
* LIBPFF_ITEM_TYPE_FOLDER (folder/container)
* LIBPFF_ITEM_TYPE_MEETING IPM.Schedule.Meeting
* LIBPFF_ITEM_TYPE_MMS IPM.Note.Mobile.MMS
* LIBPFF_ITEM_TYPE_NOTE IPM.StickyNote
* LIBPFF_ITEM_TYPE_POSTING_NOTE IPM.Post
* LIBPFF_ITEM_TYPE_RECIPIENTS (recipients)
* LIBPFF_ITEM_TYPE_RSS_FEED IPM.Post.RSS
* LIBPFF_ITEM_TYPE_SHARING IPM.Sharing.*
* LIBPFF_ITEM_TYPE_SMS IPM.Note.Mobile.SMS
* LIBPFF_ITEM_TYPE_TASK IPM.Task
* LIBPFF_ITEM_TYPE_TASK_REQUEST IPM.TaskRequest.*
* LIBPFF_ITEM_TYPE_VOICEMAIL IPM.Note.Voicemail
* LIBPFF_ITEM_TYPE_UNKNOWN (unknown item type, used in folder content type)
* LIBPFF_ITEM_TYPE_UNDEFINED (initialization value)
* LIBPFF_ITEM_TYPE_ACTIVITY IPM.Activity
* LIBPFF_ITEM_TYPE_APPOINTMENT IPM.Appointment
* LIBPFF_ITEM_TYPE_ATTACHMENT (attachment)
* LIBPFF_ITEM_TYPE_ATTACHMENTS (attachments)
* LIBPFF_ITEM_TYPE_COMMON IPM
* LIBPFF_ITEM_TYPE_CONFIGURATION IPM.Configuration.*
* LIBPFF_ITEM_TYPE_CONFLICT_MESSAGE IPM.Conflict.Message
* LIBPFF_ITEM_TYPE_CONTACT IPM.Contact
* LIBPFF_ITEM_TYPE_DISTRIBUTION_LIST IPM.DistList
* LIBPFF_ITEM_TYPE_DOCUMENT IPM.Document.*
* LIBPFF_ITEM_TYPE_EMAIL IPM.Note, REPORT.IPM.Note.*
* LIBPFF_ITEM_TYPE_EMAIL_SMIME IPM.Note.SMIME.*
* LIBPFF_ITEM_TYPE_FAX IPM.FAX, IPM.Note.Fax
* LIBPFF_ITEM_TYPE_FOLDER (folder/container)
* LIBPFF_ITEM_TYPE_MEETING IPM.Schedule.Meeting
* LIBPFF_ITEM_TYPE_MMS IPM.Note.Mobile.MMS
* LIBPFF_ITEM_TYPE_NOTE IPM.StickyNote
* LIBPFF_ITEM_TYPE_POSTING_NOTE IPM.Post
* LIBPFF_ITEM_TYPE_RECIPIENTS (recipients)
* LIBPFF_ITEM_TYPE_RSS_FEED IPM.Post.RSS
* LIBPFF_ITEM_TYPE_SHARING IPM.Sharing.*
* LIBPFF_ITEM_TYPE_SMS IPM.Note.Mobile.SMS
* LIBPFF_ITEM_TYPE_TASK IPM.Task
* LIBPFF_ITEM_TYPE_TASK_REQUEST IPM.TaskRequest.*
* LIBPFF_ITEM_TYPE_VOICEMAIL IPM.Note.Voicemail
* LIBPFF_ITEM_TYPE_UNKNOWN (unknown item type, used in folder content type)
*
* Unsupported:
* IPM.Post
Expand Down
3 changes: 2 additions & 1 deletion include/libpff/extern.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* The extern definition
*
* This header should be included in header files that export or import
* library functions
*
Expand Down Expand Up @@ -39,5 +40,5 @@

#endif

#endif
#endif /* !defined( _LIBPFF_EXTERN_H ) */

2 changes: 1 addition & 1 deletion libpff/libpff_allocation_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ int libpff_allocation_table_read(
}
#endif

#endif
#endif /* !defined( _LIBPFF_ALLOCATION_TABLE_H ) */

2 changes: 1 addition & 1 deletion libpff/libpff_attached_file_io_handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,5 @@ int libpff_attached_file_io_handle_get_size(
}
#endif

#endif
#endif /* !defined( _LIBPFF_ATTACHED_FILE_IO_HANDLE_H ) */

2 changes: 1 addition & 1 deletion libpff/libpff_attachment.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@ int libpff_attachment_get_item(
}
#endif

#endif
#endif /* !defined( _LIBPFF_ATTACHMENT_H ) */

2 changes: 1 addition & 1 deletion libpff/libpff_column_definition.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ int libpff_column_definition_free(
}
#endif

#endif
#endif /* !defined( _LIBPFF_COLUMN_DEFINITION_H ) */

2 changes: 1 addition & 1 deletion libpff/libpff_compression.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ int libpff_decompress_data(
}
#endif

#endif
#endif /* !defined( _LIBPFF_COMPRESS_H ) */

2 changes: 1 addition & 1 deletion libpff/libpff_data_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,5 @@ int libpff_data_array_decrypt_entry_data(
}
#endif

#endif
#endif /* !defined( _LIBPFF_DATA_ARRAY_H ) */

2 changes: 1 addition & 1 deletion libpff/libpff_data_array_entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ int libpff_data_array_entry_clone(
}
#endif

#endif
#endif /* !defined( _LIBPFF_DATA_ARRAY_ENTRY_H ) */

2 changes: 1 addition & 1 deletion libpff/libpff_data_block.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,5 @@ int libpff_data_block_decrypt_data(
}
#endif

#endif
#endif /* !defined( _LIBPFF_DATA_BLOCK_H ) */

2 changes: 1 addition & 1 deletion libpff/libpff_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,5 @@ int libpff_debug_print_read_offsets(
}
#endif

#endif
#endif /* !defined( _LIBPFF_DEBUG_H ) */

2 changes: 1 addition & 1 deletion libpff/libpff_deflate.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,5 @@ int libpff_deflate_decompress(
}
#endif

#endif
#endif /* !defined( _LIBPFF_DEFLATE_COMPRESSION_H ) */

2 changes: 1 addition & 1 deletion libpff/libpff_descriptor_data_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,5 @@ int libpff_descriptor_data_stream_initialize(
}
#endif

#endif
#endif /* !defined( _LIBPFF_DESCRIPTOR_DATA_STREAM_H ) */

2 changes: 1 addition & 1 deletion libpff/libpff_descriptors_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,5 @@ int libpff_descriptors_index_get_index_value_by_identifier(
}
#endif

#endif
#endif /* !defined( _LIBPFF_DESCRIPTORS_INDEX_H ) */

2 changes: 1 addition & 1 deletion libpff/libpff_encryption.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ ssize_t libpff_encryption_decrypt(
}
#endif

#endif
#endif /* !defined( _LIBPFF_ENCRYPTION_H ) */

2 changes: 1 addition & 1 deletion libpff/libpff_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,5 +290,5 @@ int libpff_file_get_recovered_item(
}
#endif

#endif
#endif /* !defined( _LIBPFF_INTERNAL_FILE_H ) */

2 changes: 1 addition & 1 deletion libpff/libpff_folder.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,5 @@ int libpff_folder_get_unknowns(
}
#endif

#endif
#endif /* !defined( _LIBPFF_FOLDER_H ) */

2 changes: 1 addition & 1 deletion libpff/libpff_free_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ int libpff_free_map_read(
}
#endif

#endif
#endif /* !defined( _LIBPFF_FREE_MAP_H ) */

2 changes: 1 addition & 1 deletion libpff/libpff_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,5 @@ int libpff_index_read_sub_nodes(
}
#endif

#endif
#endif /* !defined( _LIBPFF_INDEX_H ) */

2 changes: 1 addition & 1 deletion libpff/libpff_index_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,5 @@ int libpff_index_node_check_for_empty_block(
}
#endif

#endif
#endif /* !defined( _LIBPFF_NODE_INDEX_H ) */

2 changes: 1 addition & 1 deletion libpff/libpff_index_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,5 @@ int libpff_index_tree_insert_value(
}
#endif

#endif
#endif /* !defined( _LIBPFF_INDEX_TREE_H ) */

2 changes: 1 addition & 1 deletion libpff/libpff_index_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,5 @@ int libpff_index_value_compare(
}
#endif

#endif
#endif /* !defined( _LIBPFF_INDEX_VALUES_H ) */

2 changes: 1 addition & 1 deletion libpff/libpff_io_handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,5 @@ int libpff_io_handle_read_index_node(
}
#endif

#endif
#endif /* !defined( _LIBPFF_IO_HANDLE_H ) */

2 changes: 1 addition & 1 deletion libpff/libpff_io_handle2.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ int libpff_io_handle_read_descriptor_data_list(
}
#endif

#endif
#endif /* !defined( _LIBPFF_IO_HANDLE2_H ) */

18 changes: 2 additions & 16 deletions libpff/libpff_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -917,12 +917,11 @@ int libpff_item_get_identifier(
*/
int libpff_item_get_number_of_record_sets(
libpff_item_t *item,
uint32_t *number_of_record_sets,
int *number_of_record_sets,
libcerror_error_t **error )
{
libpff_internal_item_t *internal_item = NULL;
static char *function = "libpff_item_get_number_of_record_sets";
int table_number_of_record_sets = 0;

if( item == NULL )
{
Expand Down Expand Up @@ -959,17 +958,6 @@ int libpff_item_get_number_of_record_sets(

return( -1 );
}
if( number_of_record_sets == NULL )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid number of record sets.",
function );

return( -1 );
}
if( internal_item->item_values->table == NULL )
{
if( libpff_item_values_read(
Expand Down Expand Up @@ -1004,7 +992,7 @@ int libpff_item_get_number_of_record_sets(
}
if( libpff_table_get_number_of_record_sets(
internal_item->item_values->table,
&table_number_of_record_sets,
number_of_record_sets,
error ) != 1 )
{
libcerror_error_set(
Expand All @@ -1016,8 +1004,6 @@ int libpff_item_get_number_of_record_sets(

return( -1 );
}
*number_of_record_sets = (uint32_t) table_number_of_record_sets;

return( 1 );
}

Expand Down
Loading

0 comments on commit 3222929

Please sign in to comment.