Skip to content

Commit 0db7367

Browse files
NSProgrammermeta-codesync[bot]
authored andcommitted
Add missing default cases
Summary: **Context:** https://fburl.com/switch-enum ---- Now that `-Wswitch-enum` is an error in all of `fbobjc`, making it such that all enum values need a case within a switch regardless of having a default case, we want to also enable `-Wswitch-default` as an error (ensuring we cover all values outside the given enum's values). This will reduce SEVs as it will eliminate undefined behavior when a value outside the enum range is switched upon. Differential Revision: D87663451 fbshipit-source-id: 3eee5dfe84462b9c8deaa35d79c2ecd2027ce8a5
1 parent f6eb169 commit 0db7367

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

impl/ocean/cv/Canvas.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,9 @@ bool Canvas::line(Frame& frame, const Vector2& start, const Vector2& end, const
946946
case 4u:
947947
line8BitPerChannel<4u, tSize>(frame.data<uint8_t>(), frame.width(), frame.height(), start, end, value, frame.paddingElements());
948948
return true;
949+
950+
default:
951+
break;
949952
}
950953
}
951954

@@ -1046,6 +1049,9 @@ bool Canvas::line(Frame& frame, const Line2& line, const uint8_t* value)
10461049
case 4u:
10471050
line8BitPerChannel<4u, tSize>(frame.data<uint8_t>(), frame.width(), frame.height(), line, value, frame.paddingElements());
10481051
return true;
1052+
1053+
default:
1054+
break;
10491055
}
10501056
}
10511057

@@ -1110,6 +1116,9 @@ bool Canvas::box(Frame& frame, const Box2& box, const uint8_t* value)
11101116
case 4u:
11111117
box8BitPerChannel<4u, tSize>(frame.data<uint8_t>(), frame.width(), frame.height(), box, value, frame.paddingElements());
11121118
return true;
1119+
1120+
default:
1121+
break;
11131122
}
11141123
}
11151124

@@ -1234,6 +1243,9 @@ bool Canvas::point(Frame& frame, const Vector2& position, const uint8_t* value)
12341243
case 4u:
12351244
point8BitPerChannel<4u, tSize, tPixelCenter>(frame.data<uint8_t>(), frame.width(), frame.height(), position, value, frame.paddingElements());
12361245
return true;
1246+
1247+
default:
1248+
break;
12371249
}
12381250
}
12391251

@@ -1283,6 +1295,9 @@ bool Canvas::points(Frame& frame, const Vectors2& positions, const uint8_t* valu
12831295
case 4u:
12841296
points8BitPerChannel<4u, tSize, tPixelCenter>(frame.data<uint8_t>(), frame.width(), frame.height(), positions, value, frame.paddingElements());
12851297
return true;
1298+
1299+
default:
1300+
break;
12861301
}
12871302
}
12881303

@@ -1630,6 +1645,9 @@ bool Canvas::polygon(Frame& frame, const Vector2* points, size_t numberPoints, c
16301645
case 4u:
16311646
polygon8BitPerChannel<4u, tSize>(frame.data<uint8_t>(), frame.width(), frame.height(), points, numberPoints, value, closeLoop);
16321647
return true;
1648+
1649+
default:
1650+
break;
16331651
}
16341652
}
16351653

impl/ocean/cv/FrameInterpolatorBilinear.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,6 +1474,9 @@ bool FrameInterpolatorBilinear::Comfort::interpolatePixel8BitPerChannel(const ui
14741474
case 8u:
14751475
FrameInterpolatorBilinear::interpolatePixel8BitPerChannel<8u, PC_TOP_LEFT, TScalar>(frame, width, height, framePaddingElements, position, result);
14761476
return true;
1477+
1478+
default:
1479+
break;
14771480
}
14781481
}
14791482
else
@@ -1513,6 +1516,9 @@ bool FrameInterpolatorBilinear::Comfort::interpolatePixel8BitPerChannel(const ui
15131516
case 8u:
15141517
FrameInterpolatorBilinear::interpolatePixel8BitPerChannel<8u, PC_CENTER, TScalar>(frame, width, height, framePaddingElements, position, result);
15151518
return true;
1519+
1520+
default:
1521+
break;
15161522
}
15171523
}
15181524

@@ -1561,6 +1567,9 @@ bool FrameInterpolatorBilinear::Comfort::interpolatePixel(const TSource* frame,
15611567
case 8u:
15621568
FrameInterpolatorBilinear::interpolatePixel<TSource, TTarget, 8u, PC_TOP_LEFT, TScalar, TIntermediate>(frame, width, height, framePaddingElements, position, result, resultBias);
15631569
return true;
1570+
1571+
default:
1572+
break;
15641573
}
15651574
}
15661575
else
@@ -1600,6 +1609,9 @@ bool FrameInterpolatorBilinear::Comfort::interpolatePixel(const TSource* frame,
16001609
case 8u:
16011610
FrameInterpolatorBilinear::interpolatePixel<TSource, TTarget, 8u, PC_CENTER, TScalar, TIntermediate>(frame, width, height, framePaddingElements, position, result, resultBias);
16021611
return true;
1612+
1613+
default:
1614+
break;
16031615
}
16041616
}
16051617

0 commit comments

Comments
 (0)