Skip to content

Commit 3c15db4

Browse files
committed
Various linter fixes
1 parent 2cee444 commit 3c15db4

4 files changed

Lines changed: 20 additions & 12 deletions

File tree

code/examples/dis_queues_extended.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
print("Listing queues...")
5151

5252
# Create an empty list to hold the responses, instead of having it as a returned value
53-
response=[]
53+
response = []
5454
try:
5555
pcf.MQCMD_INQUIRE_Q(name_attrs, responses=response)
5656
except mq.MQMIError as e:
@@ -82,7 +82,7 @@
8282
if not no_queues:
8383
print()
8484
print("Listing queue status...")
85-
response=[]
85+
response = []
8686
try:
8787
pcf.MQCMD_INQUIRE_Q_STATUS(status_attrs, responses=response)
8888
except mq.MQMIError as e:

code/ibmmq/ibmmqc.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ elements of a tuple. Any other returned elements precede those in the tuple.\
6565
\
6666
";
6767

68+
69+
// For Windows, we won't want warnings about functions like ctime that we know are OK in the way we use them
70+
#define _CRT_SECURE_NO_WARNINGS
71+
6872
#include <time.h>
6973

7074
#include <cmqc.h>
@@ -244,7 +248,6 @@ that is empty/not supplied.\
244248
static PyObject * ibmmqc_MQLOGCF(PyObject *self, PyObject *args) {
245249
char *filename = NULL;
246250
long lOpts;
247-
PyObject *nameObj;
248251

249252
if (!PyArg_ParseTuple(args, "l|s", &lOpts,&filename)) {
250253
return NULL;
@@ -873,7 +876,7 @@ static PyObject *ibmmqc_MQINQ(PyObject *self, PyObject *args) {
873876
return NULL;
874877
}
875878

876-
selectorCount = PyList_Size(lSelectors);
879+
selectorCount = (MQLONG)PyList_Size(lSelectors);
877880

878881
selectors = myAlloc(sizeof(MQLONG) * selectorCount, "MQINQ");
879882
if (selectors) {
@@ -994,6 +997,7 @@ static PyObject *ibmmqc_MQSET(PyObject *self, PyObject *args) {
994997

995998
if (intAttrs) {
996999
myFree(intAttrs);
1000+
9971001
}
9981002

9991003
if (selectors) {
@@ -1439,7 +1443,7 @@ static PyObject* ibmmqc_MQSETMP(PyObject *self, PyObject *args) {
14391443
}
14401444
value_length = sizeof(MQINT16);
14411445
property_value_free = 1;
1442-
*(PMQINT16)value = PyLong_AsLong(property_value_object);
1446+
*(PMQINT16)value = (MQINT16)PyLong_AsLong(property_value_object);
14431447
break;
14441448

14451449
/* 32-bit integer value */
@@ -1512,10 +1516,10 @@ static PyObject* ibmmqc_MQSETMP(PyObject *self, PyObject *args) {
15121516
pd = (MQPD *)pd_buffer;
15131517

15141518
name.VSPtr = property_name;
1515-
name.VSLength = property_name_length;
1519+
name.VSLength = (MQLONG)property_name_length;
15161520

15171521
Py_BEGIN_ALLOW_THREADS
1518-
MQSETMP((MQHCONN)lQmgrHandle, msg_handle, smpo, &name, pd, property_type, value_length,
1522+
MQSETMP((MQHCONN)lQmgrHandle, msg_handle, smpo, &name, pd, property_type, (MQLONG)value_length,
15191523
value, &compCode, &reasonCode);
15201524
Py_END_ALLOW_THREADS
15211525

@@ -1571,7 +1575,7 @@ static PyObject* ibmmqc_MQINQMP(PyObject *self, PyObject *args) {
15711575

15721576
property_type = (MQLONG)lPropertyType;
15731577
name.VSPtr = property_name;
1574-
name.VSLength = property_name_length;
1578+
name.VSLength = (MQLONG)property_name_length;
15751579

15761580
// We know that the property_name is null-terminated because of
15771581
// how Python passes the value. Only ask for the name if a wildcard
@@ -1583,7 +1587,7 @@ static PyObject* ibmmqc_MQINQMP(PyObject *self, PyObject *args) {
15831587
}
15841588
impo->ReturnedName.VSCCSID = MQCCSI_APPL;
15851589
impo->ReturnedName.VSLength = 0;
1586-
impo->ReturnedName.VSBufSize = vsbufsize;
1590+
impo->ReturnedName.VSBufSize = (MQLONG)vsbufsize;
15871591
}
15881592

15891593
void *value = NULL;
@@ -1748,7 +1752,7 @@ static PyObject* ibmmqc_MQDLTMP(PyObject *self, PyObject *args) {
17481752
}
17491753

17501754
name.VSPtr = property_name;
1751-
name.VSLength = property_name_length;
1755+
name.VSLength = (MQLONG)property_name_length;
17521756

17531757
MQDLTMP((MQHCONN)lQmgrHandle, msg_handle, dmpo, &name, &compCode, &reasonCode);
17541758

@@ -1915,7 +1919,9 @@ PyMODINIT_FUNC PyInit_ibmmqc(void) {
19151919
PyDict_SetItemString(v,"sts", PyLong_FromLong((long)MQSTS_CURRENT_VERSION));
19161920
#endif
19171921
#if defined(MQTMC_CURRENT_VERSION)
1918-
PyDict_SetItemString(v,"tmc", PyLong_FromLong((long)MQTMC_CURRENT_VERSION));
1922+
// This constant is defined as a string in the MQI headers. So we hardcode the equivalent int, as it's
1923+
// unlikely to change.
1924+
PyDict_SetItemString(v,"tmc", PyLong_FromLong((long)2));
19191925
#endif
19201926
#if defined(MQTM_CURRENT_VERSION)
19211927
PyDict_SetItemString(v,"tm", PyLong_FromLong((long)MQTM_CURRENT_VERSION));

code/ibmmq/mqadmin.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,4 +714,3 @@ def unpack(message: bytes) -> tuple[dict, CFH]:
714714
more detailed function for test compatibility.
715715
"""
716716
return PCFExecute._unpack_option(message, False)
717-

tools/checkBaseLevel.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ curdir=`pwd`
1010
# Location of old header files
1111
export MQ_FILE_PATH=/opt/mqm.91
1212

13+
printf "Building against MQ: "
14+
$MQ_FILE_PATH/bin/dspmqver -f2
15+
1316
# Start with the default installed Python version
1417
python=python
1518

0 commit comments

Comments
 (0)