Skip to content

Commit

Permalink
Fix MSVC warning C4018 signed/unsigned mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
dechamps committed Jun 4, 2023
1 parent cb8d3dc commit 12b62c0
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ if(PA_WARNINGS_ARE_ERRORS)
# "Grandfathered" warnings that existed before we started enforcement.
# Do *NOT* add warnings to this list. Instead, fix your code so that it doesn't produce the warning.
# TODO: fix the offending code so that we don't have to exclude specific warnings anymore.
/wd4018 # W3 signed/unsigned mismatch
/wd4244 # W2 conversion possible loss of data
/wd4267 # W3 conversion possible loss of data
/wd4996 # W3 unsafe/deprecated
Expand Down
6 changes: 3 additions & 3 deletions qa/loopback/src/paqa.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ typedef struct LoopbackContext_s
volatile int minInputOutputDelta;
volatile int maxInputOutputDelta;

int minFramesPerBuffer;
int maxFramesPerBuffer;
unsigned long minFramesPerBuffer;
unsigned long maxFramesPerBuffer;
int primingCount;
TestParameters *test;
volatile int done;
Expand Down Expand Up @@ -849,7 +849,7 @@ static int PaQa_SingleLoopBackTest( UserOptions *userOptions, TestParameters *te
{
double latencyMSec;

printf( "%4d-%4d | ",
printf( "%4lu-%4lu | ",
loopbackContext.minFramesPerBuffer,
loopbackContext.maxFramesPerBuffer
);
Expand Down
2 changes: 1 addition & 1 deletion qa/paqa_devs.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ static int QaCallback( const void *inputData,
void *userData )
{
unsigned long frameIndex;
unsigned long channelIndex;
int channelIndex;
float sample;
PaQaData *data = (PaQaData *) userData;
const PaQaTestParameters *parameters = data->parameters;
Expand Down
8 changes: 4 additions & 4 deletions qa/paqa_latency.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ typedef struct
int left_phase;
int right_phase;
char message[20];
int minFramesPerBuffer;
int maxFramesPerBuffer;
unsigned long minFramesPerBuffer;
unsigned long maxFramesPerBuffer;
int callbackCount;
PaTime minDeltaDacTime;
PaTime maxDeltaDacTime;
Expand Down Expand Up @@ -170,8 +170,8 @@ PaError paqaCheckLatency( PaStreamParameters *outputParamsPtr,
printf("Play for %d seconds.\n", NUM_SECONDS );
Pa_Sleep( NUM_SECONDS * 1000 );

printf(" minFramesPerBuffer = %4d\n", dataPtr->minFramesPerBuffer );
printf(" maxFramesPerBuffer = %4d\n", dataPtr->maxFramesPerBuffer );
printf(" minFramesPerBuffer = %4lu\n", dataPtr->minFramesPerBuffer );
printf(" maxFramesPerBuffer = %4lu\n", dataPtr->maxFramesPerBuffer );
printf(" minDeltaDacTime = %f\n", dataPtr->minDeltaDacTime );
printf(" maxDeltaDacTime = %f\n", dataPtr->maxDeltaDacTime );

Expand Down
2 changes: 1 addition & 1 deletion src/hostapi/jack/pa_jack.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ static PaError BuildDeviceList( PaJackHostApiRepresentation *jackApi )
// Add 1 for null terminator.
size_t device_name_regex_escaped_size = jack_client_name_size() * 2 + 1;
size_t port_regex_size = device_name_regex_escaped_size + strlen(port_regex_suffix);
int port_index, client_index, i;
unsigned long port_index, client_index, i;
double globalSampleRate;
regex_t port_regex;
unsigned long numClients = 0, numPorts = 0;
Expand Down
2 changes: 1 addition & 1 deletion test/patest_latency.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static int patestCallback( const void *inputBuffer, void *outputBuffer,
{
paTestData *data = (paTestData*)userData;
float *out = (float*)outputBuffer;
int i;
unsigned long i;

(void) inputBuffer; /* Prevent unused variable warning. */

Expand Down

0 comments on commit 12b62c0

Please sign in to comment.