diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2024-01-13 04:31:38 +0100 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2024-01-13 04:31:38 +0100 |
commit | 28d238d7ddf85a645febc50d088815abbd8b1ccf (patch) | |
tree | 848a569430b7991955906836fd71377e7cc003b0 | |
parent | 30522a5b68eccfb225379de1fb04a4b2ee3611a2 (diff) | |
download | saw-28d238d7ddf85a645febc50d088815abbd8b1ccf.zip |
nanovg: remove unused code
-rw-r--r-- | source/nanovg/android.c | 68 | ||||
-rw-r--r-- | source/nanovg/android.h | 26 | ||||
-rw-r--r-- | source/nanovg/nanovg.c | 2 | ||||
-rw-r--r-- | source/nanovg/nanovg_gl.c | 2 | ||||
-rw-r--r-- | source/saw/_dep.c | 1 |
5 files changed, 0 insertions, 99 deletions
diff --git a/source/nanovg/android.c b/source/nanovg/android.c deleted file mode 100644 index 15d1e60..0000000 --- a/source/nanovg/android.c +++ /dev/null @@ -1,68 +0,0 @@ -// See: http://www.50ply.com/blog/2013/01/19/loading-compressed-android-assets-with-file-pointer/ -// See: https://github.com/android/ndk/issues/562 - -#include "android.h" -#include "nanovg.h" - -#if defined(__ANDROID__) - -#include <stdio.h> -#include <string.h> -#include <errno.h> -#include <android/log.h> -#include <android/asset_manager.h> - -#define LOGV(...) (__android_log_print(ANDROID_LOG_VERBOSE, "NanoVG Demo", __VA_ARGS__)) -#define LOGI(...) (__android_log_print(ANDROID_LOG_INFO, "NanoVG Demo", __VA_ARGS__)) -#define LOGW(...) (__android_log_print(ANDROID_LOG_WARN, "NanoVG Demo", __VA_ARGS__)) -#define LOGE(...) (__android_log_print(ANDROID_LOG_ERROR, "NanoVG Demo", __VA_ARGS__)) -#define LOGF(...) (__android_log_print(ANDROID_LOG_FATAL, "NanoVG Demo", __VA_ARGS__)) - -static int android_read(void * cookie, char * buf, int size) { - return AAsset_read((AAsset*)cookie, buf, size); -} - -static int android_write(void * cookie, const char * buf, int size) { - (void)cookie; (void)buf; (void)size; // unused - return EACCES; // can't provide write access to the apk -} - -static fpos_t android_seek(void * cookie, fpos_t offset, int whence) { - return AAsset_seek((AAsset*)cookie, offset, whence); -} - -static int android_close(void * cookie) { - AAsset_close((AAsset*)cookie); - return 0; -} - -AAssetManager * android_asset_manager = NULL; -void nvgSetAndroidAssetManager(AAssetManager * manager) { - android_asset_manager = manager; -} - -FILE * android_fopen(const char * fname, const char * mode) { - if (mode[0] == '/') { // absolute path - } - - if (strchr(mode, 'w')) { // for writing - LOGE("Unable to open asset (trying to write): '%s' ('%s')", fname, mode); - return NULL; - } - - if (!android_asset_manager) { - LOGE("Unable to open asset (unknown asset manager): '%s' ('%s')", fname, mode); - return NULL; - } - - AAsset* asset = AAssetManager_open(android_asset_manager, fname, 0); - if (!asset) { - LOGW("Unable to open asset: '%s' ('%s')", fname, mode); - return NULL; - } - - LOGV("Opening asset: '%s' ('%s')", fname, mode); - return funopen(asset, android_read, android_write, android_seek, android_close); -} - -#endif diff --git a/source/nanovg/android.h b/source/nanovg/android.h deleted file mode 100644 index 0bf20ce..0000000 --- a/source/nanovg/android.h +++ /dev/null @@ -1,26 +0,0 @@ -// See: http://www.50ply.com/blog/2013/01/19/loading-compressed-android-assets-with-file-pointer/ - -#ifndef NANOVG_ANDROID_H_04F2956C_D65D_11EA_852A_07298A1173F1 -#define NANOVG_ANDROID_H_04F2956C_D65D_11EA_852A_07298A1173F1 - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(__ANDROID__) - -#include <stdio.h> -#include <android/asset_manager.h> - -void android_fopen_set_asset_manager(AAssetManager* manager); -FILE* android_fopen(const char* fname, const char* mode); - -#define fopen(name, mode) android_fopen(name, mode) - -#endif - -#ifdef __cplusplus -} -#endif - -#endif // NANOVG_ANDROID_H_04F2956C_D65D_11EA_852A_07298A1173F1 diff --git a/source/nanovg/nanovg.c b/source/nanovg/nanovg.c index 7d226e8..4e110b3 100644 --- a/source/nanovg/nanovg.c +++ b/source/nanovg/nanovg.c @@ -21,8 +21,6 @@ #include <math.h> #include <memory.h> -#include "android.h" - #include "nanovg.h" #define FONTSTASH_IMPLEMENTATION diff --git a/source/nanovg/nanovg_gl.c b/source/nanovg/nanovg_gl.c index 8a6f53f..9970842 100644 --- a/source/nanovg/nanovg_gl.c +++ b/source/nanovg/nanovg_gl.c @@ -25,8 +25,6 @@ #include <string.h> #include <math.h> -#include "android.h" - #ifdef NANOVG_USE_GLEW # include <GL/glew.h> static int glew_initialized = 0; diff --git a/source/saw/_dep.c b/source/saw/_dep.c index 929d3fd..dab6342 100644 --- a/source/saw/_dep.c +++ b/source/saw/_dep.c @@ -38,4 +38,3 @@ // #include "../nanovg/nanovg.c" #include "../nanovg/nanovg_gl.c" -#include "../nanovg/android.c" |