Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some spell correction #335

Merged
merged 4 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions trantor/net/TLSPolicy.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct TRANTOR_EXPORT TLSPolicy final

/**
* @brief enables the use of the old TLS protocol (old meaning < TLS 1.2).
* TLS providres may not support old protocols even if this option is set
* TLS providers may not support old protocols even if this option is set
*/
TLSPolicy &setUseOldTLS(bool useOldTLS)
{
Expand All @@ -79,7 +79,7 @@ struct TRANTOR_EXPORT TLSPolicy final
* @brief set the list of protocols to be used for ALPN.
*
* @note for servers, it selects matching protocol against the client's
* list. And the first matching protocol supplide in the parameter will be
* list. And the first matching protocol supplied in the parameter will be
* selected. If no matching protocol is found, the connection will be
* closed.
*
Expand Down
11 changes: 7 additions & 4 deletions trantor/unittests/DateUnittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,23 @@ TEST(Date, constructorTest)
{
EXPECT_STREQ("1985-01-01 00:00:00",
trantor::Date(1985, 1, 1)
.toCustomedFormattedStringLocal("%Y-%m-%d %H:%M:%S")
.toCustomizedFormattedStringLocal("%Y-%m-%d %H:%M:%S")
.c_str());
EXPECT_STREQ("2004-02-29 00:00:00.000000",
trantor::Date(2004, 2, 29)
.toCustomedFormattedStringLocal("%Y-%m-%d %H:%M:%S", true)
.toCustomizedFormattedStringLocal("%Y-%m-%d %H:%M:%S",
true)
.c_str());
EXPECT_STRNE("2001-02-29 00:00:00.000000",
trantor::Date(2001, 2, 29)
.toCustomedFormattedStringLocal("%Y-%m-%d %H:%M:%S", true)
.toCustomizedFormattedStringLocal("%Y-%m-%d %H:%M:%S",
true)
.c_str());
EXPECT_STREQ("2018-01-01 00:00:00.000000",
trantor::Date(2018, 1, 1, 12, 12, 12, 2321)
.roundDay()
.toCustomedFormattedStringLocal("%Y-%m-%d %H:%M:%S", true)
.toCustomizedFormattedStringLocal("%Y-%m-%d %H:%M:%S",
true)
.c_str());
}
TEST(Date, DatabaseStringTest)
Expand Down
2 changes: 1 addition & 1 deletion trantor/utils/AsyncFileLogger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ void AsyncFileLogger::LoggerFile::switchLog(bool openNewOne)
// NOTE: Remember to update initFilenameQueue() if name format changes
std::string newName =
filePath_ + fileBaseName_ + "." +
creationDate_.toCustomedFormattedString("%y%m%d-%H%M%S") +
creationDate_.toCustomizedFormattedString("%y%m%d-%H%M%S") +
std::string(seq) + fileExtName_;
#if !defined(_WIN32) || defined(__MINGW32__)
rename(fileFullName_.c_str(), newName.c_str());
Expand Down
14 changes: 7 additions & 7 deletions trantor/utils/Date.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ std::string Date::toFormattedString(bool showMicroseconds) const
}
return buf;
}
std::string Date::toCustomedFormattedString(const std::string &fmtStr,
bool showMicroseconds) const
std::string Date::toCustomizedFormattedString(const std::string &fmtStr,
bool showMicroseconds) const
{
char buf[256] = {0};
time_t seconds =
Expand All @@ -163,9 +163,9 @@ std::string Date::toCustomedFormattedString(const std::string &fmtStr,
snprintf(decimals, sizeof(decimals), ".%06d", microseconds);
return std::string(buf) + decimals;
}
void Date::toCustomedFormattedString(const std::string &fmtStr,
char *str,
size_t len) const
void Date::toCustomizedFormattedString(const std::string &fmtStr,
char *str,
size_t len) const
{
// not safe
time_t seconds =
Expand Down Expand Up @@ -323,8 +323,8 @@ Date Date::fromDbString(const std::string &datetime)
static_cast<double>(timezoneOffset()));
}

