mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Fixed multiple issues reported by the Clang static analyzer.
This commit is contained in:
parent
04a5f0cc6c
commit
930bdce576
15
INSTALL.md
15
INSTALL.md
|
@ -54,13 +54,13 @@ make
|
||||||
```
|
```
|
||||||
Keep in mind though that a debug version will be much slower due to all compiler optimizations being disabled.
|
Keep in mind though that a debug version will be much slower due to all compiler optimizations being disabled.
|
||||||
|
|
||||||
To create a profiling build, run this:
|
To create a profiling build (optimized with debug symbols), run this:
|
||||||
```
|
```
|
||||||
cmake -DCMAKE_BUILD_TYPE=Profiling .
|
cmake -DCMAKE_BUILD_TYPE=Profiling .
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
You can then profile the code with valgrind:
|
You can then profile the code with Valgrind:
|
||||||
```
|
```
|
||||||
valgrind --tool=callgrind ./emulationstation
|
valgrind --tool=callgrind ./emulationstation
|
||||||
```
|
```
|
||||||
|
@ -73,7 +73,16 @@ To check for memory leaks, the following command is useful:
|
||||||
valgrind --tool=memcheck --leak-check=full ./emulationstation
|
valgrind --tool=memcheck --leak-check=full ./emulationstation
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that you can also profile either a normal build or a debug build, but it's recommended to use the profiling build for reasons that is beyond the scope of this document.
|
Note that you can also profile either a normal build or a debug build, but it's normally recommended to use the profiling build as it's compiled with optimizations while retaining the debug symbols. But if you need to alternate between Valgrind and the normal debugger the optimizations can be very annoying and therefore a normal debug build could be recommended in that instance.
|
||||||
|
|
||||||
|
Another useful tool is **scan-build**, assuming you use Clang/LLVM. This is a static analyzer that runs during compilation to provide a very helpful HTML report of potential bugs (well it should be actual bugs but some false positives could be included). You need to run it for both the cmake and make steps, here's an example:
|
||||||
|
|
||||||
|
```
|
||||||
|
scan-build cmake -DCMAKE_BUILD_TYPE=Debug .
|
||||||
|
scan-build make -j6
|
||||||
|
```
|
||||||
|
|
||||||
|
You open the report with the **scan-view** command which lets you browse it using your web browser. Note that the compilation time is much higher when using the static analyzer compared to a normal compilation. As well this tool generates a lot of extra files and folders in the build tree, so it may make sense to run it on a separate copy of the ES source folder to avoid having to clean up all this extra data when the analysis has been completed.
|
||||||
|
|
||||||
To build ES with CEC support, add the corresponding option, for example:
|
To build ES with CEC support, add the corresponding option, for example:
|
||||||
|
|
||||||
|
|
|
@ -542,7 +542,6 @@ void GuiScraperSearch::update(int deltaTime)
|
||||||
|
|
||||||
if (mMDRetrieveURLsHandle && mMDRetrieveURLsHandle->status() != ASYNC_IN_PROGRESS) {
|
if (mMDRetrieveURLsHandle && mMDRetrieveURLsHandle->status() != ASYNC_IN_PROGRESS) {
|
||||||
if (mMDRetrieveURLsHandle->status() == ASYNC_DONE) {
|
if (mMDRetrieveURLsHandle->status() == ASYNC_DONE) {
|
||||||
auto status_media = mMDRetrieveURLsHandle->status();
|
|
||||||
auto results_media = mMDRetrieveURLsHandle->getResults();
|
auto results_media = mMDRetrieveURLsHandle->getResults();
|
||||||
auto statusString_media = mMDRetrieveURLsHandle->getStatusString();
|
auto statusString_media = mMDRetrieveURLsHandle->getStatusString();
|
||||||
auto results_scrape = mScraperResults;
|
auto results_scrape = mScraperResults;
|
||||||
|
|
|
@ -591,9 +591,11 @@ std::vector<GuiComponent*> ThemeData::makeExtras(const std::shared_ptr<ThemeData
|
||||||
else if (t == "text")
|
else if (t == "text")
|
||||||
comp = new TextComponent(window);
|
comp = new TextComponent(window);
|
||||||
|
|
||||||
comp->setDefaultZIndex(10);
|
if (comp) {
|
||||||
comp->applyTheme(theme, view, *it, ThemeFlags::ALL);
|
comp->setDefaultZIndex(10);
|
||||||
comps.push_back(comp);
|
comp->applyTheme(theme, view, *it, ThemeFlags::ALL);
|
||||||
|
comps.push_back(comp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,8 +102,12 @@ public:
|
||||||
std::string type;
|
std::string type;
|
||||||
|
|
||||||
struct Property {
|
struct Property {
|
||||||
void operator= (const Vector4f& value) { r = value;
|
void operator= (const Vector4f& value)
|
||||||
v = Vector2f(value.x(), value.y()); }
|
{
|
||||||
|
r = value;
|
||||||
|
const Vector4f initVector = value;
|
||||||
|
v = Vector2f(initVector.x(), initVector.y());
|
||||||
|
}
|
||||||
void operator= (const Vector2f& value) { v = value; }
|
void operator= (const Vector2f& value) { v = value; }
|
||||||
void operator= (const std::string& value) { s = value; }
|
void operator= (const std::string& value) { s = value; }
|
||||||
void operator= (const unsigned int& value) { i = value; }
|
void operator= (const unsigned int& value) { i = value; }
|
||||||
|
|
|
@ -86,7 +86,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Start the video immediately.
|
// Start the video immediately.
|
||||||
virtual void startVideo() = 0;
|
virtual void startVideo() {};
|
||||||
// Stop the video.
|
// Stop the video.
|
||||||
virtual void stopVideo() {};
|
virtual void stopVideo() {};
|
||||||
// Pause the video when a game has been launched.
|
// Pause the video when a game has been launched.
|
||||||
|
|
Loading…
Reference in a new issue