[Scummvm-git-logs] scummvm master -> 51bcbd2fa42c0dd722e51ceecbb5937152ca7a76

digitall 547637+digitall at users.noreply.github.com
Mon Mar 15 13:25:42 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
51bcbd2fa4 MOHAWK: Fix Clang warning


Commit: 51bcbd2fa42c0dd722e51ceecbb5937152ca7a76
    https://github.com/scummvm/scummvm/commit/51bcbd2fa42c0dd722e51ceecbb5937152ca7a76
Author: Orgad Shaneh (orgads at gmail.com)
Date: 2021-03-15T13:25:40Z

Commit Message:
MOHAWK: Fix Clang warning

warning: definition of implicit copy assignment operator for 'LBValue' is deprecated because it has a user-declared copy constructor

Changed paths:
    engines/mohawk/livingbooks_code.cpp
    engines/mohawk/livingbooks_code.h


diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp
index 85aef77562..5f64c7c07e 100644
--- a/engines/mohawk/livingbooks_code.cpp
+++ b/engines/mohawk/livingbooks_code.cpp
@@ -30,6 +30,42 @@
 
 namespace Mohawk {
 
+LBValue &LBValue::operator=(const LBValue &other)
+{
+	if (type != other.type) {
+		switch (type) {
+		case kLBValueString:
+			string.clear();
+			break;
+		case kLBValueInteger:
+			integer = 0;
+			break;
+		case kLBValueReal:
+			real = 0.0;
+			break;
+		case kLBValuePoint:
+			point = Common::Point();
+			break;
+		case kLBValueRect:
+			rect = Common::Rect();
+			break;
+		case kLBValueItemPtr:
+			item = nullptr;
+			break;
+		case kLBValueLBX:
+			lbx.reset();
+			break;
+		case kLBValueList:
+			list.reset();
+			break;
+		default:
+			break;
+		}
+	}
+	copy(other);
+	return *this;
+}
+
 bool LBValue::operator==(const LBValue &x) const {
 	if (type != x.type) {
 		if (isNumeric() && x.isNumeric())
diff --git a/engines/mohawk/livingbooks_code.h b/engines/mohawk/livingbooks_code.h
index 16005e1da8..478b007a8f 100644
--- a/engines/mohawk/livingbooks_code.h
+++ b/engines/mohawk/livingbooks_code.h
@@ -80,6 +80,10 @@ struct LBValue {
 		list = l;
 	}
 	LBValue(const LBValue &val) {
+		copy(val);
+	}
+
+	void copy(const LBValue &val) {
 		type = val.type;
 		switch (type) {
 		case kLBValueString:
@@ -111,6 +115,8 @@ struct LBValue {
 		}
 	}
 
+	LBValue &operator=(const LBValue &other);
+
 	LBValueType type;
 	Common::String string;
 	int integer;




More information about the Scummvm-git-logs mailing list