From 765bb3298ea99d318b3db9ef7ca47b33f0824e91 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 8 Mar 2026 21:06:22 -1000 Subject: [PATCH] [api] Use PROTO_VARINT_PARSE_FAILED constant in parse failure returns Replace magic {0, 0} with {0, PROTO_VARINT_PARSE_FAILED} in parse_slow() and parse_wide() for consistency with the named sentinel. Co-Authored-By: Claude Opus 4.6 --- esphome/components/api/proto.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/components/api/proto.cpp b/esphome/components/api/proto.cpp index 8959ac7a2a..4f5b3f0918 100644 --- a/esphome/components/api/proto.cpp +++ b/esphome/components/api/proto.cpp @@ -38,7 +38,7 @@ ProtoVarIntResult ProtoVarInt::parse_slow(const uint8_t *buffer, uint32_t len) { #ifdef USE_API_VARINT64 return parse_wide(buffer, len, result32); #else - return {0, 0}; + return {0, PROTO_VARINT_PARSE_FAILED}; #endif } @@ -53,7 +53,7 @@ ProtoVarIntResult ProtoVarInt::parse_wide(const uint8_t *buffer, uint32_t len, u return {result64, i + 1}; } } - return {0, 0}; + return {0, PROTO_VARINT_PARSE_FAILED}; } #endif