Fix some leaking file handles and buildfix probably.
This commit is contained in:
parent
989f0663eb
commit
814c2ffdfd
|
@ -18,6 +18,7 @@
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "CPUDetect.h"
|
#include "CPUDetect.h"
|
||||||
#include "StringUtil.h"
|
#include "StringUtil.h"
|
||||||
|
#include "FileUtil.h"
|
||||||
|
|
||||||
const char procfile[] = "/proc/cpuinfo";
|
const char procfile[] = "/proc/cpuinfo";
|
||||||
|
|
||||||
|
@ -27,9 +28,9 @@ char *GetCPUString()
|
||||||
char *cpu_string = 0;
|
char *cpu_string = 0;
|
||||||
// Count the number of processor lines in /proc/cpuinfo
|
// Count the number of processor lines in /proc/cpuinfo
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
FILE *fp;
|
|
||||||
|
|
||||||
fp = fopen(procfile, "r");
|
File::IOFile file(procfile, "r");
|
||||||
|
auto const fp = file.GetHandle();
|
||||||
if (!fp)
|
if (!fp)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -47,9 +48,9 @@ bool CheckCPUFeature(const char *feature)
|
||||||
{
|
{
|
||||||
const char marker[] = "Features\t: ";
|
const char marker[] = "Features\t: ";
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
FILE *fp;
|
|
||||||
|
|
||||||
fp = fopen(procfile, "r");
|
File::IOFile file(procfile, "r");
|
||||||
|
auto const fp = file.GetHandle();
|
||||||
if (!fp)
|
if (!fp)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -73,9 +74,9 @@ int GetCoreCount()
|
||||||
const char marker[] = "processor\t: ";
|
const char marker[] = "processor\t: ";
|
||||||
int cores = 0;
|
int cores = 0;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
FILE *fp;
|
|
||||||
|
|
||||||
fp = fopen(procfile, "r");
|
File::IOFile file(procfile, "r");
|
||||||
|
auto const fp = file.GetHandle();
|
||||||
if (!fp)
|
if (!fp)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "FileUtil.h"
|
#include "../FileUtil.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 32-bit integer manipulation macros (little endian)
|
* 32-bit integer manipulation macros (little endian)
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "FileUtil.h"
|
#include "../FileUtil.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 32-bit integer manipulation macros (big endian)
|
* 32-bit integer manipulation macros (big endian)
|
||||||
|
|
Loading…
Reference in New Issue