Skip to content

Commit 2a4871d

Browse files
authored
Some spelling corrections (#335)
1 parent 88f684c commit 2a4871d

10 files changed

+96
-29
lines changed

trantor/net/TLSPolicy.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ struct TRANTOR_EXPORT TLSPolicy final
6767

6868
/**
6969
* @brief enables the use of the old TLS protocol (old meaning < TLS 1.2).
70-
* TLS providres may not support old protocols even if this option is set
70+
* TLS providers may not support old protocols even if this option is set
7171
*/
7272
TLSPolicy &setUseOldTLS(bool useOldTLS)
7373
{
@@ -79,7 +79,7 @@ struct TRANTOR_EXPORT TLSPolicy final
7979
* @brief set the list of protocols to be used for ALPN.
8080
*
8181
* @note for servers, it selects matching protocol against the client's
82-
* list. And the first matching protocol supplide in the parameter will be
82+
* list. And the first matching protocol supplied in the parameter will be
8383
* selected. If no matching protocol is found, the connection will be
8484
* closed.
8585
*

trantor/unittests/DateUnittest.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ TEST(Date, constructorTest)
77
{
88
EXPECT_STREQ("1985-01-01 00:00:00",
99
trantor::Date(1985, 1, 1)
10-
.toCustomedFormattedStringLocal("%Y-%m-%d %H:%M:%S")
10+
.toCustomFormattedStringLocal("%Y-%m-%d %H:%M:%S")
1111
.c_str());
1212
EXPECT_STREQ("2004-02-29 00:00:00.000000",
1313
trantor::Date(2004, 2, 29)
14-
.toCustomedFormattedStringLocal("%Y-%m-%d %H:%M:%S", true)
14+
.toCustomFormattedStringLocal("%Y-%m-%d %H:%M:%S", true)
1515
.c_str());
1616
EXPECT_STRNE("2001-02-29 00:00:00.000000",
1717
trantor::Date(2001, 2, 29)
18-
.toCustomedFormattedStringLocal("%Y-%m-%d %H:%M:%S", true)
18+
.toCustomFormattedStringLocal("%Y-%m-%d %H:%M:%S", true)
1919
.c_str());
2020
EXPECT_STREQ("2018-01-01 00:00:00.000000",
2121
trantor::Date(2018, 1, 1, 12, 12, 12, 2321)
2222
.roundDay()
23-
.toCustomedFormattedStringLocal("%Y-%m-%d %H:%M:%S", true)
23+
.toCustomFormattedStringLocal("%Y-%m-%d %H:%M:%S", true)
2424
.c_str());
2525
}
2626
TEST(Date, DatabaseStringTest)

trantor/utils/AsyncFileLogger.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ void AsyncFileLogger::LoggerFile::switchLog(bool openNewOne)
269269
// NOTE: Remember to update initFilenameQueue() if name format changes
270270
std::string newName =
271271
filePath_ + fileBaseName_ + "." +
272-
creationDate_.toCustomedFormattedString("%y%m%d-%H%M%S") +
272+
creationDate_.toCustomFormattedString("%y%m%d-%H%M%S") +
273273
std::string(seq) + fileExtName_;
274274
#if !defined(_WIN32) || defined(__MINGW32__)
275275
rename(fileFullName_.c_str(), newName.c_str());

trantor/utils/Date.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ std::string Date::toFormattedString(bool showMicroseconds) const
142142
}
143143
return buf;
144144
}
145-
std::string Date::toCustomedFormattedString(const std::string &fmtStr,
146-
bool showMicroseconds) const
145+
std::string Date::toCustomFormattedString(const std::string &fmtStr,
146+
bool showMicroseconds) const
147147
{
148148
char buf[256] = {0};
149149
time_t seconds =
@@ -163,9 +163,9 @@ std::string Date::toCustomedFormattedString(const std::string &fmtStr,
163163
snprintf(decimals, sizeof(decimals), ".%06d", microseconds);
164164
return std::string(buf) + decimals;
165165
}
166-
void Date::toCustomedFormattedString(const std::string &fmtStr,
167-
char *str,
168-
size_t len) const
166+
void Date::toCustomFormattedString(const std::string &fmtStr,
167+
char *str,
168+
size_t len) const
169169
{
170170
// not safe
171171
time_t seconds =
@@ -323,8 +323,8 @@ Date Date::fromDbString(const std::string &datetime)
323323
static_cast<double>(timezoneOffset()));
324324
}
325325

