Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Two small fixes for ShortArray #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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 src/main/cpp/ShortArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void ShortArray::set(JNIEnv *env, jshortArray data) {
if (_num_elements == 0) {
_data = NULL;
} else {
_data = (short *)malloc(_num_elements);
_data = (short *)malloc(_num_elements * sizeof(jshort));
env->GetShortArrayRegion(data, 0, (jsize)_num_elements, (jshort *)_data);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/cpp/ShortArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class EXPORT ShortArray {
/**
* @brief Get a pointer to the natively stored data
*/
const void* get() const { return _data; }
short* get() const { return _data; }

/**
* @brief Convert data to a Java byte[] array
Expand Down