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

Use Py_ssize_t when calculate buffer len #145

Merged
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 src/main/c/jni/org_jpy_PyLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ jlong JNICALL Java_org_jpy_PyLib_executeCode
codeChars = (*jenv)->GetStringUTFChars(jenv, jCode, NULL);
if (codeChars == NULL) {
PyLib_ThrowOOM(jenv);
return NULL;
return 0;
}

JPy_DIAG_PRINT(JPy_DIAG_F_EXEC, "Java_org_jpy_PyLib_executeCode: code='%s'\n", codeChars);
Expand Down
2 changes: 1 addition & 1 deletion src/main/c/jpy_diag.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ PyTypeObject Diag_Type =
sizeof (JPy_Diag), /* tp_basicsize */
0, /* tp_itemsize */
NULL, /* tp_dealloc */
NULL, /* tp_print */
0, /* tp_print */
NULL, /* tp_getattr */
NULL, /* tp_setattr */
NULL, /* tp_reserved */
Expand Down
2 changes: 1 addition & 1 deletion src/main/c/jpy_jarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ int JArray_GetBufferProc(JPy_JArray* self, Py_buffer* view, int flags, char java

// Step 2/5
view->buf = buf;
view->len = itemCount * itemSize;
view->len = (Py_ssize_t)itemCount * (Py_ssize_t)itemSize;
view->itemsize = itemSize;
view->readonly = (flags & (PyBUF_WRITE | PyBUF_WRITEABLE)) == 0;
self->bufReadonly &= view->readonly;
Expand Down
2 changes: 1 addition & 1 deletion src/main/c/jpy_jfield.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ PyTypeObject JField_Type = {
sizeof (JPy_JField), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)JField_dealloc, /* tp_dealloc */
NULL, /* tp_print */
0, /* tp_print */
NULL, /* tp_getattr */
NULL, /* tp_setattr */
NULL, /* tp_reserved */
Expand Down
4 changes: 2 additions & 2 deletions src/main/c/jpy_jmethod.c
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ PyTypeObject JMethod_Type = {
sizeof (JPy_JMethod), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)JMethod_dealloc, /* tp_dealloc */
NULL, /* tp_print */
0, /* tp_print */
NULL, /* tp_getattr */
NULL, /* tp_setattr */
NULL, /* tp_reserved */
Expand Down Expand Up @@ -1036,7 +1036,7 @@ PyTypeObject JOverloadedMethod_Type = {
sizeof (JPy_JOverloadedMethod), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)JOverloadedMethod_dealloc, /* tp_dealloc */
NULL, /* tp_print */
0, /* tp_print */
NULL, /* tp_getattr */
NULL, /* tp_setattr */
NULL, /* tp_reserved */
Expand Down
2 changes: 1 addition & 1 deletion src/main/c/jpy_jtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -2578,7 +2578,7 @@ PyTypeObject JType_Type = {
sizeof (JPy_JType), /* tp_basicsize */
0, /* tp_itemsize */
(destructor) JType_dealloc, /* tp_dealloc */
NULL, /* tp_print */
0, /* tp_print */
NULL, /* tp_getattr */
NULL, /* tp_setattr */
NULL, /* tp_reserved */
Expand Down
2 changes: 1 addition & 1 deletion src/main/c/jpy_verboseexcept.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ PyTypeObject VerboseExceptions_Type =
sizeof (VerboseExceptions_Type), /* tp_basicsize */
0, /* tp_itemsize */
NULL, /* tp_dealloc */
NULL, /* tp_print */
0, /* tp_print */
NULL, /* tp_getattr */
NULL, /* tp_setattr */
NULL, /* tp_reserved */
Expand Down
Loading