Code Monkey home page Code Monkey logo

Comments (1)

vloup avatar vloup commented on June 8, 2024

Not a proper fix, and totally untested, but it seems it does fully build with that patch:

diff --git a/source/libsmackerdec/src/FileStream.cpp b/source/libsmackerdec/src/FileStream.cpp
index da3b12f..febd8c7 100644
--- a/source/libsmackerdec/src/FileStream.cpp
+++ b/source/libsmackerdec/src/FileStream.cpp
@@ -19,6 +19,7 @@
 
 #include "FileStream.h"
 #include <stdlib.h>
+#include <byteswap.h>
 
 namespace SmackerCommon {
 
@@ -47,10 +48,10 @@ void FileStream::Close()
 
 int32_t FileStream::ReadBytes(uint8_t *data, uint32_t nBytes)
 {
-    int32_t nCount = kread(file, data, static_cast<int32_t>(nBytes));
+	uint32_t nCount = (uint32_t) kread(file, data, static_cast<int32_t>(nBytes));
 
-    if (nCount != nBytes)
-        return 0;
+	if (nCount != nBytes)
+		return 0;
 
 	return nCount;
 }
@@ -65,8 +66,8 @@ uint32_t FileStream::ReadUint32LE()
 uint32_t FileStream::ReadUint32BE()
 {
 	uint32_t value;
-    kread(file, &value, 4);
-	return _byteswap_ulong(value);
+	kread(file, &value, 4);
+	return bswap_32(value);
 }
 
 uint16_t FileStream::ReadUint16LE()
@@ -79,8 +80,8 @@ uint16_t FileStream::ReadUint16LE()
 uint16_t FileStream::ReadUint16BE()
 {
 	uint16_t value;
-    kread(file, &value, 2);
-	return _byteswap_ushort(value);
+	kread(file, &value, 2);
+	return bswap_16(value);
 }
 
 uint8_t FileStream::ReadByte()

from nblood.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.