mirror of
https://github.com/openshwprojects/OpenBK7231T_App.git
synced 2026-02-13 10:15:39 +00:00
Fix tests on linux (#1640)
The tests were segfaulting on linux, I don't know how they work on Windows, perhaps casting `void*` to `int` happens to work there. Generally it's not portable. Berry has a dedicated `comptr` type, so let's use that and be portable. Also makes `run_closure` handle arbitrary number of arguments, see https://berry.readthedocs.io/en/latest/source/en/Chapter-5.html#function-with-variable-number-of-arguments-vararg for docs. Test Plan: * CI * make -f custom.mk, ./build/win_main -runUnitTests 2
This commit is contained in:
@ -343,7 +343,7 @@ int http_fn_index(http_request_t* request) {
|
||||
#if ENABLE_OBK_BERRY
|
||||
void Berry_SaveRequest(http_request_t *r);
|
||||
Berry_SaveRequest(request);
|
||||
CMD_Berry_RunEventHandlers_StrInt(CMD_EVENT_ON_HTTP, "prestate", (int)request);
|
||||
CMD_Berry_RunEventHandlers_StrPtr(CMD_EVENT_ON_HTTP, "prestate", request);
|
||||
#endif
|
||||
#ifndef OBK_DISABLE_ALL_DRIVERS
|
||||
DRV_AppendInformationToHTTPIndexPage(request, true);
|
||||
@ -355,7 +355,7 @@ int http_fn_index(http_request_t* request) {
|
||||
#if ENABLE_OBK_BERRY
|
||||
void Berry_SaveRequest(http_request_t *r);
|
||||
Berry_SaveRequest(request);
|
||||
CMD_Berry_RunEventHandlers_StrInt(CMD_EVENT_ON_HTTP, "state", (int)request);
|
||||
CMD_Berry_RunEventHandlers_StrPtr(CMD_EVENT_ON_HTTP, "state", request);
|
||||
#endif
|
||||
|
||||
if (!CFG_HasFlag(OBK_FLAG_HTTP_NO_ONOFF_WORDS)){
|
||||
@ -3209,7 +3209,7 @@ int http_fn_ota(http_request_t* request) {
|
||||
int http_fn_other(http_request_t* request) {
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
#if ENABLE_OBK_BERRY
|
||||
if (CMD_Berry_RunEventHandlers_StrInt(CMD_EVENT_ON_HTTP, request->url, (int)request)) {
|
||||
if (CMD_Berry_RunEventHandlers_StrPtr(CMD_EVENT_ON_HTTP, request->url, request)) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user