ccaudio-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ccaudio-devel] Re: Bug#163282: libccaudio_1.0.2-1(hppa/unstable): FTBFS


From: Mark Purcell
Subject: [Ccaudio-devel] Re: Bug#163282: libccaudio_1.0.2-1(hppa/unstable): FTBFS: g++ 3.0 errors
Date: Sun, 6 Oct 2002 17:02:08 +1000
User-agent: Mutt/1.4i

[ 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 
Wavetest2.cpp.

  /* Open the file and read the header */
  std::ifstream file("test.wav");
  for(i = 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<char,
   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 = char, _Traits =
   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 = do_test1();
   if(rc == -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 == 0) {
     rc2 = unlink("test.wav");
     if(rc2 == -1)
-      cerr << "Deleting test wave file failed: " << strerror(errno) << endl;
+      std::cerr << "Deleting test wave file failed: " << strerror(errno) << 
std::endl;
   }

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

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

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

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

   /* Open the file and read the header */
-  ifstream file("test.wav");
+  std::ifstream file("test.wav");
   for(i = 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 = 0; i < CORRECT_BUF_SIZE; ++i)
     if(correct[i] != 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 << (int) 
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 = -1;
     }

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

   rc = do_test2();
   if(rc == -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 == 0) {
     rc2 = unlink("test.wav");
     if(rc2 == -1)
-      cerr << "Deleting test wave file failed: " << strerror(errno) << endl;
+      std::cerr << "Deleting test wave file failed: " << strerror(errno) << 
std::endl;
   }

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

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

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

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

   /* Open the file and read the header */
-  ifstream file("test.wav");
+  std::ifstream file("test.wav");
   for(i = 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 = 0; i < CORRECT_BUF_SIZE; ++i)
     if(correct[i] != 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 << (int) 
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 = -1;
     }

Attachment: pgpPX7WIi5C_h.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]