Patch for stream.cpp for non-flushable stream,

Corrected stream corruption for Umgetch()/SeekI() conflict,
  Docs for streams,
  Changed interpreteation og non-standard height in wxCombo,
  Other minor changes,
  Removed library name setting for Debian again.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4842 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 1999-12-06 16:16:14 +00:00
parent 929eed4799
commit d984207cc3
13 changed files with 394 additions and 285 deletions

551
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1755,7 +1755,7 @@ if test "$wxUSE_SHARED" = "yes"; then
PIC_FLAG="-fPIC"
WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
WX_ALL="CREATE_LINKS"
BURNT_LIBRARY_NAME="-Wl,-soname -Wl,${WX_LIBRARY_NAME_SHARED}"
dnl BURNT_LIBRARY_NAME="-Wl,-soname -Wl,${WX_LIBRARY_NAME_SHARED}"
;;
*-*-irix5* | *-*-irix6* )
if test "$GCC" = yes ; then

View File

@ -392,8 +392,11 @@ libraries, and to provide enhanced functionality.
\twocolitem{\helpref{wxStreamBuffer}{wxstreambuffer}}{Stream buffer class}
\twocolitem{\helpref{wxInputStream}{wxinputstream}}{Input stream class}
\twocolitem{\helpref{wxOutputStream}{wxoutputstream}}{Output stream class}
\twocolitem{\helpref{wxCountingOutputStream}{wxcountingoutputstream}}{Stream class for querying what size a stream would have.}
\twocolitem{\helpref{wxFilterInputStream}{wxfilterinputstream}}{Filtered input stream class}
\twocolitem{\helpref{wxFilterOutputStream}{wxfilteroutputstream}}{Filtered output stream class}
\twocolitem{\helpref{wxBufferedInputStream}{wxbufferedinputstream}}{Buffered input stream class}
\twocolitem{\helpref{wxBufferedOutputStream}{wxbufferedoutputstream}}{Buffered output stream class}
\twocolitem{\helpref{wxDataInputStream}{wxdatainputstream}}{Platform-independent binary data input stream class}
\twocolitem{\helpref{wxDataOutputStream}{wxdataoutputstream}}{Platform-independent binary data output stream class}
\twocolitem{\helpref{wxTextInputStream}{wxtextinputstream}}{Platform-independent text data input stream class}

View File

@ -3,6 +3,8 @@
% -----------------------------------------------------------------------------
\section{\class{wxInputStream}}\label{wxinputstream}
wxInputStream is an abstract base class which may not be used directly.
\wxheading{Derived from}
\helpref{wxStreamBase}{wxstreambase}
@ -91,6 +93,11 @@ read during the next read IO call are put. This is useful when you get a big
block of data which you didn't want to read: you can replace them at the top
of the input queue by this way.
Be very careful about this call in connection with calling SeekI() on the same
stream. Any call to SeekI() will invalidate any previous call to this method
(otherwise you could SeekI() to one position, "unread" a few bytes there, SeekI()
to another position and data would be either lost or corrupted).
\wxheading{Return value}
Returns the amount of bytes saved in the Write-Back buffer.

View File

