Skip to content

Commit a210409

Browse files
NSProgrammermeta-codesync[bot]
authored andcommitted
Add missing default cases (#54639)
Summary: Changelog: [iOS] [Fixed] - Fix missing default statements for projects that have `-Wswitch-default` enabled (along with `-Wswitch-enum`). Pull Request resolved: #54639 Differential Revision: D87663453 Pulled By: NSProgrammer fbshipit-source-id: 739b7cc000fb7858bb1ae9d202a3869eda6ac3a3
1 parent 2285512 commit a210409

File tree

1 file changed

+15
-6
lines changed
  • packages/react-native/ReactCommon/react/renderer/imagemanager

1 file changed

+15
-6
lines changed

packages/react-native/ReactCommon/react/renderer/imagemanager/primitives.h

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <string>
1111
#include <vector>
1212

13+
#include <react/debug/react_native_assert.h>
1314
#include <react/renderer/core/graphicsConversions.h>
1415
#include <react/renderer/core/propsConversions.h>
1516
#include <react/renderer/debug/debugStringConvertibleUtils.h>
@@ -48,15 +49,16 @@ class ImageSource {
4849
{
4950
folly::dynamic imageSourceResult = folly::dynamic::object();
5051
switch (type) {
51-
case ImageSource::Type::Invalid:
52-
imageSourceResult["type"] = "invalid";
53-
break;
5452
case ImageSource::Type::Remote:
5553
imageSourceResult["type"] = "remote";
5654
break;
5755
case ImageSource::Type::Local:
5856
imageSourceResult["type"] = "local";
5957
break;
58+
case ImageSource::Type::Invalid:
59+
default:
60+
imageSourceResult["type"] = "invalid";
61+
break;
6062
}
6163

6264
imageSourceResult["uri"] = uri;
@@ -72,9 +74,6 @@ class ImageSource {
7274
imageSourceResult["method"] = method;
7375

7476
switch (cache) {
75-
case ImageSource::CacheStategy::Default:
76-
imageSourceResult["cache"] = "default";
77-
break;
7877
case ImageSource::CacheStategy::Reload:
7978
imageSourceResult["cache"] = "reload";
8079
break;
@@ -84,6 +83,10 @@ class ImageSource {
8483
case ImageSource::CacheStategy::OnlyIfCached:
8584
imageSourceResult["cache"] = "only-if-cached";
8685
break;
86+
case ImageSource::CacheStategy::Default:
87+
default:
88+
imageSourceResult["cache"] = "default";
89+
break;
8790
}
8891

8992
folly::dynamic headersObject = folly::dynamic::object();
@@ -128,6 +131,9 @@ class ImageSource {
128131
return "remote";
129132
case ImageSource::Type::Local:
130133
return "local";
134+
default:
135+
react_native_assert(false && "Invalid ImageSource::Type");
136+
return "";
131137
}
132138
}
133139

@@ -142,6 +148,9 @@ class ImageSource {
142148
return "force-cache";
143149
case ImageSource::CacheStategy::OnlyIfCached:
144150
return "only-if-cached";
151+
default:
152+
react_native_assert(false && "Invalid ImageSource::CacheStategy");
153+
return "";
145154
}
146155
}
147156
#endif

0 commit comments

Comments
 (0)