This commit is contained in:
Sébastien Debrard 2011-02-08 21:08:40 +01:00
commit 54f523717c
67 changed files with 5431 additions and 1547 deletions

1
.gitignore vendored
View File

@ -9,6 +9,7 @@ tools/dmake
dmake dmake
tools/errmsg tools/errmsg
# VS generated files # VS generated files
*.obj
*.ncb *.ncb
*.suo *.suo
*.user *.user

2710
Changelog

File diff suppressed because it is too large Load Diff

View File

@ -205,7 +205,7 @@ lib/token.o: lib/token.cpp lib/token.h lib/errorlogger.h lib/check.h lib/tokeniz
lib/tokenize.o: lib/tokenize.cpp lib/tokenize.h lib/token.h lib/mathlib.h lib/settings.h lib/errorlogger.h lib/check.h lib/path.h lib/symboldatabase.h lib/tokenize.o: lib/tokenize.cpp lib/tokenize.h lib/token.h lib/mathlib.h lib/settings.h lib/errorlogger.h lib/check.h lib/path.h lib/symboldatabase.h
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -c -o lib/tokenize.o lib/tokenize.cpp $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -c -o lib/tokenize.o lib/tokenize.cpp
cli/cmdlineparser.o: cli/cmdlineparser.cpp lib/cppcheck.h lib/settings.h lib/errorlogger.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h lib/timer.h cli/cmdlineparser.h lib/path.h cli/cmdlineparser.o: cli/cmdlineparser.cpp lib/cppcheck.h lib/settings.h lib/errorlogger.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h lib/timer.h cli/cmdlineparser.h lib/path.h cli/filelister.h
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Iexternals -c -o cli/cmdlineparser.o cli/cmdlineparser.cpp $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Iexternals -c -o cli/cmdlineparser.o cli/cmdlineparser.cpp
cli/cppcheckexecutor.o: cli/cppcheckexecutor.cpp cli/cppcheckexecutor.h lib/errorlogger.h lib/settings.h lib/cppcheck.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h cli/threadexecutor.h cli/cmdlineparser.h cli/filelister.h lib/path.h cli/pathmatch.h cli/cppcheckexecutor.o: cli/cppcheckexecutor.cpp cli/cppcheckexecutor.h lib/errorlogger.h lib/settings.h lib/cppcheck.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h cli/threadexecutor.h cli/cmdlineparser.h cli/filelister.h lib/path.h cli/pathmatch.h
@ -256,7 +256,7 @@ test/testcppcheck.o: test/testcppcheck.cpp lib/cppcheck.h lib/settings.h lib/err
test/testdivision.o: test/testdivision.cpp lib/tokenize.h lib/checkother.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h test/testsuite.h test/redirect.h test/testdivision.o: test/testdivision.cpp lib/tokenize.h lib/checkother.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h test/testsuite.h test/redirect.h
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testdivision.o test/testdivision.cpp $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testdivision.o test/testdivision.cpp
test/testerrorlogger.o: test/testerrorlogger.cpp test/testsuite.h lib/errorlogger.h test/redirect.h test/testerrorlogger.o: test/testerrorlogger.cpp lib/cppcheck.h lib/settings.h lib/errorlogger.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h test/testsuite.h test/redirect.h
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testerrorlogger.o test/testerrorlogger.cpp $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testerrorlogger.o test/testerrorlogger.cpp
test/testexceptionsafety.o: test/testexceptionsafety.cpp lib/tokenize.h lib/checkexceptionsafety.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h test/testsuite.h test/redirect.h test/testexceptionsafety.o: test/testexceptionsafety.cpp lib/tokenize.h lib/checkexceptionsafety.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h test/testsuite.h test/redirect.h

View File

@ -607,68 +607,67 @@ void CmdLineParser::PrintHelp()
std::cout << "Cppcheck - A tool for static C/C++ code analysis\n" std::cout << "Cppcheck - A tool for static C/C++ code analysis\n"
"\n" "\n"
"Syntax:\n" "Syntax:\n"
" cppcheck [--append=file] [-D<ID>] [--enable=<id>] [--error-exitcode=[n]]\n" " cppcheck [OPTIONS] [files or paths]\n"
" [--exitcode-suppressions file] [--file-list=file.txt] [--force]\n"
" [--help] [-Idir] [--inline-suppr] [-j [jobs]] [--quiet]\n"
" [--report-progress] [--style] [--suppressions-list=file.txt]\n"
" [--verbose] [--version] [--xml] [file or path1] [file or path]\n"
"\n" "\n"
"If path is given instead of filename, *.cpp, *.cxx, *.cc, *.c++ and *.c files\n" "If path is given instead of filename, *.cpp, *.cxx, *.cc, *.c++ and *.c files\n"
"are checked recursively from given directory.\n\n" "are checked recursively from given directory.\n\n"
"Options:\n" "Options:\n"
" --append=file This allows you to provide information about\n" " --append=<file> This allows you to provide information about\n"
" functions by providing an implementation for these.\n" " functions by providing an implementation for these.\n"
" -D<ID> By default Cppcheck checks all configurations.\n" " -D<ID> By default Cppcheck checks all configurations.\n"
" Use -D to limit the checking. When -D is used the\n" " Use -D to limit the checking. When -D is used the\n"
" checking is limited to the given configuration.\n" " checking is limited to the given configuration.\n"
" Example: -DDEBUG=1 -D__cplusplus\n" " Example: -DDEBUG=1 -D__cplusplus\n"
" --enable=id Enable additional checks. The available ids are:\n" " --enable=<id> Enable additional checks. The available ids are:\n"
" * all - enable all checks\n" " * all - enable all checks\n"
" * style - Check coding style\n" " * style - Check coding style\n"
" * information - Enable information messages\n" " * information - Enable information messages\n"
" * unusedFunction - check for unused functions\n" " * unusedFunction - check for unused functions\n"
" * missingInclude - check for missing includes\n" " * missingInclude - check for missing includes\n"
" Several ids can be given if you separate them with commas\n" " Several ids can be given if you separate them with commas.\n"
" --error-exitcode=[n] If errors are found, integer [n] is returned instead\n" " --error-exitcode=<n> If errors are found, integer [n] is returned instead\n"
" of default 0. EXIT_FAILURE is returned\n" " of default 0. EXIT_FAILURE is returned\n"
" if arguments are not valid or if no input files are\n" " if arguments are not valid or if no input files are\n"
" provided. Note that your operating system can\n" " provided. Note that your operating system can\n"
" modify this value, e.g. 256 can become 0.\n" " modify this value, e.g. 256 can become 0.\n"
" --errorlist Print a list of all error messages in XML format.\n" " --errorlist Print a list of all error messages in XML format.\n"
" --exitcode-suppressions=file\n" " --exitcode-suppressions=<file>\n"
" Used when certain messages should be displayed but\n" " Used when certain messages should be displayed but\n"
" should not cause a non-zero exitcode.\n" " should not cause a non-zero exitcode.\n"
" --file-list=file Specify the files to check in a text file. One Filename per line.\n" " --file-list=<file> Specify the files to check in a text file. One Filename per line.\n"
" -f, --force Force checking on files that have \"too many\"\n" " -f, --force Force checking on files that have \"too many\"\n"
" configurations\n" " configurations.\n"
" -h, --help Print this help\n" " -h, --help Print this help.\n"
" -I [dir] Give include path. Give several -I parameters to give\n" " -I <dir> Give include path. Give several -I parameters to give\n"
" several paths. First given path is checked first. If\n" " several paths. First given path is checked first. If\n"
" paths are relative to source files, this is not needed\n" " paths are relative to source files, this is not needed.\n"
" -i [dir] Give path to ignore. Give several -i parameters to ignore\n" " -i <dir> Give path to ignore. Give several -i parameters to ignore\n"
" several paths. Give directory name or filename with path\n" " several paths. Give directory name or filename with path\n"
" as parameter. Directory name is matched to all parts of the\n" " as parameter. Directory name is matched to all parts of the\n"
" path.\n" " path.\n"
" --inline-suppr Enable inline suppressions. Use them by placing one or\n" " --inline-suppr Enable inline suppressions. Use them by placing one or\n"
" more comments, like: // cppcheck-suppress warningId\n" " more comments, like: // cppcheck-suppress warningId\n"
" on the lines before the warning to suppress.\n" " on the lines before the warning to suppress.\n"
" -j [jobs] Start [jobs] threads to do the checking simultaneously.\n" " -j <jobs> Start [jobs] threads to do the checking simultaneously.\n"
" -q, --quiet Only print error messages\n" " -q, --quiet Only print error messages.\n"
" --report-progress Report progress messages while checking a file.\n" " --report-progress Report progress messages while checking a file.\n"
" -s, --style deprecated, use --enable=style\n" " --rule=<rule> Match regular expression.\n"
" --suppressions-list=file\n" " --rule-file=<file> Use given rule file. For more information, see: \n"
" https://sourceforge.net/projects/cppcheck/files/Articles/\n"
" -s, --style Deprecated, use --enable=style\n"
" --suppressions-list=<file>\n"
" Suppress warnings listed in the file. Filename and line\n" " Suppress warnings listed in the file. Filename and line\n"
" are optional in the suppression file. The format of the\n" " are optional in the suppression file. The format of the\n"
" single line in the suppression file is:\n" " single line in the suppression file is:\n"
" [error id]:[filename]:[line]\n" " [error id]:[filename]:[line]\n"
" --template '[text]' Format the error messages. E.g.\n" " --template '<text>' Format the error messages. E.g.\n"
" '{file}:{line},{severity},{id},{message}' or\n" " '{file}:{line},{severity},{id},{message}' or\n"
" '{file}({line}):({severity}) {message}'\n" " '{file}({line}):({severity}) {message}'\n"
" Pre-defined templates: gcc, vs\n" " Pre-defined templates: gcc, vs\n"
" -v, --verbose More detailed error reports\n" " -v, --verbose More detailed error reports.\n"
" --version Print out version number\n" " --version Print out version number.\n"
" --xml Write results in xml to error stream.\n" " --xml Write results in xml to error stream.\n"
" --xml-version=[version]\n" " --xml-version=<version>\n"
" Select the XML file version. Currently versions 1 and 2\n" " Select the XML file version. Currently versions 1 and 2\n"
" are available. The default version is 1." " are available. The default version is 1."
"\n" "\n"

View File

