summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-10-20 05:50:09 +0200
committerSven Gothel <[email protected]>2020-10-20 05:50:09 +0200
commit94205b2e99d114f4238e2b846dce980901a59459 (patch)
treef8035cb58698089117a72971db0707cea007b4a8 /src
parent16b45949632960c9e4ccfc10b44f3cd4433cf78f (diff)
Use -Wshadow: Shadowing (or local scope override) often causing sloppy bugs, avoid 2/2 (tinyb)
Diffstat (limited to 'src')
-rw-r--r--src/tinyb/BluetoothAdapter.cpp16
-rw-r--r--src/tinyb/BluetoothDevice.cpp40
-rw-r--r--src/tinyb/BluetoothEvent.cpp28
-rw-r--r--src/tinyb/BluetoothGattCharacteristic.cpp16
-rw-r--r--src/tinyb/BluetoothGattDescriptor.cpp12
-rw-r--r--src/tinyb/BluetoothGattService.cpp14
-rw-r--r--src/tinyb/BluetoothManager.cpp6
7 files changed, 66 insertions, 66 deletions
diff --git a/src/tinyb/BluetoothAdapter.cpp b/src/tinyb/BluetoothAdapter.cpp
index c09e9c1f..c8ea3fbd 100644
--- a/src/tinyb/BluetoothAdapter.cpp
+++ b/src/tinyb/BluetoothAdapter.cpp
@@ -103,19 +103,19 @@ BluetoothType BluetoothAdapter::get_bluetooth_type() const
return BluetoothType::ADAPTER;
}
-BluetoothAdapter::BluetoothAdapter(Adapter1 *object)
+BluetoothAdapter::BluetoothAdapter(Adapter1 *object_)
{
- this->object = object;
- g_object_ref(object);
+ this->object = object_;
+ g_object_ref(object_);
- g_signal_connect(G_DBUS_PROXY(object), "g-properties-changed",
+ g_signal_connect(G_DBUS_PROXY(object_), "g-properties-changed",
G_CALLBACK(BluetoothNotificationHandler::on_properties_changed_adapter), this);
valid = true;
}
-BluetoothAdapter::BluetoothAdapter(const BluetoothAdapter &object)
+BluetoothAdapter::BluetoothAdapter(const BluetoothAdapter &object_)
{
- BluetoothAdapter(object.object);
+ BluetoothAdapter(object_.object);
}
BluetoothAdapter *BluetoothAdapter::clone() const
@@ -158,9 +158,9 @@ std::vector<std::unique_ptr<BluetoothDevice>> BluetoothAdapter::get_devices()
GList *l, *objects = g_dbus_object_manager_get_objects(gdbus_manager);
for (l = objects; l != NULL; l = l->next) {
- Object *object = OBJECT(l->data);
+ Object *object2 = OBJECT(l->data);
- auto p = BluetoothDevice::make(object,
+ auto p = BluetoothDevice::make(object2,
BluetoothType::DEVICE, NULL, NULL, this);
if (p != nullptr)
vector.push_back(std::move(p));
diff --git a/src/tinyb/BluetoothDevice.cpp b/src/tinyb/BluetoothDevice.cpp
index bee0205e..f8160a7d 100644
--- a/src/tinyb/BluetoothDevice.cpp
+++ b/src/tinyb/BluetoothDevice.cpp
@@ -87,22 +87,22 @@ void BluetoothNotificationHandler::on_properties_changed_device(GDBusProxy *prox
if (mfg_callback != nullptr && g_ascii_strncasecmp(key, "manufacturerdata", 16) == 0) {
std::map<uint16_t, std::vector<uint8_t>> new_value;
- GVariantIter *iter;
- g_variant_get (value, "a{qv}", &iter);
+ GVariantIter *iter_;
+ g_variant_get (value, "a{qv}", &iter_);
GVariant *array;
- uint16_t key;
+ uint16_t key_;
uint8_t val;
- while (g_variant_iter_loop(iter, "{qv}", &key, &array)) {
+ while (g_variant_iter_loop(iter_, "{qv}", &key_, &array)) {
GVariantIter it_array;
g_variant_iter_init(&it_array, array);
while(g_variant_iter_loop(&it_array, "y", &val)) {
- new_value[key].push_back(val);
+ new_value[key_].push_back(val);
}
}
- g_variant_iter_free(iter);
+ g_variant_iter_free(iter_);
mfg_callback(new_value);
continue;
}
@@ -110,22 +110,22 @@ void BluetoothNotificationHandler::on_properties_changed_device(GDBusProxy *prox
if (service_callback != nullptr && g_ascii_strncasecmp(key, "servicedata", 11) == 0) {
std::map<std::string, std::vector<uint8_t>> new_value;
- GVariantIter *iter;
- g_variant_get (value, "a{sv}", &iter);
+ GVariantIter *iter_;
+ g_variant_get (value, "a{sv}", &iter_);
GVariant *array;
- const char* key;
+ const char* key_;
uint8_t val;
- while (g_variant_iter_loop(iter, "{sv}", &key, &array)) {
+ while (g_variant_iter_loop(iter_, "{sv}", &key_, &array)) {
GVariantIter it_array;
g_variant_iter_init(&it_array, array);
while(g_variant_iter_loop(&it_array, "y", &val)) {
- new_value[key].push_back(val);
+ new_value[key_].push_back(val);
}
}
- g_variant_iter_free(iter);
+ g_variant_iter_free(iter_);
service_callback(new_value);
continue;
}
@@ -163,19 +163,19 @@ BluetoothType BluetoothDevice::get_bluetooth_type() const
return BluetoothType::DEVICE;
}
-BluetoothDevice::BluetoothDevice(Device1 *object)
+BluetoothDevice::BluetoothDevice(Device1 *object_)
{
- this->object = object;
- g_object_ref(object);
+ this->object = object_;
+ g_object_ref(object_);
- g_signal_connect(G_DBUS_PROXY(object), "g-properties-changed",
+ g_signal_connect(G_DBUS_PROXY(object_), "g-properties-changed",
G_CALLBACK(BluetoothNotificationHandler::on_properties_changed_device), this);
valid = true;
}
-BluetoothDevice::BluetoothDevice(const BluetoothDevice &object)
+BluetoothDevice::BluetoothDevice(const BluetoothDevice &object_)
{
- BluetoothDevice(object.object);
+ BluetoothDevice(object_.object);
}
BluetoothDevice::~BluetoothDevice()
@@ -218,9 +218,9 @@ std::vector<std::unique_ptr<BluetoothGattService>> BluetoothDevice::get_services
GList *l, *objects = g_dbus_object_manager_get_objects(gdbus_manager);
for (l = objects; l != NULL; l = l->next) {
- Object *object = OBJECT(l->data);
+ Object *object2 = OBJECT(l->data);
- auto p = BluetoothGattService::make(object,
+ auto p = BluetoothGattService::make(object2,
BluetoothType::GATT_SERVICE, NULL, NULL, this);
if (p != nullptr)
vector.push_back(std::move(p));
diff --git a/src/tinyb/BluetoothEvent.cpp b/src/tinyb/BluetoothEvent.cpp
index 10558edb..a92fa851 100644
--- a/src/tinyb/BluetoothEvent.cpp
+++ b/src/tinyb/BluetoothEvent.cpp
@@ -38,36 +38,36 @@ void BluetoothEvent::generic_callback(BluetoothObject &object, void *data)
generic_data->notify();
}
-BluetoothEvent::BluetoothEvent(BluetoothType type, std::string *name,
- std::string *identifier, BluetoothObject *parent, bool execute_once,
- BluetoothCallback cb, void *data)
+BluetoothEvent::BluetoothEvent(BluetoothType type_, std::string *name_,
+ std::string *identifier_, BluetoothObject *parent_, bool execute_once_,
+ BluetoothCallback cb_, void *data_)
{
canceled = false;
- this->type = type;
- if (name != nullptr)
- this->name = new std::string(*name);
+ this->type = type_;
+ if (name_ != nullptr)
+ this->name = new std::string(*name_);
else
this->name = nullptr;
- if (identifier != nullptr)
- this->identifier = new std::string(*identifier);
+ if (identifier_ != nullptr)
+ this->identifier = new std::string(*identifier_);
else
this->identifier = nullptr;
- if (parent != nullptr)
- this->parent = parent->clone();
+ if (parent_ != nullptr)
+ this->parent = parent_->clone();
else
this->parent = nullptr;
- this->execute_once = execute_once;
+ this->execute_once = execute_once_;
- if (cb == nullptr) {
+ if (cb_ == nullptr) {
this->data = static_cast<void *>(&cv);
this->cb = generic_callback;
}
else {
- this->cb = cb;
- this->data = data;
+ this->cb = cb_;
+ this->data = data_;
}
}
diff --git a/src/tinyb/BluetoothGattCharacteristic.cpp b/src/tinyb/BluetoothGattCharacteristic.cpp
index 33c14fcd..b051cba6 100644
--- a/src/tinyb/BluetoothGattCharacteristic.cpp
+++ b/src/tinyb/BluetoothGattCharacteristic.cpp
@@ -74,18 +74,18 @@ BluetoothType BluetoothGattCharacteristic::get_bluetooth_type() const
return BluetoothType::GATT_CHARACTERISTIC;
}
-BluetoothGattCharacteristic::BluetoothGattCharacteristic(GattCharacteristic1 *object)
+BluetoothGattCharacteristic::BluetoothGattCharacteristic(GattCharacteristic1 *object_)
{
- this->object = object;
- g_object_ref(object);
+ this->object = object_;
+ g_object_ref(object_);
- g_signal_connect(G_DBUS_PROXY(object), "g-properties-changed",
+ g_signal_connect(G_DBUS_PROXY(object_), "g-properties-changed",
G_CALLBACK(BluetoothNotificationHandler::on_properties_changed_characteristic), this);
}
-BluetoothGattCharacteristic::BluetoothGattCharacteristic(const BluetoothGattCharacteristic &object)
+BluetoothGattCharacteristic::BluetoothGattCharacteristic(const BluetoothGattCharacteristic &object_)
{
- BluetoothGattCharacteristic(object.object);
+ BluetoothGattCharacteristic(object_.object);
}
@@ -310,9 +310,9 @@ std::vector<std::unique_ptr<BluetoothGattDescriptor>> BluetoothGattCharacteristi
GList *l, *objects = g_dbus_object_manager_get_objects(gdbus_manager);
for (l = objects; l != NULL; l = l->next) {
- Object *object = OBJECT(l->data);
+ Object *object2 = OBJECT(l->data);
- auto p = BluetoothGattDescriptor::make(object,
+ auto p = BluetoothGattDescriptor::make(object2,
BluetoothType::GATT_DESCRIPTOR, NULL, NULL, this);
if (p != nullptr)
vector.push_back(std::move(p));
diff --git a/src/tinyb/BluetoothGattDescriptor.cpp b/src/tinyb/BluetoothGattDescriptor.cpp
index 3732d37f..48217114 100644
--- a/src/tinyb/BluetoothGattDescriptor.cpp
+++ b/src/tinyb/BluetoothGattDescriptor.cpp
@@ -73,19 +73,19 @@ BluetoothType BluetoothGattDescriptor::get_bluetooth_type() const
return BluetoothType::GATT_DESCRIPTOR;
}
-BluetoothGattDescriptor::BluetoothGattDescriptor(GattDescriptor1 *object)
+BluetoothGattDescriptor::BluetoothGattDescriptor(GattDescriptor1 *object_)
{
- this->object = object;
- g_object_ref(object);
+ this->object = object_;
+ g_object_ref(object_);
- g_signal_connect(G_DBUS_PROXY(object), "g-properties-changed",
+ g_signal_connect(G_DBUS_PROXY(object_), "g-properties-changed",
G_CALLBACK(BluetoothNotificationHandler::on_properties_changed_descriptor), this);
valid = true;
}
-BluetoothGattDescriptor::BluetoothGattDescriptor(const BluetoothGattDescriptor &object)
+BluetoothGattDescriptor::BluetoothGattDescriptor(const BluetoothGattDescriptor &object_)
{
- BluetoothGattDescriptor(object.object);
+ BluetoothGattDescriptor(object_.object);
}
BluetoothGattDescriptor::~BluetoothGattDescriptor()
diff --git a/src/tinyb/BluetoothGattService.cpp b/src/tinyb/BluetoothGattService.cpp
index d63893eb..0897ef4c 100644
--- a/src/tinyb/BluetoothGattService.cpp
+++ b/src/tinyb/BluetoothGattService.cpp
@@ -51,15 +51,15 @@ BluetoothType BluetoothGattService::get_bluetooth_type() const
return BluetoothType::GATT_SERVICE;
}
-BluetoothGattService::BluetoothGattService(GattService1 *object)
+BluetoothGattService::BluetoothGattService(GattService1 *object_)
{
- this->object = object;
- g_object_ref(object);
+ this->object = object_;
+ g_object_ref(object_);
}
-BluetoothGattService::BluetoothGattService(const BluetoothGattService &object)
+BluetoothGattService::BluetoothGattService(const BluetoothGattService &object_)
{
- BluetoothGattService(object.object);
+ BluetoothGattService(object_.object);
}
BluetoothGattService::~BluetoothGattService()
@@ -134,9 +134,9 @@ std::vector<std::unique_ptr<BluetoothGattCharacteristic>> BluetoothGattService::
GList *l, *objects = g_dbus_object_manager_get_objects(gdbus_manager);
for (l = objects; l != NULL; l = l->next) {
- Object *object = OBJECT(l->data);
+ Object *object2 = OBJECT(l->data);
- auto p = BluetoothGattCharacteristic::make(object,
+ auto p = BluetoothGattCharacteristic::make(object2,
BluetoothType::GATT_CHARACTERISTIC, NULL, NULL, this);
if (p != nullptr)
vector.push_back(std::move(p));
diff --git a/src/tinyb/BluetoothManager.cpp b/src/tinyb/BluetoothManager.cpp
index 71a42bc9..127ebf4c 100644
--- a/src/tinyb/BluetoothManager.cpp
+++ b/src/tinyb/BluetoothManager.cpp
@@ -248,18 +248,18 @@ void BluetoothManager::handle_event(BluetoothType type, std::string *name,
static gpointer init_manager_thread(void *data)
{
GMainLoop *loop;
- GDBusObjectManager *gdbus_manager = (GDBusObjectManager *) data;
+ GDBusObjectManager *_gdbus_manager = (GDBusObjectManager *) data;
g_main_context_push_thread_default(manager_context);
loop = g_main_loop_new(manager_context, FALSE);
- g_signal_connect(gdbus_manager,
+ g_signal_connect(_gdbus_manager,
"interface-added",
G_CALLBACK(BluetoothEventManager::on_interface_added),
NULL);
- g_signal_connect(gdbus_manager,
+ g_signal_connect(_gdbus_manager,
"object-added",
G_CALLBACK(BluetoothEventManager::on_object_added),
NULL);