Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ jobs:

scan-build --status-bugs cmake --build build -j"$(nproc)"

clang-tidy -p build $(git ls-files '*.c' '*.cc' '*.cpp' '*.cxx') \
FILES="$(git ls-files '*.c' '*.cc' '*.cpp' '*.cxx')"
FILES="$(git ls-files '*.c' '*.cc' '*.cpp' '*.cxx' | grep -v '^buffer/' | grep -v '^libs/')"
if [ -n "$FILES" ]; then
clang-tidy -p build $FILES \
--warnings-as-errors='clang-analyzer-*,bugprone-*,performance-*'
Expand All @@ -58,8 +57,19 @@ jobs:
fi


cppcheck --enable=warning,style,performance,portability --std=c++17 --force \
cppcheck --enable=warning,performance,portability --std=c++17 --force \
--project=build/compile_commands.json \
--suppress=missingIncludeSystem \
-i build . 2> cppcheck.log || true
cat cppcheck.log
-i build -i buffer -i libs 2> cppcheck-warn.log

cppcheck --enable=style --std=c++17 --force \
--project=build/compile_commands.json \
--suppress=missingIncludeSystem \
-i build -i buffer -i libs 2> cppcheck-style.log || true

if [ -s cppcheck-style.log ]; then
echo "Style issues found by cppcheck:"
cat cppcheck-style.log
else
echo "No style issues found by cppcheck."
fi
9 changes: 7 additions & 2 deletions openai_audio_streamer_glue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,10 @@ class AudioStreamer {
return out_buffer;
}

std::string createWavFromRaw(std::string rawAudio) {
// create wav file from raw audio
// rawAudio passed as constant reference because it is never edited
std::string createWavFromRaw(const std::string& rawAudio) {

const int numChannels = 1; // mono
const int bitsPerSample = 16; // pcm16
int byteRate = in_sample_rate * numChannels * bitsPerSample / 8;
Expand Down Expand Up @@ -1012,7 +1015,9 @@ extern "C" {
{
auto* tech_pvt = (private_t*) switch_core_media_bug_get_user_data(bug);
char sessionId[MAX_SESSION_ID];
strcpy(sessionId, tech_pvt->sessionId);

strncpy(sessionId, tech_pvt->sessionId, MAX_SESSION_ID - 1);
sessionId[MAX_SESSION_ID - 1] = '\0';

switch_mutex_lock(tech_pvt->mutex);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "(%s) stream_session_cleanup\n", sessionId);
Expand Down