137 Commits

Author SHA1 Message Date
guoling 5892e0ff3b fix expireDuration overflow bug #1665 2026-06-02 19:06:09 +08:00
guoling de70a23783 Fix oversized key corrupting data due to uint16_t overflow in KeyValueHolder
Keys longer than 65531 bytes cause keySize and computedKVSize (both uint16_t)
to wrap around, silently corrupting the internal offset so that subsequent reads
return garbage. Reject keys exceeding the safe threshold (UINT16_MAX - 4) at
all write and parse entry points.
2026-04-08 16:08:59 +08:00
guoling 7224f0aa8f Fix -Wmissing-braces 2026-03-27 16:23:03 +08:00
guoling 58920f50e1 update C++ demo code with MMKVHandler 2026-03-25 12:25:12 +08:00
guoling 050d8c874f add NameSpace to c bridge 2026-03-24 19:44:51 +08:00
guoling 3f2b3999f4 Add universal C interface (cbridge) for MMKV Core
Provide a language-agnostic C99 bridge using standard C types (const char*,
void*, int64_t, etc.) so MMKV Core can be consumed from C-only environments

- Core/cbridge/MMKVBridge.h: pure C header with mmkv_ prefixed API
- Core/cbridge/MMKVBridge.cpp: implementation wrapping MMKV C++ API
- POSIX/demo/demo_c.c: pure C demo exercising all API surface
- CMakeLists.txt updates for core library and demo_c target
2026-03-24 13:28:38 +08:00
guoling 9348a93f26 refactor callback system into unified MMKVHandler across all platforms
Replace 4 separate static function pointers (LogHandler, ErrorHandler,
ContentChangeHandler, ContentLoadedHandler) with a single MMKVHandler
abstract class in Core C++. Update all 6 platform wrappers (iOS, Android,
OHOS, Python, Golang, Flutter) to use adapter classes bridging to the new
unified handler. Add onMMKVContentLoadSuccessfully callback to Android,
OHOS, Flutter, Python and Golang where it was previously missing.
2026-03-18 12:40:05 +08:00
guoling d90f664a2e add DefaultMMKVWithConfig() for golang 2026-03-18 12:39:06 +08:00
guoling e03452f006 add all-in-one config for golang 2026-03-06 16:17:05 +08:00
guoling 1915d892f1 add MMKVConfig 2026-02-05 17:21:53 +08:00
guoling f6bfc28130 add aes256 option on golang with breaking changes on API 2025-12-01 18:13:20 +08:00
guoling 5c2bce40a3 add reKey testcase on POSIX/Win32 2025-12-01 17:05:10 +08:00
guoling 3163817697 fix single key override bug on upgrading from a v1.1.x version #1605 2025-11-24 16:07:16 +08:00
guoling 3867fec5fa test multi-process lazy load bug on file size change 2025-11-24 12:10:51 +08:00
guoling 8b7eb242cb fix readonly crash #1597 2025-10-21 16:45:32 +08:00
guoling 4ad7236e0c dont depend on OS close() to unlock file locks, for Linux/Android flock() is buggy with mmap() 2025-05-07 14:23:41 +08:00
guoling dcfbc83f1c add importFrom() for Python/Golang 2025-04-25 15:23:24 +08:00
guoling 5a5805cdbc add checkExist() for Golang 2025-04-22 20:27:44 +08:00
guoling a7d70e187a NameSpace works on POSIX 2025-01-07 20:32:36 +08:00
tulip 068ca225ef feat: fix the link error on armv8.
fix "unknown reference crc32" link error on armv8.
2025-01-04 11:53:06 +08:00
guoling 47d3c0893a add readonly support 2024-09-06 19:44:11 +08:00
guoling 2183260881 fix set empty string/bytes value not working on auto key expire 2024-06-28 15:35:12 +08:00
guoling 6622c083b6 use PRId64 & PRIu64 to format 64 bit integer 2024-06-28 14:54:20 +08:00
guoling 38efa640da fix gcc compile error 2024-06-28 14:46:27 +08:00
guoling 08627bf8bd move python out of POSIX, prepare for Win32 support #1289 #1302 2024-06-27 18:16:58 +08:00
guoling 9341e03e19 make C++20 optional 2024-05-07 16:43:18 +08:00
guoling 9e8c30d7cb also support std::span<> 2024-05-06 17:54:17 +08:00
guoling 8b8852479b support encoding string_view 2024-04-29 18:05:44 +08:00
guoling 5a350d7ebf etc -> etc. 2024-04-29 16:26:07 +08:00
guoling 4f88f3260a update doc about set<!MMKV_SUPPORTED_VALUE_TYPE<T>>() 2024-04-29 15:29:52 +08:00
guoling 346e8f0f40 fix some testcase error 2024-04-29 14:32:37 +08:00
guoling 977a93fa09 almost done add vector<T> encode/decode support 2024-04-29 14:25:18 +08:00
guoling b990c2bd14 prepare to add vector<T> encode/decode support 2024-04-28 18:49:34 +08:00
guoling db61c3ea60 fix typo 2024-04-28 15:43:13 +08:00
guoling 416ed6ce90 fix linux compile error #1281 2024-04-26 18:26:10 +08:00
tulip 5403cea874 feat: use the embedded libz when libz cannot be found. 2024-03-31 19:03:04 +08:00
tulip 43f4c30fc3 Fix cgo cannot find functions reference when turn on "MMKV_DISABLE_CRYPT" 2023-12-26 00:16:17 +08:00
guoling 1c259bf62c test removeStorage() on Python 2023-12-06 15:39:40 +08:00
guoling c9549b6635 test removeStorage() on Golang 2023-12-06 15:21:23 +08:00
guoling e7322d8cee test removeStorage() on POSIX 2023-12-06 13:29:41 +08:00
guoling 557aaf6821 add clearAll(keepSpace:) & CompareBeforeSet for python 2023-11-16 16:19:33 +08:00
guoling 697128fc86 add ClearAllKeepSpace() for golang 2023-11-16 15:58:24 +08:00
guoling c1d5874f57 add CompareBeforeSet for golang 2023-11-16 15:48:26 +08:00
lishaokai eb9d8c1497 add clearAll with keeping file disk space 2023-10-08 14:07:13 +08:00
lishaokai 347b25feaa redo ftruncate file to its previous size when zeroFillFile fails(disk full) #1180 2023-09-26 17:53:29 +08:00
lishaokai 72b59356a9 compare value before set/encode for the same key 2023-09-12 20:36:10 +08:00
Lishaokai 7649e45d70 in place modification for getString to speed up 2023-09-06 15:59:37 +08:00
lishaokai e0f5321a9a override from beginning of file when dict is empty 2023-08-28 17:42:12 +08:00
Lishaokai c962b68934 Do not append to file when dic.size()==1 && new key in dict 2023-08-23 11:23:58 +08:00
kaitian521 5c88ea604b Merge branch 'dev' into dev 2023-08-11 21:32:26 +08:00