Skip to content

Commit

Permalink
Code clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Mar 27, 2021
1 parent 4e0e08b commit 153af38
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 11 deletions.
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],
[20210326],
[20210327],
[[email protected]])

AC_CONFIG_SRCDIR(
Expand Down
4 changes: 2 additions & 2 deletions libpff/libpff_local_descriptors.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ int libpff_local_descriptors_read_local_descriptor_node(
libpff_index_value_t *offset_index_value = NULL;
static char *function = "libpff_local_descriptors_read_local_descriptor_node";
off64_t cache_value_offset = 0;
time_t cache_value_timestamp = 0;
int cache_value_index = 0;
int64_t cache_value_timestamp = 0;
int cache_value_file_index = 0;
int cache_value_index = 0;
int is_cached = 0;

if( local_descriptors == NULL )
Expand Down
76 changes: 68 additions & 8 deletions libpff/libpff_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -6241,11 +6241,12 @@ int libpff_table_read_7c_column_definitions(
libcdata_list_t *name_to_id_map_list,
libcerror_error_t **error )
{
libpff_column_definition_t *column_definition = NULL;
static char *function = "libpff_table_read_7c_column_definitions";
uint8_t column_definition_number = 0;
int column_definition_index = 0;
int result = 0;
libpff_column_definition_t *column_definition = NULL;
libpff_column_definition_t *lookup_column_definition = NULL;
static char *function = "libpff_table_read_7c_column_definitions";
uint8_t column_definition_number = 0;
int column_definition_index = 0;
int result = 0;

LIBPFF_UNREFERENCED_PARAMETER( file_io_handle )

Expand Down Expand Up @@ -6475,7 +6476,36 @@ int libpff_table_read_7c_column_definitions(
libcnotify_printf(
"\n" );
}
#endif
#endif /* defined( HAVE_DEBUG_OUTPUT ) */

if( libcdata_array_get_entry_by_index(
column_definitions_array,
(int) column_definition_number,
(intptr_t **) &lookup_column_definition,
error ) != 1 )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_GET_FAILED,
"%s: unable to retrieve column definitions: %" PRIu8 " in array.",
function,
column_definition_number );

goto on_error;
}
if( lookup_column_definition != NULL )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_VALUE_MISSING,
"%s: column definitions: %" PRIu8 " already set in array.",
function,
column_definition_number );

goto on_error;
}
if( libcdata_array_set_entry_by_index(
column_definitions_array,
(int) column_definition_number,
Expand Down Expand Up @@ -7476,14 +7506,15 @@ int libpff_table_read_ac_column_definitions(
libfcache_cache_t *column_definitions_data_cache = NULL;
libfdata_list_t *column_definitions_data_list = NULL;
libpff_column_definition_t *column_definition = NULL;
libpff_column_definition_t *lookup_column_definition = NULL;
libpff_data_block_t *column_definition_data_block = NULL;
libpff_data_block_t *column_definitions_data_block = NULL;
libpff_local_descriptor_value_t *local_descriptor_value = NULL;
pff_table_column_definition_ac_t *column_definition_data = NULL;
static char *function = "libpff_table_read_ac_column_definitions";
off64_t column_definition_data_block_offset = 0;
size_t column_definition_data_offset = 0;
size_t column_definition_data_size = 0;
off64_t column_definition_data_block_offset = 0;
uint32_t record_entry_values_table_descriptor = 0;
uint16_t column_definition_number = 0;
int column_definition_index = 0;
Expand Down Expand Up @@ -7927,7 +7958,8 @@ int libpff_table_read_ac_column_definitions(
libcnotify_printf(
"\n" );
}
#endif
#endif /* defined( HAVE_DEBUG_OUTPUT ) */

/* Read the record entry values table if necessary
*/
if( record_entry_values_table_descriptor > 0 )
Expand Down Expand Up @@ -8036,6 +8068,34 @@ int libpff_table_read_ac_column_definitions(
goto on_error;
}
}
if( libcdata_array_get_entry_by_index(
column_definitions_array,
(int) column_definition_number,
(intptr_t **) &lookup_column_definition,
error ) != 1 )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_GET_FAILED,
"%s: unable to retrieve column definitions: %" PRIu8 " in array.",
function,
column_definition_number );

goto on_error;
}
if( lookup_column_definition != NULL )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_VALUE_MISSING,
"%s: column definitions: %" PRIu8 " already set in array.",
function,
column_definition_number );

goto on_error;
}
if( libcdata_array_set_entry_by_index(
column_definitions_array,
(int) column_definition_number,
Expand Down

0 comments on commit 153af38

Please sign in to comment.