本文整理汇总了C++中FindEntry函数的典型用法代码示例。如果您正苦于以下问题:C++ FindEntry函数的具体用法?C++ FindEntry怎么用?C++ FindEntry使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FindEntry函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CPUGetPiece
static mad_status CPUGetPiece( unsigned piece,
const char **descript_p,
size_t *max_descript_p,
const mad_reg_info **reg,
mad_type_handle *disp_type,
size_t *max_value )
{
unsigned idx;
if( !FindEntry( CPUNumeric, piece, &idx, disp_type ) )
return( MS_FAIL );
*reg = &RegList[idx].info;
if( !(MADState->reg_state[CPU_REG_SET] & CT_EXTENDED) ) {
if( *disp_type == PPCT_H_DWORD ) {
*disp_type = PPCT_H_WORD;
*reg = &RegListHalf[idx - IDX_r0].info;
}
}
//NYI: if extended & ~ 64 bit mode, downshift to 32-bit display.
// Also, if 64 <=> 32 bit switch, tell client to redraw window
if( !(MADState->reg_state[CPU_REG_SET] & CT_HEX) ) {
switch( *disp_type ) {
case PPCT_H_DWORD:
*disp_type = PPCT_H_UINT64;
break;
case PPCT_H_WORD:
*disp_type = PPCT_H_ULONG;
break;
}
}
*descript_p = (*reg)->name;
*max_descript_p = 0;
*max_value = 0;
return( MS_OK );
}
示例2: strlen
RAMDISK_DIR_ENTRY * RAMDISK_PARTITION::FindPath(const char* path, const char **basename)
{
int pathLen = strlen(path);
char dirfilename[pathLen+1]; // to hold a full path
const char *cptr = path+pathLen; // find the end...
const char *filename = NULL; // to hold filename
while(cptr-->path) //search till start
{
if((*cptr=='/') || (*cptr==':')) // split at either / or : (whichever comes first form the end!)
{
cptr++;
strlcpy(dirfilename, path, 1+cptr-path); //copy string up till and including / or :
filename = cptr; //filename = now remainder of string
break;
}
}
if(!filename)
{
filename = path; //filename = complete path
dirfilename[0] = 0; //make directory path ""
}
RAMDISK_BASE_ENTRY *entry = FindEntry(dirfilename);
if(entry)
{
if(basename) *basename = filename;
return entry->IsDir();
}
return NULL;
}
示例3: AttachL
void DSession::AttachL(DThread& aClient)
{
if(FindEntry(aClient)) return;
if(!iServer) User::Leave(KErrServerTerminated);
DSessionShare** shares=iShares;
TInt top=iClients;
if(top==iAlloc)
{
if(top>(EMaxShares-EShareGranularity)) User::Leave(KErrNotSupported);
TInt newClients=top+EShareGranularity;
shares=(DSessionShare**)User::ReAllocL(shares,newClients*sizeof(DSessionShare*));
iShares=shares;
iAlloc=newClients;
}
TInt i=0;
while(i<top)
{
TUint index=(i+top)>>1;
DThread* item=shares[index]->iClient;
if(&aClient<item)
{
top=index;
continue;
}
i=index+1;
}
DSessionShare* share=DSessionShare::NewL(*this,aClient,*iServer);
Mem::Move(shares+i+1,shares+i,(iClients++-i)*sizeof(DSessionShare*));
shares[i]=share;
}
示例4: TEST_F
TEST_F(DlExtTest, ExtInfoUseFdWithOffset) {
const std::string lib_path = std::string(getenv("ANDROID_DATA")) + LIBZIPPATH;
android_dlextinfo extinfo;
extinfo.flags = ANDROID_DLEXT_USE_LIBRARY_FD | ANDROID_DLEXT_USE_LIBRARY_FD_OFFSET;
extinfo.library_fd = TEMP_FAILURE_RETRY(open(lib_path.c_str(), O_RDONLY | O_CLOEXEC));
// Find the offset of the shared library in the zip.
ZipArchiveHandle handle;
ASSERT_EQ(0, OpenArchive(lib_path.c_str(), &handle));
ZipEntry zip_entry;
ZipString zip_name;
zip_name.name = reinterpret_cast<const uint8_t*>(LIBZIP_SIMPLE_ZIP);
zip_name.name_length = sizeof(LIBZIP_SIMPLE_ZIP) - 1;
ASSERT_EQ(0, FindEntry(handle, zip_name, &zip_entry));
extinfo.library_fd_offset = zip_entry.offset;
CloseArchive(handle);
handle_ = android_dlopen_ext(lib_path.c_str(), RTLD_NOW, &extinfo);
ASSERT_DL_NOTNULL(handle_);
uint32_t* taxicab_number = reinterpret_cast<uint32_t*>(dlsym(handle_, "dlopen_testlib_taxicab_number"));
ASSERT_DL_NOTNULL(taxicab_number);
EXPECT_EQ(1729U, *taxicab_number);
}
示例5: SetFocus
void wxsToolSpace::OnMouseClick(wxMouseEvent& event)
{
SetFocus();
if ( m_Unstable ) return;
// Finding out which tool has been clicked
int PosX = event.GetX();
int PosY = event.GetY();
Entry* Tool = FindEntry(PosX,PosY);
if ( Tool )
{
if ( !Tool->m_Tool->GetIsSelected() )
{
m_Data->SelectItem(Tool->m_Tool,!event.ControlDown());
}
else
{
m_Data->SelectItem(Tool->m_Tool,false);
}
Tool->m_Tool->MouseClick(0,PosX,PosY);
}
}
示例6: FindEntry
otError Filter::Apply(const ExtAddress &aExtAddress, int8_t &aRss)
{
otError error = OT_ERROR_NONE;
otMacFilterEntry *entry = FindEntry(aExtAddress);
// assign the default RssIn setting for all receiving messages first.
aRss = mRssIn;
// check AddressFilter.
if (mAddressMode == OT_MAC_FILTER_ADDRESS_MODE_WHITELIST)
{
VerifyOrExit(entry != NULL && entry->mFiltered, error = OT_ERROR_ADDRESS_FILTERED);
}
else if (mAddressMode == OT_MAC_FILTER_ADDRESS_MODE_BLACKLIST)
{
VerifyOrExit(entry == NULL || !entry->mFiltered, error = OT_ERROR_ADDRESS_FILTERED);
}
// not override the default RssIn setting if no specific RssIn on the Extended Address.
if (entry != NULL && entry->mRssIn != OT_MAC_FILTER_FIXED_RSS_DISABLED)
{
aRss = entry->mRssIn;
}
exit:
return error;
}
示例7: ExitNow
otError Filter::AddRssIn(const ExtAddress *aExtAddress, int8_t aRss)
{
otError error = OT_ERROR_NONE;
// set the default RssIn for all received messages.
if (aExtAddress == NULL)
{
mRssIn = aRss;
ExitNow();
}
else
{
Entry *entry = FindEntry(*aExtAddress);
if (entry == NULL)
{
VerifyOrExit((entry = FindAvailEntry()) != NULL, error = OT_ERROR_NO_BUFS);
entry->mExtAddress = static_cast<const otExtAddress &>(*aExtAddress);
}
entry->mRssIn = aRss;
}
exit:
return error;
}
示例8: unzip_file
static void* unzip_file(ZipArchiveHandle zip, const char* entry_name, unsigned* sz)
{
ZipEntryName zip_entry_name(entry_name);
ZipEntry zip_entry;
if (FindEntry(zip, zip_entry_name, &zip_entry) != 0) {
fprintf(stderr, "archive does not contain '%s'\n", entry_name);
return 0;
}
*sz = zip_entry.uncompressed_length;
uint8_t* data = reinterpret_cast<uint8_t*>(malloc(zip_entry.uncompressed_length));
if (data == NULL) {
fprintf(stderr, "failed to allocate %u bytes for '%s'\n", *sz, entry_name);
return 0;
}
int error = ExtractToMemory(zip, &zip_entry, data, zip_entry.uncompressed_length);
if (error != 0) {
fprintf(stderr, "failed to extract '%s': %s\n", entry_name, ErrorCodeString(error));
free(data);
return 0;
}
return data;
}
示例9: FPUGetPiece
static mad_status FPUGetPiece( unsigned piece,
const char **descript_p,
size_t *max_descript_p,
const mad_reg_info **reg,
mad_type_handle *disp_type,
size_t *max_value )
{
unsigned idx;
if( !FindEntry( FPUList, piece, &idx, disp_type ) ) return( MS_FAIL );
if( MADState->reg_state[FPU_REG_SET] & FT_HEX ) {
switch( *disp_type ) {
case AXPT_DOUBLE:
*disp_type = AXPT_HDOUBLE;
break;
}
}
if( MADState->reg_state[FPU_REG_SET] & FT_G_FLOAT ) {
switch( *disp_type ) {
case AXPT_DOUBLE:
*disp_type = AXPT_RG_FLOAT;
break;
}
}
*reg = &RegList[idx].info;
*descript_p = (*reg)->name;
*max_descript_p = 0;
*max_value = 0;
return( MS_OK );
}
示例10: unzip_to_file
static int unzip_to_file(ZipArchiveHandle zip, char* entry_name) {
FILE* fp = tmpfile();
if (fp == NULL) {
fprintf(stderr, "failed to create temporary file for '%s': %s\n",
entry_name, strerror(errno));
return -1;
}
ZipEntryName zip_entry_name(entry_name);
ZipEntry zip_entry;
if (FindEntry(zip, zip_entry_name, &zip_entry) != 0) {
fprintf(stderr, "archive does not contain '%s'\n", entry_name);
return -1;
}
int fd = fileno(fp);
int error = ExtractEntryToFile(zip, &zip_entry, fd);
if (error != 0) {
fprintf(stderr, "failed to extract '%s': %s\n", entry_name, ErrorCodeString(error));
return -1;
}
lseek(fd, 0, SEEK_SET);
return fd;
}
示例11: _
bool wxExVCS::GetDir(wxWindow* parent)
{
if (!Use())
{
return false;
}
const wxString message = _("Select VCS Folder");
std::vector<wxExConfigItem> v;
// See also vcsentry, same item is used there.
v.push_back(wxExConfigItem(
_("Base folder"),
CONFIG_COMBOBOXDIR,
wxEmptyString,
true,
1005));
if (wxExConfigFirstOf(_("Base folder")).empty())
{
if (
parent != NULL &&
wxExConfigDialog(parent, v, message).ShowModal() == wxID_CANCEL)
{
return false;
}
}
else
{
m_Entry = FindEntry(wxExConfigFirstOf(_("Base folder")));
if (m_Entry.GetName().empty())
{
if (
parent != NULL &&
wxExConfigDialog(parent, v, message).ShowModal() == wxID_CANCEL)
{
return false;
}
}
}
m_Entry = FindEntry(wxExConfigFirstOf(_("Base folder")));
return !m_Entry.GetName().empty();
}
示例12: aout_info
// Печать заголовков файла, заданного именем
void aout_info(char *Name)
{
char name83[11];
Exec exec;
Make83Name(Name, name83);
DirEntry Entry;
if (FindEntry(0, name83, &Entry) == (uint)-1)
{
printf("Cannot open file '%s'!\n", Name);
return;
}
LoadPart(&Entry, &exec, 0, sizeof(Exec));
printf("midmag\t= 0x%x\n", exec.a_midmag);
printf("text\t= %d\n", exec.a_text);
printf("data\t= %d\n", exec.a_data);
printf("bss\t= %d\n", exec.a_bss);
printf("syms\t= %d\n", exec.a_syms);
printf("entry\t= 0x%x\n", exec.a_entry);
printf("trsize\t= %d\n", exec.a_trsize);
printf("drsize\t= %d\n", exec.a_drsize);
printf("\nflags\t= 0x%x\n", N_FLAG(exec));
printf("machine\t= ");
switch (N_MID(exec))
{
case M_OLDSUN2: printf("OldSun2"); break;
case M_68010: printf("m68010"); break;
case M_68020: printf("m68020"); break;
case M_SPARC: printf("sparc"); break;
case M_386: printf("386"); break;
case M_MIPS1: printf("mips1"); break;
case M_MIPS2: printf("mips2"); break;
default: printf("unknown?"); return;
}
printf("\n");
if (N_MID(exec) != M_386)
{
printf("Only 386's binaries are supported\n");
return;
}
printf("magic\t= ");
switch (N_MAGIC(exec))
{
case OMAGIC: printf("omagic"); break;
case NMAGIC: printf("nmagic"); break;
case ZMAGIC: printf("zmagic"); break;
case QMAGIC: printf("qmagic"); break;
case CMAGIC: printf("cmagic"); break;
default: printf("bad magic"); return;
}
// Relocation_Info rels[100];
// FIXME: добавить вывод relocation records
}
示例13: MakeDir
int DeviceDir::MakeDir(const char name[], size_t length)
{
if (FindEntry(name, length))
return E_ENTRY_EXISTS;
fEntryList.AddToTail(new DeviceDir(GetFileSystem(), name, length, this));
return E_NO_ERROR;
}
示例14: FindEntry
int IniFile::GetEntryCompatibleValueI(LPCTSTR lpcszKey, LPCTSTR lpcszEntry1, LPCTSTR lpcszEntry2, int nDefault)
{
size_t nEntry = FindEntry(lpcszKey, lpcszEntry1);
if (nEntry != InvalidIndex)
return GetValueI(lpcszKey, lpcszEntry1, nDefault);
return GetValueI(lpcszKey, lpcszEntry2, nDefault);
}
示例15:
bool C4GroupSet::LoadEntryString(const char *szEntryName, StdStrBuf * rBuf)
{
// Load the entry from the first group that has it
C4Group *pGroup;
if ((pGroup = FindEntry(szEntryName)))
return pGroup->LoadEntryString(szEntryName, rBuf);
// Didn't find it
return false;
}