| OLD | NEW |
| 1 // Amalgamated source file | 1 // Amalgamated source file |
| 2 #include "upb.h" | 2 #include "upb.h" |
| 3 | 3 |
| 4 | 4 |
| 5 #include <ctype.h> | 5 #include <ctype.h> |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 typedef struct { | 9 typedef struct { |
| 10 size_t len; | 10 size_t len; |
| (...skipping 11058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11069 switch (upb_fielddef_type(p->top->f)) { | 11069 switch (upb_fielddef_type(p->top->f)) { |
| 11070 case UPB_TYPE_BYTES: | 11070 case UPB_TYPE_BYTES: |
| 11071 if (!base64_push(p, getsel_for_handlertype(p, UPB_HANDLER_STRING), | 11071 if (!base64_push(p, getsel_for_handlertype(p, UPB_HANDLER_STRING), |
| 11072 p->accumulated, p->accumulated_len)) { | 11072 p->accumulated, p->accumulated_len)) { |
| 11073 return false; | 11073 return false; |
| 11074 } | 11074 } |
| 11075 /* Fall through. */ | 11075 /* Fall through. */ |
| 11076 | 11076 |
| 11077 case UPB_TYPE_STRING: { | 11077 case UPB_TYPE_STRING: { |
| 11078 upb_selector_t sel = getsel_for_handlertype(p, UPB_HANDLER_ENDSTR); | 11078 upb_selector_t sel = getsel_for_handlertype(p, UPB_HANDLER_ENDSTR); |
| 11079 p->top--; |
| 11079 upb_sink_endstr(&p->top->sink, sel); | 11080 upb_sink_endstr(&p->top->sink, sel); |
| 11080 p->top--; | |
| 11081 break; | 11081 break; |
| 11082 } | 11082 } |
| 11083 | 11083 |
| 11084 case UPB_TYPE_ENUM: { | 11084 case UPB_TYPE_ENUM: { |
| 11085 /* Resolve enum symbolic name to integer value. */ | 11085 /* Resolve enum symbolic name to integer value. */ |
| 11086 const upb_enumdef *enumdef = | 11086 const upb_enumdef *enumdef = |
| 11087 (const upb_enumdef*)upb_fielddef_subdef(p->top->f); | 11087 (const upb_enumdef*)upb_fielddef_subdef(p->top->f); |
| 11088 | 11088 |
| 11089 size_t len; | 11089 size_t len; |
| 11090 const char *buf = accumulate_getptr(p, &len); | 11090 const char *buf = accumulate_getptr(p, &len); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11168 multipart_end(p); | 11168 multipart_end(p); |
| 11169 break; | 11169 break; |
| 11170 case UPB_TYPE_STRING: | 11170 case UPB_TYPE_STRING: |
| 11171 case UPB_TYPE_BYTES: { | 11171 case UPB_TYPE_BYTES: { |
| 11172 upb_sink subsink; | 11172 upb_sink subsink; |
| 11173 upb_selector_t sel = getsel_for_handlertype(p, UPB_HANDLER_STARTSTR); | 11173 upb_selector_t sel = getsel_for_handlertype(p, UPB_HANDLER_STARTSTR); |
| 11174 upb_sink_startstr(&p->top->sink, sel, len, &subsink); | 11174 upb_sink_startstr(&p->top->sink, sel, len, &subsink); |
| 11175 sel = getsel_for_handlertype(p, UPB_HANDLER_STRING); | 11175 sel = getsel_for_handlertype(p, UPB_HANDLER_STRING); |
| 11176 upb_sink_putstring(&subsink, sel, buf, len, NULL); | 11176 upb_sink_putstring(&subsink, sel, buf, len, NULL); |
| 11177 sel = getsel_for_handlertype(p, UPB_HANDLER_ENDSTR); | 11177 sel = getsel_for_handlertype(p, UPB_HANDLER_ENDSTR); |
| 11178 upb_sink_endstr(&subsink, sel); | 11178 upb_sink_endstr(&p->top->sink, sel); |
| 11179 multipart_end(p); | 11179 multipart_end(p); |
| 11180 break; | 11180 break; |
| 11181 } | 11181 } |
| 11182 default: | 11182 default: |
| 11183 upb_status_seterrmsg(&p->status, "Invalid field type for map key"); | 11183 upb_status_seterrmsg(&p->status, "Invalid field type for map key"); |
| 11184 upb_env_reporterror(p->env, &p->status); | 11184 upb_env_reporterror(p->env, &p->status); |
| 11185 return false; | 11185 return false; |
| 11186 } | 11186 } |
| 11187 | 11187 |
| 11188 return true; | 11188 return true; |
| (...skipping 1614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12803 upb_sink *upb_json_printer_input(upb_json_printer *p) { | 12803 upb_sink *upb_json_printer_input(upb_json_printer *p) { |
| 12804 return &p->input_; | 12804 return &p->input_; |
| 12805 } | 12805 } |
| 12806 | 12806 |
| 12807 const upb_handlers *upb_json_printer_newhandlers(const upb_msgdef *md, | 12807 const upb_handlers *upb_json_printer_newhandlers(const upb_msgdef *md, |
| 12808 bool preserve_fieldnames, | 12808 bool preserve_fieldnames, |
| 12809 const void *owner) { | 12809 const void *owner) { |
| 12810 return upb_handlers_newfrozen( | 12810 return upb_handlers_newfrozen( |
| 12811 md, owner, printer_sethandlers, &preserve_fieldnames); | 12811 md, owner, printer_sethandlers, &preserve_fieldnames); |
| 12812 } | 12812 } |
| OLD | NEW |