Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset da0fef6 in mainline for uspace/app/bithenge/print.c


Ignore:
Timestamp:
2012-06-23T18:24:21Z (10 years ago)
Author:
Sean Bartell <wingedtachikoma@…>
Branches:
lfn, master, serial
Children:
03b2b2c
Parents:
d5070ef
Message:

Bithenge: port to Linux and allow choosing a data source

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bithenge/print.c

    rd5070ef rda0fef6  
    104104static int print_string(bithenge_print_type_t type, bithenge_node_t *node)
    105105{
    106         size_t off = 0;
    107106        const char *value = bithenge_string_node_value(node);
    108         wchar_t ch;
    109107        printf("\"");
    110         while ((ch = str_decode(value, &off, STR_NO_LIMIT)) != 0) {
     108        for (string_iterator_t i = string_iterator(value); !string_iterator_done(&i); ) {
     109                wchar_t ch;
     110                int rc = string_iterator_next(&i, &ch);
     111                if (rc != EOK)
     112                        return rc;
    111113                if (ch == '"' || ch == '\\') {
    112114                        printf("\\%lc", (wint_t) ch);
     
    134136                        return rc;
    135137                for (aoff64_t i = 0; i < size; i++)
    136                         printf("\\x%02x", buffer[i]);
     138                        printf("\\x%02x", (unsigned int)(uint8_t)buffer[i]);
    137139                pos += size;
    138140        } while (size == sizeof(buffer));
Note: See TracChangeset for help on using the changeset viewer.