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
eb02a553
Kaydet (Commit)
eb02a553
authored
Kas 06, 2015
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
coverity#1338270 Uncaught exception
Change-Id: I5c6fae963c4aabe15d82a51f5801e62656188051
üst
06147401
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
91 additions
and
83 deletions
+91
-83
regcompare.cxx
registry/tools/regcompare.cxx
+91
-83
No files found.
registry/tools/regcompare.cxx
Dosyayı görüntüle @
eb02a553
...
@@ -1954,113 +1954,121 @@ int main( int argc, char * argv[] )
...
@@ -1954,113 +1954,121 @@ int main( int argc, char * argv[] )
int
_cdecl
main
(
int
argc
,
char
*
argv
[]
)
int
_cdecl
main
(
int
argc
,
char
*
argv
[]
)
#endif
#endif
{
{
std
::
vector
<
std
::
string
>
args
;
try
Options_Impl
options
(
argv
[
0
]);
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
{
if
(
!
Options
::
checkArgument
(
args
,
argv
[
i
],
strlen
(
argv
[
i
])))
std
::
vector
<
std
::
string
>
args
;
Options_Impl
options
(
argv
[
0
]);
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
!
Options
::
checkArgument
(
args
,
argv
[
i
],
strlen
(
argv
[
i
])))
{
// failure.
options
.
printUsage
();
return
1
;
}
}
if
(
!
options
.
initOptions
(
args
))
{
{
// failure.
options
.
printUsage
();
return
1
;
return
1
;
}
}
}
if
(
!
options
.
initOptions
(
args
))
{
return
1
;
}
OUString
regName1
(
convertToFileUrl
(
options
.
getRegName1
().
c_str
(),
options
.
getRegName1
().
size
())
);
OUString
regName2
(
convertToFileUrl
(
options
.
getRegName2
().
c_str
(),
options
.
getRegName2
().
size
())
);
Registry
reg1
,
reg2
;
if
(
reg1
.
open
(
regName1
,
RegAccessMode
::
READONLY
)
!=
RegError
::
NO_ERROR
)
{
fprintf
(
stdout
,
"%s: open registry
\"
%s
\"
failed
\n
"
,
options
.
getProgramName
().
c_str
(),
options
.
getRegName1
().
c_str
());
return
2
;
}
if
(
reg2
.
open
(
regName2
,
RegAccessMode
::
READONLY
)
!=
RegError
::
NO_ERROR
)
{
fprintf
(
stdout
,
"%s: open registry
\"
%s
\"
failed
\n
"
,
options
.
getProgramName
().
c_str
(),
options
.
getRegName2
().
c_str
());
return
3
;
}
RegistryKey
key1
,
key2
;
OUString
regName1
(
convertToFileUrl
(
options
.
getRegName1
().
c_str
(),
options
.
getRegName1
().
size
())
);
if
(
reg1
.
openRootKey
(
key1
)
!=
RegError
::
NO_ERROR
)
OUString
regName2
(
convertToFileUrl
(
options
.
getRegName2
().
c_str
(),
options
.
getRegName2
().
size
())
);
{
fprintf
(
stdout
,
"%s: open root key of registry
\"
%s
\"
failed
\n
"
,
options
.
getProgramName
().
c_str
(),
options
.
getRegName1
().
c_str
());
return
4
;
}
if
(
reg2
.
openRootKey
(
key2
)
!=
RegError
::
NO_ERROR
)
{
fprintf
(
stdout
,
"%s: open root key of registry
\"
%s
\"
failed
\n
"
,
options
.
getProgramName
().
c_str
(),
options
.
getRegName2
().
c_str
());
return
5
;
}
if
(
options
.
isStartKeyValid
()
)
Registry
reg1
,
reg2
;
{
if
(
reg1
.
open
(
regName1
,
RegAccessMode
::
READONLY
)
!=
RegError
::
NO_ERROR
)
if
(
options
.
matchedWithExcludeKey
(
options
.
getStartKey
()
)
)
{
fprintf
(
stdout
,
"%s: open registry
\"
%s
\"
failed
\n
"
,
options
.
getProgramName
().
c_str
(),
options
.
getRegName1
().
c_str
());
return
2
;
}
if
(
reg2
.
open
(
regName2
,
RegAccessMode
::
READONLY
)
!=
RegError
::
NO_ERROR
)
{
{
fprintf
(
stdout
,
"%s:
start key is equal to one of the exclude keys
\n
"
,
fprintf
(
stdout
,
"%s:
open registry
\"
%s
\"
failed
\n
"
,
options
.
getProgramName
().
c_str
());
options
.
getProgramName
().
c_str
()
,
options
.
getRegName2
().
c_str
()
);
return
6
;
return
3
;
}
}
RegistryKey
sk1
,
sk2
;
if
(
key1
.
openKey
(
options
.
getStartKey
(),
sk1
)
!=
RegError
::
NO_ERROR
)
RegistryKey
key1
,
key2
;
if
(
reg1
.
openRootKey
(
key1
)
!=
RegError
::
NO_ERROR
)
{
{
fprintf
(
stdout
,
"%s: open
star
t key of registry
\"
%s
\"
failed
\n
"
,
fprintf
(
stdout
,
"%s: open
roo
t key of registry
\"
%s
\"
failed
\n
"
,
options
.
getProgramName
().
c_str
(),
options
.
getRegName1
().
c_str
());
options
.
getProgramName
().
c_str
(),
options
.
getRegName1
().
c_str
());
return
7
;
return
4
;
}
}
if
(
key2
.
openKey
(
options
.
getStartKey
(),
sk
2
)
!=
RegError
::
NO_ERROR
)
if
(
reg2
.
openRootKey
(
key
2
)
!=
RegError
::
NO_ERROR
)
{
{
fprintf
(
stdout
,
"%s: open
star
t key of registry
\"
%s
\"
failed
\n
"
,
fprintf
(
stdout
,
"%s: open
roo
t key of registry
\"
%s
\"
failed
\n
"
,
options
.
getProgramName
().
c_str
(),
options
.
getRegName2
().
c_str
());
options
.
getProgramName
().
c_str
(),
options
.
getRegName2
().
c_str
());
return
8
;
return
5
;
}
}
key1
=
sk1
;
if
(
options
.
isStartKeyValid
()
)
key2
=
sk2
;
{
}
if
(
options
.
matchedWithExcludeKey
(
options
.
getStartKey
()
)
)
{
fprintf
(
stdout
,
"%s: start key is equal to one of the exclude keys
\n
"
,
options
.
getProgramName
().
c_str
());
return
6
;
}
RegistryKey
sk1
,
sk2
;
if
(
key1
.
openKey
(
options
.
getStartKey
(),
sk1
)
!=
RegError
::
NO_ERROR
)
{
fprintf
(
stdout
,
"%s: open start key of registry
\"
%s
\"
failed
\n
"
,
options
.
getProgramName
().
c_str
(),
options
.
getRegName1
().
c_str
());
return
7
;
}
if
(
key2
.
openKey
(
options
.
getStartKey
(),
sk2
)
!=
RegError
::
NO_ERROR
)
{
fprintf
(
stdout
,
"%s: open start key of registry
\"
%s
\"
failed
\n
"
,
options
.
getProgramName
().
c_str
(),
options
.
getRegName2
().
c_str
());
return
8
;
}
sal_uInt32
nError
=
compareKeys
(
options
,
key1
,
key2
);
key1
=
sk1
;
if
(
nError
)
key2
=
sk2
;
{
}
if
(
options
.
unoTypeCheck
()
)
sal_uInt32
nError
=
compareKeys
(
options
,
key1
,
key2
);
if
(
nError
)
{
{
fprintf
(
stdout
,
"%s: registries are incompatible: %lu differences!
\n
"
,
if
(
options
.
unoTypeCheck
()
)
options
.
getProgramName
().
c_str
(),
{
sal
::
static_int_cast
<
unsigned
long
>
(
nError
));
fprintf
(
stdout
,
"%s: registries are incompatible: %lu differences!
\n
"
,
options
.
getProgramName
().
c_str
(),
sal
::
static_int_cast
<
unsigned
long
>
(
nError
));
}
else
{
fprintf
(
stdout
,
"%s: registries contain %lu differences!
\n
"
,
options
.
getProgramName
().
c_str
(),
sal
::
static_int_cast
<
unsigned
long
>
(
nError
));
}
}
}
else
key1
.
releaseKey
();
key2
.
releaseKey
();
if
(
reg1
.
close
()
!=
RegError
::
NO_ERROR
)
{
fprintf
(
stdout
,
"%s: closing registry
\"
%s
\"
failed
\n
"
,
options
.
getProgramName
().
c_str
(),
options
.
getRegName1
().
c_str
());
return
9
;
}
if
(
reg2
.
close
()
!=
RegError
::
NO_ERROR
)
{
{
fprintf
(
stdout
,
"%s:
registries contain %lu differences!
\n
"
,
fprintf
(
stdout
,
"%s:
closing registry
\"
%s
\"
failed
\n
"
,
options
.
getProgramName
().
c_str
(),
options
.
getProgramName
().
c_str
(),
options
.
getRegName2
().
c_str
());
sal
::
static_int_cast
<
unsigned
long
>
(
nError
))
;
return
10
;
}
}
}
key1
.
releaseKey
();
return
((
nError
>
0
)
?
11
:
0
);
key2
.
releaseKey
();
if
(
reg1
.
close
()
!=
RegError
::
NO_ERROR
)
{
fprintf
(
stdout
,
"%s: closing registry
\"
%s
\"
failed
\n
"
,
options
.
getProgramName
().
c_str
(),
options
.
getRegName1
().
c_str
());
return
9
;
}
}
if
(
reg2
.
close
()
!=
RegError
::
NO_ERROR
)
catch
(
std
::
exception
&
e
)
{
{
fprintf
(
stdout
,
"%s: closing registry
\"
%s
\"
failed
\n
"
,
fprintf
(
stdout
,
(
"WARNING:
\"
%s
\"\n
"
),
e
.
what
());
options
.
getProgramName
().
c_str
(),
options
.
getRegName2
().
c_str
());
return
11
;
return
10
;
}
}
return
((
nError
>
0
)
?
11
:
0
);
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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