[PATCH] make CORBA_sequence_*_allocbuf return a correct type



Hi,

The attached patch makes sure allocbuf()'s return value is correctly cast,
this is needed to shut up C++ compilers.

-- 
   .--= ULLA! =---------------------.   `We are not here to give users what
   \     http://cactus.rulez.org     \   they want'  -- RMS, at GUADEC 2001
    `---= cactus@cactus.rulez.org =---'
"Jesus saves... Passes to Gretzky... Gretzky shoots... He SCORES!"
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/ORBit2/ChangeLog,v
retrieving revision 1.361
diff -u -u -r1.361 ChangeLog
--- ChangeLog	23 Apr 2002 14:34:22 -0000	1.361
+++ ChangeLog	2 May 2002 20:18:57 -0000
@@ -1,3 +1,9 @@
+2002-05-02  ERDI Gergo  <cactus@cactus.rulez.org>
+
+	* src/idl-compiler/orbit-idl-c-headers.c (ch_prep_sequence): Cast
+	return value of _allocbuf method to pointer to member type, to
+	make typesafe C++ compilers happy
+
 2002-04-23  Mark McLoughlin  <mark@skynet.ie>
 
 	* src/orb/orb-core/iop-profiles.c:
Index: src/idl-compiler/orbit-idl-c-headers.c
===================================================================
RCS file: /cvs/gnome/ORBit2/src/idl-compiler/orbit-idl-c-headers.c,v
retrieving revision 1.60
diff -u -u -r1.60 orbit-idl-c-headers.c
--- src/idl-compiler/orbit-idl-c-headers.c	1 Apr 2002 12:20:58 -0000	1.60
+++ src/idl-compiler/orbit-idl-c-headers.c	2 May 2002 20:18:58 -0000
@@ -606,13 +606,16 @@
 
       if (rinfo->small)
         {
-	  char *tc;
+	  char *tc, *member_type;
 	  
 	  tc = orbit_cbe_get_typecode_name (
 		  orbit_cbe_get_typespec (tree));
+	  member_type = orbit_cbe_type_is_builtin (IDL_TYPE_SEQUENCE (tree).simple_type_spec) ?
+	      ctmp + strlen ("CORBA_") : ctmp;
 
-	  fprintf (ci->fh, "#define CORBA_sequence_%s_allocbuf(l) ORBit_small_allocbuf (%s, (l))\n",
-		   orbit_cbe_type_is_builtin(IDL_TYPE_SEQUENCE(tree).simple_type_spec)?(ctmp+strlen("CORBA_")):ctmp, tc);
+	  fprintf (ci->fh, "#define CORBA_sequence_%s_allocbuf(l) "
+		   "((%s*)ORBit_small_allocbuf (%s, (l)))\n",
+		   member_type, member_type, tc);
 
 	  g_free (tc);
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]