From e02fbdadbf44177f932c41907324ffece54dbe98 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Thu, 14 Dec 2023 17:35:34 +0000 Subject: [PATCH] Auto-generate files after cl/590961088 --- php/ext/google/protobuf/php-upb.h | 21 +-------------------- ruby/ext/google/protobuf_c/ruby-upb.h | 21 +-------------------- 2 files changed, 2 insertions(+), 40 deletions(-) diff --git a/php/ext/google/protobuf/php-upb.h b/php/ext/google/protobuf/php-upb.h index a485705d7c..41900b70f5 100644 --- a/php/ext/google/protobuf/php-upb.h +++ b/php/ext/google/protobuf/php-upb.h @@ -13497,26 +13497,7 @@ extern const uint8_t upb_utf8_offsets[]; UPB_INLINE bool _upb_Decoder_VerifyUtf8Inline(const char* ptr, int len) { - const char* end = ptr + len; - - // Check 8 bytes at a time for any non-ASCII char. - while (end - ptr >= 8) { - uint64_t data; - memcpy(&data, ptr, 8); - if (data & 0x8080808080808080) goto non_ascii; - ptr += 8; - } - - // Check one byte at a time for non-ASCII. - while (ptr < end) { - if (*ptr & 0x80) goto non_ascii; - ptr++; - } - - return true; - -non_ascii: - return utf8_range2((const unsigned char*)ptr, end - ptr) == 0; + return utf8_range_IsValid(ptr, len); } const char* _upb_Decoder_CheckRequired(upb_Decoder* d, const char* ptr, diff --git a/ruby/ext/google/protobuf_c/ruby-upb.h b/ruby/ext/google/protobuf_c/ruby-upb.h index d7540dac43..d92ecc0dfe 100755 --- a/ruby/ext/google/protobuf_c/ruby-upb.h +++ b/ruby/ext/google/protobuf_c/ruby-upb.h @@ -13316,26 +13316,7 @@ extern const uint8_t upb_utf8_offsets[]; UPB_INLINE bool _upb_Decoder_VerifyUtf8Inline(const char* ptr, int len) { - const char* end = ptr + len; - - // Check 8 bytes at a time for any non-ASCII char. - while (end - ptr >= 8) { - uint64_t data; - memcpy(&data, ptr, 8); - if (data & 0x8080808080808080) goto non_ascii; - ptr += 8; - } - - // Check one byte at a time for non-ASCII. - while (ptr < end) { - if (*ptr & 0x80) goto non_ascii; - ptr++; - } - - return true; - -non_ascii: - return utf8_range2((const unsigned char*)ptr, end - ptr) == 0; + return utf8_range_IsValid(ptr, len); } const char* _upb_Decoder_CheckRequired(upb_Decoder* d, const char* ptr,