Commit 74e813ec authored by hugues.jerome's avatar hugues.jerome Committed by yoogx

* Change marshalling function for ports to use Unsigned_16,

          which are safer in that context



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-ada@490 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 47707082
......@@ -190,7 +190,7 @@ package body PolyORB_HI.Messages is
begin
return Stream_Element_Count
(Swap_Bytes
(Interfaces.Integer_16 (Internal_To_Length (B))));
(Interfaces.Unsigned_16 (Internal_To_Length (B))));
end To_Length;
---------------
......@@ -200,7 +200,7 @@ package body PolyORB_HI.Messages is
function To_Buffer (L : Stream_Element_Count) return Message_Size_Buffer is
begin
return Internal_To_Buffer
(Wrapper (Swap_Bytes (Interfaces.Integer_16 (L))));
(Wrapper (Swap_Bytes (Interfaces.Unsigned_16 (L))));
end To_Buffer;
end PolyORB_HI.Messages;
......@@ -34,4 +34,4 @@ with PolyORB_HI.Marshallers_G;
with Interfaces;
package PolyORB_HI.Port_Type_Marshallers is
new PolyORB_HI.Marshallers_G (Interfaces.Integer_16);
new PolyORB_HI.Marshallers_G (Interfaces.Unsigned_16);
......@@ -59,8 +59,8 @@ package body PolyORB_HI.Utils is
-- Swap_Bytes --
----------------
function Swap_Bytes (B : Interfaces.Integer_16)
return Interfaces.Integer_16
function Swap_Bytes (B : Interfaces.Unsigned_16)
return Interfaces.Unsigned_16
is
use System;
begin
......@@ -84,9 +84,9 @@ package body PolyORB_HI.Utils is
-- Internal_Code --
-------------------
function Internal_Code (P : Port_Type) return Integer_16 is
function Internal_Code (P : Port_Type) return Unsigned_16 is
function To_Internal_Code is new Ada.Unchecked_Conversion
(Port_Type, Integer_16);
(Port_Type, Unsigned_16);
begin
return Swap_Bytes (To_Internal_Code (P));
end Internal_Code;
......@@ -95,9 +95,9 @@ package body PolyORB_HI.Utils is
-- Corresponding_Port --
------------------------
function Corresponding_Port (I : Integer_16) return Port_Type is
function Corresponding_Port (I : Unsigned_16) return Port_Type is
function To_Corresponding_Port is new Ada.Unchecked_Conversion
(Integer_16, Port_Type);
(Unsigned_16, Port_Type);
begin
return To_Corresponding_Port (Swap_Bytes (I));
end Corresponding_Port;
......
......@@ -69,11 +69,11 @@ package PolyORB_HI.Utils is
function Corresponding_Node is new Ada.Unchecked_Conversion
(Integer_8, Node_Type);
function Internal_Code (P : Port_Type) return Integer_16;
function Corresponding_Port (I : Integer_16) return Port_Type;
function Internal_Code (P : Port_Type) return Unsigned_16;
function Corresponding_Port (I : Unsigned_16) return Port_Type;
function Swap_Bytes (B : Interfaces.Integer_16)
return Interfaces.Integer_16;
function Swap_Bytes (B : Interfaces.Unsigned_16)
return Interfaces.Unsigned_16;
-- Swap bytes iff the host is little endian. This function is
-- notionnally equivalent to htons().
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment