int isValid(double *datah, int hh_size) {
    
    //mexPrintf("check head 0\n");
    int head = GetHead(datah,hh_size);
    if (head <=0) {return 0;}
    
    if (!IsHead(datah[2 * hh_size + head], datah[hh_size + head])) {return 0;}
    if (MoreThanOneHead(datah,hh_size)) {return 0;}
    
    int spouse = GetValidSpouse(datah,hh_size);
    if (!IsValidCouple(datah,hh_size,spouse, head)) {return 0;}
    
    int oldestChild = GetOldestChild(datah,hh_size);
    if (!IsValidChild(datah,hh_size,oldestChild,head)) {return 0;}
    
    int oldestChildInLaw = GetOldestChildInLaw(datah,hh_size);
    if (!IsValidChildInLaw(datah,hh_size,oldestChildInLaw,head)) {return 0;}
    
    int youngestParent = GetYoungestParent(datah,hh_size);
    if (!IsValidParent(datah,hh_size,youngestParent,head)) {return 0;}
    
    int youngestParentInLaw = GetYoungestParentInLaw(datah,hh_size);
    if (!IsValidParentInLaw(datah,hh_size,youngestParentInLaw,head)) {return 0;}
    
    if (!IsValidSiblingOrSiblingInLaw(datah,hh_size,head)) {return 0;}
    
    if (!IsValidGrandChild(datah,hh_size,spouse,head)) {return 0;}
    
    return 1;
    
}
示例#2
0
bool
nsHttpRequestHead::IsSafeMethod() const
{
  // This code will need to be extended for new safe methods, otherwise
  // they'll default to "not safe".
    if (IsGet() || IsHead() || IsOptions() || IsTrace()) {
        return true;
    }

    if (mParsedMethod != kMethod_Custom) {
        return false;
    }

    return (!strcmp(mMethod.get(), "PROPFIND") ||
            !strcmp(mMethod.get(), "REPORT") ||
            !strcmp(mMethod.get(), "SEARCH"));
}