void little::init(HINSTANCE hInst) { m_hInst = hInst; initWindow(); initGdiplus(); initRes(); initUrl(); m_hWorkThread = nullptr; m_hSuperviseThread = nullptr; m_hScreenThread = nullptr; }
int url_InitFile(const char* fileName, apr_pool_t* pool) { apr_status_t s; apr_file_t* file; char buf[URL_BUF_LEN]; LineState line; urlCount = 0; urlSize = INITIAL_URLS; urls = (URLInfo*)malloc(sizeof(URLInfo) * INITIAL_URLS); s = apr_file_open(&file, fileName, APR_READ, APR_OS_DEFAULT, pool); if (s != APR_SUCCESS) { fprintf(stderr, "Can't open \"%s\"\n", fileName); return -1; } linep_Start(&line, buf, URL_BUF_LEN, 0); s = linep_ReadFile(&line, file); if (s != APR_SUCCESS) { apr_file_close(file); return -1; } do { while (linep_NextLine(&line)) { char* urlStr = linep_GetLine(&line); if (urlCount == urlSize) { urlSize *= 2; urls = (URLInfo*)realloc(urls, sizeof(URLInfo) * urlSize); } s = apr_uri_parse(pool, urlStr, &(urls[urlCount].url)); if (s != APR_SUCCESS) { fprintf(stderr, "Invalid URL \"%s\"\n", urlStr); apr_file_close(file); return -1; } if (initUrl(&(urls[urlCount]), pool) != 0) { apr_file_close(file); return -1; } urlCount++; } linep_Reset(&line); s = linep_ReadFile(&line, file); } while (s == APR_SUCCESS); printf("Read %i URLs from \"%s\"\n", urlCount, fileName); apr_file_close(file); return 0; }
int url_InitOne(const char* urlStr, apr_pool_t* pool) { apr_status_t s; urlCount = urlSize = 1; urls = (URLInfo*)malloc(sizeof(URLInfo)); s = apr_uri_parse(pool, urlStr, &(urls[0].url)); if (s != APR_SUCCESS) { fprintf(stderr, "Invalid URL\n"); return -1; } return initUrl(&(urls[0]), pool); }
void UploadData::upload(TYPE type) { std::string url; mType = type; initUrl(url); //大厅136以上 if (DeviceData::getInstance()->getGloudVersionNameInteger() > GLOUD_GAME_VERSION + 1 && url.length() > 0) { network::HttpRequest* request = new (std::nothrow) network::HttpRequest(); log("UploadData 正在上传 ===> %s", url.c_str()); request->setUrl(url.c_str()); request->setRequestData(nullptr, 0); request->setRequestType(network::HttpRequest::Type::GET); request->setResponseCallback(this, httpresponse_selector(UploadData::onHttpRequestCompleted)); network::HttpClient * client = network::HttpClient::getInstance(); client->setTimeoutForConnect(2); client->setTimeoutForRead(2); client->sendImmediate(request); request->release(); } }