Пример #1
0
static void free_queue_empty(cst_audiodev *ad)
{
    au_wince_pdata *pd = ad->platform_data;

    while (pd->fqlen)
    {
        finish_header(pd->wo, pd->fq[--pd->fqlen]);
    }
}
Пример #2
0
static struct header *read_headers(struct mimestack **stack, int *iseof,
                                   FILE *fpin,
                                   FILE *fpout,
                                   int doappend)
{
    char buf[BUFSIZ];
    struct read_header_context rhc;
    struct header *h;

    init_read_header_context(&rhc);

    while (!*iseof)
    {
        if (fgets(buf, sizeof(buf), fpin) == NULL)
        {
            *iseof=1;
            break;
        }

        if (READ_START_OF_LINE(rhc))
        {
            struct mimestack *b;
            int is_closing;

            if (strcmp(buf, "\n") == 0
                    || strcmp(buf, "\r\n") == 0)
                break;

            b=is_boundary(*stack, buf, &is_closing);

            if (b)
            {
                /*
                ** Corrupted MIME message.  We should NOT
                ** see a MIME boundary in the middle of the
                ** headers!
                **
                ** Ignore this damage.
                */

                struct header *p;

                h=finish_header(&rhc);

                for (p=h; p; p=p->next)
                    fprintf(fpout, "%s", p->header);
                fprintf(fpout, "--%s%s", b->boundary,
                        is_closing ? "--":"");
                if (is_closing)
                {
                    pop_mimestack_to(stack, b);
                    find_boundary(stack, iseof,
                                  fpin, fpout, doappend);
                }
                free_header(h);

                init_read_header_context(&rhc);
                continue; /* From the top */
            }
        }
        read_header(&rhc, buf);
    }

    return (finish_header(&rhc));
}