void CreatureMotionSys::UpdateHangAround(const HangAroundObjTarget& target, TimeStep dt) { HangAroundObjSeekingVRes hangAroundResult; HangAroundObjSeekingV seeker(target.minRadius, target.maxRadius); seeker.Seek(m_Creature, target, hangAroundResult); SeekTargetVel(hangAroundResult.velocity, dt); }
void CastleGame::gotoF(char *line) { char buff[2]; buff[0] = line[4]; buff[1] = line[5]; seeker(buff); }
void Loop::finalize() { if (!out.is()) { type = body->type; return; } TypeSeeker seeker(this, this->out); type = mergeTypes(seeker.types); }
int encryptFinal(void) { CCCryptorStatus status; int rv; /* finish zlib */ do { strm.next_out = compressed; strm.avail_out = sizeof(compressed); rv = deflate(&strm, Z_FINISH); if (rv != Z_OK && rv != Z_STREAM_END && rv != Z_BUF_ERROR) { printf("zlib error %d\n", rv); } status = CCCryptorUpdate(cryptorRef, compressed, sizeof(compressed) - strm.avail_out, bufOut, sizeof(bufOut), &bufOutLen); if (status != kCCSuccess) { printf("cryptor update error\n"); return(-1); } if (bufOutLen) { CCHmacUpdate(&hmacContext, bufOut, bufOutLen); writer(bufOut, bufOutLen); } } while (strm.avail_out == 0); deflateEnd(&strm); status = CCCryptorFinal(cryptorRef, bufOut, sizeof(bufOut), &bufOutLen); if (status != kCCSuccess) { printf("cryptor update error: %d\n", status); } if (bufOutLen) { CCHmacUpdate(&hmacContext, bufOut, bufOutLen); writer(bufOut, bufOutLen); } status = CCCryptorRelease(cryptorRef); if (status != kCCSuccess) { printf("cryptor release error\n"); } CCHmacFinal(&hmacContext, &header.hmacDigest); CCHmacFinal(&hmacContextPlain, &header.hmacDigestPlain); seeker(0); writer(&header, sizeof(header)); return(0); }
CriticalLevel CriticalLevelDetector::detectSerial() { CriticalLevel level; CellsLineSeeker seeker(mProjectSpace.getSpaceSize(), mProjectSpace.getCellSize()); std::vector<Cell> pointsArray = mProjectSpace.getPointsArray(); FlightsPointsMap cpoints = mProjectSpace.getFlightsPoints(); compareCells(cpoints, pointsArray, seeker, level); return level; }
base_window* base_window::nextSibling() { if (!m_parent) return this; children_list& list = m_parent->getChildren(); if(list.size() <= 1) return this; child_iter it = std::find_if(list.begin(), list.end(), seeker(this)); if(it == list.end()) { assert(false && "Link to parent is invalid!"); } return (++it != list.end()) ? (*it).get() : (*list.begin()).get(); }
void Block::finalize() { if (!name.is()) { // nothing branches here, so this is easy if (list.size() > 0) { type = list.back()->type; } else { type = unreachable; } return; } TypeSeeker seeker(this, this->name); type = mergeTypes(seeker.types); }
void CastleGame::makeChoice(int choice) { char buffer[2]; switch (choice){ case '1': buffer[0] = gotowhere[1]; buffer[1] = gotowhere[2]; seeker(buffer); playingstatus=RUNNING; break; case '2': fseek(fptr, 0, SEEK_CUR); fgets(gotowhere, GOT_LEN, fptr); buffer[0] = gotowhere[1]; buffer[1] = gotowhere[2]; fseek(fptr, -NEWLINE, SEEK_CUR); seeker(buffer); playingstatus=RUNNING; break; default: ;//linetoprinton=0; //printMsg("Error 502: Occured Ending Program"); } }
void base_window::bringToBack(base_window* child) { if(m_children.size() <= 1) return; child_iter it = std::find_if(m_children.begin(), m_children.end(), seeker(child)); if(it != m_children.end()) { if(child->getAlwaysOnTop()) { child_iter topmost = std::find_if(m_children.begin(), m_children.end(), ntopmost_()); m_children.splice(topmost, m_children, it); } else { m_children.splice(m_children.begin(), m_children, it); } } }
int encryptInit(int (*writerFunc)(void *, size_t), int (*seekerFunc)(size_t)) { CCCryptorStatus status; int rv; writer = writerFunc; seeker = seekerFunc; strm.zalloc = Z_NULL; strm.zfree = Z_NULL; strm.opaque = Z_NULL; rv = deflateInit(&strm, Z_DEFAULT_COMPRESSION); if (rv != Z_OK) { printf("zlib init error\n"); return(-1); } getPassword(); if (isZero(encKey, kCCKeySizeAES256) || isZero(hmacKey, kCCKeySizeAES256)) { header.keySaltLen = redsideSalts.keySaltLen; memcpy(header.keySalt, redsideSalts.keySalt, header.keySaltLen); /* AES KEY DERIVATION */ rv = CCKeyDerivationPBKDF(kCCPBKDF2, password, strlen(password), header.keySalt, header.keySaltLen, kCCPRFHmacAlgSHA512, kIterations, encKey, kCCKeySizeAES256); if (rv < 0) { printf("Key derivation: error: %d\n", rv); exit(1); } header.hmacSaltLen = redsideSalts.hmacSaltLen; memcpy(header.hmacSalt, redsideSalts.hmacSalt, header.hmacSaltLen); /* HMAC KEY DERIVATION */ rv = CCKeyDerivationPBKDF(kCCPBKDF2, password, strlen(password), header.hmacSalt, header.hmacSaltLen, kCCPRFHmacAlgSHA512, kIterations, hmacKey, kCCKeySizeAES256); if (rv < 0) { printf("HMAC Key derivation: error: %d\n", rv); exit(1); } } if (isZero(header.iv, sizeof(header.iv))) getSalt(header.iv, sizeof(header.iv)); CCHmacInit(&hmacContext, kCCHmacAlgSHA512, hmacKey, kCCKeySizeAES256); CCHmacInit(&hmacContextPlain, kCCHmacAlgSHA512, hmacKey, kCCKeySizeAES256); status = CCCryptorCreate(kCCEncrypt, kCCAlgorithmAES128, kCCOptionPKCS7Padding, encKey, kCCKeySizeAES256, header.iv, &cryptorRef); if (status != kCCSuccess) { printf("cryptor init error\n"); return(-1); } seeker(sizeof(header)); return(0); }