Skip to content

Commit

Permalink
Merge branch 'cyg' into 'master'
Browse files Browse the repository at this point in the history
small fixes

See merge request medoc92/npupnp!74
  • Loading branch information
medoc92 committed Jan 3, 2024
2 parents fe668e3 + b900658 commit 8981fb5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/api/upnpapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,9 @@ static int getIfInfo(const char *IfNames)
if (!using_ipv6()) {
// Trim the ipv6 addresses
for (auto& netif : g_netifs) {
auto addrmasks = netif.getaddresses();
auto [addrs, _] = netif.getaddresses();
std::vector<NetIF::IPAddr> kept;
std::copy_if(addrmasks.first.begin(), addrmasks.first.end(),
std::copy_if(addrs.begin(), addrs.end(),
std::back_inserter(kept),
[](const NetIF::IPAddr &addr){
return addr.family() ==
Expand Down
2 changes: 1 addition & 1 deletion src/inc/TimerThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,5 @@ class TimerThread {
std::unique_ptr<Internal> m;
};

#endif /* TIMER_THREAD_H */
#endif /* TIMERTHREAD_H */

2 changes: 1 addition & 1 deletion src/inc/service_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,5 +264,5 @@ int initServiceTable(

#endif /* INCLUDE_DEVICE_APIS */

#endif /* SERVICE_TABLE */
#endif /* SERVICE_TABLE_H */

2 changes: 1 addition & 1 deletion src/inc/smallut.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ void catstrerror(std::string *reason, const char *what, int _errno);
time_t portable_timegm(struct tm *tm);

inline void leftzeropad(std::string &s, unsigned len) {
if (s.length() && s.length() < len) {
if (!s.empty() && s.length() < len) {
s = s.insert(0, len - s.length(), '0');
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/utils/smallut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ std::string breakIntoLines(const std::string& in, unsigned int ll, unsigned int
std::string query = in;
std::string oq;
unsigned int nlines = 0;
while (query.length() > 0) {
while (!query.empty()) {
std::string ss = query.substr(0, ll);
if (ss.length() == ll) {
std::string::size_type pos = ss.find_last_of(' ');
Expand All @@ -781,7 +781,7 @@ std::string breakIntoLines(const std::string& in, unsigned int ll, unsigned int
}
}
// This cant happen, but anyway. Be very sure to avoid an infinite loop
if (ss.length() == 0) {
if (ss.empty()) {
oq = query;
break;
}
Expand All @@ -800,7 +800,7 @@ static bool parsedate(std::vector<std::string>::const_iterator& it,
std::vector<std::string>::const_iterator end, DateInterval *dip)
{
dip->y1 = dip->m1 = dip->d1 = dip->y2 = dip->m2 = dip->d2 = 0;
if (it->length() > 4 || !it->length() ||
if (it->length() > 4 || it->empty() ||
it->find_first_not_of("0123456789") != std::string::npos) {
return false;
}
Expand All @@ -814,7 +814,7 @@ static bool parsedate(std::vector<std::string>::const_iterator& it,
return false;
}

if (it->length() > 2 || !it->length() ||
if (it->length() > 2 || it->empty() ||
it->find_first_not_of("0123456789") != std::string::npos) {
return false;
}
Expand All @@ -828,7 +828,7 @@ static bool parsedate(std::vector<std::string>::const_iterator& it,
return false;
}

if (it->length() > 2 || !it->length() ||
if (it->length() > 2 || it->empty() ||
it->find_first_not_of("0123456789") != std::string::npos) {
return false;
}
Expand Down Expand Up @@ -1320,7 +1320,7 @@ std::string flagsToString(const std::vector<CharFlags>& flags, unsigned int val)
}
if (s && *s) {
/* We have something to write */
if (out.length()) {
if (!out.empty()) {
// If not first, add '|' separator
out.append("|");
}
Expand Down

0 comments on commit 8981fb5

Please sign in to comment.