Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.getMQICharV = function(c) {
if (c && c.VSPtr && c.VSLength > 0) {
var s = ref.reinterpret(c.VSPtr,c.VSLength,'utf8');
c.VSPtr = ref.NULL; // encourage GC to reclaim buffer
return s;
} else {
c.VSPtr = ref.NULL;
c.VSLength = 0;
c.VSBufSize = 0;
return null;
}
};
case MQC.MQTYPE_INT16:
if (le) {
value = valuePtr.readInt16LE(0);
} else {
value = valuePtr.readInt16BE(0);
}
break;
case MQC.MQTYPE_INT32:
if (le) {
value = valuePtr.readInt32LE(0);
} else {
value = valuePtr.readInt32BE(0);
}
break;
case MQC.MQTYPE_STRING:
value = ref.reinterpret(valuePtr,jsPropsLen,'utf8');
break;
case MQC.MQTYPE_BOOLEAN:
if (le) {
value = valuePtr.readInt32LE(0) != 0;
} else {
value = valuePtr.readInt32BE(0) !=0 ;
}
break;
case MQC.MQTYPE_BYTE_STRING:
value = valuePtr;
break;
default:
debugLog("Unknown property type %d",jsType);
value = valuePtr;
break;
}