From 0180dcd2e0add9e00bec66c560bfc3fbae23ac85 Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Tue, 28 Dec 2021 08:47:47 +0100 Subject: [PATCH] Fix failure to read ambe files --- AudioUnit.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/AudioUnit.cpp b/AudioUnit.cpp index 276e956..f17a2fe 100644 --- a/AudioUnit.cpp +++ b/AudioUnit.cpp @@ -355,15 +355,15 @@ bool CAudioUnit::readAMBE(const std::string& dir, const std::string& name) unsigned char buffer[VOICE_FRAME_LENGTH_BYTES]; - size_t n = fread(buffer, 4, 1, file); + size_t n = fread(buffer, sizeof(unsigned char), 4, file); if (n != 4) { - CLog::logInfo("Unable to read the header from %s\n", fileName.c_str()); + CLog::logError("Unable to read the header from %s\n", fileName.c_str()); fclose(file); return false; } if (memcmp(buffer, "AMBE", 4)) { - CLog::logInfo("Invalid header from %s\n", fileName.c_str()); + CLog::logError("Invalid header from %s\n", fileName.c_str()); fclose(file); return false; } @@ -380,9 +380,9 @@ bool CAudioUnit::readAMBE(const std::string& dir, const std::string& name) for (unsigned int i = 0U; i < SILENCE_LENGTH; i++, p += VOICE_FRAME_LENGTH_BYTES) memcpy(p, NULL_AMBE_DATA_BYTES, VOICE_FRAME_LENGTH_BYTES); - n = fread(p, length, 1, file); + n = fread(p, 1, length, file); if (n != length) { - CLog::logInfo("Unable to read the AMBE data from %s\n", fileName.c_str()); + CLog::logError("Unable to read the AMBE data from %s\n", fileName.c_str()); fclose(file); delete[] m_ambe; m_ambe = NULL;