Skip to content

Commit 393167c

Browse files
committed
Fix compiler warnings
1 parent 0257df3 commit 393167c

File tree

32 files changed

+165
-125
lines changed

32 files changed

+165
-125
lines changed

examples/CloudStorage/OTA/OTA.ino

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,18 @@
3232
#define ENABLE_USER_CONFIG
3333
#define ENABLE_SERVICE_AUTH
3434
#define ENABLE_CLOUD_STORAGE
35+
#define ENABLE_OTA
3536

3637
#include <FirebaseClient.h>
3738
#include "ExampleFunctions.h" // Provides the functions used in the examples.
3839

40+
// For Arduino SAMD21 OTA supports.
41+
// See https://github.com/mobizt/FirebaseClient#ota-update.
42+
#if defined(ARDUINO_ARCH_SAMD)
43+
#include <Internal_Storage_OTA.h>
44+
#define OTA_STORAGE InternalStorage
45+
#endif
46+
3947
#define WIFI_SSID "WIFI_AP"
4048
#define WIFI_PASSWORD "WIFI_PASSWORD"
4149

examples/RealtimeDatabase/OTA/OTA.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#define ENABLE_USER_CONFIG
3232
#define ENABLE_USER_AUTH
3333
#define ENABLE_DATABASE
34+
#define ENABLE_OTA
3435

3536
#include <FirebaseClient.h>
3637
#include "ExampleFunctions.h" // Provides the functions used in the examples.

examples/Storage/OTA/OTA.ino

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,18 @@
2929
#define ENABLE_USER_CONFIG
3030
#define ENABLE_USER_AUTH
3131
#define ENABLE_STORAGE
32+
#define ENABLE_OTA
3233

3334
#include <FirebaseClient.h>
3435
#include "ExampleFunctions.h" // Provides the functions used in the examples.
3536

37+
// For Arduino SAMD21 OTA supports.
38+
// See https://github.com/mobizt/FirebaseClient#ota-update.
39+
#if defined(ARDUINO_ARCH_SAMD)
40+
#include <Internal_Storage_OTA.h>
41+
#define OTA_STORAGE InternalStorage
42+
#endif
43+
3644
#define WIFI_SSID "WIFI_AP"
3745
#define WIFI_PASSWORD "WIFI_PASSWORD"
3846

@@ -44,6 +52,7 @@
4452
#define STORAGE_BUCKET_ID "BUCKET-NAME.appspot.com"
4553

4654
void processData(AsyncResult &aResult);
55+
void restart();
4756

4857
UserAuth user_auth(API_KEY, USER_EMAIL, USER_PASSWORD, 3000 /* expire period in seconds (<3600) */);
4958

src/ExampleFunctions.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ void set_ssl_client_insecure_and_buffer(SSL_CLIENT &client)
3939
#if defined(ESP8266)
4040
client.setBufferSizes(4096, 1024);
4141
#endif
42+
#else
43+
(void)client;
4244
#endif
4345
}
4446

@@ -81,7 +83,6 @@ void file_operation_callback(File &file, const char *filename, file_operating_mo
8183
file = myFile;
8284
}
8385

