26 #define ENABLE_CURLX_PRINTF 42 #define EAT_SPACE(p) while(*(p) && ISSPACE(*(p))) (p)++ 44 #define EAT_WORD(p) while(*(p) && !ISSPACE(*(p)) && ('>' != *(p))) (p)++ 47 #define show(x) printf x 49 #define show(x) Curl_nop_stmt 52 #if defined(_MSC_VER) && defined(_DLL) 53 # pragma warning(disable:4232) 61 #if defined(WIN32) && defined(UNICODE) 62 curl_wcsdup_callback Curl_cwcsdup = (curl_wcsdup_callback)_wcsdup;
65 #if defined(_MSC_VER) && defined(_DLL) 66 # pragma warning(default:4232) 93 memcpy(convbuf, indata, insize);
132 if(!fgets(*buffer + offset, bytestoread, stream))
135 length = offset + strlen(*buffer + offset);
136 if(*(*buffer + length - 1) ==
'\n')
139 if(length < *bufsize - 1)
142 newptr =
realloc(*buffer, *bufsize * 2);
184 size_t need_alloc = 0;
185 size_t src_len = strlen(src_buf);
190 need_alloc = src_len + *dst_len + 1;
193 if(src_buf[src_len - 1] ==
'\r')
196 if(src_buf[src_len - 1] ==
'\n')
201 if(need_alloc > *dst_alloc) {
202 size_t newsize = need_alloc * 2;
203 char *newptr =
realloc(*dst_buf, newsize);
207 *dst_alloc = newsize;
212 memcpy(*dst_buf + *dst_len, src_buf, src_len);
214 *(*dst_buf + *dst_len) =
'\0';
223 unsigned char *buf64 = NULL;
247 memcpy(*buf, buf64, src_len);
249 *(*buf + src_len) =
'\0';
279 const char *
main,
const char *sub, FILE *stream)
281 # define MAX_TAG_LEN 79 295 size_t outalloc = 256;
296 int in_wanted_part = 0;
306 }
state = STATE_OUTSIDE;
309 *outbuf =
malloc(outalloc);
314 couter[0] = cmain[0] = csub[0] = ptag[0] = patt[0] =
'\0';
323 show((
"=> %s", buffer));
324 error =
appenddata(outbuf, outlen, &outalloc, buffer, base64);
347 ptag[
len.uns] =
'\0';
349 if((STATE_INSUB ==
state) && !strcmp(csub, ptag)) {
351 state = STATE_INMAIN;
366 else if((STATE_INMAIN ==
state) && !strcmp(cmain, ptag)) {
383 else if((STATE_OUTER ==
state) && !strcmp(couter, ptag)) {
385 state = STATE_OUTSIDE;
395 else if(!in_wanted_part) {
409 ptag[
len.uns] =
'\0';
412 if((
'!' == ptag[0]) || (
'?' == ptag[0])) {
413 show((
"* ignoring (%s)", buffer));
421 while(*end && (
'>' != *end))
429 patt[
len.uns] =
'\0';
431 if(STATE_OUTSIDE ==
state) {
433 strcpy(couter, ptag);
437 else if(STATE_OUTER ==
state) {
440 state = STATE_INMAIN;
443 else if(STATE_INMAIN ==
state) {
447 if(!strcmp(cmain, main) && !strcmp(csub, sub)) {
450 if(strstr(patt,
"base64="))
461 show((
"=> %s", buffer));
462 error =
appenddata(outbuf, outlen, &outalloc, buffer, base64);
void *(* curl_calloc_callback)(size_t nmemb, size_t size)
CURLcode Curl_convert_clone(struct Curl_easy *data, const char *indata, size_t insize, char **outbuf)
CURLcode Curl_base64_decode(const char *src, unsigned char **outptr, size_t *outlen)
curl_calloc_callback Curl_ccalloc
void *(* curl_realloc_callback)(void *ptr, size_t size)
UNITTEST_START char * ptr
#define realloc(ptr, size)
static int readline(char **buffer, size_t *bufsize, FILE *stream)
int curlx_uztosi(size_t uznum)
#define GPE_OUT_OF_MEMORY
static int appenddata(char **dst_buf, size_t *dst_len, size_t *dst_alloc, char *src_buf, int src_b64)
memcpy(filename, filename1, strlen(filename1))
static struct input indata[NUM_HANDLES]
curl_free_callback Curl_cfree
void *(* curl_malloc_callback)(size_t size)
static int decodedata(char **buf, size_t *len)
curl_realloc_callback Curl_crealloc
#define GPE_NO_BUFFER_SPACE
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
int getpart(char **outbuf, size_t *outlen, const char *main, const char *sub, FILE *stream)
char *(* curl_strdup_callback)(const char *str)
void(* curl_free_callback)(void *ptr)
curl_strdup_callback Curl_cstrdup
curl_malloc_callback Curl_cmalloc
#define calloc(nbelem, size)