diff --git a/build/workflow/build.config b/build/workflow/build.config index 19ff1c5..425b72c 100755 --- a/build/workflow/build.config +++ b/build/workflow/build.config @@ -1,5 +1,5 @@ export PMT_VERSION="3.0.2" export PMT_VERSION_CODE=302 -export NDK_VERSION="r27" +export NDK_VERSION="r27c" export NDK_IS="android-ndk" export NDK_LINK="https://dl.google.com/android/repository/android-ndk-${NDK_VERSION}-linux.zip" diff --git a/include/libintl.h b/include/libintl.h new file mode 100755 index 0000000..16eb252 --- /dev/null +++ b/include/libintl.h @@ -0,0 +1,53 @@ +#ifndef _LIBINTL_H +#define _LIBINTL_H + +#include +#include + +static __inline__ char* gettext(const char* msgid) +{ return (char*) msgid; } + +static __inline__ char* dgettext(const char* domainname, const char* msgid) +{ return (char*) msgid; } + +static __inline__ char* dcgettext(const char* domainname, const char* msgid, int category) +{ return (char*) msgid; } + +static __inline__ char* ngettext(const char* msgid1, const char* msgid2, unsigned long int n) +{ return (char *) ((n == 1) ? msgid1 : msgid2); } + +static __inline__ char* dngettext(const char* domainname, const char* msgid1, const char* msgid2, unsigned long int n) +{ return (char *) ((n == 1) ? msgid1 : msgid2); } + +static __inline__ char* dcngettext(const char* domainname, const char* msgid1, const char* msgid2, unsigned long int n, int category) +{ return (char *) ((n == 1) ? msgid1 : msgid2); } + +static __inline__ char* textdomain(const char* domainname) +{ + static const char default_str[] = "messages"; + if (domainname && *domainname && strcmp(domainname, default_str)) { + errno = EINVAL; + return NULL; + } + return (char*) default_str; +} + +static __inline__ char* bindtextdomain(const char* domainname, const char* dirname) +{ + static const char dir[] = "/"; + if (!domainname || !*domainname || (dirname && ((dirname[0] != '/') || dirname[1]))) { + errno = EINVAL; + return NULL; + } + return (char*) dir; +} + +static __inline__ char* bind_textdomain_codeset(const char* domainname, const char* codeset) +{ + if (!domainname || !*domainname || (codeset && strcasecmp(codeset, "UTF-8"))) { + errno = EINVAL; + } + return NULL; +} + +#endif diff --git a/include/uuid/uuid.h b/include/uuid/uuid.h new file mode 100755 index 0000000..2e3642c --- /dev/null +++ b/include/uuid/uuid.h @@ -0,0 +1,126 @@ +/* + * Public include file for the UUID library + * + * Copyright (C) 1996, 1997, 1998 Theodore Ts'o. + * + * %Begin-Header% + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, and the entire permission notice in its entirety, + * including the disclaimer of warranties. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF + * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * %End-Header% + */ + +#ifndef _UL_LIBUUID_UUID_H +#define _UL_LIBUUID_UUID_H + +#include +#ifndef _WIN32 +#include +#endif +#include + +typedef unsigned char uuid_t[16]; + +/* UUID Variant definitions */ +#define UUID_VARIANT_NCS 0 +#define UUID_VARIANT_DCE 1 +#define UUID_VARIANT_MICROSOFT 2 +#define UUID_VARIANT_OTHER 3 + +#define UUID_VARIANT_SHIFT 5 +#define UUID_VARIANT_MASK 0x7 + +/* UUID Type definitions */ +#define UUID_TYPE_DCE_NIL 0 +#define UUID_TYPE_DCE_TIME 1 +#define UUID_TYPE_DCE_SECURITY 2 +#define UUID_TYPE_DCE_MD5 3 +#define UUID_TYPE_DCE_RANDOM 4 +#define UUID_TYPE_DCE_SHA1 5 + +#define UUID_TYPE_SHIFT 4 +#define UUID_TYPE_MASK 0xf + +#define UUID_STR_LEN 37 + +/* Allow UUID constants to be defined */ +#ifdef __GNUC__ +#define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \ + static const uuid_t name __attribute__ ((unused)) = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15} +#else +#define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \ + static const uuid_t name = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15} +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* clear.c */ +extern void uuid_clear(uuid_t uu); + +/* compare.c */ +extern int uuid_compare(const uuid_t uu1, const uuid_t uu2); + +/* copy.c */ +extern void uuid_copy(uuid_t dst, const uuid_t src); + +/* gen_uuid.c */ +extern void uuid_generate(uuid_t out); +extern void uuid_generate_random(uuid_t out); +extern void uuid_generate_time(uuid_t out); +extern int uuid_generate_time_safe(uuid_t out); + +extern void uuid_generate_md5(uuid_t out, const uuid_t ns, const char *name, size_t len); +extern void uuid_generate_sha1(uuid_t out, const uuid_t ns, const char *name, size_t len); + +/* isnull.c */ +extern int uuid_is_null(const uuid_t uu); + +/* parse.c */ +extern int uuid_parse(const char *in, uuid_t uu); +extern int uuid_parse_range(const char *in_start, const char *in_end, uuid_t uu); + +/* unparse.c */ +extern void uuid_unparse(const uuid_t uu, char *out); +extern void uuid_unparse_lower(const uuid_t uu, char *out); +extern void uuid_unparse_upper(const uuid_t uu, char *out); + +/* uuid_time.c */ +#if defined(__USE_TIME_BITS64) && defined(__GLIBC__) +# define uuid_time uuid_time64 +#endif +extern time_t uuid_time(const uuid_t uu, struct timeval *ret_tv); +extern int uuid_type(const uuid_t uu); +extern int uuid_variant(const uuid_t uu); + +/* predefined.c */ +extern const uuid_t *uuid_get_template(const char *alias); + +#ifdef __cplusplus +} +#endif + +#endif /* _UL_LIBUUID_UUID_H */ diff --git a/jni/Android.mk b/jni/Android.mk index 3dc0017..5630085 100755 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -44,6 +44,7 @@ E2FSPROGS_DEFAULT_CFLAGS = \ -Wno-typedef-redefinition \ -Wno-unused-parameter \ -Wno-unused-command-line-argument \ + -Wno-nullability-completeness \ -include ../include/PartitionManager/Alternatives.h PARTED_DEFAULTS_CFLAGS = \ -std=c17 \ @@ -88,7 +89,8 @@ E2FSPROGS_INCLUDES := \ $(INC_DIR)/support \ $(INC_DIR)/uuid \ $(INC_DIR)/e2fsck \ - $(INC_DIR) + $(INC_DIR) \ + $(LOCAL_PATH)/../include include $(CLEAR_VARS) @@ -292,6 +294,7 @@ LOCAL_SRC_FILES := \ LOCAL_C_INCLUDES := $(E2FSPROGS_INCLUDES) LOCAL_CFLAGS := \ $(E2FSPROGS_DEFAULT_CFLAGS) \ + -U_FORTIFY_SOURCE \ -fPIC \ -pthread @@ -409,7 +412,8 @@ LOCAL_MODULE := libcharset LOCAL_SRC_FILES := \ $(LIBCHARSET)/lib/localcharset.c \ $(LIBCHARSET)/lib/relocatable-stub.c -LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include/libcharset +LOCAL_C_INCLUDES := \ + $(LOCAL_PATH)/../include/libcharset LOCAL_CFLAGS := \ -Wall \ -Wextra \ @@ -446,6 +450,7 @@ LOCAL_CFLAGS := \ -Wno-unused-function \ -Wno-unused-but-set-variable \ -Wno-missing-field-initializers \ + -Wno-shift-count-overflow \ -fPIC include $(BUILD_STATIC_LIBRARY) @@ -548,6 +553,7 @@ LOCAL_SRC_FILES := \ LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/../include \ $(LOCAL_PATH)/../include/libgnulib \ + $(LOCAL_PATH)/../include/libiconv \ $(PARTED) \ $(LIBPARTED) \ $(LIBPARTED)/labels \ @@ -560,13 +566,13 @@ include $(CLEAR_VARS) LOCAL_MODULE := lib__parted_objs LOCAL_SRC_FILES := \ - $(PARTED)/command.c \ - $(PARTED)/jsonwrt.c \ - $(PARTED)/parted.c \ - $(PARTED)/strlist.c \ - $(PARTED)/table.c \ - $(PARTED)/ui.c \ - $(PARTED)/version.c + $(PARTED_SRCDIR)/command.c \ + $(PARTED_SRCDIR)/jsonwrt.c \ + $(PARTED_SRCDIR)/parted.c \ + $(PARTED_SRCDIR)/strlist.c \ + $(PARTED_SRCDIR)/table.c \ + $(PARTED_SRCDIR)/ui.c \ + $(PARTED_SRCDIR)/version.c LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/../include \ $(LOCAL_PATH)/../include/libgnulib \ diff --git a/jni/parted/libgnulib/lib/nl_langinfo.c b/jni/parted/libgnulib/lib/nl_langinfo.c index 64ff93b..f8b6715 100755 --- a/jni/parted/libgnulib/lib/nl_langinfo.c +++ b/jni/parted/libgnulib/lib/nl_langinfo.c @@ -29,6 +29,11 @@ # include #endif +#ifdef REPLACE_NL_LANGINFO +#undef REPLACE_NL_LANGINFO +#define REPLACE_NL_LANGINFO 0 +#endif + #if REPLACE_NL_LANGINFO && !NL_LANGINFO_MTSAFE # if AVOID_ANY_THREADS diff --git a/jni/parted/libparted/architecture.c b/jni/parted/libparted/architecture.c index 4020f98..3fe83a4 100755 --- a/jni/parted/libparted/architecture.c +++ b/jni/parted/libparted/architecture.c @@ -28,16 +28,8 @@ ped_set_architecture () if (ped_architecture) return; -#ifdef linux extern PedArchitecture ped_linux_arch; const PedArchitecture* arch = &ped_linux_arch; -#elif defined(__BEOS__) - extern PedArchitecture ped_beos_arch; - const PedArchitecture* arch = &ped_beos_arch; -#else - extern PedArchitecture ped_gnu_arch; - const PedArchitecture* arch = &ped_gnu_arch; -#endif ped_architecture = arch; }