Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
3e3f8a47
Unverified
Commit
3e3f8a47
authored
Feb 11, 2020
by
Rémi Verschelde
Committed by
GitHub
Feb 11, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #36097 from madmiraal/fix-c4715-warning
Prevent Visual Studio compiler throwing C4715: not all control paths return a value.
parents
0b4b2488
a3b938d6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
19 deletions
+14
-19
list.h
core/list.h
+4
-14
image_saver_tinyexr.cpp
modules/tinyexr/image_saver_tinyexr.cpp
+10
-5
No files found.
core/list.h
View file @
3e3f8a47
...
@@ -456,17 +456,12 @@ public:
...
@@ -456,17 +456,12 @@ public:
Element
*
I
=
front
();
Element
*
I
=
front
();
int
c
=
0
;
int
c
=
0
;
while
(
I
)
{
while
(
c
<
p_index
)
{
if
(
c
==
p_index
)
{
return
I
->
get
();
}
I
=
I
->
next
();
I
=
I
->
next
();
c
++
;
c
++
;
}
}
CRASH_NOW
();
// bug!!
return
I
->
get
();
}
}
const
T
&
operator
[](
int
p_index
)
const
{
const
T
&
operator
[](
int
p_index
)
const
{
...
@@ -475,17 +470,12 @@ public:
...
@@ -475,17 +470,12 @@ public:
const
Element
*
I
=
front
();
const
Element
*
I
=
front
();
int
c
=
0
;
int
c
=
0
;
while
(
I
)
{
while
(
c
<
p_index
)
{
if
(
c
==
p_index
)
{
return
I
->
get
();
}
I
=
I
->
next
();
I
=
I
->
next
();
c
++
;
c
++
;
}
}
CRASH_NOW
();
// bug!!
return
I
->
get
();
}
}
void
move_to_back
(
Element
*
p_I
)
{
void
move_to_back
(
Element
*
p_I
)
{
...
...
modules/tinyexr/image_saver_tinyexr.cpp
View file @
3e3f8a47
...
@@ -58,7 +58,8 @@ static bool is_supported_format(Image::Format p_format) {
...
@@ -58,7 +58,8 @@ static bool is_supported_format(Image::Format p_format) {
enum
SrcPixelType
{
enum
SrcPixelType
{
SRC_FLOAT
,
SRC_FLOAT
,
SRC_HALF
,
SRC_HALF
,
SRC_BYTE
SRC_BYTE
,
SRC_UNSUPPORTED
};
};
static
SrcPixelType
get_source_pixel_type
(
Image
::
Format
p_format
)
{
static
SrcPixelType
get_source_pixel_type
(
Image
::
Format
p_format
)
{
...
@@ -79,7 +80,7 @@ static SrcPixelType get_source_pixel_type(Image::Format p_format) {
...
@@ -79,7 +80,7 @@ static SrcPixelType get_source_pixel_type(Image::Format p_format) {
case
Image
:
:
FORMAT_RGBA8
:
case
Image
:
:
FORMAT_RGBA8
:
return
SRC_BYTE
;
return
SRC_BYTE
;
default:
default:
CRASH_NOW
()
;
return
SRC_UNSUPPORTED
;
}
}
}
}
...
@@ -101,7 +102,7 @@ static int get_target_pixel_type(Image::Format p_format) {
...
@@ -101,7 +102,7 @@ static int get_target_pixel_type(Image::Format p_format) {
case
Image
:
:
FORMAT_RGBA8
:
case
Image
:
:
FORMAT_RGBA8
:
return
TINYEXR_PIXELTYPE_HALF
;
return
TINYEXR_PIXELTYPE_HALF
;
default:
default:
CRASH_NOW
()
;
return
-
1
;
}
}
}
}
...
@@ -112,7 +113,7 @@ static int get_pixel_type_size(int p_pixel_type) {
...
@@ -112,7 +113,7 @@ static int get_pixel_type_size(int p_pixel_type) {
case
TINYEXR_PIXELTYPE_FLOAT
:
case
TINYEXR_PIXELTYPE_FLOAT
:
return
4
;
return
4
;
}
}
CRASH_NOW
()
;
return
-
1
;
}
}
static
int
get_channel_count
(
Image
::
Format
p_format
)
{
static
int
get_channel_count
(
Image
::
Format
p_format
)
{
...
@@ -134,7 +135,7 @@ static int get_channel_count(Image::Format p_format) {
...
@@ -134,7 +135,7 @@ static int get_channel_count(Image::Format p_format) {
case
Image
:
:
FORMAT_RGBA8
:
case
Image
:
:
FORMAT_RGBA8
:
return
4
;
return
4
;
default:
default:
CRASH_NOW
()
;
return
-
1
;
}
}
}
}
...
@@ -173,11 +174,15 @@ Error save_exr(const String &p_path, const Ref<Image> &p_img, bool p_grayscale)
...
@@ -173,11 +174,15 @@ Error save_exr(const String &p_path, const Ref<Image> &p_img, bool p_grayscale)
};
};
int
channel_count
=
get_channel_count
(
format
);
int
channel_count
=
get_channel_count
(
format
);
ERR_FAIL_COND_V
(
channel_count
<
0
,
ERR_UNAVAILABLE
);
ERR_FAIL_COND_V
(
p_grayscale
&&
channel_count
!=
1
,
ERR_INVALID_PARAMETER
);
ERR_FAIL_COND_V
(
p_grayscale
&&
channel_count
!=
1
,
ERR_INVALID_PARAMETER
);
int
target_pixel_type
=
get_target_pixel_type
(
format
);
int
target_pixel_type
=
get_target_pixel_type
(
format
);
ERR_FAIL_COND_V
(
target_pixel_type
<
0
,
ERR_UNAVAILABLE
);
int
target_pixel_type_size
=
get_pixel_type_size
(
target_pixel_type
);
int
target_pixel_type_size
=
get_pixel_type_size
(
target_pixel_type
);
ERR_FAIL_COND_V
(
target_pixel_type_size
<
0
,
ERR_UNAVAILABLE
);
SrcPixelType
src_pixel_type
=
get_source_pixel_type
(
format
);
SrcPixelType
src_pixel_type
=
get_source_pixel_type
(
format
);
ERR_FAIL_COND_V
(
src_pixel_type
=
SRC_UNSUPPORTED
,
ERR_UNAVAILABLE
);
const
int
pixel_count
=
p_img
->
get_width
()
*
p_img
->
get_height
();
const
int
pixel_count
=
p_img
->
get_width
()
*
p_img
->
get_height
();
const
int
*
channel_mapping
=
channel_mappings
[
channel_count
-
1
];
const
int
*
channel_mapping
=
channel_mappings
[
channel_count
-
1
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment