Fix some problems found in static analysis
This commit is contained in:
parent
039be71266
commit
82945f9c0f
|
@ -106,7 +106,7 @@ static void closest_point_to_triangle(struct Surface* surf, Vec3f src, Vec3f out
|
|||
static s32 find_wall_collisions_from_list(struct SurfaceNode *surfaceNode,
|
||||
struct WallCollisionData *data) {
|
||||
register struct Surface *surf;
|
||||
register f32 offset;
|
||||
register f32 offset = 0;
|
||||
register f32 radius = data->radius;
|
||||
register f32 x = data->x;
|
||||
register f32 y = data->y + data->offsetY;
|
||||
|
|
|
@ -69,8 +69,8 @@ static void enemy_lakitu_update_speed_and_angle(void) {
|
|||
s32 distanceToPlayer = player ? dist_between_objects(o, player) : 10000;
|
||||
s32 angleToPlayer = player ? obj_angle_to_object(o, player) : 0;
|
||||
|
||||
f32 minSpeed;
|
||||
s16 turnSpeed;
|
||||
f32 minSpeed = 0;
|
||||
s16 turnSpeed = 0;
|
||||
|
||||
f32 distToMario = distanceToPlayer;
|
||||
if (distToMario > 500.0f) {
|
||||
|
|
|
@ -704,8 +704,8 @@ void anim_and_audio_for_heavy_walk(struct MarioState *m) {
|
|||
|
||||
void push_or_sidle_wall(struct MarioState *m, Vec3f startPos) {
|
||||
if (!m) { return; }
|
||||
s16 wallAngle;
|
||||
s16 dWallAngle;
|
||||
s16 wallAngle = 0;
|
||||
s16 dWallAngle = 0;
|
||||
f32 dx = m->pos[0] - startPos[0];
|
||||
f32 dz = m->pos[2] - startPos[2];
|
||||
f32 movedDistance = sqrtf(dx * dx + dz * dz);
|
||||
|
|
|
@ -162,7 +162,7 @@ void platform_on_track_update_pos_or_spawn_ball(s32 ballIndex, f32 x, f32 y, f32
|
|||
f32 dx;
|
||||
f32 dy;
|
||||
f32 dz;
|
||||
f32 distToNextWaypoint;
|
||||
f32 distToNextWaypoint = 100;
|
||||
|
||||
if (ballIndex == 0 || ((u16)(o->oBehParams >> 16) & 0x0080)) {
|
||||
initialPrevWaypoint = o->oPlatformOnTrackPrevWaypoint;
|
||||
|
|
|
@ -131,15 +131,16 @@ void djui_base_compute(struct DjuiBase* base) {
|
|||
struct DjuiBase* parent = base->parent;
|
||||
struct DjuiBaseRect* comp = &base->comp;
|
||||
|
||||
f32 x = (base->x.type == DJUI_SVT_RELATIVE) ? parent->comp.width * base->x.value : base->x.value;
|
||||
f32 y = (base->y.type == DJUI_SVT_RELATIVE) ? parent->comp.height * base->y.value : base->y.value;
|
||||
f32 x = (parent && base->x.type == DJUI_SVT_RELATIVE) ? parent->comp.width * base->x.value : base->x.value;
|
||||
f32 y = (parent && base->y.type == DJUI_SVT_RELATIVE) ? parent->comp.height * base->y.value : base->y.value;
|
||||
|
||||
f32 width = (base->width.type == DJUI_SVT_RELATIVE) ? parent->comp.width * base->width.value : base->width.value;
|
||||
f32 height = (base->height.type == DJUI_SVT_RELATIVE) ? parent->comp.height * base->height.value : base->height.value;
|
||||
f32 width = (parent && base->width.type == DJUI_SVT_RELATIVE) ? parent->comp.width * base->width.value : base->width.value;
|
||||
f32 height = (parent && base->height.type == DJUI_SVT_RELATIVE) ? parent->comp.height * base->height.value : base->height.value;
|
||||
|
||||
width = (base->width.type == DJUI_SVT_ASPECT_RATIO) ? height * base->width.value : width;
|
||||
height = (base->height.type == DJUI_SVT_ASPECT_RATIO) ? width * base->height.value : height;
|
||||
|
||||
if (parent != NULL) {
|
||||
// horizontal alignment
|
||||
if (base->hAlign == DJUI_HALIGN_CENTER) {
|
||||
x += (parent->comp.width - width) / 2.0f;
|
||||
|
@ -155,7 +156,6 @@ void djui_base_compute(struct DjuiBase* base) {
|
|||
}
|
||||
|
||||
// offset comp on parent's location
|
||||
if (base->parent != NULL) {
|
||||
x += parent->comp.x;
|
||||
y += parent->comp.y;
|
||||
}
|
||||
|
|
|
@ -94,6 +94,7 @@ struct ModCacheEntry* mod_cache_get_from_hash(u8* dataHash) {
|
|||
return node;
|
||||
} else {
|
||||
mod_cache_remove_node(node, prev);
|
||||
node = prev;
|
||||
}
|
||||
}
|
||||
prev = node;
|
||||
|
@ -115,6 +116,7 @@ struct ModCacheEntry* mod_cache_get_from_path(const char* path, bool validate) {
|
|||
return node;
|
||||
} else {
|
||||
mod_cache_remove_node(node, prev);
|
||||
node = prev;
|
||||
}
|
||||
}
|
||||
prev = node;
|
||||
|
@ -278,8 +280,8 @@ void mod_cache_load(void) {
|
|||
fread(&lastLoaded, sizeof(u64), 1, fp);
|
||||
fread(&pathLen, sizeof(u16), 1, fp);
|
||||
|
||||
const char* path = calloc(pathLen + 1, sizeof(u8));
|
||||
fread((char*)path, sizeof(u8), pathLen + 1, fp);
|
||||
const char* path = calloc(pathLen + 1, sizeof(char*));
|
||||
fread((char*)path, sizeof(char*), pathLen + 1, fp);
|
||||
|
||||
mod_cache_add_internal(dataHash, lastLoaded, path);
|
||||
count++;
|
||||
|
|
|
@ -25,6 +25,7 @@ static bool mod_import_lua(char* src) {
|
|||
FILE* fout = fopen(dst, "wb");
|
||||
if (fout == NULL) {
|
||||
LOG_ERROR("Failed to open dst path for lua mod import");
|
||||
fclose(fin);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue