WSL/SLF GitLab Repository
Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
snow-models
meteoio
Commits
c94c08e9
Commit
c94c08e9
authored
Mar 09, 2016
by
Mathias Bavay
Browse files
Now CLang can compile PNGIO out of the box on osX!
parent
07e0a8a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
meteoio/plugins/PNGIO.cc
View file @
c94c08e9
...
...
@@ -307,14 +307,14 @@ void PNGIO::setFile(const std::string& filename, png_structp& png_ptr, png_infop
// Write header (8 bit colour depth). Full alpha channel with PNG_COLOR_TYPE_RGB_ALPHA
if
(
indexed_png
)
{
png_set_IHDR
(
png_ptr
,
info_ptr
,
width
,
height
,
png_set_IHDR
(
png_ptr
,
info_ptr
,
static_cast
<
png_uint_32
>
(
width
)
,
static_cast
<
png_uint_32
>
(
height
)
,
channel_depth
,
PNG_COLOR_TYPE_PALETTE
,
PNG_INTERLACE_NONE
,
PNG_COMPRESSION_TYPE_BASE
,
PNG_FILTER_TYPE_BASE
);
//set transparent color (ie: cheap transparency: leads to smaller files and shorter run times)
png_byte
trans
=
0
;
//by convention, the gradient define it as color 0
png_set_tRNS
(
png_ptr
,
info_ptr
,
&
trans
,
1
,
0
);
}
else
{
png_set_IHDR
(
png_ptr
,
info_ptr
,
width
,
height
,
png_set_IHDR
(
png_ptr
,
info_ptr
,
static_cast
<
png_uint_32
>
(
width
)
,
static_cast
<
png_uint_32
>
(
height
)
,
channel_depth
,
PNG_COLOR_TYPE_RGB
,
PNG_INTERLACE_NONE
,
PNG_COMPRESSION_TYPE_BASE
,
PNG_FILTER_TYPE_BASE
);
//set transparent color (ie: cheap transparency: leads to smaller files and shorter run times)
...
...
@@ -721,9 +721,11 @@ void PNGIO::writeMetadata(png_structp &png_ptr, png_infop &info_ptr)
key
[
ii
]
=
(
char
*
)
calloc
(
sizeof
(
char
),
max_len
);
text
[
ii
]
=
(
char
*
)
calloc
(
sizeof
(
char
),
max_len
);
strncpy
(
key
[
ii
],
metadata_key
[
ii
].
c_str
(),
max_len
-
1
);
//in case the '\0' was not counted by maxlen
key
[
ii
][
max_len
-
1
]
=
'\0'
;
//make sure it is null terminated
strncpy
(
text
[
ii
],
metadata_text
[
ii
].
c_str
(),
max_len
-
1
);
info_text
[
ii
].
key
=
key
[
ii
]
+
'\0'
;
//strncpy does not always '\0' terminate
info_text
[
ii
].
text
=
text
[
ii
]
+
'\0'
;
text
[
ii
][
max_len
-
1
]
=
'\0'
;
//make sure it is null terminated
info_text
[
ii
].
key
=
key
[
ii
];
info_text
[
ii
].
text
=
text
[
ii
];
info_text
[
ii
].
compression
=
PNG_TEXT_COMPRESSION_NONE
;
}
...
...
Write
Preview
Supports
Markdown
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