Menu

Sun forte 6 does not have setb, please help?

Help
2001-05-03
2001-05-11
  • Alwyn Schoeman

    Alwyn Schoeman - 2001-05-03

    Hi,

    Is it possible to patch the common-c++ code to make provision for this.

    How would one replace the functionality of setb in the code?

     
    • David Sugar

      David Sugar - 2001-05-09

      If you have a patch to suggest to test for this or an alternate implimentation, I would look at including it.  I don't have access to a sun box at the moment...

       
    • Anonymous

      Anonymous - 2001-05-09

          Hello, I have been looking at the
      GNU iostream and the MS dev. network help, and
      the only streambuf method that seems to do
      something similar to setb is setbuf, but it only
      works for the first allocation. I am not sure
      if this will work, but below I post a patch that
      Alwyn could test in order to know if
      setbuf works fine on solaris and forte.

      BEWARE: I am not sure if this does what it should
      do, it is only a possible solution. I can only
      assure that it compiles on Debian unstable.

      *** CommonC++-1.4.2/posix/socket.cpp    Sat Mar 31 17:21:13 2001
      --- CommonC++-chapuzas/posix/socket.cpp    Tue May  8 22:05:05 2001
      ***************
      *** 875,885 ****
                Error(SOCKET_RESOURCE_FAILURE);
                return;
            }
            bufsize = size;
            clear();
      !     setb(gbuf, gbuf + size, 0);
            setg(gbuf, gbuf + size, gbuf + size);
            setp(pbuf, pbuf + size);
        }
       
        int TCPStream::doallocate()
      --- 875,887 ----
                Error(SOCKET_RESOURCE_FAILURE);
                return;
            }
            bufsize = size;
            clear();
      !     // WARNING, do not use setb(gbuf, gbuf + size, 0); it is not
      !     // defined in forte c++
      !     setbuf(gbuf, size);
            setg(gbuf, gbuf + size, gbuf + size);
            setp(pbuf, pbuf + size);
        }
       
        int TCPStream::doallocate()

       
      • Alwyn Schoeman

        Alwyn Schoeman - 2001-05-10

        I will try the patch as soon as possible.

        I have not actually used common-c++ yet so if someone could maybe provide some code that will test whether the patch operates correctly?

         
        • David Sugar

          David Sugar - 2001-05-11

          The question is one of reallocation.  A simple test would be to use a TCPStream and use open and close multiple times, each time with a different size buffer as the second argument.  I would like to know how this works and will take it in as a patch as soon as it's verified.

           
    • Anonymous

      Anonymous - 2001-05-10

          Hi, there is already such test application inside the demo/ dir; look for `tcpthread'. the patch concerns TCPStream class, that is inherited
      by TCPSession that in turn is used by tcpthread.
          Take into account that those demo apps are not ussually compiled, you have to go there and
      explicitly type make.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.