Skip to content

Commit a016458

Browse files
committed
revert change for str_tolower/str_toupper
need to sstop messing around these functions
1 parent 31823d1 commit a016458

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

include/util.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ std::string which(const std::string& command);
6666
bool read_binary_file(std::ifstream& f, std::string& ret);
6767
void replace_str(std::string& str, const std::string_view from, const std::string_view to);
6868
bool read_exec(std::vector<const char*> cmd, std::string& output, bool useStdErr = false, bool noerror_print = true);
69-
std::string str_tolower(std::string_view str);
70-
std::string str_toupper(std::string_view str);
69+
std::string str_tolower(std::string str);
70+
std::string str_toupper(std::string str);
7171
void strip(std::string& input);
7272
std::string read_by_syspath(const std::string_view path);
7373
fmt::rgb hexStringToColor(const std::string_view hexstr);

src/util.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,20 +350,20 @@ bool read_exec(std::vector<const char*> cmd, std::string& output, bool useStdErr
350350
return false;
351351
}
352352

353-
std::string str_tolower(std::string_view str)
353+
std::string str_tolower(std::string str)
354354
{
355-
for (char x : str)
355+
for (char& x : str)
356356
x = std::tolower(x);
357357

358-
return str.data();
358+
return str;
359359
}
360360

361-
std::string str_toupper(std::string_view str)
361+
std::string str_toupper(std::string str)
362362
{
363-
for (char x : str)
363+
for (char& x : str)
364364
x = std::toupper(x);
365365

366-
return str.data();
366+
return str;
367367
}
368368

369369
// Function to perform binary search on the pci vendors array to find a device from a vendor.

0 commit comments

Comments
 (0)