arduino / arduino/ArduinoCore-API
Clean up use of sprintf
- Lenguaje dominante
- C++
- Estrellas
- 306
- Forks
- 150
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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`
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Localiza las implementaciones de las API de String e IPAddress y los helpers itoa y dtostrf del conjunto de pruebas. Lee primero los pragmas sprintf existentes y las rutas de conversión. Se considera terminado cuando se eliminen las supresiones y se aborden los usos obsoletos de sprintf identificados sin romper String, IPAddress ni las pruebas de String.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- cpp
- Área
- api, embedded-iot
- Tipo de issue
- Refactorización
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 28/100