11/* *
2- *
2+ *
33 * helpers.cpp: InfluxDB Client util functions
4- *
4+ *
55 * MIT License
6- *
6+ *
77 * Copyright (c) 2020 InfluxData
8- *
8+ *
99 * Permission is hereby granted, free of charge, to any person obtaining a copy
1010 * of this software and associated documentation files (the "Software"), to deal
1111 * in the Software without restriction, including without limitation the rights
1212 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1313 * copies of the Software, and to permit persons to whom the Software is
1414 * furnished to do so, subject to the following conditions:
15- *
15+ *
1616 * The above copyright notice and this permission notice shall be included in all
1717 * copies or substantial portions of the Software.
18- *
18+ *
1919 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2020 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2121 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2828
2929void timeSync (const char *tzInfo, const char * ntpServer1, const char * ntpServer2, const char * ntpServer3) {
3030 // Accurate time is necessary for certificate validion
31-
31+
3232 configTzTime (tzInfo,ntpServer1, ntpServer2, ntpServer3);
3333
3434 // Wait till time is synced
@@ -50,16 +50,16 @@ void timeSync(const char *tzInfo, const char* ntpServer1, const char* ntpServer2
5050unsigned long long getTimeStamp (struct timeval *tv, int secFracDigits) {
5151 unsigned long long tsVal = 0 ;
5252 switch (secFracDigits) {
53- case 0 :
53+ case 0 :
5454 tsVal = tv->tv_sec ;
5555 break ;
56- case 6 :
56+ case 6 :
5757 tsVal = tv->tv_sec * 1000000LL + tv->tv_usec ;
5858 break ;
5959 case 9 :
6060 tsVal = tv->tv_sec * 1000000000LL + tv->tv_usec * 1000LL ;
6161 break ;
62- case 3 :
62+ case 3 :
6363 default :
6464 tsVal = tv->tv_sec * 1000LL + tv->tv_usec / 1000LL ;
6565 break ;
@@ -77,7 +77,7 @@ String timeStampToString(unsigned long long timestamp) {
7777String escapeKey (String key, bool escapeEqual) {
7878 String ret;
7979 ret.reserve (key.length ()+5 ); // 5 is estimate of chars needs to escape,
80-
80+
8181 for (char c: key)
8282 {
8383 switch (c)
@@ -126,18 +126,18 @@ static char hex_digit(char c) {
126126 return " 0123456789ABCDEF" [c & 0x0F ];
127127}
128128
129- String urlEncode (const char * src) {
129+ String urlEncode (const char * src) {
130130 int n=0 ;
131131 char c,*s = (char *)src;
132132 while (c = *s++) {
133133 if (strchr (invalidChars, c)) {
134134 n++;
135- }
135+ }
136136 }
137137 String ret;
138138 ret.reserve (strlen (src)+2 *n+1 );
139139 s = (char *)src;
140- while (c = *s++) {
140+ while (( c = *s++)) {
141141 if (strchr (invalidChars,c)) {
142142 ret += ' %' ;
143143 ret += hex_digit (c >> 4 );
0 commit comments