@ -56,8 +56,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,46,0,0 FILEVERSION 1,47,0,0
PRODUCTVERSION 1,46,0,0 PRODUCTVERSION 1,47,0,0
FILEFLAGSMASK 0x17L FILEFLAGSMASK 0x17L
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -73,12 +73,12 @@ BEGIN
BLOCK "040904b0" BLOCK "040904b0"
BEGIN BEGIN
VALUE "FileDescription", "cppcheck Application" VALUE "FileDescription", "cppcheck Application"
VALUE "FileVersion", "1.46" VALUE "FileVersion", "1.47"
VALUE "InternalName", "cppcheck" VALUE "InternalName", "cppcheck"
VALUE "LegalCopyright", "Copyright (C) 2007-2010 Daniel Marjamäki and Cppcheck team." VALUE "LegalCopyright", "Copyright (C) 2007-2010 Daniel Marjamäki and Cppcheck team."
VALUE "OriginalFilename", "cppcheck.exe" VALUE "OriginalFilename", "cppcheck.exe"
VALUE "ProductName", "cppcheck Application" VALUE "ProductName", "cppcheck Application"
VALUE "ProductVersion", "1.46" VALUE "ProductVersion", "1.47"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -20,7 +20,7 @@
/** /**
* *
* @mainpage Cppcheck * @mainpage Cppcheck
* @version 1.46 * @version 1.47
* *
* @section overview_sec Overview * @section overview_sec Overview
* Cppcheck is a simple tool for static analysis of C/C++ code. * Cppcheck is a simple tool for static analysis of C/C++ code.

View File

@ -1,11 +1,15 @@
#!/bin/bash #!/bin/bash
# A script for tagging and releasing.
# #
# A tag will be created with the given name. # A script for creating release packages. The release packages are create in the home directory.
# #
# Archive files are created in user's home directory. # Make sure "cppcheck --errorlist" works. For example with:
# make test
# cppcheck --errorlist > errlist.xml
# xmllint --noout errlist.xml
# cppcheck --xml-version=2 --errorlist > errlist.xml
# xmllint --noout errlist.xml
# #
# Before running this script, remember to update version number in: # Update version numbers in:
# - lib/cppcheck.cpp # - lib/cppcheck.cpp
# - cli/main.cpp # - cli/main.cpp
# - cli/cppcheck.rc # - cli/cppcheck.rc
@ -16,12 +20,16 @@
# wget http://josefsson.org/git2cl/git2cl # wget http://josefsson.org/git2cl/git2cl
# chmod 744 git2cl # chmod 744 git2cl
# ./git2cl > Changelog # ./git2cl > Changelog
# git commit -a -m "Changelog: Updated for release" # git commit -a -m "1.43: Updated Changelog"
# #
# Update the Makefile: # Update the Makefile:
# g++ -o dmake tools/dmake.cpp lib/filelister*.cpp # make dmake
# ./dmake --release # ./dmake --release
# git commit -a -m "Makefile: Set release mode" # git commit -a -m "1.43: Updated Makefile"
#
# Tag:
# git tag 1.43
# git push --tags
# #
# Create release: # Create release:
# ./createrelease 1.43 # ./createrelease 1.43
@ -33,13 +41,11 @@
# Generate the manual.pdf and version.txt # Generate the manual.pdf and version.txt
# make # make
# ./cppcheck --version > version.txt # ./cppcheck --version > version.txt
# docbook2pdf man/manual.pdf # docbook2pdf man/manual.docbook
# #
# Upload manual.pdf and version.txt... # Upload manual.pdf and version.txt...
# sftp hyd_danmar,cppcheck@web.sourceforge.net # sftp hyd_danmar,cppcheck@web.sourceforge.net
# #
# Make sure "cppcheck --errorlist" works
#
# save "cppcheck --doc" output on wiki # save "cppcheck --doc" output on wiki
# Tag to use # Tag to use

View File

@ -223,9 +223,9 @@ kate -l(line) (file)</translation>
<location filename="mainwindow.cpp" line="203"/> <location filename="mainwindow.cpp" line="203"/>
<location filename="mainwindow.cpp" line="233"/> <location filename="mainwindow.cpp" line="233"/>
<location filename="mainwindow.cpp" line="524"/> <location filename="mainwindow.cpp" line="524"/>
<location filename="mainwindow.cpp" line="642"/> <location filename="mainwindow.cpp" line="648"/>
<location filename="mainwindow.cpp" line="660"/> <location filename="mainwindow.cpp" line="666"/>
<location filename="mainwindow.cpp" line="811"/> <location filename="mainwindow.cpp" line="817"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation>Cppcheck</translation> <translation>Cppcheck</translation>
</message> </message>
@ -563,8 +563,9 @@ kate -l(line) (file)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="582"/> <location filename="mainwindow.cpp" line="582"/>
<source>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</source> <source>XML files version 2 (*.xml);;XML files version 1 (*.xml);;Text files (*.txt);;CSV files (*.csv)</source>
<translation>XML-Dateien (*.xml);;Textdateien (*.txt);;CSV-Dateien (*.csv)</translation> <oldsource>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</oldsource>
<translation type="unfinished">XML-Dateien (*.xml);;Textdateien (*.txt);;CSV-Dateien (*.csv)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="584"/> <location filename="mainwindow.cpp" line="584"/>
@ -573,7 +574,6 @@ kate -l(line) (file)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="443"/> <location filename="mainwindow.cpp" line="443"/>
<location filename="mainwindow.cpp" line="592"/>
<source>XML files (*.xml)</source> <source>XML files (*.xml)</source>
<translation>XML-Dateien (*.xml)</translation> <translation>XML-Dateien (*.xml)</translation>
</message> </message>
@ -584,8 +584,8 @@ kate -l(line) (file)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="306"/> <location filename="mainwindow.cpp" line="306"/>
<location filename="mainwindow.cpp" line="742"/> <location filename="mainwindow.cpp" line="748"/>
<location filename="mainwindow.cpp" line="788"/> <location filename="mainwindow.cpp" line="794"/>
<source>Project: </source> <source>Project: </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -601,23 +601,33 @@ kate -l(line) (file)</translation>
Do you want to stop the checking and exit Cppcheck?.</source> Do you want to stop the checking and exit Cppcheck?.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<location filename="mainwindow.cpp" line="592"/>
<source>XML files version 1 (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<location filename="mainwindow.cpp" line="598"/> <location filename="mainwindow.cpp" line="598"/>
<source>XML files version 2 (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="604"/>
<source>Text files (*.txt)</source> <source>Text files (*.txt)</source>
<translation>Textdateien (*.txt)</translation> <translation>Textdateien (*.txt)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="604"/> <location filename="mainwindow.cpp" line="610"/>
<source>CSV files (*.csv)</source> <source>CSV files (*.csv)</source>
<translation>CSV-Dateien (*.csv)</translation> <translation>CSV-Dateien (*.csv)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="644"/> <location filename="mainwindow.cpp" line="650"/>
<source>Cppcheck - %1</source> <source>Cppcheck - %1</source>
<translation>Cppcheck - %1</translation> <translation>Cppcheck - %1</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="661"/> <location filename="mainwindow.cpp" line="667"/>
<source>Failed to change the language: <source>Failed to change the language:
%1 %1
@ -633,39 +643,39 @@ Do you want to stop the checking and exit Cppcheck?.</source>
</translation> </translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="709"/> <location filename="mainwindow.cpp" line="715"/>
<location filename="mainwindow.cpp" line="718"/> <location filename="mainwindow.cpp" line="724"/>
<source>Cppcheck Help</source> <source>Cppcheck Help</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="709"/> <location filename="mainwindow.cpp" line="715"/>
<source>Failed to load help file (not found)</source> <source>Failed to load help file (not found)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="718"/> <location filename="mainwindow.cpp" line="724"/>
<source>Failed to load help file</source> <source>Failed to load help file</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="732"/> <location filename="mainwindow.cpp" line="738"/>
<location filename="mainwindow.cpp" line="777"/> <location filename="mainwindow.cpp" line="783"/>
<source>Project files (*.cppcheck);;All files(*.*)</source> <source>Project files (*.cppcheck);;All files(*.*)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="734"/> <location filename="mainwindow.cpp" line="740"/>
<source>Select Project File</source> <source>Select Project File</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="779"/> <location filename="mainwindow.cpp" line="785"/>
<source>Select Project Filename</source> <source>Select Project Filename</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="812"/> <location filename="mainwindow.cpp" line="818"/>
<source>No project file loaded</source> <source>No project file loaded</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -929,18 +939,18 @@ Please select the directory where file is located.</source>
<context> <context>
<name>ResultsView</name> <name>ResultsView</name>
<message> <message>
<location filename="resultsview.cpp" line="190"/> <location filename="resultsview.cpp" line="195"/>
<location filename="resultsview.cpp" line="202"/> <location filename="resultsview.cpp" line="207"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation>Cppcheck</translation> <translation>Cppcheck</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="191"/> <location filename="resultsview.cpp" line="196"/>
<source>No errors found.</source> <source>No errors found.</source>
<translation>Keine Fehler gefunden.</translation> <translation>Keine Fehler gefunden.</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="199"/> <location filename="resultsview.cpp" line="204"/>
<source>Errors were found, but they are configured to be hidden. <source>Errors were found, but they are configured to be hidden.
To toggle what kind of errors are shown, open view menu.</source> To toggle what kind of errors are shown, open view menu.</source>
<translation>Es wurden Fehler gefunden, aber sie sind so konfiguriert, ausgeblendet zu werden. <translation>Es wurden Fehler gefunden, aber sie sind so konfiguriert, ausgeblendet zu werden.
@ -948,28 +958,29 @@ Legen Sie unter dem Menü Ansicht fest, welche Art von Fehlern angezeigt werden
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="251"/> <location filename="resultsview.cpp" line="251"/>
<location filename="resultsview.cpp" line="261"/> <location filename="resultsview.cpp" line="271"/>
<location filename="resultsview.cpp" line="281"/>
<source>Failed to read the report.</source> <source>Failed to read the report.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="302"/> <location filename="resultsview.cpp" line="321"/>
<source>Summary</source> <source>Summary</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="303"/> <location filename="resultsview.cpp" line="322"/>
<source>Message</source> <source>Message</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="117"/> <location filename="resultsview.cpp" line="119"/>
<source>No errors found, nothing to save.</source> <source>No errors found, nothing to save.</source>
<translation>Keine Fehler gefunden, nichts zu speichern.</translation> <translation>Keine Fehler gefunden, nichts zu speichern.</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="144"/> <location filename="resultsview.cpp" line="149"/>
<location filename="resultsview.cpp" line="154"/> <location filename="resultsview.cpp" line="159"/>
<source>Failed to save the report.</source> <source>Failed to save the report.</source>
<translation>Der Bericht konnte nicht speichern werden.</translation> <translation>Der Bericht konnte nicht speichern werden.</translation>
</message> </message>

View File

@ -225,9 +225,9 @@ kate -l(line) (file)</translation>
<location filename="mainwindow.cpp" line="203"/> <location filename="mainwindow.cpp" line="203"/>
<location filename="mainwindow.cpp" line="233"/> <location filename="mainwindow.cpp" line="233"/>
<location filename="mainwindow.cpp" line="524"/> <location filename="mainwindow.cpp" line="524"/>
<location filename="mainwindow.cpp" line="642"/> <location filename="mainwindow.cpp" line="648"/>
<location filename="mainwindow.cpp" line="660"/> <location filename="mainwindow.cpp" line="666"/>
<location filename="mainwindow.cpp" line="811"/> <location filename="mainwindow.cpp" line="817"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation>Cppcheck</translation> <translation>Cppcheck</translation>
</message> </message>
@ -565,8 +565,9 @@ kate -l(line) (file)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="582"/> <location filename="mainwindow.cpp" line="582"/>
<source>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</source> <source>XML files version 2 (*.xml);;XML files version 1 (*.xml);;Text files (*.txt);;CSV files (*.csv)</source>
<translation>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</translation> <oldsource>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</oldsource>
<translation type="unfinished">XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="584"/> <location filename="mainwindow.cpp" line="584"/>
@ -575,7 +576,6 @@ kate -l(line) (file)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="443"/> <location filename="mainwindow.cpp" line="443"/>
<location filename="mainwindow.cpp" line="592"/>
<source>XML files (*.xml)</source> <source>XML files (*.xml)</source>
<translation>XML files (*.xml)</translation> <translation>XML files (*.xml)</translation>
</message> </message>
@ -586,8 +586,8 @@ kate -l(line) (file)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="306"/> <location filename="mainwindow.cpp" line="306"/>
<location filename="mainwindow.cpp" line="742"/> <location filename="mainwindow.cpp" line="748"/>
<location filename="mainwindow.cpp" line="788"/> <location filename="mainwindow.cpp" line="794"/>
<source>Project: </source> <source>Project: </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -603,23 +603,33 @@ kate -l(line) (file)</translation>
Do you want to stop the checking and exit Cppcheck?.</source> Do you want to stop the checking and exit Cppcheck?.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<location filename="mainwindow.cpp" line="592"/>
<source>XML files version 1 (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<location filename="mainwindow.cpp" line="598"/> <location filename="mainwindow.cpp" line="598"/>
<source>XML files version 2 (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="604"/>
<source>Text files (*.txt)</source> <source>Text files (*.txt)</source>
<translation>Text files (*.txt)</translation> <translation>Text files (*.txt)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="604"/> <location filename="mainwindow.cpp" line="610"/>
<source>CSV files (*.csv)</source> <source>CSV files (*.csv)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="644"/> <location filename="mainwindow.cpp" line="650"/>
<source>Cppcheck - %1</source> <source>Cppcheck - %1</source>
<translation>Cppcheck - %1</translation> <translation>Cppcheck - %1</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="661"/> <location filename="mainwindow.cpp" line="667"/>
<source>Failed to change the language: <source>Failed to change the language:
%1 %1
@ -633,39 +643,39 @@ Do you want to stop the checking and exit Cppcheck?.</source>
%1</translation> %1</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="709"/> <location filename="mainwindow.cpp" line="715"/>
<location filename="mainwindow.cpp" line="718"/> <location filename="mainwindow.cpp" line="724"/>
<source>Cppcheck Help</source> <source>Cppcheck Help</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="709"/> <location filename="mainwindow.cpp" line="715"/>
<source>Failed to load help file (not found)</source> <source>Failed to load help file (not found)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="718"/> <location filename="mainwindow.cpp" line="724"/>
<source>Failed to load help file</source> <source>Failed to load help file</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="732"/> <location filename="mainwindow.cpp" line="738"/>
<location filename="mainwindow.cpp" line="777"/> <location filename="mainwindow.cpp" line="783"/>
<source>Project files (*.cppcheck);;All files(*.*)</source> <source>Project files (*.cppcheck);;All files(*.*)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="734"/> <location filename="mainwindow.cpp" line="740"/>
<source>Select Project File</source> <source>Select Project File</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="779"/> <location filename="mainwindow.cpp" line="785"/>
<source>Select Project Filename</source> <source>Select Project Filename</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="812"/> <location filename="mainwindow.cpp" line="818"/>
<source>No project file loaded</source> <source>No project file loaded</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -929,18 +939,18 @@ Please select the directory where file is located.</source>
<context> <context>
<name>ResultsView</name> <name>ResultsView</name>
<message> <message>
<location filename="resultsview.cpp" line="190"/> <location filename="resultsview.cpp" line="195"/>
<location filename="resultsview.cpp" line="202"/> <location filename="resultsview.cpp" line="207"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation>Cppcheck</translation> <translation>Cppcheck</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="191"/> <location filename="resultsview.cpp" line="196"/>
<source>No errors found.</source> <source>No errors found.</source>
<translation>No errors found.</translation> <translation>No errors found.</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="199"/> <location filename="resultsview.cpp" line="204"/>
<source>Errors were found, but they are configured to be hidden. <source>Errors were found, but they are configured to be hidden.
To toggle what kind of errors are shown, open view menu.</source> To toggle what kind of errors are shown, open view menu.</source>
<translation>Errors were found, but they are configured to be hidden. <translation>Errors were found, but they are configured to be hidden.
@ -948,28 +958,29 @@ To toggle what kind of errors are shown, open view menu.</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="251"/> <location filename="resultsview.cpp" line="251"/>
<location filename="resultsview.cpp" line="261"/> <location filename="resultsview.cpp" line="271"/>
<location filename="resultsview.cpp" line="281"/>
<source>Failed to read the report.</source> <source>Failed to read the report.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="302"/> <location filename="resultsview.cpp" line="321"/>
<source>Summary</source> <source>Summary</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="303"/> <location filename="resultsview.cpp" line="322"/>
<source>Message</source> <source>Message</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="117"/> <location filename="resultsview.cpp" line="119"/>
<source>No errors found, nothing to save.</source> <source>No errors found, nothing to save.</source>
<translation>No errors found, nothing to save.</translation> <translation>No errors found, nothing to save.</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="144"/> <location filename="resultsview.cpp" line="149"/>
<location filename="resultsview.cpp" line="154"/> <location filename="resultsview.cpp" line="159"/>
<source>Failed to save the report.</source> <source>Failed to save the report.</source>
<translation>Failed to save the report.</translation> <translation>Failed to save the report.</translation>
</message> </message>

View File

@ -227,9 +227,9 @@ kate -l(line) (file)
<location filename="mainwindow.cpp" line="203"/> <location filename="mainwindow.cpp" line="203"/>
<location filename="mainwindow.cpp" line="233"/> <location filename="mainwindow.cpp" line="233"/>
<location filename="mainwindow.cpp" line="524"/> <location filename="mainwindow.cpp" line="524"/>
<location filename="mainwindow.cpp" line="642"/> <location filename="mainwindow.cpp" line="648"/>
<location filename="mainwindow.cpp" line="660"/> <location filename="mainwindow.cpp" line="666"/>
<location filename="mainwindow.cpp" line="811"/> <location filename="mainwindow.cpp" line="817"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation>Cppcheck</translation> <translation>Cppcheck</translation>
</message> </message>
@ -567,8 +567,9 @@ kate -l(line) (file)
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="582"/> <location filename="mainwindow.cpp" line="582"/>
<source>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</source> <source>XML files version 2 (*.xml);;XML files version 1 (*.xml);;Text files (*.txt);;CSV files (*.csv)</source>
<translation>XML-tiedostot (*.xml);;Tekstitiedostot (*.txt);;CSV-tiedostot (*.csv)</translation> <oldsource>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</oldsource>
<translation type="unfinished">XML-tiedostot (*.xml);;Tekstitiedostot (*.txt);;CSV-tiedostot (*.csv)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="584"/> <location filename="mainwindow.cpp" line="584"/>
@ -577,7 +578,6 @@ kate -l(line) (file)
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="443"/> <location filename="mainwindow.cpp" line="443"/>
<location filename="mainwindow.cpp" line="592"/>
<source>XML files (*.xml)</source> <source>XML files (*.xml)</source>
<translation>XML-tiedostot (*xml)</translation> <translation>XML-tiedostot (*xml)</translation>
</message> </message>
@ -588,8 +588,8 @@ kate -l(line) (file)
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="306"/> <location filename="mainwindow.cpp" line="306"/>
<location filename="mainwindow.cpp" line="742"/> <location filename="mainwindow.cpp" line="748"/>
<location filename="mainwindow.cpp" line="788"/> <location filename="mainwindow.cpp" line="794"/>
<source>Project: </source> <source>Project: </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -605,23 +605,33 @@ kate -l(line) (file)
Do you want to stop the checking and exit Cppcheck?.</source> Do you want to stop the checking and exit Cppcheck?.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<location filename="mainwindow.cpp" line="592"/>
<source>XML files version 1 (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<location filename="mainwindow.cpp" line="598"/> <location filename="mainwindow.cpp" line="598"/>
<source>XML files version 2 (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="604"/>
<source>Text files (*.txt)</source> <source>Text files (*.txt)</source>
<translation>Tekstitiedostot (*.txt)</translation> <translation>Tekstitiedostot (*.txt)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="604"/> <location filename="mainwindow.cpp" line="610"/>
<source>CSV files (*.csv)</source> <source>CSV files (*.csv)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="644"/> <location filename="mainwindow.cpp" line="650"/>
<source>Cppcheck - %1</source> <source>Cppcheck - %1</source>
<translation>Cppcheck - %1</translation> <translation>Cppcheck - %1</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="661"/> <location filename="mainwindow.cpp" line="667"/>
<source>Failed to change the language: <source>Failed to change the language:
%1 %1
@ -637,39 +647,39 @@ Do you want to stop the checking and exit Cppcheck?.</source>
</translation> </translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="709"/> <location filename="mainwindow.cpp" line="715"/>
<location filename="mainwindow.cpp" line="718"/> <location filename="mainwindow.cpp" line="724"/>
<source>Cppcheck Help</source> <source>Cppcheck Help</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="709"/> <location filename="mainwindow.cpp" line="715"/>
<source>Failed to load help file (not found)</source> <source>Failed to load help file (not found)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="718"/> <location filename="mainwindow.cpp" line="724"/>
<source>Failed to load help file</source> <source>Failed to load help file</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="732"/> <location filename="mainwindow.cpp" line="738"/>
<location filename="mainwindow.cpp" line="777"/> <location filename="mainwindow.cpp" line="783"/>
<source>Project files (*.cppcheck);;All files(*.*)</source> <source>Project files (*.cppcheck);;All files(*.*)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="734"/> <location filename="mainwindow.cpp" line="740"/>
<source>Select Project File</source> <source>Select Project File</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="779"/> <location filename="mainwindow.cpp" line="785"/>
<source>Select Project Filename</source> <source>Select Project Filename</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="812"/> <location filename="mainwindow.cpp" line="818"/>
<source>No project file loaded</source> <source>No project file loaded</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -933,18 +943,18 @@ Please select the directory where file is located.</source>
<context> <context>
<name>ResultsView</name> <name>ResultsView</name>
<message> <message>
<location filename="resultsview.cpp" line="190"/> <location filename="resultsview.cpp" line="195"/>
<location filename="resultsview.cpp" line="202"/> <location filename="resultsview.cpp" line="207"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation>Cppcheck</translation> <translation>Cppcheck</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="191"/> <location filename="resultsview.cpp" line="196"/>
<source>No errors found.</source> <source>No errors found.</source>
<translation>Virheitä ei löytynyt.</translation> <translation>Virheitä ei löytynyt.</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="199"/> <location filename="resultsview.cpp" line="204"/>
<source>Errors were found, but they are configured to be hidden. <source>Errors were found, but they are configured to be hidden.
To toggle what kind of errors are shown, open view menu.</source> To toggle what kind of errors are shown, open view menu.</source>
<translation>Virheitä löytyi, mutta asetuksissa kyseiset virheet on määritelty piilotettavaksi. <translation>Virheitä löytyi, mutta asetuksissa kyseiset virheet on määritelty piilotettavaksi.
@ -952,28 +962,29 @@ Määrittääksesi minkä tyyppisiä virheitä näytetään, avaa näkymä valik
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="251"/> <location filename="resultsview.cpp" line="251"/>
<location filename="resultsview.cpp" line="261"/> <location filename="resultsview.cpp" line="271"/>
<location filename="resultsview.cpp" line="281"/>
<source>Failed to read the report.</source> <source>Failed to read the report.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="302"/> <location filename="resultsview.cpp" line="321"/>
<source>Summary</source> <source>Summary</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="303"/> <location filename="resultsview.cpp" line="322"/>
<source>Message</source> <source>Message</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="117"/> <location filename="resultsview.cpp" line="119"/>
<source>No errors found, nothing to save.</source> <source>No errors found, nothing to save.</source>
<translation>Virheitä ei löytynyt, ei mitään tallennettavaa.</translation> <translation>Virheitä ei löytynyt, ei mitään tallennettavaa.</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="144"/> <location filename="resultsview.cpp" line="149"/>
<location filename="resultsview.cpp" line="154"/> <location filename="resultsview.cpp" line="159"/>
<source>Failed to save the report.</source> <source>Failed to save the report.</source>
<translation>Raportin tallentaminen epäonnistui.</translation> <translation>Raportin tallentaminen epäonnistui.</translation>
</message> </message>

View File

@ -15,10 +15,6 @@
<source>Cppcheck - A tool for static C/C++ code analysis.</source> <source>Cppcheck - A tool for static C/C++ code analysis.</source>
<translation>Cppcheck - Un outil d&apos;analyse statique de code C/C++.</translation> <translation>Cppcheck - Un outil d&apos;analyse statique de code C/C++.</translation>
</message> </message>
<message utf8="true">
<source>Copyright (C) 2007-2010 Daniel Marjamäki and cppcheck team.</source>
<translation>Copyright (C) 2007-2010 Daniel Marjamäki et cppcheck team.</translation>
</message>
<message> <message>
<source>This program is licensed under the terms <source>This program is licensed under the terms
of the GNU General Public License version 3</source> of the GNU General Public License version 3</source>
@ -29,6 +25,10 @@ General Public License version 3</translation>
<source>Visit Cppcheck homepage at %1</source> <source>Visit Cppcheck homepage at %1</source>
<translation>Visitez le site Cppcheck : %1</translation> <translation>Visitez le site Cppcheck : %1</translation>
</message> </message>
<message utf8="true">
<source>Copyright © 2007-2010 Daniel Marjamäki and cppcheck team.</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ApplicationDialog</name> <name>ApplicationDialog</name>
@ -61,14 +61,6 @@ Les textes suivants sont remplacés avec les valeurs appropriées lorsque l&apos
Example : ouvrir un fichier avec kate et position l&apos;affichage sur la bonne ligne: Example : ouvrir un fichier avec kate et position l&apos;affichage sur la bonne ligne:
kate -l(ligne) (fichier)</translation> kate -l(ligne) (fichier)</translation>
</message> </message>
<message>
<source>Application&apos;s name</source>
<translation>Nom de l&apos;application</translation>
</message>
<message>
<source>Application to execute</source>
<translation>Application à exécuter</translation>
</message>
<message> <message>
<source>Browse</source> <source>Browse</source>
<translation>Parcourir</translation> <translation>Parcourir</translation>
@ -89,6 +81,14 @@ kate -l(ligne) (fichier)</translation>
<source>You must specify a name and a path for the application!</source> <source>You must specify a name and a path for the application!</source>
<translation>Vous devez spécifier un nom et un chemin d&apos;accès pour l&apos;application !</translation> <translation>Vous devez spécifier un nom et un chemin d&apos;accès pour l&apos;application !</translation>
</message> </message>
<message>
<source>Application&apos;s name:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Command to execute:</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>FileViewDialog</name> <name>FileViewDialog</name>
@ -106,10 +106,69 @@ kate -l(ligne) (fichier)</translation>
</message> </message>
</context> </context>
<context> <context>
<name>Fileview</name> <name>HelpWindow</name>
<message> <message>
<source>Fileview</source> <source>Cppcheck Help</source>
<translation type="unfinished">Visualisateur de fichier</translation> <translation type="unfinished"></translation>
</message>
<message>
<source>Go back</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Back</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Go forward</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Forward</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Home</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LogView</name>
<message>
<source>Checking Log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Save</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Clear</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Close</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Save Log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Text files (*.txt *.log);;All files (*.*)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cppcheck</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not open file for writing: &quot;%1&quot;</source>
<translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context> <context>
@ -126,10 +185,6 @@ kate -l(ligne) (fichier)</translation>
<source>&amp;View</source> <source>&amp;View</source>
<translation type="unfinished">&amp;Affichage</translation> <translation type="unfinished">&amp;Affichage</translation>
</message> </message>
<message>
<source>&amp;Language</source>
<translation type="unfinished">&amp;Langue</translation>
</message>
<message> <message>
<source>&amp;Help</source> <source>&amp;Help</source>
<translation type="unfinished">&amp;Aide</translation> <translation type="unfinished">&amp;Aide</translation>
@ -210,26 +265,6 @@ kate -l(ligne) (fichier)</translation>
<source>&amp;Preferences</source> <source>&amp;Preferences</source>
<translation type="unfinished">&amp;Préférences</translation> <translation type="unfinished">&amp;Préférences</translation>
</message> </message>
<message>
<source>Show possible false positives</source>
<translation type="unfinished">Afficher les possibles faux positifs</translation>
</message>
<message>
<source>Show security errors</source>
<translation type="unfinished">Afficher les erreurs de sécurité</translation>
</message>
<message>
<source>Show style errors</source>
<translation type="unfinished">Afficher les erreurs de style</translation>
</message>
<message>
<source>Show possible style errors</source>
<translation type="unfinished">Afficher les erreurs possibles de style</translation>
</message>
<message>
<source>Show common errors</source>
<translation type="unfinished">Afficher les erreurs</translation>
</message>
<message> <message>
<source>&amp;Check all</source> <source>&amp;Check all</source>
<translation type="unfinished">Tout &amp;cocher</translation> <translation type="unfinished">Tout &amp;cocher</translation>
@ -246,10 +281,6 @@ kate -l(ligne) (fichier)</translation>
<source>&amp;Expand all</source> <source>&amp;Expand all</source>
<translation type="unfinished">Tout &amp;afficher</translation> <translation type="unfinished">Tout &amp;afficher</translation>
</message> </message>
<message>
<source>&amp;Toolbar</source>
<translation type="unfinished">&amp;Barre d&apos;outil</translation>
</message>
<message> <message>
<source>&amp;Contents</source> <source>&amp;Contents</source>
<translation type="unfinished">&amp;Contenu</translation> <translation type="unfinished">&amp;Contenu</translation>
@ -274,14 +305,6 @@ kate -l(ligne) (fichier)</translation>
<source>Select directory to check</source> <source>Select directory to check</source>
<translation type="unfinished">Sélectionner le répertoire à vérifier</translation> <translation type="unfinished">Sélectionner le répertoire à vérifier</translation>
</message> </message>
<message>
<source>Cannot exit while checking.
Stop the checking before exiting.</source>
<translation type="unfinished">Ne peut pas quitter pendant une vérification.
Arrêter la vérification avant de quitter.</translation>
</message>
<message> <message>
<source>License</source> <source>License</source>
<translation type="unfinished">Licence</translation> <translation type="unfinished">Licence</translation>
@ -290,10 +313,6 @@ Arrêter la vérification avant de quitter.</translation>
<source>Authors</source> <source>Authors</source>
<translation type="unfinished">Auteur</translation> <translation type="unfinished">Auteur</translation>
</message> </message>
<message>
<source>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</source>
<translation type="unfinished">Fichier XML (*.xml);;Fichier Texte (*.txt);;Fichier CSV (*.csv)</translation>
</message>
<message> <message>
<source>Save the report file</source> <source>Save the report file</source>
<translation type="unfinished">Sauvegarder le rapport</translation> <translation type="unfinished">Sauvegarder le rapport</translation>
@ -354,6 +373,253 @@ Arrêter la vérification avant de quitter.</translation>
<source>Polish</source> <source>Polish</source>
<translation type="unfinished">Polonais</translation> <translation type="unfinished">Polonais</translation>
</message> </message>
<message>
<source>&amp;Toolbars</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Categories</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Check files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Check directory</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Stop checking</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Style warnings</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show style warnings</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Errors</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show errors</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Standard</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Standard items</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Toolbar</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Categories</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error categories</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Open XML...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open P&amp;roject File...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;New Project File...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Log View</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Log View</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>C&amp;lose Project File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Edit Project File...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Statistics</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Warnings</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show warnings</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Performance warnings</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show performance warnings</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show &amp;hidden</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Information</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show information messages</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Portability</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show portability warnings</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>You must close the project file before selecting new files or directories!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Project: </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open the report file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Checking is running.
Do you want to stop the checking and exit Cppcheck?.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>XML files version 2 (*.xml);;XML files version 1 (*.xml);;Text files (*.txt);;CSV files (*.csv)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>XML files version 1 (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>XML files version 2 (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cppcheck Help</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Failed to load help file (not found)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Failed to load help file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Project files (*.cppcheck);;All files(*.*)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select Project File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select Project Filename</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No project file loaded</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Japanese</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Serbian</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Project</name>
<message>
<source>Cppcheck</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not read the project file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not write the project file.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ProjectFile</name>
<message>
<source>Project File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Project:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Paths:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Browse...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Include paths:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Defines:</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ProjectFileDialog</name>
<message>
<source>Project file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select include directory</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select directory to check</source>
<translation type="unfinished">Sélectionner le répertoire à vérifier</translation>
</message>
</context> </context>
<context> <context>
<name>QObject</name> <name>QObject</name>
@ -384,10 +650,6 @@ Arrêter la vérification avant de quitter.</translation>
<source>Line</source> <source>Line</source>
<translation type="unfinished">Ligne</translation> <translation type="unfinished">Ligne</translation>
</message> </message>
<message>
<source>Message</source>
<translation type="unfinished">Message</translation>
</message>
<message> <message>
<source>Undefined file</source> <source>Undefined file</source>
<translation type="unfinished">Fichier indéterminé</translation> <translation type="unfinished">Fichier indéterminé</translation>
@ -420,22 +682,52 @@ Please check the application path and parameters are correct.</source>
Merci de vérifier que le chemin de l&apos;application et que les paramètres sont corrects.</translation> Merci de vérifier que le chemin de l&apos;application et que les paramètres sont corrects.</translation>
</message> </message>
<message>
<source>possible error</source>
<translation type="unfinished">erreur possible</translation>
</message>
<message> <message>
<source>style</source> <source>style</source>
<translation type="unfinished">erreur de style</translation> <translation type="unfinished">erreur de style</translation>
</message> </message>
<message>
<source>possible style</source>
<translation type="unfinished">erreur de style possible</translation>
</message>
<message> <message>
<source>error</source> <source>error</source>
<translation type="unfinished">erreur</translation> <translation type="unfinished">erreur</translation>
</message> </message>
<message>
<source>Summary</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Hide</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find the file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find file:
%1
Please select the directory where file is located.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select Directory</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>warning</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>performance</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>portability</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>information</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ResultsView</name> <name>ResultsView</name>
@ -465,6 +757,18 @@ Pour configurer les erreurs affichées, ouvrez le menu d&apos;affichage.</transl
<source>Failed to save the report.</source> <source>Failed to save the report.</source>
<translation type="unfinished">Erreur lors de la sauvegarde du rapport.</translation> <translation type="unfinished">Erreur lors de la sauvegarde du rapport.</translation>
</message> </message>
<message>
<source>Failed to read the report.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Summary</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Message</source>
<translation type="unfinished">Message</translation>
</message>
</context> </context>
<context> <context>
<name>Settings</name> <name>Settings</name>
@ -480,10 +784,6 @@ Pour configurer les erreurs affichées, ouvrez le menu d&apos;affichage.</transl
<source>Number of threads: </source> <source>Number of threads: </source>
<translation type="unfinished">Nombre de processus : </translation> <translation type="unfinished">Nombre de processus : </translation>
</message> </message>
<message>
<source>Check all #ifdef configurations</source>
<translation type="unfinished">Vérifier toutes les configurations #ifdef</translation>
</message>
<message> <message>
<source>Show full path of files</source> <source>Show full path of files</source>
<translation type="unfinished">Montrer le chemin complet des fichiers</translation> <translation type="unfinished">Montrer le chemin complet des fichiers</translation>
@ -524,6 +824,38 @@ Pour configurer les erreurs affichées, ouvrez le menu d&apos;affichage.</transl
<source>Save full path to files in reports</source> <source>Save full path to files in reports</source>
<translation type="unfinished">Sauvegarder le chemin complet des fichiers dans les rapports</translation> <translation type="unfinished">Sauvegarder le chemin complet des fichiers dans les rapports</translation>
</message> </message>
<message>
<source>Include paths:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Add...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Ideal count:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>TextLabel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Force checking all #ifdef configurations</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show internal warnings in log</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable inline suppressions</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Language</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SettingsDialog</name> <name>SettingsDialog</name>
@ -535,5 +867,173 @@ Pour configurer les erreurs affichées, ouvrez le menu d&apos;affichage.</transl
<source>Modify an application</source> <source>Modify an application</source>
<translation type="unfinished">Modifier une application</translation> <translation type="unfinished">Modifier une application</translation>
</message> </message>
<message>
<source>N/A</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select include directory</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StatsDialog</name>
<message>
<source>Statistics</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Project</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Project:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Paths:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Include paths:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Defines:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Previous Scan</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Path Selected:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Number of Files Scanned:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Scan Duration:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Errors:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Warnings:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Stylistic warnings:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Portability warnings:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>TextLabel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Performance issues:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Information messages:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Copy to Clipboard</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 day</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>%1 days</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 hour</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>%1 hours</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 minute</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>%1 minutes</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 second</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>%1 seconds</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>0.%1 seconds</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> and </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Project Settings
Project: %1
Paths: %2
Include paths: %3
Defines: %4
Previous Scan
Path selected: %5
Number of files scanned: %6
Scan duration: %7
Statistics
Errors: %8
Warnings: %9
Style warnings: %10
Portability warnings: %11
Performance warnings: %12
Information messages: %13
</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;h3&gt;Project Settings&lt;h3&gt;
&lt;table&gt;
&lt;tr&gt;&lt;th&gt;Project:&lt;/th&gt;&lt;td&gt;%1&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Paths:&lt;/th&gt;&lt;td&gt;%2&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Include paths:&lt;/th&gt;&lt;td&gt;%3&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Defines:&lt;/th&gt;&lt;td&gt;%4&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;h3&gt;Previous Scan&lt;/h3&gt;
&lt;table&gt;
&lt;tr&gt;&lt;th&gt;Path selected:&lt;/th&gt;&lt;td&gt;%5&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Number of files scanned:&lt;/th&gt;&lt;td&gt;%6&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Scan duration:&lt;/th&gt;&lt;td&gt;%7&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;h3&gt;Statistics&lt;/h3&gt;
&lt;tr&gt;&lt;th&gt;Errors:&lt;/th&gt;&lt;td&gt;%8&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Warnings:&lt;/th&gt;&lt;td&gt;%9&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Style warnings:&lt;/th&gt;&lt;td&gt;%10&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Portability warnings:&lt;/th&gt;&lt;td&gt;%11&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Performance warnings:&lt;/th&gt;&lt;td&gt;%12&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Information messages:&lt;/th&gt;&lt;td&gt;%13&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>

View File

@ -211,9 +211,9 @@ kate -l(line) (file)</translation>
<location filename="mainwindow.cpp" line="203"/> <location filename="mainwindow.cpp" line="203"/>
<location filename="mainwindow.cpp" line="233"/> <location filename="mainwindow.cpp" line="233"/>
<location filename="mainwindow.cpp" line="524"/> <location filename="mainwindow.cpp" line="524"/>
<location filename="mainwindow.cpp" line="642"/> <location filename="mainwindow.cpp" line="648"/>
<location filename="mainwindow.cpp" line="660"/> <location filename="mainwindow.cpp" line="666"/>
<location filename="mainwindow.cpp" line="811"/> <location filename="mainwindow.cpp" line="817"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation>Cppcheck</translation> <translation>Cppcheck</translation>
</message> </message>
@ -546,14 +546,13 @@ kate -l(line) (file)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="306"/> <location filename="mainwindow.cpp" line="306"/>
<location filename="mainwindow.cpp" line="742"/> <location filename="mainwindow.cpp" line="748"/>
<location filename="mainwindow.cpp" line="788"/> <location filename="mainwindow.cpp" line="794"/>
<source>Project: </source> <source>Project: </source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="443"/> <location filename="mainwindow.cpp" line="443"/>
<location filename="mainwindow.cpp" line="592"/>
<source>XML files (*.xml)</source> <source>XML files (*.xml)</source>
<translation>XML (*.xml)</translation> <translation>XML (*.xml)</translation>
</message> </message>
@ -583,31 +582,42 @@ Do you want to stop the checking and exit Cppcheck?.</source>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="582"/> <location filename="mainwindow.cpp" line="582"/>
<source>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</source> <source>XML files version 2 (*.xml);;XML files version 1 (*.xml);;Text files (*.txt);;CSV files (*.csv)</source>
<translation>XML (*.xml);; (*.txt);;CSV形式ファイル (*.csv)</translation> <oldsource>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</oldsource>
<translation type="unfinished">XML (*.xml);; (*.txt);;CSV形式ファイル (*.csv)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="584"/> <location filename="mainwindow.cpp" line="584"/>
<source>Save the report file</source> <source>Save the report file</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<location filename="mainwindow.cpp" line="592"/>
<source>XML files version 1 (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<location filename="mainwindow.cpp" line="598"/> <location filename="mainwindow.cpp" line="598"/>
<source>XML files version 2 (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="604"/>
<source>Text files (*.txt)</source> <source>Text files (*.txt)</source>
<translation> (*.txt)</translation> <translation> (*.txt)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="604"/> <location filename="mainwindow.cpp" line="610"/>
<source>CSV files (*.csv)</source> <source>CSV files (*.csv)</source>
<translation>CSV形式ファイル (*.csv)</translation> <translation>CSV形式ファイル (*.csv)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="644"/> <location filename="mainwindow.cpp" line="650"/>
<source>Cppcheck - %1</source> <source>Cppcheck - %1</source>
<translation>Cppcheck - %1</translation> <translation>Cppcheck - %1</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="661"/> <location filename="mainwindow.cpp" line="667"/>
<source>Failed to change the language: <source>Failed to change the language:
%1 %1
@ -620,39 +630,39 @@ Do you want to stop the checking and exit Cppcheck?.</source>
</translation> </translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="709"/> <location filename="mainwindow.cpp" line="715"/>
<location filename="mainwindow.cpp" line="718"/> <location filename="mainwindow.cpp" line="724"/>
<source>Cppcheck Help</source> <source>Cppcheck Help</source>
<translation>Cppcheck </translation> <translation>Cppcheck </translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="709"/> <location filename="mainwindow.cpp" line="715"/>
<source>Failed to load help file (not found)</source> <source>Failed to load help file (not found)</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="718"/> <location filename="mainwindow.cpp" line="724"/>
<source>Failed to load help file</source> <source>Failed to load help file</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="732"/> <location filename="mainwindow.cpp" line="738"/>
<location filename="mainwindow.cpp" line="777"/> <location filename="mainwindow.cpp" line="783"/>
<source>Project files (*.cppcheck);;All files(*.*)</source> <source>Project files (*.cppcheck);;All files(*.*)</source>
<translation> (*.cppcheck);;All files(*.*)</translation> <translation> (*.cppcheck);;All files(*.*)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="734"/> <location filename="mainwindow.cpp" line="740"/>
<source>Select Project File</source> <source>Select Project File</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="779"/> <location filename="mainwindow.cpp" line="785"/>
<source>Select Project Filename</source> <source>Select Project Filename</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="812"/> <location filename="mainwindow.cpp" line="818"/>
<source>No project file loaded</source> <source>No project file loaded</source>
<translation></translation> <translation></translation>
</message> </message>
@ -920,46 +930,47 @@ Please select the directory where file is located.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="117"/> <location filename="resultsview.cpp" line="119"/>
<source>No errors found, nothing to save.</source> <source>No errors found, nothing to save.</source>
<translation>/</translation> <translation>/</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="144"/> <location filename="resultsview.cpp" line="149"/>
<location filename="resultsview.cpp" line="154"/> <location filename="resultsview.cpp" line="159"/>
<source>Failed to save the report.</source> <source>Failed to save the report.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="190"/> <location filename="resultsview.cpp" line="195"/>
<location filename="resultsview.cpp" line="202"/> <location filename="resultsview.cpp" line="207"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation>Cppcheck</translation> <translation>Cppcheck</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="191"/> <location filename="resultsview.cpp" line="196"/>
<source>No errors found.</source> <source>No errors found.</source>
<translation>/</translation> <translation>/</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="199"/> <location filename="resultsview.cpp" line="204"/>
<source>Errors were found, but they are configured to be hidden. <source>Errors were found, but they are configured to be hidden.
To toggle what kind of errors are shown, open view menu.</source> To toggle what kind of errors are shown, open view menu.</source>
<translation>/</translation> <translation>/</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="251"/> <location filename="resultsview.cpp" line="251"/>
<location filename="resultsview.cpp" line="261"/> <location filename="resultsview.cpp" line="271"/>
<location filename="resultsview.cpp" line="281"/>
<source>Failed to read the report.</source> <source>Failed to read the report.</source>
<translation>.</translation> <translation>.</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="302"/> <location filename="resultsview.cpp" line="321"/>
<source>Summary</source> <source>Summary</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="303"/> <location filename="resultsview.cpp" line="322"/>
<source>Message</source> <source>Message</source>
<translation></translation> <translation></translation>
</message> </message>

View File

@ -225,9 +225,9 @@ kate -l(line) (file)</translation>
<location filename="mainwindow.cpp" line="203"/> <location filename="mainwindow.cpp" line="203"/>
<location filename="mainwindow.cpp" line="233"/> <location filename="mainwindow.cpp" line="233"/>
<location filename="mainwindow.cpp" line="524"/> <location filename="mainwindow.cpp" line="524"/>
<location filename="mainwindow.cpp" line="642"/> <location filename="mainwindow.cpp" line="648"/>
<location filename="mainwindow.cpp" line="660"/> <location filename="mainwindow.cpp" line="666"/>
<location filename="mainwindow.cpp" line="811"/> <location filename="mainwindow.cpp" line="817"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation>Cppcheck</translation> <translation>Cppcheck</translation>
</message> </message>
@ -565,8 +565,9 @@ kate -l(line) (file)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="582"/> <location filename="mainwindow.cpp" line="582"/>
<source>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</source> <source>XML files version 2 (*.xml);;XML files version 1 (*.xml);;Text files (*.txt);;CSV files (*.csv)</source>
<translation>XML bestanden (*.xml);;Tekst bestanden (*.txt);;CSV bestanden (*.csv)</translation> <oldsource>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</oldsource>
<translation type="unfinished">XML bestanden (*.xml);;Tekst bestanden (*.txt);;CSV bestanden (*.csv)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="584"/> <location filename="mainwindow.cpp" line="584"/>
@ -575,7 +576,6 @@ kate -l(line) (file)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="443"/> <location filename="mainwindow.cpp" line="443"/>
<location filename="mainwindow.cpp" line="592"/>
<source>XML files (*.xml)</source> <source>XML files (*.xml)</source>
<translation>XML bestanden (*.xml)</translation> <translation>XML bestanden (*.xml)</translation>
</message> </message>
@ -586,8 +586,8 @@ kate -l(line) (file)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="306"/> <location filename="mainwindow.cpp" line="306"/>
<location filename="mainwindow.cpp" line="742"/> <location filename="mainwindow.cpp" line="748"/>
<location filename="mainwindow.cpp" line="788"/> <location filename="mainwindow.cpp" line="794"/>
<source>Project: </source> <source>Project: </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -603,23 +603,33 @@ kate -l(line) (file)</translation>
Do you want to stop the checking and exit Cppcheck?.</source> Do you want to stop the checking and exit Cppcheck?.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<location filename="mainwindow.cpp" line="592"/>
<source>XML files version 1 (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<location filename="mainwindow.cpp" line="598"/> <location filename="mainwindow.cpp" line="598"/>
<source>XML files version 2 (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="604"/>
<source>Text files (*.txt)</source> <source>Text files (*.txt)</source>
<translation>Tekst bestanden (*.txt)</translation> <translation>Tekst bestanden (*.txt)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="604"/> <location filename="mainwindow.cpp" line="610"/>
<source>CSV files (*.csv)</source> <source>CSV files (*.csv)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="644"/> <location filename="mainwindow.cpp" line="650"/>
<source>Cppcheck - %1</source> <source>Cppcheck - %1</source>
<translation>Cppcheck - %1</translation> <translation>Cppcheck - %1</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="661"/> <location filename="mainwindow.cpp" line="667"/>
<source>Failed to change the language: <source>Failed to change the language:
%1 %1
@ -633,39 +643,39 @@ Do you want to stop the checking and exit Cppcheck?.</source>
%1</translation> %1</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="709"/> <location filename="mainwindow.cpp" line="715"/>
<location filename="mainwindow.cpp" line="718"/> <location filename="mainwindow.cpp" line="724"/>
<source>Cppcheck Help</source> <source>Cppcheck Help</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="709"/> <location filename="mainwindow.cpp" line="715"/>
<source>Failed to load help file (not found)</source> <source>Failed to load help file (not found)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="718"/> <location filename="mainwindow.cpp" line="724"/>
<source>Failed to load help file</source> <source>Failed to load help file</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="732"/> <location filename="mainwindow.cpp" line="738"/>
<location filename="mainwindow.cpp" line="777"/> <location filename="mainwindow.cpp" line="783"/>
<source>Project files (*.cppcheck);;All files(*.*)</source> <source>Project files (*.cppcheck);;All files(*.*)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="734"/> <location filename="mainwindow.cpp" line="740"/>
<source>Select Project File</source> <source>Select Project File</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="779"/> <location filename="mainwindow.cpp" line="785"/>
<source>Select Project Filename</source> <source>Select Project Filename</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="812"/> <location filename="mainwindow.cpp" line="818"/>
<source>No project file loaded</source> <source>No project file loaded</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -929,18 +939,18 @@ Please select the directory where file is located.</source>
<context> <context>
<name>ResultsView</name> <name>ResultsView</name>
<message> <message>
<location filename="resultsview.cpp" line="190"/> <location filename="resultsview.cpp" line="195"/>
<location filename="resultsview.cpp" line="202"/> <location filename="resultsview.cpp" line="207"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation>Cppcheck</translation> <translation>Cppcheck</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="191"/> <location filename="resultsview.cpp" line="196"/>
<source>No errors found.</source> <source>No errors found.</source>
<translation>Geen fouten gevonden.</translation> <translation>Geen fouten gevonden.</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="199"/> <location filename="resultsview.cpp" line="204"/>
<source>Errors were found, but they are configured to be hidden. <source>Errors were found, but they are configured to be hidden.
To toggle what kind of errors are shown, open view menu.</source> To toggle what kind of errors are shown, open view menu.</source>
<translation>Fouten werden gevonden, maar volgens de configuratie zijn deze verborgen. <translation>Fouten werden gevonden, maar volgens de configuratie zijn deze verborgen.
@ -948,28 +958,29 @@ Gebruik het uitzicht menu om te selecteren welke fouten getoond worden.</transla
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="251"/> <location filename="resultsview.cpp" line="251"/>
<location filename="resultsview.cpp" line="261"/> <location filename="resultsview.cpp" line="271"/>
<location filename="resultsview.cpp" line="281"/>
<source>Failed to read the report.</source> <source>Failed to read the report.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="302"/> <location filename="resultsview.cpp" line="321"/>
<source>Summary</source> <source>Summary</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="303"/> <location filename="resultsview.cpp" line="322"/>
<source>Message</source> <source>Message</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="117"/> <location filename="resultsview.cpp" line="119"/>
<source>No errors found, nothing to save.</source> <source>No errors found, nothing to save.</source>
<translation>Geen fouten gevonden; geen data om op te slaan.</translation> <translation>Geen fouten gevonden; geen data om op te slaan.</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="144"/> <location filename="resultsview.cpp" line="149"/>
<location filename="resultsview.cpp" line="154"/> <location filename="resultsview.cpp" line="159"/>
<source>Failed to save the report.</source> <source>Failed to save the report.</source>
<translation>Kon het rapport niet opslaan.</translation> <translation>Kon het rapport niet opslaan.</translation>
</message> </message>

View File

@ -212,9 +212,9 @@ kate -l(line) (file)</oldsource>
<location filename="mainwindow.cpp" line="203"/> <location filename="mainwindow.cpp" line="203"/>
<location filename="mainwindow.cpp" line="233"/> <location filename="mainwindow.cpp" line="233"/>
<location filename="mainwindow.cpp" line="524"/> <location filename="mainwindow.cpp" line="524"/>
<location filename="mainwindow.cpp" line="642"/> <location filename="mainwindow.cpp" line="648"/>
<location filename="mainwindow.cpp" line="660"/> <location filename="mainwindow.cpp" line="666"/>
<location filename="mainwindow.cpp" line="811"/> <location filename="mainwindow.cpp" line="817"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -547,8 +547,8 @@ kate -l(line) (file)</oldsource>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="306"/> <location filename="mainwindow.cpp" line="306"/>
<location filename="mainwindow.cpp" line="742"/> <location filename="mainwindow.cpp" line="748"/>
<location filename="mainwindow.cpp" line="788"/> <location filename="mainwindow.cpp" line="794"/>
<source>Project: </source> <source>Project: </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -569,7 +569,8 @@ kate -l(line) (file)</oldsource>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="582"/> <location filename="mainwindow.cpp" line="582"/>
<source>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</source> <source>XML files version 2 (*.xml);;XML files version 1 (*.xml);;Text files (*.txt);;CSV files (*.csv)</source>
<oldsource>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</oldsource>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
@ -578,34 +579,43 @@ kate -l(line) (file)</oldsource>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="709"/> <location filename="mainwindow.cpp" line="592"/>
<location filename="mainwindow.cpp" line="718"/> <source>XML files version 1 (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="598"/>
<source>XML files version 2 (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="715"/>
<location filename="mainwindow.cpp" line="724"/>
<source>Cppcheck Help</source> <source>Cppcheck Help</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="709"/> <location filename="mainwindow.cpp" line="715"/>
<source>Failed to load help file (not found)</source> <source>Failed to load help file (not found)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="718"/> <location filename="mainwindow.cpp" line="724"/>
<source>Failed to load help file</source> <source>Failed to load help file</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="779"/> <location filename="mainwindow.cpp" line="785"/>
<source>Select Project Filename</source> <source>Select Project Filename</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="812"/> <location filename="mainwindow.cpp" line="818"/>
<source>No project file loaded</source> <source>No project file loaded</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="443"/> <location filename="mainwindow.cpp" line="443"/>
<location filename="mainwindow.cpp" line="592"/>
<source>XML files (*.xml)</source> <source>XML files (*.xml)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -617,22 +627,22 @@ Do you want to stop the checking and exit Cppcheck?.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="598"/> <location filename="mainwindow.cpp" line="604"/>
<source>Text files (*.txt)</source> <source>Text files (*.txt)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="604"/> <location filename="mainwindow.cpp" line="610"/>
<source>CSV files (*.csv)</source> <source>CSV files (*.csv)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="644"/> <location filename="mainwindow.cpp" line="650"/>
<source>Cppcheck - %1</source> <source>Cppcheck - %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="661"/> <location filename="mainwindow.cpp" line="667"/>
<source>Failed to change the language: <source>Failed to change the language:
%1 %1
@ -641,13 +651,13 @@ Do you want to stop the checking and exit Cppcheck?.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="732"/> <location filename="mainwindow.cpp" line="738"/>
<location filename="mainwindow.cpp" line="777"/> <location filename="mainwindow.cpp" line="783"/>
<source>Project files (*.cppcheck);;All files(*.*)</source> <source>Project files (*.cppcheck);;All files(*.*)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="734"/> <location filename="mainwindow.cpp" line="740"/>
<source>Select Project File</source> <source>Select Project File</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -906,46 +916,47 @@ Please select the directory where file is located.</source>
<context> <context>
<name>ResultsView</name> <name>ResultsView</name>
<message> <message>
<location filename="resultsview.cpp" line="190"/> <location filename="resultsview.cpp" line="195"/>
<location filename="resultsview.cpp" line="202"/> <location filename="resultsview.cpp" line="207"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="191"/> <location filename="resultsview.cpp" line="196"/>
<source>No errors found.</source> <source>No errors found.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="199"/> <location filename="resultsview.cpp" line="204"/>
<source>Errors were found, but they are configured to be hidden. <source>Errors were found, but they are configured to be hidden.
To toggle what kind of errors are shown, open view menu.</source> To toggle what kind of errors are shown, open view menu.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="251"/> <location filename="resultsview.cpp" line="251"/>
<location filename="resultsview.cpp" line="261"/> <location filename="resultsview.cpp" line="271"/>
<location filename="resultsview.cpp" line="281"/>
<source>Failed to read the report.</source> <source>Failed to read the report.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="302"/> <location filename="resultsview.cpp" line="321"/>
<source>Summary</source> <source>Summary</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="303"/> <location filename="resultsview.cpp" line="322"/>
<source>Message</source> <source>Message</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="117"/> <location filename="resultsview.cpp" line="119"/>
<source>No errors found, nothing to save.</source> <source>No errors found, nothing to save.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="144"/> <location filename="resultsview.cpp" line="149"/>
<location filename="resultsview.cpp" line="154"/> <location filename="resultsview.cpp" line="159"/>
<source>Failed to save the report.</source> <source>Failed to save the report.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -215,9 +215,9 @@ kate -l(line) (file)</oldsource>
<location filename="mainwindow.cpp" line="203"/> <location filename="mainwindow.cpp" line="203"/>
<location filename="mainwindow.cpp" line="233"/> <location filename="mainwindow.cpp" line="233"/>
<location filename="mainwindow.cpp" line="524"/> <location filename="mainwindow.cpp" line="524"/>
<location filename="mainwindow.cpp" line="642"/> <location filename="mainwindow.cpp" line="648"/>
<location filename="mainwindow.cpp" line="660"/> <location filename="mainwindow.cpp" line="666"/>
<location filename="mainwindow.cpp" line="811"/> <location filename="mainwindow.cpp" line="817"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation>Cppcheck</translation> <translation>Cppcheck</translation>
</message> </message>
@ -555,7 +555,8 @@ kate -l(line) (file)</oldsource>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="582"/> <location filename="mainwindow.cpp" line="582"/>
<source>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</source> <source>XML files version 2 (*.xml);;XML files version 1 (*.xml);;Text files (*.txt);;CSV files (*.csv)</source>
<oldsource>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</oldsource>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
@ -565,7 +566,6 @@ kate -l(line) (file)</oldsource>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="443"/> <location filename="mainwindow.cpp" line="443"/>
<location filename="mainwindow.cpp" line="592"/>
<source>XML files (*.xml)</source> <source>XML files (*.xml)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -576,8 +576,8 @@ kate -l(line) (file)</oldsource>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="306"/> <location filename="mainwindow.cpp" line="306"/>
<location filename="mainwindow.cpp" line="742"/> <location filename="mainwindow.cpp" line="748"/>
<location filename="mainwindow.cpp" line="788"/> <location filename="mainwindow.cpp" line="794"/>
<source>Project: </source> <source>Project: </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -593,23 +593,33 @@ kate -l(line) (file)</oldsource>
Do you want to stop the checking and exit Cppcheck?.</source> Do you want to stop the checking and exit Cppcheck?.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<location filename="mainwindow.cpp" line="592"/>
<source>XML files version 1 (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<location filename="mainwindow.cpp" line="598"/> <location filename="mainwindow.cpp" line="598"/>
<source>XML files version 2 (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="604"/>
<source>Text files (*.txt)</source> <source>Text files (*.txt)</source>
<translation>Текстовые файлы (*.txt)</translation> <translation>Текстовые файлы (*.txt)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="604"/> <location filename="mainwindow.cpp" line="610"/>
<source>CSV files (*.csv)</source> <source>CSV files (*.csv)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="644"/> <location filename="mainwindow.cpp" line="650"/>
<source>Cppcheck - %1</source> <source>Cppcheck - %1</source>
<translation>Cppcheck - %1</translation> <translation>Cppcheck - %1</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="661"/> <location filename="mainwindow.cpp" line="667"/>
<source>Failed to change the language: <source>Failed to change the language:
%1 %1
@ -625,39 +635,39 @@ Do you want to stop the checking and exit Cppcheck?.</source>
</translation> </translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="709"/> <location filename="mainwindow.cpp" line="715"/>
<location filename="mainwindow.cpp" line="718"/> <location filename="mainwindow.cpp" line="724"/>
<source>Cppcheck Help</source> <source>Cppcheck Help</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="709"/> <location filename="mainwindow.cpp" line="715"/>
<source>Failed to load help file (not found)</source> <source>Failed to load help file (not found)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="718"/> <location filename="mainwindow.cpp" line="724"/>
<source>Failed to load help file</source> <source>Failed to load help file</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="732"/> <location filename="mainwindow.cpp" line="738"/>
<location filename="mainwindow.cpp" line="777"/> <location filename="mainwindow.cpp" line="783"/>
<source>Project files (*.cppcheck);;All files(*.*)</source> <source>Project files (*.cppcheck);;All files(*.*)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="734"/> <location filename="mainwindow.cpp" line="740"/>
<source>Select Project File</source> <source>Select Project File</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="779"/> <location filename="mainwindow.cpp" line="785"/>
<source>Select Project Filename</source> <source>Select Project Filename</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="812"/> <location filename="mainwindow.cpp" line="818"/>
<source>No project file loaded</source> <source>No project file loaded</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -919,46 +929,47 @@ Please select the directory where file is located.</source>
<context> <context>
<name>ResultsView</name> <name>ResultsView</name>
<message> <message>
<location filename="resultsview.cpp" line="190"/> <location filename="resultsview.cpp" line="195"/>
<location filename="resultsview.cpp" line="202"/> <location filename="resultsview.cpp" line="207"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation>Cppcheck</translation> <translation>Cppcheck</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="191"/> <location filename="resultsview.cpp" line="196"/>
<source>No errors found.</source> <source>No errors found.</source>
<translation>Ошибок не найдено.</translation> <translation>Ошибок не найдено.</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="199"/> <location filename="resultsview.cpp" line="204"/>
<source>Errors were found, but they are configured to be hidden. <source>Errors were found, but they are configured to be hidden.
To toggle what kind of errors are shown, open view menu.</source> To toggle what kind of errors are shown, open view menu.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="251"/> <location filename="resultsview.cpp" line="251"/>
<location filename="resultsview.cpp" line="261"/> <location filename="resultsview.cpp" line="271"/>
<location filename="resultsview.cpp" line="281"/>
<source>Failed to read the report.</source> <source>Failed to read the report.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="302"/> <location filename="resultsview.cpp" line="321"/>
<source>Summary</source> <source>Summary</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="303"/> <location filename="resultsview.cpp" line="322"/>
<source>Message</source> <source>Message</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="117"/> <location filename="resultsview.cpp" line="119"/>
<source>No errors found, nothing to save.</source> <source>No errors found, nothing to save.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="144"/> <location filename="resultsview.cpp" line="149"/>
<location filename="resultsview.cpp" line="154"/> <location filename="resultsview.cpp" line="159"/>
<source>Failed to save the report.</source> <source>Failed to save the report.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -225,9 +225,9 @@ kate -l(line) (file)</translation>
<location filename="mainwindow.cpp" line="203"/> <location filename="mainwindow.cpp" line="203"/>
<location filename="mainwindow.cpp" line="233"/> <location filename="mainwindow.cpp" line="233"/>
<location filename="mainwindow.cpp" line="524"/> <location filename="mainwindow.cpp" line="524"/>
<location filename="mainwindow.cpp" line="642"/> <location filename="mainwindow.cpp" line="648"/>
<location filename="mainwindow.cpp" line="660"/> <location filename="mainwindow.cpp" line="666"/>
<location filename="mainwindow.cpp" line="811"/> <location filename="mainwindow.cpp" line="817"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation>Cppcheck</translation> <translation>Cppcheck</translation>
</message> </message>
@ -566,8 +566,9 @@ kate -l(line) (file)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="582"/> <location filename="mainwindow.cpp" line="582"/>
<source>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</source> <source>XML files version 2 (*.xml);;XML files version 1 (*.xml);;Text files (*.txt);;CSV files (*.csv)</source>
<translation>XML filer (*.xml);;Text filer (*.txt);;CSV filer (*.csv)</translation> <oldsource>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</oldsource>
<translation type="unfinished">XML filer (*.xml);;Text filer (*.txt);;CSV filer (*.csv)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="584"/> <location filename="mainwindow.cpp" line="584"/>
@ -576,7 +577,6 @@ kate -l(line) (file)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="443"/> <location filename="mainwindow.cpp" line="443"/>
<location filename="mainwindow.cpp" line="592"/>
<source>XML files (*.xml)</source> <source>XML files (*.xml)</source>
<translation>XML filer (*.xml)</translation> <translation>XML filer (*.xml)</translation>
</message> </message>
@ -587,8 +587,8 @@ kate -l(line) (file)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="306"/> <location filename="mainwindow.cpp" line="306"/>
<location filename="mainwindow.cpp" line="742"/> <location filename="mainwindow.cpp" line="748"/>
<location filename="mainwindow.cpp" line="788"/> <location filename="mainwindow.cpp" line="794"/>
<source>Project: </source> <source>Project: </source>
<translation>Projekt.</translation> <translation>Projekt.</translation>
</message> </message>
@ -606,23 +606,33 @@ Do you want to stop the checking and exit Cppcheck?.</source>
Vill du stoppa analysen och avsluta Cppcheck?</translation> Vill du stoppa analysen och avsluta Cppcheck?</translation>
</message> </message>
<message>
<location filename="mainwindow.cpp" line="592"/>
<source>XML files version 1 (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<location filename="mainwindow.cpp" line="598"/> <location filename="mainwindow.cpp" line="598"/>
<source>XML files version 2 (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="604"/>
<source>Text files (*.txt)</source> <source>Text files (*.txt)</source>
<translation>Text filer (*.txt)</translation> <translation>Text filer (*.txt)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="604"/> <location filename="mainwindow.cpp" line="610"/>
<source>CSV files (*.csv)</source> <source>CSV files (*.csv)</source>
<translation>CSV filer (*.csv)</translation> <translation>CSV filer (*.csv)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="644"/> <location filename="mainwindow.cpp" line="650"/>
<source>Cppcheck - %1</source> <source>Cppcheck - %1</source>
<translation>Cppcheck - %1</translation> <translation>Cppcheck - %1</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="661"/> <location filename="mainwindow.cpp" line="667"/>
<source>Failed to change the language: <source>Failed to change the language:
%1 %1
@ -638,39 +648,39 @@ Vill du stoppa analysen och avsluta Cppcheck?</translation>
</translation> </translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="709"/> <location filename="mainwindow.cpp" line="715"/>
<location filename="mainwindow.cpp" line="718"/> <location filename="mainwindow.cpp" line="724"/>
<source>Cppcheck Help</source> <source>Cppcheck Help</source>
<translation>Cppcheck Hjälp</translation> <translation>Cppcheck Hjälp</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="709"/> <location filename="mainwindow.cpp" line="715"/>
<source>Failed to load help file (not found)</source> <source>Failed to load help file (not found)</source>
<translation>Misslyckades att öppna hjälpfilen (hittades ej)</translation> <translation>Misslyckades att öppna hjälpfilen (hittades ej)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="718"/> <location filename="mainwindow.cpp" line="724"/>
<source>Failed to load help file</source> <source>Failed to load help file</source>
<translation>Misslykades att öppna hjälpfilen</translation> <translation>Misslykades att öppna hjälpfilen</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="732"/> <location filename="mainwindow.cpp" line="738"/>
<location filename="mainwindow.cpp" line="777"/> <location filename="mainwindow.cpp" line="783"/>
<source>Project files (*.cppcheck);;All files(*.*)</source> <source>Project files (*.cppcheck);;All files(*.*)</source>
<translation>Projektfiler (*.cppcheck);;Alla filer(*.*)</translation> <translation>Projektfiler (*.cppcheck);;Alla filer(*.*)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="734"/> <location filename="mainwindow.cpp" line="740"/>
<source>Select Project File</source> <source>Select Project File</source>
<translation>Välj projektfil</translation> <translation>Välj projektfil</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="779"/> <location filename="mainwindow.cpp" line="785"/>
<source>Select Project Filename</source> <source>Select Project Filename</source>
<translation>Välj Projektfil</translation> <translation>Välj Projektfil</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="812"/> <location filename="mainwindow.cpp" line="818"/>
<source>No project file loaded</source> <source>No project file loaded</source>
<translation>Inget projekt laddat</translation> <translation>Inget projekt laddat</translation>
</message> </message>
@ -936,18 +946,18 @@ Välj mappen där filen finns.</translation>
<context> <context>
<name>ResultsView</name> <name>ResultsView</name>
<message> <message>
<location filename="resultsview.cpp" line="190"/> <location filename="resultsview.cpp" line="195"/>
<location filename="resultsview.cpp" line="202"/> <location filename="resultsview.cpp" line="207"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation>Cppcheck</translation> <translation>Cppcheck</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="191"/> <location filename="resultsview.cpp" line="196"/>
<source>No errors found.</source> <source>No errors found.</source>
<translation>Inga fel hittades.</translation> <translation>Inga fel hittades.</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="199"/> <location filename="resultsview.cpp" line="204"/>
<source>Errors were found, but they are configured to be hidden. <source>Errors were found, but they are configured to be hidden.
To toggle what kind of errors are shown, open view menu.</source> To toggle what kind of errors are shown, open view menu.</source>
<translation>Fel hittades, men de visas ej. <translation>Fel hittades, men de visas ej.
@ -955,28 +965,29 @@ För att ställa in vilka fel som skall visas använd visa menyn.</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="251"/> <location filename="resultsview.cpp" line="251"/>
<location filename="resultsview.cpp" line="261"/> <location filename="resultsview.cpp" line="271"/>
<location filename="resultsview.cpp" line="281"/>
<source>Failed to read the report.</source> <source>Failed to read the report.</source>
<translation>Misslyckades att läsa rapporten.</translation> <translation>Misslyckades att läsa rapporten.</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="302"/> <location filename="resultsview.cpp" line="321"/>
<source>Summary</source> <source>Summary</source>
<translation>Sammanfattning</translation> <translation>Sammanfattning</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="303"/> <location filename="resultsview.cpp" line="322"/>
<source>Message</source> <source>Message</source>
<translation>Meddelande</translation> <translation>Meddelande</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="117"/> <location filename="resultsview.cpp" line="119"/>
<source>No errors found, nothing to save.</source> <source>No errors found, nothing to save.</source>
<translation>Inga fel hittades, ingenting att spara.</translation> <translation>Inga fel hittades, ingenting att spara.</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="144"/> <location filename="resultsview.cpp" line="149"/>
<location filename="resultsview.cpp" line="154"/> <location filename="resultsview.cpp" line="159"/>
<source>Failed to save the report.</source> <source>Failed to save the report.</source>
<translation>Misslyckades med att spara rapporten.</translation> <translation>Misslyckades med att spara rapporten.</translation>
</message> </message>

View File

@ -225,9 +225,9 @@ kate -l(line) (file)</translation>
<location filename="mainwindow.cpp" line="203"/> <location filename="mainwindow.cpp" line="203"/>
<location filename="mainwindow.cpp" line="233"/> <location filename="mainwindow.cpp" line="233"/>
<location filename="mainwindow.cpp" line="524"/> <location filename="mainwindow.cpp" line="524"/>
<location filename="mainwindow.cpp" line="642"/> <location filename="mainwindow.cpp" line="648"/>
<location filename="mainwindow.cpp" line="660"/> <location filename="mainwindow.cpp" line="666"/>
<location filename="mainwindow.cpp" line="811"/> <location filename="mainwindow.cpp" line="817"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation>Cppcheck</translation> <translation>Cppcheck</translation>
</message> </message>
@ -565,8 +565,9 @@ kate -l(line) (file)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="582"/> <location filename="mainwindow.cpp" line="582"/>
<source>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</source> <source>XML files version 2 (*.xml);;XML files version 1 (*.xml);;Text files (*.txt);;CSV files (*.csv)</source>
<translation>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</translation> <oldsource>XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</oldsource>
<translation type="unfinished">XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="584"/> <location filename="mainwindow.cpp" line="584"/>
@ -575,7 +576,6 @@ kate -l(line) (file)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="443"/> <location filename="mainwindow.cpp" line="443"/>
<location filename="mainwindow.cpp" line="592"/>
<source>XML files (*.xml)</source> <source>XML files (*.xml)</source>
<translation>XML files (*.xml)</translation> <translation>XML files (*.xml)</translation>
</message> </message>
@ -586,8 +586,8 @@ kate -l(line) (file)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="306"/> <location filename="mainwindow.cpp" line="306"/>
<location filename="mainwindow.cpp" line="742"/> <location filename="mainwindow.cpp" line="748"/>
<location filename="mainwindow.cpp" line="788"/> <location filename="mainwindow.cpp" line="794"/>
<source>Project: </source> <source>Project: </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -603,23 +603,33 @@ kate -l(line) (file)</translation>
Do you want to stop the checking and exit Cppcheck?.</source> Do you want to stop the checking and exit Cppcheck?.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<location filename="mainwindow.cpp" line="592"/>
<source>XML files version 1 (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<location filename="mainwindow.cpp" line="598"/> <location filename="mainwindow.cpp" line="598"/>
<source>XML files version 2 (*.xml)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="604"/>
<source>Text files (*.txt)</source> <source>Text files (*.txt)</source>
<translation>Text files (*.txt)</translation> <translation>Text files (*.txt)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="604"/> <location filename="mainwindow.cpp" line="610"/>
<source>CSV files (*.csv)</source> <source>CSV files (*.csv)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="644"/> <location filename="mainwindow.cpp" line="650"/>
<source>Cppcheck - %1</source> <source>Cppcheck - %1</source>
<translation>Cppcheck - %1</translation> <translation>Cppcheck - %1</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="661"/> <location filename="mainwindow.cpp" line="667"/>
<source>Failed to change the language: <source>Failed to change the language:
%1 %1
@ -633,39 +643,39 @@ Do you want to stop the checking and exit Cppcheck?.</source>
%1</translation> %1</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="709"/> <location filename="mainwindow.cpp" line="715"/>
<location filename="mainwindow.cpp" line="718"/> <location filename="mainwindow.cpp" line="724"/>
<source>Cppcheck Help</source> <source>Cppcheck Help</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="709"/> <location filename="mainwindow.cpp" line="715"/>
<source>Failed to load help file (not found)</source> <source>Failed to load help file (not found)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="718"/> <location filename="mainwindow.cpp" line="724"/>
<source>Failed to load help file</source> <source>Failed to load help file</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="732"/> <location filename="mainwindow.cpp" line="738"/>
<location filename="mainwindow.cpp" line="777"/> <location filename="mainwindow.cpp" line="783"/>
<source>Project files (*.cppcheck);;All files(*.*)</source> <source>Project files (*.cppcheck);;All files(*.*)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="734"/> <location filename="mainwindow.cpp" line="740"/>
<source>Select Project File</source> <source>Select Project File</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="779"/> <location filename="mainwindow.cpp" line="785"/>
<source>Select Project Filename</source> <source>Select Project Filename</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="812"/> <location filename="mainwindow.cpp" line="818"/>
<source>No project file loaded</source> <source>No project file loaded</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -929,18 +939,18 @@ Please select the directory where file is located.</source>
<context> <context>
<name>ResultsView</name> <name>ResultsView</name>
<message> <message>
<location filename="resultsview.cpp" line="190"/> <location filename="resultsview.cpp" line="195"/>
<location filename="resultsview.cpp" line="202"/> <location filename="resultsview.cpp" line="207"/>
<source>Cppcheck</source> <source>Cppcheck</source>
<translation>Cppcheck</translation> <translation>Cppcheck</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="191"/> <location filename="resultsview.cpp" line="196"/>
<source>No errors found.</source> <source>No errors found.</source>
<translation>No errors found.</translation> <translation>No errors found.</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="199"/> <location filename="resultsview.cpp" line="204"/>
<source>Errors were found, but they are configured to be hidden. <source>Errors were found, but they are configured to be hidden.
To toggle what kind of errors are shown, open view menu.</source> To toggle what kind of errors are shown, open view menu.</source>
<translation>Errors were found, but they are configured to be hidden. <translation>Errors were found, but they are configured to be hidden.
@ -948,28 +958,29 @@ To toggle what kind of errors are shown, open view menu.</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="251"/> <location filename="resultsview.cpp" line="251"/>
<location filename="resultsview.cpp" line="261"/> <location filename="resultsview.cpp" line="271"/>
<location filename="resultsview.cpp" line="281"/>
<source>Failed to read the report.</source> <source>Failed to read the report.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="302"/> <location filename="resultsview.cpp" line="321"/>
<source>Summary</source> <source>Summary</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="303"/> <location filename="resultsview.cpp" line="322"/>
<source>Message</source> <source>Message</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="117"/> <location filename="resultsview.cpp" line="119"/>
<source>No errors found, nothing to save.</source> <source>No errors found, nothing to save.</source>
<translation>No errors found, nothing to save.</translation> <translation>No errors found, nothing to save.</translation>
</message> </message>
<message> <message>
<location filename="resultsview.cpp" line="144"/> <location filename="resultsview.cpp" line="149"/>
<location filename="resultsview.cpp" line="154"/> <location filename="resultsview.cpp" line="159"/>
<source>Failed to save the report.</source> <source>Failed to save the report.</source>
<translation>Failed to save the report.</translation> <translation>Failed to save the report.</translation>
</message> </message>

View File

@ -35,6 +35,7 @@ FORMS = main.ui \
stats.ui stats.ui
TRANSLATIONS = cppcheck_fi.ts \ TRANSLATIONS = cppcheck_fi.ts \
cppcheck_fr.ts \
cppcheck_nl.ts \ cppcheck_nl.ts \
cppcheck_en.ts \ cppcheck_en.ts \
cppcheck_se.ts \ cppcheck_se.ts \
@ -69,6 +70,8 @@ HEADERS += mainwindow.h \
report.h \ report.h \
txtreport.h \ txtreport.h \
xmlreport.h \ xmlreport.h \
xmlreportv1.h \
xmlreportv2.h \
translationhandler.h \ translationhandler.h \
csvreport.h \ csvreport.h \
logview.h \ logview.h \
@ -96,6 +99,8 @@ SOURCES += main.cpp \
report.cpp \ report.cpp \
txtreport.cpp \ txtreport.cpp \
xmlreport.cpp \ xmlreport.cpp \
xmlreportv1.cpp \
xmlreportv2.cpp \
translationhandler.cpp \ translationhandler.cpp \
csvreport.cpp \ csvreport.cpp \
logview.cpp \ logview.cpp \

View File

@ -42,7 +42,6 @@ MainWindow::MainWindow() :
mSettings(new QSettings("Cppcheck", "Cppcheck-GUI", this)), mSettings(new QSettings("Cppcheck", "Cppcheck-GUI", this)),
mApplications(new ApplicationList(this)), mApplications(new ApplicationList(this)),
mTranslation(new TranslationHandler(this)), mTranslation(new TranslationHandler(this)),
mLanguages(new QActionGroup(this)),
mLogView(NULL), mLogView(NULL),
mHelpWindow(NULL), mHelpWindow(NULL),
mProject(NULL), mProject(NULL),
@ -155,7 +154,7 @@ void MainWindow::LoadSettings()
mApplications->LoadSettings(mSettings); mApplications->LoadSettings(mSettings);
SetLanguage(mSettings->value(SETTINGS_LANGUAGE, mTranslation->SuggestLanguage()).toInt()); SetLanguage(mSettings->value(SETTINGS_LANGUAGE, mTranslation->SuggestLanguage()).toString());
} }
void MainWindow::SaveSettings() void MainWindow::SaveSettings()
@ -411,10 +410,8 @@ void MainWindow::ProgramSettings()
dialog.SaveFullPath(), dialog.SaveFullPath(),
dialog.SaveAllErrors(), dialog.SaveAllErrors(),
dialog.ShowNoErrorsMessage()); dialog.ShowNoErrorsMessage());
const int currentLang = mTranslation->GetCurrentLanguage(); const QString newLang = mSettings->value(SETTINGS_LANGUAGE, "en").toString();
const int newLang = mSettings->value(SETTINGS_LANGUAGE, 0).toInt(); SetLanguage(newLang);
if (currentLang != newLang)
SetLanguage(newLang);
} }
} }
@ -579,7 +576,7 @@ void MainWindow::ShowAuthors()
void MainWindow::Save() void MainWindow::Save()
{ {
QString selectedFilter; QString selectedFilter;
QString filter(tr("XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)")); QString filter(tr("XML files version 2 (*.xml);;XML files version 1 (*.xml);;Text files (*.txt);;CSV files (*.csv)"));
QString selectedFile = QFileDialog::getSaveFileName(this, QString selectedFile = QFileDialog::getSaveFileName(this,
tr("Save the report file"), tr("Save the report file"),
QString(), QString(),
@ -589,12 +586,18 @@ void MainWindow::Save()
if (!selectedFile.isEmpty()) if (!selectedFile.isEmpty())
{ {
Report::Type type = Report::TXT; Report::Type type = Report::TXT;
if (selectedFilter == tr("XML files (*.xml)")) if (selectedFilter == tr("XML files version 1 (*.xml)"))
{ {
type = Report::XML; type = Report::XML;
if (!selectedFile.endsWith(".xml", Qt::CaseInsensitive)) if (!selectedFile.endsWith(".xml", Qt::CaseInsensitive))
selectedFile += ".xml"; selectedFile += ".xml";
} }
else if (selectedFilter == tr("XML files version 2 (*.xml)"))
{
type = Report::XMLV2;
if (!selectedFile.endsWith(".xml", Qt::CaseInsensitive))
selectedFile += ".xml";
}
else if (selectedFilter == tr("Text files (*.txt)")) else if (selectedFilter == tr("Text files (*.txt)"))
{ {
type = Report::TXT; type = Report::TXT;
@ -645,20 +648,18 @@ void MainWindow::FormatAndSetTitle(const QString &text)
setWindowTitle(title); setWindowTitle(title);
} }
void MainWindow::SetLanguage(const QString &code)
void MainWindow::SetLanguage(int index)
{ {
if (mTranslation->GetCurrentLanguage() == index) const QString currentLang = mTranslation->GetCurrentLanguage();
{ if (currentLang == code)
return; return;
}
QString error; QString error;
if (!mTranslation->SetLanguage(index, error)) if (!mTranslation->SetLanguage(code, error))
{ {
QMessageBox msg(QMessageBox::Critical, QMessageBox msg(QMessageBox::Critical,
tr("Cppcheck"), tr("Cppcheck"),
QString(tr("Failed to change the language:\n\n%1\n\n")).arg(error), QString(tr("Failed to change the language:\n\n%1")).arg(error),
QMessageBox::Ok, QMessageBox::Ok,
this); this);
@ -669,16 +670,6 @@ void MainWindow::SetLanguage(int index)
//Translate everything that is visible here //Translate everything that is visible here
mUI.retranslateUi(this); mUI.retranslateUi(this);
mUI.mResults->Translate(); mUI.mResults->Translate();
QStringList languages = mTranslation->GetNames();
QList<QAction *> actions = mLanguages->actions();
if (languages.size() <= actions.size())
{
for (int i = 0; i < languages.size(); i++)
{
actions[i]->setText(tr(languages[i].toLatin1()));
}
}
} }
} }

View File

@ -255,9 +255,9 @@ protected:
/** /**
* @brief Set current language * @brief Set current language
* @param index Index of the language to set * @param code Language code of the language to set (e.g. "en").
*/ */
void SetLanguage(const int index); void SetLanguage(const QString &code);
/** /**
* @brief Event coming when application is about to close. * @brief Event coming when application is about to close.
@ -384,12 +384,6 @@ protected:
*/ */
Ui::MainWindow mUI; Ui::MainWindow mUI;
/**
* @brief Group holding all supported languages
*
*/
QActionGroup *mLanguages;
/** /**
* @brief Current checked directory. * @brief Current checked directory.
*/ */

