From 28bb30024b5011c0b709a0095cce9b397b803d28 Mon Sep 17 00:00:00 2001 From: faker Date: Fri, 29 Dec 2023 15:29:56 +0800 Subject: [PATCH] Fix some compiler warning --- common/simple_dom.cpp | 8 ++++---- common/simple_dom_impl.h | 5 ++--- fs/subfs.cpp | 16 ++++++++-------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/common/simple_dom.cpp b/common/simple_dom.cpp index 8830b350..7f10ecb5 100644 --- a/common/simple_dom.cpp +++ b/common/simple_dom.cpp @@ -20,19 +20,19 @@ static NodeImpl* parse_json(char* text, size_t size, int flags) { Reader reader; reader.Parse(stream(text), handler); */ - return {nullptr}; + return nullptr; } static NodeImpl* parse_xml(char* text, size_t size, int flags) { - return {nullptr}; + return nullptr; } static NodeImpl* parse_yaml(char* text, size_t size, int flags) { - return {nullptr}; + return nullptr; } static NodeImpl* parse_ini(char* text, size_t size, int flags) { - return {nullptr}; + return nullptr; } Node parse(char* text, size_t size, int flags) { diff --git a/common/simple_dom_impl.h b/common/simple_dom_impl.h index 120afe2c..5655ab5e 100644 --- a/common/simple_dom_impl.h +++ b/common/simple_dom_impl.h @@ -32,12 +32,11 @@ namespace SimpleDOM { using str = estring_view; -struct Node; // the interface for internal implementations class NodeImpl : public Object { protected: - NodeImpl() = default; + NodeImpl() = delete; NodeImpl* _root; union { NodeImpl* _next; @@ -60,7 +59,7 @@ union { delete this; } - friend struct Node; + friend class Node; public: virtual size_t num_children() const __attribute__((pure)) = 0; diff --git a/fs/subfs.cpp b/fs/subfs.cpp index 102037f0..ab30c89b 100644 --- a/fs/subfs.cpp +++ b/fs/subfs.cpp @@ -231,56 +231,56 @@ namespace fs return underlayfs->mknod(path, mode, dev); } - virtual ssize_t getxattr(const char *path, const char *name, void *value, size_t size) + virtual ssize_t getxattr(const char *path, const char *name, void *value, size_t size) override { if (!underlay_xattrfs) LOG_ERROR_RETURN(ENOTSUP, -1, "xattr is not supported by underlay fs"); PathCat __(this, path); return underlay_xattrfs->getxattr(path, name, value, size); } - virtual ssize_t lgetxattr(const char *path, const char *name, void *value, size_t size) + virtual ssize_t lgetxattr(const char *path, const char *name, void *value, size_t size) override { if (!underlay_xattrfs) LOG_ERROR_RETURN(ENOTSUP, -1, "xattr is not supported by underlay fs"); PathCat __(this, path); return underlay_xattrfs->lgetxattr(path, name, value, size); } - virtual ssize_t listxattr(const char *path, char *list, size_t size) + virtual ssize_t listxattr(const char *path, char *list, size_t size) override { if (!underlay_xattrfs) LOG_ERROR_RETURN(ENOTSUP, -1, "xattr is not supported by underlay fs"); PathCat __(this, path); return underlay_xattrfs->listxattr(path, list, size); } - virtual ssize_t llistxattr(const char *path, char *list, size_t size) + virtual ssize_t llistxattr(const char *path, char *list, size_t size) override { if (!underlay_xattrfs) LOG_ERROR_RETURN(ENOTSUP, -1, "xattr is not supported by underlay fs"); PathCat __(this, path); return underlay_xattrfs->llistxattr(path, list, size); } - virtual int setxattr(const char *path, const char *name, const void *value, size_t size, int flags) + virtual int setxattr(const char *path, const char *name, const void *value, size_t size, int flags) override { if (!underlay_xattrfs) LOG_ERROR_RETURN(ENOTSUP, -1, "xattr is not supported by underlay fs"); PathCat __(this, path); return underlay_xattrfs->setxattr(path, name, value, size, flags); } - virtual int lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags) + virtual int lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags) override { if (!underlay_xattrfs) LOG_ERROR_RETURN(ENOTSUP, -1, "xattr is not supported by underlay fs"); PathCat __(this, path); return underlay_xattrfs->lsetxattr(path, name, value, size, flags); } - virtual int removexattr(const char *path, const char *name) + virtual int removexattr(const char *path, const char *name) override { if (!underlay_xattrfs) LOG_ERROR_RETURN(ENOTSUP, -1, "xattr is not supported by underlay fs"); PathCat __(this, path); return underlay_xattrfs->removexattr(path, name); } - virtual int lremovexattr(const char *path, const char *name) + virtual int lremovexattr(const char *path, const char *name) override { if (!underlay_xattrfs) LOG_ERROR_RETURN(ENOTSUP, -1, "xattr is not supported by underlay fs");