@ -3,6 +3,8 @@
% -----------------------------------------------------------------------------
\section{\class{wxOutputStream}}\label{wxoutputstream}
wxOutputStream is an abstract base class which may not be used directly.
\wxheading{Derived from}
\helpref{wxStreamBase}{wxstreambase}
@ -30,6 +32,8 @@ Destructor.
\constfunc{size\_t}{LastWrite}{\void}
Returns the number of bytes written during the last Write().
\membersection{wxOutputStream::PutC}
\func{void}{PutC}{\param{char}{ c}}
@ -65,3 +69,46 @@ Reads data from the specified input stream and stores them
in the current stream. The data is read until an error is raised
by one of the two streams.
% -----------------------------------------------------------------------------
% wxCountingOutputStream
% -----------------------------------------------------------------------------
\section{\class{wxCountOutputStream}}\label{wxcountingoutputstream}
wxCountingOutputStream is specialized output stream which does not write any data anyway,
instead it counts how many bytes would get written if this were a normal stream. This
can sometimes be useful or required if some data gets serialized to a stream or compressed
by using stream compression and thus the final size of the stream cannot be known other
than pretending to write the stream. One case where the resulting size would have to be
known is if the data has to be written to a piece of memory and the memory has to be
allocated before writing to it (which is probably always the case when writing to a
memory stream).
\wxheading{Derived from}
\helpref{wxOutputStream}{wxstreambase}
\helpref{wxStreamBase}{wxstreambase}
\wxheading{Include files}
<wx/stream.h>
% -----------
% ctor & dtor
% -----------
\membersection{wxCountingOutputStream::wxCountingOutputStream}
\func{}{wxCountingOutputStream}{\void}
Creates a wxCountingOutputStream object.
\membersection{wxCountingOutputStream::\destruct{wxCountingOutputStream}}
\func{}{\destruct{wxCountingOutputStream}}{\void}
Destructor.
\membersection{wxCountingOutputStream::GetSize}
\constfunc{size\_t}{GetSize}{\void}
Returns the current size of the stream.

View File

@ -6,6 +6,8 @@
This stream acts as a cache. It caches the bytes read from the specified
input stream (See \helpref{wxFilterInputStream}{wxfilterinputstream}).
It uses wxStreamBuffer and sets the default in-buffer size to 1024 bytes.
This class may not be used without some other stream to read the data
from (such as a file stream or a memory stream).
\wxheading{Derived from}
@ -17,7 +19,7 @@ It uses wxStreamBuffer and sets the default in-buffer size to 1024 bytes.
\wxheading{See also}
\helpref{wxStreamBuffer}{wxstreamBuffer}, \helpref{wxInputStream}{wxinputstream}
\helpref{wxStreamBuffer}{wxstreambuffer}, \helpref{wxInputStream}{wxinputstream}
% -----------------------------------------------------------------------------
% wxBufferedOutputStream
@ -28,6 +30,8 @@ This stream acts as a cache. It caches the bytes to be written to the specified
output stream (See \helpref{wxFilterOutputStream}{wxfilteroutputstream}). The
datas are only written when the cache is full or when the buffered stream is
destroyed.
This class may not be used without some other stream to write the data
to (such as a file stream or a memory stream).
\wxheading{Derived from}

View File

@ -39,7 +39,7 @@ socket connection.
\wxheading{See also}
\helpref{wxStreamBuffer}{wxstreamBuffer}, \helpref{wxSocketBase}{wxsocketbase}
\helpref{wxStreamBuffer}{wxstreambuffer}, \helpref{wxSocketBase}{wxsocketbase}
\latexignore{\rtfignore{\wxheading{Members}}}

View File

