1
0
mirror of https://github.com/fumiama/android-base16384.git synced 2026-06-06 02:30:30 +08:00
Files
android-base16384/app/src/main/cpp/base14/base16384.hpp
fumiama 54e8403004 v3.2
1. 修复指针越界
2. 修复整数溢出
3. 修复内存泄漏
2021-10-29 00:22:29 +08:00

41 lines
917 B
C++

//
// Created by fumiama on 2021/5/20.
//
#ifndef BASE16384_BASE16384_HPP
#define BASE16384_BASE16384_HPP
#include <stdint.h>
#ifndef CPUBIT32
#ifndef CPUBIT64
#define CPUBIT32
#endif
#endif
#ifdef CPUBIT32
#define B14BUFSIZ 8192
struct LENDAT {
uint8_t* data;
uint32_t len;
};
typedef struct LENDAT LENDAT;
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
struct LENDAT {
uint8_t* data;
uint64_t len;
};
typedef struct LENDAT LENDAT;
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);
extern "C" int decode_file(const char* input, const char* output);
#endif //BASE16384_BASE16384_HPP