mirror of
https://github.com/fumiama/android-base16384.git
synced 2026-06-05 02:00:30 +08:00
v3.2
1. 修复指针越界 2. 修复整数溢出 3. 修复内存泄漏
This commit is contained in:
2
.idea/compiler.xml
generated
2
.idea/compiler.xml
generated
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="11" />
|
||||
<bytecodeTargetLevel target="1.8" />
|
||||
</component>
|
||||
</project>
|
||||
3
.idea/gradle.xml
generated
3
.idea/gradle.xml
generated
@@ -4,7 +4,7 @@
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="PLATFORM" />
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="1.8" />
|
||||
@@ -15,7 +15,6 @@
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
15
.idea/misc.xml
generated
15
.idea/misc.xml
generated
@@ -1,6 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="DesignSurface">
|
||||
<option name="filePathToZoomLevelMap">
|
||||
<map>
|
||||
<entry key="app/src/main/res/drawable-anydpi/ic_add.xml" value="0.5588541666666667" />
|
||||
<entry key="app/src/main/res/drawable-anydpi/ic_dere.xml" value="0.5588541666666667" />
|
||||
<entry key="app/src/main/res/drawable-anydpi/ic_launcher_background.xml" value="0.5588541666666667" />
|
||||
<entry key="app/src/main/res/drawable-anydpi/ic_xi.xml" value="0.5588541666666667" />
|
||||
<entry key="app/src/main/res/drawable-anydpi/rndbg_white.xml" value="0.5588541666666667" />
|
||||
<entry key="app/src/main/res/layout/activity_main.xml" value="0.5427083333333333" />
|
||||
<entry key="app/src/main/res/layout/dialog_progress.xml" value="0.5427083333333333" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
||||
10
.idea/runConfigurations.xml
generated
10
.idea/runConfigurations.xml
generated
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
@@ -5,15 +5,14 @@ apply plugin: 'kotlin-kapt'
|
||||
//apply plugin: 'AndResGuard'
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.2"
|
||||
compileSdkVersion 31
|
||||
|
||||
defaultConfig {
|
||||
applicationId "top.fumiama.base16384"
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 30
|
||||
versionCode 14
|
||||
versionName '3.1'
|
||||
targetSdkVersion 31
|
||||
versionCode 15
|
||||
versionName '3.2'
|
||||
resConfigs "zh", "en"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
@@ -60,11 +59,11 @@ android {
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation 'androidx.core:core-ktx:1.3.2'
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'com.google.android.material:material:1.3.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation 'androidx.core:core-ktx:1.7.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||
implementation 'com.google.android.material:material:1.4.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
}
|
||||
@@ -18,10 +18,11 @@
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/provider_paths" />
|
||||
</provider>
|
||||
<activity android:name=".MainActivity">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.0.0)
|
||||
project(base1432 VERSION 2.0)
|
||||
SET(CMAKE_BUILD_TYPE "Release")
|
||||
|
||||
add_library(base14c STATIC base1432le.c)
|
||||
add_library(base1432 STATIC base1432le.c)
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
LENDAT* encode(const uint8_t* data, const u_int32_t len) {
|
||||
LENDAT* encode(const uint8_t* data, const int32_t len) {
|
||||
LENDAT* encd = (LENDAT*)malloc(sizeof(LENDAT));
|
||||
uint32_t outlen = len / 7 * 8;
|
||||
int32_t outlen = len / 7 * 8;
|
||||
uint8_t offset = len % 7;
|
||||
switch(offset) { //算上偏移标志字符占用的2字节
|
||||
case 0: break;
|
||||
@@ -20,56 +20,53 @@ LENDAT* encode(const uint8_t* data, const u_int32_t len) {
|
||||
case 6: outlen += 10; break;
|
||||
default: break;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
printf("outlen: %llu, offset: %u, malloc: %llu\n", outlen, offset, outlen + 8);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
printf("outlen: %llu, offset: %u, malloc: %llu\n", outlen, offset, outlen + 8);
|
||||
#endif
|
||||
encd->data = (uint8_t*)malloc(outlen + 8); //冗余的8B用于可能的结尾的覆盖
|
||||
encd->len = outlen;
|
||||
uint32_t* vals = (uint32_t*)(encd->data);
|
||||
uint32_t n = 0;
|
||||
uint32_t i = 0;
|
||||
for(; i < len; i += 7) {
|
||||
int32_t i = 0;
|
||||
for(; i <= len - 7; i += 7) {
|
||||
register uint32_t sum = 0x0000003f & ((uint32_t)data[i] >> 2);
|
||||
sum |= (((uint32_t)data[i + 1] << 6) | (data[i] << 14)) & 0x0000ff00;
|
||||
sum |= (((uint32_t)data[i + 1] << 20) | ((uint32_t)data[i + 2] << 12)) & 0x003f0000;
|
||||
sum |= (((uint32_t)data[i + 2] << 28) | ((uint32_t)data[i + 3] << 20)) & 0xff000000;
|
||||
sum += 0x004e004e;
|
||||
vals[n++] = sum;
|
||||
#ifdef DEBUG
|
||||
printf("n: %u, add sum: %08x\n", n, sum);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
printf("n: %u, add sum: %08x\n", n, sum);
|
||||
#endif
|
||||
sum = ((((uint32_t)data[i + 3] << 2) | ((uint32_t)data[i + 4] >> 6))) & 0x0000003f;
|
||||
sum |= (((uint32_t)data[i + 4] << 10) | ((uint32_t)data[i + 5] << 2)) & 0x0000ff00;
|
||||
sum |= ((uint32_t)data[i + 5] << 16) & 0x003f0000;
|
||||
sum |= ((uint32_t)data[i + 6] << 24) & 0xff000000;
|
||||
sum += 0x004e004e;
|
||||
vals[n++] = sum;
|
||||
#ifdef DEBUG
|
||||
printf("n: %u, add sum: %08x\n", n, sum);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
printf("n: %u, add sum: %08x\n", n, sum);
|
||||
#endif
|
||||
}
|
||||
if(offset > 0) {
|
||||
uint8_t o = offset;
|
||||
if(o--) {
|
||||
register uint32_t sum = 0x0000003f & (data[i] >> 2);
|
||||
sum |= ((uint32_t)data[i] << 14) & 0x0000c000;
|
||||
if(offset > 1) {
|
||||
if(o--) {
|
||||
sum |= ((uint32_t)data[i + 1] << 6) & 0x00003f00;
|
||||
sum |= ((uint32_t)data[i + 1] << 20) & 0x00300000;
|
||||
if(offset > 2) {
|
||||
if(o--) {
|
||||
sum |= ((uint32_t)data[i + 2] << 12) & 0x000f0000;
|
||||
sum |= ((uint32_t)data[i + 2] << 28) & 0xf0000000;
|
||||
if(offset == 2) {
|
||||
sum += 0x004e004e;
|
||||
vals[n++] = sum;
|
||||
}
|
||||
if(offset > 3) {
|
||||
if(o--) {
|
||||
sum |= ((uint32_t)data[i + 3] << 20) & 0x0f000000;
|
||||
sum += 0x004e004e;
|
||||
vals[n++] = sum;
|
||||
sum = (((uint32_t)data[i + 3] << 2)) & 0x0000003c;
|
||||
if(offset > 4) {
|
||||
if(o--) {
|
||||
sum |= (((uint32_t)data[i + 4] >> 6)) & 0x00000003;
|
||||
sum |= ((uint32_t)data[i + 4] << 10) & 0x0000fc00;
|
||||
if(offset > 5) {
|
||||
if(o--) {
|
||||
sum |= ((uint32_t)data[i + 5] << 2) & 0x00000300;
|
||||
sum |= ((uint32_t)data[i + 5] << 16) & 0x003f0000;
|
||||
}
|
||||
@@ -85,9 +82,9 @@ LENDAT* encode(const uint8_t* data, const u_int32_t len) {
|
||||
return encd;
|
||||
}
|
||||
|
||||
LENDAT* decode(const uint8_t* data, const u_int32_t len) {
|
||||
LENDAT* decode(const uint8_t* data, const int32_t len) {
|
||||
LENDAT* decd = (LENDAT*)malloc(sizeof(LENDAT));
|
||||
uint32_t outlen = len;
|
||||
int32_t outlen = len;
|
||||
uint8_t offset = 0;
|
||||
if(data[len-2] == '=') {
|
||||
offset = data[len-1];
|
||||
@@ -107,8 +104,8 @@ LENDAT* decode(const uint8_t* data, const u_int32_t len) {
|
||||
decd->len = outlen;
|
||||
uint32_t* vals = (uint32_t*)data;
|
||||
uint32_t n = 0;
|
||||
uint32_t i = 0;
|
||||
for(; n < len / 4; n++) { //n实际每次自增2
|
||||
int32_t i = 0;
|
||||
for(; i <= outlen - 7; n++) { //n实际每次自增2
|
||||
register uint32_t sum = vals[n++];
|
||||
sum -= 0x004e004e;
|
||||
decd->data[i++] = ((sum & 0x0000003f) << 2) | ((sum & 0x0000c000) >> 14);
|
||||
@@ -122,25 +119,25 @@ LENDAT* decode(const uint8_t* data, const u_int32_t len) {
|
||||
decd->data[i++] = ((sum & 0x00000300) >> 2) | ((sum & 0x003f0000) >> 16);
|
||||
decd->data[i++] = ((sum & 0xff000000) >> 24);
|
||||
}
|
||||
if(offset > 0) {
|
||||
if(offset--) {
|
||||
register uint32_t sum = vals[n++];
|
||||
sum -= 0x0000004e;
|
||||
decd->data[i++] = ((sum & 0x0000003f) << 2) | ((sum & 0x0000c000) >> 14);
|
||||
if(offset > 1) {
|
||||
if(offset--) {
|
||||
sum -= 0x004e0000;
|
||||
decd->data[i++] = ((sum & 0x00003f00) >> 6) | ((sum & 0x00300000) >> 20);
|
||||
if(offset > 2) {
|
||||
if(offset--) {
|
||||
decd->data[i++] = ((sum & 0x000f0000) >> 12) | ((sum & 0xf0000000) >> 28);
|
||||
if(offset > 3) {
|
||||
if(offset--) {
|
||||
decd->data[i++] = (sum & 0x0f000000) >> 20;
|
||||
sum = vals[n];
|
||||
sum -= 0x0000004e;
|
||||
decd->data[i++] |= (sum & 0x0000003c) >> 2;
|
||||
if(offset > 4) {
|
||||
if(offset--) {
|
||||
decd->data[i++] = ((sum & 0x00000003) << 6) | ((sum & 0x0000fc00) >> 10);
|
||||
if(offset > 5) {
|
||||
if(offset--) {
|
||||
sum -= 0x004e0000;
|
||||
decd->data[i++] = ((sum & 0x00000300) >> 2) | ((sum & 0x003f0000) >> 16);
|
||||
decd->data[i] = ((sum & 0x00000300) >> 2) | ((sum & 0x003f0000) >> 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#define B14BUFSIZ 8192
|
||||
struct LENDAT {
|
||||
uint8_t* data;
|
||||
uint32_t len;
|
||||
int32_t len;
|
||||
};
|
||||
typedef struct LENDAT LENDAT;
|
||||
|
||||
LENDAT* encode(const uint8_t* data, const u_int32_t len);
|
||||
LENDAT* decode(const uint8_t* data, const u_int32_t len);
|
||||
LENDAT* encode(const uint8_t* data, const int32_t len);
|
||||
LENDAT* decode(const uint8_t* data, const int32_t len);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.0.0)
|
||||
project(base1464 VERSION 2.0)
|
||||
SET(CMAKE_BUILD_TYPE "Release")
|
||||
|
||||
add_library(base14c STATIC base1464le.c)
|
||||
add_library(base1464 STATIC base1464le.c)
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
LENDAT* encode(const uint8_t* data, const u_int64_t len) {
|
||||
LENDAT* encode(const uint8_t* data, const int64_t len) {
|
||||
LENDAT* encd = (LENDAT*)malloc(sizeof(LENDAT));
|
||||
uint64_t outlen = len / 7 * 8;
|
||||
int64_t outlen = len / 7 * 8;
|
||||
uint8_t offset = len % 7;
|
||||
switch(offset) { //算上偏移标志字符占用的2字节
|
||||
case 0: break;
|
||||
@@ -20,15 +20,15 @@ LENDAT* encode(const uint8_t* data, const u_int64_t len) {
|
||||
case 6: outlen += 10; break;
|
||||
default: break;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
printf("outlen: %llu, offset: %u, malloc: %llu\n", outlen, offset, outlen + 8);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
printf("outlen: %llu, offset: %u, malloc: %llu\n", outlen, offset, outlen + 8);
|
||||
#endif
|
||||
encd->data = (uint8_t*)malloc(outlen + 8); //冗余的8B用于可能的结尾的覆盖
|
||||
encd->len = outlen;
|
||||
uint64_t* vals = (uint64_t*)(encd->data);
|
||||
uint64_t n = 0;
|
||||
uint64_t i = 0;
|
||||
for(; i < len; i += 7) {
|
||||
int64_t i = 0;
|
||||
for(; i <= len - 7; i += 7) {
|
||||
register uint64_t sum = 0x000000000000003f & ((uint64_t)data[i] >> 2);
|
||||
sum |= (((uint64_t)data[i + 1] << 6) | (data[i] << 14)) & 0x000000000000ff00;
|
||||
sum |= (((uint64_t)data[i + 1] << 20) | ((uint64_t)data[i + 2] << 12)) & 0x00000000003f0000;
|
||||
@@ -39,26 +39,27 @@ LENDAT* encode(const uint8_t* data, const u_int64_t len) {
|
||||
sum |= ((uint64_t)data[i + 6] << 56) & 0xff00000000000000;
|
||||
sum += 0x004e004e004e004e;
|
||||
vals[n++] = sum;
|
||||
#ifdef DEBUG
|
||||
printf("i: %llu, add sum: %016llx\n", i, sum);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
printf("i: %llu, add sum: %016llx\n", i, sum);
|
||||
#endif
|
||||
}
|
||||
if(offset > 0) {
|
||||
uint8_t o = offset;
|
||||
if(o--) {
|
||||
register uint64_t sum = 0x000000000000003f & (data[i] >> 2);
|
||||
sum |= ((uint64_t)data[i] << 14) & 0x000000000000c000;
|
||||
if(offset > 1) {
|
||||
if(o--) {
|
||||
sum |= ((uint64_t)data[i + 1] << 6) & 0x0000000000003f00;
|
||||
sum |= ((uint64_t)data[i + 1] << 20) & 0x0000000000300000;
|
||||
if(offset > 2) {
|
||||
if(o--) {
|
||||
sum |= ((uint64_t)data[i + 2] << 12) & 0x00000000000f0000;
|
||||
sum |= ((uint64_t)data[i + 2] << 28) & 0x00000000f0000000;
|
||||
if(offset > 3) {
|
||||
if(o--) {
|
||||
sum |= ((uint64_t)data[i + 3] << 20) & 0x000000000f000000;
|
||||
sum |= ((uint64_t)data[i + 3] << 34) & 0x0000003c00000000;
|
||||
if(offset > 4) {
|
||||
if(o--) {
|
||||
sum |= ((uint64_t)data[i + 4] << 26) & 0x0000000300000000;
|
||||
sum |= ((uint64_t)data[i + 4] << 42) & 0x0000fc0000000000;
|
||||
if(offset > 5) {
|
||||
if(o--) {
|
||||
sum |= ((uint64_t)data[i + 5] << 34) & 0x0000030000000000;
|
||||
sum |= ((uint64_t)data[i + 5] << 48) & 0x003f000000000000;
|
||||
}
|
||||
@@ -68,18 +69,18 @@ LENDAT* encode(const uint8_t* data, const u_int64_t len) {
|
||||
}
|
||||
sum += 0x004e004e004e004e;
|
||||
vals[n] = sum;
|
||||
#ifdef DEBUG
|
||||
printf("i: %llu, add sum: %016llx\n", i, sum);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
printf("i: %llu, add sum: %016llx\n", i, sum);
|
||||
#endif
|
||||
encd->data[outlen - 2] = '=';
|
||||
encd->data[outlen - 1] = offset;
|
||||
}
|
||||
return encd;
|
||||
}
|
||||
|
||||
LENDAT* decode(const uint8_t* data, const u_int64_t len) {
|
||||
LENDAT* decode(const uint8_t* data, const int64_t len) {
|
||||
LENDAT* decd = (LENDAT*)malloc(sizeof(LENDAT));
|
||||
uint64_t outlen = len;
|
||||
int64_t outlen = len;
|
||||
uint8_t offset = 0;
|
||||
if(data[len-2] == '=') {
|
||||
offset = data[len-1];
|
||||
@@ -99,10 +100,9 @@ LENDAT* decode(const uint8_t* data, const u_int64_t len) {
|
||||
decd->len = outlen;
|
||||
uint64_t* vals = (uint64_t*)data;
|
||||
uint64_t n = 0;
|
||||
uint64_t i = 0;
|
||||
for(; n < len / 8; n++) {
|
||||
register uint64_t sum = vals[n];
|
||||
sum -= 0x004e004e004e004e;
|
||||
int64_t i = 0;
|
||||
for(; i <= outlen - 7; n++) {
|
||||
register uint64_t sum = vals[n] - 0x004e004e004e004e;
|
||||
decd->data[i++] = ((sum & 0x000000000000003f) << 2) | ((sum & 0x000000000000c000) >> 14);
|
||||
decd->data[i++] = ((sum & 0x0000000000003f00) >> 6) | ((sum & 0x0000000000300000) >> 20);
|
||||
decd->data[i++] = ((sum & 0x00000000000f0000) >> 12) | ((sum & 0x00000000f0000000) >> 28);
|
||||
@@ -111,23 +111,22 @@ LENDAT* decode(const uint8_t* data, const u_int64_t len) {
|
||||
decd->data[i++] = ((sum & 0x0000030000000000) >> 34) | ((sum & 0x003f000000000000) >> 48);
|
||||
decd->data[i++] = ((sum & 0xff00000000000000) >> 56);
|
||||
}
|
||||
if(offset > 0) {
|
||||
register uint64_t sum = vals[n];
|
||||
sum -= 0x000000000000004e;
|
||||
if(offset--) {
|
||||
register uint64_t sum = vals[n] - 0x000000000000004e;
|
||||
decd->data[i++] = ((sum & 0x000000000000003f) << 2) | ((sum & 0x000000000000c000) >> 14);
|
||||
if(offset > 1) {
|
||||
if(offset--) {
|
||||
sum -= 0x00000000004e0000;
|
||||
decd->data[i++] = ((sum & 0x0000000000003f00) >> 6) | ((sum & 0x0000000000300000) >> 20);
|
||||
if(offset > 2) {
|
||||
if(offset--) {
|
||||
decd->data[i++] = ((sum & 0x00000000000f0000) >> 12) | ((sum & 0x00000000f0000000) >> 28);
|
||||
if(offset > 3) {
|
||||
if(offset--) {
|
||||
sum -= 0x0000004e00000000;
|
||||
decd->data[i++] = ((sum & 0x000000000f000000) >> 20) | ((sum & 0x0000003c00000000) >> 34);
|
||||
if(offset > 4) {
|
||||
if(offset--) {
|
||||
decd->data[i++] = ((sum & 0x0000000300000000) >> 26) | ((sum & 0x0000fc0000000000) >> 42);
|
||||
if(offset > 5) {
|
||||
if(offset--) {
|
||||
sum -= 0x004e000000000000;
|
||||
decd->data[i++] = ((sum & 0x0000030000000000) >> 34) | ((sum & 0x003f000000000000) >> 48);
|
||||
decd->data[i] = ((sum & 0x0000030000000000) >> 34) | ((sum & 0x003f000000000000) >> 48);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#define B14BUFSIZ 16384
|
||||
struct LENDAT {
|
||||
uint8_t* data;
|
||||
uint64_t len;
|
||||
int64_t len;
|
||||
};
|
||||
typedef struct LENDAT LENDAT;
|
||||
|
||||
LENDAT* encode(const uint8_t* data, const u_int64_t len);
|
||||
LENDAT* decode(const uint8_t* data, const u_int64_t len);
|
||||
LENDAT* encode(const uint8_t* data, const int64_t len);
|
||||
LENDAT* decode(const uint8_t* data, const int64_t len);
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
cmake_minimum_required(VERSION 3.10.2)
|
||||
project("base16384")
|
||||
|
||||
add_library(base14 SHARED base16384.cpp)
|
||||
add_library(base16384 STATIC base16384.c)
|
||||
|
||||
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
add_definitions("-DCPUBIT64")
|
||||
add_subdirectory("./64")
|
||||
target_link_libraries(base14 base16384 base1464)
|
||||
ELSE()
|
||||
add_definitions("-DCPUBIT32")
|
||||
add_subdirectory("./32")
|
||||
target_link_libraries(base14 base16384 base1432)
|
||||
ENDIF()
|
||||
|
||||
add_library(base14 SHARED base16384.cpp)
|
||||
add_library(base14s STATIC base16384.c)
|
||||
target_link_libraries(base14 base14s base14c)
|
||||
|
||||
@@ -21,6 +21,7 @@ int encode_file(const char* input, const char* output) {
|
||||
puts("Write file error!");
|
||||
return 1;
|
||||
}
|
||||
free(ld->data);
|
||||
free(ld);
|
||||
}
|
||||
free(bufi);
|
||||
@@ -77,6 +78,7 @@ int decode_file(const char* input, const char* output) {
|
||||
puts("Write file error!");
|
||||
return 1;
|
||||
}
|
||||
free(ld->data);
|
||||
free(ld);
|
||||
}
|
||||
free(bufi);
|
||||
|
||||
@@ -14,14 +14,13 @@
|
||||
}
|
||||
|
||||
#define exe_byte(fun) {\
|
||||
uint32_t len = env->GetArrayLength(buf);\
|
||||
jsize len = env->GetArrayLength(buf);\
|
||||
const uint8_t* data = (uint8_t*)env->GetByteArrayElements(buf, JNI_FALSE);\
|
||||
LENDAT* ld = fun(data, len);\
|
||||
jbyteArray out = env->NewByteArray(ld->len);\
|
||||
auto out_data = env->GetByteArrayElements(out, JNI_FALSE);\
|
||||
memcpy(out_data, ld->data, ld->len);\
|
||||
env->SetByteArrayRegion(out, 0, ld->len, reinterpret_cast<const jbyte *>(ld->data));\
|
||||
free(ld->data);\
|
||||
free(ld);\
|
||||
env->ReleaseByteArrayElements(out, out_data, JNI_COMMIT);\
|
||||
return out;\
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ struct LENDAT {
|
||||
};
|
||||
typedef struct LENDAT LENDAT;
|
||||
|
||||
extern "C" LENDAT* encode(const uint8_t* data, const u_int32_t len);
|
||||
extern "C" LENDAT* decode(const uint8_t* data, const u_int32_t len);
|
||||
extern "C" LENDAT* encode(const uint8_t* data, const uint32_t len);
|
||||
extern "C" LENDAT* decode(const uint8_t* data, const uint32_t len);
|
||||
#endif
|
||||
#ifdef CPUBIT64
|
||||
#define B14BUFSIZ 16384
|
||||
@@ -30,8 +30,8 @@ struct LENDAT {
|
||||
};
|
||||
typedef struct LENDAT LENDAT;
|
||||
|
||||
extern "C" LENDAT* encode(const uint8_t* data, const u_int64_t len);
|
||||
extern "C" LENDAT* decode(const uint8_t* data, const u_int64_t len);
|
||||
extern "C" LENDAT* encode(const uint8_t* data, const uint64_t len);
|
||||
extern "C" LENDAT* decode(const uint8_t* data, const uint64_t len);
|
||||
#endif
|
||||
|
||||
extern "C" int encode_file(const char* input, const char* output);
|
||||
|
||||
@@ -7,12 +7,22 @@
|
||||
android:layout_gravity="center"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_dere"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/sl"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/rndbg_white"
|
||||
android:padding="8dp"
|
||||
android:minHeight="32dp"
|
||||
android:padding="12dp"
|
||||
android:text="@string/use_lzma"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<string name="decode_succeed">解码成功</string>
|
||||
<string name="encode_succeed">编码成功</string>
|
||||
<string name="info">关于</string>
|
||||
<string name="info_content">作者:源文雨。感谢咲桜动漫社成员的支持。</string>
|
||||
<string name="info_content">作者:源文雨。</string>
|
||||
<string name="copied">已复制</string>
|
||||
<string name="select_charset">选择字符集</string>
|
||||
<string name="alert">提示</string>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<string name="decode_succeed">Decode Succeed</string>
|
||||
<string name="encode_succeed">Encode Succeed</string>
|
||||
<string name="info">Info</string>
|
||||
<string name="info_content">Author: Fumiama, with precious supports from the members in Sakura Anime Club.</string>
|
||||
<string name="info_content">Author: Fumiama.</string>
|
||||
<string name="copied">Copied Text</string>
|
||||
<string name="select_charset">Select Charset</string>
|
||||
<string name="alert">Alert</string>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.5.0'
|
||||
ext.kotlin_version = '1.5.31'
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
@@ -8,7 +8,7 @@ buildscript {
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.2.1'
|
||||
classpath 'com.android.tools.build:gradle:4.2.2'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
//classpath 'com.tencent.mm:AndResGuard-gradle-plugin:1.2.20'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user