Merge pull request #2523 from jpark37/warnings-20200319

Warning pass 2020-03-19
master
Jim 2020-03-20 19:02:19 -07:00 committed by GitHub
commit 0be6208839
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 8 deletions

View File

@ -38,6 +38,7 @@ typedef std::vector<std::string> OBSImporterFiles;
class Importer { class Importer {
public: public:
virtual ~Importer() {}
virtual std::string Prog() { return "Null"; }; virtual std::string Prog() { return "Null"; };
virtual int ImportScenes(const std::string &path, std::string &name, virtual int ImportScenes(const std::string &path, std::string &name,
json11::Json &res) = 0; json11::Json &res) = 0;

View File

@ -2600,12 +2600,13 @@ static inline void copy_frame_data_plane(struct obs_source_frame *dst,
const struct obs_source_frame *src, const struct obs_source_frame *src,
uint32_t plane, uint32_t lines) uint32_t plane, uint32_t lines)
{ {
if (dst->linesize[plane] != src->linesize[plane]) if (dst->linesize[plane] != src->linesize[plane]) {
for (uint32_t y = 0; y < lines; y++) for (uint32_t y = 0; y < lines; y++)
copy_frame_data_line(dst, src, plane, y); copy_frame_data_line(dst, src, plane, y);
else } else {
memcpy(dst->data[plane], src->data[plane], memcpy(dst->data[plane], src->data[plane],
dst->linesize[plane] * lines); (size_t)dst->linesize[plane] * (size_t)lines);
}
} }
static void copy_frame_data(struct obs_source_frame *dst, static void copy_frame_data(struct obs_source_frame *dst,

View File

@ -236,7 +236,7 @@ public:
} }
OBSSignal(const OBSSignal &) = delete; OBSSignal(const OBSSignal &) = delete;
OBSSignal(OBSSignal &&other) OBSSignal(OBSSignal &&other) noexcept
: handler(other.handler), : handler(other.handler),
signal(other.signal), signal(other.signal),
callback(other.callback), callback(other.callback),
@ -249,7 +249,7 @@ public:
} }
OBSSignal &operator=(const OBSSignal &) = delete; OBSSignal &operator=(const OBSSignal &) = delete;
OBSSignal &operator=(OBSSignal &&other) OBSSignal &operator=(OBSSignal &&other) noexcept
{ {
Disconnect(); Disconnect();

View File

@ -20,6 +20,7 @@
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include <utility>
#include "bmem.h" #include "bmem.h"
#include "config-file.h" #include "config-file.h"
@ -36,7 +37,7 @@ template<typename T> class BPtr {
public: public:
inline BPtr(T *p = nullptr) : ptr(p) {} inline BPtr(T *p = nullptr) : ptr(p) {}
inline BPtr(BPtr &&other) : ptr(other.ptr) { other.ptr = nullptr; } inline BPtr(BPtr &&other) { *this = std::move(other); }
inline ~BPtr() { bfree(ptr); } inline ~BPtr() { bfree(ptr); }
inline T *operator=(T *p) inline T *operator=(T *p)
@ -45,6 +46,14 @@ public:
ptr = p; ptr = p;
return p; return p;
} }
inline BPtr &operator=(BPtr &&other)
{
ptr = other.ptr;
other.ptr = nullptr;
return *this;
}
inline operator T *() { return ptr; } inline operator T *() { return ptr; }
inline T **operator&() inline T **operator&()
{ {
@ -68,7 +77,7 @@ class ConfigFile {
public: public:
inline ConfigFile() : config(NULL) {} inline ConfigFile() : config(NULL) {}
inline ConfigFile(ConfigFile &&other) : config(other.config) inline ConfigFile(ConfigFile &&other) noexcept : config(other.config)
{ {
other.config = nullptr; other.config = nullptr;
} }
@ -120,7 +129,7 @@ class TextLookup {
public: public:
inline TextLookup(lookup_t *lookup = nullptr) : lookup(lookup) {} inline TextLookup(lookup_t *lookup = nullptr) : lookup(lookup) {}
inline TextLookup(TextLookup &&other) : lookup(other.lookup) inline TextLookup(TextLookup &&other) noexcept : lookup(other.lookup)
{ {
other.lookup = nullptr; other.lookup = nullptr;
} }

View File

@ -39,6 +39,7 @@ public:
{ {
Clear(); Clear();
ptr = val; ptr = val;
return *this;
} }
inline T **operator&() inline T **operator&()