Changeset c3437d9 in mainline for uspace/app/bithenge/transform.c
 Timestamp:
 20120804T03:51:15Z (9 years ago)
 Branches:
 lfn, master
 Children:
 0ce0103
 Parents:
 e3f2765
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

uspace/app/bithenge/transform.c
re3f2765 rc3437d9 201 201 for (int i = 0; i < out>num_params; i++) 202 202 bithenge_node_inc_ref(out>params[i]); 203 bithenge_node_dec_ref(out>current_node); 203 204 out>current_node = scope>current_node; 204 205 if (out>current_node) … … 474 475 bithenge_transform_t bithenge_known_length_transform = { 475 476 &known_length_ops, 1, 1 477 }; 478 479 static int nonzero_boolean_apply(bithenge_transform_t *self, 480 bithenge_scope_t *scope, bithenge_node_t *in, bithenge_node_t **out) 481 { 482 if (bithenge_node_type(in) != BITHENGE_NODE_INTEGER) 483 return EINVAL; 484 bool value = bithenge_integer_node_value(in) != 0; 485 return bithenge_new_boolean_node(out, value); 486 } 487 488 static const bithenge_transform_ops_t nonzero_boolean_ops = { 489 .apply = nonzero_boolean_apply, 490 .destroy = transform_indestructible, 491 }; 492 493 /** A transform that converts integers to booleans, true if nonzero. */ 494 bithenge_transform_t bithenge_nonzero_boolean_transform = { 495 &nonzero_boolean_ops, 1, 0 476 496 }; 477 497 … … 602 622 {"ascii", &bithenge_ascii_transform}, 603 623 {"known_length", &bithenge_known_length_transform}, 624 {"nonzero_boolean", &bithenge_nonzero_boolean_transform}, 604 625 {"uint8", &bithenge_uint8_transform}, 605 626 {"uint16le", &bithenge_uint16le_transform},
Note: See TracChangeset
for help on using the changeset viewer.