326-
std::string Date::toCustomedFormattedStringLocal(const std::string &fmtStr,
327-
bool showMicroseconds) const
326+
std::string Date::toCustomFormattedStringLocal(const std::string &fmtStr,
327+
bool showMicroseconds) const
328328
{
329329
char buf[256] = {0};
330330
time_t seconds =

trantor/utils/Date.h

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,36 +202,70 @@ class TRANTOR_EXPORT Date
202202
*/
203203
std::string toFormattedString(bool showMicroseconds) const;
204204

205+
/* clang-format off */
205206
/**
206-
* @brief Generate a UTC time string formated by the @p fmtStr
207+
* @brief Generate a UTC time string formatted by the @p fmtStr
207208
* @param fmtStr is the format string for the function strftime()
208209
* @param showMicroseconds whether the microseconds are returned.
209210
* @note Examples:
210211
* - "2018-01-01 10:10:25" if the @p fmtStr is "%Y-%m-%d %H:%M:%S" and the
211212
* @p showMicroseconds is false
212213
* - "2018-01-01 10:10:25:102414" if the @p fmtStr is "%Y-%m-%d %H:%M:%S"
213214
* and the @p showMicroseconds is true
215+
* @deprecated Replaced by toCustomFormattedString
214216
*/
217+
[[deprecated("Replaced by toCustomFormattedString")]]
215218
std::string toCustomedFormattedString(const std::string &fmtStr,
216-
bool showMicroseconds = false) const;
217-
219+
bool showMicroseconds = false) const
220+
{
221+
return toCustomFormattedString(fmtStr, showMicroseconds);
222+
};
223+
/* clang-format on */
224+
/**
225+
* @brief Generate a UTC time string formatted by the @p fmtStr
226+
* @param fmtStr is the format string for the function strftime()
227+
* @param showMicroseconds whether the microseconds are returned.
228+
* @note Examples:
229+
* - "2018-01-01 10:10:25" if the @p fmtStr is "%Y-%m-%d %H:%M:%S" and the
230+
* @p showMicroseconds is false
231+
* - "2018-01-01 10:10:25:102414" if the @p fmtStr is "%Y-%m-%d %H:%M:%S"
232+
* and the @p showMicroseconds is true
233+
*/
234+
std::string toCustomFormattedString(const std::string &fmtStr,
235+
bool showMicroseconds = false) const;
218236
/**
219237
* @brief Generate a local time zone string, the format of the string is
220-
* same as the mothed toFormattedString
238+
* same as the method toFormattedString
221239
*
222240
* @param showMicroseconds
223241
* @return std::string
224242
*/
225243
std::string toFormattedStringLocal(bool showMicroseconds) const;
226244

245+
/* clang-format off */
227246
/**
228-
* @brief Generate a local time zone string formated by the @p fmtStr
247+
* @brief Generate a local time zone string formatted by the @p fmtStr
229248
*
230249
* @param fmtStr
231250
* @param showMicroseconds
232251
* @return std::string
252+
* @deprecated Replaced by toCustomFormattedString
233253
*/
234-
std::string toCustomedFormattedStringLocal(
254+
[[deprecated("Replaced by toCustomFormattedStringLocal")]]
255+
std::string toCustomedFormattedStringLocal(const std::string &fmtStr,
256+
bool showMicroseconds = false) const
257+
{
258+
return toCustomFormattedStringLocal(fmtStr, showMicroseconds);
259+
}
260+
/* clang-format on */
261+
/**
262+
* @brief Generate a local time zone string formatted by the @p fmtStr
263+
*
264+
* @param fmtStr
265+
* @param showMicroseconds
266+
* @return std::string
267+
*/
268+
std::string toCustomFormattedStringLocal(
235269
const std::string &fmtStr,
236270
bool showMicroseconds = false) const;
237271

@@ -261,16 +295,34 @@ class TRANTOR_EXPORT Date
261295
*/
262296
static Date fromDbString(const std::string &datetime);
263297

298+
/* clang-format off */
264299
/**
265300
* @brief Generate a UTC time string.
266301
*
267302
* @param fmtStr The format string.
268303
* @param str The string buffer for the generated time string.
269304
* @param len The length of the string buffer.
305+
* @deprecated Replaced by toCustomFormattedString
270306
*/
307+
[[deprecated("Replaced by toCustomFormattedString")]]
271308
void toCustomedFormattedString(const std::string &fmtStr,
272309
char *str,
273-
size_t len) const; // UTC
310+
size_t len) const
311+
{
312+
toCustomFormattedString(fmtStr, str, len);
313+
}
314+
/* clang-format on */
315+
316+
/**
317+
* @brief Generate a UTC time string.
318+
*
319+
* @param fmtStr The format string.
320+
* @param str The string buffer for the generated time string.
321+
* @param len The length of the string buffer.
322+
*/
323+
void toCustomFormattedString(const std::string &fmtStr,
324+
char *str,
325+
size_t len) const; // UTC
274326