View File

@ -39,6 +39,7 @@ public:
{ {
TXT, TXT,
XML, XML,
XMLV2,
CSV, CSV,
}; };

View File

@ -31,6 +31,8 @@
#include "report.h" #include "report.h"
#include "txtreport.h" #include "txtreport.h"
#include "xmlreport.h" #include "xmlreport.h"
#include "xmlreportv1.h"
#include "xmlreportv2.h"
#include "csvreport.h" #include "csvreport.h"
#include "applicationlist.h" #include "applicationlist.h"
#include "checkstatistics.h" #include "checkstatistics.h"
@ -130,7 +132,10 @@ void ResultsView::Save(const QString &filename, Report::Type type)
report = new TxtReport(filename, this); report = new TxtReport(filename, this);
break; break;
case Report::XML: case Report::XML:
report = new XmlReport(filename, this); report = new XmlReportV1(filename, this);
break;
case Report::XMLV2:
report = new XmlReportV2(filename, this);
break; break;
} }
@ -239,8 +244,23 @@ void ResultsView::DisableProgressbar()
void ResultsView::ReadErrorsXml(const QString &filename) void ResultsView::ReadErrorsXml(const QString &filename)
{ {
XmlReport *report = new XmlReport(filename, this); const int version = XmlReport::determineVersion(filename);
QList<ErrorLine> errors; if (version == 0)
{
QMessageBox msgBox;
msgBox.setText(tr("Failed to read the report."));
msgBox.setIcon(QMessageBox::Critical);
msgBox.exec();
return;
}
XmlReport *report = NULL;
if (version == 1)
report = new XmlReportV1(filename, this);
else if (version == 2)
report = new XmlReportV2(filename, this);
QList<ErrorItem> errors;
if (report) if (report)
{ {
if (report->Open()) if (report->Open())
@ -263,10 +283,9 @@ void ResultsView::ReadErrorsXml(const QString &filename)
msgBox.exec(); msgBox.exec();
} }
ErrorLine line; ErrorItem item;
foreach(line, errors) foreach(item, errors)
{ {
ErrorItem item(line);
mUI.mTree->AddErrorItem(item); mUI.mTree->AddErrorItem(item);
} }
mUI.mTree->SetCheckDirectory(""); mUI.mTree->SetCheckDirectory("");

View File

@ -91,13 +91,17 @@ SettingsDialog::~SettingsDialog()
void SettingsDialog::InitTranslationsList() void SettingsDialog::InitTranslationsList()
{ {
QStringList languages = mTranslator->GetNames(); const QString current = mTranslator->GetCurrentLanguage();
foreach(const QString lang, languages) QList<TranslationInfo> translations = mTranslator->GetTranslations();
foreach(TranslationInfo translation, translations)
{ {
mUI.mListLanguages->addItem(lang); QListWidgetItem *item = new QListWidgetItem;
item->setText(translation.mName);
item->setData(LangCodeRole, QVariant(translation.mCode));
mUI.mListLanguages->addItem(item);
if (translation.mCode == current)
mUI.mListLanguages->setCurrentItem(item);
} }
const int current = mTranslator->GetCurrentLanguage();
mUI.mListLanguages->setCurrentRow(current);
} }
Qt::CheckState SettingsDialog::BoolToCheckState(bool yes) const Qt::CheckState SettingsDialog::BoolToCheckState(bool yes) const
@ -148,7 +152,10 @@ void SettingsDialog::SaveSettingValues()
SaveCheckboxValue(mUI.mShowDebugWarnings, SETTINGS_SHOW_DEBUG_WARNINGS); SaveCheckboxValue(mUI.mShowDebugWarnings, SETTINGS_SHOW_DEBUG_WARNINGS);
SaveCheckboxValue(mUI.mInlineSuppressions, SETTINGS_INLINE_SUPPRESSIONS); SaveCheckboxValue(mUI.mInlineSuppressions, SETTINGS_INLINE_SUPPRESSIONS);
mSettings->setValue(SETTINGS_GLOBAL_INCLUDE_PATHS, mUI.mEditIncludePaths->text()); mSettings->setValue(SETTINGS_GLOBAL_INCLUDE_PATHS, mUI.mEditIncludePaths->text());
mSettings->setValue(SETTINGS_LANGUAGE, mUI.mListLanguages->currentRow());
QListWidgetItem *currentLang = mUI.mListLanguages->currentItem();
const QString langcode = currentLang->data(LangCodeRole).toString();
mSettings->setValue(SETTINGS_LANGUAGE, langcode);
} }
void SettingsDialog::SaveCheckboxValue(QCheckBox *box, const QString &name) void SettingsDialog::SaveCheckboxValue(QCheckBox *box, const QString &name)

