예제 #1
0
파일: signature.cpp 프로젝트: alyst/zorba
/*******************************************************************************
  "this" is the signature of the function object. "s" is the signature of the
  declaration appearing in the lib module.
********************************************************************************/
bool signature::subtype(
    const TypeManager* tm,
    const function* func,
    const signature& s,
    const QueryLoc& loc) const
{
  if (paramCount() != s.paramCount())
    return false;

  if (!theQName->equals(s.theQName.getp()))
    return false;

  if (theNonOptimizedReturnType.getp() != NULL &&
      s.theNonOptimizedReturnType.getp() != NULL &&
      !TypeOps::is_subtype(tm,
                           *theNonOptimizedReturnType.getp(),
                           *s.theNonOptimizedReturnType.getp(),
                           loc))
  {
    return false;
  }

  assert (s.theTypes.size() == theTypes.size() || theIsVariadic);

  for (csize i = 0; i < theTypes.size(); ++i)
  {
    xqtref_t builtinParamType = theTypes[i];

    if (func == BUILTIN_FUNC(FN_ZORBA_XML_PARSE_2))
    {
      if (i == 2)
      {
        store::Item_t typeName;
        GENV_ITEMFACTORY->createQName(typeName,
                                      static_context::ZORBA_XML_FN_OPTIONS_NS,
                                      "",
                                      "options"),

        builtinParamType = tm->
        create_node_type(store::StoreConsts::elementNode,
                         typeName,
                         NULL,
                         SequenceType::QUANT_QUESTION,
                         false,
                         false);
      }
    }

    if (!TypeOps::is_subtype(tm,
                             *builtinParamType,   // subtype
                             *s.theTypes[i].getp(), // supertype
                             loc))
    {
      return false;
    }
  }

  return true;
}
예제 #2
0
파일: signature.cpp 프로젝트: alyst/zorba
bool signature::equals(
    const TypeManager* tm,
    const signature& s,
    const QueryLoc& loc) const
{
  if (paramCount() != s.paramCount())
    return false;

  if (!theQName->equals(s.theQName.getp()))
    return false;

  if (theNonOptimizedReturnType.getp() != NULL
      &&
      s.theNonOptimizedReturnType.getp() != NULL
      &&
      !TypeOps::is_equal(tm,
                         *theNonOptimizedReturnType.getp(),
                         *s.theNonOptimizedReturnType.getp(),
                         loc))
  {
    return false;
  }

  assert (s.theTypes.size() == theTypes.size() || theIsVariadic );
  for (csize i = 0; i < s.theTypes.size(); ++i)
  {
    if (!TypeOps::is_equal(tm,
                           *theTypes[i].getp(),
                           *s.theTypes[i].getp(),
                           loc))
    {
      return false;
    }
  }

  return true;
}
예제 #3
0
파일: pke.cpp 프로젝트: FollowMyVote/fc
 bool public_key::verify( const sha256& digest, const signature& sig )const
 {
    static_assert( sig.size() == 2048/8, "Invalid signature size" );
    return 0 != RSA_verify( NID_sha256, (const uint8_t*)&digest, 32,
                            (uint8_t*)sig.data(), 2048/8, my->rsa );
 }
예제 #4
0
파일: pke.cpp 프로젝트: BestSilent/eos
 bool public_key::verify( const sha1& digest, const signature& sig )const
 {
    assert( sig.size() == 2048/8 );
    return 0 != RSA_verify( NID_sha1, (const uint8_t*)&digest, 20,
                            (uint8_t*)sig.data(), 2048/8, my->rsa );
 }