Re: Bug#163282: libccaudio_1.0.2-1(hppa/unstable): FTBFS: g++ 3.0 errors

Mark Purcell <[email protected]> Sun, 6 Oct 2002 17:02:08 +1000
Newsgroups gmane.comp.gnu.ccaudio.devel
Message-ID <[email protected]>
--G4iJoqBmSsgzjUCe
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

[ For ccaudio-devel and others I am having problem building the new
wavetest[1-2].cpp under g++-3.0. Mainly namespace assumptions for
which I have included a patch, but I am also having a problem with ifstream.
Full details are available at http://bugs.debian.org/163282. ]

The remaing issue is with the following code in both wavetest1.cpp and=20
Wavetest2.cpp.

  /* Open the file and read the header */
  std::ifstream file("test.wav");
  for(i =3D 0; i < CORRECT_BUF_SIZE; ++i)
    file.read((buf + i), 1);
  file.close();

When compiling with g++-3.0 it bombs out with the following:

wavetest1.cpp:125: no matching function for call to `std::basic_ifstream<ch=
ar,
   std::char_traits<char> >::read(unsigned char*, int)'
/usr/include/g++-v3/bits/istream.tcc:750: candidates are:
   std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT,
   _Traits>::read(_CharT*, int) [with _CharT =3D char, _Traits =3D
   std::char_traits<char>]

Can anyone provide advice how this should work under g++-3.0?

Mark

Patches made to build with g++-3.0 so far are as follows:

--- libccaudio-1.0.2.orig/src/wavetest1.cpp
+++ libccaudio-1.0.2/src/wavetest1.cpp
@@ -75,9 +75,9 @@

   rc =3D do_test1();
   if(rc =3D=3D -1)
-    cerr << ">>> Test 1 FAILED! <<<" << endl;
+    std::cerr << ">>> Test 1 FAILED! <<<" << std::endl;
   else
-    cout << "Test 1 passed." << endl;
+    std::cout << "Test 1 passed." << std::endl;

   // These young'uns never learn, always forgetting to omit checks on
   // the return values of system calls.  Grumble.  In *MY* day, we
@@ -86,7 +86,7 @@
   if(rc =3D=3D 0) {
     rc2 =3D unlink("test.wav");
     if(rc2 =3D=3D -1)
-      cerr << "Deleting test wave file failed: " << strerror(errno) << end=
l;
+      std::cerr << "Deleting test wave file failed: " << strerror(errno) <=
< std::endl;
   }

   return rc;
@@ -99,7 +99,7 @@
   int ret =3D 0;
   Audio::Info ai;

-  cout << "Beginning test 1" << endl;
+  std::cout << "Beginning test 1" << std::endl;
   buf =3D new unsigned char[BUF_SIZE];
   memset(buf, 0, BUF_SIZE * sizeof(unsigned char));

@@ -112,7 +112,7 @@
   AudioFile out("test.wav", &ai);
   rc =3D out.putSamples(buf, BUF_SIZE / out.getFrame(Audio::pcm16Stereo));
   if(rc !=3D Audio::errSuccess) {
-    cout << "error writing samples to file: " << rc;
+    std::cout << "error writing samples to file: " << rc;
   }

   delete buf;
@@ -120,7 +120,7 @@
   buf =3D new unsigned char [CORRECT_BUF_SIZE];

   /* Open the file and read the header */
-  ifstream file("test.wav");
+  std::ifstream file("test.wav");
   for(i =3D 0; i < CORRECT_BUF_SIZE; ++i)
     file.read((buf + i), 1);
   file.close();
@@ -128,8 +128,8 @@
   /* Compare the header that was read against the "correct" header above */
   for(i =3D 0; i < CORRECT_BUF_SIZE; ++i)
     if(correct[i] !=3D buf[i]) {
-      cerr.fill('0');
-      cerr << "Test failed at offset " << dec << i << ".  Saw 0x" << setw(=
2) << hex << (int) buf[i] << " should have been 0x" << setw(2) << hex << (i=
nt) correct[i] << endl;
+      std::cerr.fill('0');
+      std::cerr << "Test failed at offset " << std::dec << i << ".  Saw 0x=
" << std::setw(2) << std::hex << (int) buf[i] << " should have been 0x" << =
std::setw(2) << std::hex << (int) correct[i] << std::endl;
       ret =3D -1;
     }

--- libccaudio-1.0.2.orig/src/wavetest2.cpp
+++ libccaudio-1.0.2/src/wavetest2.cpp
@@ -78,14 +78,14 @@

   rc =3D do_test2();
   if(rc =3D=3D -1)
-    cerr << ">>> Test 2 FAILED! <<<" << endl;
+    std::cerr << ">>> Test 2 FAILED! <<<" << std::endl;
   else
-    cout << "Test 2 passed." << endl;
+    std::cout << "Test 2 passed." << std::endl;

   if(rc =3D=3D 0) {
     rc2 =3D unlink("test.wav");
     if(rc2 =3D=3D -1)
-      cerr << "Deleting test wave file failed: " << strerror(errno) << end=
l;
+      std::cerr << "Deleting test wave file failed: " << strerror(errno) <=
< std::endl;
   }

   return rc;
@@ -98,7 +98,7 @@
   int ret =3D 0;
   Audio::Info ai;

-  cout << "Beginning test 2" << endl;
+  std::cout << "Beginning test 2" << std::endl;
   buf =3D new unsigned char[BUF_SIZE];
   memset(buf, 0, BUF_SIZE * sizeof(unsigned char));

@@ -111,7 +111,7 @@
   AudioFile out("test.wav", &ai);
   rc =3D out.putSamples(buf, BUF_SIZE / out.getFrame(Audio::mulawAudio));
   if(rc !=3D Audio::errSuccess) {
-    cout << "error writing samples to file: " << rc;
+    std::cout << "error writing samples to file: " << rc;
   }

   delete buf;
@@ -119,7 +119,7 @@
   buf =3D new unsigned char [CORRECT_BUF_SIZE];

   /* Open the file and read the header */
-  ifstream file("test.wav");
+  std::ifstream file("test.wav");
   for(i =3D 0; i < CORRECT_BUF_SIZE; ++i)
     file.read((buf + i), 1);
   file.close();
@@ -127,8 +127,8 @@
   /* Compare the header that was read against the "correct" header above */
   for(i =3D 0; i < CORRECT_BUF_SIZE; ++i)
     if(correct[i] !=3D buf[i]) {
-      cerr.fill('0');
-      cerr << "Test failed at offset " << dec << i << ".  Saw 0x" << setw(=
2) << hex << (int) buf[i] << " should have been 0x" << setw(2) << hex << (i=
nt) correct[i] << endl;
+      std::cerr.fill('0');
+      std::cerr << "Test failed at offset " << std::dec << i << ".  Saw 0x=
" << std::setw(2) << std::hex << (int) buf[i] << " should have been 0x" << =
std::setw(2) << std::hex << (int) correct[i] << std::endl;
       ret =3D -1;
     }


--G4iJoqBmSsgzjUCe
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)

iD8DBQE9n9/woCzanz0IthIRAkchAKCIr71KzxLHNbmlkYEORp3qxpTLbACdG950
N29XghAlK8adzc66SHfRljk=
=kedh
-----END PGP SIGNATURE-----

--G4iJoqBmSsgzjUCe--