84-
8586
void print_file_content(const String &filename)
8687
{
8788
File file = MY_FS.open(filename, FILE_OPEN_MODE_READ);
@@ -110,7 +111,7 @@ void print_file_content(const String &filename)
110111
#endif
111112

112113
// Debug information printing
113-
static void auth_debug_print(AsyncResult &aResult)
114+
void auth_debug_print(AsyncResult &aResult)
114115
{
115116
if (aResult.isEvent())
116117
{
@@ -129,7 +130,7 @@ static void auth_debug_print(AsyncResult &aResult)
129130
}
130131

131132
// Function to get NTP server time.
132-
static uint32_t get_ntp_time()
133+
uint32_t get_ntp_time()
133134
{
134135
uint32_t ts = 0;
135136
Serial.print("Getting time from NTP server... ");
@@ -156,7 +157,7 @@ static uint32_t get_ntp_time()
156157
}
157158

158159
// Token type information printing
159-
static void print_token_type(FirebaseApp &app)
160+
void print_token_type(FirebaseApp &app)
160161
{
161162
Firebase.printf("Auth Token: %s\n", app.getToken().c_str());
162163
firebase_token_type type = app.getTokenType();

src/FirebaseClient.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ static FirebaseClient Firebase;
341341
*
342342
*/
343343
template <typename T>
344-
static user_auth_data &getAuth(T &auth) { return auth.get(); }
344+
inline user_auth_data &getAuth(T &auth) { return auth.get(); }
345345

346346
/**
347347
* Initialize the FirebaseApp and wait.
@@ -352,7 +352,7 @@ static user_auth_data &getAuth(T &auth) { return auth.get(); }
352352
* @param timeoutMs Optional. The await timeout in milliseconds.
353353
* @param cb Optional. The async result callback (AsyncResultCallback).
354354
*/
355-
static void initializeApp(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, unsigned long timeoutMs = 0, AsyncResultCallback cb = NULL)
355+
inline void initializeApp(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, unsigned long timeoutMs = 0, AsyncResultCallback cb = NULL)
356356
{
357357
app.setCallback(cb);
358358
Firebase.initializeApp(aClient, app, auth, timeoutMs);
@@ -367,7 +367,7 @@ static void initializeApp(AsyncClientClass &aClient, FirebaseApp &app, user_auth
367367
* @param cb The async result callback (AsyncResultCallback).
368368
* @param uid The user specified UID of async result (optional).
369369
*/
370-
static void initializeApp(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResultCallback cb, const String &uid = "")
370+
inline void initializeApp(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResultCallback cb, const String &uid = "")
371371
{
372372
app.setUID(uid);
373373
initializeApp(aClient, app, auth, 0, cb);
@@ -381,7 +381,7 @@ static void initializeApp(AsyncClientClass &aClient, FirebaseApp &app, user_auth
381381
* @param auth The user auth data (user_auth_data) which is the struct that holds the user sign-in credentials and tokens that obtained from the authentication/authorization classes via getAuth function.
382382
* @param aResult The async result (AsyncResult).
383383
*/
384-
static void initializeApp(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResult &aResult)
384+
inline void initializeApp(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResult &aResult)
385385
{
386386
app.setAsyncResult(aResult);
387387
Firebase.initializeApp(aClient, app, auth);
@@ -392,7 +392,7 @@ static void initializeApp(AsyncClientClass &aClient, FirebaseApp &app, user_auth
392392
*
393393
* @param app The FirebaseApp class object to handle authentication/authorization task.
394394
*/
395-
static void deinitializeApp(FirebaseApp &app) { Firebase.deinitializeApp(app); }
395+
inline void deinitializeApp(FirebaseApp &app) { Firebase.deinitializeApp(app); }
396396

397397
/**
398398
* Signup a new user.
@@ -403,7 +403,7 @@ static void deinitializeApp(FirebaseApp &app) { Firebase.deinitializeApp(app); }
403403
* @param timeoutMs Optional. The await timeout in milliseconds.
404404
* @param cb Optional. The async result callback (AsyncResultCallback).
405405
*/
406-
static void signup(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, unsigned long timeoutMs = 0, AsyncResultCallback cb = NULL)
406+
inline void signup(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, unsigned long timeoutMs = 0, AsyncResultCallback cb = NULL)
407407
{
408408
app.setCallback(cb);
409409
Firebase.signup(aClient, app, auth, timeoutMs);
@@ -418,7 +418,7 @@ static void signup(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &
418418
* @param cb The async result callback (AsyncResultCallback).
419419
* @param uid The user specified UID of async result (optional).
420420
*/
421-
static void signup(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResultCallback cb, const String &uid = "")
421+
inline void signup(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResultCallback cb, const String &uid = "")
422422
{
423423
app.setUID(uid);
424424
app.setCallback(cb);
@@ -433,7 +433,7 @@ static void signup(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &
433433
* @param auth The user auth data (user_auth_data) which holds the user credentials from USerAccount class.
434434
* @param aResult The async result (AsyncResult).
435435
*/
436-
static void signup(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResult &aResult)
436+
inline void signup(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResult &aResult)
437437
{
438438
Serial.println("Warning. The AsyncResult is not needed any more when calling the signup.");
439439
app.setAsyncResult(aResult);
@@ -449,7 +449,7 @@ static void signup(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &
449449
* @param timeoutMs Optional. The await timeout in milliseconds.
450450
* @param cb Optional. The async result callback (AsyncResultCallback).
451451
*/
452-
static void resetPassword(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, unsigned long timeoutMs = 0, AsyncResultCallback cb = NULL)
452+
inline void resetPassword(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, unsigned long timeoutMs = 0, AsyncResultCallback cb = NULL)
453453
{
454454
app.setCallback(cb);
455455
Firebase.resetPassword(aClient, app, auth, timeoutMs);
@@ -464,7 +464,7 @@ static void resetPassword(AsyncClientClass &aClient, FirebaseApp &app, user_auth
464464
* @param cb The async result callback (AsyncResultCallback).
465465
* @param uid The user specified UID of async result (optional).
466466
*/
467-
static void resetPassword(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResultCallback cb, const String &uid = "")
467+
inline void resetPassword(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResultCallback cb, const String &uid = "")
468468
{
469469
app.setUID(uid);
470470
app.setCallback(cb);
@@ -479,7 +479,7 @@ static void resetPassword(AsyncClientClass &aClient, FirebaseApp &app, user_auth
479479
* @param auth The user auth data (user_auth_data) which holds the user credentials from USerAccount class.
480480
* @param aResult The async result (AsyncResult).
481481
*/
482-
static void resetPassword(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResult &aResult)
482+
inline void resetPassword(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResult &aResult)
483483
{
484484
app.setAsyncResult(aResult);
485485
Firebase.resetPassword(aClient, app, auth);
@@ -494,7 +494,7 @@ static void resetPassword(AsyncClientClass &aClient, FirebaseApp &app, user_auth
494494
* @param timeoutMs Optional. The await timeout in milliseconds.
495495
* @param cb Optional. The async result callback (AsyncResultCallback).
496496
*/
497-
static void verify(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, unsigned long timeoutMs = 0, AsyncResultCallback cb = NULL)
497+
inline void verify(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, unsigned long timeoutMs = 0, AsyncResultCallback cb = NULL)
498498
{
499499
app.setCallback(cb);
500500
Firebase.verify(aClient, app, auth, timeoutMs);
@@ -509,7 +509,7 @@ static void verify(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &
509509
* @param cb The async result callback (AsyncResultCallback).
510510
* @param uid The user specified UID of async result (optional).
511511
*/
512-
static void verify(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResultCallback cb, const String &uid = "")
512+
inline void verify(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResultCallback cb, const String &uid = "")
513513
{
514514
app.setUID(uid);
515515
app.setCallback(cb);
@@ -524,7 +524,7 @@ static void verify(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &
524524
* @param auth The user auth data (user_auth_data) which holds the user credentials from USerAccount class.
525525
* @param aResult The async result (AsyncResult).
526526
*/
527-
static void verify(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResult &aResult)
527+
inline void verify(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResult &aResult)
528528
{
529529
app.setAsyncResult(aResult);
530530
Firebase.verify(aClient, app, auth);
@@ -539,7 +539,7 @@ static void verify(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &
539539
* @param timeoutMs Optional. The await timeout in milliseconds.
540540
* @param cb Optional. The async result callback (AsyncResultCallback).
541541
*/
542-
static void deleteUser(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, unsigned long timeoutMs = 0, AsyncResultCallback cb = NULL)
542+
inline void deleteUser(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, unsigned long timeoutMs = 0, AsyncResultCallback cb = NULL)
543543
{
544544
app.setCallback(cb);
545545
Firebase.deleteUser(aClient, app, auth, timeoutMs);
@@ -554,7 +554,7 @@ static void deleteUser(AsyncClientClass &aClient, FirebaseApp &app, user_auth_da
554554
* @param cb The async result callback (AsyncResultCallback).
555555
* @param uid The user specified UID of async result (optional).
556556
*/
557-
static void deleteUser(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResultCallback cb, const String &uid = "")
557+
inline void deleteUser(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResultCallback cb, const String &uid = "")
558558
{
559559
app.setUID(uid);
560560
app.setCallback(cb);
@@ -569,7 +569,7 @@ static void deleteUser(AsyncClientClass &aClient, FirebaseApp &app, user_auth_da
569569
* @param auth The user auth data (user_auth_data) which holds the user credentials from USerAccount class.
570570
* @param aResult The async result (AsyncResult).
571571
*/
572-
static void deleteUser(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResult &aResult)
572+
inline void deleteUser(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResult &aResult)
573573
{
574574
app.setAsyncResult(aResult);
575575
Firebase.deleteUser(aClient, app, auth);

src/client/SSLClient/client/BSSL_SSL_Client.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2239,15 +2239,11 @@ void *BSSL_SSL_Client::mallocImpl(size_t len, bool clear)
22392239
#endif
22402240

22412241
p = reinterpret_cast<void *>(malloc(newLen));
2242-
bool nn = p ? true : false;
2243-
2242+
22442243
#if defined(ESP_SSLCLIENT_ESP8266_USE_EXTERNAL_HEAP)
22452244
ESP.resetHeap();
22462245
#endif
22472246

2248-
if (!nn)
2249-
return NULL;
2250-
22512247
#endif
22522248
if (clear)
22532249
memset(p, 0, newLen);

src/cloud_storage/CloudStorage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class CloudStorage : public AppBase
6464
/**
6565
* Perform the async task repeatedly (DEPRECATED).
6666
*/
67-
void loop() { loopImpl(__PRETTY_FUNCTION__); }
67+
void loop() { loopImpl(); }
6868

6969
/** Download object from the Google Cloud Storage.
7070
*

src/core/AppBase.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class AppBase
3434
}
3535
}
3636

37-
static void staticLoop(app_token_t *aToken, uint32_t cvec_addr)
37+
static void staticLoop(const app_token_t *aToken, uint32_t cvec_addr)
3838
{
3939
std::vector<uint32_t> cVec = *reinterpret_cast<std::vector<uint32_t> *>(cvec_addr);
4040

@@ -90,15 +90,15 @@ class AppBase
9090

9191
void resetAppImpl()
9292
{
93-
if (this->app_addr && this->cvec_address_list_addr && reinterpret_cast<std::vector<cvec_address_info_t> *>(this->cvec_address_list_addr))
93+
if (this->app_addr && this->cvec_address_list_addr > 0)
9494
removeCvecAddressList(reinterpret_cast<std::vector<cvec_address_info_t> *>(this->cvec_address_list_addr), this->app_addr);
9595
this->app_addr = 0;
9696
this->app_token = nullptr;
9797
this->avec_addr = 0; // AsyncClient vector (list) address
9898
this->ul_dl_task_running_addr = 0;
9999
}
100100

101-
void loopImpl(const char *src)
101+
void loopImpl()
102102
{
103103

104104
if (displayInfoTimer.remaining() == 0 || !displayInfoTimer.isRunning())
@@ -133,7 +133,7 @@ class AppBase
133133
void addRemoveClientVecBase(AsyncClientClass *aClient, uint32_t cvec_addr, bool add) { aClient->addRemoveClientVec(cvec_addr, add); }
134134
void handleRemoveBase(AsyncClientClass *aClient) { aClient->handleRemove(); }
135135
void removeSlotBase(AsyncClientClass *aClient, uint8_t slot, bool sse = true) { aClient->removeSlot(slot, sse); }
136-
size_t slotCountBase(AsyncClientClass *aClient) { return aClient->slotCount(); }
136+
size_t slotCountBase(const AsyncClientClass *aClient) { return aClient->slotCount(); }
137137
void setLastErrorBase(AsyncResult *aResult, int code, const String &message)
138138
{
139139
if (aResult)

0 commit comments

Comments
 (0)