Lines Matching refs:size
83 static void* MakeVector(const void* src, size_t size, SkArenaAlloc& alloc) {
84 // The Ts are already in memory, so their size should be safe.
85 const auto total_size = sizeof(size_t) + size * sizeof(T) + extra_alloc_size;
88 *size_ptr = size;
89 sk_careful_memcpy(size_ptr + 1, src, size * sizeof(T));
94 ArrayValue::ArrayValue(const Value* src, size_t size, SkArenaAlloc& alloc) {
95 this->init_tagged_pointer(Tag::kArray, MakeVector<Value>(src, size, alloc));
107 // null terminator when size == max_len (this works 'cause kShortString == 0).
119 FastString(const char* src, size_t size, const char* eos, SkArenaAlloc& alloc) {
122 if (size > kMaxInlineStringSize) {
123 this->initLongString(src, size, alloc);
130 this->initFastShortString(src, size);
132 this->initShortString(src, size);
142 void initLongString(const char* src, size_t size, SkArenaAlloc& alloc) {
143 SkASSERT(size > kMaxInlineStringSize);
145 this->init_tagged_pointer(Tag::kString, MakeVector<char, 1>(src, size, alloc));
148 const_cast<char*>(data)[size] = '\0';
151 void initShortString(const char* src, size_t size) {
152 SkASSERT(size <= kMaxInlineStringSize);
155 sk_careful_memcpy(this->cast<char>(), src, size);
159 void initFastShortString(const char* src, size_t size) {
160 SkASSERT(size <= kMaxInlineStringSize);
177 *s64 &= (0x0000ffffffffffffULL >> ((kMaxInlineStringSize - size) * 8)) // trailing \0s
187 StringValue::StringValue(const char* src, size_t size, SkArenaAlloc& alloc) {
188 new (this) FastString(src, size, src, alloc);
191 ObjectValue::ObjectValue(const Member* src, size_t size, SkArenaAlloc& alloc) {
192 this->init_tagged_pointer(Tag::kObject, MakeVector<Member>(src, size, alloc));
302 Value parse(const char* p, size_t size) {
303 if (!size) {
307 const char* p_stop = p + size - 1;
313 SkASSERT(p_stop >= p && p_stop < p + size);
342 p = this->matchString(p, p_stop, [this](const char* key, size_t size, const char* eos) {
343 this->pushObjectKey(key, size, eos);
360 p = this->matchString(p, p_stop, [this](const char* str, size_t size, const char* eos) {
361 this->pushString(str, size, eos);
423 SkASSERT(fValueStack.size() == 1);
509 SkASSERT(scope_start <= fValueStack.size());
516 const auto scope_count = fValueStack.size() - scope_start,
537 fScopeIndex = SkTo<intptr_t>(fValueStack.size());
558 fScopeIndex = -SkTo<intptr_t>(fValueStack.size());
571 void pushObjectKey(const char* key, size_t size, const char* eos) {
573 SkASSERT(fValueStack.size() >= SkTo<size_t>(fScopeIndex));
574 SkASSERT(!((fValueStack.size() - SkTo<size_t>(fScopeIndex)) & 1));
575 this->pushString(key, size, eos);
590 void pushString(const char* s, size_t size, const char* eos) {
591 fValueStack.push_back(FastString(s, size, eos, fAlloc));
714 func(buf->data(), buf->size(), buf->data() + buf->size() - 1);
909 return SkString(static_cast<const char*>(data->data()), data->size());
914 DOM::DOM(const char* data, size_t size)
918 fRoot = parser.parse(data, size);