@@ -101,6 +101,8 @@ CborError parseOne(CborValue *it, QString *parsed)
101101 char *buffer;
102102 size_t size;
103103
104+ int flags = CborPrettyShowStringFragments;
105+
104106 setlocale (LC_ALL, " C" );
105107#ifdef Q_CC_MSVC
106108 // no open_memstream, so use a temporary file
@@ -110,7 +112,7 @@ CborError parseOne(CborValue *it, QString *parsed)
110112 FILE *f = fopen (QFile::encodeName (tmp.fileName ()), " w+" );
111113 if (!f)
112114 return CborErrorIO;
113- err = cbor_value_to_pretty_advance (f, it);
115+ err = cbor_value_to_pretty_advance_flags (f, it, flags );
114116 size = ftell (f);
115117 rewind (f);
116118
@@ -119,7 +121,7 @@ CborError parseOne(CborValue *it, QString *parsed)
119121 fclose (f);
120122#else
121123 FILE *f = open_memstream (&buffer, &size);
122- err = cbor_value_to_pretty_advance (f, it);
124+ err = cbor_value_to_pretty_advance_flags (f, it, flags );
123125 fclose (f);
124126#endif
125127
@@ -130,8 +132,6 @@ CborError parseOne(CborValue *it, QString *parsed)
130132
131133CborError parseOneChunk (CborValue *it, QString *parsed)
132134{
133- // we can't use the cborpretty.c API here because it uses
134- // cbor_value_advance_fixed and cbor_value_dup_xxxx_string
135135 CborError err;
136136 CborType ourType = cbor_value_get_type (it);
137137 if (ourType == CborByteStringType) {
@@ -397,18 +397,18 @@ void addStringsData()
397397 QTest::newRow (" textstring5*8" ) << raw (" \x7b\0\0\0\0\0\0\0\x05 Hello" ) << " \" Hello\" " ;
398398
399399 // strings with undefined length
400- QTest::newRow (" _emptybytestring" ) << raw (" \x5f\xff " ) << " h'' " ;
401- QTest::newRow (" _emptytextstring" ) << raw (" \x7f\xff " ) << " \"\" " ;
402- QTest::newRow (" _emptybytestring2" ) << raw (" \x5f\x40\xff " ) << " h''" ;
403- QTest::newRow (" _emptytextstring2" ) << raw (" \x7f\x60\xff " ) << " \"\" " ;
404- QTest::newRow (" _emptybytestring3" ) << raw (" \x5f\x40\x40\xff " ) << " h''" ;
405- QTest::newRow (" _emptytextstring3" ) << raw (" \x7f\x60\x60\xff " ) << " \"\" " ;
406- QTest::newRow (" _bytestring5*2" ) << raw (" \x5f\x43 Hel\x42 lo\xff " ) << " h'48656c6c6f' " ;
407- QTest::newRow (" _textstring5*2" ) << raw (" \x7f\x63 Hel\x62 lo\xff " ) << " \" Hello \" " ;
408- QTest::newRow (" _bytestring5*5" ) << raw (" \x5f\x41 H\x41 " " e\x41 l\x41 l\x41 o\xff " ) << " h'48656c6c6f' " ;
409- QTest::newRow (" _textstring5*5" ) << raw (" \x7f\x61 H\x61 " " e\x61 l\x61 l\x61 o\xff " ) << " \" Hello \" " ;
410- QTest::newRow (" _bytestring5*6" ) << raw (" \x5f\x41 H\x41 " " e\x40\x41 l\x41 l\x41 o\xff " ) << " h'48656c6c6f' " ;
411- QTest::newRow (" _textstring5*6" ) << raw (" \x7f\x61 H\x61 " " e\x61 l\x60\x61 l\x61 o\xff " ) << " \" Hello \" " ;
400+ QTest::newRow (" _emptybytestring" ) << raw (" \x5f\xff " ) << " (_ ) " ;
401+ QTest::newRow (" _emptytextstring" ) << raw (" \x7f\xff " ) << " (_ ) " ;
402+ QTest::newRow (" _emptybytestring2" ) << raw (" \x5f\x40\xff " ) << " (_ h'') " ;
403+ QTest::newRow (" _emptytextstring2" ) << raw (" \x7f\x60\xff " ) << " (_ \"\" ) " ;
404+ QTest::newRow (" _emptybytestring3" ) << raw (" \x5f\x40\x40\xff " ) << " (_ h'', h'') " ;
405+ QTest::newRow (" _emptytextstring3" ) << raw (" \x7f\x60\x60\xff " ) << " (_ \"\" , \"\" ) " ;
406+ QTest::newRow (" _bytestring5*2" ) << raw (" \x5f\x43 Hel\x42 lo\xff " ) << " (_ h'48656c', h'6c6f') " ;
407+ QTest::newRow (" _textstring5*2" ) << raw (" \x7f\x63 Hel\x62 lo\xff " ) << " (_ \" Hel \" , \" lo \" ) " ;
408+ QTest::newRow (" _bytestring5*5" ) << raw (" \x5f\x41 H\x41 " " e\x41 l\x41 l\x41 o\xff " ) << " (_ h'48', h'65', h'6c', h'6c', h'6f') " ;
409+ QTest::newRow (" _textstring5*5" ) << raw (" \x7f\x61 H\x61 " " e\x61 l\x61 l\x61 o\xff " ) << " (_ \" H \" , \" e \" , \" l \" , \" l \" , \" o \" ) " ;
410+ QTest::newRow (" _bytestring5*6" ) << raw (" \x5f\x41 H\x41 " " e\x40\x41 l\x41 l\x41 o\xff " ) << " (_ h'48', h'65', h'', h'6c', h'6c', h'6f') " ;
411+ QTest::newRow (" _textstring5*6" ) << raw (" \x7f\x61 H\x61 " " e\x61 l\x60\x61 l\x61 o\xff " ) << " (_ \" H \" , \" e \" , \" l \" , \"\" , \" l \" , \" o \" ) " ;
412412}
413413
414414void tst_Parser::strings_data ()
@@ -763,7 +763,7 @@ void tst_Parser::mapsAndArrays()
763763
764764 // mixed with indeterminate length strings
765765 compareOneSize (-1 , " \xbf\1\x9f " + data + " \xff\x65 Hello\xbf " + data + " \x7f\xff\xff\xff " ,
766- " {_ 1: [_ " + expected + " ], \" Hello\" : {_ " + expected + " : \"\" }}" );
766+ " {_ 1: [_ " + expected + " ], \" Hello\" : {_ " + expected + " : (_ ) }}" );
767767}
768768
769769void tst_Parser::chunkedString_data ()
0 commit comments