[Scummvm-git-logs] scummvm master -> 75833aba29db0c7be53d9dcb074aced636f97109

bluegr bluegr at gmail.com
Mon Mar 15 14:29:30 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:
75833aba29 COMMON: Don't use unavailable macros in unicode-bidi.h


Commit: 75833aba29db0c7be53d9dcb074aced636f97109
    https://github.com/scummvm/scummvm/commit/75833aba29db0c7be53d9dcb074aced636f97109
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2021-03-15T16:29:28+02:00

Commit Message:
COMMON: Don't use unavailable macros in unicode-bidi.h

Use Fribidi ones directly in implementation and tag the constructor as
"private"
Fix a warning on Common::CodePage

Changed paths:
    common/unicode-bidi.cpp
    common/unicode-bidi.h


diff --git a/common/unicode-bidi.cpp b/common/unicode-bidi.cpp
index 86a8d2ab8a..c09fa46595 100644
--- a/common/unicode-bidi.cpp
+++ b/common/unicode-bidi.cpp
@@ -26,6 +26,11 @@
 
 #ifdef USE_FRIBIDI
 #include <fribidi/fribidi.h>
+#else
+/* This constant is used below in common code
+ * fake it here to lighten code
+ */
+#define FRIBIDI_PAR_ON 0
 #endif
 
 namespace Common {
@@ -107,13 +112,15 @@ void UnicodeBiDiText::initWithU32String(const U32String &input) {
 }
 
 Common::String bidiByLineHelper(Common::String line, va_list args) {
-	Common::CodePage page = va_arg(args, Common::CodePage);
+	/* Common::CodePage is int
+	 * GCC warns that using Common::CodePage in va_arg would abort program */
+	Common::CodePage page = (Common::CodePage) va_arg(args, int);
 	uint32 *pbase_dir = va_arg(args, uint32*);
 	return UnicodeBiDiText(line, page, pbase_dir).visual.encode(page);
 }
 
 String convertBiDiStringByLines(const String &input, const Common::CodePage page) {
-	uint32 pbase_dir = SCUMMVM_FRIBIDI_PAR_ON;
+	uint32 pbase_dir = FRIBIDI_PAR_ON;
 	return input.forEachLine(bidiByLineHelper, page, &pbase_dir);
 }
 
diff --git a/common/unicode-bidi.h b/common/unicode-bidi.h
index 2b50d56f3f..052cb7b3bb 100644
--- a/common/unicode-bidi.h
+++ b/common/unicode-bidi.h
@@ -27,21 +27,6 @@
 #include "common/ustr.h"
 #include "common/language.h"
 
-
-// SCUMMVM_FRIBIDI_PAR_ON: automatically check the text's direction
-// SCUMMVM_FRIBIDI_PAR_LTR, SCUMMVM_FRIBIDI_PAR_RTL: enforce LTR or RTL direction
-// if not USE_FRIBIDI, these defines values don't matter
-#ifdef USE_FRIBIDI
-#define SCUMMVM_FRIBIDI_PAR_ON			FRIBIDI_PAR_ON
-#define SCUMMVM_FRIBIDI_PAR_LTR			FRIBIDI_PAR_LTR
-#define SCUMMVM_FRIBIDI_PAR_RTL			FRIBIDI_PAR_RTL
-#else
-#define SCUMMVM_FRIBIDI_PAR_ON			0
-#define SCUMMVM_FRIBIDI_PAR_LTR			0
-#define SCUMMVM_FRIBIDI_PAR_RTL			0
-#endif
-
-
 namespace Common {
 
 class UnicodeBiDiText {
@@ -57,6 +42,7 @@ public:
 
 	UnicodeBiDiText(const Common::U32String &str);
 	UnicodeBiDiText(const Common::String &str, const Common::CodePage page);
+	/* This constructor shouldn't be used outside of unicode-bidi.cpp file */
 	UnicodeBiDiText(const Common::String &str, const Common::CodePage page, uint32 *pbase_dir);
 	~UnicodeBiDiText();
 




More information about the Scummvm-git-logs mailing list