Skip to content

Commit

Permalink
Merge pull request OSGeo#11201 from rouault/msvc_warning_fixes
Browse files Browse the repository at this point in the history
Fix MSVC warnings
  • Loading branch information
rouault authored Nov 4, 2024
2 parents a76fe42 + 32b0d0d commit 79f6f3e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 11 deletions.
3 changes: 3 additions & 0 deletions ogr/ogrsf_frmts/arrow_common/ogr_include_arrow.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
// warning 4244: 'initializing': conversion from 'int32_t' to 'int16_t',
// possible loss of data
#pragma warning(disable : 4244)
// warning C4324: 'arrow::internal::MemoryPoolStats': structure was padded
// due to alignment specifier
#pragma warning(disable : 4324)
// warning 4458: declaration of 'type_id' hides class member
#pragma warning(disable : 4458)
#endif
Expand Down
44 changes: 33 additions & 11 deletions third_party/libertiff/libertiff.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,14 @@ constexpr TagCodeType GeoTIFFPixelScale = 33550;
constexpr TagCodeType GeoTIFFTiePoints = 33922;
constexpr TagCodeType GeoTIFFGeoKeyDirectory = 34735;
constexpr TagCodeType GeoTIFFAsciiParams = 34737;

// GDAL tags
constexpr TagCodeType GDAL_METADATA = 42112;
constexpr TagCodeType GDAL_NODATA = 42113;

// GeoTIFF related
constexpr TagCodeType RPCCoefficients = 50844;

} // namespace TagCode

#define LIBERTIFF_CASE_TAGCODE_STR(x) \
Expand Down Expand Up @@ -438,6 +446,9 @@ inline const char *tagCodeName(TagCodeType tagCode)
LIBERTIFF_CASE_TAGCODE_STR(GeoTIFFTiePoints);
LIBERTIFF_CASE_TAGCODE_STR(GeoTIFFGeoKeyDirectory);
LIBERTIFF_CASE_TAGCODE_STR(GeoTIFFAsciiParams);
LIBERTIFF_CASE_TAGCODE_STR(GDAL_METADATA);
LIBERTIFF_CASE_TAGCODE_STR(GDAL_NODATA);
LIBERTIFF_CASE_TAGCODE_STR(RPCCoefficients);
default:
break;
}
Expand Down Expand Up @@ -1334,18 +1345,29 @@ class Image
/** Final tag processing */
void finalTagProcessing()
{
if ((m_strileOffsetsTag = tag(TagCode::TileOffsets)) &&
(m_strileByteCountsTag = tag(TagCode::TileByteCounts)) &&
m_strileOffsetsTag->count == m_strileByteCountsTag->count)
m_strileOffsetsTag = tag(TagCode::TileOffsets);
if (m_strileOffsetsTag)
{
m_isTiled = true;
m_strileCount = m_strileOffsetsTag->count;
m_strileByteCountsTag = tag(TagCode::TileByteCounts);
if (m_strileByteCountsTag &&
m_strileOffsetsTag->count == m_strileByteCountsTag->count)
{
m_isTiled = true;
m_strileCount = m_strileOffsetsTag->count;
}
}
else if ((m_strileOffsetsTag = tag(TagCode::StripOffsets)) &&
(m_strileByteCountsTag = tag(TagCode::StripByteCounts)) &&
m_strileOffsetsTag->count == m_strileByteCountsTag->count)
else
{
m_strileCount = m_strileOffsetsTag->count;
m_strileOffsetsTag = tag(TagCode::StripOffsets);
if (m_strileOffsetsTag)
{
m_strileByteCountsTag = tag(TagCode::StripByteCounts);
if (m_strileByteCountsTag &&
m_strileOffsetsTag->count == m_strileByteCountsTag->count)
{
m_strileCount = m_strileOffsetsTag->count;
}
}
}
}

Expand Down Expand Up @@ -1451,7 +1473,7 @@ class Image
}
else if (dataTypeSize == sizeof(uint16_t))
{
// Read up to 2 (classic) or 4 (BigTIFF) inline bytes
// Read up to 2 (classic) or 4 (BigTIFF) inline 16-bit values
for (uint32_t idx = 0; idx < entry.count; ++idx)
{
entry.uint16Values[idx] =
Expand All @@ -1465,7 +1487,7 @@ class Image
}
else if (dataTypeSize == sizeof(uint32_t))
{
// Read up to 1 (classic) or 2 (BigTIFF) inline bytes
// Read up to 1 (classic) or 2 (BigTIFF) inline 32-bit values
entry.uint32Values[0] = m_rc->read<uint32_t>(offset, ok);
if (entry.count == 1 && entry.type == TagType::Long)
{
Expand Down

0 comments on commit 79f6f3e

Please sign in to comment.