compat: Add libutils shim
* This is required because some old libraries still rely on the strncpy16() function. Change-Id: I77da329d1296d946f43ffe6708444b1d25607342
This commit is contained in:
parent
895a614971
commit
118bd4294f
2 changed files with 30 additions and 0 deletions
|
@ -335,6 +335,14 @@ cc_library_shared {
|
|||
vendor_available: true,
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "libutils_shim",
|
||||
shared_libs: ["libutils"],
|
||||
srcs: ["libutils/String16.cpp"],
|
||||
system_ext_specific: true,
|
||||
vendor_available: true,
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "libip_checksum_shim",
|
||||
whole_static_libs: [
|
||||
|
|
22
libutils/String16.cpp
Normal file
22
libutils/String16.cpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright (C) 2023 The LineageOS Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
extern "C" {
|
||||
char16_t* strncpy16(char16_t* dst, const char16_t* src, size_t n) {
|
||||
char16_t* q = dst;
|
||||
const char16_t* p = src;
|
||||
char ch;
|
||||
while (n) {
|
||||
n--;
|
||||
*q++ = ch = *p++;
|
||||
if (!ch) break;
|
||||
}
|
||||
*q = 0;
|
||||
return dst;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue