A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/protocolbuffers/protobuf/commit/b23430512ad9bcf6d392aa77e428855e3bc842e6 below:

Fix upb to escape DefinitelyNeedsEscape (like " and ') for bytes field · protocolbuffers/protobuf@b234305 · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+10

-1

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+10

-1

lines changed Original file line number Diff line number Diff line change

@@ -609,6 +609,14 @@ def testPrintUnknownFieldsEmbeddedMessageInBytes(self, message_module):

609 609

print_unknown_fields=True,

610 610

as_one_line=True))

611 611 612 +

def testBytestDoubleQuotes(self, message_module):

613 +

msg = message_module.TestAllTypes(optional_bytes=b'"')

614 +

self.assertEqual(str(msg), 'optional_bytes: "\\""\n')

615 + 616 +

def testBytesSingleQuote(self, message_module):

617 +

msg = message_module.TestAllTypes(optional_bytes=b"'")

618 +

self.assertEqual(str(msg), 'optional_bytes: "\\\'"\n')

619 + 612 620 613 621

@parameterized.parameters(unittest_pb2, unittest_proto3_arena_pb2)

614 622

class TextFormatMessageToTextBytesTests(TextFormatBase):

Original file line number Diff line number Diff line change

@@ -207,7 +207,8 @@ UPB_INLINE void UPB_PRIVATE(_upb_TextEncode_Bytes)(txtenc* e,

207 207

UPB_PRIVATE(_upb_TextEncode_PutStr)(e, "\"");

208 208

for (; ptr < end; ptr++) {

209 209

unsigned char uc = *ptr;

210 -

if (UPB_PRIVATE(_upb_AsciiIsPrint)(uc)) {

210 +

if (UPB_PRIVATE(_upb_AsciiIsPrint)(uc) &&

211 +

!UPB_PRIVATE(_upb_DefinitelyNeedsEscape)(uc)) {

211 212

UPB_PRIVATE(_upb_TextEncode_PutBytes)(e, ptr, 1);

212 213

} else {

213 214

UPB_PRIVATE(_upb_TextEncode_Escaped)(e, uc);

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4