diff --git a/app/src/main/cpp/CMakeLists.txt b/app/src/main/cpp/CMakeLists.txt index 84963e609..1ba40aedd 100644 --- a/app/src/main/cpp/CMakeLists.txt +++ b/app/src/main/cpp/CMakeLists.txt @@ -45,6 +45,6 @@ SET(LIBARCHIVE_CUSTOM_LIBS "liblzma" "nettle") add_subdirectory(libarchive) # Build and link our app's native lib -add_library(${PROJECT_NAME} SHARED main.c archive.c image.c fdutils.c) +add_library(${PROJECT_NAME} SHARED archive.c image.c fdutils.c) target_include_directories(${PROJECT_NAME} PUBLIC libarchive/libarchive) target_link_libraries(${PROJECT_NAME} archive_static log jnigraphics GLESv2 -Wl,--gc-sections) diff --git a/app/src/main/cpp/image.c b/app/src/main/cpp/image.c index 61b619b01..e0a21d16c 100644 --- a/app/src/main/cpp/image.c +++ b/app/src/main/cpp/image.c @@ -26,8 +26,6 @@ #include -#include "image.h" - #define TAG "ImageDecoder_wrapper" #define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG ,__VA_ARGS__) #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG ,__VA_ARGS__) @@ -38,17 +36,7 @@ #define IMAGE_TILE_MAX_SIZE (512 * 512) -static void *tile_buffer = NULL; - -bool image_onLoad() { - tile_buffer = malloc(IMAGE_TILE_MAX_SIZE * 4); - return tile_buffer != NULL; -} - -void image_onUnload() { - free(tile_buffer); - tile_buffer = NULL; -} +static char tile_buffer[IMAGE_TILE_MAX_SIZE * 4]; typedef struct { AImageDecoder *decoder; diff --git a/app/src/main/cpp/image.h b/app/src/main/cpp/image.h deleted file mode 100644 index fe5dcc63a..000000000 --- a/app/src/main/cpp/image.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2022 Tarsin Norbin - * - * This file is part of EhViewer - * - * EhViewer is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * EhViewer is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * EhViewer. If not, see . - */ - -#ifndef IMAGE_IMAGE_H -#define IMAGE_IMAGE_H - -#include - -bool image_onLoad(); - -void image_onUnload(); - -#endif /* IMAGE_IMAGE_H */ diff --git a/app/src/main/cpp/main.c b/app/src/main/cpp/main.c deleted file mode 100644 index e0449f50e..000000000 --- a/app/src/main/cpp/main.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2022 Tarsin Norbin - * - * This file is part of EhViewer - * - * EhViewer is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * EhViewer is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * EhViewer. If not, see . - */ - -#include -#include -#include -#include -#include - -#include "image.h" - -JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { - JNIEnv *env; - - if ((*vm)->GetEnv(vm, (void **) (&env), JNI_VERSION_1_6) != JNI_OK) { - return JNI_ERR; - } - - if (!image_onLoad(vm)) { - return JNI_ERR; - } - - return JNI_VERSION_1_6; -} - -JNIEXPORT void JNICALL -JNI_OnUnload(JavaVM *vm, void *reserved) { - image_onUnload(); -}