Cleanup: Use enum type for brush type switch

This way we'll get a compiler warning when a new brush type is added,
and not handled in the switch. Plus a runtime warning when an invalid
value is cast to the enum. Both can help catching errors.
This commit is contained in:
Julian Eisel
2024-09-23 15:44:32 +02:00
parent 8c3a3bb9a3
commit a91ec1ddb0

View File

@@ -789,13 +789,17 @@ static void paint_brush_default_essentials_name_get(
name = "Pencil";
/* Different default brush for some brush types. */
if (brush_type) {
switch (*brush_type) {
switch (eBrushGPaintType(*brush_type)) {
case GPAINT_BRUSH_TYPE_ERASE:
name = "Eraser Hard";
break;
case GPAINT_BRUSH_TYPE_FILL:
name = "Fill Area";
break;
case GPAINT_BRUSH_TYPE_DRAW:
case GPAINT_BRUSH_TYPE_TINT:
/* Use default, don't override. */
break;
}
}
eraser_name = "Eraser Soft";