@ -98,9 +98,9 @@ void wxStreamBuffer::SetBufferIO(size_t bufsize)
wxDELETEA(m_buffer_start);
if (!bufsize) {
m_buffer_start = NULL;
m_buffer_end = NULL;
m_buffer_pos = NULL;
m_buffer_start = (char*)NULL;
m_buffer_end = (char*)NULL;
m_buffer_pos = (char*)NULL;
m_buffer_size = 0;
return;
}
@ -379,7 +379,12 @@ off_t wxStreamBuffer::Seek(off_t pos, wxSeekMode mode)
last_access = GetLastAccess();
if (!m_flushable) {
diff = pos + GetIntPosition();
switch (mode) {
case wxFromStart: diff = pos; break;
case wxFromCurrent: diff = pos + GetIntPosition(); break;
case wxFromEnd: diff = pos + last_access; break;
default: return wxInvalidOffset;
}
if (diff < 0 || diff > last_access)
return wxInvalidOffset;
SetIntPosition(diff);
@ -500,7 +505,7 @@ char *wxInputStream::AllocSpaceWBack(size_t needed_size)
temp_b = (char *)realloc(m_wback, m_wbacksize);
if (!temp_b)
return NULL;
return (char*)NULL;
m_wback = temp_b;
memmove(m_wback+needed_size, m_wback, old_size);
@ -606,9 +611,21 @@ wxInputStream& wxInputStream::Read(wxOutputStream& stream_out)
off_t wxInputStream::SeekI(off_t pos, wxSeekMode mode)
{
//should be check and improve, just to remove a slight bug !
// Should be check and improve, just to remove a slight bug !
// I don't know whether it should be put as well in wxFileInputStream::OnSysSeek ?
if (m_lasterror==wxSTREAM_EOF) m_lasterror=wxSTREAM_NOERROR;
if (m_lasterror==wxSTREAM_EOF)
m_lasterror=wxSTREAM_NOERROR;
// A call to SeekI() will automatically invalidate any previous call
// to Ungetch(), otherwise it would be possible to SeeI() to one
// one position, unread some bytes there, SeekI() to another position
// and the data would be corrupted.
if (m_wback) {
free(m_wback);
m_wback = (char*) NULL;
m_wbacksize = 0;
m_wbackcur = 0;
}
return OnSysSeek(pos, mode);
}

View File

@ -124,7 +124,7 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
if (newSize.y == -1)
{
newSize.y = 11+y;
if (newSize.x < 26) newSize.x = 26;
if (newSize.y < 26) newSize.y = 26;
}
SetSize( newSize.x, newSize.y );

View File

@ -101,7 +101,15 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
m_needParent = TRUE;
m_acceptsFocus = TRUE;
if (!PreCreation( parent, pos, size ) ||
wxSize newSize( size );
if (newSize.x == -1)
newSize.x = 80;
if (newSize.y == -1)
newSize.y = 26;
if (newSize.y > 30)
newSize.y = 30;
if (!PreCreation( parent, pos, newSize ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxComboBox creation failed") );
@ -113,8 +121,6 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
// make it more useable
gtk_combo_set_use_arrows_always(GTK_COMBO(m_widget), TRUE);
SetSizeOrDefault( size );
GtkWidget *list = GTK_COMBO(m_widget)->list;
for (int i = 0; i < n; i++)

View File

@ -124,7 +124,7 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
if (newSize.y == -1)
{
newSize.y = 11+y;
if (newSize.x < 26) newSize.x = 26;
if (newSize.y < 26) newSize.y = 26;
}
SetSize( newSize.x, newSize.y );

View File

@ -101,7 +101,15 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
m_needParent = TRUE;
m_acceptsFocus = TRUE;
if (!PreCreation( parent, pos, size ) ||
wxSize newSize( size );
if (newSize.x == -1)
newSize.x = 80;
if (newSize.y == -1)
newSize.y = 26;
if (newSize.y > 30)
newSize.y = 30;
if (!PreCreation( parent, pos, newSize ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxComboBox creation failed") );
@ -113,8 +121,6 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
// make it more useable
gtk_combo_set_use_arrows_always(GTK_COMBO(m_widget), TRUE);
SetSizeOrDefault( size );
GtkWidget *list = GTK_COMBO(m_widget)->list;
for (int i = 0; i < n; i++)

View File

@ -182,7 +182,7 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti
if (style & wxHF_BOOKMARKS) {
m_Bookmarks = new wxComboBox(toolBar, wxID_HTML_BOOKMARKSLIST, wxEmptyString,
wxDefaultPosition, wxSize(300,200), 0, NULL, wxCB_READONLY | wxCB_SORT);
wxDefaultPosition, wxSize(300,-1), 0, NULL, wxCB_READONLY | wxCB_SORT);
m_Bookmarks -> Append(_("<bookmarks>"));
for (unsigned i = 0; i < m_BookmarksNames.GetCount(); i++)
m_Bookmarks -> Append(m_BookmarksNames[i]);