Fix various warnings when building in VC2022 (#6020)

This commit is contained in:
Jeffery Myers
2026-07-26 06:10:19 -07:00
committed by GitHub
parent ac06acbaee
commit a18051fdd9
12 changed files with 47 additions and 47 deletions

View File

@@ -90,7 +90,7 @@ int main(void)
for (int i = 0; i < BUFFER_SIZE; i++)
{
int wavelength = SAMPLE_RATE/sineFrequency;
buffer[i] = sin(2*PI*sineIndex/wavelength);
buffer[i] = sinf(2*PI*sineIndex/wavelength);
sineIndex++;
if (sineIndex >= wavelength)
@@ -116,8 +116,8 @@ int main(void)
DrawText("Up/down to change frequency", 10, 10, 20, DARKGRAY);
DrawText("Left/right to pan", 10, 30, 20, DARKGRAY);
int windowStart = (GetTime() - sineStartTime)*SAMPLE_RATE;
int windowSize = 0.1f*SAMPLE_RATE;
int windowStart = (int)((GetTime() - sineStartTime)*SAMPLE_RATE);
int windowSize = SAMPLE_RATE/10;
int wavelength = SAMPLE_RATE/sineFrequency;
// Draw a sine wave with the same frequency as the one being sent to the audio stream
@@ -125,8 +125,8 @@ int main(void)
{
int t0 = windowStart + i*windowSize/screenWidth;
int t1 = windowStart + (i + 1)*windowSize/screenWidth;
Vector2 startPos = { i, 250 + 50*sin(2*PI*t0/wavelength) };
Vector2 endPos = { i + 1, 250 + 50*sin(2*PI*t1/wavelength) };
Vector2 startPos = { (float)i, 250 + 50*sinf(2*PI*t0/wavelength) };
Vector2 endPos = { (float)i + 1, 250 + 50*sinf(2*PI*t1/wavelength) };
DrawLineV(startPos, endPos, RED);
}

View File

@@ -133,8 +133,8 @@ int main(void)
// Draw the last 10 ms of uploaded audio
for (int i = 0; i < screenWidth; i++)
{
Vector2 startPos = { i, 250 - 50*buffer[SAMPLE_RATE - SAMPLE_RATE/100 + i*SAMPLE_RATE/100/screenWidth] };
Vector2 endPos = { i + 1, 250 - 50*buffer[SAMPLE_RATE - SAMPLE_RATE/100 + (i + 1)*SAMPLE_RATE/100/screenWidth] };
Vector2 startPos = {(float)i, 250 - 50*buffer[SAMPLE_RATE - SAMPLE_RATE/100 + i*SAMPLE_RATE/100/screenWidth] };
Vector2 endPos = { (float)(i + 1), 250 - 50*buffer[SAMPLE_RATE - SAMPLE_RATE/100 + (i + 1)*SAMPLE_RATE/100/screenWidth] };
DrawLineV(startPos, endPos, RED);
}
@@ -161,9 +161,9 @@ static void SineCallback(void *framesOut, unsigned int frameCount)
int wavelength = SAMPLE_RATE/waveFrequency;
// Synthesize the sine wave
for (int i = 0; i < frameCount; i++)
for (unsigned int i = 0; i < frameCount; i++)
{
((float *)framesOut)[i] = sin(2*PI*waveIndex/wavelength);
((float *)framesOut)[i] = sinf(2*PI*waveIndex/wavelength);
waveIndex++;
@@ -175,8 +175,8 @@ static void SineCallback(void *framesOut, unsigned int frameCount)
}
// Save the synthesized samples for later drawing
for (int i = 0; i < SAMPLE_RATE - frameCount; i++) buffer[i] = buffer[i + frameCount];
for (int i = 0; i < frameCount; i++) buffer[SAMPLE_RATE - frameCount + i] = ((float *)framesOut)[i];
for (unsigned int i = 0; i < SAMPLE_RATE - frameCount; i++) buffer[i] = buffer[i + frameCount];
for (unsigned int i = 0; i < frameCount; i++) buffer[SAMPLE_RATE - frameCount + i] = ((float *)framesOut)[i];
}
static void SquareCallback(void *framesOut, unsigned int frameCount)
@@ -184,9 +184,9 @@ static void SquareCallback(void *framesOut, unsigned int frameCount)
int wavelength = SAMPLE_RATE/waveFrequency;
// Synthesize the square wave
for (int i = 0; i < frameCount; i++)
for (unsigned int i = 0; i < frameCount; i++)
{
((float *)framesOut)[i] = (waveIndex < wavelength/2)? 1 : -1;
((float *)framesOut)[i] = (waveIndex < wavelength/2)? 1.0f : -1.0f;
waveIndex++;
if (waveIndex >= wavelength)
@@ -197,8 +197,8 @@ static void SquareCallback(void *framesOut, unsigned int frameCount)
}
// Save the synthesized samples for later drawing
for (int i = 0; i < SAMPLE_RATE - frameCount; i++) buffer[i] = buffer[i + frameCount];
for (int i = 0; i < frameCount; i++) buffer[SAMPLE_RATE - frameCount + i] = ((float *)framesOut)[i];
for (unsigned int i = 0; i < SAMPLE_RATE - frameCount; i++) buffer[i] = buffer[i + frameCount];
for (unsigned int i = 0; i < frameCount; i++) buffer[SAMPLE_RATE - frameCount + i] = ((float *)framesOut)[i];
}
static void TriangleCallback(void *framesOut, unsigned int frameCount)
@@ -206,7 +206,7 @@ static void TriangleCallback(void *framesOut, unsigned int frameCount)
int wavelength = SAMPLE_RATE/waveFrequency;
// Synthesize the triangle wave
for (int i = 0; i < frameCount; i++)
for (unsigned int i = 0; i < frameCount; i++)
{
((float *)framesOut)[i] = (waveIndex < wavelength/2)? (-1 + 2.0f*waveIndex/(wavelength/2)) : (1 - 2.0f*(waveIndex - wavelength/2)/(wavelength/2));
waveIndex++;
@@ -219,8 +219,8 @@ static void TriangleCallback(void *framesOut, unsigned int frameCount)
}
// Save the synthesized samples for later drawing
for (int i = 0; i < SAMPLE_RATE - frameCount; i++) buffer[i] = buffer[i + frameCount];
for (int i = 0; i < frameCount; i++) buffer[SAMPLE_RATE - frameCount + i] = ((float *)framesOut)[i];
for (unsigned int i = 0; i < SAMPLE_RATE - frameCount; i++) buffer[i] = buffer[i + frameCount];
for (unsigned int i = 0; i < frameCount; i++) buffer[SAMPLE_RATE - frameCount + i] = ((float *)framesOut)[i];
}
static void SawtoothCallback(void *framesOut, unsigned int frameCount)
@@ -228,7 +228,7 @@ static void SawtoothCallback(void *framesOut, unsigned int frameCount)
int wavelength = SAMPLE_RATE/waveFrequency;
// Synthesize the sawtooth wave
for (int i = 0; i < frameCount; i++)
for (unsigned int i = 0; i < frameCount; i++)
{
((float *)framesOut)[i] = -1 + 2.0f*waveIndex/wavelength;
waveIndex++;
@@ -241,6 +241,6 @@ static void SawtoothCallback(void *framesOut, unsigned int frameCount)
}
// Save the synthesized samples for later drawing
for (int i = 0; i < SAMPLE_RATE - frameCount; i++) buffer[i] = buffer[i + frameCount];
for (int i = 0; i < frameCount; i++) buffer[SAMPLE_RATE - frameCount + i] = ((float *)framesOut)[i];
for (unsigned int i = 0; i < SAMPLE_RATE - frameCount; i++) buffer[i] = buffer[i + frameCount];
for (unsigned int i = 0; i < frameCount; i++) buffer[SAMPLE_RATE - frameCount + i] = ((float*)framesOut)[i];
}

