changeset 4282:52ce979331fe

[project @ 2003-01-04 04:46:11 by jwe]
author jwe
date Sat, 04 Jan 2003 04:46:11 +0000
parents e0f687d372ef
children 07c990a9edf5
files liboctave/ChangeLog liboctave/dMatrix.cc
diffstat 2 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog	Sat Jan 04 03:16:37 2003 +0000
+++ b/liboctave/ChangeLog	Sat Jan 04 04:46:11 2003 +0000
@@ -1,5 +1,8 @@
 2003-01-03  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* dMatrix.cc (read_int, write_int): Avoid warnings about
+	unreachable code.
+
 	* oct-alloc.h (DECLARE_OCTAVE_ALLOCATOR): Define operator delete
 	to correspond to placement new operator.
 
--- a/liboctave/dMatrix.cc	Sat Jan 04 03:16:37 2003 +0000
+++ b/liboctave/dMatrix.cc	Sat Jan 04 04:46:11 2003 +0000
@@ -2290,13 +2290,12 @@
 {
   is.read (X_CAST (char *, &val), sizeof (T));
 
-  if (swap_bytes)
+  int t = sizeof (T);
+
+  if (swap_bytes && t > 1)
     {
-      switch (sizeof (T))
+      switch (t)
 	{
-	case 1:
-	  break;
-
 	case 2:
 	  swap_2_bytes (X_CAST (char *, &val));
 	  break;
@@ -2586,13 +2585,12 @@
 void
 write_int (std::ostream& os, bool swap_bytes, T val)
 {
-  if (swap_bytes)
+  int t = sizeof (T);
+
+  if (swap_bytes && t > 1)
     {
-      switch (sizeof (T))
+      switch (t)
 	{
-	case 1:
-	  break;
-
 	case 2:
 	  swap_2_bytes (X_CAST (char *, &val));
 	  break;