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
7ed36e0d
Kaydet (Commit)
7ed36e0d
authored
Eki 23, 2014
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
coverity#441992 Uncaught exception
Change-Id: Ibd07b854bbcf9d9e83236669addfd61fe639882a
üst
b536f9ae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
106 additions
and
105 deletions
+106
-105
idlcmain.cxx
idlc/source/idlcmain.cxx
+106
-105
No files found.
idlc/source/idlcmain.cxx
Dosyayı görüntüle @
7ed36e0d
...
...
@@ -35,131 +35,132 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
}
Options
options
(
argv
[
0
]);
sal_Int32
nErrors
=
0
;
try
{
if
(
!
options
.
initOptions
(
args
))
return
(
0
);
}
catch
(
const
IllegalArgument
&
e
)
{
fprintf
(
stderr
,
"Illegal argument: %s
\n
%s"
,
e
.
m_message
.
getStr
(),
options
.
prepareVersion
().
getStr
());
return
(
99
);
}
setIdlc
(
&
options
);
sal_Int32
nErrors
=
0
;
if
(
options
.
readStdin
())
{
if
(
!
options
.
quiet
()
)
fprintf
(
stdout
,
"%s: Compiling stdin
\n
"
,
options
.
getProgramName
().
getStr
());
nErrors
=
compileFile
(
0
);
if
(
(
idlc
()
->
getWarningCount
()
>
0
)
&&
!
options
.
quiet
()
)
{
fprintf
(
stdout
,
"%s: detected %lu warnings compiling stdin
\n
"
,
options
.
getProgramName
().
getStr
(),
sal
::
static_int_cast
<
unsigned
long
>
(
idlc
()
->
getWarningCount
()));
}
OString
outputUrl
;
if
(
options
.
isValid
(
"-O"
))
{
outputUrl
=
convertToFileUrl
(
options
.
getOption
(
"-O"
));
if
(
!
outputUrl
.
endsWith
(
"/"
))
{
outputUrl
+=
"/"
;
setIdlc
(
&
options
);
if
(
options
.
readStdin
())
{
if
(
!
options
.
quiet
()
)
fprintf
(
stdout
,
"%s: Compiling stdin
\n
"
,
options
.
getProgramName
().
getStr
());
nErrors
=
compileFile
(
0
);
if
(
(
idlc
()
->
getWarningCount
()
>
0
)
&&
!
options
.
quiet
()
)
{
fprintf
(
stdout
,
"%s: detected %lu warnings compiling stdin
\n
"
,
options
.
getProgramName
().
getStr
(),
sal
::
static_int_cast
<
unsigned
long
>
(
idlc
()
->
getWarningCount
()));
}
OString
outputUrl
;
if
(
options
.
isValid
(
"-O"
))
{
outputUrl
=
convertToFileUrl
(
options
.
getOption
(
"-O"
));
if
(
!
outputUrl
.
endsWith
(
"/"
))
{
outputUrl
+=
"/"
;
}
outputUrl
+=
"stdin.urd"
;
}
else
{
outputUrl
=
convertToFileUrl
(
"stdin.urd"
);
}
outputUrl
+=
"stdin.urd"
;
}
else
{
outputUrl
=
convertToFileUrl
(
"stdin.urd"
);
if
(
nErrors
>
0
)
{
removeIfExists
(
outputUrl
);
}
else
{
nErrors
=
produceFile
(
outputUrl
,
0
);
}
idlc
()
->
reset
();
}
if
(
nErrors
>
0
)
{
removeIfExists
(
outputUrl
);
}
else
{
nErrors
=
produceFile
(
outputUrl
,
0
);
StringVector
const
&
files
=
options
.
getInputFiles
();
if
(
options
.
verbose
()
)
{
fprintf
(
stdout
,
"%s: compiling %i source files ...
\n
"
,
options
.
getProgramName
().
getStr
(),
(
int
)
files
.
size
()
);
fflush
(
stdout
);
}
idlc
()
->
reset
();
}
StringVector
const
&
files
=
options
.
getInputFiles
();
if
(
options
.
verbose
()
)
{
fprintf
(
stdout
,
"%s: compiling %i source files ...
\n
"
,
options
.
getProgramName
().
getStr
(),
(
int
)
files
.
size
()
);
fflush
(
stdout
);
}
for
(
StringVector
::
const_iterator
i
(
files
.
begin
());
i
!=
files
.
end
()
&&
nErrors
==
0
;
++
i
)
{
OString
sysFileName
(
convertToAbsoluteSystemPath
(
*
i
)
);
if
(
!
options
.
quiet
()
)
fprintf
(
stdout
,
"Compiling: %s
\n
"
,
(
*
i
).
getStr
());
nErrors
=
compileFile
(
&
sysFileName
);
for
(
StringVector
::
const_iterator
i
(
files
.
begin
());
i
!=
files
.
end
()
&&
nErrors
==
0
;
++
i
)
{
OString
sysFileName
(
convertToAbsoluteSystemPath
(
*
i
)
);
if
(
idlc
()
->
getWarningCount
()
&&
!
options
.
quiet
()
)
fprintf
(
stdout
,
"%s: detected %lu warnings compiling file '%s'
\n
"
,
options
.
getProgramName
().
getStr
(),
sal
::
static_int_cast
<
unsigned
long
>
(
idlc
()
->
getWarningCount
()),
if
(
!
options
.
quiet
()
)
fprintf
(
stdout
,
"Compiling: %s
\n
"
,
(
*
i
).
getStr
());
// prepare output file name
OString
const
strippedFileName
(
sysFileName
.
copy
(
sysFileName
.
lastIndexOf
(
SEPARATOR
)
+
1
));
OString
outputFile
;
if
(
options
.
isValid
(
"-O"
)
)
{
outputFile
=
(
options
.
getOption
(
"-O"
));
if
(
!
outputFile
.
endsWith
(
"/"
))
{
outputFile
+=
OString
(
'/'
);
nErrors
=
compileFile
(
&
sysFileName
);
if
(
idlc
()
->
getWarningCount
()
&&
!
options
.
quiet
()
)
fprintf
(
stdout
,
"%s: detected %lu warnings compiling file '%s'
\n
"
,
options
.
getProgramName
().
getStr
(),
sal
::
static_int_cast
<
unsigned
long
>
(
idlc
()
->
getWarningCount
()),
(
*
i
).
getStr
());
// prepare output file name
OString
const
strippedFileName
(
sysFileName
.
copy
(
sysFileName
.
lastIndexOf
(
SEPARATOR
)
+
1
));
OString
outputFile
;
if
(
options
.
isValid
(
"-O"
)
)
{
outputFile
=
(
options
.
getOption
(
"-O"
));
if
(
!
outputFile
.
endsWith
(
"/"
))
{
outputFile
+=
OString
(
'/'
);
}
outputFile
+=
strippedFileName
.
replaceAt
(
strippedFileName
.
getLength
()
-
3
,
3
,
"urd"
);
}
else
{
outputFile
=
sysFileName
.
replaceAt
(
sysFileName
.
getLength
()
-
3
,
3
,
"urd"
);
}
outputFile
+=
strippedFileName
.
replaceAt
(
strippedFileName
.
getLength
()
-
3
,
3
,
"urd"
);
}
else
{
outputFile
=
sysFileName
.
replaceAt
(
sysFileName
.
getLength
()
-
3
,
3
,
"urd"
);
}
OString
const
outputFileUrl
=
convertToFileUrl
(
outputFile
);
OString
const
outputFileUrl
=
convertToFileUrl
(
outputFile
);
OString
depFileUrl
;
if
(
options
.
isValid
(
"-M"
))
{
depFileUrl
=
convertToFileUrl
(
options
.
getOption
(
"-M"
));
if
(
!
depFileUrl
.
endsWith
(
"/"
))
{
depFileUrl
+=
"/"
;
OString
depFileUrl
;
if
(
options
.
isValid
(
"-M"
))
{
depFileUrl
=
convertToFileUrl
(
options
.
getOption
(
"-M"
));
if
(
!
depFileUrl
.
endsWith
(
"/"
))
{
depFileUrl
+=
"/"
;
}
depFileUrl
+=
strippedFileName
.
replaceAt
(
strippedFileName
.
getLength
()
-
3
,
3
,
"d"
);
}
depFileUrl
+=
strippedFileName
.
replaceAt
(
strippedFileName
.
getLength
()
-
3
,
3
,
"d"
);
}
if
(
nErrors
)
{
if
(
options
.
isValid
(
"-M"
))
{
removeIfExists
(
depFileUrl
);
if
(
nErrors
)
{
if
(
options
.
isValid
(
"-M"
))
{
removeIfExists
(
depFileUrl
);
}
removeIfExists
(
outputFileUrl
);
}
else
{
sPair_t
const
pair
(
depFileUrl
,
outputFile
);
nErrors
=
produceFile
(
outputFileUrl
,
(
options
.
isValid
(
"-M"
))
?
&
pair
:
0
);
}
removeIfExists
(
outputFileUrl
);
}
else
{
sPair_t
const
pair
(
depFileUrl
,
outputFile
);
nErrors
=
produceFile
(
outputFileUrl
,
(
options
.
isValid
(
"-M"
))
?
&
pair
:
0
);
}
idlc
()
->
reset
();
}
idlc
()
->
reset
();
}
if
(
nErrors
>
0
)
{
fprintf
(
stderr
,
"%s: detected %ld errors%s"
,
options
.
getProgramName
().
getStr
(),
sal
::
static_int_cast
<
long
>
(
nErrors
),
options
.
prepareVersion
().
getStr
());
}
else
{
if
(
options
.
verbose
()
)
fprintf
(
stdout
,
"%s: returned successful%s"
,
if
(
nErrors
>
0
)
{
fprintf
(
stderr
,
"%s: detected %ld errors%s"
,
options
.
getProgramName
().
getStr
(),
sal
::
static_int_cast
<
long
>
(
nErrors
),
options
.
prepareVersion
().
getStr
());
}
else
{
if
(
options
.
verbose
()
)
fprintf
(
stdout
,
"%s: returned successful%s"
,
options
.
getProgramName
().
getStr
(),
options
.
prepareVersion
().
getStr
());
}
}
catch
(
const
IllegalArgument
&
e
)
{
fprintf
(
stderr
,
"Illegal argument: %s
\n
%s"
,
e
.
m_message
.
getStr
(),
options
.
prepareVersion
().
getStr
());
return
(
99
);
}
return
nErrors
;
}
...
...
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