Example #1
0
 // TODO: The behavior of N/A in vector is not fixed yet (#107).
 Bool operator!=(const Vector &rhs) const {
   Bool has_not_equal_size = (size_ != rhs.size_);
   if (has_not_equal_size.is_false()) {
     return Bool(std::memcmp(data_, rhs.data_,
                             sizeof(Int) * raw_size()) != 0);
   }
   return has_not_equal_size;
 }
Example #2
0
 // TODO: The behavior of N/A in vector is not fixed yet (#107).
 Bool operator==(const Vector &rhs) const {
   Bool has_equal_size = (size_ == rhs.size_);
   if (has_equal_size.is_true()) {
     return Bool(std::memcmp(data_, rhs.data_,
                             sizeof(Int) * raw_size()) == 0);
   }
   return has_equal_size;
 }
Example #3
0
 bool unmatch(const Vector &rhs) const {
   if (size_.unmatch(rhs.size_)) {
     return true;
   }
   if (is_na()) {
     return false;
   }
   return std::memcmp(data_, rhs.data_, sizeof(Int) * raw_size()) != 0;
 }
Example #4
0
 Text operator[](Int i) const {
   if (is_na() || (static_cast<size_t>(i.raw()) >= raw_size())) {
     return Text::na();
   }
   if (is_direct_) {
     return data_[i.raw()];
   } else {
     return Text(&bodies_[headers_[i.raw()].offset],
                 headers_[i.raw()].size.raw());
   }
 }
Example #5
0
bool CheckPEHeaders::parseResponse(QPointer<RpcData> rd)
{
	if (!ICommand::parseResponse(rd))
		return false;

	try
	{
		rpc::CheckPEHeadersResult result;
		if (!hlp::protobuf::parseBigMessage(result, rd->response->rpc_result()))
		{
			msg("%s: rpc::CheckPEHeadersResult::ParseFromString() failed\n", __FUNCTION__);
			return false;
		}

		peValid = result.pe_valid();
		if (peValid)
		{
			const auto& exps = result.exps();
			for (auto it = exps.begin(), end = exps.end(); it != end; ++it)
			{
				ExportItem item = {
					it->ea(),
					it->ord(),
					it->name()
				};
				exports.append(item);
			}
			const auto& sects = result.sections();
			for (auto it = sects.begin(), end = sects.end(); it != end; ++it)
			{
				Section s = {
					it->name(),
					it->va(),
					it->v_size(),
					it->raw(),
					it->raw_size(),
					it->characteristics()
				};
				sections.append(s);
			}
		}
		return true;
	}
	catch (std::runtime_error e)
	{
		msg("%s: Runtime error: %s\n", __FUNCTION__, e.what());
	}
	catch (...)
	{
		msg("%s: Unable to parse CheckPEHeadersRequest response\n", __FUNCTION__);
	}
	return false;
}
Example #6
0
 // TODO: The behavior of N/A in vector is not fixed yet (#107).
 Bool operator!=(const Vector &rhs) const {
   Bool has_not_equal_size = (size_ != rhs.size_);
   if (has_not_equal_size.is_false()) {
     size_t size = raw_size();
     for (size_t i = 0; i < size; ++i) {
       if ((data_[i].raw() != rhs.data_[i].raw()) &&
           (!data_[i].is_na() || !rhs.data_[i].is_na())) {
         return Bool(true);
       }
     }
   }
   return has_not_equal_size;
 }
Example #7
0
 // TODO: The behavior of N/A in vector is not fixed yet (#107).
 Bool operator!=(const Vector &rhs) const {
   Bool has_not_equal_size = (size_ != rhs.size_);
   if (has_not_equal_size.is_false()) {
     size_t size = raw_size();
     for (size_t i = 0; i < size; ++i) {
       Text lhs_text = (*this)[grnxx::Int(i)];
       Text rhs_text = rhs[grnxx::Int(i)];
       // TODO: Binary not equal should be used.
       if (!(lhs_text.is_na() && rhs_text.is_na()) &&
           (!(lhs_text == rhs_text)).is_true()) {
         return Bool(true);
       }
     }
   }
   return has_not_equal_size;
 }
Example #8
0
 bool unmatch(const Vector &rhs) const {
   if (size_.unmatch(rhs.size_)) {
     return true;
   }
   if (is_na()) {
     return false;
   }
   // TODO: This is because raw values are not normalized.
   size_t size = raw_size();
   for (size_t i = 0; i < size; ++i) {
     if (data_[i].unmatch(rhs.data_[i])) {
       return true;
     }
   }
   return false;
 }
Example #9
0
 bool match(const Vector &rhs) const {
   if (size_.unmatch(rhs.size_)) {
     return false;
   }
   if (is_na()) {
     return true;
   }
   // TODO: This is because raw values are not normalized.
   size_t size = raw_size();
   for (size_t i = 0; i < size; ++i) {
     // TODO: This can be improved.
     if (operator[](grnxx::Int(i)).unmatch(rhs[grnxx::Int(i)])) {
       return false;
     }
   }
   return true;
 }
Example #10
0
 bool is_empty() const {
   return raw_size() == 0;
 }
Example #11
0
 Int operator[](Int i) const {
   if (is_na() || (static_cast<size_t>(i.raw()) >= raw_size())) {
     return Int::na();
   }
   return data_[i.raw()];
 }
Example #12
0
 bool size_initialized() const
 {
     return raw_size() != STX_SIZE_T_MAX;
 }
Example #13
0
 size_type raw_max_size() const
 {
     return raw_size();
 }
Example #14
0
 size_type raw_capacity() const
 {
     return raw_size() + 1;
 }
Example #15
0
 size_type raw_length() const
 {
     return raw_size();
 }