my own uncrustify run

This commit is contained in:
Rudolf Polzer
2012-03-27 12:03:21 +02:00
parent 203343b01a
commit e4287c28bb
1056 changed files with 194610 additions and 205971 deletions

View File

@@ -1,23 +1,23 @@
/*
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
This file is part of GtkRadiant.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "archive.h"
@@ -38,121 +38,107 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "string/string.h"
#include "fs_filesystem.h"
inline void buffer_findreplace(char* buffer, char find, char replace)
{
while(*buffer != '\0')
{
if(*buffer == find)
*buffer = replace;
++buffer;
}
inline void buffer_findreplace( char* buffer, char find, char replace ){
while ( *buffer != '\0' )
{
if ( *buffer == find ) {
*buffer = replace;
}
++buffer;
}
}
#include "pak.h"
class PakArchive : public Archive
{
class PakRecord
{
public:
PakRecord(unsigned int position, unsigned int stream_size)
: m_position(position), m_stream_size(stream_size)
{
}
unsigned int m_position;
unsigned int m_stream_size;
};
typedef GenericFileSystem<PakRecord> PakFileSystem;
PakFileSystem m_filesystem;
FileInputStream m_pakfile;
CopiedString m_name;
class PakRecord
{
public:
PakRecord( unsigned int position, unsigned int stream_size )
: m_position( position ), m_stream_size( stream_size ){
}
unsigned int m_position;
unsigned int m_stream_size;
};
typedef GenericFileSystem<PakRecord> PakFileSystem;
PakFileSystem m_filesystem;
FileInputStream m_pakfile;
CopiedString m_name;
public:
PakArchive(const char* name)
: m_pakfile(name), m_name(name)
{
if(!m_pakfile.failed())
{
pakheader_t header;
m_pakfile.read(reinterpret_cast<FileInputStream::byte_type*>(header.magic), 4);
header.diroffset = istream_read_uint32_le(m_pakfile);
header.dirsize = istream_read_uint32_le(m_pakfile);
PakArchive( const char* name )
: m_pakfile( name ), m_name( name ){
if ( !m_pakfile.failed() ) {
pakheader_t header;
if(strncmp (header.magic, "PACK", 4) == 0)
{
m_pakfile.seek(header.diroffset);
m_pakfile.read( reinterpret_cast<FileInputStream::byte_type*>( header.magic ), 4 );
header.diroffset = istream_read_uint32_le( m_pakfile );
header.dirsize = istream_read_uint32_le( m_pakfile );
for(unsigned int i = 0; i < header.dirsize; i += sizeof(pakentry_t))
{
pakentry_t entry;
if ( strncmp( header.magic, "PACK", 4 ) == 0 ) {
m_pakfile.seek( header.diroffset );
m_pakfile.read(reinterpret_cast<FileInputStream::byte_type*>(entry.filename), 0x38);
entry.offset = istream_read_uint32_le(m_pakfile);
entry.size = istream_read_uint32_le(m_pakfile);
for ( unsigned int i = 0; i < header.dirsize; i += sizeof( pakentry_t ) )
{
pakentry_t entry;
buffer_findreplace(entry.filename, '\\', '/');
m_pakfile.read( reinterpret_cast<FileInputStream::byte_type*>( entry.filename ), 0x38 );
entry.offset = istream_read_uint32_le( m_pakfile );
entry.size = istream_read_uint32_le( m_pakfile );
PakFileSystem::entry_type& file = m_filesystem[entry.filename];
if(!file.is_directory())
{
globalOutputStream() << "Warning: pak archive " << makeQuoted(m_name.c_str()) << " contains duplicated file: " << makeQuoted(entry.filename) << "\n";
}
else
{
file = new PakRecord(entry.offset, entry.size);
}
}
}
}
}
buffer_findreplace( entry.filename, '\\', '/' );
~PakArchive()
{
for(PakFileSystem::iterator i = m_filesystem.begin(); i != m_filesystem.end(); ++i)
delete i->second.file();
}
void release()
{
delete this;
}
ArchiveFile* openFile(const char* name)
{
PakFileSystem::iterator i = m_filesystem.find(name);
if(i != m_filesystem.end() && !i->second.is_directory())
{
PakRecord* file = i->second.file();
return StoredArchiveFile::create(name, m_name.c_str(), file->m_position, file->m_stream_size, file->m_stream_size);
}
return 0;
}
virtual ArchiveTextFile* openTextFile(const char* name)
{
PakFileSystem::iterator i = m_filesystem.find(name);
if(i != m_filesystem.end() && !i->second.is_directory())
{
PakRecord* file = i->second.file();
return StoredArchiveTextFile::create(name, m_name.c_str(), file->m_position, file->m_stream_size);
}
return 0;
}
bool containsFile(const char* name)
{
PakFileSystem::iterator i = m_filesystem.find(name);
return i != m_filesystem.end() && !i->second.is_directory();
}
void forEachFile(VisitorFunc visitor, const char* root)
{
m_filesystem.traverse(visitor, root);
}
PakFileSystem::entry_type& file = m_filesystem[entry.filename];
if ( !file.is_directory() ) {
globalOutputStream() << "Warning: pak archive " << makeQuoted( m_name.c_str() ) << " contains duplicated file: " << makeQuoted( entry.filename ) << "\n";
}
else
{
file = new PakRecord( entry.offset, entry.size );
}
}
}
}
}
~PakArchive(){
for ( PakFileSystem::iterator i = m_filesystem.begin(); i != m_filesystem.end(); ++i )
delete i->second.file();
}
void release(){
delete this;
}
ArchiveFile* openFile( const char* name ){
PakFileSystem::iterator i = m_filesystem.find( name );
if ( i != m_filesystem.end() && !i->second.is_directory() ) {
PakRecord* file = i->second.file();
return StoredArchiveFile::create( name, m_name.c_str(), file->m_position, file->m_stream_size, file->m_stream_size );
}
return 0;
}
virtual ArchiveTextFile* openTextFile( const char* name ){
PakFileSystem::iterator i = m_filesystem.find( name );
if ( i != m_filesystem.end() && !i->second.is_directory() ) {
PakRecord* file = i->second.file();
return StoredArchiveTextFile::create( name, m_name.c_str(), file->m_position, file->m_stream_size );
}
return 0;
}
bool containsFile( const char* name ){
PakFileSystem::iterator i = m_filesystem.find( name );
return i != m_filesystem.end() && !i->second.is_directory();
}
void forEachFile( VisitorFunc visitor, const char* root ){
m_filesystem.traverse( visitor, root );
}
};
Archive* OpenArchive(const char* name)
{
return new PakArchive(name);
Archive* OpenArchive( const char* name ){
return new PakArchive( name );
}
#if 0
@@ -160,18 +146,16 @@ Archive* OpenArchive(const char* name)
class TestArchive
{
public:
TestArchive()
{
Archive* archive = OpenArchive("c:/quake3/baseq3/pak0.pak");
ArchiveFile* file = archive->openFile("gfx/palette.lmp");
if(file != 0)
{
char buffer[1024];
file->getInputStream().read((InputStream::byte_type*)buffer, 1024);
file->release();
}
archive->release();
}
TestArchive(){
Archive* archive = OpenArchive( "c:/quake3/baseq3/pak0.pak" );
ArchiveFile* file = archive->openFile( "gfx/palette.lmp" );
if ( file != 0 ) {
char buffer[1024];
file->getInputStream().read( (InputStream::byte_type*)buffer, 1024 );
file->release();
}
archive->release();
}
};
TestArchive g_test;
@@ -182,46 +166,43 @@ TestArchive g_test;
class TestArchive
{
class TestVisitor : public Archive::IVisitor
{
public:
void visit(const char* name)
{
int bleh = 0;
}
};
class TestVisitor : public Archive::IVisitor
{
public:
TestArchive()
{
{
Archive* archive = OpenArchive("");
archive->release();
}
{
Archive* archive = OpenArchive("NONEXISTANTFILE");
archive->release();
}
{
Archive* archive = OpenArchive("c:/quake/id1/pak0.pak");
ArchiveFile* file = archive->openFile("gfx/palette.lmp");
if(file != 0)
{
char buffer[1024];
file->getInputStream().read((InputStream::byte_type*)buffer, 1024);
file->release();
}
TestVisitor visitor;
archive->forEachFile(Archive::VisitorFunc(&visitor, Archive::eFilesAndDirectories, 0), "");
archive->forEachFile(Archive::VisitorFunc(&visitor, Archive::eFiles, 0), "progs/");
archive->forEachFile(Archive::VisitorFunc(&visitor, Archive::eFiles, 0), "maps/");
archive->forEachFile(Archive::VisitorFunc(&visitor, Archive::eFiles, 1), "sound/ambience/");
archive->forEachFile(Archive::VisitorFunc(&visitor, Archive::eFilesAndDirectories, 1), "sound/");
archive->forEachFile(Archive::VisitorFunc(&visitor, Archive::eDirectories, 1), "sound/");
archive->forEachFile(Archive::VisitorFunc(&visitor, Archive::eFilesAndDirectories, 2), "sound/");
archive->forEachFile(Archive::VisitorFunc(&visitor, Archive::eFilesAndDirectories, 2), "");
archive->release();
}
}
void visit( const char* name ){
int bleh = 0;
}
};
public:
TestArchive(){
{
Archive* archive = OpenArchive( "" );
archive->release();
}
{
Archive* archive = OpenArchive( "NONEXISTANTFILE" );
archive->release();
}
{
Archive* archive = OpenArchive( "c:/quake/id1/pak0.pak" );
ArchiveFile* file = archive->openFile( "gfx/palette.lmp" );
if ( file != 0 ) {
char buffer[1024];
file->getInputStream().read( (InputStream::byte_type*)buffer, 1024 );
file->release();
}
TestVisitor visitor;
archive->forEachFile( Archive::VisitorFunc( &visitor, Archive::eFilesAndDirectories, 0 ), "" );
archive->forEachFile( Archive::VisitorFunc( &visitor, Archive::eFiles, 0 ), "progs/" );
archive->forEachFile( Archive::VisitorFunc( &visitor, Archive::eFiles, 0 ), "maps/" );
archive->forEachFile( Archive::VisitorFunc( &visitor, Archive::eFiles, 1 ), "sound/ambience/" );
archive->forEachFile( Archive::VisitorFunc( &visitor, Archive::eFilesAndDirectories, 1 ), "sound/" );
archive->forEachFile( Archive::VisitorFunc( &visitor, Archive::eDirectories, 1 ), "sound/" );
archive->forEachFile( Archive::VisitorFunc( &visitor, Archive::eFilesAndDirectories, 2 ), "sound/" );
archive->forEachFile( Archive::VisitorFunc( &visitor, Archive::eFilesAndDirectories, 2 ), "" );
archive->release();
}
}
};
TestArchive g_test;

View File

@@ -1,23 +1,23 @@
/*
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
This file is part of GtkRadiant.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Archive;
Archive* OpenArchive(const char* name);
Archive* OpenArchive( const char* name );

View File

@@ -1,23 +1,22 @@
/*
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
This file is part of GtkRadiant.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "pak.h"

View File

@@ -1,40 +1,39 @@
/*
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
This file is part of GtkRadiant.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if !defined(INCLUDED_PAK_H)
#if !defined( INCLUDED_PAK_H )
#define INCLUDED_PAK_H
struct pakheader_t
{
char magic[4]; // Name of the new WAD format ("PACK")
unsigned int diroffset;// Position of WAD directory from start of file
unsigned int dirsize; // Number of entries * 0x40 (64 char)
char magic[4]; // Name of the new WAD format ("PACK")
unsigned int diroffset; // Position of WAD directory from start of file
unsigned int dirsize; // Number of entries * 0x40 (64 char)
};
struct pakentry_t
{
char filename[0x38]; // Name of the file, Unix style, with extension, 50 chars, padded with '\0'.
unsigned int offset; // Position of the entry in PACK file
unsigned int size; // Size of the entry in PACK file
char filename[0x38]; // Name of the file, Unix style, with extension, 50 chars, padded with '\0'.
unsigned int offset; // Position of the entry in PACK file
unsigned int size; // Size of the entry in PACK file
};
#endif

View File

@@ -1,23 +1,23 @@
/*
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
This file is part of GtkRadiant.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "plugin.h"
@@ -30,19 +30,17 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
class ArchivePakAPI
{
_QERArchiveTable m_archivepak;
_QERArchiveTable m_archivepak;
public:
typedef _QERArchiveTable Type;
STRING_CONSTANT(Name, "pak");
typedef _QERArchiveTable Type;
STRING_CONSTANT( Name, "pak" );
ArchivePakAPI()
{
m_archivepak.m_pfnOpenArchive = &OpenArchive;
}
_QERArchiveTable* getTable()
{
return &m_archivepak;
}
ArchivePakAPI(){
m_archivepak.m_pfnOpenArchive = &OpenArchive;
}
_QERArchiveTable* getTable(){
return &m_archivepak;
}
};
typedef SingletonModule<ArchivePakAPI> ArchivePakModule;
@@ -50,9 +48,8 @@ typedef SingletonModule<ArchivePakAPI> ArchivePakModule;
ArchivePakModule g_ArchivePakModule;
extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer& server)
{
initialiseModule(server);
extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules( ModuleServer& server ){
initialiseModule( server );
g_ArchivePakModule.selfRegister();
g_ArchivePakModule.selfRegister();
}

View File

@@ -1,25 +1,25 @@
/*
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
This file is part of GtkRadiant.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if !defined(INCLUDED_PLUGIN_H)
#if !defined( INCLUDED_PLUGIN_H )
#define INCLUDED_PLUGIN_H
#endif