changeset 7480:93826ba0d078

compilation fixes
author Jason Riedy
date Wed, 13 Feb 2008 00:00:33 -0500
parents 3018354c554c
children 78f3811155f7
files liboctave/Array.cc liboctave/ChangeLog liboctave/oct-sort.cc
diffstat 3 files changed, 20 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/Array.cc	Tue Feb 12 23:52:42 2008 -0500
+++ b/liboctave/Array.cc	Wed Feb 13 00:00:33 2008 -0500
@@ -2636,13 +2636,13 @@
 #if defined (HAVE_IEEE754_DATA_FORMAT)
 
 template <>
-extern bool ascending_compare (double, double);
+bool ascending_compare (double, double);
 template <>
-extern bool ascending_compare (vec_index<double>*, vec_index<double>*);
+bool ascending_compare (vec_index<double>*, vec_index<double>*);
 template <>
-extern bool descending_compare (double, double);
+bool descending_compare (double, double);
 template <>
-extern bool descending_compare (vec_index<double>*, vec_index<double>*);
+bool descending_compare (vec_index<double>*, vec_index<double>*);
 
 template <>
 Array<double> Array<double>::sort (octave_idx_type dim, sortmode mode) const;
--- a/liboctave/ChangeLog	Tue Feb 12 23:52:42 2008 -0500
+++ b/liboctave/ChangeLog	Wed Feb 13 00:00:33 2008 -0500
@@ -5,6 +5,11 @@
 
 2008-02-12  Jason Riedy  <ejr@cs.berkeley.edu>
   
+	* Array.cc (ascending_compare, descending_compare): Remove
+	non-standard extern in the instantiations.
+
+	* oct-sort.cc: Include <cstring> and sprinkle with std:: as needed.
+
 	* dMatrix.cc (ILAENV): Declare LAPACK Fortran function.
 	(Matrix::lssolve): Use ILAENV to query smlsiz.  And add an ugly
 	workaround for DGELSD's broken lwork query.  The formula is from
--- a/liboctave/oct-sort.cc	Tue Feb 12 23:52:42 2008 -0500
+++ b/liboctave/oct-sort.cc	Wed Feb 13 00:00:33 2008 -0500
@@ -85,6 +85,7 @@
 
 #include <cassert>
 #include <cstdlib>
+#include <cstring>
 
 #include "lo-mappers.h"
 #include "quit.h"
@@ -521,7 +522,7 @@
 
   if (MERGE_GETMEM (na) < 0)
     return -1;
-  memcpy (ms.a, pa, na * sizeof (T));
+  std::memcpy (ms.a, pa, na * sizeof (T));
   dest = pa;
   pa = ms.a;
 
@@ -583,7 +584,7 @@
 	    {
 	      if (k < 0)
 		goto Fail;
-	      memcpy (dest, pa, k * sizeof (T));
+	      std::memcpy (dest, pa, k * sizeof (T));
 	      dest += k;
 	      pa += k;
 	      na -= k;
@@ -607,7 +608,7 @@
 	    {
 	      if (k < 0)
 		goto Fail;
-	      memmove (dest, pb, k * sizeof (T));
+	      std::memmove (dest, pb, k * sizeof (T));
 	      dest += k;
 	      pb += k;
 	      nb -= k;
@@ -630,12 +631,12 @@
 
  Fail:
   if (na)
-    memcpy (dest, pa, na * sizeof (T));
+    std::memcpy (dest, pa, na * sizeof (T));
   return result;
 
  CopyB:
   /* The last element of pa belongs at the end of the merge. */
-  memmove (dest, pb, nb * sizeof (T));
+  std::memmove (dest, pb, nb * sizeof (T));
   dest[nb] = *pa;
 
   return 0;
@@ -661,7 +662,7 @@
   if (MERGE_GETMEM (nb) < 0)
     return -1;
   dest = pb + nb - 1;
-  memcpy (ms.a, pb, nb * sizeof (T));
+  std::memcpy (ms.a, pb, nb * sizeof (T));
   basea = pa;
   baseb = ms.a;
   pb = ms.a + nb - 1;
@@ -727,7 +728,7 @@
 	    {
 	      dest -= k;
 	      pa -= k;
-	      memmove (dest+1, pa+1, k * sizeof (T));
+	      std::memmove (dest+1, pa+1, k * sizeof (T));
 	      na -= k;
 	      if (na == 0)
 		goto Succeed;
@@ -746,7 +747,7 @@
 	    {
 	      dest -= k;
 	      pb -= k;
-	      memcpy (dest+1, pb+1, k * sizeof (T));
+	      std::memcpy (dest+1, pb+1, k * sizeof (T));
 	      nb -= k;
 	      if (nb == 1)
 		goto CopyA;
@@ -771,14 +772,14 @@
 
 Fail:
   if (nb)
-    memcpy (dest-(nb-1), baseb, nb * sizeof (T));
+    std::memcpy (dest-(nb-1), baseb, nb * sizeof (T));
   return result;
 
 CopyA:
   /* The first element of pb belongs at the front of the merge. */
   dest -= na;
   pa -= na;
-  memmove (dest+1, pa+1, na * sizeof (T));
+  std::memmove (dest+1, pa+1, na * sizeof (T));
   *dest = *pb;
 
   return 0;