Пример #1
0
TiffUintField::TiffUintField(IFDEntry &entry, BPositionIO &io, swap_action swp)
	: TiffField(entry)
{
	if (entry.count > 0) {
		switch (entry.fieldType) {
			case TIFF_BYTE:
				fpByte = NULL;
				LoadByte(entry, io, swp);
				break;
				
			case TIFF_SHORT:
				fpShort = NULL;
				LoadShort(entry, io, swp);
				break;
				
			case TIFF_LONG:
				fpLong = NULL;
				LoadLong(entry, io, swp);
				break;
			
			default:
				finitStatus = B_BAD_TYPE;
				break;
		}
	} else
		finitStatus = B_BAD_VALUE;
}
Пример #2
0
extern void       _TreeDeleteNodeExecute(void *dbid)
{
  PINO_DATABASE *dblist = (PINO_DATABASE *)dbid;
  static NID       nid;
  NODE     *node;
  NODE     *prevnode = 0;
  NODE     *parent;
  static NCI empty_nci;
  NODE     *firstempty = (dblist->tree_info->header->free == -1) ? (NODE *) 0 :
	  (NODE *) ((char *) dblist->tree_info->node + dblist->tree_info->header->free);

  TREE_EDIT *edit = dblist->tree_info->edit;
  static int zero = 0;
/*------------------------------------------------------------------------------

 Executable:                                                                  */

  nid.tree = 0;
  nid.node = 0;
  while (_TreeDeleteNodeGetNid(dbid, (int*)&nid) & 1)
  {
    int       found = 0;
    _TreeRemoveNodesTags(dbid, *(int *)&nid);
    _TreeSetNoSubtree(dbid, *(int *)&nid);
    nid_to_node(dblist, (&nid), node);
    parent = parent_of(node);
    if (child_of(parent) == node)
    {
      found = 1;
      if (node->INFO.TREE_INFO.brother)
      {
        link_it(parent->INFO.TREE_INFO.child,brother_of(node),parent);
      }
      else
	parent->INFO.TREE_INFO.child = 0;
    }
    else if (parent->INFO.TREE_INFO.child)
    {
      NODE     *bro;
      for (bro = child_of(parent); bro->INFO.TREE_INFO.brother && (brother_of(bro) != node); bro = brother_of(bro));
      if (brother_of(bro) == node)
      {
	found = 1;
	if (node->INFO.TREE_INFO.brother)
	{
          link_it(bro->INFO.TREE_INFO.brother,brother_of(node),bro);
        }
	else
	  bro->INFO.TREE_INFO.brother = 0;
      }
    }
    if (!found)
    {
      if (member_of(parent) == node)
      {
	if (node->INFO.TREE_INFO.brother)
	{
	  link_it(parent->INFO.TREE_INFO.member,brother_of(node), parent);
        }
	else
	  parent->INFO.TREE_INFO.member = 0;
      }
      else if (parent->INFO.TREE_INFO.member)
      {
	NODE     *bro;
	for (bro = member_of(parent); bro->INFO.TREE_INFO.brother && (brother_of(bro) != node); bro = brother_of(bro));
	if (brother_of(bro) == node)
	{
	  found = 1;
	  if (node->INFO.TREE_INFO.brother)
	  {
	    link_it(bro->INFO.TREE_INFO.brother,brother_of(node), bro);
          }
	  else
	    bro->INFO.TREE_INFO.brother = 0;
	}
      }
    }
    if ((int)nid.node < edit->first_in_mem)
    {
      NCI       old_nci;
      int       nidx = nid.node;
      TreeGetNciLw(dblist->tree_info, nidx, &old_nci);
      TreePutNci(dblist->tree_info, nidx, &empty_nci, 1);
    }
    else
      memcpy(edit->nci + nid.node - edit->first_in_mem, &empty_nci, sizeof(struct nci));
    memcpy(node->name,"deleted node",sizeof(node->name));
    LoadShort(zero,&node->conglomerate_elt);
    node->INFO.TREE_INFO.member = 0;
    node->INFO.TREE_INFO.brother = 0;
    node->usage = 0;
    if (prevnode)
    {
      int tmp;
      link_it(prevnode->parent, node, prevnode);
      tmp = -swapint((char *)&prevnode->parent);
      node->INFO.TREE_INFO.child = swapint((char *)&tmp);
    }
    else
    {
      int tmp;
      link_it(tmp,node, dblist->tree_info->node);
      dblist->tree_info->header->free = swapint((char *)&tmp);
      node->INFO.TREE_INFO.child = 0;
    }
    if (firstempty)
    {
      int tmp;
      link_it(node->parent, firstempty, node);
      tmp = -swapint((char *)&node->parent);
      firstempty->INFO.TREE_INFO.child = swapint((char *)&tmp);
    }
    else
      node->parent = 0;
    prevnode = node;
  }
  dblist->modified = 1;
  _TreeDeleteNodeInitialize(dbid, 0, 0, 1);
}