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:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user