arduino / arduino/ArduinoCore-API

Clean up use of sprintf

オープン
#209 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C++
スター
306
フォーク
150
PR マージ指標
30日以内にマージされた PR はありません

説明

In #208 I added pragmas to suppress deprecation warnings related to sprintf that were added in newer versions of GCC and CLang, and which caused compilation failure. These suppressions should be removed.

One usage is in the test suite's implemention of `itoa` that is needed to run String tests. I have a quick fix for that relying on `snprintf` but I also thought of just using a more basic implementation of `itoa` such as the one from K&R or even just copying the implementation from the SAMD core.

Thinking a bit deeper though, the only use in API code is in `String` and it looks to be unnecessarily double buffering during those conversions. I think there's an opportunity to remove String's dependency on `itoa` and make it more efficient, which would also eliminate the need for an implementation of `itoa` in the test suite. I plan to look in to that approach.

A similar use is in the test suite's implementation of `dtostrf` which delegates the deprecated avr impl. For that, I think `String` can be improved to avoid the double buffering although it would still delegate to the core for the conversion, assuming the core may have implementation-specific FP support.

The final use was in `IPAddress` and that looks like it can simply be changed to used `snprintf`

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

String と IPAddress の API 実装、およびテストスイートの itoa と dtostrf ヘルパーを特定します。まず既存の sprintf pragma と変換パスを確認します。抑制を削除し、特定された非推奨の sprintf 使用箇所に対処して、String、IPAddress、または String のテストを壊さなければ完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp
領域
api, embedded-iot
issue の種類
リファクタリング
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
28/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。