示例#1
0
	//! Expand "vector (opop)" to "vector (op)= 1", and then call for the expansion of this last expression
	Node* UnaryArithmeticAssignmentNode::expandAbstractNodes(std::wostream* dump)
	{
		assert(children.size() == 1);

		Node* memoryVector = children[0];

		// create a vector of 1's
		std::auto_ptr<TupleVectorNode> constant(new TupleVectorNode(sourcePos));
		for (unsigned int i = 0; i < memoryVector->getVectorSize(); i++)
			constant->addImmediateValue(1);

		// expand to "vector (op)= 1"
		std::auto_ptr<ArithmeticAssignmentNode> assignment(new ArithmeticAssignmentNode(sourcePos, arithmeticOp, memoryVector, constant.get()));
		constant.release();

		// perform the expansion of ArithmeticAssignmentNode
		std::auto_ptr<Node> finalBlock(assignment->expandAbstractNodes(dump));

		if (assignment.get() != finalBlock.get())
			// delete the orphaned node
			assignment.reset();
		else
			assignment.release();

		// let our children to stay with the new node
		// otherwise they will be freed when we are cleared
		children.clear();

		return finalBlock.release();
	}
示例#2
0
            CryptoBuffer CommonCryptoCipher::FinalizeDecryption()
            {
                if (m_failure)
                {
                    AWS_LOGSTREAM_FATAL(CC_LOG_TAG,
                                        "Cipher not properly initialized for decryption finalization. Aborting");
                    return CryptoBuffer();
                }

                CryptoBuffer finalBlock(GetBlockSizeBytes());
                size_t writtenSize = static_cast<int>(finalBlock.GetLength());
                CCStatus status = CCCryptorFinal(m_cryptoHandle, finalBlock.GetUnderlyingData(), finalBlock.GetLength(), &writtenSize);
                if (status != kCCSuccess)
                {
                    m_failure = true;
                    AWS_LOGSTREAM_ERROR(CC_LOG_TAG, "Decryption of buffer failed with status code: " << status);
                    return CryptoBuffer();
                }
                return CryptoBuffer(finalBlock.GetUnderlyingData(), writtenSize);
            }
示例#3
0
	Node* UnaryArithmeticAssignmentNode::expandToAsebaTree(std::wostream* dump, unsigned int index)
	{
		assert(children.size() == 1);

		Node* memoryVector = children[0];

		// create a vector of 1's
		std::auto_ptr<TupleVectorNode> constant(new TupleVectorNode(sourcePos));
		for (unsigned int i = 0; i < memoryVector->getVectorSize(); i++)
			constant->addImmediateValue(1);

		// expand to "vector (op)= 1"
		std::auto_ptr<ArithmeticAssignmentNode> assignment(new ArithmeticAssignmentNode(sourcePos, arithmeticOp, memoryVector->deepCopy(), constant.release()));
		std::auto_ptr<Node> finalBlock(assignment->expandToAsebaTree(dump, index));

		assignment.release();
		delete this;

		return finalBlock.release();
	}
示例#4
0
	Node* ArithmeticAssignmentNode::expandToAsebaTree(std::wostream* dump, unsigned int index)
	{
		assert(children.size() == 2);

		Node* leftVector = children[0];
		Node* rightVector = children[1];

		// expand to left = left + right
		std::auto_ptr<AssignmentNode> assignment(new AssignmentNode(sourcePos));
		std::auto_ptr<BinaryArithmeticNode> binary(new BinaryArithmeticNode(sourcePos, op, leftVector->deepCopy(), rightVector->deepCopy()));
		assignment->children.push_back(leftVector->deepCopy());
		assignment->children.push_back(binary.release());

		std::auto_ptr<Node> finalBlock(assignment->expandToAsebaTree(dump, index));

		assignment.release();
		delete this;

		return finalBlock.release();
	}