[Scummvm-git-logs] scummvm master -> e5bfe630872ea7097e31db12e13bf141d4a3a825

criezy criezy at scummvm.org
Thu Nov 5 23:52:29 UTC 2020


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

Summary:
f18ee89b27 JANITORIAL: Fix indentation issues
e5bfe63087 COMMON: Merge the String and U32String destructors


Commit: f18ee89b274399e8e2b91665fdab8b47bcf9f46e
    https://github.com/scummvm/scummvm/commit/f18ee89b274399e8e2b91665fdab8b47bcf9f46e
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-11-05T23:52:19Z

Commit Message:
JANITORIAL: Fix indentation issues

Changed paths:
    common/base-str.cpp
    common/base-str.h
    common/ustr.h


diff --git a/common/base-str.cpp b/common/base-str.cpp
index 2439c2931a..581c65e0e8 100644
--- a/common/base-str.cpp
+++ b/common/base-str.cpp
@@ -542,7 +542,7 @@ TEMPLATE void BASESTRING::insertString(const value_type *s, uint32 p) {
 }
 
 TEMPLATE void BASESTRING::insertString(const BaseString &s, uint32 p) {
-    for (uint i = 0; i < s._size; i++) {
+	for (uint i = 0; i < s._size; i++) {
 		BaseString::insertChar(s[i], p+i);
 	}
 }
@@ -583,7 +583,7 @@ TEMPLATE uint32 BASESTRING::find(const BaseString &str, uint32 pos) const {
 }
 
 TEMPLATE size_t BASESTRING::find(const value_type *strP, uint32 pos) const {
-    	if (pos >= _size) {
+	if (pos >= _size) {
 		return npos;
 	}
 
@@ -699,7 +699,7 @@ TEMPLATE void BASESTRING::toLowercase() {
 TEMPLATE void BASESTRING::toUppercase() {
 	makeUnique();
 	for (uint32 i = 0; i < _size; ++i) {
-	    if (_str[i] > 0 && _str[i] < 128) {
+		if (_str[i] > 0 && _str[i] < 128) {
 			_str[i] = toupper(_str[i]);
 		}
 	}
@@ -740,7 +740,7 @@ TEMPLATE void BASESTRING::assignAppend(value_type c) {
 }
 
 TEMPLATE void BASESTRING::assignAppend(const BaseString &str) {
-    	if (&str == this) {
+	if (&str == this) {
 		assignAppend(BaseString(str));
 		return;
 	}
diff --git a/common/base-str.h b/common/base-str.h
index b3119322e2..f95faa4f7a 100644
--- a/common/base-str.h
+++ b/common/base-str.h
@@ -32,9 +32,9 @@ namespace Common {
 template<class T>
 class BaseString {
 public:
-    	static void releaseMemoryPoolMutex();
+	static void releaseMemoryPoolMutex();
 
-    	static const uint32 npos = 0xFFFFFFFF;
+	static const uint32 npos = 0xFFFFFFFF;
 	typedef T          value_type;
 	typedef T *        iterator;
 	typedef const T *  const_iterator;
@@ -119,7 +119,7 @@ public:
 	bool equalsC(const char *x) const;
 	int compareTo(const BaseString &x) const;           // strcmp clone
 	int compareTo(const value_type *x) const;             // strcmp clone
-    	int compareToC(const char *x) const;             // strcmp clone
+	int compareToC(const char *x) const;             // strcmp clone
 
 	/** Set character c at position p, replacing the previous character there. */
 	void setChar(value_type c, uint32 p);
@@ -165,7 +165,7 @@ public:
 		return begin() + size();
 	}
 
-    	inline const value_type *c_str() const { return _str; }
+	inline const value_type *c_str() const { return _str; }
 	inline uint size() const         { return _size; }
 
 	inline bool empty() const { return (_size == 0); }
@@ -185,16 +185,16 @@ public:
 
 	/** Insert character c before position p. */
 	void insertChar(value_type c, uint32 p);
-    	void insertString(const value_type *s, uint32 p);
+	void insertString(const value_type *s, uint32 p);
 	void insertString(const BaseString &s, uint32 p);
 
-    	/** Finds the index of a character in the string */
-    	uint32 find(value_type x, uint32 pos = 0) const;
-    	/** Does a find for the passed string */
+	/** Finds the index of a character in the string */
+	uint32 find(value_type x, uint32 pos = 0) const;
+	/** Does a find for the passed string */
 	size_t find(const value_type *s, uint32 pos = 0) const;
 	uint32 find(const BaseString &str, uint32 pos = 0) const;
 
-    	/**
+	/**
 	 * Wraps the text in the string to the given line maximum. Lines will be
 	 * broken at any whitespace character. New lines are assumed to be
 	 * represented using '\n'.
@@ -205,12 +205,12 @@ public:
 	 */
 	void wordWrap(const uint32 maxLength);
 
-    	/** Return uint64 corrensponding to String's contents. */
+	/** Return uint64 corrensponding to String's contents. */
 	uint64 asUint64() const;
 
-      	/** Return uint64 corrensponding to String's contents. This variant recognizes 0 (oct) and 0x (hex) prefixes. */
+	/** Return uint64 corrensponding to String's contents. This variant recognizes 0 (oct) and 0x (hex) prefixes. */
 	uint64 asUint64Ext() const;
-    
+
 	/**
 	 * Convert all characters in the string to lowercase.
 	 *
diff --git a/common/ustr.h b/common/ustr.h
index 76acc80fc0..c3cb5c6049 100644
--- a/common/ustr.h
+++ b/common/ustr.h
@@ -114,8 +114,8 @@ public:
 	bool operator!=(const String &x) const;
 	bool operator!=(const char *x) const;
 
-    /** Python-like method **/
-    String encode(CodePage page = kUtf8) const;
+	/** Python-like method **/
+	String encode(CodePage page = kUtf8) const;
 
 	/**
 	 * Print formatted data into a U32String object.
@@ -139,7 +139,7 @@ public:
 	void insertString(const char *s, uint32 p);
 	void insertString(const String &s, uint32 p);
 
-    	/** Return a substring of this string */
+	/** Return a substring of this string */
 	U32String substr(size_t pos = 0, size_t len = npos) const;
 
 	const uint32 *u32_str() const {


Commit: e5bfe630872ea7097e31db12e13bf141d4a3a825
    https://github.com/scummvm/scummvm/commit/e5bfe630872ea7097e31db12e13bf141d4a3a825
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-11-05T23:52:19Z

Commit Message:
COMMON: Merge the String and U32String destructors

The call to decRefCount has been moved to the destructor
of the base class BaseString.

Note that BaseString only exists for the purpose of being able
to reuse code for our String and U32String implementations. As
such it is not meant to be used polymorphically and its
destructor does not need to be virtual (with the overhead that
this generates). And to ensure that it is not used in a
polymorphic way, the destructor is declared protected.

Changed paths:
    common/base-str.cpp
    common/base-str.h
    common/str.cpp
    common/str.h
    common/ustr.cpp
    common/ustr.h


diff --git a/common/base-str.cpp b/common/base-str.cpp
index 581c65e0e8..2cb493144d 100644
--- a/common/base-str.cpp
+++ b/common/base-str.cpp
@@ -107,6 +107,10 @@ TEMPLATE BASESTRING::BaseString(const value_type *beginP, const value_type *endP
 	initWithValueTypeStr(beginP, endP - beginP);
 }
 
+TEMPLATE BASESTRING::~BaseString() {
+	decRefCount(_extern._refCount);
+}
+
 TEMPLATE void BASESTRING::makeUnique() {
 	ensureCapacity(_size, true);
 }
diff --git a/common/base-str.h b/common/base-str.h
index f95faa4f7a..cfb2b1a57d 100644
--- a/common/base-str.h
+++ b/common/base-str.h
@@ -236,6 +236,8 @@ public:
 	uint hash() const;
 
 protected:
+	~BaseString();
+
 	void makeUnique();
 	void ensureCapacity(uint32 new_size, bool keep_old);
 	void incRefCount() const;
diff --git a/common/str.cpp b/common/str.cpp
index be6a2c6e92..084551316b 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -46,10 +46,6 @@ String::String(const U32String &str)
 }
 #endif
 
-String::~String() {
-	decRefCount(_extern._refCount);
-}
-
 String &String::operator=(const char *str) {
 	assign(str);
 	return *this;
diff --git a/common/str.h b/common/str.h
index aa40bd6839..3b677af92a 100644
--- a/common/str.h
+++ b/common/str.h
@@ -87,8 +87,6 @@ public:
 	/** Construct a new string from the given u32 string. */
 	String(const U32String &str);
 
-	~String();
-
 	String &operator=(const char *str);
 	String &operator=(const String &str);
 	String &operator=(char c);
diff --git a/common/ustr.cpp b/common/ustr.cpp
index d7bda71dc3..76e1b6d1e8 100644
--- a/common/ustr.cpp
+++ b/common/ustr.cpp
@@ -54,10 +54,6 @@ U32String::U32String(const UnicodeBiDiText &txt) : BaseString<u32char_type_t>()
 	initWithValueTypeStr(txt.visual.c_str(), txt.visual.size());
 }
 
-U32String::~U32String() {
-	decRefCount(_extern._refCount);
-}
-
 U32String &U32String::operator=(const U32String &str) {
 	assign(str);
 	return *this;
diff --git a/common/ustr.h b/common/ustr.h
index c3cb5c6049..b7973bb862 100644
--- a/common/ustr.h
+++ b/common/ustr.h
@@ -99,8 +99,6 @@ public:
 	/** Construct a copy of the given string. */
 	U32String(const String &str);
 
-	~U32String();
-
 	U32String &operator=(const U32String &str);
 	U32String &operator=(const String &str);
 	U32String &operator=(const value_type *str);




More information about the Scummvm-git-logs mailing list