Fix some leaking file handles and buildfix probably.

This commit is contained in:
Jordan Woyak 2013-03-03 19:18:04 -06:00
parent 989f0663eb
commit 814c2ffdfd
3 changed files with 11 additions and 10 deletions

View File

@ -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;

View File

@ -37,7 +37,7 @@
#include <string.h>
#include <stdio.h>
#include "FileUtil.h"
#include "../FileUtil.h"
/*
* 32-bit integer manipulation macros (little endian)

View File

@ -36,7 +36,7 @@
#include <string.h>
#include <stdio.h>
#include "FileUtil.h"
#include "../FileUtil.h"
/*
* 32-bit integer manipulation macros (big endian)