* Added wxSerial DLL support for Borland 32
* zstream.h doesn't anymore include zlib.h * updated static data * made wxClassInfo::GetFirst() static * added user/password support in the URL parser * fixed bugs git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@746 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -55,7 +55,7 @@ wxLibraries wxTheLibraries;
|
||||
|
||||
wxLibrary::wxLibrary(void *handle)
|
||||
{
|
||||
typedef wxClassInfo **(*t_get_first)(void);
|
||||
typedef wxClassInfo *(*t_get_first)(void);
|
||||
t_get_first get_first;
|
||||
|
||||
m_handle = handle;
|
||||
@@ -90,19 +90,19 @@ wxObject *wxLibrary::CreateObject(const wxString& name)
|
||||
return info->CreateObject();
|
||||
}
|
||||
|
||||
void wxLibrary::PrepareClasses(wxClassInfo **first)
|
||||
void wxLibrary::PrepareClasses(wxClassInfo *first)
|
||||
{
|
||||
// Index all class infos by their class name
|
||||
wxClassInfo *info = *first;
|
||||
wxClassInfo *info = first;
|
||||
while (info)
|
||||
{
|
||||
if (info->m_className)
|
||||
classTable.Put(info->m_className, (wxObject *)info);
|
||||
info = info->m_next;
|
||||
info = info->GetNext();
|
||||
}
|
||||
|
||||
// Set base pointers for each wxClassInfo
|
||||
info = *first;
|
||||
info = first;
|
||||
while (info)
|
||||
{
|
||||
if (info->GetBaseClassName1())
|
||||
@@ -111,7 +111,6 @@ void wxLibrary::PrepareClasses(wxClassInfo **first)
|
||||
info->m_baseInfo2 = (wxClassInfo *)classTable.Get(info->GetBaseClassName2());
|
||||
info = info->m_next;
|
||||
}
|
||||
*first = NULL;
|
||||
}
|
||||
|
||||
void *wxLibrary::GetSymbol(const wxString& symbname)
|
||||
@@ -150,10 +149,15 @@ wxLibrary *wxLibraries::LoadLibrary(const wxString& name)
|
||||
wxString lib_name = name;
|
||||
wxNode *node;
|
||||
wxLibrary *lib;
|
||||
wxClassInfo *old_sm_first;
|
||||
|
||||
if ( (node = m_loaded.Find(name.GetData())) )
|
||||
return ((wxLibrary *)node->Data());
|
||||
|
||||
// If DLL shares data, this is necessary.
|
||||
old_sm_first = wxClassInfo::sm_first;
|
||||
wxClassInfo::sm_first = NULL;
|
||||
|
||||
#if defined(__UNIX__)
|
||||
lib_name.Prepend("./lib");
|
||||
lib_name += ".so";
|
||||
@@ -162,6 +166,8 @@ wxLibrary *wxLibraries::LoadLibrary(const wxString& name)
|
||||
|
||||
void *handle = dlopen(WXSTRINGCAST lib_name, RTLD_LAZY);
|
||||
|
||||
printf("error = %s\n", dlerror());
|
||||
|
||||
if (!handle)
|
||||
return NULL;
|
||||
#elif defined(__WINDOWS__)
|
||||
@@ -180,6 +186,8 @@ wxLibrary *wxLibraries::LoadLibrary(const wxString& name)
|
||||
|
||||
lib = new wxLibrary((void *)handle);
|
||||
|
||||
wxClassInfo::sm_first = old_sm_first;
|
||||
|
||||
m_loaded.Append(name.GetData(), lib);
|
||||
return lib;
|
||||
}
|
||||
|
@@ -177,6 +177,7 @@ bool wxObjectOutputStream::SaveObject(wxObject& obj)
|
||||
wxObjectInputStream::wxObjectInputStream(wxInputStream& s)
|
||||
: wxFilterInputStream(s)
|
||||
{
|
||||
m_secondcall = FALSE;
|
||||
}
|
||||
|
||||
wxObject *wxObjectInputStream::SolveName(const wxString& name) const
|
||||
|
@@ -138,6 +138,7 @@ bool wxURL::PrepProto(wxString& url)
|
||||
|
||||
bool wxURL::PrepHost(wxString& url)
|
||||
{
|
||||
wxString temp_url;
|
||||
int pos, pos2;
|
||||
|
||||
if ((url.GetChar(0) != '/') || (url.GetChar(1) != '/'))
|
||||
@@ -149,17 +150,41 @@ bool wxURL::PrepHost(wxString& url)
|
||||
if (pos == -1)
|
||||
pos = url.Length();
|
||||
|
||||
pos2 = url.Find(':');
|
||||
if (pos == 0)
|
||||
return FALSE;
|
||||
|
||||
temp_url = url(0, pos);
|
||||
url = url(url.Find('/'), url.Length());
|
||||
|
||||
// Retrieve service number
|
||||
pos2 = temp_url.Find(':', TRUE);
|
||||
if (pos2 != -1 && pos2 < pos) {
|
||||
m_servname = url(pos2, pos);
|
||||
if (!m_servname.IsNumber())
|
||||
return FALSE;
|
||||
pos2 = pos;
|
||||
temp_url = temp_url(0, pos2);
|
||||
}
|
||||
|
||||
m_hostname = url(0, pos);
|
||||
// Retrieve user and password.
|
||||
pos2 = temp_url.Find('@');
|
||||
// Even if pos2 equals -1, this code is right.
|
||||
m_hostname = temp_url(pos2+1, temp_url.Length());
|
||||
|
||||
url = url(url.Find('/'), url.Length());
|
||||
m_user = "";
|
||||
m_password = "";
|
||||
|
||||
if (pos2 == -1)
|
||||
return TRUE;
|
||||
|
||||
temp_url = temp_url(0, pos2);
|
||||
pos2 = temp_url.Find(':');
|
||||
|
||||
if (pos2 == -1)
|
||||
return FALSE;
|
||||
|
||||
m_user = temp_url(0, pos2);
|
||||
m_password = temp_url(pos2+1, url.Length());
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -212,6 +237,11 @@ wxInputStream *wxURL::GetInputStream(void)
|
||||
}
|
||||
|
||||
m_error = wxURL_NOERR;
|
||||
if (m_user != "") {
|
||||
m_protocol->SetUser(m_user);
|
||||
m_protocol->SetPassword(m_password);
|
||||
}
|
||||
|
||||
if (m_protoinfo->m_needhost) {
|
||||
if (!addr.Hostname(m_hostname)) {
|
||||
m_error = wxURL_NOHOST;
|
||||
|
@@ -38,52 +38,55 @@ wxZlibInputStream::wxZlibInputStream(wxInputStream& stream)
|
||||
// I need a private stream buffer.
|
||||
m_i_streambuf = new wxStreamBuffer(*this);
|
||||
m_i_destroybuf = TRUE;
|
||||
m_inflate = new z_stream_s;
|
||||
|
||||
m_inflate.zalloc = (alloc_func)0;
|
||||
m_inflate.zfree = (free_func)0;
|
||||
m_inflate.opaque = (void*)0;
|
||||
m_inflate->zalloc = (alloc_func)0;
|
||||
m_inflate->zfree = (free_func)0;
|
||||
m_inflate->opaque = (voidpf)0;
|
||||
|
||||
err = inflateInit(&m_inflate);
|
||||
err = inflateInit(m_inflate);
|
||||
if (err != Z_OK) {
|
||||
inflateEnd(&m_inflate);
|
||||
inflateEnd(m_inflate);
|
||||
delete m_inflate;
|
||||
return;
|
||||
}
|
||||
|
||||
m_z_buffer = new unsigned char[ZSTREAM_BUFFER_SIZE];
|
||||
m_z_size = ZSTREAM_BUFFER_SIZE;
|
||||
|
||||
m_inflate.avail_in = 0;
|
||||
m_inflate.next_in = NULL;
|
||||
m_inflate->avail_in = 0;
|
||||
m_inflate->next_in = NULL;
|
||||
}
|
||||
|
||||
wxZlibInputStream::~wxZlibInputStream()
|
||||
{
|
||||
inflateEnd(&m_inflate);
|
||||
inflateEnd(m_inflate);
|
||||
delete m_inflate;
|
||||
}
|
||||
|
||||
size_t wxZlibInputStream::DoRead(void *buffer, size_t size)
|
||||
{
|
||||
int err;
|
||||
|
||||
m_inflate.next_out = (unsigned char *)buffer;
|
||||
m_inflate.avail_out = size;
|
||||
m_inflate->next_out = (unsigned char *)buffer;
|
||||
m_inflate->avail_out = size;
|
||||
|
||||
while (m_inflate.avail_out > 0) {
|
||||
if (m_inflate.avail_in == 0) {
|
||||
while (m_inflate->avail_out > 0) {
|
||||
if (m_inflate->avail_in == 0) {
|
||||
|
||||
m_parent_i_stream->Read(m_z_buffer, m_z_size);
|
||||
m_inflate.next_in = m_z_buffer;
|
||||
m_inflate.avail_in = m_parent_i_stream->LastRead();
|
||||
m_inflate->next_in = m_z_buffer;
|
||||
m_inflate->avail_in = m_parent_i_stream->LastRead();
|
||||
|
||||
if (m_parent_i_stream->Eof())
|
||||
return (size - m_inflate.avail_in);
|
||||
return (size - m_inflate->avail_in);
|
||||
}
|
||||
err = inflate(&m_inflate, Z_FINISH);
|
||||
err = inflate(m_inflate, Z_FINISH);
|
||||
if (err == Z_STREAM_END)
|
||||
return (size - m_inflate.avail_in);
|
||||
return (size - m_inflate->avail_in);
|
||||
}
|
||||
|
||||
return size-m_inflate.avail_in;
|
||||
return size-m_inflate->avail_in;
|
||||
}
|
||||
|
||||
bool wxZlibInputStream::Eof() const
|
||||
@@ -104,23 +107,24 @@ wxZlibOutputStream::wxZlibOutputStream(wxOutputStream& stream)
|
||||
|
||||
m_o_streambuf = new wxStreamBuffer(*this);
|
||||
m_o_destroybuf = TRUE;
|
||||
m_deflate = new z_stream_s;
|
||||
|
||||
m_deflate.zalloc = (alloc_func)0;
|
||||
m_deflate.zfree = (free_func)0;
|
||||
m_deflate.opaque = (void*)0;
|
||||
m_deflate->zalloc = (alloc_func)0;
|
||||
m_deflate->zfree = (free_func)0;
|
||||
m_deflate->opaque = (voidpf)0;
|
||||
|
||||
err = deflateInit(&m_deflate, Z_DEFAULT_COMPRESSION);
|
||||
err = deflateInit(m_deflate, Z_DEFAULT_COMPRESSION);
|
||||
if (err != Z_OK) {
|
||||
deflateEnd(&m_deflate);
|
||||
deflateEnd(m_deflate);
|
||||
return;
|
||||
}
|
||||
|
||||
m_z_buffer = new unsigned char[ZSTREAM_BUFFER_SIZE];
|
||||
m_z_size = ZSTREAM_BUFFER_SIZE;
|
||||
|
||||
m_deflate.avail_in = 0;
|
||||
m_deflate.next_out = m_z_buffer;
|
||||
m_deflate.avail_out = m_z_size;
|
||||
m_deflate->avail_in = 0;
|
||||
m_deflate->next_out = m_z_buffer;
|
||||
m_deflate->avail_out = m_z_size;
|
||||
}
|
||||
|
||||
wxZlibOutputStream::~wxZlibOutputStream()
|
||||
@@ -129,14 +133,14 @@ wxZlibOutputStream::~wxZlibOutputStream()
|
||||
|
||||
Sync();
|
||||
|
||||
err = deflate(&m_deflate, Z_FINISH);
|
||||
err = deflate(m_deflate, Z_FINISH);
|
||||
if (err != Z_STREAM_END) {
|
||||
wxDebugMsg(_("wxZlibOutputStream: an error occured while we was closing "
|
||||
"the stream.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
deflateEnd(&m_deflate);
|
||||
deflateEnd(m_deflate);
|
||||
|
||||
delete[] m_z_buffer;
|
||||
}
|
||||
@@ -145,42 +149,42 @@ void wxZlibOutputStream::Sync()
|
||||
{
|
||||
int err;
|
||||
|
||||
m_parent_o_stream->Write(m_z_buffer, m_z_size-m_deflate.avail_out);
|
||||
m_deflate.next_out = m_z_buffer;
|
||||
m_deflate.avail_out = m_z_size;
|
||||
m_parent_o_stream->Write(m_z_buffer, m_z_size-m_deflate->avail_out);
|
||||
m_deflate->next_out = m_z_buffer;
|
||||
m_deflate->avail_out = m_z_size;
|
||||
|
||||
err = deflate(&m_deflate, Z_FULL_FLUSH);
|
||||
err = deflate(m_deflate, Z_FULL_FLUSH);
|
||||
if (err != Z_OK) {
|
||||
m_bad = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
m_parent_o_stream->Write(m_z_buffer, m_z_size-m_deflate.avail_out);
|
||||
m_deflate.next_out = m_z_buffer;
|
||||
m_deflate.avail_out = m_z_size;
|
||||
m_parent_o_stream->Write(m_z_buffer, m_z_size-m_deflate->avail_out);
|
||||
m_deflate->next_out = m_z_buffer;
|
||||
m_deflate->avail_out = m_z_size;
|
||||
}
|
||||
|
||||
size_t wxZlibOutputStream::DoWrite(const void *buffer, size_t size)
|
||||
{
|
||||
int err;
|
||||
|
||||
m_deflate.next_in = (unsigned char *)buffer;
|
||||
m_deflate.avail_in = size;
|
||||
m_deflate->next_in = (unsigned char *)buffer;
|
||||
m_deflate->avail_in = size;
|
||||
|
||||
while (m_deflate.avail_in > 0) {
|
||||
while (m_deflate->avail_in > 0) {
|
||||
|
||||
if (m_deflate.avail_out == 0) {
|
||||
if (m_deflate->avail_out == 0) {
|
||||
m_parent_o_stream->Write(m_z_buffer, m_z_size);
|
||||
if (m_parent_o_stream->Bad())
|
||||
return (size - m_deflate.avail_in);
|
||||
return (size - m_deflate->avail_in);
|
||||
|
||||
m_deflate.next_out = m_z_buffer;
|
||||
m_deflate.avail_out = m_z_size;
|
||||
m_deflate->next_out = m_z_buffer;
|
||||
m_deflate->avail_out = m_z_size;
|
||||
}
|
||||
|
||||
err = deflate(&m_deflate, Z_NO_FLUSH);
|
||||
err = deflate(m_deflate, Z_NO_FLUSH);
|
||||
if (err != Z_OK)
|
||||
return (size - m_deflate.avail_in);
|
||||
return (size - m_deflate->avail_in);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
@@ -431,7 +431,7 @@ IMPLEMENT_PROTOCOL(wxHTTP, "http", "80", TRUE)
|
||||
#include "wx/protocol/ftp.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxFTP, wxProtocol)
|
||||
IMPLEMENT_PROTOCOL(wxFTP, "ftp", "ftp", TRUE)
|
||||
IMPLEMENT_PROTOCOL(wxFTP, "ftp", "21", TRUE)
|
||||
|
||||
#include "wx/protocol/sckfile.h"
|
||||
|
||||
|
@@ -431,7 +431,7 @@ IMPLEMENT_PROTOCOL(wxHTTP, "http", "80", TRUE)
|
||||
#include "wx/protocol/ftp.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxFTP, wxProtocol)
|
||||
IMPLEMENT_PROTOCOL(wxFTP, "ftp", "ftp", TRUE)
|
||||
IMPLEMENT_PROTOCOL(wxFTP, "ftp", "21", TRUE)
|
||||
|
||||
#include "wx/protocol/sckfile.h"
|
||||
|
||||
|
@@ -409,6 +409,50 @@ IMPLEMENT_DYNAMIC_CLASS(wxToolBar95, wxToolBarBase)
|
||||
|
||||
#endif
|
||||
|
||||
#include "wx/sckaddr.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxIPV4address, wxSockAddress)
|
||||
#ifdef ENABLE_IPV6
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxIPV6address, wxSockAddress)
|
||||
#endif
|
||||
#ifndef __UNIX__
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress)
|
||||
#endif
|
||||
|
||||
#include "wx/socket.h"
|
||||
|
||||
IMPLEMENT_CLASS(wxSocketBase, wxEvtHandler)
|
||||
IMPLEMENT_CLASS(wxSocketClient, wxSocketBase)
|
||||
IMPLEMENT_CLASS(wxSocketServer, wxSocketBase)
|
||||
IMPLEMENT_CLASS(wxSocketHandler, wxObject)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxSocketEvent, wxEvent)
|
||||
|
||||
#include "wx/url.h"
|
||||
|
||||
IMPLEMENT_CLASS(wxProtoInfo, wxObject)
|
||||
IMPLEMENT_CLASS(wxURL, wxObject)
|
||||
|
||||
#include "wx/protocol/http.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxHTTP, wxProtocol)
|
||||
IMPLEMENT_PROTOCOL(wxHTTP, "http", "80", TRUE)
|
||||
|
||||
#include "wx/protocol/ftp.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxFTP, wxProtocol)
|
||||
IMPLEMENT_PROTOCOL(wxFTP, "ftp", "21", TRUE)
|
||||
|
||||
#include "wx/protocol/sckfile.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxFileProto, wxProtocol)
|
||||
IMPLEMENT_PROTOCOL(wxFileProto, "file", NULL, FALSE)
|
||||
|
||||
#include "wx/sckipc.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxTCPServer, wxServerBase)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxTCPClient, wxClientBase)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxTCPConnection, wxConnectionBase)
|
||||
|
||||
#include "wx/statusbr.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow)
|
||||
|
Reference in New Issue
Block a user