void HttpClientSocket::OnData(const char *buf,size_t len) { if (m_fil) { m_fil -> fwrite(buf, 1, len); } else if (m_data_ptr) { if (m_content_ptr + len > m_data_size) { Handler().LogError(this, "OnData", -1, "content buffer overflow", LOG_LEVEL_ERROR); } else { memcpy(m_data_ptr + m_content_ptr, buf, len); } } m_content_ptr += len; if (m_content_ptr == m_content_length && m_content_length) { if (m_fil) { m_fil -> fclose(); delete m_fil; m_fil = NULL; } m_b_complete = true; OnContent(); if (m_b_close_when_complete) { SetCloseAndDelete(); } } }
XamlView SwitchViewManager::CreateViewCore(int64_t tag) { auto toggleSwitch = winrt::ToggleSwitch(); toggleSwitch.OnContent(nullptr); toggleSwitch.OffContent(nullptr); return toggleSwitch; }
void HttpClientSocket::OnDelete() { if (!m_b_complete) { if (m_fil) { fclose(m_fil); m_fil = NULL; } m_b_complete = true; OnContent(); } }
void HttpClientSocket::EndConnection() { if (m_fil) { m_fil -> fclose(); delete m_fil; m_fil = NULL; } m_b_complete = true; OnContent(); if (m_b_close_when_complete) { SetCloseAndDelete(); } }