예제 #1
0
//###########################################
CPAGE_FUNC(Handle)  CPAGE_GetInternalType(const char * name)
{
	PROLOG;
	Handle rc = 0;
	NAMEDATA nd(name);
	SetReturnCode_cpage(IDS_ERR_NO);
	rc = NameData.FindFirst(nd);
	if(!rc)
		rc = NameData.AddTail(nd);
	EPILOG;
	return rc;
}
예제 #2
0
//###########################################
CPAGE_FUNC(Handle)  CPAGE_RestorePage(Bool32 remove,char * lpName)
{
	PROLOG;
	Handle rc = NULL;
	Bool decompress=FALSE;

	SetReturnCode_cpage(IDS_ERR_NO);

	Handle file = myOpenRestore((char *)lpName);
	if(file)
	{
		int i;
		int count;

		uint32_t vers = 0;
		if(myRead(file,&vers,sizeof(vers))==sizeof(vers))
		{
			if (vers==VERSION_FILE_COMPRESSED)
			   decompress=TRUE;
			else
				if(vers!=VERSION_FILE)
				{
					SetReturnCode_cpage(IDS_ERR_OLDFILEVERSION);
					myClose(file);
					return FALSE;
				}
			{
				if(remove)
				{
					Page.Clear();
					NameData.Clear();
				}

				if(myRead(file,&count,sizeof(count))==sizeof(count))
					for(i=0;i<count ;i++)
					{
						BACKUPPAGE page;
						if(decompress ? page.RestoreCompress(file) : page.Restore(file))
							rc = Page.AddTail(page);
						else
							break;
					}
			}
		}
		myClose(file);
	}
	EPILOG;
return rc;
}
예제 #3
0
//###########################################
CPAGE_FUNC(Handle) CPAGE_CreatePage(Handle type,void * lpdata, uint32_t size)
{
	PROLOG;
	BACKUPPAGE tail;
  SetReturnCode_cpage(IDS_ERR_NO);

  Handle hPage = Page.AddTail(tail);


  if(hPage)
  {
	if(!Page.GetItem(hPage).SetData(type,lpdata,size))
	{
		Page.Del(hPage);
		hPage = NULL;
		if(hCurPage == hPage)
			hCurPage = NULL;
	}
	else
		hCurPage = hPage;
  }
  EPILOG;
  return hPage;
}