library/src/filesystem/BP-FilesystemRegistry.cc
// Attempts to lookup a keyed entry within the fs registry.  If you don't
// treat this function with care with regard to user input, it can end badly
// with potential traversals or other undefined behavior ONLY IF the lookups
// are used in an unexpected way (within your own code).  This lookup
// itself is fairly safe from misues.
Attempts to lookup a keyed entry within the fs registry.  If you don't
treat this function with care with regard to user input, it can end badly
with potential traversals or other undefined behavior ONLY IF the lookups
are used in an unexpected way (within your own code).  This lookup
itself is fairly safe from misues.
Attempts to lookup a keyed entry within the fs registry . If you don ' t treat this function with care with regard to user input it can end badly with potential traversals or other undefined behavior ONLY IF the lookups are used in an unexpected way ( within your own code ) . This lookup itself is fairly safe from misues .
P_BP_HASH_TABLE_KEYED_ENTRY BP_FSRegLookupEntryFromPath
(
	P_BP_FSREG fs_reg,
	char *     filesystem_path
)
{
	if(!fs_reg)
		return NULL;
	if(!filesystem_path)
		return NULL;
	if(!BP_StringIsReasonablePrintableString(filesystem_path, bpstrlen(filesystem_path), BP_FALSE, BP_FALSE))
		return NULL;
	char ** table_path = BP_ExplodeBuffer(filesystem_path, "/");
	if(!table_path)
		return NULL;
	P_BP_HASH_TABLE_KEYED_ENTRY lookup_entry = BP_HashRegLookupTableByPath(fs_reg->hreg, table_path);
	if(!lookup_entry)
		lookup_entry = BP_HashRegLookupTableEntryByPath(fs_reg->hreg, table_path);
	if(table_path)
		BP_DestroyPointerArrayNullTerminated((void **) table_path);
	return lookup_entry;
}
P_BP_HASH_TABLE_KEYED_ENTRY BP_FSRegLookupEntryFromPath ( P_BP_FSREG fs_reg , char * filesystem_path ) { if ( ! fs_reg ) return NULL ; if ( ! filesystem_path ) return NULL ; if ( ! BP_StringIsReasonablePrintableString ( filesystem_path , bpstrlen ( filesystem_path ) , BP_FALSE , BP_FALSE ) ) return NULL ; char * * table_path = BP_ExplodeBuffer ( filesystem_path , " " ) ; if ( ! table_path ) return NULL ; P_BP_HASH_TABLE_KEYED_ENTRY lookup_entry = BP_HashRegLookupTableByPath ( fs_reg -> hreg , table_path ) ; if ( ! lookup_entry ) lookup_entry = BP_HashRegLookupTableEntryByPath ( fs_reg -> hreg , table_path ) ; if ( table_path ) BP_DestroyPointerArrayNullTerminated ( ( void * * ) table_path ) ; return lookup_entry ; }
Attempts to lookup a keyed entry within the fs registry.
Attempts to lookup a keyed entry within the fs registry .
// ensure we have a filesystem registry // ensure we have a filesystem path // ensure the filesystem path is reasonable // attempt to explode the buffer // display the string array // printf("\n Exploding: %s", filesystem_path); // BP_DisplayStringArray("path: ", 1, 1, table_path); // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% attempt lookup %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // attempt to lookup the entry as a table-entry or data-entry. // destroy the exploded data // return the looked up entry (or null if it's not there)