Skip to content

Commit 39ad463

Browse files
committed
Web: Fix crash when built with dlink_enabled=yes
1 parent 4e6451d commit 39ad463

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

drivers/unix/os_unix.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ Dictionary OS_Unix::get_memory_info() const {
580580
return meminfo;
581581
}
582582

583-
#ifndef __GLIBC__
583+
#if !defined(__GLIBC__) && !defined(WEB_ENABLED)
584584
void OS_Unix::_load_iconv() {
585585
#if defined(MACOS_ENABLED) || defined(IOS_ENABLED)
586586
String iconv_lib_aliases[] = { "/usr/lib/libiconv.2.dylib" };
@@ -632,7 +632,7 @@ String OS_Unix::multibyte_to_string(const String &p_encoding, const PackedByteAr
632632
ERR_FAIL_COND_V_MSG(!_iconv_ok, String(), "Conversion failed: Unable to load libiconv");
633633

634634
LocalVector<char> chars;
635-
#ifdef __GLIBC__
635+
#if defined(__GLIBC__) || defined(WEB_ENABLED)
636636
gd_iconv_t ctx = gd_iconv_open("UTF-8", p_encoding.is_empty() ? nl_langinfo(CODESET) : p_encoding.utf8().get_data());
637637
#else
638638
gd_iconv_t ctx = gd_iconv_open("UTF-8", p_encoding.is_empty() ? gd_locale_charset() : p_encoding.utf8().get_data());
@@ -669,7 +669,7 @@ PackedByteArray OS_Unix::string_to_multibyte(const String &p_encoding, const Str
669669
CharString charstr = p_string.utf8();
670670

671671
PackedByteArray ret;
672-
#ifdef __GLIBC__
672+
#if defined(__GLIBC__) || defined(WEB_ENABLED)
673673
gd_iconv_t ctx = gd_iconv_open(p_encoding.is_empty() ? nl_langinfo(CODESET) : p_encoding.utf8().get_data(), "UTF-8");
674674
#else
675675
gd_iconv_t ctx = gd_iconv_open(p_encoding.is_empty() ? gd_locale_charset() : p_encoding.utf8().get_data(), "UTF-8");
@@ -1236,7 +1236,7 @@ void UnixTerminalLogger::log_error(const char *p_function, const char *p_file, i
12361236
UnixTerminalLogger::~UnixTerminalLogger() {}
12371237

12381238
OS_Unix::OS_Unix() {
1239-
#ifndef __GLIBC__
1239+
#if !defined(__GLIBC__) && !defined(WEB_ENABLED)
12401240
_load_iconv();
12411241
#endif
12421242

drivers/unix/os_unix.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include "core/os/os.h"
3636
#include "drivers/unix/ip_unix.h"
3737

38-
#ifdef __GLIBC__
38+
#if defined(__GLIBC__) || defined(WEB_ENABLED)
3939
#include <iconv.h>
4040
#include <langinfo.h>
4141
#define gd_iconv_t iconv_t
@@ -58,7 +58,7 @@ class OS_Unix : public OS {
5858
HashMap<ProcessID, ProcessInfo> *process_map = nullptr;
5959
Mutex process_map_mutex;
6060

61-
#ifdef __GLIBC__
61+
#if defined(__GLIBC__) || defined(WEB_ENABLED)
6262
bool _iconv_ok = true;
6363
#else
6464
bool _iconv_ok = false;

0 commit comments

Comments
 (0)