Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PacketLib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andrea Bulgarelli
PacketLib
Commits
ab7817db
Commit
ab7817db
authored
11 years ago
by
Andrea Zoli
Browse files
Options
Downloads
Patches
Plain Diff
Fix ByteStream and Packet initialization.
parent
d026353e
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
include/ByteStream.h
+3
-2
3 additions, 2 deletions
include/ByteStream.h
include/Packet.h
+3
-2
3 additions, 2 deletions
include/Packet.h
src/ByteStream.cpp
+6
-16
6 additions, 16 deletions
src/ByteStream.cpp
src/Packet.cpp
+13
-12
13 additions, 12 deletions
src/Packet.cpp
with
25 additions
and
32 deletions
include/ByteStream.h
+
3
−
2
View file @
ab7817db
...
@@ -2,8 +2,9 @@
...
@@ -2,8 +2,9 @@
ByteStream.h
ByteStream.h
-------------------
-------------------
begin : Thu Nov 29 2001
begin : Thu Nov 29 2001
copyright : (C) 2001, 2013 by Andrea Bulgarelli
copyright : (C) 2001-2013 by Andrea Bulgarelli
email : bulgarelli@iasfbo.inaf.it
2013-2014 by Andrea Bulgarelli, Andrea Zoli
email : bulgarelli@iasfbo.inaf.it, zoli@iasfbo.inaf.it
***************************************************************************/
***************************************************************************/
/***************************************************************************
/***************************************************************************
...
...
This diff is collapsed.
Click to expand it.
include/Packet.h
+
3
−
2
View file @
ab7817db
...
@@ -2,8 +2,9 @@
...
@@ -2,8 +2,9 @@
Packet.h - description
Packet.h - description
-------------------
-------------------
begin : Thu Nov 29 2001
begin : Thu Nov 29 2001
copyright : (C) 2001, 2013 by Andrea Bulgarelli
copyright : (C) 2001-2013 by Andrea Bulgarelli
email : bulgarelli@iasfbo.inaf.it
2013-2014 by Andrea Bulgarelli, Andrea Zoli
email : bulgarelli@iasfbo.inaf.it, zoli@iasfbo.inaf.it
***************************************************************************/
***************************************************************************/
/***************************************************************************
/***************************************************************************
...
...
This diff is collapsed.
Click to expand it.
src/ByteStream.cpp
+
6
−
16
View file @
ab7817db
...
@@ -2,8 +2,9 @@
...
@@ -2,8 +2,9 @@
ByteStream.cpp - description
ByteStream.cpp - description
-------------------
-------------------
begin : Thu Nov 29 2001
begin : Thu Nov 29 2001
copyright : (C) 2001, 2013 by Andrea Bulgarelli
copyright : (C) 2001-2013 by Andrea Bulgarelli
email : bulgarelli@iasfbo.inaf.it
2013-2914 by Andrea Bulgarelli, Andrea Zoli
email : bulgarelli@iasfbo.inaf.it, zoli@iasfbo.inaf.it
***************************************************************************/
***************************************************************************/
/***************************************************************************
/***************************************************************************
...
@@ -30,39 +31,28 @@ using namespace PacketLib;
...
@@ -30,39 +31,28 @@ using namespace PacketLib;
/// In all methods of constructor or set type accepting ByteStreamPtr the swap is never applied.
/// In all methods of constructor or set type accepting ByteStreamPtr the swap is never applied.
PacketLib
::
ByteStream
::
ByteStream
(
bool
bigendian
)
PacketLib
::
ByteStream
::
ByteStream
(
bool
bigendian
)
:
stream
(
0
),
byteInTheStream
(
0
),
bigendian
(
bigendian
)
{
{
mem_allocation_constructor
=
true
;
mem_allocation_constructor
=
true
;
byteInTheStream
=
0
;
this
->
stream
=
0
;
this
->
bigendian
=
bigendian
;
setMemoryAllocated
(
false
);
setMemoryAllocated
(
false
);
mem_allocation_constructor
=
false
;
mem_allocation_constructor
=
false
;
}
}
PacketLib
::
ByteStream
::
ByteStream
(
dword
dim
,
bool
bigendian
)
PacketLib
::
ByteStream
::
ByteStream
(
dword
dim
,
bool
bigendian
)
:
byteInTheStream
(
dim
),
bigendian
(
bigendian
)
{
{
mem_allocation_constructor
=
true
;
mem_allocation_constructor
=
true
;
byteInTheStream
=
dim
;
stream
=
(
byte
*
)
new
byte
[
dim
];
stream
=
(
byte
*
)
new
byte
[
dim
];
/// memset(stream, 0, dim); ok
this
->
bigendian
=
bigendian
;
setMemoryAllocated
(
true
);
setMemoryAllocated
(
true
);
mem_allocation_constructor
=
false
;
mem_allocation_constructor
=
false
;
}
}
PacketLib
::
ByteStream
::
ByteStream
(
byte
*
stream
,
dword
dim
,
bool
bigendian
,
bool
memory_sharing
)
PacketLib
::
ByteStream
::
ByteStream
(
byte
*
stream
,
dword
dim
,
bool
bigendian
,
bool
memory_sharing
)
:
stream
(
stream
),
byteInTheStream
(
dim
),
bigendian
(
bigendian
)
{
{
mem_allocation_constructor
=
true
;
mem_allocation_constructor
=
true
;
byteInTheStream
=
dim
;
this
->
stream
=
stream
;
this
->
bigendian
=
bigendian
;
//if(!memory_sharing)
//if(!memory_sharing)
// swapWordIfStreamIsLittleEndian();
// swapWordIfStreamIsLittleEndian();
/// \remarks memory_sharing == false means that the object is responsible for the memory
/// \remarks memory_sharing == false means that the object is responsible for the memory
...
...
This diff is collapsed.
Click to expand it.
src/Packet.cpp
+
13
−
12
View file @
ab7817db
...
@@ -2,8 +2,9 @@
...
@@ -2,8 +2,9 @@
Packet.cpp - description
Packet.cpp - description
-------------------
-------------------
begin : Thu Nov 29 2001
begin : Thu Nov 29 2001
copyright : (C) 2001, 2013 by Andrea Bulgarelli
copyright : (C) 2001-2013 by Andrea Bulgarelli
email : bulgarelli@iasfbo.inaf.it
2013-2014 by Andrea Bulgarelli, Andrea Zoli
email : bulgarelli@iasfbo.inaf.it, zoli@iasfbo.inaf.it
***************************************************************************/
***************************************************************************/
/***************************************************************************
/***************************************************************************
...
@@ -24,24 +25,24 @@ using namespace PacketLib;
...
@@ -24,24 +25,24 @@ using namespace PacketLib;
#define DECODETYPE 2
#define DECODETYPE 2
Packet
::
Packet
(
bool
bigendian
)
Packet
::
Packet
(
bool
bigendian
)
:
decodedPacketDataFieldHeader
(
false
)
:
prefix
(
0
),
packet
(
0
),
stream
(
0
),
packetID
(
0
),
name
(
0
),
identifiers
(
0
),
number_of_identifiers
(
0
),
bigendian
(
bigendian
),
thereisprefix
(
false
),
filename
(
0
),
first_output_stream_setted
(
false
),
dimPrefix
(
0
),
dimPacketHeader
(
0
),
dimPacketDataFieldHeader
(
0
),
dimPacketSourceDataFieldFixed
(
0
),
dimPacketTail
(
0
),
dimPacketStartingFixedPart
(
0
),
decodedPacketHeader
(
false
),
decodedPacketDataFieldHeader
(
false
),
decodedPacketSourceDataField
(
false
),
decodedPacketTail
(
false
),
compressionAlgorithmsSection
(
0
),
compressionAlgorithmsIndex
(
0
),
compressionLevelSection
(
0
),
compressionLevelIndex
(
0
),
compressible
(
false
)
{
{
header
=
(
PacketHeader
*
)
new
PacketHeader
();
header
=
(
PacketHeader
*
)
new
PacketHeader
();
dataField
=
(
PacketDataField
*
)
new
PacketDataField
();
dataField
=
(
PacketDataField
*
)
new
PacketDataField
();
name
=
0
;
// tail = new PartOfPacket();
number_of_identifier
=
0
;
identifiers
=
0
;
this
->
bigendian
=
bigendian
;
/// temp
tempHeader
=
ByteStreamPtr
(
new
ByteStream
);
tempHeader
=
ByteStreamPtr
(
new
ByteStream
);
tempDataField
=
ByteStreamPtr
(
new
ByteStream
);
tempDataField
=
ByteStreamPtr
(
new
ByteStream
);
tempDataFieldHeader
=
ByteStreamPtr
(
new
ByteStream
);
tempDataFieldHeader
=
ByteStreamPtr
(
new
ByteStream
);
tempPacketDataField
=
ByteStreamPtr
(
new
ByteStream
);
tempPacketDataField
=
ByteStreamPtr
(
new
ByteStream
);
tempTail
=
ByteStreamPtr
(
new
ByteStream
);
tempTail
=
ByteStreamPtr
(
new
ByteStream
);
first_output_stream_setted
=
false
;
compressible
=
false
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment