void* OSAllocator::reserveUncommitted(size_t bytes, Usage, bool writable, bool executable) { void* result = NULL; if (DosAllocMem(&result, bytes, OBJ_ANY | protection(writable, executable)) && DosAllocMem(&result, bytes, protection(writable, executable))) { CRASH(); } return result; }
void* OSAllocator::reserveUncommitted(size_t bytes, Usage, bool writable, bool executable) { void* result = NULL; if ( #if defined(MOZ_OS2_HIGH_MEMORY) DosAllocMem(&result, bytes, OBJ_ANY | protection(writable, executable)) && #endif DosAllocMem(&result, bytes, protection(writable, executable))) { CRASH(); } return result; }
CharString NounStructure::status() const { CharString info; info += "\n"; if ( damage() > 0 ) info += CharString().format("<color;0000ff>DAMAGE: %d%%</color>\n", (damage() * 100) / maxDamage() ); if ( workers() != 0 ) info += CharString().format( "Workers: %s\n", FormatNumber<char,int>( -workers() ).cstr() ); if ( power() != 0 ) info += CharString().format( "Power: %s\n", FormatNumber<char,int>( power() ).cstr() ); if ( technology() != 0 ) info += CharString().format( "Technology: %d\n", technology() ); if ( upkeep() != 0 ) info += CharString().format( "Upkeep: %d\n", upkeep() ); if ( active() ) { if ( food() != 0 ) info += CharString().format( "Food: %s\n", FormatNumber<char,int>( food() ).cstr() ); if ( habitat() != 0 ) info += CharString().format( "Habitat: %s\n", FormatNumber<char,int>( habitat() ).cstr() ); if ( mining() != 0 ) info += CharString().format( "Mining: %s\n", FormatNumber<char,int>( mining() ).cstr() ); if ( research() != 0 ) info += CharString().format( "Research: %s\n", FormatNumber<char,int>( research() ).cstr() ); if ( production() != 0 ) info += CharString().format( "Production: %s\n", FormatNumber<char,int>( production() ).cstr() ); if ( protection() != 0.0f ) info += CharString().format( "PD: %d%%\n", (int)(protection() * 100) ); } else if ( flags() & FLAG_ACTIVE ) { if ( flags() & FLAG_WORKER_SHORT ) info += "<color;0000ff>WORKER SHORTAGE!</color>\n"; if ( flags() & FLAG_POWER_SHORT ) info += "<color;0000ff>POWER SHORTAGE!</color>\n"; if ( flags() & FLAG_TECH_SHORT ) info += "<color;0000ff>TECHNOLOGY SHORTAGE!</color>\n"; } else { info += "\n<color;ffffff>INACTIVE</color>\n"; } if ( isBuilding() ) info += CharString().format("\nBuilding...%d%% complete\n", buildComplete() ); return info; }
void* OSAllocator::reserveAndCommit(size_t bytes, Usage, bool writable, bool executable, bool) { void* result = VirtualAlloc(0, bytes, MEM_RESERVE | MEM_COMMIT, protection(writable, executable)); if (!result) CRASH(); return result; }
void test_protection() { xlnt::workbook wb; auto ws = wb.active_sheet(); auto cell = ws.cell("A1"); xlnt_assert(!cell.has_format()); auto protection = xlnt::protection().locked(false).hidden(true); cell.protection(protection); xlnt_assert(cell.has_format()); xlnt_assert(cell.format().protection_applied()); xlnt_assert_equals(cell.protection(), protection); xlnt_assert(cell.has_format()); cell.clear_format(); xlnt_assert(!cell.has_format()); }
void OSAllocator::commit(void* address, size_t bytes, bool writable, bool executable) { void* result = VirtualAlloc(address, bytes, MEM_COMMIT, protection(writable, executable)); if (!result) CRASH(); }
void OSAllocator::commit(void* address, size_t bytes, bool writable, bool executable) { if (DosSetMem(address, bytes, PAG_COMMIT | protection(writable, executable))) CRASH(); }