コード例 #1
0
ファイル: dse_is_blk_in.c プロジェクト: CeperaCPP/fis-gtm
int dse_is_blk_in(sm_uc_ptr_t rp, sm_uc_ptr_t r_top, short size)
{
	sm_uc_ptr_t	key_top;
	char		targ_key[MAX_KEY_SZ + 1];

	memcpy(targ_key, rp + SIZEOF(rec_hdr), size);
	if ((patch_find_blk != patch_path[0])
		&& !dse_order(patch_path[0], &patch_path[1], patch_offset, targ_key, size, 0))
			return FALSE;
	patch_dir_path_count = patch_path_count;
	if (!patch_find_root_search || (patch_find_blk != patch_path[patch_path_count - 1]))
	{
		if ((0 >= patch_path[patch_path_count - 1]) || (patch_path[patch_path_count] > cs_addrs->ti->total_blks))
			return FALSE;
		patch_find_root_search = FALSE;
		for (key_top = rp + SIZEOF(rec_hdr); (*key_top++ || *key_top++) && (key_top < r_top);)
			;
		size = key_top - rp - SIZEOF(rec_hdr);
		if (0 > size)
			size = 0;
		else if (SIZEOF(targ_key) < size)
			size = SIZEOF(targ_key);
		memcpy(targ_key, rp + SIZEOF(rec_hdr), size);
		patch_path1[0] = patch_path[patch_path_count - 1];
		patch_path[patch_path_count - 1] = 0;
		patch_path_count = 1;
		if ((patch_find_blk != patch_path1[0])
			&& !dse_order(patch_path1[0], &patch_path1[1], patch_offset1, targ_key, size, 0))
				return FALSE;
	} else
		patch_path_count = 0;
	return TRUE;
}
コード例 #2
0
ファイル: dse_is_blk_in.c プロジェクト: h4ck3rm1k3/fis-gtm
int dse_is_blk_in(sm_uc_ptr_t rp, sm_uc_ptr_t r_top, short size)
{
	sm_uc_ptr_t	key_top;
	char		targ_key[256];

	memcpy(&targ_key[0], rp + SIZEOF(rec_hdr), size);
	if ( patch_find_blk != patch_path[0]
	    && !dse_order(patch_path[0], &patch_path[1], &patch_offset[0],
		&targ_key[0], size, 0))
			return FALSE;
	patch_dir_path_count = patch_path_count;
	if (patch_find_blk != patch_path[patch_path_count - 1])
	{
	    if (patch_path[patch_path_count - 1] <= 0
		|| patch_path[patch_path_count] > cs_addrs->ti->total_blks)
			return FALSE;
	    patch_find_root_search = FALSE;
	    for (key_top = rp + SIZEOF(rec_hdr); key_top < r_top ; )
		if (!*key_top++ && !*key_top++)
		    break;
	    size = key_top - rp - SIZEOF(rec_hdr);
	    if (size < 0)
		size = 0;
	    else if (size > SIZEOF(targ_key))
		size = SIZEOF(targ_key);
	    memcpy(&targ_key[0], rp + SIZEOF(rec_hdr), size);
	    patch_path1[0] = patch_path[patch_path_count - 1];
	    patch_path[patch_path_count - 1] = 0;
	    patch_path_count = 1;
	    if (patch_find_blk != patch_path1[0]
		&& !dse_order(patch_path1[0],&patch_path1[1],&patch_offset1[0],
		     &targ_key[0], size, 0))
			return FALSE;
	} else
	    patch_path_count = 0;
	return TRUE;
}