View File

@ -201,6 +201,7 @@ protected:
*/ */
Ui::Settings mUI; Ui::Settings mUI;
private: private:
static const int LangCodeRole = Qt::UserRole;
}; };
/// @} /// @}
#endif // SETTINGSDIALOG_H #endif // SETTINGSDIALOG_H

View File

@ -24,29 +24,21 @@
TranslationHandler::TranslationHandler(QObject *parent) : TranslationHandler::TranslationHandler(QObject *parent) :
QObject(parent), QObject(parent),
mCurrentLanguage(-1), mCurrentLanguage("en"),
mTranslator(new QTranslator(this)) mTranslator(new QTranslator(this))
{ {
//Add our default languages // Add our available languages
mNames << QT_TRANSLATE_NOOP("MainWindow", "English") // Keep this list sorted
<< QT_TRANSLATE_NOOP("MainWindow", "Dutch") AddTranslation(QT_TRANSLATE_NOOP("MainWindow", "Dutch"), "cppcheck_nl");
<< QT_TRANSLATE_NOOP("MainWindow", "Finnish") AddTranslation(QT_TRANSLATE_NOOP("MainWindow", "English"), "cppcheck_en");
<< QT_TRANSLATE_NOOP("MainWindow", "Swedish") AddTranslation(QT_TRANSLATE_NOOP("MainWindow", "Finnish"), "cppcheck_fi");
<< QT_TRANSLATE_NOOP("MainWindow", "German") AddTranslation(QT_TRANSLATE_NOOP("MainWindow", "French"), "cppcheck_fr");
<< QT_TRANSLATE_NOOP("MainWindow", "Russian") AddTranslation(QT_TRANSLATE_NOOP("MainWindow", "German"), "cppcheck_de");
<< QT_TRANSLATE_NOOP("MainWindow", "Polish") AddTranslation(QT_TRANSLATE_NOOP("MainWindow", "Japanese"), "cppcheck_ja");
<< QT_TRANSLATE_NOOP("MainWindow", "Japanese") AddTranslation(QT_TRANSLATE_NOOP("MainWindow", "Polish"), "cppcheck_pl");
<< QT_TRANSLATE_NOOP("MainWindow", "Serbian"); AddTranslation(QT_TRANSLATE_NOOP("MainWindow", "Russian"), "cppcheck_ru");
AddTranslation(QT_TRANSLATE_NOOP("MainWindow", "Serbian"), "cppcheck_sr");
mFiles << "cppcheck_en" AddTranslation(QT_TRANSLATE_NOOP("MainWindow", "Swedish"), "cppcheck_se");
<< "cppcheck_nl"
<< "cppcheck_fi"
<< "cppcheck_se"
<< "cppcheck_de"
<< "cppcheck_ru"
<< "cppcheck_pl"
<< "cppcheck_ja"
<< "cppcheck_sr";
//Load English as a fallback language //Load English as a fallback language
QTranslator *english = new QTranslator(); QTranslator *english = new QTranslator();
@ -67,18 +59,18 @@ TranslationHandler::~TranslationHandler()
const QStringList TranslationHandler::GetNames() const const QStringList TranslationHandler::GetNames() const
{ {
return mNames; QStringList names;
foreach(TranslationInfo translation, mTranslations)
{
names.append(translation.mName);
}
return names;
} }
const QStringList TranslationHandler::GetFiles() const bool TranslationHandler::SetLanguage(const QString &code, QString &error)
{
return mFiles;
}
bool TranslationHandler::SetLanguage(const int index, QString &error)
{ {
//If English is the language //If English is the language
if (index == 0) if (code == "en")
{ {
//Just remove all extra translators //Just remove all extra translators
if (mTranslator) if (mTranslator)
@ -86,48 +78,49 @@ bool TranslationHandler::SetLanguage(const int index, QString &error)
qApp->removeTranslator(mTranslator); qApp->removeTranslator(mTranslator);
} }
mCurrentLanguage = index; mCurrentLanguage = code;
return true; return true;
} }
//Make sure the translator is otherwise valid //Make sure the translator is otherwise valid
if (index >= mNames.size()) int index = GetLanguageIndexByCode(code);
if (index == -1)
{ {
error = QObject::tr("Incorrect language specified!"); error = QObject::tr("Unknown language specified!");
return false; return false;
} }
//Load the new language //Load the new language
if (!mTranslator->load(mFiles[index])) if (!mTranslator->load(mTranslations[index].mFilename))
{ {
//If it failed, lets check if the default file exists //If it failed, lets check if the default file exists
if (!QFile::exists(mFiles[index] + ".qm")) if (!QFile::exists(mTranslations[index].mFilename + ".qm"))
{ {
error = QObject::tr("Language file %1 not found!"); error = QObject::tr("Language file %1 not found!");
error = error.arg(mFiles[index] + ".qm"); error = error.arg(mTranslations[index].mFilename + ".qm");
return false; return false;
} }
//If file exists, there's something wrong with it //If file exists, there's something wrong with it
error = QObject::tr("Failed to load translation for language %1 from file %2"); error = QObject::tr("Failed to load translation for language %1 from file %2");
error = error.arg(mNames[index]); error = error.arg(mTranslations[index].mName);
error = error.arg(mFiles[index] + ".qm"); error = error.arg(mTranslations[index].mFilename + ".qm");
return false; return false;
} }
qApp->installTranslator(mTranslator); qApp->installTranslator(mTranslator);
mCurrentLanguage = index; mCurrentLanguage = code;
return true; return true;
} }
int TranslationHandler::GetCurrentLanguage() const QString TranslationHandler::GetCurrentLanguage() const
{ {
return mCurrentLanguage; return mCurrentLanguage;
} }
int TranslationHandler::SuggestLanguage() const QString TranslationHandler::SuggestLanguage() const
{ {
/* /*
Get language from system locale's name Get language from system locale's name
@ -138,20 +131,37 @@ int TranslationHandler::SuggestLanguage() const
QString language = QLocale::system().name().left(2); QString language = QLocale::system().name().left(2);
//qDebug()<<"Your language is"<<language; //qDebug()<<"Your language is"<<language;
//catenate that to the default language filename
QString file = QString("cppcheck_%1").arg(language);
//qDebug()<<"Language file could be"<<file;
//And see if we can find it from our list of language files //And see if we can find it from our list of language files
int index = mFiles.indexOf(file); int index = GetLanguageIndexByCode(language);
//If nothing found, return English //If nothing found, return English
if (index < 0) if (index < 0)
{ {
return 0; return "en";
} }
return index; return language;
} }
void TranslationHandler::AddTranslation(const char *name, const char *filename)
{
TranslationInfo info;
info.mName = name;
info.mFilename = filename;
info.mCode = QString(filename).right(2);
mTranslations.append(info);
}
int TranslationHandler::GetLanguageIndexByCode(const QString &code) const
{
int index = -1;
for (int i = 0; i < mTranslations.size(); i++)
{
if (mTranslations[i].mCode == code)
{
index = i;
break;
}
}
return index;
}

View File

@ -22,28 +22,131 @@
#include <QStringList> #include <QStringList>
#include <QTranslator> #include <QTranslator>
#include <QObject> #include <QObject>
#include <QList>
/// @addtogroup GUI /// @addtogroup GUI
/// @{ /// @{
/**
* @brief Information for one translation.
*
*/
struct TranslationInfo
{
/**
* @brief Readable name for the translation (e.g. "English").
*
*/
QString mName;
/**
* @brief Filename for the translation.
*
*/
QString mFilename;
/**
* @brief ISO 639 language code for the translation (e.g. "en").
*
*/
QString mCode;
};
/**
* @brief A class handling the available translations.
*
* This class contains a list of available translations. The class also keeps
* track which translation is the currently active translation.
*
*/
class TranslationHandler : QObject class TranslationHandler : QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
TranslationHandler(QObject *parent); TranslationHandler(QObject *parent);
virtual ~TranslationHandler(); virtual ~TranslationHandler();
/**
* @brief Get a list of available translation names.
* @return List of available translation names.
*
*/
const QStringList GetNames() const; const QStringList GetNames() const;
const QStringList GetFiles() const;
bool SetLanguage(const int index, QString &error); /**
int GetCurrentLanguage() const; * @brief Get a list of available translations.
int SuggestLanguage() const; * @return List of available translations.
*
*/
QList<TranslationInfo> GetTranslations() const
{
return mTranslations;
}
/**
* @brief Set active translation.
* @param ISO 639 language code for new selected translation.
* @param error Returns error string if selection fails.
* @return true if succeeds, false otherwise.
*
*/
bool SetLanguage(const QString &code, QString &error);
/**
* @brief Get currently selected translation.
* @return ISO 639 language code for current translation.
*
*/
QString GetCurrentLanguage() const;
/**
* @brief Get translation suggestion for the system.
* This function checks the current system locale and determines which of
* the available translations is best as current translation. If none of
* the available translations is good then it returns English ("en").
* @return Suggested translation ISO 639 language code.
*
*/
QString SuggestLanguage() const;
protected: protected:
int mCurrentLanguage;
QStringList mNames; /**
QStringList mFiles; * @brief Add new translation to list of available translations.
QTranslator *mTranslator; * @param name Name of the translation ("English").
* @param filename Filename of the translation.
*
*/
void AddTranslation(const char *name, const char *filename);
/**
* @brief Find language in the list and return its index.
* @param code ISO 639 language code.
* @return Index at list, or -1 if not found.
*
*/
int GetLanguageIndexByCode(const QString &code) const;
private: private:
/**
* @brief ISO 639 language code of the currently selected translation.
*
*/
QString mCurrentLanguage;
/**
* @brief List of available translations.
*
*/
QList<TranslationInfo> mTranslations;
/**
* @brief Translator class instance.
*
*/
QTranslator *mTranslator;
}; };
/// @} /// @}
#endif // TRANSLATIONHANDLER_H #endif // TRANSLATIONHANDLER_H

