diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-04-12 09:25:14 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-04-12 09:25:14 +0200 |
commit | fbb99d2014a0589c5440fa77b154b2042984bc45 (patch) | |
tree | 1a46823abea2f2fc26711c02387cb04442750ef5 /src | |
parent | ac3fc4bdb8647e7707a58bb569a9b3a292a55209 (diff) | |
download | ODR-PadEnc-fbb99d2014a0589c5440fa77b154b2042984bc45.tar.gz ODR-PadEnc-fbb99d2014a0589c5440fa77b154b2042984bc45.tar.bz2 ODR-PadEnc-fbb99d2014a0589c5440fa77b154b2042984bc45.zip |
mot-encoder: don't keep DLS input file open
Diffstat (limited to 'src')
-rw-r--r-- | src/mot-encoder.cpp | 10 |
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 |