Switch to unified view

a/src/bincimapmime/mime-parseonlyheader.cc b/src/bincimapmime/mime-parseonlyheader.cc
...
...
45
#ifndef NO_NAMESPACES
45
#ifndef NO_NAMESPACES
46
using namespace ::std;
46
using namespace ::std;
47
#endif /* NO_NAMESPACES */
47
#endif /* NO_NAMESPACES */
48
48
49
//------------------------------------------------------------------------
49
//------------------------------------------------------------------------
50
void Binc::MimeDocument::parseOnlyHeader(int fd) const
50
void Binc::MimeDocument::parseOnlyHeader(int fd)
51
{
51
{
52
  if (allIsParsed || headerIsParsed)
52
  if (allIsParsed || headerIsParsed)
53
    return;
53
    return;
54
  
54
  
55
  headerIsParsed = true;
55
  headerIsParsed = true;
56
56
57
  if (!mimeSource || mimeSource->getFileDescriptor() != fd) {
58
    delete mimeSource;
57
  delete doc_mimeSource;
59
    mimeSource = new MimeInputSource(fd);
58
  doc_mimeSource = new MimeInputSource(fd);
60
  } else {
61
    mimeSource->reset();
62
  }
63
64
59
65
  headerstartoffsetcrlf = 0;
60
  headerstartoffsetcrlf = 0;
66
  headerlength = 0;
61
  headerlength = 0;
67
  bodystartoffsetcrlf = 0;
62
  bodystartoffsetcrlf = 0;
68
  bodylength = 0;
63
  bodylength = 0;
...
...
70
  multipart = false;
65
  multipart = false;
71
66
72
  nlines = 0;
67
  nlines = 0;
73
  nbodylines = 0;
68
  nbodylines = 0;
74
69
75
  doParseOnlyHeader("");
70
  doParseOnlyHeader(doc_mimeSource, "");
76
}
71
}
77
72
78
void Binc::MimeDocument::parseOnlyHeader(istream& s) const
73
void Binc::MimeDocument::parseOnlyHeader(istream& s)
79
{
74
{
80
  if (allIsParsed || headerIsParsed)
75
  if (allIsParsed || headerIsParsed)
81
    return;
76
    return;
82
  
77
  
83
  headerIsParsed = true;
78
  headerIsParsed = true;
84
79
85
  delete mimeSource;
80
  delete doc_mimeSource;
86
  mimeSource = new MimeInputSourceStream(s);
81
  doc_mimeSource = new MimeInputSourceStream(s);
87
82
88
  headerstartoffsetcrlf = 0;
83
  headerstartoffsetcrlf = 0;
89
  headerlength = 0;
84
  headerlength = 0;
90
  bodystartoffsetcrlf = 0;
85
  bodystartoffsetcrlf = 0;
91
  bodylength = 0;
86
  bodylength = 0;
...
...
93
  multipart = false;
88
  multipart = false;
94
89
95
  nlines = 0;
90
  nlines = 0;
96
  nbodylines = 0;
91
  nbodylines = 0;
97
92
98
  doParseOnlyHeader("");
93
  doParseOnlyHeader(doc_mimeSource, "");
99
}
94
}
100
95
101
//------------------------------------------------------------------------
96
//------------------------------------------------------------------------
102
int Binc::MimePart::doParseOnlyHeader(const string &toboundary) const
97
int Binc::MimePart::doParseOnlyHeader(MimeInputSource *ms, 
98
                    const string &toboundary)
103
{
99
{
100
  mimeSource = ms;
104
  string name;
101
  string name;
105
  string content;
102
  string content;
106
  char cqueue[4];
103
  char cqueue[4];
107
  memset(cqueue, 0, sizeof(cqueue));
104
  memset(cqueue, 0, sizeof(cqueue));
108
105