universal7885: libfileio: Fix the unoverloadable function error

device/samsung/universal7885-common/apps/aidl-support/libfileio/FileIO.cpp:27:5: error: functions that differ only in their return type cannot be overloaded
int readline(const char *path) {
~~~ ^
device/samsung/universal7885-common/apps/aidl-support/libfileio/FileIO.cpp:12:13: note: previous definition is here
std::string readline(const char *path) {
~~~~~~~~~~~ ^
1 error generated.

- Rename int version to 'readint' to fix
This commit is contained in:
roynatech2544 2022-11-26 19:11:40 +09:00
commit 8d728a6111
6 changed files with 7 additions and 7 deletions

View file

@ -38,7 +38,7 @@ constexpr const char *FM_FREQ_SEEK = FM_SYSFS_BASE "/radio_freq_seek";
} }
switch (type) { switch (type) {
case GetType::GET_TYPE_FM_FREQ: case GetType::GET_TYPE_FM_FREQ:
*_aidl_return = FileIO::readline(FM_FREQ_CTL); *_aidl_return = FileIO::readint(FM_FREQ_CTL);
break; break;
case GetType::GET_TYPE_FM_UPPER_LIMIT: case GetType::GET_TYPE_FM_UPPER_LIMIT:
case GetType::GET_TYPE_FM_LOWER_LIMIT: case GetType::GET_TYPE_FM_LOWER_LIMIT:
@ -109,7 +109,7 @@ constexpr const char *FM_FREQ_SEEK = FM_SYSFS_BASE "/radio_freq_seek";
for (int i = 0; i < TRACK_SIZE; i++) { for (int i = 0; i < TRACK_SIZE; i++) {
FileIO::writeline(FM_FREQ_SEEK, FileIO::writeline(FM_FREQ_SEEK,
"1 " + std::to_string(SYSFS_SPACING * 10)); "1 " + std::to_string(SYSFS_SPACING * 10));
int freq = FileIO::readline(FM_FREQ_CTL); int freq = FileIO::readint(FM_FREQ_CTL);
if (std::find(freqs_list.begin(), freqs_list.end(), freq) != if (std::find(freqs_list.begin(), freqs_list.end(), freq) !=
freqs_list.end()) freqs_list.end())
continue; continue;

View file

@ -24,7 +24,7 @@ std::string readline(const char *path) {
return value; return value;
} }
int readline(const char *path) { int readint(const char *path) {
const std::string value = readline(path); const std::string value = readline(path);
try { try {
return stoi(value); return stoi(value);

View file

@ -2,7 +2,7 @@
namespace FileIO { namespace FileIO {
std::string readline(const char *path); std::string readline(const char *path);
int readline(const char *path); int readint(const char *path);
void writeline(const char *path, const std::string& data); void writeline(const char *path, const std::string& data);
void writeline(const char *path, const int data); void writeline(const char *path, const int data);

View file

@ -43,7 +43,7 @@ static inline const char *BatterySysToPath(BatterySys type) {
// Methods from ::android::hardware::battery::V1_0::IBattery follow. // Methods from ::android::hardware::battery::V1_0::IBattery follow.
::ndk::ScopedAStatus BatteryStats::getBatteryStats(BatterySys stats, ::ndk::ScopedAStatus BatteryStats::getBatteryStats(BatterySys stats,
int32_t *_aidl_return) { int32_t *_aidl_return) {
*_aidl_return = FileIO::readline(BatterySysToPath(stats)); *_aidl_return = FileIO::readint(BatterySysToPath(stats));
return ::ndk::ScopedAStatus::ok(); return ::ndk::ScopedAStatus::ok();
} }

View file

@ -37,7 +37,7 @@ constexpr const char *TORCH_LVL =
::ndk::ScopedAStatus ::ndk::ScopedAStatus
FlashBrightness::readFlashlightstats(bool s2mu106, int32_t *_aidl_return) { FlashBrightness::readFlashlightstats(bool s2mu106, int32_t *_aidl_return) {
*_aidl_return = *_aidl_return =
s2mu106 ? FileIO::readline(TORCH_LVL) / 21 : FileIO::readline(TORCH_LVL); s2mu106 ? FileIO::readint(TORCH_LVL) / 21 : FileIO::readint(TORCH_LVL);
return ::ndk::ScopedAStatus::ok(); return ::ndk::ScopedAStatus::ok();
} }

View file

@ -22,7 +22,7 @@ namespace aidl::vendor::eureka::hardware::parts {
void SmartCharge::battery_monitor(void) { void SmartCharge::battery_monitor(void) {
while (kShouldRun) { while (kShouldRun) {
auto batt = FileIO::readline(BATTERY_CAPACITY_CURRENT); auto batt = FileIO::readint(BATTERY_CAPACITY_CURRENT);
if (batt >= limit) { if (batt >= limit) {
if (kTookAction) if (kTookAction)
goto sleep; goto sleep;