Skip to content

Commit a996e73

Browse files
committed
[WIP] Implement requested changes
1 parent 060ba0e commit a996e73

File tree

8 files changed

+17
-29
lines changed

8 files changed

+17
-29
lines changed

ThirdPartyNotices.txt

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ The attached notices are provided for information only.
1414
1. android/platform/tools/base (https://android.googlesource.com/platform/tools/base/+/d41d662dbf89f9b60ca6256415a059c0107749b8/sdk-common/NOTICE)
1515
2. bazelbuild/bazel (https://github.com/bazelbuild/bazel/)
1616
3. force-net/crc32.net (https://github.com/force-net/Crc32.NET)
17-
4. google/bionic (https://android.googlesource.com/platform/bionic/)
18-
5. nunit/nunitlite (https://github.com/nunit/nunitlite/)
19-
6. tessil/robin-map (https://github.com/Tessil/robin-map)
17+
4. nunit/nunitlite (https://github.com/nunit/nunitlite/)
18+
5. tessil/robin-map (https://github.com/Tessil/robin-map)
2019

2120
%% android/platform/tools/base NOTICES AND INFORMATION BEGIN HERE
2221
=================================================================
@@ -462,26 +461,6 @@ SOFTWARE.
462461
=========================================================
463462
END OF force-net/crc32.net NOTICES AND INFORMATION
464463

465-
%% google/bionic NOTICES AND INFORMATION BEGIN HERE
466-
===================================================
467-
Copyright (C) 2006 The Android Open Source Project
468-
469-
Licensed under the Apache License, Version 2.0 (the "License");
470-
you may not use this file except in compliance with the License.
471-
You may obtain a copy of the License at
472-
473-
http://www.apache.org/licenses/LICENSE-2.0
474-
475-
Unless required by applicable law or agreed to in writing, software
476-
distributed under the License is distributed on an "AS IS" BASIS,
477-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
478-
See the License for the specific language governing permissions and
479-
limitations under the License.
480-
481-
482-
===================================================
483-
END OF google/bionic NOTICES AND INFORMATION
484-
485464
%% nunit/nunitlite NOTICES AND INFORMATION BEGIN HERE
486465
=====================================================
487466
Copyright (c) 2004-2013 Charlie Poole

build-tools/xaprepare/xaprepare/ThirdPartyNotices/bionic.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ You may obtain a copy of the License at
2626
limitations under the License.
2727
";
2828

29-
public override bool Include (bool includeExternalDeps, bool includeBuildDeps) => includeBuildDeps;
29+
public override bool Include (bool includeExternalDeps, bool includeBuildDeps) => includeExternalDeps;
3030
}
3131
}
File renamed without changes.
File renamed without changes.

src/monodroid/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ endif()
115115
set(EXTERNAL_DIR "../../external")
116116
set(JAVA_INTEROP_SRC_PATH "${EXTERNAL_DIR}/Java.Interop/src/java-interop")
117117
set(SOURCES_DIR ${CMAKE_SOURCE_DIR}/jni)
118+
set(BIONIC_SOURCES_DIR "../../src-ThirdParty/bionic")
118119
set(LZ4_SRC_DIR "${EXTERNAL_DIR}/lz4/lib")
119120
set(LZ4_INCLUDE_DIR ${LZ4_SRC_DIR})
120121
set(XA_BIN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/${XA_BUILD_CONFIGURATION}")
@@ -459,7 +460,7 @@ if(ANDROID)
459460

460461
if(NOT USES_LIBSTDCPP)
461462
list(APPEND XAMARIN_MONODROID_SOURCES
462-
${SOURCES_DIR}/cxx-abi/cxa_guard.cc
463+
${BIONIC_SOURCES_DIR}/cxa_guard.cc
463464
${SOURCES_DIR}/cxx-abi/string.cc
464465
${SOURCES_DIR}/cxx-abi/terminate.cc
465466
)

src/monodroid/jni/monodroid-glue-internal.hh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ namespace xamarin::android::internal
6868
>;
6969

7070
static constexpr pinvoke_library_map::size_type LIBRARY_MAP_INITIAL_BUCKET_COUNT = 1;
71-
#endif
71+
#endif // def NET6
7272

7373
#if defined (DEBUG) && !defined (WINDOWS)
7474
struct RuntimeOptions {
@@ -304,10 +304,10 @@ namespace xamarin::android::internal
304304
static std::mutex pinvoke_map_write_lock;
305305
static pinvoke_api_map xa_pinvoke_map;
306306
static pinvoke_library_map other_pinvoke_map;
307-
#else
307+
#else // def NET6
308308
static std::mutex api_init_lock;
309309
static void *api_dso_handle;
310-
#endif
310+
#endif // !def NET6
311311
};
312312
}
313313
#endif

src/monodroid/jni/monodroid-glue.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ MonodroidRuntime::monodroid_dlopen (const char *name, int flags, char **err, [[m
11851185
return monodroid_dlopen (name, flags, err);
11861186
}
11871187

1188-
size_t len = strlen (name) + DSO_EXTENSION_SIZE; // includes the trailing \0
1188+
size_t len = ADD_WITH_OVERFLOW_CHECK (size_t, strlen (name), DSO_EXTENSION_SIZE); // includes the trailing \0
11891189
static_local_string<PATH_MAX> full_name (len);
11901190

11911191
full_name.append (name).append (DSO_EXTENSION);

src/monodroid/jni/pinvoke-override-api.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,14 @@ _monodroid_timezone_get_default_id ()
177177
jobject d = env->CallStaticObjectMethod (monodroidRuntime.get_java_class_TimeZone (), getDefault);
178178
jstring id = reinterpret_cast<jstring> (env->CallObjectMethod (d, getID));
179179
const char *mutf8 = env->GetStringUTFChars (id, nullptr);
180+
181+
if (mutf8 == nullptr) {
182+
log_error (LOG_DEFAULT, "Failed to convert Java TimeZone ID to UTF8 (out of memory?)");
183+
env->DeleteLocalRef (id);
184+
env->DeleteLocalRef (d);
185+
return nullptr;
186+
}
187+
180188
char *def_id = strdup (mutf8);
181189

182190
env->ReleaseStringUTFChars (id, mutf8);

0 commit comments

Comments
 (0)