arduino / arduino/ArduinoCore-API

Stream::find() not working for values above 0x7F

未关闭
#119 1 条评论 0 个 reaction 已指派 0 人 已被 @asumo-1xts 认领 在 GitHub 查看
主要语言
C++
星标
306
派生
150
PR 合并指标
30 天内没有已合并 PR

描述

I found out that the `Stream::find()` (and all related functions, findUntil() etc), does not work when the sequence to be found contains values above 0x7F. I believe this is because the function uses char instead of uint8_t.

Example, using these definitions:

char a = 0xff;
uint8_t b = 0xff;

`a == b` is false, and therefore the find() method does not return a match when supplied a uint8_t[] array containing values above 0x7F, since the array gets casted to char. Changing the declaration of find() to uint8_t should solve the issue.

I don't know if ignoring values above 0x7F is the intended behaviour, but if that is the case I think the documentation should be more specific and explain this case better. In any case, if the current behaviour is the intended one, i do not see the reason behind it.

First time reporting something on Arduino, sorry if I overlooked something obvious.

贡献指南

这个仓库没有索引到贡献指南

调研方向

Inspect the Stream::find() and related findUntil() entry points and reproduce the reported mismatch with a uint8_t sequence containing 0xff. Confirm the intended handling of values above 0x7F, then verify that matching works consistently across the affected functions and that the open pull request does not already address it.

由索引模型根据 Issue 内容生成。

评估

技术栈
cpp
领域
api, embedded-iot
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。