Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
445065d1
Kaydet (Commit)
445065d1
authored
Kas 19, 2011
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
ByteString->rtl::OString[Buffer]
üst
4e7fff38
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
108 deletions
+55
-108
inetmime.hxx
tools/inc/tools/inetmime.hxx
+38
-82
inetmime.cxx
tools/source/inet/inetmime.cxx
+17
-26
No files found.
tools/inc/tools/inetmime.hxx
Dosyayı görüntüle @
445065d1
...
...
@@ -32,8 +32,9 @@
#include "tools/toolsdllapi.h"
#include <rtl/alloc.h>
#include <rtl/string.h>
#include "rtl/tencinfo.h"
#include <rtl/string.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/tencinfo.h>
#include <tools/debug.hxx>
#include <tools/errcode.hxx>
#include <tools/string.hxx>
...
...
@@ -404,19 +405,6 @@ public:
const
sal_Unicode
*
pEnd1
,
const
sal_Char
*
pString2
);
/** Check two US-ASCII strings for equality, ignoring case.
@param rString1 The first string.
@param sString2 Points to the start of the null terminated second
string, must not be null.
@return True if the two strings are equal, ignoring the case of US-
ASCII alphabetic characters (US-ASCII 'A'--'Z' and 'a'--'z').
*/
static
inline
bool
equalIgnoreCase
(
const
ByteString
&
rString1
,
const
sal_Char
*
pString2
);
static
inline
bool
startsWithLineBreak
(
const
sal_Char
*
pBegin
,
const
sal_Char
*
pEnd
);
...
...
@@ -536,7 +524,7 @@ public:
sal_uInt32
&
rCharacter
);
static
UniString
decodeHeaderFieldBody
(
HeaderFieldType
eType
,
const
ByteString
&
rBody
);
const
rtl
::
OString
&
rBody
);
// #i70651#: Prevent warnings on Mac OS X.
#ifdef MACOSX
...
...
@@ -711,14 +699,6 @@ inline sal_uInt32 INetMIME::toUTF32(sal_Unicode cHighSurrogate,
|
(
sal_uInt32
(
cLowSurrogate
)
&
0x3FF
);
}
// static
inline
bool
INetMIME
::
equalIgnoreCase
(
const
ByteString
&
rString1
,
const
sal_Char
*
pString2
)
{
return
equalIgnoreCase
(
rString1
.
GetBuffer
(),
rString1
.
GetBuffer
()
+
rString1
.
Len
(),
pString2
);
}
// static
inline
bool
INetMIME
::
startsWithLineBreak
(
const
sal_Char
*
pBegin
,
const
sal_Char
*
pEnd
)
...
...
@@ -973,14 +953,18 @@ public:
/** Write a sequence of octets.
@param rOctets A
Byte
String, interpreted as a sequence of octets.
@param rOctets A
rtl::O
String, interpreted as a sequence of octets.
@param nBegin The offset of the first character to write.
@param nEnd The offset past the last character to write.
*/
inline
void
write
(
const
ByteString
&
rString
,
xub_StrLen
nBegin
,
xub_StrLen
nEnd
);
void
write
(
const
rtl
::
OString
&
rOctets
,
xub_StrLen
nBegin
,
xub_StrLen
nEnd
)
{
writeSequence
(
rOctets
.
getStr
()
+
nBegin
,
rOctets
.
getStr
()
+
nEnd
);
m_nColumn
+=
nEnd
-
nBegin
;
}
/** Write a single octet.
...
...
@@ -1002,11 +986,16 @@ public:
/** Write a sequence of octets.
@param rOctets A
Byte
String, interpreted as a sequence of octets.
@param rOctets A
rtl::O
String, interpreted as a sequence of octets.
@return This instance.
*/
inline
INetMIMEOutputSink
&
operator
<<
(
const
ByteString
&
rOctets
);
INetMIMEOutputSink
&
operator
<<
(
const
rtl
::
OString
&
rOctets
)
{
writeSequence
(
rOctets
.
getStr
(),
rOctets
.
getStr
()
+
rOctets
.
getLength
());
m_nColumn
+=
rOctets
.
getLength
();
return
*
this
;
}
/** Call a manipulator function.
...
...
@@ -1052,13 +1041,6 @@ inline void INetMIMEOutputSink::write(const sal_Unicode * pBegin,
m_nColumn
+=
pEnd
-
pBegin
;
}
inline
void
INetMIMEOutputSink
::
write
(
const
ByteString
&
rOctets
,
xub_StrLen
nBegin
,
xub_StrLen
nEnd
)
{
writeSequence
(
rOctets
.
GetBuffer
()
+
nBegin
,
rOctets
.
GetBuffer
()
+
nEnd
);
m_nColumn
+=
nEnd
-
nBegin
;
}
inline
INetMIMEOutputSink
&
INetMIMEOutputSink
::
operator
<<
(
sal_Char
nOctet
)
{
writeSequence
(
&
nOctet
,
&
nOctet
+
1
);
...
...
@@ -1073,14 +1055,6 @@ inline INetMIMEOutputSink & INetMIMEOutputSink::operator <<(const sal_Char *
return
*
this
;
}
inline
INetMIMEOutputSink
&
INetMIMEOutputSink
::
operator
<<
(
const
ByteString
&
rOctets
)
{
writeSequence
(
rOctets
.
GetBuffer
(),
rOctets
.
GetBuffer
()
+
rOctets
.
Len
());
m_nColumn
+=
rOctets
.
Len
();
return
*
this
;
}
// static
inline
INetMIMEOutputSink
&
INetMIMEOutputSink
::
endl
(
INetMIMEOutputSink
&
rSink
)
...
...
@@ -1101,8 +1075,7 @@ inline void INetMIME::writeEscapeSequence(INetMIMEOutputSink & rSink,
//============================================================================
class
INetMIMEStringOutputSink
:
public
INetMIMEOutputSink
{
ByteString
m_aBuffer
;
bool
m_bOverflow
;
rtl
::
OStringBuffer
m_aBuffer
;
using
INetMIMEOutputSink
::
writeSequence
;
...
...
@@ -1113,21 +1086,16 @@ public:
inline
INetMIMEStringOutputSink
(
sal_uInt32
nColumn
=
0
,
sal_uInt32
nLineLengthLimit
=
INetMIME
::
SOFT_LINE_LENGTH_LIMIT
)
:
INetMIMEOutputSink
(
nColumn
,
nLineLengthLimit
)
,
m_bOverflow
(
false
)
{}
INetMIMEOutputSink
(
nColumn
,
nLineLengthLimit
)
{}
virtual
ErrCode
getError
()
const
;
inline
ByteString
takeBuffer
();
rtl
::
OString
takeBuffer
()
{
return
m_aBuffer
.
makeStringAndClear
();
}
};
inline
ByteString
INetMIMEStringOutputSink
::
takeBuffer
()
{
ByteString
aTheBuffer
=
m_aBuffer
;
m_aBuffer
.
Erase
();
m_bOverflow
=
false
;
return
aTheBuffer
;
}
//============================================================================
class
INetMIMEEncodedWordOutputSink
{
...
...
@@ -1240,17 +1208,17 @@ struct INetContentTypeParameter
will only be one item for the complete parameter, with the attribute
name lacking any section suffix.
*/
const
Byte
String
m_sAttribute
;
const
rtl
::
O
String
m_sAttribute
;
/** The optional character set specification (see RFC 2231), in US-ASCII
encoding and converted to lower case.
*/
const
Byte
String
m_sCharset
;
const
rtl
::
O
String
m_sCharset
;
/** The optional language specification (see RFC 2231), in US-ASCII
encoding and converted to lower case.
*/
const
Byte
String
m_sLanguage
;
const
rtl
::
O
String
m_sLanguage
;
/** The attribute value. If the value is a quoted-string, it is
'unpacked.' If a character set is specified, and the value can be
...
...
@@ -1277,29 +1245,18 @@ struct INetContentTypeParameter
*/
const
bool
m_bConverted
;
inline
INetContentTypeParameter
(
const
ByteString
&
rTheAttribute
,
const
ByteString
&
rTheCharset
,
const
ByteString
&
rTheLanguage
,
const
UniString
&
rTheValue
,
bool
bTheConverted
);
INetContentTypeParameter
(
const
rtl
::
OString
&
rTheAttribute
,
const
rtl
::
OString
&
rTheCharset
,
const
rtl
::
OString
&
rTheLanguage
,
const
UniString
&
rTheValue
,
bool
bTheConverted
)
:
m_sAttribute
(
rTheAttribute
)
,
m_sCharset
(
rTheCharset
)
,
m_sLanguage
(
rTheLanguage
)
,
m_sValue
(
rTheValue
)
,
m_bConverted
(
bTheConverted
)
{
}
};
inline
INetContentTypeParameter
::
INetContentTypeParameter
(
const
ByteString
&
rTheAttribute
,
const
ByteString
&
rTheCharset
,
const
ByteString
&
rTheLanguage
,
const
UniString
&
rTheValue
,
bool
bTheConverted
)
:
m_sAttribute
(
rTheAttribute
),
m_sCharset
(
rTheCharset
),
m_sLanguage
(
rTheLanguage
),
m_sValue
(
rTheValue
),
m_bConverted
(
bTheConverted
)
{}
//============================================================================
class
TOOLS_DLLPUBLIC
INetContentTypeParameterList
{
...
...
@@ -1322,8 +1279,7 @@ public:
return
&
(
maEntries
[
nIndex
]);
}
const
INetContentTypeParameter
*
find
(
const
ByteString
&
rAttribute
)
const
;
const
INetContentTypeParameter
*
find
(
const
rtl
::
OString
&
rAttribute
)
const
;
private
:
...
...
tools/source/inet/inetmime.cxx
Dosyayı görüntüle @
445065d1
...
...
@@ -2763,7 +2763,7 @@ bool INetMIME::translateUTF8Char(const sal_Char *& rBegin,
//============================================================================
// static
UniString
INetMIME
::
decodeHeaderFieldBody
(
HeaderFieldType
eType
,
const
ByteString
&
rBody
)
const
rtl
::
OString
&
rBody
)
{
// Due to a bug in INetCoreRFC822MessageStream::ConvertTo7Bit(), old
// versions of StarOffice send mails with header fields where encoded
...
...
@@ -2785,8 +2785,8 @@ UniString INetMIME::decodeHeaderFieldBody(HeaderFieldType eType,
//
// base64 = ALPHA / DIGIT / "+" / "/"
const
sal_Char
*
pBegin
=
rBody
.
GetBuffe
r
();
const
sal_Char
*
pEnd
=
pBegin
+
rBody
.
Len
();
const
sal_Char
*
pBegin
=
rBody
.
getSt
r
();
const
sal_Char
*
pEnd
=
pBegin
+
rBody
.
getLength
();
UniString
sDecoded
;
const
sal_Char
*
pCopyBegin
=
pBegin
;
...
...
@@ -2984,11 +2984,9 @@ UniString INetMIME::decodeHeaderFieldBody(HeaderFieldType eType,
bDone
=
true
;
break
;
}
sText
.
append
(
rBody
.
Copy
(
static_cast
<
xub_StrLen
>
(
pEncodedTextCopyBegin
-
pBegin
),
static_cast
<
xub_StrLen
>
(
q
-
1
-
pEncodedTextCopyBegin
)));
sText
.
append
(
rBody
.
copy
(
(
pEncodedTextCopyBegin
-
pBegin
),
(
q
-
1
-
pEncodedTextCopyBegin
)));
sText
.
append
(
sal_Char
(
nDigit1
<<
4
|
nDigit2
));
q
+=
2
;
pEncodedTextCopyBegin
=
q
;
...
...
@@ -2997,22 +2995,18 @@ UniString INetMIME::decodeHeaderFieldBody(HeaderFieldType eType,
case
'?'
:
if
(
q
-
pEncodedTextBegin
>
1
)
sText
.
append
(
rBody
.
Copy
(
static_cast
<
xub_StrLen
>
(
pEncodedTextCopyBegin
-
pBegin
),
static_cast
<
xub_StrLen
>
(
q
-
1
-
pEncodedTextCopyBegin
)));
sText
.
append
(
rBody
.
copy
(
(
pEncodedTextCopyBegin
-
pBegin
),
(
q
-
1
-
pEncodedTextCopyBegin
)));
else
bEncodedWord
=
false
;
bDone
=
true
;
break
;
case
'_'
:
sText
.
append
(
rBody
.
Copy
(
static_cast
<
xub_StrLen
>
(
pEncodedTextCopyBegin
-
pBegin
),
static_cast
<
xub_StrLen
>
(
q
-
1
-
pEncodedTextCopyBegin
)));
sText
.
append
(
rBody
.
copy
(
(
pEncodedTextCopyBegin
-
pBegin
),
(
q
-
1
-
pEncodedTextCopyBegin
)));
sText
.
append
(
' '
);
pEncodedTextCopyBegin
=
q
;
break
;
...
...
@@ -3284,20 +3278,17 @@ void INetMIMEOutputSink::writeLineEnd()
void
INetMIMEStringOutputSink
::
writeSequence
(
const
sal_Char
*
pBegin
,
const
sal_Char
*
pEnd
)
{
DBG_ASSERT
(
pBegin
&&
pBegin
<=
pEnd
,
OSL_ENSURE
(
pBegin
&&
pBegin
<=
pEnd
,
"INetMIMEStringOutputSink::writeSequence(): Bad sequence"
);
m_bOverflow
=
m_bOverflow
||
pEnd
-
pBegin
>
STRING_MAXLEN
-
m_aBuffer
.
Len
();
if
(
!
m_bOverflow
)
m_aBuffer
.
Append
(
pBegin
,
static_cast
<
xub_StrLen
>
(
pEnd
-
pBegin
));
m_aBuffer
.
append
(
pBegin
,
pEnd
-
pBegin
);
}
//============================================================================
// virtual
ErrCode
INetMIMEStringOutputSink
::
getError
()
const
{
return
m_bOverflow
?
ERRCODE_IO_OUTOFMEMORY
:
ERRCODE_NONE
;
return
ERRCODE_NONE
;
}
//============================================================================
...
...
@@ -4171,12 +4162,12 @@ void INetContentTypeParameterList::Clear()
//============================================================================
const
INetContentTypeParameter
*
INetContentTypeParameterList
::
find
(
const
ByteString
&
rAttribute
)
const
INetContentTypeParameterList
::
find
(
const
rtl
::
OString
&
rAttribute
)
const
{
boost
::
ptr_vector
<
INetContentTypeParameter
>::
const_iterator
iter
;
for
(
iter
=
maEntries
.
begin
();
iter
!=
maEntries
.
end
();
++
iter
)
{
if
(
iter
->
m_sAttribute
.
EqualsIgnoreCaseAscii
(
rAttribute
))
if
(
iter
->
m_sAttribute
.
equalsIgnoreAsciiCase
(
rAttribute
))
return
&
(
*
iter
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment