Changeset 51635 in vbox for trunk/src/VBox/Runtime/common/misc
- Timestamp:
- Jun 17, 2014 3:58:40 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 94391
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/misc/http.cpp
r46070 r51635 66 66 typedef struct RTHTTPMEMCHUNK 67 67 { 68 char *pszMem;68 uint8_t *pu8Mem; 69 69 size_t cb; 70 70 } RTHTTPMEMCHUNK; … … 146 146 size_t cbAll = cb * n; 147 147 148 pMem->p szMem = (char*)RTMemRealloc(pMem->pszMem, pMem->cb + cbAll + 1);149 if (pMem->p szMem)150 { 151 memcpy(&pMem->p szMem[pMem->cb], pvBuf, cbAll);148 pMem->pu8Mem = (uint8_t*)RTMemRealloc(pMem->pu8Mem, pMem->cb + cbAll + 1); 149 if (pMem->pu8Mem) 150 { 151 memcpy(&pMem->pu8Mem[pMem->cb], pvBuf, cbAll); 152 152 pMem->cb += cbAll; 153 pMem->p szMem[pMem->cb] = '\0';153 pMem->pu8Mem[pMem->cb] = '\0'; 154 154 } 155 155 return cbAll; … … 414 414 } 415 415 416 RTR3DECL(int) RTHttpGet(RTHTTP hHttp, const char *pcszUrl, char **ppszResponse)416 RTR3DECL(int) rtHttpGet(RTHTTP hHttp, const char *pcszUrl, uint8_t **ppvResponse, size_t *pcb) 417 417 { 418 418 PRTHTTPINTERNAL pHttpInt = hHttp; … … 460 460 rcCurl = curl_easy_perform(pHttpInt->pCurl); 461 461 int rc = rtHttpGetCalcStatus(pHttpInt, rcCurl); 462 *ppszResponse = chunk.pszMem; 462 *ppvResponse = chunk.pu8Mem; 463 *pcb = chunk.cb; 463 464 464 465 return rc; 466 } 467 468 469 RTR3DECL(int) RTHttpGetText(RTHTTP hHttp, const char *pcszUrl, char **ppszResponse) 470 { 471 uint8_t *pv; 472 size_t cb; 473 int rc = rtHttpGet(hHttp, pcszUrl, &pv, &cb); 474 *ppszResponse = (char*)pv; 475 return rc; 476 } 477 478 479 RTR3DECL(int) RTHttpGetBinary(RTHTTP hHttp, const char *pcszUrl, void **ppvResponse, size_t *pcb) 480 { 481 return rtHttpGet(hHttp, pcszUrl, (uint8_t**)ppvResponse, pcb); 465 482 } 466 483
Note:
See TracChangeset
for help on using the changeset viewer.