View File

@ -18,122 +18,70 @@
#include <QObject> #include <QObject>
#include <QString> #include <QString>
#include <QList>
#include <QDir>
#include <QFile> #include <QFile>
#include <QXmlStreamWriter> #include <QXmlStreamReader>
#include <QDebug>
#include "report.h" #include "report.h"
#include "erroritem.h"
#include "xmlreport.h" #include "xmlreport.h"
static const char ResultElementName[] = "results"; static const char ResultElementName[] = "results";
static const char ErrorElementName[] = "error"; static const char VersionAttribute[] = "version";
static const char FilenameAttribute[] = "file";
static const char LineAttribute[] = "line";
static const char IdAttribute[] = "id";
static const char SeverityAttribute[] = "severity";
static const char MsgAttribute[] = "msg";
XmlReport::XmlReport(const QString &filename, QObject * parent) : XmlReport::XmlReport(const QString &filename, QObject * parent) :
Report(filename, parent), Report(filename, parent)
mXmlReader(NULL),
mXmlWriter(NULL)
{ {
} }
XmlReport::~XmlReport() QString XmlReport::quoteMessage(const QString &message)
{ {
delete mXmlReader; QString quotedMessage(message);
delete mXmlWriter; quotedMessage.replace("&", "&amp;");
Close(); quotedMessage.replace("\"", "&quot;");
quotedMessage.replace("'", "&#039;");
quotedMessage.replace("<", "&lt;");
quotedMessage.replace(">", "&gt;");
return quotedMessage;
} }
bool XmlReport::Create() QString XmlReport::unquoteMessage(const QString &message)
{ {
bool success = false; QString quotedMessage(message);
if (Report::Create()) quotedMessage.replace("&amp;", "&");
quotedMessage.replace("&quot;", "\"");
quotedMessage.replace("&#039;", "'");
quotedMessage.replace("&lt;", "<");
quotedMessage.replace("&gt;", ">");
return quotedMessage;
}
int XmlReport::determineVersion(const QString &filename)
{
QFile file;
file.setFileName(filename);
bool succeed = file.open(QIODevice::ReadOnly | QIODevice::Text);
if (!succeed)
return 0;
QXmlStreamReader reader(&file);
while (!reader.atEnd())
{ {
mXmlWriter = new QXmlStreamWriter(Report::GetFile()); switch (reader.readNext())
success = true;
}
return success;
}
bool XmlReport::Open()
{
bool success = false;
if (Report::Open())
{
mXmlReader = new QXmlStreamReader(Report::GetFile());
success = true;
}
return success;
}
void XmlReport::WriteHeader()
{
mXmlWriter->setAutoFormatting(true);
mXmlWriter->writeStartDocument();
mXmlWriter->writeStartElement(ResultElementName);
}
void XmlReport::WriteFooter()
{
mXmlWriter->writeEndElement();
mXmlWriter->writeEndDocument();
}
void XmlReport::WriteError(const ErrorItem &error)
{
/*
Error example from the core program in xml
<error file="gui/test.cpp" line="14" id="mismatchAllocDealloc" severity="error" msg="Mismatching allocation and deallocation: k"/>
The callstack seems to be ignored here as well, instead last item of the stack is used
*/
mXmlWriter->writeStartElement(ErrorElementName);
const QString file = QDir::toNativeSeparators(error.files[error.files.size() - 1]);
mXmlWriter->writeAttribute(FilenameAttribute, file);
const QString line = QString::number(error.lines[error.lines.size() - 1]);
mXmlWriter->writeAttribute(LineAttribute, line);
mXmlWriter->writeAttribute(IdAttribute, error.id);
mXmlWriter->writeAttribute(SeverityAttribute, error.severity);
mXmlWriter->writeAttribute(MsgAttribute, error.message);
mXmlWriter->writeEndElement();
}
QList<ErrorLine> XmlReport::Read()
{
QList<ErrorLine> errors;
bool insideResults = false;
if (!mXmlReader)
{
qDebug() << "You must Open() the file before reading it!";
return errors;
}
while (!mXmlReader->atEnd())
{
switch (mXmlReader->readNext())
{ {
case QXmlStreamReader::StartElement: case QXmlStreamReader::StartElement:
if (mXmlReader->name() == ResultElementName) if (reader.name() == ResultElementName)
insideResults = true;
// Read error element from inside result element
if (insideResults && mXmlReader->name() == ErrorElementName)
{ {
ErrorLine line = ReadError(mXmlReader); QXmlStreamAttributes attribs = reader.attributes();
errors.append(line); if (attribs.hasAttribute(QString(VersionAttribute)))
{
int ver = attribs.value("", VersionAttribute).toString().toInt();
return ver;
}
else
return 1;
} }
break; break;
case QXmlStreamReader::EndElement:
if (mXmlReader->name() == ResultElementName)
insideResults = false;
break;
// Not handled // Not handled
case QXmlStreamReader::EndElement:
case QXmlStreamReader::NoToken: case QXmlStreamReader::NoToken:
case QXmlStreamReader::Invalid: case QXmlStreamReader::Invalid:
case QXmlStreamReader::StartDocument: case QXmlStreamReader::StartDocument:
@ -146,30 +94,5 @@ QList<ErrorLine> XmlReport::Read()
break; break;
} }
} }
return errors; return 0;
}
ErrorLine XmlReport::ReadError(QXmlStreamReader *reader)
{
ErrorLine line;
if (reader->name().toString() == ErrorElementName)
{
QXmlStreamAttributes attribs = reader->attributes();
line.file = attribs.value("", FilenameAttribute).toString();
line.line = attribs.value("", LineAttribute).toString().toUInt();
line.id = attribs.value("", IdAttribute).toString();
line.severity = attribs.value("", SeverityAttribute).toString();
// NOTE: This dublicates the message to Summary-field. But since
// old XML format doesn't have separate summary and verbose messages
// we must add same message to both data so it shows up in GUI.
// Check if there is full stop and cut the summary to it.
QString summary = attribs.value("", MsgAttribute).toString();
const int ind = summary.indexOf('.');
if (ind != -1)
summary = summary.left(ind + 1);
line.summary = summary;
line.message = attribs.value("", MsgAttribute).toString();
}
return line;
} }

View File

@ -19,78 +19,51 @@
#ifndef XML_REPORT_H #ifndef XML_REPORT_H
#define XML_REPORT_H #define XML_REPORT_H
#include <QObject>
#include <QString> #include <QString>
#include <QStringList> #include <QList>
#include <QFile>
#include <QXmlStreamReader>
#include <QXmlStreamWriter>
#include "report.h" #include "report.h"
#include "erroritem.h"
class QObject;
/// @addtogroup GUI /// @addtogroup GUI
/// @{ /// @{
/** /**
* @brief XML file report. * @brief Base class for XML report classes.
* This report outputs XML-formatted report. The XML format must match command
* line version's XML output.
*/ */
class XmlReport : public Report class XmlReport : public Report
{ {
public: public:
XmlReport(const QString &filename, QObject * parent = 0); XmlReport(const QString &filename, QObject * parent = 0);
virtual ~XmlReport();
/** /**
* @brief Create the report (file). * @brief Read contents of the report file.
* @return true if succeeded, false if file could not be created. */
*/ virtual QList<ErrorItem> Read() = 0;
virtual bool Create();
/** /**
* @brief Open existing report file. * @brief Quote the message.
*/ * @param message Message to quote.
bool Open(); * @return quoted message.
*/
static QString quoteMessage(const QString &message);
/** /**
* @brief Write report header. * @brief Unquote the message.
*/ * @param message Message to quote.
virtual void WriteHeader(); * @return quoted message.
*/
static QString unquoteMessage(const QString &message);
/** /**
* @brief Write report footer. * @brief Get the XML report format version from the file.
*/ * @param filename Filename of the report file.
virtual void WriteFooter(); * @return XML report format version or 0 if error happened.
*/
/** static int determineVersion(const QString &filename);
* @brief Write error to report.
* @param error Error data.
*/
virtual void WriteError(const ErrorItem &error);
/**
* @brief Read contents of the report file.
*/
QList<ErrorLine> Read();
protected:
/**
* @brief Read and parse error item from XML stream.
* @param reader XML stream reader to use.
*/
ErrorLine ReadError(QXmlStreamReader *reader);
private:
/**
* @brief XML stream reader for reading the report in XML format.
*/
QXmlStreamReader *mXmlReader;
/**
* @brief XML stream writer for writing the report in XML format.
*/
QXmlStreamWriter *mXmlWriter;
}; };
/// @} /// @}
#endif // XML_REPORT_H #endif // XML_REPORT_H

183
gui/xmlreportv1.cpp Normal file
View File

@ -0,0 +1,183 @@
/*
* Cppcheck - A tool for static C/C++ code analysis
* Copyright (C) 2007-2011 Daniel Marjamäki and Cppcheck team.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QObject>
#include <QString>
#include <QList>
#include <QDir>
#include <QFile>
#include <QXmlStreamWriter>
#include <QDebug>
#include "report.h"
#include "erroritem.h"
#include "xmlreport.h"
#include "xmlreportv1.h"
static const char ResultElementName[] = "results";
static const char ErrorElementName[] = "error";
static const char FilenameAttribute[] = "file";
static const char LineAttribute[] = "line";
static const char IdAttribute[] = "id";
static const char SeverityAttribute[] = "severity";
static const char MsgAttribute[] = "msg";
XmlReportV1::XmlReportV1(const QString &filename, QObject * parent) :
XmlReport(filename, parent),
mXmlReader(NULL),
mXmlWriter(NULL)
{
}
XmlReportV1::~XmlReportV1()
{
delete mXmlReader;
delete mXmlWriter;
Close();
}
bool XmlReportV1::Create()
{
bool success = false;
if (Report::Create())
{
mXmlWriter = new QXmlStreamWriter(Report::GetFile());
success = true;
}
return success;
}
bool XmlReportV1::Open()
{
bool success = false;
if (Report::Open())
{
mXmlReader = new QXmlStreamReader(Report::GetFile());
success = true;
}
return success;
}
void XmlReportV1::WriteHeader()
{
mXmlWriter->setAutoFormatting(true);
mXmlWriter->writeStartDocument();
mXmlWriter->writeStartElement(ResultElementName);
}
void XmlReportV1::WriteFooter()
{
mXmlWriter->writeEndElement();
mXmlWriter->writeEndDocument();
}
void XmlReportV1::WriteError(const ErrorItem &error)
{
/*
Error example from the core program in xml
<error file="gui/test.cpp" line="14" id="mismatchAllocDealloc" severity="error" msg="Mismatching allocation and deallocation: k"/>
The callstack seems to be ignored here as well, instead last item of the stack is used
*/
mXmlWriter->writeStartElement(ErrorElementName);
QString file = QDir::toNativeSeparators(error.files[error.files.size() - 1]);
file = XmlReport::quoteMessage(file);
mXmlWriter->writeAttribute(FilenameAttribute, file);
const QString line = QString::number(error.lines[error.lines.size() - 1]);
mXmlWriter->writeAttribute(LineAttribute, line);
mXmlWriter->writeAttribute(IdAttribute, error.id);
mXmlWriter->writeAttribute(SeverityAttribute, error.severity);
const QString message = XmlReport::quoteMessage(error.message);
mXmlWriter->writeAttribute(MsgAttribute, message);
mXmlWriter->writeEndElement();
}
QList<ErrorItem> XmlReportV1::Read()
{
QList<ErrorItem> errors;
bool insideResults = false;
if (!mXmlReader)
{
qDebug() << "You must Open() the file before reading it!";
return errors;
}
while (!mXmlReader->atEnd())
{
switch (mXmlReader->readNext())
{
case QXmlStreamReader::StartElement:
if (mXmlReader->name() == ResultElementName)
insideResults = true;
// Read error element from inside result element
if (insideResults && mXmlReader->name() == ErrorElementName)
{
ErrorItem item = ReadError(mXmlReader);
errors.append(item);
}
break;
case QXmlStreamReader::EndElement:
if (mXmlReader->name() == ResultElementName)
insideResults = false;
break;
// Not handled
case QXmlStreamReader::NoToken:
case QXmlStreamReader::Invalid:
case QXmlStreamReader::StartDocument:
case QXmlStreamReader::EndDocument:
case QXmlStreamReader::Characters:
case QXmlStreamReader::Comment:
case QXmlStreamReader::DTD:
case QXmlStreamReader::EntityReference:
case QXmlStreamReader::ProcessingInstruction:
break;
}
}
return errors;
}
ErrorItem XmlReportV1::ReadError(QXmlStreamReader *reader)
{
ErrorItem item;
if (reader->name().toString() == ErrorElementName)
{
QXmlStreamAttributes attribs = reader->attributes();
QString file = attribs.value("", FilenameAttribute).toString();
file = XmlReport::unquoteMessage(file);
item.file = file;
item.files.push_back(file);
const int line = attribs.value("", LineAttribute).toString().toUInt();
item.lines.push_back(line);
item.id = attribs.value("", IdAttribute).toString();
item.severity = attribs.value("", SeverityAttribute).toString();
// NOTE: This dublicates the message to Summary-field. But since
// old XML format doesn't have separate summary and verbose messages
// we must add same message to both data so it shows up in GUI.
// Check if there is full stop and cut the summary to it.
QString summary = attribs.value("", MsgAttribute).toString();
const int ind = summary.indexOf('.');
if (ind != -1)
summary = summary.left(ind + 1);
item.summary = XmlReport::unquoteMessage(summary);
QString message = attribs.value("", MsgAttribute).toString();
item.message = XmlReport::unquoteMessage(message);
}
return item;
}

96
gui/xmlreportv1.h Normal file
View File

@ -0,0 +1,96 @@
/*
* Cppcheck - A tool for static C/C++ code analysis
* Copyright (C) 2007-2011 Daniel Marjamäki and Cppcheck team.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef XML_REPORTV1_H
#define XML_REPORTV1_H
#include <QObject>
#include <QString>
#include <QStringList>
#include <QFile>
#include <QXmlStreamReader>
#include <QXmlStreamWriter>
#include "xmlreport.h"
/// @addtogroup GUI
/// @{
/**
* @brief XML file report version 1.
* This report outputs XML-formatted report, version 1. The XML format must match command
* line version's XML output.
*/
class XmlReportV1 : public XmlReport
{
public:
XmlReportV1(const QString &filename, QObject * parent = 0);
virtual ~XmlReportV1();
/**
* @brief Create the report (file).
* @return true if succeeded, false if file could not be created.
*/
virtual bool Create();
/**
* @brief Open existing report file.
*/
bool Open();
/**
* @brief Write report header.
*/
virtual void WriteHeader();
/**
* @brief Write report footer.
*/
virtual void WriteFooter();
/**
* @brief Write error to report.
* @param error Error data.
*/
virtual void WriteError(const ErrorItem &error);
/**
* @brief Read contents of the report file.
*/
virtual QList<ErrorItem> Read();
protected:
/**
* @brief Read and parse error item from XML stream.
* @param reader XML stream reader to use.
*/
ErrorItem ReadError(QXmlStreamReader *reader);
private:
/**
* @brief XML stream reader for reading the report in XML format.
*/
QXmlStreamReader *mXmlReader;
/**
* @brief XML stream writer for writing the report in XML format.
*/
QXmlStreamWriter *mXmlWriter;
};
/// @}
#endif // XML_REPORTV1_H

246
gui/xmlreportv2.cpp Normal file
View File

@ -0,0 +1,246 @@
/*
* Cppcheck - A tool for static C/C++ code analysis
* Copyright (C) 2007-2011 Daniel Marjamäki and Cppcheck team.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QObject>
#include <QString>
#include <QList>
#include <QDir>
#include <QFile>
#include <QXmlStreamWriter>
#include <QDebug>
#include "report.h"
#include "erroritem.h"
#include "xmlreport.h"
#include "xmlreportv2.h"
#include "cppcheck.h"
static const char ResultElementName[] = "results";
static const char CppcheckElementName[] = "cppcheck";
static const char ErrorElementName[] = "error";
static const char ErrorsElementName[] = "errors";
static const char LocationElementName[] = "location";
static const char FilenameAttribute[] = "file";
static const char LineAttribute[] = "line";
static const char IdAttribute[] = "id";
static const char SeverityAttribute[] = "severity";
static const char MsgAttribute[] = "msg";
static const char VersionAttribute[] = "version";
static const char VerboseAttribute[] = "verbose";
XmlReportV2::XmlReportV2(const QString &filename, QObject * parent) :
XmlReport(filename, parent),
mXmlReader(NULL),
mXmlWriter(NULL)
{
}
XmlReportV2::~XmlReportV2()
{
delete mXmlReader;
delete mXmlWriter;
Close();
}
bool XmlReportV2::Create()
{
bool success = false;
if (Report::Create())
{
mXmlWriter = new QXmlStreamWriter(Report::GetFile());
success = true;
}
return success;
}
bool XmlReportV2::Open()
{
bool success = false;
if (Report::Open())
{
mXmlReader = new QXmlStreamReader(Report::GetFile());
success = true;
}
return success;
}
void XmlReportV2::WriteHeader()
{
mXmlWriter->setAutoFormatting(true);
mXmlWriter->writeStartDocument();
mXmlWriter->writeStartElement(ResultElementName);
mXmlWriter->writeAttribute(VersionAttribute, QString::number(2));
mXmlWriter->writeStartElement(CppcheckElementName);
mXmlWriter->writeAttribute(VersionAttribute, QString(CppCheck::version()));
mXmlWriter->writeEndElement();
mXmlWriter->writeStartElement(ErrorsElementName);
}
void XmlReportV2::WriteFooter()
{
mXmlWriter->writeEndElement(); // errors
mXmlWriter->writeEndElement(); // results
mXmlWriter->writeEndDocument();
}
void XmlReportV2::WriteError(const ErrorItem &error)
{
/*
Error example from the core program in xml
<error id="mismatchAllocDealloc" severity="error" msg="Mismatching allocation and deallocation: k"
verbose="Mismatching allocation and deallocation: k">
<location file="..\..\test\test.cxx" line="16"/>
<location file="..\..\test\test.cxx" line="32"/>
</error>
*/
mXmlWriter->writeStartElement(ErrorElementName);
mXmlWriter->writeAttribute(IdAttribute, error.id);
mXmlWriter->writeAttribute(SeverityAttribute, error.severity);
const QString summary = XmlReport::quoteMessage(error.summary);
mXmlWriter->writeAttribute(MsgAttribute, summary);
const QString message = XmlReport::quoteMessage(error.message);
mXmlWriter->writeAttribute(VerboseAttribute, message);
for (int i = 0; i < error.files.count(); i++)
{
mXmlWriter->writeStartElement(LocationElementName);
QString file = QDir::toNativeSeparators(error.files[i]);
file = XmlReport::quoteMessage(file);
mXmlWriter->writeAttribute(FilenameAttribute, file);
const QString line = QString::number(error.lines[i]);
mXmlWriter->writeAttribute(LineAttribute, line);
mXmlWriter->writeEndElement();
}
mXmlWriter->writeEndElement();
}
QList<ErrorItem> XmlReportV2::Read()
{
QList<ErrorItem> errors;
bool insideResults = false;
if (!mXmlReader)
{
qDebug() << "You must Open() the file before reading it!";
return errors;
}
while (!mXmlReader->atEnd())
{
switch (mXmlReader->readNext())
{
case QXmlStreamReader::StartElement:
if (mXmlReader->name() == ResultElementName)
insideResults = true;
// Read error element from inside result element
if (insideResults && mXmlReader->name() == ErrorElementName)
{
ErrorItem item = ReadError(mXmlReader);
errors.append(item);
}
break;
case QXmlStreamReader::EndElement:
if (mXmlReader->name() == ResultElementName)
insideResults = false;
break;
// Not handled
case QXmlStreamReader::NoToken:
case QXmlStreamReader::Invalid:
case QXmlStreamReader::StartDocument:
case QXmlStreamReader::EndDocument:
case QXmlStreamReader::Characters:
case QXmlStreamReader::Comment:
case QXmlStreamReader::DTD:
case QXmlStreamReader::EntityReference:
case QXmlStreamReader::ProcessingInstruction:
break;
}
}
return errors;
}
ErrorItem XmlReportV2::ReadError(QXmlStreamReader *reader)
{
/*
Error example from the core program in xml
<error id="mismatchAllocDealloc" severity="error" msg="Mismatching allocation and deallocation: k"
verbose="Mismatching allocation and deallocation: k">
<location file="..\..\test\test.cxx" line="16"/>
<location file="..\..\test\test.cxx" line="32"/>
</error>
*/
ErrorItem item;
// Read error element from inside errors element
if (mXmlReader->name() == ErrorElementName)
{
QXmlStreamAttributes attribs = reader->attributes();
item.id = attribs.value("", IdAttribute).toString();
item.severity = attribs.value("", SeverityAttribute).toString();
const QString summary = attribs.value("", MsgAttribute).toString();
item.summary = XmlReport::unquoteMessage(summary);
const QString message = attribs.value("", VerboseAttribute).toString();
item.message = XmlReport::unquoteMessage(message);
}
bool errorRead = false;
while (!errorRead && !mXmlReader->atEnd())
{
switch (mXmlReader->readNext())
{
case QXmlStreamReader::StartElement:
// Read location element from inside error element
if (mXmlReader->name() == LocationElementName)
{
QXmlStreamAttributes attribs = mXmlReader->attributes();
QString file = attribs.value("", FilenameAttribute).toString();
file = XmlReport::unquoteMessage(file);
if (item.file.isEmpty())
item.file = file;
item.files.push_back(file);
const int line = attribs.value("", LineAttribute).toString().toUInt();
item.lines.push_back(line);
}
break;
case QXmlStreamReader::EndElement:
if (mXmlReader->name() == ErrorElementName)
errorRead = true;
break;
// Not handled
case QXmlStreamReader::NoToken:
case QXmlStreamReader::Invalid:
case QXmlStreamReader::StartDocument:
case QXmlStreamReader::EndDocument:
case QXmlStreamReader::Characters:
case QXmlStreamReader::Comment:
case QXmlStreamReader::DTD:
case QXmlStreamReader::EntityReference:
case QXmlStreamReader::ProcessingInstruction:
break;
}
}
return item;
}

96
gui/xmlreportv2.h Normal file
View File

@ -0,0 +1,96 @@
/*
* Cppcheck - A tool for static C/C++ code analysis
* Copyright (C) 2007-2011 Daniel Marjamäki and Cppcheck team.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef XML_REPORTV2_H
#define XML_REPORTV2_H
#include <QObject>
#include <QString>
#include <QStringList>
#include <QFile>
#include <QXmlStreamReader>
#include <QXmlStreamWriter>
#include "report.h"
/// @addtogroup GUI
/// @{
/**
* @brief XML file report version 2.
* This report outputs XML-formatted report. The XML format must match command
* line version's XML output.
*/
class XmlReportV2 : public XmlReport
{
public:
XmlReportV2(const QString &filename, QObject * parent = 0);
virtual ~XmlReportV2();
/**
* @brief Create the report (file).
* @return true if succeeded, false if file could not be created.
*/
virtual bool Create();
/**
* @brief Open existing report file.
*/
bool Open();
/**
* @brief Write report header.
*/
virtual void WriteHeader();
/**
* @brief Write report footer.
*/
virtual void WriteFooter();
/**
* @brief Write error to report.
* @param error Error data.
*/
virtual void WriteError(const ErrorItem &error);
/**
* @brief Read contents of the report file.
*/
virtual QList<ErrorItem> Read();
protected:
/**
* @brief Read and parse error item from XML stream.
* @param reader XML stream reader to use.
*/
ErrorItem ReadError(QXmlStreamReader *reader);
private:
/**
* @brief XML stream reader for reading the report in XML format.
*/
QXmlStreamReader *mXmlReader;
/**
* @brief XML stream writer for writing the report in XML format.
*/
QXmlStreamWriter *mXmlWriter;
};
/// @}
#endif // XML_REPORTV2_H

