Prime modifiche per compatibilita' UNIX

git-svn-id: svn://10.65.10.50/trunk@33 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
villa 1994-08-18 10:40:18 +00:00
parent 80624b0d87
commit ea150a8931
4 changed files with 955 additions and 952 deletions

View File

@ -59,6 +59,7 @@
//
#include "arclib.h"
#include <utility.h>
#pragma hdrstop
//
@ -100,7 +101,7 @@
#if defined( AL_BUILDING_DLL )
void AL_DLL_FAR * AL_PROTO ALEntry::operator new( size_t size )
{
return ::new char[ size ];
return ::new char[ size ];
}
#endif
@ -130,7 +131,7 @@ void AL_DLL_FAR * AL_PROTO ALEntry::operator new( size_t size )
#if defined( AL_BUILDING_DLL )
void AL_DLL_FAR * AL_PROTO ALEntryList::operator new( size_t size )
{
return ::new char[ size ];
return ::new char[ size ];
}
#endif
@ -191,34 +192,34 @@ void AL_DLL_FAR * AL_PROTO ALEntryList::operator new( size_t size )
//
AL_PROTO ALEntry::ALEntry( ALEntryList &list,
ALStorage *object,
ALCompressionEngine *engine )
: mrList( list ) // Initialize our own pointer to the list we will
// be a member of.
ALStorage *object,
ALCompressionEngine *engine )
: mrList( list ) // Initialize our own pointer to the list we will
// be a member of.
{
mpNextItem = this;
mpPreviousItem = this;
mpStorageObject = object;
mpCompressionEngine = engine;
mlCompressedSize = -1;
mlCompressedObjectPosition = -1;
miMark = 1; //Always construct with the mark turned on
mszComment = 0;
//
// I check for the object member to be non-zero because of a clunky design
// choice I made a while back. Each ALEntryList has an ALEntry member that
// points to the first and last members of the list. I could have (and
// probably should have) made the root of the list just be a pair of pointers,
// instead of a dummy ALEntry. Anyway, I can tell that dummy entry apart
// from the valid entries by virtue of the fact that it has a null
// pointer in its object pointer.
//
// So anyway, when I create this dummy object, I don't want to try to add
// it to the list, because by definition it is already in the list. So
// I do a check before adding any ALEntry to the list.
//
if ( object )
InsertBefore( *list.mpListHead );
mpNextItem = this;
mpPreviousItem = this;
mpStorageObject = object;
mpCompressionEngine = engine;
mlCompressedSize = -1;
mlCompressedObjectPosition = -1;
miMark = 1; //Always construct with the mark turned on
mszComment = 0;
//
// I check for the object member to be non-zero because of a clunky design
// choice I made a while back. Each ALEntryList has an ALEntry member that
// points to the first and last members of the list. I could have (and
// probably should have) made the root of the list just be a pair of pointers,
// instead of a dummy ALEntry. Anyway, I can tell that dummy entry apart
// from the valid entries by virtue of the fact that it has a null
// pointer in its object pointer.
//
// So anyway, when I create this dummy object, I don't want to try to add
// it to the list, because by definition it is already in the list. So
// I do a check before adding any ALEntry to the list.
//
if ( object )
InsertBefore( *list.mpListHead );
}
//
@ -253,30 +254,30 @@ AL_PROTO ALEntry::ALEntry( ALEntryList &list,
AL_PROTO ALEntry::~ALEntry()
{
AL_ASSERT( GoodTag(), "~ALEntry: Attempting to delete invalid object" );
if ( mszComment )
delete[] mszComment;
if ( mpStorageObject != 0 )
delete mpStorageObject;
if ( mpCompressionEngine != 0 )
delete mpCompressionEngine;
AL_ASSERT( mpNextItem != 0 ,"~ALEntry: next item is null" );
AL_ASSERT( mpPreviousItem != 0, "~ALEntry: previous item is null" );
AL_ASSERT( GoodTag(), "~ALEntry: Attempting to delete invalid object" );
if ( mszComment )
delete[] mszComment;
if ( mpStorageObject != 0 )
delete mpStorageObject;
if ( mpCompressionEngine != 0 )
delete mpCompressionEngine;
AL_ASSERT( mpNextItem != 0 ,"~ALEntry: next item is null" );
AL_ASSERT( mpPreviousItem != 0, "~ALEntry: previous item is null" );
ALEntry *next_job = mpNextItem;
ALEntry *previous_job = mpPreviousItem;
ALEntry *next_job = mpNextItem;
ALEntry *previous_job = mpPreviousItem;
if ( next_job != this ) {
next_job->mpPreviousItem = previous_job;
previous_job->mpNextItem = next_job;
}
//
// Note that I check the object twice, one at the start of the dtor, and
// once again at the end. With all the linked list and dynamic deletion
// being done here, it seems like it would be really easy to hose things
// up if any mistakes were made.
//
AL_ASSERT( GoodTag(), "~ALEntry: Attempting to delete invalid object" );
if ( next_job != this ) {
next_job->mpPreviousItem = previous_job;
previous_job->mpNextItem = next_job;
}
//
// Note that I check the object twice, one at the start of the dtor, and
// once again at the end. With all the linked list and dynamic deletion
// being done here, it seems like it would be really easy to hose things
// up if any mistakes were made.
//
AL_ASSERT( GoodTag(), "~ALEntry: Attempting to delete invalid object" );
}
//
@ -306,22 +307,22 @@ AL_PROTO ALEntry::~ALEntry()
int AL_PROTO ALEntry::Duplicate( ALEntryList &list )
{
char *name = mpStorageObject->mName;
int case_sensitive = mpStorageObject->mName.mCase == AL_MIXED;
ALEntry *job = list.GetFirstEntry();
while ( job ) {
if ( job->GetMark() && job != this ) {
if ( case_sensitive ) {
if ( strcmp( name, job->mpStorageObject->mName ) == 0 )
return 1;
} else {
if ( stricmp( name, job->mpStorageObject->mName ) == 0 )
return 1;
}
}
job = job->GetNextEntry();
char *name = mpStorageObject->mName;
int case_sensitive = mpStorageObject->mName.mCase == AL_MIXED;
ALEntry *job = list.GetFirstEntry();
while ( job ) {
if ( job->GetMark() && job != this ) {
if ( case_sensitive ) {
if ( strcmp( name, job->mpStorageObject->mName ) == 0 )
return 1;
} else {
if ( stricmp( name, job->mpStorageObject->mName ) == 0 )
return 1;
}
}
return 0;
job = job->GetNextEntry();
}
return 0;
}
//
@ -352,10 +353,10 @@ int AL_PROTO ALEntry::Duplicate( ALEntryList &list )
void AL_PROTO ALEntry::InsertBefore( ALEntry &job )
{
mpNextItem = &job;
mpPreviousItem = job.mpPreviousItem;
(job.mpPreviousItem)->mpNextItem = this;
job.mpPreviousItem = this;
mpNextItem = &job;
mpPreviousItem = job.mpPreviousItem;
(job.mpPreviousItem)->mpNextItem = this;
job.mpPreviousItem = this;
}
//
@ -387,20 +388,20 @@ void AL_PROTO ALEntry::InsertBefore( ALEntry &job )
int AL_PROTO ALEntry::SetComment( const char AL_DLL_FAR *comment )
{
if ( mszComment )
delete[] mszComment;
if ( comment ) {
mszComment = new char[ strlen( comment ) + 1 ];
if ( mszComment )
delete[] mszComment;
if ( comment ) {
mszComment = new char[ strlen( comment ) + 1 ];
if ( mszComment )
strcpy( mszComment, comment );
else
return mrList.mStatus.SetError( AL_CANT_ALLOCATE_MEMORY,
"Failed to allocate memory when "
"adding comment to storage object %s",
(char *) mpStorageObject->mName );
} else
mszComment = 0;
return AL_SUCCESS;
strcpy( mszComment, comment );
else
return mrList.mStatus.SetError( AL_CANT_ALLOCATE_MEMORY,
"Failed to allocate memory when "
"adding comment to storage object %s",
(char *) mpStorageObject->mName );
} else
mszComment = 0;
return AL_SUCCESS;
}
//
@ -434,13 +435,13 @@ int AL_PROTO ALEntry::SetComment( const char AL_DLL_FAR *comment )
int AL_PROTO ALEntry::CompressionRatio()
{
long uncompressed_size = mpStorageObject->GetSize();
long uncompressed_size = mpStorageObject->GetSize();
if ( uncompressed_size <= 0 )
return -1;
if ( mlCompressedSize <= 0 )
return -1;
return (int) ( 100 * mlCompressedSize / uncompressed_size );
if ( uncompressed_size <= 0 )
return -1;
if ( mlCompressedSize <= 0 )
return -1;
return (int) ( 100 * mlCompressedSize / uncompressed_size );
}
@ -481,9 +482,9 @@ int AL_PROTO ALEntry::CompressionRatio()
ALMonitor ALDefaultMonitor( AL_MONITOR_OBJECTS );
AL_PROTO ALEntryList::ALEntryList( ALMonitor AL_DLL_FAR * monitor /* = 0 */ )
: mrMonitor( monitor ? *monitor : ALDefaultMonitor )
: mrMonitor( monitor ? *monitor : ALDefaultMonitor )
{
mpListHead = new ALEntry( *this, 0, 0 );
mpListHead = new ALEntry( *this, 0, 0 );
}
//
@ -512,16 +513,16 @@ AL_PROTO ALEntryList::ALEntryList( ALMonitor AL_DLL_FAR * monitor /* = 0 */ )
AL_PROTO ALEntryList::~ALEntryList()
{
AL_ASSERT( GoodTag(), "~ALEntryList: attempting to delete invalid object" );
ALEntry *job = GetFirstEntry();
while ( job ) {
ALEntry *next_job = job->GetNextEntry();
delete job;
job = next_job;
}
if ( mpListHead )
delete mpListHead;
AL_ASSERT( GoodTag(), "~ALEntryList: attempting to delete invalid object" );
AL_ASSERT( GoodTag(), "~ALEntryList: attempting to delete invalid object" );
ALEntry *job = GetFirstEntry();
while ( job ) {
ALEntry *next_job = job->GetNextEntry();
delete job;
job = next_job;
}
if ( mpListHead )
delete mpListHead;
AL_ASSERT( GoodTag(), "~ALEntryList: attempting to delete invalid object" );
}
// PROTECTED FUNCTION
@ -555,24 +556,24 @@ AL_PROTO ALEntryList::~ALEntryList()
//
int AL_PROTO ALEntryList::SetMarkState( const char AL_DLL_FAR *name,
short int new_state )
short int new_state )
{
int count = 0;
int count = 0;
ALEntry *job = GetFirstEntry();
while ( job ) {
if ( name ) {
if ( job->mpStorageObject->mName.WildCardMatch( name ) ) {
job->SetMarkState( new_state );
count++;
}
} else {
job->SetMarkState( new_state );
count++;
}
job = job->GetNextEntry();
ALEntry *job = GetFirstEntry();
while ( job ) {
if ( name ) {
if ( job->mpStorageObject->mName.WildCardMatch( name ) ) {
job->SetMarkState( new_state );
count++;
}
} else {
job->SetMarkState( new_state );
count++;
}
return count;
job = job->GetNextEntry();
}
return count;
}
//
@ -600,14 +601,14 @@ int AL_PROTO ALEntryList::SetMarkState( const char AL_DLL_FAR *name,
int AL_PROTO ALEntryList::ToggleMarks()
{
int count = 0;
ALEntry *job = GetFirstEntry();
while ( job ) {
job->SetMarkState( (short int) !job->GetMark() );
job = job->GetNextEntry();
count++;
}
return count;
int count = 0;
ALEntry *job = GetFirstEntry();
while ( job ) {
job->SetMarkState( (short int) !job->GetMark() );
job = job->GetNextEntry();
count++;
}
return count;
}
//
@ -639,15 +640,15 @@ int AL_PROTO ALEntryList::ToggleMarks()
ALEntry AL_DLL_FAR * AL_PROTO ALEntry::GetNextEntry()
{
ALEntry *next_entry = this->mpNextItem;
//
// The list head has the special case where both the compression engine
// and storage object pointers are 0, and that makes the end of the list.
//
if ( mpNextItem->mpStorageObject == 0 )
return 0;
else
return next_entry;
ALEntry *next_entry = this->mpNextItem;
//
// The list head has the special case where both the compression engine
// and storage object pointers are 0, and that makes the end of the list.
//
if ( mpNextItem->mpStorageObject == 0 )
return 0;
else
return next_entry;
}
//
@ -677,7 +678,7 @@ ALEntry AL_DLL_FAR * AL_PROTO ALEntry::GetNextEntry()
ALEntry AL_DLL_FAR * AL_PROTO ALEntryList::GetFirstEntry()
{
return mpListHead->GetNextEntry();
return mpListHead->GetNextEntry();
}
//
@ -720,21 +721,21 @@ ALEntry AL_DLL_FAR * AL_PROTO ALEntryList::GetFirstEntry()
//
void AL_PROTO ALEntryList::UnmarkDuplicates( ALEntryList &list,
const char *error_message /* = 0 */ )
const char *error_message /* = 0 */ )
{
ALEntry *job = GetFirstEntry();
while ( job ) {
if ( job->GetMark() ) {
if ( job->Duplicate( list ) ) {
job->ClearMark();
if ( error_message && error_message[ 0 ] != '\0' )
job->mpStorageObject->mStatus.SetError(
AL_DUPLICATE_ENTRY,
error_message );
}
}
job = job->GetNextEntry();
ALEntry *job = GetFirstEntry();
while ( job ) {
if ( job->GetMark() ) {
if ( job->Duplicate( list ) ) {
job->ClearMark();
if ( error_message && error_message[ 0 ] != '\0' )
job->mpStorageObject->mStatus.SetError(
AL_DUPLICATE_ENTRY,
error_message );
}
}
job = job->GetNextEntry();
}
}
//
@ -762,19 +763,19 @@ void AL_PROTO ALEntryList::UnmarkDuplicates( ALEntryList &list,
int AL_PROTO ALEntryList::DeleteUnmarked()
{
ALEntry *job;
int count = 0;
ALEntry *job;
int count = 0;
job = GetFirstEntry();
while ( job ) {
ALEntry *next_job = job->GetNextEntry();
if ( job->GetMark() == 0 ) {
count++;
delete job;
}
job = next_job;
job = GetFirstEntry();
while ( job ) {
ALEntry *next_job = job->GetNextEntry();
if ( job->GetMark() == 0 ) {
count++;
delete job;
}
return count;
job = next_job;
}
return count;
}
//
@ -811,31 +812,31 @@ int AL_PROTO ALEntryList::DeleteUnmarked()
#if defined( AL_WINDOWS_GUI )
int AL_PROTO ALEntryList::FillListBox( HWND hDlg, int list_box /* = -1 */ )
{
HWND window;
HWND window;
if ( list_box != -1 )
window = GetDlgItem( hDlg, (short int) list_box );
else
window = hDlg;
SendMessage( window, LB_RESETCONTENT, 0, 0 );
ALEntry *job = GetFirstEntry();
int count = 0;
while ( job ) {
if ( job->GetMark() ) {
count++;
SendMessage( window,
LB_ADDSTRING,
0,
(LPARAM)( (LPSTR) job->mpStorageObject->mName ) );
}
job = job->GetNextEntry();
if ( list_box != -1 )
window = GetDlgItem( hDlg, (short int) list_box );
else
window = hDlg;
SendMessage( window, LB_RESETCONTENT, 0, 0 );
ALEntry *job = GetFirstEntry();
int count = 0;
while ( job ) {
if ( job->GetMark() ) {
count++;
SendMessage( window,
LB_ADDSTRING,
0,
(LPARAM)( (LPSTR) job->mpStorageObject->mName ) );
}
if ( count == 0 )
SendMessage( window,
LB_ADDSTRING,
0,
(LPARAM)( (LPSTR) "<none>" ) );
return count;
job = job->GetNextEntry();
}
if ( count == 0 )
SendMessage( window,
LB_ADDSTRING,
0,
(LPARAM)( (LPSTR) "<none>" ) );
return count;
}
@ -871,43 +872,43 @@ int AL_PROTO ALEntryList::FillListBox( HWND hDlg, int list_box /* = -1 */ )
int AL_PROTO ALEntryList::SetMarksFromListBox( HWND hDlg, int list_box /* = -1 */ )
{
HWND window;
HWND window;
if ( list_box != -1 )
window = GetDlgItem( hDlg, (short int) list_box );
else
window = hDlg;
if ( list_box != -1 )
window = GetDlgItem( hDlg, (short int) list_box );
else
window = hDlg;
WORD count = (WORD) SendMessage( window, LB_GETSELCOUNT, 0, 0L );
int *items = new int[ count ];
if ( items == 0 )
return mStatus.SetError( AL_CANT_ALLOCATE_MEMORY,
"Memory allocation failure in SetMarksFromListBox()" );
WORD count = (WORD) SendMessage( window, LB_GETSELCOUNT, 0, 0L );
int *items = new int[ count ];
if ( items == 0 )
return mStatus.SetError( AL_CANT_ALLOCATE_MEMORY,
"Memory allocation failure in SetMarksFromListBox()" );
#ifdef AL_FLAT_MODEL
if ( count != (WORD) SendMessage( window, LB_GETSELITEMS, count, (LPARAM) ( items ) ) ) {
if ( count != (WORD) SendMessage( window, LB_GETSELITEMS, count, (LPARAM) ( items ) ) ) {
#else
if ( count != (WORD) SendMessage( window, LB_GETSELITEMS, count, (LPARAM) ( (int _far * ) items ) ) ) {
#endif
mStatus.SetError( AL_LOGIC_ERROR,
"Logic error in SetMarksFromListBox()."
"Mismatch in select count from list box." );
delete[] items;
return AL_LOGIC_ERROR;
mStatus.SetError( AL_LOGIC_ERROR,
"Logic error in SetMarksFromListBox()."
"Mismatch in select count from list box." );
delete[] items;
return AL_LOGIC_ERROR;
}
for ( WORD i = 0 ; i < count ; i++ ) {
WORD length = (WORD) SendMessage( window, LB_GETTEXTLEN, (short int) items[ i ], 0L );
AL_ASSERT( length != (WORD) LB_ERR, "SetMarksFromListBox: LB_ERR returned from list box" );
if ( length > 0 ) {
char *name = new char[ length + 1 ];
if ( name ) {
if ( SendMessage( window, LB_GETTEXT, (short int) items[ i ], (LPARAM)( (LPSTR) name ) ) >= 0 )
SetMarks( name );
delete[] name;
}
WORD length = (WORD) SendMessage( window, LB_GETTEXTLEN, (short int) items[ i ], 0L );
AL_ASSERT( length != (WORD) LB_ERR, "SetMarksFromListBox: LB_ERR returned from list box" );
if ( length > 0 ) {
char *name = new char[ length + 1 ];
if ( name ) {
if ( SendMessage( window, LB_GETTEXT, (short int) items[ i ], (LPARAM)( (LPSTR) name ) ) >= 0 )
SetMarks( name );
delete[] name;
}
}
}
delete[] items;
return count;
}
}
#endif

View File

@ -78,7 +78,7 @@
#if defined( AL_BUILDING_DLL )
void AL_DLL_FAR * AL_PROTO ALArchive::operator new( size_t size )
{
return ::new char[ size ];
return ::new char[ size ];
}
#endif
@ -110,7 +110,7 @@ void AL_DLL_FAR * AL_PROTO ALArchive::operator new( size_t size )
//
AL_PROTO ALArchive::ALArchive( const char AL_DLL_FAR *file_name )
: ALArchiveBase( new ALFile( file_name ), 1 )
: ALArchiveBase( new ALFile( file_name ), 1 )
{
}
@ -143,7 +143,7 @@ AL_PROTO ALArchive::ALArchive( const char AL_DLL_FAR *file_name )
//
AL_PROTO ALArchive::ALArchive( ALStorage AL_DLL_FAR &so )
: ALArchiveBase( &so, 0 )
: ALArchiveBase( &so, 0 )
{
}
@ -173,7 +173,7 @@ AL_PROTO ALArchive::ALArchive( ALStorage AL_DLL_FAR &so )
AL_PROTO ALArchive::~ALArchive()
{
AL_ASSERT( GoodTag(), "~ALArchive: attempt to delete invalid object" );
AL_ASSERT( GoodTag(), "~ALArchive: attempt to delete invalid object" );
}
//
@ -206,18 +206,18 @@ AL_PROTO ALArchive::~ALArchive()
ALCompressionEngine AL_DLL_FAR *
AL_PROTO ALArchive::CreateCompressionEngine( int engine_type )
{
switch ( engine_type ) {
case AL_COMPRESSION_COPY :
return new ALCopyEngine();
case AL_COMPRESSION_GREENLEAF :
return new ALGreenleafEngine();
default :
mStatus.SetError( AL_UNKNOWN_COMPRESSION_TYPE,
"Unknown compression type (%d) found in archive",
engine_type );
break; //Break instead of return because of bogus warnings
}
return 0;
switch ( engine_type ) {
case AL_COMPRESSION_COPY :
return new ALCopyEngine();
case AL_COMPRESSION_GREENLEAF :
return new ALGreenleafEngine();
default :
mStatus.SetError( AL_UNKNOWN_COMPRESSION_TYPE,
"Unknown compression type (%d) found in archive",
engine_type );
break; //Break instead of return because of bogus warnings
}
return 0;
}
//
@ -251,22 +251,22 @@ AL_PROTO ALArchive::CreateCompressionEngine( int engine_type )
ALStorage AL_DLL_FAR * AL_PROTO
ALArchive::CreateStorageObject( const char AL_DLL_FAR *name,
int object_type )
int object_type )
{
switch ( object_type ) {
case AL_MEMORY_OBJECT :
return new ALMemory( name );
case AL_FILE_OBJECT :
return new ALFile( name );
default :
mStatus.SetError( AL_UNKNOWN_STORAGE_OBJECT,
"Unknown storage object type (%d) "
"found in archive",
object_type );
switch ( object_type ) {
case AL_MEMORY_OBJECT :
return new ALMemory( name );
case AL_FILE_OBJECT :
return new ALFile( name );
default :
mStatus.SetError( AL_UNKNOWN_STORAGE_OBJECT,
"Unknown storage object type (%d) "
"found in archive",
object_type );
break;
}
return 0;
break;
}
return 0;
}
// STATIC MEMBER FUNCTION
@ -325,22 +325,22 @@ ALArchive::CreateStorageObject( const char AL_DLL_FAR *name,
int AL_PROTO
ALArchive::AddWildCardFiles( ALEntryList AL_DLL_FAR & list,
const char AL_DLL_FAR *wild_spec /* = "*.*" */,
int traverse_flag /* = 0 */,
short int compression_level /* = AL_GREENLEAF_LEVEL_2 */ )
const char AL_DLL_FAR *wild_spec /* = "*.*" */,
int traverse_flag /* = 0 */,
short int compression_level /* = AL_GREENLEAF_LEVEL_2 */ )
{
AL_ASSERT( wild_spec != 0, "AddWildCardFiles: null parameter for wild_spec" );
ALWildCardExpander files( wild_spec, traverse_flag );
int count = 0;
char *new_name;
while ( ( new_name = files.GetNextFile() ) != 0 ) {
new ALEntry( list,
new ALFile( new_name ),
new ALGreenleafEngine( compression_level ) );
count++;
}
return count;
AL_ASSERT( wild_spec != 0, "AddWildCardFiles: null parameter for wild_spec" );
ALWildCardExpander files( wild_spec, traverse_flag );
int count = 0;
char *new_name; ALEntry* dummy;
while ( ( new_name = files.GetNextFile() ) != 0 ) {
dummy = new ALEntry( list,
new ALFile( new_name ),
new ALGreenleafEngine( compression_level ) );
count++;
}
return count;
}
//
@ -385,49 +385,49 @@ ALArchive::AddWildCardFiles( ALEntryList AL_DLL_FAR & list,
int AL_PROTO ALArchive::
MakeEntriesFromListBox( ALEntryList AL_DLL_FAR &list,
HWND hDlg,
int list_box /* = -1 */ )
HWND hDlg,
int list_box /* = -1 */ )
{
HWND window;
HWND window;
if ( list_box != -1 )
window = GetDlgItem( hDlg, (short int) list_box );
else
window = hDlg;
int count = (WORD) SendMessage( window, LB_GETSELCOUNT, 0, 0L );
if ( count == LB_ERR )
return AL_GETSEL_ERROR;
int *items = new int[ count ];
if ( items == 0 )
return AL_CANT_ALLOCATE_MEMORY;
if ( list_box != -1 )
window = GetDlgItem( hDlg, (short int) list_box );
else
window = hDlg;
int count = (WORD) SendMessage( window, LB_GETSELCOUNT, 0, 0L );
if ( count == LB_ERR )
return AL_GETSEL_ERROR;
int *items = new int[ count ];
if ( items == 0 )
return AL_CANT_ALLOCATE_MEMORY;
#ifdef AL_FLAT_MODEL
if ( count != SendMessage( window, LB_GETSELITEMS, (short int) count, (LPARAM) items ) ) {
if ( count != SendMessage( window, LB_GETSELITEMS, (short int) count, (LPARAM) items ) ) {
#else
if ( count != SendMessage( window, LB_GETSELITEMS, (short int) count, (LPARAM)(int _far *) items ) ) {
#endif
delete items;
return AL_GETSEL_ERROR;
delete items;
return AL_GETSEL_ERROR;
}
for ( WORD i = 0 ; i < (WORD) count ; i++ ) {
WORD length = (WORD) SendMessage( window, LB_GETTEXTLEN, (short int) items[ i ], 0L );
if ( length > 0 ) {
char *name = new char[ length + 1 ];
if ( name ) {
if ( SendMessage( window, LB_GETTEXT, (short int) items[ i ], (LPARAM)( (LPSTR) name ) ) >= 0 ) {
new ALEntry( list,
new ALFile( name ),
new ALGreenleafEngine() );
}
delete name;
SendMessage( window,
LB_SETSEL,
0,
items[ i ] );
}
WORD length = (WORD) SendMessage( window, LB_GETTEXTLEN, (short int) items[ i ], 0L );
if ( length > 0 ) {
char *name = new char[ length + 1 ];
if ( name ) {
if ( SendMessage( window, LB_GETTEXT, (short int) items[ i ], (LPARAM)( (LPSTR) name ) ) >= 0 ) {
new ALEntry( list,
new ALFile( name ),
new ALGreenleafEngine() );
}
delete name;
SendMessage( window,
LB_SETSEL,
0,
items[ i ] );
}
}
}
delete items;
return count;
}
}
#endif //#ifdef AL_WINDOWS_GUI

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,9 @@
#include "arclib.h"
#pragma hdrstop
#if XVT_OS != XVT_OS_SCOUNIX
#include <dos.h>
#endif
#include "fileattr.h"
@ -72,7 +74,7 @@
#if defined( AL_BUILDING_DLL )
void AL_DLL_FAR * AL_PROTO ALFileAttributes::operator new( size_t size )
{
return ::new char[ size ];
return ::new char[ size ];
}
#endif
@ -103,10 +105,10 @@ void AL_DLL_FAR * AL_PROTO ALFileAttributes::operator new( size_t size )
AL_PROTO ALFileAttributes::ALFileAttributes()
{
miReadOnly = 0;
miSystem = 0;
miHidden = 0;
miArchive = 0;
miReadOnly = 0;
miSystem = 0;
miHidden = 0;
miArchive = 0;
}
//
@ -164,10 +166,10 @@ AL_PROTO ALFileAttributes::~ALFileAttributes()
void AL_PROTO ALFileAttributes::
SetFromPackedAttributes( short int attributes )
{
miReadOnly = ( attributes & 1 ) != 0;
miSystem = ( attributes & 2 ) != 0;
miHidden = ( attributes & 4 ) != 0;
miArchive = ( attributes & 8 ) != 0;
miReadOnly = ( attributes & 1 ) != 0;
miSystem = ( attributes & 2 ) != 0;
miHidden = ( attributes & 4 ) != 0;
miArchive = ( attributes & 8 ) != 0;
}
//
@ -203,10 +205,10 @@ SetFromPackedAttributes( short int attributes )
void AL_PROTO ALFileAttributes::
SetFromWin32Attributes( DWORD win32_attributes )
{
miReadOnly = ( win32_attributes & FILE_ATTRIBUTE_READONLY ) != 0;
miSystem = ( win32_attributes & FILE_ATTRIBUTE_SYSTEM ) != 0;
miHidden = ( win32_attributes & FILE_ATTRIBUTE_HIDDEN ) != 0;
miArchive = ( win32_attributes & FILE_ATTRIBUTE_ARCHIVE ) != 0;
miReadOnly = ( win32_attributes & FILE_ATTRIBUTE_READONLY ) != 0;
miSystem = ( win32_attributes & FILE_ATTRIBUTE_SYSTEM ) != 0;
miHidden = ( win32_attributes & FILE_ATTRIBUTE_HIDDEN ) != 0;
miArchive = ( win32_attributes & FILE_ATTRIBUTE_ARCHIVE ) != 0;
}
#endif
@ -243,10 +245,10 @@ SetFromWin32Attributes( DWORD win32_attributes )
void AL_PROTO ALFileAttributes::SetFromDosAttributes( unsigned dos_attributes )
{
miReadOnly = ( dos_attributes & _A_RDONLY ) != 0;
miSystem = ( dos_attributes & _A_SYSTEM ) != 0;
miHidden = ( dos_attributes & _A_HIDDEN ) != 0;
miArchive = ( dos_attributes & _A_ARCH ) != 0;
miReadOnly = ( dos_attributes & _A_RDONLY ) != 0;
miSystem = ( dos_attributes & _A_SYSTEM ) != 0;
miHidden = ( dos_attributes & _A_HIDDEN ) != 0;
miArchive = ( dos_attributes & _A_ARCH ) != 0;
}
#endif
@ -279,13 +281,13 @@ void AL_PROTO ALFileAttributes::SetFromDosAttributes( unsigned dos_attributes )
unsigned short int AL_PROTO ALFileAttributes::PackedAttributes()
{
int result = 0;
int result = 0;
result |= miReadOnly ? 1 : 0;
result |= miSystem ? 2 : 0;
result |= miHidden ? 4 : 0;
result |= miArchive ? 8 : 0;
return (unsigned short int ) result;
result |= miReadOnly ? 1 : 0;
result |= miSystem ? 2 : 0;
result |= miHidden ? 4 : 0;
result |= miArchive ? 8 : 0;
return (unsigned short int ) result;
}
//
@ -316,12 +318,12 @@ unsigned short int AL_PROTO ALFileAttributes::PackedAttributes()
unsigned short int AL_PROTO ALFileAttributes::GetDosAttributes()
{
int result = 0;
result |= miReadOnly ? _A_RDONLY : 0;
result |= miSystem ? _A_SYSTEM : 0;
result |= miHidden ? _A_HIDDEN : 0;
result |= miArchive ? _A_ARCH : 0;
return (unsigned short int) result;
int result = 0;
result |= miReadOnly ? _A_RDONLY : 0;
result |= miSystem ? _A_SYSTEM : 0;
result |= miHidden ? _A_HIDDEN : 0;
result |= miArchive ? _A_ARCH : 0;
return (unsigned short int) result;
}
#endif //#if !defined( AL_WIN32S )
@ -353,11 +355,11 @@ unsigned short int AL_PROTO ALFileAttributes::GetDosAttributes()
DWORD AL_PROTO ALFileAttributes::GetWin32Attributes()
{
DWORD result = 0;
result |= miReadOnly ? FILE_ATTRIBUTE_READONLY : 0;
result |= miSystem ? FILE_ATTRIBUTE_SYSTEM : 0;
result |= miHidden ? FILE_ATTRIBUTE_HIDDEN : 0;
result |= miArchive ? FILE_ATTRIBUTE_ARCHIVE : 0;
return result;
DWORD result = 0;
result |= miReadOnly ? FILE_ATTRIBUTE_READONLY : 0;
result |= miSystem ? FILE_ATTRIBUTE_SYSTEM : 0;
result |= miHidden ? FILE_ATTRIBUTE_HIDDEN : 0;
result |= miArchive ? FILE_ATTRIBUTE_ARCHIVE : 0;
return result;
}
#endif //#if !defined( AL_WIN32S )