Base: C++ core guidelines: init variables
This commit is contained in:
@@ -76,7 +76,7 @@ PyMethodDef UnitsApi::Methods[] = {
|
||||
|
||||
PyObject* UnitsApi::sParseQuantity(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
char *pstr;
|
||||
char *pstr{};
|
||||
if (!PyArg_ParseTuple(args, "et", "utf-8", &pstr))
|
||||
return nullptr;
|
||||
|
||||
@@ -108,7 +108,7 @@ PyObject* UnitsApi::sListSchemas(PyObject * /*self*/, PyObject *args)
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
int index;
|
||||
int index{};
|
||||
if (PyArg_ParseTuple(args, "i", &index)) {
|
||||
int num = static_cast<int>(UnitSystem::NumUnitSystemTypes);
|
||||
if (index < 0 || index >= num) {
|
||||
@@ -135,7 +135,7 @@ PyObject* UnitsApi::sGetSchema(PyObject * /*self*/, PyObject *args)
|
||||
PyObject* UnitsApi::sSetSchema(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
PyErr_Clear();
|
||||
int index;
|
||||
int index{};
|
||||
if (PyArg_ParseTuple(args, "i", &index)) {
|
||||
int num = static_cast<int>(UnitSystem::NumUnitSystemTypes);
|
||||
if (index < 0 || index >= num) {
|
||||
@@ -149,8 +149,8 @@ PyObject* UnitsApi::sSetSchema(PyObject * /*self*/, PyObject *args)
|
||||
|
||||
PyObject* UnitsApi::sSchemaTranslate(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
PyObject* q;
|
||||
int index;
|
||||
PyObject* q{};
|
||||
int index{};
|
||||
if (!PyArg_ParseTuple(args, "O!i", &(QuantityPy::Type), &q, &index))
|
||||
return nullptr;
|
||||
|
||||
@@ -163,7 +163,7 @@ PyObject* UnitsApi::sSchemaTranslate(PyObject * /*self*/, PyObject *args)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
double factor;
|
||||
double factor{};
|
||||
QString uus;
|
||||
QString uss = schema->schemaTranslate(quant, factor, uus);
|
||||
|
||||
@@ -177,12 +177,12 @@ PyObject* UnitsApi::sSchemaTranslate(PyObject * /*self*/, PyObject *args)
|
||||
|
||||
PyObject* UnitsApi::sToNumber(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
double value;
|
||||
double value{};
|
||||
char* format = "g";
|
||||
int decimals;
|
||||
int decimals{};
|
||||
|
||||
do {
|
||||
PyObject* q;
|
||||
PyObject* q{};
|
||||
if (PyArg_ParseTuple(args, "O!|si", &(QuantityPy::Type), &q, &format, &decimals)) {
|
||||
value = static_cast<QuantityPy*>(q)->getQuantityPtr()->getValue();
|
||||
break;
|
||||
@@ -203,7 +203,7 @@ PyObject* UnitsApi::sToNumber(PyObject * /*self*/, PyObject *args)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool ok;
|
||||
bool ok{};
|
||||
QuantityFormat qf;
|
||||
qf.format = QuantityFormat::toFormat(format[0], &ok);
|
||||
qf.precision = decimals;
|
||||
|
||||
Reference in New Issue
Block a user