View File

@ -134,178 +134,172 @@ void CheckAutoVariables::addVDA(unsigned int varId)
void CheckAutoVariables::autoVariables() void CheckAutoVariables::autoVariables()
{ {
bool begin_function = false; const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
bool begin_function_decl = false;
int bindent = 0;
// Which variables have an unknown type? std::list<Scope *>::const_iterator i;
std::set<unsigned int> unknown_type;
const SymbolDatabase * const symbolDatabase = _tokenizer->getSymbolDatabase(); for (i = symbolDatabase->scopeList.begin(); i != symbolDatabase->scopeList.end(); ++i)
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next())
{ {
const Scope *scope = *i;
if (Token::Match(tok, "%type% *|::| %var% (")) // only check functions
{ if (scope->type != Scope::eFunction)
begin_function = true;
fp_list.clear();
vd_list.clear();
vda_list.clear();
}
else if (begin_function && begin_function_decl && Token::Match(tok, "%type% * * %var%"))
{
fp_list.insert(tok->tokAt(3)->str());
}
else if (begin_function && begin_function_decl && Token::Match(tok, "%type% * %var% ["))
{
fp_list.insert(tok->tokAt(2)->str());
}
else if (begin_function && tok->str() == "(")
{
begin_function_decl = true;
}
else if (begin_function && tok->str() == ")")
{
begin_function_decl = false;
}
else if (begin_function && tok->str() == "{")
{
bindent++;
}
else if (begin_function && tok->str() == "}")
{
bindent--;
}
else if (bindent <= 0)
{
continue; continue;
}
// Inside a function body fp_list.clear();
if (Token::Match(tok, "%type% :: %any%") && !isExternOrStatic(tok)) vd_list.clear();
vda_list.clear();
const Token *tok = scope->classDef->next();
for (; tok && tok != scope->classDef->next()->link(); tok = tok->next())
{ {
addVD(tok->tokAt(2)->varId()); if (Token::Match(tok, "%type% * * %var%"))
}
else if (Token::Match(tok, "%type% %var% ["))
{
addVDA(tok->next()->varId());
}
else if (Token::Match(tok, "%var% %var% ;") && !isExternOrStatic(tok) && isTypeName(tok))
{
addVD(tok->next()->varId());
if (!tok->isStandardType() &&
!symbolDatabase->isClassOrStruct(tok->str()))
{ {
unknown_type.insert(tok->next()->varId()); fp_list.insert(tok->tokAt(3)->str());
}
else if (Token::Match(tok, "%type% * %var% ["))
{
fp_list.insert(tok->tokAt(2)->str());
} }
} }
else if (Token::Match(tok, "const %var% %var% ;") && !isExternOrStatic(tok) && isTypeName(tok->next()))
unsigned int indentlevel = 0;
// Which variables have an unknown type?
std::set<unsigned int> unknown_type;
for (tok = scope->classDef->next()->link(); tok; tok = tok->next())
{ {
addVD(tok->tokAt(2)->varId()); // indentlevel..
if (tok->str() == "{")
++indentlevel;
else if (tok->str() == "}")
{
if (indentlevel <= 1)
break;
--indentlevel;
}
// Inside a function body
if (Token::Match(tok, "%type% :: %any%") && !isExternOrStatic(tok))
{
addVD(tok->tokAt(2)->varId());
}
else if (Token::Match(tok, "%type% %var% ["))
{
addVDA(tok->next()->varId());
}
else if (Token::Match(tok, "%var% %var% ;") && !isExternOrStatic(tok) && isTypeName(tok))
{
addVD(tok->next()->varId());
if (!tok->isStandardType() &&
!symbolDatabase->isClassOrStruct(tok->str()))
{
unknown_type.insert(tok->next()->varId());
}
}
else if (Token::Match(tok, "const %var% %var% ;") && !isExternOrStatic(tok) && isTypeName(tok->next()))
{
addVD(tok->tokAt(2)->varId());
}
//Critical assignment
else if (Token::Match(tok, "[;{}] %var% = & %var%") && errorAv(tok->tokAt(1), tok->tokAt(4)))
{
errorAutoVariableAssignment(tok);
}
else if (Token::Match(tok, "[;{}] * %var% = & %var%") && errorAv(tok->tokAt(2), tok->tokAt(5)) &&
unknown_type.find(tok->tokAt(5)->varId()) == unknown_type.end())
{
errorAutoVariableAssignment(tok);
}
else if (Token::Match(tok, "[;{}] %var% [ %any% ] = & %var%") && errorAv(tok->tokAt(1), tok->tokAt(7)))
{
errorAutoVariableAssignment(tok);
}
// Critical return
else if (Token::Match(tok, "return & %var% ;") && isAutoVar(tok->tokAt(2)->varId()))
{
reportError(tok, Severity::error, "autoVariables", "Return of the address of an auto-variable");
}
// Invalid pointer deallocation
else if (Token::Match(tok, "free ( %var% ) ;") && isAutoVarArray(tok->tokAt(2)->varId()))
{
reportError(tok, Severity::error, "autoVariables", "Invalid deallocation");
}
} }
//Critical assignment vd_list.clear();
else if (Token::Match(tok, "[;{}] %var% = & %var%") && errorAv(tok->tokAt(1), tok->tokAt(4))) vda_list.clear();
{ fp_list.clear();
errorAutoVariableAssignment(tok);
}
else if (Token::Match(tok, "[;{}] * %var% = & %var%") && errorAv(tok->tokAt(2), tok->tokAt(5)) &&
unknown_type.find(tok->tokAt(5)->varId()) == unknown_type.end())
{
errorAutoVariableAssignment(tok);
}
else if (Token::Match(tok, "[;{}] %var% [ %any% ] = & %var%") && errorAv(tok->tokAt(1), tok->tokAt(7)))
{
errorAutoVariableAssignment(tok);
}
// Critical return
else if (Token::Match(tok, "return & %var% ;") && isAutoVar(tok->tokAt(2)->varId()))
{
reportError(tok, Severity::error, "autoVariables", "Return of the address of an auto-variable");
}
// Invalid pointer deallocation
else if (Token::Match(tok, "free ( %var% ) ;") && isAutoVarArray(tok->tokAt(2)->varId()))
{
reportError(tok, Severity::error, "autoVariables", "Invalid deallocation");
}
} }
vd_list.clear();
vda_list.clear();
fp_list.clear();
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void CheckAutoVariables::returnPointerToLocalArray() void CheckAutoVariables::returnPointerToLocalArray()
{ {
bool infunc = false; const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
int indentlevel = 0;
std::set<unsigned int> arrayVar; std::list<Scope *>::const_iterator i;
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next())
for (i = symbolDatabase->scopeList.begin(); i != symbolDatabase->scopeList.end(); ++i)
{ {
// Is there a function declaration for a function that returns a pointer? const Scope *scope = *i;
if (!infunc && (Token::Match(tok, "%type% * %var% (") || Token::Match(tok, "%type% * %var% :: %var% (")))
// only check functions
if (scope->type != Scope::eFunction)
continue;
const Token *tok = scope->classDef;
// skip any qualification
while (Token::Match(tok->tokAt(-2), "%type% ::"))
tok = tok->tokAt(-2);
// have we reached a function that returns a pointer
if (Token::Match(tok->tokAt(-2), "%type% *"))
{ {
for (const Token *tok2 = tok; tok2; tok2 = tok2->next()) // go to the '('
{ const Token *tok2 = scope->classDef->next();
if (tok2->str() == ")")
{
tok = tok2;
break;
}
}
if (Token::simpleMatch(tok, ") {"))
{
infunc = true;
indentlevel = 0;
arrayVar.clear();
}
}
// Parsing a function that returns a pointer.. // go to the ')'
if (infunc) tok2 = tok2->next()->link();
{
if (tok->str() == "{")
{
++indentlevel;
}
else if (tok->str() == "}")
{
--indentlevel;
if (indentlevel <= 0)
{
infunc = false;
}
continue;
}
// Declaring a local array.. unsigned int indentlevel = 0;
if (Token::Match(tok, "[;{}] %type% %var% [")) std::set<unsigned int> arrayVar;
for (; tok2; tok2 = tok2->next())
{ {
const unsigned int varid = tok->tokAt(2)->varId(); // indentlevel..
if (varid > 0) if (tok2->str() == "{")
++indentlevel;
else if (tok2->str() == "}")
{ {
arrayVar.insert(varid); if (indentlevel <= 1)
break;
--indentlevel;
} }
}
// Return pointer to local array variable.. // Declaring a local array..
if (Token::Match(tok, "return %var% ;")) if (Token::Match(tok2, "[;{}] %type% %var% ["))
{
const unsigned int varid = tok->next()->varId();
if (varid > 0 && arrayVar.find(varid) != arrayVar.end())
{ {
errorReturnPointerToLocalArray(tok); const unsigned int varid = tok2->tokAt(2)->varId();
if (varid > 0)
{
arrayVar.insert(varid);
}
}
// Return pointer to local array variable..
if (Token::Match(tok2, "return %var% ;"))
{
const unsigned int varid = tok2->next()->varId();
if (varid > 0 && arrayVar.find(varid) != arrayVar.end())
{
errorReturnPointerToLocalArray(tok2);
}
} }
} }
} }
// Declaring array variable..
} }
} }
@ -324,6 +318,8 @@ void CheckAutoVariables::errorAutoVariableAssignment(const Token *tok)
"is invalid after the function ends."); "is invalid after the function ends.");
} }
//---------------------------------------------------------------------------
// return temporary? // return temporary?
bool CheckAutoVariables::returnTemporary(const Token *tok) const bool CheckAutoVariables::returnTemporary(const Token *tok) const
{ {
@ -332,89 +328,91 @@ bool CheckAutoVariables::returnTemporary(const Token *tok) const
return bool(0 != Token::findmatch(_tokenizer->tokens(), ("std :: string " + tok->next()->str() + " (").c_str())); return bool(0 != Token::findmatch(_tokenizer->tokens(), ("std :: string " + tok->next()->str() + " (").c_str()));
} }
//---------------------------------------------------------------------------
void CheckAutoVariables::returnReference() void CheckAutoVariables::returnReference()
{ {
// locate function that returns a reference.. const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next())
std::list<Scope *>::const_iterator i;
for (i = symbolDatabase->scopeList.begin(); i != symbolDatabase->scopeList.end(); ++i)
{ {
// Skip executable scopes.. const Scope *scope = *i;
if (Token::Match(tok, ") const| {"))
{ // only check functions
tok = tok->next(); if (scope->type != Scope::eFunction)
if (tok->str() == "const")
tok = tok->next();
tok = tok->link();
continue; continue;
}
const Token *tok = scope->classDef;
// skip any qualification
while (Token::Match(tok->tokAt(-2), "%type% ::"))
tok = tok->tokAt(-2);
// have we reached a function that returns a reference? // have we reached a function that returns a reference?
if (Token::Match(tok, "%type% & %var% (") || if (Token::Match(tok->tokAt(-2), "%type% &") ||
Token::Match(tok, "> & %var% (")) Token::Match(tok->tokAt(-2), "> &"))
{ {
// go to the '(' // go to the '('
const Token *tok2 = tok->tokAt(3); const Token *tok2 = scope->classDef->next();
// go to the ')' // go to the ')'
tok2 = tok2->link(); tok2 = tok2->link();
// is this a function implementation? unsigned int indentlevel = 0;
if (Token::Match(tok2, ") const| {")) std::set<unsigned int> localvar; // local variables in function
for (; tok2; tok2 = tok2->next())
{ {
unsigned int indentlevel = 0; // indentlevel..
std::set<unsigned int> localvar; // local variables in function if (tok2->str() == "{")
while (0 != (tok2 = tok2->next())) ++indentlevel;
else if (tok2->str() == "}")
{ {
// indentlevel.. if (indentlevel <= 1)
if (tok2->str() == "{") break;
++indentlevel; --indentlevel;
else if (tok2->str() == "}") }
{
if (indentlevel <= 1)
break;
--indentlevel;
}
// declare local variable.. // declare local variable..
if (Token::Match(tok2, "[{};] %type%") && tok2->next()->str() != "return") if (Token::Match(tok2, "[{};] %type%") && tok2->next()->str() != "return")
{ {
// goto next token.. // goto next token..
tok2 = tok2->next();
// skip "const"
if (Token::Match(tok2, "const %type%"))
tok2 = tok2->next(); tok2 = tok2->next();
// skip "const" // skip "std::" if it is seen
if (Token::Match(tok2, "const %type%")) if (Token::simpleMatch(tok2, "std ::"))
tok2 = tok2->next(); tok2 = tok2->tokAt(2);
// skip "std::" if it is seen // is it a variable declaration?
if (Token::simpleMatch(tok2, "std ::")) if (Token::Match(tok2, "%type% %var% ;"))
tok2 = tok2->tokAt(2); localvar.insert(tok2->next()->varId());
else if (Token::Match(tok2, "%type% < %any% > %var% ;"))
localvar.insert(tok2->tokAt(4)->varId());
}
// is it a variable declaration? // return..
if (Token::Match(tok2, "%type% %var% ;")) else if (Token::Match(tok2, "return %var% ;"))
localvar.insert(tok2->next()->varId()); {
else if (Token::Match(tok2, "%type% < %any% > %var% ;")) // is the returned variable a local variable?
localvar.insert(tok2->tokAt(4)->varId()); if ((tok2->next()->varId() > 0) &&
} (localvar.find(tok2->next()->varId()) != localvar.end()))
// return..
else if (Token::Match(tok2, "return %var% ;"))
{
// is the returned variable a local variable?
if ((tok2->next()->varId() > 0) &&
(localvar.find(tok2->next()->varId()) != localvar.end()))
{
// report error..
errorReturnReference(tok2);
}
}
// return reference to temporary..
else if (returnTemporary(tok2))
{ {
// report error.. // report error..
errorReturnTempReference(tok2); errorReturnReference(tok2);
} }
} }
// return reference to temporary..
else if (returnTemporary(tok2))
{
// report error..
errorReturnTempReference(tok2);
}
} }
} }
} }
@ -430,91 +428,90 @@ void CheckAutoVariables::errorReturnTempReference(const Token *tok)
reportError(tok, Severity::error, "returnTempReference", "Returning reference to temporary"); reportError(tok, Severity::error, "returnTempReference", "Returning reference to temporary");
} }
//---------------------------------------------------------------------------
// Return c_str // Return c_str
void CheckAutoVariables::returncstr() void CheckAutoVariables::returncstr()
{ {
// locate function that returns a const char *.. // locate function that returns a const char *..
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
{
// Skip executable scopes..
if (Token::Match(tok, ") const| {"))
{
tok = tok->next();
if (tok->str() == "const")
tok = tok->next();
tok = tok->link();
continue;
}
// have we reached a function that returns a reference? std::list<Scope *>::const_iterator i;
if (Token::simpleMatch(tok, "const char *"))
for (i = symbolDatabase->scopeList.begin(); i != symbolDatabase->scopeList.end(); ++i)
{
const Scope *scope = *i;
// only check functions
if (scope->type != Scope::eFunction)
continue;
const Token *tok = scope->classDef;
// skip any qualification
while (Token::Match(tok->tokAt(-2), "%type% ::"))
tok = tok->tokAt(-2);
// have we reached a function that returns a const char *
if (Token::simpleMatch(tok->tokAt(-3), "const char *"))
{ {
// go to the '(' // go to the '('
const Token *tok2 = tok->tokAt(3); const Token *tok2 = scope->classDef->next();
while (Token::Match(tok2, "%var% ::"))
tok2 = tok2->tokAt(2);
if (!Token::Match(tok2, "%var% ("))
continue;
// go to the ')' // go to the ')'
tok2 = tok2->next()->link(); tok2 = tok2->next()->link();
// is this a function implementation? unsigned int indentlevel = 0;
if (Token::Match(tok2, ") const| {")) std::set<unsigned int> localvar; // local variables in function
for (; tok2; tok2 = tok2->next())
{ {
unsigned int indentlevel = 0; // indentlevel..
std::set<unsigned int> localvar; // local variables in function if (tok2->str() == "{")
while (0 != (tok2 = tok2->next())) ++indentlevel;
else if (tok2->str() == "}")
{ {
// indentlevel.. if (indentlevel <= 1)
if (tok2->str() == "{") break;
++indentlevel; --indentlevel;
else if (tok2->str() == "}") }
{
if (indentlevel <= 1)
break;
--indentlevel;
}
// declare local variable.. // declare local variable..
if (Token::Match(tok2, "[{};] %type%") && tok2->next()->str() != "return") if (Token::Match(tok2, "[{};] %type%") && tok2->next()->str() != "return")
{ {
// goto next token.. // goto next token..
tok2 = tok2->next();
// skip "const"
if (Token::Match(tok2, "const %type%"))
tok2 = tok2->next(); tok2 = tok2->next();
// skip "const" // skip "std::" if it is seen
if (Token::Match(tok2, "const %type%")) if (Token::simpleMatch(tok2, "std ::"))
tok2 = tok2->next(); tok2 = tok2->tokAt(2);
// skip "std::" if it is seen // is it a variable declaration?
if (Token::simpleMatch(tok2, "std ::")) if (Token::Match(tok2, "%type% %var% [;=]"))
tok2 = tok2->tokAt(2); localvar.insert(tok2->next()->varId());
}
// is it a variable declaration? // return..
if (Token::Match(tok2, "%type% %var% [;=]")) else if (Token::Match(tok2, "return %var% . c_str ( ) ;"))
localvar.insert(tok2->next()->varId()); {
} // is the returned variable a local variable?
if ((tok2->next()->varId() > 0) &&
// return.. (localvar.find(tok2->next()->varId()) != localvar.end()))
else if (Token::Match(tok2, "return %var% . c_str ( ) ;"))
{
// is the returned variable a local variable?
if ((tok2->next()->varId() > 0) &&
(localvar.find(tok2->next()->varId()) != localvar.end()))
{
// report error..
errorReturnAutocstr(tok2);
}
}
// return pointer to temporary..
else if (returnTemporary(tok2))
{ {
// report error.. // report error..
errorReturnTempPointer(tok2); errorReturnAutocstr(tok2);
} }
} }
// return pointer to temporary..
else if (returnTemporary(tok2))
{
// report error..
errorReturnTempPointer(tok2);
}
} }
} }
} }
@ -529,6 +526,3 @@ void CheckAutoVariables::errorReturnTempPointer(const Token *tok)
{ {
reportError(tok, Severity::error, "returnTempPointer", "Returning pointer to temporary"); reportError(tok, Severity::error, "returnTempPointer", "Returning pointer to temporary");
} }

View File

@ -167,4 +167,32 @@ void CheckExceptionSafety::deallocThrow()
} }
} }
//---------------------------------------------------------------------------
// catch(const exception & err)
// {
// throw err; // <- should be just "throw;"
// }
//---------------------------------------------------------------------------
void CheckExceptionSafety::checkRethrowCopy()
{
if (!_settings->_checkCodingStyle)
return;
const char catchPattern[] = "catch ( const| %type% &|*| %var% ) { %any%";
const Token *tok = Token::findmatch(_tokenizer->tokens(), catchPattern);
while (tok)
{
const Token *startBlockTok = tok->next()->link()->next();
const Token *endBlockTok = startBlockTok->link();
const unsigned int varid = startBlockTok->tokAt(-2)->varId();
const Token* rethrowTok = Token::findmatch(startBlockTok, "throw %varid%", endBlockTok, varid);
if (rethrowTok)
{
rethrowCopyError(rethrowTok, startBlockTok->tokAt(-2)->str());
}
tok = Token::findmatch(endBlockTok->next(), catchPattern);
}
}

View File

@ -57,6 +57,7 @@ public:
CheckExceptionSafety checkExceptionSafety(tokenizer, settings, errorLogger); CheckExceptionSafety checkExceptionSafety(tokenizer, settings, errorLogger);
checkExceptionSafety.destructors(); checkExceptionSafety.destructors();
checkExceptionSafety.deallocThrow(); checkExceptionSafety.deallocThrow();
checkExceptionSafety.checkRethrowCopy();
} }
/** Don't throw exceptions in destructors */ /** Don't throw exceptions in destructors */
@ -65,6 +66,9 @@ public:
/** deallocating memory and then throw (dead pointer) */ /** deallocating memory and then throw (dead pointer) */
void deallocThrow(); void deallocThrow();
/** Don't rethrow a copy of the caught exception; use a bare throw instead */
void checkRethrowCopy();
private: private:
/** Don't throw exceptions in destructors */ /** Don't throw exceptions in destructors */
void destructorsError(const Token * const tok) void destructorsError(const Token * const tok)
@ -77,12 +81,21 @@ private:
reportError(tok, Severity::error, "exceptDeallocThrow", "Throwing exception in invalid state, " + varname + " points at deallocated memory"); reportError(tok, Severity::error, "exceptDeallocThrow", "Throwing exception in invalid state, " + varname + " points at deallocated memory");
} }
void rethrowCopyError(const Token * const tok, const std::string &varname)
{
reportError(tok, Severity::style, "exceptRethrowCopy",
"Throwing a copy of the caught exception instead of rethrowing the original exception\n"
"Rethrowing an exception with 'throw " + varname + ";' makes an unnecessary copy of '" + varname + "'.\n"
"To rethrow the caught exception without unnecessary copying or slicing, use a bare 'throw;'.");
}
/** Generate all possible errors (for --errorlist) */ /** Generate all possible errors (for --errorlist) */
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings)
{ {
CheckExceptionSafety c(0, settings, errorLogger); CheckExceptionSafety c(0, settings, errorLogger);
c.destructorsError(0); c.destructorsError(0);
c.deallocThrowError(0, "p"); c.deallocThrowError(0, "p");
c.rethrowCopyError(0, "varname");
} }
/** Short description of class (for --doc) */ /** Short description of class (for --doc) */
@ -96,7 +109,8 @@ private:
{ {
return "Checking exception safety\n" return "Checking exception safety\n"
"* Throwing exceptions in destructors\n" "* Throwing exceptions in destructors\n"
"* Throwing exception during invalid state"; "* Throwing exception during invalid state\n"
"* Throwing a copy of a caught exception instead of rethrowing the original exception";
} }
}; };
/// @} /// @}

View File

@ -1250,7 +1250,7 @@ Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::list<const Toke
if ((tok->str() == "else") || (tok->str() == "switch")) if ((tok->str() == "else") || (tok->str() == "switch"))
{ {
addtoken(&rettail, tok, tok->str()); addtoken(&rettail, tok, tok->str());
if (tok->str() == "switch") if (Token::simpleMatch(tok, "switch ("))
tok = tok->next()->link(); tok = tok->next()->link();
continue; continue;
} }

View File

@ -2718,6 +2718,40 @@ void CheckOther::checkMisusedScopedObject()
} }
} }
void CheckOther::checkIncorrectStringCompare()
{
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next())
{
if (Token::Match(tok, ". substr ( %any% , %num% ) ==|!= %str%"))
{
size_t clen = MathLib::toLongNumber(tok->tokAt(5)->str());
size_t slen = Token::getStrLength(tok->tokAt(8));
if (clen != slen)
{
incorrectStringCompareError(tok->next(), "substr", tok->tokAt(8)->str(), tok->tokAt(5)->str());
}
}
if (Token::Match(tok, "%str% ==|!= %var% . substr ( %any% , %num% )"))
{
size_t clen = MathLib::toLongNumber(tok->tokAt(8)->str());
size_t slen = Token::getStrLength(tok);
if (clen != slen)
{
incorrectStringCompareError(tok->next(), "substr", tok->str(), tok->tokAt(8)->str());
}
}
if (Token::Match(tok, "strncmp ( %any% , %str% , %num% )"))
{
size_t clen = MathLib::toLongNumber(tok->tokAt(6)->str());
size_t slen = Token::getStrLength(tok->tokAt(4));
if (clen != slen)
{
incorrectStringCompareError(tok, "strncmp", tok->tokAt(4)->str(), tok->tokAt(6)->str());
}
}
}
}
void CheckOther::cstyleCastError(const Token *tok) void CheckOther::cstyleCastError(const Token *tok)
{ {
reportError(tok, Severity::style, "cstyleCast", "C-style pointer casting"); reportError(tok, Severity::style, "cstyleCast", "C-style pointer casting");
@ -2935,3 +2969,8 @@ void CheckOther::memsetZeroBytesError(const Token *tok, const std::string &varna
const std::string verbose(summary + ". Second and third arguments might be inverted."); const std::string verbose(summary + ". Second and third arguments might be inverted.");
reportError(tok, Severity::warning, "memsetZeroBytes", summary + "\n" + verbose); reportError(tok, Severity::warning, "memsetZeroBytes", summary + "\n" + verbose);
} }
void CheckOther::incorrectStringCompareError(const Token *tok, const std::string& func, const std::string &string, const std::string &len)
{
reportError(tok, Severity::warning, "incorrectStringCompare", "String literal " + string + " doesn't match length argument for " + func + "(" + len + ").");
}

View File

@ -87,6 +87,7 @@ public:
checkOther.checkMisusedScopedObject(); checkOther.checkMisusedScopedObject();
checkOther.checkCatchExceptionByValue(); checkOther.checkCatchExceptionByValue();
checkOther.checkMemsetZeroBytes(); checkOther.checkMemsetZeroBytes();
checkOther.checkIncorrectStringCompare();
} }
/** @brief Clarify calculation for ".. a * b ? .." */ /** @brief Clarify calculation for ".. a * b ? .." */
@ -180,6 +181,9 @@ public:
/** @brief %Check for using sizeof with array given as function argument */ /** @brief %Check for using sizeof with array given as function argument */
void checkSizeofForArrayParameter(); void checkSizeofForArrayParameter();
/** @brief %Check for using bad usage of strncmp and substr */
void checkIncorrectStringCompare();
// Error messages.. // Error messages..
void cstyleCastError(const Token *tok); void cstyleCastError(const Token *tok);
void dangerousUsageStrtolError(const Token *tok); void dangerousUsageStrtolError(const Token *tok);
@ -204,6 +208,7 @@ public:
void catchExceptionByValueError(const Token *tok); void catchExceptionByValueError(const Token *tok);
void memsetZeroBytesError(const Token *tok, const std::string &varname); void memsetZeroBytesError(const Token *tok, const std::string &varname);
void sizeofForArrayParameterError(const Token *tok); void sizeofForArrayParameterError(const Token *tok);
void incorrectStringCompareError(const Token *tok, const std::string& func, const std::string &string, const std::string &len);
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings)
{ {
@ -243,6 +248,7 @@ public:
c.catchExceptionByValueError(0); c.catchExceptionByValueError(0);
c.memsetZeroBytesError(0, "varname"); c.memsetZeroBytesError(0, "varname");
c.clarifyCalculationError(0); c.clarifyCalculationError(0);
c.incorrectStringCompareError(0, "substr", "\"Hello World\"", "12");
} }
std::string myName() const std::string myName() const
@ -261,6 +267,7 @@ public:
"* scoped object destroyed immediately after construction\n" "* scoped object destroyed immediately after construction\n"
"* assignment in an assert statement\n" "* assignment in an assert statement\n"
"* sizeof for array given as function argument\n" "* sizeof for array given as function argument\n"
"* incorrect length arguments for 'substr' and 'strncmp'\n"
// style // style
"* C-style pointer cast in cpp file\n" "* C-style pointer cast in cpp file\n"

