summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-04-12 09:25:14 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-04-12 09:25:14 +0200
commita599ccc4c8406c244454c5a0fedc547bf3b1405a (patch)
treea6f3eca9dccf1e8a0ebd269063c8f25c5ac71ae2
parent5637664fcbe18b05a773d6db621a94de76e07817 (diff)
downloadfdk-aac-a599ccc4c8406c244454c5a0fedc547bf3b1405a.tar.gz
fdk-aac-a599ccc4c8406c244454c5a0fedc547bf3b1405a.tar.bz2
fdk-aac-a599ccc4c8406c244454c5a0fedc547bf3b1405a.zip
mot-encoder: don't keep DLS input file open
-rw-r--r--src/mot-encoder.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/mot-encoder.cpp b/src/mot-encoder.cpp
index 0548614..f2115c0 100644
--- a/src/mot-encoder.cpp
+++ b/src/mot-encoder.cpp
@@ -235,7 +235,6 @@ char dlstext_prev[MAXDLS + 1];
// The DLS data groups
std::deque<std::vector<uint8_t> > dlsdg;
-static int dlsfd = 0;
static int verbose = 0;
@@ -878,17 +877,16 @@ void writeDLS(int output_fd, const char* dls_file, int padlen, uint8_t charset)
int i;
bool dlstext_new;
- if (dlsfd != 0) {
- close(dlsfd);
- }
-
- dlsfd = open(dls_file, O_RDONLY);
+ int dlsfd = open(dls_file, O_RDONLY);
if (dlsfd == -1) {
fprintf(stderr, "mot-encoder Error: Cannot open dls file\n");
return;
}
dlslen = read(dlsfd, dlstext, MAXDLS);
+
+ close(dlsfd);
+
dlstext[dlslen] = 0x00;
// Remove trailing line breaks from the file