Commit 75ffbb73 authored by Andrea Bulgarelli's avatar Andrea Bulgarelli
Browse files

long PacketLib::ByteStream::getValue() and bool PacketNotRecognized::createPacketType()

parent f57e65bd
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -112,6 +112,7 @@
/* End PBXCopyFilesBuildPhase section */
/* End PBXCopyFilesBuildPhase section */


/* Begin PBXFileReference section */
/* Begin PBXFileReference section */
		DD3AB43119459AFB00498F60 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
		DD6C793419255A5500406949 /* ChangeLog */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ChangeLog; sourceTree = "<group>"; };
		DD6C793419255A5500406949 /* ChangeLog */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ChangeLog; sourceTree = "<group>"; };
		DD6C793519255A5E00406949 /* Doxyfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Doxyfile; sourceTree = "<group>"; };
		DD6C793519255A5E00406949 /* Doxyfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Doxyfile; sourceTree = "<group>"; };
		DD6C793619255A6A00406949 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
		DD6C793619255A6A00406949 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
@@ -225,6 +226,7 @@
		DDB3B85F18CA2F5C00918955 = {
		DDB3B85F18CA2F5C00918955 = {
			isa = PBXGroup;
			isa = PBXGroup;
			children = (
			children = (
				DD3AB43119459AFB00498F60 /* Makefile */,
				DD6C793619255A6A00406949 /* README */,
				DD6C793619255A6A00406949 /* README */,
				DD6C793519255A5E00406949 /* Doxyfile */,
				DD6C793519255A5E00406949 /* Doxyfile */,
				DD6C793419255A5500406949 /* ChangeLog */,
				DD6C793419255A5500406949 /* ChangeLog */,
+1.16 KiB (41.5 KiB)

File changed.

No diff preview for this file type.

+1 −1
Original line number Original line Diff line number Diff line
@@ -100,7 +100,7 @@ public:


    /// Get the value in the stream starting from position start and of dim dimension
    /// Get the value in the stream starting from position start and of dim dimension
    /// \param start Start position in the stream of byte
    /// \param start Start position in the stream of byte
    /// \param dim number of byte (1 oe 2)
    /// \param dim number of byte (1 or 2)
    long getValue(dword start, word dim);
    long getValue(dword start, word dim);


    /// Gets the dimension of the stream
    /// Gets the dimension of the stream
+9 −3
Original line number Original line Diff line number Diff line
@@ -226,8 +226,12 @@ long PacketLib::ByteStream::getValue(dword start, word dim)
{
{
    DEMORET0;
    DEMORET0;
    byte b1, b2;
    byte b1, b2;
	
	if(start >= byteInTheStream)
		throw new PacketException("PacketLib::ByteStream::getValue() start greater than the size of the ByteStream");
	
    /// only 1 or 2 bytes
    /// only 1 or 2 bytes
    if(dim <=0 || dim > 2)
    if(dim == 0 || dim > 2)
    	/// error
    	/// error
        return -1;               
        return -1;               
    if(bigendian)
    if(bigendian)
@@ -258,8 +262,10 @@ long PacketLib::ByteStream::getValue(dword start, word dim)
            }
            }
            else
            else
            {
            {
                b1 = (start-1)<0?0:stream[start-1];
                //b1 = (start-1)<0?0:stream[start-1];
                b2 = (start+2)>byteInTheStream?0:stream[start+2];
                //b2 = (start+2)>byteInTheStream?0:stream[start+2];
				b1=(start+1)>=byteInTheStream?0:stream[start+1];
                b2=stream[start];
            }
            }
        }
        }
    }
    }
+1 −0
Original line number Original line Diff line number Diff line
@@ -23,6 +23,7 @@ using namespace PacketLib;


bool PacketNotRecognized::createPacketType(char* fileName, bool prefix, word dimprefix) throw (PacketException*)
bool PacketNotRecognized::createPacketType(char* fileName, bool prefix, word dimprefix) throw (PacketException*)
{
{
	packetID = 0;
    if(header->loadHeader(fileName))
    if(header->loadHeader(fileName))
    {
    {
        name = new char [22];
        name = new char [22];
Loading