arduino / arduino/ArduinoCore-API

String object, len is of type unsigned int, however indexOf() and lastIndexOf() return int

未关闭
#239 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
C++
星标
306
派生
150
PR 合并指标
30 天内没有已合并 PR

描述

### Description

String Object:

len is of type unsigned int.
method that apply to position into the String or its size are expecting an unsigned int, this is the case with:
charAt()
substring()
remove()
reserve()

Oddly, indexOf() and lastIndexOf() are returning int and not unsigned int

### Current behavior

Oddly, indexOf() and lastIndexOf() are returning int and not unsigned int

### Expected behavior

indexOf() and lastIndexOf() ought to return unsigned int, to avoid unnecessary casting from int to unsigned int

### Additional information
It's frequent to pass the result of indexOf() to substring()

Thanks

贡献指南

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

调研方向

在 ArduinoCore-API 的 String 实现中查找 indexOf() 和 lastIndexOf() 的声明与实现,然后将它们的返回类型与 len、charAt()、substring()、remove() 和 reserve() 进行比较。确认这两个方法都一致地使用预期的 unsigned 类型,并且将它们的结果传递给 substring() 的调用方不再需要 cast。

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

评估

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

把新 issue 发到你的邮箱

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