Fix some typos (#1570)

* Fix typo for optional_data (closes #1567)

* Fix typo in comment
This commit is contained in:
Jan
2023-02-05 08:59:03 +01:00
committed by GitHub
parent c5d687540a
commit c2209fbad2
3 changed files with 19 additions and 19 deletions
+15 -15
View File
@@ -1154,51 +1154,51 @@ extern "C"
return uwsRes->hasResponded();
}
void uws_res_on_writable(int ssl, uws_res_t *res, bool (*handler)(uws_res_t *res, uintmax_t, void *opcional_data), void *opcional_data)
void uws_res_on_writable(int ssl, uws_res_t *res, bool (*handler)(uws_res_t *res, uintmax_t, void *optional_data), void *optional_data)
{
if (ssl)
{
uWS::HttpResponse<true> *uwsRes = (uWS::HttpResponse<true> *)res;
uwsRes->onWritable([handler, res, opcional_data](uintmax_t a)
{ return handler(res, a, opcional_data); });
uwsRes->onWritable([handler, res, optional_data](uintmax_t a)
{ return handler(res, a, optional_data); });
}
else
{
uWS::HttpResponse<false> *uwsRes = (uWS::HttpResponse<false> *)res;
uwsRes->onWritable([handler, res, opcional_data](uintmax_t a)
{ return handler(res, a, opcional_data); });
uwsRes->onWritable([handler, res, optional_data](uintmax_t a)
{ return handler(res, a, optional_data); });
}
}
void uws_res_on_aborted(int ssl, uws_res_t *res, void (*handler)(uws_res_t *res, void *opcional_data), void *opcional_data)
void uws_res_on_aborted(int ssl, uws_res_t *res, void (*handler)(uws_res_t *res, void *optional_data), void *optional_data)
{
if (ssl)
{
uWS::HttpResponse<true> *uwsRes = (uWS::HttpResponse<true> *)res;
uwsRes->onAborted([handler, res, opcional_data]
{ handler(res, opcional_data); });
uwsRes->onAborted([handler, res, optional_data]
{ handler(res, optional_data); });
}
else
{
uWS::HttpResponse<false> *uwsRes = (uWS::HttpResponse<false> *)res;
uwsRes->onAborted([handler, res, opcional_data]
{ handler(res, opcional_data); });
uwsRes->onAborted([handler, res, optional_data]
{ handler(res, optional_data); });
}
}
void uws_res_on_data(int ssl, uws_res_t *res, void (*handler)(uws_res_t *res, const char *chunk, size_t chunk_length, bool is_end, void *opcional_data), void *opcional_data)
void uws_res_on_data(int ssl, uws_res_t *res, void (*handler)(uws_res_t *res, const char *chunk, size_t chunk_length, bool is_end, void *optional_data), void *optional_data)
{
if (ssl)
{
uWS::HttpResponse<true> *uwsRes = (uWS::HttpResponse<true> *)res;
uwsRes->onData([handler, res, opcional_data](auto chunk, bool is_end)
{ handler(res, chunk.data(), chunk.length(), is_end, opcional_data); });
uwsRes->onData([handler, res, optional_data](auto chunk, bool is_end)
{ handler(res, chunk.data(), chunk.length(), is_end, optional_data); });
}
else
{
uWS::HttpResponse<false> *uwsRes = (uWS::HttpResponse<false> *)res;
uwsRes->onData([handler, res, opcional_data](auto chunk, bool is_end)
{ handler(res, chunk.data(), chunk.length(), is_end, opcional_data); });
uwsRes->onData([handler, res, optional_data](auto chunk, bool is_end)
{ handler(res, chunk.data(), chunk.length(), is_end, optional_data); });
}
}
+3 -3
View File
@@ -222,9 +222,9 @@ extern "C"
DLL_EXPORT uintmax_t uws_res_get_write_offset(int ssl, uws_res_t *res);
DLL_EXPORT void uws_res_override_write_offset(int ssl, uws_res_t *res, uintmax_t offset);
DLL_EXPORT bool uws_res_has_responded(int ssl, uws_res_t *res);
DLL_EXPORT void uws_res_on_writable(int ssl, uws_res_t *res, bool (*handler)(uws_res_t *res, uintmax_t, void *opcional_data), void *user_data);
DLL_EXPORT void uws_res_on_aborted(int ssl, uws_res_t *res, void (*handler)(uws_res_t *res, void *opcional_data), void *opcional_data);
DLL_EXPORT void uws_res_on_data(int ssl, uws_res_t *res, void (*handler)(uws_res_t *res, const char *chunk, size_t chunk_length, bool is_end, void *opcional_data), void *opcional_data);
DLL_EXPORT void uws_res_on_writable(int ssl, uws_res_t *res, bool (*handler)(uws_res_t *res, uintmax_t, void *optional_data), void *user_data);
DLL_EXPORT void uws_res_on_aborted(int ssl, uws_res_t *res, void (*handler)(uws_res_t *res, void *optional_data), void *optional_data);
DLL_EXPORT void uws_res_on_data(int ssl, uws_res_t *res, void (*handler)(uws_res_t *res, const char *chunk, size_t chunk_length, bool is_end, void *optional_data), void *optional_data);
DLL_EXPORT void uws_res_upgrade(int ssl, uws_res_t *res, void *data, const char *sec_web_socket_key, size_t sec_web_socket_key_length, const char *sec_web_socket_protocol, size_t sec_web_socket_protocol_length, const char *sec_web_socket_extensions, size_t sec_web_socket_extensions_length, uws_socket_context_t *ws);
DLL_EXPORT size_t uws_res_get_remote_address(int ssl, uws_res_t *res, const char **dest);
DLL_EXPORT size_t uws_res_get_remote_address_as_text(int ssl, uws_res_t *res, const char **dest);
+1 -1
View File
@@ -230,7 +230,7 @@ public:
#endif
/* Manually upgrade to WebSocket. Typically called in upgrade handler. Immediately calls open handler.
* NOTE: Will invalidate 'this' as socket might change location in memory. Throw away aftert use. */
* NOTE: Will invalidate 'this' as socket might change location in memory. Throw away after use. */
template <typename UserData>
void upgrade(UserData &&userData, std::string_view secWebSocketKey, std::string_view secWebSocketProtocol,
std::string_view secWebSocketExtensions,