Skip to content

Commit

Permalink
Fix unknown string encoding issues
Browse files Browse the repository at this point in the history
See drycpp/lmdbxx#1 (comment) for more info
  • Loading branch information
badsyntax committed Nov 24, 2023
1 parent 55fd9d1 commit 1ebee7b
Show file tree
Hide file tree
Showing 10 changed files with 302 additions and 444 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the
## Credits

- Thanks to [sysmas](https://www.symas.com/) for open sourcing lmdb.
- Thanks to [lmdb++](https://github.com/drycpp/lmdbxx) for the useful c++ wrapper.
- Thanks to [drycpp/lmdb++](https://github.com/drycpp/lmdbxx) & [hoytech/lmdb++](https://github.com/hoytech/lmdbxx) for the useful c++ wrapper.

## License

Expand Down
2 changes: 1 addition & 1 deletion android/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.4.1)

set (CMAKE_VERBOSE_MAKEFILE ON)
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD 17)

add_library(cpp
SHARED
Expand Down
8 changes: 6 additions & 2 deletions android/cpp-adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ extern "C"
JNIEXPORT jstring JNICALL
Java_com_lmdb_LmdbModule_nativeGet(JNIEnv *env, jclass type, jstring key) {
std::string keyStr = getString(env, key);
std::string result = rnlmdb::get(keyStr);
return (env)->NewStringUTF(result.c_str());
auto result = rnlmdb::get(keyStr);
if (result.has_value()) {
return (env)->NewStringUTF(result.value().c_str());
} else {
return nullptr;
}
}

extern "C"
Expand Down
Loading

0 comments on commit 1ebee7b

Please sign in to comment.