diff --git a/modules/cellframe-sdk/common/src/wrapping_dap_chain_tx_out_cond.c b/modules/cellframe-sdk/common/src/wrapping_dap_chain_tx_out_cond.c index 581d84ba3bb33246fd83162619c7db037c6598f4..8915f6934cab26033eaee58351bbe5e21e4e374a 100644 --- a/modules/cellframe-sdk/common/src/wrapping_dap_chain_tx_out_cond.c +++ b/modules/cellframe-sdk/common/src/wrapping_dap_chain_tx_out_cond.c @@ -3,18 +3,19 @@ PyObject *wrapping_dap_chain_tx_out_cond_get_ts_expires(PyObject *self, void *closure){ (void)closure; PyDateTime_IMPORT; - return PyDateTime_FromTimestamp((time_t)((PyDapChainTxOutCondObject*)self)->out_cond->header.ts_expires); + PyObject *timestamp = Py_BuildValue("k", ((PyDapChainTxOutCondObject*)self)->out_cond->header.ts_expires); + return PyDateTime_FromTimestamp(timestamp); } PyObject *wrapping_dap_chain_tx_out_cond_get_value(PyObject *self, void *closure){ (void)closure; - Py_BuildValue("k", ((PyDapChainTxOutCondObject*)self)->out_cond->header.value); + return Py_BuildValue("k", ((PyDapChainTxOutCondObject*)self)->out_cond->header.value); } PyObject *wrapping_dap_chain_tx_out_cond_get_type_subtype(PyObject *self, void *closure){ (void)closure; PyDapChainTxOutCondSubTypeObject *obj_type_subtype = PyObject_New(PyDapChainTxOutCondSubTypeObject, &DapChainTxOutCondSubType_DapChainTxOutCondSubTypeType); PyObject_Dir((PyObject*)obj_type_subtype); - obj_type_subtype->out_cond_subtype = ((PyDapChainTxOutCondObject*)self)->out_cond->header.subtype; + obj_type_subtype->out_cond_subtype = &((PyDapChainTxOutCondObject*)self)->out_cond->header.subtype; return (PyObject*)obj_type_subtype; } PyObject *wrapping_dap_chain_tx_out_cond_get_subtype(PyObject *self, void *closure){ diff --git a/modules/cellframe-sdk/common/src/wrapping_dap_chain_tx_pkey.c b/modules/cellframe-sdk/common/src/wrapping_dap_chain_tx_pkey.c index 5546821332370755f42c2cdd66d58a2391b76d4d..25e8e6b458b32b16b03930865f8f5e89be9053e7 100644 --- a/modules/cellframe-sdk/common/src/wrapping_dap_chain_tx_pkey.c +++ b/modules/cellframe-sdk/common/src/wrapping_dap_chain_tx_pkey.c @@ -18,6 +18,6 @@ PyObject *wrapping_dap_chain_tx_pkey_seq_no(PyObject *self, void *closure){ PyObject *wrapping_dap_chain_tx_pkey_get_pkey(PyObject *self, void *closure){ (void)closure; PyDapPkeyObject *obj_pkey = PyObject_NEW(PyDapPkeyObject, &DapPkeyTypeObject_DapPkeyTypeObjectType); - obj_pkey->pkey = ((PyDapChainTXPkeyObject*)self)->tx_pkey->pkey; + obj_pkey->pkey = (dap_pkey_t *)((PyDapChainTXPkeyObject*)self)->tx_pkey->pkey; return (PyObject*)obj_pkey; -} \ No newline at end of file +} diff --git a/modules/cellframe-sdk/common/src/wrapping_dap_chain_tx_receipt.c b/modules/cellframe-sdk/common/src/wrapping_dap_chain_tx_receipt.c index 0d35171804a127db69e5ddf768d2f75f1cb72940..e45e9547b4cd12a5ae22e7da915a8163b984f2d9 100644 --- a/modules/cellframe-sdk/common/src/wrapping_dap_chain_tx_receipt.c +++ b/modules/cellframe-sdk/common/src/wrapping_dap_chain_tx_receipt.c @@ -26,6 +26,7 @@ PyObject *wrapping_dap_chain_tx_receipt_get_value(PyObject *self, void *closure) return Py_BuildValue("k", ((PyDapChainTXReceiptObject*)self)->tx_receipt->receipt_info.value_datoshi); } PyObject *wrapping_dap_chain_tx_receipt_get_sig_provider(PyObject *self, void *closure){ + (void)closure; uint16_t l_exts_size = ((PyDapChainTXReceiptObject*)self)->tx_receipt->exts_size; if (l_exts_size == sizeof(dap_sign_t) + sizeof(dap_sign_t) || l_exts_size == sizeof(dap_sign_t)){ PyObject *obj_sign_provider = _PyObject_New(&DapSignObject_DapSignObjectType); @@ -36,11 +37,12 @@ PyObject *wrapping_dap_chain_tx_receipt_get_sig_provider(PyObject *self, void *c ((PyDapSignObject*)obj_sign_provider)->sign, ((PyDapChainTXReceiptObject*)self)->tx_receipt->exts_n_signs, sizeof(dap_sign_t)); - } else { - return Py_None; + return obj_sign_provider; } + return Py_None; } PyObject *wrapping_dap_chain_tx_receipt_get_sig_client(PyObject *self, void *closure){ + (void)closure; uint16_t l_exts_size = ((PyDapChainTXReceiptObject*)self)->tx_receipt->exts_size; if (l_exts_size == sizeof(dap_sign_t) + sizeof(dap_sign_t)){ PyObject *obj_sign_client = _PyObject_New(&DapSignObject_DapSignObjectType); @@ -51,7 +53,7 @@ PyObject *wrapping_dap_chain_tx_receipt_get_sig_client(PyObject *self, void *clo ((PyDapSignObject*)obj_sign_client)->sign, ((PyDapChainTXReceiptObject*)self)->tx_receipt->exts_n_signs + sizeof(dap_sign_t), sizeof(dap_sign_t)); - } else { - return Py_None; + return obj_sign_client; } + return Py_None; } diff --git a/modules/cellframe-sdk/net/src/libdap_chain_net_python.c b/modules/cellframe-sdk/net/src/libdap_chain_net_python.c index 2ea714cd25d5e6af13b0065e911b8c6877ecd421..bd350d87eec5887062ea26fcad7d9aa8d6540a8d 100644 --- a/modules/cellframe-sdk/net/src/libdap_chain_net_python.c +++ b/modules/cellframe-sdk/net/src/libdap_chain_net_python.c @@ -164,7 +164,7 @@ PyObject *dap_chain_net_get_chain_by_chain_type_py(PyObject *self, PyObject *arg PyObject *dap_chain_net_get_ledger_py(PyObject *self, PyObject *args){ (void)args; - PyObject *obj_ledger = PyObject_New(PyDapChainLedgerObject, &DapChainLedger_DapChainLedgerType); + PyObject *obj_ledger = (PyObject *)PyObject_New(PyDapChainLedgerObject, &DapChainLedger_DapChainLedgerType); PyObject_Dir(obj_ledger); ((PyDapChainLedgerObject*)obj_ledger)->ledger = ((PyDapChainNetObject*)self)->chain_net->pub.ledger; return obj_ledger; diff --git a/modules/dap-sdk/net/server/json_rpc/src/wrapping_json_rpc_request.c b/modules/dap-sdk/net/server/json_rpc/src/wrapping_json_rpc_request.c index 53244c7ce49c1d1a73d306cb9deb3ae77b56cb29..d9b353ca8f13accb1666469f3b4a88b6aa1fd72d 100644 --- a/modules/dap-sdk/net/server/json_rpc/src/wrapping_json_rpc_request.c +++ b/modules/dap-sdk/net/server/json_rpc/src/wrapping_json_rpc_request.c @@ -7,7 +7,7 @@ struct _w_json_rpc_handler *handlers = NULL; void _w_dap_json_rpc_request_handler(dap_json_rpc_params_t *a_params, dap_json_rpc_response_t *a_response, const char *a_method){ int count_params = a_params->lenght; PyDapJSONRPCResponseObject *obj_response = PyObject_NEW(PyDapJSONRPCResponseObject, &DapJSONRPCResponse_DapJSONRPCResponseType); - obj_response = PyObject_Init((PyObject*)obj_response, &DapJSONRPCResponse_DapJSONRPCResponseType); + obj_response = (PyDapJSONRPCResponseObject *)PyObject_Init((PyObject*)obj_response, &DapJSONRPCResponse_DapJSONRPCResponseType); obj_response->response = a_response; PyObject *obj_params = PyList_New(count_params); for (int i=0; i < count_params; i++) { @@ -33,7 +33,7 @@ void _w_dap_json_rpc_request_handler(dap_json_rpc_params_t *a_params, dap_json_r tmp_string = (char *) a_params->params[i]->value_param; obj_ptr = PyUnicode_FromString(tmp_string); break; - + default: break; } if (obj_ptr != NULL) { PyList_SetItem(obj_params, i, obj_ptr); @@ -53,14 +53,14 @@ void _w_dap_json_rpc_request_handler(dap_json_rpc_params_t *a_params, dap_json_r if (!obj_result){ log_it(L_ERROR, "Can't called method: %s", a_method); a_response->type_result = TYPE_RESPONSE_NULL; - a_response->error = dap_json_rpc_error_JSON_create(); + a_response->error = DAP_NEW(dap_json_rpc_error_t); a_response->error->code_error = 0xF1; a_response->error->msg = "Can't called method"; //a_response->error = dap_json_rpc_error_search_by_code(1); return; } } else { - log_it(L_WARNING, "%s method can't be called, it is not in the python function call table."); + log_it(L_WARNING, "%s method can't be called, it is not in the python function call table.", a_method); a_response->type_result = TYPE_RESPONSE_NULL; a_response->error = dap_json_rpc_error_search_by_code(1); } diff --git a/modules/dap-sdk/net/server/json_rpc/src/wrapping_json_rpc_response.c b/modules/dap-sdk/net/server/json_rpc/src/wrapping_json_rpc_response.c index 463ff1ff28a38f6476b6f8a2d744e3cc5500601e..604569a3e9dc4934a048a9664b6623e6abb8b0e0 100644 --- a/modules/dap-sdk/net/server/json_rpc/src/wrapping_json_rpc_response.c +++ b/modules/dap-sdk/net/server/json_rpc/src/wrapping_json_rpc_response.c @@ -55,9 +55,10 @@ PyObject *wrapping_json_rpc_response_get_result(PyObject *self, void *closure){ return Py_BuildValue("s", l_resp->result_string); break; case TYPE_RESPONSE_NULL: - return Py_BuildValue("O", Py_None); + default: break; } + return Py_BuildValue("O", Py_None); } PyObject *wrapping_json_rpc_response_get_error(PyObject *self, void *closure){ UNUSED(closure);