h2zero / esp-nimble-cpp

C++ library for the esp32 NimBLE stack based on and mostly compatible with @nkolban cpp_utils BLE library.
https://h2zero.github.io/esp-nimble-cpp/
Apache License 2.0
182 stars 62 forks source link

NimBLE UUID operator== does not behave as expected #187

Closed tecera closed 4 months ago

tecera commented 4 months ago

Testing the latest commit it seems to me that the behaviour of the == operator for NimBLEUUID has had an unintended change in behaviour.

Taking the following code (paraphrased):

const NimBLEUUID uuid_a("1da54c75-a319-49d4-b925-18b2b804af1d");
const NimBLEUUID uuid_b("530b7314-9ff5-47c8-a1f9-756a691f2018");

printf("Compared: %s == %s -> %i",
    uuid_a.toString().c_str(),
    uuid_b.toString().c_str(),
    uuid_a == uuid_b);

I get the following output:

Compared: 1da54c75-a319-49d4-b925-18b2b804af1d == 530b7314-9ff5-47c8-a1f9-756a691f2018 -> 1

Which seems weird to me. Reverting to the previous commit does result in the expected behaviour where the two uuid's are not equal to each other.

h2zero commented 4 months ago

Thanks!, looks like the return statement in that function got clobbered somewhere along the way. Will fix in a few moments.