Avoid -Wcovered-switch-default errors in XFA code
When all the cases in a switch statement have been covered, there is no
need for the default case. Remove them as they are dead code.
Bug: chromium:1393075
Change-Id: Ica543e0d35f6ce2233c53d188a6d7e73be7d56f0
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/106610
Reviewed-by: Nigi <nigi@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fxjs/xfa/cjx_eventpseudomodel.cpp b/fxjs/xfa/cjx_eventpseudomodel.cpp
index 72309dc..cd49642 100644
--- a/fxjs/xfa/cjx_eventpseudomodel.cpp
+++ b/fxjs/xfa/cjx_eventpseudomodel.cpp
@@ -309,7 +309,6 @@
bSetting);
break;
case XFA_Event::Target:
- default:
break;
}
}
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index 9d6cdf9..ffbd51f 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -241,8 +241,6 @@
case XFA_AttributeType::Measure:
SetMeasure(eAttr, CXFA_Measurement(wsValue.AsStringView()), bNotify);
break;
- default:
- break;
}
}
@@ -301,8 +299,6 @@
return absl::nullopt;
return value->ToString();
}
- default:
- break;
}
return absl::nullopt;
}
diff --git a/testing/fuzzers/pdf_xfa_fdp_fuzzer.cc b/testing/fuzzers/pdf_xfa_fdp_fuzzer.cc
index c438c89..cefd09d 100644
--- a/testing/fuzzers/pdf_xfa_fdp_fuzzer.cc
+++ b/testing/fuzzers/pdf_xfa_fdp_fuzzer.cc
@@ -159,9 +159,6 @@
FORM_GetFocusedText(form, page, local_buf, sizeof(local_buf));
break;
}
- default: {
- break;
- }
}
}
}
diff --git a/xfa/fgas/crt/cfgas_stringformatter.cpp b/xfa/fgas/crt/cfgas_stringformatter.cpp
index f705175..30d16ec 100644
--- a/xfa/fgas/crt/cfgas_stringformatter.cpp
+++ b/xfa/fgas/crt/cfgas_stringformatter.cpp
@@ -1735,7 +1735,6 @@
ParseLocaleDate(wsSrcDateTime, wsDatePattern, pLocale, dtValue,
&iStart);
case DateTimeType::kUnknown:
- default:
return false;
}
}
diff --git a/xfa/fgas/graphics/cfgas_gegraphics.cpp b/xfa/fgas/graphics/cfgas_gegraphics.cpp
index c909183..7525abc 100644
--- a/xfa/fgas/graphics/cfgas_gegraphics.cpp
+++ b/xfa/fgas/graphics/cfgas_gegraphics.cpp
@@ -390,10 +390,6 @@
result = true;
break;
}
- default: {
- result = false;
- break;
- }
}
if (result) {
CFX_RenderDevice::StateRestorer restorer(m_renderDevice);
diff --git a/xfa/fgas/layout/cfgas_rtfbreak.cpp b/xfa/fgas/layout/cfgas_rtfbreak.cpp
index 66192dc..540a226 100644
--- a/xfa/fgas/layout/cfgas_rtfbreak.cpp
+++ b/xfa/fgas/layout/cfgas_rtfbreak.cpp
@@ -113,7 +113,6 @@
case FX_CHARTYPE::kSpace:
case FX_CHARTYPE::kNumeric:
case FX_CHARTYPE::kNormal:
- default:
dwRet2 = AppendChar_Others(pCurChar);
break;
}
diff --git a/xfa/fgas/layout/cfgas_txtbreak.cpp b/xfa/fgas/layout/cfgas_txtbreak.cpp
index e00ab02..22a6277 100644
--- a/xfa/fgas/layout/cfgas_txtbreak.cpp
+++ b/xfa/fgas/layout/cfgas_txtbreak.cpp
@@ -260,7 +260,6 @@
case FX_CHARTYPE::kSpace:
case FX_CHARTYPE::kNumeric:
case FX_CHARTYPE::kNormal:
- default:
dwRet2 = AppendChar_Others(pCurChar);
break;
}
diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp
index dbd29e1..338f6ab 100644
--- a/xfa/fwl/cfwl_listbox.cpp
+++ b/xfa/fwl/cfwl_listbox.cpp
@@ -617,8 +617,6 @@
OnKeyDown(pMsg);
break;
}
- default:
- break;
}
// Dst target could be |this|, continue only if not destroyed by above.
if (pMessage->GetDstTarget())
diff --git a/xfa/fwl/cfwl_notedriver.cpp b/xfa/fwl/cfwl_notedriver.cpp
index e6bcfe8..f3506d6 100644
--- a/xfa/fwl/cfwl_notedriver.cpp
+++ b/xfa/fwl/cfwl_notedriver.cpp
@@ -131,8 +131,6 @@
return false;
break;
}
- default:
- break;
}
IFWL_WidgetDelegate* pDelegate = pMessage->GetDstTarget()->GetDelegate();
if (pDelegate)
diff --git a/xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp b/xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp
index 1d827f3..ac68171 100644
--- a/xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp
+++ b/xfa/fxfa/layout/cxfa_contentlayoutprocessor.cpp
@@ -1849,7 +1849,6 @@
case Result::kRowFullBreak:
goto SuspendAndCreateNewRow;
case Result::kDone:
- default:
fContentCurRowY +=
pProcessor->InsertPendingItems(m_pCurChildNode);
pProcessor = nullptr;
@@ -1859,8 +1858,6 @@
}
case Stage::kDone:
break;
- default:
- break;
}
GotoNextContainerNodeSimple();
if (bAddedItemInRow && eFlowStrategy == XFA_AttributeValue::Tb)
diff --git a/xfa/fxfa/parser/cxfa_localemgr.cpp b/xfa/fxfa/parser/cxfa_localemgr.cpp
index 53444b0..f49275e 100644
--- a/xfa/fxfa/parser/cxfa_localemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_localemgr.cpp
@@ -1199,7 +1199,6 @@
case LangID::k_ru_RU:
return GetLocaleFromBuffer(m_pHeap, k_ruRU_Locale);
case LangID::k_en_US:
- default:
return GetLocaleFromBuffer(m_pHeap, k_enUS_Locale);
}
}