本文整理汇总了C++中GetPageSize函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPageSize函数的具体用法?C++ GetPageSize怎么用?C++ GetPageSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetPageSize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: MmapWrapperWriteAndReadMemoryAccess
const char * MmapWrapperWriteAndReadMemoryAccess()
{
#if defined(TARGET_MAC)
return reinterpret_cast<const char *> (mmap(0, GetPageSize(), PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0));
#else
return reinterpret_cast<const char *> (mmap(0, GetPageSize(), PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0));
#endif
}
开发者ID:EmilyBragg,项目名称:profiling-tool,代码行数:8,代码来源:access_protection_app.cpp
示例2: GetRangeMin
void CRoundSliderCtrl::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
const int nMin = GetRangeMin();
const int nMax = GetRangeMax()+1;
switch(nChar)
{
case VK_LEFT:
case VK_UP:
{
int nNewPos = GetPos()-GetLineSize();
while(nNewPos < nMin) nNewPos += (nMax - nMin);
SetPos(nNewPos);
RedrawWindow();
PostMessageToParent(TB_LINEUP);
}
break;
case VK_RIGHT:
case VK_DOWN:
{
int nNewPos = GetPos()+GetLineSize();
while(nNewPos >= nMax) nNewPos -= (nMax - nMin);
SetPos(nNewPos);
RedrawWindow();
PostMessageToParent(TB_LINEDOWN);
}
break;
case VK_PRIOR:
{
int nNewPos = GetPos()-GetPageSize();
while(nNewPos < nMin) nNewPos += (nMax - nMin);
SetPos(nNewPos);
RedrawWindow();
PostMessageToParent(TB_PAGEUP);
}
break;
case VK_NEXT:
{
int nNewPos = GetPos()+GetPageSize();
while(nNewPos >= nMax) nNewPos -= (nMax - nMin);
SetPos(nNewPos);
RedrawWindow();
PostMessageToParent(TB_PAGEDOWN);
}
break;
case VK_HOME:
case VK_END:
// Do nothing (ignore keystroke)
break;
default:
CSliderCtrl::OnKeyDown(nChar, nRepCnt, nFlags);
}
}
开发者ID:ttrask,项目名称:staubliserver,代码行数:58,代码来源:RoundSliderCtrl.cpp
示例3: tsk_pagesize
static int tsk_pagesize(RIOMach *riom) {
#define GetPageSize(x) (host_page_size (riom->task, x) == KERN_SUCCESS)
static vm_size_t pagesize = 0;
return pagesize ? pagesize
: GetPageSize (&pagesize)
? pagesize : 4096;
}
开发者ID:ghostbar,项目名称:radare2.deb,代码行数:7,代码来源:io_mach.c
示例4: GetPageSize
bool wxNotebook::MSWPrintChild(WXHDC hDC, wxWindow *child)
{
// solid background colour overrides themed background drawing
if ( !UseBgCol() && DoDrawBackground(hDC, child) )
return true;
// If we're using a solid colour (for example if we've switched off
// theming for this notebook), paint it
if (UseBgCol())
{
wxRect r = GetPageSize();
if ( r.IsEmpty() )
return false;
RECT rc;
wxCopyRectToRECT(r, rc);
// map rect to the coords of the window we're drawing in
if ( child )
::MapWindowPoints(GetHwnd(), GetHwndOf(child), (POINT *)&rc, 2);
wxBrush brush(GetBackgroundColour());
HBRUSH hbr = GetHbrushOf(brush);
::FillRect((HDC) hDC, &rc, hbr);
return true;
}
return wxNotebookBase::MSWPrintChild(hDC, child);
}
开发者ID:chromylei,项目名称:third_party,代码行数:31,代码来源:notebook.cpp
示例5: wxCHECK_MSG
bool wxNotebook::SetPageText(size_t nPage, const wxString& strText)
{
wxCHECK_MSG( IS_VALID_PAGE(nPage), false, wxT("notebook page out of range") );
TC_ITEM tcItem;
tcItem.mask = TCIF_TEXT;
tcItem.pszText = wxMSW_CONV_LPTSTR(strText);
if ( !HasFlag(wxNB_MULTILINE) )
return TabCtrl_SetItem(GetHwnd(), nPage, &tcItem) != 0;
// multiline - we need to set new page size if a line is added or removed
int rows = GetRowCount();
bool ret = TabCtrl_SetItem(GetHwnd(), nPage, &tcItem) != 0;
if ( ret && rows != GetRowCount() )
{
const wxRect r = GetPageSize();
const size_t count = m_pages.Count();
for ( size_t page = 0; page < count; page++ )
m_pages[page]->SetSize(r);
}
return ret;
}
开发者ID:chromylei,项目名称:third_party,代码行数:25,代码来源:notebook.cpp
示例6: main
int main(int nargs, char **args)
{
size_t pgsz;
int MaxL1Size;
int muladd, lat, lbnreg, L1Size, mmnreg, nkflop;
FILE *fpout;
char pre;
if (nargs != 3)
{
fprintf(stderr, "USAGE: %s <pre> <file>\n", args[0]);
exit(-1);
}
pre = *args[1];
L1Size = 1024 * GetL1CacheSize(64);
if (pre == 'd') L1Size /= ATL_dsize;
else if (pre == 's') L1Size /= ATL_ssize;
else if (pre == 'z') L1Size /= ATL_csize;
else if (pre == 'c') L1Size /= ATL_zsize;
getfpinfo(pre, &muladd, &lat, &lbnreg, &nkflop);
pgsz = GetPageSize();
CreateHeader(pre, args[2], L1Size, muladd, lat, lbnreg, nkflop, 0, pgsz);
mmnreg = getmmnreg(pre);
CreateHeader(pre, args[2], L1Size, muladd, lat, lbnreg, nkflop, mmnreg,pgsz);
return(0);
}
开发者ID:kevinoid,项目名称:atlas-debian,代码行数:27,代码来源:GetSysSum.c
示例7: TabCtrl_HitTest
int wxNotebook::HitTest(const wxPoint& pt, long *flags) const
{
TC_HITTESTINFO hitTestInfo;
hitTestInfo.pt.x = pt.x;
hitTestInfo.pt.y = pt.y;
int item = TabCtrl_HitTest(GetHwnd(), &hitTestInfo);
if ( flags )
{
*flags = 0;
if ((hitTestInfo.flags & TCHT_NOWHERE) == TCHT_NOWHERE)
*flags |= wxBK_HITTEST_NOWHERE;
if ((hitTestInfo.flags & TCHT_ONITEM) == TCHT_ONITEM)
*flags |= wxBK_HITTEST_ONITEM;
if ((hitTestInfo.flags & TCHT_ONITEMICON) == TCHT_ONITEMICON)
*flags |= wxBK_HITTEST_ONICON;
if ((hitTestInfo.flags & TCHT_ONITEMLABEL) == TCHT_ONITEMLABEL)
*flags |= wxBK_HITTEST_ONLABEL;
if ( item == wxNOT_FOUND && GetPageSize().Contains(pt) )
*flags |= wxBK_HITTEST_ONPAGE;
}
return item;
}
开发者ID:chromylei,项目名称:third_party,代码行数:25,代码来源:notebook.cpp
示例8: pressed
/*----------------------------------------------------------------------
* Class: AmayaScrollBar
* Method: OnScroll
* Description:
-----------------------------------------------------------------------*/
void AmayaScrollBar::OnScroll( wxScrollEvent& event )
{
/* this flag is necessary because 2 events occure when up/down button
is pressed (it's an optimisation)
this hack works because OnLineDown is called before OnScroll,
but becareful the events orders could change in future wxWidgets
releases or can be platform specific
*/
if (m_IgnoreNextScrollEvent)
{
m_IgnoreNextScrollEvent = FALSE;
event.Skip();
return;
}
if (event.GetOrientation() == wxHORIZONTAL)
{
TTALOGDEBUG_3( TTA_LOG_DIALOG, _T("AmayaScrollBar::OnScroll [wxHORIZONTAL][frameid=%d][pos=%d][pagesize=%d]"), m_ParentFrameID, event.GetPosition(), GetPageSize() );
FrameHScrolledCallback( m_ParentFrameID,
event.GetPosition(),
GetPageSize() );
}
else if (event.GetOrientation() == wxVERTICAL)
{
TTALOGDEBUG_3( TTA_LOG_DIALOG, _T("AmayaScrollBar::OnScroll [wxVERTICAL][frameid=%d][pos=%d][pagesize=%d]"), m_ParentFrameID, event.GetPosition(), GetPageSize() );
FrameVScrolledCallback( m_ParentFrameID,
event.GetPosition() );
}
}
开发者ID:ArcScofield,项目名称:Amaya,代码行数:34,代码来源:AmayaScrollBar.cpp
示例9: GetPageSize
WXHBRUSH wxNotebook::QueryBgBitmap()
{
wxRect r = GetPageSize();
if ( r.IsEmpty() )
return 0;
wxUxThemeHandle theme(this, L"TAB");
if ( !theme )
return 0;
RECT rc;
wxCopyRectToRECT(r, rc);
WindowHDC hDC(GetHwnd());
wxUxThemeEngine::Get()->GetThemeBackgroundExtent
(
theme,
(HDC) hDC,
9 /* TABP_PANE */,
0,
&rc,
&rc
);
MemoryHDC hDCMem(hDC);
CompatibleBitmap hBmp(hDC, rc.right, rc.bottom);
SelectInHDC selectBmp(hDCMem, hBmp);
if ( !DoDrawBackground((WXHDC)(HDC)hDCMem) )
return 0;
return (WXHBRUSH)::CreatePatternBrush(hBmp);
}
开发者ID:AdmiralCurtiss,项目名称:pcsx2,代码行数:34,代码来源:notebook.cpp
示例10: GetPageSize
void CXFA_FFPageView::GetDisplayMatrix(CFX_Matrix& mt,
const CFX_Rect& rtDisp,
int32_t iRotate) const {
CFX_SizeF sz = GetPageSize();
CFX_RectF fdePage;
fdePage.Set(0, 0, sz.x, sz.y);
GetPageMatrix(mt, fdePage, rtDisp, iRotate, 0);
}
开发者ID:gradescope,项目名称:pdfium,代码行数:8,代码来源:xfa_ffpageview.cpp
示例11: SafeCopyTest
/*!
* Test the PIN_SafeCopy() function in the following scenarios:
* A. Successful copy of an entire memory region
* B. Partial copy of a memory region, whose tail is inaccessible
* C. Failure to copy an inaccessible memory region
*/
VOID SafeCopyTest()
{
size_t pageSize = GetPageSize();
CHAR * src = (CHAR *)MemAlloc(2*pageSize);
ASSERTX(src != 0);
CHAR * srcBuf = src + 1; // +1 for testing unaligned access
CHAR * dst = (CHAR *)MemAlloc(2*pageSize);
ASSERTX(dst != 0);
CHAR * dstBuf = dst + 1; // +1 for testing unaligned access
size_t bufSize = 2*pageSize - 1;
size_t halfBufSize = pageSize - 1;
size_t copySize;
//A.
for (unsigned int i = 0; i < bufSize; ++i)
{
src[i] = i/256;
dst[i] = 0;
}
copySize = PIN_SafeCopy(dstBuf, srcBuf, bufSize);
ASSERT(((copySize == bufSize) && (memcmp(dstBuf, srcBuf, bufSize) == 0)), "SafeCopy (A) failed.\n");
out << "SafeCopy (A): Entire buffer has been copied successfully." << endl << flush;
//B.
for (unsigned int i = 0; i < pageSize; ++i)
{
dst[i] = 0;
}
MemProtect(src + pageSize, pageSize, FALSE); // second half of src is inaccessible
copySize = PIN_SafeCopy(dstBuf, srcBuf, bufSize);
ASSERT(((copySize == halfBufSize) && (memcmp(dstBuf, srcBuf, halfBufSize) == 0)), "SafeCopy (B) failed.\n");
// Check to see that all accessible bytes near the end of the first page are copied successfully
for (unsigned int sz = 1; sz < 16; ++sz)
{
for (unsigned int i = 0; i < sz; ++i)
{
dstBuf[i] = 0;
}
copySize = PIN_SafeCopy(dstBuf, src + pageSize - sz, pageSize);
ASSERT(((copySize == sz) && (memcmp(dstBuf, src + pageSize - sz, sz) == 0)), "SafeCopy (B) failed.\n");
}
out << "SafeCopy (B): Accessible part of the buffer has been copied successfully." << endl << flush;
//C.
MemProtect(dst, pageSize, FALSE); // dst is inaccessible
copySize = PIN_SafeCopy(dstBuf, srcBuf, bufSize);
ASSERT((copySize == 0), "SafeCopy (C) failed.\n");
out << "SafeCopy (C): Inaccessible buffer has not been copied." << endl << flush;
MemFree(src, 2*pageSize);
MemFree(dst, 2*pageSize);
}
开发者ID:EmilyBragg,项目名称:profiling-tool,代码行数:64,代码来源:safecopy.cpp
示例12: wxCHECK_RET
void wxNotebook::AdjustPageSize(wxNotebookPage *page)
{
wxCHECK_RET( page, wxT("NULL page in wxNotebook::AdjustPageSize") );
const wxRect r = GetPageSize();
if ( !r.IsEmpty() )
{
page->SetSize(r);
}
}
开发者ID:chromylei,项目名称:third_party,代码行数:10,代码来源:notebook.cpp
示例13: GetShowButtons
void ScrollBarHorizontal::SetPos(float pos)
{
ScrollBarBase::SetPos(pos);
float mult = GetShowButtons() ? 1.0f : 0.0f;
_btnBox->Resize(std::max(GetScrollPaneLength() * GetPageSize() / GetDocumentSize(), _btnBox->GetTextureWidth()),
_btnBox->GetHeight());
_btnBox->Move(floorf(_btnUpLeft->GetWidth() * mult + (GetWidth() - _btnBox->GetWidth()
- (_btnUpLeft->GetWidth() + _btnDownRight->GetWidth()) * mult) * GetPos() / (GetDocumentSize() - GetPageSize()) + 0.5f), _btnBox->GetY());
}
开发者ID:Asqwel,项目名称:TZOD-Modified,代码行数:10,代码来源:Scroll.cpp
示例14: GetPageSize
bool wxWizard::ResizeBitmap(wxBitmap& bmp)
{
if (!GetBitmapPlacement())
return false;
if (bmp.Ok())
{
wxSize pageSize = m_sizerPage->GetSize();
if (pageSize == wxSize(0,0))
pageSize = GetPageSize();
int bitmapWidth = wxMax(bmp.GetWidth(), GetMinimumBitmapWidth());
int bitmapHeight = pageSize.y;
if (!m_statbmp->GetBitmap().Ok() || m_statbmp->GetBitmap().GetHeight() != bitmapHeight)
{
wxBitmap bitmap(bitmapWidth, bitmapHeight);
{
wxMemoryDC dc;
dc.SelectObject(bitmap);
dc.SetBackground(wxBrush(m_bitmapBackgroundColour));
dc.Clear();
if (GetBitmapPlacement() & wxWIZARD_TILE)
{
TileBitmap(wxRect(0, 0, bitmapWidth, bitmapHeight), dc, bmp);
}
else
{
int x, y;
if (GetBitmapPlacement() & wxWIZARD_HALIGN_LEFT)
x = 0;
else if (GetBitmapPlacement() & wxWIZARD_HALIGN_RIGHT)
x = bitmapWidth - bmp.GetWidth();
else
x = (bitmapWidth - bmp.GetWidth())/2;
if (GetBitmapPlacement() & wxWIZARD_VALIGN_TOP)
y = 0;
else if (GetBitmapPlacement() & wxWIZARD_VALIGN_BOTTOM)
y = bitmapHeight - bmp.GetHeight();
else
y = (bitmapHeight - bmp.GetHeight())/2;
dc.DrawBitmap(bmp, x, y, true);
dc.SelectObject(wxNullBitmap);
}
}
bmp = bitmap;
}
}
return true;
}
开发者ID:jonntd,项目名称:dynamica,代码行数:55,代码来源:wizard.cpp
示例15: main
/*!
* The main procedure of the application.
*/
int main(int argc, char *argv[])
{
cerr << "SMC in the image of the application" << endl;
// buffer to move foo/bar routines into and execute
static char staticBuffer[PI_FUNC::MAX_SIZE];
// Set read-write-execute protection for the buffer
size_t pageSize = GetPageSize();
char * firstPage = (char *)(((size_t)staticBuffer) & ~(pageSize - 1));
char * endPage = (char *)(((size_t)staticBuffer + sizeof(staticBuffer) + pageSize - 1) & ~(pageSize - 1));
if (!MemProtect(firstPage, endPage - firstPage, MEM_READ_WRITE_EXEC)) {Abort("MemProtect failed");}
for (int i = 0; i < 3; ++i)
{
FOO_FUNC fooFunc;
fooFunc.Copy(staticBuffer).Execute().AssertStatus();
cerr << fooFunc.Name() << ": " << fooFunc.ErrorMessage() << endl;
BAR_FUNC barFunc;
barFunc.Copy(staticBuffer).Execute().AssertStatus();
cerr << barFunc.Name() << ": " << barFunc.ErrorMessage() << endl;
}
cerr << "Dynamic code generation" << endl;
void * dynamicBuffer;
dynamicBuffer = MemAlloc(PI_FUNC::MAX_SIZE, MEM_READ_WRITE_EXEC);
if (dynamicBuffer == 0) {Abort("MemAlloc failed");}
{
FOO_FUNC fooFunc;
fooFunc.Copy(dynamicBuffer);
if (!MemProtect(dynamicBuffer, PI_FUNC::MAX_SIZE, MEM_READ_EXEC)) {Abort("MemProtect failed");}
for (int i = 0; i < 3; ++i)
{
fooFunc.Execute().AssertStatus();
cerr << fooFunc.Name() << ": " << fooFunc.ErrorMessage() << endl;
}
}
if (!MemProtect(dynamicBuffer, PI_FUNC::MAX_SIZE, MEM_READ_WRITE_EXEC)) {Abort("MemProtect failed");}
{
BAR_FUNC barFunc;
barFunc.Copy(dynamicBuffer);
if (!MemProtect(dynamicBuffer, PI_FUNC::MAX_SIZE, MEM_READ_EXEC)) {Abort("MemProtect failed");}
for (int i = 0; i < 3; ++i)
{
barFunc.Execute().AssertStatus();
cerr << barFunc.Name() << ": " << barFunc.ErrorMessage() << endl;
}
}
return 0;
}
开发者ID:EmilyBragg,项目名称:profiling-tool,代码行数:57,代码来源:smcapp_ia32.cpp
示例16: GetPageAllocGranularitySize
// ////////////////////////////////////////////////////////////////////////////
unsigned int GetPageAllocGranularitySize()
{
#if _Windows
SYSTEM_INFO system_data;
::GetSystemInfo(&system_data);
return(static_cast<unsigned int>(system_data.dwAllocationGranularity));
#else
return(GetPageSize());
#endif /* #if _Windows */
}
开发者ID:neilgroves,项目名称:MlbDev,代码行数:13,代码来源:PageSize.cpp
示例17: GetPageSize
// static public
bool ProcessInformation::BlockInMemory (const void* start)
{
unsigned char x = 0;
if (mincore (const_cast<void*>(AlignToStartOfPage (start)),
GetPageSize (),
&x)) {
LOG (ERROR) << "mincore failed: " << strerror (errno);
return 1;
}
return x & 0x1;
}
开发者ID:ericgogh,项目名称:Swift,代码行数:13,代码来源:processinformation.cpp
示例18: MapFile
void MapFile()
{
int pagesize = GetPageSize();
int flag = GetMMapFlag();
int prot = GetMMapProt();
mapped_size_ = ((size_ + pagesize - 1) / pagesize) * pagesize;
ptr_ = mmap(0, mapped_size_, prot, flag, fd_, offset_);
if(ptr_ == MAP_FAILED){
close(fd_);
throw MMapException("mmap", path_);
}
}
开发者ID:shnya,项目名称:experiments,代码行数:13,代码来源:mmap.hpp
示例19: init_heap_space
static void
init_heap_space(size_t min_size, size_t max_size)
{
size_t pagesize, alloc_size, reserve_size, freesize_pre, freesize_post;
unsigned int min_num_segments, max_num_segments, bitmap_bits;
void *p;
pagesize = GetPageSize();
if (SEGMENT_SIZE % pagesize != 0)
sml_fatal(0, "SEGMENT_SIZE is not aligned in page size.");
alloc_size = ALIGNSIZE(min_size, SEGMENT_SIZE);
reserve_size = ALIGNSIZE(max_size, SEGMENT_SIZE);
if (alloc_size < SEGMENT_SIZE)
alloc_size = SEGMENT_SIZE;
if (reserve_size < alloc_size)
reserve_size = alloc_size;
min_num_segments = alloc_size / SEGMENT_SIZE;
max_num_segments = reserve_size / SEGMENT_SIZE;
p = ReservePage(HEAP_BEGIN_ADDR, SEGMENT_SIZE + reserve_size);
if (p == ReservePageError)
sml_fatal(0, "failed to alloc virtual memory.");
freesize_post = (uintptr_t)p & (SEGMENT_SIZE - 1);
if (freesize_post == 0) {
ReleasePage(p + reserve_size, SEGMENT_SIZE);
} else {
freesize_pre = SEGMENT_SIZE - freesize_post;
ReleasePage(p, freesize_pre);
p = (char*)p + freesize_pre;
ReleasePage(p + reserve_size, freesize_post);
}
heap_space.begin = p;
heap_space.end = (char*)p + reserve_size;
heap_space.min_num_segments = min_num_segments;
heap_space.max_num_segments = max_num_segments;
heap_space.num_committed = 0;
heap_space.extend_step = min_num_segments > 0 ? min_num_segments : 1;
bitmap_bits = ALIGNSIZE(max_num_segments, BITPTR_WORDBITS);
heap_space.bitmap = xmalloc(bitmap_bits / CHAR_BIT);
memset(heap_space.bitmap, 0, bitmap_bits / CHAR_BIT);
extend_heap(min_num_segments);
}
开发者ID:hsk,项目名称:docs,代码行数:51,代码来源:heap_bitmap.c
示例20: Unmap
bool MappedFile::Map( const char* fileName, int startPage, int nBytes )
{
if (m_hMapping != INVALID_HANDLE_VALUE)
{
Unmap();
}
m_hFile = CreateFile( fileName, GENERIC_READ, FILE_SHARE_READ, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
if (m_hFile == INVALID_HANDLE_VALUE)
{
rlog.err( "Could not open file for mapping: %s", fileName );
return false;
}
m_FileSize = ::GetFileSize( m_hFile, NULL );
// create mapping name
char mapName[_MAX_PATH];
strcpy( mapName, fileName );
char* pName = mapName;
while (*pName)
{
if (*pName == '\\' || *pName == '/') *pName = '_';
pName++;
}
m_hMapping = CreateFileMapping( m_hFile, NULL, PAGE_READONLY, 0, 0, mapName );
uint32_t err = GetLastError();
if (m_hMapping == NULL)
{
rlog.err( "Could not memory-map file: %s", fileName );
m_hMapping = INVALID_HANDLE_VALUE;
return false;
}
m_pBuffer = (uint8_t*)MapViewOfFile( m_hMapping, FILE_MAP_READ, 0, startPage*GetPageSize(), nBytes );
if (m_pBuffer == NULL)
{
uint32_t errCode = GetLastError();
rlog.err( "Could not memory-map view of file: %s. Error code: %X", fileName );
return false;
}
CloseHandle( m_hFile );
m_hFile = INVALID_HANDLE_VALUE;
m_MappedSize = nBytes;
m_FirstMappedPage = startPage;
return true;
} // MappedFile::Map
开发者ID:skopp,项目名称:rush,代码行数:51,代码来源:mappedfile.cpp
注:本文中的GetPageSize函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论