arduino / arduino/ArduinoCore-API

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

オープン
#119 コメント 1 件 リアクション 0 件 担当者 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 を短くまとめたダイジェスト。