Beispiel #1
0
int Sess::ByteSize() const {
  int total_size = 0;

  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
    // optional string id = 1;
    if (has_id()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->id());
    }

    // optional int32 type = 2;
    if (has_type()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->type());
    }

    // optional int64 lasttime = 3;
    if (has_lasttime()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int64Size(
          this->lasttime());
    }

    // optional string sessid = 4;
    if (has_sessid()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->sessid());
    }

    // optional int32 consvid = 5;
    if (has_consvid()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->consvid());
    }

    // optional string version = 6;
    if (has_version()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->version());
    }

  }
  // repeated .gim.Pair kvs = 7;
  total_size += 1 * this->kvs_size();
  for (int i = 0; i < this->kvs_size(); i++) {
    total_size +=
      ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
        this->kvs(i));
  }

  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  _cached_size_ = total_size;
  GOOGLE_SAFE_CONCURRENT_WRITES_END();
  return total_size;
}
Beispiel #2
0
void Person::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:tutorial.Person)
  // required string name = 1;
  if (has_name()) {
    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
      1, this->name(), output);
  }

  // required int32 id = 2;
  if (has_id()) {
    ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->id(), output);
  }

  // optional string email = 3;
  if (has_email()) {
    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
      3, this->email(), output);
  }

  // repeated .tutorial.Person.PhoneNumber phone = 4;
  for (int i = 0; i < this->phone_size(); i++) {
    ::google::protobuf::internal::WireFormatLite::WriteMessage(
      4, this->phone(i), output);
  }

  output->WriteRaw(unknown_fields().data(),
                   unknown_fields().size());
  // @@protoc_insertion_point(serialize_end:tutorial.Person)
}
Beispiel #3
0
std::size_t number_format::id() const
{
    if (!has_id())
    {
        throw invalid_attribute();
    }

    return id_.get();
}
Beispiel #4
0
std::pair<section*, int> find_parent(section& sec, const std::string& id)
{
	section_list::iterator sit =
		std::find_if(sec.sections.begin(), sec.sections.end(), has_id(id));
	if (sit != sec.sections.end()) {
		return std::make_pair(&sec, std::distance(sec.sections.begin(), sit));
	}
	topic_list::iterator tit =
		std::find_if(sec.topics.begin(), sec.topics.end(), has_id(id));
	if (tit != sec.topics.end()) {
		return std::make_pair(&sec, std::distance(sec.topics.begin(), tit));
	}
	std::pair<section*, int> ret(reinterpret_cast<section*>(NULL), -1);
	for (sit = sec.sections.begin(); sit != sec.sections.end(); ++sit) {
		ret = find_parent(*(*sit), id);
		if (ret.first != NULL) {
			return ret;
		}
	}
	return ret;
}
Beispiel #5
0
int BuyGold::ByteSize() const {
  int total_size = 0;

  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
    // optional uint32 id = 1;
    if (has_id()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::UInt32Size(
          this->id());
    }

    // optional string name = 2;
    if (has_name()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->name());
    }

    // optional string describ = 3;
    if (has_describ()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->describ());
    }

    // optional uint32 gold_Number = 4;
    if (has_gold_number()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::UInt32Size(
          this->gold_number());
    }

    // optional int32 money = 5;
    if (has_money()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->money());
    }

    // optional string localName = 6;
    if (has_localname()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->localname());
    }

  }
  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  _cached_size_ = total_size;
  GOOGLE_SAFE_CONCURRENT_WRITES_END();
  return total_size;
}
Beispiel #6
0
format format::number_format(const xlnt::number_format &new_number_format, bool applied)
{
    auto copy = new_number_format;

    if (!copy.has_id())
    {
        copy.id(d_->parent->next_custom_number_format_id());
        d_->parent->number_formats.push_back(copy);
    }

    d_ = d_->parent->find_or_create_with(d_, copy, applied);
    return format(d_);
}
Beispiel #7
0
section* find_section(section &sec, const std::string &id)
{
	section_list::iterator sit =
		std::find_if(sec.sections.begin(), sec.sections.end(), has_id(id));
	if (sit != sec.sections.end()) {
		return *sit;
	}
	for (sit = sec.sections.begin(); sit != sec.sections.end(); ++sit) {
		section *s = find_section(*(*sit), id);
		if (s != NULL) {
			return s;
		}
	}
	return NULL;
}
Beispiel #8
0
topic* find_topic(section &sec, const std::string &id)
{
	topic_list::iterator tit =
		std::find_if(sec.topics.begin(), sec.topics.end(), has_id(id));
	if (tit != sec.topics.end()) {
		return &(*tit);
	}
	section_list::iterator sit;
	for (sit = sec.sections.begin(); sit != sec.sections.end(); ++sit) {
		topic *t = find_topic(*(*sit), id);
		if (t != NULL) {
			return t;
		}
	}
	return NULL;
}
Beispiel #9
0
void Message::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // optional string to = 1;
  if (has_to()) {
    ::google::protobuf::internal::WireFormatLite::WriteString(
      1, this->to(), output);
  }

  // optional int64 id = 2;
  if (has_id()) {
    ::google::protobuf::internal::WireFormatLite::WriteInt64(2, this->id(), output);
  }

  // optional int64 time = 3;
  if (has_time()) {
    ::google::protobuf::internal::WireFormatLite::WriteInt64(3, this->time(), output);
  }

  // optional string from = 4;
  if (has_from()) {
    ::google::protobuf::internal::WireFormatLite::WriteString(
      4, this->from(), output);
  }

  // optional int32 type = 5;
  if (has_type()) {
    ::google::protobuf::internal::WireFormatLite::WriteInt32(5, this->type(), output);
  }

  // optional string sn = 6;
  if (has_sn()) {
    ::google::protobuf::internal::WireFormatLite::WriteString(
      6, this->sn(), output);
  }

  // optional bytes data = 7;
  if (has_data()) {
    ::google::protobuf::internal::WireFormatLite::WriteBytes(
      7, this->data(), output);
  }

  // optional int64 expire = 8;
  if (has_expire()) {
    ::google::protobuf::internal::WireFormatLite::WriteInt64(8, this->expire(), output);
  }

}
Beispiel #10
0
void section::move(const section& s, bool up)
{
	section_list::iterator it = std::find_if(sections.begin(), sections.end(), has_id(s.id));
	int n = std::distance(sections.begin(), it);
	section_list::iterator it2;
	if (up) {
		section* s = *it;
		sections.erase(it);
		it = sections.begin();
		std::advance(it, n - 1);
		sections.insert(it, s);
	} else {
		section_list::iterator it2 = sections.begin();
		std::advance(it2, n + 1);
		section* s = *it2;
		sections.erase(it2);
		sections.insert(it, s);
	}
}
Beispiel #11
0
void section::move(const topic& t, bool up)
{
	topic_list::iterator it = std::find_if(topics.begin(), topics.end(), has_id(t.id));
	int n = std::distance(topics.begin(), it);
	topic_list::iterator it2;
	if (up) {
		topic t = *it;
		topics.erase(it);
		it = topics.begin();
		std::advance(it, n - 1);
		topics.insert(it, t);
	} else {
		topic_list::iterator it2 = topics.begin();
		std::advance(it2, n + 1);
		topic t = *it2;
		topics.erase(it2);
		topics.insert(it, t);
	}
}
Beispiel #12
0
void Sess::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // optional string id = 1;
  if (has_id()) {
    ::google::protobuf::internal::WireFormatLite::WriteString(
      1, this->id(), output);
  }

  // optional int32 type = 2;
  if (has_type()) {
    ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->type(), output);
  }

  // optional int64 lasttime = 3;
  if (has_lasttime()) {
    ::google::protobuf::internal::WireFormatLite::WriteInt64(3, this->lasttime(), output);
  }

  // optional string sessid = 4;
  if (has_sessid()) {
    ::google::protobuf::internal::WireFormatLite::WriteString(
      4, this->sessid(), output);
  }

  // optional int32 consvid = 5;
  if (has_consvid()) {
    ::google::protobuf::internal::WireFormatLite::WriteInt32(5, this->consvid(), output);
  }

  // optional string version = 6;
  if (has_version()) {
    ::google::protobuf::internal::WireFormatLite::WriteString(
      6, this->version(), output);
  }

  // repeated .gim.Pair kvs = 7;
  for (int i = 0; i < this->kvs_size(); i++) {
    ::google::protobuf::internal::WireFormatLite::WriteMessage(
      7, this->kvs(i), output);
  }

}
Beispiel #13
0
style style::number_format(const xlnt::number_format &new_number_format, bool applied)
{
    auto copy = new_number_format;

    if (!copy.has_id())
    {
        copy.id(d_->parent->next_custom_number_format_id());
        d_->parent->number_formats.push_back(copy);
    }
	else if (find_number_format(d_->parent->number_formats, copy.id()) 
		== d_->parent->number_formats.end())
	{
        d_->parent->number_formats.push_back(copy);
    }

    d_->number_format_id = copy.id();
    d_->number_format_applied = applied;

	return *this;
}
Beispiel #14
0
int Person::ByteSize() const {
  int total_size = 0;

  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
    // required string name = 1;
    if (has_name()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->name());
    }

    // required int32 id = 2;
    if (has_id()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->id());
    }

    // optional string email = 3;
    if (has_email()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->email());
    }

  }
  // repeated .tutorial.Person.PhoneNumber phone = 4;
  total_size += 1 * this->phone_size();
  for (int i = 0; i < this->phone_size(); i++) {
    total_size +=
      ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
        this->phone(i));
  }

  total_size += unknown_fields().size();

  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  _cached_size_ = total_size;
  GOOGLE_SAFE_CONCURRENT_WRITES_END();
  return total_size;
}
Beispiel #15
0
void Sess::Clear() {
  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
    if (has_id()) {
      if (id_ != &::google::protobuf::internal::kEmptyString) {
        id_->clear();
      }
    }
    type_ = 0;
    lasttime_ = GOOGLE_LONGLONG(0);
    if (has_sessid()) {
      if (sessid_ != &::google::protobuf::internal::kEmptyString) {
        sessid_->clear();
      }
    }
    consvid_ = 0;
    if (has_version()) {
      if (version_ != &::google::protobuf::internal::kEmptyString) {
        version_->clear();
      }
    }
  }
  kvs_.Clear();
  ::memset(_has_bits_, 0, sizeof(_has_bits_));
}
Beispiel #16
0
void BuyGold::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // optional uint32 id = 1;
  if (has_id()) {
    ::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->id(), output);
  }

  // optional string name = 2;
  if (has_name()) {
    ::google::protobuf::internal::WireFormatLite::WriteString(
      2, this->name(), output);
  }

  // optional string describ = 3;
  if (has_describ()) {
    ::google::protobuf::internal::WireFormatLite::WriteString(
      3, this->describ(), output);
  }

  // optional uint32 gold_Number = 4;
  if (has_gold_number()) {
    ::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->gold_number(), output);
  }

  // optional int32 money = 5;
  if (has_money()) {
    ::google::protobuf::internal::WireFormatLite::WriteInt32(5, this->money(), output);
  }

  // optional string localName = 6;
  if (has_localname()) {
    ::google::protobuf::internal::WireFormatLite::WriteString(
      6, this->localname(), output);
  }

}
Beispiel #17
0
bool
HeapSnapshot::saveStackFrame(const protobuf::StackFrame& frame,
                             StackFrameId& outFrameId)
{
  if (frame.has_ref()) {
    // We should only get a reference to the previous frame if we have already
    // seen the previous frame.
    if (!frames.has(frame.ref()))
      return false;

    outFrameId = frame.ref();
    return true;
  }

  // Incomplete message.
  if (!frame.has_data())
    return false;

  auto data = frame.data();

  if (!data.has_id())
    return false;
  StackFrameId id = data.id();

  // This should be the first and only time we see this frame.
  if (frames.has(id))
    return false;

  Maybe<StackFrameId> parent;
  if (data.has_parent()) {
    StackFrameId parentId = 0;
    if (!saveStackFrame(data.parent(), parentId))
      return false;
    parent = Some(parentId);
  }

  if (!data.has_line())
    return false;
  uint32_t line = data.line();

  if (!data.has_column())
    return false;
  uint32_t column = data.column();

  auto duplicatedSource = reinterpret_cast<const char16_t*>(
    data.source().data());
  size_t sourceLength = data.source().length() / sizeof(char16_t);
  const char16_t* source = borrowUniqueString(duplicatedSource, sourceLength);
  if (!source)
    return false;

  const char16_t* functionDisplayName = nullptr;
  if (data.has_functiondisplayname() && data.functiondisplayname().length() > 0) {
    auto duplicatedName = reinterpret_cast<const char16_t*>(
      data.functiondisplayname().data());
    size_t nameLength = data.functiondisplayname().length() / sizeof(char16_t);
    functionDisplayName = borrowUniqueString(duplicatedName, nameLength);
    if (!functionDisplayName)
      return false;
  }
  MOZ_ASSERT(!!functionDisplayName == (data.has_functiondisplayname() &&
                                       data.functiondisplayname().length() > 0));

  if (!data.has_issystem())
    return false;
  bool isSystem = data.issystem();

  if (!data.has_isselfhosted())
    return false;
  bool isSelfHosted = data.isselfhosted();

  if (!frames.putNew(id, DeserializedStackFrame(id, parent, line, column,
                                                source, functionDisplayName,
                                                isSystem, isSelfHosted, *this)))
  {
    return false;
  }

  outFrameId = id;
  return true;
}
Beispiel #18
0
static int
ms_signon(struct Client *client_p, struct Client *source_p,
          int parc, const char *parv[])
{
    struct Client *target_p;
    int newts, sameuser;
    char login[NICKLEN+1];

    if(!clean_nick(parv[1])) {
        ServerStats.is_kill++;
        sendto_realops_snomask(SNO_DEBUG, L_ALL,
                               "Bad Nick from SIGNON: %s From: %s(via %s)",
                               parv[1], source_p->servptr->name, client_p->name);
        /* if source_p has an id, kill_client_serv_butone() will
         * send a kill to client_p, otherwise do it here */
        if (!has_id(source_p))
            sendto_one(client_p, ":%s KILL %s :%s (Bad nickname from SIGNON)",
                       get_id(&me, client_p), parv[1], me.name);
        kill_client_serv_butone(client_p, source_p, "%s (Bad nickname from SIGNON)",
                                me.name);
        source_p->flags |= FLAGS_KILLED;
        exit_client(NULL, source_p, &me, "Bad nickname from SIGNON");
        return 0;
    }

    if(!clean_username(parv[2]) || !clean_host(parv[3])) {
        ServerStats.is_kill++;
        sendto_realops_snomask(SNO_DEBUG, L_ALL,
                               "Bad user@host from SIGNON: %s@%s From: %s(via %s)",
                               parv[2], parv[3], source_p->servptr->name, client_p->name);
        /* if source_p has an id, kill_client_serv_butone() will
         * send a kill to client_p, otherwise do it here */
        if (!has_id(source_p))
            sendto_one(client_p, ":%s KILL %s :%s (Bad user@host from SIGNON)",
                       get_id(&me, client_p), parv[1], me.name);
        kill_client_serv_butone(client_p, source_p, "%s (Bad user@host from SIGNON)",
                                me.name);
        source_p->flags |= FLAGS_KILLED;
        exit_client(NULL, source_p, &me, "Bad user@host from SIGNON");
        return 0;
    }

    newts = atol(parv[4]);

    if(!strcmp(parv[5], "0"))
        login[0] = '\0';
    else if(*parv[5] != '*') {
        if (clean_nick(parv[5]))
            rb_strlcpy(login, parv[5], NICKLEN + 1);
        else
            return 0;
    }

    target_p = find_named_client(parv[1]);
    if(target_p != NULL && target_p != source_p) {
        /* In case of collision, follow NICK rules. */
        /* XXX this is duplicated code and does not do SAVE */
        if(IsUnknown(target_p))
            exit_client(NULL, target_p, &me, "Overridden");
        else {
            if(!newts || !target_p->tsinfo || (newts == target_p->tsinfo) || !source_p->user) {
                sendto_realops_snomask(SNO_GENERAL, L_ALL,
                                       "Nick change collision from SIGNON from %s to %s(%s <- %s)(both killed)",
                                       source_p->name, target_p->name, target_p->from->name,
                                       client_p->name);

                ServerStats.is_kill++;
                sendto_one_numeric(target_p, ERR_NICKCOLLISION,
                                   form_str(ERR_NICKCOLLISION), target_p->name);

                kill_client_serv_butone(NULL, source_p, "%s (Nick change collision)", me.name);

                ServerStats.is_kill++;

                kill_client_serv_butone(NULL, target_p, "%s (Nick change collision)", me.name);

                target_p->flags |= FLAGS_KILLED;
                exit_client(NULL, target_p, &me, "Nick collision(new)");
                source_p->flags |= FLAGS_KILLED;
                exit_client(client_p, source_p, &me, "Nick collision(old)");
                return 0;
            } else {
                sameuser = !irccmp(target_p->username, source_p->username) &&
                           !irccmp(target_p->host, source_p->host);

                if((sameuser && newts < target_p->tsinfo) ||
                   (!sameuser && newts > target_p->tsinfo)) {
                    if(sameuser)
                        sendto_realops_snomask(SNO_GENERAL, L_ALL,
                                               "Nick change collision from SIGNON from %s to %s(%s <- %s)(older killed)",
                                               source_p->name, target_p->name,
                                               target_p->from->name, client_p->name);
                    else
                        sendto_realops_snomask(SNO_GENERAL, L_ALL,
                                               "Nick change collision from SIGNON from %s to %s(%s <- %s)(newer killed)",
                                               source_p->name, target_p->name,
                                               target_p->from->name, client_p->name);

                    ServerStats.is_kill++;

                    sendto_one_numeric(target_p, ERR_NICKCOLLISION,
                                       form_str(ERR_NICKCOLLISION), target_p->name);

                    /* kill the client issuing the nickchange */
                    kill_client_serv_butone(client_p, source_p,
                                            "%s (Nick change collision)", me.name);

                    source_p->flags |= FLAGS_KILLED;

                    if(sameuser)
                        exit_client(client_p, source_p, &me, "Nick collision(old)");
                    else
                        exit_client(client_p, source_p, &me, "Nick collision(new)");
                    return 0;
                } else {
                    if(sameuser)
                        sendto_realops_snomask(SNO_GENERAL, L_ALL,
                                               "Nick collision from SIGNON on %s(%s <- %s)(older killed)",
                                               target_p->name, target_p->from->name,
                                               client_p->name);
                    else
                        sendto_realops_snomask(SNO_GENERAL, L_ALL,
                                               "Nick collision from SIGNON on %s(%s <- %s)(newer killed)",
                                               target_p->name, target_p->from->name,
                                               client_p->name);

                    sendto_one_numeric(target_p, ERR_NICKCOLLISION,
                                       form_str(ERR_NICKCOLLISION), target_p->name);

                    /* kill the client who existed before hand */
                    kill_client_serv_butone(client_p, target_p,
                                            "%s (Nick collision)", me.name);

                    ServerStats.is_kill++;

                    target_p->flags |= FLAGS_KILLED;
                    (void) exit_client(client_p, target_p, &me, "Nick collision");
                }
            }

        }
    }

    send_signon(client_p, source_p, parv[1], parv[2], parv[3], newts, login);
    return 0;
}
Beispiel #19
0
bool CryptoHash::test() {
    const QString file_path = TEST_VEC_FILEPATH.arg(name());
    QString line, result;
    size_t qw_message_length = 0;
    uint64_t* qw_message = NULL;
    size_t qw_result_length = hash_length();
    uint64_t qw_result[qw_result_length];

    //Open test file
    QFile test_file(file_path);
    if(test_file.exists() == false) {
        log_error(CRYPTO_HASH_NAME, ERR_FILE_NOT_FOUND.arg(file_path));
        return false;
    }
    if(test_file.open(QIODevice::ReadOnly) == false) {
        log_error(CRYPTO_HASH_NAME, ERR_FILE_OPEN_FAILURE.arg(file_path));
        return false;
    }
    QTextStream test_istream(&test_file);
    if(test_istream.readLine() != TEST_FILE_HEADER) {
        log_error(CRYPTO_HASH_NAME, ERR_FILE_HEADER_INCORRECT.arg(file_path));
        return false;
    }

    //Perform tests
    while(test_istream.atEnd() == false) {
        //Read and clean up a line of text, ignoring comments and spacing
        line = test_istream.readLine();
        isolate_content(line);
        if(line.isEmpty()) continue;

        if(has_id(line, ID_MESSAGE)) {
            //Convert message to qwords
            remove_id(line, ID_MESSAGE);
            qw_message_length = qword_length_hex(line);
            if(qw_message_length == 0) {
                log_error(CRYPTO_HASH_NAME, ERR_BAD_HEX_DATA.arg(line));
                return false;
            }
            qw_message = new uint64_t[qw_message_length];
            if(!qw_message) {
                log_error(CRYPTO_HASH_NAME, ERR_BAD_ALLOC.arg(QString("qw_message")));
                return false;
            }
            if(qwords_from_hex_str(line, qw_message) == false) {
                log_error(CRYPTO_HASH_NAME, ERR_BAD_HEX_DATA.arg(line));
                return false;
            }
            continue;
        }

        if(has_id(line, ID_RESULT)) {
            //Hash message, check result
            remove_id(line, ID_RESULT);
            hash(qw_message_length, qw_message, qw_result);
            qwords_to_hex_str(qw_result_length, qw_result, result);
            delete[] qw_message;

            if(result!=line) {
                log_error(CRYPTO_HASH_NAME, ERR_WRONG_RESULT.arg(result).arg(line));
                return false;
            }
            continue;
        }
    }

    return true;
}
Beispiel #20
0
int RseLogin::ByteSize() const {
  int total_size = 0;
  
  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
    // optional int32 currentTimeMillis = 1;
    if (has_currenttimemillis()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->currenttimemillis());
    }
    
    // optional int32 id = 2;
    if (has_id()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->id());
    }
    
    // optional int32 levelBasedOnScore = 3;
    if (has_levelbasedonscore()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->levelbasedonscore());
    }
    
    // optional int32 myAccountIsLocked = 4;
    if (has_myaccountislocked()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->myaccountislocked());
    }
    
    // optional bool pop = 5;
    if (has_pop()) {
      total_size += 1 + 1;
    }
    
    // optional int32 rqId = 6;
    if (has_rqid()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->rqid());
    }
    
    // optional int32 sync = 7;
    if (has_sync()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->sync());
    }
    
    // optional int32 timeFromLastLogin = 8;
    if (has_timefromlastlogin()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->timefromlastlogin());
    }
    
  }
  if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
    // optional int32 timeFromLastUpdate = 9;
    if (has_timefromlastupdate()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->timefromlastupdate());
    }
    
    // optional int32 token = 10;
    if (has_token()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->token());
    }
    
    // optional string userId = 11;
    if (has_userid()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->userid());
    }
    
    // optional string version = 12;
    if (has_version()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->version());
    }
    
    // optional int32 vip = 13;
    if (has_vip()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->vip());
    }
    
  }
  if (!unknown_fields().empty()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        unknown_fields());
  }
  _cached_size_ = total_size;
  return total_size;
}
Beispiel #21
0
int Message::ByteSize() const {
  int total_size = 0;

  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
    // optional string to = 1;
    if (has_to()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->to());
    }

    // optional int64 id = 2;
    if (has_id()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int64Size(
          this->id());
    }

    // optional int64 time = 3;
    if (has_time()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int64Size(
          this->time());
    }

    // optional string from = 4;
    if (has_from()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->from());
    }

    // optional int32 type = 5;
    if (has_type()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->type());
    }

    // optional string sn = 6;
    if (has_sn()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->sn());
    }

    // optional bytes data = 7;
    if (has_data()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::BytesSize(
          this->data());
    }

    // optional int64 expire = 8;
    if (has_expire()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int64Size(
          this->expire());
    }

  }
  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  _cached_size_ = total_size;
  GOOGLE_SAFE_CONCURRENT_WRITES_END();
  return total_size;
}
Beispiel #22
0
bool
HeapSnapshot::saveStackFrame(const protobuf::StackFrame& frame,
                             StackFrameId& outFrameId)
{
  // NB: de-duplicated string properties must be read in the same order here as
  // they are written in `CoreDumpWriter::getProtobufStackFrame` or else indices
  // in references to already serialized strings will be off.

  if (frame.has_ref()) {
    // We should only get a reference to the previous frame if we have already
    // seen the previous frame.
    if (!frames.has(frame.ref()))
      return false;

    outFrameId = frame.ref();
    return true;
  }

  // Incomplete message.
  if (!frame.has_data())
    return false;

  auto data = frame.data();

  if (!data.has_id())
    return false;
  StackFrameId id = data.id();

  // This should be the first and only time we see this frame.
  if (frames.has(id))
    return false;

  if (!data.has_line())
    return false;
  uint32_t line = data.line();

  if (!data.has_column())
    return false;
  uint32_t column = data.column();

  if (!data.has_issystem())
    return false;
  bool isSystem = data.issystem();

  if (!data.has_isselfhosted())
    return false;
  bool isSelfHosted = data.isselfhosted();

  Maybe<StringOrRef> sourceOrRef = GET_STRING_OR_REF(data, source);
  auto source = getOrInternString<char16_t>(internedTwoByteStrings, sourceOrRef);
  if (!source)
    return false;

  const char16_t* functionDisplayName = nullptr;
  if (data.FunctionDisplayNameOrRef_case() !=
      protobuf::StackFrame_Data::FUNCTIONDISPLAYNAMEORREF_NOT_SET)
  {
    Maybe<StringOrRef> nameOrRef = GET_STRING_OR_REF(data, functiondisplayname);
    functionDisplayName = getOrInternString<char16_t>(internedTwoByteStrings, nameOrRef);
    if (!functionDisplayName)
      return false;
  }

  Maybe<StackFrameId> parent;
  if (data.has_parent()) {
    StackFrameId parentId = 0;
    if (!saveStackFrame(data.parent(), parentId))
      return false;
    parent = Some(parentId);
  }

  if (!frames.putNew(id, DeserializedStackFrame(id, parent, line, column,
                                                source, functionDisplayName,
                                                isSystem, isSelfHosted, *this)))
  {
    return false;
  }

  outFrameId = id;
  return true;
}
int RceQueryRefuseReceiveWishItem::ByteSize() const {
  int total_size = 0;
  
  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
    // optional string type = 1;
    if (has_type()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->type());
    }
    
    // optional string name = 2;
    if (has_name()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->name());
    }
    
    // optional string playerId = 3;
    if (has_playerid()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->playerid());
    }
    
    // optional string id = 4;
    if (has_id()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->id());
    }
    
    // optional string guid = 5;
    if (has_guid()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->guid());
    }
    
    // optional string planetId = 6;
    if (has_planetid()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->planetid());
    }
    
    // optional string time = 7;
    if (has_time()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->time());
    }
    
    // optional string msg = 8;
    if (has_msg()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->msg());
    }
    
  }
  if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
    // optional string url = 9;
    if (has_url()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->url());
    }
    
  }
  if (!unknown_fields().empty()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        unknown_fields());
  }
  _cached_size_ = total_size;
  return total_size;
}
Beispiel #24
0
 int id() {
     assert(has_id(),"uninitialized id");
     return _id;
 }
Beispiel #25
0
void section::erase_topic(const topic& t)
{
	topic_list::iterator it = std::find_if(topics.begin(), topics.end(), has_id(t.id));
	topics.erase(it);
}