View File

@@ -88,7 +88,7 @@ int main(void)
DrawCircleV(GetMousePosition(), 20, MAROON);
DrawRectangleRec((Rectangle) { mousePos.x - 25, mousePos.y, 50, 2 }, BLACK);
DrawRectangleRec((Rectangle) { mousePos.x, mousePos.y - 25, 2, 50 }, BLACK);
DrawText(TextFormat("[%i,%i]", GetMouseX(), GetMouseY()), mousePos.x - 44,
DrawText(TextFormat("[%i,%i]", GetMouseX(), GetMouseY()), (int)mousePos.x - 44,
(mousePos.y > GetScreenHeight() - 60)? (int)mousePos.y - 46 : (int)mousePos.y + 30, 20, BLACK);
EndDrawing();

View File

@@ -212,12 +212,12 @@ static void UpdateModelAnimationBones(Model *model, ModelAnimation *anim0, int f
if (frame1 < 0) frame1 = 0;
// Get bone count (use minimum of all to be safe)
int boneCount = model->skeleton.boneCount;
unsigned int boneCount = model->skeleton.boneCount;
if (anim0->boneCount < boneCount) boneCount = anim0->boneCount;
if (anim1->boneCount < boneCount) boneCount = anim1->boneCount;
// Blend each bone
for (int boneIndex = 0; boneIndex < boneCount; boneIndex++)
for (unsigned int boneIndex = 0; boneIndex < boneCount; boneIndex++)
{
// Determine blend factor for this bone
float boneBlendFactor = blend;

View File

@@ -252,7 +252,7 @@ int main(void)
GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER);
GuiSetStyle(DEFAULT, TEXT_SIZE, GuiGetFont().baseSize*2);
GuiLabel((Rectangle){ 0, GetScreenHeight() - 100.0f, GetScreenWidth(), 40 }, "PRESS SPACE to START BLENDING");
GuiLabel((Rectangle){ 0, GetScreenHeight() - 100.0f, (float)GetScreenWidth(), 40 }, "PRESS SPACE to START BLENDING");
GuiSetStyle(DEFAULT, TEXT_SIZE, GuiGetFont().baseSize);
GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT);

View File

@@ -103,7 +103,7 @@ int main(void)
if (collision.hit && (collision.distance < closestDistance))
{
closestDistance = collision.distance;
closestVoxelPosition = (Vector3){ x, y, z };
closestVoxelPosition = (Vector3){ (float)x, (float)y, (float)z };
voxelFound = true;
}
}

View File

@@ -64,7 +64,7 @@ int main(void)
int boneSocketIndex[BONE_SOCKETS] = { -1, -1, -1 };
// Search bones for sockets
for (int i = 0; i < characterModel.skeleton.boneCount; i++)
for (unsigned int i = 0; i < characterModel.skeleton.boneCount; i++)
{
if (TextIsEqual(characterModel.skeleton.bones[i].name, "socket_hat"))
{

View File

@@ -119,7 +119,7 @@ static void DrawModelSkeleton(ModelSkeleton skeleton, ModelAnimPose pose, float
{
// Loop to (boneCount - 1) because the last one is a special "no bone" bone,
// needed to workaround buggy models without a -1, a cube is always drawn at the origin
for (int i = 0; i < skeleton.boneCount - 1; i++)
for (unsigned int i = 0; i < skeleton.boneCount - 1; i++)
{
// Display the frame-pose skeleton
DrawCube(pose[i].translation, scale*0.05f, scale*0.05f, scale*0.05f, color);

View File

@@ -82,8 +82,8 @@ int main(void)
if (IsTextureValid(collection[i].texture))
{
DrawTexturePro(collection[i].texture,
(Rectangle){0,0,collection[i].texture.width, collection[i].texture.height},
(Rectangle){collection[i].position.x,collection[i].position.y,collection[i].texture.width, collection[i].texture.height},
(Rectangle){0,0,(float)collection[i].texture.width, (float)collection[i].texture.height},
(Rectangle){collection[i].position.x,collection[i].position.y, (float)collection[i].texture.width, (float)collection[i].texture.height},
(Vector2){collection[i].texture.width*0.5f, collection[i].texture.height*0.5f},
0.0f, WHITE);
}

View File

@@ -115,7 +115,7 @@ int main(void)
EndMode3D();
DrawRectangleLines((int)((subjectTarget.texture.width - captureSize)/2.0f), (int)((subjectTarget.texture.height - captureSize)/2.0f), captureSize, captureSize, GREEN);
DrawRectangleLines((int)((subjectTarget.texture.width - captureSize)/2.0f), (int)((subjectTarget.texture.height - captureSize)/2.0f), (int)captureSize, (int)captureSize, GREEN);
DrawText("Subject View", 10, subjectTarget.texture.height - 30, 20, BLACK);
EndTextureMode();