View File

@ -73,7 +73,7 @@ void CppCheck::clearFiles()
const char * CppCheck::version() const char * CppCheck::version()
{ {
return "1.46"; return "1.47";
} }
unsigned int CppCheck::check() unsigned int CppCheck::check()

View File

@ -908,6 +908,8 @@ std::list<std::string> Preprocessor::getcfgs(const std::string &filedata, const
def += ";"; def += ";";
def += *it; def += *it;
} }
/* TODO: Fix TestPreprocessor::test7e (#2552)
else else
{ {
std::ostringstream lineStream; std::ostringstream lineStream;
@ -918,11 +920,12 @@ std::list<std::string> Preprocessor::getcfgs(const std::string &filedata, const
loc.setfile(filename); loc.setfile(filename);
loc.line = linenr; loc.line = linenr;
errmsg._callStack.push_back(loc); errmsg._callStack.push_back(loc);
errmsg._severity = Severity::fromString("error"); errmsg._severity = Severity::error;
errmsg.setmsg(*it+" is already guaranteed to be defined"); errmsg.setmsg(*it+" is already guaranteed to be defined");
errmsg._id = "preprocessor" + lineStream.str(); errmsg._id = "preprocessor" + lineStream.str();
_errorLogger->reportErr(errmsg); _errorLogger->reportErr(errmsg);
} }
*/
} }
if (from_negation) if (from_negation)
{ {

View File

@ -213,7 +213,7 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
function.isConst = true; function.isConst = true;
// pure virtual function // pure virtual function
if (Token::Match(end, ") const| = 0 ;")) if (Token::Match(end, ") const| = %any% ;"))
function.isPure = true; function.isPure = true;
// count the number of constructors // count the number of constructors
@ -227,7 +227,7 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
// out of line function // out of line function
if (Token::Match(end, ") const| ;") || if (Token::Match(end, ") const| ;") ||
Token::Match(end, ") const| = 0 ;")) Token::Match(end, ") const| = %any% ;"))
{ {
// find the function implementation later // find the function implementation later
tok = end->next(); tok = end->next();

View File

@ -2071,7 +2071,8 @@ bool Tokenizer::tokenize(std::istream &code,
// Replace NULL with 0.. // Replace NULL with 0..
for (Token *tok = _tokens; tok; tok = tok->next()) for (Token *tok = _tokens; tok; tok = tok->next())
{ {
if (tok->str() == "NULL" || tok->str() == "'\\0'" || tok->str() == "'\\x0'") if (tok->str() == "NULL" || tok->str() == "__null" ||
tok->str() == "'\\0'" || tok->str() == "'\\x0'")
{ {
tok->str("0"); tok->str("0");
} }
@ -3807,6 +3808,8 @@ void Tokenizer::simplifySizeof()
{ {
if (Token::Match(tok, "class|struct %var%")) if (Token::Match(tok, "class|struct %var%"))
{ {
// we assume that the size of structs and classes are always
// 100 bytes.
_typeSize[tok->strAt(1)] = 100; _typeSize[tok->strAt(1)] = 100;
} }
} }

View File

@ -102,28 +102,30 @@ man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>&dhpackage;</command> <command>&dhpackage;</command>
<arg choice="opt"><option>--append=[file]</option></arg> <arg choice="opt"><option>--append=&lt;file&gt;</option></arg>
<arg choice="opt"><option>-D[id]</option></arg> <arg choice="opt"><option>-D&lt;id&gt;</option></arg>
<arg choice="opt"><option>--enable=[id]</option></arg> <arg choice="opt"><option>--enable=&lt;id&gt;</option></arg>
<arg choice="opt"><option>--error-exitcode=[n]</option></arg> <arg choice="opt"><option>--error-exitcode=&lt;n&gt;</option></arg>
<arg choice="opt"><option>--errorlist</option></arg> <arg choice="opt"><option>--errorlist</option></arg>
<arg choice="opt"><option>--exitcode-suppressions=[file]</option></arg> <arg choice="opt"><option>--exitcode-suppressions=&lt;file&gt;</option></arg>
<arg choice="opt"><option>--file-list=file</option></arg> <arg choice="opt"><option>--file-list=&lt;file&gt;</option></arg>
<arg choice="opt"><option>--force</option></arg> <arg choice="opt"><option>--force</option></arg>
<arg choice="opt"><option>--help</option></arg> <arg choice="opt"><option>--help</option></arg>
<arg choice="opt"><option>-I[dir]</option></arg> <arg choice="opt"><option>-I&lt;dir&gt;</option></arg>
<arg choice="opt"><option>-i[dir]</option></arg> <arg choice="opt"><option>-i&lt;dir&gt;</option></arg>
<arg choice="opt"><option>--inline-suppr</option></arg> <arg choice="opt"><option>--inline-suppr</option></arg>
<arg choice="opt"><option>-j[jobs]</option></arg> <arg choice="opt"><option>-j&lt;jobs&gt;</option></arg>
<arg choice="opt"><option>--quiet</option></arg> <arg choice="opt"><option>--quiet</option></arg>
<arg choice="opt"><option>--report-progress</option></arg> <arg choice="opt"><option>--report-progress</option></arg>
<arg choice="opt"><option>--rule=&lt;rule&gt;</option></arg>
<arg choice="opt"><option>--rule-file=&lt;file&gt;</option></arg>
<arg choice="opt"><option>--style</option></arg> <arg choice="opt"><option>--style</option></arg>
<arg choice="opt"><option>--suppressions-list=[file]</option></arg> <arg choice="opt"><option>--suppressions-list=&lt;file&gt;</option></arg>
<arg choice="opt"><option>--template '[text]'</option></arg> <arg choice="opt"><option>--template '&lt;text&gt;'</option></arg>
<arg choice="opt"><option>--verbose</option></arg> <arg choice="opt"><option>--verbose</option></arg>
<arg choice="opt"><option>--version</option></arg> <arg choice="opt"><option>--version</option></arg>
<arg choice="opt"><option>--xml</option></arg> <arg choice="opt"><option>--xml</option></arg>
<arg choice="opt"><option>--xml-version=[version]</option></arg> <arg choice="opt"><option>--xml-version=&lt;version&gt;]</option></arg>
<arg choice="opt"><option>file or path</option></arg> <arg choice="opt"><option>file or path</option></arg>
<arg choice="plain"><option>...</option></arg> <arg choice="plain"><option>...</option></arg>
</cmdsynopsis> </cmdsynopsis>
@ -146,20 +148,20 @@ man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/
variablelist.term.break.after parameters to variablelist.term.break.after parameters to
control the term elements. --> control the term elements. -->
<varlistentry> <varlistentry>
<term><option>--append=[file]</option></term> <term><option>--append=&lt;file&gt;</option></term>
<listitem> <listitem>
<para>This allows you to provide information about functions by providing an implementation for these.</para> <para>This allows you to provide information about functions by providing an implementation for these.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-D[id]</option></term> <term><option>-D&lt;id&gt;</option></term>
<listitem> <listitem>
<para>By default Cppcheck checks all configurations. Use -D to limit the checking. When -D is used the checking is limited to the given configuration. <para>By default Cppcheck checks all configurations. Use -D to limit the checking. When -D is used the checking is limited to the given configuration.
Example: -DDEBUG=1 -D__cplusplus</para> Example: -DDEBUG=1 -D__cplusplus</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>--enable=[id]</option></term> <term><option>--enable=&lt;id&gt;</option></term>
<listitem> <listitem>
<para>Enable additional checks. The available ids are: <para>Enable additional checks. The available ids are:
<glosslist> <glosslist>
@ -199,9 +201,9 @@ Example: -DDEBUG=1 -D__cplusplus</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>--error-exitcode=[n]</option></term> <term><option>--error-exitcode=&lt;n&gt;</option></term>
<listitem> <listitem>
<para>If errors are found, integer [n] is returned instead of default 0. <para>If errors are found, integer &lt;n&gt; is returned instead of default 0.
EXIT_FAILURE is returned if arguments are not valid or if no input files are EXIT_FAILURE is returned if arguments are not valid or if no input files are
provided. Note that your operating system can modify this value, e.g. provided. Note that your operating system can modify this value, e.g.
256 can become 0.</para> 256 can become 0.</para>
@ -214,13 +216,13 @@ Example: -DDEBUG=1 -D__cplusplus</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>--exitcode-suppressions=[file]</option></term> <term><option>--exitcode-suppressions=&lt;file&gt;</option></term>
<listitem> <listitem>
<para>Used when certain messages should be displayed but should not cause a non-zero exitcode.</para> <para>Used when certain messages should be displayed but should not cause a non-zero exitcode.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>--file-list=[file]</option></term> <term><option>--file-list=&lt;file&gt;</option></term>
<listitem> <listitem>
<para>Specify the files to check in a text file. One filename per line.</para> <para>Specify the files to check in a text file. One filename per line.</para>
</listitem> </listitem>
@ -241,7 +243,7 @@ default.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-I [dir]</option></term> <term><option>-I &lt;dir&gt;</option></term>
<listitem> <listitem>
<para>Give include path. Give several -I parameters to give several paths. First given path is checked first. If paths are relative to source <para>Give include path. Give several -I parameters to give several paths. First given path is checked first. If paths are relative to source
files, this is not needed.</para> files, this is not needed.</para>
@ -249,7 +251,7 @@ files, this is not needed.</para>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-i [dir]</option></term> <term><option>-i &lt;dir&gt;</option></term>
<listitem> <listitem>
<para>Give path to ignore. Give several -i parameters to ignore several paths. Give directory name or filename with path as parameter. <para>Give path to ignore. Give several -i parameters to ignore several paths. Give directory name or filename with path as parameter.
Directory name is matched to all parts of the path.</para> Directory name is matched to all parts of the path.</para>
@ -264,9 +266,9 @@ Directory name is matched to all parts of the path.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-j [jobs]</option></term> <term><option>-j &lt;jobs&gt;</option></term>
<listitem> <listitem>
<para>Start [jobs] threads to do the checking work.</para> <para>Start &lt;jobs&gt; threads to do the checking work.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
@ -282,6 +284,18 @@ Directory name is matched to all parts of the path.</para>
<para>Report progress when checking a file.</para> <para>Report progress when checking a file.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><option>--rule=&lt;rule&gt;</option></term>
<listitem>
<para>Match regular expression to create your own checks. E.g. rule &quot;/ 0&quot; can be used to check division by zero.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--rule-file=&lt;file&gt;</option></term>
<listitem>
<para>Use given rule XML file. See https://sourceforge.net/projects/cppcheck/files/Articles/ for more info about the syntax.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><option>-s</option></term> <term><option>-s</option></term>
<term><option>--style</option></term> <term><option>--style</option></term>
@ -290,14 +304,14 @@ Directory name is matched to all parts of the path.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>--suppressions-list=[file]</option></term> <term><option>--suppressions-list=&lt;file&gt;</option></term>
<listitem> <listitem>
<para>Suppress warnings listed in the file. Filename and line are optional. The format of the single line in file is: [error id]:[filename]:[line]. <para>Suppress warnings listed in the file. Filename and line are optional. The format of the single line in file is: [error id]:[filename]:[line].
You can use --template or --xml to see the error id.</para> You can use --template or --xml to see the error id.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>--template '[text]'</option></term> <term><option>--template '&lt;text&gt;'</option></term>
<listitem> <listitem>
<para>Format the error messages. E.g. '{file}:{line},{severity},{id},{message}' or '{file}({line}):({severity}) {message}'. Pre-defined templates: gcc, vs</para> <para>Format the error messages. E.g. '{file}:{line},{severity},{id},{message}' or '{file}({line}):({severity}) {message}'. Pre-defined templates: gcc, vs</para>
</listitem> </listitem>
@ -322,7 +336,7 @@ Directory name is matched to all parts of the path.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>--xml-version=[version]</option></term> <term><option>--xml-version=&lt;version&gt;</option></term>
<listitem> <listitem>
<para>Select the XML file version. Currently versions 1 and 2 are available. The default version is 1.</para> <para>Select the XML file version. Currently versions 1 and 2 are available. The default version is 1.</para>
</listitem> </listitem>

View File

@ -3,9 +3,9 @@
"/usr/share/xml/docbook/schema/dtd/4.4/docbookx.dtd"> "/usr/share/xml/docbook/schema/dtd/4.4/docbookx.dtd">
<book> <book>
<bookinfo> <bookinfo>
<title>Cppcheck 1.46</title> <title>Cppcheck 1.47</title>
<date>2010-12-09</date> <date>2011-02-06</date>
</bookinfo> </bookinfo>
<chapter> <chapter>
@ -94,19 +94,20 @@ Checking path/file2.cpp...
<section> <section>
<title>Excluding a file or folder from checking</title> <title>Excluding a file or folder from checking</title>
<para>There is no command to exclude a file or folder from checking. But <para>To exclude a file or folder, there are two options.</para>
you can exclude a file or folder by being more careful when including
files and folders in the checking.</para>
<para>Imagine for example that the folder "src" contain the folders "a", <para>The first option is to only provide the paths and files you want
"b" and "c". To exclude "c" this command can be used:</para> to check.</para>
<programlisting>cppcheck src/a src/b</programlisting> <programlisting>cppcheck src/a src/b</programlisting>
<para>All files under "src/a" and "src/b" are then checked.</para> <para>All files under "src/a" and "src/b" are then checked.</para>
<para>The flag <literal>--file-list</literal> might also be <para>The second option is to use <literal>-i</literal>, with it you
useful.</para> specify files/paths to ignore. With this command no files in "src/c" are
checked:</para>
<programlisting>cppcheck -isrc/c src</programlisting>
</section> </section>
<section> <section>
@ -148,6 +149,15 @@ Checking path/file2.cpp...
<para>suggestions for making the code faster</para> <para>suggestions for making the code faster</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>information</term>
<listitem>
<para>Informational messages that might be interesting. Ignore
these messages unless you really agree.</para>
</listitem>
</varlistentry>
</variablelist> </variablelist>
<remark>The performance messages are based on 'common knowledge'. It is <remark>The performance messages are based on 'common knowledge'. It is

View File

@ -16,10 +16,13 @@ Compiling
Any C++ compiler should work. Any C++ compiler should work.
To build the GUI, you need Qt. The command line tool doesn't have any dependencies. To build the GUI, you need Qt.
To build the command line tool, PCRE is needed. More information about PCRE is found in
build.txt
There are multiple compilation choices: There are multiple compilation choices:
* qmake - cross platform build tool - but only the GUI can be built * qmake - cross platform build tool
* Visual Studio - Windows * Visual Studio - Windows
* gnu make * gnu make
* g++ * g++

35
scripts/tabs.pl Executable file
View File

@ -0,0 +1,35 @@
#!/usr/bin/perl
# warn if there are tabs in string constants, it can have surprising effects.
# example usage:
# scripts/tabs.pl lib/checkstl.cpp
sub checkfile
{
my $filename = $_[0];
# parse file
open(FILE, $filename);
my @lines = <FILE>;
close(FILE);
# check comments..
my $linenr = 0;
foreach $line (@lines)
{
$linenr = $linenr + 1;
# is there a tab in a string
if ($line =~ /".*\t.*"/)
{
print "[$filename:$linenr] tab inside string constant\n";
}
}
}
foreach $filename (@ARGV)
{
checkfile($filename)
}

View File

@ -65,9 +65,12 @@ private:
void run() void run()
{ {
TEST_CASE(testautovar); TEST_CASE(testautovar1);
TEST_CASE(testautovar_array); TEST_CASE(testautovar2);
TEST_CASE(testautovar_return); TEST_CASE(testautovar_array1);
TEST_CASE(testautovar_array2);
TEST_CASE(testautovar_return1);
TEST_CASE(testautovar_return2);
TEST_CASE(testautovar_extern); TEST_CASE(testautovar_extern);
TEST_CASE(testinvaliddealloc); TEST_CASE(testinvaliddealloc);
TEST_CASE(testassign); // Ticket #1819 TEST_CASE(testassign); // Ticket #1819
@ -76,15 +79,17 @@ private:
TEST_CASE(returnLocalVariable2); TEST_CASE(returnLocalVariable2);
// return reference.. // return reference..
TEST_CASE(returnReference); TEST_CASE(returnReference1);
TEST_CASE(returnReference2);
// return c_str().. // return c_str()..
TEST_CASE(returncstr); TEST_CASE(returncstr1);
TEST_CASE(returncstr2);
} }
void testautovar() void testautovar1()
{ {
check("void func1(int **res)\n" check("void func1(int **res)\n"
"{\n" "{\n"
@ -101,7 +106,30 @@ private:
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
} }
void testautovar_array() void testautovar2()
{
check("class Fred {\n"
" void func1(int **res);\n"
"}\n"
"void Fred::func1(int **res)\n"
"{\n"
" int num = 2;\n"
" *res = &num;\n"
"}");
ASSERT_EQUALS("[test.cpp:6]: (error) Assigning address of local auto-variable to a function parameter.\n", errout.str());
check("class Fred {\n"
" void func1(int **res);\n"
"}\n"
"void Fred::func1(int **res)\n"
"{\n"
" int num = 2;\n"
" foo.res = &num;\n"
"}");
ASSERT_EQUALS("", errout.str());
}
void testautovar_array1()
{ {
check("void func1(int* arr[2])\n" check("void func1(int* arr[2])\n"
"{\n" "{\n"
@ -111,15 +139,42 @@ private:
ASSERT_EQUALS("[test.cpp:3]: (error) Assigning address of local auto-variable to a function parameter.\n", errout.str()); ASSERT_EQUALS("[test.cpp:3]: (error) Assigning address of local auto-variable to a function parameter.\n", errout.str());
} }
void testautovar_return() void testautovar_array2()
{
check("class Fred {\n"
" void func1(int* arr[2]);\n"
"}\n"
"void Fred::func1(int* arr[2])\n"
"{\n"
" int num=2;"
" arr[0]=&num;\n"
"}");
ASSERT_EQUALS("[test.cpp:6]: (error) Assigning address of local auto-variable to a function parameter.\n", errout.str());
}
void testautovar_return1()
{ {
check("int* func1()\n" check("int* func1()\n"
"{\n" "{\n"
" int num=2;" " int num=2;"
"return &num;}"); " return &num;"
"}");
ASSERT_EQUALS("[test.cpp:3]: (error) Return of the address of an auto-variable\n", errout.str()); ASSERT_EQUALS("[test.cpp:3]: (error) Return of the address of an auto-variable\n", errout.str());
} }
void testautovar_return2()
{
check("class Fred {\n"
" int* func1()\n"
"}\n"
"int* Fred::func1()\n"
"{\n"
" int num=2;"
" return &num;"
"}");
ASSERT_EQUALS("[test.cpp:6]: (error) Return of the address of an auto-variable\n", errout.str());
}
void testautovar_extern() void testautovar_extern()
{ {
check("struct foo *f()\n" check("struct foo *f()\n"
@ -169,6 +224,16 @@ private:
" return str;\n" " return str;\n"
"}\n"); "}\n");
ASSERT_EQUALS("[test.cpp:4]: (error) Returning pointer to local array variable\n", errout.str()); ASSERT_EQUALS("[test.cpp:4]: (error) Returning pointer to local array variable\n", errout.str());
check("class Fred {\n"
" char *foo();\n"
"};\n"
"char *Fred::foo()\n"
"{\n"
" char str[100] = {0};\n"
" return str;\n"
"}\n");
ASSERT_EQUALS("[test.cpp:7]: (error) Returning pointer to local array variable\n", errout.str());
} }
void returnLocalVariable2() void returnLocalVariable2()
@ -179,9 +244,19 @@ private:
" return str;\n" " return str;\n"
"}\n"); "}\n");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
check("class Fred {\n"
" std::string foo();\n"
"};\n"
"std::string Fred::foo()\n"
"{\n"
" char str[100] = {0};\n"
" return str;\n"
"}\n");
ASSERT_EQUALS("", errout.str());
} }
void returnReference() void returnReference1()
{ {
check("std::string &foo()\n" check("std::string &foo()\n"
"{\n" "{\n"
@ -216,7 +291,67 @@ private:
ASSERT_EQUALS("[test.cpp:8]: (error) Returning reference to temporary\n", errout.str()); ASSERT_EQUALS("[test.cpp:8]: (error) Returning reference to temporary\n", errout.str());
} }
void returncstr() void returnReference2()
{
check("class Fred {\n"
" std::string &foo();\n"
"}\n"
"std::string &Fred::foo()\n"
"{\n"
" std::string s;\n"
" return s;\n"
"}\n");
ASSERT_EQUALS("[test.cpp:7]: (error) Returning reference to auto variable\n", errout.str());
check("class Fred {\n"
" std::vector<int> &foo();\n"
"};\n"
"std::vector<int> &Fred::foo()\n"
"{\n"
" std::vector<int> v;\n"
" return v;\n"
"}\n");
ASSERT_EQUALS("[test.cpp:7]: (error) Returning reference to auto variable\n", errout.str());
check("class Fred {\n"
" std::vector<int> &foo();\n"
"};\n"
"std::vector<int> &Fred::foo()\n"
"{\n"
" static std::vector<int> v;\n"
" return v;\n"
"}\n");
ASSERT_EQUALS("", errout.str());
check("class Fred {\n"
" std::string &f();\n"
"};\n"
"std::string hello()\n"
"{\n"
" return \"hello\";\n"
"}\n"
"std::string &Fred::f()\n"
"{\n"
" return hello();\n"
"}\n");
ASSERT_EQUALS("[test.cpp:10]: (error) Returning reference to temporary\n", errout.str());
check("class Fred {\n"
" std::string hello();\n"
" std::string &f();\n"
"};\n"
"std::string Fred::hello()\n"
"{\n"
" return \"hello\";\n"
"}\n"
"std::string &Fred::f()\n"
"{\n"
" return hello();\n"
"}\n");
ASSERT_EQUALS("[test.cpp:11]: (error) Returning reference to temporary\n", errout.str());
}
void returncstr1()
{ {
check("const char *foo()\n" check("const char *foo()\n"
"{\n" "{\n"
@ -244,6 +379,43 @@ private:
ASSERT_EQUALS("[test.cpp:8]: (error) Returning pointer to temporary\n", errout.str()); ASSERT_EQUALS("[test.cpp:8]: (error) Returning pointer to temporary\n", errout.str());
} }
void returncstr2()
{
check("class Fred {\n"
" const char *foo();\n"
"};\n"
"const char *Fred::foo()\n"
"{\n"
" std::string s;\n"
" return s.c_str();\n"
"}\n");
ASSERT_EQUALS("[test.cpp:7]: (error) Returning pointer to auto variable\n", errout.str());
check("class Fred {\n"
" const char *foo();\n"
"};\n"
"const char *Foo::f()\n"
"{\n"
" std::string s;\n"
" return s.c_str();\n"
"}\n");
ASSERT_EQUALS("[test.cpp:7]: (error) Returning pointer to auto variable\n", errout.str());
check("class Fred {\n"
" std::string hello();\n"
" const char *f();\n"
"};\n"
"std::string Fred::hello()\n"
"{\n"
" return \"hello\";\n"
"}\n"
"const char *Fred::f()\n"
"{\n"
" return hello().c_str();\n"
"}\n");
ASSERT_EQUALS("[test.cpp:11]: (error) Returning pointer to temporary\n", errout.str());
}
}; };
REGISTER_TEST(TestAutoVariables) REGISTER_TEST(TestAutoVariables)

View File

@ -190,6 +190,7 @@ private:
TEST_CASE(symboldatabase9); // ticket #2525 TEST_CASE(symboldatabase9); // ticket #2525
TEST_CASE(symboldatabase10); // ticket #2537 TEST_CASE(symboldatabase10); // ticket #2537
TEST_CASE(symboldatabase11); // ticket #2539 TEST_CASE(symboldatabase11); // ticket #2539
TEST_CASE(symboldatabase12); // ticket #2547
} }
// Check the operator Equal // Check the operator Equal
@ -487,11 +488,11 @@ private:
" UString& operator=( const UString& s );\n" " UString& operator=( const UString& s );\n"
"};\n" "};\n"
"UString& UString::assign( const char* c_str ) {\n" "UString& UString::assign( const char* c_str ) {\n"
" std::string tmp( c_str );\n" " std::string tmp( c_str );\n"
" return assign( tmp );\n" " return assign( tmp );\n"
"}\n" "}\n"
"UString& UString::operator=( const UString& s ) {\n" "UString& UString::operator=( const UString& s ) {\n"
" return assign( s );\n" " return assign( s );\n"
"}\n"); "}\n");
} }
@ -2722,7 +2723,7 @@ private:
" A()\n" " A()\n"
" {\n" " {\n"
" init();\n" " init();\n"
" }\n" " }\n"
"\n" "\n"
" void init() { init(0); }\n" " void init() { init(0); }\n"
"\n" "\n"
@ -5451,12 +5452,12 @@ private:
checkConst("template<template<class> class E,class D> class C : E<D>\n" checkConst("template<template<class> class E,class D> class C : E<D>\n"
"{\n" "{\n"
"public:\n" "public:\n"
" int f();\n" " int f();\n"
"};\n" "};\n"
"class E : C<D,int>\n" "class E : C<D,int>\n"
"{\n" "{\n"
"public:\n" "public:\n"
" int f() { return C< ::D,int>::f(); }\n" " int f() { return C< ::D,int>::f(); }\n"
"};\n"); "};\n");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
@ -5517,6 +5518,16 @@ private:
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
} }
void symboldatabase12()
{
// ticket #2547 - segmentation fault
checkConst("class foo {\n"
" void bar2 () = __null;\n"
"};\n");
ASSERT_EQUALS("", errout.str());
}
}; };
REGISTER_TEST(TestClass) REGISTER_TEST(TestClass)