std::string Date::toCustomedFormattedStringLocal(const std::string &fmtStr,
bool showMicroseconds) const
std::string Date::toCustomizedFormattedStringLocal(const std::string &fmtStr,
bool showMicroseconds) const
{
char buf[256] = {0};
time_t seconds =
Expand Down
19 changes: 10 additions & 9 deletions trantor/utils/Date.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class TRANTOR_EXPORT Date
std::string toFormattedString(bool showMicroseconds) const;

/**
* @brief Generate a UTC time string formated by the @p fmtStr
* @brief Generate a UTC time string formatted by the @p fmtStr
* @param fmtStr is the format string for the function strftime()
* @param showMicroseconds whether the microseconds are returned.
* @note Examples:
Expand All @@ -212,26 +212,27 @@ class TRANTOR_EXPORT Date
* - "2018-01-01 10:10:25:102414" if the @p fmtStr is "%Y-%m-%d %H:%M:%S"
* and the @p showMicroseconds is true
*/
std::string toCustomedFormattedString(const std::string &fmtStr,
hks2002 marked this conversation as resolved.
Show resolved Hide resolved
bool showMicroseconds = false) const;
std::string toCustomizedFormattedString(
hks2002 marked this conversation as resolved.
Show resolved Hide resolved
const std::string &fmtStr,
bool showMicroseconds = false) const;

/**
* @brief Generate a local time zone string, the format of the string is
* same as the mothed toFormattedString
* same as the method toFormattedString
*
* @param showMicroseconds
* @return std::string
*/
std::string toFormattedStringLocal(bool showMicroseconds) const;

/**
* @brief Generate a local time zone string formated by the @p fmtStr
* @brief Generate a local time zone string formatted by the @p fmtStr
*
* @param fmtStr
* @param showMicroseconds
* @return std::string
*/
std::string toCustomedFormattedStringLocal(
std::string toCustomizedFormattedStringLocal(
const std::string &fmtStr,
bool showMicroseconds = false) const;

Expand Down Expand Up @@ -268,9 +269,9 @@ class TRANTOR_EXPORT Date
* @param str The string buffer for the generated time string.
* @param len The length of the string buffer.
*/
void toCustomedFormattedString(const std::string &fmtStr,
char *str,
size_t len) const; // UTC
void toCustomizedFormattedString(const std::string &fmtStr,
char *str,
size_t len) const; // UTC

/**
* @brief Return true if the time point is in a same second as another.
Expand Down
2 changes: 1 addition & 1 deletion trantor/utils/MsgBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class TRANTOR_EXPORT MsgBuffer
void appendInt32(const uint32_t i);

/**
* @brief Appaend a unsigned int64 value to the end of the buffer.
* @brief Append a unsigned int64 value to the end of the buffer.
*
* @param l
*/
Expand Down
2 changes: 1 addition & 1 deletion trantor/utils/SerialTaskQueue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
namespace trantor
{
SerialTaskQueue::SerialTaskQueue(const std::string &name)
: queueName_(name.empty() ? "SerailTaskQueue" : name),
: queueName_(name.empty() ? "SerialTaskQueue" : name),
loopThread_(queueName_)
{
loopThread_.run();
Expand Down
4 changes: 2 additions & 2 deletions trantor/utils/SerialTaskQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class TRANTOR_EXPORT SerialTaskQueue : public TaskQueue
SerialTaskQueue() = delete;

/**
* @brief Construct a new serail task queue instance.
* @brief Construct a new serial task queue instance.
*
* @param name
*/
Expand All @@ -72,7 +72,7 @@ class TRANTOR_EXPORT SerialTaskQueue : public TaskQueue
* @return true
* @return false
*/
bool isRuningTask()
bool isRunningTask()
{
return loopThread_.getLoop()
? loopThread_.getLoop()->isCallingFunctions()
Expand Down
2 changes: 1 addition & 1 deletion trantor/utils/TaskQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class TaskQueue : public NonCopyable
};

/**
* @brief Run a task in the queue sychronously. This means that the task is
* @brief Run a task in the queue synchronously. This means that the task is
* executed before the method returns.
*
* @param task
Expand Down
8 changes: 4 additions & 4 deletions trantor/utils/Utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ inline std::string fromNativePath(const std::wstring &strPath)
}

/**
* @brief Check if the name supplied by the SSL Cert matchs a FQDN
* @brief Check if the name supplied by the SSL Cert matches a FQDN
* @param certName The name supplied by the SSL Cert
* @param hostName The FQDN to match
*
Expand Down Expand Up @@ -243,7 +243,7 @@ inline Hash256 sha3(const std::string &str)
/**
* @brief Compute the BLAKE2b hash of the given data
* @note When in doubt, use SHA3 or BLAKE2b. Both are safe and SHA3 is faster if
* you are using OpenSSL and it has SHA3 in hardware mode. Owtherwise BLAKE2b is
* you are using OpenSSL and it has SHA3 in hardware mode. Otherwise BLAKE2b is
* faster in software.
*/
TRANTOR_EXPORT Hash256 blake2b(const void *data, size_t len);
Expand All @@ -255,7 +255,7 @@ inline Hash256 blake2b(const std::string &str)
/**
* @brief hex encode the given data
* @note When in doubt, use SHA3 or BLAKE2b. Both are safe and SHA3 is faster if
* you are using OpenSSL and it has SHA3 in hardware mode. Owtherwise BLAKE2b is
* you are using OpenSSL and it has SHA3 in hardware mode. Otherwise BLAKE2b is
* faster in software.
*/
TRANTOR_EXPORT std::string toHexString(const void *data, size_t len);
Expand All @@ -280,7 +280,7 @@ inline std::string toHexString(const Hash256 &hash)
* @param size Size of the buffer
* @return true if successful, false otherwise
*
* @note This function really sholdn't fail, but it's possible that
* @note This function really shouldn't fail, but it's possible that
*
* - OpenSSL can't access /dev/urandom
* - Compiled with glibc that supports getentropy() but the kernel doesn't
Expand Down
Loading