Merge "Remove unused variable and trim down unnecessary cflags."
diff --git a/cpu_ref/rsCpuCore.cpp b/cpu_ref/rsCpuCore.cpp
index 7039cec..0485433 100644
--- a/cpu_ref/rsCpuCore.cpp
+++ b/cpu_ref/rsCpuCore.cpp
@@ -183,7 +183,7 @@
// Determine if the CPU we're running on supports SIMD instructions.
static void GetCpuInfo() {
// Read the CPU flags from /proc/cpuinfo.
- FILE *cpuinfo = fopen("/proc/cpuinfo", "r");
+ FILE *cpuinfo = fopen("/proc/cpuinfo", "re");
if (!cpuinfo) {
return;
diff --git a/cpu_ref/rsCpuScript.cpp b/cpu_ref/rsCpuScript.cpp
index 2961321..e41a6b8 100644
--- a/cpu_ref/rsCpuScript.cpp
+++ b/cpu_ref/rsCpuScript.cpp
@@ -132,7 +132,7 @@
std::vector<const char *> &compileArguments) {
rsAssert(bitcode && bitcodeSize);
- FILE *bcfile = fopen(bcFileName.c_str(), "w");
+ FILE *bcfile = fopen(bcFileName.c_str(), "we");
if (!bcfile) {
ALOGE("Could not write to %s", bcFileName.c_str());
return false;
@@ -172,7 +172,7 @@
}
bool addFileToChecksum(const char *fileName, uint32_t &checksum) {
- int FD = open(fileName, O_RDONLY);
+ int FD = open(fileName, O_RDONLY | O_CLOEXEC);
if (FD == -1) {
ALOGE("Cannot open file \'%s\' to compute checksum", fileName);
return false;
diff --git a/rsApiFileA3D.cpp b/rsApiFileA3D.cpp
index 50de3b2..bbb68ef 100644
--- a/rsApiFileA3D.cpp
+++ b/rsApiFileA3D.cpp
@@ -96,7 +96,7 @@
Context *rsc = static_cast<Context *>(con);
FileA3D *fa3d = nullptr;
- FILE *f = fopen(path, "rb");
+ FILE *f = fopen(path, "rbe");
if (f) {
fa3d = new FileA3D(rsc);
fa3d->incUserRef();
diff --git a/rsFifoSocket.cpp b/rsFifoSocket.cpp
index af61380..8cda09a 100644
--- a/rsFifoSocket.cpp
+++ b/rsFifoSocket.cpp
@@ -36,7 +36,7 @@
}
bool FifoSocket::init(bool supportNonBlocking, bool supportReturnValues, size_t maxDataSize) {
- int ret = socketpair(AF_UNIX, SOCK_STREAM, 0, sv);
+ int ret = socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sv);
return (ret == 0);
}
diff --git a/rsFileA3D.cpp b/rsFileA3D.cpp
index b09c52e..3120a56 100644
--- a/rsFileA3D.cpp
+++ b/rsFileA3D.cpp
@@ -303,7 +303,7 @@
return false;
}
- FILE *writeHandle = fopen(filename, "wb");
+ FILE *writeHandle = fopen(filename, "wbe");
if (!writeHandle) {
ALOGE("Couldn't open the file for writing\n");
return false;
diff --git a/rsScriptC.cpp b/rsScriptC.cpp
index 5566398..669954a 100644
--- a/rsScriptC.cpp
+++ b/rsScriptC.cpp
@@ -273,7 +273,7 @@
return false;
}
- FILE *fp = fopen(f.c_str(), "w");
+ FILE *fp = fopen(f.c_str(), "we");
if (!fp) {
ALOGE("Could not open %s", f.c_str());
return false;
diff --git a/rsg_generator.c b/rsg_generator.c
index 6e6d6e7..89caa600 100644
--- a/rsg_generator.c
+++ b/rsg_generator.c
@@ -471,7 +471,7 @@
}
const char* rsgFile = argv[1];
const char* outFile = argv[2];
- FILE* input = fopen(rsgFile, "r");
+ FILE* input = fopen(rsgFile, "re");
char choice = fgetc(input);
fclose(input);
@@ -484,7 +484,7 @@
yylex();
// printf("# of lines = %d\n", num_lines);
- FILE *f = fopen(outFile, "w");
+ FILE *f = fopen(outFile, "we");
printFileHeader(f);
switch (choice) {
diff --git a/script_api/Specification.cpp b/script_api/Specification.cpp
index 5056b08..95ebc78 100644
--- a/script_api/Specification.cpp
+++ b/script_api/Specification.cpp
@@ -802,7 +802,7 @@
// Read the specification, adding the definitions to the global functions map.
bool SpecFile::readSpecFile(unsigned int maxApiLevel) {
- FILE* specFile = fopen(mSpecFileName.c_str(), "rt");
+ FILE* specFile = fopen(mSpecFileName.c_str(), "rte");
if (!specFile) {
cerr << "Error opening input file: " << mSpecFileName << "\n";
return false;