From 814c2ffdfd213dfa78078471d298e2657b7e14e9 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Sun, 3 Mar 2013 19:18:04 -0600 Subject: [PATCH] Fix some leaking file handles and buildfix probably. --- Source/Core/Common/Src/ArmCPUDetect.cpp | 17 +++++++++-------- Source/Core/Common/Src/Crypto/md5.cpp | 2 +- Source/Core/Common/Src/Crypto/sha1.cpp | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Source/Core/Common/Src/ArmCPUDetect.cpp b/Source/Core/Common/Src/ArmCPUDetect.cpp index c03ab08c48..8b5cbf9b79 100644 --- a/Source/Core/Common/Src/ArmCPUDetect.cpp +++ b/Source/Core/Common/Src/ArmCPUDetect.cpp @@ -18,6 +18,7 @@ #include "Common.h" #include "CPUDetect.h" #include "StringUtil.h" +#include "FileUtil.h" const char procfile[] = "/proc/cpuinfo"; @@ -27,9 +28,9 @@ char *GetCPUString() char *cpu_string = 0; // Count the number of processor lines in /proc/cpuinfo char buf[1024]; - FILE *fp; - fp = fopen(procfile, "r"); + File::IOFile file(procfile, "r"); + auto const fp = file.GetHandle(); if (!fp) return 0; @@ -47,9 +48,9 @@ bool CheckCPUFeature(const char *feature) { const char marker[] = "Features\t: "; char buf[1024]; - FILE *fp; - - fp = fopen(procfile, "r"); + + File::IOFile file(procfile, "r"); + auto const fp = file.GetHandle(); if (!fp) return 0; @@ -73,9 +74,9 @@ int GetCoreCount() const char marker[] = "processor\t: "; int cores = 0; char buf[1024]; - FILE *fp; - - fp = fopen(procfile, "r"); + + File::IOFile file(procfile, "r"); + auto const fp = file.GetHandle(); if (!fp) return 0; diff --git a/Source/Core/Common/Src/Crypto/md5.cpp b/Source/Core/Common/Src/Crypto/md5.cpp index ef31636aea..7b8dc149f4 100644 --- a/Source/Core/Common/Src/Crypto/md5.cpp +++ b/Source/Core/Common/Src/Crypto/md5.cpp @@ -37,7 +37,7 @@ #include #include -#include "FileUtil.h" +#include "../FileUtil.h" /* * 32-bit integer manipulation macros (little endian) diff --git a/Source/Core/Common/Src/Crypto/sha1.cpp b/Source/Core/Common/Src/Crypto/sha1.cpp index 3d26dc8a50..45b88b2b6e 100644 --- a/Source/Core/Common/Src/Crypto/sha1.cpp +++ b/Source/Core/Common/Src/Crypto/sha1.cpp @@ -36,7 +36,7 @@ #include #include -#include "FileUtil.h" +#include "../FileUtil.h" /* * 32-bit integer manipulation macros (big endian)