neighbor/smbclient: add `noexcept`

This commit is contained in:
Max Kellermann 2019-04-16 20:05:01 +02:00
parent 2e80477218
commit aa5c5bf14f
1 changed files with 12 additions and 12 deletions

View File

@ -39,7 +39,7 @@ class SmbclientNeighborExplorer final : public NeighborExplorer {
struct Server { struct Server {
const std::string name, comment; const std::string name, comment;
Server(std::string &&_name, std::string &&_comment) Server(std::string &&_name, std::string &&_comment) noexcept
:name(std::move(_name)), :name(std::move(_name)),
comment(std::move(_comment)) {} comment(std::move(_comment)) {}
@ -66,7 +66,7 @@ class SmbclientNeighborExplorer final : public NeighborExplorer {
bool quit; bool quit;
public: public:
SmbclientNeighborExplorer(NeighborListener &_listener) SmbclientNeighborExplorer(NeighborListener &_listener) noexcept
:NeighborExplorer(_listener), :NeighborExplorer(_listener),
thread(BIND_THIS_METHOD(ThreadFunc)) {} thread(BIND_THIS_METHOD(ThreadFunc)) {}
@ -76,8 +76,8 @@ public:
List GetList() const noexcept override; List GetList() const noexcept override;
private: private:
void Run(); void Run() noexcept;
void ThreadFunc(); void ThreadFunc() noexcept;
}; };
void void
@ -111,7 +111,7 @@ SmbclientNeighborExplorer::GetList() const noexcept
} }
static void static void
ReadServer(NeighborExplorer::List &list, const smbc_dirent &e) ReadServer(NeighborExplorer::List &list, const smbc_dirent &e) noexcept
{ {
const std::string name(e.name, e.namelen); const std::string name(e.name, e.namelen);
const std::string comment(e.comment, e.commentlen); const std::string comment(e.comment, e.commentlen);
@ -120,17 +120,17 @@ ReadServer(NeighborExplorer::List &list, const smbc_dirent &e)
} }
static void static void
ReadServers(NeighborExplorer::List &list, const char *uri); ReadServers(NeighborExplorer::List &list, const char *uri) noexcept;
static void static void
ReadWorkgroup(NeighborExplorer::List &list, const std::string &name) ReadWorkgroup(NeighborExplorer::List &list, const std::string &name) noexcept
{ {
std::string uri = "smb://" + name; std::string uri = "smb://" + name;
ReadServers(list, uri.c_str()); ReadServers(list, uri.c_str());
} }
static void static void
ReadEntry(NeighborExplorer::List &list, const smbc_dirent &e) ReadEntry(NeighborExplorer::List &list, const smbc_dirent &e) noexcept
{ {
switch (e.smbc_type) { switch (e.smbc_type) {
case SMBC_WORKGROUP: case SMBC_WORKGROUP:
@ -144,7 +144,7 @@ ReadEntry(NeighborExplorer::List &list, const smbc_dirent &e)
} }
static void static void
ReadServers(NeighborExplorer::List &list, int fd) ReadServers(NeighborExplorer::List &list, int fd) noexcept
{ {
smbc_dirent *e; smbc_dirent *e;
while ((e = smbc_readdir(fd)) != nullptr) while ((e = smbc_readdir(fd)) != nullptr)
@ -154,7 +154,7 @@ ReadServers(NeighborExplorer::List &list, int fd)
} }
static void static void
ReadServers(NeighborExplorer::List &list, const char *uri) ReadServers(NeighborExplorer::List &list, const char *uri) noexcept
{ {
int fd = smbc_opendir(uri); int fd = smbc_opendir(uri);
if (fd >= 0) { if (fd >= 0) {
@ -189,7 +189,7 @@ FindBeforeServerByURI(NeighborExplorer::List::const_iterator prev,
} }
inline void inline void
SmbclientNeighborExplorer::Run() SmbclientNeighborExplorer::Run() noexcept
{ {
List found = DetectServers(), lost; List found = DetectServers(), lost;
@ -228,7 +228,7 @@ SmbclientNeighborExplorer::Run()
} }
inline void inline void
SmbclientNeighborExplorer::ThreadFunc() SmbclientNeighborExplorer::ThreadFunc() noexcept
{ {
SetThreadName("smbclient"); SetThreadName("smbclient");