summaryrefslogtreecommitdiff
path: root/gcc/ada/g-socthi-mingw.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-07 09:41:29 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-07 09:41:29 +0000
commitccf6b4adad882a6b65ae35364203ca6f646a5b03 (patch)
tree42d3d9e228b315764a37741113a5eb88a8f05e7b /gcc/ada/g-socthi-mingw.adb
parentd40145fa3df09249c71894b22675738a02834e69 (diff)
downloadgcc-ccf6b4adad882a6b65ae35364203ca6f646a5b03.tar.gz
2005-07-07 Pascal Obry <obry@adacore.com>
* g-socthi-mingw.adb (C_Inet_Addr): New body used to convert the returned type on Windows. * g-socthi-mingw.ads (C_Inet_Addr): Remove pragma Import for this routine. * g-socket.adb (Inet_Addr): Check for empty Image and raises an exception in this case. Simplify the code as "Image (Image'Range)" = "Image". git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101691 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/g-socthi-mingw.adb')
-rw-r--r--gcc/ada/g-socthi-mingw.adb27
1 files changed, 26 insertions, 1 deletions
diff --git a/gcc/ada/g-socthi-mingw.adb b/gcc/ada/g-socthi-mingw.adb
index c90f2077595..9c12bdfbf31 100644
--- a/gcc/ada/g-socthi-mingw.adb
+++ b/gcc/ada/g-socthi-mingw.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2004 Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005 AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -409,6 +409,31 @@ package body GNAT.Sockets.Thin is
return Res;
end C_Select;
+ -----------------
+ -- C_Inet_Addr --
+ -----------------
+
+ function C_Inet_Addr
+ (Cp : C.Strings.chars_ptr) return C.int
+ is
+ use type C.unsigned_long;
+
+ function Internal_Inet_Addr
+ (Cp : C.Strings.chars_ptr) return C.unsigned_long;
+ pragma Import (Stdcall, Internal_Inet_Addr, "inet_addr");
+
+ Res : C.unsigned_long;
+ begin
+ Res := Internal_Inet_Addr (Cp);
+
+ if Res = C.unsigned_long'Last then
+ -- This value is returned in case of error
+ return -1;
+ else
+ return C.int (Internal_Inet_Addr (Cp));
+ end if;
+ end C_Inet_Addr;
+
--------------
-- C_Writev --
--------------