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
42bd4103
Kaydet (Commit)
42bd4103
authored
Tem 22, 2017
tarafından
Chris Sherlock
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
rtl: cleanup cipher.cxx equality conditions
Change-Id: I0b8084adea65f8c6a6e5e46b6628297fbd9eda9b
üst
4f9cd941
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
27 deletions
+32
-27
cipher.cxx
sal/rtl/cipher.cxx
+32
-27
No files found.
sal/rtl/cipher.cxx
Dosyayı görüntüle @
42bd4103
...
...
@@ -135,9 +135,10 @@ rtlCipherError SAL_CALL rtl_cipher_init(
const
sal_uInt8
*
pArgData
,
sal_Size
nArgLen
)
SAL_THROW_EXTERN_C
()
{
Cipher_Impl
*
pImpl
=
static_cast
<
Cipher_Impl
*>
(
Cipher
);
if
(
pImpl
==
nullptr
)
if
(
!
pImpl
)
return
rtl_Cipher_E_Argument
;
if
(
pImpl
->
m_init
==
nullptr
)
if
(
!
pImpl
->
m_init
)
return
rtl_Cipher_E_Unknown
;
return
(
pImpl
->
m_init
)(
...
...
@@ -150,9 +151,10 @@ rtlCipherError SAL_CALL rtl_cipher_encode(
sal_uInt8
*
pBuffer
,
sal_Size
nBufLen
)
SAL_THROW_EXTERN_C
()
{
Cipher_Impl
*
pImpl
=
static_cast
<
Cipher_Impl
*>
(
Cipher
);
if
(
pImpl
==
nullptr
)
if
(
!
pImpl
)
return
rtl_Cipher_E_Argument
;
if
(
pImpl
->
m_encode
==
nullptr
)
if
(
!
pImpl
->
m_encode
)
return
rtl_Cipher_E_Unknown
;
return
(
pImpl
->
m_encode
)(
Cipher
,
pData
,
nDatLen
,
pBuffer
,
nBufLen
);
...
...
@@ -164,9 +166,10 @@ rtlCipherError SAL_CALL rtl_cipher_decode(
sal_uInt8
*
pBuffer
,
sal_Size
nBufLen
)
SAL_THROW_EXTERN_C
()
{
Cipher_Impl
*
pImpl
=
static_cast
<
Cipher_Impl
*>
(
Cipher
);
if
(
pImpl
==
nullptr
)
if
(
!
pImpl
)
return
rtl_Cipher_E_Argument
;
if
(
pImpl
->
m_decode
==
nullptr
)
if
(
!
pImpl
->
m_decode
)
return
rtl_Cipher_E_Unknown
;
return
(
pImpl
->
m_decode
)(
Cipher
,
pData
,
nDatLen
,
pBuffer
,
nBufLen
);
...
...
@@ -681,10 +684,10 @@ static rtlCipherError BF_update(
sal_uInt8
*
pBuffer
,
sal_Size
nBufLen
)
{
/* Check arguments. */
if
(
(
pData
==
nullptr
)
||
(
pBuffer
==
nullptr
)
)
if
(
!
pData
||
!
pBuffer
)
return
rtl_Cipher_E_Argument
;
if
(
!
((
0
<
nDatLen
)
&&
(
nDatLen
<=
nBufLen
)))
if
(
!
((
nDatLen
>
0
)
&&
(
nDatLen
<=
nBufLen
)))
return
rtl_Cipher_E_BufferSize
;
/* Update. */
...
...
@@ -939,7 +942,7 @@ rtlCipher SAL_CALL rtl_cipher_createBF(rtlCipherMode Mode) SAL_THROW_EXTERN_C()
CipherBF_Impl
*
pImpl
=
nullptr
;
if
(
Mode
==
rtl_Cipher_ModeInvalid
)
return
(
nullptr
)
;
return
nullptr
;
pImpl
=
static_cast
<
CipherBF_Impl
*>
(
rtl_allocateZeroMemory
(
sizeof
(
CipherBF_Impl
)));
if
(
pImpl
)
...
...
@@ -964,13 +967,13 @@ rtlCipherError SAL_CALL rtl_cipher_initBF(
{
CipherBF_Impl
*
pImpl
=
static_cast
<
CipherBF_Impl
*>
(
Cipher
);
if
(
(
pImpl
==
nullptr
)
||
(
pKeyData
==
nullptr
)
)
if
(
!
pImpl
||
!
pKeyData
)
return
rtl_Cipher_E_Argument
;
if
(
!
(
pImpl
->
m_cipher
.
m_algorithm
==
rtl_Cipher_AlgorithmBF
)
)
if
(
pImpl
->
m_cipher
.
m_algorithm
!=
rtl_Cipher_AlgorithmBF
)
return
rtl_Cipher_E_Algorithm
;
if
(
!
(
Direction
==
rtl_Cipher_DirectionInvalid
)
)
if
(
Direction
!=
rtl_Cipher_DirectionInvalid
)
pImpl
->
m_cipher
.
m_direction
=
Direction
;
else
return
rtl_Cipher_E_Direction
;
...
...
@@ -986,14 +989,15 @@ rtlCipherError SAL_CALL rtl_cipher_encodeBF(
sal_uInt8
*
pBuffer
,
sal_Size
nBufLen
)
SAL_THROW_EXTERN_C
()
{
CipherBF_Impl
*
pImpl
=
static_cast
<
CipherBF_Impl
*>
(
Cipher
);
if
(
pImpl
==
nullptr
)
if
(
!
pImpl
)
return
rtl_Cipher_E_Argument
;
if
(
!
(
pImpl
->
m_cipher
.
m_algorithm
==
rtl_Cipher_AlgorithmBF
)
)
if
(
pImpl
->
m_cipher
.
m_algorithm
!=
rtl_Cipher_AlgorithmBF
)
return
rtl_Cipher_E_Algorithm
;
if
(
pImpl
->
m_cipher
.
m_direction
==
rtl_Cipher_DirectionInvalid
)
return
rtl_Cipher_E_Direction
;
if
(
pImpl
->
m_cipher
.
m_direction
==
rtl_Cipher_DirectionDecode
)
return
rtl_Cipher_E_Direction
;
...
...
@@ -1009,14 +1013,15 @@ rtlCipherError SAL_CALL rtl_cipher_decodeBF(
sal_uInt8
*
pBuffer
,
sal_Size
nBufLen
)
SAL_THROW_EXTERN_C
()
{
CipherBF_Impl
*
pImpl
=
static_cast
<
CipherBF_Impl
*>
(
Cipher
);
if
(
pImpl
==
nullptr
)
if
(
!
pImpl
)
return
rtl_Cipher_E_Argument
;
if
(
!
(
pImpl
->
m_cipher
.
m_algorithm
==
rtl_Cipher_AlgorithmBF
)
)
if
(
pImpl
->
m_cipher
.
m_algorithm
!=
rtl_Cipher_AlgorithmBF
)
return
rtl_Cipher_E_Algorithm
;
if
(
pImpl
->
m_cipher
.
m_direction
==
rtl_Cipher_DirectionInvalid
)
return
rtl_Cipher_E_Direction
;
if
(
pImpl
->
m_cipher
.
m_direction
==
rtl_Cipher_DirectionEncode
)
return
rtl_Cipher_E_Direction
;
...
...
@@ -1115,7 +1120,7 @@ static rtlCipherError rtl_cipherARCFOUR_update_Impl(
sal_Size
k
;
/* Check arguments. */
if
(
(
pData
==
nullptr
)
||
(
pBuffer
==
nullptr
)
)
if
(
!
pData
||
!
pBuffer
)
return
rtl_Cipher_E_Argument
;
if
(
!
((
0
<
nDatLen
)
&&
(
nDatLen
<=
nBufLen
)))
...
...
@@ -1156,8 +1161,8 @@ rtlCipher SAL_CALL rtl_cipher_createARCFOUR(rtlCipherMode Mode)
{
CipherARCFOUR_Impl
*
pImpl
=
nullptr
;
if
(
!
(
Mode
==
rtl_Cipher_ModeStream
)
)
return
(
nullptr
)
;
if
(
Mode
!=
rtl_Cipher_ModeStream
)
return
nullptr
;
pImpl
=
static_cast
<
CipherARCFOUR_Impl
*>
(
rtl_allocateZeroMemory
(
sizeof
(
CipherARCFOUR_Impl
)));
if
(
pImpl
)
...
...
@@ -1184,18 +1189,18 @@ rtlCipherError SAL_CALL rtl_cipher_initARCFOUR(
{
CipherARCFOUR_Impl
*
pImpl
=
static_cast
<
CipherARCFOUR_Impl
*>
(
Cipher
);
if
(
(
pImpl
==
nullptr
)
||
(
pKeyData
==
nullptr
)
)
if
(
!
pImpl
||
!
pKeyData
)
return
rtl_Cipher_E_Argument
;
if
(
!
(
pImpl
->
m_cipher
.
m_algorithm
==
rtl_Cipher_AlgorithmARCFOUR
)
)
if
(
pImpl
->
m_cipher
.
m_algorithm
!=
rtl_Cipher_AlgorithmARCFOUR
)
return
rtl_Cipher_E_Algorithm
;
if
(
!
(
Direction
==
rtl_Cipher_DirectionInvalid
)
)
if
(
Direction
!=
rtl_Cipher_DirectionInvalid
)
pImpl
->
m_cipher
.
m_direction
=
Direction
;
else
return
rtl_Cipher_E_Direction
;
return
rtl_cipherARCFOUR_init_Impl
(
&
(
pImpl
->
m_context
),
pKeyData
,
nKeyLen
);
return
rtl_cipherARCFOUR_init_Impl
(
&
(
pImpl
->
m_context
),
pKeyData
,
nKeyLen
);
}
rtlCipherError
SAL_CALL
rtl_cipher_encodeARCFOUR
(
...
...
@@ -1204,10 +1209,10 @@ rtlCipherError SAL_CALL rtl_cipher_encodeARCFOUR(
sal_uInt8
*
pBuffer
,
sal_Size
nBufLen
)
SAL_THROW_EXTERN_C
()
{
CipherARCFOUR_Impl
*
pImpl
=
static_cast
<
CipherARCFOUR_Impl
*>
(
Cipher
);
if
(
pImpl
==
nullptr
)
if
(
!
pImpl
)
return
rtl_Cipher_E_Argument
;
if
(
!
(
pImpl
->
m_cipher
.
m_algorithm
==
rtl_Cipher_AlgorithmARCFOUR
)
)
if
(
pImpl
->
m_cipher
.
m_algorithm
!=
rtl_Cipher_AlgorithmARCFOUR
)
return
rtl_Cipher_E_Algorithm
;
if
(
pImpl
->
m_cipher
.
m_direction
==
rtl_Cipher_DirectionInvalid
)
...
...
@@ -1224,10 +1229,10 @@ rtlCipherError SAL_CALL rtl_cipher_decodeARCFOUR(
sal_uInt8
*
pBuffer
,
sal_Size
nBufLen
)
SAL_THROW_EXTERN_C
()
{
CipherARCFOUR_Impl
*
pImpl
=
static_cast
<
CipherARCFOUR_Impl
*>
(
Cipher
);
if
(
pImpl
==
nullptr
)
if
(
!
pImpl
)
return
rtl_Cipher_E_Argument
;
if
(
!
(
pImpl
->
m_cipher
.
m_algorithm
==
rtl_Cipher_AlgorithmARCFOUR
)
)
if
(
pImpl
->
m_cipher
.
m_algorithm
!=
rtl_Cipher_AlgorithmARCFOUR
)
return
rtl_Cipher_E_Algorithm
;
if
(
pImpl
->
m_cipher
.
m_direction
==
rtl_Cipher_DirectionInvalid
)
...
...
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