Exemplo n.º 1
0
static bfelf64_sword
private_check_signature(struct bfelf_file_t *ef)
{
    if (ef->ehdr->e_ident[bfei_mag0] != 0x7F)
        return invalid_signature("magic #0 has unexpected value");

    if (ef->ehdr->e_ident[bfei_mag1] != 'E')
        return invalid_signature("magic #1 has unexpected value");

    if (ef->ehdr->e_ident[bfei_mag2] != 'L')
        return invalid_signature("magic #2 has unexpected value");

    if (ef->ehdr->e_ident[bfei_mag3] != 'F')
        return invalid_signature("magic #3 has unexpected value");

    return BFELF_SUCCESS;
}
Exemplo n.º 2
0
 boost::shared_ptr<R> resolve()
 {
     std::string typeName = typeid(R).name();
     boost::any resolver = m_resolvers.get(typeName);
     if (resolver.empty())
         throw unregistred_type(typeName);
     
     try
     {
         return boost::any_cast< boost::function<boost::shared_ptr<R>(void*)> >(resolver)(&m_instances); 
     }
     catch(boost::bad_any_cast&)
     {
         throw invalid_signature(typeName);
     }
 }