Lines Matching refs:context

50   android_log_context_internal* context;
52 context = calloc(1, sizeof(android_log_context_internal));
53 if (!context) {
56 context->tag = tag;
57 context->read_write_flag = kAndroidLoggerWrite;
59 if ((context->pos + needed) > MAX_EVENT_PAYLOAD) {
60 context->overflow = true;
63 context->storage[context->pos + 0] = EVENT_TYPE_LIST;
64 context->list[0] = context->pos + 1;
65 context->pos += needed;
67 return (android_log_context)context;
72 android_log_context_internal* context;
75 context = calloc(1, sizeof(android_log_context_internal));
76 if (!context) {
80 context->len = len;
81 memcpy(context->storage, msg, len);
82 context->read_write_flag = kAndroidLoggerRead;
84 return (android_log_context)context;
88 android_log_context_internal* context;
90 context = (android_log_context_internal*)*ctx;
91 if (!context) {
94 memset(context, 0, sizeof(*context));
95 free(context);
102 android_log_context_internal* context;
104 context = (android_log_context_internal*)ctx;
105 if (!context || (kAndroidLoggerWrite != context->read_write_flag)) {
108 if (context->list_nest_depth > ANDROID_MAX_LIST_NEST_DEPTH) {
109 context->overflow = true;
113 if ((context->pos + needed) > MAX_EVENT_PAYLOAD) {
114 context->overflow = true;
117 context->count[context->list_nest_depth]++;
118 context->list_nest_depth++;
119 if (context->list_nest_depth > ANDROID_MAX_LIST_NEST_DEPTH) {
120 context->overflow = true;
123 if (context->overflow) {
126 context->storage[context->pos + 0] = EVENT_TYPE_LIST;
127 context->storage[context->pos + 1] = 0;
128 context->list[context->list_nest_depth] = context->pos + 1;
129 context->count[context->list_nest_depth] = 0;
130 context->pos += needed;
144 android_log_context_internal* context;
146 context = (android_log_context_internal*)ctx;
147 if (!context || (kAndroidLoggerWrite != context->read_write_flag)) {
150 if (context->overflow) {
154 if ((context->pos + needed) > MAX_EVENT_PAYLOAD) {
155 context->overflow = true;
158 context->count[context->list_nest_depth]++;
159 context->storage[context->pos + 0] = EVENT_TYPE_INT;
160 copy4LE(&context->storage[context->pos + 1], value);
161 context->pos += needed;
179 android_log_context_internal* context;
181 context = (android_log_context_internal*)ctx;
182 if (!context || (kAndroidLoggerWrite != context->read_write_flag)) {
185 if (context->overflow) {
189 if ((context->pos + needed) > MAX_EVENT_PAYLOAD) {
190 context->overflow = true;
193 context->count[context->list_nest_depth]++;
194 context->storage[context->pos + 0] = EVENT_TYPE_LONG;
195 copy8LE(&context->storage[context->pos + 1], value);
196 context->pos += needed;
205 android_log_context_internal* context;
207 context = (android_log_context_internal*)ctx;
208 if (!context || (kAndroidLoggerWrite != context->read_write_flag)) {
211 if (context->overflow) {
219 if ((context->pos + needed) > MAX_EVENT_PAYLOAD) {
221 len = MAX_EVENT_PAYLOAD - context->pos - 1 - sizeof(int32_t);
223 context->overflow = true;
227 context->count[context->list_nest_depth]++;
228 context->storage[context->pos + 0] = EVENT_TYPE_STRING;
229 copy4LE(&context->storage[context->pos + 1], len);
231 memcpy(&context->storage[context->pos + 5], value, len);
233 context->pos += needed;
246 android_log_context_internal* context;
248 context = (android_log_context_internal*)ctx;
249 if (!context || (kAndroidLoggerWrite != context->read_write_flag)) {
252 if (context->overflow) {
256 if ((context->pos + needed) > MAX_EVENT_PAYLOAD) {
257 context->overflow = true;
261 context->count[context->list_nest_depth]++;
262 context->storage[context->pos + 0] = EVENT_TYPE_FLOAT;
263 copy4LE(&context->storage[context->pos + 1], ivalue);
264 context->pos += needed;
269 android_log_context_internal* context;
271 context = (android_log_context_internal*)ctx;
272 if (!context || (kAndroidLoggerWrite != context->read_write_flag)) {
275 if (context->list_nest_depth > ANDROID_MAX_LIST_NEST_DEPTH) {
276 context->overflow = true;
277 context->list_nest_depth--;
280 if (!context->list_nest_depth) {
281 context->overflow = true;
284 if (context->list[context->list_nest_depth] <= 0) {
285 context->list_nest_depth--;
286 context->overflow = true;
289 context->storage[context->list[context->list_nest_depth]] =
290 context->count[context->list_nest_depth];
291 context->list_nest_depth--;
300 android_log_context_internal* context;
308 context = (android_log_context_internal*)ctx;
309 if (!context || (kAndroidLoggerWrite != context->read_write_flag)) {
312 if (context->list_nest_depth) {
316 context->storage[1] = context->count[0];
317 len = context->len = context->pos;
318 msg = (const char*)context->storage;
320 if (context->count[0] <= 1) {
328 ? __android_log_bwrite(context->tag, msg, len)
329 : __android_log_security_bwrite(context->tag, msg, len);
334 android_log_context_internal* context;
338 context = (android_log_context_internal*)ctx;
339 if (!context || (kAndroidLoggerWrite != context->read_write_flag)) {
342 if (context->list_nest_depth) {
349 context->storage[1] = context->count[0];
350 len = context->len = context->pos;
351 msg = (const char*)context->storage;
353 if (context->count[0] <= 1) {
391 android_log_context_internal* context;
393 context = (android_log_context_internal*)ctx;
397 /* Nothing to parse from this context, so return complete. */
398 if (!context || (kAndroidLoggerRead != context->read_write_flag) ||
399 (context->list_nest_depth > ANDROID_MAX_LIST_NEST_DEPTH) ||
400 (context->count[context->list_nest_depth] >=
403 if (context && (context->list_stop ||
404 ((context->list_nest_depth <= ANDROID_MAX_LIST_NEST_DEPTH) &&
405 !context->count[context->list_nest_depth]))) {
416 pos = context->pos;
417 if (context->list_stop) {
419 elem.complete = !context->count[0] &&
420 (!context->list_nest_depth ||
421 ((context->list_nest_depth == 1) && !context->count[1]));
424 if (context->storage[pos] == EVENT_TYPE_LIST_STOP) {
425 context->pos = pos + 1;
427 if (context->list_nest_depth) {
428 --context->list_nest_depth;
429 if (context->count[context->list_nest_depth]) {
430 context->list_stop = false;
433 context->list_stop = false;
438 if ((pos + 1) > context->len) {
444 elem.type = context->storage[pos++];
451 if ((pos + elem.len) > context->len) {
455 elem.data.int32 = get4LE(&context->storage[pos]);
458 elem.complete = !context->list_nest_depth && !context->count[0];
460 if (!context->count[context->list_nest_depth] ||
461 !--(context->count[context->list_nest_depth])) {
462 context->list_stop = true;
464 context->pos = pos;
470 if ((pos + elem.len) > context->len) {
474 elem.data.int64 = get8LE(&context->storage[pos]);
477 elem.complete = !context->list_nest_depth && !context->count[0];
479 if (!context->count[context->list_nest_depth] ||
480 !--(context->count[context->list_nest_depth])) {
481 context->list_stop = true;
483 context->pos = pos;
488 if ((pos + sizeof(int32_t)) > context->len) {
493 elem.len = get4LE(&context->storage[pos]);
495 if ((pos + elem.len) > context->len) {
496 elem.len = context->len - pos; /* truncate string */
503 elem.data.string = (char*)&context->storage[pos];
506 elem.complete = !context->list_nest_depth && !context->count[0];
508 if (!context->count[context->list_nest_depth] ||
509 !--(context->count[context->list_nest_depth])) {
510 context->list_stop = true;
512 context->pos = pos;
517 if ((pos + sizeof(uint8_t)) > context->len) {
522 elem.complete = context->list_nest_depth >= ANDROID_MAX_LIST_NEST_DEPTH;
526 if (context->count[context->list_nest_depth]) {
527 context->count[context->list_nest_depth]--;
529 context->list_stop = !context->storage[pos];
530 context->list_nest_depth++;
531 if (context->list_nest_depth <= ANDROID_MAX_LIST_NEST_DEPTH) {
532 context->count[context->list_nest_depth] = context->storage[pos];
534 context->pos = pos + sizeof(uint8_t);
539 context->pos = pos;
542 elem.complete = !context->list_nest_depth;
543 if (context->list_nest_depth > 0) {
546 context->list_nest_depth--;