Skip to content

Commit

Permalink
Source/Common/Platform: Explicitly include <cstdint>
Browse files Browse the repository at this point in the history
GCC 15 will no longer include <cstdint> by default, resulting in build
failures in projects that do not explicitly include it.

Errors:

Source/Common/Platform/NMR_EncryptionHeader.cpp:
In member function ‘size_t NMR::CEncryptionHeader::readFrom(NMR::PImportStream)’:
Source/Common/Platform/NMR_EncryptionHeader.cpp:35:52:
error: ‘uint64_t’ was not declared in this scope
   35 |                 if (header.Header.Length.length < (uint64_t) headerSize)
      |                                                    ^~~~~~~~
Source/Common/Platform/NMR_EncryptionHeader.cpp:12:1:
note: ‘uint64_t’ is defined in header ‘<cstdint>’; this is probably fixable by adding ‘#include <cstdint>’
   11 | #include <cstring>
  +++ |+#include <cstdint>
   12 |

Source/Common/Platform/NMR_ImportStream_Unique_Memory.cpp:
In member function ‘virtual const NMR::nfByte* NMR::CImportStream_Unique_Memory::getAt(NMR::nfUint64)’:
Source/Common/Platform/NMR_ImportStream_Unique_Memory.cpp:128:35:
error: ‘uint64_t’ was not declared in this scope
  128 |                 if (nPosition >= (uint64_t) m_Buffer.size())
      |                                   ^~~~~~~~
Source/Common/Platform/NMR_ImportStream_Unique_Memory.cpp:37:1:
note: ‘uint64_t’ is defined in header ‘<cstdint>’; this is probably fixable by adding ‘#include <cstdint>’
   36 | #include "Common/NMR_Exception_Windows.h"
  +++ |+#include <cstdint>
   37 |

Test results:

Test project lib3mf/build
    Start 1: Test_CPP_Bindings
1/1 Test #1: Test_CPP_Bindings ................   Passed    0.39 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) =   0.39 sec

Gentoo bug: https://bugs.gentoo.org/937423
See-also: https://gcc.gnu.org/pipermail/gcc-cvs/2024-August/407124.html
Signed-off-by: Christopher Fore <[email protected]>
  • Loading branch information
csfore committed Aug 9, 2024
1 parent 5746aa3 commit 4748d6a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Source/Common/Platform/NMR_EncryptionHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "Common/Platform/NMR_ExportStream.h"

#include "Common/NMR_Architecture_Utils.h"
#include <cstdint>
#include <cstring>

#define LIB3MF_MAXENCRYPTIONHEADERSIZE (1UL << 31)
Expand Down Expand Up @@ -67,4 +68,4 @@ namespace NMR {
nfUint64 CEncryptionHeader::headerSize() const {
return m_nfHeaderSize;
}
}
}
4 changes: 3 additions & 1 deletion Source/Common/Platform/NMR_ImportStream_Unique_Memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ This is a platform independent class for keeping data in a memory stream that ow
#include "Common/NMR_Exception.h"
#include "Common/NMR_Exception_Windows.h"

#include <cstdint>

namespace NMR {

CImportStream_Unique_Memory::CImportStream_Unique_Memory()
Expand Down Expand Up @@ -132,4 +134,4 @@ namespace NMR {
return &m_Buffer[(size_t) nPosition];
}

}
}

0 comments on commit 4748d6a

Please sign in to comment.