Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11574
Modified Files:
PgOutputPacket.cs PgResponsePacket.cs
Log Message:
2004-06-03 Carlos Guzman Alvarez <car...@te...>
* PostgreSql.Data.PgSqlClient/PgLayouts.cs:
- Removed file.
* PostgreSql.Data.PgSqlClient/PgResponsePacket.cs:
* PostgreSql.Data.PgSqlClient/PgOutputPacket.cs:
- Improved Doubvle and Float read/write
Index: PgResponsePacket.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgResponsePacket.cs,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** PgResponsePacket.cs 10 Apr 2004 20:16:07 -0000 1.25
--- PgResponsePacket.cs 3 Jun 2004 16:37:20 -0000 1.26
***************
*** 173,181 ****
public override float ReadSingle()
! {
FloatLayout floatValue = new FloatLayout();
floatValue.i0 = IPAddress.HostToNetworkOrder(base.ReadInt32());
return floatValue.f;
}
--- 173,185 ----
public override float ReadSingle()
! {
! return BitConverter.ToSingle(BitConverter.GetBytes(this.ReadInt()), 0);
!
! /*
FloatLayout floatValue = new FloatLayout();
floatValue.i0 = IPAddress.HostToNetworkOrder(base.ReadInt32());
return floatValue.f;
+ */
}
***************
*** 188,192 ****
public override double ReadDouble()
! {
DoubleLayout doubleValue = new DoubleLayout();
int temp;
--- 192,199 ----
public override double ReadDouble()
! {
! return BitConverter.ToDouble(BitConverter.GetBytes(this.ReadLong()), 0);
!
! /*
DoubleLayout doubleValue = new DoubleLayout();
int temp;
***************
*** 201,204 ****
--- 208,212 ----
return doubleValue.d;
+ */
}
Index: PgOutputPacket.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgOutputPacket.cs,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** PgOutputPacket.cs 3 May 2004 20:29:36 -0000 1.25
--- PgOutputPacket.cs 3 Jun 2004 16:37:20 -0000 1.26
***************
*** 99,124 ****
public void WriteFloat(float val)
{
! FloatLayout floatValue = new FloatLayout();
!
! floatValue.f = val;
! floatValue.i0 = IPAddress.HostToNetworkOrder(floatValue.i0);
! this.Write(floatValue.f);
}
public void WriteDouble(double val)
{
! DoubleLayout doubleValue = new DoubleLayout();
! int temp;
!
! doubleValue.d = val;
! doubleValue.i0 = IPAddress.HostToNetworkOrder(doubleValue.i0);
! doubleValue.i4 = IPAddress.HostToNetworkOrder(doubleValue.i4);
!
! temp = doubleValue.i0;
! doubleValue.i0 = doubleValue.i4;
! doubleValue.i4 = temp;
! this.Write(doubleValue.d);
}
--- 99,112 ----
public void WriteFloat(float val)
{
! byte[] buffer = BitConverter.GetBytes(val);
! this.Write(BitConverter.ToInt32(buffer, 0));
}
public void WriteDouble(double val)
{
! byte[] buffer = BitConverter.GetBytes(val);
! this.Write(BitConverter.ToInt64(buffer, 0));
}
|