Commit 1ea62818 authored by hugues.jerome's avatar hugues.jerome
Browse files

* Change marshalling function for ports to use Unsigned_16,

          which are safer in that context

git-svn-id: 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent cf57effe
......@@ -190,7 +190,7 @@ package body PolyORB_HI.Messages is
return Stream_Element_Count
(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
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
use System;
......@@ -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);
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);
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().
Supports Markdown
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