micuintus / harbour-Berlin-Vegan

Berlin-Vegan Guide
Other
14 stars 4 forks source link

Micu/#234 open hours to venue model #235

Closed micuintus closed 6 years ago

jmastr commented 6 years ago

Without any real review, just compiling it yields to:

In file included from ../harbour-Berlin-Vegan/src/VenueModel.cpp:3:
../harbour-Berlin-Vegan/src/OpeningHoursAlgorithms.h:48:14: warning: variable 'curr' is used uninitialized whenever function 'condenseOpeningHours' is called [-Wsometimes-uninitialized]
    unsigned curr, next = 1;
    ~~~~~~~~~^~~~
../harbour-Berlin-Vegan/src/OpeningHoursAlgorithms.h:51:12: note: uninitialized use occurs here
    while (curr < numElements)
           ^~~~
../harbour-Berlin-Vegan/src/OpeningHoursAlgorithms.h:48:18: note: initialize the variable 'curr' to silence this warning
    unsigned curr, next = 1;
                 ^
                  = 0
1 warning generated.
jmastr commented 6 years ago

After your patch, the opening hours are just gone.

Might be because of:

-            model: OpeningHoursModel {
-                id: openingHoursModel
-                openingData: {
-                    "otMon": venueDetails.restaurant.otMon,
-                    "otTue": venueDetails.restaurant.otTue,
-                    "otWed": venueDetails.restaurant.otWed,
-                    "otThu": venueDetails.restaurant.otThu,
-                    "otFri": venueDetails.restaurant.otFri,
-                    "otSat": venueDetails.restaurant.otSat,
-                    "otSun": venueDetails.restaurant.otSun
-                }
-
-                Component.onCompleted: condenseOpeningHoursModel()
-            }
+            model: restaurant.condensedOpeningHours.length

but I am not sure...

screen shot 2018-06-10 at 16 25 39
micuintus commented 6 years ago

Oh, sorry, I didn't see that warning on my machine. For some some strange reasons my compiler interpreted this code in the way I meant it and not in the undefined behavior how a compiler could (should) interpret it by the C++ standard. See https://stackoverflow.com/questions/6838408/how-can-i-declare-and-define-multiple-variables-in-one-line-using-c