Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix string encoding issues #2

Merged
merged 1 commit into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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