浏览代码

net: fix emscripten build.

legacy
Sam Hocevar 5 年前
父节点
当前提交
cc7d34400d
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. +3
    -3
      src/net/http.cpp

+ 3
- 3
src/net/http.cpp 查看文件

@@ -50,7 +50,7 @@ public:
#if __EMSCRIPTEN__ #if __EMSCRIPTEN__
~client_impl() ~client_impl()
{ {
emscripten_fetch_close(impl->m_fetch);
emscripten_fetch_close(m_fetch);
} }


void get(std::string const &url) void get(std::string const &url)
@@ -58,11 +58,11 @@ public:
emscripten_fetch_attr_t attr; emscripten_fetch_attr_t attr;
emscripten_fetch_attr_init(&attr); emscripten_fetch_attr_init(&attr);
strcpy(attr.requestMethod, "GET"); strcpy(attr.requestMethod, "GET");
attr.userData = impl.get();
attr.userData = this;
attr.attributes = EMSCRIPTEN_FETCH_LOAD_TO_MEMORY; attr.attributes = EMSCRIPTEN_FETCH_LOAD_TO_MEMORY;
attr.onsuccess = client_impl::on_success; attr.onsuccess = client_impl::on_success;
attr.onerror = client_impl::on_failure; attr.onerror = client_impl::on_failure;
impl->m_fetch = emscripten_fetch(&attr, url.c_str());
m_fetch = emscripten_fetch(&attr, url.c_str());
} }


static void on_success(emscripten_fetch_t *fetch) static void on_success(emscripten_fetch_t *fetch)


正在加载...
取消
保存