Changeset 1b6b76d in mainline
- Timestamp:
- 2012-08-12T05:10:17Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2988aec7
- Parents:
- 6be4142
- Location:
- uspace/app/bithenge
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bithenge/compound.c
r6be4142 r1b6b76d 287 287 if (bithenge_node_type(in) != BITHENGE_NODE_BLOB) 288 288 return EINVAL; 289 uint64_t size;290 289 return bithenge_transform_prefix_apply(self->xform, scope, 291 bithenge_node_as_blob(in), out, &size);290 bithenge_node_as_blob(in), out, NULL); 292 291 } 293 292 -
uspace/app/bithenge/expression.c
r6be4142 r1b6b76d 970 970 { 971 971 expression_transform_t *self = transform_as_expression(base); 972 *out_size = 0; 972 if (out_size) 973 *out_size = 0; 973 974 return bithenge_expression_evaluate(self->expr, scope, out_node); 974 975 } -
uspace/app/bithenge/sequence.c
r6be4142 r1b6b76d 546 546 return rc; 547 547 548 rc = seq_node_field_offset(node_as_seq(*out_node), out_size, 549 self->num_subtransforms); 550 if (rc != EOK) { 551 bithenge_node_dec_ref(*out_node); 552 return rc; 548 if (out_size) { 549 rc = seq_node_field_offset(node_as_seq(*out_node), out_size, 550 self->num_subtransforms); 551 if (rc != EOK) { 552 bithenge_node_dec_ref(*out_node); 553 return rc; 554 } 553 555 } 554 556 … … 815 817 return rc; 816 818 817 bithenge_int_t count = node_as_repeat(*out_node)->count; 818 if (count != -1) { 819 rc = seq_node_field_offset(node_as_seq(*out_node), out_size, count); 820 if (rc != EOK) { 821 bithenge_node_dec_ref(*out_node); 822 return rc; 823 } 824 } else { 825 *out_size = 0; 826 for (count = 1; ; count++) { 827 aoff64_t size; 819 if (out_size) { 820 bithenge_int_t count = node_as_repeat(*out_node)->count; 821 if (count != -1) { 828 822 rc = seq_node_field_offset(node_as_seq(*out_node), 829 &size, count); 830 if (rc != EOK) 831 break; 832 *out_size = size; 823 out_size, count); 824 if (rc != EOK) { 825 bithenge_node_dec_ref(*out_node); 826 return rc; 827 } 828 } else { 829 *out_size = 0; 830 for (count = 1; ; count++) { 831 aoff64_t size; 832 rc = seq_node_field_offset( 833 node_as_seq(*out_node), &size, count); 834 if (rc != EOK) 835 break; 836 *out_size = size; 837 } 833 838 } 834 839 } … … 1087 1092 return rc; 1088 1093 1089 rc = bithenge_node_for_each(*out_node, for_each_noop, NULL); 1090 if (rc != EOK) { 1091 bithenge_node_dec_ref(*out_node); 1092 return rc; 1093 } 1094 1095 rc = seq_node_field_offset(node_as_seq(*out_node), out_size, 1096 node_as_do_while(*out_node)->count); 1097 if (rc != EOK) { 1098 bithenge_node_dec_ref(*out_node); 1099 return rc; 1094 if (out_size) { 1095 rc = bithenge_node_for_each(*out_node, for_each_noop, NULL); 1096 if (rc != EOK) { 1097 bithenge_node_dec_ref(*out_node); 1098 return rc; 1099 } 1100 1101 rc = seq_node_field_offset(node_as_seq(*out_node), out_size, 1102 node_as_do_while(*out_node)->count); 1103 if (rc != EOK) { 1104 bithenge_node_dec_ref(*out_node); 1105 return rc; 1106 } 1100 1107 } 1101 1108 -
uspace/app/bithenge/transform.c
r6be4142 r1b6b76d 143 143 * @param[out] out_node Holds the result of applying this transform to the 144 144 * prefix. 145 * @param[out] out_size Holds the size of the prefix. 145 * @param[out] out_size Holds the size of the prefix. Can be null, in which 146 * case the size is not determined. 146 147 * @return EOK on success, ENOTSUP if not supported, or another error code from 147 148 * errno.h. */ … … 158 159 return ENOTSUP; 159 160 160 int rc = bithenge_transform_prefix_length(self, scope, blob, out_size); 161 aoff64_t size; 162 int rc = bithenge_transform_prefix_length(self, scope, blob, &size); 161 163 if (rc != EOK) 162 164 return rc; 163 165 bithenge_node_t *prefix_blob; 164 166 bithenge_blob_inc_ref(blob); 165 rc = bithenge_new_subblob(&prefix_blob, blob, 0, *out_size);167 rc = bithenge_new_subblob(&prefix_blob, blob, 0, size); 166 168 if (rc != EOK) 167 169 return rc; 168 170 rc = bithenge_transform_apply(self, scope, prefix_blob, out_node); 169 171 bithenge_node_dec_ref(prefix_blob); 172 if (out_size) 173 *out_size = size; 170 174 return rc; 171 175 } … … 560 564 { 561 565 char buffer; 562 *out_size = 1; 563 int rc = bithenge_blob_read_bits(blob, 0, &buffer, out_size, true); 564 if (rc != EOK) 565 return rc; 566 if (*out_size != 1) 567 return EINVAL; 566 aoff64_t size = 1; 567 int rc = bithenge_blob_read_bits(blob, 0, &buffer, &size, true); 568 if (rc != EOK) 569 return rc; 570 if (size != 1) 571 return EINVAL; 572 if (out_size) 573 *out_size = size; 568 574 return bithenge_new_boolean_node(out_node, (buffer & 1) != 0); 569 575 } … … 902 908 return EINVAL; 903 909 904 *out_size = num_bits;910 aoff64_t size = num_bits; 905 911 uint8_t buffer[sizeof(bithenge_int_t)]; 906 rc = bithenge_blob_read_bits(blob, 0, (char *)buffer, out_size,912 rc = bithenge_blob_read_bits(blob, 0, (char *)buffer, &size, 907 913 little_endian); 908 914 if (rc != EOK) 909 915 return rc; 910 if (*out_size != (aoff64_t)num_bits) 911 return EINVAL; 916 if (size != (aoff64_t)num_bits) 917 return EINVAL; 918 if (out_size) 919 *out_size = size; 912 920 913 921 bithenge_int_t result = 0;
Note:
See TracChangeset
for help on using the changeset viewer.