@@ -34,7 +34,7 @@ index 3cfc92533..9c487ac45 100644
3434
3535 #ifdef ANDROID
3636 # include <android/log.h>
37- + #elif defined(OHOS )
37+ + #elif defined(XP_OHOS )
3838+ # include <hilog/log.h>
3939 #endif
4040 #ifdef MOZ_WIDGET_ANDROID
@@ -46,7 +46,7 @@ index 3cfc92533..9c487ac45 100644
4646- #ifndef ANDROID
4747+ #ifdef ANDROID
4848+ __android_log_print(ANDROID_LOG_ERROR, "Gecko", "mozalloc_abort: %s", msg);
49- + #elif defined(OHOS )
49+ + #elif defined(XP_OHOS )
5050+ (void) OH_LOG_Print(LOG_APP, LOG_ERROR, 0, "Gecko",
5151+ "mozalloc_abort: %{public}s\n", msg);
5252+ #else
@@ -65,7 +65,7 @@ index 0b7395177..e84d76aba 100644
6565 #endif
6666 #ifdef ANDROID
6767 # include <android/log.h>
68- + #elif defined(OHOS )
68+ + #elif defined(XP_OHOS )
6969+ # include <hilog/log.h>
7070 #endif
7171
@@ -74,7 +74,7 @@ index 0b7395177..e84d76aba 100644
7474 MozWalkTheStackWithWriter(MOZ_ReportAssertionFailurePrintFrame, CallerPC(),
7575 /* aMaxFrames */ 0);
7676 # endif
77- + #elif defined(OHOS )
77+ + #elif defined(XP_OHOS )
7878+ (void) OH_LOG_Print(LOG_APP, LOG_FATAL, 0, "MOZ_Assert",
7979+ "Assertion failure: %{public}s, at %{public}s:%{public}d\n",
8080+ aStr, aFilename, aLine);
@@ -85,7 +85,7 @@ index 0b7395177..e84d76aba 100644
8585 __android_log_print(ANDROID_LOG_FATAL, "MOZ_CRASH",
8686 "[%d] Hit MOZ_CRASH(%s) at %s:%d\n", MOZ_GET_PID(), aStr,
8787 aFilename, aLine);
88- + #elif defined(OHOS )
88+ + #elif defined(XP_OHOS )
8989+ (void) OH_LOG_Print(LOG_APP, LOG_FATAL, 0, "MOZ_CRASH",
9090+ "Hit MOZ_CRASH(%{public}s), at %{public}s:%{public}d\n",
9191+ aStr, aFilename, aLine);
@@ -103,7 +103,7 @@ index 3247b993c..c7039d5f8 100644
103103- #ifdef ANDROID
104104+ #if defined(ANDROID)
105105 # include <android/log.h>
106- + #elif defined(OHOS )
106+ + #elif defined(XP_OHOS )
107107+ # include <hilog/log.h>
108108 #endif
109109
@@ -115,7 +115,7 @@ index 3247b993c..c7039d5f8 100644
115115- #ifdef ANDROID
116116+ #if defined(ANDROID)
117117 __android_log_print(ANDROID_LOG_INFO, "Gecko", "%s", s.str().c_str());
118- + #elif defined(OHOS )
118+ + #elif defined(XP_OHOS )
119119+ (void) OH_LOG_Print(LOG_APP, LOG_INFO, 0, "Gecko", "%{public}s\n", s.str().c_str());
120120 #else
121121 fputs(s.str().c_str(), stderr);
@@ -128,20 +128,20 @@ index c3a2ca89e..3fea33f4b 100644
128128
129129 #ifdef ANDROID
130130 # include <android/log.h>
131- + #elif defined(OHOS )
131+ + #elif defined(XP_OHOS )
132132+ # include <hilog/log.h>
133133 #endif
134134
135135- #ifndef ANDROID
136- + #if ! (defined(ANDROID) || defined(OHOS ))
136+ + #if ! (defined(ANDROID) || defined(XP_OHOS ))
137137 static void vprintf_stderr_buffered(const char* aFmt, va_list aArgs) {
138138 // Avoid interleaving by writing to an on-stack buffer and then writing in one
139139 // go with fputs, as long as the output fits into the buffer.
140140@@ -66,6 +68,10 @@ MFBT_API void vprintf_stderr(const char* aFmt, va_list aArgs) {
141141 MFBT_API void vprintf_stderr(const char* aFmt, va_list aArgs) {
142142 __android_log_vprint(ANDROID_LOG_INFO, "Gecko", aFmt, aArgs);
143143 }
144- + #elif defined(OHOS )
144+ + #elif defined(XP_OHOS )
145145+ MFBT_API void vprintf_stderr(const char* aFmt, va_list aArgs) {
146146+ (void) OH_LOG_Print(LOG_APP, LOG_INFO, 0, "Gecko", aFmt, aArgs);
147147+ }
@@ -153,7 +153,7 @@ index c3a2ca89e..3fea33f4b 100644
153153
154154 MFBT_API void print_stderr(std::stringstream& aStr) {
155155- #if defined(ANDROID)
156- + #if defined(ANDROID) || defined(OHOS )
156+ + #if defined(ANDROID) || defined(XP_OHOS )
157157 // On Android logcat output is truncated to 1024 chars per line, and
158158 // we usually use std::stringstream to build up giant multi-line gobs
159159 // of output. So to avoid the truncation we find the newlines and
@@ -179,7 +179,7 @@ index 52bd6abc5..781402d56 100644
179179- #ifdef ANDROID
180180+ #if defined(ANDROID)
181181 # include <android/log.h>
182- + #elif defined(OHOS )
182+ + #elif defined(XP_OHOS )
183183+ # include <hilog/log.h>
184184 #endif
185185
@@ -188,7 +188,7 @@ index 52bd6abc5..781402d56 100644
188188 PR_Write(fd, buf, nb); \
189189 } \
190190 PR_END_MACRO
191- + #elif defined(OHOS )
191+ + #elif defined(XP_OHOS )
192192+ #define _PUT_LOG(fd, buf, nb) \
193193+ PR_BEGIN_MACRO \
194194+ if (fd == _pr_stderr) { \
@@ -208,7 +208,7 @@ index 52bd6abc5..781402d56 100644
208208 PR_LogPrint("Aborting");
209209 #ifdef ANDROID
210210 __android_log_write(ANDROID_LOG_ERROR, "PRLog", "Aborting");
211- + #elif defined(OHOS )
211+ + #elif defined(XP_OHOS )
212212+ (void) OH_LOG_Print(LOG_APP, LOG_ERROR, 0, "PRLog", "Aborting\n");
213213 #endif
214214 abort();
@@ -217,7 +217,7 @@ index 52bd6abc5..781402d56 100644
217217 #elif defined(ANDROID)
218218 __android_log_assert(NULL, "PRLog", "Assertion failure: %s, at %s:%d\n", s,
219219 file, ln);
220- + #elif defined(OHOS )
220+ + #elif defined(XP_OHOS )
221221+ (void) OH_LOG_Print(LOG_APP, LOG_ERROR, 0, "PRLog",
222222+ "Assertion failure: %{public}s, at %{public}s:%{public}d\n",s, file, ln);
223223 #endif
0 commit comments