275327
/**
276328
* @brief Return true if the time point is in a same second as another.

trantor/utils/MsgBuffer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class TRANTOR_EXPORT MsgBuffer
207207
void appendInt32(const uint32_t i);
208208

209209
/**
210-
* @brief Appaend a unsigned int64 value to the end of the buffer.
210+
* @brief Append a unsigned int64 value to the end of the buffer.
211211
*
212212
* @param l
213213
*/

trantor/utils/SerialTaskQueue.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
namespace trantor
2121
{
2222
SerialTaskQueue::SerialTaskQueue(const std::string &name)
23-
: queueName_(name.empty() ? "SerailTaskQueue" : name),
23+
: queueName_(name.empty() ? "SerialTaskQueue" : name),
2424
loopThread_(queueName_)
2525
{
2626
loopThread_.run();

trantor/utils/SerialTaskQueue.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,36 @@ class TRANTOR_EXPORT SerialTaskQueue : public TaskQueue
5858
SerialTaskQueue() = delete;
5959

6060
/**
61-
* @brief Construct a new serail task queue instance.
61+
* @brief Construct a new serial task queue instance.
6262
*
6363
* @param name
6464
*/
6565
explicit SerialTaskQueue(const std::string &name);
6666

6767
virtual ~SerialTaskQueue();
6868

69+
/* clang-format off */
6970
/**
7071
* @brief Check whether a task is running in the queue.
7172
*
7273
* @return true
7374
* @return false
75+
* @deprecated Use isRunningTask instead
7476
*/
77+
[[deprecated("Use isRunningTask instead")]]
7578
bool isRuningTask()
79+
{
80+
return isRunningTask();
81+
}
82+
/* clang-format on */
83+
84+
/**
85+
* @brief Check whether a task is running in the queue.
86+
*
87+
* @return true
88+
* @return false
89+
*/
90+
bool isRunningTask()
7691
{
7792
return loopThread_.getLoop()
7893
? loopThread_.getLoop()->isCallingFunctions()

trantor/utils/TaskQueue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class TaskQueue : public NonCopyable
3636
};
3737

3838
/**
39-
* @brief Run a task in the queue sychronously. This means that the task is
39+
* @brief Run a task in the queue synchronously. This means that the task is
4040
* executed before the method returns.
4141
*
4242
* @param task

trantor/utils/Utilities.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ inline std::string fromNativePath(const std::wstring &strPath)
172172
}
173173

174174
/**
175-
* @brief Check if the name supplied by the SSL Cert matchs a FQDN
175+
* @brief Check if the name supplied by the SSL Cert matches a FQDN
176176
* @param certName The name supplied by the SSL Cert
177177
* @param hostName The FQDN to match
178178
*
@@ -243,7 +243,7 @@ inline Hash256 sha3(const std::string &str)
243243
/**
244244
* @brief Compute the BLAKE2b hash of the given data
245245
* @note When in doubt, use SHA3 or BLAKE2b. Both are safe and SHA3 is faster if
246-
* you are using OpenSSL and it has SHA3 in hardware mode. Owtherwise BLAKE2b is
246+
* you are using OpenSSL and it has SHA3 in hardware mode. Otherwise BLAKE2b is
247247
* faster in software.
248248
*/
249249
TRANTOR_EXPORT Hash256 blake2b(const void *data, size_t len);
@@ -255,7 +255,7 @@ inline Hash256 blake2b(const std::string &str)
255255
/**
256256
* @brief hex encode the given data
257257
* @note When in doubt, use SHA3 or BLAKE2b. Both are safe and SHA3 is faster if
258-
* you are using OpenSSL and it has SHA3 in hardware mode. Owtherwise BLAKE2b is
258+
* you are using OpenSSL and it has SHA3 in hardware mode. Otherwise BLAKE2b is
259259
* faster in software.
260260
*/
261261
TRANTOR_EXPORT std::string toHexString(const void *data, size_t len);
@@ -280,7 +280,7 @@ inline std::string toHexString(const Hash256 &hash)
280280
* @param size Size of the buffer
281281
* @return true if successful, false otherwise
282282
*
283-
* @note This function really sholdn't fail, but it's possible that
283+
* @note This function really shouldn't fail, but it's possible that
284284
*
285285
* - OpenSSL can't access /dev/urandom
286286
* - Compiled with glibc that supports getentropy() but the kernel doesn't

0 commit comments

Comments
 (0)