diff main/database/src/pq_conninfo.cc @ 12612:2257648e8ce1 octave-forge

avoid using const_cast, new release 2.3.2 * pq_connection.h/cc: octave_pq_connection now contains pointer to object of new class octave_pq_connection_rep, containing the pq-specific members formerly in octave_pq_connection. * pq_exec.cc, pq_close.cc, pq_update_types.cc, pq_conninfo.cc, pq_lo.cc: Remove const_cast, use octave_pq_connection_rep object instead. * __pq_connect__.cc, converters.h/cc, converters_arr_comp.cc, command.h/cc: Use octave_pq_connection_rep instead of octave_pq_connection.
author i7tiol
date Tue, 05 May 2015 07:31:33 +0000
parents 4f35a79fa79a
children 9cb56e0cd09b
line wrap: on
line diff
--- a/main/database/src/pq_conninfo.cc	Tue May 05 05:29:10 2015 +0000
+++ b/main/database/src/pq_conninfo.cc	Tue May 05 07:31:33 2015 +0000
@@ -58,11 +58,12 @@
       return retval;
     }
 
-  octave_base_value& rep = const_cast<octave_base_value&> (args(0).get_rep ());
+  const octave_base_value& rep = (args(0).get_rep ());
 
-  octave_pq_connection &oct_pq_conn = dynamic_cast<octave_pq_connection&> (rep);
+  const octave_pq_connection &oct_pq_conn =
+    dynamic_cast<const octave_pq_connection&> (rep);
 
-  PGconn *conn = oct_pq_conn.octave_pq_get_conn ();
+  PGconn *conn = oct_pq_conn.get_rep ()->octave_pq_get_conn ();
 
   if (! conn)
     {
@@ -71,5 +72,5 @@
       return retval;
     }
 
-  return octave_value (oct_pq_conn.get_integer_datetimes ());
+  return octave_value (oct_pq_conn.get_rep ()->get_integer_datetimes ());
 }