View File

@ -37,6 +37,9 @@ private:
TEST_CASE(destructors); TEST_CASE(destructors);
TEST_CASE(deallocThrow1); TEST_CASE(deallocThrow1);
TEST_CASE(deallocThrow2); TEST_CASE(deallocThrow2);
TEST_CASE(rethrowCopy1);
TEST_CASE(rethrowCopy2);
TEST_CASE(rethrowCopy3);
} }
void check(const std::string &code) void check(const std::string &code)
@ -90,6 +93,52 @@ private:
"}\n"); "}\n");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
} }
void rethrowCopy1()
{
check("void f() {\n"
" try\n"
" {\n"
" foo();\n"
" }\n"
" catch(const exception& err)\n"
" {\n"
" throw err;\n"
" }\n"
"}\n");
ASSERT_EQUALS("[test.cpp:8]: (style) Throwing a copy of the caught exception instead of rethrowing the original exception\n", errout.str());
}
void rethrowCopy2()
{
check("void f() {\n"
" try\n"
" {\n"
" foo();\n"
" }\n"
" catch(exception err)\n"
" {\n"
" throw err;\n"
" }\n"
"}\n");
ASSERT_EQUALS("[test.cpp:8]: (style) Throwing a copy of the caught exception instead of rethrowing the original exception\n", errout.str());
}
void rethrowCopy3()
{
check("void f() {\n"
" try\n"
" {\n"
" foo();\n"
" }\n"
" catch(exception err)\n"
" {\n"
" exception err2;\n"
" throw err2;\n"
" }\n"
"}\n");
ASSERT_EQUALS("", errout.str());
}
}; };
REGISTER_TEST(TestExceptionSafety) REGISTER_TEST(TestExceptionSafety)

View File

@ -66,20 +66,20 @@ private:
ASSERT_EQUALS("3000" , MathLib::multiply("1.0E3", "3")); ASSERT_EQUALS("3000" , MathLib::multiply("1.0E3", "3"));
ASSERT_EQUALS("-3000" , MathLib::multiply("-1.0E3", "3")); ASSERT_EQUALS("-3000" , MathLib::multiply("-1.0E3", "3"));
ASSERT_EQUALS("-3000" , MathLib::multiply("-1.0E+3", "3")); ASSERT_EQUALS("-3000" , MathLib::multiply("-1.0E+3", "3"));
ASSERT_EQUALS("0" , MathLib::multiply("-1.0E+3", "0")); ASSERT_EQUALS("0" , MathLib::multiply("-1.0E+3", "0"));
ASSERT_EQUALS("0" , MathLib::multiply("+1.0E+3", "0")); ASSERT_EQUALS("0" , MathLib::multiply("+1.0E+3", "0"));
ASSERT_EQUALS("2147483648" , MathLib::multiply("2","1073741824")); ASSERT_EQUALS("2147483648" , MathLib::multiply("2","1073741824"));
ASSERT_EQUALS("536870912" , MathLib::multiply("512","1048576")); ASSERT_EQUALS("536870912" , MathLib::multiply("512","1048576"));
// divide // divide
ASSERT_EQUALS("1" , MathLib::divide("1", "1")); ASSERT_EQUALS("1" , MathLib::divide("1", "1"));
ASSERT_EQUALS("0" , MathLib::divide("0", "1")); ASSERT_EQUALS("0" , MathLib::divide("0", "1"));
ASSERT_EQUALS("5" , MathLib::divide("-10", "-2")); ASSERT_EQUALS("5" , MathLib::divide("-10", "-2"));
ASSERT_EQUALS("-2.5", MathLib::divide("-10.", "4")); ASSERT_EQUALS("-2.5", MathLib::divide("-10.", "4"));
ASSERT_EQUALS("2.5" , MathLib::divide("-10.", "-4")); ASSERT_EQUALS("2.5" , MathLib::divide("-10.", "-4"));
ASSERT_EQUALS("5" , MathLib::divide("25.5", "5.1")); ASSERT_EQUALS("5" , MathLib::divide("25.5", "5.1"));
ASSERT_EQUALS("7" , MathLib::divide("21.", "3")); ASSERT_EQUALS("7" , MathLib::divide("21.", "3"));
ASSERT_EQUALS("1" , MathLib::divide("3", "2")); ASSERT_EQUALS("1" , MathLib::divide("3", "2"));
} }

View File

@ -197,6 +197,7 @@ private:
TEST_CASE(switch2); TEST_CASE(switch2);
TEST_CASE(switch3); TEST_CASE(switch3);
TEST_CASE(switch4); // #2555 - segfault
TEST_CASE(ret5); // Bug 2458436 - return use TEST_CASE(ret5); // Bug 2458436 - return use
TEST_CASE(ret6); TEST_CASE(ret6);
@ -1287,6 +1288,17 @@ private:
ASSERT_EQUALS("[test.cpp:9]: (error) Memory leak: str\n", errout.str()); ASSERT_EQUALS("[test.cpp:9]: (error) Memory leak: str\n", errout.str());
} }
void switch4()
{
check("void f() {\n"
" switch MAKEWORD(1)\n"
" {\n"
" case 0:\n"
" return;\n"
" }\n"
"}\n");
ASSERT_EQUALS("", errout.str());
}
void ret5() void ret5()
{ {

View File

@ -668,7 +668,7 @@ private:
check("void f(int a) {\n" check("void f(int a) {\n"
" const char *p = 0;\n" " const char *p = 0;\n"
" if (a) {\n" " if (a) {\n"
" p = \"abcd\";\n" " p = \"abcd\";\n"
" }\n" " }\n"
" for (int i = 0; i < 3; i++) {\n" " for (int i = 0; i < 3; i++) {\n"
" if (a && (p[i] == '1'));\n" " if (a && (p[i] == '1'));\n"

View File

@ -102,6 +102,8 @@ private:
TEST_CASE(sizeofForArrayParameter); TEST_CASE(sizeofForArrayParameter);
TEST_CASE(clarifyCalculation); TEST_CASE(clarifyCalculation);
TEST_CASE(incorrectStringCompare);
} }
void check(const char code[], const char *filename = NULL) void check(const char code[], const char *filename = NULL)
@ -138,6 +140,7 @@ private:
checkOther.checkCatchExceptionByValue(); checkOther.checkCatchExceptionByValue();
checkOther.checkMemsetZeroBytes(); checkOther.checkMemsetZeroBytes();
checkOther.clarifyCalculation(); checkOther.clarifyCalculation();
checkOther.checkIncorrectStringCompare();
} }
@ -1856,6 +1859,39 @@ private:
ASSERT_EQUALS("[test.cpp:2]: (information) Please clarify precedence: 'a*b?..'\n", errout.str()); ASSERT_EQUALS("[test.cpp:2]: (information) Please clarify precedence: 'a*b?..'\n", errout.str());
} }
void incorrectStringCompare()
{
check("int f() {\n"
" return test.substr( 0 , 4 ) == \"Hello\" ? : 0 : 1 ;\n"
"}");
ASSERT_EQUALS("[test.cpp:2]: (warning) String literal \"Hello\" doesn't match length argument for substr(4).\n", errout.str());
check("int f() {\n"
" return test.substr( 0 , 5 ) == \"Hello\" ? : 0 : 1 ;\n"
"}");
ASSERT_EQUALS("", errout.str());
check("int f() {\n"
" return \"Hello\" == test.substr( 0 , 4 ) ? : 0 : 1 ;\n"
"}");
ASSERT_EQUALS("[test.cpp:2]: (warning) String literal \"Hello\" doesn't match length argument for substr(4).\n", errout.str());
check("int f() {\n"
" return \"Hello\" == test.substr( 0 , 5 ) ? : 0 : 1 ;\n"
"}");
ASSERT_EQUALS("", errout.str());
check("int f() {\n"
" return strncmp(\"test\" , \"test\" , 2) ; \n"
"}");
ASSERT_EQUALS("[test.cpp:2]: (warning) String literal \"test\" doesn't match length argument for strncmp(2).\n", errout.str());
check("int f() {\n"
" return strncmp(\"test\" , \"test\" , 4) ; \n"
"}");
ASSERT_EQUALS("", errout.str());
}
}; };
REGISTER_TEST(TestOther) REGISTER_TEST(TestOther)

View File

@ -78,6 +78,11 @@ private:
TEST_CASE(test5); TEST_CASE(test5);
TEST_CASE(test6); TEST_CASE(test6);
TEST_CASE(test7); TEST_CASE(test7);
TEST_CASE(test7a);
TEST_CASE(test7b);
TEST_CASE(test7c);
TEST_CASE(test7d);
TEST_CASE(test7e);
// #error => don't extract any code // #error => don't extract any code
TEST_CASE(error1); TEST_CASE(error1);
@ -429,8 +434,9 @@ private:
preprocessor.preprocess(istr, actual, "file.c"); preprocessor.preprocess(istr, actual, "file.c");
// Make sure an error message is written.. // Make sure an error message is written..
ASSERT_EQUALS("[file.c:3]: (error) ABC is already guaranteed to be defined\n", TODO_ASSERT_EQUALS("[file.c:3]: (error) ABC is already guaranteed to be defined\n",
errout.str()); "",
errout.str());
// Compare results.. // Compare results..
ASSERT_EQUALS("\n\n\n\n\n\n", actual[""]); ASSERT_EQUALS("\n\n\n\n\n\n", actual[""]);
@ -511,8 +517,9 @@ private:
preprocessor.preprocess(istr, actual, "file.c"); preprocessor.preprocess(istr, actual, "file.c");
// Make sure an error message is written.. // Make sure an error message is written..
ASSERT_EQUALS("[file.c:3]: (error) ABC is already guaranteed to be defined\n", TODO_ASSERT_EQUALS("[file.c:3]: (error) ABC is already guaranteed to be defined\n",
errout.str()); "",
errout.str());
// Compare results.. // Compare results..
ASSERT_EQUALS(2, static_cast<unsigned int>(actual.size())); ASSERT_EQUALS(2, static_cast<unsigned int>(actual.size()));
@ -536,7 +543,36 @@ private:
preprocessor.preprocess(istr, actual, "file.c"); preprocessor.preprocess(istr, actual, "file.c");
// Make sure an error message is written.. // Make sure an error message is written..
ASSERT_EQUALS("[file.c:3]: (error) ABC is already guaranteed to be defined\n", TODO_ASSERT_EQUALS("[file.c:3]: (error) ABC is already guaranteed to be defined\n",
"",
errout.str());
// Compare results..
ASSERT_EQUALS(2, static_cast<unsigned int>(actual.size()));
}
void test7e()
{
const char filedata[] = "#ifdef ABC\n"
"#file \"test.h\"\n"
"#ifndef test_h\n"
"#define test_h\n"
"#ifdef ABC\n"
"#endif\n"
"#endif\n"
"#endfile\n"
"#endif\n";
// Preprocess => actual result..
std::istringstream istr(filedata);
std::map<std::string, std::string> actual;
Settings settings;
Preprocessor preprocessor(&settings, this);
errout.str("");
preprocessor.preprocess(istr, actual, "file.c");
// Make sure an error message is written..
ASSERT_EQUALS("",
errout.str()); errout.str());
// Compare results.. // Compare results..

View File

@ -213,6 +213,7 @@ private:
TEST_CASE(simplify_constants); TEST_CASE(simplify_constants);
TEST_CASE(simplify_constants2); TEST_CASE(simplify_constants2);
TEST_CASE(simplify_constants3); TEST_CASE(simplify_constants3);
TEST_CASE(simplify_null);
TEST_CASE(vardecl1); TEST_CASE(vardecl1);
TEST_CASE(vardecl2); TEST_CASE(vardecl2);
@ -3879,6 +3880,16 @@ private:
ASSERT_EQUALS(expected, tokenizeAndStringify(code,true)); ASSERT_EQUALS(expected, tokenizeAndStringify(code,true));
} }
void simplify_null()
{
const char code[] =
"int * p = NULL;\n"
"int * q = __null;\n";
const char expected[] =
"int * p ; p = 0 ;\nint * q ; q = 0 ;";
ASSERT_EQUALS(expected, tokenizeAndStringify(code,true));
}
void vardecl1() void vardecl1()
{ {
const char code[] = "unsigned int a, b;"; const char code[] = "unsigned int a, b;";

View File

@ -736,9 +736,9 @@ private:
checkUninitVar("enum ABCD { A, B, C, D };\n" checkUninitVar("enum ABCD { A, B, C, D };\n"
"\n" "\n"
"static void f(char *str ) {\n" "static void f(char *str ) {\n"
" enum ABCD i;\n" " enum ABCD i;\n"
" for (i = 0; i < D; i++) {\n" " for (i = 0; i < D; i++) {\n"
" str[i] = 0;\n" " str[i] = 0;\n"
" }\n" " }\n"
"}\n"); "}\n");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());

View File

@ -1,138 +0,0 @@
#include "codeeditor.h"
#include <QPainter>
#include <QTextBlock>
CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent)
{
lineNumberArea = new LineNumberArea(this);
connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
connect(this, SIGNAL(updateRequest(const QRect &, int)), this, SLOT(updateLineNumberArea(const QRect &, int)));
//connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine()));
updateLineNumberAreaWidth(0);
//highlightCurrentLine();
}
int CodeEditor::lineNumberAreaWidth()
{
int digits = 1;
int max = qMax(1, blockCount());
while (max >= 10)
{
max /= 10;
++digits;
}
int space = 3 + fontMetrics().width(QLatin1Char('9')) * digits;
return space;
}
void CodeEditor::updateLineNumberAreaWidth(int /* newBlockCount */)
{
setViewportMargins(lineNumberAreaWidth(), 0, 0, 0);
}
void CodeEditor::updateLineNumberArea(const QRect &rect, int dy)
{
if (dy)
lineNumberArea->scroll(0, dy);
else
lineNumberArea->update(0, rect.y(), lineNumberArea->width(), rect.height());
if (rect.contains(viewport()->rect()))
updateLineNumberAreaWidth(0);
}
void CodeEditor::resizeEvent(QResizeEvent *e)
{
QPlainTextEdit::resizeEvent(e);
QRect cr = contentsRect();
lineNumberArea->setGeometry(QRect(cr.left(), cr.top(), lineNumberAreaWidth(), cr.height()));
}
/*
void CodeEditor::highlightCurrentLine()
{
QList<QTextEdit::ExtraSelection> extraSelections;
if (!isReadOnly())
{
QTextEdit::ExtraSelection selection;
QColor lineColor = QColor(Qt::yellow).lighter(160);
selection.format.setBackground(lineColor);
selection.format.setProperty(QTextFormat::FullWidthSelection, true);
selection.cursor = textCursor();
selection.cursor.clearSelection();
extraSelections.append(selection);
}
setExtraSelections(extraSelections);
}
*/
void CodeEditor::highlightErrors(const QList<int> &errorLines)
{
QList<QTextEdit::ExtraSelection> extraSelections;
for (int i = 0; i < errorLines.size(); ++i)
{
QTextEdit::ExtraSelection selection;
QColor lineColor = QColor(Qt::red).lighter(160);
selection.format.setBackground(lineColor);
selection.format.setProperty(QTextFormat::FullWidthSelection, true);
selection.cursor = textCursor();
selection.cursor.clearSelection();
selection.cursor.movePosition(QTextCursor::Start);
selection.cursor.movePosition(QTextCursor::Down, QTextCursor::MoveAnchor, errorLines[i] - 1);
extraSelections.append(selection);
}
setExtraSelections(extraSelections);
}
void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent *event)
{
QPainter painter(lineNumberArea);
painter.fillRect(event->rect(), Qt::lightGray);
QTextBlock block = firstVisibleBlock();
int blockNumber = block.blockNumber();
int top = (int) blockBoundingGeometry(block).translated(contentOffset()).top();
int bottom = top + (int) blockBoundingRect(block).height();
while (block.isValid() && top <= event->rect().bottom())
{
if (block.isVisible() && bottom >= event->rect().top())
{
QString number = QString::number(blockNumber + 1);
painter.setPen(Qt::black);
painter.drawText(0, top, lineNumberArea->width(), fontMetrics().height(),
Qt::AlignRight, number);
}
block = block.next();
top = bottom;
bottom = top + (int) blockBoundingRect(block).height();
++blockNumber;
}
}

View File

@ -1,63 +0,0 @@
#ifndef CODEEDITOR_H
#define CODEEDITOR_H
#include <QPlainTextEdit>
#include <QObject>
#include <QList>
class QPaintEvent;
class QResizeEvent;
class QSize;
class QWidget;
class LineNumberArea;
class CodeEditor : public QPlainTextEdit
{
Q_OBJECT
public:
CodeEditor(QWidget *parent = 0);
void lineNumberAreaPaintEvent(QPaintEvent *event);
int lineNumberAreaWidth();
void highlightErrors(const QList<int> &errorLines);
protected:
void resizeEvent(QResizeEvent *event);
private slots:
void updateLineNumberAreaWidth(int newBlockCount);
//void highlightCurrentLine();
void updateLineNumberArea(const QRect &, int);
private:
QWidget *lineNumberArea;
};
class LineNumberArea : public QWidget
{
public:
LineNumberArea(CodeEditor *editor) : QWidget(editor)
{
codeEditor = editor;
}
QSize sizeHint() const
{
return QSize(codeEditor->lineNumberAreaWidth(), 0);
}
protected:
void paintEvent(QPaintEvent *event)
{
codeEditor->lineNumberAreaPaintEvent(event);
}
private:
CodeEditor *codeEditor;
};
#endif // CODEEDITOR_H

View File

@ -1,29 +0,0 @@
TARGET = cppcheck-verify
TEMPLATE = app
INCLUDEPATH += ../lib
SOURCES += main.cpp \
mainwindow.cpp \
../lib/tokenize.cpp \
../lib/token.cpp \
../lib/settings.cpp \
../lib/preprocessor.cpp \
../lib/path.cpp \
../lib/mathlib.cpp \
../lib/filelister_win32.cpp \
../lib/filelister_unix.cpp \
../lib/filelister.cpp \
../lib/errorlogger.cpp \
codeeditor.cpp
HEADERS += mainwindow.h \
../lib/tokenize.h \
../lib/token.h \
../lib/settings.h \
../lib/preprocessor.h \
../lib/path.h \
../lib/mathlib.h \
../lib/filelister_win32.h \
../lib/filelister_unix.h \
../lib/filelister.h \
../lib/errorlogger.h \
codeeditor.h
FORMS += mainwindow.ui

View File

@ -1,28 +0,0 @@
/*
* Cppcheck - A tool for static C/C++ code analysis
* Copyright (C) 2007-2010 Daniel Marjamäki and Cppcheck team.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QtGui/QApplication>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}

View File

@ -1,148 +0,0 @@
/*
* Cppcheck - A tool for static C/C++ code analysis
* Copyright (C) 2007-2010 Daniel Marjamäki and Cppcheck team.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "preprocessor.h"
#include "tokenize.h"
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <set>
#include <QFileDialog>
static void arrayIndex(const Tokenizer &tokenizer, std::set<unsigned int> &errorlines);
static unsigned char readChar(std::istream &istr)
{
unsigned char ch = (unsigned char)istr.get();
// Handling of newlines..
if (ch == '\r')
{
ch = '\n';
if ((char)istr.peek() == '\n')
(void)istr.get();
}
return ch;
}
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(open()));
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::open()
{
const std::string fileName = QFileDialog::getOpenFileName(this,
tr("Open File"),
"",
"cpp files (*.cpp)").toStdString();
if (fileName.empty())
return;
setWindowTitle(fileName.c_str());
Tokenizer tokenizer;
{
// Preprocess the file..
Preprocessor preprocessor;
std::ifstream fin(fileName.c_str());
std::string filedata;
std::list<std::string> configurations;
std::list<std::string> includePaths;
preprocessor.preprocess(fin,
filedata,
configurations,
fileName,
includePaths);
filedata = Preprocessor::getcode(filedata, "", fileName, NULL, NULL);
// Tokenize the preprocessed code..
std::istringstream istr(filedata);
tokenizer.tokenize(istr, fileName.c_str(), "");
}
// Check the tokens..
std::set<unsigned int> errorlines;
arrayIndex(tokenizer, errorlines);
// show report..
{
std::ostringstream report;
std::ifstream fin(fileName.c_str());
for (unsigned char c = readChar(fin); fin.good(); c = readChar(fin))
{
if (c & 0x80)
continue;
report << c;
}
ui->codeEditor->setPlainText(QString::fromStdString(report.str()));
QList<int> errorLines;
for (std::set<unsigned int>::const_iterator it = errorlines.begin(); it != errorlines.end(); ++it)
errorLines.push_back(*it);
ui->codeEditor->highlightErrors(errorLines);
}
}
/**
* Check that array indexes are within bounds
* 1. Locate array access through: [ .. ]
* 2. Try to determine if index is within bounds.
* 3. If it fails to determine that the index is within bounds then write warning
* \param tokenizer The tokenizer
* \param errout output stream to write warnings to
*/
static void arrayIndex(const Tokenizer &tokenizer, std::set<unsigned int> &errorlines)
{
for (const Token *tok = tokenizer.tokens(); tok; tok = tok->next())
{
// 1. Locate array access through: [ .. ]
if (tok->fileIndex() == 0 && tok->str() == "[")
{
// 2. try to determine if the array index is within bounds
// array declaration
if (Token::simpleMatch(tok, "[ ]"))
continue;
if (Token::Match(tok->tokAt(-2), "%type% %var% [ %num% ] ;|="))
continue;
// 3. If it fails to determine that the index is within bounds then write warning
errorlines.insert(tok->linenr());
}
}
}

View File

@ -1,43 +0,0 @@
/*
* Cppcheck - A tool for static C/C++ code analysis
* Copyright (C) 2007-2010 Daniel Marjamäki and Cppcheck team.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtGui/QMainWindow>
namespace Ui
{
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
private slots:
void open();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H

View File

@ -1,75 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
<string>Cppcheck-Verify</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="CodeEditor" name="codeEditor">
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="tabStopWidth">
<number>4</number>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="actionOpen"/>
</widget>
<addaction name="menuFile"/>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
<action name="actionOpen">
<property name="text">
<string>Open..</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>CodeEditor</class>
<extends>QPlainTextEdit</extends>
<header>codeeditor.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -1,11 +0,0 @@
cppcheck-verify
===============
Experimental subproject for Cppcheck.
The goal is no false negatives.
Just use 'make' to build.

View File

@ -4,7 +4,7 @@
<?define Platform = "x86" ?> <?define Platform = "x86" ?>
<?endif ?> <?endif ?>
<?define CliBuildDir = "..\Build\release" ?> <?define CliBuildDir = "..\cli\release" ?>
<?define GuiBuildDir = "..\Build\gui" ?> <?define GuiBuildDir = "..\Build\gui" ?>
<?define TranslationsDir = "..\gui" ?> <?define TranslationsDir = "..\gui" ?>
<?define HelpDir = "..\gui\help" ?> <?define HelpDir = "..\gui\help" ?>

View File

@ -43,6 +43,7 @@
<File Id='cppcheck_de.qm' Name='cppcheck_de.qm' Source='$(var.TranslationsDir)\cppcheck_de.qm' /> <File Id='cppcheck_de.qm' Name='cppcheck_de.qm' Source='$(var.TranslationsDir)\cppcheck_de.qm' />
<File Id='cppcheck_en.qm' Name='cppcheck_en.qm' Source='$(var.TranslationsDir)\cppcheck_en.qm' /> <File Id='cppcheck_en.qm' Name='cppcheck_en.qm' Source='$(var.TranslationsDir)\cppcheck_en.qm' />
<File Id='cppcheck_fi.qm' Name='cppcheck_fi.qm' Source='$(var.TranslationsDir)\cppcheck_fi.qm' /> <File Id='cppcheck_fi.qm' Name='cppcheck_fi.qm' Source='$(var.TranslationsDir)\cppcheck_fi.qm' />
<File Id='cppcheck_fr.qm' Name='cppcheck_fr.qm' Source='$(var.TranslationsDir)\cppcheck_fr.qm' />
<File Id='cppcheck_ja.qm' Name='cppcheck_ja.qm' Source='$(var.TranslationsDir)\cppcheck_ja.qm' /> <File Id='cppcheck_ja.qm' Name='cppcheck_ja.qm' Source='$(var.TranslationsDir)\cppcheck_ja.qm' />
<File Id='cppcheck_nl.qm' Name='cppcheck_nl.qm' Source='$(var.TranslationsDir)\cppcheck_nl.qm' /> <File Id='cppcheck_nl.qm' Name='cppcheck_nl.qm' Source='$(var.TranslationsDir)\cppcheck_nl.qm' />
<File Id='cppcheck_pl.qm' Name='cppcheck_pl.qm' Source='$(var.TranslationsDir)\cppcheck_pl.qm' /> <File Id='cppcheck_pl.qm' Name='cppcheck_pl.qm' Source='$(var.TranslationsDir)\cppcheck_pl.qm' />

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Include> <Include>
<?define ProductName = "Cppcheck 1.46" ?> <?define ProductName = "Cppcheck 1.47" ?>
<?define ProductNameShort = "Cppcheck" ?> <?define ProductNameShort = "Cppcheck" ?>
<?define ProductVersion = "1.46.0" ?> <?define ProductVersion = "1.47.0" ?>
<?define ProductManufacturer = "The Cppcheck team" ?> <?define ProductManufacturer = "The Cppcheck team" ?>
<?define ProductDescription = "Cppcheck is a tool for static analysis of C/C++ code" ?> <?define ProductDescription = "Cppcheck is a tool for static analysis of C/C++ code" ?>