亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? btree.c

?? Trolltech公司發布的基于C++圖形開發環境
?? C
?? 第 1 頁 / 共 5 頁
字號:
** beginning of the page and all free space is collected ** into one big FreeBlk at the end of the page.*/static void defragmentPage(Btree *pBt, MemPage *pPage){  int pc, i, n;  FreeBlk *pFBlk;  char newPage[SQLITE_USABLE_SIZE];  assert( sqlitepager_iswriteable(pPage) );  assert( pPage->isInit );  pc = sizeof(PageHdr);  pPage->u.hdr.firstCell = SWAB16(pBt, pc);  memcpy(newPage, pPage->u.aDisk, pc);  for(i=0; i<pPage->nCell; i++){    Cell *pCell = pPage->apCell[i];    /* This routine should never be called on an overfull page.  The    ** following asserts verify that constraint. */    assert( Addr(pCell) > Addr(pPage) );    assert( Addr(pCell) < Addr(pPage) + SQLITE_USABLE_SIZE );    n = cellSize(pBt, pCell);    pCell->h.iNext = SWAB16(pBt, pc + n);    memcpy(&newPage[pc], pCell, n);    pPage->apCell[i] = (Cell*)&pPage->u.aDisk[pc];    pc += n;  }  assert( pPage->nFree==SQLITE_USABLE_SIZE-pc );  memcpy(pPage->u.aDisk, newPage, pc);  if( pPage->nCell>0 ){    pPage->apCell[pPage->nCell-1]->h.iNext = 0;  }  pFBlk = (FreeBlk*)&pPage->u.aDisk[pc];  pFBlk->iSize = SWAB16(pBt, SQLITE_USABLE_SIZE - pc);  pFBlk->iNext = 0;  pPage->u.hdr.firstFree = SWAB16(pBt, pc);  memset(&pFBlk[1], 0, SQLITE_USABLE_SIZE - pc - sizeof(FreeBlk));}/*** Allocate nByte bytes of space on a page.  nByte must be a ** multiple of 4.**** Return the index into pPage->u.aDisk[] of the first byte of** the new allocation. Or return 0 if there is not enough free** space on the page to satisfy the allocation request.**** If the page contains nBytes of free space but does not contain** nBytes of contiguous free space, then this routine automatically** calls defragementPage() to consolidate all free space before ** allocating the new chunk.*/static int allocateSpace(Btree *pBt, MemPage *pPage, int nByte){  FreeBlk *p;  u16 *pIdx;  int start;  int iSize;#ifndef NDEBUG  int cnt = 0;#endif  assert( sqlitepager_iswriteable(pPage) );  assert( nByte==ROUNDUP(nByte) );  assert( pPage->isInit );  if( pPage->nFree<nByte || pPage->isOverfull ) return 0;  pIdx = &pPage->u.hdr.firstFree;  p = (FreeBlk*)&pPage->u.aDisk[SWAB16(pBt, *pIdx)];  while( (iSize = SWAB16(pBt, p->iSize))<nByte ){    assert( cnt++ < SQLITE_USABLE_SIZE/4 );    if( p->iNext==0 ){      defragmentPage(pBt, pPage);      pIdx = &pPage->u.hdr.firstFree;    }else{      pIdx = &p->iNext;    }    p = (FreeBlk*)&pPage->u.aDisk[SWAB16(pBt, *pIdx)];  }  if( iSize==nByte ){    start = SWAB16(pBt, *pIdx);    *pIdx = p->iNext;  }else{    FreeBlk *pNew;    start = SWAB16(pBt, *pIdx);    pNew = (FreeBlk*)&pPage->u.aDisk[start + nByte];    pNew->iNext = p->iNext;    pNew->iSize = SWAB16(pBt, iSize - nByte);    *pIdx = SWAB16(pBt, start + nByte);  }  pPage->nFree -= nByte;  return start;}/*** Return a section of the MemPage.u.aDisk[] to the freelist.** The first byte of the new free block is pPage->u.aDisk[start]** and the size of the block is "size" bytes.  Size must be** a multiple of 4.**** Most of the effort here is involved in coalesing adjacent** free blocks into a single big free block.*/static void freeSpace(Btree *pBt, MemPage *pPage, int start, int size){  int end = start + size;  u16 *pIdx, idx;  FreeBlk *pFBlk;  FreeBlk *pNew;  FreeBlk *pNext;  int iSize;  assert( sqlitepager_iswriteable(pPage) );  assert( size == ROUNDUP(size) );  assert( start == ROUNDUP(start) );  assert( pPage->isInit );  pIdx = &pPage->u.hdr.firstFree;  idx = SWAB16(pBt, *pIdx);  while( idx!=0 && idx<start ){    pFBlk = (FreeBlk*)&pPage->u.aDisk[idx];    iSize = SWAB16(pBt, pFBlk->iSize);    if( idx + iSize == start ){      pFBlk->iSize = SWAB16(pBt, iSize + size);      if( idx + iSize + size == SWAB16(pBt, pFBlk->iNext) ){        pNext = (FreeBlk*)&pPage->u.aDisk[idx + iSize + size];        if( pBt->needSwab ){          pFBlk->iSize = swab16((u16)swab16(pNext->iSize)+iSize+size);        }else{          pFBlk->iSize += pNext->iSize;        }        pFBlk->iNext = pNext->iNext;      }      pPage->nFree += size;      return;    }    pIdx = &pFBlk->iNext;    idx = SWAB16(pBt, *pIdx);  }  pNew = (FreeBlk*)&pPage->u.aDisk[start];  if( idx != end ){    pNew->iSize = SWAB16(pBt, size);    pNew->iNext = SWAB16(pBt, idx);  }else{    pNext = (FreeBlk*)&pPage->u.aDisk[idx];    pNew->iSize = SWAB16(pBt, size + SWAB16(pBt, pNext->iSize));    pNew->iNext = pNext->iNext;  }  *pIdx = SWAB16(pBt, start);  pPage->nFree += size;}/*** Initialize the auxiliary information for a disk block.**** The pParent parameter must be a pointer to the MemPage which** is the parent of the page being initialized.  The root of the** BTree (usually page 2) has no parent and so for that page, ** pParent==NULL.**** Return SQLITE_OK on success.  If we see that the page does** not contain a well-formed database page, then return ** SQLITE_CORRUPT.  Note that a return of SQLITE_OK does not** guarantee that the page is well-formed.  It only shows that** we failed to detect any corruption.*/static int initPage(Bt *pBt, MemPage *pPage, Pgno pgnoThis, MemPage *pParent){  int idx;           /* An index into pPage->u.aDisk[] */  Cell *pCell;       /* A pointer to a Cell in pPage->u.aDisk[] */  FreeBlk *pFBlk;    /* A pointer to a free block in pPage->u.aDisk[] */  int sz;            /* The size of a Cell in bytes */  int freeSpace;     /* Amount of free space on the page */  if( pPage->pParent ){    assert( pPage->pParent==pParent );    return SQLITE_OK;  }  if( pParent ){    pPage->pParent = pParent;    sqlitepager_ref(pParent);  }  if( pPage->isInit ) return SQLITE_OK;  pPage->isInit = 1;  pPage->nCell = 0;  freeSpace = USABLE_SPACE;  idx = SWAB16(pBt, pPage->u.hdr.firstCell);  while( idx!=0 ){    if( idx>SQLITE_USABLE_SIZE-MIN_CELL_SIZE ) goto page_format_error;    if( idx<sizeof(PageHdr) ) goto page_format_error;    if( idx!=ROUNDUP(idx) ) goto page_format_error;    pCell = (Cell*)&pPage->u.aDisk[idx];    sz = cellSize(pBt, pCell);    if( idx+sz > SQLITE_USABLE_SIZE ) goto page_format_error;    freeSpace -= sz;    pPage->apCell[pPage->nCell++] = pCell;    idx = SWAB16(pBt, pCell->h.iNext);  }  pPage->nFree = 0;  idx = SWAB16(pBt, pPage->u.hdr.firstFree);  while( idx!=0 ){    int iNext;    if( idx>SQLITE_USABLE_SIZE-sizeof(FreeBlk) ) goto page_format_error;    if( idx<sizeof(PageHdr) ) goto page_format_error;    pFBlk = (FreeBlk*)&pPage->u.aDisk[idx];    pPage->nFree += SWAB16(pBt, pFBlk->iSize);    iNext = SWAB16(pBt, pFBlk->iNext);    if( iNext>0 && iNext <= idx ) goto page_format_error;    idx = iNext;  }  if( pPage->nCell==0 && pPage->nFree==0 ){    /* As a special case, an uninitialized root page appears to be    ** an empty database */    return SQLITE_OK;  }  if( pPage->nFree!=freeSpace ) goto page_format_error;  return SQLITE_OK;page_format_error:  return SQLITE_CORRUPT;}/*** Set up a raw page so that it looks like a database page holding** no entries.*/static void zeroPage(Btree *pBt, MemPage *pPage){  PageHdr *pHdr;  FreeBlk *pFBlk;  assert( sqlitepager_iswriteable(pPage) );  memset(pPage, 0, SQLITE_USABLE_SIZE);  pHdr = &pPage->u.hdr;  pHdr->firstCell = 0;  pHdr->firstFree = SWAB16(pBt, sizeof(*pHdr));  pFBlk = (FreeBlk*)&pHdr[1];  pFBlk->iNext = 0;  pPage->nFree = SQLITE_USABLE_SIZE - sizeof(*pHdr);  pFBlk->iSize = SWAB16(pBt, pPage->nFree);  pPage->nCell = 0;  pPage->isOverfull = 0;}/*** This routine is called when the reference count for a page** reaches zero.  We need to unref the pParent pointer when that** happens.*/static void pageDestructor(void *pData){  MemPage *pPage = (MemPage*)pData;  if( pPage->pParent ){    MemPage *pParent = pPage->pParent;    pPage->pParent = 0;    sqlitepager_unref(pParent);  }}/*** Open a new database.**** Actually, this routine just sets up the internal data structures** for accessing the database.  We do not open the database file ** until the first page is loaded.**** zFilename is the name of the database file.  If zFilename is NULL** a new database with a random name is created.  This randomly named** database file will be deleted when sqliteBtreeClose() is called.*/int sqliteBtreeOpen(  const char *zFilename,    /* Name of the file containing the BTree database */  int omitJournal,          /* if TRUE then do not journal this file */  int nCache,               /* How many pages in the page cache */  Btree **ppBtree           /* Pointer to new Btree object written here */){  Btree *pBt;  int rc;  /*  ** The following asserts make sure that structures used by the btree are  ** the right size.  This is to guard against size changes that result  ** when compiling on a different architecture.  */  assert( sizeof(u32)==4 );  assert( sizeof(u16)==2 );  assert( sizeof(Pgno)==4 );  assert( sizeof(PageHdr)==8 );  assert( sizeof(CellHdr)==12 );  assert( sizeof(FreeBlk)==4 );  assert( sizeof(OverflowPage)==SQLITE_USABLE_SIZE );  assert( sizeof(FreelistInfo)==OVERFLOW_SIZE );  assert( sizeof(ptr)==sizeof(char*) );  assert( sizeof(uptr)==sizeof(ptr) );  pBt = sqliteMalloc( sizeof(*pBt) );  if( pBt==0 ){    *ppBtree = 0;    return SQLITE_NOMEM;  }  if( nCache<10 ) nCache = 10;  rc = sqlitepager_open(&pBt->pPager, zFilename, nCache, EXTRA_SIZE,                        !omitJournal);  if( rc!=SQLITE_OK ){    if( pBt->pPager ) sqlitepager_close(pBt->pPager);    sqliteFree(pBt);    *ppBtree = 0;    return rc;  }  sqlitepager_set_destructor(pBt->pPager, pageDestructor);  pBt->pCursor = 0;  pBt->page1 = 0;  pBt->readOnly = sqlitepager_isreadonly(pBt->pPager);  pBt->pOps = &sqliteBtreeOps;  *ppBtree = pBt;  return SQLITE_OK;}/*** Close an open database and invalidate all cursors.*/static int fileBtreeClose(Btree *pBt){  while( pBt->pCursor ){    fileBtreeCloseCursor(pBt->pCursor);  }  sqlitepager_close(pBt->pPager);  sqliteFree(pBt);  return SQLITE_OK;}/*** Change the limit on the number of pages allowed in the cache.**** The maximum number of cache pages is set to the absolute** value of mxPage.  If mxPage is negative, the pager will** operate asynchronously - it will not stop to do fsync()s** to insure data is written to the disk surface before** continuing.  Transactions still work if synchronous is off,** and the database cannot be corrupted if this program** crashes.  But if the operating system crashes or there is** an abrupt power failure when synchronous is off, the database** could be left in an inconsistent and unrecoverable state.** Synchronous is on by default so database corruption is not** normally a worry.*/static int fileBtreeSetCacheSize(Btree *pBt, int mxPage){  sqlitepager_set_cachesize(pBt->pPager, mxPage);  return SQLITE_OK;}/*** Change the way data is synced to disk in order to increase or decrease** how well the database resists damage due to OS crashes and power** failures.  Level 1 is the same as asynchronous (no syncs() occur and** there is a high probability of damage)  Level 2 is the default.  There** is a very low but non-zero probability of damage.  Level 3 reduces the** probability of damage to near zero but with a write performance reduction.*/static int fileBtreeSetSafetyLevel(Btree *pBt, int level){  sqlitepager_set_safety_level(pBt->pPager, level);  return SQLITE_OK;}/*** Get a reference to page1 of the database file.  This will** also acquire a readlock on that file.**** SQLITE_OK is returned on success.  If the file is not a** well-formed database file, then SQLITE_CORRUPT is returned.** SQLITE_BUSY is returned if the database is locked.  SQLITE_NOMEM** is returned if we run out of memory.  SQLITE_PROTOCOL is returned** if there is a locking protocol violation.*/static int lockBtree(Btree *pBt){  int rc;  if( pBt->page1 ) return SQLITE_OK;  rc = sqlitepager_get(pBt->pPager, 1, (void**)&pBt->page1);  if( rc!=SQLITE_OK ) return rc;  /* Do some checking to help insure the file we opened really is  ** a valid database file.   */  if( sqlitepager_pagecount(pBt->pPager)>0 ){    PageOne *pP1 = pBt->page1;    if( strcmp(pP1->zMagic,zMagicHeader)!=0 ||          (pP1->iMagic!=MAGIC && swab32(pP1->iMagic)!=MAGIC) ){      rc = SQLITE_NOTADB;      goto page1_init_failed;    }    pBt->needSwab = pP1->iMagic!=MAGIC;  }  return rc;page1_init_failed:  sqlitepager_unref(pBt->page1);  pBt->page1 = 0;  return rc;}/*** If there are no outstanding cursors and we are not in the middle** of a transaction but there is a read lock on the database, then** this routine unrefs the first page of the database file which ** has the effect of releasing the read lock.**** If there are any outstanding cursors, this routine is a no-op.**** If there is a transaction in progress, this routine is a no-op.*/static void unlockBtreeIfUnused(Btree *pBt){  if( pBt->inTrans==0 && pBt->pCursor==0 && pBt->page1!=0 ){    sqlitepager_unref(pBt->page1);    pBt->page1 = 0;    pBt->inTrans = 0;    pBt->inCkpt = 0;  }}/*** Create a new database by initializing the first two pages of the** file.*/static int newDatabase(Btree *pBt){  MemPage *pRoot;  PageOne *pP1;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区免费看| 精品在线视频一区| 久久奇米777| 欧美综合欧美视频| 国产盗摄一区二区| 日本不卡高清视频| 亚洲一区二区综合| 国产精品免费aⅴ片在线观看| 884aa四虎影成人精品一区| gogo大胆日本视频一区| 久99久精品视频免费观看| 亚洲夂夂婷婷色拍ww47| 综合欧美亚洲日本| 国产午夜精品福利| 欧美电视剧免费观看| 欧美亚洲自拍偷拍| 色婷婷av一区| 91视视频在线直接观看在线看网页在线看| 久久99精品一区二区三区| 香蕉久久夜色精品国产使用方法| 国产精品久久久久久亚洲毛片 | 欧美视频中文一区二区三区在线观看| 国产精品自拍一区| 久99久精品视频免费观看| 日韩精品电影一区亚洲| 一卡二卡三卡日韩欧美| 亚洲图片另类小说| 亚洲欧美日韩中文播放 | 亚洲三级免费电影| 欧美高清在线精品一区| 久久久久一区二区三区四区| 欧美一级日韩免费不卡| 欧美日韩成人在线一区| 欧美日韩aaa| 91精品国产综合久久蜜臀| 精品视频一区二区不卡| 欧美三级电影在线观看| 欧美日韩国产美| 51精品久久久久久久蜜臀| 欧美日韩国产一二三| 欧美日韩国产综合一区二区三区| 色乱码一区二区三区88| 在线精品视频免费观看| 在线观看亚洲一区| 欧美日韩黄色一区二区| 91精品在线免费| 精品久久五月天| 久久久一区二区三区| 国产精品午夜久久| 亚洲欧美区自拍先锋| 亚洲制服丝袜av| 蜜臀久久久久久久| 国产做a爰片久久毛片| 国产精品一区二区在线观看网站| 国产91精品久久久久久久网曝门| 成人激情免费网站| 在线观看亚洲精品视频| 制服.丝袜.亚洲.中文.综合| 日韩欧美的一区二区| 久久免费的精品国产v∧| 国产精品妹子av| 亚洲一区二区偷拍精品| 免费视频一区二区| 国产一区二区精品在线观看| 成人国产精品免费观看动漫| 91麻豆国产在线观看| 欧美日韩另类国产亚洲欧美一级| 欧美一级电影网站| 国产欧美一区二区三区在线看蜜臀| 最新不卡av在线| 视频一区二区中文字幕| 国产又粗又猛又爽又黄91精品| 成人高清免费在线播放| 在线成人午夜影院| 久久久久久影视| 亚洲一区二区高清| 国产一区二区三区在线观看免费| 91丨九色丨黑人外教| 欧美一区二区三区四区视频| 久久久国产精品午夜一区ai换脸| 一区精品在线播放| 麻豆久久久久久久| 色婷婷久久一区二区三区麻豆| 欧美一区午夜视频在线观看| 国产日韩欧美精品电影三级在线| 亚洲成人中文在线| 成人午夜视频网站| 欧美一级片在线| 亚洲日韩欧美一区二区在线| 精品一区二区在线视频| 欧美性生交片4| 欧美国产精品专区| 日本不卡一二三区黄网| 色av综合在线| 国产欧美一区二区在线观看| 午夜av区久久| 97精品久久久午夜一区二区三区| 91精品国产乱码| 亚洲精品乱码久久久久久日本蜜臀| 日韩av二区在线播放| 色欧美片视频在线观看在线视频| 精品国产伦一区二区三区观看方式 | 日韩精品一区第一页| 99精品视频在线播放观看| 欧美成人女星排名| 日韩二区在线观看| 日本精品视频一区二区| 久久久美女毛片| 青青草原综合久久大伊人精品优势| 99re免费视频精品全部| 久久精品一区蜜桃臀影院| 日韩精品成人一区二区三区| 91福利区一区二区三区| 国产精品久久久久7777按摩 | 激情综合色丁香一区二区| 欧洲一区在线观看| 亚洲蜜臀av乱码久久精品蜜桃| 国产福利91精品一区二区三区| 日韩三级免费观看| 亚洲成人av一区| 欧洲激情一区二区| 夜夜嗨av一区二区三区中文字幕 | 国产精品99久| 51精品视频一区二区三区| 伊人夜夜躁av伊人久久| 91丨国产丨九色丨pron| 1024成人网| 99精品黄色片免费大全| 欧美韩国日本综合| 国产成人精品在线看| 久久奇米777| 高清成人在线观看| 欧美国产视频在线| av电影在线不卡| 亚洲欧洲一区二区在线播放| 97久久精品人人做人人爽| 一区在线观看免费| 在线免费精品视频| 亚洲综合一二区| 欧美日韩在线综合| 婷婷国产在线综合| 欧美一区二区久久久| 美女视频网站久久| 26uuu精品一区二区| 国产一区二区三区四区五区美女| 久久免费国产精品| 成人av网站免费观看| 中文字幕欧美一| 在线观看www91| 天天做天天摸天天爽国产一区| 欧美男人的天堂一二区| 久久国产免费看| 国产日韩欧美制服另类| 99久久精品免费| 亚洲高清免费观看| 日韩欧美一区二区久久婷婷| 国内精品国产成人| 中文字幕一区二区三| 欧美在线一区二区| 老汉av免费一区二区三区 | 亚洲国产aⅴ天堂久久| 欧美精品乱人伦久久久久久| 久久精品99国产精品| 日本一区二区三区国色天香| 色视频一区二区| 美女爽到高潮91| 中文字幕一区二区三区精华液| 91视视频在线观看入口直接观看www | 亚洲电影在线免费观看| 日韩精品在线一区| 成人性生交大片免费看在线播放| 夜夜亚洲天天久久| 久久综合成人精品亚洲另类欧美| 成人福利在线看| 日韩av中文字幕一区二区| 日本不卡一二三区黄网| 欧美国产1区2区| 欧美日韩国产综合一区二区三区| 国产在线视频一区二区三区| ...av二区三区久久精品| 777亚洲妇女| av动漫一区二区| 久久国产精品99久久久久久老狼| 中文字幕亚洲精品在线观看| 日韩一区二区三区视频| 99re视频这里只有精品| 久久99久国产精品黄毛片色诱| 亚洲美女视频在线观看| 精品黑人一区二区三区久久| 一本到高清视频免费精品| 国内外成人在线| 亚洲国产精品综合小说图片区| 国产欧美一区二区三区沐欲| 在线综合视频播放| 91香蕉视频mp4| 国产一区二区0| 亚洲国产另类av| 亚洲欧美日韩一区二区三区在线观看 | 国产在线视频精品一区| 日韩精品一级二级|