Skip to content

Commit 1c5e05e

Browse files
authored
whisper: fix printf format string (ggml-org#894)
This format string uses %d to print uint32_t and size_t{ype,}, which is not guaranteed to work. Instead, use PRIu32 for uint32_t, and %zu for size_t.
1 parent 813cf82 commit 1c5e05e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

otherarch/whispercpp/whisper_adapter.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <vector>
1616
#include <cstring>
1717
#include <mutex>
18+
#include <cinttypes>
1819

1920
#define COMMON_SAMPLE_RATE 16000
2021

@@ -50,7 +51,8 @@ static std::vector<float> resample_wav(const std::vector<float>& input, uint32_t
5051

5152
if(whisperdebugmode==1)
5253
{
53-
printf("\nResample wav from %d to %d (in size: %d, out size: %d)", input_rate,output_rate,input_size,output.size());
54+
printf("\nResample wav from %" PRIu32 " to %" PRIu32 " (in size: %zu, out size: %zu)",
55+
input_rate, output_rate, input_size, static_cast<std::size_t>(output.size()));
5456
}
5557

5658
// Perform simple linear interpolation resampling
@@ -273,4 +275,4 @@ whisper_generation_outputs whispertype_generate(const whisper_generation_inputs
273275
output.text = whisper_output_text.c_str();
274276
output.status = 1;
275277
return output;
276-
}
278+
}

0 commit comments

Comments
 (0)