From d230302b16474ff22a35243ffed6236ef4fc7fb9 Mon Sep 17 00:00:00 2001 From: Paradox Date: Mon, 9 Feb 2009 08:16:34 -0500 Subject: [PATCH] Replace tabs with spaces in more files. --HG-- branch : trunk --- contrib/extractor/System.cpp | 14 +- contrib/extractor/adt.cpp | 2 +- contrib/extractor/libmpq/common.cpp | 1134 +-- contrib/extractor/libmpq/common.h | 42 +- contrib/extractor/libmpq/explode.cpp | 604 +- contrib/extractor/libmpq/explode.h | 90 +- contrib/extractor/libmpq/extract.cpp | 284 +- contrib/extractor/libmpq/huffman.cpp | 1336 ++-- contrib/extractor/libmpq/huffman.h | 72 +- contrib/extractor/libmpq/mpq.cpp | 844 +-- contrib/extractor/libmpq/mpq.h | 212 +- contrib/extractor/libmpq/parser.cpp | 376 +- contrib/extractor/libmpq/wave.cpp | 274 +- contrib/extractor/libmpq/wave.h | 8 +- contrib/vmap_debugger/G3D/AABSPTree.h | 368 +- contrib/vmap_debugger/ModelContainerView.cpp | 6 +- contrib/vmap_debugger/ModelContainerView.h | 82 +- .../vmap_extractor_v2/stormlib/GfxDecode.cpp | 136 +- .../vmap_extractor_v2/stormlib/SCommon.cpp | 30 +- .../stormlib/SCompression.cpp | 36 +- .../stormlib/SFileCompactArchive.cpp | 8 +- .../stormlib/SFileCreateArchiveEx.cpp | 14 +- .../stormlib/SFileFindFile.cpp | 8 +- .../stormlib/SFileOpenArchive.cpp | 14 +- .../stormlib/SFileOpenFileEx.cpp | 16 +- .../stormlib/SFileReadFile.cpp | 28 +- .../vmap_extractor_v2/stormlib/SListFile.cpp | 16 +- contrib/vmap_extractor_v2/stormlib/StormLib.h | 46 +- .../vmap_extractor_v2/stormlib/StormPort.h | 48 +- .../stormlib/StormPortLinux.cpp | 10 +- .../stormlib/StormPortMac.cpp | 128 +- .../stormlib/bzip2/blocksort.c | 146 +- .../vmap_extractor_v2/stormlib/bzip2/bzip2.c | 306 +- .../stormlib/bzip2/bzip2recover.c | 56 +- .../vmap_extractor_v2/stormlib/bzip2/bzlib.c | 234 +- .../vmap_extractor_v2/stormlib/bzip2/bzlib.h | 172 +- .../stormlib/bzip2/bzlib_private.h | 32 +- .../stormlib/bzip2/compress.c | 102 +- .../stormlib/bzip2/crctable.c | 10 +- .../stormlib/bzip2/decompress.c | 56 +- .../stormlib/bzip2/dlltest.c | 2 +- .../stormlib/bzip2/huffman.c | 18 +- .../stormlib/bzip2/randtable.c | 114 +- .../vmap_extractor_v2/stormlib/bzip2/spewG.c | 2 +- .../stormlib/bzip2/unzcrash.c | 10 +- .../stormlib/huffman/huff.cpp | 444 +- .../vmap_extractor_v2/stormlib/huffman/huff.h | 52 +- .../stormlib/pklib/explode.c | 20 +- .../stormlib/pklib/implode.c | 18 +- .../vmap_extractor_v2/stormlib/pklib/pklib.h | 30 +- .../vmap_extractor_v2/stormlib/wave/wave.cpp | 14 +- .../vmap_extractor_v2/stormlib/zlib/adler32.c | 6 +- .../stormlib/zlib/compress.c | 2 +- .../stormlib/zlib/contrib/asm386/gvmat32c.c | 10 +- .../zlib/contrib/iostream/zfstream.cpp | 12 +- .../stormlib/zlib/contrib/iostream/zfstream.h | 4 +- .../zlib/contrib/iostream2/zstream_test.cpp | 6 +- .../stormlib/zlib/contrib/minizip/miniunz.c | 530 +- .../stormlib/zlib/contrib/minizip/minizip.c | 116 +- .../stormlib/zlib/contrib/minizip/unzip.c | 1416 ++-- .../stormlib/zlib/contrib/minizip/unzip.h | 102 +- .../stormlib/zlib/contrib/minizip/zip.c | 38 +- .../stormlib/zlib/contrib/minizip/zip.h | 58 +- .../stormlib/zlib/contrib/untgz/untgz.c | 468 +- .../vmap_extractor_v2/stormlib/zlib/crc32.c | 4 +- .../vmap_extractor_v2/stormlib/zlib/deflate.c | 206 +- .../vmap_extractor_v2/stormlib/zlib/deflate.h | 6 +- .../vmap_extractor_v2/stormlib/zlib/example.c | 80 +- .../vmap_extractor_v2/stormlib/zlib/gzio.c | 302 +- .../stormlib/zlib/infblock.c | 4 +- .../stormlib/zlib/infblock.h | 2 +- .../stormlib/zlib/infcodes.c | 2 +- .../stormlib/zlib/infcodes.h | 2 +- .../vmap_extractor_v2/stormlib/zlib/inffast.c | 2 +- .../vmap_extractor_v2/stormlib/zlib/inffast.h | 2 +- .../vmap_extractor_v2/stormlib/zlib/inflate.c | 4 +- .../stormlib/zlib/inftrees.c | 2 +- .../stormlib/zlib/inftrees.h | 2 +- .../vmap_extractor_v2/stormlib/zlib/infutil.c | 2 +- .../vmap_extractor_v2/stormlib/zlib/infutil.h | 4 +- .../stormlib/zlib/maketree.c | 2 +- .../stormlib/zlib/minigzip.c | 20 +- .../vmap_extractor_v2/stormlib/zlib/trees.c | 78 +- .../vmap_extractor_v2/stormlib/zlib/uncompr.c | 2 +- .../vmap_extractor_v2/stormlib/zlib/zconf.h | 58 +- .../vmap_extractor_v2/stormlib/zlib/zlib.h | 30 +- .../vmap_extractor_v2/stormlib/zlib/zutil.c | 2 +- .../vmap_extractor_v2/stormlib/zlib/zutil.h | 2 +- .../vmap_extractor_v2/stormlibdll/DllMain.c | 2 +- .../vmap_extractor_v2/vmapextract/adtfile.cpp | 300 +- .../vmap_extractor_v2/vmapextract/adtfile.h | 106 +- .../vmap_extractor_v2/vmapextract/dbcfile.cpp | 78 +- .../vmap_extractor_v2/vmapextract/dbcfile.h | 228 +- .../vmap_extractor_v2/vmapextract/model.cpp | 24 +- contrib/vmap_extractor_v2/vmapextract/model.h | 96 +- .../vmapextract/modelheaders.h | 404 +- contrib/vmap_extractor_v2/vmapextract/mpq.cpp | 136 +- contrib/vmap_extractor_v2/vmapextract/mpq.h | 64 +- contrib/vmap_extractor_v2/vmapextract/vec3d.h | 306 +- .../vmapextract/vmapexport.cpp | 48 +- .../vmap_extractor_v2/vmapextract/wdtfile.cpp | 154 +- .../vmap_extractor_v2/vmapextract/wdtfile.h | 24 +- contrib/vmap_extractor_v2/vmapextract/wmo.cpp | 858 +-- dep/ACE_wrappers/ace/Array_Map.h | 2 +- dep/ACE_wrappers/ace/CDR_Base.h | 2 +- dep/ACE_wrappers/ace/CDR_Size.cpp | 12 +- dep/ACE_wrappers/ace/CDR_Stream.cpp | 4 +- dep/ACE_wrappers/ace/Codecs.cpp | 2 +- .../ace/Hash_Map_With_Allocator_T.h | 2 +- .../ace/Hash_Multi_Map_Manager_T.h | 2 +- dep/ACE_wrappers/ace/MEM_IO.cpp | 16 +- dep/ACE_wrappers/ace/MMAP_Memory_Pool.cpp | 4 +- dep/ACE_wrappers/ace/Message_Queue_T.cpp | 6 +- .../ace/Monitor_Point_Registry.cpp | 4 +- dep/ACE_wrappers/ace/OS_NS_stdio.h | 2 +- dep/ACE_wrappers/ace/OS_NS_unistd.cpp | 2 +- dep/ACE_wrappers/ace/Priority_Reactor.cpp | 2 +- dep/ACE_wrappers/ace/Priority_Reactor.h | 2 +- dep/ACE_wrappers/ace/Process.h | 2 +- dep/ACE_wrappers/ace/Process_Manager.cpp | 2 +- dep/ACE_wrappers/ace/RB_Tree.cpp | 2 +- dep/ACE_wrappers/ace/Service_Manager.cpp | 26 +- dep/ACE_wrappers/ace/Stack_Trace.cpp | 8 +- dep/ACE_wrappers/ace/Stack_Trace.h | 22 +- dep/ACE_wrappers/ace/String_Base.h | 4 +- dep/ACE_wrappers/ace/Task_T.h | 2 +- dep/ACE_wrappers/ace/UPIPE_Stream.cpp | 2 +- dep/ACE_wrappers/ace/UUID.cpp | 2 +- dep/ACE_wrappers/ace/UUID.h | 2 +- dep/ACE_wrappers/ace/Unbounded_Set.h | 8 +- dep/ACE_wrappers/ace/Unbounded_Set_Ex.h | 6 +- dep/ACE_wrappers/ace/Vector_T.cpp | 2 +- dep/ACE_wrappers/ace/config-macosx-leopard.h | 2 +- dep/ACE_wrappers/ace/config-qnx-rtp.h | 4 +- dep/include/g3dlite/G3D/AABox.h | 66 +- dep/include/g3dlite/G3D/Array.h | 116 +- dep/include/g3dlite/G3D/Box.h | 46 +- dep/include/g3dlite/G3D/CollisionDetection.h | 1300 ++-- dep/include/g3dlite/G3D/CoordinateFrame.h | 78 +- dep/include/g3dlite/G3D/Crypto.h | 6 +- dep/include/g3dlite/G3D/GCamera.h | 106 +- dep/include/g3dlite/G3D/Line.h | 6 +- dep/include/g3dlite/G3D/Matrix3.h | 54 +- dep/include/g3dlite/G3D/Plane.h | 16 +- dep/include/g3dlite/G3D/Quat.h | 66 +- dep/include/g3dlite/G3D/Ray.h | 44 +- dep/include/g3dlite/G3D/RegistryUtil.h | 10 +- dep/include/g3dlite/G3D/Sphere.h | 38 +- dep/include/g3dlite/G3D/System.h | 26 +- dep/include/g3dlite/G3D/Table.h | 40 +- dep/include/g3dlite/G3D/Triangle.h | 12 +- dep/include/g3dlite/G3D/Vector2.h | 16 +- dep/include/g3dlite/G3D/Vector2int16.h | 2 +- dep/include/g3dlite/G3D/Vector3.h | 34 +- dep/include/g3dlite/G3D/Vector3int16.h | 2 +- dep/include/g3dlite/G3D/Vector4.h | 10 +- dep/include/g3dlite/G3D/format.h | 4 +- dep/include/g3dlite/G3D/g3dmath.h | 62 +- dep/include/g3dlite/G3D/platform.h | 64 +- dep/include/g3dlite/G3D/stringutils.h | 4 +- dep/include/mersennetwister/MersenneTwister.h | 400 +- dep/include/mysql/config-netware.h | 2 +- dep/include/mysql/config-os2.h | 118 +- dep/include/mysql/config-win.h | 236 +- dep/include/mysql/errmsg.h | 66 +- dep/include/mysql/mysql.h | 372 +- dep/include/mysql/raid.h | 36 +- dep/include/mysql/typelib.h | 6 +- dep/include/openssl/aes.h | 58 +- dep/include/openssl/asn1.h | 1240 ++-- dep/include/openssl/asn1_mac.h | 658 +- dep/include/openssl/asn1t.h | 648 +- dep/include/openssl/bio.h | 708 +- dep/include/openssl/blowfish.h | 40 +- dep/include/openssl/bn.h | 778 +-- dep/include/openssl/buffer.h | 46 +- dep/include/openssl/cast.h | 44 +- dep/include/openssl/comp.h | 50 +- dep/include/openssl/conf.h | 152 +- dep/include/openssl/conf_api.h | 16 +- dep/include/openssl/crypto.h | 332 +- dep/include/openssl/des.h | 168 +- dep/include/openssl/des_old.h | 246 +- dep/include/openssl/dh.h | 172 +- dep/include/openssl/dsa.h | 232 +- dep/include/openssl/dso.h | 288 +- dep/include/openssl/dtls1.h | 178 +- dep/include/openssl/e_os2.h | 20 +- dep/include/openssl/ec.h | 378 +- dep/include/openssl/ecdh.h | 24 +- dep/include/openssl/ecdsa.h | 90 +- dep/include/openssl/engine.h | 360 +- dep/include/openssl/err.h | 218 +- dep/include/openssl/evp.h | 876 +-- dep/include/openssl/hmac.h | 40 +- dep/include/openssl/idea.h | 36 +- dep/include/openssl/krb5_asn.h | 220 +- dep/include/openssl/kssl.h | 100 +- dep/include/openssl/lhash.h | 114 +- dep/include/openssl/md2.h | 28 +- dep/include/openssl/md4.h | 32 +- dep/include/openssl/md5.h | 32 +- dep/include/openssl/mdc2.h | 14 +- dep/include/openssl/obj_mac.h | 6152 ++++++++--------- dep/include/openssl/objects.h | 1444 ++-- dep/include/openssl/ocsp.h | 376 +- dep/include/openssl/opensslconf.h | 20 +- dep/include/openssl/opensslv.h | 34 +- dep/include/openssl/ossl_typ.h | 44 +- dep/include/openssl/pem.h | 692 +- dep/include/openssl/pem2.h | 2 +- dep/include/openssl/pkcs12.h | 214 +- dep/include/openssl/pkcs7.h | 438 +- dep/include/openssl/pq_compat.h | 10 +- dep/include/openssl/pqueue.h | 16 +- dep/include/openssl/rand.h | 34 +- dep/include/openssl/rc2.h | 40 +- dep/include/openssl/rc4.h | 24 +- dep/include/openssl/rc5.h | 40 +- dep/include/openssl/ripemd.h | 32 +- dep/include/openssl/rsa.h | 434 +- dep/include/openssl/safestack.h | 318 +- dep/include/openssl/sha.h | 82 +- dep/include/openssl/ssl.h | 2256 +++--- dep/include/openssl/ssl2.h | 328 +- dep/include/openssl/ssl23.h | 28 +- dep/include/openssl/ssl3.h | 646 +- dep/include/openssl/stack.h | 34 +- dep/include/openssl/store.h | 470 +- dep/include/openssl/symhacks.h | 124 +- dep/include/openssl/tls1.h | 226 +- dep/include/openssl/tmdiff.h | 14 +- dep/include/openssl/txt_db.h | 46 +- dep/include/openssl/ui.h | 156 +- dep/include/openssl/ui_compat.h | 6 +- dep/include/openssl/x509.h | 1226 ++-- dep/include/openssl/x509_vfy.h | 484 +- dep/include/openssl/x509v3.h | 656 +- dep/include/postgre/libpq-fe.h | 432 +- dep/include/postgre/pg_type.h | 80 +- dep/include/postgre/postgres_ext.h | 40 +- dep/include/sockets/Base64.h | 34 +- dep/include/sockets/Exception.h | 18 +- dep/include/sockets/File.h | 48 +- dep/include/sockets/IFile.h | 32 +- dep/include/sockets/ISocketHandler.h | 268 +- dep/include/sockets/Ipv4Address.h | 88 +- dep/include/sockets/Ipv6Address.h | 88 +- dep/include/sockets/ListenSocket.h | 584 +- dep/include/sockets/Lock.h | 16 +- dep/include/sockets/Mutex.h | 24 +- dep/include/sockets/Parse.h | 78 +- dep/include/sockets/ResolvServer.h | 30 +- dep/include/sockets/ResolvSocket.h | 76 +- dep/include/sockets/SctpSocket.h | 86 +- dep/include/sockets/Socket.h | 992 +-- dep/include/sockets/SocketAddress.h | 58 +- dep/include/sockets/SocketHandler.h | 300 +- dep/include/sockets/StdLog.h | 30 +- dep/include/sockets/StdoutLog.h | 12 +- dep/include/sockets/StreamSocket.h | 148 +- dep/include/sockets/TcpSocket.h | 474 +- dep/include/sockets/Thread.h | 54 +- dep/include/sockets/UdpSocket.h | 254 +- dep/include/sockets/Utility.h | 190 +- dep/include/sockets/socket_include.h | 60 +- dep/include/sockets/sockets-config.h | 10 +- dep/include/sqlite/sqlite.h | 44 +- dep/include/utf8cpp/utf8/checked.h | 40 +- dep/include/utf8cpp/utf8/core.h | 34 +- dep/include/utf8cpp/utf8/unchecked.h | 32 +- dep/include/zthread/AtomicCount.h | 20 +- dep/include/zthread/Barrier.h | 102 +- dep/include/zthread/BiasedReadWriteLock.h | 110 +- dep/include/zthread/BlockingQueue.h | 34 +- dep/include/zthread/BoundedQueue.h | 124 +- dep/include/zthread/Cancelable.h | 22 +- dep/include/zthread/ClassLockable.h | 20 +- dep/include/zthread/ConcurrentExecutor.h | 46 +- dep/include/zthread/Condition.h | 60 +- dep/include/zthread/Config.h | 36 +- dep/include/zthread/CountedPtr.h | 40 +- dep/include/zthread/CountingSemaphore.h | 56 +- dep/include/zthread/Exceptions.h | 58 +- dep/include/zthread/Executor.h | 26 +- dep/include/zthread/FairReadWriteLock.h | 24 +- dep/include/zthread/FastMutex.h | 42 +- dep/include/zthread/FastRecursiveMutex.h | 28 +- dep/include/zthread/Guard.h | 96 +- dep/include/zthread/GuardedClass.h | 18 +- dep/include/zthread/Lockable.h | 44 +- dep/include/zthread/LockedQueue.h | 32 +- dep/include/zthread/MonitoredQueue.h | 86 +- dep/include/zthread/Mutex.h | 28 +- dep/include/zthread/PoolExecutor.h | 52 +- dep/include/zthread/PriorityCondition.h | 12 +- .../zthread/PriorityInheritanceMutex.h | 34 +- dep/include/zthread/PriorityMutex.h | 26 +- dep/include/zthread/PrioritySemaphore.h | 24 +- dep/include/zthread/Queue.h | 30 +- dep/include/zthread/ReadWriteLock.h | 16 +- dep/include/zthread/RecursiveMutex.h | 40 +- dep/include/zthread/Runnable.h | 4 +- dep/include/zthread/Semaphore.h | 64 +- dep/include/zthread/Singleton.h | 68 +- dep/include/zthread/SynchronousExecutor.h | 20 +- dep/include/zthread/Task.h | 36 +- dep/include/zthread/Thread.h | 60 +- dep/include/zthread/ThreadLocal.h | 114 +- dep/include/zthread/ThreadLocalImpl.h | 16 +- dep/include/zthread/ThreadedExecutor.h | 32 +- dep/include/zthread/Waitable.h | 26 +- dep/src/g3dlite/AABox.cpp | 140 +- dep/src/g3dlite/Crypto.cpp | 188 +- dep/src/g3dlite/Matrix3.cpp | 24 +- dep/src/g3dlite/Plane.cpp | 10 +- dep/src/g3dlite/System.cpp | 48 +- dep/src/g3dlite/Triangle.cpp | 10 +- dep/src/g3dlite/Vector3.cpp | 26 +- dep/src/g3dlite/Vector4.cpp | 10 +- dep/src/g3dlite/format.cpp | 10 +- dep/src/sockets/Base64.cpp | 376 +- dep/src/sockets/Exception.cpp | 8 +- dep/src/sockets/Ipv4Address.cpp | 154 +- dep/src/sockets/Ipv6Address.cpp | 226 +- dep/src/sockets/Lock.cpp | 10 +- dep/src/sockets/Mutex.cpp | 24 +- dep/src/sockets/Parse.cpp | 306 +- dep/src/sockets/ResolvServer.cpp | 38 +- dep/src/sockets/ResolvSocket.cpp | 526 +- dep/src/sockets/Socket.cpp | 1458 ++-- dep/src/sockets/SocketHandler.cpp | 2022 +++--- dep/src/sockets/StdoutLog.cpp | 86 +- dep/src/sockets/StreamSocket.cpp | 70 +- dep/src/sockets/TcpSocket.cpp | 2292 +++--- dep/src/sockets/Thread.cpp | 96 +- dep/src/sockets/UdpSocket.cpp | 958 +-- dep/src/sockets/Utility.cpp | 1332 ++-- dep/src/sockets/socket_include.cpp | 110 +- dep/src/zthread/ConditionImpl.h | 116 +- dep/src/zthread/Debug.h | 2 +- dep/src/zthread/DeferredInterruptionScope.h | 8 +- dep/src/zthread/FastRecursiveLock.h | 6 +- dep/src/zthread/IntrusivePtr.h | 14 +- dep/src/zthread/Monitor.h | 2 +- dep/src/zthread/MutexImpl.h | 148 +- dep/src/zthread/RecursiveMutexImpl.h | 26 +- dep/src/zthread/Scheduling.h | 10 +- dep/src/zthread/SemaphoreImpl.h | 122 +- dep/src/zthread/State.h | 4 +- dep/src/zthread/Status.h | 56 +- dep/src/zthread/ThreadImpl.h | 20 +- dep/src/zthread/ThreadOps.h | 6 +- dep/src/zthread/ThreadQueue.h | 26 +- dep/src/zthread/TimeStrategy.h | 2 +- dep/src/zthread/config.h | 10 +- dep/src/zthread/linux/AtomicFastLock.h | 26 +- dep/src/zthread/linux/FastRecursiveLock.h | 26 +- dep/src/zthread/macos/FastLock.h | 40 +- dep/src/zthread/macos/Monitor.h | 28 +- dep/src/zthread/macos/TSS.h | 26 +- dep/src/zthread/macos/ThreadOps.h | 22 +- dep/src/zthread/macos/UpTimeStrategy.h | 6 +- .../zthread/posix/ConditionRecursiveLock.h | 36 +- dep/src/zthread/posix/FastLock.h | 26 +- dep/src/zthread/posix/FtimeStrategy.h | 4 +- dep/src/zthread/posix/Monitor.h | 18 +- dep/src/zthread/posix/PriorityOps.h | 6 +- dep/src/zthread/posix/TSS.h | 24 +- dep/src/zthread/posix/ThreadOps.h | 24 +- dep/src/zthread/solaris/FastRecursiveLock.h | 34 +- .../zthread/vanilla/DualMutexRecursiveLock.h | 62 +- dep/src/zthread/vanilla/SimpleRecursiveLock.h | 42 +- dep/src/zthread/win32/AtomicFastLock.h | 30 +- .../zthread/win32/AtomicFastRecursiveLock.h | 50 +- dep/src/zthread/win32/FastLock.h | 16 +- dep/src/zthread/win32/FastRecursiveLock.h | 12 +- dep/src/zthread/win32/Monitor.h | 24 +- .../win32/PerformanceCounterStrategy.h | 18 +- dep/src/zthread/win32/TSS.h | 18 +- dep/src/zthread/win32/ThreadOps.h | 20 +- dep/src/zthread/win9x/AtomicFastLock.h | 22 +- src/bindings/interface/ScriptMgr.cpp | 2 +- src/bindings/scripts/ScriptMgr.cpp | 106 +- src/bindings/scripts/include/sc_creature.cpp | 18 +- src/bindings/scripts/include/sc_instance.h | 2 +- .../areatrigger/areatrigger_scripts.cpp | 38 +- .../scripts/scripts/guard/guard_ai.cpp | 34 +- src/bindings/scripts/scripts/guard/guards.cpp | 2 +- .../scripts/scripts/item/item_scripts.cpp | 12 +- .../scripts/scripts/npc/npc_escortAI.cpp | 20 +- .../scripts/scripts/npc/npcs_special.cpp | 186 +- .../zone/ashenvale_forest/ashenvale.cpp | 230 +- .../auchenai_crypts/boss_exarch_maladaar.cpp | 34 +- .../boss_shirrak_the_dead_watcher.cpp | 8 +- .../mana_tombs/boss_nexusprince_shaffar.cpp | 6 +- .../sethekk_halls/boss_darkweaver_syth.cpp | 22 +- .../boss_ambassador_hellmaw.cpp | 14 +- .../instance_shadow_labyrinth.cpp | 128 +- .../scripts/scripts/zone/azshara/azshara.cpp | 40 +- .../scripts/zone/azshara/boss_azuregos.cpp | 4 +- .../zone/azuremyst_isle/azuremyst_isle.cpp | 444 +- .../scripts/zone/barrens/the_barrens.cpp | 196 +- .../zone/black_temple/boss_bloodboil.cpp | 38 +- .../zone/black_temple/boss_mother_shahraz.cpp | 24 +- .../black_temple/boss_reliquary_of_souls.cpp | 40 +- .../zone/black_temple/boss_shade_of_akama.cpp | 18 +- .../zone/black_temple/boss_supremus.cpp | 14 +- .../black_temple/boss_teron_gorefiend.cpp | 28 +- .../black_temple/boss_warlord_najentus.cpp | 16 +- .../zone/black_temple/illidari_council.cpp | 48 +- .../black_temple/instance_black_temple.cpp | 100 +- .../blackrock_depths/blackrock_depths.cpp | 1403 ++-- .../instance_blackrock_depths.cpp | 410 +- .../zone/blackwing_lair/boss_flamegor.cpp | 2 +- .../dark_portal/boss_aeonus.cpp | 50 +- .../dark_portal/boss_chrono_lord_deja.cpp | 44 +- .../dark_portal/boss_temporus.cpp | 24 +- .../dark_portal/dark_portal.cpp | 428 +- .../caverns_of_time/hyjal/boss_archimonde.cpp | 32 +- .../zone/caverns_of_time/hyjal/hyjal.cpp | 52 +- .../zone/caverns_of_time/hyjal/hyjalAI.cpp | 54 +- .../zone/caverns_of_time/hyjal/hyjalAI.h | 56 +- .../caverns_of_time/hyjal/instance_hyjal.cpp | 16 +- .../old_hillsbrad/boss_leutenant_drake.cpp | 12 +- .../old_hillsbrad/instance_old_hillsbrad.cpp | 102 +- .../old_hillsbrad/old_hillsbrad.cpp | 188 +- .../boss_fathomlord_karathress.cpp | 486 +- .../boss_hydross_the_unstable.cpp | 114 +- .../serpent_shrine/boss_lady_vashj.cpp | 308 +- .../boss_leotheras_the_blind.cpp | 852 +-- .../serpent_shrine/boss_lurker_below.cpp | 574 +- .../boss_morogrim_tidewalker.cpp | 104 +- .../instance_serpent_shrine.cpp | 210 +- .../steam_vault/instance_steam_vault.cpp | 134 +- .../zone/eversong_woods/eversong_woods.cpp | 294 +- .../scripts/zone/ghostlands/ghostlands.cpp | 220 +- .../scripts/zone/gruuls_lair/boss_gruul.cpp | 82 +- .../gruuls_lair/boss_high_king_maulgar.cpp | 54 +- .../boss_kelidan_the_breaker.cpp | 56 +- .../boss_vazruden_the_herald.cpp | 2 +- .../magtheridons_lair/boss_magtheridon.cpp | 12 +- .../magtheridons_lair/def_magtheridons_lair.h | 6 +- .../instance_magtheridons_lair.cpp | 8 +- .../hellfire_peninsula/hellfire_peninsula.cpp | 242 +- .../isle_of_queldanas/isle_of_queldanas.cpp | 72 +- .../scripts/zone/karazhan/boss_curator.cpp | 6 +- .../zone/karazhan/boss_maiden_of_virtue.cpp | 10 +- .../scripts/zone/karazhan/boss_midnight.cpp | 102 +- .../scripts/zone/karazhan/boss_moroes.cpp | 38 +- .../scripts/zone/karazhan/boss_nightbane.cpp | 164 +- .../zone/karazhan/boss_prince_malchezaar.cpp | 24 +- .../zone/karazhan/boss_shade_of_aran.cpp | 70 +- .../zone/karazhan/boss_terestian_illhoof.cpp | 26 +- .../scripts/zone/karazhan/bosses_opera.cpp | 170 +- .../scripts/zone/karazhan/def_karazhan.h | 4 +- .../zone/karazhan/instance_karazhan.cpp | 52 +- .../scripts/zone/karazhan/karazhan.cpp | 88 +- .../boss_felblood_kaelthas.cpp | 418 +- .../boss_priestess_delrissa.cpp | 152 +- .../boss_selin_fireheart.cpp | 70 +- .../zone/magisters_terrace/boss_vexallus.cpp | 32 +- .../magisters_terrace/def_magisters_terrace.h | 2 +- .../instance_magisters_terrace.cpp | 76 +- .../zone/molten_core/boss_baron_geddon.cpp | 8 +- .../zone/molten_core/boss_golemagg.cpp | 6 +- .../molten_core/boss_majordomo_executus.cpp | 14 +- .../zone/molten_core/boss_ragnaros.cpp | 12 +- .../zone/molten_core/instance_molten_core.cpp | 78 +- .../scripts/zone/moonglade/moonglade.cpp | 8 +- .../scripts/scripts/zone/mulgore/mulgore.cpp | 170 +- .../zone/naxxramas/boss_anubrekhan.cpp | 24 +- .../scripts/zone/naxxramas/boss_faerlina.cpp | 18 +- .../scripts/zone/naxxramas/boss_kelthuzad.cpp | 28 +- .../scripts/zone/naxxramas/boss_noth.cpp | 24 +- .../scripts/zone/naxxramas/boss_sapphiron.cpp | 16 +- .../scripts/zone/netherstorm/netherstorm.cpp | 588 +- .../scripts/zone/onyxias_lair/boss_onyxia.cpp | 264 +- .../zone/ruins_of_ahnqiraj/boss_moam.cpp | 4 +- .../boss_headless_horseman.cpp | 1284 ++-- .../zone/scarlet_monastery/boss_herod.cpp | 124 +- .../instance_scarlet_monastery.cpp | 132 +- .../instance_shadowfang_keep.cpp | 120 +- .../zone/shadowfang_keep/shadowfang_keep.cpp | 10 +- .../shadowmoon_valley/shadowmoon_valley.cpp | 30 +- .../scripts/zone/shattrath/shattrath_city.cpp | 370 +- .../scripts/zone/silithus/silithus.cpp | 96 +- .../silverpine_forest/silverpine_forest.cpp | 184 +- .../stonetalon_mountains.cpp | 148 +- .../stranglethorn_vale/stranglethorn_vale.cpp | 4 +- .../zone/stratholme/boss_baron_rivendare.cpp | 60 +- .../stratholme/boss_baroness_anastari.cpp | 30 +- .../stratholme/boss_magistrate_barthilas.cpp | 76 +- .../stratholme/boss_maleki_the_pallid.cpp | 22 +- .../zone/stratholme/boss_nerubenkan.cpp | 22 +- .../stratholme/boss_ramstein_the_gorger.cpp | 28 +- .../zone/stratholme/instance_stratholme.cpp | 606 +- .../scripts/zone/stratholme/stratholme.cpp | 14 +- .../zone/sunwell_plateau/boss_brutallus.cpp | 58 +- .../sunwell_plateau/boss_eredar_twins.cpp | 20 +- .../zone/sunwell_plateau/boss_kalecgos.cpp | 14 +- .../sunwell_plateau/def_sunwell_plateau.h | 2 +- .../instance_sunwell_plateau.cpp | 8 +- .../scripts/scripts/zone/tanaris/tanaris.cpp | 74 +- .../zone/tempest_keep/arcatraz/arcatraz.cpp | 18 +- .../arcatraz/boss_harbinger_skyriss.cpp | 34 +- .../arcatraz/instance_arcatraz.cpp | 28 +- .../botanica/boss_high_botanist_freywinn.cpp | 18 +- .../zone/tempest_keep/botanica/boss_laj.cpp | 2 +- .../botanica/boss_warp_splinter.cpp | 24 +- .../tempest_keep/the_eye/boss_astromancer.cpp | 32 +- .../tempest_keep/the_eye/boss_kaelthas.cpp | 232 +- .../tempest_keep/the_eye/boss_void_reaver.cpp | 18 +- .../zone/tempest_keep/the_eye/def_the_eye.h | 2 +- .../tempest_keep/the_eye/instance_the_eye.cpp | 50 +- .../boss_gatewatcher_ironhand.cpp | 48 +- .../boss_nethermancer_sepethrea.cpp | 50 +- .../boss_pathaleon_the_calculator.cpp | 68 +- .../zone/temple_of_ahnqiraj/boss_cthun.cpp | 2 +- .../zone/temple_of_ahnqiraj/boss_sartura.cpp | 18 +- .../zone/temple_of_ahnqiraj/boss_skeram.cpp | 36 +- .../zone/terokkar_forest/terokkar_forest.cpp | 214 +- .../thousand_needles/thousand_needles.cpp | 4 +- .../zone/tirisfal_glades/tirisfal_glades.cpp | 6 +- .../scripts/zone/uldaman/instance_uldaman.cpp | 6 +- .../zone/ungoro_crater/ungoro_crater.cpp | 6 +- .../scripts/zone/zangarmarsh/zangarmarsh.cpp | 192 +- .../scripts/zone/zulaman/boss_akilzon.cpp | 128 +- .../scripts/zone/zulaman/boss_halazzi.cpp | 30 +- .../scripts/zone/zulaman/boss_janalai.cpp | 16 +- .../scripts/zone/zulaman/instance_zulaman.cpp | 10 +- .../scripts/zone/zulgurub/boss_arlokk.cpp | 24 +- .../scripts/zone/zulgurub/boss_hakkar.cpp | 22 +- .../scripts/zone/zulgurub/boss_jeklik.cpp | 20 +- .../scripts/zone/zulgurub/boss_jindo.cpp | 10 +- .../scripts/zone/zulgurub/boss_mandokir.cpp | 50 +- .../scripts/zone/zulgurub/boss_marli.cpp | 28 +- .../scripts/zone/zulgurub/boss_thekal.cpp | 6 +- .../scripts/zone/zulgurub/boss_venoxis.cpp | 24 +- src/game/BattleGround.h | 2 +- src/game/BattleGroundAV.cpp | 72 +- src/game/CharacterHandler.cpp | 6 +- src/game/Chat.cpp | 66 +- src/game/Chat.h | 52 +- src/game/ConfusedMovementGenerator.h | 6 +- src/game/Creature.cpp | 62 +- src/game/Creature.h | 32 +- src/game/CreatureGroups.cpp | 230 +- src/game/CreatureGroups.h | 40 +- src/game/FleeingMovementGenerator.cpp | 2 +- src/game/FleeingMovementGenerator.h | 2 +- src/game/GridNotifiers.h | 4 +- src/game/Group.cpp | 70 +- src/game/Group.h | 52 +- src/game/Guild.cpp | 4 +- src/game/HomeMovementGenerator.cpp | 8 +- src/game/HomeMovementGenerator.h | 2 +- src/game/Language.h | 42 +- src/game/Level0.cpp | 52 +- src/game/Level1.cpp | 440 +- src/game/Level2.cpp | 1152 +-- src/game/Level3.cpp | 6 +- src/game/Map.cpp | 32 +- src/game/MiscHandler.cpp | 6 +- src/game/MotionMaster.cpp | 22 +- src/game/MotionMaster.h | 4 +- src/game/Object.cpp | 8 +- src/game/ObjectMgr.cpp | 20 +- src/game/ObjectMgr.h | 14 +- src/game/Opcodes.cpp | 4 +- src/game/Player.cpp | 14 +- src/game/PlayerDump.h | 10 +- src/game/RandomMovementGenerator.cpp | 4 +- src/game/RandomMovementGenerator.h | 10 +- src/game/ScriptCalls.cpp | 4 +- src/game/ScriptCalls.h | 2 +- src/game/SharedDefines.h | 12 +- src/game/Spell.cpp | 4 +- src/game/SpellAuras.cpp | 16 +- src/game/SpellEffects.cpp | 16 +- src/game/SpellHandler.cpp | 34 +- src/game/SpellMgr.cpp | 34 +- src/game/TicketHandler.cpp | 182 +- src/game/TicketMgr.cpp | 230 +- src/game/TicketMgr.h | 56 +- src/game/Transports.cpp | 56 +- src/game/Transports.h | 4 +- src/game/Traveller.h | 8 +- src/game/Unit.cpp | 138 +- src/game/Unit.h | 2 +- src/game/WaypointManager.cpp | 58 +- src/game/WaypointManager.h | 16 +- src/game/WaypointMovementGenerator.cpp | 150 +- src/game/WaypointMovementGenerator.h | 28 +- src/game/World.cpp | 208 +- src/game/World.h | 12 +- src/game/WorldSession.h | 18 +- src/shared/Common.h | 2 +- src/shared/WheatyExceptionReport.cpp | 6 +- src/shared/vmap/AABSPTree.h | 206 +- src/shared/vmap/ModelContainer.cpp | 2 +- src/trinitycore/Master.cpp | 2 +- 602 files changed, 41367 insertions(+), 41366 deletions(-) diff --git a/contrib/extractor/System.cpp b/contrib/extractor/System.cpp index 197c4d35416..bb238230f0a 100644 --- a/contrib/extractor/System.cpp +++ b/contrib/extractor/System.cpp @@ -256,7 +256,7 @@ void LoadLocaleMPQFiles(int const locale) new MPQArchive(filename); } } - + void LoadCommonMPQFiles() { char filename[512]; @@ -291,7 +291,7 @@ int main(int argc, char * arg[]) HandleArgs(argc, arg); int FirstLocale = -1; - + for (int i = 0; i < LANG_COUNT; i++) { char tmp1[512]; @@ -299,10 +299,10 @@ int main(int argc, char * arg[]) if (FileExists(tmp1)) { printf("Detected locale: %s\n", langs[i]); - + //Open MPQs LoadLocaleMPQFiles(i); - + if((extract & EXTRACT_DBC) == 0) { FirstLocale = i; @@ -328,15 +328,15 @@ int main(int argc, char * arg[]) printf("No locales detected\n"); return 0; } - + if (extract & EXTRACT_MAP) { printf("Using locale: %s\n", langs[FirstLocale]); - + // Open MPQs LoadLocaleMPQFiles(FirstLocale); LoadCommonMPQFiles(); - + // Extract maps ExtractMapsFromMpq(); diff --git a/contrib/extractor/adt.cpp b/contrib/extractor/adt.cpp index 26adaa28537..4c3b4c7d117 100644 --- a/contrib/extractor/adt.cpp +++ b/contrib/extractor/adt.cpp @@ -192,7 +192,7 @@ bool isHole(int holes, int i, int j) int testj = j/4; if(testi>3) testi = 3; if(testj>3) testj = 3; - return (holes & holetab_h[testi] & holetab_v[testj])!=0; + return (holes & holetab_h[testi] & holetab_v[testj])!=0; } inline diff --git a/contrib/extractor/libmpq/common.cpp b/contrib/extractor/libmpq/common.cpp index 7b902087540..7376a500870 100644 --- a/contrib/extractor/libmpq/common.cpp +++ b/contrib/extractor/libmpq/common.cpp @@ -34,19 +34,19 @@ * This function decrypts a MPQ block. */ int libmpq_decrypt_block(mpq_archive *mpq_a, unsigned int *block, unsigned int length, unsigned int seed1) { - unsigned int seed2 = 0xEEEEEEEE; - unsigned int ch; + unsigned int seed2 = 0xEEEEEEEE; + unsigned int ch; - /* Round to unsigned int's */ - length >>= 2; - while (length-- > 0) { - seed2 += mpq_a->buf[0x400 + (seed1 & 0xFF)]; - ch = *block ^ (seed1 + seed2); - seed1 = ((~seed1 << 0x15) + 0x11111111) | (seed1 >> 0x0B); - seed2 = ch + seed2 + (seed2 << 5) + 3; - *block++ = ch; - } - return LIBMPQ_TOOLS_SUCCESS; + /* Round to unsigned int's */ + length >>= 2; + while (length-- > 0) { + seed2 += mpq_a->buf[0x400 + (seed1 & 0xFF)]; + ch = *block ^ (seed1 + seed2); + seed1 = ((~seed1 << 0x15) + 0x11111111) | (seed1 >> 0x0B); + seed2 = ch + seed2 + (seed2 << 5) + 3; + *block++ = ch; + } + return LIBMPQ_TOOLS_SUCCESS; } /* @@ -54,164 +54,164 @@ int libmpq_decrypt_block(mpq_archive *mpq_a, unsigned int *block, unsigned int l * file informations. */ int libmpq_decrypt_hashtable(mpq_archive *mpq_a, unsigned char *pbKey) { - unsigned int seed1 = 0x7FED7FED; - unsigned int seed2 = 0xEEEEEEEE; - unsigned int ch; /* One key character */ - unsigned int *pdwTable = (unsigned int *)(mpq_a->hashtable); - unsigned int length = mpq_a->header->hashtablesize * 4; + unsigned int seed1 = 0x7FED7FED; + unsigned int seed2 = 0xEEEEEEEE; + unsigned int ch; /* One key character */ + unsigned int *pdwTable = (unsigned int *)(mpq_a->hashtable); + unsigned int length = mpq_a->header->hashtablesize * 4; - /* Prepare seeds */ - while (*pbKey != 0) { - ch = toupper(*pbKey++); - seed1 = mpq_a->buf[0x300 + ch] ^ (seed1 + seed2); - seed2 = ch + seed1 + seed2 + (seed2 << 5) + 3; - } + /* Prepare seeds */ + while (*pbKey != 0) { + ch = toupper(*pbKey++); + seed1 = mpq_a->buf[0x300 + ch] ^ (seed1 + seed2); + seed2 = ch + seed1 + seed2 + (seed2 << 5) + 3; + } - /* Decrypt it */ - seed2 = 0xEEEEEEEE; - while (length-- > 0) { - seed2 += mpq_a->buf[0x400 + (seed1 & 0xFF)]; - ch = *pdwTable ^ (seed1 + seed2); - seed1 = ((~seed1 << 0x15) + 0x11111111) | (seed1 >> 0x0B); - seed2 = ch + seed2 + (seed2 << 5) + 3; - *pdwTable++ = ch; - } - return LIBMPQ_TOOLS_SUCCESS; + /* Decrypt it */ + seed2 = 0xEEEEEEEE; + while (length-- > 0) { + seed2 += mpq_a->buf[0x400 + (seed1 & 0xFF)]; + ch = *pdwTable ^ (seed1 + seed2); + seed1 = ((~seed1 << 0x15) + 0x11111111) | (seed1 >> 0x0B); + seed2 = ch + seed2 + (seed2 << 5) + 3; + *pdwTable++ = ch; + } + return LIBMPQ_TOOLS_SUCCESS; } /* * This function decrypts the blocktable. */ int libmpq_decrypt_blocktable(mpq_archive *mpq_a, unsigned char *pbKey) { - unsigned int seed1 = 0x7FED7FED; - unsigned int seed2 = 0xEEEEEEEE; - unsigned int ch; /* One key character */ - unsigned int *pdwTable = (unsigned int *)(mpq_a->blocktable); - unsigned int length = mpq_a->header->blocktablesize * 4; + unsigned int seed1 = 0x7FED7FED; + unsigned int seed2 = 0xEEEEEEEE; + unsigned int ch; /* One key character */ + unsigned int *pdwTable = (unsigned int *)(mpq_a->blocktable); + unsigned int length = mpq_a->header->blocktablesize * 4; - /* Prepare seeds */ - while(*pbKey != 0) { - ch = toupper(*pbKey++); - seed1 = mpq_a->buf[0x300 + ch] ^ (seed1 + seed2); - seed2 = ch + seed1 + seed2 + (seed2 << 5) + 3; - } + /* Prepare seeds */ + while(*pbKey != 0) { + ch = toupper(*pbKey++); + seed1 = mpq_a->buf[0x300 + ch] ^ (seed1 + seed2); + seed2 = ch + seed1 + seed2 + (seed2 << 5) + 3; + } - /* Decrypt it */ - seed2 = 0xEEEEEEEE; - while(length-- > 0) { - seed2 += mpq_a->buf[0x400 + (seed1 & 0xFF)]; - ch = *pdwTable ^ (seed1 + seed2); - seed1 = ((~seed1 << 0x15) + 0x11111111) | (seed1 >> 0x0B); - seed2 = ch + seed2 + (seed2 << 5) + 3; - *pdwTable++ = ch; - } - return LIBMPQ_TOOLS_SUCCESS; + /* Decrypt it */ + seed2 = 0xEEEEEEEE; + while(length-- > 0) { + seed2 += mpq_a->buf[0x400 + (seed1 & 0xFF)]; + ch = *pdwTable ^ (seed1 + seed2); + seed1 = ((~seed1 << 0x15) + 0x11111111) | (seed1 >> 0x0B); + seed2 = ch + seed2 + (seed2 << 5) + 3; + *pdwTable++ = ch; + } + return LIBMPQ_TOOLS_SUCCESS; } int libmpq_read_listfile(mpq_archive *mpq_a, FILE *fp) { - int mpq_size; - int mpq_ht_size; - int mpq_bt_size; - int mpq_blocksize; - int mpq_files; - int mpq_csize; - int mpq_fsize; - int entries; - char listdb_version[10]; - char libmpq_version[10]; - int listdb_temp_version = 0; - int libmpq_temp_version = 0; + int mpq_size; + int mpq_ht_size; + int mpq_bt_size; + int mpq_blocksize; + int mpq_files; + int mpq_csize; + int mpq_fsize; + int entries; + char listdb_version[10]; + char libmpq_version[10]; + int listdb_temp_version = 0; + int libmpq_temp_version = 0; - /* first check header and version */ - if (libmpq_conf_get_value(fp, "LIBMPQ_VERSION", mpq_a->mpq_l->mpq_version, LIBMPQ_CONF_TYPE_CHAR, sizeof(mpq_a->mpq_l->mpq_version))) { - return LIBMPQ_CONF_EFILE_CORRUPT; - } else { + /* first check header and version */ + if (libmpq_conf_get_value(fp, "LIBMPQ_VERSION", mpq_a->mpq_l->mpq_version, LIBMPQ_CONF_TYPE_CHAR, sizeof(mpq_a->mpq_l->mpq_version))) { + return LIBMPQ_CONF_EFILE_CORRUPT; + } else { - /* copy to temp buffer for removing . characters */ - sprintf(listdb_version, (char *)mpq_a->mpq_l->mpq_version); + /* copy to temp buffer for removing . characters */ + sprintf(listdb_version, (char *)mpq_a->mpq_l->mpq_version); - /* remove . characters from listfile version */ - libmpq_conf_delete_char(listdb_version, "."); + /* remove . characters from listfile version */ + libmpq_conf_delete_char(listdb_version, "."); - /* get libmpq version */ - sprintf(libmpq_version, "%i%i%i",LIBMPQ_MAJOR_VERSION, LIBMPQ_MINOR_VERSION, LIBMPQ_PATCH_VERSION); + /* get libmpq version */ + sprintf(libmpq_version, "%i%i%i",LIBMPQ_MAJOR_VERSION, LIBMPQ_MINOR_VERSION, LIBMPQ_PATCH_VERSION); - /* convert to number */ - listdb_temp_version = atoi(listdb_version); - libmpq_temp_version = atoi(libmpq_version); + /* convert to number */ + listdb_temp_version = atoi(listdb_version); + libmpq_temp_version = atoi(libmpq_version); - /* check if installed libmpq version is valid for listfile version */ - if ((libmpq_temp_version < listdb_temp_version) || (libmpq_temp_version == 0) || (listdb_temp_version == 0)) { - return LIBMPQ_CONF_EFILE_VERSION; - } - } + /* check if installed libmpq version is valid for listfile version */ + if ((libmpq_temp_version < listdb_temp_version) || (libmpq_temp_version == 0) || (listdb_temp_version == 0)) { + return LIBMPQ_CONF_EFILE_VERSION; + } + } - /* check listfile header, the following entries must be set */ - if (libmpq_conf_get_value(fp, "MPQ_SIZE", &mpq_size, LIBMPQ_CONF_TYPE_INT, 0)) { - return LIBMPQ_CONF_EFILE_CORRUPT; - } - if (libmpq_conf_get_value(fp, "MPQ_HASHTABLE_SIZE", &mpq_ht_size, LIBMPQ_CONF_TYPE_INT, 0)) { - return LIBMPQ_CONF_EFILE_CORRUPT; - } - if (libmpq_conf_get_value(fp, "MPQ_BLOCKTABLE_SIZE", &mpq_bt_size, LIBMPQ_CONF_TYPE_INT, 0)) { - return LIBMPQ_CONF_EFILE_CORRUPT; - } - if (libmpq_conf_get_value(fp, "MPQ_BLOCKSIZE", &mpq_blocksize, LIBMPQ_CONF_TYPE_INT, 0)) { - return LIBMPQ_CONF_EFILE_CORRUPT; - } - if (libmpq_conf_get_value(fp, "MPQ_FILES", &mpq_files, LIBMPQ_CONF_TYPE_INT, 0)) { - return LIBMPQ_CONF_EFILE_CORRUPT; - } - if (libmpq_conf_get_value(fp, "MPQ_COMPRESSED_SIZE", &mpq_csize, LIBMPQ_CONF_TYPE_INT, 0)) { - return LIBMPQ_CONF_EFILE_CORRUPT; - } - if (libmpq_conf_get_value(fp, "MPQ_UNCOMPRESSED_SIZE", &mpq_fsize, LIBMPQ_CONF_TYPE_INT, 0)) { - return LIBMPQ_CONF_EFILE_CORRUPT; - } - if (libmpq_conf_get_value(fp, "MPQ_NAME", mpq_a->mpq_l->mpq_name, LIBMPQ_CONF_TYPE_CHAR, PATH_MAX)) { - return LIBMPQ_CONF_EFILE_CORRUPT; - } - if (libmpq_conf_get_value(fp, "MPQ_TYPE", mpq_a->mpq_l->mpq_type, LIBMPQ_CONF_TYPE_CHAR, sizeof(mpq_a->mpq_l->mpq_type))) { - return LIBMPQ_CONF_EFILE_CORRUPT; - } + /* check listfile header, the following entries must be set */ + if (libmpq_conf_get_value(fp, "MPQ_SIZE", &mpq_size, LIBMPQ_CONF_TYPE_INT, 0)) { + return LIBMPQ_CONF_EFILE_CORRUPT; + } + if (libmpq_conf_get_value(fp, "MPQ_HASHTABLE_SIZE", &mpq_ht_size, LIBMPQ_CONF_TYPE_INT, 0)) { + return LIBMPQ_CONF_EFILE_CORRUPT; + } + if (libmpq_conf_get_value(fp, "MPQ_BLOCKTABLE_SIZE", &mpq_bt_size, LIBMPQ_CONF_TYPE_INT, 0)) { + return LIBMPQ_CONF_EFILE_CORRUPT; + } + if (libmpq_conf_get_value(fp, "MPQ_BLOCKSIZE", &mpq_blocksize, LIBMPQ_CONF_TYPE_INT, 0)) { + return LIBMPQ_CONF_EFILE_CORRUPT; + } + if (libmpq_conf_get_value(fp, "MPQ_FILES", &mpq_files, LIBMPQ_CONF_TYPE_INT, 0)) { + return LIBMPQ_CONF_EFILE_CORRUPT; + } + if (libmpq_conf_get_value(fp, "MPQ_COMPRESSED_SIZE", &mpq_csize, LIBMPQ_CONF_TYPE_INT, 0)) { + return LIBMPQ_CONF_EFILE_CORRUPT; + } + if (libmpq_conf_get_value(fp, "MPQ_UNCOMPRESSED_SIZE", &mpq_fsize, LIBMPQ_CONF_TYPE_INT, 0)) { + return LIBMPQ_CONF_EFILE_CORRUPT; + } + if (libmpq_conf_get_value(fp, "MPQ_NAME", mpq_a->mpq_l->mpq_name, LIBMPQ_CONF_TYPE_CHAR, PATH_MAX)) { + return LIBMPQ_CONF_EFILE_CORRUPT; + } + if (libmpq_conf_get_value(fp, "MPQ_TYPE", mpq_a->mpq_l->mpq_type, LIBMPQ_CONF_TYPE_CHAR, sizeof(mpq_a->mpq_l->mpq_type))) { + return LIBMPQ_CONF_EFILE_CORRUPT; + } - /* these are optional parameters, if they are empty we set the struct members empty */ - libmpq_conf_get_value(fp, "MPQ_GAME", mpq_a->mpq_l->mpq_game, LIBMPQ_CONF_TYPE_CHAR, sizeof(mpq_a->mpq_l->mpq_game)); - libmpq_conf_get_value(fp, "MPQ_GAME_VERSION", mpq_a->mpq_l->mpq_game_version, LIBMPQ_CONF_TYPE_CHAR, sizeof(mpq_a->mpq_l->mpq_game_version)); + /* these are optional parameters, if they are empty we set the struct members empty */ + libmpq_conf_get_value(fp, "MPQ_GAME", mpq_a->mpq_l->mpq_game, LIBMPQ_CONF_TYPE_CHAR, sizeof(mpq_a->mpq_l->mpq_game)); + libmpq_conf_get_value(fp, "MPQ_GAME_VERSION", mpq_a->mpq_l->mpq_game_version, LIBMPQ_CONF_TYPE_CHAR, sizeof(mpq_a->mpq_l->mpq_game_version)); - /* check if we found a valid listfile for the given archive */ - if (mpq_a->header->hashtablesize == mpq_ht_size && mpq_a->header->blocktablesize == mpq_bt_size && mpq_a->blocksize == mpq_blocksize && libmpq_archive_info(mpq_a, LIBMPQ_MPQ_ARCHIVE_SIZE) == mpq_size && libmpq_archive_info(mpq_a, LIBMPQ_MPQ_NUMFILES) == mpq_files && libmpq_archive_info(mpq_a, LIBMPQ_MPQ_COMPRESSED_SIZE) == mpq_csize && libmpq_archive_info(mpq_a, LIBMPQ_MPQ_UNCOMPRESSED_SIZE) == mpq_fsize) { + /* check if we found a valid listfile for the given archive */ + if (mpq_a->header->hashtablesize == mpq_ht_size && mpq_a->header->blocktablesize == mpq_bt_size && mpq_a->blocksize == mpq_blocksize && libmpq_archive_info(mpq_a, LIBMPQ_MPQ_ARCHIVE_SIZE) == mpq_size && libmpq_archive_info(mpq_a, LIBMPQ_MPQ_NUMFILES) == mpq_files && libmpq_archive_info(mpq_a, LIBMPQ_MPQ_COMPRESSED_SIZE) == mpq_csize && libmpq_archive_info(mpq_a, LIBMPQ_MPQ_UNCOMPRESSED_SIZE) == mpq_fsize) { - /* check if the filelist is correct */ - if (!libmpq_conf_get_array(fp, "FILE_NAMES", (char ***)&mpq_a->mpq_l->mpq_files, &entries)) { + /* check if the filelist is correct */ + if (!libmpq_conf_get_array(fp, "FILE_NAMES", (char ***)&mpq_a->mpq_l->mpq_files, &entries)) { - /* we have a corrupt filelist, so return */ - return LIBMPQ_CONF_EFILE_LIST_CORRUPT; - } else { + /* we have a corrupt filelist, so return */ + return LIBMPQ_CONF_EFILE_LIST_CORRUPT; + } else { - /* now check if filelist entries matches number of files in the archive. */ - if (entries != libmpq_archive_info(mpq_a, LIBMPQ_MPQ_NUMFILES)) { - libmpq_free_listfile((char **)mpq_a->mpq_l->mpq_files); - mpq_a->mpq_l->mpq_files = NULL; - return LIBMPQ_CONF_EFILE_LIST_CORRUPT; - } - } - } + /* now check if filelist entries matches number of files in the archive. */ + if (entries != libmpq_archive_info(mpq_a, LIBMPQ_MPQ_NUMFILES)) { + libmpq_free_listfile((char **)mpq_a->mpq_l->mpq_files); + mpq_a->mpq_l->mpq_files = NULL; + return LIBMPQ_CONF_EFILE_LIST_CORRUPT; + } + } + } - return LIBMPQ_TOOLS_SUCCESS; + return LIBMPQ_TOOLS_SUCCESS; } /* * This function frees up the space reserved by libmpq_get_listfile() */ int libmpq_free_listfile(char **filelist) { - int i = 0; - while (filelist[i]) { - free(filelist[i++]); - } - free(filelist); + int i = 0; + while (filelist[i]) { + free(filelist[i++]); + } + free(filelist); - return LIBMPQ_TOOLS_SUCCESS; + return LIBMPQ_TOOLS_SUCCESS; } /* @@ -220,84 +220,84 @@ int libmpq_free_listfile(char **filelist) { * array. */ /*int libmpq_detect_listfile_rec(char path[PATH_MAX], char ***filelist, int *fl_count, int *fl_size) { - char nextpath[PATH_MAX]; - DIR *dp = opendir(path); - FILE *fp; - struct dirent *entry; - struct stat statbuf; - char buf[LIBMPQ_CONF_BUFSIZE]; + char nextpath[PATH_MAX]; + DIR *dp = opendir(path); + FILE *fp; + struct dirent *entry; + struct stat statbuf; + char buf[LIBMPQ_CONF_BUFSIZE]; - if (dp == NULL) { - return LIBMPQ_CONF_EOPEN_DIR; - } else { - while ((entry = readdir(dp)) != NULL) { - if (strncmp(entry->d_name, ".", 1) == 0 || strncmp(entry->d_name, "..", 2) == 0) { - continue; - } - if (strnlen(path, PATH_MAX) + strnlen(entry->d_name, PATH_MAX) + 2 > sizeof nextpath) { - continue; - } + if (dp == NULL) { + return LIBMPQ_CONF_EOPEN_DIR; + } else { + while ((entry = readdir(dp)) != NULL) { + if (strncmp(entry->d_name, ".", 1) == 0 || strncmp(entry->d_name, "..", 2) == 0) { + continue; + } + if (strnlen(path, PATH_MAX) + strnlen(entry->d_name, PATH_MAX) + 2 > sizeof nextpath) { + continue; + } - snprintf(nextpath, PATH_MAX, "%s/%s", path, entry->d_name); + snprintf(nextpath, PATH_MAX, "%s/%s", path, entry->d_name); - // check if file extension matches listdb file extension - if (strncmp(&entry->d_name[strlen(entry->d_name) - strlen(LIBMPQ_CONF_EXT)], LIBMPQ_CONF_EXT, strlen(LIBMPQ_CONF_EXT)) == 0) { + // check if file extension matches listdb file extension + if (strncmp(&entry->d_name[strlen(entry->d_name) - strlen(LIBMPQ_CONF_EXT)], LIBMPQ_CONF_EXT, strlen(LIBMPQ_CONF_EXT)) == 0) { - // check if it is really a listdb file - if ((fp = fopen(nextpath, "r")) != NULL ) { - while (fgets(buf, LIBMPQ_CONF_BUFSIZE, fp) != NULL) { - char *line; + // check if it is really a listdb file + if ((fp = fopen(nextpath, "r")) != NULL ) { + while (fgets(buf, LIBMPQ_CONF_BUFSIZE, fp) != NULL) { + char *line; - buf[strlen(buf) - 1] = '\0'; + buf[strlen(buf) - 1] = '\0'; - // skip whitespace - for (line = buf; isspace(*line); line++) { - continue; - } + // skip whitespace + for (line = buf; isspace(*line); line++) { + continue; + } - // skip empty line - if (line[0] == '\0') { - continue; - } + // skip empty line + if (line[0] == '\0') { + continue; + } - // skip comments - if (line[0] == '#') { - continue; - } + // skip comments + if (line[0] == '#') { + continue; + } - //search for listdb header; dirty but works :) - if (!strncasecmp(line, LIBMPQ_CONF_HEADER, strlen(LIBMPQ_CONF_HEADER))) { + //search for listdb header; dirty but works :) + if (!strncasecmp(line, LIBMPQ_CONF_HEADER, strlen(LIBMPQ_CONF_HEADER))) { - // set the next filelist entry to a copy of the file path - (*filelist)[(*fl_count)++] = strdup(nextpath); + // set the next filelist entry to a copy of the file path + (*filelist)[(*fl_count)++] = strdup(nextpath); - // increase the array size - if ((*fl_count) == (*fl_size)) { - (*filelist) = realloc((*filelist), ((*fl_size) + LIBMPQ_CONF_FL_INCREMENT) * sizeof(char *)); - (*fl_size) += LIBMPQ_CONF_FL_INCREMENT; - } + // increase the array size + if ((*fl_count) == (*fl_size)) { + (*filelist) = realloc((*filelist), ((*fl_size) + LIBMPQ_CONF_FL_INCREMENT) * sizeof(char *)); + (*fl_size) += LIBMPQ_CONF_FL_INCREMENT; + } - // header found so we could stop reading the file. - break; - } - } - fclose(fp); - } - } + // header found so we could stop reading the file. + break; + } + } + fclose(fp); + } + } - if (stat(nextpath, &statbuf) < 0) { - continue; - } + if (stat(nextpath, &statbuf) < 0) { + continue; + } - // if entry ia a subdirectory, read it - if (S_ISDIR(statbuf.st_mode)) { - libmpq_detect_listfile_rec(nextpath, filelist, fl_count, fl_size); - } - } - closedir(dp); - } + // if entry ia a subdirectory, read it + if (S_ISDIR(statbuf.st_mode)) { + libmpq_detect_listfile_rec(nextpath, filelist, fl_count, fl_size); + } + } + closedir(dp); + } - return LIBMPQ_TOOLS_SUCCESS; + return LIBMPQ_TOOLS_SUCCESS; } */ @@ -309,69 +309,69 @@ int libmpq_free_listfile(char **filelist) { * we can find the decryption key. */ int libmpq_detect_fileseed(mpq_archive *mpq_a, unsigned int *block, unsigned int decrypted) { - unsigned int saveseed1; - unsigned int temp = *block ^ decrypted; /* temp = seed1 + seed2 */ - int i = 0; - temp -= 0xEEEEEEEE; /* temp = seed1 + mpq_a->buf[0x400 + (seed1 & 0xFF)] */ + unsigned int saveseed1; + unsigned int temp = *block ^ decrypted; /* temp = seed1 + seed2 */ + int i = 0; + temp -= 0xEEEEEEEE; /* temp = seed1 + mpq_a->buf[0x400 + (seed1 & 0xFF)] */ - for (i = 0; i < 0x100; i++) { /* Try all 255 possibilities */ - unsigned int seed1; - unsigned int seed2 = 0xEEEEEEEE; - unsigned int ch; + for (i = 0; i < 0x100; i++) { /* Try all 255 possibilities */ + unsigned int seed1; + unsigned int seed2 = 0xEEEEEEEE; + unsigned int ch; - /* Try the first unsigned int's (We exactly know the value) */ - seed1 = temp - mpq_a->buf[0x400 + i]; - seed2 += mpq_a->buf[0x400 + (seed1 & 0xFF)]; - ch = block[0] ^ (seed1 + seed2); + /* Try the first unsigned int's (We exactly know the value) */ + seed1 = temp - mpq_a->buf[0x400 + i]; + seed2 += mpq_a->buf[0x400 + (seed1 & 0xFF)]; + ch = block[0] ^ (seed1 + seed2); - if (ch != decrypted) { - continue; - } + if (ch != decrypted) { + continue; + } - /* Add 1 because we are decrypting block positions */ - saveseed1 = seed1 + 1; + /* Add 1 because we are decrypting block positions */ + saveseed1 = seed1 + 1; - /* - * If OK, continue and test the second value. We don't know exactly the value, - * but we know that the second one has lower 16 bits set to zero - * (no compressed block is larger than 0xFFFF bytes) - */ - seed1 = ((~seed1 << 0x15) + 0x11111111) | (seed1 >> 0x0B); - seed2 = ch + seed2 + (seed2 << 5) + 3; - seed2 += mpq_a->buf[0x400 + (seed1 & 0xFF)]; - ch = block[1] ^ (seed1 + seed2); - if ((ch & 0xFFFF0000) == 0) { - return saveseed1; - } - } - return LIBMPQ_TOOLS_SUCCESS; + /* + * If OK, continue and test the second value. We don't know exactly the value, + * but we know that the second one has lower 16 bits set to zero + * (no compressed block is larger than 0xFFFF bytes) + */ + seed1 = ((~seed1 << 0x15) + 0x11111111) | (seed1 >> 0x0B); + seed2 = ch + seed2 + (seed2 << 5) + 3; + seed2 += mpq_a->buf[0x400 + (seed1 & 0xFF)]; + ch = block[1] ^ (seed1 + seed2); + if ((ch & 0xFFFF0000) == 0) { + return saveseed1; + } + } + return LIBMPQ_TOOLS_SUCCESS; } /* * This function initialize the decryption buffer */ int libmpq_init_buffer(mpq_archive *mpq_a) { - unsigned int seed = 0x00100001; - unsigned int index1 = 0; - unsigned int index2 = 0; - int i; + unsigned int seed = 0x00100001; + unsigned int index1 = 0; + unsigned int index2 = 0; + int i; - memset(mpq_a->buf, 0, sizeof(mpq_a->buf)); + memset(mpq_a->buf, 0, sizeof(mpq_a->buf)); - /* Initialize the decryption buffer. */ - for (index1 = 0; index1 < 0x100; index1++) { - for(index2 = index1, i = 0; i < 5; i++, index2 += 0x100) { - unsigned int temp1, temp2; - seed = (seed * 125 + 3) % 0x2AAAAB; - temp1 = (seed & 0xFFFF) << 0x10; + /* Initialize the decryption buffer. */ + for (index1 = 0; index1 < 0x100; index1++) { + for(index2 = index1, i = 0; i < 5; i++, index2 += 0x100) { + unsigned int temp1, temp2; + seed = (seed * 125 + 3) % 0x2AAAAB; + temp1 = (seed & 0xFFFF) << 0x10; - seed = (seed * 125 + 3) % 0x2AAAAB; - temp2 = (seed & 0xFFFF); + seed = (seed * 125 + 3) % 0x2AAAAB; + temp2 = (seed & 0xFFFF); - mpq_a->buf[index2] = (temp1 | temp2); - } - } - return LIBMPQ_TOOLS_SUCCESS; + mpq_a->buf[index2] = (temp1 | temp2); + } + } + return LIBMPQ_TOOLS_SUCCESS; } /* @@ -380,52 +380,52 @@ int libmpq_init_buffer(mpq_archive *mpq_a) { * be decrypted for later use. */ int libmpq_read_hashtable(mpq_archive *mpq_a) { - unsigned int bytes = 0; - int rb = 0; + unsigned int bytes = 0; + int rb = 0; - /* - * Allocate memory. Note that the block table should be as large as the - * hash table. (for later file additions) - */ - mpq_a->hashtable = (mpq_hash *)malloc(sizeof(mpq_hash) * mpq_a->header->hashtablesize); + /* + * Allocate memory. Note that the block table should be as large as the + * hash table. (for later file additions) + */ + mpq_a->hashtable = (mpq_hash *)malloc(sizeof(mpq_hash) * mpq_a->header->hashtablesize); - if (!mpq_a->hashtable) { - return LIBMPQ_EALLOCMEM; - } + if (!mpq_a->hashtable) { + return LIBMPQ_EALLOCMEM; + } - /* Read the hash table into the buffer */ - bytes = mpq_a->header->hashtablesize * sizeof(mpq_hash); + /* Read the hash table into the buffer */ + bytes = mpq_a->header->hashtablesize * sizeof(mpq_hash); - #ifdef WIN32 - _lseeki64(mpq_a->fd, mpq_a->header->hashtablepos, SEEK_SET); - #else - lseek64(mpq_a->fd, mpq_a->header->hashtablepos, SEEK_SET); - #endif + #ifdef WIN32 + _lseeki64(mpq_a->fd, mpq_a->header->hashtablepos, SEEK_SET); + #else + lseek64(mpq_a->fd, mpq_a->header->hashtablepos, SEEK_SET); + #endif - rb = _read(mpq_a->fd, mpq_a->hashtable, bytes); - if (rb != bytes) { - return LIBMPQ_EFILE_CORRUPT; - } + rb = _read(mpq_a->fd, mpq_a->hashtable, bytes); + if (rb != bytes) { + return LIBMPQ_EFILE_CORRUPT; + } - /* Decrypt hash table and check if it is correctly decrypted */ - mpq_hash *mpq_h_end = mpq_a->hashtable + mpq_a->header->hashtablesize; - mpq_hash *mpq_h = NULL; + /* Decrypt hash table and check if it is correctly decrypted */ + mpq_hash *mpq_h_end = mpq_a->hashtable + mpq_a->header->hashtablesize; + mpq_hash *mpq_h = NULL; - libmpq_decrypt_hashtable(mpq_a, (unsigned char *)"(hash table)"); + libmpq_decrypt_hashtable(mpq_a, (unsigned char *)"(hash table)"); - /* Check hash table if is correctly decrypted */ - for (mpq_h = mpq_a->hashtable; mpq_h < mpq_h_end; mpq_h++) { - if (mpq_h->locale != 0xFFFFFFFF && (mpq_h->locale & 0xFFFF0000) != 0) { - return LIBMPQ_EFILE_FORMAT; - } + /* Check hash table if is correctly decrypted */ + for (mpq_h = mpq_a->hashtable; mpq_h < mpq_h_end; mpq_h++) { + if (mpq_h->locale != 0xFFFFFFFF && (mpq_h->locale & 0xFFFF0000) != 0) { + return LIBMPQ_EFILE_FORMAT; + } - /* Remember the highest block table entry */ - if (mpq_h->blockindex < LIBMPQ_HASH_ENTRY_DELETED && mpq_h->blockindex > 0) { - mpq_a->maxblockindex = mpq_h->blockindex; - } - } + /* Remember the highest block table entry */ + if (mpq_h->blockindex < LIBMPQ_HASH_ENTRY_DELETED && mpq_h->blockindex > 0) { + mpq_a->maxblockindex = mpq_h->blockindex; + } + } - return LIBMPQ_TOOLS_SUCCESS; + return LIBMPQ_TOOLS_SUCCESS; } /* @@ -437,365 +437,365 @@ int libmpq_read_hashtable(mpq_archive *mpq_a) { * cracked Diablo versions. */ int libmpq_read_blocktable(mpq_archive *mpq_a) { - unsigned int bytes = 0; - int rb = 0; + unsigned int bytes = 0; + int rb = 0; - /* - * Allocate memory. Note that the block table should be as large as the - * hash table. (for later file additions) - */ - mpq_a->blocktable = (mpq_block *)malloc(sizeof(mpq_block) * mpq_a->header->hashtablesize); - mpq_a->blockbuf = (unsigned char *)malloc(mpq_a->blocksize); + /* + * Allocate memory. Note that the block table should be as large as the + * hash table. (for later file additions) + */ + mpq_a->blocktable = (mpq_block *)malloc(sizeof(mpq_block) * mpq_a->header->hashtablesize); + mpq_a->blockbuf = (unsigned char *)malloc(mpq_a->blocksize); - if (!mpq_a->blocktable || !mpq_a->blockbuf) { - return LIBMPQ_EALLOCMEM; - } + if (!mpq_a->blocktable || !mpq_a->blockbuf) { + return LIBMPQ_EALLOCMEM; + } - /* Read the block table into the buffer */ - bytes = mpq_a->header->blocktablesize * sizeof(mpq_block); - memset(mpq_a->blocktable, 0, mpq_a->header->blocktablesize * sizeof(mpq_block)); + /* Read the block table into the buffer */ + bytes = mpq_a->header->blocktablesize * sizeof(mpq_block); + memset(mpq_a->blocktable, 0, mpq_a->header->blocktablesize * sizeof(mpq_block)); - #ifdef WIN32 - _lseeki64(mpq_a->fd, mpq_a->header->blocktablepos, SEEK_SET); - #else - lseek64(mpq_a->fd, mpq_a->header->blocktablepos, SEEK_SET); - #endif + #ifdef WIN32 + _lseeki64(mpq_a->fd, mpq_a->header->blocktablepos, SEEK_SET); + #else + lseek64(mpq_a->fd, mpq_a->header->blocktablepos, SEEK_SET); + #endif - rb = _read(mpq_a->fd, mpq_a->blocktable, bytes); - if (rb != bytes) { - return LIBMPQ_EFILE_CORRUPT; - } + rb = _read(mpq_a->fd, mpq_a->blocktable, bytes); + if (rb != bytes) { + return LIBMPQ_EFILE_CORRUPT; + } - /* - * Decrypt block table. Some MPQs don't have encrypted block table, - * e.g. cracked Diablo version. We have to check if block table is - * already decrypted - */ - mpq_block *mpq_b_end = mpq_a->blocktable + mpq_a->maxblockindex + 1; - mpq_block *mpq_b = NULL; - unsigned int archivesize = mpq_a->header->archivesize + mpq_a->mpqpos; + /* + * Decrypt block table. Some MPQs don't have encrypted block table, + * e.g. cracked Diablo version. We have to check if block table is + * already decrypted + */ + mpq_block *mpq_b_end = mpq_a->blocktable + mpq_a->maxblockindex + 1; + mpq_block *mpq_b = NULL; + unsigned int archivesize = mpq_a->header->archivesize + mpq_a->mpqpos; - if (mpq_a->header->offset != mpq_a->blocktable->filepos) { - libmpq_decrypt_blocktable(mpq_a, (unsigned char *)"(block table)"); - } - for (mpq_b = mpq_a->blocktable; mpq_b < mpq_b_end; mpq_b++) { - if (mpq_b->filepos > archivesize || mpq_b->csize > archivesize) { - if ((mpq_a->flags & LIBMPQ_FLAG_PROTECTED) == 0) { - return LIBMPQ_EFILE_FORMAT; - } - } - mpq_b->filepos += mpq_a->mpqpos; - } + if (mpq_a->header->offset != mpq_a->blocktable->filepos) { + libmpq_decrypt_blocktable(mpq_a, (unsigned char *)"(block table)"); + } + for (mpq_b = mpq_a->blocktable; mpq_b < mpq_b_end; mpq_b++) { + if (mpq_b->filepos > archivesize || mpq_b->csize > archivesize) { + if ((mpq_a->flags & LIBMPQ_FLAG_PROTECTED) == 0) { + return LIBMPQ_EFILE_FORMAT; + } + } + mpq_b->filepos += mpq_a->mpqpos; + } - return LIBMPQ_TOOLS_SUCCESS; + return LIBMPQ_TOOLS_SUCCESS; } int libmpq_file_read_block(mpq_archive *mpq_a, mpq_file *mpq_f, unsigned int blockpos, char *buffer, unsigned int blockbytes) { - unsigned char *tempbuf = NULL; /* Buffer for reading compressed data from the file */ - unsigned int readpos; /* Reading position from the file */ - unsigned int toread = 0; /* Number of bytes to read */ - unsigned int blocknum; /* Block number (needed for decrypt) */ - unsigned int bytesread = 0; /* Total number of bytes read */ - unsigned int nblocks; /* Number of blocks to load */ - unsigned int i; + unsigned char *tempbuf = NULL; /* Buffer for reading compressed data from the file */ + unsigned int readpos; /* Reading position from the file */ + unsigned int toread = 0; /* Number of bytes to read */ + unsigned int blocknum; /* Block number (needed for decrypt) */ + unsigned int bytesread = 0; /* Total number of bytes read */ + unsigned int nblocks; /* Number of blocks to load */ + unsigned int i; - /* Test parameters. Block position and block size must be block-aligned, block size nonzero */ - if ((blockpos & (mpq_a->blocksize - 1)) || blockbytes == 0) { - return 0; - } + /* Test parameters. Block position and block size must be block-aligned, block size nonzero */ + if ((blockpos & (mpq_a->blocksize - 1)) || blockbytes == 0) { + return 0; + } - /* Check the end of file */ - if ((blockpos + blockbytes) > mpq_f->mpq_b->fsize) { - blockbytes = mpq_f->mpq_b->fsize - blockpos; - } - blocknum = blockpos / mpq_a->blocksize; - nblocks = blockbytes / mpq_a->blocksize; - if (blockbytes % mpq_a->blocksize) { - nblocks++; - } + /* Check the end of file */ + if ((blockpos + blockbytes) > mpq_f->mpq_b->fsize) { + blockbytes = mpq_f->mpq_b->fsize - blockpos; + } + blocknum = blockpos / mpq_a->blocksize; + nblocks = blockbytes / mpq_a->blocksize; + if (blockbytes % mpq_a->blocksize) { + nblocks++; + } - /* If file has variable block positions, we have to load them */ - if ((mpq_f->mpq_b->flags & LIBMPQ_FILE_COMPRESSED) && mpq_f->blockposloaded == FALSE) { - unsigned int nread; + /* If file has variable block positions, we have to load them */ + if ((mpq_f->mpq_b->flags & LIBMPQ_FILE_COMPRESSED) && mpq_f->blockposloaded == FALSE) { + unsigned int nread; - if (mpq_f->mpq_b->filepos != mpq_a->filepos) { - #ifdef WIN32 - _lseeki64(mpq_a->fd, mpq_f->mpq_b->filepos, SEEK_SET); - #else - lseek64(mpq_a->fd, mpq_f->mpq_b->filepos, SEEK_SET); + if (mpq_f->mpq_b->filepos != mpq_a->filepos) { + #ifdef WIN32 + _lseeki64(mpq_a->fd, mpq_f->mpq_b->filepos, SEEK_SET); + #else + lseek64(mpq_a->fd, mpq_f->mpq_b->filepos, SEEK_SET); - #endif - } + #endif + } - /* Read block positions from begin of file. */ - nread = (mpq_f->nblocks + 1) * sizeof(int); - nread = _read(mpq_a->fd, mpq_f->blockpos, nread); + /* Read block positions from begin of file. */ + nread = (mpq_f->nblocks + 1) * sizeof(int); + nread = _read(mpq_a->fd, mpq_f->blockpos, nread); - /* - * If the archive is protected some way, perform additional check - * Sometimes, the file appears not to be encrypted, but it is. - */ - /*if (mpq_f->blockpos[0] != nread) { - mpq_f->mpq_b->flags |= LIBMPQ_FILE_ENCRYPTED; - }*/ + /* + * If the archive is protected some way, perform additional check + * Sometimes, the file appears not to be encrypted, but it is. + */ + /*if (mpq_f->blockpos[0] != nread) { + mpq_f->mpq_b->flags |= LIBMPQ_FILE_ENCRYPTED; + }*/ if ((mpq_f->mpq_b->flags & LIBMPQ_FILE_HAS_METADATA) == 0) { if (mpq_f->blockpos[0] != nread) { - mpq_f->mpq_b->flags |= LIBMPQ_FILE_ENCRYPTED; - } + mpq_f->mpq_b->flags |= LIBMPQ_FILE_ENCRYPTED; + } } - /* Decrypt loaded block positions if necessary */ - if (mpq_f->mpq_b->flags & LIBMPQ_FILE_ENCRYPTED) { + /* Decrypt loaded block positions if necessary */ + if (mpq_f->mpq_b->flags & LIBMPQ_FILE_ENCRYPTED) { - /* If we don't know the file seed, try to find it. */ - if (mpq_f->seed == 0) { - mpq_f->seed = libmpq_detect_fileseed(mpq_a, mpq_f->blockpos, nread); - } + /* If we don't know the file seed, try to find it. */ + if (mpq_f->seed == 0) { + mpq_f->seed = libmpq_detect_fileseed(mpq_a, mpq_f->blockpos, nread); + } - /* If we don't know the file seed, sorry but we cannot extract the file. */ - if (mpq_f->seed == 0) { - return 0; - } + /* If we don't know the file seed, sorry but we cannot extract the file. */ + if (mpq_f->seed == 0) { + return 0; + } - /* Decrypt block positions */ - libmpq_decrypt_block(mpq_a, mpq_f->blockpos, nread, mpq_f->seed - 1); + /* Decrypt block positions */ + libmpq_decrypt_block(mpq_a, mpq_f->blockpos, nread, mpq_f->seed - 1); - /* - * Check if the block positions are correctly decrypted - * I don't know why, but sometimes it will result invalid - * block positions on some files. - */ - if (mpq_f->blockpos[0] != nread) { + /* + * Check if the block positions are correctly decrypted + * I don't know why, but sometimes it will result invalid + * block positions on some files. + */ + if (mpq_f->blockpos[0] != nread) { - /* Try once again to detect file seed and decrypt the blocks */ + /* Try once again to detect file seed and decrypt the blocks */ - #ifdef WIN32 - _lseeki64(mpq_a->fd, mpq_f->mpq_b->filepos, SEEK_SET); - #else - lseek64(mpq_a->fd, mpq_f->mpq_b->filepos, SEEK_SET); - #endif + #ifdef WIN32 + _lseeki64(mpq_a->fd, mpq_f->mpq_b->filepos, SEEK_SET); + #else + lseek64(mpq_a->fd, mpq_f->mpq_b->filepos, SEEK_SET); + #endif - nread = _read(mpq_a->fd, mpq_f->blockpos, (mpq_f->nblocks + 1) * sizeof(int)); - mpq_f->seed = libmpq_detect_fileseed(mpq_a, mpq_f->blockpos, nread); - libmpq_decrypt_block(mpq_a, mpq_f->blockpos, nread, mpq_f->seed - 1); + nread = _read(mpq_a->fd, mpq_f->blockpos, (mpq_f->nblocks + 1) * sizeof(int)); + mpq_f->seed = libmpq_detect_fileseed(mpq_a, mpq_f->blockpos, nread); + libmpq_decrypt_block(mpq_a, mpq_f->blockpos, nread, mpq_f->seed - 1); - /* Check if the block positions are correctly decrypted. */ - if (mpq_f->blockpos[0] != nread) { - return 0; - } - } - } + /* Check if the block positions are correctly decrypted. */ + if (mpq_f->blockpos[0] != nread) { + return 0; + } + } + } - /* Update mpq_f's variables */ - mpq_f->blockposloaded = TRUE; - mpq_a->filepos = mpq_f->mpq_b->filepos + nread; - } + /* Update mpq_f's variables */ + mpq_f->blockposloaded = TRUE; + mpq_a->filepos = mpq_f->mpq_b->filepos + nread; + } - /* Get file position and number of bytes to read */ - readpos = blockpos; - toread = blockbytes; + /* Get file position and number of bytes to read */ + readpos = blockpos; + toread = blockbytes; - if (mpq_f->mpq_b->flags & LIBMPQ_FILE_COMPRESSED) { - readpos = mpq_f->blockpos[blocknum]; - toread = mpq_f->blockpos[blocknum + nblocks] - readpos; - } + if (mpq_f->mpq_b->flags & LIBMPQ_FILE_COMPRESSED) { + readpos = mpq_f->blockpos[blocknum]; + toread = mpq_f->blockpos[blocknum + nblocks] - readpos; + } - readpos += mpq_f->mpq_b->filepos; + readpos += mpq_f->mpq_b->filepos; - /* Get work buffer for store read data */ + /* Get work buffer for store read data */ if ((tempbuf = (unsigned char *)malloc(toread)) == NULL) { /* Hmmm... We should add a better error handling here :) */ return 0; } - /* Set file pointer, if necessary. */ - if (mpq_a->filepos != readpos) { + /* Set file pointer, if necessary. */ + if (mpq_a->filepos != readpos) { - #ifdef WIN32 - mpq_a->filepos = _lseeki64(mpq_a->fd, readpos, SEEK_SET); - #else - mpq_a->filepos = lseek64(mpq_a->fd, readpos, SEEK_SET); - #endif + #ifdef WIN32 + mpq_a->filepos = _lseeki64(mpq_a->fd, readpos, SEEK_SET); + #else + mpq_a->filepos = lseek64(mpq_a->fd, readpos, SEEK_SET); + #endif - } + } - /* 15018F87 - Read all requested blocks. */ - bytesread = _read(mpq_a->fd, tempbuf, toread); - mpq_a->filepos = readpos + bytesread; + /* 15018F87 - Read all requested blocks. */ + bytesread = _read(mpq_a->fd, tempbuf, toread); + mpq_a->filepos = readpos + bytesread; - /* Block processing part. */ - unsigned int blockstart = 0; /* Index of block start in work buffer. */ - unsigned int blocksize = min(blockbytes, mpq_a->blocksize); - unsigned int index = blocknum; /* Current block index. */ - bytesread = 0; /* Clear read byte counter */ + /* Block processing part. */ + unsigned int blockstart = 0; /* Index of block start in work buffer. */ + unsigned int blocksize = min(blockbytes, mpq_a->blocksize); + unsigned int index = blocknum; /* Current block index. */ + bytesread = 0; /* Clear read byte counter */ - /* Walk through all blocks. */ - for (i = 0; i < nblocks; i++, index++) { - int outlength = mpq_a->blocksize; + /* Walk through all blocks. */ + for (i = 0; i < nblocks; i++, index++) { + int outlength = mpq_a->blocksize; - /* Get current block length */ - if (mpq_f->mpq_b->flags & LIBMPQ_FILE_COMPRESSED) { - blocksize = mpq_f->blockpos[index + 1] - mpq_f->blockpos[index]; - } + /* Get current block length */ + if (mpq_f->mpq_b->flags & LIBMPQ_FILE_COMPRESSED) { + blocksize = mpq_f->blockpos[index + 1] - mpq_f->blockpos[index]; + } - /* If block is encrypted, we have to decrypt it. */ - if (mpq_f->mpq_b->flags & LIBMPQ_FILE_ENCRYPTED) { - if (mpq_f->seed == 0) { - return 0; - } - libmpq_decrypt_block(mpq_a, (unsigned int *)&tempbuf[blockstart], blocksize, mpq_f->seed + index); - } + /* If block is encrypted, we have to decrypt it. */ + if (mpq_f->mpq_b->flags & LIBMPQ_FILE_ENCRYPTED) { + if (mpq_f->seed == 0) { + return 0; + } + libmpq_decrypt_block(mpq_a, (unsigned int *)&tempbuf[blockstart], blocksize, mpq_f->seed + index); + } - /* - * If the block is really compressed, recompress it. - * WARNING: Some block may not be compressed, it can - * only be determined by comparing uncompressed and - * compressed size! - */ - if (blocksize < blockbytes) { + /* + * If the block is really compressed, recompress it. + * WARNING: Some block may not be compressed, it can + * only be determined by comparing uncompressed and + * compressed size! + */ + if (blocksize < blockbytes) { - /* Is the file compressed with PKWARE Data Compression Library? */ - if (mpq_f->mpq_b->flags & LIBMPQ_FILE_COMPRESS_PKWARE) { - libmpq_pkzip_decompress(buffer, &outlength, (char *)&tempbuf[blockstart], blocksize); - } + /* Is the file compressed with PKWARE Data Compression Library? */ + if (mpq_f->mpq_b->flags & LIBMPQ_FILE_COMPRESS_PKWARE) { + libmpq_pkzip_decompress(buffer, &outlength, (char *)&tempbuf[blockstart], blocksize); + } - /* - * Is it a file compressed by Blizzard's multiple compression ? - * Note that Storm.dll v 1.0.9 distributed with Warcraft III - * passes the full path name of the opened archive as the new - * last parameter. - */ - if (mpq_f->mpq_b->flags & LIBMPQ_FILE_COMPRESS_MULTI) { - libmpq_multi_decompress(buffer, &outlength, (char *)&tempbuf[blockstart], blocksize); - } - bytesread += outlength; - buffer += outlength; - } else { - memcpy(buffer, tempbuf, blocksize); - bytesread += blocksize; - buffer += blocksize; - } - blockstart += blocksize; - } + /* + * Is it a file compressed by Blizzard's multiple compression ? + * Note that Storm.dll v 1.0.9 distributed with Warcraft III + * passes the full path name of the opened archive as the new + * last parameter. + */ + if (mpq_f->mpq_b->flags & LIBMPQ_FILE_COMPRESS_MULTI) { + libmpq_multi_decompress(buffer, &outlength, (char *)&tempbuf[blockstart], blocksize); + } + bytesread += outlength; + buffer += outlength; + } else { + memcpy(buffer, tempbuf, blocksize); + bytesread += blocksize; + buffer += blocksize; + } + blockstart += blocksize; + } - /* Delete input buffer, if necessary. */ + /* Delete input buffer, if necessary. */ free(tempbuf); return bytesread; } int libmpq_file_read_file(mpq_archive *mpq_a, mpq_file *mpq_f, unsigned int filepos, char *buffer, unsigned int toread) { - unsigned int bytesread = 0; /* Number of bytes read from the file */ - unsigned int blockpos; /* Position in the file aligned to the whole blocks */ - unsigned int loaded = 0; + unsigned int bytesread = 0; /* Number of bytes read from the file */ + unsigned int blockpos; /* Position in the file aligned to the whole blocks */ + unsigned int loaded = 0; - /* File position is greater or equal to file size? */ - if (filepos >= mpq_f->mpq_b->fsize) { - return 0; - } + /* File position is greater or equal to file size? */ + if (filepos >= mpq_f->mpq_b->fsize) { + return 0; + } - /* If to few bytes in the file remaining, cut them */ - if ((mpq_f->mpq_b->fsize - filepos) < toread) { - toread = (mpq_f->mpq_b->fsize - filepos); - } + /* If to few bytes in the file remaining, cut them */ + if ((mpq_f->mpq_b->fsize - filepos) < toread) { + toread = (mpq_f->mpq_b->fsize - filepos); + } - /* Block position in the file */ - blockpos = filepos & ~(mpq_a->blocksize - 1); + /* Block position in the file */ + blockpos = filepos & ~(mpq_a->blocksize - 1); - /* - * Load the first block, if noncomplete. It may be loaded in the cache buffer. - * We have to check if this block is loaded. If not, load it. - */ - if ((filepos % mpq_a->blocksize) != 0) { - /* Number of bytes remaining in the buffer */ - unsigned int tocopy; - unsigned int loaded = mpq_a->blocksize; + /* + * Load the first block, if noncomplete. It may be loaded in the cache buffer. + * We have to check if this block is loaded. If not, load it. + */ + if ((filepos % mpq_a->blocksize) != 0) { + /* Number of bytes remaining in the buffer */ + unsigned int tocopy; + unsigned int loaded = mpq_a->blocksize; - /* Check if data are loaded in the cache */ - if (mpq_f->accessed == FALSE || blockpos != mpq_a->blockpos) { + /* Check if data are loaded in the cache */ + if (mpq_f->accessed == FALSE || blockpos != mpq_a->blockpos) { - /* Load one MPQ block into archive buffer */ - loaded = libmpq_file_read_block(mpq_a, mpq_f, blockpos, (char *)mpq_a->blockbuf, mpq_a->blocksize); - if (loaded == 0) { - return 0; - } + /* Load one MPQ block into archive buffer */ + loaded = libmpq_file_read_block(mpq_a, mpq_f, blockpos, (char *)mpq_a->blockbuf, mpq_a->blocksize); + if (loaded == 0) { + return 0; + } - /* Save lastly accessed file and block position for later use */ - mpq_f->accessed = TRUE; - mpq_a->blockpos = blockpos; - mpq_a->bufpos = filepos % mpq_a->blocksize; - } - tocopy = loaded - mpq_a->bufpos; - if (tocopy > toread) { - tocopy = toread; - } + /* Save lastly accessed file and block position for later use */ + mpq_f->accessed = TRUE; + mpq_a->blockpos = blockpos; + mpq_a->bufpos = filepos % mpq_a->blocksize; + } + tocopy = loaded - mpq_a->bufpos; + if (tocopy > toread) { + tocopy = toread; + } - /* Copy data from block buffer into target buffer */ - memcpy(buffer, mpq_a->blockbuf + mpq_a->bufpos, tocopy); + /* Copy data from block buffer into target buffer */ + memcpy(buffer, mpq_a->blockbuf + mpq_a->bufpos, tocopy); - /* Update pointers */ - toread -= tocopy; - bytesread += tocopy; - buffer += tocopy; - blockpos += mpq_a->blocksize; - mpq_a->bufpos += tocopy; + /* Update pointers */ + toread -= tocopy; + bytesread += tocopy; + buffer += tocopy; + blockpos += mpq_a->blocksize; + mpq_a->bufpos += tocopy; - /* If all, return. */ - if (toread == 0) { - return bytesread; - } - } + /* If all, return. */ + if (toread == 0) { + return bytesread; + } + } - /* Load the whole ("middle") blocks only if there are more or equal one block */ - if (toread > mpq_a->blocksize) { - unsigned int blockbytes = toread & ~(mpq_a->blocksize - 1); - loaded = libmpq_file_read_block(mpq_a, mpq_f, blockpos, buffer, blockbytes); - if (loaded == 0) { - return 0; - } + /* Load the whole ("middle") blocks only if there are more or equal one block */ + if (toread > mpq_a->blocksize) { + unsigned int blockbytes = toread & ~(mpq_a->blocksize - 1); + loaded = libmpq_file_read_block(mpq_a, mpq_f, blockpos, buffer, blockbytes); + if (loaded == 0) { + return 0; + } - /* Update pointers */ - toread -= loaded; - bytesread += loaded; - buffer += loaded; - blockpos += loaded; + /* Update pointers */ + toread -= loaded; + bytesread += loaded; + buffer += loaded; + blockpos += loaded; - /* If all, return. */ - if (toread == 0) { - return bytesread; - } - } + /* If all, return. */ + if (toread == 0) { + return bytesread; + } + } - /* Load the terminating block */ - if (toread > 0) { - unsigned int tocopy = mpq_a->blocksize; + /* Load the terminating block */ + if (toread > 0) { + unsigned int tocopy = mpq_a->blocksize; - /* Check if data are loaded in the cache */ - if (mpq_f->accessed == FALSE || blockpos != mpq_a->blockpos) { + /* Check if data are loaded in the cache */ + if (mpq_f->accessed == FALSE || blockpos != mpq_a->blockpos) { - /* Load one MPQ block into archive buffer */ - tocopy = libmpq_file_read_block(mpq_a, mpq_f, blockpos, (char *)mpq_a->blockbuf, mpq_a->blocksize); - if (tocopy == 0) { - return 0; - } + /* Load one MPQ block into archive buffer */ + tocopy = libmpq_file_read_block(mpq_a, mpq_f, blockpos, (char *)mpq_a->blockbuf, mpq_a->blocksize); + if (tocopy == 0) { + return 0; + } - /* Save lastly accessed file and block position for later use */ - mpq_f->accessed = TRUE; - mpq_a->blockpos = blockpos; - } - mpq_a->bufpos = 0; + /* Save lastly accessed file and block position for later use */ + mpq_f->accessed = TRUE; + mpq_a->blockpos = blockpos; + } + mpq_a->bufpos = 0; - /* Check number of bytes read */ - if (tocopy > toread) { - tocopy = toread; - } + /* Check number of bytes read */ + if (tocopy > toread) { + tocopy = toread; + } - memcpy(buffer, mpq_a->blockbuf, tocopy); - bytesread += tocopy; - mpq_a->bufpos = tocopy; - } + memcpy(buffer, mpq_a->blockbuf, tocopy); + bytesread += tocopy; + mpq_a->bufpos = tocopy; + } - /* Return what we've read */ - return bytesread; + /* Return what we've read */ + return bytesread; } diff --git a/contrib/extractor/libmpq/common.h b/contrib/extractor/libmpq/common.h index 5794c162e10..517d959b346 100644 --- a/contrib/extractor/libmpq/common.h +++ b/contrib/extractor/libmpq/common.h @@ -20,33 +20,33 @@ * $Id: common.h,v 1.4 2004/02/12 00:41:55 mbroemme Exp $ */ -#define LIBMPQ_CONF_FL_INCREMENT 512 /* i hope we did not need more :) */ -#define LIBMPQ_CONF_EXT ".conf" /* listdb file seems to be valid with this extension */ -#define LIBMPQ_CONF_HEADER "LIBMPQ_VERSION" /* listdb file must include this entry to be valid */ -#define LIBMPQ_CONF_BUFSIZE 4096 /* maximum number of bytes a line in the file could contain */ +#define LIBMPQ_CONF_FL_INCREMENT 512 /* i hope we did not need more :) */ +#define LIBMPQ_CONF_EXT ".conf" /* listdb file seems to be valid with this extension */ +#define LIBMPQ_CONF_HEADER "LIBMPQ_VERSION" /* listdb file must include this entry to be valid */ +#define LIBMPQ_CONF_BUFSIZE 4096 /* maximum number of bytes a line in the file could contain */ -#define LIBMPQ_CONF_TYPE_CHAR 1 /* value in config file is from type char */ -#define LIBMPQ_CONF_TYPE_INT 2 /* value in config file is from type int */ +#define LIBMPQ_CONF_TYPE_CHAR 1 /* value in config file is from type char */ +#define LIBMPQ_CONF_TYPE_INT 2 /* value in config file is from type int */ -#define LIBMPQ_CONF_EOPEN_DIR -1 /* error on open directory */ -#define LIBMPQ_CONF_EVALUE_NOT_FOUND -2 /* value for the option was not found */ +#define LIBMPQ_CONF_EOPEN_DIR -1 /* error on open directory */ +#define LIBMPQ_CONF_EVALUE_NOT_FOUND -2 /* value for the option was not found */ #if defined( __GNUC__ ) - #include - #include + #include + #include - #define _lseek lseek - #define _read read - #define _open open - #define _write write - #define _close close - #define _strdup strdup + #define _lseek lseek + #define _read read + #define _open open + #define _write write + #define _close close + #define _strdup strdup - #ifndef O_BINARY - #define O_BINARY 0 - #endif + #ifndef O_BINARY + #define O_BINARY 0 + #endif #else - #include + #include #endif #ifdef O_LARGEFILE @@ -56,7 +56,7 @@ #endif #ifndef min - #define min(a, b) ((a < b) ? a : b) + #define min(a, b) ((a < b) ? a : b) #endif int libmpq_init_buffer(mpq_archive *mpq_a); diff --git a/contrib/extractor/libmpq/explode.cpp b/contrib/extractor/libmpq/explode.cpp index bcf9e7857a2..1401dd4ad5f 100644 --- a/contrib/extractor/libmpq/explode.cpp +++ b/contrib/extractor/libmpq/explode.cpp @@ -31,88 +31,88 @@ /* Tables */ static unsigned char pkzip_dist_bits[] = { - 0x02, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 + 0x02, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 }; static unsigned char pkzip_dist_code[] = { - 0x03, 0x0D, 0x05, 0x19, 0x09, 0x11, 0x01, 0x3E, 0x1E, 0x2E, 0x0E, 0x36, 0x16, 0x26, 0x06, 0x3A, - 0x1A, 0x2A, 0x0A, 0x32, 0x12, 0x22, 0x42, 0x02, 0x7C, 0x3C, 0x5C, 0x1C, 0x6C, 0x2C, 0x4C, 0x0C, - 0x74, 0x34, 0x54, 0x14, 0x64, 0x24, 0x44, 0x04, 0x78, 0x38, 0x58, 0x18, 0x68, 0x28, 0x48, 0x08, - 0xF0, 0x70, 0xB0, 0x30, 0xD0, 0x50, 0x90, 0x10, 0xE0, 0x60, 0xA0, 0x20, 0xC0, 0x40, 0x80, 0x00 + 0x03, 0x0D, 0x05, 0x19, 0x09, 0x11, 0x01, 0x3E, 0x1E, 0x2E, 0x0E, 0x36, 0x16, 0x26, 0x06, 0x3A, + 0x1A, 0x2A, 0x0A, 0x32, 0x12, 0x22, 0x42, 0x02, 0x7C, 0x3C, 0x5C, 0x1C, 0x6C, 0x2C, 0x4C, 0x0C, + 0x74, 0x34, 0x54, 0x14, 0x64, 0x24, 0x44, 0x04, 0x78, 0x38, 0x58, 0x18, 0x68, 0x28, 0x48, 0x08, + 0xF0, 0x70, 0xB0, 0x30, 0xD0, 0x50, 0x90, 0x10, 0xE0, 0x60, 0xA0, 0x20, 0xC0, 0x40, 0x80, 0x00 }; static unsigned char pkzip_clen_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 }; static unsigned short pkzip_len_base[] = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x000A, 0x000E, 0x0016, 0x0026, 0x0046, 0x0086, 0x0106 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x000A, 0x000E, 0x0016, 0x0026, 0x0046, 0x0086, 0x0106 }; static unsigned char pkzip_slen_bits[] = { - 0x03, 0x02, 0x03, 0x03, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x07, 0x07 + 0x03, 0x02, 0x03, 0x03, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x07, 0x07 }; static unsigned char pkzip_len_code[] = { - 0x05, 0x03, 0x01, 0x06, 0x0A, 0x02, 0x0C, 0x14, 0x04, 0x18, 0x08, 0x30, 0x10, 0x20, 0x40, 0x00 + 0x05, 0x03, 0x01, 0x06, 0x0A, 0x02, 0x0C, 0x14, 0x04, 0x18, 0x08, 0x30, 0x10, 0x20, 0x40, 0x00 }; static unsigned char pkzip_bits_asc[] = { - 0x0B, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x08, 0x07, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, - 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0D, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, - 0x04, 0x0A, 0x08, 0x0C, 0x0A, 0x0C, 0x0A, 0x08, 0x07, 0x07, 0x08, 0x09, 0x07, 0x06, 0x07, 0x08, - 0x07, 0x06, 0x07, 0x07, 0x07, 0x07, 0x08, 0x07, 0x07, 0x08, 0x08, 0x0C, 0x0B, 0x07, 0x09, 0x0B, - 0x0C, 0x06, 0x07, 0x06, 0x06, 0x05, 0x07, 0x08, 0x08, 0x06, 0x0B, 0x09, 0x06, 0x07, 0x06, 0x06, - 0x07, 0x0B, 0x06, 0x06, 0x06, 0x07, 0x09, 0x08, 0x09, 0x09, 0x0B, 0x08, 0x0B, 0x09, 0x0C, 0x08, - 0x0C, 0x05, 0x06, 0x06, 0x06, 0x05, 0x06, 0x06, 0x06, 0x05, 0x0B, 0x07, 0x05, 0x06, 0x05, 0x05, - 0x06, 0x0A, 0x05, 0x05, 0x05, 0x05, 0x08, 0x07, 0x08, 0x08, 0x0A, 0x0B, 0x0B, 0x0C, 0x0C, 0x0C, - 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, - 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, - 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, - 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, - 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, - 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, - 0x0D, 0x0C, 0x0D, 0x0D, 0x0D, 0x0C, 0x0D, 0x0D, 0x0D, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D, 0x0C, 0x0D, - 0x0D, 0x0D, 0x0C, 0x0C, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D + 0x0B, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x08, 0x07, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0D, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, + 0x04, 0x0A, 0x08, 0x0C, 0x0A, 0x0C, 0x0A, 0x08, 0x07, 0x07, 0x08, 0x09, 0x07, 0x06, 0x07, 0x08, + 0x07, 0x06, 0x07, 0x07, 0x07, 0x07, 0x08, 0x07, 0x07, 0x08, 0x08, 0x0C, 0x0B, 0x07, 0x09, 0x0B, + 0x0C, 0x06, 0x07, 0x06, 0x06, 0x05, 0x07, 0x08, 0x08, 0x06, 0x0B, 0x09, 0x06, 0x07, 0x06, 0x06, + 0x07, 0x0B, 0x06, 0x06, 0x06, 0x07, 0x09, 0x08, 0x09, 0x09, 0x0B, 0x08, 0x0B, 0x09, 0x0C, 0x08, + 0x0C, 0x05, 0x06, 0x06, 0x06, 0x05, 0x06, 0x06, 0x06, 0x05, 0x0B, 0x07, 0x05, 0x06, 0x05, 0x05, + 0x06, 0x0A, 0x05, 0x05, 0x05, 0x05, 0x08, 0x07, 0x08, 0x08, 0x0A, 0x0B, 0x0B, 0x0C, 0x0C, 0x0C, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, + 0x0D, 0x0C, 0x0D, 0x0D, 0x0D, 0x0C, 0x0D, 0x0D, 0x0D, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D, 0x0C, 0x0D, + 0x0D, 0x0D, 0x0C, 0x0C, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D }; static unsigned short pkzip_code_asc[] = { - 0x0490, 0x0FE0, 0x07E0, 0x0BE0, 0x03E0, 0x0DE0, 0x05E0, 0x09E0, - 0x01E0, 0x00B8, 0x0062, 0x0EE0, 0x06E0, 0x0022, 0x0AE0, 0x02E0, - 0x0CE0, 0x04E0, 0x08E0, 0x00E0, 0x0F60, 0x0760, 0x0B60, 0x0360, - 0x0D60, 0x0560, 0x1240, 0x0960, 0x0160, 0x0E60, 0x0660, 0x0A60, - 0x000F, 0x0250, 0x0038, 0x0260, 0x0050, 0x0C60, 0x0390, 0x00D8, - 0x0042, 0x0002, 0x0058, 0x01B0, 0x007C, 0x0029, 0x003C, 0x0098, - 0x005C, 0x0009, 0x001C, 0x006C, 0x002C, 0x004C, 0x0018, 0x000C, - 0x0074, 0x00E8, 0x0068, 0x0460, 0x0090, 0x0034, 0x00B0, 0x0710, - 0x0860, 0x0031, 0x0054, 0x0011, 0x0021, 0x0017, 0x0014, 0x00A8, - 0x0028, 0x0001, 0x0310, 0x0130, 0x003E, 0x0064, 0x001E, 0x002E, - 0x0024, 0x0510, 0x000E, 0x0036, 0x0016, 0x0044, 0x0030, 0x00C8, - 0x01D0, 0x00D0, 0x0110, 0x0048, 0x0610, 0x0150, 0x0060, 0x0088, - 0x0FA0, 0x0007, 0x0026, 0x0006, 0x003A, 0x001B, 0x001A, 0x002A, - 0x000A, 0x000B, 0x0210, 0x0004, 0x0013, 0x0032, 0x0003, 0x001D, - 0x0012, 0x0190, 0x000D, 0x0015, 0x0005, 0x0019, 0x0008, 0x0078, - 0x00F0, 0x0070, 0x0290, 0x0410, 0x0010, 0x07A0, 0x0BA0, 0x03A0, - 0x0240, 0x1C40, 0x0C40, 0x1440, 0x0440, 0x1840, 0x0840, 0x1040, - 0x0040, 0x1F80, 0x0F80, 0x1780, 0x0780, 0x1B80, 0x0B80, 0x1380, - 0x0380, 0x1D80, 0x0D80, 0x1580, 0x0580, 0x1980, 0x0980, 0x1180, - 0x0180, 0x1E80, 0x0E80, 0x1680, 0x0680, 0x1A80, 0x0A80, 0x1280, - 0x0280, 0x1C80, 0x0C80, 0x1480, 0x0480, 0x1880, 0x0880, 0x1080, - 0x0080, 0x1F00, 0x0F00, 0x1700, 0x0700, 0x1B00, 0x0B00, 0x1300, - 0x0DA0, 0x05A0, 0x09A0, 0x01A0, 0x0EA0, 0x06A0, 0x0AA0, 0x02A0, - 0x0CA0, 0x04A0, 0x08A0, 0x00A0, 0x0F20, 0x0720, 0x0B20, 0x0320, - 0x0D20, 0x0520, 0x0920, 0x0120, 0x0E20, 0x0620, 0x0A20, 0x0220, - 0x0C20, 0x0420, 0x0820, 0x0020, 0x0FC0, 0x07C0, 0x0BC0, 0x03C0, - 0x0DC0, 0x05C0, 0x09C0, 0x01C0, 0x0EC0, 0x06C0, 0x0AC0, 0x02C0, - 0x0CC0, 0x04C0, 0x08C0, 0x00C0, 0x0F40, 0x0740, 0x0B40, 0x0340, - 0x0300, 0x0D40, 0x1D00, 0x0D00, 0x1500, 0x0540, 0x0500, 0x1900, - 0x0900, 0x0940, 0x1100, 0x0100, 0x1E00, 0x0E00, 0x0140, 0x1600, - 0x0600, 0x1A00, 0x0E40, 0x0640, 0x0A40, 0x0A00, 0x1200, 0x0200, - 0x1C00, 0x0C00, 0x1400, 0x0400, 0x1800, 0x0800, 0x1000, 0x0000 + 0x0490, 0x0FE0, 0x07E0, 0x0BE0, 0x03E0, 0x0DE0, 0x05E0, 0x09E0, + 0x01E0, 0x00B8, 0x0062, 0x0EE0, 0x06E0, 0x0022, 0x0AE0, 0x02E0, + 0x0CE0, 0x04E0, 0x08E0, 0x00E0, 0x0F60, 0x0760, 0x0B60, 0x0360, + 0x0D60, 0x0560, 0x1240, 0x0960, 0x0160, 0x0E60, 0x0660, 0x0A60, + 0x000F, 0x0250, 0x0038, 0x0260, 0x0050, 0x0C60, 0x0390, 0x00D8, + 0x0042, 0x0002, 0x0058, 0x01B0, 0x007C, 0x0029, 0x003C, 0x0098, + 0x005C, 0x0009, 0x001C, 0x006C, 0x002C, 0x004C, 0x0018, 0x000C, + 0x0074, 0x00E8, 0x0068, 0x0460, 0x0090, 0x0034, 0x00B0, 0x0710, + 0x0860, 0x0031, 0x0054, 0x0011, 0x0021, 0x0017, 0x0014, 0x00A8, + 0x0028, 0x0001, 0x0310, 0x0130, 0x003E, 0x0064, 0x001E, 0x002E, + 0x0024, 0x0510, 0x000E, 0x0036, 0x0016, 0x0044, 0x0030, 0x00C8, + 0x01D0, 0x00D0, 0x0110, 0x0048, 0x0610, 0x0150, 0x0060, 0x0088, + 0x0FA0, 0x0007, 0x0026, 0x0006, 0x003A, 0x001B, 0x001A, 0x002A, + 0x000A, 0x000B, 0x0210, 0x0004, 0x0013, 0x0032, 0x0003, 0x001D, + 0x0012, 0x0190, 0x000D, 0x0015, 0x0005, 0x0019, 0x0008, 0x0078, + 0x00F0, 0x0070, 0x0290, 0x0410, 0x0010, 0x07A0, 0x0BA0, 0x03A0, + 0x0240, 0x1C40, 0x0C40, 0x1440, 0x0440, 0x1840, 0x0840, 0x1040, + 0x0040, 0x1F80, 0x0F80, 0x1780, 0x0780, 0x1B80, 0x0B80, 0x1380, + 0x0380, 0x1D80, 0x0D80, 0x1580, 0x0580, 0x1980, 0x0980, 0x1180, + 0x0180, 0x1E80, 0x0E80, 0x1680, 0x0680, 0x1A80, 0x0A80, 0x1280, + 0x0280, 0x1C80, 0x0C80, 0x1480, 0x0480, 0x1880, 0x0880, 0x1080, + 0x0080, 0x1F00, 0x0F00, 0x1700, 0x0700, 0x1B00, 0x0B00, 0x1300, + 0x0DA0, 0x05A0, 0x09A0, 0x01A0, 0x0EA0, 0x06A0, 0x0AA0, 0x02A0, + 0x0CA0, 0x04A0, 0x08A0, 0x00A0, 0x0F20, 0x0720, 0x0B20, 0x0320, + 0x0D20, 0x0520, 0x0920, 0x0120, 0x0E20, 0x0620, 0x0A20, 0x0220, + 0x0C20, 0x0420, 0x0820, 0x0020, 0x0FC0, 0x07C0, 0x0BC0, 0x03C0, + 0x0DC0, 0x05C0, 0x09C0, 0x01C0, 0x0EC0, 0x06C0, 0x0AC0, 0x02C0, + 0x0CC0, 0x04C0, 0x08C0, 0x00C0, 0x0F40, 0x0740, 0x0B40, 0x0340, + 0x0300, 0x0D40, 0x1D00, 0x0D00, 0x1500, 0x0540, 0x0500, 0x1900, + 0x0900, 0x0940, 0x1100, 0x0100, 0x1E00, 0x0E00, 0x0140, 0x1600, + 0x0600, 0x1A00, 0x0E40, 0x0640, 0x0A40, 0x0A00, 0x1200, 0x0200, + 0x1C00, 0x0C00, 0x1400, 0x0400, 0x1800, 0x0800, 0x1000, 0x0000 }; /* Local variables */ @@ -124,68 +124,68 @@ static char copyright[] = "PKWARE Data Compression Library for Win32\r\n" /* Local functions */ static void libmpq_pkzip_gen_decode_tabs(long count, unsigned char *bits, unsigned char *code, unsigned char *buf2) { - long i; + long i; - for (i = count-1; i >= 0; i--) { /* EBX - count */ - unsigned long idx1 = code[i]; - unsigned long idx2 = 1 << bits[i]; - do { - buf2[idx1] = (unsigned char)i; - idx1 += idx2; - } while (idx1 < 0x100); - } + for (i = count-1; i >= 0; i--) { /* EBX - count */ + unsigned long idx1 = code[i]; + unsigned long idx2 = 1 << bits[i]; + do { + buf2[idx1] = (unsigned char)i; + idx1 += idx2; + } while (idx1 < 0x100); + } } static void libmpq_pkzip_gen_asc_tabs(pkzip_data_cmp *mpq_pkzip) { - unsigned short *code_asc = &pkzip_code_asc[0xFF]; - unsigned long acc, add; - unsigned short count; + unsigned short *code_asc = &pkzip_code_asc[0xFF]; + unsigned long acc, add; + unsigned short count; - for (count = 0x00FF; code_asc >= pkzip_code_asc; code_asc--, count--) { - unsigned char *bits_asc = mpq_pkzip->bits_asc + count; - unsigned char bits_tmp = *bits_asc; + for (count = 0x00FF; code_asc >= pkzip_code_asc; code_asc--, count--) { + unsigned char *bits_asc = mpq_pkzip->bits_asc + count; + unsigned char bits_tmp = *bits_asc; - if (bits_tmp <= 8) { - add = (1 << bits_tmp); - acc = *code_asc; - do { - mpq_pkzip->offs_2c34[acc] = (unsigned char)count; - acc += add; - } while (acc < 0x100); - } else { - if ((acc = (*code_asc & 0xFF)) != 0) { - mpq_pkzip->offs_2c34[acc] = 0xFF; - if (*code_asc & 0x3F) { - bits_tmp -= 4; - *bits_asc = bits_tmp; - add = (1 << bits_tmp); - acc = *code_asc >> 4; - do { - mpq_pkzip->offs_2d34[acc] = (unsigned char)count; - acc += add; - } while (acc < 0x100); - } else { - bits_tmp -= 6; - *bits_asc = bits_tmp; - add = (1 << bits_tmp); - acc = *code_asc >> 6; - do { - mpq_pkzip->offs_2e34[acc] = (unsigned char)count; - acc += add; - } while (acc < 0x80); - } - } else { - bits_tmp -= 8; - *bits_asc = bits_tmp; - add = (1 << bits_tmp); - acc = *code_asc >> 8; - do { - mpq_pkzip->offs_2eb4[acc] = (unsigned char)count; - acc += add; - } while (acc < 0x100); - } - } - } + if (bits_tmp <= 8) { + add = (1 << bits_tmp); + acc = *code_asc; + do { + mpq_pkzip->offs_2c34[acc] = (unsigned char)count; + acc += add; + } while (acc < 0x100); + } else { + if ((acc = (*code_asc & 0xFF)) != 0) { + mpq_pkzip->offs_2c34[acc] = 0xFF; + if (*code_asc & 0x3F) { + bits_tmp -= 4; + *bits_asc = bits_tmp; + add = (1 << bits_tmp); + acc = *code_asc >> 4; + do { + mpq_pkzip->offs_2d34[acc] = (unsigned char)count; + acc += add; + } while (acc < 0x100); + } else { + bits_tmp -= 6; + *bits_asc = bits_tmp; + add = (1 << bits_tmp); + acc = *code_asc >> 6; + do { + mpq_pkzip->offs_2e34[acc] = (unsigned char)count; + acc += add; + } while (acc < 0x80); + } + } else { + bits_tmp -= 8; + *bits_asc = bits_tmp; + add = (1 << bits_tmp); + acc = *code_asc >> 8; + do { + mpq_pkzip->offs_2eb4[acc] = (unsigned char)count; + acc += add; + } while (acc < 0x100); + } + } + } } /* @@ -193,28 +193,28 @@ static void libmpq_pkzip_gen_asc_tabs(pkzip_data_cmp *mpq_pkzip) { * If no data in input buffer, returns true */ static int libmpq_pkzip_skip_bits(pkzip_data_cmp *mpq_pkzip, unsigned long bits) { - /* If number of bits required is less than number of (bits in the buffer) ? */ - if (bits <= mpq_pkzip->extra_bits) { - mpq_pkzip->extra_bits -= bits; - mpq_pkzip->bit_buf >>= bits; - return 0; - } + /* If number of bits required is less than number of (bits in the buffer) ? */ + if (bits <= mpq_pkzip->extra_bits) { + mpq_pkzip->extra_bits -= bits; + mpq_pkzip->bit_buf >>= bits; + return 0; + } - /* Load input buffer if necessary */ - mpq_pkzip->bit_buf >>= mpq_pkzip->extra_bits; - if (mpq_pkzip->in_pos == mpq_pkzip->in_bytes) { - mpq_pkzip->in_pos = sizeof(mpq_pkzip->in_buf); - if ((mpq_pkzip->in_bytes = mpq_pkzip->read_buf((char *)mpq_pkzip->in_buf, &mpq_pkzip->in_pos, mpq_pkzip->param)) == 0) { - return 1; - } - mpq_pkzip->in_pos = 0; - } + /* Load input buffer if necessary */ + mpq_pkzip->bit_buf >>= mpq_pkzip->extra_bits; + if (mpq_pkzip->in_pos == mpq_pkzip->in_bytes) { + mpq_pkzip->in_pos = sizeof(mpq_pkzip->in_buf); + if ((mpq_pkzip->in_bytes = mpq_pkzip->read_buf((char *)mpq_pkzip->in_buf, &mpq_pkzip->in_pos, mpq_pkzip->param)) == 0) { + return 1; + } + mpq_pkzip->in_pos = 0; + } - /* Update bit buffer */ - mpq_pkzip->bit_buf |= (mpq_pkzip->in_buf[mpq_pkzip->in_pos++] << 8); - mpq_pkzip->bit_buf >>= (bits - mpq_pkzip->extra_bits); - mpq_pkzip->extra_bits = (mpq_pkzip->extra_bits - bits) + 8; - return 0; + /* Update bit buffer */ + mpq_pkzip->bit_buf |= (mpq_pkzip->in_buf[mpq_pkzip->in_pos++] << 8); + mpq_pkzip->bit_buf >>= (bits - mpq_pkzip->extra_bits); + mpq_pkzip->extra_bits = (mpq_pkzip->extra_bits - bits) + 8; + return 0; } /* @@ -224,205 +224,205 @@ static int libmpq_pkzip_skip_bits(pkzip_data_cmp *mpq_pkzip, unsigned long bits) * 0x306 : Out of buffer (?) */ static unsigned long libmpq_pkzip_explode_lit(pkzip_data_cmp *mpq_pkzip) { - unsigned long bits; /* Number of bits to skip */ - unsigned long value; /* Position in buffers */ + unsigned long bits; /* Number of bits to skip */ + unsigned long value; /* Position in buffers */ - /* Test the current bit in byte buffer. If is not set, simply return the next byte. */ - if (mpq_pkzip->bit_buf & 1) { + /* Test the current bit in byte buffer. If is not set, simply return the next byte. */ + if (mpq_pkzip->bit_buf & 1) { - /* Skip current bit in the buffer. */ - if (libmpq_pkzip_skip_bits(mpq_pkzip, 1)) { - return 0x306; - } + /* Skip current bit in the buffer. */ + if (libmpq_pkzip_skip_bits(mpq_pkzip, 1)) { + return 0x306; + } - /* The next bits are position in buffers. */ - value = mpq_pkzip->pos2[(mpq_pkzip->bit_buf & 0xFF)]; + /* The next bits are position in buffers. */ + value = mpq_pkzip->pos2[(mpq_pkzip->bit_buf & 0xFF)]; - /* Get number of bits to skip */ - if (libmpq_pkzip_skip_bits(mpq_pkzip, mpq_pkzip->slen_bits[value])) { - return 0x306; - } - if ((bits = mpq_pkzip->clen_bits[value]) != 0) { - unsigned long val2 = mpq_pkzip->bit_buf & ((1 << bits) - 1); - if (libmpq_pkzip_skip_bits(mpq_pkzip, bits)) { - if ((value + val2) != 0x10E) { - return 0x306; - } - } - value = mpq_pkzip->len_base[value] + val2; - } - return value + 0x100; /* Return number of bytes to repeat */ - } + /* Get number of bits to skip */ + if (libmpq_pkzip_skip_bits(mpq_pkzip, mpq_pkzip->slen_bits[value])) { + return 0x306; + } + if ((bits = mpq_pkzip->clen_bits[value]) != 0) { + unsigned long val2 = mpq_pkzip->bit_buf & ((1 << bits) - 1); + if (libmpq_pkzip_skip_bits(mpq_pkzip, bits)) { + if ((value + val2) != 0x10E) { + return 0x306; + } + } + value = mpq_pkzip->len_base[value] + val2; + } + return value + 0x100; /* Return number of bytes to repeat */ + } - /* Skip one bit */ - if (libmpq_pkzip_skip_bits(mpq_pkzip, 1)) { - return 0x306; - } + /* Skip one bit */ + if (libmpq_pkzip_skip_bits(mpq_pkzip, 1)) { + return 0x306; + } - /* If the binary compression type, read 8 bits and return them as one byte. */ - if (mpq_pkzip->cmp_type == LIBMPQ_PKZIP_CMP_BINARY) { - value = mpq_pkzip->bit_buf & 0xFF; - if (libmpq_pkzip_skip_bits(mpq_pkzip, 8)) { - return 0x306; - } - return value; - } + /* If the binary compression type, read 8 bits and return them as one byte. */ + if (mpq_pkzip->cmp_type == LIBMPQ_PKZIP_CMP_BINARY) { + value = mpq_pkzip->bit_buf & 0xFF; + if (libmpq_pkzip_skip_bits(mpq_pkzip, 8)) { + return 0x306; + } + return value; + } - /* When ASCII compression ... */ - if (mpq_pkzip->bit_buf & 0xFF) { - value = mpq_pkzip->offs_2c34[mpq_pkzip->bit_buf & 0xFF]; - if (value == 0xFF) { - if (mpq_pkzip->bit_buf & 0x3F) { - if (libmpq_pkzip_skip_bits(mpq_pkzip, 4)) { - return 0x306; - } - value = mpq_pkzip->offs_2d34[mpq_pkzip->bit_buf & 0xFF]; - } else { - if (libmpq_pkzip_skip_bits(mpq_pkzip, 6)) { - return 0x306; - } - value = mpq_pkzip->offs_2e34[mpq_pkzip->bit_buf & 0x7F]; - } - } - } else { - if (libmpq_pkzip_skip_bits(mpq_pkzip, 8)) { - return 0x306; - } - value = mpq_pkzip->offs_2eb4[mpq_pkzip->bit_buf & 0xFF]; - } - return libmpq_pkzip_skip_bits(mpq_pkzip, mpq_pkzip->bits_asc[value]) ? 0x306 : value; + /* When ASCII compression ... */ + if (mpq_pkzip->bit_buf & 0xFF) { + value = mpq_pkzip->offs_2c34[mpq_pkzip->bit_buf & 0xFF]; + if (value == 0xFF) { + if (mpq_pkzip->bit_buf & 0x3F) { + if (libmpq_pkzip_skip_bits(mpq_pkzip, 4)) { + return 0x306; + } + value = mpq_pkzip->offs_2d34[mpq_pkzip->bit_buf & 0xFF]; + } else { + if (libmpq_pkzip_skip_bits(mpq_pkzip, 6)) { + return 0x306; + } + value = mpq_pkzip->offs_2e34[mpq_pkzip->bit_buf & 0x7F]; + } + } + } else { + if (libmpq_pkzip_skip_bits(mpq_pkzip, 8)) { + return 0x306; + } + value = mpq_pkzip->offs_2eb4[mpq_pkzip->bit_buf & 0xFF]; + } + return libmpq_pkzip_skip_bits(mpq_pkzip, mpq_pkzip->bits_asc[value]) ? 0x306 : value; } /* * Retrieves the number of bytes to move back. */ static unsigned long libmpq_pkzip_explode_dist(pkzip_data_cmp *mpq_pkzip, unsigned long length) { - unsigned long pos = mpq_pkzip->pos1[(mpq_pkzip->bit_buf & 0xFF)]; - unsigned long skip = mpq_pkzip->dist_bits[pos]; /* Number of bits to skip */ + unsigned long pos = mpq_pkzip->pos1[(mpq_pkzip->bit_buf & 0xFF)]; + unsigned long skip = mpq_pkzip->dist_bits[pos]; /* Number of bits to skip */ - /* Skip the appropriate number of bits */ - if (libmpq_pkzip_skip_bits(mpq_pkzip, skip) == 1) { - return 0; - } - if (length == 2) { - pos = (pos << 2) | (mpq_pkzip->bit_buf & 0x03); - if (libmpq_pkzip_skip_bits(mpq_pkzip, 2) == 1) { - return 0; - } - } else { - pos = (pos << mpq_pkzip->dsize_bits) | (mpq_pkzip->bit_buf & mpq_pkzip->dsize_mask); + /* Skip the appropriate number of bits */ + if (libmpq_pkzip_skip_bits(mpq_pkzip, skip) == 1) { + return 0; + } + if (length == 2) { + pos = (pos << 2) | (mpq_pkzip->bit_buf & 0x03); + if (libmpq_pkzip_skip_bits(mpq_pkzip, 2) == 1) { + return 0; + } + } else { + pos = (pos << mpq_pkzip->dsize_bits) | (mpq_pkzip->bit_buf & mpq_pkzip->dsize_mask); - /* Skip the bits */ - if (libmpq_pkzip_skip_bits(mpq_pkzip, mpq_pkzip->dsize_bits) == 1) { - return 0; - } - } - return pos + 1; + /* Skip the bits */ + if (libmpq_pkzip_skip_bits(mpq_pkzip, mpq_pkzip->dsize_bits) == 1) { + return 0; + } + } + return pos + 1; } static unsigned long libmpq_pkzip_expand(pkzip_data_cmp *mpq_pkzip) { - unsigned int copy_bytes; /* Number of bytes to copy */ - unsigned long one_byte; /* One byte from compressed file */ - unsigned long result; + unsigned int copy_bytes; /* Number of bytes to copy */ + unsigned long one_byte; /* One byte from compressed file */ + unsigned long result; - mpq_pkzip->out_pos = 0x1000; /* Initialize output buffer position */ + mpq_pkzip->out_pos = 0x1000; /* Initialize output buffer position */ - /* If end of data or error, terminate decompress */ - while ((result = one_byte = libmpq_pkzip_explode_lit(mpq_pkzip)) < 0x305) { + /* If end of data or error, terminate decompress */ + while ((result = one_byte = libmpq_pkzip_explode_lit(mpq_pkzip)) < 0x305) { - /* If one byte is greater than 0x100, means "Repeat n - 0xFE bytes" */ - if (one_byte >= 0x100) { - unsigned char *source; /* ECX */ - unsigned char *target; /* EDX */ - unsigned long copy_length = one_byte - 0xFE; - unsigned long move_back; + /* If one byte is greater than 0x100, means "Repeat n - 0xFE bytes" */ + if (one_byte >= 0x100) { + unsigned char *source; /* ECX */ + unsigned char *target; /* EDX */ + unsigned long copy_length = one_byte - 0xFE; + unsigned long move_back; - /* Get length of data to copy */ - if ((move_back = libmpq_pkzip_explode_dist(mpq_pkzip, copy_length)) == 0) { - result = 0x306; - break; - } + /* Get length of data to copy */ + if ((move_back = libmpq_pkzip_explode_dist(mpq_pkzip, copy_length)) == 0) { + result = 0x306; + break; + } - /* Target and source pointer */ - target = &mpq_pkzip->out_buf[mpq_pkzip->out_pos]; - source = target - move_back; - mpq_pkzip->out_pos += copy_length; - while (copy_length-- > 0) { - *target++ = *source++; - } - } else { - mpq_pkzip->out_buf[mpq_pkzip->out_pos++] = (unsigned char)one_byte; - } + /* Target and source pointer */ + target = &mpq_pkzip->out_buf[mpq_pkzip->out_pos]; + source = target - move_back; + mpq_pkzip->out_pos += copy_length; + while (copy_length-- > 0) { + *target++ = *source++; + } + } else { + mpq_pkzip->out_buf[mpq_pkzip->out_pos++] = (unsigned char)one_byte; + } - /* - * If number of extracted bytes has reached 1/2 of output buffer, - * flush output buffer. - */ - if (mpq_pkzip->out_pos >= 0x2000) { + /* + * If number of extracted bytes has reached 1/2 of output buffer, + * flush output buffer. + */ + if (mpq_pkzip->out_pos >= 0x2000) { - /* Copy decompressed data into user buffer. */ - copy_bytes = 0x1000; - mpq_pkzip->write_buf((char *)&mpq_pkzip->out_buf[0x1000], ©_bytes, mpq_pkzip->param); + /* Copy decompressed data into user buffer. */ + copy_bytes = 0x1000; + mpq_pkzip->write_buf((char *)&mpq_pkzip->out_buf[0x1000], ©_bytes, mpq_pkzip->param); - /* If there are some data left, keep them alive */ - memcpy(mpq_pkzip->out_buf, &mpq_pkzip->out_buf[0x1000], mpq_pkzip->out_pos - 0x1000); - mpq_pkzip->out_pos -= 0x1000; - } - } - copy_bytes = mpq_pkzip->out_pos - 0x1000; - mpq_pkzip->write_buf((char *)&mpq_pkzip->out_buf[0x1000], ©_bytes, mpq_pkzip->param); - return result; + /* If there are some data left, keep them alive */ + memcpy(mpq_pkzip->out_buf, &mpq_pkzip->out_buf[0x1000], mpq_pkzip->out_pos - 0x1000); + mpq_pkzip->out_pos -= 0x1000; + } + } + copy_bytes = mpq_pkzip->out_pos - 0x1000; + mpq_pkzip->write_buf((char *)&mpq_pkzip->out_buf[0x1000], ©_bytes, mpq_pkzip->param); + return result; } /* * Main exploding function. */ unsigned int libmpq_pkzip_explode( - unsigned int (*read_buf)(char *buf, unsigned int *size, void *param), - void (*write_buf)(char *buf, unsigned int *size, void *param), - char *work_buf, - void *param) { + unsigned int (*read_buf)(char *buf, unsigned int *size, void *param), + void (*write_buf)(char *buf, unsigned int *size, void *param), + char *work_buf, + void *param) { - pkzip_data_cmp *mpq_pkzip = (pkzip_data_cmp *)work_buf; + pkzip_data_cmp *mpq_pkzip = (pkzip_data_cmp *)work_buf; - /* Set the whole work buffer to zeros */ - memset(mpq_pkzip, 0, sizeof(pkzip_data_cmp)); + /* Set the whole work buffer to zeros */ + memset(mpq_pkzip, 0, sizeof(pkzip_data_cmp)); - /* Initialize work struct and load compressed data */ - mpq_pkzip->read_buf = read_buf; - mpq_pkzip->write_buf = write_buf; - mpq_pkzip->param = param; - mpq_pkzip->in_pos = sizeof(mpq_pkzip->in_buf); - mpq_pkzip->in_bytes = mpq_pkzip->read_buf((char *)mpq_pkzip->in_buf, &mpq_pkzip->in_pos, mpq_pkzip->param); - if (mpq_pkzip->in_bytes <= 4) { - return LIBMPQ_PKZIP_CMP_BAD_DATA; - } - mpq_pkzip->cmp_type = mpq_pkzip->in_buf[0]; /* Get the compression type */ - mpq_pkzip->dsize_bits = mpq_pkzip->in_buf[1]; /* Get the dictionary size */ - mpq_pkzip->bit_buf = mpq_pkzip->in_buf[2]; /* Initialize 16-bit bit buffer */ - mpq_pkzip->extra_bits = 0; /* Extra (over 8) bits */ - mpq_pkzip->in_pos = 3; /* Position in input buffer */ + /* Initialize work struct and load compressed data */ + mpq_pkzip->read_buf = read_buf; + mpq_pkzip->write_buf = write_buf; + mpq_pkzip->param = param; + mpq_pkzip->in_pos = sizeof(mpq_pkzip->in_buf); + mpq_pkzip->in_bytes = mpq_pkzip->read_buf((char *)mpq_pkzip->in_buf, &mpq_pkzip->in_pos, mpq_pkzip->param); + if (mpq_pkzip->in_bytes <= 4) { + return LIBMPQ_PKZIP_CMP_BAD_DATA; + } + mpq_pkzip->cmp_type = mpq_pkzip->in_buf[0]; /* Get the compression type */ + mpq_pkzip->dsize_bits = mpq_pkzip->in_buf[1]; /* Get the dictionary size */ + mpq_pkzip->bit_buf = mpq_pkzip->in_buf[2]; /* Initialize 16-bit bit buffer */ + mpq_pkzip->extra_bits = 0; /* Extra (over 8) bits */ + mpq_pkzip->in_pos = 3; /* Position in input buffer */ - /* Test for the valid dictionary size */ - if (4 > mpq_pkzip->dsize_bits || mpq_pkzip->dsize_bits > 6) { - return LIBMPQ_PKZIP_CMP_INV_DICTSIZE; - } - mpq_pkzip->dsize_mask = 0xFFFF >> (0x10 - mpq_pkzip->dsize_bits); /* Shifted by 'sar' instruction */ - if (mpq_pkzip->cmp_type != LIBMPQ_PKZIP_CMP_BINARY) { - if (mpq_pkzip->cmp_type != LIBMPQ_PKZIP_CMP_ASCII) { - return LIBMPQ_PKZIP_CMP_INV_MODE; - } - memcpy(mpq_pkzip->bits_asc, pkzip_bits_asc, sizeof(mpq_pkzip->bits_asc)); - libmpq_pkzip_gen_asc_tabs(mpq_pkzip); - } - memcpy(mpq_pkzip->slen_bits, pkzip_slen_bits, sizeof(mpq_pkzip->slen_bits)); - libmpq_pkzip_gen_decode_tabs(0x10, mpq_pkzip->slen_bits, pkzip_len_code, mpq_pkzip->pos2); - memcpy(mpq_pkzip->clen_bits, pkzip_clen_bits, sizeof(mpq_pkzip->clen_bits)); - memcpy(mpq_pkzip->len_base, pkzip_len_base, sizeof(mpq_pkzip->len_base)); - memcpy(mpq_pkzip->dist_bits, pkzip_dist_bits, sizeof(mpq_pkzip->dist_bits)); - libmpq_pkzip_gen_decode_tabs(0x40, mpq_pkzip->dist_bits, pkzip_dist_code, mpq_pkzip->pos1); - if (libmpq_pkzip_expand(mpq_pkzip) != 0x306) { - return LIBMPQ_PKZIP_CMP_NO_ERROR; - } - return LIBMPQ_PKZIP_CMP_ABORT; + /* Test for the valid dictionary size */ + if (4 > mpq_pkzip->dsize_bits || mpq_pkzip->dsize_bits > 6) { + return LIBMPQ_PKZIP_CMP_INV_DICTSIZE; + } + mpq_pkzip->dsize_mask = 0xFFFF >> (0x10 - mpq_pkzip->dsize_bits); /* Shifted by 'sar' instruction */ + if (mpq_pkzip->cmp_type != LIBMPQ_PKZIP_CMP_BINARY) { + if (mpq_pkzip->cmp_type != LIBMPQ_PKZIP_CMP_ASCII) { + return LIBMPQ_PKZIP_CMP_INV_MODE; + } + memcpy(mpq_pkzip->bits_asc, pkzip_bits_asc, sizeof(mpq_pkzip->bits_asc)); + libmpq_pkzip_gen_asc_tabs(mpq_pkzip); + } + memcpy(mpq_pkzip->slen_bits, pkzip_slen_bits, sizeof(mpq_pkzip->slen_bits)); + libmpq_pkzip_gen_decode_tabs(0x10, mpq_pkzip->slen_bits, pkzip_len_code, mpq_pkzip->pos2); + memcpy(mpq_pkzip->clen_bits, pkzip_clen_bits, sizeof(mpq_pkzip->clen_bits)); + memcpy(mpq_pkzip->len_base, pkzip_len_base, sizeof(mpq_pkzip->len_base)); + memcpy(mpq_pkzip->dist_bits, pkzip_dist_bits, sizeof(mpq_pkzip->dist_bits)); + libmpq_pkzip_gen_decode_tabs(0x40, mpq_pkzip->dist_bits, pkzip_dist_code, mpq_pkzip->pos1); + if (libmpq_pkzip_expand(mpq_pkzip) != 0x306) { + return LIBMPQ_PKZIP_CMP_NO_ERROR; + } + return LIBMPQ_PKZIP_CMP_ABORT; } diff --git a/contrib/extractor/libmpq/explode.h b/contrib/extractor/libmpq/explode.h index 1f916f778ae..d8b15868a39 100644 --- a/contrib/extractor/libmpq/explode.h +++ b/contrib/extractor/libmpq/explode.h @@ -27,60 +27,60 @@ #ifndef _EXPLODE_H #define _EXPLODE_H -#define LIBMPQ_PKZIP_EXP_BUFFER_SIZE 12596 /* Size of decompress buffer */ -#define LIBMPQ_PKZIP_CMP_BINARY 0 /* Binary compression */ -#define LIBMPQ_PKZIP_CMP_ASCII 1 /* Ascii compression */ -#define LIBMPQ_PKZIP_CMP_NO_ERROR 0 -#define LIBMPQ_PKZIP_CMP_INV_DICTSIZE 1 -#define LIBMPQ_PKZIP_CMP_INV_MODE 2 -#define LIBMPQ_PKZIP_CMP_BAD_DATA 3 -#define LIBMPQ_PKZIP_CMP_ABORT 4 +#define LIBMPQ_PKZIP_EXP_BUFFER_SIZE 12596 /* Size of decompress buffer */ +#define LIBMPQ_PKZIP_CMP_BINARY 0 /* Binary compression */ +#define LIBMPQ_PKZIP_CMP_ASCII 1 /* Ascii compression */ +#define LIBMPQ_PKZIP_CMP_NO_ERROR 0 +#define LIBMPQ_PKZIP_CMP_INV_DICTSIZE 1 +#define LIBMPQ_PKZIP_CMP_INV_MODE 2 +#define LIBMPQ_PKZIP_CMP_BAD_DATA 3 +#define LIBMPQ_PKZIP_CMP_ABORT 4 /* Compression structure (size: 12596 bytes on x86-32) */ typedef struct { - unsigned long offs0000; /* 0000 */ - unsigned long cmp_type; /* 0004 - Compression type (LIBMPQ_PZIP_CMP_BINARY or LIBMPQ_PKZIP_CMP_ASCII) */ - unsigned long out_pos; /* 0008 - Position in output buffer */ - unsigned long dsize_bits; /* 000C - Dict size (4, 5, 6 for 0x400, 0x800, 0x1000) */ - unsigned long dsize_mask; /* 0010 - Dict size bitmask (0x0F, 0x1F, 0x3F for 0x400, 0x800, 0x1000) */ - unsigned long bit_buf; /* 0014 - 16-bit buffer for processing input data */ - unsigned long extra_bits; /* 0018 - Number of extra (above 8) bits in bit buffer */ - unsigned int in_pos; /* 001C - Position in in_buf */ - unsigned long in_bytes; /* 0020 - Number of bytes in input buffer */ - void *param; /* 0024 - Custom parameter */ - unsigned int (*read_buf)(char *buf, unsigned int *size, void *param); /* 0028 */ - void (*write_buf)(char *buf, unsigned int *size, void *param); /* 002C */ - unsigned char out_buf[0x2000]; /* 0030 - Output circle buffer. Starting position is 0x1000 */ - unsigned char offs_2030[0x204]; /* 2030 - ??? */ - unsigned char in_buf[0x800]; /* 2234 - Buffer for data to be decompressed */ - unsigned char pos1[0x100]; /* 2A34 - Positions in buffers */ - unsigned char pos2[0x100]; /* 2B34 - Positions in buffers */ - unsigned char offs_2c34[0x100]; /* 2C34 - Buffer for */ - unsigned char offs_2d34[0x100]; /* 2D34 - Buffer for */ - unsigned char offs_2e34[0x80]; /* 2EB4 - Buffer for */ - unsigned char offs_2eb4[0x100]; /* 2EB4 - Buffer for */ - unsigned char bits_asc[0x100]; /* 2FB4 - Buffer for */ - unsigned char dist_bits[0x40]; /* 30B4 - Numbers of bytes to skip copied block length */ - unsigned char slen_bits[0x10]; /* 30F4 - Numbers of bits for skip copied block length */ - unsigned char clen_bits[0x10]; /* 3104 - Number of valid bits for copied block */ - unsigned short len_base[0x10]; /* 3114 - Buffer for */ + unsigned long offs0000; /* 0000 */ + unsigned long cmp_type; /* 0004 - Compression type (LIBMPQ_PZIP_CMP_BINARY or LIBMPQ_PKZIP_CMP_ASCII) */ + unsigned long out_pos; /* 0008 - Position in output buffer */ + unsigned long dsize_bits; /* 000C - Dict size (4, 5, 6 for 0x400, 0x800, 0x1000) */ + unsigned long dsize_mask; /* 0010 - Dict size bitmask (0x0F, 0x1F, 0x3F for 0x400, 0x800, 0x1000) */ + unsigned long bit_buf; /* 0014 - 16-bit buffer for processing input data */ + unsigned long extra_bits; /* 0018 - Number of extra (above 8) bits in bit buffer */ + unsigned int in_pos; /* 001C - Position in in_buf */ + unsigned long in_bytes; /* 0020 - Number of bytes in input buffer */ + void *param; /* 0024 - Custom parameter */ + unsigned int (*read_buf)(char *buf, unsigned int *size, void *param); /* 0028 */ + void (*write_buf)(char *buf, unsigned int *size, void *param); /* 002C */ + unsigned char out_buf[0x2000]; /* 0030 - Output circle buffer. Starting position is 0x1000 */ + unsigned char offs_2030[0x204]; /* 2030 - ??? */ + unsigned char in_buf[0x800]; /* 2234 - Buffer for data to be decompressed */ + unsigned char pos1[0x100]; /* 2A34 - Positions in buffers */ + unsigned char pos2[0x100]; /* 2B34 - Positions in buffers */ + unsigned char offs_2c34[0x100]; /* 2C34 - Buffer for */ + unsigned char offs_2d34[0x100]; /* 2D34 - Buffer for */ + unsigned char offs_2e34[0x80]; /* 2EB4 - Buffer for */ + unsigned char offs_2eb4[0x100]; /* 2EB4 - Buffer for */ + unsigned char bits_asc[0x100]; /* 2FB4 - Buffer for */ + unsigned char dist_bits[0x40]; /* 30B4 - Numbers of bytes to skip copied block length */ + unsigned char slen_bits[0x10]; /* 30F4 - Numbers of bits for skip copied block length */ + unsigned char clen_bits[0x10]; /* 3104 - Number of valid bits for copied block */ + unsigned short len_base[0x10]; /* 3114 - Buffer for */ } pkzip_data_cmp; // __attribute__ ((packed)) pkzip_data_cmp; typedef struct { - char *in_buf; /* Pointer to input data buffer */ - unsigned int in_pos; /* Current offset in input data buffer */ - int in_bytes; /* Number of bytes in the input buffer */ - char *out_buf; /* Pointer to output data buffer */ - unsigned int out_pos; /* Position in the output buffer */ - int max_out; /* Maximum number of bytes in the output buffer */ + char *in_buf; /* Pointer to input data buffer */ + unsigned int in_pos; /* Current offset in input data buffer */ + int in_bytes; /* Number of bytes in the input buffer */ + char *out_buf; /* Pointer to output data buffer */ + unsigned int out_pos; /* Position in the output buffer */ + int max_out; /* Maximum number of bytes in the output buffer */ } pkzip_data; extern unsigned int libmpq_pkzip_explode( - unsigned int (*read_buf)(char *buf, unsigned int *size, void *param), - void (*write_buf)(char *buf, unsigned int *size, void *param), - char *work_buf, - void *param + unsigned int (*read_buf)(char *buf, unsigned int *size, void *param), + void (*write_buf)(char *buf, unsigned int *size, void *param), + char *work_buf, + void *param ); -#endif /* _EXPLODE_H */ +#endif /* _EXPLODE_H */ diff --git a/contrib/extractor/libmpq/extract.cpp b/contrib/extractor/libmpq/extract.cpp index 41472b3c426..21043b75ae8 100644 --- a/contrib/extractor/libmpq/extract.cpp +++ b/contrib/extractor/libmpq/extract.cpp @@ -50,20 +50,20 @@ * void * param - Custom pointer, parameter of implode/explode */ static unsigned int libmpq_pkzip_read_input_data(char *buf, unsigned int *size, void *param) { - pkzip_data *info = (pkzip_data *)param; - unsigned int max_avail = (info->in_bytes - info->in_pos); - unsigned int to_read = *size; + pkzip_data *info = (pkzip_data *)param; + unsigned int max_avail = (info->in_bytes - info->in_pos); + unsigned int to_read = *size; - /* Check the case when not enough data available */ - if (to_read > max_avail) { - to_read = max_avail; - } + /* Check the case when not enough data available */ + if (to_read > max_avail) { + to_read = max_avail; + } - /* Load data and increment offsets */ - memcpy(buf, info->in_buf + info->in_pos, to_read); - info->in_pos += to_read; + /* Load data and increment offsets */ + memcpy(buf, info->in_buf + info->in_pos, to_read); + info->in_pos += to_read; - return to_read; + return to_read; } /* @@ -77,76 +77,76 @@ static unsigned int libmpq_pkzip_read_input_data(char *buf, unsigned int *size, * void * param - Custom pointer, parameter of implode/explode */ static void libmpq_pkzip_write_output_data(char *buf, unsigned int *size, void *param) { - pkzip_data *info = (pkzip_data *)param; - unsigned int max_write = (info->max_out - info->out_pos); - unsigned int to_write = *size; + pkzip_data *info = (pkzip_data *)param; + unsigned int max_write = (info->max_out - info->out_pos); + unsigned int to_write = *size; - /* Check the case when not enough space in the output buffer */ - if (to_write > max_write) { - to_write = max_write; - } + /* Check the case when not enough space in the output buffer */ + if (to_write > max_write) { + to_write = max_write; + } - /* Write output data and increments offsets */ - memcpy(info->out_buf + info->out_pos, buf, to_write); - info->out_pos += to_write; + /* Write output data and increments offsets */ + memcpy(info->out_buf + info->out_pos, buf, to_write); + info->out_pos += to_write; } int libmpq_pkzip_decompress(char *out_buf, int *out_length, char *in_buf, int in_length) { - pkzip_data info; /* Data information */ - char *work_buf = (char *)malloc(LIBMPQ_PKZIP_EXP_BUFFER_SIZE); /* mpq_pkzip work buffer */ + pkzip_data info; /* Data information */ + char *work_buf = (char *)malloc(LIBMPQ_PKZIP_EXP_BUFFER_SIZE); /* mpq_pkzip work buffer */ - /* Fill data information structure */ - info.in_buf = in_buf; - info.in_pos = 0; - info.in_bytes = in_length; - info.out_buf = out_buf; - info.out_pos = 0; - info.max_out = *out_length; + /* Fill data information structure */ + info.in_buf = in_buf; + info.in_pos = 0; + info.in_bytes = in_length; + info.out_buf = out_buf; + info.out_pos = 0; + info.max_out = *out_length; - /* Do the decompression */ - libmpq_pkzip_explode(libmpq_pkzip_read_input_data, libmpq_pkzip_write_output_data, work_buf, &info); - *out_length = info.out_pos; - free(work_buf); - return 0; + /* Do the decompression */ + libmpq_pkzip_explode(libmpq_pkzip_read_input_data, libmpq_pkzip_write_output_data, work_buf, &info); + *out_length = info.out_pos; + free(work_buf); + return 0; } int libmpq_wave_decompress_mono(char *out_buf, int *out_length, char *in_buf, int in_length) { - *out_length = libmpq_wave_decompress((unsigned char *)out_buf, *out_length, (unsigned char *)in_buf, in_length, 1); - return 1; + *out_length = libmpq_wave_decompress((unsigned char *)out_buf, *out_length, (unsigned char *)in_buf, in_length, 1); + return 1; } int libmpq_wave_decompress_stereo(char *out_buf, int *out_length, char *in_buf, int in_length) { - *out_length = libmpq_wave_decompress((unsigned char *)out_buf, *out_length, (unsigned char *)in_buf, in_length, 2); - return 1; + *out_length = libmpq_wave_decompress((unsigned char *)out_buf, *out_length, (unsigned char *)in_buf, in_length, 2); + return 1; } int libmpq_zlib_decompress(char *out_buf, int *out_length, char *in_buf, int in_length) { #ifdef HAVE_LIBZ - z_stream z; /* Stream information for zlib */ - int result; + z_stream z; /* Stream information for zlib */ + int result; - /* Fill the stream structure for zlib */ - z.next_in = (Bytef *)in_buf; - z.avail_in = (uInt)in_length; - z.total_in = in_length; - z.next_out = (Bytef *)out_buf; - z.avail_out = *out_length; - z.total_out = 0; - z.zalloc = NULL; - z.zfree = NULL; + /* Fill the stream structure for zlib */ + z.next_in = (Bytef *)in_buf; + z.avail_in = (uInt)in_length; + z.total_in = in_length; + z.next_out = (Bytef *)out_buf; + z.avail_out = *out_length; + z.total_out = 0; + z.zalloc = NULL; + z.zfree = NULL; - /* Initialize the decompression structure. Storm.dll uses zlib version 1.1.3 */ - if ((result = inflateInit(&z)) == 0) { + /* Initialize the decompression structure. Storm.dll uses zlib version 1.1.3 */ + if ((result = inflateInit(&z)) == 0) { - /* Call zlib to decompress the data */ - result = inflate(&z, Z_FINISH); - *out_length = z.total_out; - inflateEnd(&z); - } - return result; + /* Call zlib to decompress the data */ + result = inflate(&z, Z_FINISH); + *out_length = z.total_out; + inflateEnd(&z); + } + return result; #else - memset(out_buf, '0', *out_length); - return 0; + memset(out_buf, '0', *out_length); + return 0; #endif } @@ -157,106 +157,106 @@ int libmpq_zlib_decompress(char *out_buf, int *out_length, char *in_buf, int in_ * 1500F5F0 */ int libmpq_huff_decompress(char *out_buf, int *out_length, char *in_buf, int in_length) { - struct huffman_tree *ht = (huffman_tree *)malloc(sizeof(struct huffman_tree)); - struct huffman_input_stream *is = (huffman_input_stream *)malloc(sizeof(struct huffman_input_stream)); - struct huffman_tree_item *hi = (huffman_tree_item *)malloc(sizeof(struct huffman_tree_item)); - memset(ht, 0, sizeof(struct huffman_tree)); - memset(is, 0, sizeof(struct huffman_input_stream)); - memset(hi, 0, sizeof(struct huffman_tree_item)); + struct huffman_tree *ht = (huffman_tree *)malloc(sizeof(struct huffman_tree)); + struct huffman_input_stream *is = (huffman_input_stream *)malloc(sizeof(struct huffman_input_stream)); + struct huffman_tree_item *hi = (huffman_tree_item *)malloc(sizeof(struct huffman_tree_item)); + memset(ht, 0, sizeof(struct huffman_tree)); + memset(is, 0, sizeof(struct huffman_input_stream)); + memset(hi, 0, sizeof(struct huffman_tree_item)); - /* Initialize input stream */ - is->bit_buf = *(unsigned long *)in_buf; - in_buf += sizeof(unsigned long); - is->in_buf = (unsigned char *)in_buf; - is->bits = 32; + /* Initialize input stream */ + is->bit_buf = *(unsigned long *)in_buf; + in_buf += sizeof(unsigned long); + is->in_buf = (unsigned char *)in_buf; + is->bits = 32; - /* Initialize the Huffmann tree for decompression */ - libmpq_huff_init_tree(ht, hi, LIBMPQ_HUFF_DECOMPRESS); + /* Initialize the Huffmann tree for decompression */ + libmpq_huff_init_tree(ht, hi, LIBMPQ_HUFF_DECOMPRESS); - *out_length = libmpq_huff_do_decompress(ht, is, (unsigned char *)out_buf, *out_length); + *out_length = libmpq_huff_do_decompress(ht, is, (unsigned char *)out_buf, *out_length); - free(hi); - free(is); - free(ht); - return 0; + free(hi); + free(is); + free(ht); + return 0; } int libmpq_multi_decompress(char *out_buf, int *pout_length, char *in_buf, int in_length) { - char *temp_buf = NULL; /* Temporary storage for decompressed data */ - char *work_buf = NULL; /* Where to store decompressed data */ - int out_length = *pout_length; /* For storage number of output bytes */ - unsigned fDecompressions1; /* Decompressions applied to the block */ - unsigned fDecompressions2; /* Just another copy of decompressions applied to the block */ - int count = 0; /* Counter for every use */ - int entries = (sizeof(dcmp_table) / sizeof(decompress_table)); - int i; + char *temp_buf = NULL; /* Temporary storage for decompressed data */ + char *work_buf = NULL; /* Where to store decompressed data */ + int out_length = *pout_length; /* For storage number of output bytes */ + unsigned fDecompressions1; /* Decompressions applied to the block */ + unsigned fDecompressions2; /* Just another copy of decompressions applied to the block */ + int count = 0; /* Counter for every use */ + int entries = (sizeof(dcmp_table) / sizeof(decompress_table)); + int i; - /* If the input length is the same as output, do nothing. */ - if (in_length == out_length) { - if (in_buf == out_buf) { - return 1; - } - memcpy(out_buf, in_buf, in_length); - return 1; - } + /* If the input length is the same as output, do nothing. */ + if (in_length == out_length) { + if (in_buf == out_buf) { + return 1; + } + memcpy(out_buf, in_buf, in_length); + return 1; + } - /* Get applied compression types and decrement data length */ - fDecompressions1 = fDecompressions2 = (unsigned char)*in_buf++; - in_length--; + /* Get applied compression types and decrement data length */ + fDecompressions1 = fDecompressions2 = (unsigned char)*in_buf++; + in_length--; - /* Search decompression table type and get all types of compression */ - for (i = 0; i < entries; i++) { - /* We have to apply this decompression? */ - if (fDecompressions1 & dcmp_table[i].mask) { - count++; - } + /* Search decompression table type and get all types of compression */ + for (i = 0; i < entries; i++) { + /* We have to apply this decompression? */ + if (fDecompressions1 & dcmp_table[i].mask) { + count++; + } - /* Clear this flag from temporary variable. */ - fDecompressions2 &= ~dcmp_table[i].mask; - } + /* Clear this flag from temporary variable. */ + fDecompressions2 &= ~dcmp_table[i].mask; + } - /* - * Check if there is some method unhandled - * (E.g. compressed by future versions) - */ - if (fDecompressions2 != 0) { - printf("Unknown Compression\n"); - return 0; - } + /* + * Check if there is some method unhandled + * (E.g. compressed by future versions) + */ + if (fDecompressions2 != 0) { + printf("Unknown Compression\n"); + return 0; + } - /* If there is more than only one compression, we have to allocate extra buffer */ - if (count >= 2) { - temp_buf = (char *)malloc(out_length); - } + /* If there is more than only one compression, we have to allocate extra buffer */ + if (count >= 2) { + temp_buf = (char *)malloc(out_length); + } - /* Apply all decompressions */ - for (i = 0, count = 0; i < entries; i++) { + /* Apply all decompressions */ + for (i = 0, count = 0; i < entries; i++) { - /* If not used this kind of compression, skip the loop */ - if (fDecompressions1 & dcmp_table[i].mask) { + /* If not used this kind of compression, skip the loop */ + if (fDecompressions1 & dcmp_table[i].mask) { - /* If odd case, use target buffer for output, otherwise use allocated tempbuf */ - work_buf = (count++ & 1) ? temp_buf : out_buf; - out_length = *pout_length; + /* If odd case, use target buffer for output, otherwise use allocated tempbuf */ + work_buf = (count++ & 1) ? temp_buf : out_buf; + out_length = *pout_length; - /* Decompress buffer using corresponding function */ - dcmp_table[i].decompress(work_buf, &out_length, in_buf, in_length); + /* Decompress buffer using corresponding function */ + dcmp_table[i].decompress(work_buf, &out_length, in_buf, in_length); - /* Move output length to src length for next compression */ - in_length = out_length; - in_buf = work_buf; - } - } + /* Move output length to src length for next compression */ + in_length = out_length; + in_buf = work_buf; + } + } - /* If output buffer is not the same like target buffer, we have to copy data */ - if (work_buf != out_buf) { - memcpy(out_buf, in_buf, out_length); - } - *pout_length = out_length; + /* If output buffer is not the same like target buffer, we have to copy data */ + if (work_buf != out_buf) { + memcpy(out_buf, in_buf, out_length); + } + *pout_length = out_length; - /* Delete temporary buffer, if necessary */ - if (temp_buf != NULL) { - free(temp_buf); - } - return 1; + /* Delete temporary buffer, if necessary */ + if (temp_buf != NULL) { + free(temp_buf); + } + return 1; } diff --git a/contrib/extractor/libmpq/huffman.cpp b/contrib/extractor/libmpq/huffman.cpp index b63eee43e42..b126a887fd1 100644 --- a/contrib/extractor/libmpq/huffman.cpp +++ b/contrib/extractor/libmpq/huffman.cpp @@ -37,797 +37,797 @@ unsigned char table1502A630[] = { - /* Data for compression type 0x00 */ - 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x00, 0x00, + /* Data for compression type 0x00 */ + 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, - /* Data for compression type 0x01 */ - 0x54, 0x16, 0x16, 0x0D, 0x0C, 0x08, 0x06, 0x05, 0x06, 0x05, 0x06, 0x03, 0x04, 0x04, 0x03, 0x05, - 0x0E, 0x0B, 0x14, 0x13, 0x13, 0x09, 0x0B, 0x06, 0x05, 0x04, 0x03, 0x02, 0x03, 0x02, 0x02, 0x02, - 0x0D, 0x07, 0x09, 0x06, 0x06, 0x04, 0x03, 0x02, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, - 0x09, 0x06, 0x04, 0x04, 0x04, 0x04, 0x03, 0x02, 0x03, 0x02, 0x02, 0x02, 0x02, 0x03, 0x02, 0x04, - 0x08, 0x03, 0x04, 0x07, 0x09, 0x05, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x03, 0x02, 0x02, - 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, - 0x06, 0x0A, 0x08, 0x08, 0x06, 0x07, 0x04, 0x03, 0x04, 0x04, 0x02, 0x02, 0x04, 0x02, 0x03, 0x03, - 0x04, 0x03, 0x07, 0x07, 0x09, 0x06, 0x04, 0x03, 0x03, 0x02, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, - 0x0A, 0x02, 0x02, 0x03, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x06, 0x03, 0x05, 0x02, 0x03, - 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x03, 0x01, 0x01, 0x01, - 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x04, 0x04, 0x04, 0x07, 0x09, 0x08, 0x0C, 0x02, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x03, - 0x04, 0x01, 0x02, 0x04, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, - 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x06, 0x4B, - 0x00, 0x00, + /* Data for compression type 0x01 */ + 0x54, 0x16, 0x16, 0x0D, 0x0C, 0x08, 0x06, 0x05, 0x06, 0x05, 0x06, 0x03, 0x04, 0x04, 0x03, 0x05, + 0x0E, 0x0B, 0x14, 0x13, 0x13, 0x09, 0x0B, 0x06, 0x05, 0x04, 0x03, 0x02, 0x03, 0x02, 0x02, 0x02, + 0x0D, 0x07, 0x09, 0x06, 0x06, 0x04, 0x03, 0x02, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, + 0x09, 0x06, 0x04, 0x04, 0x04, 0x04, 0x03, 0x02, 0x03, 0x02, 0x02, 0x02, 0x02, 0x03, 0x02, 0x04, + 0x08, 0x03, 0x04, 0x07, 0x09, 0x05, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x03, 0x02, 0x02, + 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, + 0x06, 0x0A, 0x08, 0x08, 0x06, 0x07, 0x04, 0x03, 0x04, 0x04, 0x02, 0x02, 0x04, 0x02, 0x03, 0x03, + 0x04, 0x03, 0x07, 0x07, 0x09, 0x06, 0x04, 0x03, 0x03, 0x02, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x0A, 0x02, 0x02, 0x03, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x06, 0x03, 0x05, 0x02, 0x03, + 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x03, 0x01, 0x01, 0x01, + 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x04, 0x04, 0x04, 0x07, 0x09, 0x08, 0x0C, 0x02, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x03, + 0x04, 0x01, 0x02, 0x04, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, + 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x06, 0x4B, + 0x00, 0x00, - /* Data for compression type 0x02 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x27, 0x00, 0x00, 0x23, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x06, 0x0E, 0x10, 0x04, - 0x06, 0x08, 0x05, 0x04, 0x04, 0x03, 0x03, 0x02, 0x02, 0x03, 0x03, 0x01, 0x01, 0x02, 0x01, 0x01, - 0x01, 0x04, 0x02, 0x04, 0x02, 0x02, 0x02, 0x01, 0x01, 0x04, 0x01, 0x01, 0x02, 0x03, 0x03, 0x02, - 0x03, 0x01, 0x03, 0x06, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x02, 0x01, 0x01, - 0x01, 0x29, 0x07, 0x16, 0x12, 0x40, 0x0A, 0x0A, 0x11, 0x25, 0x01, 0x03, 0x17, 0x10, 0x26, 0x2A, - 0x10, 0x01, 0x23, 0x23, 0x2F, 0x10, 0x06, 0x07, 0x02, 0x09, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, + /* Data for compression type 0x02 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x27, 0x00, 0x00, 0x23, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x06, 0x0E, 0x10, 0x04, + 0x06, 0x08, 0x05, 0x04, 0x04, 0x03, 0x03, 0x02, 0x02, 0x03, 0x03, 0x01, 0x01, 0x02, 0x01, 0x01, + 0x01, 0x04, 0x02, 0x04, 0x02, 0x02, 0x02, 0x01, 0x01, 0x04, 0x01, 0x01, 0x02, 0x03, 0x03, 0x02, + 0x03, 0x01, 0x03, 0x06, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x02, 0x01, 0x01, + 0x01, 0x29, 0x07, 0x16, 0x12, 0x40, 0x0A, 0x0A, 0x11, 0x25, 0x01, 0x03, 0x17, 0x10, 0x26, 0x2A, + 0x10, 0x01, 0x23, 0x23, 0x2F, 0x10, 0x06, 0x07, 0x02, 0x09, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, - /* Data for compression type 0x03 */ - 0xFF, 0x0B, 0x07, 0x05, 0x0B, 0x02, 0x02, 0x02, 0x06, 0x02, 0x02, 0x01, 0x04, 0x02, 0x01, 0x03, - 0x09, 0x01, 0x01, 0x01, 0x03, 0x04, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, - 0x05, 0x01, 0x01, 0x01, 0x0D, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x02, 0x01, 0x01, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, - 0x0A, 0x04, 0x02, 0x01, 0x06, 0x03, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x01, - 0x05, 0x02, 0x03, 0x04, 0x03, 0x03, 0x03, 0x02, 0x01, 0x01, 0x01, 0x02, 0x01, 0x02, 0x03, 0x03, - 0x01, 0x03, 0x01, 0x01, 0x02, 0x05, 0x01, 0x01, 0x04, 0x03, 0x05, 0x01, 0x03, 0x01, 0x03, 0x03, - 0x02, 0x01, 0x04, 0x03, 0x0A, 0x06, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x02, 0x02, 0x01, 0x0A, 0x02, 0x05, 0x01, 0x01, 0x02, 0x07, 0x02, 0x17, 0x01, 0x05, 0x01, 0x01, - 0x0E, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x06, 0x02, 0x01, 0x04, 0x05, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, - 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x11, - 0x00, 0x00, + /* Data for compression type 0x03 */ + 0xFF, 0x0B, 0x07, 0x05, 0x0B, 0x02, 0x02, 0x02, 0x06, 0x02, 0x02, 0x01, 0x04, 0x02, 0x01, 0x03, + 0x09, 0x01, 0x01, 0x01, 0x03, 0x04, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, + 0x05, 0x01, 0x01, 0x01, 0x0D, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x02, 0x01, 0x01, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, + 0x0A, 0x04, 0x02, 0x01, 0x06, 0x03, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x01, + 0x05, 0x02, 0x03, 0x04, 0x03, 0x03, 0x03, 0x02, 0x01, 0x01, 0x01, 0x02, 0x01, 0x02, 0x03, 0x03, + 0x01, 0x03, 0x01, 0x01, 0x02, 0x05, 0x01, 0x01, 0x04, 0x03, 0x05, 0x01, 0x03, 0x01, 0x03, 0x03, + 0x02, 0x01, 0x04, 0x03, 0x0A, 0x06, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x02, 0x02, 0x01, 0x0A, 0x02, 0x05, 0x01, 0x01, 0x02, 0x07, 0x02, 0x17, 0x01, 0x05, 0x01, 0x01, + 0x0E, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x06, 0x02, 0x01, 0x04, 0x05, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, + 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x11, + 0x00, 0x00, - /* Data for compression type 0x04 */ - 0xFF, 0xFB, 0x98, 0x9A, 0x84, 0x85, 0x63, 0x64, 0x3E, 0x3E, 0x22, 0x22, 0x13, 0x13, 0x18, 0x17, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, + /* Data for compression type 0x04 */ + 0xFF, 0xFB, 0x98, 0x9A, 0x84, 0x85, 0x63, 0x64, 0x3E, 0x3E, 0x22, 0x22, 0x13, 0x13, 0x18, 0x17, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, - /* Data for compression type 0x05 */ - 0xFF, 0xF1, 0x9D, 0x9E, 0x9A, 0x9B, 0x9A, 0x97, 0x93, 0x93, 0x8C, 0x8E, 0x86, 0x88, 0x80, 0x82, - 0x7C, 0x7C, 0x72, 0x73, 0x69, 0x6B, 0x5F, 0x60, 0x55, 0x56, 0x4A, 0x4B, 0x40, 0x41, 0x37, 0x37, - 0x2F, 0x2F, 0x27, 0x27, 0x21, 0x21, 0x1B, 0x1C, 0x17, 0x17, 0x13, 0x13, 0x10, 0x10, 0x0D, 0x0D, - 0x0B, 0x0B, 0x09, 0x09, 0x08, 0x08, 0x07, 0x07, 0x06, 0x05, 0x05, 0x04, 0x04, 0x04, 0x19, 0x18, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, + /* Data for compression type 0x05 */ + 0xFF, 0xF1, 0x9D, 0x9E, 0x9A, 0x9B, 0x9A, 0x97, 0x93, 0x93, 0x8C, 0x8E, 0x86, 0x88, 0x80, 0x82, + 0x7C, 0x7C, 0x72, 0x73, 0x69, 0x6B, 0x5F, 0x60, 0x55, 0x56, 0x4A, 0x4B, 0x40, 0x41, 0x37, 0x37, + 0x2F, 0x2F, 0x27, 0x27, 0x21, 0x21, 0x1B, 0x1C, 0x17, 0x17, 0x13, 0x13, 0x10, 0x10, 0x0D, 0x0D, + 0x0B, 0x0B, 0x09, 0x09, 0x08, 0x08, 0x07, 0x07, 0x06, 0x05, 0x05, 0x04, 0x04, 0x04, 0x19, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, - /* Data for compression type 0x06 */ - 0xC3, 0xCB, 0xF5, 0x41, 0xFF, 0x7B, 0xF7, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xBF, 0xCC, 0xF2, 0x40, 0xFD, 0x7C, 0xF7, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7A, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, + /* Data for compression type 0x06 */ + 0xC3, 0xCB, 0xF5, 0x41, 0xFF, 0x7B, 0xF7, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xBF, 0xCC, 0xF2, 0x40, 0xFD, 0x7C, 0xF7, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7A, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, - /* Data for compression type 0x07 */ - 0xC3, 0xD9, 0xEF, 0x3D, 0xF9, 0x7C, 0xE9, 0x1E, 0xFD, 0xAB, 0xF1, 0x2C, 0xFC, 0x5B, 0xFE, 0x17, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xBD, 0xD9, 0xEC, 0x3D, 0xF5, 0x7D, 0xE8, 0x1D, 0xFB, 0xAE, 0xF0, 0x2C, 0xFB, 0x5C, 0xFF, 0x18, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x70, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, + /* Data for compression type 0x07 */ + 0xC3, 0xD9, 0xEF, 0x3D, 0xF9, 0x7C, 0xE9, 0x1E, 0xFD, 0xAB, 0xF1, 0x2C, 0xFC, 0x5B, 0xFE, 0x17, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xBD, 0xD9, 0xEC, 0x3D, 0xF5, 0x7D, 0xE8, 0x1D, 0xFB, 0xAE, 0xF0, 0x2C, 0xFB, 0x5C, 0xFF, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x70, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, - /* Data for compression type 0x08 */ - 0xBA, 0xC5, 0xDA, 0x33, 0xE3, 0x6D, 0xD8, 0x18, 0xE5, 0x94, 0xDA, 0x23, 0xDF, 0x4A, 0xD1, 0x10, - 0xEE, 0xAF, 0xE4, 0x2C, 0xEA, 0x5A, 0xDE, 0x15, 0xF4, 0x87, 0xE9, 0x21, 0xF6, 0x43, 0xFC, 0x12, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xB0, 0xC7, 0xD8, 0x33, 0xE3, 0x6B, 0xD6, 0x18, 0xE7, 0x95, 0xD8, 0x23, 0xDB, 0x49, 0xD0, 0x11, - 0xE9, 0xB2, 0xE2, 0x2B, 0xE8, 0x5C, 0xDD, 0x15, 0xF1, 0x87, 0xE7, 0x20, 0xF7, 0x44, 0xFF, 0x13, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x5F, 0x9E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00 + /* Data for compression type 0x08 */ + 0xBA, 0xC5, 0xDA, 0x33, 0xE3, 0x6D, 0xD8, 0x18, 0xE5, 0x94, 0xDA, 0x23, 0xDF, 0x4A, 0xD1, 0x10, + 0xEE, 0xAF, 0xE4, 0x2C, 0xEA, 0x5A, 0xDE, 0x15, 0xF4, 0x87, 0xE9, 0x21, 0xF6, 0x43, 0xFC, 0x12, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xB0, 0xC7, 0xD8, 0x33, 0xE3, 0x6B, 0xD6, 0x18, 0xE7, 0x95, 0xD8, 0x23, 0xDB, 0x49, 0xD0, 0x11, + 0xE9, 0xB2, 0xE2, 0x2B, 0xE8, 0x5C, 0xDD, 0x15, 0xF1, 0x87, 0xE7, 0x20, 0xF7, 0x44, 0xFF, 0x13, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x5F, 0x9E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 }; /* Gets previous Huffman tree item (?) */ struct huffman_tree_item *libmpq_huff_get_prev_item(struct huffman_tree_item *hi, long value) { - if (PTR_INT(hi->prev) < 0) { - return PTR_NOT(hi->prev); - } - if (value < 0) { - value = hi - hi->next->prev; - } - return hi->prev + value; + if (PTR_INT(hi->prev) < 0) { + return PTR_NOT(hi->prev); + } + if (value < 0) { + value = hi - hi->next->prev; + } + return hi->prev + value; } /* 1500BC90 */ static void libmpq_huff_remove_item(struct huffman_tree_item *hi) { - struct huffman_tree_item *temp; /* EDX */ + struct huffman_tree_item *temp; /* EDX */ - if (hi->next != NULL) { - temp = hi->prev; - if (PTR_INT(temp) <= 0) { - temp = PTR_NOT(temp); - } else { - temp += (hi - hi->next->prev); - } - temp->next = hi->next; - hi->next->prev = hi->prev; - hi->next = hi->prev = NULL; - } + if (hi->next != NULL) { + temp = hi->prev; + if (PTR_INT(temp) <= 0) { + temp = PTR_NOT(temp); + } else { + temp += (hi - hi->next->prev); + } + temp->next = hi->next; + hi->next->prev = hi->prev; + hi->next = hi->prev = NULL; + } } static void libmpq_huff_insert_item(struct huffman_tree_item **p_item, struct huffman_tree_item *item, unsigned long where, struct huffman_tree_item *item2) { - struct huffman_tree_item *next = item->next; /* EDI - next to the first item */ - struct huffman_tree_item *prev = item->prev; /* ESI - prev to the first item */ - struct huffman_tree_item *prev2; /* Pointer to previous item */ - long next2; /* Pointer to the next item */ + struct huffman_tree_item *next = item->next; /* EDI - next to the first item */ + struct huffman_tree_item *prev = item->prev; /* ESI - prev to the first item */ + struct huffman_tree_item *prev2; /* Pointer to previous item */ + long next2; /* Pointer to the next item */ - /* The same code like in mpq_huff_remove_item(); */ - if (next != 0) { /* If the first item already has next one */ - if (PTR_INT(prev) < 0) { - prev = PTR_NOT(prev); - } else { - prev += (item - next->prev); - } + /* The same code like in mpq_huff_remove_item(); */ + if (next != 0) { /* If the first item already has next one */ + if (PTR_INT(prev) < 0) { + prev = PTR_NOT(prev); + } else { + prev += (item - next->prev); + } - /* - * 150083C1 - * Remove the item from the tree - */ - prev->next = next; - next->prev = prev; + /* + * 150083C1 + * Remove the item from the tree + */ + prev->next = next; + next->prev = prev; - /* Invalidate 'prev' and 'next' pointer */ - item->next = 0; - item->prev = 0; - } + /* Invalidate 'prev' and 'next' pointer */ + item->next = 0; + item->prev = 0; + } - if (item2 == NULL) { /* EDX - If the second item is not entered, */ - item2 = PTR_PTR(&p_item[1]); /* take the first tree item */ - } + if (item2 == NULL) { /* EDX - If the second item is not entered, */ + item2 = PTR_PTR(&p_item[1]); /* take the first tree item */ + } - switch (where) { - case SWITCH_ITEMS: /* Switch the two items */ - item->next = item2->next; /* item2->next (Pointer to pointer to first) */ - item->prev = item2->next->prev; - item2->next->prev = item; - item2->next = item; /* Set the first item */ - return; - case INSERT_ITEM: /* Insert as the last item */ - item->next = item2; /* Set next item (or pointer to pointer to first item) */ - item->prev = item2->prev; /* Set prev item (or last item in the tree) */ - next2 = PTR_INT(p_item[0]); /* Usually NULL */ - prev2 = item2->prev; /* Prev item to the second (or last tree item) */ - if (PTR_INT(prev2) < 0) { - prev2 = PTR_NOT(prev); - prev2->next = item; - item2->prev = item; /* Next after last item */ - return; - } - if (next2 < 0) { - next2 = item2 - item2->next->prev; - } - prev2 += next2; - prev2->next = item; - item2->prev = item; /* Set the next/last item */ - return; - default: - return; - } + switch (where) { + case SWITCH_ITEMS: /* Switch the two items */ + item->next = item2->next; /* item2->next (Pointer to pointer to first) */ + item->prev = item2->next->prev; + item2->next->prev = item; + item2->next = item; /* Set the first item */ + return; + case INSERT_ITEM: /* Insert as the last item */ + item->next = item2; /* Set next item (or pointer to pointer to first item) */ + item->prev = item2->prev; /* Set prev item (or last item in the tree) */ + next2 = PTR_INT(p_item[0]); /* Usually NULL */ + prev2 = item2->prev; /* Prev item to the second (or last tree item) */ + if (PTR_INT(prev2) < 0) { + prev2 = PTR_NOT(prev); + prev2->next = item; + item2->prev = item; /* Next after last item */ + return; + } + if (next2 < 0) { + next2 = item2 - item2->next->prev; + } + prev2 += next2; + prev2->next = item; + item2->prev = item; /* Set the next/last item */ + return; + default: + return; + } } /* Builds Huffman tree. Called with the first 8 bits loaded from input stream. */ static void libmpq_huff_build_tree(struct huffman_tree *ht, unsigned int cmp_type) { - unsigned long max_byte; /* [ESP+10] - The greatest character found in table */ - unsigned char *byte_array; /* [ESP+1C] - Pointer to unsigned char in table1502A630 */ - unsigned long i; /* egcs in linux doesn't like multiple for loops without an explicit i */ - unsigned int found; /* Thats needed to replace the goto stuff from original source :) */ - struct huffman_tree_item **p_item; /* [ESP+14] - Pointer to Huffman tree item pointer array */ - struct huffman_tree_item *child1; + unsigned long max_byte; /* [ESP+10] - The greatest character found in table */ + unsigned char *byte_array; /* [ESP+1C] - Pointer to unsigned char in table1502A630 */ + unsigned long i; /* egcs in linux doesn't like multiple for loops without an explicit i */ + unsigned int found; /* Thats needed to replace the goto stuff from original source :) */ + struct huffman_tree_item **p_item; /* [ESP+14] - Pointer to Huffman tree item pointer array */ + struct huffman_tree_item *child1; - /* Loop while pointer has a negative value. */ - while (PTR_INT(ht->last) > 0) { /* ESI - Last entry */ - struct huffman_tree_item *temp; /* EAX */ - - if (ht->last->next != NULL) { /* ESI->next */ - libmpq_huff_remove_item(ht->last); - } - ht->item3058 = PTR_PTR(&ht->item3054);/* [EDI+4] */ - ht->last->prev = ht->item3058; /* EAX */ - temp = libmpq_huff_get_prev_item(PTR_PTR(&ht->item3054), PTR_INT(&ht->item3050)); - temp->next = ht->last; - ht->item3054 = ht->last; - } + /* Loop while pointer has a negative value. */ + while (PTR_INT(ht->last) > 0) { /* ESI - Last entry */ + struct huffman_tree_item *temp; /* EAX */ - /* Clear all pointers in huffman tree item array. */ - memset(ht->items306C, 0, sizeof(ht->items306C)); + if (ht->last->next != NULL) { /* ESI->next */ + libmpq_huff_remove_item(ht->last); + } + ht->item3058 = PTR_PTR(&ht->item3054);/* [EDI+4] */ + ht->last->prev = ht->item3058; /* EAX */ + temp = libmpq_huff_get_prev_item(PTR_PTR(&ht->item3054), PTR_INT(&ht->item3050)); + temp->next = ht->last; + ht->item3054 = ht->last; + } - max_byte = 0; /* Greatest character found init to zero. */ - p_item = (struct huffman_tree_item **)&ht->items306C; /* Pointer to current entry in huffman tree item pointer array */ + /* Clear all pointers in huffman tree item array. */ + memset(ht->items306C, 0, sizeof(ht->items306C)); - /* Ensure we have low 8 bits only */ - cmp_type &= 0xFF; - byte_array = table1502A630 + cmp_type * 258; /* EDI also */ + max_byte = 0; /* Greatest character found init to zero. */ + p_item = (struct huffman_tree_item **)&ht->items306C; /* Pointer to current entry in huffman tree item pointer array */ - for (i = 0; i < 0x100; i++, p_item++) { - struct huffman_tree_item *item = ht->item3058; /* Item to be created */ - struct huffman_tree_item *p_item3 = ht->item3058; - unsigned char one_byte = byte_array[i]; + /* Ensure we have low 8 bits only */ + cmp_type &= 0xFF; + byte_array = table1502A630 + cmp_type * 258; /* EDI also */ - /* Skip all the bytes which are zero. */ - if (byte_array[i] == 0) { - continue; - } + for (i = 0; i < 0x100; i++, p_item++) { + struct huffman_tree_item *item = ht->item3058; /* Item to be created */ + struct huffman_tree_item *p_item3 = ht->item3058; + unsigned char one_byte = byte_array[i]; - /* If not valid pointer, take the first available item in the array. */ - if (PTR_INT(item) <= 0) { - item = &ht->items0008[ht->items++]; - } + /* Skip all the bytes which are zero. */ + if (byte_array[i] == 0) { + continue; + } - /* Insert this item as the top of the tree. */ - libmpq_huff_insert_item(&ht->item305C, item, SWITCH_ITEMS, NULL); + /* If not valid pointer, take the first available item in the array. */ + if (PTR_INT(item) <= 0) { + item = &ht->items0008[ht->items++]; + } - item->parent = NULL; /* Invalidate child and parent */ - item->child = NULL; - *p_item = item; /* Store pointer into pointer array */ + /* Insert this item as the top of the tree. */ + libmpq_huff_insert_item(&ht->item305C, item, SWITCH_ITEMS, NULL); - item->dcmp_byte = i; /* Store counter */ - item->byte_value = one_byte; /* Store byte value */ - if (one_byte >= max_byte) { - max_byte = one_byte; - continue; - } + item->parent = NULL; /* Invalidate child and parent */ + item->child = NULL; + *p_item = item; /* Store pointer into pointer array */ - /* Find the first item which has byte value greater than current one byte */ - found = 0; - if (PTR_INT((p_item3 = ht->last)) > 0) {/* EDI - Pointer to the last item */ + item->dcmp_byte = i; /* Store counter */ + item->byte_value = one_byte; /* Store byte value */ + if (one_byte >= max_byte) { + max_byte = one_byte; + continue; + } - /* 15006AF7 */ - if (p_item3 != NULL) { - do { /* 15006AFB */ - if (p_item3->byte_value >= one_byte) { - found = 1; - break; - } - p_item3 = p_item3->prev; - } while (PTR_INT(p_item3) > 0); - } - } + /* Find the first item which has byte value greater than current one byte */ + found = 0; + if (PTR_INT((p_item3 = ht->last)) > 0) {/* EDI - Pointer to the last item */ - if (found == 0) { - p_item3 = NULL; - } + /* 15006AF7 */ + if (p_item3 != NULL) { + do { /* 15006AFB */ + if (p_item3->byte_value >= one_byte) { + found = 1; + break; + } + p_item3 = p_item3->prev; + } while (PTR_INT(p_item3) > 0); + } + } - /* 15006B09 */ - if (item->next != NULL) { - libmpq_huff_remove_item(item); - } + if (found == 0) { + p_item3 = NULL; + } - /* 15006B15 */ - if (p_item3 == NULL) { - p_item3 = PTR_PTR(&ht->first); - } + /* 15006B09 */ + if (item->next != NULL) { + libmpq_huff_remove_item(item); + } - /* 15006B1F */ - item->next = p_item3->next; - item->prev = p_item3->next->prev; - p_item3->next->prev = item; - p_item3->next = item; - } + /* 15006B15 */ + if (p_item3 == NULL) { + p_item3 = PTR_PTR(&ht->first); + } - /* 15006B4A */ - for (; i < 0x102; i++) { - struct huffman_tree_item **p_item2 = &ht->items306C[i]; /* EDI */ + /* 15006B1F */ + item->next = p_item3->next; + item->prev = p_item3->next->prev; + p_item3->next->prev = item; + p_item3->next = item; + } - /* 15006B59 */ - struct huffman_tree_item *item2 = ht->item3058; /* ESI */ - if (PTR_INT(item2) <= 0) { - item2 = &ht->items0008[ht->items++]; - } - libmpq_huff_insert_item(&ht->item305C, item2, INSERT_ITEM, NULL); + /* 15006B4A */ + for (; i < 0x102; i++) { + struct huffman_tree_item **p_item2 = &ht->items306C[i]; /* EDI */ - /* 15006B89 */ - item2->dcmp_byte = i; - item2->byte_value = 1; - item2->parent = NULL; - item2->child = NULL; - *p_item2++ = item2; - } + /* 15006B59 */ + struct huffman_tree_item *item2 = ht->item3058; /* ESI */ + if (PTR_INT(item2) <= 0) { + item2 = &ht->items0008[ht->items++]; + } + libmpq_huff_insert_item(&ht->item305C, item2, INSERT_ITEM, NULL); - /* 15006BAA */ - if (PTR_INT((child1 = ht->last)) > 0) { /* EDI - last item (first child to item */ - struct huffman_tree_item *child2; /* EBP */ - struct huffman_tree_item *item; /* ESI */ + /* 15006B89 */ + item2->dcmp_byte = i; + item2->byte_value = 1; + item2->parent = NULL; + item2->child = NULL; + *p_item2++ = item2; + } - /* 15006BB8 */ - while (PTR_INT((child2 = child1->prev)) > 0) { - if (PTR_INT((item = ht->item3058)) <= 0) { - item = &ht->items0008[ht->items++]; - } - /* 15006BE3 */ - libmpq_huff_insert_item(&ht->item305C, item, SWITCH_ITEMS, NULL); + /* 15006BAA */ + if (PTR_INT((child1 = ht->last)) > 0) { /* EDI - last item (first child to item */ + struct huffman_tree_item *child2; /* EBP */ + struct huffman_tree_item *item; /* ESI */ - /* 15006BF3 */ - item->parent = NULL; - item->child = NULL; + /* 15006BB8 */ + while (PTR_INT((child2 = child1->prev)) > 0) { + if (PTR_INT((item = ht->item3058)) <= 0) { + item = &ht->items0008[ht->items++]; + } + /* 15006BE3 */ + libmpq_huff_insert_item(&ht->item305C, item, SWITCH_ITEMS, NULL); - /* - * EDX = child2->byte_value + child1->byte_value; - * EAX = child1->byte_value; - * ECX = max_byte; The greatest character (0xFF usually) - */ - item->byte_value = child1->byte_value + child2->byte_value; /* 0x02 */ - item->child = child1; /* Prev item in the */ - child1->parent = item; - child2->parent = item; + /* 15006BF3 */ + item->parent = NULL; + item->child = NULL; - /* EAX = item->byte_value; */ - if (item->byte_value >= max_byte) { - max_byte = item->byte_value; - } else { - struct huffman_tree_item *p_item2 = child2->prev; /* EDI */ - found = 0; - if (PTR_INT(p_item2) > 0) { + /* + * EDX = child2->byte_value + child1->byte_value; + * EAX = child1->byte_value; + * ECX = max_byte; The greatest character (0xFF usually) + */ + item->byte_value = child1->byte_value + child2->byte_value; /* 0x02 */ + item->child = child1; /* Prev item in the */ + child1->parent = item; + child2->parent = item; - /* 15006C2D */ - do { - if (p_item2->byte_value >= item->byte_value) { - found = 1; - break; - } - p_item2 = p_item2->prev; - } while (PTR_INT(p_item2) > 0); - } - if (found == 0) { - p_item2 = NULL; - } - if (item->next != 0) { - struct huffman_tree_item *temp4 = libmpq_huff_get_prev_item(item, -1); - temp4->next = item->next; /* The first item changed */ - item->next->prev = item->prev; /* First->prev changed to negative value */ - item->next = NULL; - item->prev = NULL; - } + /* EAX = item->byte_value; */ + if (item->byte_value >= max_byte) { + max_byte = item->byte_value; + } else { + struct huffman_tree_item *p_item2 = child2->prev; /* EDI */ + found = 0; + if (PTR_INT(p_item2) > 0) { - /* 15006C62 */ - if (p_item2 == NULL) { - p_item2 = PTR_PTR(&ht->first); - } - item->next = p_item2->next; /* Set item with 0x100 byte value */ - item->prev = p_item2->next->prev; /* Set item with 0x17 byte value */ - p_item2->next->prev = item; /* Changed prev of item with */ - p_item2->next = item; - } + /* 15006C2D */ + do { + if (p_item2->byte_value >= item->byte_value) { + found = 1; + break; + } + p_item2 = p_item2->prev; + } while (PTR_INT(p_item2) > 0); + } + if (found == 0) { + p_item2 = NULL; + } + if (item->next != 0) { + struct huffman_tree_item *temp4 = libmpq_huff_get_prev_item(item, -1); + temp4->next = item->next; /* The first item changed */ + item->next->prev = item->prev; /* First->prev changed to negative value */ + item->next = NULL; + item->prev = NULL; + } - /* 15006C7B */ - if (PTR_INT((child1 = child2->prev)) <= 0) { - break; - } - } - } + /* 15006C62 */ + if (p_item2 == NULL) { + p_item2 = PTR_PTR(&ht->first); + } + item->next = p_item2->next; /* Set item with 0x100 byte value */ + item->prev = p_item2->next->prev; /* Set item with 0x17 byte value */ + p_item2->next->prev = item; /* Changed prev of item with */ + p_item2->next = item; + } - /* 15006C88 */ - ht->offs0004 = 1; + /* 15006C7B */ + if (PTR_INT((child1 = child2->prev)) <= 0) { + break; + } + } + } + + /* 15006C88 */ + ht->offs0004 = 1; } /* Gets the whole byte from the input stream. */ static unsigned long libmpq_huff_get_8bits(struct huffman_input_stream *is) { - unsigned long one_byte; + unsigned long one_byte; - if (is->bits <= 8) { - is->bit_buf |= *(unsigned short *)is->in_buf << is->bits; - is->in_buf += sizeof(unsigned short); - is->bits += 16; - } + if (is->bits <= 8) { + is->bit_buf |= *(unsigned short *)is->in_buf << is->bits; + is->in_buf += sizeof(unsigned short); + is->bits += 16; + } - one_byte = (is->bit_buf & 0xFF); - is->bit_buf >>= 8; - is->bits -= 8; + one_byte = (is->bit_buf & 0xFF); + is->bit_buf >>= 8; + is->bits -= 8; - return one_byte; + return one_byte; } /* Gets 7 bits from the stream. */ static unsigned long libmpq_huff_get_7bits(struct huffman_input_stream *is) { - if (is->bits <= 7) { - is->bit_buf |= *(unsigned short *)is->in_buf << is->bits; - is->in_buf += sizeof(unsigned short); - is->bits += 16; - } + if (is->bits <= 7) { + is->bit_buf |= *(unsigned short *)is->in_buf << is->bits; + is->in_buf += sizeof(unsigned short); + is->bits += 16; + } - /* Get 7 bits from input stream. */ - return (is->bit_buf & 0x7F); + /* Get 7 bits from input stream. */ + return (is->bit_buf & 0x7F); } /* Gets one bit from input stream. */ unsigned long libmpq_huff_get_bit(struct huffman_input_stream *is) { - unsigned long bit = (is->bit_buf & 1); + unsigned long bit = (is->bit_buf & 1); - is->bit_buf >>= 1; - if (--is->bits == 0) { - is->bit_buf = *(unsigned long *)is->in_buf; - is->in_buf += sizeof(unsigned long); - is->bits = 32; - } - return bit; + is->bit_buf >>= 1; + if (--is->bits == 0) { + is->bit_buf = *(unsigned long *)is->in_buf; + is->in_buf += sizeof(unsigned long); + is->bits = 32; + } + return bit; } static struct huffman_tree_item *libmpq_huff_call1500E740(struct huffman_tree *ht, unsigned int value) { - struct huffman_tree_item *p_item1 = ht->item3058; /* EDX */ - struct huffman_tree_item *p_item2; /* EAX */ - struct huffman_tree_item *p_next; - struct huffman_tree_item *p_prev; - struct huffman_tree_item **pp_item; + struct huffman_tree_item *p_item1 = ht->item3058; /* EDX */ + struct huffman_tree_item *p_item2; /* EAX */ + struct huffman_tree_item *p_next; + struct huffman_tree_item *p_prev; + struct huffman_tree_item **pp_item; - if (PTR_INT(p_item1) <= 0 || (p_item2 = p_item1) == NULL) { - if((p_item2 = &ht->items0008[ht->items++]) != NULL) { - p_item1 = p_item2; - } else { - p_item1 = ht->first; - } - } else { - p_item1 = p_item2; - } + if (PTR_INT(p_item1) <= 0 || (p_item2 = p_item1) == NULL) { + if((p_item2 = &ht->items0008[ht->items++]) != NULL) { + p_item1 = p_item2; + } else { + p_item1 = ht->first; + } + } else { + p_item1 = p_item2; + } - p_next = p_item1->next; - if (p_next != NULL) { - p_prev = p_item1->prev; - if (PTR_INT(p_prev) <= 0) { - p_prev = PTR_NOT(p_prev); - } else { - p_prev += (p_item1 - p_item1->next->prev); - } + p_next = p_item1->next; + if (p_next != NULL) { + p_prev = p_item1->prev; + if (PTR_INT(p_prev) <= 0) { + p_prev = PTR_NOT(p_prev); + } else { + p_prev += (p_item1 - p_item1->next->prev); + } - p_prev->next = p_next; - p_next->prev = p_prev; - p_item1->next = NULL; - p_item1->prev = NULL; - } - pp_item = &ht->first; /* ESI */ - if (value > 1) { + p_prev->next = p_next; + p_next->prev = p_prev; + p_item1->next = NULL; + p_item1->prev = NULL; + } + pp_item = &ht->first; /* ESI */ + if (value > 1) { - /* ECX = ht->first->next; */ - p_item1->next = *pp_item; - p_item1->prev = (*pp_item)->prev; + /* ECX = ht->first->next; */ + p_item1->next = *pp_item; + p_item1->prev = (*pp_item)->prev; - (*pp_item)->prev = p_item2; - *pp_item = p_item1; + (*pp_item)->prev = p_item2; + *pp_item = p_item1; - p_item2->parent = NULL; - p_item2->child = NULL; - } else { - p_item1->next = (struct huffman_tree_item *)pp_item; - p_item1->prev = pp_item[1]; - /* EDI = ht->item305C; */ - p_prev = pp_item[1]; /* ECX */ - if (p_prev <= 0) { - p_prev = PTR_NOT(p_prev); - p_prev->next = p_item1; - p_prev->prev = p_item2; + p_item2->parent = NULL; + p_item2->child = NULL; + } else { + p_item1->next = (struct huffman_tree_item *)pp_item; + p_item1->prev = pp_item[1]; + /* EDI = ht->item305C; */ + p_prev = pp_item[1]; /* ECX */ + if (p_prev <= 0) { + p_prev = PTR_NOT(p_prev); + p_prev->next = p_item1; + p_prev->prev = p_item2; - p_item2->parent = NULL; - p_item2->child = NULL; - } else { - if (PTR_INT(ht->item305C) < 0) { - p_prev += (struct huffman_tree_item *)pp_item - (*pp_item)->prev; - } else { - p_prev += PTR_INT(ht->item305C); - } + p_item2->parent = NULL; + p_item2->child = NULL; + } else { + if (PTR_INT(ht->item305C) < 0) { + p_prev += (struct huffman_tree_item *)pp_item - (*pp_item)->prev; + } else { + p_prev += PTR_INT(ht->item305C); + } - p_prev->next = p_item1; - pp_item[1] = p_item2; - p_item2->parent = NULL; - p_item2->child = NULL; - } - } - return p_item2; + p_prev->next = p_item1; + pp_item[1] = p_item2; + p_item2->parent = NULL; + p_item2->child = NULL; + } + } + return p_item2; } static void libmpq_huff_call1500E820(struct huffman_tree *ht, struct huffman_tree_item *p_item) { - struct huffman_tree_item *p_item1; /* EDI */ - struct huffman_tree_item *p_item2 = NULL; /* EAX */ - struct huffman_tree_item *p_item3; /* EDX */ - struct huffman_tree_item *p_prev; /* EBX */ + struct huffman_tree_item *p_item1; /* EDI */ + struct huffman_tree_item *p_item2 = NULL; /* EAX */ + struct huffman_tree_item *p_item3; /* EDX */ + struct huffman_tree_item *p_prev; /* EBX */ - for (; p_item != NULL; p_item = p_item->parent) { - p_item->byte_value++; + for (; p_item != NULL; p_item = p_item->parent) { + p_item->byte_value++; - for (p_item1 = p_item; ; p_item1 = p_prev) { - p_prev = p_item1->prev; - if (PTR_INT(p_prev) <= 0) { - p_prev = NULL; - break; - } - if (p_prev->byte_value >= p_item->byte_value) { - break; - } - } + for (p_item1 = p_item; ; p_item1 = p_prev) { + p_prev = p_item1->prev; + if (PTR_INT(p_prev) <= 0) { + p_prev = NULL; + break; + } + if (p_prev->byte_value >= p_item->byte_value) { + break; + } + } - if (p_item1 == p_item) { - continue; - } + if (p_item1 == p_item) { + continue; + } - if (p_item1->next != NULL) { - p_item2 = libmpq_huff_get_prev_item(p_item1, -1); - p_item2->next = p_item1->next; - p_item1->next->prev = p_item1->prev; - p_item1->next = NULL; - p_item1->prev = NULL; - } - p_item2 = p_item->next; - p_item1->next = p_item2; - p_item1->prev = p_item2->prev; - p_item2->prev = p_item1; - p_item->next = p_item1; - if ((p_item2 = p_item1) != NULL) { - p_item2 = libmpq_huff_get_prev_item(p_item, -1); - p_item2->next = p_item->next; - p_item->next->prev = p_item->prev; - p_item->next = NULL; - p_item->prev = NULL; - } + if (p_item1->next != NULL) { + p_item2 = libmpq_huff_get_prev_item(p_item1, -1); + p_item2->next = p_item1->next; + p_item1->next->prev = p_item1->prev; + p_item1->next = NULL; + p_item1->prev = NULL; + } + p_item2 = p_item->next; + p_item1->next = p_item2; + p_item1->prev = p_item2->prev; + p_item2->prev = p_item1; + p_item->next = p_item1; + if ((p_item2 = p_item1) != NULL) { + p_item2 = libmpq_huff_get_prev_item(p_item, -1); + p_item2->next = p_item->next; + p_item->next->prev = p_item->prev; + p_item->next = NULL; + p_item->prev = NULL; + } - if (p_prev == NULL) { - p_prev = PTR_PTR(&ht->first); - } - p_item2 = p_prev->next; - p_item->next = p_item2; - p_item->prev = p_item2->prev; - p_item2->prev = p_item; - p_prev->next = p_item; + if (p_prev == NULL) { + p_prev = PTR_PTR(&ht->first); + } + p_item2 = p_prev->next; + p_item->next = p_item2; + p_item->prev = p_item2->prev; + p_item2->prev = p_item; + p_prev->next = p_item; - p_item3 = p_item1->parent->child; - p_item2 = p_item->parent; - if (p_item2->child == p_item) { - p_item2->child = p_item1; - } + p_item3 = p_item1->parent->child; + p_item2 = p_item->parent; + if (p_item2->child == p_item) { + p_item2->child = p_item1; + } - if (p_item3 == p_item1) { - p_item1->parent->child = p_item; - } + if (p_item3 == p_item1) { + p_item1->parent->child = p_item; + } - p_item2 = p_item->parent; - p_item->parent = p_item1->parent; - p_item1->parent = p_item2; - ht->offs0004++; - } + p_item2 = p_item->parent; + p_item->parent = p_item1->parent; + p_item1->parent = p_item2; + ht->offs0004++; + } } int libmpq_huff_do_decompress(struct huffman_tree *ht, struct huffman_input_stream *is, unsigned char *out_buf, unsigned int out_length) { - unsigned int n8bits; /* 8 bits loaded from input stream */ - unsigned int n7bits; /* 7 bits loaded from input stream */ - unsigned int found; /* Thats needed to replace the goto stuff from original source :) */ - unsigned int dcmp_byte = 0; - unsigned long bit_count; - struct huffman_decompress *qd; - unsigned int has_qd; /* Can we use quick decompression? */ - struct huffman_tree_item *p_item1; - struct huffman_tree_item *p_item2; - unsigned char *out_pos = out_buf; + unsigned int n8bits; /* 8 bits loaded from input stream */ + unsigned int n7bits; /* 7 bits loaded from input stream */ + unsigned int found; /* Thats needed to replace the goto stuff from original source :) */ + unsigned int dcmp_byte = 0; + unsigned long bit_count; + struct huffman_decompress *qd; + unsigned int has_qd; /* Can we use quick decompression? */ + struct huffman_tree_item *p_item1; + struct huffman_tree_item *p_item2; + unsigned char *out_pos = out_buf; - /* Test the output length. Must not be non zero. */ - if (out_length == 0) { - return 0; - } + /* Test the output length. Must not be non zero. */ + if (out_length == 0) { + return 0; + } - /* Get the compression type from the input stream. */ - n8bits = libmpq_huff_get_8bits(is); + /* Get the compression type from the input stream. */ + n8bits = libmpq_huff_get_8bits(is); - /* Build the Huffman tree */ - libmpq_huff_build_tree(ht, n8bits); - ht->cmp0 = (n8bits == 0) ? TRUE : FALSE; + /* Build the Huffman tree */ + libmpq_huff_build_tree(ht, n8bits); + ht->cmp0 = (n8bits == 0) ? TRUE : FALSE; - for(;;) { - n7bits = libmpq_huff_get_7bits(is); /* Get 7 bits from input stream */ + for(;;) { + n7bits = libmpq_huff_get_7bits(is); /* Get 7 bits from input stream */ - /* - * Try to use quick decompression. Check huffman_decompress array for corresponding item. - * If found, use the result byte instead. - */ - qd = &ht->qd3474[n7bits]; + /* + * Try to use quick decompression. Check huffman_decompress array for corresponding item. + * If found, use the result byte instead. + */ + qd = &ht->qd3474[n7bits]; - /* If there is a quick-pass possible (ebx) */ - has_qd = (qd->offs00 >= ht->offs0004) ? TRUE : FALSE; + /* If there is a quick-pass possible (ebx) */ + has_qd = (qd->offs00 >= ht->offs0004) ? TRUE : FALSE; - /* If we can use quick decompress, use it. */ - if (has_qd) { - found = 0; - if (qd->bits > 7) { - is->bit_buf >>= 7; - is->bits -= 7; - p_item1 = qd->p_item; - found = 1; - } - if (found == 0) { - is->bit_buf >>= qd->bits; - is->bits -= qd->bits; - dcmp_byte = qd->dcmp_byte; - } - } else { - found = 1; - p_item1 = ht->first->next->prev; - if (PTR_INT(p_item1) <= 0) { - p_item1 = NULL; - } - } + /* If we can use quick decompress, use it. */ + if (has_qd) { + found = 0; + if (qd->bits > 7) { + is->bit_buf >>= 7; + is->bits -= 7; + p_item1 = qd->p_item; + found = 1; + } + if (found == 0) { + is->bit_buf >>= qd->bits; + is->bits -= qd->bits; + dcmp_byte = qd->dcmp_byte; + } + } else { + found = 1; + p_item1 = ht->first->next->prev; + if (PTR_INT(p_item1) <= 0) { + p_item1 = NULL; + } + } - if (found == 1) { - bit_count = 0; - p_item2 = NULL; - do { - p_item1 = p_item1->child; /* Move down by one level */ - if (libmpq_huff_get_bit(is)) { /* If current bit is set, move to previous */ - p_item1 = p_item1->prev; - } - if (++bit_count == 7) { /* If we are at 7th bit, save current huffman tree item. */ - p_item2 = p_item1; - } - } while (p_item1->child != NULL); /* Walk until tree has no deeper level */ + if (found == 1) { + bit_count = 0; + p_item2 = NULL; + do { + p_item1 = p_item1->child; /* Move down by one level */ + if (libmpq_huff_get_bit(is)) { /* If current bit is set, move to previous */ + p_item1 = p_item1->prev; + } + if (++bit_count == 7) { /* If we are at 7th bit, save current huffman tree item. */ + p_item2 = p_item1; + } + } while (p_item1->child != NULL); /* Walk until tree has no deeper level */ - if (has_qd == FALSE) { - if (bit_count > 7) { - qd->offs00 = ht->offs0004; - qd->bits = bit_count; - qd->p_item = p_item2; - } else { - unsigned long index = n7bits & (0xFFFFFFFF >> (32 - bit_count)); - unsigned long add = (1 << bit_count); + if (has_qd == FALSE) { + if (bit_count > 7) { + qd->offs00 = ht->offs0004; + qd->bits = bit_count; + qd->p_item = p_item2; + } else { + unsigned long index = n7bits & (0xFFFFFFFF >> (32 - bit_count)); + unsigned long add = (1 << bit_count); - for (qd = &ht->qd3474[index]; index <= 0x7F; index += add, qd += add) { - qd->offs00 = ht->offs0004; - qd->bits = bit_count; - qd->dcmp_byte = p_item1->dcmp_byte; - } - } - } - dcmp_byte = p_item1->dcmp_byte; - } + for (qd = &ht->qd3474[index]; index <= 0x7F; index += add, qd += add) { + qd->offs00 = ht->offs0004; + qd->bits = bit_count; + qd->dcmp_byte = p_item1->dcmp_byte; + } + } + } + dcmp_byte = p_item1->dcmp_byte; + } - if (dcmp_byte == 0x101) { /* Huffman tree needs to be modified */ - n8bits = libmpq_huff_get_8bits(is); - p_item1 = (ht->last <= 0) ? NULL : ht->last; + if (dcmp_byte == 0x101) { /* Huffman tree needs to be modified */ + n8bits = libmpq_huff_get_8bits(is); + p_item1 = (ht->last <= 0) ? NULL : ht->last; - p_item2 = libmpq_huff_call1500E740(ht, 1); - p_item2->parent = p_item1; - p_item2->dcmp_byte = p_item1->dcmp_byte; - p_item2->byte_value = p_item1->byte_value; - ht->items306C[p_item2->dcmp_byte] = p_item2; + p_item2 = libmpq_huff_call1500E740(ht, 1); + p_item2->parent = p_item1; + p_item2->dcmp_byte = p_item1->dcmp_byte; + p_item2->byte_value = p_item1->byte_value; + ht->items306C[p_item2->dcmp_byte] = p_item2; - p_item2 = libmpq_huff_call1500E740(ht, 1); - p_item2->parent = p_item1; - p_item2->dcmp_byte = n8bits; - p_item2->byte_value = 0; - ht->items306C[p_item2->dcmp_byte] = p_item2; + p_item2 = libmpq_huff_call1500E740(ht, 1); + p_item2->parent = p_item1; + p_item2->dcmp_byte = n8bits; + p_item2->byte_value = 0; + ht->items306C[p_item2->dcmp_byte] = p_item2; - p_item1->child = p_item2; - libmpq_huff_call1500E820(ht, p_item2); - if (ht->cmp0 == 0) { - libmpq_huff_call1500E820(ht, ht->items306C[n8bits]); - } - dcmp_byte = n8bits; - } + p_item1->child = p_item2; + libmpq_huff_call1500E820(ht, p_item2); + if (ht->cmp0 == 0) { + libmpq_huff_call1500E820(ht, ht->items306C[n8bits]); + } + dcmp_byte = n8bits; + } - if (dcmp_byte == 0x100) { - break; - } + if (dcmp_byte == 0x100) { + break; + } - *out_pos++ = (unsigned char)dcmp_byte; - if (--out_length == 0) { - break; - } - if (ht->cmp0) { - libmpq_huff_call1500E820(ht, ht->items306C[dcmp_byte]); - } - } - return (out_pos - out_buf); + *out_pos++ = (unsigned char)dcmp_byte; + if (--out_length == 0) { + break; + } + if (ht->cmp0) { + libmpq_huff_call1500E820(ht, ht->items306C[dcmp_byte]); + } + } + return (out_pos - out_buf); } int libmpq_huff_init_tree(struct huffman_tree *ht, struct huffman_tree_item *hi, unsigned int cmp) { - int count; + int count; - /* Clear links for all the items in the tree */ - for (hi = ht->items0008, count = 0x203; count != 0; hi++, count--) { - hi->next = hi->prev = NULL; - } + /* Clear links for all the items in the tree */ + for (hi = ht->items0008, count = 0x203; count != 0; hi++, count--) { + hi->next = hi->prev = NULL; + } - ht->item3050 = NULL; - ht->item3054 = PTR_PTR(&ht->item3054); - ht->item3058 = PTR_NOT(ht->item3054); + ht->item3050 = NULL; + ht->item3054 = PTR_PTR(&ht->item3054); + ht->item3058 = PTR_NOT(ht->item3054); - ht->item305C = NULL; - ht->first = PTR_PTR(&ht->first); - ht->last = PTR_NOT(ht->first); + ht->item305C = NULL; + ht->first = PTR_PTR(&ht->first); + ht->last = PTR_NOT(ht->first); - ht->offs0004 = 1; - ht->items = 0; + ht->offs0004 = 1; + ht->items = 0; - /* Clear all huffman_decompress items. Do this only if preparing for decompression */ - if (cmp == LIBMPQ_HUFF_DECOMPRESS) { - for (count = 0; count < sizeof(ht->qd3474) / sizeof(struct huffman_decompress); count++) { - ht->qd3474[count].offs00 = 0; - } - } + /* Clear all huffman_decompress items. Do this only if preparing for decompression */ + if (cmp == LIBMPQ_HUFF_DECOMPRESS) { + for (count = 0; count < sizeof(ht->qd3474) / sizeof(struct huffman_decompress); count++) { + ht->qd3474[count].offs00 = 0; + } + } return 0; } diff --git a/contrib/extractor/libmpq/huffman.h b/contrib/extractor/libmpq/huffman.h index 1f8eae54eb4..cce32dd6718 100644 --- a/contrib/extractor/libmpq/huffman.h +++ b/contrib/extractor/libmpq/huffman.h @@ -27,32 +27,32 @@ #ifndef _HUFFMAN_H #define _HUFFMAN_H -#define PTR_NOT(ptr) (struct huffman_tree_item *)(~(unsigned long)(ptr)) -#define PTR_PTR(ptr) ((struct huffman_tree_item *)(ptr)) -#define PTR_INT(ptr) (long)(ptr) +#define PTR_NOT(ptr) (struct huffman_tree_item *)(~(unsigned long)(ptr)) +#define PTR_PTR(ptr) ((struct huffman_tree_item *)(ptr)) +#define PTR_INT(ptr) (long)(ptr) -#define INSERT_ITEM 1 -#define SWITCH_ITEMS 2 /* Switch the item1 and item2 */ +#define INSERT_ITEM 1 +#define SWITCH_ITEMS 2 /* Switch the item1 and item2 */ /* * Input stream for Huffmann decompression */ struct huffman_input_stream { - unsigned char *in_buf; /* 00 - Input data */ - unsigned long bit_buf; /* 04 - Input bit buffer */ - unsigned int bits; /* 08 - Number of bits remaining in 'byte' */ + unsigned char *in_buf; /* 00 - Input data */ + unsigned long bit_buf; /* 04 - Input bit buffer */ + unsigned int bits; /* 08 - Number of bits remaining in 'byte' */ }; /* * Huffmann tree item. */ struct huffman_tree_item { - struct huffman_tree_item *next; /* 00 - Pointer to next huffman_tree_item */ - struct huffman_tree_item *prev; /* 04 - Pointer to prev huffman_tree_item (< 0 if none) */ - unsigned long dcmp_byte; /* 08 - Index of this item in item pointer array, decompressed byte value */ - unsigned long byte_value; /* 0C - Some byte value */ - struct huffman_tree_item *parent; /* 10 - Pointer to parent huffman_tree_item (NULL if none) */ - struct huffman_tree_item *child; /* 14 - Pointer to child huffman_tree_item */ + struct huffman_tree_item *next; /* 00 - Pointer to next huffman_tree_item */ + struct huffman_tree_item *prev; /* 04 - Pointer to prev huffman_tree_item (< 0 if none) */ + unsigned long dcmp_byte; /* 08 - Index of this item in item pointer array, decompressed byte value */ + unsigned long byte_value; /* 0C - Some byte value */ + struct huffman_tree_item *parent; /* 10 - Pointer to parent huffman_tree_item (NULL if none) */ + struct huffman_tree_item *child; /* 14 - Pointer to child huffman_tree_item */ }; /* @@ -66,40 +66,40 @@ struct huffman_tree_item { * directly stores output byte to output stream. */ struct huffman_decompress { - unsigned long offs00; /* 00 - 1 if resolved */ - unsigned long bits; /* 04 - Bit count */ - union { - unsigned long dcmp_byte; /* 08 - Byte value for decompress (if bitCount <= 7) */ - struct huffman_tree_item *p_item; /* 08 - THTreeItem (if number of bits is greater than 7 */ - }; + unsigned long offs00; /* 00 - 1 if resolved */ + unsigned long bits; /* 04 - Bit count */ + union { + unsigned long dcmp_byte; /* 08 - Byte value for decompress (if bitCount <= 7) */ + struct huffman_tree_item *p_item; /* 08 - THTreeItem (if number of bits is greater than 7 */ + }; }; /* * Structure for Huffman tree. */ struct huffman_tree { - unsigned long cmp0; /* 0000 - 1 if compression type 0 */ - unsigned long offs0004; /* 0004 - Some flag */ + unsigned long cmp0; /* 0000 - 1 if compression type 0 */ + unsigned long offs0004; /* 0004 - Some flag */ - struct huffman_tree_item items0008[0x203]; /* 0008 - huffman tree items */ + struct huffman_tree_item items0008[0x203]; /* 0008 - huffman tree items */ - /* Sometimes used as huffman tree item */ - struct huffman_tree_item *item3050; /* 3050 - Always NULL (?) */ - struct huffman_tree_item *item3054; /* 3054 - Pointer to huffman_tree_item */ - struct huffman_tree_item *item3058; /* 3058 - Pointer to huffman_tree_item (< 0 if invalid) */ + /* Sometimes used as huffman tree item */ + struct huffman_tree_item *item3050; /* 3050 - Always NULL (?) */ + struct huffman_tree_item *item3054; /* 3054 - Pointer to huffman_tree_item */ + struct huffman_tree_item *item3058; /* 3058 - Pointer to huffman_tree_item (< 0 if invalid) */ - /* Sometimes used as huffman tree item */ - struct huffman_tree_item *item305C; /* 305C - Usually NULL */ - struct huffman_tree_item *first; /* 3060 - Pointer to top (first) Huffman tree item */ - struct huffman_tree_item *last; /* 3064 - Pointer to bottom (last) Huffman tree item (< 0 if invalid) */ - unsigned long items; /* 3068 - Number of used huffman tree items */ + /* Sometimes used as huffman tree item */ + struct huffman_tree_item *item305C; /* 305C - Usually NULL */ + struct huffman_tree_item *first; /* 3060 - Pointer to top (first) Huffman tree item */ + struct huffman_tree_item *last; /* 3064 - Pointer to bottom (last) Huffman tree item (< 0 if invalid) */ + unsigned long items; /* 3068 - Number of used huffman tree items */ - struct huffman_tree_item *items306C[0x102]; /* 306C - huffman_tree_item pointer array */ - struct huffman_decompress qd3474[0x80]; /* 3474 - Array for quick decompression */ + struct huffman_tree_item *items306C[0x102]; /* 306C - huffman_tree_item pointer array */ + struct huffman_decompress qd3474[0x80]; /* 3474 - Array for quick decompression */ - //unsigned char table1502A630[]; /* Some table to make struct size flexible */ + //unsigned char table1502A630[]; /* Some table to make struct size flexible */ }; int libmpq_huff_init_tree(struct huffman_tree *ht, struct huffman_tree_item *hi, unsigned int cmp); int libmpq_huff_do_decompress(struct huffman_tree *ht, struct huffman_input_stream *is, unsigned char *out_buf, unsigned int out_length); -#endif /* _HUFFMAN_H */ +#endif /* _HUFFMAN_H */ diff --git a/contrib/extractor/libmpq/mpq.cpp b/contrib/extractor/libmpq/mpq.cpp index 9d1cd883386..bd260bd3a36 100644 --- a/contrib/extractor/libmpq/mpq.cpp +++ b/contrib/extractor/libmpq/mpq.cpp @@ -36,9 +36,9 @@ * format: MAJOR.MINOR.PATCH */ char *libmpq_version() { - static char version[10]; - sprintf(version, "%i.%i.%i", LIBMPQ_MAJOR_VERSION, LIBMPQ_MINOR_VERSION, LIBMPQ_PATCH_VERSION); - return version; + static char version[10]; + sprintf(version, "%i.%i.%i", LIBMPQ_MAJOR_VERSION, LIBMPQ_MINOR_VERSION, LIBMPQ_PATCH_VERSION); + return version; } /* @@ -47,94 +47,94 @@ char *libmpq_version() { * table. */ int libmpq_archive_open(mpq_archive *mpq_a, unsigned char *mpq_filename) { - int fd = 0; - int rb = 0; - int ncnt = FALSE; - struct stat fileinfo; + int fd = 0; + int rb = 0; + int ncnt = FALSE; + struct stat fileinfo; - /* allocate memory */ - mpq_a->mpq_l = (mpq_list *)malloc(sizeof(mpq_list)); - memset(mpq_a->mpq_l, 0, sizeof(mpq_list)); - mpq_a->header = (mpq_header *)malloc(sizeof(mpq_header)); - memset(mpq_a->header, 0, sizeof(mpq_header)); + /* allocate memory */ + mpq_a->mpq_l = (mpq_list *)malloc(sizeof(mpq_list)); + memset(mpq_a->mpq_l, 0, sizeof(mpq_list)); + mpq_a->header = (mpq_header *)malloc(sizeof(mpq_header)); + memset(mpq_a->header, 0, sizeof(mpq_header)); - /* Check if file exists and is readable */ - fd = _open((char *)mpq_filename, MPQ_FILE_OPEN_FLAGS); - if (fd == LIBMPQ_EFILE) { - return LIBMPQ_EFILE; - } + /* Check if file exists and is readable */ + fd = _open((char *)mpq_filename, MPQ_FILE_OPEN_FLAGS); + if (fd == LIBMPQ_EFILE) { + return LIBMPQ_EFILE; + } - /* fill the structures with informations */ - strcpy((char *)mpq_a->filename, (char *)mpq_filename); - libmpq_init_buffer(mpq_a); - mpq_a->fd = fd; - mpq_a->header->id = 0; - mpq_a->maxblockindex = 0; - mpq_a->mpq_l->mpq_files = NULL; + /* fill the structures with informations */ + strcpy((char *)mpq_a->filename, (char *)mpq_filename); + libmpq_init_buffer(mpq_a); + mpq_a->fd = fd; + mpq_a->header->id = 0; + mpq_a->maxblockindex = 0; + mpq_a->mpq_l->mpq_files = NULL; mpq_a->mpqpos = 0; //k - while (!ncnt) { - mpq_a->header->id = 0; - #ifdef WIN32 - _lseeki64(mpq_a->fd, mpq_a->mpqpos, SEEK_SET); - #else - lseek64(mpq_a->fd, mpq_a->mpqpos, SEEK_SET); - #endif - rb = _read(mpq_a->fd, mpq_a->header, sizeof(mpq_header)); + while (!ncnt) { + mpq_a->header->id = 0; + #ifdef WIN32 + _lseeki64(mpq_a->fd, mpq_a->mpqpos, SEEK_SET); + #else + lseek64(mpq_a->fd, mpq_a->mpqpos, SEEK_SET); + #endif + rb = _read(mpq_a->fd, mpq_a->header, sizeof(mpq_header)); - /* if different number of bytes read, break the loop */ - if (rb != sizeof(mpq_header)) { - return LIBMPQ_EFILE_FORMAT; - } + /* if different number of bytes read, break the loop */ + if (rb != sizeof(mpq_header)) { + return LIBMPQ_EFILE_FORMAT; + } - /* special offset for protected MPQs */ - if (mpq_a->header->offset == LIBMPQ_HEADER_W3M) { - mpq_a->flags |= LIBMPQ_FLAG_PROTECTED; - mpq_a->header->offset = sizeof(mpq_header); - } + /* special offset for protected MPQs */ + if (mpq_a->header->offset == LIBMPQ_HEADER_W3M) { + mpq_a->flags |= LIBMPQ_FLAG_PROTECTED; + mpq_a->header->offset = sizeof(mpq_header); + } - /* if valid signature has been found, break the loop */ + /* if valid signature has been found, break the loop */ if (mpq_a->header->id == LIBMPQ_ID_MPQ) { ncnt = true; } /*if (mpq_a->header->id == LIBMPQ_ID_MPQ && - mpq_a->header->offset == sizeof(mpq_header) && - mpq_a->header->hashtablepos < mpq_a->header->archivesize && - mpq_a->header->blocktablepos < mpq_a->header->archivesize) { - ncnt = TRUE; - }*/ + mpq_a->header->offset == sizeof(mpq_header) && + mpq_a->header->hashtablepos < mpq_a->header->archivesize && + mpq_a->header->blocktablepos < mpq_a->header->archivesize) { + ncnt = TRUE; + }*/ - /* move to the next possible offset */ - if (!ncnt) { - mpq_a->mpqpos += 0x200; - } - } + /* move to the next possible offset */ + if (!ncnt) { + mpq_a->mpqpos += 0x200; + } + } - /* get the right positions of the hash table and the block table. */ - mpq_a->blocksize = (0x200 << mpq_a->header->blocksize); - fstat(mpq_a->fd, &fileinfo); + /* get the right positions of the hash table and the block table. */ + mpq_a->blocksize = (0x200 << mpq_a->header->blocksize); + fstat(mpq_a->fd, &fileinfo); - /* Normal MPQs must have position of */ - /*if (mpq_a->header->hashtablepos + mpq_a->mpqpos < fileinfo.st_size && - mpq_a->header->blocktablepos + mpq_a->mpqpos < fileinfo.st_size) { - mpq_a->header->hashtablepos += mpq_a->mpqpos; - mpq_a->header->blocktablepos += mpq_a->mpqpos; - } else { - return LIBMPQ_EFILE_FORMAT; - }*/ + /* Normal MPQs must have position of */ + /*if (mpq_a->header->hashtablepos + mpq_a->mpqpos < fileinfo.st_size && + mpq_a->header->blocktablepos + mpq_a->mpqpos < fileinfo.st_size) { + mpq_a->header->hashtablepos += mpq_a->mpqpos; + mpq_a->header->blocktablepos += mpq_a->mpqpos; + } else { + return LIBMPQ_EFILE_FORMAT; + }*/ - /* Try to read and decrypt the hashtable */ - if (libmpq_read_hashtable(mpq_a) != 0) { - return LIBMPQ_EHASHTABLE; - } + /* Try to read and decrypt the hashtable */ + if (libmpq_read_hashtable(mpq_a) != 0) { + return LIBMPQ_EHASHTABLE; + } - /* Try to read and decrypt the blocktable */ - if (libmpq_read_blocktable(mpq_a) != 0) { - return LIBMPQ_EBLOCKTABLE; - } + /* Try to read and decrypt the blocktable */ + if (libmpq_read_blocktable(mpq_a) != 0) { + return LIBMPQ_EBLOCKTABLE; + } - return LIBMPQ_TOOLS_SUCCESS; + return LIBMPQ_TOOLS_SUCCESS; } /* @@ -142,18 +142,18 @@ int libmpq_archive_open(mpq_archive *mpq_a, unsigned char *mpq_filename) { * mpq_open_archive(); and frees the decryption buffer. */ int libmpq_archive_close(mpq_archive *mpq_a) { - memset(mpq_a->buf, 0, sizeof(mpq_a->buf)); + memset(mpq_a->buf, 0, sizeof(mpq_a->buf)); - /* free the allocated memory. */ - free(mpq_a->header); - free(mpq_a->mpq_l); + /* free the allocated memory. */ + free(mpq_a->header); + free(mpq_a->mpq_l); - /* Check if file descriptor is valid. */ - if ((_close(mpq_a->fd)) == LIBMPQ_EFILE) { - return LIBMPQ_EFILE; - } + /* Check if file descriptor is valid. */ + if ((_close(mpq_a->fd)) == LIBMPQ_EFILE) { + return LIBMPQ_EFILE; + } - return LIBMPQ_TOOLS_SUCCESS; + return LIBMPQ_TOOLS_SUCCESS; } /* @@ -161,95 +161,95 @@ int libmpq_archive_close(mpq_archive *mpq_a) { * If an error occurs something < 0 is returned. */ int libmpq_archive_info(mpq_archive *mpq_a, unsigned int infotype) { - unsigned int filecount = 0; - unsigned int fsize = 0; - unsigned int csize = 0; - mpq_block *mpq_b_end = mpq_a->blocktable + mpq_a->header->blocktablesize; - mpq_block *mpq_b = NULL; + unsigned int filecount = 0; + unsigned int fsize = 0; + unsigned int csize = 0; + mpq_block *mpq_b_end = mpq_a->blocktable + mpq_a->header->blocktablesize; + mpq_block *mpq_b = NULL; - switch (infotype) { - case LIBMPQ_MPQ_ARCHIVE_SIZE: - return mpq_a->header->archivesize; - case LIBMPQ_MPQ_HASHTABLE_SIZE: - return mpq_a->header->hashtablesize; - case LIBMPQ_MPQ_BLOCKTABLE_SIZE: - return mpq_a->header->blocktablesize; - case LIBMPQ_MPQ_BLOCKSIZE: - return mpq_a->blocksize; - case LIBMPQ_MPQ_NUMFILES: - for (mpq_b = mpq_a->blocktable; mpq_b < mpq_b_end; mpq_b++) { - filecount++; - } - return filecount; - case LIBMPQ_MPQ_COMPRESSED_SIZE: - for (mpq_b = mpq_a->blocktable; mpq_b < mpq_b_end; mpq_b++) { - csize += mpq_b->csize; - } - return csize; - case LIBMPQ_MPQ_UNCOMPRESSED_SIZE: - for (mpq_b = mpq_a->blocktable; mpq_b < mpq_b_end; mpq_b++) { - fsize += mpq_b->fsize; - } - return fsize; - default: - return LIBMPQ_TOOLS_SUCCESS; - } + switch (infotype) { + case LIBMPQ_MPQ_ARCHIVE_SIZE: + return mpq_a->header->archivesize; + case LIBMPQ_MPQ_HASHTABLE_SIZE: + return mpq_a->header->hashtablesize; + case LIBMPQ_MPQ_BLOCKTABLE_SIZE: + return mpq_a->header->blocktablesize; + case LIBMPQ_MPQ_BLOCKSIZE: + return mpq_a->blocksize; + case LIBMPQ_MPQ_NUMFILES: + for (mpq_b = mpq_a->blocktable; mpq_b < mpq_b_end; mpq_b++) { + filecount++; + } + return filecount; + case LIBMPQ_MPQ_COMPRESSED_SIZE: + for (mpq_b = mpq_a->blocktable; mpq_b < mpq_b_end; mpq_b++) { + csize += mpq_b->csize; + } + return csize; + case LIBMPQ_MPQ_UNCOMPRESSED_SIZE: + for (mpq_b = mpq_a->blocktable; mpq_b < mpq_b_end; mpq_b++) { + fsize += mpq_b->fsize; + } + return fsize; + default: + return LIBMPQ_TOOLS_SUCCESS; + } } /* * This function returns some useful file information. */ int libmpq_file_info(mpq_archive *mpq_a, unsigned int infotype, const int unsigned number) { - int blockindex = number; //-1; - int i = 0; - mpq_block *mpq_b = NULL; - mpq_hash *mpq_h = NULL; + int blockindex = number; //-1; + int i = 0; + mpq_block *mpq_b = NULL; + mpq_hash *mpq_h = NULL; - /* check if given number is not out of range */ - if (number < 1 || number > mpq_a->header->blocktablesize) { - return LIBMPQ_EINV_RANGE; - } + /* check if given number is not out of range */ + if (number < 1 || number > mpq_a->header->blocktablesize) { + return LIBMPQ_EINV_RANGE; + } - /* search for correct hashtable */ - /*for (i = 0; i < mpq_a->header->hashtablesize; i++) { - if ((number - 1) == (mpq_a->hashtable[i]).blockindex) { - blockindex = (mpq_a->hashtable[i]).blockindex; - mpq_h = &(mpq_a->hashtable[i]); - break; - } - }*/ + /* search for correct hashtable */ + /*for (i = 0; i < mpq_a->header->hashtablesize; i++) { + if ((number - 1) == (mpq_a->hashtable[i]).blockindex) { + blockindex = (mpq_a->hashtable[i]).blockindex; + mpq_h = &(mpq_a->hashtable[i]); + break; + } + }*/ - /* check if file was found */ - /*if (blockindex == -1 || blockindex > mpq_a->header->blocktablesize) { - return LIBMPQ_EFILE_NOT_FOUND; - }*/ + /* check if file was found */ + /*if (blockindex == -1 || blockindex > mpq_a->header->blocktablesize) { + return LIBMPQ_EFILE_NOT_FOUND; + }*/ - /* check if sizes are correct */ - mpq_b = mpq_a->blocktable + blockindex; - if (mpq_b->filepos > (mpq_a->header->archivesize + mpq_a->mpqpos) || mpq_b->csize > mpq_a->header->archivesize) { - return LIBMPQ_EFILE_CORRUPT; - } + /* check if sizes are correct */ + mpq_b = mpq_a->blocktable + blockindex; + if (mpq_b->filepos > (mpq_a->header->archivesize + mpq_a->mpqpos) || mpq_b->csize > mpq_a->header->archivesize) { + return LIBMPQ_EFILE_CORRUPT; + } - /* check if file exists */ - if ((mpq_b->flags & LIBMPQ_FILE_EXISTS) == 0) { - return LIBMPQ_EFILE_NOT_FOUND; - } + /* check if file exists */ + if ((mpq_b->flags & LIBMPQ_FILE_EXISTS) == 0) { + return LIBMPQ_EFILE_NOT_FOUND; + } - switch (infotype) { - case LIBMPQ_FILE_COMPRESSED_SIZE: - return mpq_b->csize; - case LIBMPQ_FILE_UNCOMPRESSED_SIZE: - return mpq_b->fsize; - case LIBMPQ_FILE_COMPRESSION_TYPE: - if (mpq_b->flags & LIBMPQ_FILE_COMPRESS_PKWARE) { - return LIBMPQ_FILE_COMPRESS_PKWARE; - } - if (mpq_b->flags & LIBMPQ_FILE_COMPRESS_MULTI) { - return LIBMPQ_FILE_COMPRESS_MULTI; - } - default: - return LIBMPQ_TOOLS_SUCCESS; - } + switch (infotype) { + case LIBMPQ_FILE_COMPRESSED_SIZE: + return mpq_b->csize; + case LIBMPQ_FILE_UNCOMPRESSED_SIZE: + return mpq_b->fsize; + case LIBMPQ_FILE_COMPRESSION_TYPE: + if (mpq_b->flags & LIBMPQ_FILE_COMPRESS_PKWARE) { + return LIBMPQ_FILE_COMPRESS_PKWARE; + } + if (mpq_b->flags & LIBMPQ_FILE_COMPRESS_MULTI) { + return LIBMPQ_FILE_COMPRESS_MULTI; + } + default: + return LIBMPQ_TOOLS_SUCCESS; + } } /* @@ -259,17 +259,17 @@ int libmpq_file_info(mpq_archive *mpq_a, unsigned int infotype, const int unsign * returns NULL. */ char *libmpq_file_name(mpq_archive *mpq_a, const int number) { - static char tempfile[PATH_MAX]; + static char tempfile[PATH_MAX]; - /* check if we are in the range of available files. */ - if (number > libmpq_archive_info(mpq_a, LIBMPQ_MPQ_NUMFILES) || number < 1) { - return NULL; - } + /* check if we are in the range of available files. */ + if (number > libmpq_archive_info(mpq_a, LIBMPQ_MPQ_NUMFILES) || number < 1) { + return NULL; + } - /* this is safe because we built a fallback filelist, if something was wrong. */ - sprintf(tempfile, (char *)mpq_a->mpq_l->mpq_files[number - 1], number); + /* this is safe because we built a fallback filelist, if something was wrong. */ + sprintf(tempfile, (char *)mpq_a->mpq_l->mpq_files[number - 1], number); - return tempfile; + return tempfile; } /* @@ -277,20 +277,20 @@ char *libmpq_file_name(mpq_archive *mpq_a, const int number) { * filename. */ int libmpq_file_number(mpq_archive *mpq_a, const char *name) { - int i; - char tempfile[PATH_MAX]; + int i; + char tempfile[PATH_MAX]; - for (i = 0; mpq_a->mpq_l->mpq_files[i]; i++) { - sprintf(tempfile, (char *)mpq_a->mpq_l->mpq_files[i], i + 1); - if (strncmp(tempfile, name, strlen(name)) == 0) { + for (i = 0; mpq_a->mpq_l->mpq_files[i]; i++) { + sprintf(tempfile, (char *)mpq_a->mpq_l->mpq_files[i], i + 1); + if (strncmp(tempfile, name, strlen(name)) == 0) { - /* if file found return the number */ - return i + 1; - } - } + /* if file found return the number */ + return i + 1; + } + } - /* if no matching entry found return LIBMPQ_EFILE_NOT_FOUND */ - return LIBMPQ_EFILE_NOT_FOUND; + /* if no matching entry found return LIBMPQ_EFILE_NOT_FOUND */ + return LIBMPQ_EFILE_NOT_FOUND; } /* @@ -299,39 +299,39 @@ int libmpq_file_number(mpq_archive *mpq_a, const char *name) { * it returns 0, otherwise LIBMPQ_EFILE_NOT_FOUND. */ int libmpq_file_check(mpq_archive *mpq_a, void *file, int type) { - int found = 0; - int i; - char tempfile[PATH_MAX]; + int found = 0; + int i; + char tempfile[PATH_MAX]; - switch (type) { - case LIBMPQ_FILE_TYPE_INT: + switch (type) { + case LIBMPQ_FILE_TYPE_INT: - /* check if we are in the range of available files. */ - if (*(int *)file > libmpq_archive_info(mpq_a, LIBMPQ_MPQ_NUMFILES) || *(int *)file < 1) { - return LIBMPQ_EFILE_NOT_FOUND; - } else { - return LIBMPQ_TOOLS_SUCCESS; - } - case LIBMPQ_FILE_TYPE_CHAR: - for (i = 0; mpq_a->mpq_l->mpq_files[i]; i++) { - sprintf(tempfile, (char *)mpq_a->mpq_l->mpq_files[i], i); - if (strncmp(tempfile, (char *)file, strlen((char *)file)) == 0) { + /* check if we are in the range of available files. */ + if (*(int *)file > libmpq_archive_info(mpq_a, LIBMPQ_MPQ_NUMFILES) || *(int *)file < 1) { + return LIBMPQ_EFILE_NOT_FOUND; + } else { + return LIBMPQ_TOOLS_SUCCESS; + } + case LIBMPQ_FILE_TYPE_CHAR: + for (i = 0; mpq_a->mpq_l->mpq_files[i]; i++) { + sprintf(tempfile, (char *)mpq_a->mpq_l->mpq_files[i], i); + if (strncmp(tempfile, (char *)file, strlen((char *)file)) == 0) { - /* if file found break */ - found = 1; - break; - } - } + /* if file found break */ + found = 1; + break; + } + } - /* if a file was found return 0 */ - if (found == 1) { - return LIBMPQ_TOOLS_SUCCESS; - } else { - return LIBMPQ_EFILE_NOT_FOUND; - } - default: - return LIBMPQ_TOOLS_SUCCESS; - } + /* if a file was found return 0 */ + if (found == 1) { + return LIBMPQ_TOOLS_SUCCESS; + } else { + return LIBMPQ_EFILE_NOT_FOUND; + } + default: + return LIBMPQ_TOOLS_SUCCESS; + } } /* @@ -339,102 +339,102 @@ int libmpq_file_check(mpq_archive *mpq_a, void *file, int type) { * by the given number. */ int libmpq_file_extract(mpq_archive *mpq_a, const int number, const char *filename) { - int blockindex = number; //-1; - int fd = 0; - int i = 0; - char buffer[0x1000]; - //char tempfile[PATH_MAX]; - unsigned int transferred = 1; - mpq_file *mpq_f = NULL; - mpq_block *mpq_b = NULL; - mpq_hash *mpq_h = NULL; + int blockindex = number; //-1; + int fd = 0; + int i = 0; + char buffer[0x1000]; + //char tempfile[PATH_MAX]; + unsigned int transferred = 1; + mpq_file *mpq_f = NULL; + mpq_block *mpq_b = NULL; + mpq_hash *mpq_h = NULL; -/* if (number < 1 || number > mpq_a->header->blocktablesize) { - return LIBMPQ_EINV_RANGE; - }*/ +/* if (number < 1 || number > mpq_a->header->blocktablesize) { + return LIBMPQ_EINV_RANGE; + }*/ /* - sprintf(tempfile, libmpq_file_name(mpq_a, number)); + sprintf(tempfile, libmpq_file_name(mpq_a, number)); */ - /* check if mpq_f->filename could be written here. */ - fd = _open(filename, O_RDWR|O_CREAT|O_TRUNC, 0644); - if (fd == LIBMPQ_EFILE) { - return LIBMPQ_EFILE; - } + /* check if mpq_f->filename could be written here. */ + fd = _open(filename, O_RDWR|O_CREAT|O_TRUNC, 0644); + if (fd == LIBMPQ_EFILE) { + return LIBMPQ_EFILE; + } - /* search for correct hashtable */ - /*for (i = 0; i < mpq_a->header->hashtablesize; i++) { - if ((number - 1) == (mpq_a->hashtable[i]).blockindex) { - blockindex = (mpq_a->hashtable[i]).blockindex; - mpq_h = &(mpq_a->hashtable[i]); - break; - } - }*/ + /* search for correct hashtable */ + /*for (i = 0; i < mpq_a->header->hashtablesize; i++) { + if ((number - 1) == (mpq_a->hashtable[i]).blockindex) { + blockindex = (mpq_a->hashtable[i]).blockindex; + mpq_h = &(mpq_a->hashtable[i]); + break; + } + }*/ - /* check if file was found */ - if (blockindex == -1 || blockindex > mpq_a->header->blocktablesize) { - return LIBMPQ_EFILE_NOT_FOUND; - } + /* check if file was found */ + if (blockindex == -1 || blockindex > mpq_a->header->blocktablesize) { + return LIBMPQ_EFILE_NOT_FOUND; + } - /* check if sizes are correct */ - mpq_b = mpq_a->blocktable + blockindex; - if (mpq_b->filepos > (mpq_a->header->archivesize + mpq_a->mpqpos) || mpq_b->csize > mpq_a->header->archivesize) { - return LIBMPQ_EFILE_CORRUPT; - } + /* check if sizes are correct */ + mpq_b = mpq_a->blocktable + blockindex; + if (mpq_b->filepos > (mpq_a->header->archivesize + mpq_a->mpqpos) || mpq_b->csize > mpq_a->header->archivesize) { + return LIBMPQ_EFILE_CORRUPT; + } - /* check if file exists */ - if ((mpq_b->flags & LIBMPQ_FILE_EXISTS) == 0) { - return LIBMPQ_EFILE_NOT_FOUND; - } + /* check if file exists */ + if ((mpq_b->flags & LIBMPQ_FILE_EXISTS) == 0) { + return LIBMPQ_EFILE_NOT_FOUND; + } - /* allocate memory for file structure */ - mpq_f = (mpq_file *)malloc(sizeof(mpq_file)); - if (!mpq_f) { - return LIBMPQ_EALLOCMEM; - } + /* allocate memory for file structure */ + mpq_f = (mpq_file *)malloc(sizeof(mpq_file)); + if (!mpq_f) { + return LIBMPQ_EALLOCMEM; + } - /* initialize file structure */ - memset(mpq_f, 0, sizeof(mpq_file)); - mpq_f->fd = fd; - mpq_f->mpq_b = mpq_b; - mpq_f->nblocks = (mpq_f->mpq_b->fsize + mpq_a->blocksize - 1) / mpq_a->blocksize; - mpq_f->mpq_h = mpq_h; - mpq_f->accessed = FALSE; - mpq_f->blockposloaded = FALSE; - sprintf((char *)mpq_f->filename, filename); + /* initialize file structure */ + memset(mpq_f, 0, sizeof(mpq_file)); + mpq_f->fd = fd; + mpq_f->mpq_b = mpq_b; + mpq_f->nblocks = (mpq_f->mpq_b->fsize + mpq_a->blocksize - 1) / mpq_a->blocksize; + mpq_f->mpq_h = mpq_h; + mpq_f->accessed = FALSE; + mpq_f->blockposloaded = FALSE; + sprintf((char *)mpq_f->filename, filename); - /* allocate buffers for decompression. */ - if (mpq_f->mpq_b->flags & LIBMPQ_FILE_COMPRESSED) { + /* allocate buffers for decompression. */ + if (mpq_f->mpq_b->flags & LIBMPQ_FILE_COMPRESSED) { - /* - * Allocate buffer for block positions. At the begin of file are stored - * unsigned ints holding positions of each block relative from begin of - * file in the archive. - */ - if ((mpq_f->blockpos = (unsigned int *)malloc(sizeof(int) * mpq_f->nblocks + 1)) == NULL) { - return LIBMPQ_EALLOCMEM; - } - } + /* + * Allocate buffer for block positions. At the begin of file are stored + * unsigned ints holding positions of each block relative from begin of + * file in the archive. + */ + if ((mpq_f->blockpos = (unsigned int *)malloc(sizeof(int) * mpq_f->nblocks + 1)) == NULL) { + return LIBMPQ_EALLOCMEM; + } + } - while (transferred > 0) { - transferred = libmpq_file_read_file(mpq_a, mpq_f, mpq_f->filepos, buffer, sizeof(buffer)); - if (transferred == 0) { - break; - } else { - mpq_f->accessed = TRUE; - mpq_f->filepos += transferred; - } + while (transferred > 0) { + transferred = libmpq_file_read_file(mpq_a, mpq_f, mpq_f->filepos, buffer, sizeof(buffer)); + if (transferred == 0) { + break; + } else { + mpq_f->accessed = TRUE; + mpq_f->filepos += transferred; + } - transferred = _write(mpq_f->fd, buffer, transferred); - if (transferred == 0) { - break; - } - } + transferred = _write(mpq_f->fd, buffer, transferred); + if (transferred == 0) { + break; + } + } - _close(fd); + _close(fd); - /* freeing the file structure */ - free(mpq_f); - return LIBMPQ_TOOLS_SUCCESS; + /* freeing the file structure */ + free(mpq_f); + return LIBMPQ_TOOLS_SUCCESS; } /* @@ -444,183 +444,183 @@ int libmpq_file_extract(mpq_archive *mpq_a, const int number, const char *filena */ int libmpq_listfile_open(mpq_archive *mpq_a, char file[PATH_MAX]) { - FILE *fp; - //char **filelist; - int i = 0; - //int fl_count; - //int fl_size; - int fl_count_fb; - int fl_size_fb; - int result = LIBMPQ_TOOLS_SUCCESS; - struct stat statbuf; + FILE *fp; + //char **filelist; + int i = 0; + //int fl_count; + //int fl_size; + int fl_count_fb; + int fl_size_fb; + int result = LIBMPQ_TOOLS_SUCCESS; + struct stat statbuf; - /* get file status */ - if (stat(file, &statbuf) < 0) { - result = LIBMPQ_CONF_EFILE_NOT_FOUND; - } + /* get file status */ + if (stat(file, &statbuf) < 0) { + result = LIBMPQ_CONF_EFILE_NOT_FOUND; + } - /* check if file is a filename or directory */ - /*if (S_ISDIR(statbuf.st_mode)) { + /* check if file is a filename or directory */ + /*if (S_ISDIR(statbuf.st_mode)) { - // allocate memory for the file list - filelist = (char **)malloc(LIBMPQ_CONF_FL_INCREMENT * sizeof(char *)); - fl_count = 0; - fl_size = LIBMPQ_CONF_FL_INCREMENT; + // allocate memory for the file list + filelist = (char **)malloc(LIBMPQ_CONF_FL_INCREMENT * sizeof(char *)); + fl_count = 0; + fl_size = LIBMPQ_CONF_FL_INCREMENT; - // check if it is a valid listfile - if (libmpq_detect_listfile_rec(file, &filelist, &fl_count, &fl_size)) { - filelist == NULL; - } + // check if it is a valid listfile + if (libmpq_detect_listfile_rec(file, &filelist, &fl_count, &fl_size)) { + filelist == NULL; + } - filelist[fl_count] = NULL; + filelist[fl_count] = NULL; - // return if no listfile was found - if (filelist == NULL) { - result = LIBMPQ_CONF_EFILE_NOT_FOUND; - } + // return if no listfile was found + if (filelist == NULL) { + result = LIBMPQ_CONF_EFILE_NOT_FOUND; + } - for (i = 0; filelist[i]; i++) { - if ((fp = fopen(filelist[i], "r")) != NULL ) { - result = libmpq_read_listfile(mpq_a, fp); - fclose(fp); - } - } + for (i = 0; filelist[i]; i++) { + if ((fp = fopen(filelist[i], "r")) != NULL ) { + result = libmpq_read_listfile(mpq_a, fp); + fclose(fp); + } + } - // freeing the listfile struct - libmpq_free_listfile(filelist); - }*/ + // freeing the listfile struct + libmpq_free_listfile(filelist); + }*/ - /* if file is a regular file use it */ - //if (S_ISREG(statbuf.st_mode)) { + /* if file is a regular file use it */ + //if (S_ISREG(statbuf.st_mode)) { - /* if specific listfile was forced. */ - if ((fp = fopen(file, "r")) != NULL ) { - result = libmpq_read_listfile(mpq_a, fp); - fclose(fp); - } else { - result = LIBMPQ_CONF_EFILE_OPEN; - } - //} + /* if specific listfile was forced. */ + if ((fp = fopen(file, "r")) != NULL ) { + result = libmpq_read_listfile(mpq_a, fp); + fclose(fp); + } else { + result = LIBMPQ_CONF_EFILE_OPEN; + } + //} - /* if error occured we need to create a fallback filelist. */ - if (mpq_a->mpq_l->mpq_files == NULL) { + /* if error occured we need to create a fallback filelist. */ + if (mpq_a->mpq_l->mpq_files == NULL) { - /* allocate memory for the file list */ - mpq_a->mpq_l->mpq_files = (unsigned char **)malloc(LIBMPQ_CONF_FL_INCREMENT * sizeof(char *)); - fl_count_fb = 0; - fl_size_fb = LIBMPQ_CONF_FL_INCREMENT; + /* allocate memory for the file list */ + mpq_a->mpq_l->mpq_files = (unsigned char **)malloc(LIBMPQ_CONF_FL_INCREMENT * sizeof(char *)); + fl_count_fb = 0; + fl_size_fb = LIBMPQ_CONF_FL_INCREMENT; - for (i = 0; i < libmpq_archive_info(mpq_a, LIBMPQ_MPQ_NUMFILES); i++) { + for (i = 0; i < libmpq_archive_info(mpq_a, LIBMPQ_MPQ_NUMFILES); i++) { - /* set the next filelist entry to a copy of the file */ - mpq_a->mpq_l->mpq_files[fl_count_fb++] = (unsigned char *)_strdup("file%06lu.xxx"); + /* set the next filelist entry to a copy of the file */ + mpq_a->mpq_l->mpq_files[fl_count_fb++] = (unsigned char *)_strdup("file%06lu.xxx"); - /* increase the array size */ - if (fl_count_fb == fl_size_fb) { - mpq_a->mpq_l->mpq_files = (unsigned char **)realloc(mpq_a->mpq_l->mpq_files, (fl_size_fb + LIBMPQ_CONF_FL_INCREMENT) * sizeof(char *)); - fl_size_fb += LIBMPQ_CONF_FL_INCREMENT; - } - } - mpq_a->mpq_l->mpq_files[fl_count_fb] = NULL; + /* increase the array size */ + if (fl_count_fb == fl_size_fb) { + mpq_a->mpq_l->mpq_files = (unsigned char **)realloc(mpq_a->mpq_l->mpq_files, (fl_size_fb + LIBMPQ_CONF_FL_INCREMENT) * sizeof(char *)); + fl_size_fb += LIBMPQ_CONF_FL_INCREMENT; + } + } + mpq_a->mpq_l->mpq_files[fl_count_fb] = NULL; - /* if no error occurs and no listfile was assigned, we think there was no matching listfile. */ - if (result == 0) { - result = LIBMPQ_CONF_EFILE_NOT_FOUND; - } - } + /* if no error occurs and no listfile was assigned, we think there was no matching listfile. */ + if (result == 0) { + result = LIBMPQ_CONF_EFILE_NOT_FOUND; + } + } - return result; + return result; } /* * This function frees the allocated memory for the listfile. */ int libmpq_listfile_close(mpq_archive *mpq_a) { - int i = 0; + int i = 0; - /* safety check if we really have a filelist. */ - if (mpq_a->mpq_l->mpq_files != NULL) { - /* freeing the filelist */ - while (mpq_a->mpq_l->mpq_files[i]) { - free(mpq_a->mpq_l->mpq_files[i++]); - } - free(mpq_a->mpq_l->mpq_files); - } + /* safety check if we really have a filelist. */ + if (mpq_a->mpq_l->mpq_files != NULL) { + /* freeing the filelist */ + while (mpq_a->mpq_l->mpq_files[i]) { + free(mpq_a->mpq_l->mpq_files[i++]); + } + free(mpq_a->mpq_l->mpq_files); + } return 0; } int libmpq_file_getdata(mpq_archive *mpq_a, mpq_hash mpq_h, const int number, unsigned char *dest) { - int blockindex = number; //-1; - int i = 0; - mpq_file *mpq_f = NULL; - mpq_block *mpq_b = NULL; - int success = 0; + int blockindex = number; //-1; + int i = 0; + mpq_file *mpq_f = NULL; + mpq_block *mpq_b = NULL; + int success = 0; - /*if (number < 1 || number > mpq_a->header->blocktablesize) { - return LIBMPQ_EINV_RANGE; - }*/ + /*if (number < 1 || number > mpq_a->header->blocktablesize) { + return LIBMPQ_EINV_RANGE; + }*/ - /* search for correct hashtable */ - /*for (i = 0; i < mpq_a->header->hashtablesize; i++) { - if ((number - 1) == (mpq_a->hashtable[i]).blockindex) { - blockindex = (mpq_a->hashtable[i]).blockindex; - mpq_h = &(mpq_a->hashtable[i]); - break; - } - }*/ + /* search for correct hashtable */ + /*for (i = 0; i < mpq_a->header->hashtablesize; i++) { + if ((number - 1) == (mpq_a->hashtable[i]).blockindex) { + blockindex = (mpq_a->hashtable[i]).blockindex; + mpq_h = &(mpq_a->hashtable[i]); + break; + } + }*/ - /* check if file was found */ - if (blockindex == -1 || blockindex > mpq_a->header->blocktablesize) { - return LIBMPQ_EFILE_NOT_FOUND; - } + /* check if file was found */ + if (blockindex == -1 || blockindex > mpq_a->header->blocktablesize) { + return LIBMPQ_EFILE_NOT_FOUND; + } - /* check if sizes are correct */ - mpq_b = mpq_a->blocktable + blockindex; - if (mpq_b->filepos > (mpq_a->header->archivesize + mpq_a->mpqpos) || mpq_b->csize > mpq_a->header->archivesize) { - return LIBMPQ_EFILE_CORRUPT; - } + /* check if sizes are correct */ + mpq_b = mpq_a->blocktable + blockindex; + if (mpq_b->filepos > (mpq_a->header->archivesize + mpq_a->mpqpos) || mpq_b->csize > mpq_a->header->archivesize) { + return LIBMPQ_EFILE_CORRUPT; + } - /* check if file exists */ - if ((mpq_b->flags & LIBMPQ_FILE_EXISTS) == 0) { - return LIBMPQ_EFILE_NOT_FOUND; - } + /* check if file exists */ + if ((mpq_b->flags & LIBMPQ_FILE_EXISTS) == 0) { + return LIBMPQ_EFILE_NOT_FOUND; + } - /* allocate memory for file structure */ - mpq_f = (mpq_file*)malloc(sizeof(mpq_file)); - if (!mpq_f) { - return LIBMPQ_EALLOCMEM; - } + /* allocate memory for file structure */ + mpq_f = (mpq_file*)malloc(sizeof(mpq_file)); + if (!mpq_f) { + return LIBMPQ_EALLOCMEM; + } - /* initialize file structure */ - memset(mpq_f, 0, sizeof(mpq_file)); - mpq_f->mpq_b = mpq_b; - mpq_f->nblocks = (mpq_f->mpq_b->fsize + mpq_a->blocksize - 1) / mpq_a->blocksize; - mpq_f->mpq_h = &mpq_h; - mpq_f->accessed = FALSE; - mpq_f->blockposloaded = FALSE; + /* initialize file structure */ + memset(mpq_f, 0, sizeof(mpq_file)); + mpq_f->mpq_b = mpq_b; + mpq_f->nblocks = (mpq_f->mpq_b->fsize + mpq_a->blocksize - 1) / mpq_a->blocksize; + mpq_f->mpq_h = &mpq_h; + mpq_f->accessed = FALSE; + mpq_f->blockposloaded = FALSE; - /* allocate buffers for decompression. */ - if (mpq_f->mpq_b->flags & LIBMPQ_FILE_COMPRESSED) { + /* allocate buffers for decompression. */ + if (mpq_f->mpq_b->flags & LIBMPQ_FILE_COMPRESSED) { - /* - * Allocate buffer for block positions. At the begin of file are stored - * unsigned ints holding positions of each block relative from begin of - * file in the archive. - */ - if ((mpq_f->blockpos = (unsigned int*)malloc(sizeof(int) * (mpq_f->nblocks + 1))) == NULL) { - return LIBMPQ_EALLOCMEM; - } - } + /* + * Allocate buffer for block positions. At the begin of file are stored + * unsigned ints holding positions of each block relative from begin of + * file in the archive. + */ + if ((mpq_f->blockpos = (unsigned int*)malloc(sizeof(int) * (mpq_f->nblocks + 1))) == NULL) { + return LIBMPQ_EALLOCMEM; + } + } if(libmpq_file_read_file(mpq_a, mpq_f, 0, (char*)dest, mpq_b->fsize) == mpq_b->fsize) success = 1; if (mpq_f->mpq_b->flags & LIBMPQ_FILE_COMPRESSED) { // Free buffer for block positions - - free(mpq_f->blockpos); - } - /* freeing the file structure */ - free(mpq_f); - return success?LIBMPQ_TOOLS_SUCCESS:LIBMPQ_EFILE_CORRUPT; + + free(mpq_f->blockpos); + } + /* freeing the file structure */ + free(mpq_f); + return success?LIBMPQ_TOOLS_SUCCESS:LIBMPQ_EFILE_CORRUPT; } diff --git a/contrib/extractor/libmpq/mpq.h b/contrib/extractor/libmpq/mpq.h index 55b72ad75a9..58eef6bead2 100644 --- a/contrib/extractor/libmpq/mpq.h +++ b/contrib/extractor/libmpq/mpq.h @@ -33,61 +33,61 @@ #include #ifndef PATH_MAX - #define PATH_MAX 260 + #define PATH_MAX 260 #endif -#define LIBMPQ_MAJOR_VERSION 0 /* Major version number... maybe sometimes we reach version 1 :) */ -#define LIBMPQ_MINOR_VERSION 3 /* Minor version number - increased only for small changes */ -#define LIBMPQ_PATCH_VERSION 0 /* Patchlevel - changed on bugfixes etc... */ +#define LIBMPQ_MAJOR_VERSION 0 /* Major version number... maybe sometimes we reach version 1 :) */ +#define LIBMPQ_MINOR_VERSION 3 /* Minor version number - increased only for small changes */ +#define LIBMPQ_PATCH_VERSION 0 /* Patchlevel - changed on bugfixes etc... */ -#define LIBMPQ_TOOLS_SUCCESS 0 /* return value for all functions which success */ -#define LIBMPQ_TOOLS_BUFSIZE 0x500 /* buffer size for the decryption engine */ +#define LIBMPQ_TOOLS_SUCCESS 0 /* return value for all functions which success */ +#define LIBMPQ_TOOLS_BUFSIZE 0x500 /* buffer size for the decryption engine */ -#define LIBMPQ_EFILE -1 /* error on file operation */ -#define LIBMPQ_EFILE_FORMAT -2 /* bad file format */ -#define LIBMPQ_EFILE_CORRUPT -3 /* file corrupt */ -#define LIBMPQ_EFILE_NOT_FOUND -4 /* file in archive not found */ -#define LIBMPQ_EFILE_READ -5 /* Read error in archive */ -#define LIBMPQ_EALLOCMEM -6 /* maybe not enough memory? :) */ -#define LIBMPQ_EFREEMEM -7 /* can not free memory */ -#define LIBMPQ_EINV_RANGE -8 /* Given filenumber is out of range */ -#define LIBMPQ_EHASHTABLE -9 /* error in reading hashtable */ -#define LIBMPQ_EBLOCKTABLE -10 /* error in reading blocktable */ +#define LIBMPQ_EFILE -1 /* error on file operation */ +#define LIBMPQ_EFILE_FORMAT -2 /* bad file format */ +#define LIBMPQ_EFILE_CORRUPT -3 /* file corrupt */ +#define LIBMPQ_EFILE_NOT_FOUND -4 /* file in archive not found */ +#define LIBMPQ_EFILE_READ -5 /* Read error in archive */ +#define LIBMPQ_EALLOCMEM -6 /* maybe not enough memory? :) */ +#define LIBMPQ_EFREEMEM -7 /* can not free memory */ +#define LIBMPQ_EINV_RANGE -8 /* Given filenumber is out of range */ +#define LIBMPQ_EHASHTABLE -9 /* error in reading hashtable */ +#define LIBMPQ_EBLOCKTABLE -10 /* error in reading blocktable */ -#define LIBMPQ_ID_MPQ 0x1A51504D /* MPQ archive header ID ('MPQ\x1A') */ -#define LIBMPQ_HEADER_W3M 0x6D9E4B86 /* special value used by W3M Map Protector */ -#define LIBMPQ_FLAG_PROTECTED 0x00000002 /* Set on protected MPQs (like W3M maps) */ -#define LIBMPQ_HASH_ENTRY_DELETED 0xFFFFFFFE /* Block index for deleted hash entry */ +#define LIBMPQ_ID_MPQ 0x1A51504D /* MPQ archive header ID ('MPQ\x1A') */ +#define LIBMPQ_HEADER_W3M 0x6D9E4B86 /* special value used by W3M Map Protector */ +#define LIBMPQ_FLAG_PROTECTED 0x00000002 /* Set on protected MPQs (like W3M maps) */ +#define LIBMPQ_HASH_ENTRY_DELETED 0xFFFFFFFE /* Block index for deleted hash entry */ -#define LIBMPQ_FILE_COMPRESS_PKWARE 0x00000100 /* Compression made by PKWARE Data Compression Library */ -#define LIBMPQ_FILE_COMPRESS_MULTI 0x00000200 /* Multiple compressions */ -#define LIBMPQ_FILE_COMPRESSED 0x0000FF00 /* File is compressed */ -#define LIBMPQ_FILE_EXISTS 0x80000000 /* Set if file exists, reset when the file was deleted */ -#define LIBMPQ_FILE_ENCRYPTED 0x00010000 /* Indicates whether file is encrypted */ +#define LIBMPQ_FILE_COMPRESS_PKWARE 0x00000100 /* Compression made by PKWARE Data Compression Library */ +#define LIBMPQ_FILE_COMPRESS_MULTI 0x00000200 /* Multiple compressions */ +#define LIBMPQ_FILE_COMPRESSED 0x0000FF00 /* File is compressed */ +#define LIBMPQ_FILE_EXISTS 0x80000000 /* Set if file exists, reset when the file was deleted */ +#define LIBMPQ_FILE_ENCRYPTED 0x00010000 /* Indicates whether file is encrypted */ #define LIBMPQ_FILE_HAS_METADATA 0x04000000 -#define LIBMPQ_FILE_COMPRESSED_SIZE 1 /* MPQ compressed filesize of given file */ -#define LIBMPQ_FILE_UNCOMPRESSED_SIZE 2 /* MPQ uncompressed filesize of given file */ -#define LIBMPQ_FILE_COMPRESSION_TYPE 3 /* MPQ compression type of given file */ -#define LIBMPQ_FILE_TYPE_INT 4 /* file is given by number */ -#define LIBMPQ_FILE_TYPE_CHAR 5 /* file is given by name */ +#define LIBMPQ_FILE_COMPRESSED_SIZE 1 /* MPQ compressed filesize of given file */ +#define LIBMPQ_FILE_UNCOMPRESSED_SIZE 2 /* MPQ uncompressed filesize of given file */ +#define LIBMPQ_FILE_COMPRESSION_TYPE 3 /* MPQ compression type of given file */ +#define LIBMPQ_FILE_TYPE_INT 4 /* file is given by number */ +#define LIBMPQ_FILE_TYPE_CHAR 5 /* file is given by name */ -#define LIBMPQ_MPQ_ARCHIVE_SIZE 1 /* MPQ archive size */ -#define LIBMPQ_MPQ_HASHTABLE_SIZE 2 /* MPQ archive hashtable size */ -#define LIBMPQ_MPQ_BLOCKTABLE_SIZE 3 /* MPQ archive blocktable size */ -#define LIBMPQ_MPQ_BLOCKSIZE 4 /* MPQ archive blocksize */ -#define LIBMPQ_MPQ_NUMFILES 5 /* Number of files in the MPQ archive */ -#define LIBMPQ_MPQ_COMPRESSED_SIZE 6 /* Compressed archive size */ -#define LIBMPQ_MPQ_UNCOMPRESSED_SIZE 7 /* Uncompressed archive size */ +#define LIBMPQ_MPQ_ARCHIVE_SIZE 1 /* MPQ archive size */ +#define LIBMPQ_MPQ_HASHTABLE_SIZE 2 /* MPQ archive hashtable size */ +#define LIBMPQ_MPQ_BLOCKTABLE_SIZE 3 /* MPQ archive blocktable size */ +#define LIBMPQ_MPQ_BLOCKSIZE 4 /* MPQ archive blocksize */ +#define LIBMPQ_MPQ_NUMFILES 5 /* Number of files in the MPQ archive */ +#define LIBMPQ_MPQ_COMPRESSED_SIZE 6 /* Compressed archive size */ +#define LIBMPQ_MPQ_UNCOMPRESSED_SIZE 7 /* Uncompressed archive size */ -#define LIBMPQ_HUFF_DECOMPRESS 0 /* Defines that we want to decompress using huffman trees. */ +#define LIBMPQ_HUFF_DECOMPRESS 0 /* Defines that we want to decompress using huffman trees. */ -#define LIBMPQ_CONF_EFILE_OPEN -1 /* error if a specific listfile was forced and could not be opened. */ -#define LIBMPQ_CONF_EFILE_CORRUPT -2 /* listfile seems to be corrupt */ -#define LIBMPQ_CONF_EFILE_LIST_CORRUPT -3 /* listfile seems correct, but filelist is broken */ -#define LIBMPQ_CONF_EFILE_NOT_FOUND -4 /* error if no matching listfile found */ -#define LIBMPQ_CONF_EFILE_VERSION -5 /* libmpq version does not match required listfile version */ +#define LIBMPQ_CONF_EFILE_OPEN -1 /* error if a specific listfile was forced and could not be opened. */ +#define LIBMPQ_CONF_EFILE_CORRUPT -2 /* listfile seems to be corrupt */ +#define LIBMPQ_CONF_EFILE_LIST_CORRUPT -3 /* listfile seems correct, but filelist is broken */ +#define LIBMPQ_CONF_EFILE_NOT_FOUND -4 /* error if no matching listfile found */ +#define LIBMPQ_CONF_EFILE_VERSION -5 /* libmpq version does not match required listfile version */ #ifndef FALSE #define FALSE 0 @@ -102,95 +102,95 @@ #endif */ -typedef unsigned int mpq_buffer[LIBMPQ_TOOLS_BUFSIZE]; -typedef int (*DECOMPRESS)(char *, int *, char *, int); +typedef unsigned int mpq_buffer[LIBMPQ_TOOLS_BUFSIZE]; +typedef int (*DECOMPRESS)(char *, int *, char *, int); typedef struct { - unsigned long mask; /* Decompression bit */ - DECOMPRESS decompress; /* Decompression function */ + unsigned long mask; /* Decompression bit */ + DECOMPRESS decompress; /* Decompression function */ } decompress_table; /* MPQ file header */ typedef struct { - unsigned int id; /* The 0x1A51504D ('MPQ\x1A') signature */ - unsigned int offset; /* Offset of the first file (Relative to MPQ start) */ - unsigned int archivesize; /* Size of MPQ archive */ - unsigned short offsetsc; /* 0000 for SC and BW */ - unsigned short blocksize; /* Size of file block is (0x200 << blockSize) */ - unsigned int hashtablepos; /* File position of hashTable */ - unsigned int blocktablepos; /* File position of blockTable. Each entry has 16 bytes */ - unsigned int hashtablesize; /* Number of entries in hash table */ - unsigned int blocktablesize; /* Number of entries in the block table */ + unsigned int id; /* The 0x1A51504D ('MPQ\x1A') signature */ + unsigned int offset; /* Offset of the first file (Relative to MPQ start) */ + unsigned int archivesize; /* Size of MPQ archive */ + unsigned short offsetsc; /* 0000 for SC and BW */ + unsigned short blocksize; /* Size of file block is (0x200 << blockSize) */ + unsigned int hashtablepos; /* File position of hashTable */ + unsigned int blocktablepos; /* File position of blockTable. Each entry has 16 bytes */ + unsigned int hashtablesize; /* Number of entries in hash table */ + unsigned int blocktablesize; /* Number of entries in the block table */ } mpq_header; //} __attribute__ ((packed)) mpq_header; /* Hash entry. All files in the archive are searched by their hashes. */ typedef struct { - unsigned int name1; /* The first two unsigned ints */ - unsigned int name2; /* are the encrypted file name */ - unsigned int locale; /* Locale information. */ - unsigned int blockindex; /* Index to file description block */ + unsigned int name1; /* The first two unsigned ints */ + unsigned int name2; /* are the encrypted file name */ + unsigned int locale; /* Locale information. */ + unsigned int blockindex; /* Index to file description block */ } mpq_hash; /* File description block contains informations about the file */ typedef struct { - unsigned int filepos; /* Block file starting position in the archive */ - unsigned int csize; /* Compressed file size */ - unsigned int fsize; /* Uncompressed file size */ - unsigned int flags; /* Flags */ + unsigned int filepos; /* Block file starting position in the archive */ + unsigned int csize; /* Compressed file size */ + unsigned int fsize; /* Uncompressed file size */ + unsigned int flags; /* Flags */ } mpq_block; /* File handle structure used since Diablo 1.00 (0x38 bytes) */ typedef struct { - unsigned char filename[PATH_MAX]; /* filename of the actual file in the archive */ - int fd; /* File handle */ - unsigned int seed; /* Seed used for file decrypt */ - unsigned int filepos; /* Current file position */ - unsigned int offset; - unsigned int nblocks; /* Number of blocks in the file (incl. the last noncomplete one) */ - unsigned int *blockpos; /* Position of each file block (only for compressed files) */ - int blockposloaded; /* TRUE if block positions loaded */ - unsigned int offset2; /* (Number of bytes somewhere ?) */ - mpq_hash *mpq_h; /* Hash table entry */ - mpq_block *mpq_b; /* File block pointer */ + unsigned char filename[PATH_MAX]; /* filename of the actual file in the archive */ + int fd; /* File handle */ + unsigned int seed; /* Seed used for file decrypt */ + unsigned int filepos; /* Current file position */ + unsigned int offset; + unsigned int nblocks; /* Number of blocks in the file (incl. the last noncomplete one) */ + unsigned int *blockpos; /* Position of each file block (only for compressed files) */ + int blockposloaded; /* TRUE if block positions loaded */ + unsigned int offset2; /* (Number of bytes somewhere ?) */ + mpq_hash *mpq_h; /* Hash table entry */ + mpq_block *mpq_b; /* File block pointer */ - /* Non-Storm.dll members */ + /* Non-Storm.dll members */ - unsigned int accessed; /* Was something from the file already read? */ + unsigned int accessed; /* Was something from the file already read? */ } mpq_file; /* List handle structure */ typedef struct { - unsigned char mpq_version[10]; /* libmpq version required by the listfile */ - unsigned char mpq_name[PATH_MAX]; /* mpq archive name without full path */ - unsigned char mpq_type[20]; /* mpq archive type */ - unsigned char mpq_game[40]; /* blizzard title the file matches */ - unsigned char mpq_game_version[10]; /* game version */ - unsigned char **mpq_files; /* filelist */ + unsigned char mpq_version[10]; /* libmpq version required by the listfile */ + unsigned char mpq_name[PATH_MAX]; /* mpq archive name without full path */ + unsigned char mpq_type[20]; /* mpq archive type */ + unsigned char mpq_game[40]; /* blizzard title the file matches */ + unsigned char mpq_game_version[10]; /* game version */ + unsigned char **mpq_files; /* filelist */ } mpq_list; /* Archive handle structure used since Diablo 1.00 */ typedef struct { - unsigned char filename[PATH_MAX]; /* Opened archive file name */ - int fd; /* File handle */ - unsigned int blockpos; /* Position of loaded block in the file */ - unsigned int blocksize; /* Size of file block */ - unsigned char *blockbuf; /* Buffer (cache) for file block */ - unsigned int bufpos; /* Position in block buffer */ - unsigned int mpqpos; /* MPQ archive position in the file */ - unsigned int filepos; /* Current file pointer */ - unsigned int openfiles; /* Number of open files + 1 */ - mpq_buffer buf; /* MPQ buffer */ - mpq_header *header; /* MPQ file header */ - mpq_hash *hashtable; /* Hash table */ - mpq_block *blocktable; /* Block table */ + unsigned char filename[PATH_MAX]; /* Opened archive file name */ + int fd; /* File handle */ + unsigned int blockpos; /* Position of loaded block in the file */ + unsigned int blocksize; /* Size of file block */ + unsigned char *blockbuf; /* Buffer (cache) for file block */ + unsigned int bufpos; /* Position in block buffer */ + unsigned int mpqpos; /* MPQ archive position in the file */ + unsigned int filepos; /* Current file pointer */ + unsigned int openfiles; /* Number of open files + 1 */ + mpq_buffer buf; /* MPQ buffer */ + mpq_header *header; /* MPQ file header */ + mpq_hash *hashtable; /* Hash table */ + mpq_block *blocktable; /* Block table */ - /* Non-Storm.dll members */ + /* Non-Storm.dll members */ - mpq_list *mpq_l; /* Handle to file list from database */ + mpq_list *mpq_l; /* Handle to file list from database */ - unsigned int flags; /* See LIBMPQ_TOOLS_FLAG_XXXXX */ - unsigned int maxblockindex; /* The highest block table entry */ + unsigned int flags; /* See LIBMPQ_TOOLS_FLAG_XXXXX */ + unsigned int maxblockindex; /* The highest block table entry */ } mpq_archive; extern char *libmpq_version(); @@ -213,13 +213,13 @@ extern int libmpq_wave_decompress_mono(char *out_buf, int *out_length, char *in_ extern int libmpq_multi_decompress(char *out_buf, int *pout_length, char *in_buf, int in_length); static decompress_table dcmp_table[] = { - {0x08, libmpq_pkzip_decompress}, /* Decompression with Pkware Data Compression Library */ - {0x02, libmpq_zlib_decompress}, /* Decompression with the "zlib" library */ - {0x01, libmpq_huff_decompress}, /* Huffmann decompression */ - {0x80, libmpq_wave_decompress_stereo}, /* WAVE decompression for stereo waves */ - {0x40, libmpq_wave_decompress_mono} /* WAVE decompression for mono waves */ + {0x08, libmpq_pkzip_decompress}, /* Decompression with Pkware Data Compression Library */ + {0x02, libmpq_zlib_decompress}, /* Decompression with the "zlib" library */ + {0x01, libmpq_huff_decompress}, /* Huffmann decompression */ + {0x80, libmpq_wave_decompress_stereo}, /* WAVE decompression for stereo waves */ + {0x40, libmpq_wave_decompress_mono} /* WAVE decompression for mono waves */ }; int libmpq_file_extract(mpq_archive *mpq_a, const int number, const char *filename); int libmpq_file_getdata(mpq_archive *mpq_a, mpq_hash mpq_h, const int number, unsigned char *dest); -#endif /* _MPQ_H */ +#endif /* _MPQ_H */ diff --git a/contrib/extractor/libmpq/parser.cpp b/contrib/extractor/libmpq/parser.cpp index 435395b8767..5bd620aa74c 100644 --- a/contrib/extractor/libmpq/parser.cpp +++ b/contrib/extractor/libmpq/parser.cpp @@ -34,21 +34,21 @@ * deleted but \" would not. */ char *libmpq_conf_delete_char(char *buf, char *chars) { - static char *temp; - char ch; + static char *temp; + char ch; - temp = buf; + temp = buf; - /* strip out special chars like " */ - while (temp = strpbrk(temp, chars)) { - ch = temp[0]; - memmove(&temp[0], &temp[1], strlen(temp)); - if (ch == '\\') { - temp++; - } - } + /* strip out special chars like " */ + while (temp = strpbrk(temp, chars)) { + ch = temp[0]; + memmove(&temp[0], &temp[1], strlen(temp)); + if (ch == '\\') { + temp++; + } + } - return buf; + return buf; } /* @@ -56,65 +56,65 @@ char *libmpq_conf_delete_char(char *buf, char *chars) { * return 1 on success and the byte array or 0 and null. */ int libmpq_conf_parse_line(char *line, char *search_value, char *return_value, int size) { - int level = 0; - int found = 0; - int i = 0; - int pos = 0; + int level = 0; + int found = 0; + int i = 0; + int pos = 0; - /* search value */ - while (*(++line)) { + /* search value */ + while (*(++line)) { - /* check for spaces */ - if (!isspace(*line) && level == 1) { + /* check for spaces */ + if (!isspace(*line) && level == 1) { - /* we found our value so break */ - found = 1; - break; - } + /* we found our value so break */ + found = 1; + break; + } - /* check for '=' so the value follows as next parameter */ - if (*line == '=' && level == 0) { - level = 1; - } - } + /* check for '=' so the value follows as next parameter */ + if (*line == '=' && level == 0) { + level = 1; + } + } - /* now search for comment in this line */ - for (i = 0; i < int(strlen(line)); i++) { - if (line[i] == '#') { - pos = i - 1; - break; - } - } + /* now search for comment in this line */ + for (i = 0; i < int(strlen(line)); i++) { + if (line[i] == '#') { + pos = i - 1; + break; + } + } - /* now set end of byte array behind value, but only if comment was found */ - if (pos != 0) { - for (i = pos; i >= 0; i--) { - if (line[i] != ' ' && line[i] != '\t') { - line[i + 1] = '\0'; - break; - } - } - } + /* now set end of byte array behind value, but only if comment was found */ + if (pos != 0) { + for (i = pos; i >= 0; i--) { + if (line[i] != ' ' && line[i] != '\t') { + line[i + 1] = '\0'; + break; + } + } + } - /* now check if line has trailing spaces */ - for (i = strlen(line); i >= 0; i--) { - if (line[i] != ' ' && line[i] != '\t') { - line[i + 1] = '\0'; - break; - } - } + /* now check if line has trailing spaces */ + for (i = strlen(line); i >= 0; i--) { + if (line[i] != ' ' && line[i] != '\t') { + line[i + 1] = '\0'; + break; + } + } - /* now check if value is quoted with "" and if there is a char behind. */ - for (i = strlen(line); i >= 0; i--) { - if (line[i] == '"') { - line[i + 1] = '\0'; - break; - } - } + /* now check if value is quoted with "" and if there is a char behind. */ + for (i = strlen(line); i >= 0; i--) { + if (line[i] == '"') { + line[i + 1] = '\0'; + break; + } + } - /* return the values */ - strncpy(return_value, line, size); - return found; + /* return the values */ + strncpy(return_value, line, size); + return found; } /* @@ -122,70 +122,70 @@ int libmpq_conf_parse_line(char *line, char *search_value, char *return_value, i * listdb or config file. On success it returns 1, otherwise 0. */ int libmpq_conf_get_value(FILE *fp, char *search_value, void *return_value, int type, int size) { - char buf[LIBMPQ_CONF_BUFSIZE]; - int found = 0; - int result = LIBMPQ_TOOLS_SUCCESS; + char buf[LIBMPQ_CONF_BUFSIZE]; + int found = 0; + int result = LIBMPQ_TOOLS_SUCCESS; - while (fgets(buf, LIBMPQ_CONF_BUFSIZE, fp) != NULL) { - char *line; + while (fgets(buf, LIBMPQ_CONF_BUFSIZE, fp) != NULL) { + char *line; - buf[strlen(buf) - 1] = '\0'; + buf[strlen(buf) - 1] = '\0'; - /* skip whitespace */ - for (line = buf; isspace(*line); line++) { - continue; - } + /* skip whitespace */ + for (line = buf; isspace(*line); line++) { + continue; + } - /* skip empty line */ - if (line[0] == '\0') { - continue; - } + /* skip empty line */ + if (line[0] == '\0') { + continue; + } - /* skip comments */ - if (line[0] == '#') { - continue; - } + /* skip comments */ + if (line[0] == '#') { + continue; + } - /* process the line */ - //if (!strncasecmp(line, search_value, strlen(search_value))) { + /* process the line */ + //if (!strncasecmp(line, search_value, strlen(search_value))) { if (!strcmp(line, search_value)) { - found = libmpq_conf_parse_line(line, search_value, line, LIBMPQ_CONF_BUFSIZE); - if (found == 1) { - libmpq_conf_delete_char(line, "\"\\"); + found = libmpq_conf_parse_line(line, search_value, line, LIBMPQ_CONF_BUFSIZE); + if (found == 1) { + libmpq_conf_delete_char(line, "\"\\"); - switch (type) { - case LIBMPQ_CONF_TYPE_INT: + switch (type) { + case LIBMPQ_CONF_TYPE_INT: - /* if it is no valid number it is safe to return 0 */ - *(int *)return_value = atoi(line); - break; - default: - strncpy((char *)return_value, line, size); - break; - } + /* if it is no valid number it is safe to return 0 */ + *(int *)return_value = atoi(line); + break; + default: + strncpy((char *)return_value, line, size); + break; + } - /* value found, so rewind stream */ - break; - } - } - } + /* value found, so rewind stream */ + break; + } + } + } - /* if value was not found */ - if (found == 0) { - switch (type) { - case LIBMPQ_CONF_TYPE_INT: - *(int *)return_value = 0; - result = LIBMPQ_CONF_EVALUE_NOT_FOUND; - break; - default: - strncpy((char *)return_value, "", size); - result = LIBMPQ_CONF_EVALUE_NOT_FOUND; - break; - } - } - fseek(fp, 0L, SEEK_SET); + /* if value was not found */ + if (found == 0) { + switch (type) { + case LIBMPQ_CONF_TYPE_INT: + *(int *)return_value = 0; + result = LIBMPQ_CONF_EVALUE_NOT_FOUND; + break; + default: + strncpy((char *)return_value, "", size); + result = LIBMPQ_CONF_EVALUE_NOT_FOUND; + break; + } + } + fseek(fp, 0L, SEEK_SET); - return result; + return result; } /* @@ -194,101 +194,101 @@ int libmpq_conf_get_value(FILE *fp, char *search_value, void *return_value, int * entries in the byte array. On success it returns 1, otherwise 0. */ int libmpq_conf_get_array(FILE *fp, char *search_value, char ***filelist, int *entries) { - char buf[LIBMPQ_CONF_BUFSIZE]; - char temp[LIBMPQ_CONF_BUFSIZE]; - int level = 0; - int array_start = 0; - int array_end = 0; - int fl_count; - int fl_size; - int found = 0; - int i = 0; + char buf[LIBMPQ_CONF_BUFSIZE]; + char temp[LIBMPQ_CONF_BUFSIZE]; + int level = 0; + int array_start = 0; + int array_end = 0; + int fl_count; + int fl_size; + int found = 0; + int i = 0; - *entries = 0; + *entries = 0; - /* allocate memory for the file list */ - (*filelist) = (char **)malloc(LIBMPQ_CONF_FL_INCREMENT * sizeof(char *)); - fl_count = 0; - fl_size = LIBMPQ_CONF_FL_INCREMENT; + /* allocate memory for the file list */ + (*filelist) = (char **)malloc(LIBMPQ_CONF_FL_INCREMENT * sizeof(char *)); + fl_count = 0; + fl_size = LIBMPQ_CONF_FL_INCREMENT; - while (fgets(buf, LIBMPQ_CONF_BUFSIZE, fp) != NULL) { - char *line; + while (fgets(buf, LIBMPQ_CONF_BUFSIZE, fp) != NULL) { + char *line; - buf[strlen(buf) - 1] = '\0'; + buf[strlen(buf) - 1] = '\0'; - /* skip whitespace */ - for (line = buf; isspace(*line); line++) { - continue; - } + /* skip whitespace */ + for (line = buf; isspace(*line); line++) { + continue; + } - /* skip empty line */ - if (line[0] == '\0') { - continue; - } + /* skip empty line */ + if (line[0] == '\0') { + continue; + } - /* skip comments */ - if (line[0] == '#') { - continue; - } + /* skip comments */ + if (line[0] == '#') { + continue; + } - /* check for array end ) */ - if (*line == ')') { - array_end = 1; - break; - } + /* check for array end ) */ + if (*line == ')') { + array_end = 1; + break; + } - /* process entries between () */ - if (array_start == 1 && array_end == 0) { + /* process entries between () */ + if (array_start == 1 && array_end == 0) { - /* add dummy option to use with libmpq_conf_parse_line() */ - strncpy(temp, "MPQ_BUFFER = ", LIBMPQ_CONF_BUFSIZE); - strncat(temp, line, LIBMPQ_CONF_BUFSIZE); - found = libmpq_conf_parse_line(temp, "MPQ_BUFFER", temp, LIBMPQ_CONF_BUFSIZE); + /* add dummy option to use with libmpq_conf_parse_line() */ + strncpy(temp, "MPQ_BUFFER = ", LIBMPQ_CONF_BUFSIZE); + strncat(temp, line, LIBMPQ_CONF_BUFSIZE); + found = libmpq_conf_parse_line(temp, "MPQ_BUFFER", temp, LIBMPQ_CONF_BUFSIZE); - if (found == 1) { - libmpq_conf_delete_char(temp, "\"\\"); + if (found == 1) { + libmpq_conf_delete_char(temp, "\"\\"); - /* set the next filelist entry to a copy of the file */ - (*filelist)[fl_count++] = _strdup(temp); + /* set the next filelist entry to a copy of the file */ + (*filelist)[fl_count++] = _strdup(temp); - /* increase the array size */ - if (fl_count == fl_size) { - (*filelist) = (char **)realloc((*filelist), (fl_size + LIBMPQ_CONF_FL_INCREMENT) * sizeof(char *)); - fl_size += LIBMPQ_CONF_FL_INCREMENT; - } + /* increase the array size */ + if (fl_count == fl_size) { + (*filelist) = (char **)realloc((*filelist), (fl_size + LIBMPQ_CONF_FL_INCREMENT) * sizeof(char *)); + fl_size += LIBMPQ_CONF_FL_INCREMENT; + } - /* increase number of entries */ - (*entries)++; - } - } + /* increase number of entries */ + (*entries)++; + } + } - /* process the line and search array start */ - //if (!strncasecmp(line, search_value, strlen(search_value))) { + /* process the line and search array start */ + //if (!strncasecmp(line, search_value, strlen(search_value))) { if (!strcmp(line, search_value)) { - /* search value */ - while (*(++line)) { + /* search value */ + while (*(++line)) { - /* check for array start ( */ - if (*line == '(' && level == 1) { + /* check for array start ( */ + if (*line == '(' && level == 1) { - /* we found our value so break */ - array_start = 1; - break; - } + /* we found our value so break */ + array_start = 1; + break; + } - /* check for '=' so the value follows as next parameter */ - if (*line == '=' && level == 0) { - level = 1; - } - } - } - } + /* check for '=' so the value follows as next parameter */ + if (*line == '=' && level == 0) { + level = 1; + } + } + } + } - /* we got all files, so rewind stream */ - fseek(fp, 0L, SEEK_SET); + /* we got all files, so rewind stream */ + fseek(fp, 0L, SEEK_SET); - (*filelist)[fl_count] = NULL; + (*filelist)[fl_count] = NULL; - return found; + return found; } diff --git a/contrib/extractor/libmpq/wave.cpp b/contrib/extractor/libmpq/wave.cpp index 8edc1f7fa41..d5c59d8e085 100644 --- a/contrib/extractor/libmpq/wave.cpp +++ b/contrib/extractor/libmpq/wave.cpp @@ -29,25 +29,25 @@ /* Tables necessary dor decompression */ static unsigned long wave_table_1503f120[] = { - 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0x00000004, 0xFFFFFFFF, 0x00000002, 0xFFFFFFFF, 0x00000006, - 0xFFFFFFFF, 0x00000001, 0xFFFFFFFF, 0x00000005, 0xFFFFFFFF, 0x00000003, 0xFFFFFFFF, 0x00000007, - 0xFFFFFFFF, 0x00000001, 0xFFFFFFFF, 0x00000005, 0xFFFFFFFF, 0x00000003, 0xFFFFFFFF, 0x00000007, - 0xFFFFFFFF, 0x00000002, 0xFFFFFFFF, 0x00000004, 0xFFFFFFFF, 0x00000006, 0xFFFFFFFF, 0x00000008 + 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0x00000004, 0xFFFFFFFF, 0x00000002, 0xFFFFFFFF, 0x00000006, + 0xFFFFFFFF, 0x00000001, 0xFFFFFFFF, 0x00000005, 0xFFFFFFFF, 0x00000003, 0xFFFFFFFF, 0x00000007, + 0xFFFFFFFF, 0x00000001, 0xFFFFFFFF, 0x00000005, 0xFFFFFFFF, 0x00000003, 0xFFFFFFFF, 0x00000007, + 0xFFFFFFFF, 0x00000002, 0xFFFFFFFF, 0x00000004, 0xFFFFFFFF, 0x00000006, 0xFFFFFFFF, 0x00000008 }; static unsigned long wave_table_1503f1a0[] = { - 0x00000007, 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x0000000E, - 0x00000010, 0x00000011, 0x00000013, 0x00000015, 0x00000017, 0x00000019, 0x0000001C, 0x0000001F, - 0x00000022, 0x00000025, 0x00000029, 0x0000002D, 0x00000032, 0x00000037, 0x0000003C, 0x00000042, - 0x00000049, 0x00000050, 0x00000058, 0x00000061, 0x0000006B, 0x00000076, 0x00000082, 0x0000008F, - 0x0000009D, 0x000000AD, 0x000000BE, 0x000000D1, 0x000000E6, 0x000000FD, 0x00000117, 0x00000133, - 0x00000151, 0x00000173, 0x00000198, 0x000001C1, 0x000001EE, 0x00000220, 0x00000256, 0x00000292, - 0x000002D4, 0x0000031C, 0x0000036C, 0x000003C3, 0x00000424, 0x0000048E, 0x00000502, 0x00000583, - 0x00000610, 0x000006AB, 0x00000756, 0x00000812, 0x000008E0, 0x000009C3, 0x00000ABD, 0x00000BD0, - 0x00000CFF, 0x00000E4C, 0x00000FBA, 0x0000114C, 0x00001307, 0x000014EE, 0x00001706, 0x00001954, - 0x00001BDC, 0x00001EA5, 0x000021B6, 0x00002515, 0x000028CA, 0x00002CDF, 0x0000315B, 0x0000364B, - 0x00003BB9, 0x000041B2, 0x00004844, 0x00004F7E, 0x00005771, 0x0000602F, 0x000069CE, 0x00007462, - 0x00007FFF + 0x00000007, 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x0000000E, + 0x00000010, 0x00000011, 0x00000013, 0x00000015, 0x00000017, 0x00000019, 0x0000001C, 0x0000001F, + 0x00000022, 0x00000025, 0x00000029, 0x0000002D, 0x00000032, 0x00000037, 0x0000003C, 0x00000042, + 0x00000049, 0x00000050, 0x00000058, 0x00000061, 0x0000006B, 0x00000076, 0x00000082, 0x0000008F, + 0x0000009D, 0x000000AD, 0x000000BE, 0x000000D1, 0x000000E6, 0x000000FD, 0x00000117, 0x00000133, + 0x00000151, 0x00000173, 0x00000198, 0x000001C1, 0x000001EE, 0x00000220, 0x00000256, 0x00000292, + 0x000002D4, 0x0000031C, 0x0000036C, 0x000003C3, 0x00000424, 0x0000048E, 0x00000502, 0x00000583, + 0x00000610, 0x000006AB, 0x00000756, 0x00000812, 0x000008E0, 0x000009C3, 0x00000ABD, 0x00000BD0, + 0x00000CFF, 0x00000E4C, 0x00000FBA, 0x0000114C, 0x00001307, 0x000014EE, 0x00001706, 0x00001954, + 0x00001BDC, 0x00001EA5, 0x000021B6, 0x00002515, 0x000028CA, 0x00002CDF, 0x0000315B, 0x0000364B, + 0x00003BB9, 0x000041B2, 0x00004844, 0x00004F7E, 0x00005771, 0x0000602F, 0x000069CE, 0x00007462, + 0x00007FFF }; /* @@ -56,130 +56,130 @@ static unsigned long wave_table_1503f1a0[] = { * Offset: 1500F230 */ int libmpq_wave_decompress(unsigned char *out_buf, int out_length, unsigned char *in_buf, int in_length, int channels) { - byte_and_short out; - byte_and_short in; - unsigned char *in_end = in_buf + in_length; /* End on input buffer */ - unsigned long index; - long nr_array1[2]; - long nr_array2[2]; - int count = 0; + byte_and_short out; + byte_and_short in; + unsigned char *in_end = in_buf + in_length; /* End on input buffer */ + unsigned long index; + long nr_array1[2]; + long nr_array2[2]; + int count = 0; - out.pb = out_buf; - in.pb = in_buf; - nr_array1[0] = 0x2C; - nr_array1[1] = 0x2C; - in.pw++; + out.pb = out_buf; + in.pb = in_buf; + nr_array1[0] = 0x2C; + nr_array1[1] = 0x2C; + in.pw++; - /* 15007AD7 */ - for (count = 0; count < channels; count++) { - long temp; - temp = *(short *)in.pw++; - nr_array2[count] = temp; - if (out_length < 2) { - return out.pb - out_buf; - } - *out.pw++ = (unsigned short)temp; - out_length -= 2; - } - index = channels - 1; - while (in.pb < in_end) { - unsigned char one_byte = *in.pb++; - if (channels == 2) { - index = (index == 0) ? 1 : 0; - } + /* 15007AD7 */ + for (count = 0; count < channels; count++) { + long temp; + temp = *(short *)in.pw++; + nr_array2[count] = temp; + if (out_length < 2) { + return out.pb - out_buf; + } + *out.pw++ = (unsigned short)temp; + out_length -= 2; + } + index = channels - 1; + while (in.pb < in_end) { + unsigned char one_byte = *in.pb++; + if (channels == 2) { + index = (index == 0) ? 1 : 0; + } - /* - * Get one byte from input buffer - * 15007B25 - */ - if (one_byte & 0x80) { - /* 15007B32 */ - switch(one_byte & 0x7F) { - case 0: /* 15007B8E */ - if (nr_array1[index] != 0) { - nr_array1[index]--; - } - if (out_length < 2) { - break; - } - *out.pw++ = (unsigned short)nr_array2[index]; - out_length -= 2; - continue; - case 1: /* 15007B72 */ - nr_array1[index] += 8; /* EBX also */ - if (nr_array1[index] > 0x58) { - nr_array1[index] = 0x58; - } - if (channels == 2) { - index = (index == 0) ? 1 : 0; - } - continue; - case 2: - continue; - default: - nr_array1[index] -= 8; - if (nr_array1[index] < 0) { - nr_array1[index] = 0; - } - if (channels != 2) { - continue; - } - index = (index == 0) ? 1 : 0; - continue; - } - } else { - unsigned long temp1 = wave_table_1503f1a0[nr_array1[index]]; /* EDI */ - unsigned long temp2 = temp1 >> in_buf[1]; /* ESI */ - long temp3 = nr_array2[index]; /* ECX */ - if (one_byte & 0x01) { /* EBX = one_byte */ - temp2 += (temp1 >> 0); - } - if (one_byte & 0x02) { - temp2 += (temp1 >> 1); - } - if (one_byte & 0x04) { - temp2 += (temp1 >> 2); - } - if (one_byte & 0x08) { - temp2 += (temp1 >> 3); - } - if (one_byte & 0x10) { - temp2 += (temp1 >> 4); - } - if (one_byte & 0x20) { - temp2 += (temp1 >> 5); - } - if(one_byte & 0x40) { - temp3 -= temp2; - if (temp3 <= (long)0xFFFF8000) { - temp3 = (long)0xFFFF8000; - } - } else { - temp3 += temp2; - if (temp3 >= 0x7FFF) { - temp3 = 0x7FFF; - } - } - nr_array2[index] = temp3; - if (out_length < 2) { - break; - } + /* + * Get one byte from input buffer + * 15007B25 + */ + if (one_byte & 0x80) { + /* 15007B32 */ + switch(one_byte & 0x7F) { + case 0: /* 15007B8E */ + if (nr_array1[index] != 0) { + nr_array1[index]--; + } + if (out_length < 2) { + break; + } + *out.pw++ = (unsigned short)nr_array2[index]; + out_length -= 2; + continue; + case 1: /* 15007B72 */ + nr_array1[index] += 8; /* EBX also */ + if (nr_array1[index] > 0x58) { + nr_array1[index] = 0x58; + } + if (channels == 2) { + index = (index == 0) ? 1 : 0; + } + continue; + case 2: + continue; + default: + nr_array1[index] -= 8; + if (nr_array1[index] < 0) { + nr_array1[index] = 0; + } + if (channels != 2) { + continue; + } + index = (index == 0) ? 1 : 0; + continue; + } + } else { + unsigned long temp1 = wave_table_1503f1a0[nr_array1[index]]; /* EDI */ + unsigned long temp2 = temp1 >> in_buf[1]; /* ESI */ + long temp3 = nr_array2[index]; /* ECX */ + if (one_byte & 0x01) { /* EBX = one_byte */ + temp2 += (temp1 >> 0); + } + if (one_byte & 0x02) { + temp2 += (temp1 >> 1); + } + if (one_byte & 0x04) { + temp2 += (temp1 >> 2); + } + if (one_byte & 0x08) { + temp2 += (temp1 >> 3); + } + if (one_byte & 0x10) { + temp2 += (temp1 >> 4); + } + if (one_byte & 0x20) { + temp2 += (temp1 >> 5); + } + if(one_byte & 0x40) { + temp3 -= temp2; + if (temp3 <= (long)0xFFFF8000) { + temp3 = (long)0xFFFF8000; + } + } else { + temp3 += temp2; + if (temp3 >= 0x7FFF) { + temp3 = 0x7FFF; + } + } + nr_array2[index] = temp3; + if (out_length < 2) { + break; + } - temp2 = nr_array1[index]; - one_byte &= 0x1F; - *out.pw++ = (unsigned short)temp3; - out_length -= 2; - temp2 += wave_table_1503f120[one_byte]; - nr_array1[index] = temp2; + temp2 = nr_array1[index]; + one_byte &= 0x1F; + *out.pw++ = (unsigned short)temp3; + out_length -= 2; + temp2 += wave_table_1503f120[one_byte]; + nr_array1[index] = temp2; - if (nr_array1[index] < 0) { - nr_array1[index] = 0; - } else { - if (nr_array1[index] > 0x58) { - nr_array1[index] = 0x58; - } - } - } - } - return (out.pb - out_buf); + if (nr_array1[index] < 0) { + nr_array1[index] = 0; + } else { + if (nr_array1[index] > 0x58) { + nr_array1[index] = 0x58; + } + } + } + } + return (out.pb - out_buf); } diff --git a/contrib/extractor/libmpq/wave.h b/contrib/extractor/libmpq/wave.h index 8920880a04f..996e8c6777f 100644 --- a/contrib/extractor/libmpq/wave.h +++ b/contrib/extractor/libmpq/wave.h @@ -22,16 +22,16 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + */ #ifndef _WAVE_H #define _WAVE_H typedef union { - unsigned short *pw; - unsigned char *pb; + unsigned short *pw; + unsigned char *pb; } byte_and_short; int libmpq_wave_decompress(unsigned char *out_buf, int out_length, unsigned char *in_buf, int in_length, int channels); -#endif /* _WAVE_H */ +#endif /* _WAVE_H */ diff --git a/contrib/vmap_debugger/G3D/AABSPTree.h b/contrib/vmap_debugger/G3D/AABSPTree.h index 543f06a881e..30eca17d08e 100644 --- a/contrib/vmap_debugger/G3D/AABSPTree.h +++ b/contrib/vmap_debugger/G3D/AABSPTree.h @@ -1,14 +1,14 @@ /** @file AABSPTree.h - + @maintainer Morgan McGuire, matrix@graphics3d.com - + @created 2004-01-11 @edited 2007-02-16 Copyright 2000-2007, Morgan McGuire. All rights reserved. - + */ #ifndef G3D_AABSPTREE_H @@ -89,7 +89,7 @@ namespace G3D { /** Wraps a pointer value so that it can be treated as the instance itself; - convenient for inserting pointers into a Table but using the + convenient for inserting pointers into a Table but using the object equality instead of pointer equality. */ template @@ -136,9 +136,9 @@ namespace G3D { AABSPTree is as powerful as but more general than a Quad Tree, Oct Tree, or KD Tree, but less general than an unconstrained BSP tree (which is much slower to create). - + Internally, objects - are arranged into an axis-aligned BSP-tree according to their + are arranged into an axis-aligned BSP-tree according to their axis-aligned bounds. This increases the cost of insertion to O(log n) but allows fast overlap queries. @@ -158,13 +158,13 @@ namespace G3D { Moving %Set Members
It is important that objects do not move without updating the AABSPTree. If the axis-aligned bounds of an object are about - to change, AABSPTree::remove it before they change and + to change, AABSPTree::remove it before they change and AABSPTree::insert it again afterward. For objects - where the hashCode and == operator are invariant with respect + where the hashCode and == operator are invariant with respect to the 3D position, you can use the AABSPTree::update method as a shortcut to insert/remove an object in one step after it has moved. - + Note: Do not mutate any value once it has been inserted into AABSPTree. Values are copied interally. All AABSPTree iterators convert to pointers to constant @@ -185,9 +185,9 @@ namespace G3D { */ namespace _AABSPTree { - /** Wrapper for a value that includes a cache of its bounds. + /** Wrapper for a value that includes a cache of its bounds. Except for the test value used in a set-query operation, there - is only ever one instance of the handle associated with any + is only ever one instance of the handle associated with any value and the memberTable and Nodes maintain pointers to that heap-allocated value. */ @@ -201,7 +201,7 @@ namespace _AABSPTree { during the median sort, and because MSVC 6 std::sort goes into an infinite loop if we compute the midpoint on the fly (possibly a floating point roundoff issue, where B*>& point, + const Array<_AABSPTree::Handle*>& point, int beginIndex, int endIndex) { - + Vector3 lo = Vector3::inf(); Vector3 hi = -lo; @@ -279,11 +279,11 @@ public: /** Compares centers */ class CenterComparator { public: - Vector3::Axis sortAxis; + Vector3::Axis sortAxis; - CenterComparator(Vector3::Axis a) : sortAxis(a) {} + CenterComparator(Vector3::Axis a) : sortAxis(a) {} - inline int operator()(_AABSPTree::Handle* A, const _AABSPTree::Handle* B) const { + inline int operator()(_AABSPTree::Handle* A, const _AABSPTree::Handle* B) const { float a = A->center[sortAxis]; float b = B->center[sortAxis]; @@ -294,18 +294,18 @@ public: } else { return 0; } - } + } }; /** Compares bounds for strict >, <, or overlap*/ class BoundsComparator { public: - Vector3::Axis sortAxis; + Vector3::Axis sortAxis; - BoundsComparator(Vector3::Axis a) : sortAxis(a) {} + BoundsComparator(Vector3::Axis a) : sortAxis(a) {} - inline int operator()(_AABSPTree::Handle* A, const _AABSPTree::Handle* B) const { + inline int operator()(_AABSPTree::Handle* A, const _AABSPTree::Handle* B) const { const AABox& a = A->bounds; const AABox& b = B->bounds; @@ -316,33 +316,33 @@ public: } else { return 0; } - } + } }; /** Compares bounds to the sort location */ class Comparator { public: - Vector3::Axis sortAxis; - float sortLocation; + Vector3::Axis sortAxis; + float sortLocation; - Comparator(Vector3::Axis a, float l) : sortAxis(a), sortLocation(l) {} + Comparator(Vector3::Axis a, float l) : sortAxis(a), sortLocation(l) {} - inline int operator()(_AABSPTree::Handle* ignore, const _AABSPTree::Handle* handle) const { + inline int operator()(_AABSPTree::Handle* ignore, const _AABSPTree::Handle* handle) const { const AABox& box = handle->bounds; debugAssert(ignore == NULL); - if (box.high()[sortAxis] < sortLocation) { + if (box.high()[sortAxis] < sortLocation) { // Box is strictly below the sort location return -1; - } else if (box.low()[sortAxis] > sortLocation) { + } else if (box.low()[sortAxis] > sortLocation) { // Box is strictly above the sort location - return 1; - } else { + return 1; + } else { // Box overlaps the sort location - return 0; - } - } + return 0; + } + } }; // Using System::malloc with this class provided no speed improvement. @@ -357,8 +357,8 @@ public: /** Location along the specified axis */ float splitLocation; - - /** child[0] contains all values strictly + + /** child[0] contains all values strictly smaller than splitLocation along splitAxis. child[1] contains all values strictly @@ -371,15 +371,15 @@ public: /** Array of values at this node (i.e., values straddling the split plane + all values if - this is a leaf node). + this is a leaf node). This is an array of pointers because that minimizes - data movement during tree building, which accounts + data movement during tree building, which accounts for about 15% of the time cost of tree building. */ Array<_AABSPTree::Handle * > valueArray; - /** For each object in the value array, a copy of its bounds. + /** For each object in the value array, a copy of its bounds. Packing these into an array at the node level instead putting them in the valueArray improves cache coherence, which is about a 3x performance @@ -403,7 +403,7 @@ public: Node(const Node& other) : valueArray(other.valueArray), boundsArray(other.boundsArray) { splitAxis = other.splitAxis; splitLocation = other.splitLocation; - splitBounds = other.splitBounds; + splitBounds = other.splitBounds; for (int i = 0; i < 2; ++i) { child[i] = NULL; } @@ -450,47 +450,47 @@ public: } } - void verifyNode(const Vector3& lo, const Vector3& hi) { - // debugPrintf("Verifying: split %d @ %f [%f, %f, %f], [%f, %f, %f]\n", - // splitAxis, splitLocation, lo.x, lo.y, lo.z, hi.x, hi.y, hi.z); + void verifyNode(const Vector3& lo, const Vector3& hi) { + // debugPrintf("Verifying: split %d @ %f [%f, %f, %f], [%f, %f, %f]\n", + // splitAxis, splitLocation, lo.x, lo.y, lo.z, hi.x, hi.y, hi.z); debugAssert(lo == splitBounds.low()); debugAssert(hi == splitBounds.high()); - for (int i = 0; i < valueArray.length(); ++i) { - const AABox& b = valueArray[i]->bounds; + for (int i = 0; i < valueArray.length(); ++i) { + const AABox& b = valueArray[i]->bounds; debugAssert(b == boundsArray[i]); - for(int axis = 0; axis < 3; ++axis) { - debugAssert(b.low()[axis] <= b.high()[axis]); - debugAssert(b.low()[axis] >= lo[axis]); - debugAssert(b.high()[axis] <= hi[axis]); - } - } + for(int axis = 0; axis < 3; ++axis) { + debugAssert(b.low()[axis] <= b.high()[axis]); + debugAssert(b.low()[axis] >= lo[axis]); + debugAssert(b.high()[axis] <= hi[axis]); + } + } - if (child[0] || child[1]) { - debugAssert(lo[splitAxis] < splitLocation); - debugAssert(hi[splitAxis] > splitLocation); - } + if (child[0] || child[1]) { + debugAssert(lo[splitAxis] < splitLocation); + debugAssert(hi[splitAxis] > splitLocation); + } - Vector3 newLo = lo; - newLo[splitAxis] = splitLocation; - Vector3 newHi = hi; - newHi[splitAxis] = splitLocation; + Vector3 newLo = lo; + newLo[splitAxis] = splitLocation; + Vector3 newHi = hi; + newHi[splitAxis] = splitLocation; - if (child[0] != NULL) { - child[0]->verifyNode(lo, newHi); - } + if (child[0] != NULL) { + child[0]->verifyNode(lo, newHi); + } - if (child[1] != NULL) { - child[1]->verifyNode(newLo, hi); - } - } + if (child[1] != NULL) { + child[1]->verifyNode(newLo, hi); + } + } #if 0 /** Stores the locations of the splitting planes (the structure but not the content) - so that the tree can be quickly rebuilt from a previous configuration without + so that the tree can be quickly rebuilt from a previous configuration without calling balance. */ static void serializeStructure(const Node* n, BinaryOutput& bo) { @@ -546,7 +546,7 @@ public: } - /** Appends all members that intersect the box. + /** Appends all members that intersect the box. If useSphere is true, members that pass the box test face a second test against the sphere. */ void getIntersectingMembers( @@ -604,11 +604,11 @@ public: // See if the ray will ever hit this node or its children Vector3 location; bool alreadyInsideBounds = false; - bool rayWillHitBounds = + bool rayWillHitBounds = VMAP::MyCollisionDetection::collisionLocationForMovingPointFixedAABox( ray.origin, ray.direction, splitBounds, location, alreadyInsideBounds); - - bool canHitThisNode = (alreadyInsideBounds || + + bool canHitThisNode = (alreadyInsideBounds || (rayWillHitBounds && ((location - ray.origin).squaredLength() < square(distance)))); return canHitThisNode; @@ -616,20 +616,20 @@ public: template void intersectRay( - const Ray& ray, - RayCallback& intersectCallback, + const Ray& ray, + RayCallback& intersectCallback, float& distance, bool pStopAtFirstHit, bool intersectCallbackIsFast) const { float enterDistance = distance; - + if (! intersects(ray, distance)) { // The ray doesn't hit this node, so it can't hit the children of the node. return; } // Test for intersection against every object at this node. - for (int v = 0; v < valueArray.size(); ++v) { + for (int v = 0; v < valueArray.size(); ++v) { bool canHitThisObject = true; if (! intersectCallbackIsFast) { @@ -637,11 +637,11 @@ public: Vector3 location; const AABox& bounds = boundsArray[v]; bool alreadyInsideBounds = false; - bool rayWillHitBounds = + bool rayWillHitBounds = VMAP::MyCollisionDetection::collisionLocationForMovingPointFixedAABox( ray.origin, ray.direction, bounds, location, alreadyInsideBounds); - canHitThisObject = (alreadyInsideBounds || + canHitThisObject = (alreadyInsideBounds || (rayWillHitBounds && ((location - ray.origin).squaredLength() < square(distance)))); } @@ -656,7 +656,7 @@ public: } // There are three cases to consider next: - // + // // 1. the ray can start on one side of the splitting plane and never enter the other, // 2. the ray can start on one side and enter the other, and // 3. the ray can travel exactly down the splitting plane @@ -666,7 +666,7 @@ public: int secondChild = NONE; if (ray.origin[splitAxis] < splitLocation) { - + // The ray starts on the small side firstChild = 0; @@ -702,7 +702,7 @@ public: } if (ray.direction[splitAxis] != 0) { - // See if there was an intersection before hitting the splitting plane. + // See if there was an intersection before hitting the splitting plane. // If so, there is no need to look on the far side and recursion terminates. float distanceToSplittingPlane = (splitLocation - ray.origin[splitAxis]) / ray.direction[splitAxis]; if (distanceToSplittingPlane > distance) { @@ -724,43 +724,43 @@ public: /** Recursively subdivides the subarray. - + Clears the source array as soon as it is no longer needed. Call assignSplitBounds() on the root node after making a tree. */ Node* makeNode( - Array<_AABSPTree::Handle * >& source, - int valuesPerNode, + Array<_AABSPTree::Handle * >& source, + int valuesPerNode, int numMeanSplits, Array<_AABSPTree::Handle * >& temp) { - Node* node = NULL; - - if (source.size() <= valuesPerNode) { - // Make a new leaf node - node = new Node(source); - - // Set the pointers in the memberTable - for (int i = 0; i < source.size(); ++i) { - memberTable.set(Member(source[i]), node); - } + Node* node = NULL; + + if (source.size() <= valuesPerNode) { + // Make a new leaf node + node = new Node(source); + + // Set the pointers in the memberTable + for (int i = 0; i < source.size(); ++i) { + memberTable.set(Member(source[i]), node); + } source.clear(); - + } else { - // Make a new internal node - node = new Node(); - + // Make a new internal node + node = new Node(); + const AABox bounds = computeBounds(source, 0, source.size() - 1); - const Vector3 extent = bounds.high() - bounds.low(); - - Vector3::Axis splitAxis = extent.primaryAxis(); - + const Vector3 extent = bounds.high() - bounds.low(); + + Vector3::Axis splitAxis = extent.primaryAxis(); + float splitLocation; // Arrays for holding the children Array<_AABSPTree::Handle * > lt, gt; - + if (numMeanSplits <= 0) { source.medianPartition(lt, node->valueArray, gt, temp, CenterComparator(splitAxis)); @@ -788,13 +788,13 @@ public: // is swapped in in its place. gt.fastRemove(i); --i; } - } + } if ((node->valueArray.size() > (source.size() / 2)) && (source.size() > 6)) { - // This was a bad partition; we ended up putting the splitting plane right in the middle of most of the - // objects. We could try to split on a different axis, or use a different partition (e.g., the extents mean, - // or geometric mean). This implementation falls back on the extents mean, since that case is already handled + // This was a bad partition; we ended up putting the splitting plane right in the middle of most of the + // objects. We could try to split on a different axis, or use a different partition (e.g., the extents mean, + // or geometric mean). This implementation falls back on the extents mean, since that case is already handled // below. numMeanSplits = 1; } @@ -805,9 +805,9 @@ public: if (numMeanSplits > 0) { // Split along the mean - splitLocation = (bounds.high()[splitAxis] + + splitLocation = (bounds.high()[splitAxis] + bounds.low()[splitAxis]) / 2.0; - + source.partition(NULL, lt, node->valueArray, gt, Comparator(splitAxis, splitLocation)); // The Comparator ensures that elements are strictly on the correct side of the split @@ -817,7 +817,7 @@ public: # if defined(G3D_DEBUG) && defined(VERIFY_TREE) debugAssert(lt.size() + node->valueArray.size() + gt.size() == source.size()); // Verify that all objects ended up on the correct side of the split. - // (i.e., make sure that the Array partition was correct) + // (i.e., make sure that the Array partition was correct) for (int i = 0; i < lt.size(); ++i) { const AABox& bounds = lt[i]->bounds; debugAssert(bounds.high()[splitAxis] < splitLocation); @@ -846,20 +846,20 @@ public: for (int i = 0; i < node->valueArray.size(); ++i) { _AABSPTree::Handle * v = node->valueArray[i]; node->boundsArray[i] = v->bounds; - memberTable.set(Member(v), node); + memberTable.set(Member(v), node); } - if (lt.size() > 0) { - node->child[0] = makeNode(lt, valuesPerNode, numMeanSplits - 1, temp); - } - - if (gt.size() > 0) { - node->child[1] = makeNode(gt, valuesPerNode, numMeanSplits - 1, temp); - } - - } - - return node; + if (lt.size() > 0) { + node->child[0] = makeNode(lt, valuesPerNode, numMeanSplits - 1, temp); + } + + if (gt.size() > 0) { + node->child[1] = makeNode(gt, valuesPerNode, numMeanSplits - 1, temp); + } + + } + + return node; } /** @@ -927,7 +927,7 @@ public: */ void clear() { typedef typename Table<_internal::Indirector<_AABSPTree::Handle >, Node* >::Iterator It; - + // Delete all handles stored in the member table It cur = memberTable.begin(); It end = memberTable.end(); @@ -970,7 +970,7 @@ public: // Insert into the node node->valueArray.append(h); node->boundsArray.append(h->bounds); - + // Insert into the node table Member m(h); memberTable.set(m, node); @@ -1022,8 +1022,8 @@ public: /** Removes an object from the set in O(1) time. It is an error to remove members that are not already - present. May unbalance the tree. - + present. May unbalance the tree. + Removing an element never causes a node (split plane) to be removed... nodes are only changed when the tree is rebalanced. This behavior is desirable because it allows the split planes to be serialized, @@ -1075,7 +1075,7 @@ public: on T are independent of the bounds. In that case, you may call update(v) to insert an element for the first time and call update(v) - again every time it moves to keep the tree + again every time it moves to keep the tree up to date. */ void update(const T& value) { @@ -1091,15 +1091,15 @@ public: have moved substantially from their original positions (which unbalances the tree and causes the spatial queries to be slow). - + @param valuesPerNode Maximum number of elements to put at a node. - @param numMeanSplits numMeanSplits = 0 gives a + @param numMeanSplits numMeanSplits = 0 gives a fully axis aligned BSP-tree, where the balance operation attempts to balance the tree so that every splitting plane has an equal number of left - and right children (i.e. it is a median split along that axis). - This tends to maximize average performance. + and right children (i.e. it is a median split along that axis). + This tends to maximize average performance. You can override this behavior by setting a number of mean (average) splits. numMeanSplits = MAX_INT @@ -1126,7 +1126,7 @@ public: } Array<_AABSPTree::Handle * > temp; - // Make a new root. Work with a copy of the value array because + // Make a new root. Work with a copy of the value array because // makeNode clears the source array as it progresses Array<_AABSPTree::Handle * > copy(oldRoot->valueArray); root = makeNode(copy, valuesPerNode, numMeanSplits, temp); @@ -1195,7 +1195,7 @@ protected: public: /** - Returns all members inside the set of planes. + Returns all members inside the set of planes. @param members The results are appended to this array. */ void getIntersectingMembers(const Array& plane, Array& members) const { @@ -1221,7 +1221,7 @@ public: */ void getIntersectingMembers(const GCamera::Frustum& frustum, Array& members) const { Array plane; - + for (int i = 0; i < frustum.faceArray.size(); ++i) { plane.append(frustum.faceArray[i].plane); } @@ -1260,14 +1260,14 @@ public: // caller uses post increment (which they shouldn't!). Array stack; - /** The next index of current->valueArray to return. + /** The next index of current->valueArray to return. Undefined when isEnd is true.*/ int nextValueArrayIndex; BoxIntersectionIterator() : isEnd(true) {} - - BoxIntersectionIterator(const AABox& b, const Node* root) : - isEnd(root == NULL), box(b), + + BoxIntersectionIterator(const AABox& b, const Node* root) : + isEnd(root == NULL), box(b), node(const_cast(root)), nextValueArrayIndex(-1) { // We intentionally start at the "-1" index of the current @@ -1290,10 +1290,10 @@ public: } else if (other.isEnd) { return false; } else { - // Two non-end iterators; see if they match. This is kind of + // Two non-end iterators; see if they match. This is kind of // silly; users shouldn't call == on iterators in general unless // one of them is the end iterator. - if ((box != other.box) || (node != other.node) || + if ((box != other.box) || (node != other.node) || (nextValueArrayIndex != other.nextValueArrayIndex) || (stack.length() != other.stack.length())) { return false; @@ -1317,51 +1317,51 @@ public: BoxIntersectionIterator& operator++() { ++nextValueArrayIndex; - bool foundIntersection = false; + bool foundIntersection = false; while (! isEnd && ! foundIntersection) { - // Search for the next node if we've exhausted this one + // Search for the next node if we've exhausted this one while ((! isEnd) && (nextValueArrayIndex >= node->valueArray.length())) { - // If we entered this loop, then the iterator has exhausted the elements at - // node (possibly because it just switched to a child node with no members). - // This loop continues until it finds a node with members or reaches - // the end of the whole intersection search. + // If we entered this loop, then the iterator has exhausted the elements at + // node (possibly because it just switched to a child node with no members). + // This loop continues until it finds a node with members or reaches + // the end of the whole intersection search. - // If the right child overlaps the box, push it onto the stack for - // processing. - if ((node->child[1] != NULL) && - (box.high()[node->splitAxis] > node->splitLocation)) { - stack.push(node->child[1]); - } - - // If the left child overlaps the box, push it onto the stack for - // processing. - if ((node->child[0] != NULL) && - (box.low()[node->splitAxis] < node->splitLocation)) { - stack.push(node->child[0]); - } + // If the right child overlaps the box, push it onto the stack for + // processing. + if ((node->child[1] != NULL) && + (box.high()[node->splitAxis] > node->splitLocation)) { + stack.push(node->child[1]); + } - if (stack.length() > 0) { - // Go on to the next node (which may be either one of the ones we - // just pushed, or one from farther back the tree). - node = stack.pop(); - nextValueArrayIndex = 0; - } else { - // That was the last node; we're done iterating - isEnd = true; - } - } + // If the left child overlaps the box, push it onto the stack for + // processing. + if ((node->child[0] != NULL) && + (box.low()[node->splitAxis] < node->splitLocation)) { + stack.push(node->child[0]); + } - // Search for the next intersection at this node until we run out of children - while (! isEnd && ! foundIntersection && (nextValueArrayIndex < node->valueArray.length())) { - if (box.intersects(node->boundsArray[nextValueArrayIndex])) { - foundIntersection = true; - } else { - ++nextValueArrayIndex; - // If we exhaust this node, we'll loop around the master loop - // to find a new node. - } - } + if (stack.length() > 0) { + // Go on to the next node (which may be either one of the ones we + // just pushed, or one from farther back the tree). + node = stack.pop(); + nextValueArrayIndex = 0; + } else { + // That was the last node; we're done iterating + isEnd = true; + } + } + + // Search for the next intersection at this node until we run out of children + while (! isEnd && ! foundIntersection && (nextValueArrayIndex < node->valueArray.length())) { + if (box.intersects(node->boundsArray[nextValueArrayIndex])) { + foundIntersection = true; + } else { + ++nextValueArrayIndex; + // If we exhaust this node, we'll loop around the master loop + // to find a new node. + } + } } return *this; @@ -1431,7 +1431,7 @@ public: Invoke a callback for every member along a ray until the closest intersection is found. @param callback either a function or an instance of a class with an overloaded operator() of the form: - + void callback(const Ray& ray, const T& object, float& distance). If the ray hits the object before travelling distance distance, updates distance with the new distance to the intersection, otherwise leaves it unmodified. A common example is: @@ -1482,12 +1482,12 @@ public: */ template void intersectRay( - const Ray& ray, - RayCallback& intersectCallback, + const Ray& ray, + RayCallback& intersectCallback, float& distance, bool pStopAtFirstHit, bool intersectCallbackIsFast = false) const { - + root->intersectRay(ray, intersectCallback, distance, pStopAtFirstHit, intersectCallbackIsFast); } @@ -1509,7 +1509,7 @@ public: #if 0 /** Stores the locations of the splitting planes (the structure but not the content) - so that the tree can be quickly rebuilt from a previous configuration without + so that the tree can be quickly rebuilt from a previous configuration without calling balance. */ void serializeStructure(BinaryOutput& bo) const { @@ -1593,9 +1593,9 @@ public: /** - C++ STL style iterator method. Returns the first member. + C++ STL style iterator method. Returns the first member. Use preincrement (++entry) to get to the next element (iteration - order is arbitrary). + order is arbitrary). Do not modify the set while iterating. */ Iterator begin() const { diff --git a/contrib/vmap_debugger/ModelContainerView.cpp b/contrib/vmap_debugger/ModelContainerView.cpp index fa6b2b40b29..4feab72e6cd 100644 --- a/contrib/vmap_debugger/ModelContainerView.cpp +++ b/contrib/vmap_debugger/ModelContainerView.cpp @@ -56,7 +56,7 @@ namespace VMAP Vector3 lo = Vector3(inf(), inf(), inf()); Vector3 hi = Vector3(-inf(), -inf(), -inf()); - for(int i=0; i< root->getNValues(); i++) { + for(int i=0; i< root->getNValues(); i++) { SubModel sm = pModelContainer->getSubModel(root->getStartPosition() + i); lo = lo.min(sm.getAABoxBounds().low()); hi = hi.max(sm.getAABoxBounds().high()); @@ -502,7 +502,7 @@ namespace VMAP if(ui->keyPressed(GKey::fromString("2"))) { //dec count1 gCount1--; - if(gCount1 < 0) + if(gCount1 < 0) gCount1 = 0; } @@ -529,7 +529,7 @@ namespace VMAP if(ui->keyPressed(GKey::LEFT_MOUSE)) { - if( iCurrCmdIndex>0) { + if( iCurrCmdIndex>0) { --iCurrCmdIndex; printf("restart last command\n"); processCommand(); diff --git a/contrib/vmap_debugger/ModelContainerView.h b/contrib/vmap_debugger/ModelContainerView.h index ff41f7d1784..3371d263808 100644 --- a/contrib/vmap_debugger/ModelContainerView.h +++ b/contrib/vmap_debugger/ModelContainerView.h @@ -12,78 +12,78 @@ namespace VMAP { - //========================================== + //========================================== - //========================================== + //========================================== - class ModelContainerView : - public G3D::GApp - { - private: + class ModelContainerView : + public G3D::GApp + { + private: SkyRef iSky; LightingRef iLighting; SkyParameters iSkyParameters; - VARAreaRef iVARAreaRef; - Table iTriVarTable; - Table > iTriIndexTable; + VARAreaRef iVARAreaRef; + Table iTriVarTable; + Table > iTriIndexTable; - VARAreaRef iVARAreaRef2; + VARAreaRef iVARAreaRef2; VAR iTriDebugVar; Array iVTriDebugArray; Array iTriDebugArray; //Array iLineIndexArray; - GApp* i_App; - CommandFileRW iCommandFileRW; - Array iCmdArray; - int iCurrCmdIndex; + GApp* i_App; + CommandFileRW iCommandFileRW; + Array iCmdArray; + int iCurrCmdIndex; - VMapManager* iVMapManager; + VMapManager* iVMapManager; - Vector3 iPos1; - Vector3 iPos2; - Color3 iColor; - bool iDrawLine; - int iInstanceId; + Vector3 iPos1; + Vector3 iPos2; + Color3 iColor; + bool iDrawLine; + int iInstanceId; bool iPosSent; Array iPrevLoadCommands; - private: - Vector3 convertPositionToTrinityRep(float x, float y, float z) const; + private: + Vector3 convertPositionToTrinityRep(float x, float y, float z) const; - public: - ModelContainerView(const G3D::GApp::Settings& settings); + public: + ModelContainerView(const G3D::GApp::Settings& settings); - ~ModelContainerView(void); + ~ModelContainerView(void); - void addModelContainer(const std::string& pName,const ModelContainer* pModelContainer); - void removeModelContainer(const std::string& pName, const ModelContainer* pModelContainer); - void setViewPosition(const Vector3& pPosition); + void addModelContainer(const std::string& pName,const ModelContainer* pModelContainer); + void removeModelContainer(const std::string& pName, const ModelContainer* pModelContainer); + void setViewPosition(const Vector3& pPosition); - void onGraphics(RenderDevice* rd, Array &posed3D, Array &posed2D); + void onGraphics(RenderDevice* rd, Array &posed3D, Array &posed2D); virtual void onInit(); void init(); - void cleanup(); - void onUserInput(UserInput* ui); + void cleanup(); + void onUserInput(UserInput* ui); - void fillRenderArray(const SubModel& pSm,Array &pArray, const TreeNode* pTreeNode); - void fillVertexAndIndexArrays(const SubModel& pSm, Array& vArray, Array& iArray); + void fillRenderArray(const SubModel& pSm,Array &pArray, const TreeNode* pTreeNode); + void fillVertexAndIndexArrays(const SubModel& pSm, Array& vArray, Array& iArray); - bool loadAndShowTile(int pMapId, int x, int y); - void showMap(int pMapId, int x, int y); + bool loadAndShowTile(int pMapId, int x, int y); + void showMap(int pMapId, int x, int y); - void showMap(MapTree* mt, std::string dirFileName); - bool loadAndShowTile(int pMapId); + void showMap(MapTree* mt, std::string dirFileName); + bool loadAndShowTile(int pMapId); - void processCommand(); + void processCommand(); - }; + }; - //========================================== - //========================================== + //========================================== + //========================================== } #endif diff --git a/contrib/vmap_extractor_v2/stormlib/GfxDecode.cpp b/contrib/vmap_extractor_v2/stormlib/GfxDecode.cpp index 665e5d38e49..d9a5380f0e8 100644 --- a/contrib/vmap_extractor_v2/stormlib/GfxDecode.cpp +++ b/contrib/vmap_extractor_v2/stormlib/GfxDecode.cpp @@ -3,9 +3,9 @@ * Description: GfxDecode -- functions for reading Diablo's GFX files * Author: Marko Friedemann * Created at: Son Jan 27 15:20:43 CET 2002 -* Computer: hangloose.flachland-chemnitz.de +* Computer: hangloose.flachland-chemnitz.de * System: Linux 2.4.16 on i686 -* +* * Copyright (c) 2002 BMX-Chemnitz.DE All rights reserved. * * --------------------------------------------------------------------- @@ -60,12 +60,12 @@ static const uint16_t c_RampOffsetRight[17] = { 2, // __ before this, there are 2 Pixels 14, // + 12 --__ 4^2 - 2 34, // + 20 --__ 6^2 - 2 - 62, // + 28 this area --__ 8^2 - 2 + 62, // + 28 this area --__ 8^2 - 2 98, // + 36 is always --__ 10^2 - 2 pattern anyone? ;) - 142, // + 44 colored --__ + 142, // + 44 colored --__ 194, // + 52 --__ 254, // + 60 lower ramp ends here --__ (-30 == 224) - 318, // + 64 upper ramp might be missing __-- + 318, // + 64 upper ramp might be missing __-- 374, // + 56 __-- | 422, // + 48 this area __-- | note that this 462, // + 40 is always __-- | "drawing" @@ -133,7 +133,7 @@ class FrameBuf cerr << "\n +++ at (" << uCols << "," << uRows << "), see for yourself *** \n\n"; uColorNum = TRANS_COL; // sane setting to avoid segfaults } - + memcpy(pCurrRow + 4*uCols, pPalette + 4*uColorNum, 4*sizeof(uint8_t)); if (++uCols == uXSize) addLine(); @@ -147,18 +147,18 @@ class FrameBuf vector ::reverse_iterator vri; // allocate a buffer to hold the actual image size uint8_t *tmp = new uint8_t[4*uXSize*uRows]; - + // the lines are upside down inside the vector, use reverse iterator for (i=0, vri=vecData.rbegin(); vri!=vecData.rend(); vri++, i++) memcpy(tmp+4*uXSize*i, *vri, 4*uXSize*sizeof(uint8_t)); - + *upYSize = uRows; // set height - + if (uCols > 0) { cerr << "\n*** there seemed to be an error (last line does not match boundary, " << uCols << " pixels left)"; cerr << "\n +++ this is often caused by specifying an invalid width, see for yourself *** \n\n"; } - + return tmp; } }; @@ -183,17 +183,17 @@ uint8_t *celDecodeBlocks(uint8_t *pFileBuf, FrameBuf *pFrame, uint32_t *framesta if (!pFrame->bHasBlocks) // sanity check return NULL; - + while (uFilePos < framestart[pFrame->uFrameNum+1]) { cRead = pFileBuf[uFilePos++]; - + if ((uFilePos == framestart[pFrame->uFrameNum]+1)) // TODO: what is this 0x0A 0x00 stuff all about? if ((cRead == 0x0A) && (pFileBuf[uFilePos] == 0x00)) { uFilePos += 9; cRead = pFileBuf[uFilePos++]; } - + if (cRead > 0x7F) // transparent block (complement, 256-val) for (i=0; i<256-cRead; i++) @@ -220,10 +220,10 @@ uint8_t *celDecodeRamps(uint8_t *pFileBuf, FrameBuf *pFrame, uint32_t *framestar uint32_t uFilePos=0; uint16_t uBlockLen=0, i=0, j=0; bool bFirstLonger=false; - + if (!pFrame->bHasRamps) // sanity check return NULL; - + if (pFrame->uXSize != 32) // only used in that case return NULL; @@ -265,7 +265,7 @@ uint8_t *celDecodeRamps(uint8_t *pFileBuf, FrameBuf *pFrame, uint32_t *framestar pFrame->addPixel(pFileBuf[uFilePos++]); } } - + // now read the last 0x00 pair and fill up uBlockLen = (uFrameLen == c_2RampSize ? 30 : 2); // one or two ramps? uFilePos = framestart[pFrame->uFrameNum] + (bLeft ? c_RampOffsetLeft[i] : c_RampOffsetRight[i]) + 2; @@ -276,16 +276,16 @@ uint8_t *celDecodeRamps(uint8_t *pFileBuf, FrameBuf *pFrame, uint32_t *framestar for (j=0; juXSize - uBlockLen; j++) pFrame->addPixel(pFileBuf[uFilePos++]); } - + // now the rest of the file (plain) while (uFilePos < framestart[pFrame->uFrameNum+1]) pFrame->addPixel(pFileBuf[uFilePos++]); - + // the uppermost line is emtpy when 2 ramps are used if (uFrameLen == c_2RampSize) for (j=0; juXSize; j++) pFrame->addPixel(TRANS_COL); - + return pFrame->getData(); } @@ -308,17 +308,17 @@ uint8_t *celDecodeRamps(uint8_t *pFileBuf, FrameBuf *pFrame, uint32_t *framestar * Comments: dirty hack, started from scratch @ 2000-10-11 * cleanly rewritten during incorporation into ladiks StormLib * status: structured hack ;) - * + * * It took me approx. 6 days to understand the format basics (hex viewer) * For this I had a little help from a dos tool ("ddecode", from - * www.cowlevel.com, binary only, no sources) which, however, gave + * www.cowlevel.com, binary only, no sources) which, however, gave * me the general idea what the pictures are actually supposed to look like. - * + * * The fine adjustments, however, took quite some time and a little luck. * After I had written to various people (mickyk and ladik), which could * not help me, but wished best luck (thanks, btw, it helped ;)), I tried * some reverse engineering which was not succesful in the end. - * + * * I then had incidentally a new idea of what could be going on @ 2002-01-23. * It just came to my mind that I could retry some actual painting in * reverse order (had done that before to no avail) and when looking closer @@ -334,48 +334,48 @@ uint8_t * WINAPI celGetFrameData(uint8_t *pFileBuf, uint8_t *palette, uint16_t u uint32_t *framestart=NULL, frames=0, uFilePos=0; uint16_t i, tmpWord=0; uint8_t cRead=0, *data; - + memcpy(&frames, pFileBuf, sizeof(uint32_t)); uFilePos += sizeof(uint32_t); - + if (pFileBuf == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return NULL; } - + if (palette == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return NULL; } - + if (uFrameNum > frames-1) { SetLastError(ERROR_INVALID_PARAMETER); return NULL; } - + if (uYSize == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return NULL; } - + // in case we want to know the rightmost pixels column (usable eg. for fonts) if (uMaxX != NULL) *uMaxX = 0; - + // get the frame offsets framestart = new uint32_t[frames+1]; for (i=0; ibHasRamps = (i==(uFrameLen == c_2RampSize ? 16 : 8)); // bRampsLeft stays false in this case } - + if (pFrame->bHasRamps) { // decode ramps and be off (if appropriate) data = celDecodeRamps(pFileBuf, pFrame, framestart, bRampsLeft); delete pFrame; @@ -408,25 +408,25 @@ uint8_t * WINAPI celGetFrameData(uint8_t *pFileBuf, uint8_t *palette, uint16_t u return data; } } - + /*********** block detection *************************************** * 0x0A as start byte seems to be sufficient (though I still dunno * what the trailing 10 bytes mean); in any other case we act as if * blocks were to be used and check afterwards if the image looks * OK (that is, the last line has no pixels in it) ******************************************************************/ - + cRead = pFileBuf[framestart[uFrameNum]]; if (cRead == 0x0A) // sufficient pFrame->bHasBlocks = true; // if width == 32 && framelen == 32*32, assume plain else if ((uXSize != 32) || (uFrameLen != 32*32)) { // check needed - uFilePos=framestart[uFrameNum]; + uFilePos=framestart[uFrameNum]; i=0; // rush through the frame while (uFilePos < framestart[uFrameNum+1]) { cRead = pFileBuf[uFilePos++]; - + // transparency blocks while (cRead > 0x7F) { i += 256-cRead; @@ -436,7 +436,7 @@ uint8_t * WINAPI celGetFrameData(uint8_t *pFileBuf, uint8_t *palette, uint16_t u else cRead = 0; } - + // colored pixel block if (uFilePos < framestart[uFrameNum+1]) { if (cRead < pFrame->uMaxBlock + 1) { @@ -453,19 +453,19 @@ uint8_t * WINAPI celGetFrameData(uint8_t *pFileBuf, uint8_t *palette, uint16_t u if (i%uXSize == 0) // looks as if we got it right pFrame->bHasBlocks=true; } - + if (pFrame->bHasBlocks) { // use block decoder if appropriate data = celDecodeBlocks(pFileBuf, pFrame, framestart); delete pFrame; delete[] framestart; return data; } - + // plain mode (#3), read each color index and write the pixel uFilePos=framestart[uFrameNum]; while (uFilePos < framestart[uFrameNum+1]) pFrame->addPixel(pFileBuf[uFilePos++]); - + // cleanup, return image data and height data = pFrame->getData(); delete pFrame; @@ -496,7 +496,7 @@ uint16_t WINAPI cl2GetFrameCount(uint8_t *pFileBuf) * * --------------------------------------------------------------- * Comments: dirty hack, started from scratch @ 2000-10-12 - * + * * The format basics are similar to .cel, with the main difference * that the values read have reverse interpretation. In .cel a value * greater than 0x7F means transparency, while in .cl2 this means @@ -507,7 +507,7 @@ uint16_t WINAPI cl2GetFrameCount(uint8_t *pFileBuf) * .cl2 only uses the block scheme, so there is no detection * necessary in order to get it right. The only thing still unknown * is that 0x0A 0x00 stuff... - * + * * TODO: learn what 0x0A 0x00 means ***********************************************************************/ BYTE ** WINAPI cl2GetDirData(BYTE *pFileBuf, BYTE *palette, WORD uXSize, WORD uDirNum, WORD *uYSize) @@ -516,27 +516,27 @@ BYTE ** WINAPI cl2GetDirData(BYTE *pFileBuf, BYTE *palette, WORD uXSize, WORD uD uint32_t frames=0, *framestart=NULL, uFilePos=0; uint16_t i, fc; uint8_t cRead=0, **data=NULL; - + if (pFileBuf == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return NULL; } - + if (palette == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return NULL; } - + if (uDirNum > 7) { SetLastError(ERROR_INVALID_PARAMETER); return NULL; } - + if (uYSize == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return NULL; } - + // get direction offsets uint32_t dirstart[8]; for (i=0; i<8; i++) { @@ -545,23 +545,23 @@ BYTE ** WINAPI cl2GetDirData(BYTE *pFileBuf, BYTE *palette, WORD uXSize, WORD uD } uFilePos = dirstart[uDirNum]; - + memcpy(&frames, pFileBuf+uFilePos, sizeof(uint32_t)); uFilePos += sizeof(uint32_t); - + data = new uint8_t*[frames]; - + // get frame offsets framestart = new uint32_t[frames+1]; for (i=0; iaddPixel(pFileBuf[uFilePos++]); } - + // got the frame data, save it data[fc] = pFrame->getData(); delete pFrame; } - + delete[] framestart; return data; } @@ -616,7 +616,7 @@ BYTE * WINAPI pcxGetData(BYTE *pFileBuf, DWORD uFileSize, BYTE uTransColor, WORD uint16_t i=0; uint8_t *data, *palette; uint8_t uColorNum=0, uCount=0; - + struct pcx_header_t { uint8_t id; uint8_t version; @@ -635,17 +635,17 @@ BYTE * WINAPI pcxGetData(BYTE *pFileBuf, DWORD uFileSize, BYTE uTransColor, WORD uint16_t colortype; uint8_t pad[58]; } pcxHeader; - + if (pFileBuf == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return NULL; } - + if (uXSize == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return NULL; } - + if (uYSize == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return NULL; @@ -655,12 +655,12 @@ BYTE * WINAPI pcxGetData(BYTE *pFileBuf, DWORD uFileSize, BYTE uTransColor, WORD memcpy(&pcxHeader, pFileBuf, sizeof(struct pcx_header_t)); *uXSize = (pcxHeader.x1 - pcxHeader.x0 + 1); *uYSize = (pcxHeader.y1 - pcxHeader.y0 + 1); - + if ((pcxHeader.version != 2) && (pcxHeader.version != 5)) { cerr << "cannot handle pcx v" << pcxHeader.version << "\n"; return NULL; } - + // get palette palette = new uint8_t[256*4]; if (pFileBuf[uFileSize - 768 - 1] != 0x0C) { @@ -672,7 +672,7 @@ BYTE * WINAPI pcxGetData(BYTE *pFileBuf, DWORD uFileSize, BYTE uTransColor, WORD palette[i*4+3] = 0xFF; } memset(palette+uTransColor*4, 0, 4*sizeof(uint8_t)); // transparent black - + // start right after the header uFilePos = sizeof(struct pcx_header_t); data = new uint8_t[*uXSize * *uYSize * 4]; @@ -684,14 +684,14 @@ BYTE * WINAPI pcxGetData(BYTE *pFileBuf, DWORD uFileSize, BYTE uTransColor, WORD uColorNum = pFileBuf[uFilePos++]; } else uCount = 1; - + // draw count pixels with color val for (i=0; i 0x10) return 0; - + va_start(argList, nDwords); for(i = 0; i < nDwords; i++) dwDecrypted[i] = va_arg(argList, DWORD); va_end(argList); - + dwTemp = (*pdwBlock ^ dwDecrypted[0]) - 0xEEEEEEEE; for(i = 0; i < 0x100; i++) // Try all 255 possibilities { @@ -427,7 +427,7 @@ TMPQHash * GetHashEntry(TMPQArchive * ha, const char * szFileName) // If filename is given by index, we have to search all hash entries for the right index. if(dwIndex <= ha->pHeader->dwBlockTableSize) { - // Pass all the hash entries and find the + // Pass all the hash entries and find the for(pHash = ha->pHashTable; pHash < pHashEnd; pHash++) { if(pHash->dwBlockIndex == dwIndex) @@ -441,7 +441,7 @@ TMPQHash * GetHashEntry(TMPQArchive * ha, const char * szFileName) dwName1 = DecryptName1(szFileName); dwName2 = DecryptName2(szFileName); pHash = pHash0 = ha->pHashTable + dwIndex; - + // Look for hash index while(pHash->dwBlockIndex != HASH_ENTRY_FREE) { @@ -562,7 +562,7 @@ BOOL IsValidMpqHandle(TMPQArchive * ha) return FALSE; if(ha->pHeader == NULL || IsBadReadPtr(ha->pHeader, sizeof(TMPQHeader))) return FALSE; - + return (ha->pHeader->dwID == ID_MPQ); } @@ -620,7 +620,7 @@ int AddFileToArchive( { if(nFileType == SFILE_TYPE_DATA) nCmpFirst = nCmpNext = nDataCmp; - + if(nFileType == SFILE_TYPE_WAVE) { nCmpNext = uWaveCmpType[dwQuality]; @@ -721,7 +721,7 @@ int AddFileToArchive( // Get pointers to both block entries of the file pBlockEx = ha->pExtBlockTable + pHash->dwBlockIndex; pBlock = ha->pBlockTable + pHash->dwBlockIndex; - + // Save the file size info pBlockEx->wFilePosHigh = (USHORT)RelativePos.HighPart; pBlock->dwFilePos = RelativePos.LowPart; @@ -735,7 +735,7 @@ int AddFileToArchive( if(dwFlags & MPQ_FILE_ENCRYPTED) { dwSeed1 = DecryptFileSeed(szArchivedName); - + if(dwFlags & MPQ_FILE_FIXSEED) dwSeed1 = (dwSeed1 + pBlock->dwFilePos) ^ pBlock->dwFSize; } @@ -785,7 +785,7 @@ int AddFileToArchive( memset(pdwBlockPos, 0, dwBlockPosLen); pdwBlockPos[0] = dwBlockPosLen; - + // Write the block positions BSWAP_ARRAY32_UNSIGNED((DWORD *)pdwBlockPos, nBlocks); WriteFile(ha->hFile, pdwBlockPos, dwBlockPosLen, &dwTransferred, NULL); @@ -852,7 +852,7 @@ int AddFileToArchive( EncryptMPQBlock((DWORD *)pbToWrite, dwOutLength, dwSeed1 + nBlock); BSWAP_ARRAY32_UNSIGNED((DWORD *)pbToWrite, dwOutLength / sizeof(DWORD)); } - + // Write the block WriteFile(ha->hFile, pbToWrite, dwOutLength, &dwTransferred, NULL); if(dwTransferred != dwOutLength) @@ -876,10 +876,10 @@ int AddFileToArchive( // If file is encrypted, block positions are also encrypted if(dwFlags & MPQ_FILE_ENCRYPTED) EncryptMPQBlock(pdwBlockPos, dwBlockPosLen, dwSeed1 - 1); - + // Set the position back to the block table SetFilePointer(ha->hFile, FilePos.LowPart, &FilePos.HighPart, FILE_BEGIN); - + // Write block positions to the archive BSWAP_ARRAY32_UNSIGNED((DWORD *)pdwBlockPos, nBlocks); WriteFile(ha->hFile, pdwBlockPos, dwBlockPosLen, &dwTransferred, NULL); @@ -1015,7 +1015,7 @@ int SaveMPQTables(TMPQArchive * ha) // Encrypt the block table and write it to the file EncryptBlockTable((DWORD *)pbBuffer, (BYTE *)"(block table)", dwBytes >> 2); - + // Convert to little endian for file save BSWAP_ARRAY32_UNSIGNED((DWORD *)pbBuffer, dwBytes / sizeof(DWORD)); WriteFile(ha->hFile, pbBuffer, dwBytes, &dwWritten, NULL); diff --git a/contrib/vmap_extractor_v2/stormlib/SCompression.cpp b/contrib/vmap_extractor_v2/stormlib/SCompression.cpp index 612ef2cc262..775961f4804 100644 --- a/contrib/vmap_extractor_v2/stormlib/SCompression.cpp +++ b/contrib/vmap_extractor_v2/stormlib/SCompression.cpp @@ -2,7 +2,7 @@ /* SCompression.cpp Copyright (c) Ladislav Zezula 2003 */ /*---------------------------------------------------------------------------*/ /* This module serves as a bridge between StormLib code and (de)compression */ -/* functions. All (de)compression calls go (and should only go) through this */ +/* functions. All (de)compression calls go (and should only go) through this */ /* module. No system headers should be included in this module to prevent */ /* compile-time problems. */ /*---------------------------------------------------------------------------*/ @@ -19,7 +19,7 @@ #include // Include functions from Pkware Data Compression Library -#include "pklib/pklib.h" +#include "pklib/pklib.h" // Include functions from zlib #ifndef __SYS_ZLIB @@ -29,10 +29,10 @@ #endif // Include functions from Huffmann compression -#include "huffman/huff.h" +#include "huffman/huff.h" // Include functions from WAVe compression -#include "wave/wave.h" +#include "wave/wave.h" // Include functions from BZip2 compression library #ifndef __SYS_BZLIB @@ -57,7 +57,7 @@ typedef struct // Table of compression functions typedef int (*COMPRESS)(char *, int *, char *, int, int *, int); -typedef struct +typedef struct { unsigned long dwMask; // Compression mask COMPRESS Compress; // Compression function @@ -81,7 +81,7 @@ typedef struct // Function loads data from the input buffer. Used by Pklib's "implode" // and "explode" function as user-defined callback // Returns number of bytes loaded -// +// // char * buf - Pointer to a buffer where to store loaded data // unsigned int * size - Max. number of bytes to read // void * param - Custom pointer, parameter of implode/explode @@ -95,7 +95,7 @@ static unsigned int ReadInputData(char * buf, unsigned int * size, void * param) // Check the case when not enough data available if(nToRead > nMaxAvail) nToRead = nMaxAvail; - + // Load data and increment offsets memcpy(buf, pInfo->pInBuff + pInfo->nInPos, nToRead); pInfo->nInPos += nToRead; @@ -105,7 +105,7 @@ static unsigned int ReadInputData(char * buf, unsigned int * size, void * param) // Function for store output data. Used by Pklib's "implode" and "explode" // as user-defined callback -// +// // char * buf - Pointer to data to be written // unsigned int * size - Number of bytes to write // void * param - Custom pointer, parameter of implode/explode @@ -272,7 +272,7 @@ int Compress_zlib(char * pbOutBuffer, int * pdwOutLength, char * pbInBuffer, int { // Call zlib to compress the data nResult = deflate(&z, Z_FINISH); - + if(nResult == Z_OK || nResult == Z_STREAM_END) *pdwOutLength = z.total_out; @@ -359,7 +359,7 @@ int Decompress_pklib(char * pbOutBuffer, int * pdwOutLength, char * pbInBuffer, // Do the decompression explode(ReadInputData, WriteOutputData, work_buf, &Info); - + // Fix: If PKLIB is unable to decompress the data, they are uncompressed if(Info.nOutPos == 0) { @@ -487,7 +487,7 @@ int WINAPI SCompCompress(char * pbCompressed, int * pdwOutLength, char * pbUncom int dwInSize = dwInLength; int dwEntries = (sizeof(cmp_table) / sizeof(TCompressTable)); int nResult = 1; - int i; + int i; // Check for valid parameters if(!pdwOutLength || *pdwOutLength < dwInLength || !pbCompressed || !pbUncompressed) @@ -523,7 +523,7 @@ int WINAPI SCompCompress(char * pbCompressed, int * pdwOutLength, char * pbUncom { if(uCompressions2 & cmp_table[i].dwMask) { - // Set the right output buffer + // Set the right output buffer dwCompressCount--; pbOutput = (dwCompressCount & 1) ? pbTempBuff : pbCompressed; @@ -611,7 +611,7 @@ int WINAPI SCompDecompress(char * pbOutBuffer, int * pdwOutLength, char * pbInBu int dwCount = 0; // Counter for every use int dwEntries = (sizeof(dcmp_table) / sizeof(TDecompressTable)); int nResult = 1; - int i; + int i; // If the input length is the same as output, do nothing. if(dwInLength == dwOutLength) @@ -623,11 +623,11 @@ int WINAPI SCompDecompress(char * pbOutBuffer, int * pdwOutLength, char * pbInBu *pdwOutLength = dwInLength; return 1; } - + // Get applied compression types and decrement data length - fDecompressions1 = fDecompressions2 = (unsigned char)*pbInBuffer++; + fDecompressions1 = fDecompressions2 = (unsigned char)*pbInBuffer++; dwInLength--; - + // Search decompression table type and get all types of compression for(i = 0; i < dwEntries; i++) { @@ -681,13 +681,13 @@ int WINAPI SCompDecompress(char * pbOutBuffer, int * pdwOutLength, char * pbInBu { if(pbWorkBuff != pbOutBuffer) memcpy(pbOutBuffer, pbInBuffer, dwOutLength); - + } // Delete temporary buffer, if necessary if(pbTempBuff != NULL) FREEMEM(pbTempBuff); - + *pdwOutLength = dwOutLength; return nResult; } diff --git a/contrib/vmap_extractor_v2/stormlib/SFileCompactArchive.cpp b/contrib/vmap_extractor_v2/stormlib/SFileCompactArchive.cpp index 9510b15ae1f..96fb1e4a63d 100644 --- a/contrib/vmap_extractor_v2/stormlib/SFileCompactArchive.cpp +++ b/contrib/vmap_extractor_v2/stormlib/SFileCompactArchive.cpp @@ -143,7 +143,7 @@ static int CheckIfAllFilesKnown(TMPQArchive * ha, const char * szListFile, DWORD SFileCloseFile(hFile); } - // If the file is encrypted, we have to check + // If the file is encrypted, we have to check // If we can apply the file decryption seed if(dwFlags & MPQ_FILE_ENCRYPTED && dwSeed == 0) { @@ -269,7 +269,7 @@ static int CopyMpqFileBlocks( DecryptMPQBlock(pdwBlockPos, dwBytes, dwSeed1 - 1); if(pdwBlockPos[0] != dwBytes) nError = ERROR_FILE_CORRUPT; - + memcpy(pdwBlockPos2, pdwBlockPos, dwBytes); EncryptMPQBlock(pdwBlockPos2, dwBytes, dwSeed2 - 1); } @@ -315,7 +315,7 @@ static int CopyMpqFileBlocks( } // If necessary, re-encrypt the block - // Note: Recompression is not necessary here. Unlike encryption, + // Note: Recompression is not necessary here. Unlike encryption, // the compression does not depend on the position of the file in MPQ. if((pBlock->dwFlags & MPQ_FILE_ENCRYPTED) && dwSeed1 != dwSeed2) { @@ -583,7 +583,7 @@ BOOL WINAPI SFileCompactArchive(HANDLE hMPQ, const char * szListFile, BOOL /* bR TempPos.LowPart = pBlock->dwFilePos; if(TempPos.QuadPart < FirstFilePos.QuadPart) FirstFilePos = TempPos; - + pBlockEx++; pBlock++; } diff --git a/contrib/vmap_extractor_v2/stormlib/SFileCreateArchiveEx.cpp b/contrib/vmap_extractor_v2/stormlib/SFileCreateArchiveEx.cpp index 2410920fc93..e55ad4c0f11 100644 --- a/contrib/vmap_extractor_v2/stormlib/SFileCreateArchiveEx.cpp +++ b/contrib/vmap_extractor_v2/stormlib/SFileCreateArchiveEx.cpp @@ -20,7 +20,7 @@ //----------------------------------------------------------------------------- // Local tables -static DWORD PowersOfTwo[] = +static DWORD PowersOfTwo[] = { 0x0000002, 0x0000004, 0x0000008, 0x0000010, 0x0000020, 0x0000040, 0x0000080, @@ -52,7 +52,7 @@ static DWORD PowersOfTwo[] = // // MPQ_CREATE_ARCHIVE_V1 - Creates MPQ archive version 1 // MPQ_CREATE_ARCHIVE_V2 - Creates MPQ archive version 2 -// +// // dwHashTableSize - Size of the hash table (only if creating a new archive). // Must be between 2^4 (= 16) and 2^18 (= 262 144) // @@ -118,7 +118,7 @@ BOOL WINAPI SFileCreateArchiveEx(const char * szMpqName, DWORD dwCreationDisposi dwHashTableSize = HASH_TABLE_SIZE_MIN; if(dwHashTableSize > HASH_TABLE_SIZE_MAX) dwHashTableSize = HASH_TABLE_SIZE_MAX; - + // Round the hash table size up to the nearest power of two for(nIndex = 0; PowersOfTwo[nIndex] != 0; nIndex++) { @@ -249,7 +249,7 @@ BOOL WINAPI SFileCreateArchiveEx(const char * szMpqName, DWORD dwCreationDisposi BSWAP_TMPQHEADER(ha->pHeader); WriteFile(ha->hFile, ha->pHeader, dwHeaderSize, &dwTransferred, NULL); BSWAP_TMPQHEADER(ha->pHeader); - + if(dwTransferred != ha->pHeader->dwHeaderSize) nError = ERROR_DISK_FULL; @@ -273,7 +273,7 @@ BOOL WINAPI SFileCreateArchiveEx(const char * szMpqName, DWORD dwCreationDisposi CloseHandle(hFile); SetLastError(nError); } - + // Return the values *phMPQ = (HANDLE)ha; return (nError == ERROR_SUCCESS); @@ -355,7 +355,7 @@ BOOL WINAPI SFileAddFileEx(HANDLE hMPQ, const char * szFileName, const char * sz SetLastError(nError); return (nError == ERROR_SUCCESS); } - + // Adds a data file into the archive // TODO: Test for archives > 4GB BOOL WINAPI SFileAddFile(HANDLE hMPQ, const char * szFileName, const char * szArchivedName, DWORD dwFlags) @@ -375,7 +375,7 @@ BOOL WINAPI SFileAddWave(HANDLE hMPQ, const char * szFileName, const char * szAr // // This function removes a file from the archive. The file content // remains there, only the entries in the hash table and in the block -// table are updated. +// table are updated. // TODO: Test for archives > 4GB BOOL WINAPI SFileRemoveFile(HANDLE hMPQ, const char * szFileName, DWORD dwSearchScope) diff --git a/contrib/vmap_extractor_v2/stormlib/SFileFindFile.cpp b/contrib/vmap_extractor_v2/stormlib/SFileFindFile.cpp index 41dbeba900c..ea5ce5a47a1 100644 --- a/contrib/vmap_extractor_v2/stormlib/SFileFindFile.cpp +++ b/contrib/vmap_extractor_v2/stormlib/SFileFindFile.cpp @@ -67,7 +67,7 @@ BOOL CheckWildCard(const char * szString, const char * szWildCard) // The next N characters must not agree nMustNotMatch |= 0x70000000; break; - + case '?': // Means "One or no character" while(*szWildCard == '?') { @@ -111,7 +111,7 @@ BOOL CheckWildCard(const char * szString, const char * szWildCard) { if((nResult = _strnicmp(szString, szWildCard, nMustMatch)) == 0) break; - + szString++; nMustNotMatch--; } @@ -207,7 +207,7 @@ HANDLE WINAPI SFileFindFirstFile(HANDLE hMPQ, const char * szMask, SFILE_FIND_DA { if(!IsValidMpqHandle(ha)) nError = ERROR_INVALID_PARAMETER; - + if(szMask == NULL || lpFindFileData == NULL) nError = ERROR_INVALID_PARAMETER; @@ -245,7 +245,7 @@ HANDLE WINAPI SFileFindFirstFile(HANDLE hMPQ, const char * szMask, SFILE_FIND_DA FreeMPQSearch(hs); SetLastError(nError); } - + // Return the result value return (HANDLE)hs; } diff --git a/contrib/vmap_extractor_v2/stormlib/SFileOpenArchive.cpp b/contrib/vmap_extractor_v2/stormlib/SFileOpenArchive.cpp index cadb4e023a2..468759e6d1c 100644 --- a/contrib/vmap_extractor_v2/stormlib/SFileOpenArchive.cpp +++ b/contrib/vmap_extractor_v2/stormlib/SFileOpenArchive.cpp @@ -74,7 +74,7 @@ static int RelocateMpqTablePositions(TMPQArchive * ha) TempSize.QuadPart = ha->ExtBlockTablePos.QuadPart + (pHeader->dwBlockTableSize * sizeof(TMPQBlockEx)); if(TempSize.QuadPart > ha->MpqSize.QuadPart) ha->MpqSize = TempSize; - + // MPQ size does not include the bytes before MPQ header ha->MpqSize.QuadPart -= ha->MpqPos.QuadPart; return ERROR_SUCCESS; @@ -122,7 +122,7 @@ BOOL SFileOpenArchiveEx( DWORD dwBlockTableSize = 0; // Block table size. DWORD dwTransferred; // Number of bytes read DWORD dwBytes = 0; // Number of bytes to read - int nError = ERROR_SUCCESS; + int nError = ERROR_SUCCESS; // Check the right parameters if(nError == ERROR_SUCCESS) @@ -142,7 +142,7 @@ BOOL SFileOpenArchiveEx( if(hFile == INVALID_HANDLE_VALUE) nError = GetLastError(); } - + // Allocate the MPQhandle if(nError == ERROR_SUCCESS) { @@ -241,7 +241,7 @@ BOOL SFileOpenArchiveEx( break; } - // If a MPQ shunt already has been found, + // If a MPQ shunt already has been found, // and no MPQ header was at potision pointed by the shunt, // then the archive is corrupt if(ha->pShunt != NULL) @@ -327,7 +327,7 @@ BOOL SFileOpenArchiveEx( nError = ERROR_BAD_FORMAT; break; } - + // Remember the highest block table entry if(pHash->dwBlockIndex > dwMaxBlockIndex) dwMaxBlockIndex = pHash->dwBlockIndex; @@ -437,7 +437,7 @@ BOOL SFileOpenArchiveEx( } } - // If the user didn't specified otherwise, + // If the user didn't specified otherwise, // include the internal listfile to the TMPQArchive structure if((dwFlags & MPQ_OPEN_NO_LISTFILE) == 0) { @@ -479,7 +479,7 @@ BOOL WINAPI SFileOpenArchive(const char * szMpqName, DWORD dwPriority, DWORD dwF BOOL WINAPI SFileCloseArchive(HANDLE hMPQ) { TMPQArchive * ha = (TMPQArchive *)hMPQ; - + if(!IsValidMpqHandle(ha)) { SetLastError(ERROR_INVALID_PARAMETER); diff --git a/contrib/vmap_extractor_v2/stormlib/SFileOpenFileEx.cpp b/contrib/vmap_extractor_v2/stormlib/SFileOpenFileEx.cpp index dae312144eb..bbda59e5e79 100644 --- a/contrib/vmap_extractor_v2/stormlib/SFileOpenFileEx.cpp +++ b/contrib/vmap_extractor_v2/stormlib/SFileOpenFileEx.cpp @@ -25,7 +25,7 @@ static BOOL OpenLocalFile(const char * szFileName, HANDLE * phFile) if(hFile != INVALID_HANDLE_VALUE) { // Allocate and initialize file handle - size_t nHandleSize = sizeof(TMPQFile) + strlen(szFileName); + size_t nHandleSize = sizeof(TMPQFile) + strlen(szFileName); if((hf = (TMPQFile *)ALLOCMEM(char, nHandleSize)) != NULL) { memset(hf, 0, nHandleSize); @@ -62,7 +62,7 @@ static void FreeMPQFile(TMPQFile *& hf) /*****************************************************************************/ //----------------------------------------------------------------------------- -// SFileEnumLocales enums all locale versions within MPQ. +// SFileEnumLocales enums all locale versions within MPQ. // Functions fills all available language identifiers on a file into the buffer // pointed by plcLocales. There must be enough entries to copy the localed, // otherwise the function returns ERROR_INSUFFICIENT_BUFFER. @@ -220,7 +220,7 @@ BOOL WINAPI SFileOpenFileEx(HANDLE hMPQ, const char * szFileName, DWORD dwSearch size_t nHandleSize = 0; // Memory space necessary to allocate TMPQHandle int nError = ERROR_SUCCESS; -#ifdef _DEBUG +#ifdef _DEBUG // Due to increasing numbers of files in MPQs, I had to change the behavior // of opening by file index. Now, the SFILE_OPEN_BY_INDEX value of dwSearchScope // must be entered. This check will allow to find code places that are incompatible @@ -321,13 +321,13 @@ BOOL WINAPI SFileOpenFileEx(HANDLE hMPQ, const char * szFileName, DWORD dwSearch hf->pBlock = pBlock; hf->nBlocks = (hf->pBlock->dwFSize + ha->dwBlockSize - 1) / ha->dwBlockSize; hf->pHash = pHash; - + hf->MpqFilePos.HighPart = pBlockEx->wFilePosHigh; hf->MpqFilePos.LowPart = pBlock->dwFilePos; hf->MpqFilePos.QuadPart += ha->MpqPos.QuadPart; hf->dwHashIndex = dwHashIndex; - hf->dwFileIndex = dwBlockIndex; + hf->dwFileIndex = dwBlockIndex; // Allocate buffers for decompression. if(hf->pBlock->dwFlags & MPQ_FILE_COMPRESSED) @@ -337,11 +337,11 @@ BOOL WINAPI SFileOpenFileEx(HANDLE hMPQ, const char * szFileName, DWORD dwSearch // As for newer MPQs, there may be one additional entry in the block table // (if the MPQ_FILE_HAS_EXTRA flag is set). // Allocate the buffer to include this DWORD as well - + if((hf->pdwBlockPos = ALLOCMEM(DWORD, hf->nBlocks + 2)) == NULL) nError = ERROR_NOT_ENOUGH_MEMORY; } - + // Decrypt file seed. Cannot be used if the file is given by index if(dwSearchScope != SFILE_OPEN_BY_INDEX) { @@ -386,7 +386,7 @@ BOOL WINAPI SFileOpenFileEx(HANDLE hMPQ, const char * szFileName, DWORD dwSearch BOOL WINAPI SFileCloseFile(HANDLE hFile) { TMPQFile * hf = (TMPQFile *)hFile; - + if(!IsValidFileHandle(hf)) { SetLastError(ERROR_INVALID_PARAMETER); diff --git a/contrib/vmap_extractor_v2/stormlib/SFileReadFile.cpp b/contrib/vmap_extractor_v2/stormlib/SFileReadFile.cpp index 27fd1e0f085..a1f94ae3bb1 100644 --- a/contrib/vmap_extractor_v2/stormlib/SFileReadFile.cpp +++ b/contrib/vmap_extractor_v2/stormlib/SFileReadFile.cpp @@ -154,8 +154,8 @@ static DWORD WINAPI ReadMPQBlocks(TMPQFile * hf, DWORD dwBlockPos, BYTE * buffer } } - // Set file pointer, if necessary - if(ha->FilePointer.QuadPart != FilePos.QuadPart) + // Set file pointer, if necessary + if(ha->FilePointer.QuadPart != FilePos.QuadPart) { SetFilePointer(ha->hFile, FilePos.LowPart, &FilePos.HighPart, FILE_BEGIN); } @@ -245,7 +245,7 @@ static DWORD WINAPI ReadMPQBlocks(TMPQFile * hf, DWORD dwBlockPos, BYTE * buffer // TODO: Test for archives > 4GB static DWORD WINAPI ReadMPQFileSingleUnit(TMPQFile * hf, DWORD dwFilePos, BYTE * pbBuffer, DWORD dwToRead) { - TMPQArchive * ha = hf->ha; + TMPQArchive * ha = hf->ha; DWORD dwBytesRead = 0; if(ha->FilePointer.QuadPart != hf->MpqFilePos.QuadPart) @@ -311,7 +311,7 @@ static DWORD WINAPI ReadMPQFileSingleUnit(TMPQFile * hf, DWORD dwFilePos, BYTE * // TODO: Test for archives > 4GB static DWORD WINAPI ReadMPQFile(TMPQFile * hf, DWORD dwFilePos, BYTE * pbBuffer, DWORD dwToRead) { - TMPQArchive * ha = hf->ha; + TMPQArchive * ha = hf->ha; TMPQBlock * pBlock = hf->pBlock; // Pointer to file block DWORD dwBytesRead = 0; // Number of bytes read from the file DWORD dwBlockPos; // Position in the file aligned to the whole blocks @@ -359,7 +359,7 @@ static DWORD WINAPI ReadMPQFile(TMPQFile * hf, DWORD dwFilePos, BYTE * pbBuffer, // Copy data from block buffer into target buffer memcpy(pbBuffer, ha->pbBlockBuffer + ha->dwBuffPos, dwToCopy); - + // Update pointers dwToRead -= dwToCopy; dwBytesRead += dwToCopy; @@ -374,7 +374,7 @@ static DWORD WINAPI ReadMPQFile(TMPQFile * hf, DWORD dwFilePos, BYTE * pbBuffer, // Load the whole ("middle") blocks only if there are more or equal one block if(dwToRead > ha->dwBlockSize) - { + { DWORD dwBlockBytes = dwToRead & ~(ha->dwBlockSize - 1); dwLoaded = ReadMPQBlocks(hf, dwBlockPos, pbBuffer, dwBlockBytes); @@ -419,7 +419,7 @@ static DWORD WINAPI ReadMPQFile(TMPQFile * hf, DWORD dwFilePos, BYTE * pbBuffer, dwBytesRead += dwToCopy; ha->dwBuffPos = dwToCopy; } - + // Return what we've read return dwBytesRead; } @@ -456,7 +456,7 @@ BOOL WINAPI SFileReadFile(HANDLE hFile, VOID * lpBuffer, DWORD dwToRead, DWORD * SetLastError(ERROR_HANDLE_EOF); return FALSE; } - + if(pdwRead != NULL) *pdwRead = dwTransferred; return TRUE; @@ -498,7 +498,7 @@ BOOL WINAPI SFileReadFile(HANDLE hFile, VOID * lpBuffer, DWORD dwToRead, DWORD * DWORD WINAPI SFileGetFilePos(HANDLE hFile, DWORD * pdwFilePosHigh) { TMPQFile * hf = (TMPQFile *)hFile; - + if(pdwFilePosHigh != NULL) *pdwFilePosHigh = 0; @@ -525,7 +525,7 @@ DWORD WINAPI SFileGetFilePos(HANDLE hFile, DWORD * pdwFilePosHigh) DWORD WINAPI SFileGetFileSize(HANDLE hFile, DWORD * pdwFileSizeHigh) { TMPQFile * hf = (TMPQFile *)hFile; - + if(pdwFileSizeHigh != NULL) *pdwFileSizeHigh = 0; @@ -604,7 +604,7 @@ DWORD WINAPI SFileSetFilePointer(HANDLE hFile, LONG lFilePos, LONG * pdwFilePosH //----------------------------------------------------------------------------- // Tries to retrieve the file name -static TID2Ext id2ext[] = +static TID2Ext id2ext[] = { {0x1A51504D, "mpq"}, // MPQ archive header ID ('MPQ\x1A') {0x46464952, "wav"}, // WAVE header 'RIFF' @@ -623,7 +623,7 @@ static TID2Ext id2ext[] = {0x3032444D, "m2"}, // WoW ??? .m2 {0x43424457, "dbc"}, // ??? .dbc {0x47585053, "bls"}, // WoW pixel shaders - {0, NULL} // Terminator + {0, NULL} // Terminator }; // TODO: Test for archives > 4GB @@ -646,7 +646,7 @@ BOOL WINAPI SFileGetFileName(HANDLE hFile, char * szFileName) if(hf == NULL || szFileName == NULL) nError = ERROR_INVALID_PARAMETER; } - + // If the file name is already filled, return it. if(nError == ERROR_SUCCESS && *hf->szFileName != 0) { @@ -665,7 +665,7 @@ BOOL WINAPI SFileGetFileName(HANDLE hFile, char * szFileName) if(nError == ERROR_SUCCESS) { dwFirstBytes[0] = dwFirstBytes[1] = 0; - dwFilePos = SFileSetFilePointer(hf, 0, NULL, FILE_CURRENT); + dwFilePos = SFileSetFilePointer(hf, 0, NULL, FILE_CURRENT); if(!SFileReadFile(hFile, &dwFirstBytes, sizeof(dwFirstBytes), NULL)) nError = GetLastError(); BSWAP_ARRAY32_UNSIGNED(dwFirstBytes, sizeof(dwFirstBytes) / sizeof(DWORD)); diff --git a/contrib/vmap_extractor_v2/stormlib/SListFile.cpp b/contrib/vmap_extractor_v2/stormlib/SListFile.cpp index c3723d17dcd..628043c0a84 100644 --- a/contrib/vmap_extractor_v2/stormlib/SListFile.cpp +++ b/contrib/vmap_extractor_v2/stormlib/SListFile.cpp @@ -71,7 +71,7 @@ static size_t ReadLine(TListFileCache * pCache, char * szLine, int nMaxChars) { char * szLineBegin = szLine; char * szLineEnd = szLine + nMaxChars - 1; - + __BeginLoading: // Skip newlines, spaces, tabs and another non-printable stuff @@ -156,7 +156,7 @@ int SListFileAddNode(TMPQArchive * ha, const char * szFileName) dwName2 = pHash->dwName2; if((DWORD_PTR)ha->pListFile[dwHashIndex] <= LISTFILE_ENTRY_DELETED) return ERROR_SUCCESS; - + // Create the listfile node and insert it into the listfile table nLength = strlen(szFileName); pNode = (TFileNode *)ALLOCMEM(char, sizeof(TFileNode) + nLength); @@ -310,8 +310,8 @@ int SListFileSaveToMpq(TMPQArchive * ha) szBuffer[nLength + 0] = 0x0D; szBuffer[nLength + 1] = 0x0A; WriteFile(hFile, szBuffer, (DWORD)(nLength + 2), &dwTransferred, NULL); - } - + } + // Add the listfile into the archive. SFileSetLocale(LANG_NEUTRAL); nError = AddFileToArchive(ha, hFile, LISTFILE_NAME, MPQ_FILE_COMPRESS_PKWARE | MPQ_FILE_ENCRYPTED | MPQ_FILE_REPLACEEXISTING, 0, SFILE_TYPE_DATA, NULL); @@ -329,7 +329,7 @@ int SListFileSaveToMpq(TMPQArchive * ha) // File functions // Adds a listfile into the MPQ archive. -// Note that the function does not remove the +// Note that the function does not remove the // TODO: Test for archives > 4GB int WINAPI SFileAddListFile(HANDLE hMpq, const char * szListFile) { @@ -359,7 +359,7 @@ int WINAPI SFileAddListFile(HANDLE hMpq, const char * szListFile) if(nError == ERROR_SUCCESS) { - dwCacheSize = + dwCacheSize = dwFileSize = SFileGetFileSize(hListFile, NULL); // Try to allocate memory for the complete file. If it fails, @@ -443,7 +443,7 @@ HANDLE SListFileFindFirstFile(HANDLE hMpq, const char * szListFile, const char * if(nError == ERROR_SUCCESS) { - dwCacheSize = + dwCacheSize = dwFileSize = SFileGetFileSize(hListFile, NULL); // Try to allocate memory for the complete file. If it fails, @@ -493,7 +493,7 @@ HANDLE SListFileFindFirstFile(HANDLE hMpq, const char * szListFile, const char * // If some mask entered, check it if(CheckWildCard(lpFindFileData->cFileName, pCache->szMask)) - break; + break; } } diff --git a/contrib/vmap_extractor_v2/stormlib/StormLib.h b/contrib/vmap_extractor_v2/stormlib/StormLib.h index eeb8daa6468..93e2eb41c4b 100644 --- a/contrib/vmap_extractor_v2/stormlib/StormLib.h +++ b/contrib/vmap_extractor_v2/stormlib/StormLib.h @@ -55,7 +55,7 @@ // // The library type is encoded in the library name as the following // StormLibXYZ.lib -// +// // X - D for Debug version, R for Release version // Y - A for ANSI version, U for Unicode version (Unicode version does not exist yet) // Z - S for static C library, D for multithreaded DLL C-library @@ -63,15 +63,15 @@ #if defined(_MSC_VER) && !defined (__STORMLIB_SELF__) #ifdef _DEBUG // DEBUG VERSIONS - #ifdef _DLL + #ifdef _DLL #pragma comment(lib, "StormLibDAD.lib") // Debug Ansi Dynamic version - #else + #else #pragma comment(lib, "StormLibDAS.lib") // Debug Ansi Static version #endif #else // RELEASE VERSIONS #ifdef _DLL #pragma comment(lib, "StormLibRAD.lib") // Release Ansi Dynamic version - #else + #else #pragma comment(lib, "StormLibRAS.lib") // Release Ansi Static version #endif #endif @@ -109,7 +109,7 @@ #define MPQ_FILE_COMPRESS_PKWARE 0x00000100 // Compression made by PKWARE Data Compression Library #define MPQ_FILE_COMPRESS_MULTI 0x00000200 // Multiple compressions #define MPQ_FILE_COMPRESSED 0x0000FF00 // File is compressed -#define MPQ_FILE_ENCRYPTED 0x00010000 // Indicates whether file is encrypted +#define MPQ_FILE_ENCRYPTED 0x00010000 // Indicates whether file is encrypted #define MPQ_FILE_FIXSEED 0x00020000 // File decrypt seed has to be fixed #define MPQ_FILE_SINGLE_UNIT 0x01000000 // File is stored as a single unit, rather than split into sectors (Thx, Quantam) #define MPQ_FILE_DUMMY_FILE 0x02000000 // The file is only 1 byte long and its name is a hash @@ -132,8 +132,8 @@ #define MPQ_COMPRESSION_ZLIB 0x02 // ZLIB compression #define MPQ_COMPRESSION_PKWARE 0x08 // PKWARE DCL compression #define MPQ_COMPRESSION_BZIP2 0x10 // BZIP2 compression -#define MPQ_COMPRESSION_WAVE_MONO 0x40 // -#define MPQ_COMPRESSION_WAVE_STEREO 0x80 // +#define MPQ_COMPRESSION_WAVE_MONO 0x40 // +#define MPQ_COMPRESSION_WAVE_STEREO 0x80 // // Constants for SFileAddWave @@ -168,7 +168,7 @@ #define CCB_COPYING_NON_MPQ_DATA 3 // Copying non-MPQ data: No params used #define CCB_COMPACTING_FILES 4 // Compacting archive (dwParam1 = current, dwParam2 = total) #define CCB_CLOSING_ARCHIVE 5 // Closing archive: No params used - + #define LISTFILE_NAME "(listfile)" // Name of internal listfile #define SIGNATURE_NAME "(signature)" // Name of internal signature #define ATTRIBUTES_NAME "(attributes)" // Name of internal attributes file @@ -213,10 +213,10 @@ struct TMPQShunt struct TMPQHeader { // The ID_MPQ ('MPQ\x1A') signature - DWORD dwID; + DWORD dwID; // Size of the archive header - DWORD dwHeaderSize; + DWORD dwHeaderSize; // Size of MPQ archive // This field is deprecated in the Burning Crusade MoPaQ format, and the size of the archive @@ -235,14 +235,14 @@ struct TMPQHeader // Offset to the beginning of the hash table, relative to the beginning of the archive. DWORD dwHashTablePos; - + // Offset to the beginning of the block table, relative to the beginning of the archive. DWORD dwBlockTablePos; - + // Number of entries in the hash table. Must be a power of two, and must be less than 2^16 for // the original MoPaQ format, or less than 2^20 for the Burning Crusade format. DWORD dwHashTableSize; - + // Number of entries in the block table DWORD dwBlockTableSize; }; @@ -267,7 +267,7 @@ struct TMPQHash { // The hash of the file path, using method A. DWORD dwName1; - + // The hash of the file path, using method B. DWORD dwName2; @@ -303,16 +303,16 @@ struct TMPQBlock { // Offset of the beginning of the block, relative to the beginning of the archive. DWORD dwFilePos; - + // Compressed file size DWORD dwCSize; - + // Only valid if the block is a file; otherwise meaningless, and should be 0. // If the file is compressed, this is the size of the uncompressed file data. - DWORD dwFSize; - + DWORD dwFSize; + // Flags for the file. See MPQ_FILE_XXXX constants - DWORD dwFlags; + DWORD dwFlags; }; @@ -333,7 +333,7 @@ struct TFileNode // There can be more files that have the same name. // (e.g. multiple language files). We don't want to // have an entry for each of them, so the entries will be referenced. - // When a number of node references reaches zero, + // When a number of node references reaches zero, // the node will be deleted size_t nLength; // File name length @@ -372,7 +372,7 @@ struct TMPQArchive TMPQHash * pHashTable; // Hash table TMPQBlock * pBlockTable; // Block table TMPQBlockEx * pExtBlockTable; // Extended block table - + TMPQShunt Shunt; // MPQ shunt. Valid only when ID_MPQ_SHUNT has been found TMPQHeader2 Header; // MPQ header @@ -520,8 +520,8 @@ int WINAPI SFileAddListFile(HANDLE hMpq, const char * szListFile); // Archive creating and editing BOOL WINAPI SFileCreateArchiveEx(const char * szMpqName, DWORD dwCreationDisposition, DWORD dwHashTableSize, HANDLE * phMPQ); -BOOL WINAPI SFileAddFile(HANDLE hMPQ, const char * szFileName, const char * szArchivedName, DWORD dwFlags); -BOOL WINAPI SFileAddWave(HANDLE hMPQ, const char * szFileName, const char * szArchivedName, DWORD dwFlags, DWORD dwQuality); +BOOL WINAPI SFileAddFile(HANDLE hMPQ, const char * szFileName, const char * szArchivedName, DWORD dwFlags); +BOOL WINAPI SFileAddWave(HANDLE hMPQ, const char * szFileName, const char * szArchivedName, DWORD dwFlags, DWORD dwQuality); BOOL WINAPI SFileRemoveFile(HANDLE hMPQ, const char * szFileName, DWORD dwSearchScope = SFILE_OPEN_BY_INDEX); BOOL WINAPI SFileRenameFile(HANDLE hMPQ, const char * szOldFileName, const char * szNewFileName); BOOL WINAPI SFileSetFileLocale(HANDLE hFile, LCID lcNewLocale); diff --git a/contrib/vmap_extractor_v2/stormlib/StormPort.h b/contrib/vmap_extractor_v2/stormlib/StormPort.h index 4cb8d84bd57..8670627809c 100644 --- a/contrib/vmap_extractor_v2/stormlib/StormPort.h +++ b/contrib/vmap_extractor_v2/stormlib/StormPort.h @@ -20,7 +20,7 @@ /* 12.11.03 1.02 Dan Macintosh compatibility */ /* 24.07.04 1.03 Sam Mac OS X compatibility */ /* 22.11.06 1.04 Sam Mac OS X compatibility (for StormLib 6.0) */ -/* 31.12.06 1.05 XPinguin Full GNU/Linux compatibility */ +/* 31.12.06 1.05 XPinguin Full GNU/Linux compatibility */ /*****************************************************************************/ #ifndef __STORMPORT_H__ @@ -35,9 +35,9 @@ #define _CRT_NON_CONFORMING_SWPRINTFS #endif - #include - #include - #include + #include + #include + #include #define PLATFORM_LITTLE_ENDIAN 1 #ifdef WIN64 @@ -50,20 +50,20 @@ #endif -// Defines for Mac Carbon +// Defines for Mac Carbon #if !defined(PLATFORM_DEFINED) && defined(__APPLE__) // Mac Carbon API // Macintosh using Carbon #include // Mac OS X #define _stricmp strcasecmp // Case insensitive strcmp has a different name on this platform. #define _strnicmp strncasecmp - + typedef void * LPCSTR; typedef unsigned long * LPDWORD; typedef long * PLONG; typedef void * LPVOID; typedef unsigned int UINT; - + #define PKEXPORT #define __SYS_ZLIB #define __SYS_BZLIB @@ -120,17 +120,17 @@ typedef void * LPOVERLAPPED; // Unsupported on Linux typedef char TCHAR; typedef unsigned long LCID; - + typedef void * LPCSTR; typedef unsigned long * LPDWORD; typedef long * PLONG; typedef void * LPVOID; typedef unsigned int UINT; - + typedef struct _FILETIME - { - DWORD dwLowDateTime; - DWORD dwHighDateTime; + { + DWORD dwLowDateTime; + DWORD dwHighDateTime; } FILETIME, *PFILETIME; @@ -152,7 +152,7 @@ LONGLONG QuadPart; } LARGE_INTEGER, *PLARGE_INTEGER; - + // Some Windows-specific defines #ifndef MAX_PATH #define MAX_PATH 1024 @@ -167,24 +167,24 @@ #endif #define VOID void - #define WINAPI + #define WINAPI #define FILE_BEGIN SEEK_SET #define FILE_CURRENT SEEK_CUR #define FILE_END SEEK_END - + #define CREATE_NEW 1 #define CREATE_ALWAYS 2 #define OPEN_EXISTING 3 #define OPEN_ALWAYS 4 - + #define FILE_SHARE_READ 0x00000001L #define GENERIC_WRITE 0x40000000 #define GENERIC_READ 0x80000000 - + #define FILE_FLAG_DELETE_ON_CLOSE 1 // Sam: Added these two defines so it would compile. #define FILE_FLAG_SEQUENTIAL_SCAN 2 - + #define ERROR_SUCCESS 0 #define ERROR_INVALID_FUNCTION 1 #define ERROR_FILE_NOT_FOUND 2 @@ -204,22 +204,22 @@ #define ERROR_PARAMETER_QUOTA_EXCEEDED 1283 #define ERROR_FILE_CORRUPT 1392 #define ERROR_INSUFFICIENT_BUFFER 4999 - + #define INVALID_HANDLE_VALUE ((HANDLE) -1) - + #ifndef min #define min(a, b) ((a < b) ? a : b) #endif - + #ifndef max #define max(a, b) ((a > b) ? a : b) #endif - + #define _stricmp strcasecmp #define _strnicmp strncasecmp - + extern int globalerr; - + void SetLastError(int err); int GetLastError(); char *ErrString(int err); diff --git a/contrib/vmap_extractor_v2/stormlib/StormPortLinux.cpp b/contrib/vmap_extractor_v2/stormlib/StormPortLinux.cpp index 0cd827fde9f..03c51f0d4dc 100644 --- a/contrib/vmap_extractor_v2/stormlib/StormPortLinux.cpp +++ b/contrib/vmap_extractor_v2/stormlib/StormPortLinux.cpp @@ -2,7 +2,7 @@ * * Description: implementation for StormLib - linux port * intended to be used in GLdiablo -* +* * ----> StormLib was originally developed for Windows by * Ladislav Zezula (www.zezula.net), and he did * a _great_ job! Thanks Ladislav! @@ -17,9 +17,9 @@ * * Author: Marko Friedemann * Created at: Mon Jan 29 19:01:37 CEST 2001 -* Computer: whiplash.flachland-chemnitz.de +* Computer: whiplash.flachland-chemnitz.de * System: Linux 2.4.0 on i686 -* +* * Copyright (c) 2001 BMX-Chemnitz.DE All rights reserved. * ********************************************************************/ @@ -97,7 +97,7 @@ DWORD GetFileSize(HANDLE hFile, DWORD *ulOffSetHigh) struct stat fileinfo; fstat((int)hFile, &fileinfo); - + return fileinfo.st_size; } @@ -163,6 +163,6 @@ BOOL DeleteFile(const char *lpFileName) BOOL MoveFile(const char *lpExistingFileName, const char *lpNewFileName) { return rename(lpExistingFileName, lpNewFileName); -} +} #endif diff --git a/contrib/vmap_extractor_v2/stormlib/StormPortMac.cpp b/contrib/vmap_extractor_v2/stormlib/StormPortMac.cpp index 26f67872a14..976b8fbe8e8 100644 --- a/contrib/vmap_extractor_v2/stormlib/StormPortMac.cpp +++ b/contrib/vmap_extractor_v2/stormlib/StormPortMac.cpp @@ -1,7 +1,7 @@ /******************************************************************** * * Description: implementation for StormLib - Macintosh port -* +* * these are function wraps to execute Windows API calls * as native Macintosh file calls (open/close/read/write/...) * requires Mac OS X @@ -45,14 +45,14 @@ static OSErr FSGetFullPath(const FSRef *ref, UInt8 *fullPath, UInt32 fullPathLen OSErr result; result = FSRefMakePath(ref, fullPath, fullPathLength); - + return result; } static OSErr FSLocationFromFullPath(const void *fullPath, FSRef *ref) { OSErr result; - + result = FSPathMakeRef((UInt8 *)fullPath, ref, NULL); // Create an FSRef from the path return result; } @@ -61,7 +61,7 @@ static OSErr FSLocationFromFullPath(const void *fullPath, FSRef *ref) /*****************************************************************************/ -static OSErr FSCreateCompat(const FSRef *parentRef, OSType creator, OSType fileType, const UniChar *fileName, +static OSErr FSCreateCompat(const FSRef *parentRef, OSType creator, OSType fileType, const UniChar *fileName, UniCharCount nameLength, FSRef *ref) { FSCatalogInfo theCatInfo; @@ -71,7 +71,7 @@ static OSErr FSCreateCompat(const FSRef *parentRef, OSType creator, OSType fileT ((FileInfo *)&theCatInfo.finderInfo)->finderFlags = 0; SetPt(&((FileInfo *)&theCatInfo.finderInfo)->location, 0, 0); ((FileInfo *)&theCatInfo.finderInfo)->reservedField = 0; - + theErr = FSCreateFileUnicode(parentRef, nameLength, fileName, kFSCatInfoFinderInfo, &theCatInfo, ref, NULL); return theErr; } @@ -84,11 +84,11 @@ static OSErr FSOpenDFCompat(FSRef *ref, char permission, short *refNum) HFSUniStr255 forkName; OSErr theErr; Boolean isFolder, wasChanged; - + theErr = FSResolveAliasFile(ref, TRUE, &isFolder, &wasChanged); if (theErr != noErr) return theErr; - + FSGetDataForkName(&forkName); theErr = FSOpenFork(ref, forkName.length, forkName.unicode, permission, refNum); return theErr; @@ -209,7 +209,7 @@ void ConvertTMPQShunt(void *shunt) void ConvertTMPQHeader(void *header) { TMPQHeader2 * theHeader = (TMPQHeader2 *)header; - + theHeader->dwID = SwapULong(theHeader->dwID); theHeader->dwHeaderSize = SwapULong(theHeader->dwHeaderSize); theHeader->dwArchiveSize = SwapULong(theHeader->dwArchiveSize); @@ -271,7 +271,7 @@ int GetLastError() ********************************************************************/ char *ErrString(int err) { - switch (err) + switch (err) { case ERROR_INVALID_FUNCTION: return "function not implemented"; @@ -324,7 +324,7 @@ void GetTempPath(DWORD szTempLength, char * szTemp) // I think I'll change this else szTemp[0] = '\0'; strcat(szTemp, "/"); - + SetLastError(theErr); } @@ -347,7 +347,7 @@ void GetTempFileName(const char * lpTempFolderPath, const char * lpFileName, DWO strcpy(szLFName, lpTempFolderPath); strcat(szLFName, lpFileName); strcat(szLFName, tmp); - + if ((fHandle = CreateFile(szLFName, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0)) == INVALID_HANDLE_VALUE) // OK we found it! break; @@ -364,16 +364,16 @@ BOOL DeleteFile(const char * lpFileName) { OSErr theErr; FSRef theFileRef; - + theErr = FSLocationFromFullPath(lpFileName, &theFileRef); if (theErr != noErr) { SetLastError(theErr); return FALSE; } - + theErr = FSDeleteObject(&theFileRef); - + SetLastError(theErr); return theErr == noErr; @@ -390,7 +390,7 @@ BOOL MoveFile(const char * lpFromFileName, const char * lpToFileName) FSRef fromFileRef; FSRef toFileRef; FSRef parentFolderRef; - + // Get the path to the old file theErr = FSLocationFromFullPath(lpFromFileName, &fromFileRef); if (theErr != noErr) @@ -398,7 +398,7 @@ BOOL MoveFile(const char * lpFromFileName, const char * lpToFileName) SetLastError(theErr); return false; } - + // Get the path to the new folder for the file char folderName[strlen(lpToFileName)]; CFStringRef folderPathCFString = CFStringCreateWithCString(NULL, lpToFileName, kCFStringEncodingUTF8); @@ -409,7 +409,7 @@ BOOL MoveFile(const char * lpFromFileName, const char * lpToFileName) CFRelease(fileURL); CFRelease(folderURL); CFRelease(folderPathCFString); - + // Move the old file theErr = FSMoveObject(&fromFileRef, &parentFolderRef, &toFileRef); if (theErr != noErr) @@ -417,19 +417,19 @@ BOOL MoveFile(const char * lpFromFileName, const char * lpToFileName) SetLastError(theErr); return false; } - + // Get a CFString for the new file name CFStringRef newFileNameCFString = CFStringCreateWithCString(NULL, lpToFileName, kCFStringEncodingUTF8); fileURL = CFURLCreateWithFileSystemPath(NULL, newFileNameCFString, kCFURLPOSIXPathStyle, FALSE); CFRelease(newFileNameCFString); newFileNameCFString = CFURLCopyLastPathComponent(fileURL); CFRelease(fileURL); - + // Convert CFString to Unicode and rename the file - UniChar unicodeFileName[256]; - CFStringGetCharacters(newFileNameCFString, CFRangeMake(0, CFStringGetLength(newFileNameCFString)), + UniChar unicodeFileName[256]; + CFStringGetCharacters(newFileNameCFString, CFRangeMake(0, CFStringGetLength(newFileNameCFString)), unicodeFileName); - theErr = FSRenameUnicode(&toFileRef, CFStringGetLength(newFileNameCFString), unicodeFileName, + theErr = FSRenameUnicode(&toFileRef, CFStringGetLength(newFileNameCFString), unicodeFileName, kTextEncodingUnknown, NULL); if (theErr != noErr) { @@ -437,9 +437,9 @@ BOOL MoveFile(const char * lpFromFileName, const char * lpToFileName) CFRelease(newFileNameCFString); return false; } - + CFRelease(newFileNameCFString); - + SetLastError(theErr); return true; } @@ -470,7 +470,7 @@ HANDLE CreateFile( const char *sFileName, /* file name */ char permission; static OSType gCreator; static OSType gType; - + theErr = FSLocationFromFullPath(sFileName, &theFileRef); if (theErr == fnfErr) { // Create the FSRef for the parent directory. @@ -484,23 +484,23 @@ HANDLE CreateFile( const char *sFileName, /* file name */ CFRelease(fileURL); CFRelease(folderURL); CFRelease(folderPathCFString); - } + } if (theErr != noErr) { SetLastError(theErr); if (ulCreation == OPEN_EXISTING || theErr != fnfErr) return INVALID_HANDLE_VALUE; } - + if (ulCreation != OPEN_EXISTING) { /* We create the file */ UniChar unicodeFileName[256]; CFStringRef filePathCFString = CFStringCreateWithCString(NULL, sFileName, kCFStringEncodingUTF8); CFURLRef fileURL = CFURLCreateWithFileSystemPath(NULL, filePathCFString, kCFURLPOSIXPathStyle, FALSE); CFStringRef fileNameCFString = CFURLCopyLastPathComponent(fileURL); - CFStringGetCharacters(fileNameCFString, CFRangeMake(0, CFStringGetLength(fileNameCFString)), + CFStringGetCharacters(fileNameCFString, CFRangeMake(0, CFStringGetLength(fileNameCFString)), unicodeFileName); - theErr = FSCreateCompat(&theParentRef, gCreator, gType, unicodeFileName, + theErr = FSCreateCompat(&theParentRef, gCreator, gType, unicodeFileName, CFStringGetLength(fileNameCFString), &theFileRef); CFRelease(fileNameCFString); CFRelease(filePathCFString); @@ -522,7 +522,7 @@ HANDLE CreateFile( const char *sFileName, /* file name */ permission = fsRdWrPerm; } theErr = FSOpenDFCompat(&theFileRef, permission, &fileRef); - + SetLastError(theErr); if (theErr == noErr) @@ -537,14 +537,14 @@ HANDLE CreateFile( const char *sFileName, /* file name */ BOOL CloseHandle( HANDLE hFile ) /* handle to object */ { OSErr theErr; - + if ((hFile == NULL) || (hFile == INVALID_HANDLE_VALUE)) return FALSE; theErr = FSCloseFork((short)(int)hFile); - + SetLastError(theErr); - + return theErr != noErr; } @@ -562,19 +562,19 @@ DWORD GetFileSize( HANDLE hFile, /* handle to file */ SetLastError(theErr); return -1u; } - + theErr = FSGetForkSize((short)(int)hFile, &fileLength); if (theErr != noErr) { SetLastError(theErr); return -1u; } - + if (ulOffSetHigh != NULL) *ulOffSetHigh = fileLength >> 32; SetLastError(theErr); - + return fileLength; } @@ -593,81 +593,81 @@ DWORD SetFilePointer( HANDLE hFile, /* handle to file */ if (ulMethod == FILE_CURRENT) { SInt64 bytesToMove; - + if (pOffSetHigh != NULL) bytesToMove = ((SInt64)*pOffSetHigh << 32) + lOffSetLow; else bytesToMove = lOffSetLow; - + SInt64 newPos; - + theErr = FSSetForkPosition((short)(int)hFile, fsFromMark, bytesToMove); if (theErr != noErr) { SetLastError(theErr); return -1u; } - + theErr = FSGetForkPosition((short)(int)hFile, &newPos); if (theErr != noErr) { SetLastError(theErr); return -1u; } - + if (pOffSetHigh != NULL) *pOffSetHigh = newPos >> 32; - + SetLastError(theErr); return newPos; } else if (ulMethod == FILE_BEGIN) { SInt64 bytesToMove; - + if (pOffSetHigh != NULL) bytesToMove = ((SInt64)*pOffSetHigh << 32) + lOffSetLow; else bytesToMove = lOffSetLow; - + theErr = FSSetForkPosition((short)(int)hFile, fsFromStart, bytesToMove); if (theErr != noErr) { SetLastError(theErr); return -1u; } - + SetLastError(theErr); return lOffSetLow; } else { SInt64 bytesToMove; - + if (pOffSetHigh != NULL) bytesToMove = ((SInt64)*pOffSetHigh << 32) + lOffSetLow; else bytesToMove = lOffSetLow; - + SInt64 newPos; - + theErr = FSSetForkPosition((short)(int)hFile, fsFromLEOF, bytesToMove); if (theErr != noErr) { SetLastError(theErr); return -1u; } - + theErr = FSGetForkPosition((short)(int)hFile, &newPos); if (theErr != noErr) { SetLastError(theErr); return -1u; } - + if (pOffSetHigh != NULL) *pOffSetHigh = newPos >> 32; - + SetLastError(theErr); return newPos; } @@ -679,11 +679,11 @@ DWORD SetFilePointer( HANDLE hFile, /* handle to file */ BOOL SetEndOfFile( HANDLE hFile ) /* handle to file */ { OSErr theErr; - + theErr = FSSetForkSize((short)(int)hFile, fsAtMark, 0); - + SetLastError(theErr); - + return theErr == noErr; } @@ -701,13 +701,13 @@ BOOL ReadFile( HANDLE hFile, /* handle to file */ ByteCount nbCharsRead; OSErr theErr; - + nbCharsRead = ulLen; theErr = FSReadFork((short)(int)hFile, fsAtMark, 0, nbCharsRead, pBuffer, &nbCharsRead); *ulRead = nbCharsRead; - + SetLastError(theErr); - + return theErr == noErr; } @@ -725,13 +725,13 @@ BOOL WriteFile( HANDLE hFile, /* handle to file */ ByteCount nbCharsToWrite; OSErr theErr; - - nbCharsToWrite = ulLen; + + nbCharsToWrite = ulLen; theErr = FSWriteFork((short)(int)hFile, fsAtMark, 0, nbCharsToWrite, pBuffer, &nbCharsToWrite); *ulWritten = nbCharsToWrite; - + SetLastError(theErr); - + return theErr == noErr; } @@ -744,15 +744,15 @@ BOOL IsBadReadPtr(const void * ptr, int size) return FALSE; } -// Returns attributes of a file. Actually, it doesn't, it just checks if +// Returns attributes of a file. Actually, it doesn't, it just checks if // the file exists, since that's all StormLib uses it for DWORD GetFileAttributes(const char * szFileName) { FSRef theRef; OSErr theErr; - + theErr = FSLocationFromFullPath(szFileName, &theRef); - + if (theErr != noErr) return -1u; else diff --git a/contrib/vmap_extractor_v2/stormlib/bzip2/blocksort.c b/contrib/vmap_extractor_v2/stormlib/bzip2/blocksort.c index 33ec9f5dcb0..4c09446422a 100644 --- a/contrib/vmap_extractor_v2/stormlib/bzip2/blocksort.c +++ b/contrib/vmap_extractor_v2/stormlib/bzip2/blocksort.c @@ -17,16 +17,16 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product + 2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written + 4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS @@ -57,8 +57,8 @@ For more information on these sources, see the manual. - To get some idea how the block sorting algorithms in this file - work, read my paper + To get some idea how the block sorting algorithms in this file + work, read my paper On the Performance of BWT Sorting Algorithms in Proceedings of the IEEE Data Compression Conference 2000, Snowbird, Utah, USA, 27-30 March 2000. The main sort in this @@ -74,11 +74,11 @@ /*---------------------------------------------*/ /*---------------------------------------------*/ -static +static __inline__ -void fallbackSimpleSort ( UInt32* fmap, - UInt32* eclass, - Int32 lo, +void fallbackSimpleSort ( UInt32* fmap, + UInt32* eclass, + Int32 lo, Int32 hi ) { Int32 i, j, tmp; @@ -137,9 +137,9 @@ void fallbackSimpleSort ( UInt32* fmap, static -void fallbackQSort3 ( UInt32* fmap, +void fallbackQSort3 ( UInt32* fmap, UInt32* eclass, - Int32 loSt, + Int32 loSt, Int32 hiSt ) { Int32 unLo, unHi, ltLo, gtHi, n, m; @@ -164,9 +164,9 @@ void fallbackQSort3 ( UInt32* fmap, } /* Random partitioning. Median of 3 sometimes fails to - avoid bad cases. Median of 9 seems to help but + avoid bad cases. Median of 9 seems to help but looks rather expensive. This too seems to work but - is cheaper. Guidance for the magic constants + is cheaper. Guidance for the magic constants 7621 and 32768 is taken from Sedgewick's algorithms book, chapter 35. */ @@ -183,10 +183,10 @@ void fallbackQSort3 ( UInt32* fmap, while (1) { if (unLo > unHi) break; n = (Int32)eclass[fmap[unLo]] - (Int32)med; - if (n == 0) { - fswap(fmap[unLo], fmap[ltLo]); - ltLo++; unLo++; - continue; + if (n == 0) { + fswap(fmap[unLo], fmap[ltLo]); + ltLo++; unLo++; + continue; }; if (n > 0) break; unLo++; @@ -194,10 +194,10 @@ void fallbackQSort3 ( UInt32* fmap, while (1) { if (unLo > unHi) break; n = (Int32)eclass[fmap[unHi]] - (Int32)med; - if (n == 0) { - fswap(fmap[unHi], fmap[gtHi]); - gtHi--; unHi--; - continue; + if (n == 0) { + fswap(fmap[unHi], fmap[gtHi]); + gtHi--; unHi--; + continue; }; if (n < 0) break; unHi--; @@ -256,8 +256,8 @@ void fallbackQSort3 ( UInt32* fmap, #define UNALIGNED_BH(zz) ((zz) & 0x01f) static -void fallbackSort ( UInt32* fmap, - UInt32* eclass, +void fallbackSort ( UInt32* fmap, + UInt32* eclass, UInt32* bhtab, Int32 nblock, Int32 verb ) @@ -298,7 +298,7 @@ void fallbackSort ( UInt32* fmap, --*/ /*-- set sentinel bits for block-end detection --*/ - for (i = 0; i < 32; i++) { + for (i = 0; i < 32; i++) { SET_BH(nblock + 2*i); CLEAR_BH(nblock + 2*i + 1); } @@ -307,7 +307,7 @@ void fallbackSort ( UInt32* fmap, H = 1; while (1) { - if (verb >= 4) + if (verb >= 4) VPrintf1 ( " depth %6d has ", H ); j = 0; @@ -321,7 +321,7 @@ void fallbackSort ( UInt32* fmap, r = -1; while (1) { - /*-- find the next non-singleton bucket --*/ + /*-- find the next non-singleton bucket --*/ k = r + 1; while (ISSET_BH(k) && UNALIGNED_BH(k)) k++; if (ISSET_BH(k)) { @@ -352,14 +352,14 @@ void fallbackSort ( UInt32* fmap, } } - if (verb >= 4) + if (verb >= 4) VPrintf1 ( "%6d unresolved strings\n", nNotDone ); H *= 2; if (H > nblock || nNotDone == 0) break; } - /*-- + /*-- Reconstruct the original block in eclass8 [0 .. nblock-1], since the previous phase destroyed it. @@ -391,9 +391,9 @@ void fallbackSort ( UInt32* fmap, /*---------------------------------------------*/ static __inline__ -Bool mainGtU ( UInt32 i1, +Bool mainGtU ( UInt32 i1, UInt32 i2, - UChar* block, + UChar* block, UInt16* quadrant, UInt32 nblock, Int32* budget ) @@ -533,8 +533,8 @@ void mainSimpleSort ( UInt32* ptr, UChar* block, UInt16* quadrant, Int32 nblock, - Int32 lo, - Int32 hi, + Int32 lo, + Int32 hi, Int32 d, Int32* budget ) { @@ -558,8 +558,8 @@ void mainSimpleSort ( UInt32* ptr, if (i > hi) break; v = ptr[i]; j = i; - while ( mainGtU ( - ptr[j-h]+d, v+d, block, quadrant, nblock, budget + while ( mainGtU ( + ptr[j-h]+d, v+d, block, quadrant, nblock, budget ) ) { ptr[j] = ptr[j-h]; j = j - h; @@ -572,8 +572,8 @@ void mainSimpleSort ( UInt32* ptr, if (i > hi) break; v = ptr[i]; j = i; - while ( mainGtU ( - ptr[j-h]+d, v+d, block, quadrant, nblock, budget + while ( mainGtU ( + ptr[j-h]+d, v+d, block, quadrant, nblock, budget ) ) { ptr[j] = ptr[j-h]; j = j - h; @@ -586,8 +586,8 @@ void mainSimpleSort ( UInt32* ptr, if (i > hi) break; v = ptr[i]; j = i; - while ( mainGtU ( - ptr[j-h]+d, v+d, block, quadrant, nblock, budget + while ( mainGtU ( + ptr[j-h]+d, v+d, block, quadrant, nblock, budget ) ) { ptr[j] = ptr[j-h]; j = j - h; @@ -625,13 +625,13 @@ void mainSimpleSort ( UInt32* ptr, } \ } -static +static __inline__ UChar mmed3 ( UChar a, UChar b, UChar c ) { UChar t; if (a > b) { t = a; a = b; b = t; }; - if (b > c) { + if (b > c) { b = c; if (a > b) b = a; } @@ -669,8 +669,8 @@ void mainQSort3 ( UInt32* ptr, UChar* block, UInt16* quadrant, Int32 nblock, - Int32 loSt, - Int32 hiSt, + Int32 loSt, + Int32 hiSt, Int32 dSt, Int32* budget ) { @@ -693,14 +693,14 @@ void mainQSort3 ( UInt32* ptr, AssertH ( sp < MAIN_QSORT_STACK_SIZE, 1001 ); mpop ( lo, hi, d ); - if (hi - lo < MAIN_QSORT_SMALL_THRESH || + if (hi - lo < MAIN_QSORT_SMALL_THRESH || d > MAIN_QSORT_DEPTH_THRESH) { mainSimpleSort ( ptr, block, quadrant, nblock, lo, hi, d, budget ); if (*budget < 0) return; continue; } - med = (Int32) + med = (Int32) mmed3 ( block[ptr[ lo ]+d], block[ptr[ hi ]+d], block[ptr[ (lo+hi)>>1 ]+d] ); @@ -712,9 +712,9 @@ void mainQSort3 ( UInt32* ptr, while (True) { if (unLo > unHi) break; n = ((Int32)block[ptr[unLo]+d]) - med; - if (n == 0) { - mswap(ptr[unLo], ptr[ltLo]); - ltLo++; unLo++; continue; + if (n == 0) { + mswap(ptr[unLo], ptr[ltLo]); + ltLo++; unLo++; continue; }; if (n > 0) break; unLo++; @@ -722,9 +722,9 @@ void mainQSort3 ( UInt32* ptr, while (True) { if (unLo > unHi) break; n = ((Int32)block[ptr[unHi]+d]) - med; - if (n == 0) { - mswap(ptr[unHi], ptr[gtHi]); - gtHi--; unHi--; continue; + if (n == 0) { + mswap(ptr[unHi], ptr[gtHi]); + gtHi--; unHi--; continue; }; if (n < 0) break; unHi--; @@ -795,9 +795,9 @@ void mainQSort3 ( UInt32* ptr, #define CLEARMASK (~(SETMASK)) static -void mainSort ( UInt32* ptr, +void mainSort ( UInt32* ptr, UChar* block, - UInt16* quadrant, + UInt16* quadrant, UInt32* ftab, Int32 nblock, Int32 verb, @@ -925,7 +925,7 @@ void mainSort ( UInt32* ptr, /*-- Step 1: Complete the big bucket [ss] by quicksorting - any unsorted small buckets [ss, j], for j != ss. + any unsorted small buckets [ss, j], for j != ss. Hopefully previous pointer-scanning phases have already completed many of the small buckets [ss, j], so we don't have to sort them at all. @@ -941,10 +941,10 @@ void mainSort ( UInt32* ptr, VPrintf4 ( " qsort [0x%x, 0x%x] " "done %d this %d\n", ss, j, numQSorted, hi - lo + 1 ); - mainQSort3 ( - ptr, block, quadrant, nblock, - lo, hi, BZ_N_RADIX, budget - ); + mainQSort3 ( + ptr, block, quadrant, nblock, + lo, hi, BZ_N_RADIX, budget + ); numQSorted += (hi - lo + 1); if (*budget < 0) return; } @@ -976,16 +976,16 @@ void mainSort ( UInt32* ptr, for (j = (ftab[(ss+1) << 8] & CLEARMASK) - 1; j > copyEnd[ss]; j--) { k = ptr[j]-1; if (k < 0) k += nblock; c1 = block[k]; - if (!bigDone[c1]) + if (!bigDone[c1]) ptr[ copyEnd[c1]-- ] = k; } } AssertH ( (copyStart[ss]-1 == copyEnd[ss]) - || + || /* Extremely rare case missing in bzip2-1.0.0 and 1.0.1. - Necessity for this case is demonstrated by compressing - a sequence of approximately 48.5 million of character + Necessity for this case is demonstrated by compressing + a sequence of approximately 48.5 million of character 251; 1.0.0/1.0.1 will then die here. */ (copyStart[ss] == 0 && copyEnd[ss] == nblock-1), 1007 ) @@ -1002,7 +1002,7 @@ void mainSort ( UInt32* ptr, updating for the last bucket is pointless. The quadrant array provides a way to incrementally - cache sort orderings, as they appear, so as to + cache sort orderings, as they appear, so as to make subsequent comparisons in fullGtU() complete faster. For repetitive blocks this makes a big difference (but not big enough to be able to avoid @@ -1012,9 +1012,9 @@ void mainSort ( UInt32* ptr, for 0 <= i < nblock and 0 <= j <= nblock - if block[i] != block[j], + if block[i] != block[j], - then the relative values of quadrant[i] and + then the relative values of quadrant[i] and quadrant[j] are meaningless. else { @@ -1077,7 +1077,7 @@ void mainSort ( UInt32* ptr, */ void BZ2_blockSort ( EState* s ) { - UInt32* ptr = s->ptr; + UInt32* ptr = s->ptr; UChar* block = s->block; UInt32* ftab = s->ftab; Int32 nblock = s->nblock; @@ -1101,8 +1101,8 @@ void BZ2_blockSort ( EState* s ) quadrant = (UInt16*)(&(block[i])); /* (wfact-1) / 3 puts the default-factor-30 - transition point at very roughly the same place as - with v0.1 and v0.9.0. + transition point at very roughly the same place as + with v0.1 and v0.9.0. Not that it particularly matters any more, since the resulting compressed stream is now the same regardless of whether or not we use the main sort or fallback sort. @@ -1113,14 +1113,14 @@ void BZ2_blockSort ( EState* s ) budget = budgetInit; mainSort ( ptr, block, quadrant, ftab, nblock, verb, &budget ); - if (verb >= 3) + if (verb >= 3) VPrintf3 ( " %d work, %d block, ratio %5.2f\n", budgetInit - budget, - nblock, + nblock, (float)(budgetInit - budget) / - (float)(nblock==0 ? 1 : nblock) ); + (float)(nblock==0 ? 1 : nblock) ); if (budget < 0) { - if (verb >= 2) + if (verb >= 2) VPrintf0 ( " too repetitive; using fallback" " sorting algorithm\n" ); fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb ); diff --git a/contrib/vmap_extractor_v2/stormlib/bzip2/bzip2.c b/contrib/vmap_extractor_v2/stormlib/bzip2/bzip2.c index 79f87a51986..2e54697670a 100644 --- a/contrib/vmap_extractor_v2/stormlib/bzip2/bzip2.c +++ b/contrib/vmap_extractor_v2/stormlib/bzip2/bzip2.c @@ -16,16 +16,16 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product + 2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written + 4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS @@ -64,12 +64,12 @@ /*-- WARNING: - This program and library (attempts to) compress data by - performing several non-trivial transformations on it. - Unless you are 100% familiar with *all* the algorithms - contained herein, and with the consequences of modifying them, - you should NOT meddle with the compression or decompression - machinery. Incorrect changes can and very likely *will* + This program and library (attempts to) compress data by + performing several non-trivial transformations on it. + Unless you are 100% familiar with *all* the algorithms + contained herein, and with the consequences of modifying them, + you should NOT meddle with the compression or decompression + machinery. Incorrect changes can and very likely *will* lead to disasterous loss of data. DISCLAIMER: @@ -84,8 +84,8 @@ of various special cases in the code which occur with very low but non-zero probability make it impossible to rule out the possibility of bugs remaining in the program. DO NOT COMPRESS - ANY DATA WITH THIS PROGRAM AND/OR LIBRARY UNLESS YOU ARE PREPARED - TO ACCEPT THE POSSIBILITY, HOWEVER SMALL, THAT THE DATA WILL + ANY DATA WITH THIS PROGRAM AND/OR LIBRARY UNLESS YOU ARE PREPARED + TO ACCEPT THE POSSIBILITY, HOWEVER SMALL, THAT THE DATA WILL NOT BE RECOVERABLE. That is not to say this program is inherently unreliable. @@ -93,9 +93,9 @@ has been carefully constructed and extensively tested. PATENTS: - To the best of my knowledge, bzip2/libbzip2 does not use any - patented algorithms. However, I do not have the resources - available to carry out a full patent search. Therefore I cannot + To the best of my knowledge, bzip2/libbzip2 does not use any + patented algorithms. However, I do not have the resources + available to carry out a full patent search. Therefore I cannot give any guarantee of the above statement. --*/ @@ -257,7 +257,7 @@ typedef int Int32; typedef unsigned int UInt32; typedef short Int16; typedef unsigned short UInt16; - + #define True ((Bool)1) #define False ((Bool)0) @@ -321,7 +321,7 @@ static void* myMalloc ( Int32 ); /*---------------------------------------------------*/ typedef - struct { UChar b[8]; } + struct { UChar b[8]; } UInt64; @@ -364,7 +364,7 @@ Bool uInt64_isZero ( UInt64* n ) /* Divide *n by 10, and return the remainder. */ -static +static Int32 uInt64_qrm10 ( UInt64* n ) { UInt32 rem, tmp; @@ -395,7 +395,7 @@ void uInt64_toAscii ( char* outbuf, UInt64* n ) nBuf++; } while (!uInt64_isZero(&n_copy)); outbuf[nBuf] = 0; - for (i = 0; i < nBuf; i++) + for (i = 0; i < nBuf; i++) outbuf[i] = buf[nBuf-i-1]; } @@ -405,7 +405,7 @@ void uInt64_toAscii ( char* outbuf, UInt64* n ) /*---------------------------------------------------*/ /*---------------------------------------------*/ -static +static Bool myfeof ( FILE* f ) { Int32 c = fgetc ( f ); @@ -416,7 +416,7 @@ Bool myfeof ( FILE* f ) /*---------------------------------------------*/ -static +static void compressStream ( FILE *stream, FILE *zStream ) { BZFILE* bzf = NULL; @@ -432,8 +432,8 @@ void compressStream ( FILE *stream, FILE *zStream ) if (ferror(stream)) goto errhandler_io; if (ferror(zStream)) goto errhandler_io; - bzf = BZ2_bzWriteOpen ( &bzerr, zStream, - blockSize100k, verbosity, workFactor ); + bzf = BZ2_bzWriteOpen ( &bzerr, zStream, + blockSize100k, verbosity, workFactor ); if (bzerr != BZ_OK) goto errhandler; if (verbosity >= 2) fprintf ( stderr, "\n" ); @@ -448,7 +448,7 @@ void compressStream ( FILE *stream, FILE *zStream ) } - BZ2_bzWriteClose64 ( &bzerr, bzf, 0, + BZ2_bzWriteClose64 ( &bzerr, bzf, 0, &nbytes_in_lo32, &nbytes_in_hi32, &nbytes_out_lo32, &nbytes_out_hi32 ); if (bzerr != BZ_OK) goto errhandler; @@ -468,34 +468,34 @@ void compressStream ( FILE *stream, FILE *zStream ) if (verbosity >= 1) { if (nbytes_in_lo32 == 0 && nbytes_in_hi32 == 0) { - fprintf ( stderr, " no data compressed.\n"); + fprintf ( stderr, " no data compressed.\n"); } else { - Char buf_nin[32], buf_nout[32]; - UInt64 nbytes_in, nbytes_out; - double nbytes_in_d, nbytes_out_d; - uInt64_from_UInt32s ( &nbytes_in, - nbytes_in_lo32, nbytes_in_hi32 ); - uInt64_from_UInt32s ( &nbytes_out, - nbytes_out_lo32, nbytes_out_hi32 ); - nbytes_in_d = uInt64_to_double ( &nbytes_in ); - nbytes_out_d = uInt64_to_double ( &nbytes_out ); - uInt64_toAscii ( buf_nin, &nbytes_in ); - uInt64_toAscii ( buf_nout, &nbytes_out ); - fprintf ( stderr, "%6.3f:1, %6.3f bits/byte, " - "%5.2f%% saved, %s in, %s out.\n", - nbytes_in_d / nbytes_out_d, - (8.0 * nbytes_out_d) / nbytes_in_d, - 100.0 * (1.0 - nbytes_out_d / nbytes_in_d), - buf_nin, - buf_nout - ); + Char buf_nin[32], buf_nout[32]; + UInt64 nbytes_in, nbytes_out; + double nbytes_in_d, nbytes_out_d; + uInt64_from_UInt32s ( &nbytes_in, + nbytes_in_lo32, nbytes_in_hi32 ); + uInt64_from_UInt32s ( &nbytes_out, + nbytes_out_lo32, nbytes_out_hi32 ); + nbytes_in_d = uInt64_to_double ( &nbytes_in ); + nbytes_out_d = uInt64_to_double ( &nbytes_out ); + uInt64_toAscii ( buf_nin, &nbytes_in ); + uInt64_toAscii ( buf_nout, &nbytes_out ); + fprintf ( stderr, "%6.3f:1, %6.3f bits/byte, " + "%5.2f%% saved, %s in, %s out.\n", + nbytes_in_d / nbytes_out_d, + (8.0 * nbytes_out_d) / nbytes_in_d, + 100.0 * (1.0 - nbytes_out_d / nbytes_in_d), + buf_nin, + buf_nout + ); } } return; errhandler: - BZ2_bzWriteClose64 ( &bzerr_dummy, bzf, 1, + BZ2_bzWriteClose64 ( &bzerr_dummy, bzf, 1, &nbytes_in_lo32, &nbytes_in_hi32, &nbytes_out_lo32, &nbytes_out_hi32 ); switch (bzerr) { @@ -517,7 +517,7 @@ void compressStream ( FILE *stream, FILE *zStream ) /*---------------------------------------------*/ -static +static Bool uncompressStream ( FILE *zStream, FILE *stream ) { BZFILE* bzf = NULL; @@ -539,8 +539,8 @@ Bool uncompressStream ( FILE *zStream, FILE *stream ) while (True) { - bzf = BZ2_bzReadOpen ( - &bzerr, zStream, verbosity, + bzf = BZ2_bzReadOpen ( + &bzerr, zStream, verbosity, (int)smallMode, unused, nUnused ); if (bzf == NULL || bzerr != BZ_OK) goto errhandler; @@ -584,19 +584,19 @@ Bool uncompressStream ( FILE *zStream, FILE *stream ) if (verbosity >= 2) fprintf ( stderr, "\n " ); return True; - trycat: + trycat: if (forceOverwrite) { rewind(zStream); while (True) { - if (myfeof(zStream)) break; - nread = fread ( obuf, sizeof(UChar), 5000, zStream ); - if (ferror(zStream)) goto errhandler_io; - if (nread > 0) fwrite ( obuf, sizeof(UChar), nread, stream ); - if (ferror(stream)) goto errhandler_io; + if (myfeof(zStream)) break; + nread = fread ( obuf, sizeof(UChar), 5000, zStream ); + if (ferror(zStream)) goto errhandler_io; + if (nread > 0) fwrite ( obuf, sizeof(UChar), nread, stream ); + if (ferror(stream)) goto errhandler_io; } goto closeok; } - + errhandler: BZ2_bzReadClose ( &bzerr_dummy, bzf ); switch (bzerr) { @@ -618,10 +618,10 @@ Bool uncompressStream ( FILE *zStream, FILE *stream ) return False; } else { if (noisy) - fprintf ( stderr, + fprintf ( stderr, "\n%s: %s: trailing garbage after EOF ignored\n", progName, inName ); - return True; + return True; } default: panic ( "decompress:unexpected error" ); @@ -633,7 +633,7 @@ Bool uncompressStream ( FILE *zStream, FILE *stream ) /*---------------------------------------------*/ -static +static Bool testStream ( FILE *zStream ) { BZFILE* bzf = NULL; @@ -652,8 +652,8 @@ Bool testStream ( FILE *zStream ) while (True) { - bzf = BZ2_bzReadOpen ( - &bzerr, zStream, verbosity, + bzf = BZ2_bzReadOpen ( + &bzerr, zStream, verbosity, (int)smallMode, unused, nUnused ); if (bzf == NULL || bzerr != BZ_OK) goto errhandler; @@ -686,7 +686,7 @@ Bool testStream ( FILE *zStream ) errhandler: BZ2_bzReadClose ( &bzerr_dummy, bzf ); - if (verbosity == 0) + if (verbosity == 0) fprintf ( stderr, "%s: %s: ", progName, inName ); switch (bzerr) { case BZ_CONFIG_ERROR: @@ -707,14 +707,14 @@ Bool testStream ( FILE *zStream ) case BZ_DATA_ERROR_MAGIC: if (zStream != stdin) fclose(zStream); if (streamNo == 1) { - fprintf ( stderr, + fprintf ( stderr, "bad magic number (file not created by bzip2)\n" ); return False; } else { if (noisy) - fprintf ( stderr, + fprintf ( stderr, "trailing garbage after EOF ignored\n" ); - return True; + return True; } default: panic ( "test:unexpected error" ); @@ -738,7 +738,7 @@ void setExit ( Int32 v ) /*---------------------------------------------*/ -static +static void cadvise ( void ) { if (noisy) @@ -753,26 +753,26 @@ void cadvise ( void ) /*---------------------------------------------*/ -static +static void showFileNames ( void ) { if (noisy) fprintf ( stderr, "\tInput file = %s, output file = %s\n", - inName, outName + inName, outName ); } /*---------------------------------------------*/ -static +static void cleanUpAndFail ( Int32 ec ) { IntNative retVal; struct MY_STAT statBuf; - if ( srcMode == SM_F2F + if ( srcMode == SM_F2F && opMode != OM_TEST && deleteOutputOnInterrupt ) { @@ -784,7 +784,7 @@ void cleanUpAndFail ( Int32 ec ) retVal = MY_STAT ( inName, &statBuf ); if (retVal == 0) { if (noisy) - fprintf ( stderr, + fprintf ( stderr, "%s: Deleting output file %s, if it exists.\n", progName, outName ); if (outputHandleJustInCase != NULL) @@ -805,7 +805,7 @@ void cleanUpAndFail ( Int32 ec ) fprintf ( stderr, "%s: `%s' may be incomplete.\n", progName, outName ); - fprintf ( stderr, + fprintf ( stderr, "%s: I suggest doing an integrity test (bzip2 -tv)" " of it.\n", progName ); @@ -813,7 +813,7 @@ void cleanUpAndFail ( Int32 ec ) } if (noisy && numFileNames > 0 && numFilesProcessed < numFileNames) { - fprintf ( stderr, + fprintf ( stderr, "%s: WARNING: some files have not been processed:\n" "%s: %d specified on command line, %d not processed yet.\n\n", progName, progName, @@ -825,7 +825,7 @@ void cleanUpAndFail ( Int32 ec ) /*---------------------------------------------*/ -static +static void panic ( Char* s ) { fprintf ( stderr, @@ -840,7 +840,7 @@ void panic ( Char* s ) /*---------------------------------------------*/ -static +static void crcError ( void ) { fprintf ( stderr, @@ -853,14 +853,14 @@ void crcError ( void ) /*---------------------------------------------*/ -static +static void compressedStreamEOF ( void ) { if (noisy) { fprintf ( stderr, - "\n%s: Compressed file ends unexpectedly;\n\t" - "perhaps it is corrupted? *Possible* reason follows.\n", - progName ); + "\n%s: Compressed file ends unexpectedly;\n\t" + "perhaps it is corrupted? *Possible* reason follows.\n", + progName ); perror ( progName ); showFileNames(); cadvise(); @@ -870,7 +870,7 @@ void compressedStreamEOF ( void ) /*---------------------------------------------*/ -static +static void ioError ( void ) { fprintf ( stderr, @@ -884,7 +884,7 @@ void ioError ( void ) /*---------------------------------------------*/ -static +static void mySignalCatcher ( IntNative n ) { fprintf ( stderr, @@ -895,11 +895,11 @@ void mySignalCatcher ( IntNative n ) /*---------------------------------------------*/ -static +static void mySIGSEGVorSIGBUScatcher ( IntNative n ) { if (opMode == OM_Z) - fprintf ( + fprintf ( stderr, "\n%s: Caught a SIGSEGV or SIGBUS whilst compressing.\n" "\n" @@ -920,7 +920,7 @@ void mySIGSEGVorSIGBUScatcher ( IntNative n ) "\n", progName ); else - fprintf ( + fprintf ( stderr, "\n%s: Caught a SIGSEGV or SIGBUS whilst decompressing.\n" "\n" @@ -951,7 +951,7 @@ void mySIGSEGVorSIGBUScatcher ( IntNative n ) /*---------------------------------------------*/ -static +static void outOfMemory ( void ) { fprintf ( stderr, @@ -963,7 +963,7 @@ void outOfMemory ( void ) /*---------------------------------------------*/ -static +static void configError ( void ) { fprintf ( stderr, @@ -983,11 +983,11 @@ void configError ( void ) /* All rather crufty. The main problem is that input files are stat()d multiple times before use. This should be - cleaned up. + cleaned up. */ /*---------------------------------------------*/ -static +static void pad ( Char *s ) { Int32 i; @@ -998,8 +998,8 @@ void pad ( Char *s ) /*---------------------------------------------*/ -static -void copyFileName ( Char* to, Char* from ) +static +void copyFileName ( Char* to, Char* from ) { if ( strlen(from) > FILE_NAME_LEN-10 ) { fprintf ( @@ -1019,7 +1019,7 @@ void copyFileName ( Char* to, Char* from ) /*---------------------------------------------*/ -static +static Bool fileExists ( Char* name ) { FILE *tmp = fopen ( name, "rb" ); @@ -1059,7 +1059,7 @@ FILE* fopen_output_safely ( Char* name, const char* mode ) /*-- if in doubt, return True --*/ -static +static Bool notAStandardFile ( Char* name ) { IntNative i; @@ -1076,9 +1076,9 @@ Bool notAStandardFile ( Char* name ) /*-- rac 11/21/98 see if file has hard links to it --*/ -static +static Int32 countHardLinks ( Char* name ) -{ +{ IntNative i; struct MY_STAT statBuf; @@ -1109,14 +1109,14 @@ Int32 countHardLinks ( Char* name ) It sounds pretty fragile to me. Whether this carries across robustly to arbitrary Unix-like platforms (or even works robustly - on this one, RedHat 7.2) is unknown to me. Nevertheless ... + on this one, RedHat 7.2) is unknown to me. Nevertheless ... */ #if BZ_UNIX -static +static struct MY_STAT fileMetaInfo; #endif -static +static void saveInputFileMetaInfo ( Char *srcName ) { # if BZ_UNIX @@ -1128,7 +1128,7 @@ void saveInputFileMetaInfo ( Char *srcName ) } -static +static void applySavedMetaInfoToOutputFile ( Char *dstName ) { # if BZ_UNIX @@ -1153,7 +1153,7 @@ void applySavedMetaInfoToOutputFile ( Char *dstName ) /*---------------------------------------------*/ -static +static Bool containsDubiousChars ( Char* name ) { # if BZ_UNIX @@ -1162,7 +1162,7 @@ Bool containsDubiousChars ( Char* name ) */ return False; # else /* ! BZ_UNIX */ - /* On non-unix (Win* platforms), wildcard characters are not allowed in + /* On non-unix (Win* platforms), wildcard characters are not allowed in * filenames. */ for (; *name != '\0'; name++) @@ -1175,12 +1175,12 @@ Bool containsDubiousChars ( Char* name ) /*---------------------------------------------*/ #define BZ_N_SUFFIX_PAIRS 4 -Char* zSuffix[BZ_N_SUFFIX_PAIRS] +Char* zSuffix[BZ_N_SUFFIX_PAIRS] = { ".bz2", ".bz", ".tbz2", ".tbz" }; -Char* unzSuffix[BZ_N_SUFFIX_PAIRS] +Char* unzSuffix[BZ_N_SUFFIX_PAIRS] = { "", "", ".tar", ".tar" }; -static +static Bool hasSuffix ( Char* s, Char* suffix ) { Int32 ns = strlen(s); @@ -1190,8 +1190,8 @@ Bool hasSuffix ( Char* s, Char* suffix ) return False; } -static -Bool mapSuffix ( Char* name, +static +Bool mapSuffix ( Char* name, Char* oldSuffix, Char* newSuffix ) { if (!hasSuffix(name,oldSuffix)) return False; @@ -1202,7 +1202,7 @@ Bool mapSuffix ( Char* name, /*---------------------------------------------*/ -static +static void compress ( Char *name ) { FILE *inStr; @@ -1216,18 +1216,18 @@ void compress ( Char *name ) panic ( "compress: bad modes\n" ); switch (srcMode) { - case SM_I2O: + case SM_I2O: copyFileName ( inName, "(stdin)" ); - copyFileName ( outName, "(stdout)" ); + copyFileName ( outName, "(stdout)" ); break; - case SM_F2F: + case SM_F2F: copyFileName ( inName, name ); copyFileName ( outName, name ); - strcat ( outName, ".bz2" ); + strcat ( outName, ".bz2" ); break; - case SM_F2O: + case SM_F2O: copyFileName ( inName, name ); - copyFileName ( outName, "(stdout)" ); + copyFileName ( outName, "(stdout)" ); break; } @@ -1247,7 +1247,7 @@ void compress ( Char *name ) for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++) { if (hasSuffix(inName, zSuffix[i])) { if (noisy) - fprintf ( stderr, + fprintf ( stderr, "%s: Input file %s already has %s suffix.\n", progName, inName, zSuffix[i] ); setExit(1); @@ -1273,12 +1273,12 @@ void compress ( Char *name ) } if ( srcMode == SM_F2F && fileExists ( outName ) ) { if (forceOverwrite) { - remove(outName); + remove(outName); } else { - fprintf ( stderr, "%s: Output file %s already exists.\n", - progName, outName ); - setExit(1); - return; + fprintf ( stderr, "%s: Output file %s already exists.\n", + progName, outName ); + setExit(1); + return; } } if ( srcMode == SM_F2F && !forceOverwrite && @@ -1383,7 +1383,7 @@ void compress ( Char *name ) /*---------------------------------------------*/ -static +static void uncompress ( Char *name ) { FILE *inStr; @@ -1400,22 +1400,22 @@ void uncompress ( Char *name ) cantGuess = False; switch (srcMode) { - case SM_I2O: + case SM_I2O: copyFileName ( inName, "(stdin)" ); - copyFileName ( outName, "(stdout)" ); + copyFileName ( outName, "(stdout)" ); break; - case SM_F2F: + case SM_F2F: copyFileName ( inName, name ); copyFileName ( outName, name ); for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++) if (mapSuffix(outName,zSuffix[i],unzSuffix[i])) - goto zzz; + goto zzz; cantGuess = True; strcat ( outName, ".out" ); break; - case SM_F2O: + case SM_F2O: copyFileName ( inName, name ); - copyFileName ( outName, "(stdout)" ); + copyFileName ( outName, "(stdout)" ); break; } @@ -1452,14 +1452,14 @@ void uncompress ( Char *name ) } if ( /* srcMode == SM_F2F implied && */ cantGuess ) { if (noisy) - fprintf ( stderr, + fprintf ( stderr, "%s: Can't guess original name for %s -- using %s\n", progName, inName, outName ); /* just a warning, no return */ - } + } if ( srcMode == SM_F2F && fileExists ( outName ) ) { if (forceOverwrite) { - remove(outName); + remove(outName); } else { fprintf ( stderr, "%s: Output file %s already exists.\n", progName, outName ); @@ -1581,7 +1581,7 @@ void uncompress ( Char *name ) /*---------------------------------------------*/ -static +static void testf ( Char *name ) { FILE *inStr; @@ -1670,7 +1670,7 @@ void testf ( Char *name ) /*---------------------------------------------*/ -static +static void license ( void ) { fprintf ( stderr, @@ -1695,7 +1695,7 @@ void license ( void ) /*---------------------------------------------*/ -static +static void usage ( Char *fullProgName ) { fprintf ( @@ -1739,11 +1739,11 @@ void usage ( Char *fullProgName ) /*---------------------------------------------*/ -static +static void redundant ( Char* flag ) { - fprintf ( - stderr, + fprintf ( + stderr, "%s: %s is redundant in versions 0.9.5 and above\n", progName, flag ); } @@ -1755,8 +1755,8 @@ void redundant ( Char* flag ) implement a linked list of command-line arguments, into which main() copies argv[1 .. argc-1]. - The purpose of this exercise is to facilitate - the expansion of wildcard characters * and ? in + The purpose of this exercise is to facilitate + the expansion of wildcard characters * and ? in filenames for OSs which don't know how to do it themselves, like MSDOS, Windows 95 and NT. @@ -1773,7 +1773,7 @@ typedef /*---------------------------------------------*/ -static +static void *myMalloc ( Int32 n ) { void* p; @@ -1785,7 +1785,7 @@ void *myMalloc ( Int32 n ) /*---------------------------------------------*/ -static +static Cell *mkCell ( void ) { Cell *c; @@ -1798,7 +1798,7 @@ Cell *mkCell ( void ) /*---------------------------------------------*/ -static +static Cell *snocString ( Cell *root, Char *name ) { if (root == NULL) { @@ -1816,8 +1816,8 @@ Cell *snocString ( Cell *root, Char *name ) /*---------------------------------------------*/ -static -void addFlagsFromEnvVar ( Cell** argList, Char* varName ) +static +void addFlagsFromEnvVar ( Cell** argList, Char* varName ) { Int32 i, j, k; Char *envbase, *p; @@ -1894,7 +1894,7 @@ IntNative main ( IntNative argc, Char *argv[] ) if (*tmp == PATH_SEP) progName = tmp + 1; - /*-- Copy flags from env var BZIP2, and + /*-- Copy flags from env var BZIP2, and expand filename wildcards in arg list. --*/ argList = NULL; @@ -1977,7 +1977,7 @@ IntNative main ( IntNative argc, Char *argv[] ) } } } - + /*-- And again ... --*/ for (aa = argList; aa != NULL; aa = aa->link) { if (ISFLAG("--")) break; @@ -1991,7 +1991,7 @@ IntNative main ( IntNative argc, Char *argv[] ) if (ISFLAG("--quiet")) noisy = False; else if (ISFLAG("--version")) license(); else if (ISFLAG("--license")) license(); else - if (ISFLAG("--exponential")) workFactor = 1; else + if (ISFLAG("--exponential")) workFactor = 1; else if (ISFLAG("--repetitive-best")) redundant(aa->name); else if (ISFLAG("--repetitive-fast")) redundant(aa->name); else if (ISFLAG("--fast")) blockSize100k = 1; else @@ -2007,7 +2007,7 @@ IntNative main ( IntNative argc, Char *argv[] ) } if (verbosity > 4) verbosity = 4; - if (opMode == OM_Z && smallMode && blockSize100k > 2) + if (opMode == OM_Z && smallMode && blockSize100k > 2) blockSize100k = 2; if (opMode == OM_TEST && srcMode == SM_F2O) { @@ -2041,7 +2041,7 @@ IntNative main ( IntNative argc, Char *argv[] ) compress ( aa->name ); } } - } + } else if (opMode == OM_UNZ) { @@ -2055,13 +2055,13 @@ IntNative main ( IntNative argc, Char *argv[] ) if (aa->name[0] == '-' && decode) continue; numFilesProcessed++; uncompress ( aa->name ); - } + } } - if (unzFailsExist) { - setExit(2); + if (unzFailsExist) { + setExit(2); exit(exitValue); } - } + } else { testFailsExist = False; @@ -2070,11 +2070,11 @@ IntNative main ( IntNative argc, Char *argv[] ) } else { decode = True; for (aa = argList; aa != NULL; aa = aa->link) { - if (ISFLAG("--")) { decode = False; continue; } + if (ISFLAG("--")) { decode = False; continue; } if (aa->name[0] == '-' && decode) continue; numFilesProcessed++; testf ( aa->name ); - } + } } if (testFailsExist && noisy) { fprintf ( stderr, @@ -2087,7 +2087,7 @@ IntNative main ( IntNative argc, Char *argv[] ) } } - /* Free the argument list memory to mollify leak detectors + /* Free the argument list memory to mollify leak detectors (eg) Purify, Checker. Serves no other useful purpose. */ aa = argList; diff --git a/contrib/vmap_extractor_v2/stormlib/bzip2/bzip2recover.c b/contrib/vmap_extractor_v2/stormlib/bzip2/bzip2recover.c index 5cd405dd4cb..d1b8da845db 100644 --- a/contrib/vmap_extractor_v2/stormlib/bzip2/bzip2recover.c +++ b/contrib/vmap_extractor_v2/stormlib/bzip2/bzip2recover.c @@ -5,7 +5,7 @@ /*-----------------------------------------------------------*/ /*-- - This program is bzip2recover, a program to attempt data + This program is bzip2recover, a program to attempt data salvage from damaged files created by the accompanying bzip2-1.0.3 program. @@ -18,16 +18,16 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product + 2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written + 4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS @@ -107,7 +107,7 @@ MaybeUInt64 bytesIn = 0; #define BZ_HDR_Z 0x5a /* 'Z' */ #define BZ_HDR_h 0x68 /* 'h' */ #define BZ_HDR_0 0x30 /* '0' */ - + /*---------------------------------------------------*/ /*--- I/O errors ---*/ @@ -160,7 +160,7 @@ void tooManyBlocks ( Int32 max_handled_blocks ) fprintf ( stderr, "%s: and cannot be handled. To fix, increase\n", progName ); - fprintf ( stderr, + fprintf ( stderr, "%s: BZ_MAX_HANDLED_BLOCKS in bzip2recover.c, and recompile.\n", progName ); exit ( 1 ); @@ -344,7 +344,7 @@ Int32 main ( Int32 argc, Char** argv ) strcpy ( progName, argv[0] ); inFileName[0] = outFileName[0] = 0; - fprintf ( stderr, + fprintf ( stderr, "bzip2recover 1.0.3: extracts blocks from damaged .bz2 files.\n" ); if (argc != 2) { @@ -352,18 +352,18 @@ Int32 main ( Int32 argc, Char** argv ) progName, progName ); switch (sizeof(MaybeUInt64)) { case 8: - fprintf(stderr, + fprintf(stderr, "\trestrictions on size of recovered file: None\n"); break; case 4: - fprintf(stderr, + fprintf(stderr, "\trestrictions on size of recovered file: 512 MB\n"); - fprintf(stderr, + fprintf(stderr, "\tto circumvent, recompile with MaybeUInt64 as an\n" "\tunsigned 64-bit int.\n"); break; default: - fprintf(stderr, + fprintf(stderr, "\tsizeof(MaybeUInt64) is not 4 or 8 -- " "configuration error.\n"); break; @@ -372,7 +372,7 @@ Int32 main ( Int32 argc, Char** argv ) } if (strlen(argv[1]) >= BZ_MAX_FILENAME-20) { - fprintf ( stderr, + fprintf ( stderr, "%s: supplied filename is suspiciously (>= %d chars) long. Bye!\n", progName, (int)strlen(argv[1]) ); exit(1); @@ -404,7 +404,7 @@ Int32 main ( Int32 argc, Char** argv ) (bitsRead - bStart[currBlock]) >= 40) { bEnd[currBlock] = bitsRead-1; if (currBlock > 0) - fprintf ( stderr, " block %d runs from " MaybeUInt64_FMT + fprintf ( stderr, " block %d runs from " MaybeUInt64_FMT " to " MaybeUInt64_FMT " (incomplete)\n", currBlock, bStart[currBlock], bEnd[currBlock] ); } else @@ -413,10 +413,10 @@ Int32 main ( Int32 argc, Char** argv ) } buffHi = (buffHi << 1) | (buffLo >> 31); buffLo = (buffLo << 1) | (b & 1); - if ( ( (buffHi & 0x0000ffff) == BLOCK_HEADER_HI + if ( ( (buffHi & 0x0000ffff) == BLOCK_HEADER_HI && buffLo == BLOCK_HEADER_LO) - || - ( (buffHi & 0x0000ffff) == BLOCK_ENDMARK_HI + || + ( (buffHi & 0x0000ffff) == BLOCK_ENDMARK_HI && buffLo == BLOCK_ENDMARK_LO) ) { if (bitsRead > 49) { @@ -425,8 +425,8 @@ Int32 main ( Int32 argc, Char** argv ) bEnd[currBlock] = 0; } if (currBlock > 0 && - (bEnd[currBlock] - bStart[currBlock]) >= 130) { - fprintf ( stderr, " block %d runs from " MaybeUInt64_FMT + (bEnd[currBlock] - bStart[currBlock]) >= 130) { + fprintf ( stderr, " block %d runs from " MaybeUInt64_FMT " to " MaybeUInt64_FMT "\n", rbCtr+1, bStart[currBlock], bEnd[currBlock] ); rbStart[rbCtr] = bStart[currBlock]; @@ -472,7 +472,7 @@ Int32 main ( Int32 argc, Char** argv ) if (b == 2) break; buffHi = (buffHi << 1) | (buffLo >> 31); buffLo = (buffLo << 1) | (b & 1); - if (bitsRead == 47+rbStart[wrBlock]) + if (bitsRead == 47+rbStart[wrBlock]) blockCRC = (buffHi << 16) | (buffLo >> 16); if (outFile != NULL && bitsRead >= rbStart[wrBlock] @@ -494,11 +494,11 @@ Int32 main ( Int32 argc, Char** argv ) wrBlock++; } else if (bitsRead == rbStart[wrBlock]) { - /* Create the output file name, correctly handling leading paths. + /* Create the output file name, correctly handling leading paths. (31.10.2001 by Sergey E. Kusikov) */ Char* split; Int32 ofs, k; - for (k = 0; k < BZ_MAX_FILENAME; k++) + for (k = 0; k < BZ_MAX_FILENAME; k++) outFileName[k] = 0; strcpy (outFileName, inFileName); split = strrchr (outFileName, BZ_SPLIT_SYM); @@ -506,8 +506,8 @@ Int32 main ( Int32 argc, Char** argv ) split = outFileName; } else { ++split; - } - /* Now split points to the start of the basename. */ + } + /* Now split points to the start of the basename. */ ofs = split - outFileName; sprintf (split, "rec%5d", wrBlock+1); for (p = split; *p != 0; p++) if (*p == ' ') *p = '0'; @@ -525,9 +525,9 @@ Int32 main ( Int32 argc, Char** argv ) exit(1); } bsWr = bsOpenWriteStream ( outFile ); - bsPutUChar ( bsWr, BZ_HDR_B ); - bsPutUChar ( bsWr, BZ_HDR_Z ); - bsPutUChar ( bsWr, BZ_HDR_h ); + bsPutUChar ( bsWr, BZ_HDR_B ); + bsPutUChar ( bsWr, BZ_HDR_Z ); + bsPutUChar ( bsWr, BZ_HDR_h ); bsPutUChar ( bsWr, BZ_HDR_0 + 9 ); bsPutUChar ( bsWr, 0x31 ); bsPutUChar ( bsWr, 0x41 ); bsPutUChar ( bsWr, 0x59 ); bsPutUChar ( bsWr, 0x26 ); diff --git a/contrib/vmap_extractor_v2/stormlib/bzip2/bzlib.c b/contrib/vmap_extractor_v2/stormlib/bzip2/bzlib.c index 195f51a7840..785306827fb 100644 --- a/contrib/vmap_extractor_v2/stormlib/bzip2/bzlib.c +++ b/contrib/vmap_extractor_v2/stormlib/bzip2/bzlib.c @@ -17,16 +17,16 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product + 2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written + 4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS @@ -86,7 +86,7 @@ #ifndef BZ_NO_STDIO void BZ2_bz__AssertH__fail ( int errcode ) { - fprintf(stderr, + fprintf(stderr, "\n\nbzip2/libbzip2: internal error number %d.\n" "This is a bug in bzip2/libbzip2, %s.\n" "Please report it to me at: jseward@bzip.org. If this happened\n" @@ -191,8 +191,8 @@ Bool isempty_RL ( EState* s ) /*---------------------------------------------------*/ -int BZ_API(BZ2_bzCompressInit) - ( bz_stream* strm, +int BZ_API(BZ2_bzCompressInit) + ( bz_stream* strm, int blockSize100k, int verbosity, int workFactor ) @@ -202,7 +202,7 @@ int BZ_API(BZ2_bzCompressInit) if (!bz_config_ok()) return BZ_CONFIG_ERROR; - if (strm == NULL || + if (strm == NULL || blockSize100k < 1 || blockSize100k > 9 || workFactor < 0 || workFactor > 250) return BZ_PARAM_ERROR; @@ -345,7 +345,7 @@ Bool copy_input_until_stop ( EState* s ) /*-- no input? --*/ if (s->strm->avail_in == 0) break; progress_in = True; - ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); + ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); s->strm->next_in++; s->strm->avail_in--; s->strm->total_in_lo32++; @@ -363,7 +363,7 @@ Bool copy_input_until_stop ( EState* s ) /*-- flush/finish end? --*/ if (s->avail_in_expect == 0) break; progress_in = True; - ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); + ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); s->strm->next_in++; s->strm->avail_in--; s->strm->total_in_lo32++; @@ -409,18 +409,18 @@ Bool handle_compress ( bz_stream* strm ) Bool progress_in = False; Bool progress_out = False; EState* s = strm->state; - + while (True) { if (s->state == BZ_S_OUTPUT) { progress_out |= copy_output_until_stop ( s ); if (s->state_out_pos < s->numZ) break; - if (s->mode == BZ_M_FINISHING && + if (s->mode == BZ_M_FINISHING && s->avail_in_expect == 0 && isempty_RL(s)) break; prepare_new_block ( s ); s->state = BZ_S_INPUT; - if (s->mode == BZ_M_FLUSHING && + if (s->mode == BZ_M_FLUSHING && s->avail_in_expect == 0 && isempty_RL(s)) break; } @@ -469,9 +469,9 @@ int BZ_API(BZ2_bzCompress) ( bz_stream *strm, int action ) if (action == BZ_RUN) { progress = handle_compress ( strm ); return progress ? BZ_RUN_OK : BZ_PARAM_ERROR; - } + } else - if (action == BZ_FLUSH) { + if (action == BZ_FLUSH) { s->avail_in_expect = strm->avail_in; s->mode = BZ_M_FLUSHING; goto preswitch; @@ -482,12 +482,12 @@ int BZ_API(BZ2_bzCompress) ( bz_stream *strm, int action ) s->mode = BZ_M_FINISHING; goto preswitch; } - else + else return BZ_PARAM_ERROR; case BZ_M_FLUSHING: if (action != BZ_FLUSH) return BZ_SEQUENCE_ERROR; - if (s->avail_in_expect != s->strm->avail_in) + if (s->avail_in_expect != s->strm->avail_in) return BZ_SEQUENCE_ERROR; progress = handle_compress ( strm ); if (s->avail_in_expect > 0 || !isempty_RL(s) || @@ -497,7 +497,7 @@ int BZ_API(BZ2_bzCompress) ( bz_stream *strm, int action ) case BZ_M_FINISHING: if (action != BZ_FINISH) return BZ_SEQUENCE_ERROR; - if (s->avail_in_expect != s->strm->avail_in) + if (s->avail_in_expect != s->strm->avail_in) return BZ_SEQUENCE_ERROR; progress = handle_compress ( strm ); if (!progress) return BZ_SEQUENCE_ERROR; @@ -524,7 +524,7 @@ int BZ_API(BZ2_bzCompressEnd) ( bz_stream *strm ) if (s->ftab != NULL) BZFREE(s->ftab); BZFREE(strm->state); - strm->state = NULL; + strm->state = NULL; return BZ_OK; } @@ -535,8 +535,8 @@ int BZ_API(BZ2_bzCompressEnd) ( bz_stream *strm ) /*---------------------------------------------------*/ /*---------------------------------------------------*/ -int BZ_API(BZ2_bzDecompressInit) - ( bz_stream* strm, +int BZ_API(BZ2_bzDecompressInit) + ( bz_stream* strm, int verbosity, int small ) { @@ -601,34 +601,34 @@ Bool unRLE_obuf_to_output_FAST ( DState* s ) /* can a new run be started? */ if (s->nblock_used == s->save_nblock+1) return False; - + /* Only caused by corrupt data stream? */ if (s->nblock_used > s->save_nblock+1) return True; - + s->state_out_len = 1; s->state_out_ch = s->k0; - BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; + BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; - + s->state_out_len = 2; - BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; + BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; - + s->state_out_len = 3; - BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; + BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; - - BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; + + BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; s->state_out_len = ((Int32)k1) + 4; - BZ_GET_FAST(s->k0); BZ_RAND_UPD_MASK; + BZ_GET_FAST(s->k0); BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; s->nblock_used++; } @@ -665,7 +665,7 @@ Bool unRLE_obuf_to_output_FAST ( DState* s ) } s_state_out_len_eq_one: { - if (cs_avail_out == 0) { + if (cs_avail_out == 0) { c_state_out_len = 1; goto return_notr; }; *( (UChar*)(cs_next_out) ) = c_state_out_ch; @@ -673,7 +673,7 @@ Bool unRLE_obuf_to_output_FAST ( DState* s ) cs_next_out++; cs_avail_out--; } - } + } /* Only caused by corrupt data stream? */ if (c_nblock_used > s_save_nblockPP) return True; @@ -681,25 +681,25 @@ Bool unRLE_obuf_to_output_FAST ( DState* s ) /* can a new run be started? */ if (c_nblock_used == s_save_nblockPP) { c_state_out_len = 0; goto return_notr; - }; + }; c_state_out_ch = c_k0; BZ_GET_FAST_C(k1); c_nblock_used++; - if (k1 != c_k0) { - c_k0 = k1; goto s_state_out_len_eq_one; + if (k1 != c_k0) { + c_k0 = k1; goto s_state_out_len_eq_one; }; - if (c_nblock_used == s_save_nblockPP) + if (c_nblock_used == s_save_nblockPP) goto s_state_out_len_eq_one; - + c_state_out_len = 2; BZ_GET_FAST_C(k1); c_nblock_used++; if (c_nblock_used == s_save_nblockPP) continue; if (k1 != c_k0) { c_k0 = k1; continue; }; - + c_state_out_len = 3; BZ_GET_FAST_C(k1); c_nblock_used++; if (c_nblock_used == s_save_nblockPP) continue; if (k1 != c_k0) { c_k0 = k1; continue; }; - + BZ_GET_FAST_C(k1); c_nblock_used++; c_state_out_len = ((Int32)k1) + 4; BZ_GET_FAST_C(c_k0); c_nblock_used++; @@ -767,37 +767,37 @@ Bool unRLE_obuf_to_output_SMALL ( DState* s ) s->strm->total_out_lo32++; if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; } - + /* can a new run be started? */ if (s->nblock_used == s->save_nblock+1) return False; /* Only caused by corrupt data stream? */ if (s->nblock_used > s->save_nblock+1) return True; - + s->state_out_len = 1; s->state_out_ch = s->k0; - BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; + BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; - + s->state_out_len = 2; - BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; + BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; - + s->state_out_len = 3; - BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; + BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; - - BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; + + BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; s->state_out_len = ((Int32)k1) + 4; - BZ_GET_SMALL(s->k0); BZ_RAND_UPD_MASK; + BZ_GET_SMALL(s->k0); BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; s->nblock_used++; } @@ -816,30 +816,30 @@ Bool unRLE_obuf_to_output_SMALL ( DState* s ) s->strm->total_out_lo32++; if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; } - + /* can a new run be started? */ if (s->nblock_used == s->save_nblock+1) return False; /* Only caused by corrupt data stream? */ if (s->nblock_used > s->save_nblock+1) return True; - + s->state_out_len = 1; s->state_out_ch = s->k0; BZ_GET_SMALL(k1); s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; - + s->state_out_len = 2; BZ_GET_SMALL(k1); s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; - + s->state_out_len = 3; BZ_GET_SMALL(k1); s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; - + BZ_GET_SMALL(k1); s->nblock_used++; s->state_out_len = ((Int32)k1) + 4; BZ_GET_SMALL(s->k0); s->nblock_used++; @@ -868,14 +868,14 @@ int BZ_API(BZ2_bzDecompress) ( bz_stream *strm ) if (corrupt) return BZ_DATA_ERROR; if (s->nblock_used == s->save_nblock+1 && s->state_out_len == 0) { BZ_FINALISE_CRC ( s->calculatedBlockCRC ); - if (s->verbosity >= 3) - VPrintf2 ( " {0x%08x, 0x%08x}", s->storedBlockCRC, + if (s->verbosity >= 3) + VPrintf2 ( " {0x%08x, 0x%08x}", s->storedBlockCRC, s->calculatedBlockCRC ); if (s->verbosity >= 2) VPrintf0 ( "]" ); if (s->calculatedBlockCRC != s->storedBlockCRC) return BZ_DATA_ERROR; - s->calculatedCombinedCRC - = (s->calculatedCombinedCRC << 1) | + s->calculatedCombinedCRC + = (s->calculatedCombinedCRC << 1) | (s->calculatedCombinedCRC >> 31); s->calculatedCombinedCRC ^= s->calculatedBlockCRC; s->state = BZ_X_BLKHDR_1; @@ -887,7 +887,7 @@ int BZ_API(BZ2_bzDecompress) ( bz_stream *strm ) Int32 r = BZ2_decompress ( s ); if (r == BZ_STREAM_END) { if (s->verbosity >= 3) - VPrintf2 ( "\n combined CRCs: stored = 0x%08x, computed = 0x%08x", + VPrintf2 ( "\n combined CRCs: stored = 0x%08x, computed = 0x%08x", s->storedCombinedCRC, s->calculatedCombinedCRC ); if (s->calculatedCombinedCRC != s->storedCombinedCRC) return BZ_DATA_ERROR; @@ -934,7 +934,7 @@ int BZ_API(BZ2_bzDecompressEnd) ( bz_stream *strm ) if (bzf != NULL) bzf->lastErr = eee; \ } -typedef +typedef struct { FILE* handle; Char buf[BZ_MAX_UNUSED]; @@ -958,10 +958,10 @@ static Bool myfeof ( FILE* f ) /*---------------------------------------------------*/ -BZFILE* BZ_API(BZ2_bzWriteOpen) - ( int* bzerror, - FILE* f, - int blockSize100k, +BZFILE* BZ_API(BZ2_bzWriteOpen) + ( int* bzerror, + FILE* f, + int blockSize100k, int verbosity, int workFactor ) { @@ -993,23 +993,23 @@ BZFILE* BZ_API(BZ2_bzWriteOpen) bzf->strm.opaque = NULL; if (workFactor == 0) workFactor = 30; - ret = BZ2_bzCompressInit ( &(bzf->strm), blockSize100k, + ret = BZ2_bzCompressInit ( &(bzf->strm), blockSize100k, verbosity, workFactor ); if (ret != BZ_OK) { BZ_SETERR(ret); free(bzf); return NULL; }; bzf->strm.avail_in = 0; bzf->initialisedOk = True; - return bzf; + return bzf; } /*---------------------------------------------------*/ void BZ_API(BZ2_bzWrite) - ( int* bzerror, - BZFILE* b, - void* buf, + ( int* bzerror, + BZFILE* b, + void* buf, int len ) { Int32 n, n2, ret; @@ -1038,7 +1038,7 @@ void BZ_API(BZ2_bzWrite) if (bzf->strm.avail_out < BZ_MAX_UNUSED) { n = BZ_MAX_UNUSED - bzf->strm.avail_out; - n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), + n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), n, bzf->handle ); if (n != n2 || ferror(bzf->handle)) { BZ_SETERR(BZ_IO_ERROR); return; }; @@ -1052,20 +1052,20 @@ void BZ_API(BZ2_bzWrite) /*---------------------------------------------------*/ void BZ_API(BZ2_bzWriteClose) - ( int* bzerror, - BZFILE* b, + ( int* bzerror, + BZFILE* b, int abandon, unsigned int* nbytes_in, unsigned int* nbytes_out ) { - BZ2_bzWriteClose64 ( bzerror, b, abandon, + BZ2_bzWriteClose64 ( bzerror, b, abandon, nbytes_in, NULL, nbytes_out, NULL ); } void BZ_API(BZ2_bzWriteClose64) - ( int* bzerror, - BZFILE* b, + ( int* bzerror, + BZFILE* b, int abandon, unsigned int* nbytes_in_lo32, unsigned int* nbytes_in_hi32, @@ -1097,7 +1097,7 @@ void BZ_API(BZ2_bzWriteClose64) if (bzf->strm.avail_out < BZ_MAX_UNUSED) { n = BZ_MAX_UNUSED - bzf->strm.avail_out; - n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), + n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), n, bzf->handle ); if (n != n2 || ferror(bzf->handle)) { BZ_SETERR(BZ_IO_ERROR); return; }; @@ -1129,9 +1129,9 @@ void BZ_API(BZ2_bzWriteClose64) /*---------------------------------------------------*/ -BZFILE* BZ_API(BZ2_bzReadOpen) - ( int* bzerror, - FILE* f, +BZFILE* BZ_API(BZ2_bzReadOpen) + ( int* bzerror, + FILE* f, int verbosity, int small, void* unused, @@ -1142,7 +1142,7 @@ BZFILE* BZ_API(BZ2_bzReadOpen) BZ_SETERR(BZ_OK); - if (f == NULL || + if (f == NULL || (small != 0 && small != 1) || (verbosity < 0 || verbosity > 4) || (unused == NULL && nUnused != 0) || @@ -1153,7 +1153,7 @@ BZFILE* BZ_API(BZ2_bzReadOpen) { BZ_SETERR(BZ_IO_ERROR); return NULL; }; bzf = malloc ( sizeof(bzFile) ); - if (bzf == NULL) + if (bzf == NULL) { BZ_SETERR(BZ_MEM_ERROR); return NULL; }; BZ_SETERR(BZ_OK); @@ -1165,7 +1165,7 @@ BZFILE* BZ_API(BZ2_bzReadOpen) bzf->strm.bzalloc = NULL; bzf->strm.bzfree = NULL; bzf->strm.opaque = NULL; - + while (nUnused > 0) { bzf->buf[bzf->bufN] = *((UChar*)(unused)); bzf->bufN++; unused = ((void*)( 1 + ((UChar*)(unused)) )); @@ -1180,7 +1180,7 @@ BZFILE* BZ_API(BZ2_bzReadOpen) bzf->strm.next_in = bzf->buf; bzf->initialisedOk = True; - return bzf; + return bzf; } @@ -1203,10 +1203,10 @@ void BZ_API(BZ2_bzReadClose) ( int *bzerror, BZFILE *b ) /*---------------------------------------------------*/ -int BZ_API(BZ2_bzRead) - ( int* bzerror, - BZFILE* b, - void* buf, +int BZ_API(BZ2_bzRead) + ( int* bzerror, + BZFILE* b, + void* buf, int len ) { Int32 n, ret; @@ -1228,11 +1228,11 @@ int BZ_API(BZ2_bzRead) while (True) { - if (ferror(bzf->handle)) + if (ferror(bzf->handle)) { BZ_SETERR(BZ_IO_ERROR); return 0; }; if (bzf->strm.avail_in == 0 && !myfeof(bzf->handle)) { - n = fread ( bzf->buf, sizeof(UChar), + n = fread ( bzf->buf, sizeof(UChar), BZ_MAX_UNUSED, bzf->handle ); if (ferror(bzf->handle)) { BZ_SETERR(BZ_IO_ERROR); return 0; }; @@ -1246,7 +1246,7 @@ int BZ_API(BZ2_bzRead) if (ret != BZ_OK && ret != BZ_STREAM_END) { BZ_SETERR(ret); return 0; }; - if (ret == BZ_OK && myfeof(bzf->handle) && + if (ret == BZ_OK && myfeof(bzf->handle) && bzf->strm.avail_in == 0 && bzf->strm.avail_out > 0) { BZ_SETERR(BZ_UNEXPECTED_EOF); return 0; }; @@ -1255,7 +1255,7 @@ int BZ_API(BZ2_bzRead) return len - bzf->strm.avail_out; }; if (bzf->strm.avail_out == 0) { BZ_SETERR(BZ_OK); return len; }; - + } return 0; /*not reached*/ @@ -1263,10 +1263,10 @@ int BZ_API(BZ2_bzRead) /*---------------------------------------------------*/ -void BZ_API(BZ2_bzReadGetUnused) - ( int* bzerror, - BZFILE* b, - void** unused, +void BZ_API(BZ2_bzReadGetUnused) + ( int* bzerror, + BZFILE* b, + void** unused, int* nUnused ) { bzFile* bzf = (bzFile*)b; @@ -1289,30 +1289,30 @@ void BZ_API(BZ2_bzReadGetUnused) /*---------------------------------------------------*/ /*---------------------------------------------------*/ -int BZ_API(BZ2_bzBuffToBuffCompress) - ( char* dest, +int BZ_API(BZ2_bzBuffToBuffCompress) + ( char* dest, unsigned int* destLen, - char* source, + char* source, unsigned int sourceLen, - int blockSize100k, - int verbosity, + int blockSize100k, + int verbosity, int workFactor ) { bz_stream strm; int ret; - if (dest == NULL || destLen == NULL || + if (dest == NULL || destLen == NULL || source == NULL || blockSize100k < 1 || blockSize100k > 9 || verbosity < 0 || verbosity > 4 || - workFactor < 0 || workFactor > 250) + workFactor < 0 || workFactor > 250) return BZ_PARAM_ERROR; if (workFactor == 0) workFactor = 30; strm.bzalloc = NULL; strm.bzfree = NULL; strm.opaque = NULL; - ret = BZ2_bzCompressInit ( &strm, blockSize100k, + ret = BZ2_bzCompressInit ( &strm, blockSize100k, verbosity, workFactor ); if (ret != BZ_OK) return ret; @@ -1326,7 +1326,7 @@ int BZ_API(BZ2_bzBuffToBuffCompress) if (ret != BZ_STREAM_END) goto errhandler; /* normal termination */ - *destLen -= strm.avail_out; + *destLen -= strm.avail_out; BZ2_bzCompressEnd ( &strm ); return BZ_OK; @@ -1341,10 +1341,10 @@ int BZ_API(BZ2_bzBuffToBuffCompress) /*---------------------------------------------------*/ -int BZ_API(BZ2_bzBuffToBuffDecompress) - ( char* dest, +int BZ_API(BZ2_bzBuffToBuffDecompress) + ( char* dest, unsigned int* destLen, - char* source, + char* source, unsigned int sourceLen, int small, int verbosity ) @@ -1352,10 +1352,10 @@ int BZ_API(BZ2_bzBuffToBuffDecompress) bz_stream strm; int ret; - if (dest == NULL || destLen == NULL || + if (dest == NULL || destLen == NULL || source == NULL || (small != 0 && small != 1) || - verbosity < 0 || verbosity > 4) + verbosity < 0 || verbosity > 4) return BZ_PARAM_ERROR; strm.bzalloc = NULL; @@ -1385,11 +1385,11 @@ int BZ_API(BZ2_bzBuffToBuffDecompress) } else { BZ2_bzDecompressEnd ( &strm ); return BZ_OUTBUFF_FULL; - }; + }; errhandler: BZ2_bzDecompressEnd ( &strm ); - return ret; + return ret; } @@ -1442,7 +1442,7 @@ BZFILE * bzopen_or_bzdopen int verbosity = 0; int workFactor = 30; int smallMode = 0; - int nUnused = 0; + int nUnused = 0; if (mode == NULL) return NULL; while (*mode) { @@ -1482,7 +1482,7 @@ BZFILE * bzopen_or_bzdopen if (writing) { /* Guard against total chaos and anarchy -- JRS */ if (blockSize100k < 1) blockSize100k = 1; - if (blockSize100k > 9) blockSize100k = 9; + if (blockSize100k > 9) blockSize100k = 9; bzfp = BZ2_bzWriteOpen(&bzerr,fp,blockSize100k, verbosity,workFactor); } else { @@ -1561,7 +1561,7 @@ void BZ_API(BZ2_bzclose) (BZFILE* b) { int bzerr; FILE *fp = ((bzFile *)b)->handle; - + if (b==NULL) {return;} if(((bzFile*)b)->writing){ BZ2_bzWriteClose(&bzerr,b,0,NULL,NULL); @@ -1579,7 +1579,7 @@ void BZ_API(BZ2_bzclose) (BZFILE* b) /*---------------------------------------------------*/ /*-- - return last error code + return last error code --*/ static char *bzerrorstrings[] = { "OK" diff --git a/contrib/vmap_extractor_v2/stormlib/bzip2/bzlib.h b/contrib/vmap_extractor_v2/stormlib/bzip2/bzlib.h index 323724394a2..c84589d1fbd 100644 --- a/contrib/vmap_extractor_v2/stormlib/bzip2/bzlib.h +++ b/contrib/vmap_extractor_v2/stormlib/bzip2/bzlib.h @@ -17,16 +17,16 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product + 2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written + 4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS @@ -85,7 +85,7 @@ extern "C" { #define BZ_OUTBUFF_FULL (-8) #define BZ_CONFIG_ERROR (-9) -typedef +typedef struct { char *next_in; unsigned int avail_in; @@ -102,7 +102,7 @@ typedef void *(*bzalloc)(void *,int,int); void (*bzfree)(void *,void *); void *opaque; - } + } bz_stream; @@ -137,34 +137,34 @@ typedef /*-- Core (low-level) library functions --*/ -BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( - bz_stream* strm, - int blockSize100k, - int verbosity, - int workFactor +BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( + bz_stream* strm, + int blockSize100k, + int verbosity, + int workFactor ); -BZ_EXTERN int BZ_API(BZ2_bzCompress) ( - bz_stream* strm, - int action +BZ_EXTERN int BZ_API(BZ2_bzCompress) ( + bz_stream* strm, + int action ); -BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( - bz_stream* strm +BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( + bz_stream* strm ); -BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( - bz_stream *strm, - int verbosity, +BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( + bz_stream *strm, + int verbosity, int small ); -BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( - bz_stream* strm +BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( + bz_stream* strm ); -BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( - bz_stream *strm +BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( + bz_stream *strm ); @@ -176,64 +176,64 @@ BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( typedef void BZFILE; -BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( - int* bzerror, - FILE* f, - int verbosity, +BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( + int* bzerror, + FILE* f, + int verbosity, int small, - void* unused, - int nUnused + void* unused, + int nUnused ); -BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( - int* bzerror, - BZFILE* b +BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( + int* bzerror, + BZFILE* b ); -BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( - int* bzerror, - BZFILE* b, - void** unused, - int* nUnused +BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( + int* bzerror, + BZFILE* b, + void** unused, + int* nUnused ); -BZ_EXTERN int BZ_API(BZ2_bzRead) ( - int* bzerror, - BZFILE* b, - void* buf, - int len +BZ_EXTERN int BZ_API(BZ2_bzRead) ( + int* bzerror, + BZFILE* b, + void* buf, + int len ); -BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( - int* bzerror, - FILE* f, - int blockSize100k, - int verbosity, - int workFactor +BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( + int* bzerror, + FILE* f, + int blockSize100k, + int verbosity, + int workFactor ); -BZ_EXTERN void BZ_API(BZ2_bzWrite) ( - int* bzerror, - BZFILE* b, - void* buf, - int len +BZ_EXTERN void BZ_API(BZ2_bzWrite) ( + int* bzerror, + BZFILE* b, + void* buf, + int len ); -BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( - int* bzerror, - BZFILE* b, - int abandon, - unsigned int* nbytes_in, - unsigned int* nbytes_out +BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( + int* bzerror, + BZFILE* b, + int abandon, + unsigned int* nbytes_in, + unsigned int* nbytes_out ); -BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( - int* bzerror, - BZFILE* b, - int abandon, - unsigned int* nbytes_in_lo32, - unsigned int* nbytes_in_hi32, - unsigned int* nbytes_out_lo32, +BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( + int* bzerror, + BZFILE* b, + int abandon, + unsigned int* nbytes_in_lo32, + unsigned int* nbytes_in_hi32, + unsigned int* nbytes_out_lo32, unsigned int* nbytes_out_hi32 ); #endif @@ -241,23 +241,23 @@ BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( /*-- Utility functions --*/ -BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( - char* dest, +BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( + char* dest, unsigned int* destLen, - char* source, + char* source, unsigned int sourceLen, - int blockSize100k, - int verbosity, - int workFactor + int blockSize100k, + int verbosity, + int workFactor ); -BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( - char* dest, +BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( + char* dest, unsigned int* destLen, - char* source, + char* source, unsigned int sourceLen, - int small, - int verbosity + int small, + int verbosity ); @@ -285,17 +285,17 @@ BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) ( int fd, const char *mode ); - + BZ_EXTERN int BZ_API(BZ2_bzread) ( - BZFILE* b, - void* buf, - int len + BZFILE* b, + void* buf, + int len ); BZ_EXTERN int BZ_API(BZ2_bzwrite) ( - BZFILE* b, - void* buf, - int len + BZFILE* b, + void* buf, + int len ); BZ_EXTERN int BZ_API(BZ2_bzflush) ( @@ -307,7 +307,7 @@ BZ_EXTERN void BZ_API(BZ2_bzclose) ( ); BZ_EXTERN const char * BZ_API(BZ2_bzerror) ( - BZFILE *b, + BZFILE *b, int *errnum ); #endif diff --git a/contrib/vmap_extractor_v2/stormlib/bzip2/bzlib_private.h b/contrib/vmap_extractor_v2/stormlib/bzip2/bzlib_private.h index ca76fe62b3b..23a19f8070e 100644 --- a/contrib/vmap_extractor_v2/stormlib/bzip2/bzlib_private.h +++ b/contrib/vmap_extractor_v2/stormlib/bzip2/bzlib_private.h @@ -17,16 +17,16 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product + 2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written + 4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS @@ -91,7 +91,7 @@ typedef unsigned short UInt16; #ifndef __GNUC__ #define __inline__ /* */ -#endif +#endif #ifndef BZ_NO_STDIO extern void BZ2_bz__AssertH__fail ( int errcode ); @@ -143,7 +143,7 @@ extern void bz_internal_error ( int errcode ); #define BZ_HDR_Z 0x5a /* 'Z' */ #define BZ_HDR_h 0x68 /* 'h' */ #define BZ_HDR_0 0x30 /* '0' */ - + /*-- Constants for the back end. --*/ #define BZ_MAX_ALPHA_SIZE 258 @@ -303,19 +303,19 @@ typedef /*-- externs for compression. --*/ -extern void +extern void BZ2_blockSort ( EState* ); -extern void +extern void BZ2_compressBlock ( EState*, Bool ); -extern void +extern void BZ2_bsInitWrite ( EState* ); -extern void +extern void BZ2_hbAssignCodes ( Int32*, UChar*, Int32, Int32, Int32 ); -extern void +extern void BZ2_hbMakeCodeLengths ( UChar*, Int32*, Int32, Int32 ); @@ -459,7 +459,7 @@ typedef Int32 save_N; Int32 save_curr; Int32 save_zt; - Int32 save_zn; + Int32 save_zn; Int32 save_zvec; Int32 save_zj; Int32 save_gSel; @@ -509,13 +509,13 @@ typedef /*-- externs for decompression. --*/ -extern Int32 +extern Int32 BZ2_indexIntoF ( Int32, Int32* ); -extern Int32 +extern Int32 BZ2_decompress ( DState* ); -extern void +extern void BZ2_hbCreateDecodeTables ( Int32*, Int32*, Int32*, UChar*, Int32, Int32, Int32 ); diff --git a/contrib/vmap_extractor_v2/stormlib/bzip2/compress.c b/contrib/vmap_extractor_v2/stormlib/bzip2/compress.c index 7e0c29155ab..c328ef137fd 100644 --- a/contrib/vmap_extractor_v2/stormlib/bzip2/compress.c +++ b/contrib/vmap_extractor_v2/stormlib/bzip2/compress.c @@ -17,16 +17,16 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product + 2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written + 4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS @@ -66,7 +66,7 @@ 0.9.0a/b -- no changes in this file. 0.9.0c - * changed setting of nGroups in sendMTFValues() so as to + * changed setting of nGroups in sendMTFValues() so as to do a bit better on small files --*/ @@ -169,11 +169,11 @@ void generateMTFValues ( EState* s ) Int32 wr; Int32 EOB; - /* + /* After sorting (eg, here), s->arr1 [ 0 .. s->nblock-1 ] holds sorted order, and - ((UChar*)s->arr2) [ 0 .. s->nblock-1 ] + ((UChar*)s->arr2) [ 0 .. s->nblock-1 ] holds the original block data. The first thing to do is generate the MTF values, @@ -188,7 +188,7 @@ void generateMTFValues ( EState* s ) (UChar*) (&((UChar*)s->arr2)[s->nblock]) These storage aliases are set up in bzCompressInit(), - except for the last one, which is arranged in + except for the last one, which is arranged in compressBlock(). */ UInt32* ptr = s->ptr; @@ -211,7 +211,7 @@ void generateMTFValues ( EState* s ) ll_i = s->unseqToSeq[block[j]]; AssertD ( ll_i < s->nInUse, "generateMTFValues(2a)" ); - if (yy[0] == ll_i) { + if (yy[0] == ll_i) { zPend++; } else { @@ -219,11 +219,11 @@ void generateMTFValues ( EState* s ) zPend--; while (True) { if (zPend & 1) { - mtfv[wr] = BZ_RUNB; wr++; - s->mtfFreq[BZ_RUNB]++; + mtfv[wr] = BZ_RUNB; wr++; + s->mtfFreq[BZ_RUNB]++; } else { - mtfv[wr] = BZ_RUNA; wr++; - s->mtfFreq[BZ_RUNA]++; + mtfv[wr] = BZ_RUNA; wr++; + s->mtfFreq[BZ_RUNA]++; } if (zPend < 2) break; zPend = (zPend - 2) / 2; @@ -257,11 +257,11 @@ void generateMTFValues ( EState* s ) zPend--; while (True) { if (zPend & 1) { - mtfv[wr] = BZ_RUNB; wr++; - s->mtfFreq[BZ_RUNB]++; + mtfv[wr] = BZ_RUNB; wr++; + s->mtfFreq[BZ_RUNB]++; } else { - mtfv[wr] = BZ_RUNA; wr++; - s->mtfFreq[BZ_RUNA]++; + mtfv[wr] = BZ_RUNA; wr++; + s->mtfFreq[BZ_RUNA]++; } if (zPend < 2) break; zPend = (zPend - 2) / 2; @@ -304,7 +304,7 @@ void sendMTFValues ( EState* s ) if (s->verbosity >= 3) VPrintf3( " %d in block, %d after MTF & 1-2 coding, " - "%d+2 syms in use\n", + "%d+2 syms in use\n", s->nblock, s->nMTF, s->nInUse ); alphaSize = s->nInUse+2; @@ -321,7 +321,7 @@ void sendMTFValues ( EState* s ) nGroups = 6; /*--- Generate an initial set of coding tables ---*/ - { + { Int32 nPart, remF, tFreq, aFreq; nPart = nGroups; @@ -336,8 +336,8 @@ void sendMTFValues ( EState* s ) aFreq += s->mtfFreq[ge]; } - if (ge > gs - && nPart != nGroups && nPart != 1 + if (ge > gs + && nPart != nGroups && nPart != 1 && ((nGroups-nPart) % 2 == 1)) { aFreq -= s->mtfFreq[ge]; ge--; @@ -346,21 +346,21 @@ void sendMTFValues ( EState* s ) if (s->verbosity >= 3) VPrintf5( " initial group %d, [%d .. %d], " "has %d syms (%4.1f%%)\n", - nPart, gs, ge, aFreq, + nPart, gs, ge, aFreq, (100.0 * (float)aFreq) / (float)(s->nMTF) ); - + for (v = 0; v < alphaSize; v++) - if (v >= gs && v <= ge) + if (v >= gs && v <= ge) s->len[nPart-1][v] = BZ_LESSER_ICOST; else s->len[nPart-1][v] = BZ_GREATER_ICOST; - + nPart--; gs = ge+1; remF -= aFreq; } } - /*--- + /*--- Iterate up to BZ_N_ITERS times to improve the tables. ---*/ for (iter = 0; iter < BZ_N_ITERS; iter++) { @@ -373,14 +373,14 @@ void sendMTFValues ( EState* s ) /*--- Set up an auxiliary length table which is used to fast-track - the common case (nGroups == 6). + the common case (nGroups == 6). ---*/ if (nGroups == 6) { for (v = 0; v < alphaSize; v++) { s->len_pack[v][0] = (s->len[1][v] << 16) | s->len[0][v]; s->len_pack[v][1] = (s->len[3][v] << 16) | s->len[2][v]; s->len_pack[v][2] = (s->len[5][v] << 16) | s->len[4][v]; - } + } } nSelectors = 0; @@ -390,10 +390,10 @@ void sendMTFValues ( EState* s ) /*--- Set group start & end marks. --*/ if (gs >= s->nMTF) break; - ge = gs + BZ_G_SIZE - 1; + ge = gs + BZ_G_SIZE - 1; if (ge >= s->nMTF) ge = s->nMTF-1; - /*-- + /*-- Calculate the cost of this group as coded by each of the coding tables. --*/ @@ -429,14 +429,14 @@ void sendMTFValues ( EState* s ) cost[4] = cost45 & 0xffff; cost[5] = cost45 >> 16; } else { - /*--- slow version which correctly handles all situations ---*/ - for (i = gs; i <= ge; i++) { + /*--- slow version which correctly handles all situations ---*/ + for (i = gs; i <= ge; i++) { UInt16 icv = mtfv[i]; for (t = 0; t < nGroups; t++) cost[t] += s->len[t][icv]; } } - - /*-- + + /*-- Find the coding table which is best for this group, and record its identity in the selector table. --*/ @@ -448,7 +448,7 @@ void sendMTFValues ( EState* s ) s->selector[nSelectors] = bt; nSelectors++; - /*-- + /*-- Increment the symbol frequencies for the selected table. --*/ if (nGroups == 6 && 50 == ge-gs+1) { @@ -470,7 +470,7 @@ void sendMTFValues ( EState* s ) # undef BZ_ITUR } else { - /*--- slow version which correctly handles all situations ---*/ + /*--- slow version which correctly handles all situations ---*/ for (i = gs; i <= ge; i++) s->rfreq[bt][ mtfv[i] ]++; } @@ -478,7 +478,7 @@ void sendMTFValues ( EState* s ) gs = ge+1; } if (s->verbosity >= 3) { - VPrintf2 ( " pass %d: size is %d, grp uses are ", + VPrintf2 ( " pass %d: size is %d, grp uses are ", iter+1, totc/8 ); for (t = 0; t < nGroups; t++) VPrintf1 ( "%d ", fave[t] ); @@ -488,10 +488,10 @@ void sendMTFValues ( EState* s ) /*-- Recompute the tables based on the accumulated frequencies. --*/ - /* maxLen was changed from 20 to 17 in bzip2-1.0.3. See + /* maxLen was changed from 20 to 17 in bzip2-1.0.3. See comment in huffman.c for details. */ for (t = 0; t < nGroups; t++) - BZ2_hbMakeCodeLengths ( &(s->len[t][0]), &(s->rfreq[t][0]), + BZ2_hbMakeCodeLengths ( &(s->len[t][0]), &(s->rfreq[t][0]), alphaSize, 17 /*20*/ ); } @@ -531,19 +531,19 @@ void sendMTFValues ( EState* s ) } AssertH ( !(maxLen > 17 /*20*/ ), 3004 ); AssertH ( !(minLen < 1), 3005 ); - BZ2_hbAssignCodes ( &(s->code[t][0]), &(s->len[t][0]), + BZ2_hbAssignCodes ( &(s->code[t][0]), &(s->len[t][0]), minLen, maxLen, alphaSize ); } /*--- Transmit the mapping table. ---*/ - { + { Bool inUse16[16]; for (i = 0; i < 16; i++) { inUse16[i] = False; for (j = 0; j < 16; j++) if (s->inUse[i * 16 + j]) inUse16[i] = True; } - + nBytes = s->numZ; for (i = 0; i < 16; i++) if (inUse16[i]) bsW(s,1,1); else bsW(s,1,0); @@ -554,7 +554,7 @@ void sendMTFValues ( EState* s ) if (s->inUse[i * 16 + j]) bsW(s,1,1); else bsW(s,1,0); } - if (s->verbosity >= 3) + if (s->verbosity >= 3) VPrintf1( " bytes: mapping %d, ", s->numZ-nBytes ); } @@ -562,7 +562,7 @@ void sendMTFValues ( EState* s ) nBytes = s->numZ; bsW ( s, 3, nGroups ); bsW ( s, 15, nSelectors ); - for (i = 0; i < nSelectors; i++) { + for (i = 0; i < nSelectors; i++) { for (j = 0; j < s->selectorMtf[i]; j++) bsW(s,1,1); bsW(s,1,0); } @@ -591,14 +591,14 @@ void sendMTFValues ( EState* s ) gs = 0; while (True) { if (gs >= s->nMTF) break; - ge = gs + BZ_G_SIZE - 1; + ge = gs + BZ_G_SIZE - 1; if (ge >= s->nMTF) ge = s->nMTF-1; AssertH ( s->selector[selCtr] < nGroups, 3006 ); if (nGroups == 6 && 50 == ge-gs+1) { /*--- fast track the common case ---*/ UInt16 mtfv_i; - UChar* s_len_sel_selCtr + UChar* s_len_sel_selCtr = &(s->len[s->selector[selCtr]][0]); Int32* s_code_sel_selCtr = &(s->code[s->selector[selCtr]][0]); @@ -623,9 +623,9 @@ void sendMTFValues ( EState* s ) # undef BZ_ITAH } else { - /*--- slow version which correctly handles all situations ---*/ + /*--- slow version which correctly handles all situations ---*/ for (i = gs; i <= ge; i++) { - bsW ( s, + bsW ( s, s->len [s->selector[selCtr]] [mtfv[i]], s->code [s->selector[selCtr]] [mtfv[i]] ); } @@ -680,8 +680,8 @@ void BZ2_compressBlock ( EState* s, Bool is_last_block ) /*-- Now the block's CRC, so it is in a known place. --*/ bsPutUInt32 ( s, s->blockCRC ); - /*-- - Now a single bit indicating (non-)randomisation. + /*-- + Now a single bit indicating (non-)randomisation. As of version 0.9.5, we use a better sorting algorithm which makes randomisation unnecessary. So always set the randomised bit to 'no'. Of course, the decoder diff --git a/contrib/vmap_extractor_v2/stormlib/bzip2/crctable.c b/contrib/vmap_extractor_v2/stormlib/bzip2/crctable.c index b6dadfc62f2..7b394805429 100644 --- a/contrib/vmap_extractor_v2/stormlib/bzip2/crctable.c +++ b/contrib/vmap_extractor_v2/stormlib/bzip2/crctable.c @@ -17,16 +17,16 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product + 2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written + 4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS diff --git a/contrib/vmap_extractor_v2/stormlib/bzip2/decompress.c b/contrib/vmap_extractor_v2/stormlib/bzip2/decompress.c index 81c3d2cc3f4..855b98bb631 100644 --- a/contrib/vmap_extractor_v2/stormlib/bzip2/decompress.c +++ b/contrib/vmap_extractor_v2/stormlib/bzip2/decompress.c @@ -17,16 +17,16 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product + 2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written + 4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS @@ -167,7 +167,7 @@ Int32 BZ2_decompress ( DState* s ) Int32 N; Int32 curr; Int32 zt; - Int32 zn; + Int32 zn; Int32 zvec; Int32 zj; Int32 gSel; @@ -221,7 +221,7 @@ Int32 BZ2_decompress ( DState* s ) N = s->save_N; curr = s->save_curr; zt = s->save_zt; - zn = s->save_zn; + zn = s->save_zn; zvec = s->save_zvec; zj = s->save_zj; gSel = s->save_gSel; @@ -244,14 +244,14 @@ Int32 BZ2_decompress ( DState* s ) if (uc != BZ_HDR_h) RETURN(BZ_DATA_ERROR_MAGIC); GET_BITS(BZ_X_MAGIC_4, s->blockSize100k, 8) - if (s->blockSize100k < (BZ_HDR_0 + 1) || + if (s->blockSize100k < (BZ_HDR_0 + 1) || s->blockSize100k > (BZ_HDR_0 + 9)) RETURN(BZ_DATA_ERROR_MAGIC); s->blockSize100k -= BZ_HDR_0; if (s->smallDecompress) { s->ll16 = BZALLOC( s->blockSize100k * 100000 * sizeof(UInt16) ); - s->ll4 = BZALLOC( - ((1 + s->blockSize100k * 100000) >> 1) * sizeof(UChar) + s->ll4 = BZALLOC( + ((1 + s->blockSize100k * 100000) >> 1) * sizeof(UChar) ); if (s->ll16 == NULL || s->ll4 == NULL) RETURN(BZ_MEM_ERROR); } else { @@ -277,7 +277,7 @@ Int32 BZ2_decompress ( DState* s ) s->currBlockNo++; if (s->verbosity >= 2) VPrintf1 ( "\n [%d: huff+mtf ", s->currBlockNo ); - + s->storedBlockCRC = 0; GET_UCHAR(BZ_X_BCRC_1, uc); s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); @@ -300,14 +300,14 @@ Int32 BZ2_decompress ( DState* s ) if (s->origPtr < 0) RETURN(BZ_DATA_ERROR); - if (s->origPtr > 10 + 100000*s->blockSize100k) + if (s->origPtr > 10 + 100000*s->blockSize100k) RETURN(BZ_DATA_ERROR); /*--- Receive the mapping table ---*/ for (i = 0; i < 16; i++) { GET_BIT(BZ_X_MAPPING_1, uc); - if (uc == 1) - s->inUse16[i] = True; else + if (uc == 1) + s->inUse16[i] = True; else s->inUse16[i] = False; } @@ -343,7 +343,7 @@ Int32 BZ2_decompress ( DState* s ) { UChar pos[BZ_N_GROUPS], tmp, v; for (v = 0; v < nGroups; v++) pos[v] = v; - + for (i = 0; i < nSelectors; i++) { v = s->selectorMtf[i]; tmp = pos[v]; @@ -376,10 +376,10 @@ Int32 BZ2_decompress ( DState* s ) if (s->len[t][i] > maxLen) maxLen = s->len[t][i]; if (s->len[t][i] < minLen) minLen = s->len[t][i]; } - BZ2_hbCreateDecodeTables ( - &(s->limit[t][0]), - &(s->base[t][0]), - &(s->perm[t][0]), + BZ2_hbCreateDecodeTables ( + &(s->limit[t][0]), + &(s->base[t][0]), + &(s->perm[t][0]), &(s->len[t][0]), minLen, maxLen, alphaSize ); @@ -471,23 +471,23 @@ Int32 BZ2_decompress ( DState* s ) s->mtfa[(z)-3] = s->mtfa[(z)-4]; nn -= 4; } - while (nn > 0) { - s->mtfa[(pp+nn)] = s->mtfa[(pp+nn)-1]; nn--; + while (nn > 0) { + s->mtfa[(pp+nn)] = s->mtfa[(pp+nn)-1]; nn--; }; s->mtfa[pp] = uc; - } else { + } else { /* general case */ lno = nn / MTFL_SIZE; off = nn % MTFL_SIZE; pp = s->mtfbase[lno] + off; uc = s->mtfa[pp]; - while (pp > s->mtfbase[lno]) { - s->mtfa[pp] = s->mtfa[pp-1]; pp--; + while (pp > s->mtfbase[lno]) { + s->mtfa[pp] = s->mtfa[pp-1]; pp--; }; s->mtfbase[lno]++; while (lno > 0) { s->mtfbase[lno]--; - s->mtfa[s->mtfbase[lno]] + s->mtfa[s->mtfbase[lno]] = s->mtfa[s->mtfbase[lno-1] + MTFL_SIZE - 1]; lno--; } @@ -569,7 +569,7 @@ Int32 BZ2_decompress ( DState* s ) if (s->blockRandomised) { BZ_RAND_INIT_MASK; BZ_GET_SMALL(s->k0); s->nblock_used++; - BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; + BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; } else { BZ_GET_SMALL(s->k0); s->nblock_used++; } @@ -588,7 +588,7 @@ Int32 BZ2_decompress ( DState* s ) if (s->blockRandomised) { BZ_RAND_INIT_MASK; BZ_GET_FAST(s->k0); s->nblock_used++; - BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; + BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; } else { BZ_GET_FAST(s->k0); s->nblock_used++; } @@ -657,7 +657,7 @@ Int32 BZ2_decompress ( DState* s ) s->save_gBase = gBase; s->save_gPerm = gPerm; - return retVal; + return retVal; } diff --git a/contrib/vmap_extractor_v2/stormlib/bzip2/dlltest.c b/contrib/vmap_extractor_v2/stormlib/bzip2/dlltest.c index eb86bb61a59..2049906ea53 100644 --- a/contrib/vmap_extractor_v2/stormlib/bzip2/dlltest.c +++ b/contrib/vmap_extractor_v2/stormlib/bzip2/dlltest.c @@ -19,7 +19,7 @@ #ifdef _WIN32 -#define BZ2_LIBNAME "libbz2-1.0.2.DLL" +#define BZ2_LIBNAME "libbz2-1.0.2.DLL" #include static int BZ2DLLLoaded = 0; diff --git a/contrib/vmap_extractor_v2/stormlib/bzip2/huffman.c b/contrib/vmap_extractor_v2/stormlib/bzip2/huffman.c index 5bf190be9a1..871eed4f23e 100644 --- a/contrib/vmap_extractor_v2/stormlib/bzip2/huffman.c +++ b/contrib/vmap_extractor_v2/stormlib/bzip2/huffman.c @@ -17,16 +17,16 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product + 2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written + 4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS @@ -100,7 +100,7 @@ /*---------------------------------------------------*/ -void BZ2_hbMakeCodeLengths ( UChar *len, +void BZ2_hbMakeCodeLengths ( UChar *len, Int32 *freq, Int32 alphaSize, Int32 maxLen ) @@ -114,7 +114,7 @@ void BZ2_hbMakeCodeLengths ( UChar *len, Int32 heap [ BZ_MAX_ALPHA_SIZE + 2 ]; Int32 weight [ BZ_MAX_ALPHA_SIZE * 2 ]; - Int32 parent [ BZ_MAX_ALPHA_SIZE * 2 ]; + Int32 parent [ BZ_MAX_ALPHA_SIZE * 2 ]; for (i = 0; i < alphaSize; i++) weight[i+1] = (freq[i] == 0 ? 1 : freq[i]) << 8; @@ -136,7 +136,7 @@ void BZ2_hbMakeCodeLengths ( UChar *len, } AssertH( nHeap < (BZ_MAX_ALPHA_SIZE+2), 2001 ); - + while (nHeap > 1) { n1 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1); n2 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1); @@ -159,7 +159,7 @@ void BZ2_hbMakeCodeLengths ( UChar *len, len[i-1] = j; if (j > maxLen) tooLong = True; } - + if (! tooLong) break; /* 17 Oct 04: keep-going condition for the following loop used diff --git a/contrib/vmap_extractor_v2/stormlib/bzip2/randtable.c b/contrib/vmap_extractor_v2/stormlib/bzip2/randtable.c index 940462d693d..b8e74070f82 100644 --- a/contrib/vmap_extractor_v2/stormlib/bzip2/randtable.c +++ b/contrib/vmap_extractor_v2/stormlib/bzip2/randtable.c @@ -17,16 +17,16 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product + 2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written + 4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS @@ -63,58 +63,58 @@ /*---------------------------------------------*/ -Int32 BZ2_rNums[512] = { - 619, 720, 127, 481, 931, 816, 813, 233, 566, 247, - 985, 724, 205, 454, 863, 491, 741, 242, 949, 214, - 733, 859, 335, 708, 621, 574, 73, 654, 730, 472, - 419, 436, 278, 496, 867, 210, 399, 680, 480, 51, - 878, 465, 811, 169, 869, 675, 611, 697, 867, 561, - 862, 687, 507, 283, 482, 129, 807, 591, 733, 623, - 150, 238, 59, 379, 684, 877, 625, 169, 643, 105, - 170, 607, 520, 932, 727, 476, 693, 425, 174, 647, - 73, 122, 335, 530, 442, 853, 695, 249, 445, 515, - 909, 545, 703, 919, 874, 474, 882, 500, 594, 612, - 641, 801, 220, 162, 819, 984, 589, 513, 495, 799, - 161, 604, 958, 533, 221, 400, 386, 867, 600, 782, - 382, 596, 414, 171, 516, 375, 682, 485, 911, 276, - 98, 553, 163, 354, 666, 933, 424, 341, 533, 870, - 227, 730, 475, 186, 263, 647, 537, 686, 600, 224, - 469, 68, 770, 919, 190, 373, 294, 822, 808, 206, - 184, 943, 795, 384, 383, 461, 404, 758, 839, 887, - 715, 67, 618, 276, 204, 918, 873, 777, 604, 560, - 951, 160, 578, 722, 79, 804, 96, 409, 713, 940, - 652, 934, 970, 447, 318, 353, 859, 672, 112, 785, - 645, 863, 803, 350, 139, 93, 354, 99, 820, 908, - 609, 772, 154, 274, 580, 184, 79, 626, 630, 742, - 653, 282, 762, 623, 680, 81, 927, 626, 789, 125, - 411, 521, 938, 300, 821, 78, 343, 175, 128, 250, - 170, 774, 972, 275, 999, 639, 495, 78, 352, 126, - 857, 956, 358, 619, 580, 124, 737, 594, 701, 612, - 669, 112, 134, 694, 363, 992, 809, 743, 168, 974, - 944, 375, 748, 52, 600, 747, 642, 182, 862, 81, - 344, 805, 988, 739, 511, 655, 814, 334, 249, 515, - 897, 955, 664, 981, 649, 113, 974, 459, 893, 228, - 433, 837, 553, 268, 926, 240, 102, 654, 459, 51, - 686, 754, 806, 760, 493, 403, 415, 394, 687, 700, - 946, 670, 656, 610, 738, 392, 760, 799, 887, 653, - 978, 321, 576, 617, 626, 502, 894, 679, 243, 440, - 680, 879, 194, 572, 640, 724, 926, 56, 204, 700, - 707, 151, 457, 449, 797, 195, 791, 558, 945, 679, - 297, 59, 87, 824, 713, 663, 412, 693, 342, 606, - 134, 108, 571, 364, 631, 212, 174, 643, 304, 329, - 343, 97, 430, 751, 497, 314, 983, 374, 822, 928, - 140, 206, 73, 263, 980, 736, 876, 478, 430, 305, - 170, 514, 364, 692, 829, 82, 855, 953, 676, 246, - 369, 970, 294, 750, 807, 827, 150, 790, 288, 923, - 804, 378, 215, 828, 592, 281, 565, 555, 710, 82, - 896, 831, 547, 261, 524, 462, 293, 465, 502, 56, - 661, 821, 976, 991, 658, 869, 905, 758, 745, 193, - 768, 550, 608, 933, 378, 286, 215, 979, 792, 961, - 61, 688, 793, 644, 986, 403, 106, 366, 905, 644, - 372, 567, 466, 434, 645, 210, 389, 550, 919, 135, - 780, 773, 635, 389, 707, 100, 626, 958, 165, 504, - 920, 176, 193, 713, 857, 265, 203, 50, 668, 108, - 645, 990, 626, 197, 510, 357, 358, 850, 858, 364, +Int32 BZ2_rNums[512] = { + 619, 720, 127, 481, 931, 816, 813, 233, 566, 247, + 985, 724, 205, 454, 863, 491, 741, 242, 949, 214, + 733, 859, 335, 708, 621, 574, 73, 654, 730, 472, + 419, 436, 278, 496, 867, 210, 399, 680, 480, 51, + 878, 465, 811, 169, 869, 675, 611, 697, 867, 561, + 862, 687, 507, 283, 482, 129, 807, 591, 733, 623, + 150, 238, 59, 379, 684, 877, 625, 169, 643, 105, + 170, 607, 520, 932, 727, 476, 693, 425, 174, 647, + 73, 122, 335, 530, 442, 853, 695, 249, 445, 515, + 909, 545, 703, 919, 874, 474, 882, 500, 594, 612, + 641, 801, 220, 162, 819, 984, 589, 513, 495, 799, + 161, 604, 958, 533, 221, 400, 386, 867, 600, 782, + 382, 596, 414, 171, 516, 375, 682, 485, 911, 276, + 98, 553, 163, 354, 666, 933, 424, 341, 533, 870, + 227, 730, 475, 186, 263, 647, 537, 686, 600, 224, + 469, 68, 770, 919, 190, 373, 294, 822, 808, 206, + 184, 943, 795, 384, 383, 461, 404, 758, 839, 887, + 715, 67, 618, 276, 204, 918, 873, 777, 604, 560, + 951, 160, 578, 722, 79, 804, 96, 409, 713, 940, + 652, 934, 970, 447, 318, 353, 859, 672, 112, 785, + 645, 863, 803, 350, 139, 93, 354, 99, 820, 908, + 609, 772, 154, 274, 580, 184, 79, 626, 630, 742, + 653, 282, 762, 623, 680, 81, 927, 626, 789, 125, + 411, 521, 938, 300, 821, 78, 343, 175, 128, 250, + 170, 774, 972, 275, 999, 639, 495, 78, 352, 126, + 857, 956, 358, 619, 580, 124, 737, 594, 701, 612, + 669, 112, 134, 694, 363, 992, 809, 743, 168, 974, + 944, 375, 748, 52, 600, 747, 642, 182, 862, 81, + 344, 805, 988, 739, 511, 655, 814, 334, 249, 515, + 897, 955, 664, 981, 649, 113, 974, 459, 893, 228, + 433, 837, 553, 268, 926, 240, 102, 654, 459, 51, + 686, 754, 806, 760, 493, 403, 415, 394, 687, 700, + 946, 670, 656, 610, 738, 392, 760, 799, 887, 653, + 978, 321, 576, 617, 626, 502, 894, 679, 243, 440, + 680, 879, 194, 572, 640, 724, 926, 56, 204, 700, + 707, 151, 457, 449, 797, 195, 791, 558, 945, 679, + 297, 59, 87, 824, 713, 663, 412, 693, 342, 606, + 134, 108, 571, 364, 631, 212, 174, 643, 304, 329, + 343, 97, 430, 751, 497, 314, 983, 374, 822, 928, + 140, 206, 73, 263, 980, 736, 876, 478, 430, 305, + 170, 514, 364, 692, 829, 82, 855, 953, 676, 246, + 369, 970, 294, 750, 807, 827, 150, 790, 288, 923, + 804, 378, 215, 828, 592, 281, 565, 555, 710, 82, + 896, 831, 547, 261, 524, 462, 293, 465, 502, 56, + 661, 821, 976, 991, 658, 869, 905, 758, 745, 193, + 768, 550, 608, 933, 378, 286, 215, 979, 792, 961, + 61, 688, 793, 644, 986, 403, 106, 366, 905, 644, + 372, 567, 466, 434, 645, 210, 389, 550, 919, 135, + 780, 773, 635, 389, 707, 100, 626, 958, 165, 504, + 920, 176, 193, 713, 857, 265, 203, 50, 668, 108, + 645, 990, 626, 197, 510, 357, 358, 850, 858, 364, 936, 638 }; diff --git a/contrib/vmap_extractor_v2/stormlib/bzip2/spewG.c b/contrib/vmap_extractor_v2/stormlib/bzip2/spewG.c index 7934e765818..6caca9baa94 100644 --- a/contrib/vmap_extractor_v2/stormlib/bzip2/spewG.c +++ b/contrib/vmap_extractor_v2/stormlib/bzip2/spewG.c @@ -4,7 +4,7 @@ support for large files (> 2GB) in a reasonable amount of time. I suggest you use the undocumented --exponential option to bzip2 when compressing the resulting file; this saves a bit of - time. Note: *don't* bother with --exponential when compressing + time. Note: *don't* bother with --exponential when compressing Real Files; it'll just waste a lot of CPU time :-) (but is otherwise harmless). */ diff --git a/contrib/vmap_extractor_v2/stormlib/bzip2/unzcrash.c b/contrib/vmap_extractor_v2/stormlib/bzip2/unzcrash.c index f0f17fcca53..623aacc9f3f 100644 --- a/contrib/vmap_extractor_v2/stormlib/bzip2/unzcrash.c +++ b/contrib/vmap_extractor_v2/stormlib/bzip2/unzcrash.c @@ -1,11 +1,11 @@ /* A test program written to test robustness to decompression of - corrupted data. Usage is + corrupted data. Usage is unzcrash filename and the program will read the specified file, compress it (in memory), and then repeatedly decompress it, each time with a different bit of the compressed data inverted, so as to test all possible one-bit errors. - This should not cause any invalid memory accesses. If it does, + This should not cause any invalid memory accesses. If it does, I want to know about it! p.s. As you can see from the above description, the process is @@ -100,9 +100,9 @@ int main ( int argc, char** argv ) return 1; } else { for (i = 0; i < nOut; i++) - if (inbuf[i] != outbuf[i]) { - fprintf(stderr, "mismatch at %d\n", i ); - return 1; + if (inbuf[i] != outbuf[i]) { + fprintf(stderr, "mismatch at %d\n", i ); + return 1; } if (i == nOut) fprintf(stderr, "really ok!\n" ); } diff --git a/contrib/vmap_extractor_v2/stormlib/huffman/huff.cpp b/contrib/vmap_extractor_v2/stormlib/huffman/huff.cpp index 612fcb08386..235319b9252 100644 --- a/contrib/vmap_extractor_v2/stormlib/huffman/huff.cpp +++ b/contrib/vmap_extractor_v2/stormlib/huffman/huff.cpp @@ -14,10 +14,10 @@ /* 19.11.03 1.01 Dan Big endian handling */ /* 08.12.03 2.01 Dan High-memory handling (> 0x80000000) */ /*****************************************************************************/ - + #include #include - + #include "huff.h" // Special for Mac - we have to know if normal pointer greater or less @@ -29,10 +29,10 @@ static long mul = 1; #define PTR_INVALID(ptr) (((LONG_PTR)(ptr) * mul) < 0) #define PTR_INVALID_OR_NULL(ptr) (((LONG_PTR)(ptr) * mul) <= 0) - + //----------------------------------------------------------------------------- // Methods of the THTreeItem struct - + // 1501DB70 THTreeItem * THTreeItem::Call1501DB70(THTreeItem * pLast) { @@ -40,83 +40,83 @@ THTreeItem * THTreeItem::Call1501DB70(THTreeItem * pLast) pLast = this + 1; return pLast; } - + // Gets previous Huffman tree item (?) THTreeItem * THTreeItem::GetPrevItem(LONG_PTR value) { if(PTR_INVALID(prev)) return PTR_NOT(prev); - + if(value == -1 || PTR_INVALID(value)) value = (long)(this - next->prev); return prev + value; - + // OLD VERSION // if(PTR_INT(value) < 0) // value = PTR_INT((item - item->next->prev)); // return (THTreeItem *)((char *)prev + value); } - + // 1500F5E0 void THTreeItem::ClearItemLinks() { next = prev = NULL; } - + // 1500BC90 void THTreeItem::RemoveItem() { THTreeItem * pTemp; // EDX - + if(next != NULL) { pTemp = prev; - + if(PTR_INVALID_OR_NULL(pTemp)) pTemp = PTR_NOT(pTemp); else pTemp += (this - next->prev); - + pTemp->next = next; next->prev = prev; next = prev = NULL; } } - + /* // OLD VERSION : Removes item from the tree (?) static void RemoveItem(THTreeItem * item) { THTreeItem * next = item->next; // ESI THTreeItem * prev = item->prev; // EDX - + if(next == NULL) return; - + if(PTR_INT(prev) < 0) prev = PTR_NOT(prev); else // ??? usually item == next->prev, so what is it ? prev = (THTreeItem *)((unsigned char *)prev + (unsigned long)((unsigned char *)item - (unsigned char *)(next->prev))); - + // Remove HTree item from the chain prev->next = next; // Sets the 'first' pointer next->prev = item->prev; - + // Invalidate pointers item->next = NULL; item->prev = NULL; } */ - + //----------------------------------------------------------------------------- // TOutputStream functions - + void TOutputStream::PutBits(unsigned long dwBuff, unsigned int nPutBits) { dwBitBuff |= (dwBuff << nBits); nBits += nPutBits; - + // Flush completed bytes while(nBits >= 8) { @@ -125,20 +125,20 @@ void TOutputStream::PutBits(unsigned long dwBuff, unsigned int nPutBits) *pbOutPos++ = (unsigned char)dwBitBuff; dwOutSize--; } - + dwBitBuff >>= 8; nBits -= 8; } } - + //----------------------------------------------------------------------------- // TInputStream functions - + // Gets one bit from input stream unsigned long TInputStream::GetBit() { unsigned long dwBit = (dwBitBuff & 1); - + dwBitBuff >>= 1; if(--nBits == 0) { @@ -147,8 +147,8 @@ unsigned long TInputStream::GetBit() nBits = 32; } return dwBit; -} - +} + // Gets 7 bits from the stream unsigned long TInputStream::Get7Bits() { @@ -158,32 +158,32 @@ unsigned long TInputStream::Get7Bits() pbInBuffer += sizeof(unsigned short); nBits += 16; } - + // Get 7 bits from input stream return (dwBitBuff & 0x7F); } - + // Gets the whole byte from the input stream. unsigned long TInputStream::Get8Bits() { unsigned long dwOneByte; - + if(nBits <= 8) { dwBitBuff |= BSWAP_INT16_UNSIGNED(*(unsigned short *)pbInBuffer) << nBits; pbInBuffer += sizeof(unsigned short); nBits += 16; } - + dwOneByte = (dwBitBuff & 0xFF); dwBitBuff >>= 8; nBits -= 8; return dwOneByte; } - + //----------------------------------------------------------------------------- // Functions for huffmann tree items - + // Inserts item into the tree (?) static void InsertItem(THTreeItem ** itemPtr, THTreeItem * item, unsigned long where, THTreeItem * item2) { @@ -191,7 +191,7 @@ static void InsertItem(THTreeItem ** itemPtr, THTreeItem * item, unsigned long w THTreeItem * prev = item->prev; // ESI - prev to the first item THTreeItem * prev2; // Pointer to previous item LONG_PTR next2; // Pointer to the next item - + // The same code like in RemoveItem(item); if(next != 0) // If the first item already has next one { @@ -199,20 +199,20 @@ static void InsertItem(THTreeItem ** itemPtr, THTreeItem * item, unsigned long w prev = PTR_NOT(prev); else prev += (item - next->prev); - + // 150083C1 // Remove the item from the tree prev->next = next; next->prev = prev; - + // Invalidate 'prev' and 'next' pointer item->next = 0; item->prev = 0; } - + if(item2 == NULL) // EDX - If the second item is not entered, item2 = PTR_PTR(&itemPtr[1]); // take the first tree item - + switch(where) { case SWITCH_ITEMS : // Switch the two items @@ -221,68 +221,68 @@ static void InsertItem(THTreeItem ** itemPtr, THTreeItem * item, unsigned long w item2->next->prev = item; item2->next = item; // Set the first item return; - + case INSERT_ITEM: // Insert as the last item item->next = item2; // Set next item (or pointer to pointer to first item) item->prev = item2->prev; // Set prev item (or last item in the tree) - + next2 = PTR_INT(itemPtr[0]);// Usually NULL prev2 = item2->prev; // Prev item to the second (or last tree item) - + if(PTR_INVALID(prev2)) { prev2 = PTR_NOT(prev); - + prev2->next = item; item2->prev = item; // Next after last item return; } - + if(PTR_INVALID(next2)) next2 = (long)(item2 - item2->next->prev); // next2 = (THTreeItem *)(unsigned long)((unsigned char *)item2 - (unsigned char *)(item2->next->prev)); - + // prev2 = (THTreeItem *)((char *)prev2 + (unsigned long)next2);// ??? prev2 += next2; prev2->next = item; item2->prev = item; // Set the next/last item return; - + default: return; } } - + //----------------------------------------------------------------------------- // THuffmannTree class functions - + THuffmannTree::THuffmannTree() { // We have to check if the "this" pointer is less than zero if((LONG_PTR)this < 0) mul = -1; } - + void THuffmannTree::InitTree(bool bCompression) { THTreeItem * pItem; unsigned int nCount; - + // Clear links for all the items in the tree for(pItem = items0008, nCount = 0x203; nCount != 0; pItem++, nCount--) pItem->ClearItemLinks(); - + pItem3050 = NULL; pItem3054 = PTR_PTR(&pItem3054); pItem3058 = PTR_NOT(pItem3054); - + pItem305C = NULL; pFirst = PTR_PTR(&pFirst); pLast = PTR_NOT(pFirst); - + offs0004 = 1; nItems = 0; - + // Clear all TQDecompress items. Do this only if preparing for decompression if(bCompression == false) { @@ -290,7 +290,7 @@ void THuffmannTree::InitTree(bool bCompression) qd3474[nCount].offs00 = 0; } } - + // Builds Huffman tree. Called with the first 8 bits loaded from input stream void THuffmannTree::BuildTree(unsigned int nCmpType) { @@ -299,55 +299,55 @@ void THuffmannTree::BuildTree(unsigned int nCmpType) unsigned char * byteArray; // [ESP+1C] - Pointer to unsigned char in Table1502A630 THTreeItem * child1; unsigned long i; // egcs in linux doesn't like multiple for loops without an explicit i - + // Loop while pointer has a valid value while(PTR_VALID(pLast)) // ESI - Last entry { THTreeItem * temp; // EAX - + if(pLast->next != NULL) // ESI->next pLast->RemoveItem(); // EDI = &offs3054 pItem3058 = PTR_PTR(&pItem3054);// [EDI+4] pLast->prev = pItem3058; // EAX - + temp = PTR_PTR(&pItem3054)->GetPrevItem(PTR_INT(&pItem3050)); - + temp->next = pLast; pItem3054 = pLast; } - + // Clear all pointers in HTree item array memset(items306C, 0, sizeof(items306C)); - + maxByte = 0; // Greatest character found init to zero. itemPtr = (THTreeItem **)&items306C; // Pointer to current entry in HTree item pointer array - + // Ensure we have low 8 bits only nCmpType &= 0xFF; byteArray = Table1502A630 + nCmpType * 258; // EDI also - + for(i = 0; i < 0x100; i++, itemPtr++) { THTreeItem * item = pItem3058; // Item to be created THTreeItem * pItem3 = pItem3058; unsigned char oneByte = byteArray[i]; - + // Skip all the bytes which are zero. if(byteArray[i] == 0) continue; - + // If not valid pointer, take the first available item in the array if(PTR_INVALID_OR_NULL(item)) item = &items0008[nItems++]; - + // Insert this item as the top of the tree InsertItem(&pItem305C, item, SWITCH_ITEMS, NULL); - + item->parent = NULL; // Invalidate child and parent item->child = NULL; *itemPtr = item; // Store pointer into pointer array - + item->dcmpByte = i; // Store counter item->byteValue = oneByte; // Store byte value if(oneByte >= maxByte) @@ -355,7 +355,7 @@ void THuffmannTree::BuildTree(unsigned int nCmpType) maxByte = oneByte; continue; } - + // Find the first item which has byte value greater than current one byte if(PTR_VALID(pItem3 = pLast)) // EDI - Pointer to the last item { @@ -372,35 +372,35 @@ void THuffmannTree::BuildTree(unsigned int nCmpType) } } pItem3 = NULL; - + // 15006B09 _15006B09: if(item->next != NULL) item->RemoveItem(); - + // 15006B15 if(pItem3 == NULL) pItem3 = PTR_PTR(&pFirst); - + // 15006B1F item->next = pItem3->next; item->prev = pItem3->next->prev; pItem3->next->prev = item; pItem3->next = item; } - + // 15006B4A for(; i < 0x102; i++) { THTreeItem ** itemPtr = &items306C[i]; // EDI - + // 15006B59 THTreeItem * item = pItem3058; // ESI if(PTR_INVALID_OR_NULL(item)) item = &items0008[nItems++]; - + InsertItem(&pItem305C, item, INSERT_ITEM, NULL); - + // 15006B89 item->dcmpByte = i; item->byteValue = 1; @@ -408,42 +408,42 @@ void THuffmannTree::BuildTree(unsigned int nCmpType) item->child = NULL; *itemPtr++ = item; } - + // 15006BAA if(PTR_VALID(child1 = pLast)) // EDI - last item (first child to item { THTreeItem * child2; // EBP THTreeItem * item; // ESI - + // 15006BB8 while(PTR_VALID(child2 = child1->prev)) { if(PTR_INVALID_OR_NULL(item = pItem3058)) item = &items0008[nItems++]; - + // 15006BE3 InsertItem(&pItem305C, item, SWITCH_ITEMS, NULL); - + // 15006BF3 item->parent = NULL; item->child = NULL; - + //EDX = child2->byteValue + child1->byteValue; //EAX = child1->byteValue; //ECX = maxByte; // The greatest character (0xFF usually) - + item->byteValue = child1->byteValue + child2->byteValue; // 0x02 item->child = child1; // Prev item in the child1->parent = item; child2->parent = item; - + // EAX = item->byteValue; if(item->byteValue >= maxByte) maxByte = item->byteValue; else { THTreeItem * pItem2 = child2->prev; // EDI - + // 15006C2D while(PTR_VALID(pItem2)) { @@ -452,22 +452,22 @@ void THuffmannTree::BuildTree(unsigned int nCmpType) pItem2 = pItem2->prev; } pItem2 = NULL; - + _15006C3B: if(item->next != 0) { THTreeItem * temp4 = item->GetPrevItem(-1); - + temp4->next = item->next; // The first item changed item->next->prev = item->prev; // First->prev changed to negative value item->next = NULL; item->prev = NULL; } - + // 15006C62 if(pItem2 == NULL) pItem2 = PTR_PTR(&pFirst); - + item->next = pItem2->next; // Set item with 0x100 byte value item->prev = pItem2->next->prev; // Set item with 0x17 byte value pItem2->next->prev = item; // Changed prev of item with @@ -489,48 +489,48 @@ void THuffmannTree::ModifyTree(unsigned long dwIndex) THTreeItem * pItem1 = pItem3058; // ESI THTreeItem * pSaveLast = (PTR_INT(pLast) <= 0) ? NULL : pLast; // EBX THTreeItem * temp; // EAX - + // Prepare the first item to insert to the tree if(PTR_INT(pItem1) <= 0) pItem1 = &items0008[nItems++]; - + // If item has any next item, remove it from the chain if(pItem1->next != NULL) { THTreeItem * temp = pItem1->GetPrevItem(-1); // EAX - + temp->next = pItem1->next; pItem1->next->prev = pItem1->prev; pItem1->next = NULL; pItem1->prev = NULL; } - + pItem1->next = PTR_PTR(&pFirst); pItem1->prev = pLast; temp = pItem1->next->GetPrevItem(PTR_INT(pItem305C)); - + // 150068E9 temp->next = pItem1; pLast = pItem1; - + pItem1->parent = NULL; pItem1->child = NULL; - + // 150068F6 pItem1->dcmpByte = pSaveLast->dcmpByte; // Copy item index pItem1->byteValue = pSaveLast->byteValue; // Copy item byte value pItem1->parent = pSaveLast; // Set parent to last item items306C[pSaveLast->dcmpByte] = pItem1; // Insert item into item pointer array - + // Prepare the second item to insert into the tree if(PTR_INT((pItem1 = pItem3058)) <= 0) pItem1 = &items0008[nItems++]; - + // 1500692E if(pItem1->next != NULL) { temp = pItem1->GetPrevItem(-1); // EAX - + temp->next = pItem1->next; pItem1->next->prev = pItem1->prev; pItem1->next = NULL; @@ -540,11 +540,11 @@ void THuffmannTree::ModifyTree(unsigned long dwIndex) pItem1->next = PTR_PTR(&pFirst); pItem1->prev = pLast; temp = pItem1->next->GetPrevItem(PTR_INT(pItem305C)); - + // 15006968 temp->next = pItem1; pLast = pItem1; - + // 1500696E pItem1->child = NULL; pItem1->dcmpByte = dwIndex; @@ -552,45 +552,45 @@ void THuffmannTree::ModifyTree(unsigned long dwIndex) pItem1->parent = pSaveLast; pSaveLast->child = pItem1; items306C[dwIndex] = pItem1; - + do { THTreeItem * pItem2 = pItem1; THTreeItem * pItem3; unsigned long byteValue; - + // 15006993 byteValue = ++pItem1->byteValue; - + // Pass through all previous which have its value greater than byteValue while(PTR_INT((pItem3 = pItem2->prev)) > 0) // EBX { if(pItem3->byteValue >= byteValue) goto _150069AE; - + pItem2 = pItem2->prev; } // 150069AC pItem3 = NULL; - + _150069AE: if(pItem2 == pItem1) continue; - + // 150069B2 // Switch pItem2 with item InsertItem(&pItem305C, pItem2, SWITCH_ITEMS, pItem1); InsertItem(&pItem305C, pItem1, SWITCH_ITEMS, pItem3); - + // 150069D0 // Switch parents of pItem1 and pItem2 temp = pItem2->parent->child; if(pItem1 == pItem1->parent->child) pItem1->parent->child = pItem2; - + if(pItem2 == temp) pItem2->parent->child = pItem1; - + // 150069ED // Switch parents of pItem1 and pItem3 temp = pItem1->parent; @@ -600,7 +600,7 @@ void THuffmannTree::ModifyTree(unsigned long dwIndex) } while(PTR_INT((pItem1 = pItem1->parent)) > 0); } - + void THuffmannTree::UninitTree() { while(PTR_INT(pLast) > 0) @@ -608,11 +608,11 @@ void THuffmannTree::UninitTree() pItem = pItem305C->Call1501DB70(pLast); pItem->RemoveItem(); } - + for(pItem = pFirst; PTR_INT(pItem3058) > 0; pItem = pItem3058) pItem->RemoveItem(); PTR_PTR(&pItem3054)->RemoveItem(); - + for(pItem = items0008 + 0x203, nCount = 0x203; nCount != 0; nCount--) { pItem--; @@ -621,7 +621,7 @@ void THuffmannTree::UninitTree() } } */ - + THTreeItem * THuffmannTree::Call1500E740(unsigned int nValue) { THTreeItem * pItem1 = pItem3058; // EDX @@ -629,7 +629,7 @@ THTreeItem * THuffmannTree::Call1500E740(unsigned int nValue) THTreeItem * pNext; THTreeItem * pPrev; THTreeItem ** ppItem; - + if(PTR_INVALID_OR_NULL(pItem1) || (pItem2 = pItem1) == NULL) { if((pItem2 = &items0008[nItems++]) != NULL) @@ -639,7 +639,7 @@ THTreeItem * THuffmannTree::Call1500E740(unsigned int nValue) } else pItem1 = pItem2; - + pNext = pItem1->next; if(pNext != NULL) { @@ -648,23 +648,23 @@ THTreeItem * THuffmannTree::Call1500E740(unsigned int nValue) pPrev = PTR_NOT(pPrev); else pPrev += (pItem1 - pItem1->next->prev); - + pPrev->next = pNext; pNext->prev = pPrev; pItem1->next = NULL; pItem1->prev = NULL; } - + ppItem = &pFirst; // esi if(nValue > 1) { // ecx = pFirst->next; pItem1->next = *ppItem; pItem1->prev = (*ppItem)->prev; - + (*ppItem)->prev = pItem2; *ppItem = pItem1; - + pItem2->parent = NULL; pItem2->child = NULL; } @@ -679,7 +679,7 @@ THTreeItem * THuffmannTree::Call1500E740(unsigned int nValue) pPrev = PTR_NOT(pPrev); pPrev->next = pItem1; pPrev->prev = pItem2; - + pItem2->parent = NULL; pItem2->child = NULL; } @@ -689,7 +689,7 @@ THTreeItem * THuffmannTree::Call1500E740(unsigned int nValue) pPrev += (THTreeItem *)ppItem - (*ppItem)->prev; else pPrev += PTR_INT(pItem305C); - + pPrev->next = pItem1; ppItem[1] = pItem2; pItem2->parent = NULL; @@ -698,18 +698,18 @@ THTreeItem * THuffmannTree::Call1500E740(unsigned int nValue) } return pItem2; } - + void THuffmannTree::Call1500E820(THTreeItem * pItem) { THTreeItem * pItem1; // edi THTreeItem * pItem2 = NULL; // eax THTreeItem * pItem3; // edx THTreeItem * pPrev; // ebx - + for(; pItem != NULL; pItem = pItem->parent) { pItem->byteValue++; - + for(pItem1 = pItem; ; pItem1 = pPrev) { pPrev = pItem1->prev; @@ -718,14 +718,14 @@ void THuffmannTree::Call1500E820(THTreeItem * pItem) pPrev = NULL; break; } - + if(pPrev->byteValue >= pItem->byteValue) break; } - + if(pItem1 == pItem) continue; - + if(pItem1->next != NULL) { pItem2 = pItem1->GetPrevItem(-1); @@ -734,7 +734,7 @@ void THuffmannTree::Call1500E820(THTreeItem * pItem) pItem1->next = NULL; pItem1->prev = NULL; } - + pItem2 = pItem->next; pItem1->next = pItem2; pItem1->prev = pItem2->prev; @@ -748,30 +748,30 @@ void THuffmannTree::Call1500E820(THTreeItem * pItem) pItem->next = NULL; pItem->prev = NULL; } - + if(pPrev == NULL) pPrev = PTR_PTR(&pFirst); - + pItem2 = pPrev->next; pItem->next = pItem2; pItem->prev = pItem2->prev; pItem2->prev = pItem; pPrev->next = pItem; - + pItem3 = pItem1->parent->child; pItem2 = pItem->parent; if(pItem2->child == pItem) pItem2->child = pItem1; if(pItem3 == pItem1) pItem1->parent->child = pItem; - + pItem2 = pItem->parent; pItem->parent = pItem1->parent; pItem1->parent = pItem2; offs0004++; } } - + // 1500E920 unsigned int THuffmannTree::DoCompression(TOutputStream * os, unsigned char * pbInBuffer, int nInLength, int nCmpType) { @@ -782,14 +782,14 @@ unsigned int THuffmannTree::DoCompression(TOutputStream * os, unsigned char * pb unsigned long dwBitBuff; unsigned int nBits; unsigned int nBit; - + BuildTree(nCmpType); bIsCmp0 = (nCmpType == 0); - + // Store the compression type into output buffer os->dwBitBuff |= (nCmpType << os->nBits); os->nBits += 8; - + // Flush completed bytes while(os->nBits >= 8) { @@ -798,22 +798,22 @@ unsigned int THuffmannTree::DoCompression(TOutputStream * os, unsigned char * pb *os->pbOutPos++ = (unsigned char)os->dwBitBuff; os->dwOutSize--; } - + os->dwBitBuff >>= 8; os->nBits -= 8; } - + for(; nInLength != 0; nInLength--) { unsigned char bOneByte = *pbInBuffer++; - + if((pItem1 = items306C[bOneByte]) == NULL) { pItem2 = items306C[0x101]; // ecx pItem3 = pItem2->parent; // eax dwBitBuff = 0; nBits = 0; - + for(; pItem3 != NULL; pItem3 = pItem3->parent) { nBit = (pItem3->child != pItem2) ? 1 : 0; @@ -822,11 +822,11 @@ unsigned int THuffmannTree::DoCompression(TOutputStream * os, unsigned char * pb pItem2 = pItem3; } os->PutBits(dwBitBuff, nBits); - + // Store the loaded byte into output stream os->dwBitBuff |= (bOneByte << os->nBits); os->nBits += 8; - + // Flush the whole byte(s) while(os->nBits >= 8) { @@ -838,34 +838,34 @@ unsigned int THuffmannTree::DoCompression(TOutputStream * os, unsigned char * pb os->dwBitBuff >>= 8; os->nBits -= 8; } - + pItem1 = (PTR_INVALID_OR_NULL(pLast)) ? NULL : pLast; pItem2 = Call1500E740(1); pItem2->dcmpByte = pItem1->dcmpByte; pItem2->byteValue = pItem1->byteValue; pItem2->parent = pItem1; items306C[pItem2->dcmpByte] = pItem2; - + pItem2 = Call1500E740(1); pItem2->dcmpByte = bOneByte; pItem2->byteValue = 0; pItem2->parent = pItem1; items306C[pItem2->dcmpByte] = pItem2; pItem1->child = pItem2; - + Call1500E820(pItem2); - + if(bIsCmp0 != 0) { Call1500E820(items306C[bOneByte]); continue; } - + for(pItem1 = items306C[bOneByte]; pItem1 != NULL; pItem1 = pItem1->parent) { pItem1->byteValue++; pItem2 = pItem1; - + for(;;) { pItem3 = pItem2->prev; @@ -878,19 +878,19 @@ unsigned int THuffmannTree::DoCompression(TOutputStream * os, unsigned char * pb break; pItem2 = pItem3; } - + if(pItem2 != pItem1) { InsertItem(&pItem305C, pItem2, SWITCH_ITEMS, pItem1); InsertItem(&pItem305C, pItem1, SWITCH_ITEMS, pItem3); - + pItem3 = pItem2->parent->child; if(pItem1->parent->child == pItem1) pItem1->parent->child = pItem2; - + if(pItem3 == pItem2) pItem2->parent->child = pItem1; - + pTemp = pItem1->parent; pItem1->parent = pItem2->parent; pItem2->parent = pTemp; @@ -912,13 +912,13 @@ unsigned int THuffmannTree::DoCompression(TOutputStream * os, unsigned char * pb } os->PutBits(dwBitBuff, nBits); } - + // 1500EB98 if(bIsCmp0 != 0) Call1500E820(items306C[bOneByte]); // 1500EB9D // 1500EBAF } // for(; nInLength != 0; nInLength--) - + // 1500EBB8 pItem1 = items306C[0x100]; dwBitBuff = 0; @@ -930,10 +930,10 @@ unsigned int THuffmannTree::DoCompression(TOutputStream * os, unsigned char * pb nBits++; pItem1 = pItem2; } - + // 1500EBE6 os->PutBits(dwBitBuff, nBits); - + // 1500EBEF // Flush the remaining bits while(os->nBits != 0) @@ -946,10 +946,10 @@ unsigned int THuffmannTree::DoCompression(TOutputStream * os, unsigned char * pb os->dwBitBuff >>= 8; os->nBits -= ((os->nBits > 8) ? 8 : os->nBits); } - + return (unsigned int)(os->pbOutPos - os->pbOutBuffer); } - + // Decompression using Huffman tree (1500E450) unsigned int THuffmannTree::DoDecompression(unsigned char * pbOutBuffer, unsigned int dwOutLength, TInputStream * is) { @@ -962,29 +962,29 @@ unsigned int THuffmannTree::DoDecompression(unsigned char * pbOutBuffer, unsigne unsigned int n8Bits; // 8 bits loaded from input stream unsigned int n7Bits; // 7 bits loaded from input stream bool bHasQdEntry; - + // Test the output length. Must not be NULL. if(dwOutLength == 0) return 0; - + // Get the compression type from the input stream n8Bits = is->Get8Bits(); - + // Build the Huffman tree - BuildTree(n8Bits); + BuildTree(n8Bits); bIsCmp0 = (n8Bits == 0) ? 1 : 0; - + for(;;) { n7Bits = is->Get7Bits(); // Get 7 bits from input stream - + // Try to use quick decompression. Check TQDecompress array for corresponding item. // If found, ise the result byte instead. qd = &qd3474[n7Bits]; - + // If there is a quick-pass possible (ebx) bHasQdEntry = (qd->offs00 >= offs0004) ? true : false; - + // If we can use quick decompress, use it. if(bHasQdEntry) { @@ -1004,21 +1004,21 @@ unsigned int THuffmannTree::DoDecompression(unsigned char * pbOutBuffer, unsigne pItem1 = pFirst->next->prev; if(PTR_INVALID_OR_NULL(pItem1)) pItem1 = NULL; -_1500E549: +_1500E549: nBitCount = 0; pItem2 = NULL; - + do { pItem1 = pItem1->child; // Move down by one level if(is->GetBit()) // If current bit is set, move to previous pItem1 = pItem1->prev; - + if(++nBitCount == 7) // If we are at 7th bit, save current HTree item. pItem2 = pItem1; } while(pItem1->child != NULL); // Walk until tree has no deeper level - + if(bHasQdEntry == false) { if(nBitCount > 7) @@ -1031,7 +1031,7 @@ _1500E549: { unsigned long nIndex = n7Bits & (0xFFFFFFFF >> (32 - nBitCount)); unsigned long nAdd = (1 << nBitCount); - + for(qd = &qd3474[nIndex]; nIndex <= 0x7F; nIndex += nAdd, qd += nAdd) { qd->offs00 = offs0004; @@ -1042,46 +1042,46 @@ _1500E549: } nDcmpByte = pItem1->dcmpByte; } - + if(nDcmpByte == 0x101) // Huffman tree needs to be modified { n8Bits = is->Get8Bits(); pItem1 = (PTR_INVALID_OR_NULL(pLast)) ? NULL : pLast; - + pItem2 = Call1500E740(1); pItem2->parent = pItem1; pItem2->dcmpByte = pItem1->dcmpByte; pItem2->byteValue = pItem1->byteValue; items306C[pItem2->dcmpByte] = pItem2; - + pItem2 = Call1500E740(1); pItem2->parent = pItem1; pItem2->dcmpByte = n8Bits; pItem2->byteValue = 0; items306C[pItem2->dcmpByte] = pItem2; - + pItem1->child = pItem2; Call1500E820(pItem2); if(bIsCmp0 == 0) Call1500E820(items306C[n8Bits]); - + nDcmpByte = n8Bits; } - + if(nDcmpByte == 0x100) break; - + *pbOutPos++ = (unsigned char)nDcmpByte; if(--dwOutLength == 0) break; - + if(bIsCmp0) Call1500E820(items306C[nDcmpByte]); } - + return (unsigned int)(pbOutPos - pbOutBuffer); } - + /* OLD VERSION unsigned int THuffmannTree::DoDecompression(unsigned char * pbOutBuffer, unsigned int dwOutLength, TInputStream * is) { @@ -1094,38 +1094,38 @@ unsigned int THuffmannTree::DoDecompression(unsigned char * pbOutBuffer, unsigne THTreeItem * temp; // For every use unsigned long dcmpByte = 0; // Decompressed byte value bool bFlag = 0; - + // Test the output length. Must not be NULL. if(dwOutLength == 0) return 0; - + // If too few bits in input bit buffer, we have to load next 16 bits is->EnsureHasMoreThan8Bits(); - + // Get 8 bits from input stream oneByte = is->Get8Bits(); - + // Build the Huffman tree - BuildTree(oneByte); - + BuildTree(oneByte); + bIsCmp0 = (oneByte == 0) ? 1 : 0; outPtr = pbOutBuffer; // Copy pointer to output data - + for(;;) { TQDecompress * qd; // For quick decompress unsigned long sevenBits = is->Get7Bits();// 7 bits from input stream - + // Try to use quick decompression. Check TQDecompress array for corresponding item. // If found, ise the result byte instead. qd = &qd3474[sevenBits]; - + // If there is a quick-pass possible hasQDEntry = (qd->offs00 == offs0004) ? 1 : 0; - + // Start passing the Huffman tree. Set item to tree root item pItem1 = pFirst; - + // If we can use quick decompress, use it. bFlag = 1; if(hasQDEntry == 1) @@ -1152,22 +1152,22 @@ unsigned int THuffmannTree::DoDecompression(unsigned char * pbOutBuffer, unsigne if(PTR_INT(pItem1) <= 0) pItem1 = NULL; } - + if(bFlag == 1) { // Walk through Huffman Tree bitCount = 0; // Clear bit counter do { - pItem1 = pItem1->child; + pItem1 = pItem1->child; if(is->GetBit() != 0) // If current bit is set, move to previous pItem1 = pItem1->prev; // item in current level - + if(++bitCount == 7) // If we are at 7th bit, store current HTree item. itemAt7 = pItem1; // Store Huffman tree item } while(pItem1->child != NULL); // Walk until tree has no deeper level - + // If quick decompress entry is not filled yet, fill it. if(hasQDEntry == 0) { @@ -1178,19 +1178,19 @@ unsigned int THuffmannTree::DoDecompression(unsigned char * pbOutBuffer, unsigne qd->item = itemAt7; // Store item at 7th bit } // If we passed less than 7 bits, fill entry and bit count multipliers - else + else { unsigned long index = sevenBits & (0xFFFFFFFF >> (32 - bitCount)); // Index for quick-decompress entry unsigned long addIndex = (1 << bitCount); // Add value for index - + qd = &qd3474[index]; - + do { qd->offs00 = offs0004; qd->bitCount = bitCount; qd->dcmpByte = pItem1->dcmpByte; - + index += addIndex; qd += addIndex; } @@ -1199,21 +1199,21 @@ unsigned int THuffmannTree::DoDecompression(unsigned char * pbOutBuffer, unsigne } dcmpByte = pItem1->dcmpByte; } - + if(dcmpByte == 0x101) // Huffman tree needs to be modified { // Check if there is enough bits in the buffer is->EnsureHasMoreThan8Bits(); - + // Get 8 bits from the buffer oneByte = is->Get8Bits(); - + // Modify Huffman tree ModifyTree(oneByte); - + // Get lastly added tree item pItem1 = items306C[oneByte]; - + if(bIsCmp0 == 0 && pItem1 != NULL) { // 15006F15 @@ -1222,32 +1222,32 @@ unsigned int THuffmannTree::DoDecompression(unsigned char * pbOutBuffer, unsigne THTreeItem * pItem2 = pItem1; THTreeItem * pItem3; unsigned long byteValue; - + byteValue = ++pItem1->byteValue; - + while(PTR_INT((pItem3 = pItem2->prev)) > 0) { if(pItem3->byteValue >= byteValue) goto _15006F30; - + pItem2 = pItem2->prev; } pItem3 = NULL; - + _15006F30: if(pItem2 == pItem1) continue; - + InsertItem(&pItem305C, pItem2, SWITCH_ITEMS, pItem1); InsertItem(&pItem305C, pItem1, SWITCH_ITEMS, pItem3); - + temp = pItem2->parent->child; if(pItem1 == pItem1->parent->child) pItem1->parent->child = pItem2; - + if(pItem2 == temp) pItem2->parent->child = pItem1; - + // Switch parents of pItem1 and pItem3 temp = pItem1->parent; pItem1->parent = pItem2->parent; @@ -1258,7 +1258,7 @@ unsigned int THuffmannTree::DoDecompression(unsigned char * pbOutBuffer, unsigne } dcmpByte = oneByte; } - + if(dcmpByte != 0x100) // Not at the end of data ? { *outPtr++ = (unsigned char)dcmpByte; @@ -1266,7 +1266,7 @@ unsigned int THuffmannTree::DoDecompression(unsigned char * pbOutBuffer, unsigne { if(bIsCmp0 != 0) Call1500E820(items306C[pItem1->byteValue]); - } + } else break; } @@ -1276,7 +1276,7 @@ unsigned int THuffmannTree::DoDecompression(unsigned char * pbOutBuffer, unsigne return (unsigned long)(outPtr - pbOutBuffer); } */ - + // Table for (de)compression. Every compression type has 258 entries unsigned char THuffmannTree::Table1502A630[] = { @@ -1298,7 +1298,7 @@ unsigned char THuffmannTree::Table1502A630[] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, - + // Data for compression type 0x01 0x54, 0x16, 0x16, 0x0D, 0x0C, 0x08, 0x06, 0x05, 0x06, 0x05, 0x06, 0x03, 0x04, 0x04, 0x03, 0x05, 0x0E, 0x0B, 0x14, 0x13, 0x13, 0x09, 0x0B, 0x06, 0x05, 0x04, 0x03, 0x02, 0x03, 0x02, 0x02, 0x02, @@ -1317,7 +1317,7 @@ unsigned char THuffmannTree::Table1502A630[] = 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x06, 0x4B, 0x00, 0x00, - + // Data for compression type 0x02 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x27, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -1336,7 +1336,7 @@ unsigned char THuffmannTree::Table1502A630[] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - + // Data for compression type 0x03 0xFF, 0x0B, 0x07, 0x05, 0x0B, 0x02, 0x02, 0x02, 0x06, 0x02, 0x02, 0x01, 0x04, 0x02, 0x01, 0x03, 0x09, 0x01, 0x01, 0x01, 0x03, 0x04, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, @@ -1355,7 +1355,7 @@ unsigned char THuffmannTree::Table1502A630[] = 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x11, 0x00, 0x00, - + // Data for compression type 0x04 0xFF, 0xFB, 0x98, 0x9A, 0x84, 0x85, 0x63, 0x64, 0x3E, 0x3E, 0x22, 0x22, 0x13, 0x13, 0x18, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -1374,7 +1374,7 @@ unsigned char THuffmannTree::Table1502A630[] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - + // Data for compression type 0x05 0xFF, 0xF1, 0x9D, 0x9E, 0x9A, 0x9B, 0x9A, 0x97, 0x93, 0x93, 0x8C, 0x8E, 0x86, 0x88, 0x80, 0x82, 0x7C, 0x7C, 0x72, 0x73, 0x69, 0x6B, 0x5F, 0x60, 0x55, 0x56, 0x4A, 0x4B, 0x40, 0x41, 0x37, 0x37, @@ -1393,7 +1393,7 @@ unsigned char THuffmannTree::Table1502A630[] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - + // Data for compression type 0x06 0xC3, 0xCB, 0xF5, 0x41, 0xFF, 0x7B, 0xF7, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -1412,7 +1412,7 @@ unsigned char THuffmannTree::Table1502A630[] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - + // Data for compression type 0x07 0xC3, 0xD9, 0xEF, 0x3D, 0xF9, 0x7C, 0xE9, 0x1E, 0xFD, 0xAB, 0xF1, 0x2C, 0xFC, 0x5B, 0xFE, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -1431,7 +1431,7 @@ unsigned char THuffmannTree::Table1502A630[] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - + // Data for compression type 0x08 0xBA, 0xC5, 0xDA, 0x33, 0xE3, 0x6D, 0xD8, 0x18, 0xE5, 0x94, 0xDA, 0x23, 0xDF, 0x4A, 0xD1, 0x10, 0xEE, 0xAF, 0xE4, 0x2C, 0xEA, 0x5A, 0xDE, 0x15, 0xF4, 0x87, 0xE9, 0x21, 0xF6, 0x43, 0xFC, 0x12, diff --git a/contrib/vmap_extractor_v2/stormlib/huffman/huff.h b/contrib/vmap_extractor_v2/stormlib/huffman/huff.h index f06aa771acd..0deaa2e4a0f 100644 --- a/contrib/vmap_extractor_v2/stormlib/huffman/huff.h +++ b/contrib/vmap_extractor_v2/stormlib/huffman/huff.h @@ -9,67 +9,67 @@ /* 03.05.03 2.00 Lad Added compression */ /* 08.12.03 2.01 Dan High-memory handling (> 0x80000000) */ /*****************************************************************************/ - + #ifndef __HUFFMAN_H__ #define __HUFFMAN_H__ #include "../StormPort.h" - + //----------------------------------------------------------------------------- // Defines - -#define INSERT_ITEM 1 + +#define INSERT_ITEM 1 #define SWITCH_ITEMS 2 // Switch the item1 and item2 - + #define PTR_NOT(ptr) (THTreeItem *)(~(DWORD_PTR)(ptr)) #define PTR_PTR(ptr) ((THTreeItem *)(ptr)) #define PTR_INT(ptr) (LONG_PTR)(ptr) - + #ifndef NULL #define NULL 0 #endif - + //----------------------------------------------------------------------------- // Structures and classes - + // Input stream for Huffmann decompression class TInputStream { public: - + unsigned long GetBit(); unsigned long Get7Bits(); unsigned long Get8Bits(); - + unsigned char * pbInBuffer; // 00 - Input data unsigned long dwBitBuff; // 04 - Input bit buffer unsigned int nBits; // 08 - Number of bits remaining in 'dwValue' }; - + // Output stream for Huffmann compression class TOutputStream { public: - + void PutBits(unsigned long dwBuff, unsigned int nPutBits); - + unsigned char * pbOutBuffer; // 00 : Output buffer unsigned long dwOutSize; // 04 : Size of output buffer unsigned char * pbOutPos; // 08 : Current output position unsigned long dwBitBuff; // 0C : Bit buffer unsigned long nBits; // 10 : Number of bits in the bit buffer }; - + // Huffmann tree item (?) struct THTreeItem { public: - + THTreeItem * Call1501DB70(THTreeItem * pLast); THTreeItem * GetPrevItem(LONG_PTR value); void ClearItemLinks(); void RemoveItem(); - + THTreeItem * next; // 00 - Pointer to next THTreeItem THTreeItem * prev; // 04 - Pointer to prev THTreeItem (< 0 if none) unsigned long dcmpByte; // 08 - Index of this item in item pointer array, decompressed byte value @@ -78,7 +78,7 @@ struct THTreeItem THTreeItem * child; // 14 - Pointer to child THTreeItem int addressMultiplier; // -1 if object on negative address (>0x80000000), +1 if positive }; - + // Structure used for quick decompress. The 'bitCount' contains number of bits // and byte value contains result decompressed byte value. // After each walk through Huffman tree are filled all entries which are @@ -96,47 +96,47 @@ struct TQDecompress THTreeItem * pItem; // 08 - THTreeItem (if number of bits is greater than 7 }; }; - + // Structure for Huffman tree (Size 0x3674 bytes). Because I'm not expert // for the decompression, I do not know actually if the class is really a Hufmann // tree. If someone knows the decompression details, please let me know class THuffmannTree { public: - + THuffmannTree(); void InitTree(bool bCompression); void BuildTree(unsigned int nCmpType); // void ModifyTree(unsigned long dwIndex); // void UninitTree(); - + // void Call15007010(Bit32 dwInLength, THTreeItem * item); THTreeItem * Call1500E740(unsigned int nValue); void Call1500E820(THTreeItem * pItem); unsigned int DoCompression(TOutputStream * os, unsigned char * pbInBuffer, int nInLength, int nCmpType); unsigned int DoDecompression(unsigned char * pbOutBuffer, unsigned int dwOutLength, TInputStream * is); - + unsigned long bIsCmp0; // 0000 - 1 if compression type 0 unsigned long offs0004; // 0004 - Some flag THTreeItem items0008[0x203]; // 0008 - HTree items - + //- Sometimes used as HTree item ----------- THTreeItem * pItem3050; // 3050 - Always NULL (?) THTreeItem * pItem3054; // 3054 - Pointer to Huffman tree item THTreeItem * pItem3058; // 3058 - Pointer to Huffman tree item (< 0 if invalid) - + //- Sometimes used as HTree item ----------- THTreeItem * pItem305C; // 305C - Usually NULL THTreeItem * pFirst; // 3060 - Pointer to top (first) Huffman tree item THTreeItem * pLast; // 3064 - Pointer to bottom (last) Huffman tree item (< 0 if invalid) unsigned long nItems; // 3068 - Number of used HTree items - + //------------------------------------------- THTreeItem * items306C[0x102]; // 306C - THTreeItem pointer array TQDecompress qd3474[0x80]; // 3474 - Array for quick decompression int addressMultiplier; // -1 if object on negative address (>0x80000000), +1 if positive - + static unsigned char Table1502A630[];// Some table }; - + #endif // __HUFFMAN_H__ diff --git a/contrib/vmap_extractor_v2/stormlib/pklib/explode.c b/contrib/vmap_extractor_v2/stormlib/pklib/explode.c index a5b41e3dcf9..8e6825dfcd1 100644 --- a/contrib/vmap_extractor_v2/stormlib/pklib/explode.c +++ b/contrib/vmap_extractor_v2/stormlib/pklib/explode.c @@ -18,7 +18,7 @@ //----------------------------------------------------------------------------- // Tables -static unsigned char DistBits[] = +static unsigned char DistBits[] = { 0x02, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, @@ -26,7 +26,7 @@ static unsigned char DistBits[] = 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 }; -static unsigned char DistCode[] = +static unsigned char DistCode[] = { 0x03, 0x0D, 0x05, 0x19, 0x09, 0x11, 0x01, 0x3E, 0x1E, 0x2E, 0x0E, 0x36, 0x16, 0x26, 0x06, 0x3A, 0x1A, 0x2A, 0x0A, 0x32, 0x12, 0x22, 0x42, 0x02, 0x7C, 0x3C, 0x5C, 0x1C, 0x6C, 0x2C, 0x4C, 0x0C, @@ -75,7 +75,7 @@ static unsigned char ChBitsAsc[] = 0x0D, 0x0D, 0x0C, 0x0C, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D }; -static unsigned short ChCodeAsc[] = +static unsigned short ChCodeAsc[] = { 0x0490, 0x0FE0, 0x07E0, 0x0BE0, 0x03E0, 0x0DE0, 0x05E0, 0x09E0, 0x01E0, 0x00B8, 0x0062, 0x0EE0, 0x06E0, 0x0022, 0x0AE0, 0x02E0, @@ -108,7 +108,7 @@ static unsigned short ChCodeAsc[] = 0x0300, 0x0D40, 0x1D00, 0x0D00, 0x1500, 0x0540, 0x0500, 0x1900, 0x0900, 0x0940, 0x1100, 0x0100, 0x1E00, 0x0E00, 0x0140, 0x1600, 0x0600, 0x1A00, 0x0E40, 0x0640, 0x0A40, 0x0A00, 0x1200, 0x0200, - 0x1C00, 0x0C00, 0x1400, 0x0400, 0x1800, 0x0800, 0x1000, 0x0000 + 0x1C00, 0x0C00, 0x1400, 0x0400, 0x1800, 0x0800, 0x1000, 0x0000 }; //----------------------------------------------------------------------------- @@ -266,11 +266,11 @@ static unsigned long DecodeLit(TDcmpStruct * pWork) { // Skip current bit in the buffer if(WasteBits(pWork, 1)) - return 0x306; + return 0x306; // The next bits are position in buffers value = pWork->position2[(pWork->bit_buff & 0xFF)]; - + // Get number of bits to skip if(WasteBits(pWork, pWork->LenBits[value])) return 0x306; @@ -337,7 +337,7 @@ static unsigned long DecodeLit(TDcmpStruct * pWork) } //----------------------------------------------------------------------------- -// Retrieves the number of bytes to move back +// Retrieves the number of bytes to move back static unsigned long DecodeDist(TDcmpStruct * pWork, unsigned long dwLength) { @@ -402,7 +402,7 @@ static unsigned long Expand(TDcmpStruct * pWork) } else pWork->out_buff[pWork->outputPos++] = (unsigned char)oneByte; - + // If number of extracted bytes has reached 1/2 of output buffer, // flush output buffer. if(pWork->outputPos >= 0x2000) @@ -453,7 +453,7 @@ unsigned int explode( pWork->in_pos = 3; // Position in input buffer // Test for the valid dictionary size - if(4 > pWork->dsize_bits || pWork->dsize_bits > 6) + if(4 > pWork->dsize_bits || pWork->dsize_bits > 6) return CMP_INVALID_DICTSIZE; pWork->dsize_mask = 0xFFFF >> (0x10 - pWork->dsize_bits); // Shifted by 'sar' instruction @@ -475,6 +475,6 @@ unsigned int explode( GenDecodeTabs(0x40, pWork->DistBits, DistCode, pWork->position1); if(Expand(pWork) != 0x306) return CMP_NO_ERROR; - + return CMP_ABORT; } diff --git a/contrib/vmap_extractor_v2/stormlib/pklib/implode.c b/contrib/vmap_extractor_v2/stormlib/pklib/implode.c index 68d5301cc8d..2ffa0f62764 100644 --- a/contrib/vmap_extractor_v2/stormlib/pklib/implode.c +++ b/contrib/vmap_extractor_v2/stormlib/pklib/implode.c @@ -28,7 +28,7 @@ //----------------------------------------------------------------------------- // Tables -static unsigned char DistBits[] = +static unsigned char DistBits[] = { 0x02, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, @@ -36,7 +36,7 @@ static unsigned char DistBits[] = 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 }; -static unsigned char DistCode[] = +static unsigned char DistCode[] = { 0x03, 0x0D, 0x05, 0x19, 0x09, 0x11, 0x01, 0x3E, 0x1E, 0x2E, 0x0E, 0x36, 0x16, 0x26, 0x06, 0x3A, 0x1A, 0x2A, 0x0A, 0x32, 0x12, 0x22, 0x42, 0x02, 0x7C, 0x3C, 0x5C, 0x1C, 0x6C, 0x2C, 0x4C, 0x0C, @@ -79,7 +79,7 @@ static unsigned char ChBitsAsc[] = 0x0D, 0x0D, 0x0C, 0x0C, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D }; -static unsigned short ChCodeAsc[] = +static unsigned short ChCodeAsc[] = { 0x0490, 0x0FE0, 0x07E0, 0x0BE0, 0x03E0, 0x0DE0, 0x05E0, 0x09E0, 0x01E0, 0x00B8, 0x0062, 0x0EE0, 0x06E0, 0x0022, 0x0AE0, 0x02E0, @@ -112,7 +112,7 @@ static unsigned short ChCodeAsc[] = 0x0300, 0x0D40, 0x1D00, 0x0D00, 0x1500, 0x0540, 0x0500, 0x1900, 0x0900, 0x0940, 0x1100, 0x0100, 0x1E00, 0x0E00, 0x0140, 0x1600, 0x0600, 0x1A00, 0x0E40, 0x0640, 0x0A40, 0x0A00, 0x1200, 0x0200, - 0x1C00, 0x0C00, 0x1400, 0x0400, 0x1800, 0x0800, 0x1000, 0x0000 + 0x1C00, 0x0C00, 0x1400, 0x0400, 0x1800, 0x0800, 0x1000, 0x0000 }; //----------------------------------------------------------------------------- @@ -215,7 +215,7 @@ static void OutputBits(TCmpStruct * pWork, unsigned int nbits, unsigned long bit { pWork->out_bytes++; bit_buff >>= (8 - out_bits); - + pWork->out_buff[pWork->out_bytes] = (unsigned char)bit_buff; pWork->out_bits &= 7; } @@ -341,7 +341,7 @@ static unsigned long FindRep(TCmpStruct * pWork, unsigned char * srcbuff) esi = nreps; pin27CC = pWork->work_buff + pin49D0[0] + nreps; esp14 = pin27CC; - + for(;;) // 0040268B { esi = pWork->offs09BC[esi]; @@ -473,7 +473,7 @@ static void WriteCmpData(TCmpStruct * pWork) // switch(esp20) { - case 0: + case 0: SortBuffer(pWork, uncmp_begin, uncmp_end + 1); esp20++; if(pWork->dsize_bytes != 0x1000) @@ -590,7 +590,7 @@ unsigned int PKEXPORT implode( // Initialize the work buffer. This is not in the Pklib, // but it seems to be a bug. Storm always pre-fills the data with zeros, // and always compresses one block only. So the bug will not appear. - // But when a larger data block (size > 0x1000) is compressed, + // But when a larger data block (size > 0x1000) is compressed, // it may fail. memset(pWork, 0, sizeof(TCmpStruct)); @@ -650,7 +650,7 @@ unsigned int PKEXPORT implode( for(i = 0; i < 0x10; i++) { - int nCount2 = 0; // EBX + int nCount2 = 0; // EBX if((1 << ExLenBits[i]) == 0) continue; diff --git a/contrib/vmap_extractor_v2/stormlib/pklib/pklib.h b/contrib/vmap_extractor_v2/stormlib/pklib/pklib.h index 881262e3839..a06bee1de4c 100644 --- a/contrib/vmap_extractor_v2/stormlib/pklib/pklib.h +++ b/contrib/vmap_extractor_v2/stormlib/pklib/pklib.h @@ -29,7 +29,7 @@ // Define calling convention #ifndef PKEXPORT -#define PKEXPORT //__cdecl // Use for normal __cdecl calling +#define PKEXPORT //__cdecl // Use for normal __cdecl calling #endif //#define PKEXPORT __stdcall //#define PKEXPORT __fastcall @@ -40,8 +40,8 @@ // Compression structure typedef struct { - unsigned int offs0000; // 0000 : - unsigned int out_bytes; // 0004 : # bytes available in out_buff + unsigned int offs0000; // 0000 : + unsigned int out_bytes; // 0004 : # bytes available in out_buff unsigned int out_bits; // 0008 : # of bits available in the last out byte unsigned int dsize_bits; // 000C : Dict size : 4=0x400, 5=0x800, 6=0x1000 unsigned int dsize_mask; // 0010 : Dict size : 0x0F=0x400, 0x1F=0x800, 0x3F=0x1000 @@ -49,23 +49,23 @@ typedef struct unsigned int dsize_bytes; // 0018 : Dictionary size in bytes unsigned char dist_bits[0x40]; // 001C : Distance bits unsigned char dist_codes[0x40]; // 005C : Distance codes - unsigned char nChBits[0x306]; // 009C : - unsigned short nChCodes[0x306]; // 03A2 : - unsigned short offs09AE; // 09AE : + unsigned char nChBits[0x306]; // 009C : + unsigned short nChCodes[0x306]; // 03A2 : + unsigned short offs09AE; // 09AE : void * param; // 09B0 : User parameter unsigned int (*read_buf)(char *buf, unsigned int *size, void *param); // 9B4 void (*write_buf)(char *buf, unsigned int *size, void *param); // 9B8 unsigned short offs09BC[0x204]; // 09BC : - unsigned long offs0DC4; // 0DC4 : + unsigned long offs0DC4; // 0DC4 : unsigned short offs0DC8[0x900]; // 0DC8 : - unsigned short offs1FC8; // 1FC8 : + unsigned short offs1FC8; // 1FC8 : char out_buff[0x802]; // 1FCA : Output (compressed) data unsigned char work_buff[0x2204]; // 27CC : Work buffer // + DICT_OFFSET => Dictionary // + UNCMP_OFFSET => Uncompressed data - unsigned short offs49D0[0x2000]; // 49D0 : + unsigned short offs49D0[0x2000]; // 49D0 : } TCmpStruct; #define CMP_BUFFER_SIZE sizeof(TCmpStruct) // Size of compression buffer @@ -91,15 +91,15 @@ typedef struct unsigned char in_buff[0x800]; // 2234 - Buffer for data to be decompressed unsigned char position1[0x100]; // 2A34 - Positions in buffers unsigned char position2[0x100]; // 2B34 - Positions in buffers - unsigned char offs2C34[0x100]; // 2C34 - Buffer for - unsigned char offs2D34[0x100]; // 2D34 - Buffer for - unsigned char offs2E34[0x80]; // 2EB4 - Buffer for - unsigned char offs2EB4[0x100]; // 2EB4 - Buffer for - unsigned char ChBitsAsc[0x100]; // 2FB4 - Buffer for + unsigned char offs2C34[0x100]; // 2C34 - Buffer for + unsigned char offs2D34[0x100]; // 2D34 - Buffer for + unsigned char offs2E34[0x80]; // 2EB4 - Buffer for + unsigned char offs2EB4[0x100]; // 2EB4 - Buffer for + unsigned char ChBitsAsc[0x100]; // 2FB4 - Buffer for unsigned char DistBits[0x40]; // 30B4 - Numbers of bytes to skip copied block length unsigned char LenBits[0x10]; // 30F4 - Numbers of bits for skip copied block length unsigned char ExLenBits[0x10]; // 3104 - Number of valid bits for copied block - unsigned short LenBase[0x10]; // 3114 - Buffer for + unsigned short LenBase[0x10]; // 3114 - Buffer for } TDcmpStruct; #define EXP_BUFFER_SIZE sizeof(TDcmpStruct) // Size of decompress buffer diff --git a/contrib/vmap_extractor_v2/stormlib/wave/wave.cpp b/contrib/vmap_extractor_v2/stormlib/wave/wave.cpp index 936525f4eae..74ab1cd7e72 100644 --- a/contrib/vmap_extractor_v2/stormlib/wave/wave.cpp +++ b/contrib/vmap_extractor_v2/stormlib/wave/wave.cpp @@ -35,8 +35,8 @@ static long Table1503F120[] = { 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0x00000004, 0xFFFFFFFF, 0x00000002, 0xFFFFFFFF, 0x00000006, 0xFFFFFFFF, 0x00000001, 0xFFFFFFFF, 0x00000005, 0xFFFFFFFF, 0x00000003, 0xFFFFFFFF, 0x00000007, - 0xFFFFFFFF, 0x00000001, 0xFFFFFFFF, 0x00000005, 0xFFFFFFFF, 0x00000003, 0xFFFFFFFF, 0x00000007, - 0xFFFFFFFF, 0x00000002, 0xFFFFFFFF, 0x00000004, 0xFFFFFFFF, 0x00000006, 0xFFFFFFFF, 0x00000008 + 0xFFFFFFFF, 0x00000001, 0xFFFFFFFF, 0x00000005, 0xFFFFFFFF, 0x00000003, 0xFFFFFFFF, 0x00000007, + 0xFFFFFFFF, 0x00000002, 0xFFFFFFFF, 0x00000004, 0xFFFFFFFF, 0x00000006, 0xFFFFFFFF, 0x00000008 }; static long Table1503F1A0[] = @@ -112,10 +112,10 @@ int CompressWave(unsigned char * pbOutBuffer, int dwOutLength, short * pwInBuffe nLength = (nLength / 2) - (int)(out.pb - pbOutBuffer); nLength = (nLength < 0) ? 0 : nLength; - + nIndex = nChannels - 1; // edi nWordsRemains = dwInLength / 2; // eax - + // ebx - nChannels // ecx - pwOutPos for(int chnl = nChannels; chnl < nWordsRemains; chnl++) @@ -184,7 +184,7 @@ int CompressWave(unsigned char * pbOutBuffer, int dwOutLength, short * pwInBuffe } if(dwBit == dwStopBit) break; - + nTableValue >>= 1; } @@ -205,7 +205,7 @@ int CompressWave(unsigned char * pbOutBuffer, int dwOutLength, short * pwInBuffe SInt32Array2[nIndex] = nValue; *out.pb++ = (unsigned char)(dwBitBuff | ebx); nTableValue = Table1503F120[dwBitBuff & 0x1F]; - SInt32Array1[nIndex] = SInt32Array1[nIndex] + nTableValue; + SInt32Array1[nIndex] = SInt32Array1[nIndex] + nTableValue; if(SInt32Array1[nIndex] < 0) SInt32Array1[nIndex] = 0; else if(SInt32Array1[nIndex] > 0x58) @@ -280,7 +280,7 @@ int DecompressWave(unsigned char * pbOutBuffer, int dwOutLength, unsigned char * SInt32Array1[nIndex] += 8; if(SInt32Array1[nIndex] > 0x58) SInt32Array1[nIndex] = 0x58; - + if(nChannels == 2) nIndex = (nIndex == 0) ? 1 : 0; break; diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/adler32.c b/contrib/vmap_extractor_v2/stormlib/zlib/adler32.c index fae88b65593..d74de704d62 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/adler32.c +++ b/contrib/vmap_extractor_v2/stormlib/zlib/adler32.c @@ -1,6 +1,6 @@ /* adler32.c -- compute the Adler-32 checksum of a data stream * Copyright (C) 1995-2002 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ @@ -34,12 +34,12 @@ uLong ZEXPORT adler32(adler, buf, len) len -= k; while (k >= 16) { DO16(buf); - buf += 16; + buf += 16; k -= 16; } if (k != 0) do { s1 += *buf++; - s2 += s1; + s2 += s1; } while (--k); s1 %= BASE; s2 %= BASE; diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/compress.c b/contrib/vmap_extractor_v2/stormlib/zlib/compress.c index 814bd9d6061..c44f8ba9dfa 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/compress.c +++ b/contrib/vmap_extractor_v2/stormlib/zlib/compress.c @@ -1,6 +1,6 @@ /* compress.c -- compress a memory buffer * Copyright (C) 1995-2002 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/contrib/asm386/gvmat32c.c b/contrib/vmap_extractor_v2/stormlib/zlib/contrib/asm386/gvmat32c.c index d853bb7ce8a..4ee6051aeb0 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/contrib/asm386/gvmat32c.c +++ b/contrib/vmap_extractor_v2/stormlib/zlib/contrib/asm386/gvmat32c.c @@ -20,7 +20,7 @@ /* if your C compiler don't add underline before function name, - define ADD_UNDERLINE_ASMFUNC */ + define ADD_UNDERLINE_ASMFUNC */ #ifdef ADD_UNDERLINE_ASMFUNC #define longest_match_7fff _longest_match_7fff #endif @@ -46,15 +46,15 @@ uInt longest_match( deflate_state *s, IPos cur_match) /* current match */ { - static uInt iIsPPro=2; + static uInt iIsPPro=2; if ((s->w_mask == 0x7fff) && (iIsPPro==0)) return longest_match_7fff(s,cur_match); - if (iIsPPro==2) - iIsPPro = (((cpudetect32()/0x100)&0xf)>=6) ? 1 : 0; + if (iIsPPro==2) + iIsPPro = (((cpudetect32()/0x100)&0xf)>=6) ? 1 : 0; - return longest_match_c(s,cur_match); + return longest_match_c(s,cur_match); } diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/contrib/iostream/zfstream.cpp b/contrib/vmap_extractor_v2/stormlib/zlib/contrib/iostream/zfstream.cpp index a690bbefceb..e4585cedb02 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/contrib/iostream/zfstream.cpp +++ b/contrib/vmap_extractor_v2/stormlib/zlib/contrib/iostream/zfstream.cpp @@ -17,7 +17,7 @@ gzfilebuf::~gzfilebuf() { } gzfilebuf *gzfilebuf::open( const char *name, - int io_mode ) { + int io_mode ) { if ( is_open() ) return NULL; @@ -58,7 +58,7 @@ gzfilebuf *gzfilebuf::open( const char *name, } gzfilebuf *gzfilebuf::attach( int file_descriptor, - int io_mode ) { + int io_mode ) { if ( is_open() ) return NULL; @@ -151,7 +151,7 @@ int gzfilebuf::underflow() { if ( out_waiting() ) { if ( flushbuf() == EOF ) - return EOF; + return EOF; } } @@ -180,11 +180,11 @@ int gzfilebuf::overflow( int c ) { setg(0,0,0); } else { if (in_avail()) { - return EOF; + return EOF; } if (out_waiting()) { if (flushbuf() == EOF) - return EOF; + return EOF; } } @@ -287,7 +287,7 @@ gzfilebuf *gzfilestream_common::rdbuf() { return &buffer; } - + gzifstream::gzifstream() : ios( gzfilestream_common::rdbuf() ) { diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/contrib/iostream/zfstream.h b/contrib/vmap_extractor_v2/stormlib/zlib/contrib/iostream/zfstream.h index c87fa08e9d1..28675f7ce93 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/contrib/iostream/zfstream.h +++ b/contrib/vmap_extractor_v2/stormlib/zlib/contrib/iostream/zfstream.h @@ -99,9 +99,9 @@ private: }; template gzofstream &operator<<(gzofstream &s, - const gzomanip &m) { + const gzomanip &m) { return (*m.func)(s, m.val); - + } inline gzofstream &setcompressionlevel( gzofstream &s, int l ) { diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/contrib/iostream2/zstream_test.cpp b/contrib/vmap_extractor_v2/stormlib/zlib/contrib/iostream2/zstream_test.cpp index 5bbd56c3ad8..6273f62d62a 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/contrib/iostream2/zstream_test.cpp +++ b/contrib/vmap_extractor_v2/stormlib/zlib/contrib/iostream2/zstream_test.cpp @@ -4,9 +4,9 @@ #include void main() { - char h[256] = "Hello"; - char* g = "Goodbye"; - ozstream out("temp.gz"); + char h[256] = "Hello"; + char* g = "Goodbye"; + ozstream out("temp.gz"); out < "This works well" < h < g; out.close(); diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/contrib/minizip/miniunz.c b/contrib/vmap_extractor_v2/stormlib/zlib/contrib/minizip/miniunz.c index f3b7832878f..741e8dca566 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/contrib/minizip/miniunz.c +++ b/contrib/vmap_extractor_v2/stormlib/zlib/contrib/minizip/miniunz.c @@ -34,9 +34,9 @@ dosdate : the new date at the MSDos format (4 bytes) tmu_date : the SAME new date at the tm_unz format */ void change_file_date(filename,dosdate,tmu_date) - const char *filename; - uLong dosdate; - tm_unz tmu_date; + const char *filename; + uLong dosdate; + tm_unz tmu_date; { #ifdef WIN32 HANDLE hFile; @@ -75,17 +75,17 @@ void change_file_date(filename,dosdate,tmu_date) As I don't know well Unix, I wait feedback for the unix portion */ int mymkdir(dirname) - const char* dirname; + const char* dirname; { int ret=0; #ifdef WIN32 - ret = mkdir(dirname); + ret = mkdir(dirname); #else #ifdef unix - ret = mkdir (dirname,0775); + ret = mkdir (dirname,0775); #endif #endif - return ret; + return ret; } int makedir (newdir) @@ -93,14 +93,14 @@ int makedir (newdir) { char *buffer ; char *p; - int len = strlen(newdir); + int len = strlen(newdir); - if (len <= 0) + if (len <= 0) return 0; buffer = (char*)malloc(len+1); strcpy(buffer,newdir); - + if (buffer[len-1] == '/') { buffer[len-1] = '\0'; } @@ -135,104 +135,104 @@ int makedir (newdir) void do_banner() { - printf("MiniUnz 0.15, demo of zLib + Unz package written by Gilles Vollant\n"); - printf("more info at http://wwww.winimage/zLibDll/unzip.htm\n\n"); + printf("MiniUnz 0.15, demo of zLib + Unz package written by Gilles Vollant\n"); + printf("more info at http://wwww.winimage/zLibDll/unzip.htm\n\n"); } void do_help() -{ - printf("Usage : miniunz [-exvlo] file.zip [file_to_extract]\n\n") ; +{ + printf("Usage : miniunz [-exvlo] file.zip [file_to_extract]\n\n") ; } int do_list(uf) - unzFile uf; + unzFile uf; { - uLong i; - unz_global_info gi; - int err; + uLong i; + unz_global_info gi; + int err; - err = unzGetGlobalInfo (uf,&gi); - if (err!=UNZ_OK) - printf("error %d with zipfile in unzGetGlobalInfo \n",err); + err = unzGetGlobalInfo (uf,&gi); + if (err!=UNZ_OK) + printf("error %d with zipfile in unzGetGlobalInfo \n",err); printf(" Length Method Size Ratio Date Time CRC-32 Name\n"); printf(" ------ ------ ---- ----- ---- ---- ------ ----\n"); - for (i=0;i0) - ratio = (file_info.compressed_size*100)/file_info.uncompressed_size; + for (i=0;i0) + ratio = (file_info.compressed_size*100)/file_info.uncompressed_size; - if (file_info.compression_method==0) - string_method="Stored"; - else - if (file_info.compression_method==Z_DEFLATED) - { - uInt iLevel=(uInt)((file_info.flag & 0x6)/2); - if (iLevel==0) - string_method="Defl:N"; - else if (iLevel==1) - string_method="Defl:X"; - else if ((iLevel==2) || (iLevel==3)) - string_method="Defl:F"; /* 2:fast , 3 : extra fast*/ - } - else - string_method="Unkn. "; + if (file_info.compression_method==0) + string_method="Stored"; + else + if (file_info.compression_method==Z_DEFLATED) + { + uInt iLevel=(uInt)((file_info.flag & 0x6)/2); + if (iLevel==0) + string_method="Defl:N"; + else if (iLevel==1) + string_method="Defl:X"; + else if ((iLevel==2) || (iLevel==3)) + string_method="Defl:F"; /* 2:fast , 3 : extra fast*/ + } + else + string_method="Unkn. "; - printf("%7lu %6s %7lu %3lu%% %2.2lu-%2.2lu-%2.2lu %2.2lu:%2.2lu %8.8lx %s\n", - file_info.uncompressed_size,string_method,file_info.compressed_size, - ratio, - (uLong)file_info.tmu_date.tm_mon + 1, + printf("%7lu %6s %7lu %3lu%% %2.2lu-%2.2lu-%2.2lu %2.2lu:%2.2lu %8.8lx %s\n", + file_info.uncompressed_size,string_method,file_info.compressed_size, + ratio, + (uLong)file_info.tmu_date.tm_mon + 1, (uLong)file_info.tmu_date.tm_mday, - (uLong)file_info.tmu_date.tm_year % 100, - (uLong)file_info.tmu_date.tm_hour,(uLong)file_info.tmu_date.tm_min, - (uLong)file_info.crc,filename_inzip); - if ((i+1)='a') && (rep<='z')) - rep -= 0x20; - } - while ((rep!='Y') && (rep!='N') && (rep!='A')); - } + if (((*popt_overwrite)==0) && (err==UNZ_OK)) + { + char rep; + FILE* ftestexist; + ftestexist = fopen(write_filename,"rb"); + if (ftestexist!=NULL) + { + fclose(ftestexist); + do + { + char answer[128]; + printf("The file %s exist. Overwrite ? [y]es, [n]o, [A]ll: ",write_filename); + scanf("%1s",answer); + rep = answer[0] ; + if ((rep>='a') && (rep<='z')) + rep -= 0x20; + } + while ((rep!='Y') && (rep!='N') && (rep!='A')); + } - if (rep == 'N') - skip = 1; + if (rep == 'N') + skip = 1; - if (rep == 'A') - *popt_overwrite=1; - } + if (rep == 'A') + *popt_overwrite=1; + } - if ((skip==0) && (err==UNZ_OK)) - { - fout=fopen(write_filename,"wb"); + if ((skip==0) && (err==UNZ_OK)) + { + fout=fopen(write_filename,"wb"); /* some zipfile don't contain directory alone before file */ - if ((fout==NULL) && ((*popt_extract_without_path)==0) && + if ((fout==NULL) && ((*popt_extract_without_path)==0) && (filename_withoutpath!=(char*)filename_inzip)) { char c=*(filename_withoutpath-1); @@ -316,94 +316,94 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite) fout=fopen(write_filename,"wb"); } - if (fout==NULL) - { - printf("error opening %s\n",write_filename); - } - } + if (fout==NULL) + { + printf("error opening %s\n",write_filename); + } + } - if (fout!=NULL) - { - printf(" extracting: %s\n",write_filename); + if (fout!=NULL) + { + printf(" extracting: %s\n",write_filename); - do - { - err = unzReadCurrentFile(uf,buf,size_buf); - if (err<0) - { - printf("error %d with zipfile in unzReadCurrentFile\n",err); - break; - } - if (err>0) - if (fwrite(buf,err,1,fout)!=1) - { - printf("error in writing extracted file\n"); + do + { + err = unzReadCurrentFile(uf,buf,size_buf); + if (err<0) + { + printf("error %d with zipfile in unzReadCurrentFile\n",err); + break; + } + if (err>0) + if (fwrite(buf,err,1,fout)!=1) + { + printf("error in writing extracted file\n"); err=UNZ_ERRNO; - break; - } - } - while (err>0); - fclose(fout); - if (err==0) - change_file_date(write_filename,file_info.dosDate, - file_info.tmu_date); - } + break; + } + } + while (err>0); + fclose(fout); + if (err==0) + change_file_date(write_filename,file_info.dosDate, + file_info.tmu_date); + } if (err==UNZ_OK) { - err = unzCloseCurrentFile (uf); - if (err!=UNZ_OK) - { - printf("error %d with zipfile in unzCloseCurrentFile\n",err); - } + err = unzCloseCurrentFile (uf); + if (err!=UNZ_OK) + { + printf("error %d with zipfile in unzCloseCurrentFile\n",err); + } } else - unzCloseCurrentFile(uf); /* don't lose the error */ - } + unzCloseCurrentFile(uf); /* don't lose the error */ + } - free(buf); + free(buf); return err; } int do_extract(uf,opt_extract_without_path,opt_overwrite) - unzFile uf; - int opt_extract_without_path; + unzFile uf; + int opt_extract_without_path; int opt_overwrite; { - uLong i; - unz_global_info gi; - int err; - FILE* fout=NULL; + uLong i; + unz_global_info gi; + int err; + FILE* fout=NULL; - err = unzGetGlobalInfo (uf,&gi); - if (err!=UNZ_OK) - printf("error %d with zipfile in unzGetGlobalInfo \n",err); + err = unzGetGlobalInfo (uf,&gi); + if (err!=UNZ_OK) + printf("error %d with zipfile in unzGetGlobalInfo \n",err); - for (i=0;i='0') && (c<='9')) opt_compress_level = c-'0'; - } - } - else - if (zipfilenamearg == 0) + } + } + else + if (zipfilenamearg == 0) zipfilenamearg = i ; - } - } + } + } size_buf = WRITEBUFFERSIZE; buf = (void*)malloc(size_buf); @@ -172,15 +172,15 @@ int main(argc,argv) return ZIP_INTERNALERROR; } - if (zipfilenamearg==0) + if (zipfilenamearg==0) zipok=0; else - { + { int i,len; int dot_found=0; zipok = 1 ; - strcpy(filename_try,argv[zipfilenamearg]); + strcpy(filename_try,argv[zipfilenamearg]); len=strlen(filename_try); for (i=0;i='a') && (rep<='z')) - rep -= 0x20; - } - while ((rep!='Y') && (rep!='N')); + do + { + char answer[128]; + printf("The file %s exist. Overwrite ? [y]es, [n]o : ",filename_try); + scanf("%1s",answer); + rep = answer[0] ; + if ((rep>='a') && (rep<='z')) + rep -= 0x20; + } + while ((rep!='Y') && (rep!='N')); if (rep=='N') zipok = 0; - } + } } if (zipok==1) @@ -218,7 +218,7 @@ int main(argc,argv) printf("error opening %s\n",filename_try); err= ZIP_ERRNO; } - else + else printf("creating %s\n",filename_try); for (i=zipfilenamearg+1;(i0)); @@ -283,7 +283,7 @@ int main(argc,argv) if (err<0) err=ZIP_ERRNO; else - { + { err = zipCloseFileInZip(zf); if (err!=ZIP_OK) printf("error in closing %s in the zipfile\n", @@ -298,5 +298,5 @@ int main(argc,argv) free(buf); exit(0); - return 0; /* to avoid warning */ + return 0; /* to avoid warning */ } diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/contrib/minizip/unzip.c b/contrib/vmap_extractor_v2/stormlib/zlib/contrib/minizip/unzip.c index ff71a474da1..e41da922fea 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/contrib/minizip/unzip.c +++ b/contrib/vmap_extractor_v2/stormlib/zlib/contrib/minizip/unzip.c @@ -1,4 +1,4 @@ -/* unzip.c -- IO on .zip files using zlib +/* unzip.c -- IO on .zip files using zlib Version 0.15 beta, Mar 19th, 1998, Read unzip.h for more info @@ -83,23 +83,23 @@ typedef struct unz_file_info_internal_s when reading and decompress it */ typedef struct { - char *read_buffer; /* internal buffer for compressed data */ - z_stream stream; /* zLib stream structure for inflate */ + char *read_buffer; /* internal buffer for compressed data */ + z_stream stream; /* zLib stream structure for inflate */ - uLong pos_in_zipfile; /* position in byte on the zipfile, for fseek*/ - uLong stream_initialised; /* flag set if stream structure is initialised*/ + uLong pos_in_zipfile; /* position in byte on the zipfile, for fseek*/ + uLong stream_initialised; /* flag set if stream structure is initialised*/ - uLong offset_local_extrafield;/* offset of the local extra field */ - uInt size_local_extrafield;/* size of the local extra field */ - uLong pos_local_extrafield; /* position in the local extra field in read*/ + uLong offset_local_extrafield;/* offset of the local extra field */ + uInt size_local_extrafield;/* size of the local extra field */ + uLong pos_local_extrafield; /* position in the local extra field in read*/ - uLong crc32; /* crc32 of all data uncompressed */ - uLong crc32_wait; /* crc32 we must obtain after decompress all */ - uLong rest_read_compressed; /* number of byte to be decompressed */ - uLong rest_read_uncompressed;/*number of byte to be obtained after decomp*/ - FILE* file; /* io structore of the zipfile */ - uLong compression_method; /* compression method (0==store) */ - uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ + uLong crc32; /* crc32 of all data uncompressed */ + uLong crc32_wait; /* crc32 we must obtain after decompress all */ + uLong rest_read_compressed; /* number of byte to be decompressed */ + uLong rest_read_uncompressed;/*number of byte to be obtained after decomp*/ + FILE* file; /* io structore of the zipfile */ + uLong compression_method; /* compression method (0==store) */ + uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ } file_in_zip_read_info_s; @@ -107,22 +107,22 @@ typedef struct */ typedef struct { - FILE* file; /* io structore of the zipfile */ - unz_global_info gi; /* public global information */ - uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ - uLong num_file; /* number of the current file in the zipfile*/ - uLong pos_in_central_dir; /* pos of the current file in the central dir*/ - uLong current_file_ok; /* flag about the usability of the current file*/ - uLong central_pos; /* position of the beginning of the central dir*/ + FILE* file; /* io structore of the zipfile */ + unz_global_info gi; /* public global information */ + uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ + uLong num_file; /* number of the current file in the zipfile*/ + uLong pos_in_central_dir; /* pos of the current file in the central dir*/ + uLong current_file_ok; /* flag about the usability of the current file*/ + uLong central_pos; /* position of the beginning of the central dir*/ - uLong size_central_dir; /* size of the central directory */ - uLong offset_central_dir; /* offset of start of central directory with - respect to the starting disk number */ + uLong size_central_dir; /* size of the central directory */ + uLong offset_central_dir; /* offset of start of central directory with + respect to the starting disk number */ - unz_file_info cur_file_info; /* public info about the current file in zip*/ - unz_file_info_internal cur_file_info_internal; /* private info about it*/ + unz_file_info cur_file_info; /* public info about the current file in zip*/ + unz_file_info_internal cur_file_info_internal; /* private info about it*/ file_in_zip_read_info_s* pfile_in_zip_read; /* structure about the current - file if we are decompressing it */ + file if we are decompressing it */ } unz_s; @@ -134,11 +134,11 @@ typedef struct local int unzlocal_getByte(fin,pi) - FILE *fin; - int *pi; + FILE *fin; + int *pi; { unsigned char c; - int err = fread(&c, 1, 1, fin); + int err = fread(&c, 1, 1, fin); if (err==1) { *pi = (int)c; @@ -146,7 +146,7 @@ local int unzlocal_getByte(fin,pi) } else { - if (ferror(fin)) + if (ferror(fin)) return UNZ_ERRNO; else return UNZ_EOF; @@ -155,10 +155,10 @@ local int unzlocal_getByte(fin,pi) /* =========================================================================== - Reads a long in LSB order from the given gz_stream. Sets + Reads a long in LSB order from the given gz_stream. Sets */ local int unzlocal_getShort (fin,pX) - FILE* fin; + FILE* fin; uLong *pX; { uLong x ; @@ -167,11 +167,11 @@ local int unzlocal_getShort (fin,pX) err = unzlocal_getByte(fin,&i); x = (uLong)i; - + if (err==UNZ_OK) err = unzlocal_getByte(fin,&i); x += ((uLong)i)<<8; - + if (err==UNZ_OK) *pX = x; else @@ -180,7 +180,7 @@ local int unzlocal_getShort (fin,pX) } local int unzlocal_getLong (fin,pX) - FILE* fin; + FILE* fin; uLong *pX; { uLong x ; @@ -189,7 +189,7 @@ local int unzlocal_getLong (fin,pX) err = unzlocal_getByte(fin,&i); x = (uLong)i; - + if (err==UNZ_OK) err = unzlocal_getByte(fin,&i); x += ((uLong)i)<<8; @@ -201,7 +201,7 @@ local int unzlocal_getLong (fin,pX) if (err==UNZ_OK) err = unzlocal_getByte(fin,&i); x += ((uLong)i)<<24; - + if (err==UNZ_OK) *pX = x; else @@ -212,26 +212,26 @@ local int unzlocal_getLong (fin,pX) /* My own strcmpi / strcasecmp */ local int strcmpcasenosensitive_internal (fileName1,fileName2) - const char* fileName1; - const char* fileName2; + const char* fileName1; + const char* fileName2; { - for (;;) - { - char c1=*(fileName1++); - char c2=*(fileName2++); - if ((c1>='a') && (c1<='z')) - c1 -= 0x20; - if ((c2>='a') && (c2<='z')) - c2 -= 0x20; - if (c1=='\0') - return ((c2=='\0') ? 0 : -1); - if (c2=='\0') - return 1; - if (c1c2) - return 1; - } + for (;;) + { + char c1=*(fileName1++); + char c2=*(fileName2++); + if ((c1>='a') && (c1<='z')) + c1 -= 0x20; + if ((c2>='a') && (c2<='z')) + c2 -= 0x20; + if (c1=='\0') + return ((c2=='\0') ? 0 : -1); + if (c2=='\0') + return 1; + if (c1c2) + return 1; + } } @@ -245,7 +245,7 @@ local int strcmpcasenosensitive_internal (fileName1,fileName2) #define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal #endif -/* +/* Compare two filename (fileName1,fileName2). If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi @@ -255,18 +255,18 @@ local int strcmpcasenosensitive_internal (fileName1,fileName2) */ extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivity) - const char* fileName1; - const char* fileName2; - int iCaseSensitivity; + const char* fileName1; + const char* fileName2; + int iCaseSensitivity; { - if (iCaseSensitivity==0) - iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE; + if (iCaseSensitivity==0) + iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE; - if (iCaseSensitivity==1) - return strcmp(fileName1,fileName2); + if (iCaseSensitivity==1) + return strcmp(fileName1,fileName2); - return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2); -} + return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2); +} #define BUFREADCOMMENT (0x400) @@ -275,161 +275,161 @@ extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivit the global comment) */ local uLong unzlocal_SearchCentralDir(fin) - FILE *fin; + FILE *fin; { - unsigned char* buf; - uLong uSizeFile; - uLong uBackRead; - uLong uMaxBack=0xffff; /* maximum size of global comment */ - uLong uPosFound=0; - - if (fseek(fin,0,SEEK_END) != 0) - return 0; + unsigned char* buf; + uLong uSizeFile; + uLong uBackRead; + uLong uMaxBack=0xffff; /* maximum size of global comment */ + uLong uPosFound=0; + + if (fseek(fin,0,SEEK_END) != 0) + return 0; - uSizeFile = ftell( fin ); - - if (uMaxBack>uSizeFile) - uMaxBack = uSizeFile; + uSizeFile = ftell( fin ); - buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); - if (buf==NULL) - return 0; + if (uMaxBack>uSizeFile) + uMaxBack = uSizeFile; - uBackRead = 4; - while (uBackReaduMaxBack) - uBackRead = uMaxBack; - else - uBackRead+=BUFREADCOMMENT; - uReadPos = uSizeFile-uBackRead ; - - uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? + buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); + if (buf==NULL) + return 0; + + uBackRead = 4; + while (uBackReaduMaxBack) + uBackRead = uMaxBack; + else + uBackRead+=BUFREADCOMMENT; + uReadPos = uSizeFile-uBackRead ; + + uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? (BUFREADCOMMENT+4) : (uSizeFile-uReadPos); - if (fseek(fin,uReadPos,SEEK_SET)!=0) - break; + if (fseek(fin,uReadPos,SEEK_SET)!=0) + break; - if (fread(buf,(uInt)uReadSize,1,fin)!=1) - break; + if (fread(buf,(uInt)uReadSize,1,fin)!=1) + break; for (i=(int)uReadSize-3; (i--)>0;) - if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && - ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) - { - uPosFound = uReadPos+i; - break; - } + if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && + ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) + { + uPosFound = uReadPos+i; + break; + } - if (uPosFound!=0) - break; - } - TRYFREE(buf); - return uPosFound; + if (uPosFound!=0) + break; + } + TRYFREE(buf); + return uPosFound; } /* Open a Zip file. path contain the full pathname (by example, on a Windows NT computer "c:\\test\\zlib109.zip" or on an Unix computer - "zlib/zlib109.zip". - If the zipfile cannot be opened (file don't exist or in not valid), the - return value is NULL. + "zlib/zlib109.zip". + If the zipfile cannot be opened (file don't exist or in not valid), the + return value is NULL. Else, the return value is a unzFile Handle, usable with other function - of this unzip package. + of this unzip package. */ extern unzFile ZEXPORT unzOpen (path) - const char *path; + const char *path; { - unz_s us; - unz_s *s; - uLong central_pos,uL; - FILE * fin ; + unz_s us; + unz_s *s; + uLong central_pos,uL; + FILE * fin ; - uLong number_disk; /* number of the current dist, used for - spaning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used - for spaning ZIP, unsupported, always 0*/ - uLong number_entry_CD; /* total number of entries in - the central dir - (same than number_entry on nospan) */ + uLong number_disk; /* number of the current dist, used for + spaning ZIP, unsupported, always 0*/ + uLong number_disk_with_CD; /* number the the disk with central dir, used + for spaning ZIP, unsupported, always 0*/ + uLong number_entry_CD; /* total number of entries in + the central dir + (same than number_entry on nospan) */ - int err=UNZ_OK; + int err=UNZ_OK; if (unz_copyright[0]!=' ') return NULL; fin=fopen(path,"rb"); - if (fin==NULL) - return NULL; + if (fin==NULL) + return NULL; - central_pos = unzlocal_SearchCentralDir(fin); - if (central_pos==0) - err=UNZ_ERRNO; + central_pos = unzlocal_SearchCentralDir(fin); + if (central_pos==0) + err=UNZ_ERRNO; - if (fseek(fin,central_pos,SEEK_SET)!=0) - err=UNZ_ERRNO; + if (fseek(fin,central_pos,SEEK_SET)!=0) + err=UNZ_ERRNO; - /* the signature, already checked */ - if (unzlocal_getLong(fin,&uL)!=UNZ_OK) - err=UNZ_ERRNO; + /* the signature, already checked */ + if (unzlocal_getLong(fin,&uL)!=UNZ_OK) + err=UNZ_ERRNO; - /* number of this disk */ - if (unzlocal_getShort(fin,&number_disk)!=UNZ_OK) - err=UNZ_ERRNO; + /* number of this disk */ + if (unzlocal_getShort(fin,&number_disk)!=UNZ_OK) + err=UNZ_ERRNO; - /* number of the disk with the start of the central directory */ - if (unzlocal_getShort(fin,&number_disk_with_CD)!=UNZ_OK) - err=UNZ_ERRNO; + /* number of the disk with the start of the central directory */ + if (unzlocal_getShort(fin,&number_disk_with_CD)!=UNZ_OK) + err=UNZ_ERRNO; - /* total number of entries in the central dir on this disk */ - if (unzlocal_getShort(fin,&us.gi.number_entry)!=UNZ_OK) - err=UNZ_ERRNO; + /* total number of entries in the central dir on this disk */ + if (unzlocal_getShort(fin,&us.gi.number_entry)!=UNZ_OK) + err=UNZ_ERRNO; - /* total number of entries in the central dir */ - if (unzlocal_getShort(fin,&number_entry_CD)!=UNZ_OK) - err=UNZ_ERRNO; + /* total number of entries in the central dir */ + if (unzlocal_getShort(fin,&number_entry_CD)!=UNZ_OK) + err=UNZ_ERRNO; - if ((number_entry_CD!=us.gi.number_entry) || - (number_disk_with_CD!=0) || - (number_disk!=0)) - err=UNZ_BADZIPFILE; + if ((number_entry_CD!=us.gi.number_entry) || + (number_disk_with_CD!=0) || + (number_disk!=0)) + err=UNZ_BADZIPFILE; - /* size of the central directory */ - if (unzlocal_getLong(fin,&us.size_central_dir)!=UNZ_OK) - err=UNZ_ERRNO; + /* size of the central directory */ + if (unzlocal_getLong(fin,&us.size_central_dir)!=UNZ_OK) + err=UNZ_ERRNO; - /* offset of start of central directory with respect to the - starting disk number */ - if (unzlocal_getLong(fin,&us.offset_central_dir)!=UNZ_OK) - err=UNZ_ERRNO; + /* offset of start of central directory with respect to the + starting disk number */ + if (unzlocal_getLong(fin,&us.offset_central_dir)!=UNZ_OK) + err=UNZ_ERRNO; - /* zipfile comment length */ - if (unzlocal_getShort(fin,&us.gi.size_comment)!=UNZ_OK) - err=UNZ_ERRNO; + /* zipfile comment length */ + if (unzlocal_getShort(fin,&us.gi.size_comment)!=UNZ_OK) + err=UNZ_ERRNO; - if ((central_pospfile_in_zip_read!=NULL) unzCloseCurrentFile(file); - fclose(s->file); - TRYFREE(s); - return UNZ_OK; + fclose(s->file); + TRYFREE(s); + return UNZ_OK; } @@ -460,15 +460,15 @@ extern int ZEXPORT unzClose (file) No preparation of the structure is needed return UNZ_OK if there is no problem. */ extern int ZEXPORT unzGetGlobalInfo (file,pglobal_info) - unzFile file; - unz_global_info *pglobal_info; + unzFile file; + unz_global_info *pglobal_info; { - unz_s* s; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - *pglobal_info=s->gi; - return UNZ_OK; + unz_s* s; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz_s*)file; + *pglobal_info=s->gi; + return UNZ_OK; } @@ -495,14 +495,14 @@ local void unzlocal_DosDateToTmuDate (ulDosDate, ptm) */ local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file, unz_file_info *pfile_info, - unz_file_info_internal + unz_file_info_internal *pfile_info_internal, char *szFileName, - uLong fileNameBufferSize, + uLong fileNameBufferSize, void *extraField, - uLong extraFieldBufferSize, + uLong extraFieldBufferSize, char *szComment, - uLong commentBufferSize)); + uLong commentBufferSize)); local int unzlocal_GetCurrentFileInfoInternal (file, pfile_info, @@ -510,156 +510,156 @@ local int unzlocal_GetCurrentFileInfoInternal (file, szFileName, fileNameBufferSize, extraField, extraFieldBufferSize, szComment, commentBufferSize) - unzFile file; - unz_file_info *pfile_info; - unz_file_info_internal *pfile_info_internal; - char *szFileName; - uLong fileNameBufferSize; - void *extraField; - uLong extraFieldBufferSize; - char *szComment; - uLong commentBufferSize; + unzFile file; + unz_file_info *pfile_info; + unz_file_info_internal *pfile_info_internal; + char *szFileName; + uLong fileNameBufferSize; + void *extraField; + uLong extraFieldBufferSize; + char *szComment; + uLong commentBufferSize; { - unz_s* s; - unz_file_info file_info; - unz_file_info_internal file_info_internal; - int err=UNZ_OK; - uLong uMagic; - long lSeek=0; + unz_s* s; + unz_file_info file_info; + unz_file_info_internal file_info_internal; + int err=UNZ_OK; + uLong uMagic; + long lSeek=0; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - if (fseek(s->file,s->pos_in_central_dir+s->byte_before_the_zipfile,SEEK_SET)!=0) - err=UNZ_ERRNO; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz_s*)file; + if (fseek(s->file,s->pos_in_central_dir+s->byte_before_the_zipfile,SEEK_SET)!=0) + err=UNZ_ERRNO; - /* we check the magic */ - if (err==UNZ_OK) - if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK) - err=UNZ_ERRNO; - else if (uMagic!=0x02014b50) - err=UNZ_BADZIPFILE; + /* we check the magic */ + if (err==UNZ_OK) + if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK) + err=UNZ_ERRNO; + else if (uMagic!=0x02014b50) + err=UNZ_BADZIPFILE; - if (unzlocal_getShort(s->file,&file_info.version) != UNZ_OK) - err=UNZ_ERRNO; + if (unzlocal_getShort(s->file,&file_info.version) != UNZ_OK) + err=UNZ_ERRNO; - if (unzlocal_getShort(s->file,&file_info.version_needed) != UNZ_OK) - err=UNZ_ERRNO; + if (unzlocal_getShort(s->file,&file_info.version_needed) != UNZ_OK) + err=UNZ_ERRNO; - if (unzlocal_getShort(s->file,&file_info.flag) != UNZ_OK) - err=UNZ_ERRNO; + if (unzlocal_getShort(s->file,&file_info.flag) != UNZ_OK) + err=UNZ_ERRNO; - if (unzlocal_getShort(s->file,&file_info.compression_method) != UNZ_OK) - err=UNZ_ERRNO; + if (unzlocal_getShort(s->file,&file_info.compression_method) != UNZ_OK) + err=UNZ_ERRNO; - if (unzlocal_getLong(s->file,&file_info.dosDate) != UNZ_OK) - err=UNZ_ERRNO; + if (unzlocal_getLong(s->file,&file_info.dosDate) != UNZ_OK) + err=UNZ_ERRNO; unzlocal_DosDateToTmuDate(file_info.dosDate,&file_info.tmu_date); - if (unzlocal_getLong(s->file,&file_info.crc) != UNZ_OK) - err=UNZ_ERRNO; + if (unzlocal_getLong(s->file,&file_info.crc) != UNZ_OK) + err=UNZ_ERRNO; - if (unzlocal_getLong(s->file,&file_info.compressed_size) != UNZ_OK) - err=UNZ_ERRNO; + if (unzlocal_getLong(s->file,&file_info.compressed_size) != UNZ_OK) + err=UNZ_ERRNO; - if (unzlocal_getLong(s->file,&file_info.uncompressed_size) != UNZ_OK) - err=UNZ_ERRNO; + if (unzlocal_getLong(s->file,&file_info.uncompressed_size) != UNZ_OK) + err=UNZ_ERRNO; - if (unzlocal_getShort(s->file,&file_info.size_filename) != UNZ_OK) - err=UNZ_ERRNO; + if (unzlocal_getShort(s->file,&file_info.size_filename) != UNZ_OK) + err=UNZ_ERRNO; - if (unzlocal_getShort(s->file,&file_info.size_file_extra) != UNZ_OK) - err=UNZ_ERRNO; + if (unzlocal_getShort(s->file,&file_info.size_file_extra) != UNZ_OK) + err=UNZ_ERRNO; - if (unzlocal_getShort(s->file,&file_info.size_file_comment) != UNZ_OK) - err=UNZ_ERRNO; + if (unzlocal_getShort(s->file,&file_info.size_file_comment) != UNZ_OK) + err=UNZ_ERRNO; - if (unzlocal_getShort(s->file,&file_info.disk_num_start) != UNZ_OK) - err=UNZ_ERRNO; + if (unzlocal_getShort(s->file,&file_info.disk_num_start) != UNZ_OK) + err=UNZ_ERRNO; - if (unzlocal_getShort(s->file,&file_info.internal_fa) != UNZ_OK) - err=UNZ_ERRNO; + if (unzlocal_getShort(s->file,&file_info.internal_fa) != UNZ_OK) + err=UNZ_ERRNO; - if (unzlocal_getLong(s->file,&file_info.external_fa) != UNZ_OK) - err=UNZ_ERRNO; + if (unzlocal_getLong(s->file,&file_info.external_fa) != UNZ_OK) + err=UNZ_ERRNO; - if (unzlocal_getLong(s->file,&file_info_internal.offset_curfile) != UNZ_OK) - err=UNZ_ERRNO; + if (unzlocal_getLong(s->file,&file_info_internal.offset_curfile) != UNZ_OK) + err=UNZ_ERRNO; - lSeek+=file_info.size_filename; - if ((err==UNZ_OK) && (szFileName!=NULL)) - { - uLong uSizeRead ; - if (file_info.size_filename0) && (fileNameBufferSize>0)) - if (fread(szFileName,(uInt)uSizeRead,1,s->file)!=1) - err=UNZ_ERRNO; - lSeek -= uSizeRead; - } + if ((file_info.size_filename>0) && (fileNameBufferSize>0)) + if (fread(szFileName,(uInt)uSizeRead,1,s->file)!=1) + err=UNZ_ERRNO; + lSeek -= uSizeRead; + } - - if ((err==UNZ_OK) && (extraField!=NULL)) - { - uLong uSizeRead ; - if (file_info.size_file_extrafile,lSeek,SEEK_CUR)==0) - lSeek=0; - else - err=UNZ_ERRNO; - if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0)) - if (fread(extraField,(uInt)uSizeRead,1,s->file)!=1) - err=UNZ_ERRNO; - lSeek += file_info.size_file_extra - uSizeRead; - } - else - lSeek+=file_info.size_file_extra; + if ((err==UNZ_OK) && (extraField!=NULL)) + { + uLong uSizeRead ; + if (file_info.size_file_extrafile,lSeek,SEEK_CUR)==0) + lSeek=0; + else + err=UNZ_ERRNO; + if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0)) + if (fread(extraField,(uInt)uSizeRead,1,s->file)!=1) + err=UNZ_ERRNO; + lSeek += file_info.size_file_extra - uSizeRead; + } + else + lSeek+=file_info.size_file_extra; - if (lSeek!=0) - if (fseek(s->file,lSeek,SEEK_CUR)==0) - lSeek=0; - else - err=UNZ_ERRNO; - if ((file_info.size_file_comment>0) && (commentBufferSize>0)) - if (fread(szComment,(uInt)uSizeRead,1,s->file)!=1) - err=UNZ_ERRNO; - lSeek+=file_info.size_file_comment - uSizeRead; - } - else - lSeek+=file_info.size_file_comment; - if ((err==UNZ_OK) && (pfile_info!=NULL)) - *pfile_info=file_info; + if ((err==UNZ_OK) && (szComment!=NULL)) + { + uLong uSizeRead ; + if (file_info.size_file_commentfile,lSeek,SEEK_CUR)==0) + lSeek=0; + else + err=UNZ_ERRNO; + if ((file_info.size_file_comment>0) && (commentBufferSize>0)) + if (fread(szComment,(uInt)uSizeRead,1,s->file)!=1) + err=UNZ_ERRNO; + lSeek+=file_info.size_file_comment - uSizeRead; + } + else + lSeek+=file_info.size_file_comment; - return err; + if ((err==UNZ_OK) && (pfile_info!=NULL)) + *pfile_info=file_info; + + if ((err==UNZ_OK) && (pfile_info_internal!=NULL)) + *pfile_info_internal=file_info_internal; + + return err; } @@ -674,19 +674,19 @@ extern int ZEXPORT unzGetCurrentFileInfo (file, szFileName, fileNameBufferSize, extraField, extraFieldBufferSize, szComment, commentBufferSize) - unzFile file; - unz_file_info *pfile_info; - char *szFileName; - uLong fileNameBufferSize; - void *extraField; - uLong extraFieldBufferSize; - char *szComment; - uLong commentBufferSize; + unzFile file; + unz_file_info *pfile_info; + char *szFileName; + uLong fileNameBufferSize; + void *extraField; + uLong extraFieldBufferSize; + char *szComment; + uLong commentBufferSize; { - return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,NULL, - szFileName,fileNameBufferSize, - extraField,extraFieldBufferSize, - szComment,commentBufferSize); + return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,NULL, + szFileName,fileNameBufferSize, + extraField,extraFieldBufferSize, + szComment,commentBufferSize); } /* @@ -694,20 +694,20 @@ extern int ZEXPORT unzGetCurrentFileInfo (file, return UNZ_OK if there is no problem */ extern int ZEXPORT unzGoToFirstFile (file) - unzFile file; + unzFile file; { - int err=UNZ_OK; - unz_s* s; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - s->pos_in_central_dir=s->offset_central_dir; - s->num_file=0; - err=unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info, - &s->cur_file_info_internal, - NULL,0,NULL,0,NULL,0); - s->current_file_ok = (err == UNZ_OK); - return err; + int err=UNZ_OK; + unz_s* s; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz_s*)file; + s->pos_in_central_dir=s->offset_central_dir; + s->num_file=0; + err=unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info, + &s->cur_file_info_internal, + NULL,0,NULL,0,NULL,0); + s->current_file_ok = (err == UNZ_OK); + return err; } @@ -717,27 +717,27 @@ extern int ZEXPORT unzGoToFirstFile (file) return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. */ extern int ZEXPORT unzGoToNextFile (file) - unzFile file; + unzFile file; { - unz_s* s; - int err; + unz_s* s; + int err; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - if (!s->current_file_ok) - return UNZ_END_OF_LIST_OF_FILE; - if (s->num_file+1==s->gi.number_entry) - return UNZ_END_OF_LIST_OF_FILE; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz_s*)file; + if (!s->current_file_ok) + return UNZ_END_OF_LIST_OF_FILE; + if (s->num_file+1==s->gi.number_entry) + return UNZ_END_OF_LIST_OF_FILE; - s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename + - s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ; - s->num_file++; - err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info, - &s->cur_file_info_internal, - NULL,0,NULL,0,NULL,0); - s->current_file_ok = (err == UNZ_OK); - return err; + s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename + + s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ; + s->num_file++; + err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info, + &s->cur_file_info_internal, + NULL,0,NULL,0,NULL,0); + s->current_file_ok = (err == UNZ_OK); + return err; } @@ -750,48 +750,48 @@ extern int ZEXPORT unzGoToNextFile (file) UNZ_END_OF_LIST_OF_FILE if the file is not found */ extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity) - unzFile file; - const char *szFileName; - int iCaseSensitivity; + unzFile file; + const char *szFileName; + int iCaseSensitivity; { - unz_s* s; - int err; - - - uLong num_fileSaved; - uLong pos_in_central_dirSaved; + unz_s* s; + int err; - if (file==NULL) - return UNZ_PARAMERROR; + uLong num_fileSaved; + uLong pos_in_central_dirSaved; + + + if (file==NULL) + return UNZ_PARAMERROR; if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP) return UNZ_PARAMERROR; - s=(unz_s*)file; - if (!s->current_file_ok) - return UNZ_END_OF_LIST_OF_FILE; + s=(unz_s*)file; + if (!s->current_file_ok) + return UNZ_END_OF_LIST_OF_FILE; - num_fileSaved = s->num_file; - pos_in_central_dirSaved = s->pos_in_central_dir; + num_fileSaved = s->num_file; + pos_in_central_dirSaved = s->pos_in_central_dir; - err = unzGoToFirstFile(file); + err = unzGoToFirstFile(file); - while (err == UNZ_OK) - { - char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1]; - unzGetCurrentFileInfo(file,NULL, - szCurrentFileName,sizeof(szCurrentFileName)-1, - NULL,0,NULL,0); - if (unzStringFileNameCompare(szCurrentFileName, - szFileName,iCaseSensitivity)==0) - return UNZ_OK; - err = unzGoToNextFile(file); - } + while (err == UNZ_OK) + { + char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1]; + unzGetCurrentFileInfo(file,NULL, + szCurrentFileName,sizeof(szCurrentFileName)-1, + NULL,0,NULL,0); + if (unzStringFileNameCompare(szCurrentFileName, + szFileName,iCaseSensitivity)==0) + return UNZ_OK; + err = unzGoToNextFile(file); + } - s->num_file = num_fileSaved ; - s->pos_in_central_dir = pos_in_central_dirSaved ; - return err; + s->num_file = num_fileSaved ; + s->pos_in_central_dir = pos_in_central_dirSaved ; + return err; } @@ -803,182 +803,182 @@ extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity) (filename and size of extra field data) */ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar, - poffset_local_extrafield, - psize_local_extrafield) - unz_s* s; - uInt* piSizeVar; - uLong *poffset_local_extrafield; - uInt *psize_local_extrafield; + poffset_local_extrafield, + psize_local_extrafield) + unz_s* s; + uInt* piSizeVar; + uLong *poffset_local_extrafield; + uInt *psize_local_extrafield; { - uLong uMagic,uData,uFlags; - uLong size_filename; - uLong size_extra_field; - int err=UNZ_OK; + uLong uMagic,uData,uFlags; + uLong size_filename; + uLong size_extra_field; + int err=UNZ_OK; - *piSizeVar = 0; - *poffset_local_extrafield = 0; - *psize_local_extrafield = 0; + *piSizeVar = 0; + *poffset_local_extrafield = 0; + *psize_local_extrafield = 0; - if (fseek(s->file,s->cur_file_info_internal.offset_curfile + - s->byte_before_the_zipfile,SEEK_SET)!=0) - return UNZ_ERRNO; + if (fseek(s->file,s->cur_file_info_internal.offset_curfile + + s->byte_before_the_zipfile,SEEK_SET)!=0) + return UNZ_ERRNO; - if (err==UNZ_OK) - if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK) - err=UNZ_ERRNO; - else if (uMagic!=0x04034b50) - err=UNZ_BADZIPFILE; + if (err==UNZ_OK) + if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK) + err=UNZ_ERRNO; + else if (uMagic!=0x04034b50) + err=UNZ_BADZIPFILE; - if (unzlocal_getShort(s->file,&uData) != UNZ_OK) - err=UNZ_ERRNO; + if (unzlocal_getShort(s->file,&uData) != UNZ_OK) + err=UNZ_ERRNO; /* - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion)) - err=UNZ_BADZIPFILE; + else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion)) + err=UNZ_BADZIPFILE; */ - if (unzlocal_getShort(s->file,&uFlags) != UNZ_OK) - err=UNZ_ERRNO; + if (unzlocal_getShort(s->file,&uFlags) != UNZ_OK) + err=UNZ_ERRNO; - if (unzlocal_getShort(s->file,&uData) != UNZ_OK) - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method)) - err=UNZ_BADZIPFILE; + if (unzlocal_getShort(s->file,&uData) != UNZ_OK) + err=UNZ_ERRNO; + else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method)) + err=UNZ_BADZIPFILE; if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) && (s->cur_file_info.compression_method!=Z_DEFLATED)) err=UNZ_BADZIPFILE; - if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* date/time */ - err=UNZ_ERRNO; + if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* date/time */ + err=UNZ_ERRNO; - if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* crc */ - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) && - ((uFlags & 8)==0)) - err=UNZ_BADZIPFILE; + if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* crc */ + err=UNZ_ERRNO; + else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) && + ((uFlags & 8)==0)) + err=UNZ_BADZIPFILE; - if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size compr */ - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) && - ((uFlags & 8)==0)) - err=UNZ_BADZIPFILE; + if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size compr */ + err=UNZ_ERRNO; + else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) && + ((uFlags & 8)==0)) + err=UNZ_BADZIPFILE; - if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size uncompr */ - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && - ((uFlags & 8)==0)) - err=UNZ_BADZIPFILE; + if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size uncompr */ + err=UNZ_ERRNO; + else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && + ((uFlags & 8)==0)) + err=UNZ_BADZIPFILE; - if (unzlocal_getShort(s->file,&size_filename) != UNZ_OK) - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (size_filename!=s->cur_file_info.size_filename)) - err=UNZ_BADZIPFILE; + if (unzlocal_getShort(s->file,&size_filename) != UNZ_OK) + err=UNZ_ERRNO; + else if ((err==UNZ_OK) && (size_filename!=s->cur_file_info.size_filename)) + err=UNZ_BADZIPFILE; - *piSizeVar += (uInt)size_filename; + *piSizeVar += (uInt)size_filename; - if (unzlocal_getShort(s->file,&size_extra_field) != UNZ_OK) - err=UNZ_ERRNO; - *poffset_local_extrafield= s->cur_file_info_internal.offset_curfile + - SIZEZIPLOCALHEADER + size_filename; - *psize_local_extrafield = (uInt)size_extra_field; + if (unzlocal_getShort(s->file,&size_extra_field) != UNZ_OK) + err=UNZ_ERRNO; + *poffset_local_extrafield= s->cur_file_info_internal.offset_curfile + + SIZEZIPLOCALHEADER + size_filename; + *psize_local_extrafield = (uInt)size_extra_field; - *piSizeVar += (uInt)size_extra_field; + *piSizeVar += (uInt)size_extra_field; - return err; + return err; } - + /* Open for reading data the current file in the zipfile. If there is no error and the file is opened, the return value is UNZ_OK. */ extern int ZEXPORT unzOpenCurrentFile (file) - unzFile file; + unzFile file; { - int err=UNZ_OK; - int Store; - uInt iSizeVar; - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - uLong offset_local_extrafield; /* offset of the local extra field */ - uInt size_local_extrafield; /* size of the local extra field */ + int err=UNZ_OK; + int Store; + uInt iSizeVar; + unz_s* s; + file_in_zip_read_info_s* pfile_in_zip_read_info; + uLong offset_local_extrafield; /* offset of the local extra field */ + uInt size_local_extrafield; /* size of the local extra field */ - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - if (!s->current_file_ok) - return UNZ_PARAMERROR; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz_s*)file; + if (!s->current_file_ok) + return UNZ_PARAMERROR; if (s->pfile_in_zip_read != NULL) unzCloseCurrentFile(file); - if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar, - &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK) - return UNZ_BADZIPFILE; + if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar, + &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK) + return UNZ_BADZIPFILE; - pfile_in_zip_read_info = (file_in_zip_read_info_s*) - ALLOC(sizeof(file_in_zip_read_info_s)); - if (pfile_in_zip_read_info==NULL) - return UNZ_INTERNALERROR; + pfile_in_zip_read_info = (file_in_zip_read_info_s*) + ALLOC(sizeof(file_in_zip_read_info_s)); + if (pfile_in_zip_read_info==NULL) + return UNZ_INTERNALERROR; - pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE); - pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield; - pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield; - pfile_in_zip_read_info->pos_local_extrafield=0; + pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE); + pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield; + pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield; + pfile_in_zip_read_info->pos_local_extrafield=0; - if (pfile_in_zip_read_info->read_buffer==NULL) - { - TRYFREE(pfile_in_zip_read_info); - return UNZ_INTERNALERROR; - } + if (pfile_in_zip_read_info->read_buffer==NULL) + { + TRYFREE(pfile_in_zip_read_info); + return UNZ_INTERNALERROR; + } - pfile_in_zip_read_info->stream_initialised=0; - - if ((s->cur_file_info.compression_method!=0) && + pfile_in_zip_read_info->stream_initialised=0; + + if ((s->cur_file_info.compression_method!=0) && (s->cur_file_info.compression_method!=Z_DEFLATED)) - err=UNZ_BADZIPFILE; - Store = s->cur_file_info.compression_method==0; + err=UNZ_BADZIPFILE; + Store = s->cur_file_info.compression_method==0; - pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc; - pfile_in_zip_read_info->crc32=0; - pfile_in_zip_read_info->compression_method = + pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc; + pfile_in_zip_read_info->crc32=0; + pfile_in_zip_read_info->compression_method = s->cur_file_info.compression_method; - pfile_in_zip_read_info->file=s->file; - pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile; + pfile_in_zip_read_info->file=s->file; + pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile; pfile_in_zip_read_info->stream.total_out = 0; - if (!Store) - { - pfile_in_zip_read_info->stream.zalloc = (alloc_func)0; - pfile_in_zip_read_info->stream.zfree = (free_func)0; - pfile_in_zip_read_info->stream.opaque = (voidpf)0; - - err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS); - if (err == Z_OK) - pfile_in_zip_read_info->stream_initialised=1; + if (!Store) + { + pfile_in_zip_read_info->stream.zalloc = (alloc_func)0; + pfile_in_zip_read_info->stream.zfree = (free_func)0; + pfile_in_zip_read_info->stream.opaque = (voidpf)0; + + err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS); + if (err == Z_OK) + pfile_in_zip_read_info->stream_initialised=1; /* windowBits is passed < 0 to tell that there is no zlib header. * Note that in this case inflate *requires* an extra "dummy" byte * after the compressed stream in order to complete decompression and - * return Z_STREAM_END. - * In unzip, i don't wait absolutely Z_STREAM_END because I known the + * return Z_STREAM_END. + * In unzip, i don't wait absolutely Z_STREAM_END because I known the * size of both compressed and uncompressed data */ - } - pfile_in_zip_read_info->rest_read_compressed = + } + pfile_in_zip_read_info->rest_read_compressed = s->cur_file_info.compressed_size ; - pfile_in_zip_read_info->rest_read_uncompressed = + pfile_in_zip_read_info->rest_read_uncompressed = s->cur_file_info.uncompressed_size ; - - pfile_in_zip_read_info->pos_in_zipfile = - s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + - iSizeVar; - - pfile_in_zip_read_info->stream.avail_in = (uInt)0; + + pfile_in_zip_read_info->pos_in_zipfile = + s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + + iSizeVar; + + pfile_in_zip_read_info->stream.avail_in = (uInt)0; - s->pfile_in_zip_read = pfile_in_zip_read_info; + s->pfile_in_zip_read = pfile_in_zip_read_info; return UNZ_OK; } @@ -994,126 +994,126 @@ extern int ZEXPORT unzOpenCurrentFile (file) (UNZ_ERRNO for IO error, or zLib error for uncompress error) */ extern int ZEXPORT unzReadCurrentFile (file, buf, len) - unzFile file; - voidp buf; - unsigned len; + unzFile file; + voidp buf; + unsigned len; { - int err=UNZ_OK; - uInt iRead = 0; - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; + int err=UNZ_OK; + uInt iRead = 0; + unz_s* s; + file_in_zip_read_info_s* pfile_in_zip_read_info; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz_s*)file; pfile_in_zip_read_info=s->pfile_in_zip_read; - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; + if (pfile_in_zip_read_info==NULL) + return UNZ_PARAMERROR; - if ((pfile_in_zip_read_info->read_buffer == NULL)) - return UNZ_END_OF_LIST_OF_FILE; - if (len==0) - return 0; + if ((pfile_in_zip_read_info->read_buffer == NULL)) + return UNZ_END_OF_LIST_OF_FILE; + if (len==0) + return 0; - pfile_in_zip_read_info->stream.next_out = (Bytef*)buf; + pfile_in_zip_read_info->stream.next_out = (Bytef*)buf; - pfile_in_zip_read_info->stream.avail_out = (uInt)len; - - if (len>pfile_in_zip_read_info->rest_read_uncompressed) - pfile_in_zip_read_info->stream.avail_out = - (uInt)pfile_in_zip_read_info->rest_read_uncompressed; + pfile_in_zip_read_info->stream.avail_out = (uInt)len; - while (pfile_in_zip_read_info->stream.avail_out>0) - { - if ((pfile_in_zip_read_info->stream.avail_in==0) && + if (len>pfile_in_zip_read_info->rest_read_uncompressed) + pfile_in_zip_read_info->stream.avail_out = + (uInt)pfile_in_zip_read_info->rest_read_uncompressed; + + while (pfile_in_zip_read_info->stream.avail_out>0) + { + if ((pfile_in_zip_read_info->stream.avail_in==0) && (pfile_in_zip_read_info->rest_read_compressed>0)) - { - uInt uReadThis = UNZ_BUFSIZE; - if (pfile_in_zip_read_info->rest_read_compressedrest_read_compressed; - if (uReadThis == 0) - return UNZ_EOF; - if (fseek(pfile_in_zip_read_info->file, - pfile_in_zip_read_info->pos_in_zipfile + + { + uInt uReadThis = UNZ_BUFSIZE; + if (pfile_in_zip_read_info->rest_read_compressedrest_read_compressed; + if (uReadThis == 0) + return UNZ_EOF; + if (fseek(pfile_in_zip_read_info->file, + pfile_in_zip_read_info->pos_in_zipfile + pfile_in_zip_read_info->byte_before_the_zipfile,SEEK_SET)!=0) - return UNZ_ERRNO; - if (fread(pfile_in_zip_read_info->read_buffer,uReadThis,1, + return UNZ_ERRNO; + if (fread(pfile_in_zip_read_info->read_buffer,uReadThis,1, pfile_in_zip_read_info->file)!=1) - return UNZ_ERRNO; - pfile_in_zip_read_info->pos_in_zipfile += uReadThis; + return UNZ_ERRNO; + pfile_in_zip_read_info->pos_in_zipfile += uReadThis; - pfile_in_zip_read_info->rest_read_compressed-=uReadThis; - - pfile_in_zip_read_info->stream.next_in = + pfile_in_zip_read_info->rest_read_compressed-=uReadThis; + + pfile_in_zip_read_info->stream.next_in = (Bytef*)pfile_in_zip_read_info->read_buffer; - pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis; - } + pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis; + } - if (pfile_in_zip_read_info->compression_method==0) - { - uInt uDoCopy,i ; - if (pfile_in_zip_read_info->stream.avail_out < + if (pfile_in_zip_read_info->compression_method==0) + { + uInt uDoCopy,i ; + if (pfile_in_zip_read_info->stream.avail_out < pfile_in_zip_read_info->stream.avail_in) - uDoCopy = pfile_in_zip_read_info->stream.avail_out ; - else - uDoCopy = pfile_in_zip_read_info->stream.avail_in ; - - for (i=0;istream.next_out+i) = + uDoCopy = pfile_in_zip_read_info->stream.avail_out ; + else + uDoCopy = pfile_in_zip_read_info->stream.avail_in ; + + for (i=0;istream.next_out+i) = *(pfile_in_zip_read_info->stream.next_in+i); - - pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32, - pfile_in_zip_read_info->stream.next_out, - uDoCopy); - pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy; - pfile_in_zip_read_info->stream.avail_in -= uDoCopy; - pfile_in_zip_read_info->stream.avail_out -= uDoCopy; - pfile_in_zip_read_info->stream.next_out += uDoCopy; - pfile_in_zip_read_info->stream.next_in += uDoCopy; + + pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32, + pfile_in_zip_read_info->stream.next_out, + uDoCopy); + pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy; + pfile_in_zip_read_info->stream.avail_in -= uDoCopy; + pfile_in_zip_read_info->stream.avail_out -= uDoCopy; + pfile_in_zip_read_info->stream.next_out += uDoCopy; + pfile_in_zip_read_info->stream.next_in += uDoCopy; pfile_in_zip_read_info->stream.total_out += uDoCopy; - iRead += uDoCopy; - } - else - { - uLong uTotalOutBefore,uTotalOutAfter; - const Bytef *bufBefore; - uLong uOutThis; - int flush=Z_SYNC_FLUSH; + iRead += uDoCopy; + } + else + { + uLong uTotalOutBefore,uTotalOutAfter; + const Bytef *bufBefore; + uLong uOutThis; + int flush=Z_SYNC_FLUSH; - uTotalOutBefore = pfile_in_zip_read_info->stream.total_out; - bufBefore = pfile_in_zip_read_info->stream.next_out; + uTotalOutBefore = pfile_in_zip_read_info->stream.total_out; + bufBefore = pfile_in_zip_read_info->stream.next_out; - /* - if ((pfile_in_zip_read_info->rest_read_uncompressed == - pfile_in_zip_read_info->stream.avail_out) && - (pfile_in_zip_read_info->rest_read_compressed == 0)) - flush = Z_FINISH; - */ - err=inflate(&pfile_in_zip_read_info->stream,flush); + /* + if ((pfile_in_zip_read_info->rest_read_uncompressed == + pfile_in_zip_read_info->stream.avail_out) && + (pfile_in_zip_read_info->rest_read_compressed == 0)) + flush = Z_FINISH; + */ + err=inflate(&pfile_in_zip_read_info->stream,flush); - uTotalOutAfter = pfile_in_zip_read_info->stream.total_out; - uOutThis = uTotalOutAfter-uTotalOutBefore; - - pfile_in_zip_read_info->crc32 = + uTotalOutAfter = pfile_in_zip_read_info->stream.total_out; + uOutThis = uTotalOutAfter-uTotalOutBefore; + + pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,bufBefore, (uInt)(uOutThis)); - pfile_in_zip_read_info->rest_read_uncompressed -= + pfile_in_zip_read_info->rest_read_uncompressed -= uOutThis; - iRead += (uInt)(uTotalOutAfter - uTotalOutBefore); - - if (err==Z_STREAM_END) - return (iRead==0) ? UNZ_EOF : iRead; - if (err!=Z_OK) - break; - } - } + iRead += (uInt)(uTotalOutAfter - uTotalOutBefore); - if (err==Z_OK) - return iRead; - return err; + if (err==Z_STREAM_END) + return (iRead==0) ? UNZ_EOF : iRead; + if (err!=Z_OK) + break; + } + } + + if (err==Z_OK) + return iRead; + return err; } @@ -1121,42 +1121,42 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len) Give the current position in uncompressed data */ extern z_off_t ZEXPORT unztell (file) - unzFile file; + unzFile file; { - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; + unz_s* s; + file_in_zip_read_info_s* pfile_in_zip_read_info; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz_s*)file; pfile_in_zip_read_info=s->pfile_in_zip_read; - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; + if (pfile_in_zip_read_info==NULL) + return UNZ_PARAMERROR; - return (z_off_t)pfile_in_zip_read_info->stream.total_out; + return (z_off_t)pfile_in_zip_read_info->stream.total_out; } /* - return 1 if the end of file was reached, 0 elsewhere + return 1 if the end of file was reached, 0 elsewhere */ extern int ZEXPORT unzeof (file) - unzFile file; + unzFile file; { - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; + unz_s* s; + file_in_zip_read_info_s* pfile_in_zip_read_info; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz_s*)file; pfile_in_zip_read_info=s->pfile_in_zip_read; - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; - - if (pfile_in_zip_read_info->rest_read_uncompressed == 0) - return 1; - else - return 0; + if (pfile_in_zip_read_info==NULL) + return UNZ_PARAMERROR; + + if (pfile_in_zip_read_info->rest_read_uncompressed == 0) + return 1; + else + return 0; } @@ -1169,51 +1169,51 @@ extern int ZEXPORT unzeof (file) if buf==NULL, it return the size of the local extra field that can be read if buf!=NULL, len is the size of the buffer, the extra header is copied in - buf. - the return value is the number of bytes copied in buf, or (if <0) - the error code + buf. + the return value is the number of bytes copied in buf, or (if <0) + the error code */ extern int ZEXPORT unzGetLocalExtrafield (file,buf,len) - unzFile file; - voidp buf; - unsigned len; + unzFile file; + voidp buf; + unsigned len; { - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - uInt read_now; - uLong size_to_read; + unz_s* s; + file_in_zip_read_info_s* pfile_in_zip_read_info; + uInt read_now; + uLong size_to_read; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz_s*)file; pfile_in_zip_read_info=s->pfile_in_zip_read; - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; + if (pfile_in_zip_read_info==NULL) + return UNZ_PARAMERROR; - size_to_read = (pfile_in_zip_read_info->size_local_extrafield - - pfile_in_zip_read_info->pos_local_extrafield); + size_to_read = (pfile_in_zip_read_info->size_local_extrafield - + pfile_in_zip_read_info->pos_local_extrafield); - if (buf==NULL) - return (int)size_to_read; - - if (len>size_to_read) - read_now = (uInt)size_to_read; - else - read_now = (uInt)len ; + if (buf==NULL) + return (int)size_to_read; - if (read_now==0) - return 0; - - if (fseek(pfile_in_zip_read_info->file, - pfile_in_zip_read_info->offset_local_extrafield + - pfile_in_zip_read_info->pos_local_extrafield,SEEK_SET)!=0) - return UNZ_ERRNO; + if (len>size_to_read) + read_now = (uInt)size_to_read; + else + read_now = (uInt)len ; - if (fread(buf,(uInt)size_to_read,1,pfile_in_zip_read_info->file)!=1) - return UNZ_ERRNO; + if (read_now==0) + return 0; - return (int)read_now; + if (fseek(pfile_in_zip_read_info->file, + pfile_in_zip_read_info->offset_local_extrafield + + pfile_in_zip_read_info->pos_local_extrafield,SEEK_SET)!=0) + return UNZ_ERRNO; + + if (fread(buf,(uInt)size_to_read,1,pfile_in_zip_read_info->file)!=1) + return UNZ_ERRNO; + + return (int)read_now; } /* @@ -1221,39 +1221,39 @@ extern int ZEXPORT unzGetLocalExtrafield (file,buf,len) Return UNZ_CRCERROR if all the file was read but the CRC is not good */ extern int ZEXPORT unzCloseCurrentFile (file) - unzFile file; + unzFile file; { - int err=UNZ_OK; + int err=UNZ_OK; - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; + unz_s* s; + file_in_zip_read_info_s* pfile_in_zip_read_info; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz_s*)file; pfile_in_zip_read_info=s->pfile_in_zip_read; - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; + if (pfile_in_zip_read_info==NULL) + return UNZ_PARAMERROR; - if (pfile_in_zip_read_info->rest_read_uncompressed == 0) - { - if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait) - err=UNZ_CRCERROR; - } + if (pfile_in_zip_read_info->rest_read_uncompressed == 0) + { + if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait) + err=UNZ_CRCERROR; + } - TRYFREE(pfile_in_zip_read_info->read_buffer); - pfile_in_zip_read_info->read_buffer = NULL; - if (pfile_in_zip_read_info->stream_initialised) - inflateEnd(&pfile_in_zip_read_info->stream); + TRYFREE(pfile_in_zip_read_info->read_buffer); + pfile_in_zip_read_info->read_buffer = NULL; + if (pfile_in_zip_read_info->stream_initialised) + inflateEnd(&pfile_in_zip_read_info->stream); - pfile_in_zip_read_info->stream_initialised = 0; - TRYFREE(pfile_in_zip_read_info); + pfile_in_zip_read_info->stream_initialised = 0; + TRYFREE(pfile_in_zip_read_info); s->pfile_in_zip_read=NULL; - return err; + return err; } @@ -1263,32 +1263,32 @@ extern int ZEXPORT unzCloseCurrentFile (file) return the number of byte copied or an error code <0 */ extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf) - unzFile file; - char *szComment; - uLong uSizeBuf; + unzFile file; + char *szComment; + uLong uSizeBuf; { - int err=UNZ_OK; - unz_s* s; - uLong uReadThis ; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; + int err=UNZ_OK; + unz_s* s; + uLong uReadThis ; + if (file==NULL) + return UNZ_PARAMERROR; + s=(unz_s*)file; - uReadThis = uSizeBuf; - if (uReadThis>s->gi.size_comment) - uReadThis = s->gi.size_comment; + uReadThis = uSizeBuf; + if (uReadThis>s->gi.size_comment) + uReadThis = s->gi.size_comment; - if (fseek(s->file,s->central_pos+22,SEEK_SET)!=0) - return UNZ_ERRNO; + if (fseek(s->file,s->central_pos+22,SEEK_SET)!=0) + return UNZ_ERRNO; - if (uReadThis>0) + if (uReadThis>0) { *szComment='\0'; - if (fread(szComment,(uInt)uReadThis,1,s->file)!=1) - return UNZ_ERRNO; + if (fread(szComment,(uInt)uReadThis,1,s->file)!=1) + return UNZ_ERRNO; } - if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment)) - *(szComment+s->gi.size_comment)='\0'; - return (int)uReadThis; + if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment)) + *(szComment+s->gi.size_comment)='\0'; + return (int)uReadThis; } diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/contrib/minizip/unzip.h b/contrib/vmap_extractor_v2/stormlib/zlib/contrib/minizip/unzip.h index 76692cb703c..a4bd3596f8b 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/contrib/minizip/unzip.h +++ b/contrib/vmap_extractor_v2/stormlib/zlib/contrib/minizip/unzip.h @@ -1,4 +1,4 @@ -/* unzip.h -- IO for uncompress .zip files using zlib +/* unzip.h -- IO for uncompress .zip files using zlib Version 0.15 beta, Mar 19th, 1998, Copyright (C) 1998 Gilles Vollant @@ -33,7 +33,7 @@ */ -/* for more info about .ZIP format, see +/* for more info about .ZIP format, see ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip PkWare has also a specification at : ftp://ftp.pkware.com/probdesc.zip */ @@ -52,7 +52,7 @@ extern "C" { #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) /* like the STRICT of WIN32, we define a pointer that cannot be converted from (void*) without cast */ -typedef struct TagunzFile__ { int unused; } unzFile__; +typedef struct TagunzFile__ { int unused; } unzFile__; typedef unzFile__ *unzFile; #else typedef voidp unzFile; @@ -69,23 +69,23 @@ typedef voidp unzFile; #define UNZ_CRCERROR (-105) /* tm_unz contain date/time info */ -typedef struct tm_unz_s +typedef struct tm_unz_s { - uInt tm_sec; /* seconds after the minute - [0,59] */ - uInt tm_min; /* minutes after the hour - [0,59] */ - uInt tm_hour; /* hours since midnight - [0,23] */ - uInt tm_mday; /* day of the month - [1,31] */ - uInt tm_mon; /* months since January - [0,11] */ - uInt tm_year; /* years - [1980..2044] */ + uInt tm_sec; /* seconds after the minute - [0,59] */ + uInt tm_min; /* minutes after the hour - [0,59] */ + uInt tm_hour; /* hours since midnight - [0,23] */ + uInt tm_mday; /* day of the month - [1,31] */ + uInt tm_mon; /* months since January - [0,11] */ + uInt tm_year; /* years - [1980..2044] */ } tm_unz; /* unz_global_info structure contain global data about the ZIPfile These data comes from the end of central dir */ typedef struct unz_global_info_s { - uLong number_entry; /* total number of entries in - the central dir on this disk */ - uLong size_comment; /* size of the global comment of the zipfile */ + uLong number_entry; /* total number of entries in + the central dir on this disk */ + uLong size_comment; /* size of the global comment of the zipfile */ } unz_global_info; @@ -98,8 +98,8 @@ typedef struct unz_file_info_s uLong compression_method; /* compression method 2 bytes */ uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ uLong crc; /* crc-32 4 bytes */ - uLong compressed_size; /* compressed size 4 bytes */ - uLong uncompressed_size; /* uncompressed size 4 bytes */ + uLong compressed_size; /* compressed size 4 bytes */ + uLong uncompressed_size; /* uncompressed size 4 bytes */ uLong size_filename; /* filename length 2 bytes */ uLong size_file_extra; /* extra field length 2 bytes */ uLong size_file_comment; /* file comment length 2 bytes */ @@ -112,15 +112,15 @@ typedef struct unz_file_info_s } unz_file_info; extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, - const char* fileName2, - int iCaseSensitivity)); + const char* fileName2, + int iCaseSensitivity)); /* Compare two filename (fileName1,fileName2). If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi - or strcasecmp) + or strcasecmp) If iCaseSenisivity = 0, case sensitivity is defaut of your operating system - (like 1 on Unix, 2 on Windows) + (like 1 on Unix, 2 on Windows) */ @@ -128,11 +128,11 @@ extern unzFile ZEXPORT unzOpen OF((const char *path)); /* Open a Zip file. path contain the full pathname (by example, on a Windows NT computer "c:\\zlib\\zlib111.zip" or on an Unix computer - "zlib/zlib111.zip". - If the zipfile cannot be opened (file don't exist or in not valid), the - return value is NULL. + "zlib/zlib111.zip". + If the zipfile cannot be opened (file don't exist or in not valid), the + return value is NULL. Else, the return value is a unzFile Handle, usable with other function - of this unzip package. + of this unzip package. */ extern int ZEXPORT unzClose OF((unzFile file)); @@ -143,7 +143,7 @@ extern int ZEXPORT unzClose OF((unzFile file)); return UNZ_OK if there is no problem. */ extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, - unz_global_info *pglobal_info)); + unz_global_info *pglobal_info)); /* Write info about the ZipFile in the *pglobal_info structure. No preparation of the structure is needed @@ -151,8 +151,8 @@ extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, extern int ZEXPORT unzGetGlobalComment OF((unzFile file, - char *szComment, - uLong uSizeBuf)); + char *szComment, + uLong uSizeBuf)); /* Get the global comment string of the ZipFile, in the szComment buffer. uSizeBuf is the size of the szComment buffer. @@ -176,9 +176,9 @@ extern int ZEXPORT unzGoToNextFile OF((unzFile file)); return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. */ -extern int ZEXPORT unzLocateFile OF((unzFile file, - const char *szFileName, - int iCaseSensitivity)); +extern int ZEXPORT unzLocateFile OF((unzFile file, + const char *szFileName, + int iCaseSensitivity)); /* Try locate the file szFileName in the zipfile. For the iCaseSensitivity signification, see unzStringFileNameCompare @@ -190,24 +190,24 @@ extern int ZEXPORT unzLocateFile OF((unzFile file, extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, - unz_file_info *pfile_info, - char *szFileName, - uLong fileNameBufferSize, - void *extraField, - uLong extraFieldBufferSize, - char *szComment, - uLong commentBufferSize)); + unz_file_info *pfile_info, + char *szFileName, + uLong fileNameBufferSize, + void *extraField, + uLong extraFieldBufferSize, + char *szComment, + uLong commentBufferSize)); /* Get Info about the current file if pfile_info!=NULL, the *pfile_info structure will contain somes info about - the current file + the current file if szFileName!=NULL, the filemane string will be copied in szFileName - (fileNameBufferSize is the size of the buffer) + (fileNameBufferSize is the size of the buffer) if extraField!=NULL, the extra field information will be copied in extraField - (extraFieldBufferSize is the size of the buffer). - This is the Central-header version of the extra field + (extraFieldBufferSize is the size of the buffer). + This is the Central-header version of the extra field if szComment!=NULL, the comment string of the file will be copied in szComment - (commentBufferSize is the size of the buffer) + (commentBufferSize is the size of the buffer) */ /***************************************************************************/ @@ -227,10 +227,10 @@ extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); Return UNZ_CRCERROR if all the file was read but the CRC is not good */ - -extern int ZEXPORT unzReadCurrentFile OF((unzFile file, - voidp buf, - unsigned len)); + +extern int ZEXPORT unzReadCurrentFile OF((unzFile file, + voidp buf, + unsigned len)); /* Read bytes from the current file (opened by unzOpenCurrentFile) buf contain buffer where data must be copied @@ -249,12 +249,12 @@ extern z_off_t ZEXPORT unztell OF((unzFile file)); extern int ZEXPORT unzeof OF((unzFile file)); /* - return 1 if the end of file was reached, 0 elsewhere + return 1 if the end of file was reached, 0 elsewhere */ extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, - voidp buf, - unsigned len)); + voidp buf, + unsigned len)); /* Read extra field from the current file (opened by unzOpenCurrentFile) This is the local-header version of the extra field (sometimes, there is @@ -263,9 +263,9 @@ extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, if buf==NULL, it return the size of the local extra field if buf!=NULL, len is the size of the buffer, the extra header is copied in - buf. - the return value is the number of bytes copied in buf, or (if <0) - the error code + buf. + the return value is the number of bytes copied in buf, or (if <0) + the error code */ #ifdef __cplusplus diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/contrib/minizip/zip.c b/contrib/vmap_extractor_v2/stormlib/zlib/contrib/minizip/zip.c index 0cae64ab7b1..25abe71f88c 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/contrib/minizip/zip.c +++ b/contrib/vmap_extractor_v2/stormlib/zlib/contrib/minizip/zip.c @@ -1,4 +1,4 @@ -/* zip.c -- IO on .zip files using zlib +/* zip.c -- IO on .zip files using zlib Version 0.15 beta, Mar 19th, 1998, Read zip.h for more info @@ -99,11 +99,11 @@ typedef struct linkedlist_data_s typedef struct { - z_stream stream; /* zLib stream structure for inflate */ + z_stream stream; /* zLib stream structure for inflate */ int stream_initialised; /* 1 is stream is initialised */ uInt pos_in_buffered_data; /* last written byte in buffered_data */ - uLong pos_local_header; /* offset of the local header of the file + uLong pos_local_header; /* offset of the local header of the file currenty writing */ char* central_header; /* central header data for the current file */ uLong size_centralheader; /* size of the central header for cur file */ @@ -166,7 +166,7 @@ local void free_linkedlist(ll) local int add_data_in_datablock(ll,buf,len) - linkedlist_data* ll; + linkedlist_data* ll; const void* buf; uLong len; { @@ -222,7 +222,7 @@ local int add_data_in_datablock(ll,buf,len) local int write_datablock(fout,ll) FILE * fout; - linkedlist_data* ll; + linkedlist_data* ll; { linkedlist_datablock_internal* ldi; ldi = ll->first_block; @@ -322,7 +322,7 @@ extern zipFile ZEXPORT zipOpen (pathname, append) return (zipFile)zi; } -extern int ZEXPORT zipOpenNewFileInZip (file, filename, zipfi, +extern int ZEXPORT zipOpenNewFileInZip (file, filename, zipfi, extrafield_local, size_extrafield_local, extrafield_global, size_extrafield_global, comment, method, level) @@ -390,7 +390,7 @@ extern int ZEXPORT zipOpenNewFileInZip (file, filename, zipfi, zi->ci.stream_initialised = 0; zi->ci.pos_in_buffered_data = 0; zi->ci.pos_local_header = ftell(zi->filezip); - zi->ci.size_centralheader = SIZECENTRALHEADER + size_filename + + zi->ci.size_centralheader = SIZECENTRALHEADER + size_filename + size_extrafield_global + size_comment; zi->ci.central_header = (char*)ALLOC((uInt)zi->ci.size_centralheader); @@ -410,12 +410,12 @@ extern int ZEXPORT zipOpenNewFileInZip (file, filename, zipfi, ziplocal_putValue_inmemory(zi->ci.central_header+34,(uLong)0,2); /*disk nm start*/ if (zipfi==NULL) - ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)0,2); + ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)0,2); else - ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)zipfi->internal_fa,2); + ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)zipfi->internal_fa,2); if (zipfi==NULL) - ziplocal_putValue_inmemory(zi->ci.central_header+38,(uLong)0,4); + ziplocal_putValue_inmemory(zi->ci.central_header+38,(uLong)0,4); else ziplocal_putValue_inmemory(zi->ci.central_header+38,(uLong)zipfi->external_fa,4); @@ -568,10 +568,10 @@ extern int ZEXPORT zipCloseFileInZip (file) return ZIP_PARAMERROR; zi = (zip_internal*)file; - if (zi->in_opened_file_inzip == 0) + if (zi->in_opened_file_inzip == 0) return ZIP_PARAMERROR; zi->ci.stream.avail_in = 0; - + if (zi->ci.method == Z_DEFLATED) while (err==ZIP_OK) { @@ -618,22 +618,22 @@ extern int ZEXPORT zipCloseFileInZip (file) if (err==ZIP_OK) { long cur_pos_inzip = ftell(zi->filezip); - if (fseek(zi->filezip, + if (fseek(zi->filezip, zi->ci.pos_local_header + 14,SEEK_SET)!=0) - err = ZIP_ERRNO; + err = ZIP_ERRNO; if (err==ZIP_OK) err = ziplocal_putValue(zi->filezip,(uLong)zi->ci.crc32,4); /* crc 32, unknown */ if (err==ZIP_OK) /* compressed size, unknown */ - err = ziplocal_putValue(zi->filezip,(uLong)zi->ci.stream.total_out,4); + err = ziplocal_putValue(zi->filezip,(uLong)zi->ci.stream.total_out,4); if (err==ZIP_OK) /* uncompressed size, unknown */ err = ziplocal_putValue(zi->filezip,(uLong)zi->ci.stream.total_in,4); - if (fseek(zi->filezip, + if (fseek(zi->filezip, cur_pos_inzip,SEEK_SET)!=0) - err = ZIP_ERRNO; + err = ZIP_ERRNO; } zi->number_entry ++; @@ -701,8 +701,8 @@ extern int ZEXPORT zipClose (file, global_comment) if (err==ZIP_OK) /* size of the central directory */ err = ziplocal_putValue(zi->filezip,(uLong)size_centraldir,4); - if (err==ZIP_OK) /* offset of start of central directory with respect to the - starting disk number */ + if (err==ZIP_OK) /* offset of start of central directory with respect to the + starting disk number */ err = ziplocal_putValue(zi->filezip,(uLong)centraldir_pos_inzip ,4); if (err==ZIP_OK) /* zipfile comment length */ diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/contrib/minizip/zip.h b/contrib/vmap_extractor_v2/stormlib/zlib/contrib/minizip/zip.h index 678260b330b..2c519d294d7 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/contrib/minizip/zip.h +++ b/contrib/vmap_extractor_v2/stormlib/zlib/contrib/minizip/zip.h @@ -1,4 +1,4 @@ -/* zip.h -- IO for compress .zip files using zlib +/* zip.h -- IO for compress .zip files using zlib Version 0.15 alpha, Mar 19th, 1998, Copyright (C) 1998 Gilles Vollant @@ -36,7 +36,7 @@ */ -/* for more info about .ZIP format, see +/* for more info about .ZIP format, see ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip PkWare has also a specification at : ftp://ftp.pkware.com/probdesc.zip @@ -56,7 +56,7 @@ extern "C" { #if defined(STRICTZIP) || defined(STRICTZIPUNZIP) /* like the STRICT of WIN32, we define a pointer that cannot be converted from (void*) without cast */ -typedef struct TagzipFile__ { int unused; } zipFile__; +typedef struct TagzipFile__ { int unused; } zipFile__; typedef zipFile__ *zipFile; #else typedef voidp zipFile; @@ -68,19 +68,19 @@ typedef voidp zipFile; #define ZIP_INTERNALERROR (-104) /* tm_zip contain date/time info */ -typedef struct tm_zip_s +typedef struct tm_zip_s { - uInt tm_sec; /* seconds after the minute - [0,59] */ - uInt tm_min; /* minutes after the hour - [0,59] */ - uInt tm_hour; /* hours since midnight - [0,23] */ - uInt tm_mday; /* day of the month - [1,31] */ - uInt tm_mon; /* months since January - [0,11] */ - uInt tm_year; /* years - [1980..2044] */ + uInt tm_sec; /* seconds after the minute - [0,59] */ + uInt tm_min; /* minutes after the hour - [0,59] */ + uInt tm_hour; /* hours since midnight - [0,23] */ + uInt tm_mday; /* day of the month - [1,31] */ + uInt tm_mon; /* months since January - [0,11] */ + uInt tm_year; /* years - [1980..2044] */ } tm_zip; typedef struct { - tm_zip tmz_date; /* date in understandable format */ + tm_zip tmz_date; /* date in understandable format */ uLong dosDate; /* if dos_date == 0, tmu_date is used */ /* uLong flag; */ /* general purpose bit flag 2 bytes */ @@ -91,27 +91,27 @@ typedef struct extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append)); /* Create a zipfile. - pathname contain on Windows NT a filename like "c:\\zlib\\zlib111.zip" or on - an Unix computer "zlib/zlib111.zip". - if the file pathname exist and append=1, the zip will be created at the end - of the file. (useful if the file contain a self extractor code) - If the zipfile cannot be opened, the return value is NULL. + pathname contain on Windows NT a filename like "c:\\zlib\\zlib111.zip" or on + an Unix computer "zlib/zlib111.zip". + if the file pathname exist and append=1, the zip will be created at the end + of the file. (useful if the file contain a self extractor code) + If the zipfile cannot be opened, the return value is NULL. Else, the return value is a zipFile Handle, usable with other function - of this zip package. + of this zip package. */ extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, - const char* filename, - const zip_fileinfo* zipfi, - const void* extrafield_local, - uInt size_extrafield_local, - const void* extrafield_global, - uInt size_extrafield_global, - const char* comment, - int method, - int level)); + const char* filename, + const zip_fileinfo* zipfi, + const void* extrafield_local, + uInt size_extrafield_local, + const void* extrafield_global, + uInt size_extrafield_global, + const char* comment, + int method, + int level)); /* Open a file in the ZIP for writing. filename : the filename in zip (if NULL, '-' without quote will be used @@ -126,8 +126,8 @@ extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, */ extern int ZEXPORT zipWriteInFileInZip OF((zipFile file, - const voidp buf, - unsigned len)); + const voidp buf, + unsigned len)); /* Write data in the zipfile */ @@ -138,7 +138,7 @@ extern int ZEXPORT zipCloseFileInZip OF((zipFile file)); */ extern int ZEXPORT zipClose OF((zipFile file, - const char* global_comment)); + const char* global_comment)); /* Close the zipfile */ diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/contrib/untgz/untgz.c b/contrib/vmap_extractor_v2/stormlib/zlib/contrib/untgz/untgz.c index 4a431ff3163..bfde094c044 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/contrib/untgz/untgz.c +++ b/contrib/vmap_extractor_v2/stormlib/zlib/contrib/untgz/untgz.c @@ -39,37 +39,37 @@ /* Values used in typeflag field. */ -#define REGTYPE '0' /* regular file */ -#define AREGTYPE '\0' /* regular file */ -#define LNKTYPE '1' /* link */ -#define SYMTYPE '2' /* reserved */ -#define CHRTYPE '3' /* character special */ -#define BLKTYPE '4' /* block special */ -#define DIRTYPE '5' /* directory */ -#define FIFOTYPE '6' /* FIFO special */ -#define CONTTYPE '7' /* reserved */ +#define REGTYPE '0' /* regular file */ +#define AREGTYPE '\0' /* regular file */ +#define LNKTYPE '1' /* link */ +#define SYMTYPE '2' /* reserved */ +#define CHRTYPE '3' /* character special */ +#define BLKTYPE '4' /* block special */ +#define DIRTYPE '5' /* directory */ +#define FIFOTYPE '6' /* FIFO special */ +#define CONTTYPE '7' /* reserved */ #define BLOCKSIZE 512 struct tar_header -{ /* byte offset */ - char name[100]; /* 0 */ - char mode[8]; /* 100 */ - char uid[8]; /* 108 */ - char gid[8]; /* 116 */ - char size[12]; /* 124 */ - char mtime[12]; /* 136 */ - char chksum[8]; /* 148 */ - char typeflag; /* 156 */ - char linkname[100]; /* 157 */ - char magic[6]; /* 257 */ - char version[2]; /* 263 */ - char uname[32]; /* 265 */ - char gname[32]; /* 297 */ - char devmajor[8]; /* 329 */ - char devminor[8]; /* 337 */ - char prefix[155]; /* 345 */ - /* 500 */ +{ /* byte offset */ + char name[100]; /* 0 */ + char mode[8]; /* 100 */ + char uid[8]; /* 108 */ + char gid[8]; /* 116 */ + char size[12]; /* 124 */ + char mtime[12]; /* 136 */ + char chksum[8]; /* 148 */ + char typeflag; /* 156 */ + char linkname[100]; /* 157 */ + char magic[6]; /* 257 */ + char version[2]; /* 263 */ + char uname[32]; /* 265 */ + char gname[32]; /* 297 */ + char devmajor[8]; /* 329 */ + char devminor[8]; /* 337 */ + char prefix[155]; /* 345 */ + /* 500 */ }; union tar_buffer { @@ -79,21 +79,21 @@ union tar_buffer { enum { TGZ_EXTRACT = 0, TGZ_LIST }; -static char *TGZfname OF((const char *)); -void TGZnotfound OF((const char *)); +static char *TGZfname OF((const char *)); +void TGZnotfound OF((const char *)); -int getoct OF((char *, int)); -char *strtime OF((time_t *)); -int ExprMatch OF((char *,char *)); +int getoct OF((char *, int)); +char *strtime OF((time_t *)); +int ExprMatch OF((char *,char *)); -int makedir OF((char *)); -int matchname OF((int,int,char **,char *)); +int makedir OF((char *)); +int matchname OF((int,int,char **,char *)); -void error OF((const char *)); -int tar OF((gzFile, int, int, int, char **)); +void error OF((const char *)); +int tar OF((gzFile, int, int, int, char **)); -void help OF((int)); -int main OF((int, char **)); +void help OF((int)); +int main OF((int, char **)); char *prog; @@ -108,7 +108,7 @@ static char *TGZfname OF((const char *fname)) { static char buffer[1024]; int origlen,i; - + strcpy(buffer,fname); origlen = strlen(buffer); @@ -142,14 +142,14 @@ int getoct(char *p,int width) { int result = 0; char c; - + while (width --) { c = *p++; if (c == ' ') - continue; + continue; if (c == 0) - break; + break; result = result * 8 + (c - '0'); } return result; @@ -162,8 +162,8 @@ char *strtime (time_t *t) local = localtime(t); sprintf(result,"%2d/%02d/%4d %02d:%02d:%02d", - local->tm_mday, local->tm_mon+1, local->tm_year+1900, - local->tm_hour, local->tm_min, local->tm_sec); + local->tm_mday, local->tm_mon+1, local->tm_year+1900, + local->tm_hour, local->tm_min, local->tm_sec); return result; } @@ -177,30 +177,30 @@ int ExprMatch(char *string,char *expr) while (1) { if (ISSPECIAL(*expr)) - { - if (*expr == '/') - { - if (*string != '\\' && *string != '/') - return 0; - string ++; expr++; - } - else if (*expr == '*') - { - if (*expr ++ == 0) - return 1; - while (*++string != *expr) - if (*string == 0) - return 0; - } - } + { + if (*expr == '/') + { + if (*string != '\\' && *string != '/') + return 0; + string ++; expr++; + } + else if (*expr == '*') + { + if (*expr ++ == 0) + return 1; + while (*++string != *expr) + if (*string == 0) + return 0; + } + } else - { - if (*string != *expr) - return 0; - if (*expr++ == 0) - return 1; - string++; - } + { + if (*string != *expr) + return 0; + if (*expr++ == 0) + return 1; + string++; + } } } @@ -216,7 +216,7 @@ int makedir (char *newdir) char *buffer = strdup(newdir); char *p; int len = strlen(buffer); - + if (len <= 0) { free(buffer); return 0; @@ -234,19 +234,19 @@ int makedir (char *newdir) while (1) { char hold; - + while(*p && *p != '\\' && *p != '/') - p++; + p++; hold = *p; *p = 0; if ((mkdir(buffer, 0775) == -1) && (errno == ENOENT)) - { - fprintf(stderr,"%s: couldn't create directory %s\n",prog,buffer); - free(buffer); - return 0; - } + { + fprintf(stderr,"%s: couldn't create directory %s\n",prog,buffer); + free(buffer); + return 0; + } if (hold == 0) - break; + break; *p++ = hold; } free(buffer); @@ -255,7 +255,7 @@ int makedir (char *newdir) int matchname (int arg,int argc,char **argv,char *fname) { - if (arg == argc) /* no arguments given (untgz tgzarchive) */ + if (arg == argc) /* no arguments given (untgz tgzarchive) */ return 1; while (arg < argc) @@ -278,144 +278,144 @@ int tar (gzFile in,int action,int arg,int argc,char **argv) FILE *outfile = NULL; char fname[BLOCKSIZE]; time_t tartime; - + if (action == TGZ_LIST) printf(" day time size file\n" - " ---------- -------- --------- -------------------------------------\n"); + " ---------- -------- --------- -------------------------------------\n"); while (1) { len = gzread(in, &buffer, BLOCKSIZE); if (len < 0) - error (gzerror(in, &err)); + error (gzerror(in, &err)); /* * Always expect complete blocks to process * the tar information. */ if (len != BLOCKSIZE) - error("gzread: incomplete block read"); - + error("gzread: incomplete block read"); + /* * If we have to get a tar header */ if (getheader == 1) - { - /* - * if we met the end of the tar - * or the end-of-tar block, - * we are done - */ - if ((len == 0) || (buffer.header.name[0]== 0)) break; + { + /* + * if we met the end of the tar + * or the end-of-tar block, + * we are done + */ + if ((len == 0) || (buffer.header.name[0]== 0)) break; - tartime = (time_t)getoct(buffer.header.mtime,12); - strcpy(fname,buffer.header.name); - - switch (buffer.header.typeflag) - { - case DIRTYPE: - if (action == TGZ_LIST) - printf(" %s %s\n",strtime(&tartime),fname); - if (action == TGZ_EXTRACT) - makedir(fname); - break; - case REGTYPE: - case AREGTYPE: - remaining = getoct(buffer.header.size,12); - if (action == TGZ_LIST) - printf(" %s %9d %s\n",strtime(&tartime),remaining,fname); - if (action == TGZ_EXTRACT) - { - if ((remaining) && (matchname(arg,argc,argv,fname))) - { - outfile = fopen(fname,"wb"); - if (outfile == NULL) { - /* try creating directory */ - char *p = strrchr(fname, '/'); - if (p != NULL) { - *p = '\0'; - makedir(fname); - *p = '/'; - outfile = fopen(fname,"wb"); - } - } - fprintf(stderr, - "%s %s\n", - (outfile) ? "Extracting" : "Couldn't create", - fname); - } - else - outfile = NULL; - } - /* - * could have no contents - */ - getheader = (remaining) ? 0 : 1; - break; - default: - if (action == TGZ_LIST) - printf(" %s <---> %s\n",strtime(&tartime),fname); - break; - } - } - else - { - unsigned int bytes = (remaining > BLOCKSIZE) ? BLOCKSIZE : remaining; + tartime = (time_t)getoct(buffer.header.mtime,12); + strcpy(fname,buffer.header.name); - if ((action == TGZ_EXTRACT) && (outfile != NULL)) - { - if (fwrite(&buffer,sizeof(char),bytes,outfile) != bytes) - { - fprintf(stderr,"%s : error writing %s skipping...\n",prog,fname); - fclose(outfile); - unlink(fname); - } - } - remaining -= bytes; - if (remaining == 0) - { - getheader = 1; - if ((action == TGZ_EXTRACT) && (outfile != NULL)) - { -#ifdef WIN32 - HANDLE hFile; - FILETIME ftm,ftLocal; - SYSTEMTIME st; - struct tm localt; - - fclose(outfile); - - localt = *localtime(&tartime); - - hFile = CreateFile(fname, GENERIC_READ | GENERIC_WRITE, - 0, NULL, OPEN_EXISTING, 0, NULL); - - st.wYear = (WORD)localt.tm_year+1900; - st.wMonth = (WORD)localt.tm_mon; - st.wDayOfWeek = (WORD)localt.tm_wday; - st.wDay = (WORD)localt.tm_mday; - st.wHour = (WORD)localt.tm_hour; - st.wMinute = (WORD)localt.tm_min; - st.wSecond = (WORD)localt.tm_sec; - st.wMilliseconds = 0; - SystemTimeToFileTime(&st,&ftLocal); - LocalFileTimeToFileTime(&ftLocal,&ftm); - SetFileTime(hFile,&ftm,NULL,&ftm); - CloseHandle(hFile); - - outfile = NULL; -#else - struct utimbuf settime; - - settime.actime = settime.modtime = tartime; - - fclose(outfile); - outfile = NULL; - utime(fname,&settime); -#endif - } - } - } + switch (buffer.header.typeflag) + { + case DIRTYPE: + if (action == TGZ_LIST) + printf(" %s %s\n",strtime(&tartime),fname); + if (action == TGZ_EXTRACT) + makedir(fname); + break; + case REGTYPE: + case AREGTYPE: + remaining = getoct(buffer.header.size,12); + if (action == TGZ_LIST) + printf(" %s %9d %s\n",strtime(&tartime),remaining,fname); + if (action == TGZ_EXTRACT) + { + if ((remaining) && (matchname(arg,argc,argv,fname))) + { + outfile = fopen(fname,"wb"); + if (outfile == NULL) { + /* try creating directory */ + char *p = strrchr(fname, '/'); + if (p != NULL) { + *p = '\0'; + makedir(fname); + *p = '/'; + outfile = fopen(fname,"wb"); + } + } + fprintf(stderr, + "%s %s\n", + (outfile) ? "Extracting" : "Couldn't create", + fname); + } + else + outfile = NULL; + } + /* + * could have no contents + */ + getheader = (remaining) ? 0 : 1; + break; + default: + if (action == TGZ_LIST) + printf(" %s <---> %s\n",strtime(&tartime),fname); + break; + } } - + else + { + unsigned int bytes = (remaining > BLOCKSIZE) ? BLOCKSIZE : remaining; + + if ((action == TGZ_EXTRACT) && (outfile != NULL)) + { + if (fwrite(&buffer,sizeof(char),bytes,outfile) != bytes) + { + fprintf(stderr,"%s : error writing %s skipping...\n",prog,fname); + fclose(outfile); + unlink(fname); + } + } + remaining -= bytes; + if (remaining == 0) + { + getheader = 1; + if ((action == TGZ_EXTRACT) && (outfile != NULL)) + { +#ifdef WIN32 + HANDLE hFile; + FILETIME ftm,ftLocal; + SYSTEMTIME st; + struct tm localt; + + fclose(outfile); + + localt = *localtime(&tartime); + + hFile = CreateFile(fname, GENERIC_READ | GENERIC_WRITE, + 0, NULL, OPEN_EXISTING, 0, NULL); + + st.wYear = (WORD)localt.tm_year+1900; + st.wMonth = (WORD)localt.tm_mon; + st.wDayOfWeek = (WORD)localt.tm_wday; + st.wDay = (WORD)localt.tm_mday; + st.wHour = (WORD)localt.tm_hour; + st.wMinute = (WORD)localt.tm_min; + st.wSecond = (WORD)localt.tm_sec; + st.wMilliseconds = 0; + SystemTimeToFileTime(&st,&ftLocal); + LocalFileTimeToFileTime(&ftLocal,&ftm); + SetFileTime(hFile,&ftm,NULL,&ftm); + CloseHandle(hFile); + + outfile = NULL; +#else + struct utimbuf settime; + + settime.actime = settime.modtime = tartime; + + fclose(outfile); + outfile = NULL; + utime(fname,&settime); +#endif + } + } + } + } + if (gzclose(in) != Z_OK) error("failed gzclose"); @@ -428,8 +428,8 @@ int tar (gzFile in,int action,int arg,int argc,char **argv) void help(int exitval) { fprintf(stderr, - "untgz v 0.1\n" - " an sample application of zlib 1.0.4\n\n" + "untgz v 0.1\n" + " an sample application of zlib 1.0.4\n\n" "Usage : untgz TGZfile to extract all files\n" " untgz TGZfile fname ... to extract selected files\n" " untgz -l TGZfile to list archive contents\n" @@ -446,50 +446,50 @@ void error(const char *msg) /* ====================================================================== */ -int _CRT_glob = 0; /* disable globbing of the arguments */ +int _CRT_glob = 0; /* disable globbing of the arguments */ int main(int argc,char **argv) { - int action = TGZ_EXTRACT; - int arg = 1; - char *TGZfile; - gzFile *f; - + int action = TGZ_EXTRACT; + int arg = 1; + char *TGZfile; + gzFile *f; + prog = strrchr(argv[0],'\\'); if (prog == NULL) { - prog = strrchr(argv[0],'/'); - if (prog == NULL) - { - prog = strrchr(argv[0],':'); - if (prog == NULL) - prog = argv[0]; - else - prog++; - } - else - prog++; + prog = strrchr(argv[0],'/'); + if (prog == NULL) + { + prog = strrchr(argv[0],':'); + if (prog == NULL) + prog = argv[0]; + else + prog++; } else prog++; - + } + else + prog++; + if (argc == 1) help(0); if (strcmp(argv[arg],"-l") == 0) { - action = TGZ_LIST; - if (argc == ++arg) - help(0); + action = TGZ_LIST; + if (argc == ++arg) + help(0); } else if (strcmp(argv[arg],"-h") == 0) { - help(0); + help(0); } if ((TGZfile = TGZfname(argv[arg])) == NULL) - TGZnotfound(argv[arg]); + TGZnotfound(argv[arg]); ++arg; if ((action == TGZ_LIST) && (arg != argc)) @@ -502,20 +502,20 @@ int main(int argc,char **argv) { case TGZ_LIST: case TGZ_EXTRACT: - f = gzopen(TGZfile,"rb"); - if (f == NULL) - { - fprintf(stderr,"%s: Couldn't gzopen %s\n", - prog, - TGZfile); - return 1; - } - exit(tar(f, action, arg, argc, argv)); + f = gzopen(TGZfile,"rb"); + if (f == NULL) + { + fprintf(stderr,"%s: Couldn't gzopen %s\n", + prog, + TGZfile); + return 1; + } + exit(tar(f, action, arg, argc, argv)); break; - + default: - error("Unknown option!"); - exit(1); + error("Unknown option!"); + exit(1); } return 0; diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/crc32.c b/contrib/vmap_extractor_v2/stormlib/zlib/crc32.c index 60deca2ddf4..797f4f982fa 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/crc32.c +++ b/contrib/vmap_extractor_v2/stormlib/zlib/crc32.c @@ -1,6 +1,6 @@ /* crc32.c -- compute the CRC-32 of a data stream * Copyright (C) 1995-2002 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ @@ -51,7 +51,7 @@ local void make_crc_table() poly = 0L; for (n = 0; n < sizeof(p)/sizeof(Byte); n++) poly |= 1L << (31 - p[n]); - + for (n = 0; n < 256; n++) { c = (uLong)n; diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/deflate.c b/contrib/vmap_extractor_v2/stormlib/zlib/deflate.c index 16ebdade3f1..11568941c4c 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/deflate.c +++ b/contrib/vmap_extractor_v2/stormlib/zlib/deflate.c @@ -1,6 +1,6 @@ /* deflate.c -- compress data using the deflation algorithm * Copyright (C) 1995-2002 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @@ -194,13 +194,13 @@ int ZEXPORT deflateInit_(strm, level, version, stream_size) int stream_size; { return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, - Z_DEFAULT_STRATEGY, version, stream_size); + Z_DEFAULT_STRATEGY, version, stream_size); /* To do: ignore strm->next_in if we use it as window */ } /* ========================================================================= */ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, - version, stream_size) + version, stream_size) z_streamp strm; int level; int method; @@ -221,14 +221,14 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, if (version == Z_NULL || version[0] != my_version[0] || stream_size != sizeof(z_stream)) { - return Z_VERSION_ERROR; + return Z_VERSION_ERROR; } if (strm == Z_NULL) return Z_STREAM_ERROR; strm->msg = Z_NULL; if (strm->zalloc == Z_NULL) { - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; } if (strm->zfree == Z_NULL) strm->zfree = zcfree; @@ -243,7 +243,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, } if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || windowBits < 9 || windowBits > 15 || level < 0 || level > 9 || - strategy < 0 || strategy > Z_HUFFMAN_ONLY) { + strategy < 0 || strategy > Z_HUFFMAN_ONLY) { return Z_STREAM_ERROR; } s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); @@ -306,9 +306,9 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) if (length < MIN_MATCH) return Z_OK; if (length > MAX_DIST(s)) { - length = MAX_DIST(s); + length = MAX_DIST(s); #ifndef USE_DICT_HEAD - dictionary += dictLength - length; /* use the tail of the dictionary */ + dictionary += dictLength - length; /* use the tail of the dictionary */ #endif } zmemcpy(s->window, dictionary, length); @@ -322,7 +322,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) s->ins_h = s->window[0]; UPDATE_HASH(s, s->ins_h, s->window[1]); for (n = 0; n <= length - MIN_MATCH; n++) { - INSERT_STRING(s, n, hash_head); + INSERT_STRING(s, n, hash_head); } if (hash_head) hash_head = 0; /* to make compiler happy */ return Z_OK; @@ -333,7 +333,7 @@ int ZEXPORT deflateReset (strm) z_streamp strm; { deflate_state *s; - + if (strm == Z_NULL || strm->state == Z_NULL || strm->zalloc == Z_NULL || strm->zfree == Z_NULL) return Z_STREAM_ERROR; @@ -372,23 +372,23 @@ int ZEXPORT deflateParams(strm, level, strategy) s = strm->state; if (level == Z_DEFAULT_COMPRESSION) { - level = 6; + level = 6; } if (level < 0 || level > 9 || strategy < 0 || strategy > Z_HUFFMAN_ONLY) { - return Z_STREAM_ERROR; + return Z_STREAM_ERROR; } func = configuration_table[s->level].func; if (func != configuration_table[level].func && strm->total_in != 0) { - /* Flush the last buffer: */ - err = deflate(strm, Z_PARTIAL_FLUSH); + /* Flush the last buffer: */ + err = deflate(strm, Z_PARTIAL_FLUSH); } if (s->level != level) { - s->level = level; - s->max_lazy_match = configuration_table[level].max_lazy; - s->good_match = configuration_table[level].good_length; - s->nice_match = configuration_table[level].nice_length; - s->max_chain_length = configuration_table[level].max_chain; + s->level = level; + s->max_lazy_match = configuration_table[level].max_lazy; + s->good_match = configuration_table[level].good_length; + s->nice_match = configuration_table[level].nice_length; + s->max_chain_length = configuration_table[level].max_chain; } s->strategy = strategy; return err; @@ -405,7 +405,7 @@ local void putShortMSB (s, b) { put_byte(s, (Byte)(b >> 8)); put_byte(s, (Byte)(b & 0xff)); -} +} /* ========================================================================= * Flush as much pending output as possible. All deflate() output goes @@ -441,14 +441,14 @@ int ZEXPORT deflate (strm, flush) deflate_state *s; if (strm == Z_NULL || strm->state == Z_NULL || - flush > Z_FINISH || flush < 0) { + flush > Z_FINISH || flush < 0) { return Z_STREAM_ERROR; } s = strm->state; if (strm->next_out == Z_NULL || (strm->next_in == Z_NULL && strm->avail_in != 0) || - (s->status == FINISH_STATE && flush != Z_FINISH)) { + (s->status == FINISH_STATE && flush != Z_FINISH)) { ERR_RETURN(strm, Z_STREAM_ERROR); } if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); @@ -465,40 +465,40 @@ int ZEXPORT deflate (strm, flush) if (level_flags > 3) level_flags = 3; header |= (level_flags << 6); - if (s->strstart != 0) header |= PRESET_DICT; + if (s->strstart != 0) header |= PRESET_DICT; header += 31 - (header % 31); s->status = BUSY_STATE; putShortMSB(s, header); - /* Save the adler32 of the preset dictionary: */ - if (s->strstart != 0) { - putShortMSB(s, (uInt)(strm->adler >> 16)); - putShortMSB(s, (uInt)(strm->adler & 0xffff)); - } - strm->adler = 1L; + /* Save the adler32 of the preset dictionary: */ + if (s->strstart != 0) { + putShortMSB(s, (uInt)(strm->adler >> 16)); + putShortMSB(s, (uInt)(strm->adler & 0xffff)); + } + strm->adler = 1L; } /* Flush as much pending output as possible */ if (s->pending != 0) { flush_pending(strm); if (strm->avail_out == 0) { - /* Since avail_out is 0, deflate will be called again with - * more output space, but possibly with both pending and - * avail_in equal to zero. There won't be anything to do, - * but this is not an error situation so make sure we - * return OK instead of BUF_ERROR at next call of deflate: + /* Since avail_out is 0, deflate will be called again with + * more output space, but possibly with both pending and + * avail_in equal to zero. There won't be anything to do, + * but this is not an error situation so make sure we + * return OK instead of BUF_ERROR at next call of deflate: */ - s->last_flush = -1; - return Z_OK; - } + s->last_flush = -1; + return Z_OK; + } /* Make sure there is something to do and avoid duplicate consecutive * flushes. For repeated and useless calls with Z_FINISH, we keep * returning Z_STREAM_END instead of Z_BUFF_ERROR. */ } else if (strm->avail_in == 0 && flush <= old_flush && - flush != Z_FINISH) { + flush != Z_FINISH) { ERR_RETURN(strm, Z_BUF_ERROR); } @@ -513,24 +513,24 @@ int ZEXPORT deflate (strm, flush) (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { block_state bstate; - bstate = (*(configuration_table[s->level].func))(s, flush); + bstate = (*(configuration_table[s->level].func))(s, flush); if (bstate == finish_started || bstate == finish_done) { s->status = FINISH_STATE; } if (bstate == need_more || bstate == finish_started) { - if (strm->avail_out == 0) { - s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ - } - return Z_OK; - /* If flush != Z_NO_FLUSH && avail_out == 0, the next call - * of deflate should use the same flush parameter to make sure - * that the flush is complete. So we don't have to output an - * empty block here, this will be done at next call. This also - * ensures that for a very small output buffer, we emit at most - * one empty block. - */ - } + if (strm->avail_out == 0) { + s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ + } + return Z_OK; + /* If flush != Z_NO_FLUSH && avail_out == 0, the next call + * of deflate should use the same flush parameter to make sure + * that the flush is complete. So we don't have to output an + * empty block here, this will be done at next call. This also + * ensures that for a very small output buffer, we emit at most + * one empty block. + */ + } if (bstate == block_done) { if (flush == Z_PARTIAL_FLUSH) { _tr_align(s); @@ -544,10 +544,10 @@ int ZEXPORT deflate (strm, flush) } } flush_pending(strm); - if (strm->avail_out == 0) { - s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ - return Z_OK; - } + if (strm->avail_out == 0) { + s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ + return Z_OK; + } } } Assert(strm->avail_out > 0, "bug2"); @@ -576,7 +576,7 @@ int ZEXPORT deflateEnd (strm) status = strm->state->status; if (status != INIT_STATE && status != BUSY_STATE && - status != FINISH_STATE) { + status != FINISH_STATE) { return Z_STREAM_ERROR; } @@ -903,10 +903,10 @@ local uInt longest_match(s, cur_match) */ do { } while (*++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - scan < strend); + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + scan < strend); Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); @@ -933,10 +933,10 @@ local void check_match(s, start, match, length) if (zmemcmp(s->window + match, s->window + start, length) != EQUAL) { fprintf(stderr, " start %u, match %u, length %d\n", - start, match, length); + start, match, length); do { - fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); - } while (--length != 0); + fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); + } while (--length != 0); z_error("invalid match"); } if (z_verbose > 1) { @@ -995,23 +995,23 @@ local void fill_window(s) later. (Using level 0 permanently is not an optimal usage of zlib, so we don't care about this pathological case.) */ - n = s->hash_size; - p = &s->head[n]; - do { - m = *--p; - *p = (Pos)(m >= wsize ? m-wsize : NIL); - } while (--n); + n = s->hash_size; + p = &s->head[n]; + do { + m = *--p; + *p = (Pos)(m >= wsize ? m-wsize : NIL); + } while (--n); - n = wsize; + n = wsize; #ifndef FASTEST - p = &s->prev[n]; - do { - m = *--p; - *p = (Pos)(m >= wsize ? m-wsize : NIL); - /* If n is not on any hash chain, prev[n] is garbage but - * its value will never be used. - */ - } while (--n); + p = &s->prev[n]; + do { + m = *--p; + *p = (Pos)(m >= wsize ? m-wsize : NIL); + /* If n is not on any hash chain, prev[n] is garbage but + * its value will never be used. + */ + } while (--n); #endif more += wsize; } @@ -1056,8 +1056,8 @@ local void fill_window(s) _tr_flush_block(s, (s->block_start >= 0L ? \ (charf *)&s->window[(unsigned)s->block_start] : \ (charf *)Z_NULL), \ - (ulg)((long)s->strstart - s->block_start), \ - (eof)); \ + (ulg)((long)s->strstart - s->block_start), \ + (eof)); \ s->block_start = s->strstart; \ flush_pending(s->strm); \ Tracev((stderr,"[FLUSH]")); \ @@ -1098,32 +1098,32 @@ local block_state deflate_stored(s, flush) if (s->lookahead <= 1) { Assert(s->strstart < s->w_size+MAX_DIST(s) || - s->block_start >= (long)s->w_size, "slide too late"); + s->block_start >= (long)s->w_size, "slide too late"); fill_window(s); if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more; if (s->lookahead == 0) break; /* flush the current block */ } - Assert(s->block_start >= 0L, "block gone"); + Assert(s->block_start >= 0L, "block gone"); - s->strstart += s->lookahead; - s->lookahead = 0; + s->strstart += s->lookahead; + s->lookahead = 0; - /* Emit a stored block if pending_buf will be full: */ - max_start = s->block_start + max_block_size; + /* Emit a stored block if pending_buf will be full: */ + max_start = s->block_start + max_block_size; if (s->strstart == 0 || (ulg)s->strstart >= max_start) { - /* strstart == 0 is possible when wraparound on 16-bit machine */ - s->lookahead = (uInt)(s->strstart - max_start); - s->strstart = (uInt)max_start; + /* strstart == 0 is possible when wraparound on 16-bit machine */ + s->lookahead = (uInt)(s->strstart - max_start); + s->strstart = (uInt)max_start; FLUSH_BLOCK(s, 0); - } - /* Flush if we may have to slide, otherwise block_start may become + } + /* Flush if we may have to slide, otherwise block_start may become * negative and the data will be gone: */ if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) { FLUSH_BLOCK(s, 0); - } + } } FLUSH_BLOCK(s, flush == Z_FINISH); return flush == Z_FINISH ? finish_done : block_done; @@ -1152,8 +1152,8 @@ local block_state deflate_fast(s, flush) if (s->lookahead < MIN_LOOKAHEAD) { fill_window(s); if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { - return need_more; - } + return need_more; + } if (s->lookahead == 0) break; /* flush the current block */ } @@ -1199,10 +1199,10 @@ local block_state deflate_fast(s, flush) * always MIN_MATCH bytes ahead. */ } while (--s->match_length != 0); - s->strstart++; + s->strstart++; } else #endif - { + { s->strstart += s->match_length; s->match_length = 0; s->ins_h = s->window[s->strstart]; @@ -1219,7 +1219,7 @@ local block_state deflate_fast(s, flush) Tracevv((stderr,"%c", s->window[s->strstart])); _tr_tally_lit (s, s->window[s->strstart], bflush); s->lookahead--; - s->strstart++; + s->strstart++; } if (bflush) FLUSH_BLOCK(s, 0); } @@ -1249,8 +1249,8 @@ local block_state deflate_slow(s, flush) if (s->lookahead < MIN_LOOKAHEAD) { fill_window(s); if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { - return need_more; - } + return need_more; + } if (s->lookahead == 0) break; /* flush the current block */ } @@ -1297,7 +1297,7 @@ local block_state deflate_slow(s, flush) check_match(s, s->strstart-1, s->prev_match, s->prev_length); _tr_tally_dist(s, s->strstart -1 - s->prev_match, - s->prev_length - MIN_MATCH, bflush); + s->prev_length - MIN_MATCH, bflush); /* Insert in hash table all strings up to the end of the match. * strstart-1 and strstart are already inserted. If there is not @@ -1323,8 +1323,8 @@ local block_state deflate_slow(s, flush) * is longer, truncate the previous match to a single literal. */ Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); - if (bflush) { + _tr_tally_lit(s, s->window[s->strstart-1], bflush); + if (bflush) { FLUSH_BLOCK_ONLY(s, 0); } s->strstart++; diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/deflate.h b/contrib/vmap_extractor_v2/stormlib/zlib/deflate.h index b99a48a5214..2b7fd6528f9 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/deflate.h +++ b/contrib/vmap_extractor_v2/stormlib/zlib/deflate.h @@ -1,6 +1,6 @@ /* deflate.h -- internal compression state * Copyright (C) 1995-2002 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is @@ -269,7 +269,7 @@ typedef struct internal_state { void _tr_init OF((deflate_state *s)); int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len, - int eof)); + int eof)); void _tr_align OF((deflate_state *s)); void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, int eof)); @@ -312,7 +312,7 @@ void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, #else # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) # define _tr_tally_dist(s, distance, length, flush) \ - flush = _tr_tally(s, distance, length) + flush = _tr_tally(s, distance, length) #endif #endif diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/example.c b/contrib/vmap_extractor_v2/stormlib/zlib/example.c index e7e3673333e..83e5d8f0341 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/example.c +++ b/contrib/vmap_extractor_v2/stormlib/zlib/example.c @@ -1,6 +1,6 @@ /* example.c -- usage example of the zlib compression library * Copyright (C) 1995-2002 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ @@ -37,22 +37,22 @@ const char dictionary[] = "hello"; uLong dictId; /* Adler32 value of the dictionary */ void test_compress OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_gzio OF((const char *out, const char *in, - Byte *uncompr, int uncomprLen)); + Byte *uncompr, uLong uncomprLen)); +void test_gzio OF((const char *out, const char *in, + Byte *uncompr, int uncomprLen)); void test_deflate OF((Byte *compr, uLong comprLen)); void test_inflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); + Byte *uncompr, uLong uncomprLen)); void test_large_deflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); + Byte *uncompr, uLong uncomprLen)); void test_large_inflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); + Byte *uncompr, uLong uncomprLen)); void test_flush OF((Byte *compr, uLong *comprLen)); void test_sync OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); + Byte *uncompr, uLong uncomprLen)); void test_dict_deflate OF((Byte *compr, uLong comprLen)); void test_dict_inflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); + Byte *uncompr, uLong uncomprLen)); int main OF((int argc, char *argv[])); /* =========================================================================== @@ -75,7 +75,7 @@ void test_compress(compr, comprLen, uncompr, uncomprLen) if (strcmp((char*)uncompr, hello)) { fprintf(stderr, "bad uncompress\n"); - exit(1); + exit(1); } else { printf("uncompress(): %s\n", (char *)uncompr); } @@ -103,11 +103,11 @@ void test_gzio(out, in, uncompr, uncomprLen) gzputc(file, 'h'); if (gzputs(file, "ello") != 4) { fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err)); - exit(1); + exit(1); } if (gzprintf(file, ", %s!", "hello") != 8) { fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err)); - exit(1); + exit(1); } gzseek(file, 1L, SEEK_CUR); /* add one zero byte */ gzclose(file); @@ -121,36 +121,36 @@ void test_gzio(out, in, uncompr, uncomprLen) uncomprLen = gzread(file, uncompr, (unsigned)uncomprLen); if (uncomprLen != len) { fprintf(stderr, "gzread err: %s\n", gzerror(file, &err)); - exit(1); + exit(1); } if (strcmp((char*)uncompr, hello)) { fprintf(stderr, "bad gzread: %s\n", (char*)uncompr); - exit(1); + exit(1); } else { printf("gzread(): %s\n", (char *)uncompr); } pos = gzseek(file, -8L, SEEK_CUR); if (pos != 6 || gztell(file) != pos) { - fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n", - (long)pos, (long)gztell(file)); - exit(1); + fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n", + (long)pos, (long)gztell(file)); + exit(1); } if (gzgetc(file) != ' ') { - fprintf(stderr, "gzgetc error\n"); - exit(1); + fprintf(stderr, "gzgetc error\n"); + exit(1); } gzgets(file, (char*)uncompr, uncomprLen); uncomprLen = strlen((char*)uncompr); if (uncomprLen != 6) { /* "hello!" */ fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err)); - exit(1); + exit(1); } if (strcmp((char*)uncompr, hello+7)) { fprintf(stderr, "bad gzgets after gzseek\n"); - exit(1); + exit(1); } else { printf("gzgets() after gzseek: %s\n", (char *)uncompr); } @@ -231,7 +231,7 @@ void test_inflate(compr, comprLen, uncompr, uncomprLen) if (strcmp((char*)uncompr, hello)) { fprintf(stderr, "bad inflate\n"); - exit(1); + exit(1); } else { printf("inflate(): %s\n", (char *)uncompr); } @@ -266,7 +266,7 @@ void test_large_deflate(compr, comprLen, uncompr, uncomprLen) CHECK_ERR(err, "deflate"); if (c_stream.avail_in != 0) { fprintf(stderr, "deflate not greedy\n"); - exit(1); + exit(1); } /* Feed in already compressed data and switch to no compression: */ @@ -286,7 +286,7 @@ void test_large_deflate(compr, comprLen, uncompr, uncomprLen) err = deflate(&c_stream, Z_FINISH); if (err != Z_STREAM_END) { fprintf(stderr, "deflate should report Z_STREAM_END\n"); - exit(1); + exit(1); } err = deflateEnd(&c_stream); CHECK_ERR(err, "deflateEnd"); @@ -316,7 +316,7 @@ void test_large_inflate(compr, comprLen, uncompr, uncomprLen) for (;;) { d_stream.next_out = uncompr; /* discard the output */ - d_stream.avail_out = (uInt)uncomprLen; + d_stream.avail_out = (uInt)uncomprLen; err = inflate(&d_stream, Z_NO_FLUSH); if (err == Z_STREAM_END) break; CHECK_ERR(err, "large inflate"); @@ -327,7 +327,7 @@ void test_large_inflate(compr, comprLen, uncompr, uncomprLen) if (d_stream.total_out != 2*uncomprLen + comprLen/2) { fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out); - exit(1); + exit(1); } else { printf("large_inflate(): OK\n"); } @@ -407,7 +407,7 @@ void test_sync(compr, comprLen, uncompr, uncomprLen) if (err != Z_DATA_ERROR) { fprintf(stderr, "inflate should report DATA_ERROR\n"); /* Because of incorrect adler32 */ - exit(1); + exit(1); } err = inflateEnd(&d_stream); CHECK_ERR(err, "inflateEnd"); @@ -433,7 +433,7 @@ void test_dict_deflate(compr, comprLen) CHECK_ERR(err, "deflateInit"); err = deflateSetDictionary(&c_stream, - (const Bytef*)dictionary, sizeof(dictionary)); + (const Bytef*)dictionary, sizeof(dictionary)); CHECK_ERR(err, "deflateSetDictionary"); dictId = c_stream.adler; @@ -446,7 +446,7 @@ void test_dict_deflate(compr, comprLen) err = deflate(&c_stream, Z_FINISH); if (err != Z_STREAM_END) { fprintf(stderr, "deflate should report Z_STREAM_END\n"); - exit(1); + exit(1); } err = deflateEnd(&c_stream); CHECK_ERR(err, "deflateEnd"); @@ -480,14 +480,14 @@ void test_dict_inflate(compr, comprLen, uncompr, uncomprLen) for (;;) { err = inflate(&d_stream, Z_NO_FLUSH); if (err == Z_STREAM_END) break; - if (err == Z_NEED_DICT) { - if (d_stream.adler != dictId) { - fprintf(stderr, "unexpected dictionary"); - exit(1); - } - err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary, - sizeof(dictionary)); - } + if (err == Z_NEED_DICT) { + if (d_stream.adler != dictId) { + fprintf(stderr, "unexpected dictionary"); + exit(1); + } + err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary, + sizeof(dictionary)); + } CHECK_ERR(err, "inflate with dict"); } @@ -496,7 +496,7 @@ void test_dict_inflate(compr, comprLen, uncompr, uncomprLen) if (strcmp((char*)uncompr, hello)) { fprintf(stderr, "bad inflate with dict\n"); - exit(1); + exit(1); } else { printf("inflate with dictionary: %s\n", (char *)uncompr); } @@ -530,13 +530,13 @@ int main(argc, argv) */ if (compr == Z_NULL || uncompr == Z_NULL) { printf("out of memory\n"); - exit(1); + exit(1); } test_compress(compr, comprLen, uncompr, uncomprLen); test_gzio((argc > 1 ? argv[1] : TESTFILE), (argc > 2 ? argv[2] : TESTFILE), - uncompr, (int)uncomprLen); + uncompr, (int)uncomprLen); test_deflate(compr, comprLen); test_inflate(compr, comprLen, uncompr, uncomprLen); diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/gzio.c b/contrib/vmap_extractor_v2/stormlib/zlib/gzio.c index 09e0a20b8ce..36a371cdebc 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/gzio.c +++ b/contrib/vmap_extractor_v2/stormlib/zlib/gzio.c @@ -112,17 +112,17 @@ local gzFile gz_open (path, mode, fd) if (*p == 'r') s->mode = 'r'; if (*p == 'w' || *p == 'a') s->mode = 'w'; if (*p >= '0' && *p <= '9') { - level = *p - '0'; - } else if (*p == 'f') { - strategy = Z_FILTERED; - } else if (*p == 'h') { - strategy = Z_HUFFMAN_ONLY; - } else { - *m++ = *p; /* copy the mode */ - } + level = *p - '0'; + } else if (*p == 'f') { + strategy = Z_FILTERED; + } else if (*p == 'h') { + strategy = Z_HUFFMAN_ONLY; + } else { + *m++ = *p; /* copy the mode */ + } } while (*p++ && m != fmode + sizeof(fmode)); if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL; - + if (s->mode == 'w') { #ifdef NO_DEFLATE err = Z_STREAM_ERROR; @@ -163,17 +163,17 @@ local gzFile gz_open (path, mode, fd) */ fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1], Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE); - s->startpos = 10L; - /* We use 10L instead of ftell(s->file) to because ftell causes an + s->startpos = 10L; + /* We use 10L instead of ftell(s->file) to because ftell causes an * fflush on some systems. This version of the library doesn't use * startpos anyway in write mode, so this initialization is not * necessary. */ } else { - check_header(s); /* skip the .gz header */ - s->startpos = (ftell(s->file) - s->stream.avail_in); + check_header(s); /* skip the .gz header */ + s->startpos = (ftell(s->file) - s->stream.avail_in); } - + return (gzFile)s; } @@ -218,11 +218,11 @@ int ZEXPORT gzsetparams (file, level, strategy) /* Make room to allow flushing */ if (s->stream.avail_out == 0) { - s->stream.next_out = s->outbuf; - if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { - s->z_err = Z_ERRNO; - } - s->stream.avail_out = Z_BUFSIZE; + s->stream.next_out = s->outbuf; + if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { + s->z_err = Z_ERRNO; + } + s->stream.avail_out = Z_BUFSIZE; } return deflateParams (&(s->stream), level, strategy); @@ -238,14 +238,14 @@ local int get_byte(s) { if (s->z_eof) return EOF; if (s->stream.avail_in == 0) { - errno = 0; - s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file); - if (s->stream.avail_in == 0) { - s->z_eof = 1; - if (ferror(s->file)) s->z_err = Z_ERRNO; - return EOF; - } - s->stream.next_in = s->inbuf; + errno = 0; + s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file); + if (s->stream.avail_in == 0) { + s->z_eof = 1; + if (ferror(s->file)) s->z_err = Z_ERRNO; + return EOF; + } + s->stream.next_in = s->inbuf; } s->stream.avail_in--; return *(s->stream.next_in)++; @@ -270,41 +270,41 @@ local void check_header(s) /* Check the gzip magic header */ for (len = 0; len < 2; len++) { - c = get_byte(s); - if (c != gz_magic[len]) { - if (len != 0) s->stream.avail_in++, s->stream.next_in--; - if (c != EOF) { - s->stream.avail_in++, s->stream.next_in--; - s->transparent = 1; - } - s->z_err = s->stream.avail_in != 0 ? Z_OK : Z_STREAM_END; - return; - } + c = get_byte(s); + if (c != gz_magic[len]) { + if (len != 0) s->stream.avail_in++, s->stream.next_in--; + if (c != EOF) { + s->stream.avail_in++, s->stream.next_in--; + s->transparent = 1; + } + s->z_err = s->stream.avail_in != 0 ? Z_OK : Z_STREAM_END; + return; + } } method = get_byte(s); flags = get_byte(s); if (method != Z_DEFLATED || (flags & RESERVED) != 0) { - s->z_err = Z_DATA_ERROR; - return; + s->z_err = Z_DATA_ERROR; + return; } /* Discard time, xflags and OS code: */ for (len = 0; len < 6; len++) (void)get_byte(s); if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */ - len = (uInt)get_byte(s); - len += ((uInt)get_byte(s))<<8; - /* len is garbage if EOF but the loop below will quit anyway */ - while (len-- != 0 && get_byte(s) != EOF) ; + len = (uInt)get_byte(s); + len += ((uInt)get_byte(s))<<8; + /* len is garbage if EOF but the loop below will quit anyway */ + while (len-- != 0 && get_byte(s) != EOF) ; } if ((flags & ORIG_NAME) != 0) { /* skip the original file name */ - while ((c = get_byte(s)) != 0 && c != EOF) ; + while ((c = get_byte(s)) != 0 && c != EOF) ; } if ((flags & COMMENT) != 0) { /* skip the .gz file comment */ - while ((c = get_byte(s)) != 0 && c != EOF) ; + while ((c = get_byte(s)) != 0 && c != EOF) ; } if ((flags & HEAD_CRC) != 0) { /* skip the header crc */ - for (len = 0; len < 2; len++) (void)get_byte(s); + for (len = 0; len < 2; len++) (void)get_byte(s); } s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK; } @@ -323,21 +323,21 @@ local int destroy (s) TRYFREE(s->msg); if (s->stream.state != NULL) { - if (s->mode == 'w') { + if (s->mode == 'w') { #ifdef NO_DEFLATE - err = Z_STREAM_ERROR; + err = Z_STREAM_ERROR; #else - err = deflateEnd(&(s->stream)); + err = deflateEnd(&(s->stream)); #endif - } else if (s->mode == 'r') { - err = inflateEnd(&(s->stream)); - } + } else if (s->mode == 'r') { + err = inflateEnd(&(s->stream)); + } } if (s->file != NULL && fclose(s->file)) { #ifdef ESPIPE - if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */ + if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */ #endif - err = Z_ERRNO; + err = Z_ERRNO; } if (s->z_err < 0) err = s->z_err; @@ -372,69 +372,69 @@ int ZEXPORT gzread (file, buf, len) while (s->stream.avail_out != 0) { - if (s->transparent) { - /* Copy first the lookahead bytes: */ - uInt n = s->stream.avail_in; - if (n > s->stream.avail_out) n = s->stream.avail_out; - if (n > 0) { - zmemcpy(s->stream.next_out, s->stream.next_in, n); - next_out += n; - s->stream.next_out = next_out; - s->stream.next_in += n; - s->stream.avail_out -= n; - s->stream.avail_in -= n; - } - if (s->stream.avail_out > 0) { - s->stream.avail_out -= fread(next_out, 1, s->stream.avail_out, - s->file); - } - len -= s->stream.avail_out; - s->stream.total_in += (uLong)len; - s->stream.total_out += (uLong)len; + if (s->transparent) { + /* Copy first the lookahead bytes: */ + uInt n = s->stream.avail_in; + if (n > s->stream.avail_out) n = s->stream.avail_out; + if (n > 0) { + zmemcpy(s->stream.next_out, s->stream.next_in, n); + next_out += n; + s->stream.next_out = next_out; + s->stream.next_in += n; + s->stream.avail_out -= n; + s->stream.avail_in -= n; + } + if (s->stream.avail_out > 0) { + s->stream.avail_out -= fread(next_out, 1, s->stream.avail_out, + s->file); + } + len -= s->stream.avail_out; + s->stream.total_in += (uLong)len; + s->stream.total_out += (uLong)len; if (len == 0) s->z_eof = 1; - return (int)len; - } + return (int)len; + } if (s->stream.avail_in == 0 && !s->z_eof) { errno = 0; s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file); if (s->stream.avail_in == 0) { s->z_eof = 1; - if (ferror(s->file)) { - s->z_err = Z_ERRNO; - break; - } + if (ferror(s->file)) { + s->z_err = Z_ERRNO; + break; + } } s->stream.next_in = s->inbuf; } s->z_err = inflate(&(s->stream), Z_NO_FLUSH); - if (s->z_err == Z_STREAM_END) { - /* Check CRC and original size */ - s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); - start = s->stream.next_out; + if (s->z_err == Z_STREAM_END) { + /* Check CRC and original size */ + s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); + start = s->stream.next_out; - if (getLong(s) != s->crc) { - s->z_err = Z_DATA_ERROR; - } else { - (void)getLong(s); + if (getLong(s) != s->crc) { + s->z_err = Z_DATA_ERROR; + } else { + (void)getLong(s); /* The uncompressed length returned by above getlong() may * be different from s->stream.total_out) in case of - * concatenated .gz files. Check for such files: - */ - check_header(s); - if (s->z_err == Z_OK) { - uLong total_in = s->stream.total_in; - uLong total_out = s->stream.total_out; + * concatenated .gz files. Check for such files: + */ + check_header(s); + if (s->z_err == Z_OK) { + uLong total_in = s->stream.total_in; + uLong total_out = s->stream.total_out; - inflateReset(&(s->stream)); - s->stream.total_in = total_in; - s->stream.total_out = total_out; - s->crc = crc32(0L, Z_NULL, 0); - } - } - } - if (s->z_err != Z_OK || s->z_eof) break; + inflateReset(&(s->stream)); + s->stream.total_in = total_in; + s->stream.total_out = total_out; + s->crc = crc32(0L, Z_NULL, 0); + } + } + } + if (s->z_err != Z_OK || s->z_eof) break; } s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); @@ -543,21 +543,21 @@ int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...) #else /* not ANSI C */ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, - a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) + a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) gzFile file; const char *format; int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, - a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; + a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; { char buf[Z_PRINTF_BUFSIZE]; int len; #ifdef HAS_snprintf snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); #else sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); #endif len = strlen(buf); /* old sprintf doesn't return the nb of bytes written */ if (len <= 0) return 0; @@ -623,14 +623,14 @@ local int do_flush (file, flush) if (done) break; s->z_err = deflate(&(s->stream), flush); - /* Ignore the second of two consecutive flushes: */ - if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK; + /* Ignore the second of two consecutive flushes: */ + if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK; /* deflate has finished flushing only when it hasn't used up - * all the available space in the output buffer: + * all the available space in the output buffer: */ done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END); - + if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break; } return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; @@ -665,84 +665,84 @@ z_off_t ZEXPORT gzseek (file, offset, whence) gz_stream *s = (gz_stream*)file; if (s == NULL || whence == SEEK_END || - s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) { - return -1L; + s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) { + return -1L; } - + if (s->mode == 'w') { #ifdef NO_DEFLATE - return -1L; + return -1L; #else - if (whence == SEEK_SET) { - offset -= s->stream.total_in; - } - if (offset < 0) return -1L; + if (whence == SEEK_SET) { + offset -= s->stream.total_in; + } + if (offset < 0) return -1L; - /* At this point, offset is the number of zero bytes to write. */ - if (s->inbuf == Z_NULL) { - s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */ - zmemzero(s->inbuf, Z_BUFSIZE); - } - while (offset > 0) { - uInt size = Z_BUFSIZE; - if (offset < Z_BUFSIZE) size = (uInt)offset; + /* At this point, offset is the number of zero bytes to write. */ + if (s->inbuf == Z_NULL) { + s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */ + zmemzero(s->inbuf, Z_BUFSIZE); + } + while (offset > 0) { + uInt size = Z_BUFSIZE; + if (offset < Z_BUFSIZE) size = (uInt)offset; - size = gzwrite(file, s->inbuf, size); - if (size == 0) return -1L; + size = gzwrite(file, s->inbuf, size); + if (size == 0) return -1L; - offset -= size; - } - return (z_off_t)s->stream.total_in; + offset -= size; + } + return (z_off_t)s->stream.total_in; #endif } /* Rest of function is for reading only */ /* compute absolute position */ if (whence == SEEK_CUR) { - offset += s->stream.total_out; + offset += s->stream.total_out; } if (offset < 0) return -1L; if (s->transparent) { - /* map to fseek */ - s->stream.avail_in = 0; - s->stream.next_in = s->inbuf; + /* map to fseek */ + s->stream.avail_in = 0; + s->stream.next_in = s->inbuf; if (fseek(s->file, offset, SEEK_SET) < 0) return -1L; - s->stream.total_in = s->stream.total_out = (uLong)offset; - return offset; + s->stream.total_in = s->stream.total_out = (uLong)offset; + return offset; } /* For a negative seek, rewind and use positive seek */ if ((uLong)offset >= s->stream.total_out) { - offset -= s->stream.total_out; + offset -= s->stream.total_out; } else if (gzrewind(file) < 0) { - return -1L; + return -1L; } /* offset is now the number of bytes to skip. */ if (offset != 0 && s->outbuf == Z_NULL) { - s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); + s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); } while (offset > 0) { - int size = Z_BUFSIZE; - if (offset < Z_BUFSIZE) size = (int)offset; + int size = Z_BUFSIZE; + if (offset < Z_BUFSIZE) size = (int)offset; - size = gzread(file, s->outbuf, (uInt)size); - if (size <= 0) return -1L; - offset -= size; + size = gzread(file, s->outbuf, (uInt)size); + if (size <= 0) return -1L; + offset -= size; } return (z_off_t)s->stream.total_out; } /* =========================================================================== - Rewinds input file. + Rewinds input file. */ int ZEXPORT gzrewind (file) gzFile file; { gz_stream *s = (gz_stream*)file; - + if (s == NULL || s->mode != 'r') return -1; s->z_err = Z_OK; @@ -750,10 +750,10 @@ int ZEXPORT gzrewind (file) s->stream.avail_in = 0; s->stream.next_in = s->inbuf; s->crc = crc32(0L, Z_NULL, 0); - + if (s->startpos == 0) { /* not a compressed file */ - rewind(s->file); - return 0; + rewind(s->file); + return 0; } (void) inflateReset(&s->stream); @@ -779,7 +779,7 @@ int ZEXPORT gzeof (file) gzFile file; { gz_stream *s = (gz_stream*)file; - + return (s == NULL || s->mode != 'r') ? 0 : s->z_eof; } @@ -829,7 +829,7 @@ int ZEXPORT gzclose (file) if (s->mode == 'w') { #ifdef NO_DEFLATE - return Z_STREAM_ERROR; + return Z_STREAM_ERROR; #else err = do_flush (file, Z_FINISH); if (err != Z_OK) return destroy((gz_stream*)file); diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/infblock.c b/contrib/vmap_extractor_v2/stormlib/zlib/infblock.c index dd7a6d40a8d..4e4e2e15d96 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/infblock.c +++ b/contrib/vmap_extractor_v2/stormlib/zlib/infblock.c @@ -1,6 +1,6 @@ /* infblock.c -- interpret and process block types to last block * Copyright (C) 1995-2002 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" @@ -393,7 +393,7 @@ uInt n; /* Returns true if inflate is currently at the end of a block generated - * by Z_SYNC_FLUSH or Z_FULL_FLUSH. + * by Z_SYNC_FLUSH or Z_FULL_FLUSH. * IN assertion: s != Z_NULL */ int inflate_blocks_sync_point(s) diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/infblock.h b/contrib/vmap_extractor_v2/stormlib/zlib/infblock.h index 173b2267ade..8176340aa6a 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/infblock.h +++ b/contrib/vmap_extractor_v2/stormlib/zlib/infblock.h @@ -1,6 +1,6 @@ /* infblock.h -- header to use infblock.c * Copyright (C) 1995-2002 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/infcodes.c b/contrib/vmap_extractor_v2/stormlib/zlib/infcodes.c index 9abe5412b9c..0af7a5be75c 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/infcodes.c +++ b/contrib/vmap_extractor_v2/stormlib/zlib/infcodes.c @@ -1,6 +1,6 @@ /* infcodes.c -- process literals and length/distance pairs * Copyright (C) 1995-2002 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/infcodes.h b/contrib/vmap_extractor_v2/stormlib/zlib/infcodes.h index 46821a02be6..63933e78d6a 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/infcodes.h +++ b/contrib/vmap_extractor_v2/stormlib/zlib/infcodes.h @@ -1,6 +1,6 @@ /* infcodes.h -- header to use infcodes.c * Copyright (C) 1995-2002 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/inffast.c b/contrib/vmap_extractor_v2/stormlib/zlib/inffast.c index aa7f1d4d2ad..4e918dbdc67 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/inffast.c +++ b/contrib/vmap_extractor_v2/stormlib/zlib/inffast.c @@ -1,6 +1,6 @@ /* inffast.c -- process literals and length/distance pairs fast * Copyright (C) 1995-2002 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/inffast.h b/contrib/vmap_extractor_v2/stormlib/zlib/inffast.h index a31a4bbb058..ec13e09319f 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/inffast.h +++ b/contrib/vmap_extractor_v2/stormlib/zlib/inffast.h @@ -1,6 +1,6 @@ /* inffast.h -- header to use inffast.c * Copyright (C) 1995-2002 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/inflate.c b/contrib/vmap_extractor_v2/stormlib/zlib/inflate.c index dfb2e867d81..3ac2efb900d 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/inflate.c +++ b/contrib/vmap_extractor_v2/stormlib/zlib/inflate.c @@ -1,6 +1,6 @@ /* inflate.c -- zlib interface to inflate modules * Copyright (C) 1995-2002 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" @@ -44,7 +44,7 @@ struct internal_state { /* mode independent information */ int nowrap; /* flag for no wrapper */ uInt wbits; /* log2(window size) (8..15, defaults to 15) */ - inflate_blocks_statef + inflate_blocks_statef *blocks; /* current inflate_blocks state */ }; diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/inftrees.c b/contrib/vmap_extractor_v2/stormlib/zlib/inftrees.c index 4c32ca30d99..a64a23ff61d 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/inftrees.c +++ b/contrib/vmap_extractor_v2/stormlib/zlib/inftrees.c @@ -1,6 +1,6 @@ /* inftrees.c -- generate Huffman trees for efficient decoding * Copyright (C) 1995-2002 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/inftrees.h b/contrib/vmap_extractor_v2/stormlib/zlib/inftrees.h index 04b73b7296a..b4a5d6f9e0e 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/inftrees.h +++ b/contrib/vmap_extractor_v2/stormlib/zlib/inftrees.h @@ -1,6 +1,6 @@ /* inftrees.h -- header to use inftrees.c * Copyright (C) 1995-2002 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/infutil.c b/contrib/vmap_extractor_v2/stormlib/zlib/infutil.c index 9a076221f2a..b3189642085 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/infutil.c +++ b/contrib/vmap_extractor_v2/stormlib/zlib/infutil.c @@ -1,6 +1,6 @@ /* inflate_util.c -- data and routines common to blocks and codes * Copyright (C) 1995-2002 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/infutil.h b/contrib/vmap_extractor_v2/stormlib/zlib/infutil.h index 4401df82fc8..9e4f939b44c 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/infutil.h +++ b/contrib/vmap_extractor_v2/stormlib/zlib/infutil.h @@ -1,6 +1,6 @@ /* infutil.h -- types and macros common to blocks and codes * Copyright (C) 1995-2002 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is @@ -41,7 +41,7 @@ struct inflate_blocks_state { inflate_huft *tb; /* bit length decoding tree */ } trees; /* if DTREE, decoding info for trees */ struct { - inflate_codes_statef + inflate_codes_statef *codes; } decode; /* if CODES, current state */ } sub; /* submode */ diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/maketree.c b/contrib/vmap_extractor_v2/stormlib/zlib/maketree.c index a16d4b14608..6eea67ed6da 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/maketree.c +++ b/contrib/vmap_extractor_v2/stormlib/zlib/maketree.c @@ -1,6 +1,6 @@ /* maketree.c -- make inffixed.h table for decoding fixed codes * Copyright (C) 1995-2002 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/minigzip.c b/contrib/vmap_extractor_v2/stormlib/zlib/minigzip.c index 97b7c2d93b2..c71e743a548 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/minigzip.c +++ b/contrib/vmap_extractor_v2/stormlib/zlib/minigzip.c @@ -1,6 +1,6 @@ /* minigzip.c -- simulate gzip using the zlib compression library * Copyright (C) 1995-2002 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @@ -147,7 +147,7 @@ int gz_compress_mmap(in, out) if (buf_len <= 0) return Z_ERRNO; /* Now do the actual mmap: */ - buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0); + buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0); if (buf == (caddr_t)(-1)) return Z_ERRNO; /* Compress the whole file at once: */ @@ -179,8 +179,8 @@ void gz_uncompress(in, out) if (len == 0) break; if ((int)fwrite(buf, 1, (unsigned)len, out) != len) { - error("failed fwrite"); - } + error("failed fwrite"); + } } if (fclose(out)) error("failed fclose"); @@ -282,16 +282,16 @@ int main(argc, argv) while (argc > 0) { if (strcmp(*argv, "-d") == 0) - uncompr = 1; + uncompr = 1; else if (strcmp(*argv, "-f") == 0) - outmode[3] = 'f'; + outmode[3] = 'f'; else if (strcmp(*argv, "-h") == 0) - outmode[3] = 'h'; + outmode[3] = 'h'; else if ((*argv)[0] == '-' && (*argv)[1] >= '1' && (*argv)[1] <= '9' && - (*argv)[2] == 0) - outmode[2] = (*argv)[1]; + (*argv)[2] == 0) + outmode[2] = (*argv)[1]; else - break; + break; argc--, argv++; } if (argc == 0) { diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/trees.c b/contrib/vmap_extractor_v2/stormlib/zlib/trees.c index 0a984056738..d4da040ae9d 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/trees.c +++ b/contrib/vmap_extractor_v2/stormlib/zlib/trees.c @@ -1,6 +1,6 @@ /* trees.c -- output deflated data using Huffman coding * Copyright (C) 1995-2002 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @@ -335,42 +335,42 @@ void gen_trees_header() Assert (header != NULL, "Can't open trees.h"); fprintf(header, - "/* header created automatically with -DGEN_TREES_H */\n\n"); + "/* header created automatically with -DGEN_TREES_H */\n\n"); fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); for (i = 0; i < L_CODES+2; i++) { - fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, - static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); + fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, + static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); } fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); for (i = 0; i < D_CODES; i++) { - fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, - static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); + fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, + static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); } fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n"); for (i = 0; i < DIST_CODE_LEN; i++) { - fprintf(header, "%2u%s", _dist_code[i], - SEPARATOR(i, DIST_CODE_LEN-1, 20)); + fprintf(header, "%2u%s", _dist_code[i], + SEPARATOR(i, DIST_CODE_LEN-1, 20)); } fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { - fprintf(header, "%2u%s", _length_code[i], - SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); + fprintf(header, "%2u%s", _length_code[i], + SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); } fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); for (i = 0; i < LENGTH_CODES; i++) { - fprintf(header, "%1u%s", base_length[i], - SEPARATOR(i, LENGTH_CODES-1, 20)); + fprintf(header, "%1u%s", base_length[i], + SEPARATOR(i, LENGTH_CODES-1, 20)); } fprintf(header, "local const int base_dist[D_CODES] = {\n"); for (i = 0; i < D_CODES; i++) { - fprintf(header, "%5u%s", base_dist[i], - SEPARATOR(i, D_CODES-1, 10)); + fprintf(header, "%5u%s", base_dist[i], + SEPARATOR(i, D_CODES-1, 10)); } fclose(header); @@ -930,39 +930,39 @@ void _tr_flush_block(s, buf, stored_len, eof) /* Build the Huffman trees unless a stored block is forced */ if (s->level > 0) { - /* Check if the file is ascii or binary */ - if (s->data_type == Z_UNKNOWN) set_data_type(s); + /* Check if the file is ascii or binary */ + if (s->data_type == Z_UNKNOWN) set_data_type(s); - /* Construct the literal and distance trees */ - build_tree(s, (tree_desc *)(&(s->l_desc))); - Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, - s->static_len)); + /* Construct the literal and distance trees */ + build_tree(s, (tree_desc *)(&(s->l_desc))); + Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, + s->static_len)); - build_tree(s, (tree_desc *)(&(s->d_desc))); - Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, - s->static_len)); - /* At this point, opt_len and static_len are the total bit lengths of - * the compressed block data, excluding the tree representations. - */ + build_tree(s, (tree_desc *)(&(s->d_desc))); + Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, + s->static_len)); + /* At this point, opt_len and static_len are the total bit lengths of + * the compressed block data, excluding the tree representations. + */ - /* Build the bit length tree for the above two trees, and get the index - * in bl_order of the last bit length code to send. - */ - max_blindex = build_bl_tree(s); + /* Build the bit length tree for the above two trees, and get the index + * in bl_order of the last bit length code to send. + */ + max_blindex = build_bl_tree(s); - /* Determine the best encoding. Compute first the block length in bytes*/ - opt_lenb = (s->opt_len+3+7)>>3; - static_lenb = (s->static_len+3+7)>>3; + /* Determine the best encoding. Compute first the block length in bytes*/ + opt_lenb = (s->opt_len+3+7)>>3; + static_lenb = (s->static_len+3+7)>>3; - Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", - opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, - s->last_lit)); + Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", + opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, + s->last_lit)); - if (static_lenb <= opt_lenb) opt_lenb = static_lenb; + if (static_lenb <= opt_lenb) opt_lenb = static_lenb; } else { Assert(buf != (char*)0, "lost buf"); - opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ + opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ } #ifdef FORCE_STORED @@ -1199,7 +1199,7 @@ local void copy_block(s, buf, len, header) s->last_eob_len = 8; /* enough lookahead for inflate */ if (header) { - put_short(s, (ush)len); + put_short(s, (ush)len); put_short(s, (ush)~len); #ifdef DEBUG s->bits_sent += 2*16; diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/uncompr.c b/contrib/vmap_extractor_v2/stormlib/zlib/uncompr.c index a287714f5de..fdd495ff4ba 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/uncompr.c +++ b/contrib/vmap_extractor_v2/stormlib/zlib/uncompr.c @@ -1,6 +1,6 @@ /* uncompr.c -- decompress a memory buffer * Copyright (C) 1995-2002 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/zconf.h b/contrib/vmap_extractor_v2/stormlib/zlib/zconf.h index eb0ae2e1a0c..1ca5af55a7f 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/zconf.h +++ b/contrib/vmap_extractor_v2/stormlib/zlib/zconf.h @@ -1,6 +1,6 @@ /* zconf.h -- configuration of the zlib compression library * Copyright (C) 1995-2002 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ @@ -13,39 +13,39 @@ * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. */ #ifdef Z_PREFIX -# define deflateInit_ z_deflateInit_ -# define deflate z_deflate -# define deflateEnd z_deflateEnd -# define inflateInit_ z_inflateInit_ -# define inflate z_inflate -# define inflateEnd z_inflateEnd -# define deflateInit2_ z_deflateInit2_ +# define deflateInit_ z_deflateInit_ +# define deflate z_deflate +# define deflateEnd z_deflateEnd +# define inflateInit_ z_inflateInit_ +# define inflate z_inflate +# define inflateEnd z_inflateEnd +# define deflateInit2_ z_deflateInit2_ # define deflateSetDictionary z_deflateSetDictionary -# define deflateCopy z_deflateCopy -# define deflateReset z_deflateReset -# define deflateParams z_deflateParams -# define inflateInit2_ z_inflateInit2_ +# define deflateCopy z_deflateCopy +# define deflateReset z_deflateReset +# define deflateParams z_deflateParams +# define inflateInit2_ z_inflateInit2_ # define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync +# define inflateSync z_inflateSync # define inflateSyncPoint z_inflateSyncPoint -# define inflateReset z_inflateReset -# define compress z_compress -# define compress2 z_compress2 -# define uncompress z_uncompress -# define adler32 z_adler32 -# define crc32 z_crc32 +# define inflateReset z_inflateReset +# define compress z_compress +# define compress2 z_compress2 +# define uncompress z_uncompress +# define adler32 z_adler32 +# define crc32 z_crc32 # define get_crc_table z_get_crc_table -# define Byte z_Byte -# define uInt z_uInt -# define uLong z_uLong -# define Bytef z_Bytef -# define charf z_charf -# define intf z_intf -# define uIntf z_uIntf -# define uLongf z_uLongf -# define voidpf z_voidpf -# define voidp z_voidp +# define Byte z_Byte +# define uInt z_uInt +# define uLong z_uLong +# define Bytef z_Bytef +# define charf z_charf +# define intf z_intf +# define uIntf z_uIntf +# define uLongf z_uLongf +# define voidpf z_voidpf +# define voidp z_voidp #endif #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/zlib.h b/contrib/vmap_extractor_v2/stormlib/zlib/zlib.h index 52cb529f6f3..dbdd2cf7074 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/zlib.h +++ b/contrib/vmap_extractor_v2/stormlib/zlib/zlib.h @@ -39,7 +39,7 @@ extern "C" { #define ZLIB_VERSION "1.1.4" -/* +/* The 'zlib' compression library provides in-memory compression and decompression functions, including integrity checks of the uncompressed data. This version of the library supports only one compression method @@ -175,7 +175,7 @@ ZEXTERN const char * ZEXPORT zlibVersion OF((void)); This check is automatically made by deflateInit and inflateInit. */ -/* +/* ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); Initializes the internal stream state for compression. The fields @@ -253,7 +253,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); more input data, until it returns with Z_STREAM_END or an error. After deflate has returned Z_STREAM_END, the only possible operations on the stream are deflateReset or deflateEnd. - + Z_FINISH can be used immediately after deflateInit if all the compression is to be done in a single step. In this case, avail_out must be at least 0.1% larger than avail_in plus 12 bytes. If deflate does not return @@ -290,7 +290,7 @@ ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); */ -/* +/* ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); Initializes the internal stream state for decompression. The fields @@ -359,7 +359,7 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); If a preset dictionary is needed at this point (see inflateSetDictionary below), inflate sets strm-adler to the adler32 checksum of the - dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise + dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise it sets strm->adler to the adler32 checksum of all output produced so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described below. At the end of the stream, inflate() @@ -397,7 +397,7 @@ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); The following functions are needed only in some special applications. */ -/* +/* ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, int level, int method, @@ -440,7 +440,7 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, method). msg is set to null if there is no error message. deflateInit2 does not perform any compression: this will be done by deflate(). */ - + ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, const Bytef *dictionary, uInt dictLength)); @@ -507,8 +507,8 @@ ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); */ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, - int level, - int strategy)); + int level, + int strategy)); /* Dynamically update the compression level and compression strategy. The interpretation of level and strategy is as in deflateInit2. This can be @@ -527,7 +527,7 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, if strm->avail_out was zero. */ -/* +/* ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, int windowBits)); @@ -570,7 +570,7 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, */ ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); -/* +/* Skips invalid compressed data until a full flush point (see above the description of deflate with Z_FULL_FLUSH) can be found, or until all available input is skipped. No output is provided. @@ -701,8 +701,8 @@ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); gzread returns the number of uncompressed bytes actually read (0 for end of file, -1 for error). */ -ZEXTERN int ZEXPORT gzwrite OF((gzFile file, - const voidp buf, unsigned len)); +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, + const voidp buf, unsigned len)); /* Writes the given number of uncompressed bytes into the compressed file. gzwrite returns the number of uncompressed bytes actually written @@ -755,8 +755,8 @@ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); */ ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, - z_off_t offset, int whence)); -/* + z_off_t offset, int whence)); +/* Sets the starting position for the next gzread or gzwrite on the given compressed file. The offset represents a number of bytes in the uncompressed data stream. The whence parameter is defined as in lseek(2); diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/zutil.c b/contrib/vmap_extractor_v2/stormlib/zlib/zutil.c index 9a076221f2a..b3189642085 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/zutil.c +++ b/contrib/vmap_extractor_v2/stormlib/zlib/zutil.c @@ -1,6 +1,6 @@ /* inflate_util.c -- data and routines common to blocks and codes * Copyright (C) 1995-2002 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" diff --git a/contrib/vmap_extractor_v2/stormlib/zlib/zutil.h b/contrib/vmap_extractor_v2/stormlib/zlib/zutil.h index 718ebc15be1..0d5f2115b43 100644 --- a/contrib/vmap_extractor_v2/stormlib/zlib/zutil.h +++ b/contrib/vmap_extractor_v2/stormlib/zlib/zutil.h @@ -208,7 +208,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ typedef uLong (ZEXPORT *check_func) OF((uLong check, const Bytef *buf, - uInt len)); + uInt len)); voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); void zcfree OF((voidpf opaque, voidpf ptr)); diff --git a/contrib/vmap_extractor_v2/stormlibdll/DllMain.c b/contrib/vmap_extractor_v2/stormlibdll/DllMain.c index cbfa84a08a8..d5ef37fc106 100644 --- a/contrib/vmap_extractor_v2/stormlibdll/DllMain.c +++ b/contrib/vmap_extractor_v2/stormlibdll/DllMain.c @@ -20,5 +20,5 @@ DWORD WINAPI DllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved) UNREFERENCED_PARAMETER(dwReason); UNREFERENCED_PARAMETER(lpReserved); - return TRUE; + return TRUE; } diff --git a/contrib/vmap_extractor_v2/vmapextract/adtfile.cpp b/contrib/vmap_extractor_v2/vmapextract/adtfile.cpp index b798263ca64..28d645a00d5 100644 --- a/contrib/vmap_extractor_v2/vmapextract/adtfile.cpp +++ b/contrib/vmap_extractor_v2/vmapextract/adtfile.cpp @@ -12,151 +12,151 @@ char * GetPlainName(char * FileName) void fixnamen(char *name, size_t len) { - for (size_t i=0; i0 && name[i]>='A' && name[i]<='Z' && isalpha(name[i-1])) - { - name[i] |= 0x20; - } else if ((i==0 || !isalpha(name[i-1])) && name[i]>='a' && name[i]<='z') - { - name[i] &= ~0x20; - } - } + for (size_t i=0; i0 && name[i]>='A' && name[i]<='Z' && isalpha(name[i-1])) + { + name[i] |= 0x20; + } else if ((i==0 || !isalpha(name[i-1])) && name[i]>='a' && name[i]<='z') + { + name[i] &= ~0x20; + } + } } void fixname2(char *name, size_t len) { - for (size_t i=0; iopen()) - { - m2->ConvertToVMAPModel((char*)szLocalFile); - } - delete m2; + size_t nextpos = ADT.getPos () + size; - } - else - fclose(output); - } - - delete[] buf; - } - - } - else if (!strcmp(fourcc,"MWMO")) - { - if (size) - { - - char *buf = new char[size]; - ADT.read(buf, size); - char *p=buf; - int q = 0; - WmoInstansName = new string[size]; - while (popen()) + { + m2->ConvertToVMAPModel((char*)szLocalFile); + } + delete m2; + + } + else + fclose(output); + } + + delete[] buf; + } + + } + else if (!strcmp(fourcc,"MWMO")) + { + if (size) + { + + char *buf = new char[size]; + ADT.read(buf, size); + char *p=buf; + int q = 0; + WmoInstansName = new string[size]; + while (p= recordSize); + f.read(&na,4); // Number of records + f.read(&nb,4); // Number of fields + f.read(&es,4); // Size of a record + f.read(&ss,4); // String size - data = new unsigned char[recordSize*recordCount+stringSize]; - stringTable = data + recordSize*recordCount; - f.read(data,recordSize*recordCount+stringSize); - f.close(); - return true; + recordSize = es; + recordCount = na; + fieldCount = nb; + stringSize = ss; + //assert(fieldCount*4 == recordSize); + assert(fieldCount*4 >= recordSize); + + data = new unsigned char[recordSize*recordCount+stringSize]; + stringTable = data + recordSize*recordCount; + f.read(data,recordSize*recordCount+stringSize); + f.close(); + return true; } DBCFile::~DBCFile() { - delete [] data; + delete [] data; } DBCFile::Record DBCFile::getRecord(size_t id) { - assert(data); - return Record(*this, data + id*recordSize); + assert(data); + return Record(*this, data + id*recordSize); } DBCFile::Iterator DBCFile::begin() { - assert(data); - return Iterator(*this, data); + assert(data); + return Iterator(*this, data); } DBCFile::Iterator DBCFile::end() { - assert(data); - return Iterator(*this, stringTable); + assert(data); + return Iterator(*this, stringTable); } diff --git a/contrib/vmap_extractor_v2/vmapextract/dbcfile.h b/contrib/vmap_extractor_v2/vmapextract/dbcfile.h index bf6b8635a96..002e7eeeb20 100644 --- a/contrib/vmap_extractor_v2/vmapextract/dbcfile.h +++ b/contrib/vmap_extractor_v2/vmapextract/dbcfile.h @@ -9,131 +9,131 @@ class DBCFile { public: - DBCFile(const std::string &filename); - ~DBCFile(); + DBCFile(const std::string &filename); + ~DBCFile(); - // Open database. It must be openened before it can be used. - bool open(); + // Open database. It must be openened before it can be used. + bool open(); - // TODO: Add a close function? + // TODO: Add a close function? - // Database exceptions - class Exception - { - public: - Exception(const std::string &message): message(message) - { } - virtual ~Exception() - { } - const std::string &getMessage() {return message;} - private: - std::string message; - }; + // Database exceptions + class Exception + { + public: + Exception(const std::string &message): message(message) + { } + virtual ~Exception() + { } + const std::string &getMessage() {return message;} + private: + std::string message; + }; - // - class NotFound: public Exception - { - public: - NotFound(): Exception("Key was not found") - { } - }; + // + class NotFound: public Exception + { + public: + NotFound(): Exception("Key was not found") + { } + }; - // Iteration over database - class Iterator; - class Record - { - public: - Record& operator= (const Record& r) - { + // Iteration over database + class Iterator; + class Record + { + public: + Record& operator= (const Record& r) + { file = r.file; - offset = r.offset; - return *this; - } - float getFloat(size_t field) const - { - assert(field < file.fieldCount); - return *reinterpret_cast(offset+field*4); - } - unsigned int getUInt(size_t field) const - { - assert(field < file.fieldCount); - return *reinterpret_cast(offset+(field*4)); - } - int getInt(size_t field) const - { - assert(field < file.fieldCount); - return *reinterpret_cast(offset+field*4); - } - unsigned char getByte(size_t ofs) const - { - assert(ofs < file.recordSize); - return *reinterpret_cast(offset+ofs); - } - const char *getString(size_t field) const - { - assert(field < file.fieldCount); - size_t stringOffset = getUInt(field); - assert(stringOffset < file.stringSize); - //char * tmp = (char*)file.stringTable + stringOffset; - //unsigned char * tmp2 = file.stringTable + stringOffset; - return reinterpret_cast(file.stringTable + stringOffset); - } - private: - Record(DBCFile &file, unsigned char *offset): file(file), offset(offset) {} - unsigned char *offset; - DBCFile &file; + offset = r.offset; + return *this; + } + float getFloat(size_t field) const + { + assert(field < file.fieldCount); + return *reinterpret_cast(offset+field*4); + } + unsigned int getUInt(size_t field) const + { + assert(field < file.fieldCount); + return *reinterpret_cast(offset+(field*4)); + } + int getInt(size_t field) const + { + assert(field < file.fieldCount); + return *reinterpret_cast(offset+field*4); + } + unsigned char getByte(size_t ofs) const + { + assert(ofs < file.recordSize); + return *reinterpret_cast(offset+ofs); + } + const char *getString(size_t field) const + { + assert(field < file.fieldCount); + size_t stringOffset = getUInt(field); + assert(stringOffset < file.stringSize); + //char * tmp = (char*)file.stringTable + stringOffset; + //unsigned char * tmp2 = file.stringTable + stringOffset; + return reinterpret_cast(file.stringTable + stringOffset); + } + private: + Record(DBCFile &file, unsigned char *offset): file(file), offset(offset) {} + unsigned char *offset; + DBCFile &file; - friend class DBCFile; - friend class Iterator; - }; + friend class DBCFile; + friend class Iterator; + }; - /* Iterator that iterates over records */ - class Iterator - { - public: - Iterator(DBCFile &file, unsigned char *offset): - record(file, offset) {} - /// Advance (prefix only) - Iterator & operator++() { - record.offset += record.file.recordSize; - return *this; - } - /// Return address of current instance - Record const & operator*() const { return record; } - const Record* operator->() const { - return &record; - } - /// Comparison - bool operator==(const Iterator &b) const - { - return record.offset == b.record.offset; - } - bool operator!=(const Iterator &b) const - { - return record.offset != b.record.offset; - } - private: - Record record; - }; + /* Iterator that iterates over records */ + class Iterator + { + public: + Iterator(DBCFile &file, unsigned char *offset): + record(file, offset) {} + /// Advance (prefix only) + Iterator & operator++() { + record.offset += record.file.recordSize; + return *this; + } + /// Return address of current instance + Record const & operator*() const { return record; } + const Record* operator->() const { + return &record; + } + /// Comparison + bool operator==(const Iterator &b) const + { + return record.offset == b.record.offset; + } + bool operator!=(const Iterator &b) const + { + return record.offset != b.record.offset; + } + private: + Record record; + }; - // Get record by id - Record getRecord(size_t id); - /// Get begin iterator over records - Iterator begin(); - /// Get begin iterator over records - Iterator end(); - /// Trivial - size_t getRecordCount() const { return recordCount;} - size_t getFieldCount() const { return fieldCount; } + // Get record by id + Record getRecord(size_t id); + /// Get begin iterator over records + Iterator begin(); + /// Get begin iterator over records + Iterator end(); + /// Trivial + size_t getRecordCount() const { return recordCount;} + size_t getFieldCount() const { return fieldCount; } private: - std::string filename; - size_t recordSize; - size_t recordCount; - size_t fieldCount; - size_t stringSize; - unsigned char *data; - unsigned char *stringTable; + std::string filename; + size_t recordSize; + size_t recordCount; + size_t fieldCount; + size_t stringSize; + unsigned char *data; + unsigned char *stringTable; }; #endif diff --git a/contrib/vmap_extractor_v2/vmapextract/model.cpp b/contrib/vmap_extractor_v2/vmapextract/model.cpp index 7dca7841d74..54c11134ed4 100644 --- a/contrib/vmap_extractor_v2/vmapextract/model.cpp +++ b/contrib/vmap_extractor_v2/vmapextract/model.cpp @@ -16,7 +16,7 @@ bool Model::open() ok = !f.isEof(); - if (!ok) + if (!ok) { f.close(); printf("Error loading model %s\n", filename.c_str()); @@ -40,12 +40,12 @@ bool Model::open() vertices = new Vec3D[header.nVertices]; normals = new Vec3D[header.nVertices]; - for (size_t i=0; inTris; indices = new uint16[nIndices]; - for (size_t i = 0; i0) + if(nIdexes >0) { fwrite(indices, sizeof(unsigned short), nIdexes, output); } @@ -176,9 +176,9 @@ bool Model::ConvertToVMAPModel(char * outfilename) wsize = sizeof(int) + sizeof(float) * 3 * nVertices; fwrite(&wsize, sizeof(int), 1, output); fwrite(&nVertices, sizeof(int), 1, output); - if(nVertices >0) + if(nVertices >0) { - for(int vpos=0; vpos =number of materials it seems - uint16 flags; // Flags - uint16 order; // ? - uint16 op; // Material this texture is part of (index into mat) - uint16 op2; // Always same as above? - int16 colorIndex; // color or -1 - uint16 flagsIndex; // more flags... - uint16 texunit; // Texture unit (0 or 1) - uint16 d4; // ? (seems to be always 1) - uint16 textureid; // Texture id (index into global texture list) - uint16 texunit2; // copy of texture unit value? - uint16 transid; // transparency id (index into transparency list) - uint16 texanimid; // texture animation id + // probably the texture units + // size always >=number of materials it seems + uint16 flags; // Flags + uint16 order; // ? + uint16 op; // Material this texture is part of (index into mat) + uint16 op2; // Always same as above? + int16 colorIndex; // color or -1 + uint16 flagsIndex; // more flags... + uint16 texunit; // Texture unit (0 or 1) + uint16 d4; // ? (seems to be always 1) + uint16 textureid; // Texture id (index into global texture list) + uint16 texunit2; // copy of texture unit value? + uint16 transid; // transparency id (index into transparency list) + uint16 texanimid; // texture animation id }; // block X - render flags struct ModelRenderFlags { - uint16 flags; - uint16 blend; + uint16 flags; + uint16 blend; }; // block G - color defs struct ModelColorDef { - AnimationBlock color; - AnimationBlock opacity; + AnimationBlock color; + AnimationBlock opacity; }; // block H - transp defs struct ModelTransDef { - AnimationBlock trans; + AnimationBlock trans; }; struct ModelTextureDef { - uint32 type; - uint32 flags; - uint32 nameLen; - uint32 nameOfs; + uint32 type; + uint32 flags; + uint32 nameLen; + uint32 nameOfs; }; struct ModelLightDef { - int16 type; - int16 bone; - Vec3D pos; - AnimationBlock ambColor; - AnimationBlock ambIntensity; - AnimationBlock color; - AnimationBlock intensity; - AnimationBlock attStart; - AnimationBlock attEnd; - AnimationBlock unk1; + int16 type; + int16 bone; + Vec3D pos; + AnimationBlock ambColor; + AnimationBlock ambIntensity; + AnimationBlock color; + AnimationBlock intensity; + AnimationBlock attStart; + AnimationBlock attEnd; + AnimationBlock unk1; }; struct ModelCameraDef { - int32 id; - float fov, farclip, nearclip; - AnimationBlock transPos; - Vec3D pos; - AnimationBlock transTarget; - Vec3D target; - AnimationBlock rot; + int32 id; + float fov, farclip, nearclip; + AnimationBlock transPos; + Vec3D pos; + AnimationBlock transTarget; + Vec3D target; + AnimationBlock rot; }; struct ModelParticleParams { - float mid; - uint32 colors[3]; - float sizes[3]; - int16 d[10]; - float unk[3]; - float scales[3]; - float slowdown; - float rotation; - float f2[16]; + float mid; + uint32 colors[3]; + float sizes[3]; + int16 d[10]; + float unk[3]; + float scales[3]; + float slowdown; + float rotation; + float f2[16]; }; struct ModelParticleEmitterDef { int32 id; - int32 flags; - Vec3D pos; - int16 bone; - int16 texture; - int32 nZero1; - int32 ofsZero1; - int32 nZero2; - int32 ofsZero2; - int16 blend; - int16 type; - int16 s1; - int16 s2; - int16 cols; - int16 rows; - AnimationBlock params[10]; - ModelParticleParams p; - AnimationBlock unk; + int32 flags; + Vec3D pos; + int16 bone; + int16 texture; + int32 nZero1; + int32 ofsZero1; + int32 nZero2; + int32 ofsZero2; + int16 blend; + int16 type; + int16 s1; + int16 s2; + int16 cols; + int16 rows; + AnimationBlock params[10]; + ModelParticleParams p; + AnimationBlock unk; }; struct ModelRibbonEmitterDef { - int32 id; - int32 bone; - Vec3D pos; - int32 nTextures; - int32 ofsTextures; - int32 nUnknown; - int32 ofsUnknown; - AnimationBlock color; - AnimationBlock opacity; - AnimationBlock above; - AnimationBlock below; - float res, length, unk; - int16 s1, s2; - AnimationBlock unk1; - AnimationBlock unk2; + int32 id; + int32 bone; + Vec3D pos; + int32 nTextures; + int32 ofsTextures; + int32 nUnknown; + int32 ofsUnknown; + AnimationBlock color; + AnimationBlock opacity; + AnimationBlock above; + AnimationBlock below; + float res, length, unk; + int16 s1, s2; + AnimationBlock unk1; + AnimationBlock unk2; }; diff --git a/contrib/vmap_extractor_v2/vmapextract/mpq.cpp b/contrib/vmap_extractor_v2/vmapextract/mpq.cpp index ae847d8be33..c501525cd30 100644 --- a/contrib/vmap_extractor_v2/vmapextract/mpq.cpp +++ b/contrib/vmap_extractor_v2/vmapextract/mpq.cpp @@ -8,85 +8,85 @@ ArchiveSet gOpenArchives; //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx MPQArchive::MPQArchive(const char* filename) { - BOOL succ = SFileOpenArchive(filename, 0, 0,&hMPQ); - if (succ) - { - MPQArchive*ar = (MPQArchive*)(hMPQ); - printf("Opening %s\n", filename); - gOpenArchives.push_back(ar); + BOOL succ = SFileOpenArchive(filename, 0, 0,&hMPQ); + if (succ) + { + MPQArchive*ar = (MPQArchive*)(hMPQ); + printf("Opening %s\n", filename); + gOpenArchives.push_back(ar); succ = true; - - } - else - { - printf("Error!!!Not open archive %s\n", filename); - } + + } + else + { + printf("Error!!!Not open archive %s\n", filename); + } } void MPQArchive::close() { - SFileCloseArchive(hMPQ); + SFileCloseArchive(hMPQ); } //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx MPQFile::MPQFile(const char* filename): - eof(false), - buffer(0), - pointer(0), - size(0) + eof(false), + buffer(0), + pointer(0), + size(0) { - for(ArchiveSet::iterator i=gOpenArchives.begin(); i!=gOpenArchives.end();++i) - { - - HANDLE hFile = ""; - MPQArchive*(hMPQ) = *i; - BOOL succ = SFileOpenFileEx(hMPQ,filename,0, &hFile); - if (succ) - { - DWORD s = SFileGetFileSize(hFile, 0); - if (!s) - { - eof = true; - buffer = 0; - return; - } + for(ArchiveSet::iterator i=gOpenArchives.begin(); i!=gOpenArchives.end();++i) + { + + HANDLE hFile = ""; + MPQArchive*(hMPQ) = *i; + BOOL succ = SFileOpenFileEx(hMPQ,filename,0, &hFile); + if (succ) + { + DWORD s = SFileGetFileSize(hFile, 0); + if (!s) + { + eof = true; + buffer = 0; + return; + } size = (size_t)s; - buffer = new char[s]; - SFileReadFile(hFile, buffer, s, 0, 0); - SFileCloseFile(hFile); - - eof = false; - return; - } - } - - eof = true; - buffer = 0; - + buffer = new char[s]; + SFileReadFile(hFile, buffer, s, 0, 0); + SFileCloseFile(hFile); + + eof = false; + return; + } + } + + eof = true; + buffer = 0; + } MPQFile::~MPQFile() { - close(); + close(); } size_t MPQFile::read(void* dest, size_t bytes) { - if (eof) - return 0; + if (eof) + return 0; - size_t rpos = pointer + bytes; - if (rpos > size) - { - bytes = size - pointer; - eof = true; - } + size_t rpos = pointer + bytes; + if (rpos > size) + { + bytes = size - pointer; + eof = true; + } - memcpy(dest, &(buffer[pointer]), bytes); + memcpy(dest, &(buffer[pointer]), bytes); - pointer = rpos; + pointer = rpos; - return bytes; + return bytes; } bool MPQFile::isEof() @@ -96,41 +96,41 @@ bool MPQFile::isEof() void MPQFile::seek(int offset) { - pointer = offset; - eof = (pointer >= size); + pointer = offset; + eof = (pointer >= size); } void MPQFile::seekRelative(int offset) { - pointer += offset; - eof = (pointer >= size); + pointer += offset; + eof = (pointer >= size); } void MPQFile::close() { - if (buffer) - delete[] buffer; - buffer = 0; - eof = true; + if (buffer) + delete[] buffer; + buffer = 0; + eof = true; } size_t MPQFile::getSize() { - return size; + return size; } size_t MPQFile::getPos() { - return pointer; + return pointer; } char* MPQFile::getBuffer() { - return buffer; + return buffer; } char* MPQFile::getPointer() { - return buffer + pointer; + return buffer + pointer; } diff --git a/contrib/vmap_extractor_v2/vmapextract/mpq.h b/contrib/vmap_extractor_v2/vmapextract/mpq.h index 79f30afc79b..6364fcba64c 100644 --- a/contrib/vmap_extractor_v2/vmapextract/mpq.h +++ b/contrib/vmap_extractor_v2/vmapextract/mpq.h @@ -3,7 +3,7 @@ #ifndef MPQ_H #define MPQ_H -#define __STORMLIB_SELF__ +#define __STORMLIB_SELF__ #include #include @@ -18,49 +18,49 @@ typedef unsigned int uint32; class MPQArchive { - + public: - HANDLE hMPQ; - MPQArchive(const char* filename); - void close(); + HANDLE hMPQ; + MPQArchive(const char* filename); + void close(); }; - + class MPQFile { - HANDLE hFile; + HANDLE hFile; HANDLE hMPQ; - bool eof; - char *buffer; - size_t pointer, - size; + bool eof; + char *buffer; + size_t pointer, + size; - // disable copying - //MPQFile(const MPQFile &f) {} - //void operator=(const MPQFile &f) {} + // disable copying + //MPQFile(const MPQFile &f) {} + //void operator=(const MPQFile &f) {} public: - MPQFile(const char* filename); - ~MPQFile(); - size_t read(void* dest, size_t bytes); - size_t getSize(); - size_t getPos(); - char* getBuffer(); - char* getPointer(); - bool isEof(); - void seek(int offset); - void seekRelative(int offset); - void close(); + MPQFile(const char* filename); + ~MPQFile(); + size_t read(void* dest, size_t bytes); + size_t getSize(); + size_t getPos(); + char* getBuffer(); + char* getPointer(); + bool isEof(); + void seek(int offset); + void seekRelative(int offset); + void close(); }; inline void flipcc(char *fcc) { - char t; - t=fcc[0]; - fcc[0]=fcc[3]; - fcc[3]=t; - t=fcc[1]; - fcc[1]=fcc[2]; - fcc[2]=t; + char t; + t=fcc[0]; + fcc[0]=fcc[3]; + fcc[3]=t; + t=fcc[1]; + fcc[1]=fcc[2]; + fcc[2]=t; } diff --git a/contrib/vmap_extractor_v2/vmapextract/vec3d.h b/contrib/vmap_extractor_v2/vmapextract/vec3d.h index 88b8e1c4f32..4f3cad15ad0 100644 --- a/contrib/vmap_extractor_v2/vmapextract/vec3d.h +++ b/contrib/vmap_extractor_v2/vmapextract/vec3d.h @@ -8,220 +8,220 @@ class Vec3D { public: - float x,y,z; + float x,y,z; - Vec3D(float x0 = 0.0f, float y0 = 0.0f, float z0 = 0.0f) : x(x0), y(y0), z(z0) {} + Vec3D(float x0 = 0.0f, float y0 = 0.0f, float z0 = 0.0f) : x(x0), y(y0), z(z0) {} - Vec3D(const Vec3D& v) : x(v.x), y(v.y), z(v.z) {} + Vec3D(const Vec3D& v) : x(v.x), y(v.y), z(v.z) {} - Vec3D& operator= (const Vec3D &v) { + Vec3D& operator= (const Vec3D &v) { x = v.x; - y = v.y; - z = v.z; - return *this; - } + y = v.y; + z = v.z; + return *this; + } - Vec3D operator+ (const Vec3D &v) const - { - Vec3D r(x+v.x,y+v.y,z+v.z); + Vec3D operator+ (const Vec3D &v) const + { + Vec3D r(x+v.x,y+v.y,z+v.z); return r; - } + } - Vec3D operator- (const Vec3D &v) const - { - Vec3D r(x-v.x,y-v.y,z-v.z); - return r; - } + Vec3D operator- (const Vec3D &v) const + { + Vec3D r(x-v.x,y-v.y,z-v.z); + return r; + } - float operator* (const Vec3D &v) const - { + float operator* (const Vec3D &v) const + { return x*v.x + y*v.y + z*v.z; - } + } - Vec3D operator* (float d) const - { - Vec3D r(x*d,y*d,z*d); + Vec3D operator* (float d) const + { + Vec3D r(x*d,y*d,z*d); return r; - } + } - friend Vec3D operator* (float d, const Vec3D& v) - { - return v * d; - } + friend Vec3D operator* (float d, const Vec3D& v) + { + return v * d; + } - Vec3D operator% (const Vec3D &v) const - { + Vec3D operator% (const Vec3D &v) const + { Vec3D r(y*v.z-z*v.y, z*v.x-x*v.z, x*v.y-y*v.x); - return r; - } + return r; + } - Vec3D& operator+= (const Vec3D &v) - { - x += v.x; - y += v.y; - z += v.z; - return *this; - } + Vec3D& operator+= (const Vec3D &v) + { + x += v.x; + y += v.y; + z += v.z; + return *this; + } - Vec3D& operator-= (const Vec3D &v) - { - x -= v.x; - y -= v.y; - z -= v.z; - return *this; - } + Vec3D& operator-= (const Vec3D &v) + { + x -= v.x; + y -= v.y; + z -= v.z; + return *this; + } - Vec3D& operator*= (float d) - { - x *= d; - y *= d; - z *= d; - return *this; - } + Vec3D& operator*= (float d) + { + x *= d; + y *= d; + z *= d; + return *this; + } - float lengthSquared() const - { - return x*x+y*y+z*z; - } + float lengthSquared() const + { + return x*x+y*y+z*z; + } - float length() const - { + float length() const + { return sqrt(x*x+y*y+z*z); - } + } - Vec3D& normalize() - { - this->operator*= (1.0f/length()); - return *this; - } + Vec3D& normalize() + { + this->operator*= (1.0f/length()); + return *this; + } - Vec3D operator~ () const - { - Vec3D r(*this); + Vec3D operator~ () const + { + Vec3D r(*this); r.normalize(); - return r; - } + return r; + } - friend std::istream& operator>>(std::istream& in, Vec3D& v) - { - in >> v.x >> v.y >> v.z; - return in; - } + friend std::istream& operator>>(std::istream& in, Vec3D& v) + { + in >> v.x >> v.y >> v.z; + return in; + } - operator float*() - { - return (float*)this; - } + operator float*() + { + return (float*)this; + } }; class Vec2D { public: - float x,y; - - Vec2D(float x0 = 0.0f, float y0 = 0.0f) : x(x0), y(y0) {} + float x,y; - Vec2D(const Vec2D& v) : x(v.x), y(v.y) {} + Vec2D(float x0 = 0.0f, float y0 = 0.0f) : x(x0), y(y0) {} - Vec2D& operator= (const Vec2D &v) { + Vec2D(const Vec2D& v) : x(v.x), y(v.y) {} + + Vec2D& operator= (const Vec2D &v) { x = v.x; - y = v.y; - return *this; - } + y = v.y; + return *this; + } - Vec2D operator+ (const Vec2D &v) const - { - Vec2D r(x+v.x,y+v.y); + Vec2D operator+ (const Vec2D &v) const + { + Vec2D r(x+v.x,y+v.y); return r; - } + } - Vec2D operator- (const Vec2D &v) const - { - Vec2D r(x-v.x,y-v.y); - return r; - } + Vec2D operator- (const Vec2D &v) const + { + Vec2D r(x-v.x,y-v.y); + return r; + } - float operator* (const Vec2D &v) const - { + float operator* (const Vec2D &v) const + { return x*v.x + y*v.y; - } + } - Vec2D operator* (float d) const - { - Vec2D r(x*d,y*d); + Vec2D operator* (float d) const + { + Vec2D r(x*d,y*d); return r; - } + } - friend Vec2D operator* (float d, const Vec2D& v) - { - return v * d; - } + friend Vec2D operator* (float d, const Vec2D& v) + { + return v * d; + } - Vec2D& operator+= (const Vec2D &v) - { - x += v.x; - y += v.y; - return *this; - } + Vec2D& operator+= (const Vec2D &v) + { + x += v.x; + y += v.y; + return *this; + } - Vec2D& operator-= (const Vec2D &v) - { - x -= v.x; - y -= v.y; - return *this; - } + Vec2D& operator-= (const Vec2D &v) + { + x -= v.x; + y -= v.y; + return *this; + } - Vec2D& operator*= (float d) - { - x *= d; - y *= d; - return *this; - } + Vec2D& operator*= (float d) + { + x *= d; + y *= d; + return *this; + } - float lengthSquared() const - { - return x*x+y*y; - } + float lengthSquared() const + { + return x*x+y*y; + } - float length() const - { + float length() const + { return sqrt(x*x+y*y); - } + } - Vec2D& normalize() - { - this->operator*= (1.0f/length()); - return *this; - } + Vec2D& normalize() + { + this->operator*= (1.0f/length()); + return *this; + } - Vec2D operator~ () const - { - Vec2D r(*this); + Vec2D operator~ () const + { + Vec2D r(*this); r.normalize(); - return r; - } + return r; + } - friend std::istream& operator>>(std::istream& in, Vec2D& v) - { + friend std::istream& operator>>(std::istream& in, Vec2D& v) + { in >> v.x >> v.y; - return in; - } + return in; + } - operator float*() - { - return (float*)this; - } + operator float*() + { + return (float*)this; + } }; inline void rotate(float x0, float y0, float *x, float *y, float angle) { - float xa = *x - x0, ya = *y - y0; - *x = xa*cosf(angle) - ya*sinf(angle) + x0; - *y = xa*sinf(angle) + ya*cosf(angle) + y0; + float xa = *x - x0, ya = *y - y0; + *x = xa*cosf(angle) - ya*sinf(angle) + x0; + *y = xa*sinf(angle) + ya*cosf(angle) + y0; } diff --git a/contrib/vmap_extractor_v2/vmapextract/vmapexport.cpp b/contrib/vmap_extractor_v2/vmapextract/vmapexport.cpp index dfc7cddcfdd..d095b84c8ea 100644 --- a/contrib/vmap_extractor_v2/vmapextract/vmapexport.cpp +++ b/contrib/vmap_extractor_v2/vmapextract/vmapexport.cpp @@ -24,7 +24,7 @@ #define __STORMLIB_SELF__ // Don't use StormLib.lib #include "StormLib.h" -#pragma warning(disable : 4505) +#pragma warning(disable : 4505) #pragma comment(lib, "Winmm.lib") //From Extractor @@ -58,7 +58,7 @@ char input_path[1024]="."; bool hasInputPathParam = false; char tmp[512]; bool preciseVectorData = false; -//char gamepath[1024]; +//char gamepath[1024]; //Convert function //bool ConvertADT(char*,char*); @@ -106,9 +106,9 @@ static void ShowProcessedFile(const char * szFileName) int ExtractWmo(const std::vector& pArchiveNames) { - char* szListFile = ""; + char* szListFile = ""; char szLocalFile[MAX_PATH] = ""; - HANDLE hMpq = ""; + HANDLE hMpq = ""; BOOL bResult = FALSE; //const char* ParsArchiveNames[] = {"patch-2.MPQ", "patch.MPQ", "common.MPQ", "expansion.MPQ"}; @@ -128,7 +128,7 @@ int ExtractWmo(const std::vector& pArchiveNames) // Copy files from archive if(nError == ERROR_SUCCESS) - { + { SFILE_FIND_DATA wf; HANDLE hFind = SFileFindFirstFile(hMpq,"*.wmo*", &wf, szListFile); bResult = TRUE; @@ -153,7 +153,7 @@ int ExtractWmo(const std::vector& pArchiveNames) { int m = cpy[i]; if(isdigit(m)) - p++; + p++; } } if(p != 3) @@ -189,12 +189,12 @@ int ExtractWmo(const std::vector& pArchiveNames) bResult = SFileFindNextFile(hFind, &wf); break; } - Wmo_nVertices += fgroup->ConvertToVMAPGroupWmo(output, preciseVectorData); + Wmo_nVertices += fgroup->ConvertToVMAPGroupWmo(output, preciseVectorData); } } fseek(output, 8, SEEK_SET); // store the correct no of vertices fwrite(&Wmo_nVertices,sizeof(int),1,output); - fclose(output); + fclose(output); } } else { fclose(n); @@ -269,7 +269,7 @@ void ParsMapFiles() { for (int x=0; x<64; x++) { - for (int y=0; y<64; y++) + for (int y=0; y<64; y++) { if (ADTFile*ADT = WDT.GetMap(x,y)) { @@ -297,10 +297,10 @@ void getGamePath() //l = RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\Blizzard Entertainment\\Burning Crusade Closed Beta",0,KEY_QUERY_VALUE,&key); l = RegQueryValueEx(key,"InstallPath",0,&t,(LPBYTE)input_path,&s); RegCloseKey(key); - if (strlen(input_path) > 0) - { - if (input_path[strlen(input_path) - 1] != '\\') strcat(input_path, "\\"); - } + if (strlen(input_path) > 0) + { + if (input_path[strlen(input_path) - 1] != '\\') strcat(input_path, "\\"); + } strcat(input_path,"Data\\"); #else strcpy(input_path,"data/"); @@ -450,9 +450,9 @@ bool processArgv(int argc, char ** argv, char*versionString) bool preciseVectorData = false; for(int i=1; i< argc; ++i) { - if(strcmp("-s",argv[i]) == 0) { - preciseVectorData = false; - } else if(strcmp("-d",argv[i]) == 0) { + if(strcmp("-s",argv[i]) == 0) { + preciseVectorData = false; + } else if(strcmp("-d",argv[i]) == 0) { if((i+1) fake priority handling std::vector archives; @@ -548,7 +548,7 @@ int main(int argc, char ** argv) { map_ids[x].id=dbc->getRecord (x).getUInt(0); strcpy(map_ids[x].name,dbc->getRecord(x).getString(1)); - printf("Map - %s\n",map_ids[x].name); + printf("Map - %s\n",map_ids[x].name); } delete dbc; diff --git a/contrib/vmap_extractor_v2/vmapextract/wdtfile.cpp b/contrib/vmap_extractor_v2/vmapextract/wdtfile.cpp index 831cdaae79f..36f3d653f95 100644 --- a/contrib/vmap_extractor_v2/vmapextract/wdtfile.cpp +++ b/contrib/vmap_extractor_v2/vmapextract/wdtfile.cpp @@ -1,4 +1,4 @@ -#define __STORMLIB_SELF__ +#define __STORMLIB_SELF__ #include "wdtfile.h" #include "adtfile.h" @@ -15,106 +15,106 @@ char * wdtGetPlainName(char * FileName) WDTFile::WDTFile(char* file_name, char* file_name1):WDT(file_name) { - filename.append(file_name1,strlen(file_name1)); + filename.append(file_name1,strlen(file_name1)); } bool WDTFile::init(char *map_id) { - if (WDT.isEof()) - { - //printf("Can't find WDT file.\n"); - return false; - } - - char fourcc[5]; - size_t size; - + if (WDT.isEof()) + { + //printf("Can't find WDT file.\n"); + return false; + } - const char dirname[] = "buildings\\dir"; - FILE *dirfile; + char fourcc[5]; + size_t size; + + + const char dirname[] = "buildings\\dir"; + FILE *dirfile; dirfile = fopen(dirname, "ab"); - if(!dirfile) - { - printf("Can't open dirfile!'%s'\n"); - return false; - } + if(!dirfile) + { + printf("Can't open dirfile!'%s'\n"); + return false; + } - while (!WDT.isEof()) - { - WDT.read(fourcc,4); - WDT.read(&size, 4); + while (!WDT.isEof()) + { + WDT.read(fourcc,4); + WDT.read(&size, 4); - flipcc(fourcc); - fourcc[4] = 0; + flipcc(fourcc); + fourcc[4] = 0; - size_t nextpos = WDT.getPos() + size; + size_t nextpos = WDT.getPos() + size; - if (!strcmp(fourcc,"MAIN")) - { - } - if (!strcmp(fourcc,"MWMO")) - { - // global map objects - if (size) - { - char *buf = new char[size]; - WDT.read(buf, size); - char *p=buf; - int q = 0; - gWmoInstansName = new string[size]; - while (p=0 && z >= 0 && x<64 && z<64)) return NULL; - - char name[512]; + if(!(x>=0 && z >= 0 && x<64 && z<64)) return NULL; - sprintf(name,"World\\Maps\\%s\\%s_%d_%d.adt", filename.c_str(), filename.c_str(), x, z); - return new ADTFile(name); + char name[512]; + + sprintf(name,"World\\Maps\\%s\\%s_%d_%d.adt", filename.c_str(), filename.c_str(), x, z); + return new ADTFile(name); } diff --git a/contrib/vmap_extractor_v2/vmapextract/wdtfile.h b/contrib/vmap_extractor_v2/vmapextract/wdtfile.h index 7a7002a2ed8..0baef22f185 100644 --- a/contrib/vmap_extractor_v2/vmapextract/wdtfile.h +++ b/contrib/vmap_extractor_v2/vmapextract/wdtfile.h @@ -1,7 +1,7 @@ #ifndef WDTFILE_H #define WDTFILE_H -#define __STORMLIB_SELF__ +#define __STORMLIB_SELF__ #include "mpq.h" #include "adtfile.h" @@ -12,19 +12,19 @@ class WDTFile { public: - WDTFile(char* file_name, char* file_name1); - ~WDTFile(void); - bool init(char *map_id); - - string* gWmoInstansName; - int gnWMO, nMaps; - - ADTFile* GetMap(int x, int z); + WDTFile(char* file_name, char* file_name1); + ~WDTFile(void); + bool init(char *map_id); + + string* gWmoInstansName; + int gnWMO, nMaps; + + ADTFile* GetMap(int x, int z); private: - MPQFile WDT; - bool maps[64][64]; - string filename; + MPQFile WDT; + bool maps[64][64]; + string filename; }; #endif diff --git a/contrib/vmap_extractor_v2/vmapextract/wmo.cpp b/contrib/vmap_extractor_v2/vmapextract/wmo.cpp index 9dfda6f771f..9b10bea01a7 100644 --- a/contrib/vmap_extractor_v2/vmapextract/wmo.cpp +++ b/contrib/vmap_extractor_v2/vmapextract/wmo.cpp @@ -15,114 +15,114 @@ WMORoot::WMORoot(std::string &filename) : filename(filename) bool WMORoot::open() { - MPQFile f(filename.c_str()); - if(f.isEof ()) - { - printf("No such file.\n"); - return false; - } + MPQFile f(filename.c_str()); + if(f.isEof ()) + { + printf("No such file.\n"); + return false; + } - size_t size; - char fourcc[5]; - bbcorn1[3] = 0; - bbcorn2[3]= 0; + size_t size; + char fourcc[5]; + bbcorn1[3] = 0; + bbcorn2[3]= 0; - while (!f.isEof ()) - { - f.read(fourcc,4); - f.read(&size, 4); + while (!f.isEof ()) + { + f.read(fourcc,4); + f.read(&size, 4); - flipcc(fourcc); - fourcc[4] = 0; + flipcc(fourcc); + fourcc[4] = 0; - size_t nextpos = f.getPos() + size; + size_t nextpos = f.getPos() + size; - if (!strcmp(fourcc,"MOHD"))//header - { + if (!strcmp(fourcc,"MOHD"))//header + { - f.read(&nTextures, 4); - f.read(&nGroups, 4); - f.read(&nP, 4); - f.read(&nLights, 4); - f.read(&nModels, 4); - f.read(&nDoodads, 4); - f.read(&nDoodadSets, 4); - f.read(&col, 4); - f.read(&RootID, 4); - f.read(bbcorn1,12); - f.read(bbcorn2,12); - break; - } - /* - else if (!strcmp(fourcc,"MOTX")) - { + f.read(&nTextures, 4); + f.read(&nGroups, 4); + f.read(&nP, 4); + f.read(&nLights, 4); + f.read(&nModels, 4); + f.read(&nDoodads, 4); + f.read(&nDoodadSets, 4); + f.read(&col, 4); + f.read(&RootID, 4); + f.read(bbcorn1,12); + f.read(bbcorn2,12); + break; + } + /* + else if (!strcmp(fourcc,"MOTX")) + { - } - else if (!strcmp(fourcc,"MOMT")) - { + } + else if (!strcmp(fourcc,"MOMT")) + { - } - else if (!strcmp(fourcc,"MOGN")) - { + } + else if (!strcmp(fourcc,"MOGN")) + { - } - else if (!strcmp(fourcc,"MOGI")) - { + } + else if (!strcmp(fourcc,"MOGI")) + { - } - else if (!strcmp(fourcc,"MOLT")) - { + } + else if (!strcmp(fourcc,"MOLT")) + { - } - else if (!strcmp(fourcc,"MODN")) - { + } + else if (!strcmp(fourcc,"MODN")) + { - } - else if (!strcmp(fourcc,"MODS")) - { + } + else if (!strcmp(fourcc,"MODS")) + { - } - else if (!strcmp(fourcc,"MODD")) - { + } + else if (!strcmp(fourcc,"MODD")) + { - } - else if (!strcmp(fourcc,"MOSB")) - { + } + else if (!strcmp(fourcc,"MOSB")) + { - } - else if (!strcmp(fourcc,"MOPV")) - { + } + else if (!strcmp(fourcc,"MOPV")) + { - } - else if (!strcmp(fourcc,"MOPT")) - { + } + else if (!strcmp(fourcc,"MOPT")) + { - } - else if (!strcmp(fourcc,"MOPR")) - { + } + else if (!strcmp(fourcc,"MOPR")) + { - } - else if (!strcmp(fourcc,"MFOG")) - { + } + else if (!strcmp(fourcc,"MFOG")) + { - } - */ - f.seek((int)nextpos); - } - f.close (); - return true; + } + */ + f.seek((int)nextpos); + } + f.close (); + return true; } //--------------------------------------------------------------------------- bool WMORoot::ConvertToVMAPRootWmo(FILE *pOutfile) { - //printf("Convert RootWmo...\n"); + //printf("Convert RootWmo...\n"); - fwrite("VMAP002",1,8,pOutfile); - unsigned int nVectors = 0; - fwrite(&nVectors,sizeof(nVectors),1,pOutfile); // will be filled later - fwrite(&nGroups,4,1,pOutfile); - return true; + fwrite("VMAP002",1,8,pOutfile); + unsigned int nVectors = 0; + fwrite(&nVectors,sizeof(nVectors),1,pOutfile); // will be filled later + fwrite(&nGroups,4,1,pOutfile); + return true; } //---------------------------------------------------------------------------- @@ -137,309 +137,309 @@ WMOGroup::WMOGroup(std::string &filename) : filename(filename) //--------------------------------------------------------------------------- bool WMOGroup::open() { - MPQFile f(filename.c_str()); - if(f.isEof ()) - { - printf("No such file.\n"); - return false; - } - size_t size; - char fourcc[5]; - bbcorn1[3] = 0; - bbcorn2[3] = 0; - while (!f.isEof ()) - { - f.read(fourcc,4); - f.read(&size, 4); - flipcc(fourcc); - if (!strcmp(fourcc,"MOGP"))//Fix sizeoff = Data size. - { - size = 68; - } - fourcc[4] = 0; - size_t nextpos = f.getPos() + size; - LiquEx_size = 0; - liquflags = 0; + MPQFile f(filename.c_str()); + if(f.isEof ()) + { + printf("No such file.\n"); + return false; + } + size_t size; + char fourcc[5]; + bbcorn1[3] = 0; + bbcorn2[3] = 0; + while (!f.isEof ()) + { + f.read(fourcc,4); + f.read(&size, 4); + flipcc(fourcc); + if (!strcmp(fourcc,"MOGP"))//Fix sizeoff = Data size. + { + size = 68; + } + fourcc[4] = 0; + size_t nextpos = f.getPos() + size; + LiquEx_size = 0; + liquflags = 0; - if (!strcmp(fourcc,"MOGP"))//header - { - f.seekRelative(-4); - f.read(&offsize, 4); - f.read(&flag, 4); - f.read(&flag1, 4); - f.read(&Xid, 4); - f.read(bbcorn1, 12); - f.read(bbcorn2, 12); - f.read(&Xid2, 4); - f.read(&Xid3, 4); - f.read(&zero1, 4); - f.read(&Xflag, 4); - f.read(&nTexture,4); - f.read(&GroupID,4); - } - else if (!strcmp(fourcc,"MOPY")) - { - MOPY = new char[size]; - mopy_size = size; - nTriangles = (int)size / 2; - f.read(MOPY, size); - } - else if (!strcmp(fourcc,"MOVI")) - { - MOVI = new uint16[size/2]; - f.read(MOVI, size); + if (!strcmp(fourcc,"MOGP"))//header + { + f.seekRelative(-4); + f.read(&offsize, 4); + f.read(&flag, 4); + f.read(&flag1, 4); + f.read(&Xid, 4); + f.read(bbcorn1, 12); + f.read(bbcorn2, 12); + f.read(&Xid2, 4); + f.read(&Xid3, 4); + f.read(&zero1, 4); + f.read(&Xflag, 4); + f.read(&nTexture,4); + f.read(&GroupID,4); + } + else if (!strcmp(fourcc,"MOPY")) + { + MOPY = new char[size]; + mopy_size = size; + nTriangles = (int)size / 2; + f.read(MOPY, size); + } + else if (!strcmp(fourcc,"MOVI")) + { + MOVI = new uint16[size/2]; + f.read(MOVI, size); - } - else if (!strcmp(fourcc,"MOVT")) - { - MOVT = new float[size/4]; - f.read(MOVT, size); - nVertices = (int)size / 12; - } - else if (!strcmp(fourcc,"MONR")) - { - } - else if (!strcmp(fourcc,"MOTV")) - { - } - else if (!strcmp(fourcc,"MOBA")) - { - MOBA = new uint16[size/2]; - moba_size = size/2; - f.read(MOBA, size); - } - else if (!strcmp(fourcc,"MLIQ")) - { - liquflags |= 1; - WMOLiquidHeader hlq; - f.read(&hlq, 0x1E); - float ydir = -1.0f; - hlq_xverts = hlq.xverts; - hlq_yverts = hlq.yverts; - int noVer = hlq.xverts * hlq.yverts; - float tilesize = CHUNKSIZE / 8.0f; - LiquEx_size = sizeof(float) * 3 * noVer; - LiquEx = new float[sizeof(float) * 3 * noVer]; - int p = 0; + } + else if (!strcmp(fourcc,"MOVT")) + { + MOVT = new float[size/4]; + f.read(MOVT, size); + nVertices = (int)size / 12; + } + else if (!strcmp(fourcc,"MONR")) + { + } + else if (!strcmp(fourcc,"MOTV")) + { + } + else if (!strcmp(fourcc,"MOBA")) + { + MOBA = new uint16[size/2]; + moba_size = size/2; + f.read(MOBA, size); + } + else if (!strcmp(fourcc,"MLIQ")) + { + liquflags |= 1; + WMOLiquidHeader hlq; + f.read(&hlq, 0x1E); + float ydir = -1.0f; + hlq_xverts = hlq.xverts; + hlq_yverts = hlq.yverts; + int noVer = hlq.xverts * hlq.yverts; + float tilesize = CHUNKSIZE / 8.0f; + LiquEx_size = sizeof(float) * 3 * noVer; + LiquEx = new float[sizeof(float) * 3 * noVer]; + int p = 0; - for (int j=0; j0) { - if(fwrite(MOVI, sizeof(unsigned short), nIdexes, output) != nIdexes) { printf("Error while writing file indexarray"); exit(0); } - } + if(fwrite("INDX",4, 1, output) != 1) { printf("Error while writing file nbraches ID"); exit(0); } + int wsize = sizeof(uint32) + sizeof(unsigned short) * nIdexes; + if(fwrite(&wsize, sizeof(int), 1, output) != 1) { printf("Error while writing file wsize"); } + if(fwrite(&nIdexes, sizeof(uint32), 1, output) != 1) { printf("Error while writing file nIndexes"); exit(0); } + if(nIdexes >0) { + if(fwrite(MOVI, sizeof(unsigned short), nIdexes, output) != nIdexes) { printf("Error while writing file indexarray"); exit(0); } + } - if(fwrite("VERT",4, 1, output) != 1) { printf("Error while writing file nbraches ID"); exit(0); } - wsize = sizeof(int) + sizeof(float) * 3 * nVertices; - if(fwrite(&wsize, sizeof(int), 1, output) != 1) { printf("Error while writing file wsize"); } - if(fwrite(&nVertices, sizeof(int), 1, output) != 1) { printf("Error while writing file nVertices"); exit(0); } - if(nVertices >0) { - if(fwrite(MOVT, sizeof(float)*3, nVertices, output) != nVertices) { printf("Error while writing file vectors"); exit(0); } - } + if(fwrite("VERT",4, 1, output) != 1) { printf("Error while writing file nbraches ID"); exit(0); } + wsize = sizeof(int) + sizeof(float) * 3 * nVertices; + if(fwrite(&wsize, sizeof(int), 1, output) != 1) { printf("Error while writing file wsize"); } + if(fwrite(&nVertices, sizeof(int), 1, output) != 1) { printf("Error while writing file nVertices"); exit(0); } + if(nVertices >0) { + if(fwrite(MOVT, sizeof(float)*3, nVertices, output) != nVertices) { printf("Error while writing file vectors"); exit(0); } + } - if(LiquEx_size != 0) - { - int LIQU_h[] = {0x5551494C,LiquEx_size+8,hlq_xverts,hlq_yverts};// "LIQU" - fwrite(LIQU_h,4,4,output); - fwrite(LiquEx,4,LiquEx_size/4,output); - delete [] LiquEx; - } + if(LiquEx_size != 0) + { + int LIQU_h[] = {0x5551494C,LiquEx_size+8,hlq_xverts,hlq_yverts};// "LIQU" + fwrite(LIQU_h,4,4,output); + fwrite(LiquEx,4,LiquEx_size/4,output); + delete [] LiquEx; + } - return nTriangles; - } else { - //printf("Convert GroupWmo...\n"); - //-------GRP ------------------------------------- - fwrite(&liquflags,sizeof(uint32),1,output); - char GRP[] = "GRP "; - fwrite(GRP,1,4,output); - int k = 0; - int moba_batch = moba_size/12; - MobaEx = new int[moba_batch*4]; - for(int i=8; i MoviExSort[i+1]) - { - hold = MoviExSort[i]; - MoviExSort[i] = MoviExSort[i+1]; - MoviExSort[i+1] = hold; - } - //double = 65535 - else - if (MoviExSort[i] == MoviExSort[i+1]) - MoviExSort[i+1] = 65535; - } - } - // double delet - uint16 s = 0; - for (int i=0; i < IndexExTr_size*3; i++) - { - if (MoviExSort[i]!=65535) - { - MoviExSort[s] = MoviExSort[i]; - s++; - } - } - MovtExSort = new uint16[s]; - for (int i=0; i < s; i++) - { - MovtExSort[i] = MoviExSort[i]; - } + uint16 hold; + for (int pass = 1; pass < IndexExTr_size*3; pass++) + { + for (int i=0; i < IndexExTr_size*3-1; i++) + { + if (MoviExSort[i] > MoviExSort[i+1]) + { + hold = MoviExSort[i]; + MoviExSort[i] = MoviExSort[i+1]; + MoviExSort[i+1] = hold; + } + //double = 65535 + else + if (MoviExSort[i] == MoviExSort[i+1]) + MoviExSort[i+1] = 65535; + } + } + // double delet + uint16 s = 0; + for (int i=0; i < IndexExTr_size*3; i++) + { + if (MoviExSort[i]!=65535) + { + MoviExSort[s] = MoviExSort[i]; + s++; + } + } + MovtExSort = new uint16[s]; + for (int i=0; i < s; i++) + { + MovtExSort[i] = MoviExSort[i]; + } - for (int i=0; i < IndexExTr_size*3; i++) - { - uint16 b = MoviEx[i]; - for (uint16 x = 0; x < s; x++) - { - if(MoviExSort[x] == b) - { + for (int i=0; i < IndexExTr_size*3; i++) + { + uint16 b = MoviEx[i]; + for (uint16 x = 0; x < s; x++) + { + if(MoviExSort[x] == b) + { - MoviEx[i] = x; - break; - } - } + MoviEx[i] = x; + break; + } + } - } - int INDX[] = {0x58444E49,IndexExTr_size*6+4,IndexExTr_size*3}; - fwrite(INDX,4,3,output); - fwrite(MoviEx,2,IndexExTr_size*3,output); + } + int INDX[] = {0x58444E49,IndexExTr_size*6+4,IndexExTr_size*3}; + fwrite(INDX,4,3,output); + fwrite(MoviEx,2,IndexExTr_size*3,output); - delete [] MoviEx; - delete [] MoviExSort; - delete [] IndexExTr; + delete [] MoviEx; + delete [] MoviExSort; + delete [] IndexExTr; - //----------VERT--------- - //-----MOVT---------- - int d = 0; - MovtEx = new float[s*3]; - for (uint16 i=0; i> 16; + doodadset = (d2 & 0xFFFF0000) >> 16; - int realx1 = (int) ((float) pos2.x / 533.333333f); - int realy1 = (int) ((float) pos2.z / 533.333333f); - int realx2 = (int) ((float) pos3.x / 533.333333f); - int realy2 = (int) ((float) pos3.z / 533.333333f); + int realx1 = (int) ((float) pos2.x / 533.333333f); + int realy1 = (int) ((float) pos2.z / 533.333333f); + int realx2 = (int) ((float) pos3.x / 533.333333f); + int realy2 = (int) ((float) pos3.z / 533.333333f); - if(realx1 < 0) - { - realx1 +=20; realx2+=20; - } - if(realy1 < 0) - { - realy1 +=20; realy2+=20; - } // hack to prevent neg. values + if(realx1 < 0) + { + realx1 +=20; realx2+=20; + } + if(realy1 < 0) + { + realy1 +=20; realy2+=20; + } // hack to prevent neg. values - //-----------add_in _dir_file---------------- + //-----------add_in _dir_file---------------- - char tempname[512]; - // const char dirname[] = "buildings\\dir"; + char tempname[512]; + // const char dirname[] = "buildings\\dir"; - sprintf(tempname, "buildings\\%s", WmoInstName); - FILE *input; - input = fopen(tempname, "r+b"); - if(!input) - { - return; - } - fseek(input, 8, SEEK_SET); // get the correct no of vertices - int nVertices; - fread(&nVertices, sizeof (int), 1, input); - fclose(input); - if(nVertices == 0) - { - return; - } + sprintf(tempname, "buildings\\%s", WmoInstName); + FILE *input; + input = fopen(tempname, "r+b"); + if(!input) + { + return; + } + fseek(input, 8, SEEK_SET); // get the correct no of vertices + int nVertices; + fread(&nVertices, sizeof (int), 1, input); + fclose(input); + if(nVertices == 0) + { + return; + } - /* FILE *dirfile; - dirfile = fopen(dirname, "ab"); - if(!dirfile) - { - printf("Can't open dirfile!'%s'\n"); - return; - } - */ - float x,z; - x = pos.x; - z = pos.z; - if(x==0 && z == 0) - { x = 533.33333f*32; z = 533.33333f*32; } - fprintf(pDirfile,"%s/%s %f,%f,%f_%f,%f,%f 1.0 %d %d %d,%d %d\n", - MapName, - WmoInstName, - (float) x, (float) pos.y, (float) z, - (float) rot.x, (float) rot.y, (float) rot.z, - nVertices, - realx1, realy1, - realx2, realy2 - ); + /* FILE *dirfile; + dirfile = fopen(dirname, "ab"); + if(!dirfile) + { + printf("Can't open dirfile!'%s'\n"); + return; + } + */ + float x,z; + x = pos.x; + z = pos.z; + if(x==0 && z == 0) + { x = 533.33333f*32; z = 533.33333f*32; } + fprintf(pDirfile,"%s/%s %f,%f,%f_%f,%f,%f 1.0 %d %d %d,%d %d\n", + MapName, + WmoInstName, + (float) x, (float) pos.y, (float) z, + (float) rot.x, (float) rot.y, (float) rot.z, + nVertices, + realx1, realy1, + realx2, realy2 + ); - // fclose(dirfile); -} + // fclose(dirfile); +} diff --git a/dep/ACE_wrappers/ace/Array_Map.h b/dep/ACE_wrappers/ace/Array_Map.h index 67aa8d94b23..ce06334217d 100644 --- a/dep/ACE_wrappers/ace/Array_Map.h +++ b/dep/ACE_wrappers/ace/Array_Map.h @@ -159,7 +159,7 @@ public: /// Return @c true if the map is empty, else @c false. bool is_empty (void) const; // ACE style - /** + /** * Return @c true if the map is empty, else @c false. We recommend * using @c is_empty() instead since it's more consistent with the * ACE container naming conventions. diff --git a/dep/ACE_wrappers/ace/CDR_Base.h b/dep/ACE_wrappers/ace/CDR_Base.h index 9c5851b2206..d840bbe097e 100644 --- a/dep/ACE_wrappers/ace/CDR_Base.h +++ b/dep/ACE_wrappers/ace/CDR_Base.h @@ -124,7 +124,7 @@ public: /// Use whichever byte order is native to this machine. BYTE_ORDER_NATIVE = ACE_CDR_BYTE_ORDER }; - + /** * Do byte swapping for each basic IDL type size. There exist only * routines to put byte, halfword (2 bytes), word (4 bytes), diff --git a/dep/ACE_wrappers/ace/CDR_Size.cpp b/dep/ACE_wrappers/ace/CDR_Size.cpp index 96970927037..7c96aae7ee9 100644 --- a/dep/ACE_wrappers/ace/CDR_Size.cpp +++ b/dep/ACE_wrappers/ace/CDR_Size.cpp @@ -23,13 +23,13 @@ ACE_SizeCDR::write_wchar (ACE_CDR::WChar x) errno = EACCES; return (this->good_bit_ = false); } - + if (static_cast (major_version_) == 1 && static_cast (minor_version_) == 2) { ACE_CDR::Octet len = static_cast (ACE_OutputCDR::wchar_maxbytes ()); - + if (this->write_1 (&len)) { if (ACE_OutputCDR::wchar_maxbytes () == sizeof(ACE_CDR::WChar)) @@ -65,7 +65,7 @@ ACE_SizeCDR::write_wchar (ACE_CDR::WChar x) errno = EINVAL; return (this->good_bit_ = false); } - + if (ACE_OutputCDR::wchar_maxbytes () == sizeof (ACE_CDR::WChar)) { const void *temp = &x; @@ -76,7 +76,7 @@ ACE_SizeCDR::write_wchar (ACE_CDR::WChar x) ACE_CDR::Short sx = static_cast (x); return this->write_2 (reinterpret_cast (&sx)); } - + ACE_CDR::Octet ox = static_cast (x); return this->write_1 (reinterpret_cast (&ox)); } @@ -138,9 +138,9 @@ ACE_SizeCDR::write_wstring (ACE_CDR::ULong len, this->write_ulong ( ACE_Utils::truncate_cast ( ACE_OutputCDR::wchar_maxbytes () * len)); - + if (good_ulong) - { + { return this->write_wchar_array (x, len); } } diff --git a/dep/ACE_wrappers/ace/CDR_Stream.cpp b/dep/ACE_wrappers/ace/CDR_Stream.cpp index 80b405467ec..da2a1c3de52 100644 --- a/dep/ACE_wrappers/ace/CDR_Stream.cpp +++ b/dep/ACE_wrappers/ace/CDR_Stream.cpp @@ -379,7 +379,7 @@ ACE_OutputCDR::write_wstring (ACE_CDR::ULong len, this->write_ulong ( ACE_Utils::truncate_cast ( ACE_OutputCDR::wchar_maxbytes_ * len)); - + if (good_ulong) { return this->write_wchar_array (x, len); @@ -1371,7 +1371,7 @@ ACE_InputCDR::read_wstring (ACE_CDR::WChar*& x) } ACE_CDR::ULong len = 0; - + if (!this->read_ulong (len)) { return false; diff --git a/dep/ACE_wrappers/ace/Codecs.cpp b/dep/ACE_wrappers/ace/Codecs.cpp index 71491fe1c44..a9fffb79b98 100644 --- a/dep/ACE_wrappers/ace/Codecs.cpp +++ b/dep/ACE_wrappers/ace/Codecs.cpp @@ -71,7 +71,7 @@ ACE_Base64::encode (const ACE_Byte* input, result[pos++] = alphabet[bits & 0x3f]; cols += 4; if (cols == max_columns) { - if (is_chunked) + if (is_chunked) result[pos++] = '\n'; cols = 0; } diff --git a/dep/ACE_wrappers/ace/Hash_Map_With_Allocator_T.h b/dep/ACE_wrappers/ace/Hash_Map_With_Allocator_T.h index 8ac9a41ef28..5d5dabc093b 100644 --- a/dep/ACE_wrappers/ace/Hash_Map_With_Allocator_T.h +++ b/dep/ACE_wrappers/ace/Hash_Map_With_Allocator_T.h @@ -42,7 +42,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL * is meaningful! That is why we need this wrapper, which * insures that appropriate allocator pointer is in place for * each call. - * + * * At some point it would be a good idea to update this class to * use the new "two allocator" technique provided by @c * ACE_Hash_Map_Manager_Ex. diff --git a/dep/ACE_wrappers/ace/Hash_Multi_Map_Manager_T.h b/dep/ACE_wrappers/ace/Hash_Multi_Map_Manager_T.h index dadfd19d8bc..e9a8ad0d182 100644 --- a/dep/ACE_wrappers/ace/Hash_Multi_Map_Manager_T.h +++ b/dep/ACE_wrappers/ace/Hash_Multi_Map_Manager_T.h @@ -553,7 +553,7 @@ protected: ACE_Allocator *table_allocator_; /// Addidtional allocator for entries, so it should be able to - /// allocate 'size' / chunks of sizeof + /// allocate 'size' / chunks of sizeof /// (@c ACE_Hash_Multi_Map_Entry<@c EXT_ID, @c INT_ID>) bytes each. ACE_Allocator *entry_allocator_; diff --git a/dep/ACE_wrappers/ace/MEM_IO.cpp b/dep/ACE_wrappers/ace/MEM_IO.cpp index ff919b7e0e9..f98d6c326bb 100644 --- a/dep/ACE_wrappers/ace/MEM_IO.cpp +++ b/dep/ACE_wrappers/ace/MEM_IO.cpp @@ -75,13 +75,13 @@ ACE_Reactive_MEM_IO::send_buf (ACE_MEM_SAP_Node *buf, { return -1; } - + // The offset. ACE_OFF_T offset = ACE_Utils::truncate_cast ( reinterpret_cast (buf) - static_cast (this->shm_malloc_->base_addr ())); - + // Send the offset value over the socket. if (ACE::send (this->handle_, (const char *) &offset, @@ -94,7 +94,7 @@ ACE_Reactive_MEM_IO::send_buf (ACE_MEM_SAP_Node *buf, return -1; } - + return ACE_Utils::truncate_cast (buf->size ()); } @@ -280,12 +280,12 @@ ACE_MT_MEM_IO::recv_buf (ACE_MEM_SAP_Node *&buf, ACE_GUARD_RETURN (ACE_SYNCH_PROCESS_MUTEX, ace_mon, *this->recv_channel_.lock_, -1); buf = this->recv_channel_.queue_.read (); - + if (buf != 0) { return ACE_Utils::truncate_cast (buf->size ()); } - + return -1; } } @@ -403,9 +403,9 @@ ACE_MEM_IO::send (const ACE_Message_Block *message_block, reinterpret_cast ( this->deliver_strategy_->acquire_buffer ( ACE_Utils::truncate_cast (len))); - + size_t n = 0; - + while (message_block != 0) { ACE_OS::memcpy (static_cast (buf->data ()) + n, @@ -429,7 +429,7 @@ ACE_MEM_IO::send (const ACE_Message_Block *message_block, 0, timeout); } - + return 0; } diff --git a/dep/ACE_wrappers/ace/MMAP_Memory_Pool.cpp b/dep/ACE_wrappers/ace/MMAP_Memory_Pool.cpp index 61f02a65432..b759816dd76 100644 --- a/dep/ACE_wrappers/ace/MMAP_Memory_Pool.cpp +++ b/dep/ACE_wrappers/ace/MMAP_Memory_Pool.cpp @@ -311,12 +311,12 @@ ACE_MMAP_Memory_Pool::map_file (size_t map_size) { #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1) this->base_addr_ = this->mmap_.addr (); - + if (obase_addr && this->base_addr_ != obase_addr) { ACE_BASED_POINTER_REPOSITORY::instance ()->unbind (obase_addr); } - + ACE_BASED_POINTER_REPOSITORY::instance ()->bind (this->base_addr_, map_size); #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */ diff --git a/dep/ACE_wrappers/ace/Message_Queue_T.cpp b/dep/ACE_wrappers/ace/Message_Queue_T.cpp index 38413ba7e28..742ecf3a85d 100644 --- a/dep/ACE_wrappers/ace/Message_Queue_T.cpp +++ b/dep/ACE_wrappers/ace/Message_Queue_T.cpp @@ -1028,12 +1028,12 @@ ACE_Message_Queue::ACE_Message_Queue (size_t hwm, char pid_buf[sizeof (int) + 1]; ACE_OS::sprintf (pid_buf, "%d", ACE_OS::getpid ()); pid_buf[sizeof (int)] = '\0'; - + const int addr_nibbles = 2 * sizeof (ptrdiff_t); char addr_buf[addr_nibbles + 1]; ACE_OS::sprintf (addr_buf, "%p", this); addr_buf[addr_nibbles] = '\0'; - + ACE_CString name_str ("Message_Queue_"); name_str += pid_buf; name_str += '_'; @@ -2255,7 +2255,7 @@ ACE_Dynamic_Message_Queue::enqueue_i (ACE_Message_Block *new_item // Refresh priority status boundaries in the queue. result = this->refresh_queue (current_time); - + if (result < 0) { return result; diff --git a/dep/ACE_wrappers/ace/Monitor_Point_Registry.cpp b/dep/ACE_wrappers/ace/Monitor_Point_Registry.cpp index 4c3844f7ea5..a6d5e983613 100644 --- a/dep/ACE_wrappers/ace/Monitor_Point_Registry.cpp +++ b/dep/ACE_wrappers/ace/Monitor_Point_Registry.cpp @@ -42,7 +42,7 @@ namespace ACE type->add_ref (); status = this->map_.bind (type->name (), type); - + /// Temporary debugging code. // ACE_DEBUG ((LM_DEBUG, "adding %s\n", type->name ())); } @@ -75,7 +75,7 @@ namespace ACE ACE_CString name_str (name, 0, false); status = this->map_.unbind (name_str, mp); - + /// Temporary debugging code. // ACE_DEBUG ((LM_DEBUG, "removing %s\n", name_str.c_str ())); } diff --git a/dep/ACE_wrappers/ace/OS_NS_stdio.h b/dep/ACE_wrappers/ace/OS_NS_stdio.h index e818a94d356..306249d94bc 100644 --- a/dep/ACE_wrappers/ace/OS_NS_stdio.h +++ b/dep/ACE_wrappers/ace/OS_NS_stdio.h @@ -516,7 +516,7 @@ namespace ACE_OS { #if !defined (ACE_HAS_VASPRINTF) extern ACE_Export - int vasprintf_emulation (char **bufp, const char *format, va_list argptr); + int vasprintf_emulation (char **bufp, const char *format, va_list argptr); #endif /* !ACE_HAS_VASPRINTF */ #if defined (ACE_HAS_WCHAR) diff --git a/dep/ACE_wrappers/ace/OS_NS_unistd.cpp b/dep/ACE_wrappers/ace/OS_NS_unistd.cpp index dbaa92ef341..d5d538fec60 100644 --- a/dep/ACE_wrappers/ace/OS_NS_unistd.cpp +++ b/dep/ACE_wrappers/ace/OS_NS_unistd.cpp @@ -851,7 +851,7 @@ ACE_OS::string_to_argv (ACE_TCHAR *buf, { delete [] argp; } - + errno = ENOMEM; return -1; } diff --git a/dep/ACE_wrappers/ace/Priority_Reactor.cpp b/dep/ACE_wrappers/ace/Priority_Reactor.cpp index 9b46b641343..9d11bdc4715 100644 --- a/dep/ACE_wrappers/ace/Priority_Reactor.cpp +++ b/dep/ACE_wrappers/ace/Priority_Reactor.cpp @@ -84,7 +84,7 @@ ACE_Priority_Reactor::build_bucket (ACE_Handle_Set &dispatch_mask, (handle = handle_iter ()) != ACE_INVALID_HANDLE; ) { - ACE_Event_Handler *event_handler = + ACE_Event_Handler *event_handler = this->handler_rep_.find (handle); if (event_handler == 0) return -1; diff --git a/dep/ACE_wrappers/ace/Priority_Reactor.h b/dep/ACE_wrappers/ace/Priority_Reactor.h index bb4150925cd..3bac29a6770 100644 --- a/dep/ACE_wrappers/ace/Priority_Reactor.h +++ b/dep/ACE_wrappers/ace/Priority_Reactor.h @@ -75,7 +75,7 @@ private: void init_bucket (void); /// Build the bucket from the given dispatch_mask. Return -1 on - /// failure, 0 otherwise. + /// failure, 0 otherwise. int build_bucket (ACE_Handle_Set& dispatch_mask, int &min_priority, int &max_priority); diff --git a/dep/ACE_wrappers/ace/Process.h b/dep/ACE_wrappers/ace/Process.h index 4454d9cc604..33fad9fa0b7 100644 --- a/dep/ACE_wrappers/ace/Process.h +++ b/dep/ACE_wrappers/ace/Process.h @@ -439,7 +439,7 @@ protected: ACE_TCHAR process_name_[MAXPATHLEN + 1]; /// Indicate if a Unicode environment should be used - bool use_unicode_environment_; + bool use_unicode_environment_; }; //class ACE_Process_Manager; diff --git a/dep/ACE_wrappers/ace/Process_Manager.cpp b/dep/ACE_wrappers/ace/Process_Manager.cpp index 5aae463df4f..46af3f5098f 100644 --- a/dep/ACE_wrappers/ace/Process_Manager.cpp +++ b/dep/ACE_wrappers/ace/Process_Manager.cpp @@ -686,7 +686,7 @@ ACE_Process_Manager::find_proc (pid_t pid) { ACE_TRACE ("ACE_Process_Manager::find_proc"); - for (size_t i = 0; i < this->current_count_; ++i) + for (size_t i = 0; i < this->current_count_; ++i) { if (pid == this->process_table_[i].process_->getpid ()) { diff --git a/dep/ACE_wrappers/ace/RB_Tree.cpp b/dep/ACE_wrappers/ace/RB_Tree.cpp index 57095be5795..88bbd50bdab 100644 --- a/dep/ACE_wrappers/ace/RB_Tree.cpp +++ b/dep/ACE_wrappers/ace/RB_Tree.cpp @@ -1076,7 +1076,7 @@ ACE_RB_Tree::remove_i (ACE_RB_Tree_Node< y->color (z->color ()); z->color (yColor); - //Reassign the y pointer to z because the node that y points to will be + //Reassign the y pointer to z because the node that y points to will be //deleted y = z; } diff --git a/dep/ACE_wrappers/ace/Service_Manager.cpp b/dep/ACE_wrappers/ace/Service_Manager.cpp index 54ceb67f636..39e26773e0a 100644 --- a/dep/ACE_wrappers/ace/Service_Manager.cpp +++ b/dep/ACE_wrappers/ace/Service_Manager.cpp @@ -68,7 +68,7 @@ ACE_Service_Manager::open (const ACE_INET_Addr &sia) { return -1; } - + return 0; } @@ -89,7 +89,7 @@ ACE_Service_Manager::info (ACE_TCHAR **strp, size_t length) const sa.get_port_number (), ACE_TEXT ("tcp"), ACE_TEXT ("# lists all services in the daemon\n")); - + if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0) { return -1; @@ -98,7 +98,7 @@ ACE_Service_Manager::info (ACE_TCHAR **strp, size_t length) const { ACE_OS::strsncpy (*strp, buf, length); } - + return static_cast (ACE_OS::strlen (buf)); } @@ -143,7 +143,7 @@ ACE_Service_Manager::init (int argc, ACE_TCHAR *argv[]) ACE_TEXT ("registering service with ACE_Reactor\n")), -1); } - + return 0; } @@ -160,18 +160,18 @@ ACE_Service_Manager::fini (void) ACE_TRACE ("ACE_Service_Manager::fini"); int retv = 0; - + if (this->get_handle () != ACE_INVALID_HANDLE) { retv = ACE_Reactor::instance ()->remove_handler ( this, ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); - + this->handle_close (ACE_INVALID_HANDLE, ACE_Event_Handler::NULL_MASK); } - + return retv; } @@ -227,7 +227,7 @@ ACE_Service_Manager::list_services (void) if (len > 0) { ssize_t n = this->client_stream_.send_n (buf, len); - + if (n <= 0 && errno != EPIPE) { ACE_ERROR ((LM_ERROR, @@ -334,7 +334,7 @@ ACE_Service_Manager::handle_input (ACE_HANDLE) ACE_TEXT ("client_stream fd = %d\n"), this->client_stream_.get_handle ())); ACE_INET_Addr sa; - + if (this->client_stream_.get_remote_addr (sa) == -1) { return -1; @@ -361,12 +361,12 @@ ACE_Service_Manager::handle_input (ACE_HANDLE) // contains an incomplete string. int error; - + do { result = client_stream_.recv (offset, remaining); error = errno; - + if (result == 0 && error != EWOULDBLOCK) { remaining = 0; @@ -403,7 +403,7 @@ ACE_Service_Manager::handle_input (ACE_HANDLE) ACE_TEXT ("%p\n"), ACE_TEXT ("recv"))); } - + break; case 0: return 0; @@ -430,7 +430,7 @@ ACE_Service_Manager::handle_input (ACE_HANDLE) ACE_TEXT ("%p\n"), ACE_TEXT ("close"))); } - + return 0; } diff --git a/dep/ACE_wrappers/ace/Stack_Trace.cpp b/dep/ACE_wrappers/ace/Stack_Trace.cpp index 082cca8a88a..edca5ef2652 100644 --- a/dep/ACE_wrappers/ace/Stack_Trace.cpp +++ b/dep/ACE_wrappers/ace/Stack_Trace.cpp @@ -108,7 +108,7 @@ struct ACE_Stack_Trace_stackstate size_t starting_frame; }; -//@TODO: Replace with a TSS-based pointer to avoid problems in multithreaded environs, +//@TODO: Replace with a TSS-based pointer to avoid problems in multithreaded environs, // or use a mutex to serialize access to this. static ACE_Stack_Trace_stackstate* ACE_Stack_Trace_stateptr = 0; @@ -495,7 +495,7 @@ typedef struct _dbghelp_functions # pragma warning (push) -# pragma warning (disable:4706) +# pragma warning (disable:4706) static bool load_dbghelp_library_if_needed (dbghelp_functions *pDbg) { //@TODO: See codeproject's StackWalker.cpp for the list of locations to @@ -587,7 +587,7 @@ cs_operate(int (*func)(struct frame_state const *, void *), void *usrarg, ZeroMemory (&fs.sf, sizeof (fs.sf)); fs.pDbg = &dbg; emptyStack (); //Not sure what this should do, Chad? - + CONTEXT c; ZeroMemory (&c, sizeof (CONTEXT)); c.ContextFlags = CONTEXT_FULL; @@ -684,7 +684,7 @@ ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset, void ACE_Stack_Trace::generate_trace (ssize_t, size_t) { -// Call determine_starting_frame() on HP aCC build to resolve declared +// Call determine_starting_frame() on HP aCC build to resolve declared // method never referenced warning. #if defined (__HP_aCC) size_t starting_frame = determine_starting_frame (0, 0); diff --git a/dep/ACE_wrappers/ace/Stack_Trace.h b/dep/ACE_wrappers/ace/Stack_Trace.h index 56cf8a09208..3769f7f14d1 100644 --- a/dep/ACE_wrappers/ace/Stack_Trace.h +++ b/dep/ACE_wrappers/ace/Stack_Trace.h @@ -37,31 +37,31 @@ * A new conversion character, the question mark, was added to ACE_Log_Msg for stack * trace logging. The %? conversion character was added as a convenience so that users * need not instantiate an ACE_Stack_Trace instance solely for the purpose of printing - * it in an ACE logging message. The following are functionally equivalent: + * it in an ACE logging message. The following are functionally equivalent: * * \code - * ACE_DEBUG((LM_DEBUG, "%?")); + * ACE_DEBUG((LM_DEBUG, "%?")); * * ACE_Stack_Trace st; - * ACE_DEBUG ((LM_DEBUG, "%s", st.c_str() )); + * ACE_DEBUG ((LM_DEBUG, "%s", st.c_str() )); * \endcode * * These usage examples were shown in $ACE_ROOT/tests/Stack_Trace_Test.cpp. * * @note The stack trace functionality was currently supported on platforms: - * - Any platform using glibc as its runtime library, or where ACE_HAS_EXECINFO_H is defined + * - Any platform using glibc as its runtime library, or where ACE_HAS_EXECINFO_H is defined * (this covers Linux and Mac) and gcc version >= 3.3. * - VxWorks, both kernel and RTP * - Solaris * - Windows 32 and 64 bit (Visual C++, excluding WinCE/mobile) * - * @note Since stack trace buffer size has limitation(@c ACE_STACK_TRACE_SYMBUFSIZ), you will not - * get a complete stack trace if @c ACE_STACK_TRACE_SYMBUFSIZ value is less than actual stack - * trace data length. To get a complete stack trace, you need set @c ACE_STACK_TRACE_SYMBUFSIZ - * with a larger value that is enough for the stack trace data in your @c config.h file + * @note Since stack trace buffer size has limitation(@c ACE_STACK_TRACE_SYMBUFSIZ), you will not + * get a complete stack trace if @c ACE_STACK_TRACE_SYMBUFSIZ value is less than actual stack + * trace data length. To get a complete stack trace, you need set @c ACE_STACK_TRACE_SYMBUFSIZ + * with a larger value that is enough for the stack trace data in your @c config.h file * and rebuild ACE. * - * @note Using ACE logging mechanism (%?) to log the stack trace also has ACE_MAXLOGMSGLEN size limitation. + * @note Using ACE logging mechanism (%?) to log the stack trace also has ACE_MAXLOGMSGLEN size limitation. * To get a complete stack trace, you could use different output method. Following is an example. * * \code @@ -75,8 +75,8 @@ public: /** * @brief Grab a snapshot of the current stack trace and hold it for later use. * - * @param starting_frame_offset offset into the array of frames to start printing; 0 is the - * platform-specific offset for the first frame, positive numbers give less frames, negative give + * @param starting_frame_offset offset into the array of frames to start printing; 0 is the + * platform-specific offset for the first frame, positive numbers give less frames, negative give * more frames * @param num_frames the number of stack frames to include (0 indicates platform-specific maximum) * diff --git a/dep/ACE_wrappers/ace/String_Base.h b/dep/ACE_wrappers/ace/String_Base.h index 04962d102c5..8232380657c 100644 --- a/dep/ACE_wrappers/ace/String_Base.h +++ b/dep/ACE_wrappers/ace/String_Base.h @@ -516,7 +516,7 @@ public: * * fast_resize just adjusts the buffer if needed and sets the length, * it doesn't fill the buffer, so is much faster. - * + * * @param len The number of CHARs to reserve * @param c The CHAR to use when filling the string. */ @@ -528,7 +528,7 @@ public: * @note This is non-throwing operation. */ void swap (ACE_String_Base & str); - + /** * Declare the dynamic allocation hooks. */ diff --git a/dep/ACE_wrappers/ace/Task_T.h b/dep/ACE_wrappers/ace/Task_T.h index b945bf37551..35ebb064d6a 100644 --- a/dep/ACE_wrappers/ace/Task_T.h +++ b/dep/ACE_wrappers/ace/Task_T.h @@ -112,7 +112,7 @@ public: // Should be protected: int put_next (ACE_Message_Block *msg, ACE_Time_Value *timeout = 0); /** - * Tests whether we can enqueue a message without blocking. + * Tests whether we can enqueue a message without blocking. * * @deprecated This method is deprecated and will go away in the future. */ diff --git a/dep/ACE_wrappers/ace/UPIPE_Stream.cpp b/dep/ACE_wrappers/ace/UPIPE_Stream.cpp index d07722a482e..443dc5fa1c2 100644 --- a/dep/ACE_wrappers/ace/UPIPE_Stream.cpp +++ b/dep/ACE_wrappers/ace/UPIPE_Stream.cpp @@ -215,7 +215,7 @@ ACE_UPIPE_Stream::recv_n (char *buf, len = this->recv (buf + bytes_read, n - bytes_read, timeout); - + if (len == -1) { return -1; diff --git a/dep/ACE_wrappers/ace/UUID.cpp b/dep/ACE_wrappers/ace/UUID.cpp index 4ce2bcd0a4b..17785384957 100644 --- a/dep/ACE_wrappers/ace/UUID.cpp +++ b/dep/ACE_wrappers/ace/UUID.cpp @@ -461,7 +461,7 @@ namespace ACE_Utils // sequence. if (timestamp <= time_last_) { - uuid_state_.clock_sequence = static_cast + uuid_state_.clock_sequence = static_cast ((uuid_state_.clock_sequence + 1) & ACE_UUID_CLOCK_SEQ_MASK); } // If the system time ticked since the last UUID was diff --git a/dep/ACE_wrappers/ace/UUID.h b/dep/ACE_wrappers/ace/UUID.h index 4f3c39d0812..b499697ceea 100644 --- a/dep/ACE_wrappers/ace/UUID.h +++ b/dep/ACE_wrappers/ace/UUID.h @@ -209,7 +209,7 @@ namespace ACE_Utils /// Obtain a UUID timestamp and clock sequence. Compensate for the /// fact that the time obtained from getSystem time has a /// resolution less than 100ns. - void get_timestamp_and_clocksequence (UUID_Time& timestamp, + void get_timestamp_and_clocksequence (UUID_Time& timestamp, ACE_UINT16& clockSequence); /// Obtain the system time in UTC as a count of 100 nanosecond intervals diff --git a/dep/ACE_wrappers/ace/Unbounded_Set.h b/dep/ACE_wrappers/ace/Unbounded_Set.h index a75eac18fc3..aa629b15d4e 100644 --- a/dep/ACE_wrappers/ace/Unbounded_Set.h +++ b/dep/ACE_wrappers/ace/Unbounded_Set.h @@ -50,7 +50,7 @@ public: // = Initialization method. ACE_Unbounded_Set_Iterator (ACE_Unbounded_Set &s, bool end = false); - + ACE_Unbounded_Set_Iterator (const base_type &s); }; @@ -63,13 +63,13 @@ class ACE_Unbounded_Set_Const_Iterator : public ACE_Unbounded_Set_Ex_Const_Iterator > { public: - + typedef ACE_Unbounded_Set_Ex_Const_Iterator > base_type; - + // = Initialization method. ACE_Unbounded_Set_Const_Iterator (const ACE_Unbounded_Set &s, bool end = false); - + ACE_Unbounded_Set_Const_Iterator (const base_type &s); }; diff --git a/dep/ACE_wrappers/ace/Unbounded_Set_Ex.h b/dep/ACE_wrappers/ace/Unbounded_Set_Ex.h index 262ef6043a1..92f8fe0065e 100644 --- a/dep/ACE_wrappers/ace/Unbounded_Set_Ex.h +++ b/dep/ACE_wrappers/ace/Unbounded_Set_Ex.h @@ -163,7 +163,7 @@ private: * allow duplicates, but it maintains FIFO ordering of insertions. * * This implementation may also be parameterized with a comparator - * functor, which must implement bool operator () (const T&, const T&) const, + * functor, which must implement bool operator () (const T&, const T&) const, * returning true if the given items are equivalent. The default comparator * is sufficient for objects reliably compared with operator==. * @@ -205,7 +205,7 @@ public: typedef ACE_Unbounded_Set_Ex_Const_Iterator const_iterator; typedef C COMP; typedef ACE_Node NODE; - + // = Initialization and termination methods. /// Constructor. Use user specified allocation strategy /// if specified. @@ -324,7 +324,7 @@ private: /// Allocation strategy of the set. ACE_Allocator *allocator_; - + /// Comparator to be used COMP comp_; }; diff --git a/dep/ACE_wrappers/ace/Vector_T.cpp b/dep/ACE_wrappers/ace/Vector_T.cpp index 006e6db1b4a..e50fe5f71ba 100644 --- a/dep/ACE_wrappers/ace/Vector_T.cpp +++ b/dep/ACE_wrappers/ace/Vector_T.cpp @@ -40,7 +40,7 @@ void ACE_Vector::push_back (const T& elem) } else ACE_Array::size (length_ + 1); - + ++length_; (*this)[length_-1] = elem; } diff --git a/dep/ACE_wrappers/ace/config-macosx-leopard.h b/dep/ACE_wrappers/ace/config-macosx-leopard.h index a56067b9707..bc82d8a7f37 100644 --- a/dep/ACE_wrappers/ace/config-macosx-leopard.h +++ b/dep/ACE_wrappers/ace/config-macosx-leopard.h @@ -52,7 +52,7 @@ #define ACE_LACKS_STROPTS_H // Platform provides header. -#define ACE_HAS_EXECINFO_H +#define ACE_HAS_EXECINFO_H // Wcharness.... #define ACE_HAS_WCHAR diff --git a/dep/ACE_wrappers/ace/config-qnx-rtp.h b/dep/ACE_wrappers/ace/config-qnx-rtp.h index c55a4abb988..54047262540 100644 --- a/dep/ACE_wrappers/ace/config-qnx-rtp.h +++ b/dep/ACE_wrappers/ace/config-qnx-rtp.h @@ -2,8 +2,8 @@ // $Id: config-qnx-rtp.h 80826 2008-03-04 14:51:23Z wotte $ // The following configuration file is designed to work for QNX RTP // GNU C++ and the POSIX (pthread) threads package. You can get QNX -// RTP at http://get.qnx.com. -// This header is intended to switch between configuration for +// RTP at http://get.qnx.com. +// This header is intended to switch between configuration for // various NTO versions. #ifndef ACE_CONFIG_QNX_RTP_H #define ACE_CONFIG_QNX_RTP_H diff --git a/dep/include/g3dlite/G3D/AABox.h b/dep/include/g3dlite/G3D/AABox.h index b5e862a7721..34262b82c0d 100644 --- a/dep/include/g3dlite/G3D/AABox.h +++ b/dep/include/g3dlite/G3D/AABox.h @@ -1,10 +1,10 @@ /** @file AABox.h - + Axis-aligned box class - + @maintainer Morgan McGuire, matrix@graphics3d.com - + @created 2004-01-10 @edited 2006-02-10 @@ -112,23 +112,23 @@ public: } /** - @deprecated Use culledBy(Array&) + @deprecated Use culledBy(Array&) */ bool culledBy( const class Plane* plane, int numPlanes, - int32& cullingPlaneIndex, - const uint32 testMask, + int32& cullingPlaneIndex, + const uint32 testMask, uint32& childMask) const; /** - @deprecated Use culledBy(Array&) + @deprecated Use culledBy(Array&) */ bool culledBy( const class Plane* plane, int numPlanes, - int32& cullingPlaneIndex = dummy, - const uint32 testMask = 0xFFFFFF) const; + int32& cullingPlaneIndex = dummy, + const uint32 testMask = 0xFFFFFF) const; /** Splits the box into two AABoxes along the specified axis. low contains @@ -137,46 +137,46 @@ public: */ void split(const Vector3::Axis& axis, float location, AABox& low, AABox& high) const; - /** - Conservative culling test for up to 32 planes. - Returns true if there exists a plane[p] for + /** + Conservative culling test for up to 32 planes. + Returns true if there exists a plane[p] for which the entire object is in the negative half space (opposite the plane normal). - testMask and childMask - are used for optimizing bounding volume hierarchies. + testMask and childMask + are used for optimizing bounding volume hierarchies. The version of this method that produces childMask is slower than the version without; it should only be used for parent nodes. - @param cullingPlaneIndex The index of the first plane for which - the entire object is in the negative half-space. The function - exits early when one plane is found. -1 when the function - returns false (i.e. when no plane culls the whole object). + @param cullingPlaneIndex The index of the first plane for which + the entire object is in the negative half-space. The function + exits early when one plane is found. -1 when the function + returns false (i.e. when no plane culls the whole object). - @param testMask If bit p is 0, the - bounding volume automatically passes the culling test for - plane[p] (i.e. it is known that the volume - is entirely within the positive half space). The function + @param testMask If bit p is 0, the + bounding volume automatically passes the culling test for + plane[p] (i.e. it is known that the volume + is entirely within the positive half space). The function must return false if testMask is 0 and test all planes when testMask is -1 (0xFFFFFFFF). @param childMask Test mask for the children of this volume. - - */ - bool culledBy( - const Array& plane, - int32& cullingPlaneIndex, - const uint32 testMask, + + */ + bool culledBy( + const Array& plane, + int32& cullingPlaneIndex, + const uint32 testMask, uint32& childMask) const; /** Conservative culling test that does not produce a mask for children. */ - bool culledBy( - const Array& plane, - int32& cullingPlaneIndex = dummy, - const uint32 testMask = -1) const; + bool culledBy( + const Array& plane, + int32& cullingPlaneIndex = dummy, + const uint32 testMask = -1) const; inline bool contains( const Vector3& point) const { @@ -248,7 +248,7 @@ public: Hashing function for use with Table. */ inline unsigned int hashCode(const G3D::AABox& b) { - return b.hashCode(); + return b.hashCode(); } diff --git a/dep/include/g3dlite/G3D/Array.h b/dep/include/g3dlite/G3D/Array.h index 290563b6719..d0ac66ee4b1 100644 --- a/dep/include/g3dlite/G3D/Array.h +++ b/dep/include/g3dlite/G3D/Array.h @@ -1,9 +1,9 @@ -/** +/** @file Array.h - + @maintainer Morgan McGuire, graphics3d.com @cite Portions written by Aaron Orenstein, a@orenstein.name - + @created 2001-03-11 @edited 2007-05-12 @@ -26,7 +26,7 @@ #ifdef G3D_WIN32 # include - + # pragma warning (push) // debug information too long # pragma warning( disable : 4312) @@ -47,7 +47,7 @@ const int SORT_INCREASING = 1; const int SORT_DECREASING = -1; /** - Dynamic 1D array. + Dynamic 1D array. Objects must have a default constructor (constructor that takes no arguments) in order to be used with this template. @@ -61,9 +61,9 @@ const int SORT_DECREASING = -1; 16 bytes. - Array is highly optimized compared to std::vector. + Array is highly optimized compared to std::vector. Array operations are less expensive than on std::vector and for large - amounts of data, Array consumes only 1.5x the total size of the + amounts of data, Array consumes only 1.5x the total size of the data, while std::vector consumes 2.0x. The default array takes up zero heap space. The first resize (or append) operation grows it to a reasonable internal size so it is efficient @@ -128,16 +128,16 @@ private: /** - Allocates a new array of size numAllocated (not a parameter to the method) + Allocates a new array of size numAllocated (not a parameter to the method) and then copies at most oldNum elements from the old array to it. Destructors are called for oldNum elements of the old array. */ void realloc(int oldNum) { T* oldData = data; - - // The allocation is separate from the constructor invocation because we don't want + + // The allocation is separate from the constructor invocation because we don't want // to pay for the cost of constructors until the newly allocated - // elements are actually revealed to the application. They + // elements are actually revealed to the application. They // will be constructed in the resize() method. data = (T*)System::alignedMalloc(sizeof(T) * numAllocated, 16); @@ -153,7 +153,7 @@ private: const T* constructed = new (ptr) T(*oldPtr); (void)constructed; - debugAssertM(constructed == ptr, + debugAssertM(constructed == ptr, "new returned a different address than the one provided by Array."); }} @@ -170,7 +170,7 @@ private: public: /** - C++ STL style iterator variable. Call begin() to get + C++ STL style iterator variable. Call begin() to get the first iterator, pre-increment (++i) the iterator to get to the next value. Use dereference (*i) to access the element. */ @@ -201,16 +201,16 @@ public: } /** - The array returned is only valid until the next append() or resize call, or - the Array is deallocated. + The array returned is only valid until the next append() or resize call, or + the Array is deallocated. */ T* getCArray() { return data; } /** - The array returned is only valid until the next append() or resize call, or - the Array is deallocated. + The array returned is only valid until the next append() or resize call, or + the Array is deallocated. */ const T* getCArray() const { return data; @@ -237,7 +237,7 @@ public: /** Destructor does not delete() the objects if T is a pointer type - (e.g. T = int*) instead, it deletes the pointers themselves and + (e.g. T = int*) instead, it deletes the pointers themselves and leaves the objects. Call deleteAll if you want to dealocate the objects referenced. Do not call deleteAll if T is not a pointer type (e.g. do call Array::deleteAll, do not call Array::deleteAll). @@ -247,17 +247,17 @@ public: for (int i = 0; i < num; i++) { (data + i)->~T(); } - + System::alignedFree(data); // Set to 0 in case this Array is global and gets referenced during app exit data = NULL; - num = 0; + num = 0; numAllocated = 0; } /** - Removes all elements. Use resize(0, false) or fastClear if you want to + Removes all elements. Use resize(0, false) or fastClear if you want to remove all elements without deallocating the underlying array so that future append() calls will be faster. */ @@ -316,7 +316,7 @@ public: } /** - Resizes, calling the default constructor for + Resizes, calling the default constructor for newly created objects and shrinking the underlying array as needed (and calling destructors as needed). */ @@ -367,7 +367,7 @@ public: debugAssert(oldNum == 0); realloc(oldNum); } else { - + if (num < minSize) { // Grow to at least the minimum size numAllocated = minSize; @@ -424,7 +424,7 @@ public: in the array. */ inline void append(const T& value) { - + if (num < numAllocated) { // This is a simple situation; just stick it in the next free slot using // the copy constructor. @@ -570,27 +570,27 @@ public: pop(); } - /** + /** "The member function returns the storage currently allocated to hold the controlled - sequence, a value at least as large as size()" + sequence, a value at least as large as size()" For compatibility with std::vector. */ int capacity() const { return numAllocated; } - /** - "The member function returns a reference to the first element of the controlled sequence, - which must be non-empty." + /** + "The member function returns a reference to the first element of the controlled sequence, + which must be non-empty." For compatibility with std::vector. */ T& front() { return (*this)[0]; } - /** - "The member function returns a reference to the first element of the controlled sequence, - which must be non-empty." + /** + "The member function returns a reference to the first element of the controlled sequence, + which must be non-empty." For compatibility with std::vector. */ const T& front() const { @@ -717,13 +717,13 @@ public: /** Returns element middleIndex() */ inline const T& middle() const { debugAssertM(num > 0, "Array is empty"); - return data[num >> 1]; + return data[num >> 1]; } /** Returns element middleIndex() */ inline T& middle() { debugAssertM(num > 0, "Array is empty"); - return data[num >> 1]; + return data[num >> 1]; } /** @@ -785,14 +785,14 @@ public: element[0] = element[count]; ++element; } - + resize(num - count); } void remove(int index, int count = 1) { debugAssert((index >= 0) && (index < num)); debugAssert((count > 0) && (index + count <= num)); - + remove(begin() + index, count); } @@ -801,7 +801,7 @@ public: */ void reverse() { T temp; - + int n2 = num / 2; for (int i = 0; i < n2; ++i) { temp = data[num - 1 - i]; @@ -819,7 +819,7 @@ public: } - Note that for pointer arrays, the const must come + Note that for pointer arrays, the const must come after the class name, e.g., Array uses:
@@ -834,7 +834,7 @@ public:
 
 
     /**
-     Sorts the array in increasing order using the > or < operator.  To 
+     Sorts the array in increasing order using the > or < operator.  To
      invoke this method on Array, T must override those operator.
      You can overide these operators as follows:
      
@@ -893,8 +893,8 @@ public:
     };
 
     /** The output arrays are resized with fastClear() so that if they are already of the same size
-        as this array no memory is allocated during partitioning. 
-        
+        as this array no memory is allocated during partitioning.
+
         @param comparator A function, or class instance with an overloaded operator() that compares
         two elements of type T and returns 0 if they are equal, -1 if the second is smaller,
         and 1 if the first is smaller (i.e., following the conventions of std::string::compare).  For example:
@@ -913,7 +913,7 @@ public:
         */
     template
     void partition(
-        const T& partitionElement, 
+        const T& partitionElement,
         Array& ltArray,
         Array& eqArray,
         Array& gtArray,
@@ -948,7 +948,7 @@ public:
       Uses < and == on elements to perform a partition.  See partition().
      */
     void partition(
-        const T& partitionElement, 
+        const T& partitionElement,
         Array& ltArray,
         Array& eqArray,
         Array& gtArray) const {
@@ -956,7 +956,7 @@ public:
         partition(partitionElement, ltArray, eqArray, gtArray, typename Array::DefaultComparator());
     }
 
-    /** 
+    /**
      Paritions the array into those below the median, those above the median, and those elements
      equal to the median in expected O(n) time using quickselect.  If the array has an even
      number of different elements, the median for partition purposes is the largest value
@@ -966,8 +966,8 @@ public:
      @param comparator see parition() for a discussion.*/
     template
     void medianPartition(
-        Array&           ltMedian, 
-        Array&           eqMedian, 
+        Array&           ltMedian,
+        Array&           eqMedian,
         Array&           gtMedian,
         Array&           tempArray,
         const Comparator&   comparator) const {
@@ -991,7 +991,7 @@ public:
             {
                 // Two element array; median is the smaller
                 int c = comparator(first(), last());
-                
+
                 switch (c) {
                 case -1:
                     // first was bigger
@@ -1016,14 +1016,14 @@ public:
 
         // All other cases use a recursive randomized median
 
-        // Number of values less than all in the current arrays        
+        // Number of values less than all in the current arrays
         int ltBoost = 0;
 
-        // Number of values greater than all in the current arrays        
+        // Number of values greater than all in the current arrays
         int gtBoost = 0;
 
         // For even length arrays, force the gt array to be one larger than the
-        // lt array:  
+        // lt array:
         //  [1 2 3] size = 3, choose half = (s + 1) /2
         //
         int lowerHalfSize, upperHalfSize;
@@ -1062,7 +1062,7 @@ public:
             if ((L >= lowerHalfSize) &&
                 (U >= upperHalfSize)) {
 
-                // x must be the partition median                    
+                // x must be the partition median
                 break;
 
             } else if (L < lowerHalfSize) {
@@ -1071,10 +1071,10 @@ public:
                 ltBoost += lt->size() + eq->size();
 
                 // The new gt array will be the old source array, unless
-                // that was the this pointer (i.e., unless we are on the 
+                // that was the this pointer (i.e., unless we are on the
                 // first iteration)
                 Array* newGt = (source == this) ? extra : const_cast*>(source);
-                
+
                 // Now set up the gt array as the new source
                 source = gt;
                 gt = newGt;
@@ -1085,10 +1085,10 @@ public:
                 gtBoost += gt->size() + eq->size();
 
                 // The new lt array will be the old source array, unless
-                // that was the this pointer (i.e., unless we are on the 
+                // that was the this pointer (i.e., unless we are on the
                 // first iteration)
                 Array* newLt = (source == this) ? extra : const_cast*>(source);
-                
+
                 // Now set up the lt array as the new source
                 source = lt;
                 lt = newLt;
@@ -1105,13 +1105,13 @@ public:
     }
 
     /**
-      Computes a median partition using the default comparator and a dynamically allocated temporary 
+      Computes a median partition using the default comparator and a dynamically allocated temporary
       working array.  If the median is not in the array, it is chosen to be the largest value smaller
       than the true median.
      */
     void medianPartition(
-        Array&           ltMedian, 
-        Array&           eqMedian, 
+        Array&           ltMedian,
+        Array&           eqMedian,
         Array&           gtMedian) const {
 
         Array temp;
diff --git a/dep/include/g3dlite/G3D/Box.h b/dep/include/g3dlite/G3D/Box.h
index f097c10e18e..124727a0ca9 100644
--- a/dep/include/g3dlite/G3D/Box.h
+++ b/dep/include/g3dlite/G3D/Box.h
@@ -1,10 +1,10 @@
 /**
   @file Box.h
- 
+
   Box class
- 
+
   @maintainer Morgan McGuire, matrix@graphics3d.com
- 
+
   @cite Portions based on Dave Eberly's Magic Software Library at http://www.magic-software.com
   @created 2001-06-02
   @edited  2006-01-05
@@ -26,7 +26,7 @@ namespace G3D {
 class CoordinateFrame;
 
 /**
- An arbitrary 3D box, useful as a bounding box. 
+ An arbitrary 3D box, useful as a bounding box.
 
 
   To construct a box from a coordinate frame, center and extent, use the idiom:
@@ -43,7 +43,7 @@ private:
     /**
       
        3    2       7    6
-    
+
        0    1       4    5
 
        front    back (seen through front)
@@ -55,7 +55,7 @@ private:
      Unit axes.
      */
     Vector3 _axis[3];
-   
+
     Vector3 _center;
 
     /**
@@ -88,7 +88,7 @@ public:
 
 
     /**
-     Returns the object to world transformation for 
+     Returns the object to world transformation for
      this box.  localFrame().worldToObject(...) takes
      objects into the space where the box axes are
      (1,0,0), (0,1,0), (0,0,1).  Note that there
@@ -156,40 +156,40 @@ public:
         Vector3&            v3) const;
 
 /**
-	 @deprecated Use culledBy(Array&)
+     @deprecated Use culledBy(Array&)
      */
     bool culledBy(
         const class Plane*  plane,
         int                 numPlanes,
-	int32&              cullingPlaneIndex,
-	const uint32        testMask,
+    int32&              cullingPlaneIndex,
+    const uint32        testMask,
         uint32&             childMask) const;
 
     /**
-	 @deprecated Use culledBy(Array&)
+     @deprecated Use culledBy(Array&)
      */
     bool culledBy(
         const class Plane*  plane,
         int                 numPlanes,
-	int32&		cullingPlaneIndex = dummy,
-	const uint32  	testMask = -1) const;
+    int32&      cullingPlaneIndex = dummy,
+    const uint32    testMask = -1) const;
 
-	/**
+    /**
       See AABox::culledBy
-	 */
-	bool culledBy(
-		const Array&		plane,
-		int32&					cullingPlaneIndex,
-		const uint32  			testMask,
+     */
+    bool culledBy(
+        const Array&     plane,
+        int32&                  cullingPlaneIndex,
+        const uint32            testMask,
         uint32&                 childMask) const;
 
     /**
      Conservative culling test that does not produce a mask for children.
      */
-	bool culledBy(
-		const Array&		plane,
-		int32&					cullingPlaneIndex = dummy,
-		const uint32  			testMask		  = -1) const;
+    bool culledBy(
+        const Array&     plane,
+        int32&                  cullingPlaneIndex = dummy,
+        const uint32            testMask          = -1) const;
 
     bool contains(
         const Vector3&      point) const;
diff --git a/dep/include/g3dlite/G3D/CollisionDetection.h b/dep/include/g3dlite/G3D/CollisionDetection.h
index 4dc8b26538d..0105f1349ca 100644
--- a/dep/include/g3dlite/G3D/CollisionDetection.h
+++ b/dep/include/g3dlite/G3D/CollisionDetection.h
@@ -39,20 +39,20 @@ namespace G3D {
 
   These routines provide moving and static collision detection.
   Moving collision detection allows the calculation of collisions that
-  occur during a period of time -- as opposed to the intersection of 
+  occur during a period of time -- as opposed to the intersection of
   two static bodies.
-  
+
   Moving collision detection routines detect collisions between
-  only static primitives and moving spheres or points.  Since the 
+  only static primitives and moving spheres or points.  Since the
   reference frame can be user defined, these functions can be used to
   detect the collision between two moving bodies by subtracting
-  the velocity vector of one object from the velocity vector of the 
-  sphere or point the detection is to occur with.  This unified 
+  the velocity vector of one object from the velocity vector of the
+  sphere or point the detection is to occur with.  This unified
   velocity vector will act as if both objects are moving simultaneously.
 
   Collisions are detected for single-sided objects only.  That is,
   no collision is detected when leaving a primitive or passing
-  through a plane or triangle opposite the normal... except for the 
+  through a plane or triangle opposite the normal... except for the
   point-sphere calculation or when otherwise noted.
 
   For a sphere, the collision location returned is the point in world
@@ -90,22 +90,22 @@ namespace G3D {
 class CollisionDetection {
 private:
 
-	/**
-	 Default parameter if value passed to a function as reference is
-	 not to be calculated.  Must be explicitly supported by function.
-	 */
-	static Vector3 ignore;
+    /**
+     Default parameter if value passed to a function as reference is
+     not to be calculated.  Must be explicitly supported by function.
+     */
+    static Vector3 ignore;
 
-	/**
-	 Default parameter if value passed to a function as reference is
-	 not to be calculated.  Must be explicitly supported by function.
-	 */
+    /**
+     Default parameter if value passed to a function as reference is
+     not to be calculated.  Must be explicitly supported by function.
+     */
     static bool    ignoreBool;
 
-	/**
-	 Default parameter if value passed to a function as reference is
-	 not to be calculated.  Must be explicitly supported by function.
-	 */
+    /**
+     Default parameter if value passed to a function as reference is
+     not to be calculated.  Must be explicitly supported by function.
+     */
     static Array ignoreArray;
 
 
@@ -120,32 +120,32 @@ public:
       Does not return normalized vector in the edge-edge case
       (indices 6 through 15).
 
-	  @param separatingAxisIndex	Separating axis.
-	  @param box1					Box 1.
-	  @param box2					Box 2.
+      @param separatingAxisIndex    Separating axis.
+      @param box1                   Box 1.
+      @param box2                   Box 2.
 
- 	  @return Axis that separates the two boxes.
-  	 */
+      @return Axis that separates the two boxes.
+     */
     static Vector3 separatingAxisForSolidBoxSolidBox(
             const int       separatingAxisIndex,
             const Box &     box1,
             const Box &     box2);
 
     /**
-	  Tests whether two boxes have axes that are parallel to
-	  each other.  If they are, axis1 and axis2 are set to be
-	  the parallel axes for both box1 and box2 respectively.
+      Tests whether two boxes have axes that are parallel to
+      each other.  If they are, axis1 and axis2 are set to be
+      the parallel axes for both box1 and box2 respectively.
 
-	  @param ca			Dot products of each of the boxes axes
-	  @param epsilon	Fudge factor (small unit by which the dot
-	  					products may vary and still be considered
-	  					zero).
-	  @param axis1		Parallel Axis 1. [Post Condition]
-	  @param axis2		Parallel Axis 2. [Post Condition]
+      @param ca         Dot products of each of the boxes axes
+      @param epsilon    Fudge factor (small unit by which the dot
+                        products may vary and still be considered
+                        zero).
+      @param axis1      Parallel Axis 1. [Post Condition]
+      @param axis2      Parallel Axis 2. [Post Condition]
 
-	  @return true  - If boxes have a parallel axis
-	  @return false - otherwise.
- 	 */
+      @return true  - If boxes have a parallel axis
+      @return false - otherwise.
+     */
     static bool parallelAxisForSolidBoxSolidBox(
             const double*   ca,
             const double    epsilon,
@@ -160,15 +160,15 @@ public:
       penetrationDepthForFixedSphereFixedBox() for more details
 
       @param separatingAxisIndex
-	  @param a Box 1's bounding sphere vector
-	  @param b Box 2's bounding sphere vector
-	  @param D Vector between Box 1 and Box 2's center points
-	  @param c Pointer to array of dot products of the axes of Box 1
-	           and Box 2.
-	  @param ca Pointer to array of unsigned dot products of the axes
-	            of Box 1 and Box 2.
-	  @param ad Pointer to array of dot products of Box 1 axes and D.
-	  @param bd Pointer to array of dot products of Box 2 axes and D.
+      @param a Box 1's bounding sphere vector
+      @param b Box 2's bounding sphere vector
+      @param D Vector between Box 1 and Box 2's center points
+      @param c Pointer to array of dot products of the axes of Box 1
+               and Box 2.
+      @param ca Pointer to array of unsigned dot products of the axes
+                of Box 1 and Box 2.
+      @param ad Pointer to array of dot products of Box 1 axes and D.
+      @param bd Pointer to array of dot products of Box 2 axes and D.
 
       @return Projected distance between the two boxes along the
       specified separating axis.
@@ -184,41 +184,41 @@ public:
             const double*       bd);
 
 
-	/**
-	  Creates a set of standard information about two boxes in order to
-	  solve for their collision.  This information includes a vector to
-	  the radius of the bounding sphere for each box, the vector between
-	  each boxes' center and a series of dot products between differing
-	  important vectors.  These dot products include those between the axes
-	  of both boxes (signed and unsigned values), and the dot products
-	  between all the axes of box1 and the boxes' center vector and box2
-	  and the boxes' center vector.
+    /**
+      Creates a set of standard information about two boxes in order to
+      solve for their collision.  This information includes a vector to
+      the radius of the bounding sphere for each box, the vector between
+      each boxes' center and a series of dot products between differing
+      important vectors.  These dot products include those between the axes
+      of both boxes (signed and unsigned values), and the dot products
+      between all the axes of box1 and the boxes' center vector and box2
+      and the boxes' center vector.
 
-	  @pre The following space requirements must be met:
-      		- c[]  9 elements
-      		- ca[] 9 elements
-      		- ad[] 3 elements
-      		- bd[] 3 elements
+      @pre The following space requirements must be met:
+            - c[]  9 elements
+            - ca[] 9 elements
+            - ad[] 3 elements
+            - bd[] 3 elements
 
-	  @cite dobted from David Eberly's papers, variables used in this function
+      @cite dobted from David Eberly's papers, variables used in this function
       correspond to variables used in pages 6 and 7 in the pdf
       http://www.magic-software.com/Intersection.html
       http://www.magic-software.com/Documentation/DynamicCollisionDetection.pdf
 
       @note Links are out-dated. (Kept to preserve origin and authorship)
 
-	  @param box1 Box 1
-	  @param box2 Box 2
-	  @param a Box 1's bounding sphere vector
-	  @param b Box 2's bounding sphere vector
-	  @param D Vector between Box 1 and Box 2's center points
-	  @param c Pointer to array of dot products of the axes of Box 1
-	           and Box 2.
-	  @param ca Pointer to array of unsigned dot products of the axes
-	            of Box 1 and Box 2.
-	  @param ad Pointer to array of dot products of Box 1 axes and D.
-	  @param bd Pointer to array of dot products of Box 2 axes and D.
-	 */
+      @param box1 Box 1
+      @param box2 Box 2
+      @param a Box 1's bounding sphere vector
+      @param b Box 2's bounding sphere vector
+      @param D Vector between Box 1 and Box 2's center points
+      @param c Pointer to array of dot products of the axes of Box 1
+               and Box 2.
+      @param ca Pointer to array of unsigned dot products of the axes
+                of Box 1 and Box 2.
+      @param ad Pointer to array of dot products of Box 1 axes and D.
+      @param bd Pointer to array of dot products of Box 2 axes and D.
+     */
     static void fillSolidBoxSolidBoxInfo(
             const Box &     box1,
             const Box &     box2,
@@ -230,70 +230,70 @@ public:
             double*         ad,
             double*         bd);
 
-	/**
-	  Performs a simple bounding sphere check between two boxes to determine
-	  whether these boxes could possibly intersect.  This is a very
-	  cheap operation (three dot products, two sqrts and a few others).  If
-	  it returns true, an intersection is possible, but not necessarily
-	  guaranteed.
+    /**
+      Performs a simple bounding sphere check between two boxes to determine
+      whether these boxes could possibly intersect.  This is a very
+      cheap operation (three dot products, two sqrts and a few others).  If
+      it returns true, an intersection is possible, but not necessarily
+      guaranteed.
 
-	  @param a Vector from box A's center to an outer vertex
-	  @param b Vector from box B's center to an outer vertex
-	  @param D Distance between the centers of the two boxes
+      @param a Vector from box A's center to an outer vertex
+      @param b Vector from box B's center to an outer vertex
+      @param D Distance between the centers of the two boxes
 
-	  @return true - if possible intersection
-	  @return false - otherwise (This does not guarantee an intersection)
-	 */
+      @return true - if possible intersection
+      @return false - otherwise (This does not guarantee an intersection)
+     */
     static bool conservativeBoxBoxTest(
             const Vector3 &     a,
             const Vector3 &     b,
             const Vector3 &     D);
 
-	/**
- 	  Determines whether two fixed solid boxes intersect.
+    /**
+      Determines whether two fixed solid boxes intersect.
 
       @note To speed up collision detection, the lastSeparatingAxis from
       the previous time step can be passed in and that plane can be
       checked first.  If the separating axis was not saved, or if the
       two boxes intersected then lastSeparatingAxis should equal -1.
 
-	  @cite Adobted from David Eberly's papers, variables used in this function
+      @cite Adobted from David Eberly's papers, variables used in this function
       correspond to variables used in pages 6 and 7 in the pdf
       http://www.magic-software.com/Intersection.html
       http://www.magic-software.com/Documentation/DynamicCollisionDetection.pdf
 
- 	  @param box1				Box 1.
- 	  @param box2				Box 2.
- 	  @param lastSeparatingAxis	Last separating axis.
- 	  							(optimization - see note)
+      @param box1               Box 1.
+      @param box2               Box 2.
+      @param lastSeparatingAxis Last separating axis.
+                                (optimization - see note)
 
-	  @return true  - Intersection.
-	  @return false - otherwise.
-	 */
+      @return true  - Intersection.
+      @return false - otherwise.
+     */
     static bool fixedSolidBoxIntersectsFixedSolidBox(
         const Box&      box1,
         const Box&      box2,
         const int       lastSeparatingAxis = -1);
 
     /**
-	  Calculates the closest points on two lines with each other.   If the
-	  lines are parallel then using the starting point, else calculate the
-	  closest point on each line to the other.
+      Calculates the closest points on two lines with each other.   If the
+      lines are parallel then using the starting point, else calculate the
+      closest point on each line to the other.
 
-	  @note This is very similiar to calculating the intersection of two lines.
-	  Logically then, the two points calculated would be identical if calculated
-	  with inifinite precision, but with the finite precision of floating point
-	  calculations, these values could (will) differ as the line slope approaches
-	  zero or inifinity.
+      @note This is very similiar to calculating the intersection of two lines.
+      Logically then, the two points calculated would be identical if calculated
+      with inifinite precision, but with the finite precision of floating point
+      calculations, these values could (will) differ as the line slope approaches
+      zero or inifinity.
 
-	  @cite variables and algorithm based on derivation at the following website:
-      	    http://softsurfer.com/Archive/algorithm_0106/algorithm_0106.htm
+      @cite variables and algorithm based on derivation at the following website:
+            http://softsurfer.com/Archive/algorithm_0106/algorithm_0106.htm
 
-	  @param line1		Line 1.
-	  @param line2		Line 2.
-	  @param closest1	Closest point on line 1.
-	  @param closest2	Closest point on line 2.
- 	*/
+      @param line1      Line 1.
+      @param line2      Line 2.
+      @param closest1   Closest point on line 1.
+      @param closest2   Closest point on line 2.
+    */
     static void closestPointsBetweenLineAndLine(
             const Line &    line1,
             const Line &    line2,
@@ -301,7 +301,7 @@ public:
             Vector3 &       closest2);
 
     /**
-	  Calculates the depth of penetration between two fixed boxes.
+      Calculates the depth of penetration between two fixed boxes.
       Contact normal faces away from box1 and into box2.  If there is
       contact, only one contact point is returned.  The minimally
       violated separating plane is computed
@@ -312,26 +312,26 @@ public:
               the contact point is the midpoint of the smallest line
               segment between the two edge lines
 
-	  @note This is very similiar to calculating the intersection of two lines.
-	  Logically then, the two points calculated would be identical if calculated
-	  with inifinite precision, but with the finite precision of floating point
-	  calculations, these values could (will) differ as the line slope approaches
-	  zero or inifinity.
+      @note This is very similiar to calculating the intersection of two lines.
+      Logically then, the two points calculated would be identical if calculated
+      with inifinite precision, but with the finite precision of floating point
+      calculations, these values could (will) differ as the line slope approaches
+      zero or inifinity.
 
-	  @cite adobted from David Eberly's papers, variables used in this function
+      @cite adobted from David Eberly's papers, variables used in this function
       correspond to variables used in pages 6 and 7 in the pdf
       http://www.magic-software.com/Intersection.html
       http://www.magic-software.com/Documentation/DynamicCollisionDetection.pdf
 
-	  @param box1				Box 1
-	  @param box2				Box 2
-	  @param contactPoints		Contact point between boxes. [Post Condition]
-	  @param contactNormals		Surface normal at contact point. [Post Condition]
-	  @param lastSeparatingAxis	Last separating axis. (Used for optimization)
+      @param box1               Box 1
+      @param box2               Box 2
+      @param contactPoints      Contact point between boxes. [Post Condition]
+      @param contactNormals     Surface normal at contact point. [Post Condition]
+      @param lastSeparatingAxis Last separating axis. (Used for optimization)
 
-	  @return Depth of penetration between the two boxes.  If there is no
- 	   intersection between the boxes, then a negative value is returned.
- 	*/
+      @return Depth of penetration between the two boxes.  If there is no
+       intersection between the boxes, then a negative value is returned.
+    */
     static float penetrationDepthForFixedBoxFixedBox(
         const Box&          box1,
         const Box&          box2,
@@ -340,21 +340,21 @@ public:
         const int           lastSeparatingAxis = -1);
 
     /**
-	  Calculates the depth of penetration between two fixed spheres as well
-	  as the deepest point of Sphere A that penetrates Sphere B. The normal
+      Calculates the depth of penetration between two fixed spheres as well
+      as the deepest point of Sphere A that penetrates Sphere B. The normal
       returned points away from the object A, although it may
       represent a perpendicular to either the faces of object B or object A
       depending on their relative orientations.
 
-	  @param sphereA		Fixed Sphere A.
-	  @param sphereB		Fixed Sphere B.
-	  @param contactPoints	Sphere A's deepest point that penetrates Sphere B.
-	 						[Post Condition]
-	  @param contactNormals	Normal at penetration point. [Post Condition]
+      @param sphereA        Fixed Sphere A.
+      @param sphereB        Fixed Sphere B.
+      @param contactPoints  Sphere A's deepest point that penetrates Sphere B.
+                            [Post Condition]
+      @param contactNormals Normal at penetration point. [Post Condition]
 
-	  @return Depth of penetration.  If there is no intersection between the
-	 		 objects then the depth will be a negative value.
-	 */
+      @return Depth of penetration.  If there is no intersection between the
+             objects then the depth will be a negative value.
+     */
     static float penetrationDepthForFixedSphereFixedSphere(
         const class Sphere& sphereA,
         const Sphere&       sphereB,
@@ -362,127 +362,127 @@ public:
         Array&     contactNormals = ignoreArray);
 
     /**
-	  Calculates the depth of penetration between a fixed sphere and a fixed
-	  box as well as the deepest point of the sphere that penetrates the box
-	  and the normal at that intersection.
+      Calculates the depth of penetration between a fixed sphere and a fixed
+      box as well as the deepest point of the sphere that penetrates the box
+      and the normal at that intersection.
 
-	  @note There are three possible intersections between a sphere and box.
-	  - Sphere completely contained in the box
-	  - Sphere intersects one edge
-	  - Sphere intersects one vertex
+      @note There are three possible intersections between a sphere and box.
+      - Sphere completely contained in the box
+      - Sphere intersects one edge
+      - Sphere intersects one vertex
 
-	  The contact point and contact normal vary for each of these situations.
-	  - Sphere contained in Box:
-	 	- Normal is based on side of least penetration (as is the depth calculation).
-	 	- Point is based on center of sphere
-	  - Sphere intersects one edge
-	 	- Normal is based on vector from the box center to the point of depth.
-	 	- Point is closest point to the sphere on the line
-	  - Sphere intersects one vertex
-	 	- Normal is based on vector from the box center to the vertex of penetration.
-	 	- Point is vertex of penetration.
+      The contact point and contact normal vary for each of these situations.
+      - Sphere contained in Box:
+        - Normal is based on side of least penetration (as is the depth calculation).
+        - Point is based on center of sphere
+      - Sphere intersects one edge
+        - Normal is based on vector from the box center to the point of depth.
+        - Point is closest point to the sphere on the line
+      - Sphere intersects one vertex
+        - Normal is based on vector from the box center to the vertex of penetration.
+        - Point is vertex of penetration.
 
       @cite Adapted from Jim Arvo's method in Graphics Gems
       See also http://www.win.tue.nl/~gino/solid/gdc2001depth.pdf
 
-	  @param sphere			Fixed Sphere.
-	  @param box			Fixed Box.
-	  @param contactPoints	Sphere point that penetrates the box. [Post Condition]
-	  @param contactNormals	Normal at the penetration point. [Post Condition]
+      @param sphere         Fixed Sphere.
+      @param box            Fixed Box.
+      @param contactPoints  Sphere point that penetrates the box. [Post Condition]
+      @param contactNormals Normal at the penetration point. [Post Condition]
 
-	  @return Depth of penetration.  If there is no intersection between the
-	 		  objects then the depth will be a negative value.
- 	 */
+      @return Depth of penetration.  If there is no intersection between the
+              objects then the depth will be a negative value.
+     */
     static float penetrationDepthForFixedSphereFixedBox(
         const Sphere&       sphere,
         const Box&          box,
         Array&     contactPoints,
         Array&     contactNormals = ignoreArray);
 
-	/**
-	  Calculates the depth of penetration between a Fixed Sphere and a Fixed
-	  Plane as well as the deepest point of the sphere that penetrates the plane
-	  and the plane normal at that intersection.
+    /**
+      Calculates the depth of penetration between a Fixed Sphere and a Fixed
+      Plane as well as the deepest point of the sphere that penetrates the plane
+      and the plane normal at that intersection.
 
-	  @param sphere			Fixed Sphere.
-	  @param plane			Fixed Plane.
-	  @param contactPoints	Sphere point that penetrates the plane.
-	 						[Post Condition]
-	  @param contactNormals	Normal at penetration point. [Post Condition]
+      @param sphere         Fixed Sphere.
+      @param plane          Fixed Plane.
+      @param contactPoints  Sphere point that penetrates the plane.
+                            [Post Condition]
+      @param contactNormals Normal at penetration point. [Post Condition]
 
- 	  @return Depth of penetration.  If there is no intersection between the
-	  		 objects then the depth will be a negative value.
- 	 */
+      @return Depth of penetration.  If there is no intersection between the
+             objects then the depth will be a negative value.
+     */
     static float penetrationDepthForFixedSphereFixedPlane(
         const Sphere&       sphereA,
         const class Plane&  planeB,
         Array&     contactPoints,
         Array&     contactNormals = ignoreArray);
 
-	/**
-	  Calculates the depth of penetration between a fixed box and a fixed
-	  plane as well as the vertexes of the box that penetrate the plane
-	  and the plane normals at those intersections.
+    /**
+      Calculates the depth of penetration between a fixed box and a fixed
+      plane as well as the vertexes of the box that penetrate the plane
+      and the plane normals at those intersections.
 
-	  @param box			Fixed Box.
-	  @param plane			Fixed Plane.
-	  @param contactPoints	Box points that penetrate the plane.
-	 						[Post Condition]
-	  @param contactNormals	Normals at penetration points [Post Condition]
+      @param box            Fixed Box.
+      @param plane          Fixed Plane.
+      @param contactPoints  Box points that penetrate the plane.
+                            [Post Condition]
+      @param contactNormals Normals at penetration points [Post Condition]
 
-	  @return Depth of penetration.  If there is no intersection between the
-	 		 objects then the depth will be a negative value.
- 	*/
+      @return Depth of penetration.  If there is no intersection between the
+             objects then the depth will be a negative value.
+    */
     static float penetrationDepthForFixedBoxFixedPlane(
         const Box&          box,
         const Plane&        plane,
         Array&     contactPoints,
         Array&     contactNormals = ignoreArray);
 
-	/**
- 	  Calculates time between the intersection of a moving point and a fixed
- 	  plane.
+    /**
+      Calculates time between the intersection of a moving point and a fixed
+      plane.
 
- 	  @note This is only a one sided collision test.   The side defined by
- 	  the plane's surface normal is the only one tested.  For a two sided
- 	  collision, call the function once for each side's surface normal.
+      @note This is only a one sided collision test.   The side defined by
+      the plane's surface normal is the only one tested.  For a two sided
+      collision, call the function once for each side's surface normal.
 
- 	  @param point		Moving point.
- 	  @param velocity	Point's velocity.
- 	  @param plane		Fixed plane.
- 	  @param location	Location of collision. [Post Condition]
- 	  					(Infinite vector on no collision)
- 	  @param outNormal	Plane's surface normal. [Post Condition]
+      @param point      Moving point.
+      @param velocity   Point's velocity.
+      @param plane      Fixed plane.
+      @param location   Location of collision. [Post Condition]
+                        (Infinite vector on no collision)
+      @param outNormal  Plane's surface normal. [Post Condition]
 
- 	  @return Time til collision.  If there is no collision then the return
- 	          value will be inf().
- 	*/
+      @return Time til collision.  If there is no collision then the return
+              value will be inf().
+    */
     static float collisionTimeForMovingPointFixedPlane(
-        const Vector3&			point,
-        const Vector3&			velocity,
-        const class Plane&		plane,
-        Vector3&				outLocation,
+        const Vector3&          point,
+        const Vector3&          velocity,
+        const class Plane&      plane,
+        Vector3&                outLocation,
         Vector3&                outNormal = ignore);
 
-	/**
- 	  Calculates time between the intersection of a moving point and a fixed
- 	  triangle.
+    /**
+      Calculates time between the intersection of a moving point and a fixed
+      triangle.
 
- 	  @note This is only a one sided collision test.   The side defined by
- 	  the triangle's surface normal is the only one tested.  For a two sided
- 	  collision, call the function once for each side's surface normal.
+      @note This is only a one sided collision test.   The side defined by
+      the triangle's surface normal is the only one tested.  For a two sided
+      collision, call the function once for each side's surface normal.
 
- 	  @param orig		Moving point.
- 	  @param dir		Point's velocity.
-	  @param v0 		Triangle vertex 1.
-	  @param v1 		Triangle vertex 2.
-	  @param v2 		Triangle vertex 3
- 	  @param location	Location of collision. [Post Condition]
- 	  					(Infinite vector on no collision)
+      @param orig       Moving point.
+      @param dir        Point's velocity.
+      @param v0         Triangle vertex 1.
+      @param v1         Triangle vertex 2.
+      @param v2         Triangle vertex 3
+      @param location   Location of collision. [Post Condition]
+                        (Infinite vector on no collision)
 
- 	  @return Time til collision.  If there is no collision then the return
- 	          value will be inf().
- 	*/
+      @return Time til collision.  If there is no collision then the return
+              value will be inf().
+    */
     inline static float collisionTimeForMovingPointFixedTriangle(
         const Vector3& orig,
         const Vector3& dir,
@@ -492,25 +492,25 @@ public:
         return Ray::fromOriginAndDirection(orig, dir).intersectionTime(v0, v1, v2);
     }
 
-	/**
- 	  Calculates time between the intersection of a moving point and a fixed
- 	  triangle.
+    /**
+      Calculates time between the intersection of a moving point and a fixed
+      triangle.
 
- 	  @note This is only a one sided collision test.   The side defined by
- 	  the triangle's surface normal is the only one tested.  For a two sided
- 	  collision, call the function once for each side's surface normal.
+      @note This is only a one sided collision test.   The side defined by
+      the triangle's surface normal is the only one tested.  For a two sided
+      collision, call the function once for each side's surface normal.
 
- 	  @param orig		Moving point.
- 	  @param dir		Point's velocity.
-	  @param v0 		Triangle vertex 1.
-	  @param v1 		Triangle vertex 2.
-	  @param v2 		Triangle vertex 3
- 	  @param location	Location of collision. [Post Condition]
- 	  					(Infinite vector on no collision)
+      @param orig       Moving point.
+      @param dir        Point's velocity.
+      @param v0         Triangle vertex 1.
+      @param v1         Triangle vertex 2.
+      @param v2         Triangle vertex 3
+      @param location   Location of collision. [Post Condition]
+                        (Infinite vector on no collision)
 
- 	  @return Time til collision.  If there is no collision then the return
- 	          value will be inf().
- 	*/
+      @return Time til collision.  If there is no collision then the return
+              value will be inf().
+    */
     inline static float collisionTimeForMovingPointFixedTriangle(
         const Vector3& orig,
         const Vector3& dir,
@@ -525,24 +525,24 @@ public:
         return t;
     }
 
-	/**
- 	  Calculates time between the intersection of a moving point and a fixed
- 	  triangle.
+    /**
+      Calculates time between the intersection of a moving point and a fixed
+      triangle.
 
- 	  @note This is only a one sided collision test.   The side defined by
- 	  the triangle's surface normal is the only one tested.  For a two sided
- 	  collision, call the function once for each side's surface normal.
+      @note This is only a one sided collision test.   The side defined by
+      the triangle's surface normal is the only one tested.  For a two sided
+      collision, call the function once for each side's surface normal.
 
- 	  @param orig		Moving point.
- 	  @param dir		Point's velocity.
- 	  @param tri		Fixed triangle.
- 	  @param location	Location of collision. [Post Condition]
- 	  					(Infinite vector on no collision)
- 	  @param normal		Triangle's surface normal. [Post Condition]
+      @param orig       Moving point.
+      @param dir        Point's velocity.
+      @param tri        Fixed triangle.
+      @param location   Location of collision. [Post Condition]
+                        (Infinite vector on no collision)
+      @param normal     Triangle's surface normal. [Post Condition]
 
- 	  @return Time til collision.  If there is no collision then the return
- 	          value will be inf().
- 	*/
+      @return Time til collision.  If there is no collision then the return
+              value will be inf().
+    */
     inline static float collisionTimeForMovingPointFixedTriangle(
         const Vector3&  orig,
         const Vector3&  dir,
@@ -552,7 +552,7 @@ public:
 
         float t = collisionTimeForMovingPointFixedTriangle(
             orig, dir, tri.vertex(0), tri.vertex(1), tri.vertex(2));
-        
+
         if ((t < inf()) && (&location != &ignore)) {
             location = orig + dir * t;
             normal   = tri.normal();
@@ -560,26 +560,26 @@ public:
         return t;
     }
 
-	/**
- 	  Calculates time between the intersection of a moving point and a fixed
- 	  triangle.
+    /**
+      Calculates time between the intersection of a moving point and a fixed
+      triangle.
 
- 	  @note This is only a one sided collision test.   The side defined by
- 	  the triangle's surface normal is the only one tested.  For a two sided
- 	  collision, call the function once for each side's surface normal.
+      @note This is only a one sided collision test.   The side defined by
+      the triangle's surface normal is the only one tested.  For a two sided
+      collision, call the function once for each side's surface normal.
 
- 	  @param orig		Moving point.
- 	  @param dir		Point's velocity.
-	  @param v0 		Triangle vertex 1.
-	  @param v1 		Triangle vertex 2.
-	  @param v2 		Triangle vertex 3
- 	  @param location	Location of collision. [Post Condition]
- 	  					(Infinite vector on no collision)
- 	  @param normal		Triangle's surface normal. [Post Condition]
+      @param orig       Moving point.
+      @param dir        Point's velocity.
+      @param v0         Triangle vertex 1.
+      @param v1         Triangle vertex 2.
+      @param v2         Triangle vertex 3
+      @param location   Location of collision. [Post Condition]
+                        (Infinite vector on no collision)
+      @param normal     Triangle's surface normal. [Post Condition]
 
- 	  @return Time til collision.  If there is no collision then the return
- 	          value will be inf().
- 	*/
+      @return Time til collision.  If there is no collision then the return
+              value will be inf().
+    */
     inline static float collisionTimeForMovingPointFixedTriangle(
         const Vector3& orig,
         const Vector3& dir,
@@ -603,553 +603,553 @@ public:
      Beta API
 
      @cite Andrew Woo, from "Graphics Gems", Academic Press, 1990
-  	 @cite Optimized code by Pierre Terdiman, 2000 (~20-30% faster on my Celeron 500)
+     @cite Optimized code by Pierre Terdiman, 2000 (~20-30% faster on my Celeron 500)
      @cite Epsilon value added by Klaus Hartmann
      @cite http://www.codercorner.com/RayAABB.cpp
      */
     static float collisionTimeForMovingPointFixedAABox(
-        const Vector3&			point,
-        const Vector3&			velocity,
+        const Vector3&          point,
+        const Vector3&          velocity,
         const class AABox&      box,
-        Vector3&				outLocation,
+        Vector3&                outLocation,
         bool&                   inside = ignoreBool,
         Vector3&                outNormal = ignore);
 
     /**
-	 Calculates time between the intersection of a moving point and a fixed
-	 Axis-Aligned Box (AABox).
+     Calculates time between the intersection of a moving point and a fixed
+     Axis-Aligned Box (AABox).
 
-	 @note Avoids the sqrt from collisionTimeForMovingPointFixedAABox.
+     @note Avoids the sqrt from collisionTimeForMovingPointFixedAABox.
 
-	 @param point		Moving point.
-	 @param velocity	Sphere's velocity.
-	 @param box			Fixed AAbox.
-	 @param location	Location of collision. [Post Condition]
-	 @param Inside		Does the ray originate inside the box? [Post Condition]
-	 @param normal		Box's surface normal to collision [Post Condition]
+     @param point       Moving point.
+     @param velocity    Sphere's velocity.
+     @param box         Fixed AAbox.
+     @param location    Location of collision. [Post Condition]
+     @param Inside      Does the ray originate inside the box? [Post Condition]
+     @param normal      Box's surface normal to collision [Post Condition]
 
-	 @return Time til collision.  If there is no collision then the return
-	         value will be inf().
- 	*/
+     @return Time til collision.  If there is no collision then the return
+             value will be inf().
+    */
     static bool collisionLocationForMovingPointFixedAABox(
-        const Vector3&			point,
-        const Vector3&			velocity,
+        const Vector3&          point,
+        const Vector3&          velocity,
         const class AABox&      box,
-        Vector3&				outLocation,
+        Vector3&                outLocation,
         bool&                   inside = ignoreBool,
         Vector3&                normal = ignore);
 
     /**
-	 Calculates time between the intersection of a moving point and a fixed
-	 sphere.
+     Calculates time between the intersection of a moving point and a fixed
+     sphere.
 
-	 @note When ray is starts inside the rectangle, the exiting intersection
-	 is detected.
+     @note When ray is starts inside the rectangle, the exiting intersection
+     is detected.
 
-	 @param point		Moving point.
-	 @param velocity	Point's velocity.
-	 @param Sphere		Fixed Sphere.
-	 @param location	Location of collision. [Post Condition]
-	 @param outNormal	Sphere's surface normal to collision [Post Condition]
+     @param point       Moving point.
+     @param velocity    Point's velocity.
+     @param Sphere      Fixed Sphere.
+     @param location    Location of collision. [Post Condition]
+     @param outNormal   Sphere's surface normal to collision [Post Condition]
 
-	 @return Time til collision.  If there is no collision then the return
-	         value will be inf().
- 	*/
+     @return Time til collision.  If there is no collision then the return
+             value will be inf().
+    */
     static float collisionTimeForMovingPointFixedSphere(
-        const Vector3&			point,
-        const Vector3&			velocity,
-        const class Sphere&		sphere,
-        Vector3&				outLocation,
+        const Vector3&          point,
+        const Vector3&          velocity,
+        const class Sphere&     sphere,
+        Vector3&                outLocation,
         Vector3&                outNormal = ignore);
 
     /**
-	 Calculates time between the intersection of a moving point and a fixed
-	 box.
+     Calculates time between the intersection of a moving point and a fixed
+     box.
 
-	 @note If the point is already inside the box, no collision: inf is returned.
+     @note If the point is already inside the box, no collision: inf is returned.
 
-	 @param point		Moving point.
-	 @param velocity	Sphere's velocity.
-	 @param box			Fixed box.
-	 @param location	Position of collision. [Post Condition]
-	 @param outNormal	Box's surface normal to collision [Post Condition]
+     @param point       Moving point.
+     @param velocity    Sphere's velocity.
+     @param box         Fixed box.
+     @param location    Position of collision. [Post Condition]
+     @param outNormal   Box's surface normal to collision [Post Condition]
 
-	 @return Time til collision.  If there is no collision then the return
-	         value will be inf().
- 	*/
+     @return Time til collision.  If there is no collision then the return
+             value will be inf().
+    */
     static float collisionTimeForMovingPointFixedBox(
-        const Vector3&			point,
-        const Vector3&			velocity,
-        const class  Box&		box,
-        Vector3&				outLocation,
+        const Vector3&          point,
+        const Vector3&          velocity,
+        const class  Box&       box,
+        Vector3&                outLocation,
         Vector3&                outNormal = ignore);
 
-	/**
-	 Calculates time between the intersection of a moving point and a fixed
-	 rectangle defined by the points v0, v1, v2, & v3.
+    /**
+     Calculates time between the intersection of a moving point and a fixed
+     rectangle defined by the points v0, v1, v2, & v3.
 
-	 @note This is only a one sided collision test.   The side defined by
-	 the rectangle's surface normal is the only one tested.  For a two sided
-	 collision, call the function once for each side's surface normal.
+     @note This is only a one sided collision test.   The side defined by
+     the rectangle's surface normal is the only one tested.  For a two sided
+     collision, call the function once for each side's surface normal.
 
-	 @param point		Moving point.
-	 @param velocity	Sphere's velocity.
-	 @param v0 			Rectangle vertex 1.
-	 @param v1 			Rectangle vertex 2.
-	 @param v2 			Rectangle vertex 3
-	 @param v3 			Rectangle vertex 4.
-	 @param location	Location of collision [Post Condition]
-	 @param outNormal	Rectangle's surface normal. [Post Condition]
+     @param point       Moving point.
+     @param velocity    Sphere's velocity.
+     @param v0          Rectangle vertex 1.
+     @param v1          Rectangle vertex 2.
+     @param v2          Rectangle vertex 3
+     @param v3          Rectangle vertex 4.
+     @param location    Location of collision [Post Condition]
+     @param outNormal   Rectangle's surface normal. [Post Condition]
 
-	 @return Time til collision.  If there is no collision then the return
-	         value will be inf().
- 	*/
+     @return Time til collision.  If there is no collision then the return
+             value will be inf().
+    */
     static float collisionTimeForMovingPointFixedRectangle(
-        const Vector3&			point,
-        const Vector3&			velocity,
-        const Vector3&			v0,
-        const Vector3&			v1,
-        const Vector3&			v2,
-        const Vector3&			v3,
-        Vector3&				outLocation,
+        const Vector3&          point,
+        const Vector3&          velocity,
+        const Vector3&          v0,
+        const Vector3&          v1,
+        const Vector3&          v2,
+        const Vector3&          v3,
+        Vector3&                outLocation,
         Vector3&                outNormal = ignore);
 
-	/**
-	 Calculates time between the intersection of a moving point and a fixed
-	 capsule.
+    /**
+     Calculates time between the intersection of a moving point and a fixed
+     capsule.
 
-	 @param point		Moving point.
-	 @param velocity	Point's velocity.
-	 @param capsule		Fixed capsule.
-	 @param location	Location of collision. [Post Condition]
-	 @param outNormal	Capsule's surface normal to collision [Post Condition]
+     @param point       Moving point.
+     @param velocity    Point's velocity.
+     @param capsule     Fixed capsule.
+     @param location    Location of collision. [Post Condition]
+     @param outNormal   Capsule's surface normal to collision [Post Condition]
 
-	 @return Time til collision.  If there is no collision then the return
-	         value will be inf().
- 	*/
-	static float collisionTimeForMovingPointFixedCapsule(
-		const Vector3&		    point,
-		const Vector3&		    velocity,
-		const class Capsule&	capsule,
-        Vector3&				outLocation,
+     @return Time til collision.  If there is no collision then the return
+             value will be inf().
+    */
+    static float collisionTimeForMovingPointFixedCapsule(
+        const Vector3&          point,
+        const Vector3&          velocity,
+        const class Capsule&    capsule,
+        Vector3&                outLocation,
         Vector3&                outNormal = ignore);
 
-	/**
-	 Calculates time between the intersection of a moving sphere and a fixed
-	 triangle.
+    /**
+     Calculates time between the intersection of a moving sphere and a fixed
+     triangle.
 
-	 @param sphere		Moving sphere.
-	 @param velocity	Sphere's velocity.
-	 @param plane		Fixed Plane.
-	 @param location	Location of collision -- not center position of sphere
-	 					at the collision time. [Post Condition]
-	 @param outNormal	Box's surface normal to collision [Post Condition]
+     @param sphere      Moving sphere.
+     @param velocity    Sphere's velocity.
+     @param plane       Fixed Plane.
+     @param location    Location of collision -- not center position of sphere
+                        at the collision time. [Post Condition]
+     @param outNormal   Box's surface normal to collision [Post Condition]
 
-	 @return Time til collision.  If there is no collision then the return
-	         value will be inf().
-	 */
+     @return Time til collision.  If there is no collision then the return
+             value will be inf().
+     */
     static float collisionTimeForMovingSphereFixedPlane(
-        const class Sphere&		sphere,
-        const Vector3&	    	velocity,
-        const class Plane&		plane,
-        Vector3&				outLocation,
+        const class Sphere&     sphere,
+        const Vector3&          velocity,
+        const class Plane&      plane,
+        Vector3&                outLocation,
         Vector3&                outNormal = ignore);
 
-	/**
-	 Calculates time between the intersection of a moving sphere and a fixed
-	 triangle.
+    /**
+     Calculates time between the intersection of a moving sphere and a fixed
+     triangle.
 
-	 @param sphere		Moving sphere.
-	 @param velocity	Sphere's velocity.
-	 @param triangle	Fixed Triangle.
-	 @param location	Location of collision -- not center position of sphere
-	 					at the collision time. [Post Condition]
-	 @param outNormal	Box's surface normal to collision [Post Condition]
+     @param sphere      Moving sphere.
+     @param velocity    Sphere's velocity.
+     @param triangle    Fixed Triangle.
+     @param location    Location of collision -- not center position of sphere
+                        at the collision time. [Post Condition]
+     @param outNormal   Box's surface normal to collision [Post Condition]
 
-	 @return Time til collision.  If there is no collision then the return
-	         value will be inf().
-	*/
+     @return Time til collision.  If there is no collision then the return
+             value will be inf().
+    */
     static float collisionTimeForMovingSphereFixedTriangle(
-        const class Sphere&		sphere,
-        const Vector3&		    velocity,
+        const class Sphere&     sphere,
+        const Vector3&          velocity,
         const Triangle&       triangle,
-        Vector3&				outLocation,
+        Vector3&                outLocation,
         Vector3&                outNormal = ignore);
 
-	/**
-	 Calculates time between the intersection of a moving sphere and a fixed
-	 rectangle defined by the points v0, v1, v2, & v3.
+    /**
+     Calculates time between the intersection of a moving sphere and a fixed
+     rectangle defined by the points v0, v1, v2, & v3.
 
-	 @param sphere		Moving sphere.
-	 @param velocity	Sphere's velocity.
-	 @param v0 			Rectangle vertex 1.
-	 @param v1 			Rectangle vertex 2.
-	 @param v2 			Rectangle vertex 3
-	 @param v3 			Rectangle vertex 4.
-	 @param location	Location of collision -- not center position of sphere
-	 					at the collision time. [Post Condition]
-	 @param outNormal	Box's surface normal to collision [Post Condition]
+     @param sphere      Moving sphere.
+     @param velocity    Sphere's velocity.
+     @param v0          Rectangle vertex 1.
+     @param v1          Rectangle vertex 2.
+     @param v2          Rectangle vertex 3
+     @param v3          Rectangle vertex 4.
+     @param location    Location of collision -- not center position of sphere
+                        at the collision time. [Post Condition]
+     @param outNormal   Box's surface normal to collision [Post Condition]
 
-	 @return Time til collision.  If there is no collision then the return
-	         value will be inf().
- 	*/
+     @return Time til collision.  If there is no collision then the return
+             value will be inf().
+    */
     static float collisionTimeForMovingSphereFixedRectangle(
-        const class Sphere&		sphere,
-        const Vector3&	    	velocity,
-        const Vector3&	    	v0,
-        const Vector3&	    	v1,
-        const Vector3&	    	v2,
-        const Vector3&	    	v3,
-        Vector3&				outLocation,
+        const class Sphere&     sphere,
+        const Vector3&          velocity,
+        const Vector3&          v0,
+        const Vector3&          v1,
+        const Vector3&          v2,
+        const Vector3&          v3,
+        Vector3&                outLocation,
         Vector3&                outNormal = ignore);
 
-	/**
-	 Calculates time between the intersection of a moving sphere and a fixed
-	 box.
+    /**
+     Calculates time between the intersection of a moving sphere and a fixed
+     box.
 
-	 @note This function will not detect an intersection between a moving object
-	 that is already interpenetrating the fixed object.
+     @note This function will not detect an intersection between a moving object
+     that is already interpenetrating the fixed object.
 
-	 @param sphere		Moving sphere.
-	 @param velocity	Sphere's velocity.
-	 @param box			Fixed box.
-	 @param location	Location of collision -- not center position of sphere
-	 					at the collision time. [Post Condition]
-	 @param outNormal	Box's surface normal to collision [Post Condition]
+     @param sphere      Moving sphere.
+     @param velocity    Sphere's velocity.
+     @param box         Fixed box.
+     @param location    Location of collision -- not center position of sphere
+                        at the collision time. [Post Condition]
+     @param outNormal   Box's surface normal to collision [Post Condition]
 
-	 @return Time til collision.  If there is no collision then the return
-	         value will be inf().
- 	*/
+     @return Time til collision.  If there is no collision then the return
+             value will be inf().
+    */
     static float collisionTimeForMovingSphereFixedBox(
-        const class Sphere&		sphere,
-        const Vector3&		    velocity,
-        const class Box&		box,
-        Vector3&				outLocation,
+        const class Sphere&     sphere,
+        const Vector3&          velocity,
+        const class Box&        box,
+        Vector3&                outLocation,
         Vector3&                outNormal = ignore);
 
     /**
-	 Calculates time between the intersection of a moving sphere and a fixed
-	 sphere.
+     Calculates time between the intersection of a moving sphere and a fixed
+     sphere.
 
-	 @note This won't detect a collision if the sphere is already interpenetrating
-	       the fixed sphere.
+     @note This won't detect a collision if the sphere is already interpenetrating
+           the fixed sphere.
 
-	 @param movingSphere	Moving sphere.
-	 @param velocity		Sphere's velocity.
-	 @param fixedSphere		Fixed Sphere.
-	 @param location		Location of collision -- not center position of sphere
-	 						at the collision time. [Post Condition]
-	 @param outNormal		Sphere's surface normal to collision [Post Condition]
+     @param movingSphere    Moving sphere.
+     @param velocity        Sphere's velocity.
+     @param fixedSphere     Fixed Sphere.
+     @param location        Location of collision -- not center position of sphere
+                            at the collision time. [Post Condition]
+     @param outNormal       Sphere's surface normal to collision [Post Condition]
 
-	 @return Time til collision.  If there is no collision then the return
-	         value will be inf().
- 	*/
-	static float collisionTimeForMovingSphereFixedSphere(
-		const class Sphere&		sphere,
-		const Vector3&		    velocity,
-		const class Sphere&	    fixedSphere,
-        Vector3&				outLocation,
+     @return Time til collision.  If there is no collision then the return
+             value will be inf().
+    */
+    static float collisionTimeForMovingSphereFixedSphere(
+        const class Sphere&     sphere,
+        const Vector3&          velocity,
+        const class Sphere&     fixedSphere,
+        Vector3&                outLocation,
         Vector3&                outNormal = ignore);
 
     /**
-	 Calculates time between the intersection of a moving sphere and a fixed
-	 capsule.
+     Calculates time between the intersection of a moving sphere and a fixed
+     capsule.
 
-	 @note This won't detect a collision if the sphere is already
-	       interpenetrating the capsule.
+     @note This won't detect a collision if the sphere is already
+           interpenetrating the capsule.
 
-	 @param sphere		Moving sphere.
-	 @param velocity	Sphere's velocity.
-	 @param capsule		Fixed capsule.
-	 @param location	Location of collision -- not center position of sphere
-	 					at the collision time. [Post Condition]
-	 @param outNormal	Capsule's surface normal to the collision [Post Condition]
+     @param sphere      Moving sphere.
+     @param velocity    Sphere's velocity.
+     @param capsule     Fixed capsule.
+     @param location    Location of collision -- not center position of sphere
+                        at the collision time. [Post Condition]
+     @param outNormal   Capsule's surface normal to the collision [Post Condition]
 
-	 @return Time til collision.  If there is no collision then the return
-	         value will be inf().
- 	*/
-	static float collisionTimeForMovingSphereFixedCapsule(
-		const class Sphere&		sphere,
-		const Vector3&		    velocity,
-		const class Capsule&	capsule,
-        Vector3&				outLocation,
+     @return Time til collision.  If there is no collision then the return
+             value will be inf().
+    */
+    static float collisionTimeForMovingSphereFixedCapsule(
+        const class Sphere&     sphere,
+        const Vector3&          velocity,
+        const class Capsule&    capsule,
+        Vector3&                outLocation,
         Vector3&                outNormal = ignore);
 
     /**
-	 Finds the direction of bounce that a sphere would have when it 
-	 intersects an object with the  given time of collision, the 
-	 collision location and the collision normal.
+     Finds the direction of bounce that a sphere would have when it
+     intersects an object with the  given time of collision, the
+     collision location and the collision normal.
 
-	 @note This function works like a pong style ball bounce.
+     @note This function works like a pong style ball bounce.
 
-	 @param sphere				Moving sphere.
-	 @param velocity			Sphere's velocity.
-	 @param collisionTime		Time of collision.
-	 @param collisionLocation	Collision location.
-	 @param collisionNormal		Surface collision normal.
+     @param sphere              Moving sphere.
+     @param velocity            Sphere's velocity.
+     @param collisionTime       Time of collision.
+     @param collisionLocation   Collision location.
+     @param collisionNormal     Surface collision normal.
 
-	 @return Direction of bounce.
- 	*/
+     @return Direction of bounce.
+    */
     static Vector3 bounceDirection(
-        const class Sphere&		sphere,
-        const Vector3&			velocity,
-        const float				collisionTime,
-        const Vector3&			collisionLocation,
+        const class Sphere&     sphere,
+        const Vector3&          velocity,
+        const float             collisionTime,
+        const Vector3&          collisionLocation,
         const Vector3&          collisionNormal);
 
     /**
-	 Finds the direction of slide given a moving sphere, its velocity, the
-	 time of collision and the collision location.  This function works as
-	 if the sphere intersects the surface and continues to hug it.
+     Finds the direction of slide given a moving sphere, its velocity, the
+     time of collision and the collision location.  This function works as
+     if the sphere intersects the surface and continues to hug it.
 
-	 @note The result will work well for calculating the movement of a player
-	 who collides with an object and continues moving along the object instead
-	 of just bouncing off it.
+     @note The result will work well for calculating the movement of a player
+     who collides with an object and continues moving along the object instead
+     of just bouncing off it.
 
-	 @param sphere				Moving sphere.
-	 @param velocity			Sphere's velocity.
-	 @param collisionTime		Time of collision
-	 @param collisionLocation	Collision location.
+     @param sphere              Moving sphere.
+     @param velocity            Sphere's velocity.
+     @param collisionTime       Time of collision
+     @param collisionLocation   Collision location.
 
-	 @return Direction of slide.
- 	*/
+     @return Direction of slide.
+    */
     static Vector3 slideDirection(
-        const class Sphere&		sphere,
-        const Vector3&			velocity,
-        const float				collisionTime,
-        const Vector3&			collisionLocation);
-
-	/**
-	 Finds the closest point on a line segment to a given point.
-
-	 @param v0 line vertex 1.
-	 @param v1 line vertex 2.
-	 @param point External point.
-
-	 @return Closests point to point on the line segment.
- 	*/
-	static Vector3 closestPointOnLineSegment(
-        const Vector3&			v0,
-        const Vector3&			v1,
-        const Vector3&			point);
+        const class Sphere&     sphere,
+        const Vector3&          velocity,
+        const float             collisionTime,
+        const Vector3&          collisionLocation);
 
     /**
-	 Finds the closest point on a line segment to a given point.
+     Finds the closest point on a line segment to a given point.
 
-	 @note This is an optimization to closestPointOnLineSegment.  Edge length
-	 and direction can be used in this function if already pre-calculated.  This
-	 prevents doing the same work twice.
+     @param v0 line vertex 1.
+     @param v1 line vertex 2.
+     @param point External point.
 
-	 @param v0 line vertex 1.
-	 @param v1 line vertex 2.
+     @return Closests point to point on the line segment.
+    */
+    static Vector3 closestPointOnLineSegment(
+        const Vector3&          v0,
+        const Vector3&          v1,
+        const Vector3&          point);
+
+    /**
+     Finds the closest point on a line segment to a given point.
+
+     @note This is an optimization to closestPointOnLineSegment.  Edge length
+     and direction can be used in this function if already pre-calculated.  This
+     prevents doing the same work twice.
+
+     @param v0 line vertex 1.
+     @param v1 line vertex 2.
      @param edgeDirection The direction of the segment (unit length).
      @param edgeLength The length of the segment.
      @param point External point.
 
-	 @return Closests point to point on the line segment.
- 	*/
+     @return Closests point to point on the line segment.
+    */
     static Vector3 closestPointOnLineSegment(
-        const Vector3&			v0,
-        const Vector3&			v1,
+        const Vector3&          v0,
+        const Vector3&          v1,
         const Vector3&          edgeDirection,
         float                  edgeLength,
-        const Vector3&			point);
+        const Vector3&          point);
 
     /**
-	 Finds the closest point on the perimeter of the triangle to an external point;
-	 given a triangle defined by three points v0, v1, & v2, and the external point.
+     Finds the closest point on the perimeter of the triangle to an external point;
+     given a triangle defined by three points v0, v1, & v2, and the external point.
 
-	 @param v0 Triangle vertex 1.
-	 @param v1 Triangle vertex 2.
-	 @param v2 Triangle vertex 3.
-	 @param point External point.
+     @param v0 Triangle vertex 1.
+     @param v1 Triangle vertex 2.
+     @param v2 Triangle vertex 3.
+     @param point External point.
 
-	 @return Closests point to point on the perimeter of the
-	 triangle.
- 	*/
+     @return Closests point to point on the perimeter of the
+     triangle.
+    */
     static Vector3 closestPointToTrianglePerimeter(
-        const Vector3&			v0,
-        const Vector3&			v1,
-        const Vector3&			v2,
-        const Vector3&			point);
+        const Vector3&          v0,
+        const Vector3&          v1,
+        const Vector3&          v2,
+        const Vector3&          point);
 
-	/**
-	 Finds the closest point on the perimeter of the triangle to an external point;
-	 given a triangle defined by the array of points v, its edge directions and
-	 their lengths, as well as the external point.
+    /**
+     Finds the closest point on the perimeter of the triangle to an external point;
+     given a triangle defined by the array of points v, its edge directions and
+     their lengths, as well as the external point.
 
-	 @note This is an optimization to closestPointToTrianglePerimeter.  Edge length
-	 and direction can be used in this function if already pre-calculated.  This
-	 prevents doing the same work twice.
+     @note This is an optimization to closestPointToTrianglePerimeter.  Edge length
+     and direction can be used in this function if already pre-calculated.  This
+     prevents doing the same work twice.
 
-	 @param v0 Triangle vertex 1.
-	 @param v1 Triangle vertex 2.
-	 @param v2 Triangle vertex 3.
-	 @param point External point.
+     @param v0 Triangle vertex 1.
+     @param v1 Triangle vertex 2.
+     @param v2 Triangle vertex 3.
+     @param point External point.
 
-	 @return Closests point to point on the perimeter of the
-	 triangle.
- 	*/
+     @return Closests point to point on the perimeter of the
+     triangle.
+    */
     static Vector3 closestPointToTrianglePerimeter(
         const Vector3           v[3],
         const Vector3           edgeDirection[3],
         const double            edgeLength[3],
-        const Vector3&			point);
+        const Vector3&          point);
 
     /**
-	 Tests whether a point is contained within the triangle defined by
-	 v0, v1, & v2 and its plane's normal.
+     Tests whether a point is contained within the triangle defined by
+     v0, v1, & v2 and its plane's normal.
 
-	 @param v0 Triangle vertex 1.
-	 @param v1 Triangle vertex 2.
-	 @param v2 Triangle vertex 3.
-	 @param normal Normal to triangle's plane.
-	 @param point The point in question.
-	 @param primaryAxis Primary axis of triangle.  This will be detected
-	        if not given. This parameter is provided as an optimization.
+     @param v0 Triangle vertex 1.
+     @param v1 Triangle vertex 2.
+     @param v2 Triangle vertex 3.
+     @param normal Normal to triangle's plane.
+     @param point The point in question.
+     @param primaryAxis Primary axis of triangle.  This will be detected
+            if not given. This parameter is provided as an optimization.
 
-	 @return true  - if point is inside the triangle.
-	 @return false - otherwise
- 	*/
+     @return true  - if point is inside the triangle.
+     @return false - otherwise
+    */
     static bool isPointInsideTriangle(
-        const Vector3&			v0,
-        const Vector3&			v1,
-        const Vector3&			v2,
-        const Vector3&			normal,
-        const Vector3&			point,
+        const Vector3&          v0,
+        const Vector3&          v1,
+        const Vector3&          v2,
+        const Vector3&          normal,
+        const Vector3&          point,
         Vector3::Axis  primaryAxis = Vector3::DETECT_AXIS);
 
      /**
-	  Tests for the intersection of a moving sphere and a fixed box in a
-	  given time limit.
+      Tests for the intersection of a moving sphere and a fixed box in a
+      given time limit.
 
-	  @note Returns true if any part of the sphere is inside the box
-     		during the time period (inf means "ever").  Useful for
-		    performing bounding-box collision detection.
+      @note Returns true if any part of the sphere is inside the box
+            during the time period (inf means "ever").  Useful for
+            performing bounding-box collision detection.
 
-	  @param sphere 		Moving sphere.
-	  @param velocity 	Velocity of moving sphere.
-	  @param box 		Fixed box.
-	  @param timeLimit 	Time limit for intersection test.
+      @param sphere         Moving sphere.
+      @param velocity   Velocity of moving sphere.
+      @param box        Fixed box.
+      @param timeLimit  Time limit for intersection test.
 
-	  @return true  -  if the two objects will touch.
-	  @return false - if there is no intersection.
- 	*/
+      @return true  -  if the two objects will touch.
+      @return false - if there is no intersection.
+    */
     static bool movingSpherePassesThroughFixedBox(
         const Sphere&           sphere,
         const Vector3&          velocity,
         const Box&              box,
         double                  timeLimit = inf());
 
-	/**
-	 Tests for the intersection of a moving sphere and a fixed sphere in a
-	 given time limit.
+    /**
+     Tests for the intersection of a moving sphere and a fixed sphere in a
+     given time limit.
 
-	 @note This function will not detect an intersection between a moving object
-	 that is already interpenetrating the fixed object.
+     @note This function will not detect an intersection between a moving object
+     that is already interpenetrating the fixed object.
 
-	 @param sphere 		Moving sphere.
-	 @param velocity 	Velocity of moving sphere.
-	 @param fixedSphere Fixed sphere.
-	 @param timeLimit 	Time limit for intersection test.
+     @param sphere      Moving sphere.
+     @param velocity    Velocity of moving sphere.
+     @param fixedSphere Fixed sphere.
+     @param timeLimit   Time limit for intersection test.
 
-	 @return true  -  if the two spheres will touch.
-	 @return false - if there is no intersection.
- 	*/
+     @return true  -  if the two spheres will touch.
+     @return false - if there is no intersection.
+    */
     static bool movingSpherePassesThroughFixedSphere(
         const Sphere&           sphere,
         const Vector3&          velocity,
         const Sphere&           fixedSphere,
         double                  timeLimit = inf());
 
-	/**
-	 Tests for the intersection of two fixed spheres.
+    /**
+     Tests for the intersection of two fixed spheres.
 
-	 @param sphere1 Fixed sphere 1.
-	 @param sphere2 Fixed sphere 2.
+     @param sphere1 Fixed sphere 1.
+     @param sphere2 Fixed sphere 2.
 
-	 @return true -  if the two spheres touch.
-	 @return false - if there is no intersection.
- 	*/
+     @return true -  if the two spheres touch.
+     @return false - if there is no intersection.
+    */
     static bool fixedSolidSphereIntersectsFixedSolidSphere(
         const Sphere&           sphere1,
         const Sphere&           sphere2);
 
-	/**
-	 Tests for the intersection of a fixed sphere and a fixed box.
+    /**
+     Tests for the intersection of a fixed sphere and a fixed box.
 
-	 @param sphere Fixed sphere.
-	 @param box    Fixed box.
+     @param sphere Fixed sphere.
+     @param box    Fixed box.
 
-	 @return true  -  if the two objects touch.
-	 @return false - if there is no intersection.
- 	*/
+     @return true  -  if the two objects touch.
+     @return false - if there is no intersection.
+    */
     static bool fixedSolidSphereIntersectsFixedSolidBox(
         const Sphere&           sphere,
         const Box&              box);
 
     /**
-	 Tests whether a point is inside a rectangle defined by the vertexes
-	 v0, v1, v2, & v3, and the rectangle's plane normal.
+     Tests whether a point is inside a rectangle defined by the vertexes
+     v0, v1, v2, & v3, and the rectangle's plane normal.
 
-	 @param v0 Rectangle vertex 1.
-	 @param v1 Rectangle vertex 2.
-	 @param v2 Rectangle vertex 3.
-	 @param v3 Rectangle vertex 4.
-	 @param normal Normal to rectangle's plane.
-	 @param point The point in question.
+     @param v0 Rectangle vertex 1.
+     @param v1 Rectangle vertex 2.
+     @param v2 Rectangle vertex 3.
+     @param v3 Rectangle vertex 4.
+     @param normal Normal to rectangle's plane.
+     @param point The point in question.
 
-	 @return true  - if point is inside the rectangle.
-	 @return false - otherwise
- 	*/
+     @return true  - if point is inside the rectangle.
+     @return false - otherwise
+    */
     static bool isPointInsideRectangle(
-        const Vector3&			v0,
-        const Vector3&			v1,
-        const Vector3&			v2,
-        const Vector3&			v3,
-        const Vector3&			normal,
-        const Vector3&			point);
+        const Vector3&          v0,
+        const Vector3&          v1,
+        const Vector3&          v2,
+        const Vector3&          v3,
+        const Vector3&          normal,
+        const Vector3&          point);
 
     /**
-	 Finds the closest point on the perimeter of the rectangle to an
-	 external point; given a rectangle defined by four points v0, v1,
-	 v2, & v3, and the external point.
+     Finds the closest point on the perimeter of the rectangle to an
+     external point; given a rectangle defined by four points v0, v1,
+     v2, & v3, and the external point.
 
-	 @param v0 Rectangle vertex 1.
-	 @param v1 Rectangle vertex 2.
-	 @param v2 Rectangle vertex 3.
-	 @param v3 Rectangle vertex 4.
-	 @param point External point.
+     @param v0 Rectangle vertex 1.
+     @param v1 Rectangle vertex 2.
+     @param v2 Rectangle vertex 3.
+     @param v3 Rectangle vertex 4.
+     @param point External point.
 
-	 @return Closests point to point on the perimeter of the
- 	 rectangle.
- 	 */
+     @return Closests point to point on the perimeter of the
+     rectangle.
+     */
     static Vector3 closestPointToRectanglePerimeter(
-        const Vector3&			v0,
-        const Vector3&			v1,
-        const Vector3&			v2,
-        const Vector3&			v3,
-        const Vector3&			point);
+        const Vector3&          v0,
+        const Vector3&          v1,
+        const Vector3&          v2,
+        const Vector3&          v3,
+        const Vector3&          point);
 
      /**
-	  Finds the closest point in the rectangle to an external point; Given
-	  a rectangle defined by four points v0, v1, v2, & v3, and the external
-	  point.
+      Finds the closest point in the rectangle to an external point; Given
+      a rectangle defined by four points v0, v1, v2, & v3, and the external
+      point.
 
-	  @param v0 Rectangle vertex 1.
-	  @param v1 Rectangle vertex 2.
-	  @param v2 Rectangle vertex 3
-	  @param v3 Rectangle vertex 4.
-	  @param point External point.
+      @param v0 Rectangle vertex 1.
+      @param v1 Rectangle vertex 2.
+      @param v2 Rectangle vertex 3
+      @param v3 Rectangle vertex 4.
+      @param point External point.
 
       @return Closet point in the rectangle to the external point.
-	  */
-	 static Vector3 closestPointToRectangle(
-        const Vector3&			v0,
-        const Vector3&			v1,
-        const Vector3&			v2,
-        const Vector3&			v3,
-        const Vector3&			point);
+      */
+     static Vector3 closestPointToRectangle(
+        const Vector3&          v0,
+        const Vector3&          v1,
+        const Vector3&          v2,
+        const Vector3&          v3,
+        const Vector3&          point);
 };
 
 } // namespace
diff --git a/dep/include/g3dlite/G3D/CoordinateFrame.h b/dep/include/g3dlite/G3D/CoordinateFrame.h
index 657323eea6b..d93bfb43f40 100644
--- a/dep/include/g3dlite/G3D/CoordinateFrame.h
+++ b/dep/include/g3dlite/G3D/CoordinateFrame.h
@@ -2,7 +2,7 @@
  @file CoordinateFrame.h
 
  @maintainer Morgan McGuire, matrix@graphics3d.com
- 
+
  @created 2001-03-04
  @edited  2006-04-07
 
@@ -28,21 +28,21 @@ namespace G3D {
 
 /**
  A rigid body RT (rotation-translation) transformation.
-    
+
 CoordinateFrame abstracts a 4x4 matrix that maps object space to world space:
-  
+
   v_world = C * v_object
 
 CoordinateFrame::rotation is the upper 3x3 submatrix, CoordinateFrame::translation
-is the right 3x1 column.  The 4th row is always [0 0 0 1], so it isn't stored.  
+is the right 3x1 column.  The 4th row is always [0 0 0 1], so it isn't stored.
 So you don't have to remember which way the multiplication and transformation work,
-it provides explicit toWorldSpace and toObjectSpace methods.  Also, points, vectors 
+it provides explicit toWorldSpace and toObjectSpace methods.  Also, points, vectors
 (directions), and surface normals transform differently, so they have separate methods.
- 
+
 Some helper functions transform whole primitives like boxes in and out of object space.
 
 Convert to Matrix4 using CoordinateFrame::toMatrix4.  You can construct a CoordinateFrame
-from a Matrix4 using Matrix4::approxCoordinateFrame, however, because a Matrix4 is more 
+from a Matrix4 using Matrix4::approxCoordinateFrame, however, because a Matrix4 is more
 general than a CoordinateFrame, some information may be lost.
 
 See also: G3D::Matrix4, G3D::Quat
@@ -53,18 +53,18 @@ public:
     /**
      Takes object space points to world space.
      */
-    Matrix3							rotation;
+    Matrix3                         rotation;
 
     /**
      Takes object space points to world space.
      */
-    Vector3							translation;
+    Vector3                         translation;
 
     /**
      The direction an object "looks" relative to its own axes.
      @deprecated This is always -1 and will be fixed at that value in future releases.
      */
-    static const float				zLookDirection;
+    static const float              zLookDirection;
 
     inline bool operator==(const CoordinateFrame& other) const {
         return (translation == other.translation) && (rotation == other.rotation);
@@ -83,13 +83,13 @@ public:
     /**
      Initializes to the identity coordinate frame.
      */
-    inline CoordinateFrame() : 
+    inline CoordinateFrame() :
         rotation(Matrix3::identity()), translation(Vector3::zero()) {
     }
 
-	CoordinateFrame(const Vector3& _translation) :
+    CoordinateFrame(const Vector3& _translation) :
         rotation(Matrix3::identity()), translation(_translation) {
-	}
+    }
 
     CoordinateFrame(const Matrix3 &rotation, const Vector3 &translation) :
         rotation(rotation), translation(translation) {
@@ -124,7 +124,7 @@ public:
 
     /**
      Returns the heading of the lookVector as an angle in radians relative to
-     the world -z axis.  That is, a counter-clockwise heading where north (-z) 
+     the world -z axis.  That is, a counter-clockwise heading where north (-z)
      is 0 and west (-x) is PI/2.
 
      Note that the heading ignores the Y axis, so an inverted
@@ -157,23 +157,23 @@ public:
      */
     inline Vector3 pointToWorldSpace(const Vector3& v) const {
         return Vector3(
-			rotation[0][0] * v[0] + rotation[0][1] * v[1] + rotation[0][2] * v[2] + translation[0],
-			rotation[1][0] * v[0] + rotation[1][1] * v[1] + rotation[1][2] * v[2] + translation[1],
-			rotation[2][0] * v[0] + rotation[2][1] * v[1] + rotation[2][2] * v[2] + translation[2]);
+            rotation[0][0] * v[0] + rotation[0][1] * v[1] + rotation[0][2] * v[2] + translation[0],
+            rotation[1][0] * v[0] + rotation[1][1] * v[1] + rotation[1][2] * v[2] + translation[1],
+            rotation[2][0] * v[0] + rotation[2][1] * v[1] + rotation[2][2] * v[2] + translation[2]);
     }
 
     /**
      Transforms the point into object space.
      */
-	inline Vector3 pointToObjectSpace(const Vector3& v) const {
-		float p[3];
-		p[0] = v[0] - translation[0];
-		p[1] = v[1] - translation[1];
-		p[2] = v[2] - translation[2];
-		return Vector3(
-			rotation[0][0] * p[0] + rotation[1][0] * p[1] + rotation[2][0] * p[2],
-			rotation[0][1] * p[0] + rotation[1][1] * p[1] + rotation[2][1] * p[2],
-			rotation[0][2] * p[0] + rotation[1][2] * p[1] + rotation[2][2] * p[2]);
+    inline Vector3 pointToObjectSpace(const Vector3& v) const {
+        float p[3];
+        p[0] = v[0] - translation[0];
+        p[1] = v[1] - translation[1];
+        p[2] = v[2] - translation[2];
+        return Vector3(
+            rotation[0][0] * p[0] + rotation[1][0] * p[1] + rotation[2][0] * p[2],
+            rotation[0][1] * p[0] + rotation[1][1] * p[1] + rotation[2][1] * p[2],
+            rotation[0][2] * p[0] + rotation[1][2] * p[1] + rotation[2][2] * p[2]);
     }
 
     /**
@@ -235,7 +235,7 @@ public:
     class Box toObjectSpace(const Box& b) const;
 
     class Plane toObjectSpace(const Plane& p) const;
- 
+
     class Sphere toObjectSpace(const Sphere& b) const;
 
     Triangle toObjectSpace(const Triangle& t) const;
@@ -261,14 +261,14 @@ public:
         Vector3         up);
 
     /** @deprecated See lookVector */
-	inline Vector3 getLookVector() const {
-		return rotation.getColumn(2) * zLookDirection;
-	}
+    inline Vector3 getLookVector() const {
+        return rotation.getColumn(2) * zLookDirection;
+    }
 
     /** The direction this camera is looking (its negative z axis)*/
-	inline Vector3 lookVector() const {
-		return rotation.getColumn(2) * zLookDirection;
-	}
+    inline Vector3 lookVector() const {
+        return rotation.getColumn(2) * zLookDirection;
+    }
 
     /** Returns the ray starting at the camera origin travelling in direction CoordinateFrame::lookVector. */
     class Ray lookRay() const;
@@ -283,24 +283,24 @@ public:
      @deprecated leftVector
      */
     inline Vector3 getLeftVector() const {
-		return -rotation.getColumn(0);
-	}
+        return -rotation.getColumn(0);
+    }
 
     /** @deprecated See rightVector */
     inline Vector3 getRightVector() const {
-		return rotation.getColumn(0);
-	}
+        return rotation.getColumn(0);
+    }
 
     /**
      If a viewer looks along the look vector, this is the viewer's "left".
      Useful for strafing motions and building alternative coordinate frames.
      */
     inline Vector3 leftVector() const {
-		return -rotation.getColumn(0);
+        return -rotation.getColumn(0);
     }
 
     inline Vector3 rightVector() const {
-		return rotation.getColumn(0);
+        return rotation.getColumn(0);
     }
 
     /**
diff --git a/dep/include/g3dlite/G3D/Crypto.h b/dep/include/g3dlite/G3D/Crypto.h
index f4e7bfad6cd..63ee1bbecb6 100644
--- a/dep/include/g3dlite/G3D/Crypto.h
+++ b/dep/include/g3dlite/G3D/Crypto.h
@@ -1,8 +1,8 @@
-/** 
+/**
   @file Crypto.h
- 
+
   @maintainer Morgan McGuire, matrix@graphics3d.com
- 
+
 
   @created 2006-03-29
   @edited  2006-04-06
diff --git a/dep/include/g3dlite/G3D/GCamera.h b/dep/include/g3dlite/G3D/GCamera.h
index 3205f3904b1..c4fd27a1ff5 100644
--- a/dep/include/g3dlite/G3D/GCamera.h
+++ b/dep/include/g3dlite/G3D/GCamera.h
@@ -32,23 +32,23 @@ private:
     /**
     Vertical field of view (in radians)
     */
-    float						fieldOfView;
+    float                       fieldOfView;
 
-    /** 
-     The image plane depth corresponding to a vertical field of 
-     view, where the film size is 1x1.  
+    /**
+     The image plane depth corresponding to a vertical field of
+     view, where the film size is 1x1.
      */
-    float						imagePlaneDepth;
+    float                       imagePlaneDepth;
 
     /**
      Clipping plane, *not* imaging plane.  Positive numbers.
      */
-    float						nearPlane;
+    float                       nearPlane;
 
     /**
-     Positive 
+     Positive
      */
-    float						farPlane;
+    float                       farPlane;
 
     CoordinateFrame             cframe;
 
@@ -64,7 +64,7 @@ public:
             /** The plane containing the face. */
             Plane           plane;
         };
-        
+
         /** The vertices, in homogeneous space.  If w == 0,
             a vertex is at infinity. */
         Array      vertexPos;
@@ -77,42 +77,42 @@ public:
         Array         faceArray;
     };
 
-	GCamera();
+    GCamera();
 
     virtual ~GCamera();
 
 
-	CoordinateFrame getCoordinateFrame() const;
-	void getCoordinateFrame(CoordinateFrame& c) const;
-	void setCoordinateFrame(const CoordinateFrame& c);
-           
-   /**
-	 Sets the horizontal field of view, in radians.  The 
-     initial angle is toRadians(55).
-	 
    -
  • toRadians(50) - Telephoto -
  • toRadians(110) - Normal -
  • toRadians(140) - Wide angle -
- */ - void setFieldOfView(float angle); + CoordinateFrame getCoordinateFrame() const; + void getCoordinateFrame(CoordinateFrame& c) const; + void setCoordinateFrame(const CoordinateFrame& c); - /** - Sets the field of view based on a desired image plane depth - (s') and film dimensions in world space. Depth must be positive. Width, - depth, and height are measured in the same units (meters are - recommended). The field of view will span the diagonal to the - image.

Note: to simulate a 35mm GCamera, set width = - 0.36 mm and height = 0.24 mm. The width and height used are - generally not the pixel dimensions of the image. - */ - void setImagePlaneDepth( + /** + Sets the horizontal field of view, in radians. The + initial angle is toRadians(55). +

    +
  • toRadians(50) - Telephoto +
  • toRadians(110) - Normal +
  • toRadians(140) - Wide angle +
+ */ + void setFieldOfView(float angle); + + /** + Sets the field of view based on a desired image plane depth + (s') and film dimensions in world space. Depth must be positive. Width, + depth, and height are measured in the same units (meters are + recommended). The field of view will span the diagonal to the + image.

Note: to simulate a 35mm GCamera, set width = + 0.36 mm and height = 0.24 mm. The width and height used are + generally not the pixel dimensions of the image. + */ + void setImagePlaneDepth( float depth, const class Rect2D& viewport); - inline double getFieldOfView() const { - return fieldOfView; - } + inline double getFieldOfView() const { + return fieldOfView; + } /** Projects a world space point onto a width x height screen. The @@ -147,7 +147,7 @@ public: /** Returns the image plane depth, s', given the current field of view for film of dimensions width x height. See - setImagePlaneDepth for a discussion of worldspace values width and height. + setImagePlaneDepth for a discussion of worldspace values width and height. */ float getImagePlaneDepth( const class Rect2D& viewport) const; @@ -162,7 +162,7 @@ public: Integer (x, y) values correspond to the upper left corners of pixels. If you want to cast rays - through pixel centers, add 0.5 to x and y. + through pixel centers, add 0.5 to x and y. */ Ray worldRay( float x, @@ -184,15 +184,15 @@ public: return -farPlane; } - inline void setFarPlaneZ(float z) { - debugAssert(z < 0); - farPlane = -z; - } + inline void setFarPlaneZ(float z) { + debugAssert(z < 0); + farPlane = -z; + } - inline void setNearPlaneZ(float z) { - debugAssert(z < 0); - nearPlane = -z; - } + inline void setNearPlaneZ(float z) { + debugAssert(z < 0); + nearPlane = -z; + } /** Returns the GCamera space width of the viewport. @@ -203,16 +203,16 @@ public: /** Returns the GCamera space height of the viewport. */ - float getViewportHeight( + float getViewportHeight( const class Rect2D& viewport) const; /** Read back a GCamera space z-value at pixel (x, y) from the depth buffer. double getZValue( - double x, - double y, + double x, + double y, const class Rect2D& viewport, - double polygonOffset = 0) const; + double polygonOffset = 0) const; */ void setPosition(const Vector3& t); @@ -220,13 +220,13 @@ public: void lookAt(const Vector3& position, const Vector3& up = Vector3::unitY()); /** - Returns the clipping planes of the frustum, in world space. + Returns the clipping planes of the frustum, in world space. The planes have normals facing into the view frustum. The plane order is guaranteed to be: Near, Right, Left, Top, Bottom, [Far] - If the far plane is at infinity, the resulting array will have + If the far plane is at infinity, the resulting array will have 5 planes, otherwise there will be 6. The viewport is used only to determine the aspect ratio of the screen; the diff --git a/dep/include/g3dlite/G3D/Line.h b/dep/include/g3dlite/G3D/Line.h index 5dd82c19bc7..59adafd0459 100644 --- a/dep/include/g3dlite/G3D/Line.h +++ b/dep/include/g3dlite/G3D/Line.h @@ -1,10 +1,10 @@ /** @file Line.h - + Line class - + @maintainer Morgan McGuire, matrix@graphics3d.com - + @created 2001-06-02 @edited 2006-02-28 */ diff --git a/dep/include/g3dlite/G3D/Matrix3.h b/dep/include/g3dlite/G3D/Matrix3.h index 19eda497a15..3d8da9204b8 100644 --- a/dep/include/g3dlite/G3D/Matrix3.h +++ b/dep/include/g3dlite/G3D/Matrix3.h @@ -1,12 +1,12 @@ /** @file Matrix3.h - + 3x3 matrix class - + @maintainer Morgan McGuire, matrix@graphics3d.com - + @cite Portions based on Dave Eberly's Magic Software Library at http://www.magic-software.com - + @created 2001-06-02 @edited 2006-04-05 */ @@ -37,7 +37,7 @@ private: public: - /** Initial values are undefined for performance. See also + /** Initial values are undefined for performance. See also Matrix3::zero(), Matrix3::identity(), Matrix3::fromAxisAngle, etc.*/ inline Matrix3() {} @@ -51,7 +51,7 @@ public: /** Constructs a matrix from a quaternion. @cite Graphics Gems II, p. 351--354 - @cite Implementation from Watt and Watt, pg 362*/ + @cite Implementation from Watt and Watt, pg 362*/ Matrix3(const class Quat& q); @@ -148,7 +148,7 @@ private: static void _mul(const Matrix3& A, const Matrix3& B, Matrix3& out); public: - /** Optimized implementation of out = A * B. It is safe (but slow) to call + /** Optimized implementation of out = A * B. It is safe (but slow) to call with A, B, and out possibly pointer equal to one another.*/ // This is a static method so that it is not ambiguous whether "this" // is an input or output argument. @@ -166,10 +166,10 @@ private: static void _transpose(const Matrix3& A, Matrix3& out); public: - /** Optimized implementation of out = A.transpose(). It is safe (but slow) to call + /** Optimized implementation of out = A.transpose(). It is safe (but slow) to call with A and out possibly pointer equal to one another. - - Note that A.transpose() * v can be computed + + Note that A.transpose() * v can be computed more efficiently as v * A. */ inline static void transpose(const Matrix3& A, Matrix3& out) { @@ -239,32 +239,32 @@ public: static void tensorProduct (const Vector3& rkU, const Vector3& rkV, Matrix3& rkProduct); - std::string toString() const; + std::string toString() const; - static const float EPSILON; + static const float EPSILON; // Special values. - // The unguaranteed order of initialization of static variables across + // The unguaranteed order of initialization of static variables across // translation units can be a source of annoying bugs, so now the static // special values (like Vector3::ZERO, Color3::WHITE, ...) are wrapped - // inside static functions that return references to them. - // These functions are intentionally not inlined, because: - // "You might be tempted to write [...] them as inline functions - // inside their respective header files, but this is something you - // must definitely not do. An inline function can be duplicated - // in every file in which it appears – and this duplication - // includes the static object definition. Because inline functions - // automatically default to internal linkage, this would result in - // having multiple static objects across the various translation - // units, which would certainly cause problems. So you must - // ensure that there is only one definition of each wrapping + // inside static functions that return references to them. + // These functions are intentionally not inlined, because: + // "You might be tempted to write [...] them as inline functions + // inside their respective header files, but this is something you + // must definitely not do. An inline function can be duplicated + // in every file in which it appears – and this duplication + // includes the static object definition. Because inline functions + // automatically default to internal linkage, this would result in + // having multiple static objects across the various translation + // units, which would certainly cause problems. So you must + // ensure that there is only one definition of each wrapping // function, and this means not making the wrapping functions inline", - // according to Chapter 10 of "Thinking in C++, 2nd ed. Volume 1" by Bruce Eckel, + // according to Chapter 10 of "Thinking in C++, 2nd ed. Volume 1" by Bruce Eckel, // http://www.mindview.net/ static const Matrix3& zero(); - static const Matrix3& identity(); + static const Matrix3& identity(); - // Deprecated. + // Deprecated. /** @deprecated Use Matrix3::zero() */ static const Matrix3 ZERO; /** @deprecated Use Matrix3::identity() */ diff --git a/dep/include/g3dlite/G3D/Plane.h b/dep/include/g3dlite/G3D/Plane.h index f00c15c0988..0e53cc14666 100644 --- a/dep/include/g3dlite/G3D/Plane.h +++ b/dep/include/g3dlite/G3D/Plane.h @@ -25,8 +25,8 @@ class Plane { private: /** normal.Dot(x,y,z) = distance */ - Vector3 _normal; - float _distance; + Vector3 _normal; + float _distance; /** Assumes the normal has unit length. @@ -68,7 +68,7 @@ public: virtual ~Plane() {} /** - Returns true if point is on the side the normal points to or + Returns true if point is on the side the normal points to or is in the plane. */ inline bool halfSpaceContains(Vector3 point) const { @@ -81,7 +81,7 @@ public: } /** - Returns true if point is on the side the normal points to or + Returns true if point is on the side the normal points to or is in the plane. */ inline bool halfSpaceContains(const Vector4& point) const { @@ -93,7 +93,7 @@ public: } /** - Returns true if point is on the side the normal points to or + Returns true if point is on the side the normal points to or is in the plane. Only call on finite points. Faster than halfSpaceContains. */ inline bool halfSpaceContainsFinite(const Vector3& point) const { @@ -108,9 +108,9 @@ public: return fuzzyEq(point.dot(_normal), _distance); } - inline const Vector3& normal() const { - return _normal; - } + inline const Vector3& normal() const { + return _normal; + } /** Returns distance from point to plane. Distance is negative if point is behind (not in plane in direction opposite normal) the plane. diff --git a/dep/include/g3dlite/G3D/Quat.h b/dep/include/g3dlite/G3D/Quat.h index b852fe0fd47..34549032262 100644 --- a/dep/include/g3dlite/G3D/Quat.h +++ b/dep/include/g3dlite/G3D/Quat.h @@ -1,10 +1,10 @@ /** @file Quat.h - + Quaternion - + @maintainer Morgan McGuire, matrix@graphics3d.com - + @created 2002-01-23 @edited 2006-05-10 */ @@ -27,11 +27,11 @@ namespace G3D { A quaternion represents the sum of a real scalar and an imaginary vector: ix + jy + kz + w. A unit quaternion - representing a rotation by A about axis v has the form + representing a rotation by A about axis v has the form [sin(A/2)*v, cos(A/2)]. For a unit quaternion, q.conj() == q.inverse() is a rotation by -A about v. -q is the same rotation as q - (negate both the axis and angle). - + (negate both the axis and angle). + A non-unit quaterion q represents the same rotation as q.unitize() (Dam98 pg 28). @@ -56,9 +56,9 @@ public: /** q = [sin(angle / 2) * axis, cos(angle / 2)] - + In Watt & Watt's notation, s = w, v = (x, y, z) - In the Real-Time Rendering notation, u = (x, y, z), w = w + In the Real-Time Rendering notation, u = (x, y, z), w = w */ float x, y, z, w; @@ -89,20 +89,20 @@ public: } /** Note: two quats can represent the Quat::sameRotation and not be equal. */ - bool fuzzyEq(const Quat& q) { - return G3D::fuzzyEq(x, q.x) && G3D::fuzzyEq(y, q.y) && G3D::fuzzyEq(z, q.z) && G3D::fuzzyEq(w, q.w); - } + bool fuzzyEq(const Quat& q) { + return G3D::fuzzyEq(x, q.x) && G3D::fuzzyEq(y, q.y) && G3D::fuzzyEq(z, q.z) && G3D::fuzzyEq(w, q.w); + } - /** True if these quaternions represent the same rotation (note that every rotation is + /** True if these quaternions represent the same rotation (note that every rotation is represented by two values; q and -q). */ bool sameRotation(const Quat& q) { return fuzzyEq(q) || fuzzyEq(-q); } - inline Quat operator-() const { - return Quat(-x, -y, -z, -w); - } + inline Quat operator-() const { + return Quat(-x, -y, -z, -w); + } /** Returns the imaginary part (x, y, z) @@ -129,34 +129,34 @@ public: void toAxisAngleRotation( Vector3& axis, float& angle) const { - double d; - toAxisAngleRotation(axis, d); - angle = (float)d; - } + double d; + toAxisAngleRotation(axis, d); + angle = (float)d; + } Matrix3 toRotationMatrix() const; void toRotationMatrix( Matrix3& rot) const; - + /** - Spherical linear interpolation: linear interpolation along the + Spherical linear interpolation: linear interpolation along the shortest (3D) great-circle route between two quaternions. Note: Correct rotations are expected between 0 and PI in the right order. @cite Based on Game Physics -- David Eberly pg 538-540 @param threshold Critical angle between between rotations at which - the algorithm switches to normalized lerp, which is more - numerically stable in those situations. 0.0 will always slerp. + the algorithm switches to normalized lerp, which is more + numerically stable in those situations. 0.0 will always slerp. */ Quat slerp( const Quat& other, float alpha, float threshold = 0.05f) const; - /** Normalized linear interpolation of quaternion components. */ - Quat nlerp(const Quat& other, float alpha) const; + /** Normalized linear interpolation of quaternion components. */ + Quat nlerp(const Quat& other, float alpha) const; /** Negates the imaginary part. @@ -177,7 +177,7 @@ public: return Quat(x * s, y * s, z * s, w * s); } - /** @cite Based on Watt & Watt, page 360 */ + /** @cite Based on Watt & Watt, page 360 */ friend Quat operator* (float s, const Quat& q); inline Quat operator/(float s) const { @@ -188,7 +188,7 @@ public: return (x * other.x) + (y * other.y) + (z * other.z) + (w * other.w); } - /** Note that q-1 = q.conj() for a unit quaternion. + /** Note that q-1 = q.conj() for a unit quaternion. @cite Dam99 page 13 */ inline Quat inverse() const { return conj() / dot(*this); @@ -214,7 +214,7 @@ public: inline bool isUnit(float tolerance = 1e-5) const { return abs(dot(*this) - 1.0f) < tolerance; } - + inline float magnitude() const { return sqrtf(dot(*this)); @@ -242,18 +242,18 @@ public: } } /** log q = [Av, 0] where q = [sin(A) * v, cos(A)]. - Only for unit quaternions + Only for unit quaternions debugAssertM(isUnit(), "Log only defined for unit quaternions"); // Solve for A in q = [sin(A)*v, cos(A)] Vector3 u(x, y, z); double len = u.magnitude(); if (len == 0.0) { - return + return } double A = atan2((double)w, len); Vector3 v = u / len; - + return Quat(v * A, 0); } */ @@ -321,8 +321,8 @@ public: const float& operator[] (int i) const; float& operator[] (int i); - /** Generate uniform random unit quaternion (i.e. random "direction") - @cite From "Uniform Random Rotations", Ken Shoemake, Graphics Gems III. + /** Generate uniform random unit quaternion (i.e. random "direction") + @cite From "Uniform Random Rotations", Ken Shoemake, Graphics Gems III. */ static Quat unitRandom(); diff --git a/dep/include/g3dlite/G3D/Ray.h b/dep/include/g3dlite/G3D/Ray.h index 3b54f145c33..b9848792733 100644 --- a/dep/include/g3dlite/G3D/Ray.h +++ b/dep/include/g3dlite/G3D/Ray.h @@ -1,10 +1,10 @@ /** @file Ray.h - + Ray class - + @maintainer Morgan McGuire, matrix@graphics3d.com - + @created 2002-07-12 @edited 2006-02-21 */ @@ -142,7 +142,7 @@ public: return intersectionTime(vert0, vert1, vert2, vert1 - vert0, vert2 - vert0, w0, w1, w2); } - /* One-sided triangle + /* One-sided triangle */ inline float intersectionTime(const Triangle& triangle) const { return intersectionTime( @@ -189,7 +189,7 @@ public: #define SUB(dest,v1,v2) \ dest[0]=v1[0]-v2[0]; \ dest[1]=v1[1]-v2[1]; \ - dest[2]=v1[2]-v2[2]; + dest[2]=v1[2]-v2[2]; inline float Ray::intersectionTime( const Vector3& vert0, @@ -205,41 +205,41 @@ inline float Ray::intersectionTime( float u, v; float tvec[3], pvec[3], qvec[3]; - + // begin calculating determinant - also used to calculate U parameter CROSS(pvec, direction, edge2); - + // if determinant is near zero, ray lies in plane of triangle const float det = DOT(edge1, pvec); - + if (det < EPSILON) { return (float)inf(); } - + // calculate distance from vert0 to ray origin SUB(tvec, origin, vert0); - + // calculate U parameter and test bounds u = DOT(tvec, pvec); if ((u < 0.0f) || (u > det)) { // Hit the plane outside the triangle return (float)inf(); } - + // prepare to test V parameter CROSS(qvec, tvec, edge1); - + // calculate V parameter and test bounds v = DOT(direction, qvec); if ((v < 0.0f) || (u + v > det)) { // Hit the plane outside the triangle return (float)inf(); } - + // Case where we don't need correct (u, v): const float t = DOT(edge2, qvec); - + if (t >= 0.0f) { // Note that det must be positive return t / det; @@ -270,36 +270,36 @@ inline float Ray::intersectionTime( // begin calculating determinant - also used to calculate U parameter CROSS(pvec, direction, edge2); - + // if determinant is near zero, ray lies in plane of triangle const float det = DOT(edge1, pvec); - + if (det < EPSILON) { return (float)inf(); } - + // calculate distance from vert0 to ray origin SUB(tvec, origin, vert0); - + // calculate U parameter and test bounds u = DOT(tvec, pvec); if ((u < 0.0f) || (u > det)) { // Hit the plane outside the triangle return (float)inf(); } - + // prepare to test V parameter CROSS(qvec, tvec, edge1); - + // calculate V parameter and test bounds v = DOT(direction, qvec); if ((v < 0.0f) || (u + v > det)) { // Hit the plane outside the triangle return (float)inf(); } - + float t = DOT(edge2, qvec); - + if (t >= 0) { const float inv_det = 1.0f / det; t *= inv_det; diff --git a/dep/include/g3dlite/G3D/RegistryUtil.h b/dep/include/g3dlite/G3D/RegistryUtil.h index 97de8d06725..34e4ef8f144 100644 --- a/dep/include/g3dlite/G3D/RegistryUtil.h +++ b/dep/include/g3dlite/G3D/RegistryUtil.h @@ -21,7 +21,7 @@ namespace G3D { -/** +/** Provides generalized Windows registry querying. All key names are one string in the format: @@ -49,10 +49,10 @@ public: /** returns false if the key could not be read for any reason. */ static bool readInt32(const std::string& key, int32& valueData); - /** + /** Reads an arbitrary amount of data from a binary registry key. returns false if the key could not be read for any reason. - + @beta @param valueData pointer to the output buffer of sufficient size. Pass NULL as valueData in order to have available data size returned in dataSize. @param dataSize size of the output buffer. When NULL is passed for valueData, contains the size of available data on successful return. @@ -65,10 +65,10 @@ public: /** returns false if the key could not be written for any reason. */ static bool writeInt32(const std::string& key, int32 valueData); - /** + /** Writes an arbitrary amount of data to a binary registry key. returns false if the key could not be written for any reason. - + @param valueData pointer to the input buffer @param dataSize size of the input buffer that should be written */ diff --git a/dep/include/g3dlite/G3D/Sphere.h b/dep/include/g3dlite/G3D/Sphere.h index 39097e01850..97425649fbd 100644 --- a/dep/include/g3dlite/G3D/Sphere.h +++ b/dep/include/g3dlite/G3D/Sphere.h @@ -1,10 +1,10 @@ /** @file Sphere.h - + Sphere class - + @maintainer Morgan McGuire, matrix@graphics3d.com - + @created 2001-06-02 @edited 2004-07-05 */ @@ -61,40 +61,40 @@ public: bool contains(const Vector3& point) const; /** - @deprecated Use culledBy(Array&) + @deprecated Use culledBy(Array&) */ bool culledBy( const class Plane* plane, int numPlanes, - int32& cullingPlaneIndex, - const uint32 testMask, + int32& cullingPlaneIndex, + const uint32 testMask, uint32& childMask) const; /** - @deprecated Use culledBy(Array&) + @deprecated Use culledBy(Array&) */ bool culledBy( const class Plane* plane, int numPlanes, - int32& cullingPlaneIndex = dummy, - const uint32 testMask = -1) const; + int32& cullingPlaneIndex = dummy, + const uint32 testMask = -1) const; - /** + /** See AABox::culledBy - */ - bool culledBy( - const Array& plane, - int32& cullingPlaneIndex, - const uint32 testMask, + */ + bool culledBy( + const Array& plane, + int32& cullingPlaneIndex, + const uint32 testMask, uint32& childMask) const; /** Conservative culling test that does not produce a mask for children. */ - bool culledBy( - const Array& plane, - int32& cullingPlaneIndex = dummy, - const uint32 testMask = -1) const; + bool culledBy( + const Array& plane, + int32& cullingPlaneIndex = dummy, + const uint32 testMask = -1) const; virtual std::string toString() const; float volume() const; diff --git a/dep/include/g3dlite/G3D/System.h b/dep/include/g3dlite/G3D/System.h index 507b44670da..178302d5953 100644 --- a/dep/include/g3dlite/G3D/System.h +++ b/dep/include/g3dlite/G3D/System.h @@ -1,8 +1,8 @@ -/** +/** @file System.h - + @maintainer Morgan McGuire, matrix@graphics3d.com - + @cite Rob Wyatt http://www.gamasutra.com/features/wyatts_world/19990709/processor_detection_01.htm @cite Benjamin Jurke http://www.flipcode.com/cgi-bin/msg.cgi?showThread=COTD-ProcessorDetectionClass&forum=cotd&id=-1 @cite Michael Herf http://www.stereopsis.com/memcpy.html @@ -19,7 +19,7 @@ #include #ifdef G3D_OSX -# include +# include #endif @@ -34,13 +34,13 @@ public: static void init(); /** - Guarantees that the start of the array is aligned to the + Guarantees that the start of the array is aligned to the specified number of bytes. */ static void* alignedMalloc(size_t bytes, size_t alignment); /** - Uses pooled storage to optimize small allocations (1 byte to 5 kilobytes). + Uses pooled storage to optimize small allocations (1 byte to 5 kilobytes). Can be 10x to 100x faster than calling ::malloc or new. The result must be freed with free. @@ -56,7 +56,7 @@ public: /** @param size Size of memory that the system was trying to allocate @param recoverable If true, the system will attempt to allocate again - if the callback returns true. If false, malloc is going to return + if the callback returns true. If false, malloc is going to return NULL and this invocation is just to notify the application. @return Return true to force malloc to attempt allocation again if the error was recoverable. @@ -71,7 +71,7 @@ public: true, System::malloc will attempt to allocate the memory again. If the callback returns false, then System::malloc will return NULL. - You can use outOfMemoryCallback to free data structures or to + You can use outOfMemoryCallback to free data structures or to register the failure. */ static OutOfMemoryCallback outOfMemoryCallback; @@ -86,7 +86,7 @@ public: static std::string mallocPerformance(); static void resetMallocPerformanceCounters(); - /** + /** Returns a string describing the current usage of the buffer pools used for optimizing System::malloc. */ @@ -105,13 +105,13 @@ public: static void alignedFree(void* ptr); /** An implementation of memcpy that may be up to 2x as fast as the C library - one on some processors. Guaranteed to have the same behavior as memcpy - in all cases. */ + one on some processors. Guaranteed to have the same behavior as memcpy + in all cases. */ static void memcpy(void* dst, const void* src, size_t numBytes); /** An implementation of memset that may be up to 2x as fast as the C library - one on some processors. Guaranteed to have the same behavior as memset - in all cases. */ + one on some processors. Guaranteed to have the same behavior as memset + in all cases. */ static void memset(void* dst, uint8 value, size_t numBytes); }; diff --git a/dep/include/g3dlite/G3D/Table.h b/dep/include/g3dlite/G3D/Table.h index 285d774d24a..692b91ab059 100644 --- a/dep/include/g3dlite/G3D/Table.h +++ b/dep/include/g3dlite/G3D/Table.h @@ -81,7 +81,7 @@ namespace G3D { An unordered data structure mapping keys to values. Key must be a pointer, an int, a std::string, a class with a hashCode() method, - or provide overloads for: + or provide overloads for:

     template<> struct GHashCode {
@@ -108,7 +108,7 @@ namespace G3D {
   1.0 your hash function is badly designed and maps too many inputs to
   the same output.
  */
-template > 
+template >
 class Table {
 public:
 
@@ -131,12 +131,12 @@ private:
         Entry       entry;
         Node*       next;
 
-        
+
         /** Provide pooled allocation for speed. */
         inline void* operator new (size_t size) {
             return System::malloc(size);
         }
-        
+
         inline void operator delete (void* p) {
             System::free(p);
         }
@@ -165,12 +165,12 @@ private:
     size_t  _size;
 
     /**
-     Array of Node*. 
+     Array of Node*.
      We don't use Array because Table is lower level.
      Some elements may be NULL.
      */
     Node**  bucket;
-    
+
     /**
      Length of the bucket array.
      */
@@ -187,15 +187,15 @@ private:
 
         for (size_t b = 0; b < this->numBuckets; b++) {
             Node* node = oldBucket[b];
-         
+
             while (node != NULL) {
                 Node* nextNode = node->next;
-        
+
                 // insert at the head of the list for bucket[i]
                 size_t i = node->hashCode % numBuckets;
                 node->next = bucket[i];
                 bucket[i] = node;
-        
+
                 node = nextNode;
             }
         }
@@ -294,7 +294,7 @@ public:
 
     /**
      A small load (close to zero) means the hash table is acting very
-     efficiently most of the time.  A large load (close to 1) means 
+     efficiently most of the time.  A large load (close to 1) means
      the hash table is acting poorly-- all operations will be very slow.
      A large load will result from a bad hash function that maps too
      many keys to the same code.
@@ -342,7 +342,7 @@ public:
             table(const_cast*>(table)),
             numBuckets(numBuckets),
             bucket(bucket) {
-            
+
             if (numBuckets == 0) {
                 // Empty table
                 isDone = true;
@@ -383,7 +383,7 @@ public:
             } else {
                 return
                     (table == other.table) &&
-                    (node == other.node) && 
+                    (node == other.node) &&
                     (index == other.index);
             }
         }
@@ -421,7 +421,7 @@ public:
 
 
     /**
-     C++ STL style iterator method.  Returns the first Entry, which 
+     C++ STL style iterator method.  Returns the first Entry, which
      contains a key and value.  Use preincrement (++entry) to get to
      the next element.  Do not modify the table while iterating.
      */
@@ -448,7 +448,7 @@ public:
          System::memset(bucket, 0, sizeof(Node*) * numBuckets);
     }
 
-   
+
     /**
      Returns the number of keys.
      */
@@ -459,13 +459,13 @@ public:
 
     /**
      If you insert a pointer into the key or value of a table, you are
-     responsible for deallocating the object eventually.  Inserting 
+     responsible for deallocating the object eventually.  Inserting
      key into a table is O(1), but may cause a potentially slow rehashing.
      */
     void set(const Key& key, const Value& value) {
         size_t code = m_HashFunc(key);
         size_t b = code % numBuckets;
-        
+
         // Go to the bucket
         Node* n = bucket[b];
 
@@ -479,7 +479,7 @@ public:
         size_t bucketLength = 1;
 
         // Sometimes a bad hash code will cause all elements
-        // to collide.  Detect this case and don't rehash when 
+        // to collide.  Detect this case and don't rehash when
         // it occurs; nothing good will come from the rehashing.
         bool allSameCode = true;
 
@@ -515,7 +515,7 @@ public:
     to remove an element that isn't present.
     */
    void remove(const Key& key) {
-      
+
       size_t code = m_HashFunc(key);
       size_t b = code % numBuckets;
 
@@ -552,7 +552,7 @@ public:
 
    /**
     Returns the value associated with key.
-    @deprecated Use get(key, val) or 
+    @deprecated Use get(key, val) or
     */
    Value& get(const Key& key) const {
 
@@ -647,7 +647,7 @@ public:
    }
 
    /**
-    Calls delete on all of the keys.  Does not clear the table, 
+    Calls delete on all of the keys.  Does not clear the table,
     however, so you are left with a table of dangling pointers.
 
     Same as getKeys().deleteAll();
diff --git a/dep/include/g3dlite/G3D/Triangle.h b/dep/include/g3dlite/G3D/Triangle.h
index cbe46a8cf50..50552a356fa 100644
--- a/dep/include/g3dlite/G3D/Triangle.h
+++ b/dep/include/g3dlite/G3D/Triangle.h
@@ -1,8 +1,8 @@
 /**
  @file Triangle.h
-  
+
  @maintainer Morgan McGuire, matrix@graphics3d.com
- 
+
  @created 2003-04-05
  @edited  2004-03-14
 
@@ -52,11 +52,11 @@ private:
     void init(const Vector3& v0, const Vector3& v1, const Vector3& v2);
 
 public:
-	
+
     Triangle();
-    
+
     Triangle(const Vector3& v0, const Vector3& v1, const Vector3& v2);
-    
+
     ~Triangle();
 
     /** 0, 1, or 2 */
@@ -110,7 +110,7 @@ public:
 } // namespace
 
 inline unsigned int hashCode(const G3D::Triangle& t) {
-	return t.hashCode();
+    return t.hashCode();
 }
 
 #endif
diff --git a/dep/include/g3dlite/G3D/Vector2.h b/dep/include/g3dlite/G3D/Vector2.h
index 2d9d2662646..02098037f34 100644
--- a/dep/include/g3dlite/G3D/Vector2.h
+++ b/dep/include/g3dlite/G3D/Vector2.h
@@ -1,10 +1,10 @@
 /**
   @file Vector2.h
- 
+
   2D vector class
- 
+
   @maintainer Morgan McGuire, matrix@graphics3d.com
-  
+
   @created 2001-06-02
   @edited  2006-01-14
   Copyright 2000-2006, Morgan McGuire.
@@ -21,7 +21,7 @@
 
 namespace G3D {
 
-class Vector2;    
+class Vector2;
 class Vector3;
 class Vector4;
 
@@ -47,7 +47,7 @@ public:
     Vector2(float coordinate[2]);
     Vector2(double coordinate[2]);
     Vector2(const Vector2& rkVector);
-    Vector2(const class Vector2int16& v); 
+    Vector2(const class Vector2int16& v);
 
     float& operator[] (int i);
     const float& operator[] (int i) const;
@@ -87,7 +87,7 @@ public:
      Linear interpolation
      */
     inline Vector2 lerp(const Vector2& v, float alpha) const {
-        return (*this) + (v - *this) * alpha; 
+        return (*this) + (v - *this) * alpha;
     }
 
     inline Vector2 clamp(const Vector2& low, const Vector2& high) const {
@@ -137,10 +137,10 @@ public:
     inline static const Vector2& one() { static const Vector2 v(1, 1); return v; }
     static const Vector2& unitX();
     static const Vector2& unitY();
-    static const Vector2& inf(); 
+    static const Vector2& inf();
     static const Vector2& nan();
     /** smallest (most negative) representable vector */
-    static const Vector2& minFinite(); 
+    static const Vector2& minFinite();
     /** Largest representable vector */
     static const Vector2& maxFinite();
 
diff --git a/dep/include/g3dlite/G3D/Vector2int16.h b/dep/include/g3dlite/G3D/Vector2int16.h
index cadb4a80c5f..0d495e383c9 100644
--- a/dep/include/g3dlite/G3D/Vector2int16.h
+++ b/dep/include/g3dlite/G3D/Vector2int16.h
@@ -1,6 +1,6 @@
 /**
   @file Vector2int16.h
-  
+
   @maintainer Morgan McGuire, matrix@brown.edu
 
   @created 2003-08-09
diff --git a/dep/include/g3dlite/G3D/Vector3.h b/dep/include/g3dlite/G3D/Vector3.h
index 79c28fb5e7d..56e88aa085a 100644
--- a/dep/include/g3dlite/G3D/Vector3.h
+++ b/dep/include/g3dlite/G3D/Vector3.h
@@ -1,8 +1,8 @@
 /**
   @file Vector3.h
- 
+
   3D vector class
- 
+
   @maintainer Morgan McGuire, matrix@graphics3d.com
 
   @created 2001-06-02
@@ -22,14 +22,14 @@
 
 namespace G3D {
 
-class Vector2;    
+class Vector2;
 class Vector3;
 class Vector4;
 
 /**
   Swizzles
  Vector classes have swizzle operators, e.g. v.xy(), that
- allow selection of arbitrary sub-fields.  These cannot be used as write 
+ allow selection of arbitrary sub-fields.  These cannot be used as write
  masks.  Examples
 
   
@@ -57,7 +57,7 @@ private:
 
      
        V'    N      V
-                 
+
          r   ^   -,
           \  |  /
             \|/
@@ -126,7 +126,7 @@ public:
 
     /** Returns true if this vector has length ~= 1 */
     bool isUnit() const;
-    
+
     // arithmetic operations
     Vector3 operator+ (const Vector3& v) const;
     Vector3 operator- (const Vector3& v) const;
@@ -145,10 +145,10 @@ public:
     Vector3& operator/= (const Vector3& v);
 
     /** @deprecated Use magnitude */
-	float G3D_DEPRECATED length() const;
+    float G3D_DEPRECATED length() const;
 
     float magnitude() const;
-    
+
     /**
      The result is a nan vector if the length is almost zero.
      */
@@ -163,17 +163,17 @@ public:
 
     /**
       See also G3D::Ray::reflect.
-      The length is 1. 
+      The length is 1.
      
        V'    N       V
-                 
+
          r   ^    /
           \  |  /
             \|'-
      
*/ Vector3 reflectionDirection(const Vector3& normal) const; - + /** Returns Vector3::zero() if the length is nearly zero, otherwise @@ -195,7 +195,7 @@ public: where iExit is the index of refraction for the previous material and iEnter is the index of refraction for the new material. Like Vector3::reflectionDirection, - the result has length 1 and is + the result has length 1 and is pointed away from the intersection. Returns Vector3::zero() in the case of total internal refraction. @@ -209,7 +209,7 @@ public: See also G3D::Ray::refract.
               N      V
-                  
+
               ^    /
               |  /
               |'-
@@ -236,14 +236,14 @@ public:
     float G3D_DEPRECATED squaredLength() const;
 
     float squaredMagnitude () const;
-	
+
     /** @deprecated Use squaredMagnitude */
     inline float G3D_DEPRECATED norm() const {
         return squaredMagnitude();
     }
 
     float dot(const Vector3& rkVector) const;
-    
+
     float G3D_DEPRECATED unitize(float fTolerance = 1e-06);
 
     /** Cross product.  Note that two cross products in a row
@@ -285,7 +285,7 @@ public:
      Linear interpolation
      */
     inline Vector3 lerp(const Vector3& v, float alpha) const {
-        return (*this) + (v - *this) * alpha; 
+        return (*this) + (v - *this) * alpha;
     }
 
     /** Gram-Schmidt orthonormalization. */
@@ -295,7 +295,7 @@ public:
     static Vector3 random();
 
     /** Random unit vector, distributed
-        so that the probability of V is proportional 
+        so that the probability of V is proportional
         to max(V dot Normal, 0).
 
         @cite Henrik Wann Jensen, Realistic Image Synthesis using Photon Mapping eqn 2.24
diff --git a/dep/include/g3dlite/G3D/Vector3int16.h b/dep/include/g3dlite/G3D/Vector3int16.h
index 9fd344b2da7..744446a147c 100644
--- a/dep/include/g3dlite/G3D/Vector3int16.h
+++ b/dep/include/g3dlite/G3D/Vector3int16.h
@@ -1,6 +1,6 @@
 /**
   @file Vector3int16.h
-  
+
   @maintainer Morgan McGuire, matrix@brown.edu
 
   @created 2003-04-07
diff --git a/dep/include/g3dlite/G3D/Vector4.h b/dep/include/g3dlite/G3D/Vector4.h
index b86bf95b003..ecaec2bec57 100644
--- a/dep/include/g3dlite/G3D/Vector4.h
+++ b/dep/include/g3dlite/G3D/Vector4.h
@@ -1,10 +1,10 @@
 /**
   @file Vector4.h
- 
+
   Homogeneous vector class.
- 
+
   @maintainer Morgan McGuire, matrix@graphics3d.com
- 
+
   @created 2002-07-09
   @edited  2005-03-28
 
@@ -23,7 +23,7 @@
 
 namespace G3D {
 
-class Vector2;    
+class Vector2;
 class Vector3;
 class Vector4;
 
@@ -116,7 +116,7 @@ public:
     // arithmetic operations
     Vector4 operator+ (const Vector4& rkVector) const;
     Vector4 operator- (const Vector4& rkVector) const;
-    
+
     inline Vector4 operator*(const Vector4& rkVector) const {
         return Vector4(x * rkVector.x, y * rkVector.y, z * rkVector.z, w * rkVector.w);
     }
diff --git a/dep/include/g3dlite/G3D/format.h b/dep/include/g3dlite/G3D/format.h
index b031300ab1a..877afba1926 100644
--- a/dep/include/g3dlite/G3D/format.h
+++ b/dep/include/g3dlite/G3D/format.h
@@ -1,8 +1,8 @@
 /**
  @file format.h
- 
+
  @maintainer Morgan McGuire, matrix@graphics3d.com
- 
+
  @author  2000-09-09
  @edited  2005-11-03
 
diff --git a/dep/include/g3dlite/G3D/g3dmath.h b/dep/include/g3dlite/G3D/g3dmath.h
index 1f3eaaae57c..5dbd008409f 100644
--- a/dep/include/g3dlite/G3D/g3dmath.h
+++ b/dep/include/g3dlite/G3D/g3dmath.h
@@ -1,11 +1,11 @@
 /**
  @file g3dmath.h
- 
+
  Math util class.
- 
+
  @maintainer Morgan McGuire, matrix@graphics3d.com
  @cite highestBit by Jukka Liimatta
- 
+
  @created 2001-06-02
  @edited  2006-01-16
 
@@ -32,7 +32,7 @@
 
 /*These defines enable functionality introduced with the 1999 ISO C
 **standard. They must be defined before the inclusion of math.h to
-**engage them. If optimisation is enabled, these functions will be 
+**engage them. If optimisation is enabled, these functions will be
 **inlined. With optimisation switched off, you have to link in the
 **maths library using -lm.
 */
@@ -52,19 +52,19 @@
 namespace G3D {
 
 #if defined(_MSC_VER)
-    
+
 #if !defined(_WIN64)
 
 /**
    Win32 implementation of the C99 fast rounding routines.
-   
+
    @cite routines are
    Copyright (C) 2001 Erik de Castro Lopo 
-   
-   Permission to use, copy, modify, distribute, and sell this file for any 
-   purpose is hereby granted without fee, provided that the above copyright 
+
+   Permission to use, copy, modify, distribute, and sell this file for any
+   purpose is hereby granted without fee, provided that the above copyright
    and this permission notice appear in all copies.  No representations are
-   made about the suitability of this software for any purpose.  It is 
+   made about the suitability of this software for any purpose.  It is
    provided "as is" without express or implied warranty.
 */
 
@@ -115,13 +115,13 @@ inline const double& inf() {
 
 // We already have  included but
 // not using it in older gcc for safe compilations
-#if (__GNUC__ == 2)    
+#if (__GNUC__ == 2)
     static const double i = 1.0/sin(0.0);
 #else
     // double is a standard type and should have infinity
     static const double i = std::numeric_limits::infinity();
 #endif
-	return i;
+    return i;
 }
 
 /** Returns a reference to a static double.
@@ -137,7 +137,7 @@ inline const double& nan() {
     // double is a standard type and should have quiet NaN
     static const double n = std::numeric_limits::quiet_NaN();
 #endif
-	return n;
+    return n;
 }
 
 /** Returns a reference to a static double. Use instead of G3D_PI. */
@@ -168,24 +168,24 @@ inline const double& twoPi() {
     @deprecated Use G3D::twoPi() instead. */
 #define G3D_TWO_PI  (6.283185)
 
-typedef signed char		int8;
-typedef unsigned char	uint8;
-typedef short			int16;
-typedef unsigned short	uint16;
-typedef int				int32;
-typedef unsigned int	uint32;
+typedef signed char     int8;
+typedef unsigned char   uint8;
+typedef short           int16;
+typedef unsigned short  uint16;
+typedef int             int32;
+typedef unsigned int    uint32;
 
 #ifdef _MSC_EXTENSIONS
-    typedef __int64			   int64;
+    typedef __int64            int64;
     typedef unsigned __int64   uint64;
 #else
-    typedef long long		   int64;
+    typedef long long          int64;
     typedef unsigned long long uint64;
 #endif
 typedef unsigned int uint;
 
-typedef float			float32;
-typedef double			float64;
+typedef float           float32;
+typedef double          float64;
 
 int iAbs(int iValue);
 int iCeil(double fValue);
@@ -226,7 +226,7 @@ inline int iSign(float f) {
 }
 
 
-/** 
+/**
     Fast round to integer using the lrint routine.
     Typically 6x faster than casting to integer.
  */
@@ -234,7 +234,7 @@ inline int iRound(double fValue) {
     return lrint(fValue);
 }
 
-/** 
+/**
     Fast round to integer using the lrint routine.
     Typically 6x faster than casting to integer.
  */
@@ -273,7 +273,7 @@ bool isNaN(double x);
  */
 int iMod3(int x);
 
-/** 
+/**
  [0, 1]
  @deprecated use uniformRandom()
  */
@@ -297,7 +297,7 @@ double symmetricRandom ();
 float uniformRandom(float low = 0.0f, float hi = 1.0f);
 
 /**
- Normally distributed random number. 
+ Normally distributed random number.
  */
 float gaussRandom(float mean = 0.0f, float stdev = 1.0f);
 
@@ -360,7 +360,7 @@ double distance(double x, double y, double z);
   the left.  -1 means the number was 0.
 
   @cite Based on code by jukka@liimatta.org
- */ 
+ */
 int highestBit(uint32 x);
 
 /**
@@ -370,8 +370,8 @@ int highestBit(uint32 x);
  */
 bool fuzzyEq(double a, double b);
 
-/** True if a is definitely not equal to b.  
-    Guaranteed false if a == b. 
+/** True if a is definitely not equal to b.
+    Guaranteed false if a == b.
     Possibly false when a != b.*/
 bool fuzzyNe(double a, double b);
 
@@ -415,7 +415,7 @@ inline float SSErsq(float x) {
 
 /**
  Return the next power of 2 higher than the input
- If the input is already a power of 2, the output will be the same 
+ If the input is already a power of 2, the output will be the same
  as the input.
  */
 int ceilPow2(unsigned int in);
diff --git a/dep/include/g3dlite/G3D/platform.h b/dep/include/g3dlite/G3D/platform.h
index 8950e5b7b55..1b2518fcd77 100644
--- a/dep/include/g3dlite/G3D/platform.h
+++ b/dep/include/g3dlite/G3D/platform.h
@@ -13,7 +13,7 @@
 #define G3D_PLATFORM_H
 
 /**
- The version number of G3D in the form: MmmBB -> 
+ The version number of G3D in the form: MmmBB ->
  version M.mm [beta BB]
  */
 #define G3D_VER 61000
@@ -30,11 +30,11 @@
 #   define G3D_DEBUG
 #endif
 
-#ifdef _MSC_VER 
+#ifdef _MSC_VER
     #define G3D_WIN32
 #elif defined(__MINGW32__)
-    #define G3D_WIN32 
-    #define G3D_MINGW32 
+    #define G3D_WIN32
+    #define G3D_MINGW32
 #elif defined(__linux__)
     #define G3D_LINUX
 #elif defined(__OpenBSD__)
@@ -46,11 +46,11 @@
 #elif defined(__APPLE__)
     #define G3D_OSX
 #else
-    #error Unknown platform 
+    #error Unknown platform
 #endif
 
 
-// Default to compiling with SSE, but if you want to compile 
+// Default to compiling with SSE, but if you want to compile
 // without installing SP5.0 and the Processor Pack on Windows, compile with NO_SSE
 // defined (can be passed to the compiler command line with /D "NO_SSE")
 #if !defined(NO_SSE)
@@ -59,7 +59,7 @@
 
 #ifdef G3D_WIN32
 // Turn off warnings about deprecated C routines (TODO: revisit)
-#	pragma warning (disable : 4996)
+#   pragma warning (disable : 4996)
 #endif
 
 // On g++, recognize cases where the -msse2 flag was not specified
@@ -107,14 +107,14 @@
     #ifndef __GNUC__
         #error G3D only supports the gcc compiler on OS X.
     #endif
-	
-	#if defined(__i386__)
-		#define G3D_OSX_INTEL
-	#elif defined(__PPC__)
-		#define G3D_OSX_PPC
-	#else
-		#define G3D_OSX_UNKNOWN
-	#endif
+
+    #if defined(__i386__)
+        #define G3D_OSX_INTEL
+    #elif defined(__PPC__)
+        #define G3D_OSX_PPC
+    #else
+        #define G3D_OSX_UNKNOWN
+    #endif
 
 #   ifndef __cdecl
 #       define __cdecl __attribute__((cdecl))
@@ -134,10 +134,10 @@
 
 
 #ifdef G3D_WIN32
-// Microsoft Visual C++ 7.1	_MSC_VER = 1310
-// Microsoft Visual C++ 7.0	_MSC_VER = 1300
-// Microsoft Visual C++ 6.0	_MSC_VER = 1200
-// Microsoft Visual C++ 5.0	_MSC_VER = 1100
+// Microsoft Visual C++ 7.1 _MSC_VER = 1310
+// Microsoft Visual C++ 7.0 _MSC_VER = 1300
+// Microsoft Visual C++ 6.0 _MSC_VER = 1200
+// Microsoft Visual C++ 5.0 _MSC_VER = 1100
 
     // Old versions of MSVC (6.0 and previous) don't
     // support C99 for loop scoping rules.  This fixes them.
@@ -165,10 +165,10 @@
 // TODO: remove
 #   pragma warning (disable : 4244)
 
-#	if defined(_MSC_VER) && (_MSC_VER <= 1200)
-		//	VC6 std:: has signed problems in it	
-#		pragma warning (disable : 4018)
-#	endif
+#   if defined(_MSC_VER) && (_MSC_VER <= 1200)
+        //  VC6 std:: has signed problems in it
+#       pragma warning (disable : 4018)
+#   endif
 
 #   define ZLIB_WINAPI
 
@@ -177,15 +177,15 @@
 #          define restrict
 #   endif
 
-#   define G3D_CHECK_PRINTF_ARGS 
+#   define G3D_CHECK_PRINTF_ARGS
 #   define G3D_CHECK_VPRINTF_ARGS
-#   define G3D_CHECK_PRINTF_METHOD_ARGS 
+#   define G3D_CHECK_PRINTF_METHOD_ARGS
 #   define G3D_CHECK_VPRINTF_METHOD_ARGS
 
     // On MSVC, we need to link against the multithreaded DLL version of
     // the C++ runtime because that is what SDL and ZLIB are compiled
     // against.  This is not the default for MSVC, so we set the following
-    // defines to force correct linking.  
+    // defines to force correct linking.
     //
     // For documentation on compiler options, see:
     //  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_.2f.md.2c_2f.ml.2c_2f.mt.2c_2f.ld.asp
@@ -195,16 +195,16 @@
 #if 0 //ignore that for Trinity
     // DLL runtime
     #ifndef _DLL
-	    #define _DLL
+        #define _DLL
     #endif
 
     // Multithreaded runtime
     #ifndef _MT
-	    #define _MT 1
+        #define _MT 1
     #endif
     // Ensure that we aren't forced into the static lib
     #ifdef _STATIC_CPPLIB
-	    #undef _STATIC_CPPLIB
+        #undef _STATIC_CPPLIB
     #endif
 #endif
 
@@ -228,7 +228,7 @@
         // zlib and SDL were linked against the release MSVCRT; force
         // the debug version.
         #pragma comment(linker, "/NODEFAULTLIB:MSVCRT.LIB")
-#	endif
+#   endif
 
 #   ifndef WIN32_LEAN_AND_MEAN
 #       define WIN32_LEAN_AND_MEAN 1
@@ -252,11 +252,11 @@
 #       pragma warning (disable : 4018)
 #   endif
 
-/** 
+/**
   @def STR(expression)
 
   Creates a string from the expression.  Frequently used with G3D::Shader
-  to express shading programs inline.  
+  to express shading programs inline.
 
   STR(this becomes a string)
 evaluates the same as "this becomes a string"
  */
diff --git a/dep/include/g3dlite/G3D/stringutils.h b/dep/include/g3dlite/G3D/stringutils.h
index 9080d00b6a4..c24a2653a78 100644
--- a/dep/include/g3dlite/G3D/stringutils.h
+++ b/dep/include/g3dlite/G3D/stringutils.h
@@ -1,8 +1,8 @@
 /**
  @file stringutils.h
- 
+
  @maintainer Morgan McGuire, matrix@graphics3d.com
- 
+
  @author  2000-09-09
  @edited  2002-11-30
  */
diff --git a/dep/include/mersennetwister/MersenneTwister.h b/dep/include/mersennetwister/MersenneTwister.h
index 553d3899328..9c7d3f0250a 100644
--- a/dep/include/mersennetwister/MersenneTwister.h
+++ b/dep/include/mersennetwister/MersenneTwister.h
@@ -17,7 +17,7 @@
 
 // Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
 // Copyright (C) 2000 - 2003, Richard J. Wagner
-// All rights reserved.                          
+// All rights reserved.
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions
@@ -30,8 +30,8 @@
 //      notice, this list of conditions and the following disclaimer in the
 //      documentation and/or other materials provided with the distribution.
 //
-//   3. The names of its contributors may not be used to endorse or promote 
-//      products derived from this software without specific prior written 
+//   3. The names of its contributors may not be used to endorse or promote
+//      products derived from this software without specific prior written
 //      permission.
 //
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
@@ -70,304 +70,304 @@ class MTRand {
 // Data
 public:
     typedef ::uint32 uint32;
-	enum { N = 624 };       // length of state vector
-	enum { SAVE = N + 1 };  // length of array for save()
+    enum { N = 624 };       // length of state vector
+    enum { SAVE = N + 1 };  // length of array for save()
 
 protected:
-	enum { M = 397 };  // period parameter
-	
-	uint32 state[N];   // internal state
-	uint32 *pNext;     // next value to get from state
-	int left;          // number of values left before reload needed
+    enum { M = 397 };  // period parameter
+
+    uint32 state[N];   // internal state
+    uint32 *pNext;     // next value to get from state
+    int left;          // number of values left before reload needed
 
 
 //Methods
 public:
-	MTRand( const uint32& oneSeed );  // initialize with a simple uint32
-	MTRand( uint32 *const bigSeed, uint32 const seedLength = N );  // or an array
-	MTRand();                         // auto-initialize with /dev/urandom or time() and clock()
-	MTRand(const MTRand&);            // prevent copy constructor
-	MTRand& operator=(const MTRand&); // no-op operator=
-	
-	// Do NOT use for CRYPTOGRAPHY without securely hashing several returned
-	// values together, otherwise the generator state can be learned after
-	// reading 624 consecutive values.
-	
-	// Access to 32-bit random numbers
-	double rand();                          // real number in [0,1]
-	double rand( const double& n );         // real number in [0,n]
-	double randExc();                       // real number in [0,1)
-	double randExc( const double& n );      // real number in [0,n)
-	double randDblExc();                    // real number in (0,1)
-	double randDblExc( const double& n );   // real number in (0,n)
-	uint32 randInt();                       // integer in [0,2^32-1]
-	uint32 randInt( const uint32& n );      // integer in [0,n] for n < 2^32
-	double operator()() { return rand(); }  // same as rand()
-	
-	// Access to 53-bit random numbers (capacity of IEEE double precision)
-	double rand53();  // real number in [0,1)
-	
-	// Access to nonuniform random number distributions
-	double randNorm( const double& mean = 0.0, const double& variance = 0.0 );
-	
-	// Re-seeding functions with same behavior as initializers
-	void seed( const uint32 oneSeed );
-	void seed( uint32 *const bigSeed, const uint32 seedLength = N );
-	void seed();
-	
-	// Saving and loading generator state
-	void save( uint32* saveArray ) const;  // to array of size SAVE
-	void load( uint32 *const loadArray );  // from such array
+    MTRand( const uint32& oneSeed );  // initialize with a simple uint32
+    MTRand( uint32 *const bigSeed, uint32 const seedLength = N );  // or an array
+    MTRand();                         // auto-initialize with /dev/urandom or time() and clock()
+    MTRand(const MTRand&);            // prevent copy constructor
+    MTRand& operator=(const MTRand&); // no-op operator=
+
+    // Do NOT use for CRYPTOGRAPHY without securely hashing several returned
+    // values together, otherwise the generator state can be learned after
+    // reading 624 consecutive values.
+
+    // Access to 32-bit random numbers
+    double rand();                          // real number in [0,1]
+    double rand( const double& n );         // real number in [0,n]
+    double randExc();                       // real number in [0,1)
+    double randExc( const double& n );      // real number in [0,n)
+    double randDblExc();                    // real number in (0,1)
+    double randDblExc( const double& n );   // real number in (0,n)
+    uint32 randInt();                       // integer in [0,2^32-1]
+    uint32 randInt( const uint32& n );      // integer in [0,n] for n < 2^32
+    double operator()() { return rand(); }  // same as rand()
+
+    // Access to 53-bit random numbers (capacity of IEEE double precision)
+    double rand53();  // real number in [0,1)
+
+    // Access to nonuniform random number distributions
+    double randNorm( const double& mean = 0.0, const double& variance = 0.0 );
+
+    // Re-seeding functions with same behavior as initializers
+    void seed( const uint32 oneSeed );
+    void seed( uint32 *const bigSeed, const uint32 seedLength = N );
+    void seed();
+
+    // Saving and loading generator state
+    void save( uint32* saveArray ) const;  // to array of size SAVE
+    void load( uint32 *const loadArray );  // from such array
     /* Trinity not use streams for random values output
-	friend std::ostream& operator<<( std::ostream& os, const MTRand& mtrand );
-	friend std::istream& operator>>( std::istream& is, MTRand& mtrand );
+    friend std::ostream& operator<<( std::ostream& os, const MTRand& mtrand );
+    friend std::istream& operator>>( std::istream& is, MTRand& mtrand );
     */
 protected:
-	void initialize( const uint32 oneSeed );
-	void reload();
-	uint32 hiBit( const uint32& u ) const { return u & 0x80000000UL; }
-	uint32 loBit( const uint32& u ) const { return u & 0x00000001UL; }
-	uint32 loBits( const uint32& u ) const { return u & 0x7fffffffUL; }
-	uint32 mixBits( const uint32& u, const uint32& v ) const
-		{ return hiBit(u) | loBits(v); }
-	uint32 twist( const uint32& m, const uint32& s0, const uint32& s1 ) const
-		{ return m ^ (mixBits(s0,s1)>>1) ^ uint32(-(int32)(loBit(s1) & 0x9908b0dfUL)); }
-	static uint32 hash( time_t t, clock_t c );
+    void initialize( const uint32 oneSeed );
+    void reload();
+    uint32 hiBit( const uint32& u ) const { return u & 0x80000000UL; }
+    uint32 loBit( const uint32& u ) const { return u & 0x00000001UL; }
+    uint32 loBits( const uint32& u ) const { return u & 0x7fffffffUL; }
+    uint32 mixBits( const uint32& u, const uint32& v ) const
+        { return hiBit(u) | loBits(v); }
+    uint32 twist( const uint32& m, const uint32& s0, const uint32& s1 ) const
+        { return m ^ (mixBits(s0,s1)>>1) ^ uint32(-(int32)(loBit(s1) & 0x9908b0dfUL)); }
+    static uint32 hash( time_t t, clock_t c );
 };
 
 inline MTRand::MTRand(const MTRand&)
     { seed(); }
 
-inline MTRand& MTRand::operator=(const MTRand&) 
+inline MTRand& MTRand::operator=(const MTRand&)
     { return *this; }
 
 inline MTRand::MTRand( const uint32& oneSeed )
-	{ seed(oneSeed); }
+    { seed(oneSeed); }
 
 inline MTRand::MTRand( uint32 *const bigSeed, const uint32 seedLength )
-	{ seed(bigSeed,seedLength); }
+    { seed(bigSeed,seedLength); }
 
 inline MTRand::MTRand()
-	{ seed(); }
+    { seed(); }
 
 inline double MTRand::rand()
-	{ return double(randInt()) * (1.0/4294967295.0); }
+    { return double(randInt()) * (1.0/4294967295.0); }
 
 inline double MTRand::rand( const double& n )
-	{ return rand() * n; }
+    { return rand() * n; }
 
 inline double MTRand::randExc()
-	{ return double(randInt()) * (1.0/4294967296.0); }
+    { return double(randInt()) * (1.0/4294967296.0); }
 
 inline double MTRand::randExc( const double& n )
-	{ return randExc() * n; }
+    { return randExc() * n; }
 
 inline double MTRand::randDblExc()
-	{ return ( double(randInt()) + 0.5 ) * (1.0/4294967296.0); }
+    { return ( double(randInt()) + 0.5 ) * (1.0/4294967296.0); }
 
 inline double MTRand::randDblExc( const double& n )
-	{ return randDblExc() * n; }
+    { return randDblExc() * n; }
 
 inline double MTRand::rand53()
 {
-	uint32 a = randInt() >> 5, b = randInt() >> 6;
-	return ( a * 67108864.0 + b ) * (1.0/9007199254740992.0);  // by Isaku Wada
+    uint32 a = randInt() >> 5, b = randInt() >> 6;
+    return ( a * 67108864.0 + b ) * (1.0/9007199254740992.0);  // by Isaku Wada
 }
 
 inline double MTRand::randNorm( const double& mean, const double& variance )
 {
-	// Return a real number from a normal (Gaussian) distribution with given
-	// mean and variance by Box-Muller method
-	double r = sqrt( -2.0 * log( 1.0-randDblExc()) ) * variance;
-	double phi = 2.0 * 3.14159265358979323846264338328 * randExc();
-	return mean + r * cos(phi);
+    // Return a real number from a normal (Gaussian) distribution with given
+    // mean and variance by Box-Muller method
+    double r = sqrt( -2.0 * log( 1.0-randDblExc()) ) * variance;
+    double phi = 2.0 * 3.14159265358979323846264338328 * randExc();
+    return mean + r * cos(phi);
 }
 
 inline MTRand::uint32 MTRand::randInt()
 {
-	// Pull a 32-bit integer from the generator state
-	// Every other access function simply transforms the numbers extracted here
-	
-	if( left == 0 ) reload();
-	--left;
-		
-	register uint32 s1;
-	s1 = *pNext++;
-	s1 ^= (s1 >> 11);
-	s1 ^= (s1 <<  7) & 0x9d2c5680UL;
-	s1 ^= (s1 << 15) & 0xefc60000UL;
-	return ( s1 ^ (s1 >> 18) );
+    // Pull a 32-bit integer from the generator state
+    // Every other access function simply transforms the numbers extracted here
+
+    if( left == 0 ) reload();
+    --left;
+
+    register uint32 s1;
+    s1 = *pNext++;
+    s1 ^= (s1 >> 11);
+    s1 ^= (s1 <<  7) & 0x9d2c5680UL;
+    s1 ^= (s1 << 15) & 0xefc60000UL;
+    return ( s1 ^ (s1 >> 18) );
 }
 
 inline MTRand::uint32 MTRand::randInt( const uint32& n )
 {
-	// Find which bits are used in n
-	// Optimized by Magnus Jonsson (magnus@smartelectronix.com)
-	uint32 used = n;
-	used |= used >> 1;
-	used |= used >> 2;
-	used |= used >> 4;
-	used |= used >> 8;
-	used |= used >> 16;
-	
-	// Draw numbers until one is found in [0,n]
-	uint32 i;
-	do
-		i = randInt() & used;  // toss unused bits to shorten search
-	while( i > n );
-	return i;
+    // Find which bits are used in n
+    // Optimized by Magnus Jonsson (magnus@smartelectronix.com)
+    uint32 used = n;
+    used |= used >> 1;
+    used |= used >> 2;
+    used |= used >> 4;
+    used |= used >> 8;
+    used |= used >> 16;
+
+    // Draw numbers until one is found in [0,n]
+    uint32 i;
+    do
+        i = randInt() & used;  // toss unused bits to shorten search
+    while( i > n );
+    return i;
 }
 
 
 inline void MTRand::seed( const uint32 oneSeed )
 {
-	// Seed the generator with a simple uint32
-	initialize(oneSeed);
-	reload();
+    // Seed the generator with a simple uint32
+    initialize(oneSeed);
+    reload();
 }
 
 
 inline void MTRand::seed( uint32 *const bigSeed, const uint32 seedLength )
 {
-	// Seed the generator with an array of uint32's
-	// There are 2^19937-1 possible initial states.  This function allows
-	// all of those to be accessed by providing at least 19937 bits (with a
-	// default seed length of N = 624 uint32's).  Any bits above the lower 32
-	// in each element are discarded.
-	// Just call seed() if you want to get array from /dev/urandom
-	initialize(19650218UL);
-	register int i = 1;
-	register uint32 j = 0;
-	register int k = ( N > seedLength ? N : seedLength );
-	for( ; k; --k )
-	{
-		state[i] =
-			state[i] ^ ( (state[i-1] ^ (state[i-1] >> 30)) * 1664525UL );
-		state[i] += ( bigSeed[j] & 0xffffffffUL ) + j;
-		state[i] &= 0xffffffffUL;
-		++i;  ++j;
-		if( i >= N ) { state[0] = state[N-1];  i = 1; }
-		if( j >= seedLength ) j = 0;
-	}
-	for( k = N - 1; k; --k )
-	{
-		state[i] =
-			state[i] ^ ( (state[i-1] ^ (state[i-1] >> 30)) * 1566083941UL );
-		state[i] -= i;
-		state[i] &= 0xffffffffUL;
-		++i;
-		if( i >= N ) { state[0] = state[N-1];  i = 1; }
-	}
-	state[0] = 0x80000000UL;  // MSB is 1, assuring non-zero initial array
-	reload();
+    // Seed the generator with an array of uint32's
+    // There are 2^19937-1 possible initial states.  This function allows
+    // all of those to be accessed by providing at least 19937 bits (with a
+    // default seed length of N = 624 uint32's).  Any bits above the lower 32
+    // in each element are discarded.
+    // Just call seed() if you want to get array from /dev/urandom
+    initialize(19650218UL);
+    register int i = 1;
+    register uint32 j = 0;
+    register int k = ( N > seedLength ? N : seedLength );
+    for( ; k; --k )
+    {
+        state[i] =
+            state[i] ^ ( (state[i-1] ^ (state[i-1] >> 30)) * 1664525UL );
+        state[i] += ( bigSeed[j] & 0xffffffffUL ) + j;
+        state[i] &= 0xffffffffUL;
+        ++i;  ++j;
+        if( i >= N ) { state[0] = state[N-1];  i = 1; }
+        if( j >= seedLength ) j = 0;
+    }
+    for( k = N - 1; k; --k )
+    {
+        state[i] =
+            state[i] ^ ( (state[i-1] ^ (state[i-1] >> 30)) * 1566083941UL );
+        state[i] -= i;
+        state[i] &= 0xffffffffUL;
+        ++i;
+        if( i >= N ) { state[0] = state[N-1];  i = 1; }
+    }
+    state[0] = 0x80000000UL;  // MSB is 1, assuring non-zero initial array
+    reload();
 }
 
 
 inline void MTRand::seed()
 {
-	// Seed the generator with hash of time() and clock() values
-	seed( hash( time(NULL), clock() ) );
+    // Seed the generator with hash of time() and clock() values
+    seed( hash( time(NULL), clock() ) );
 }
 
 
 inline void MTRand::initialize( const uint32 seed )
 {
-	// Initialize generator state with seed
-	// See Knuth TAOCP Vol 2, 3rd Ed, p.106 for multiplier.
-	// In previous versions, most significant bits (MSBs) of the seed affect
-	// only MSBs of the state array.  Modified 9 Jan 2002 by Makoto Matsumoto.
-	register uint32 *s = state;
-	register uint32 *r = state;
-	register int i = 1;
-	*s++ = seed & 0xffffffffUL;
-	for( ; i < N; ++i )
-	{
-		*s++ = ( 1812433253UL * ( *r ^ (*r >> 30) ) + i ) & 0xffffffffUL;
-		r++;
-	}
+    // Initialize generator state with seed
+    // See Knuth TAOCP Vol 2, 3rd Ed, p.106 for multiplier.
+    // In previous versions, most significant bits (MSBs) of the seed affect
+    // only MSBs of the state array.  Modified 9 Jan 2002 by Makoto Matsumoto.
+    register uint32 *s = state;
+    register uint32 *r = state;
+    register int i = 1;
+    *s++ = seed & 0xffffffffUL;
+    for( ; i < N; ++i )
+    {
+        *s++ = ( 1812433253UL * ( *r ^ (*r >> 30) ) + i ) & 0xffffffffUL;
+        r++;
+    }
 }
 
 
 inline void MTRand::reload()
 {
-	// Generate N new values in state
-	// Made clearer and faster by Matthew Bellew (matthew.bellew@home.com)
-	register uint32 *p = state;
-	register int i;
-	for( i = N - M; i--; ++p )
-		*p = twist( p[M], p[0], p[1] );
-	for( i = M; --i; ++p )
-		*p = twist( p[M-N], p[0], p[1] );
-	*p = twist( p[M-N], p[0], state[0] );
+    // Generate N new values in state
+    // Made clearer and faster by Matthew Bellew (matthew.bellew@home.com)
+    register uint32 *p = state;
+    register int i;
+    for( i = N - M; i--; ++p )
+        *p = twist( p[M], p[0], p[1] );
+    for( i = M; --i; ++p )
+        *p = twist( p[M-N], p[0], p[1] );
+    *p = twist( p[M-N], p[0], state[0] );
 
-	left = N, pNext = state;
+    left = N, pNext = state;
 }
 
 
 inline MTRand::uint32 MTRand::hash( time_t t, clock_t c )
 {
-	// Get a uint32 from t and c
-	// Better than uint32(x) in case x is floating point in [0,1]
-	// Based on code by Lawrence Kirby (fred@genesis.demon.co.uk)
+    // Get a uint32 from t and c
+    // Better than uint32(x) in case x is floating point in [0,1]
+    // Based on code by Lawrence Kirby (fred@genesis.demon.co.uk)
 
-	static uint32 differ = 0;  // guarantee time-based seeds will change
+    static uint32 differ = 0;  // guarantee time-based seeds will change
 
-	uint32 h1 = 0;
-	unsigned char *p = (unsigned char *) &t;
-	for( size_t i = 0; i < sizeof(t); ++i )
-	{
-		h1 *= UCHAR_MAX + 2U;
-		h1 += p[i];
-	}
-	uint32 h2 = 0;
-	p = (unsigned char *) &c;
-	for( size_t j = 0; j < sizeof(c); ++j )
-	{
-		h2 *= UCHAR_MAX + 2U;
-		h2 += p[j];
-	}
-	return ( h1 + differ++ ) ^ h2;
+    uint32 h1 = 0;
+    unsigned char *p = (unsigned char *) &t;
+    for( size_t i = 0; i < sizeof(t); ++i )
+    {
+        h1 *= UCHAR_MAX + 2U;
+        h1 += p[i];
+    }
+    uint32 h2 = 0;
+    p = (unsigned char *) &c;
+    for( size_t j = 0; j < sizeof(c); ++j )
+    {
+        h2 *= UCHAR_MAX + 2U;
+        h2 += p[j];
+    }
+    return ( h1 + differ++ ) ^ h2;
 }
 
 
 inline void MTRand::save( uint32* saveArray ) const
 {
-	register uint32 *sa = saveArray;
-	register const uint32 *s = state;
-	register int i = N;
-	for( ; i--; *sa++ = *s++ ) {}
-	*sa = left;
+    register uint32 *sa = saveArray;
+    register const uint32 *s = state;
+    register int i = N;
+    for( ; i--; *sa++ = *s++ ) {}
+    *sa = left;
 }
 
 
 inline void MTRand::load( uint32 *const loadArray )
 {
-	register uint32 *s = state;
-	register uint32 *la = loadArray;
-	register int i = N;
-	for( ; i--; *s++ = *la++ ) {}
-	left = *la;
-	pNext = &state[N-left];
+    register uint32 *s = state;
+    register uint32 *la = loadArray;
+    register int i = N;
+    for( ; i--; *s++ = *la++ ) {}
+    left = *la;
+    pNext = &state[N-left];
 }
 
 /* Trinity not use streams for random values output
 inline std::ostream& operator<<( std::ostream& os, const MTRand& mtrand )
 {
-	register const MTRand::uint32 *s = mtrand.state;
-	register int i = mtrand.N;
-	for( ; i--; os << *s++ << "\t" ) {}
-	return os << mtrand.left;
+    register const MTRand::uint32 *s = mtrand.state;
+    register int i = mtrand.N;
+    for( ; i--; os << *s++ << "\t" ) {}
+    return os << mtrand.left;
 }
 
 
 inline std::istream& operator>>( std::istream& is, MTRand& mtrand )
 {
-	register MTRand::uint32 *s = mtrand.state;
-	register int i = mtrand.N;
-	for( ; i--; is >> *s++ ) {}
-	is >> mtrand.left;
-	mtrand.pNext = &mtrand.state[mtrand.N-mtrand.left];
-	return is;
+    register MTRand::uint32 *s = mtrand.state;
+    register int i = mtrand.N;
+    for( ; i--; is >> *s++ ) {}
+    is >> mtrand.left;
+    mtrand.pNext = &mtrand.state[mtrand.N-mtrand.left];
+    return is;
 }
 */
 
diff --git a/dep/include/mysql/config-netware.h b/dep/include/mysql/config-netware.h
index 9c99305789a..0f74ebe7933 100644
--- a/dep/include/mysql/config-netware.h
+++ b/dep/include/mysql/config-netware.h
@@ -105,7 +105,7 @@ extern "C" {
 #define FN_DEVCHAR ':'
 
 /* default directory information */
-#define	DEFAULT_MYSQL_HOME    "sys:/mysql"
+#define DEFAULT_MYSQL_HOME    "sys:/mysql"
 #define PACKAGE               "mysql"
 #define DEFAULT_BASEDIR       "sys:/"
 #define SHAREDIR              "share/"
diff --git a/dep/include/mysql/config-os2.h b/dep/include/mysql/config-os2.h
index 8e2d0e2e836..b2932c38b5a 100644
--- a/dep/include/mysql/config-os2.h
+++ b/dep/include/mysql/config-os2.h
@@ -39,56 +39,56 @@
 /* Default socket */
 #define MYSQL_UNIX_ADDR "\\socket\\MySQL"
 
-#define FN_LIBCHAR		 '\\'
-#define FN_ROOTDIR		 "\\"
-#define MY_NFILE		1024  /* This is only used to save filenames */
+#define FN_LIBCHAR       '\\'
+#define FN_ROOTDIR       "\\"
+#define MY_NFILE        1024  /* This is only used to save filenames */
 
 #define HAVE_ACCESS
 
-#define DEFAULT_MYSQL_HOME	"c:\\mysql"
-#define DEFAULT_BASEDIR		"C:\\"
-#define SHAREDIR		"share"
-#define DEFAULT_CHARSET_HOME	"C:/mysql/"
-#define _POSIX_PATH_MAX		255
-#define DWORD			ULONG
+#define DEFAULT_MYSQL_HOME  "c:\\mysql"
+#define DEFAULT_BASEDIR     "C:\\"
+#define SHAREDIR        "share"
+#define DEFAULT_CHARSET_HOME    "C:/mysql/"
+#define _POSIX_PATH_MAX     255
+#define DWORD           ULONG
 
-#define O_SHARE		0x1000		/* Open file in sharing mode */
-#define FILE_BINARY	O_BINARY	/* my_fopen in binary mode */
-#define S_IROTH		S_IREAD		/* for my_lib */
+#define O_SHARE     0x1000      /* Open file in sharing mode */
+#define FILE_BINARY O_BINARY    /* my_fopen in binary mode */
+#define S_IROTH     S_IREAD     /* for my_lib */
 
-#define CANT_DELETE_OPEN_FILES		/* saves open files in a list, for delayed delete */
+#define CANT_DELETE_OPEN_FILES      /* saves open files in a list, for delayed delete */
 
-#define O_NONBLOCK	0x10
+#define O_NONBLOCK  0x10
 
-#define NO_OPEN_3			/* For my_create() */
-#define SIGQUIT		SIGTERM		/* No SIGQUIT */
-#define SIGALRM		14		/* Alarm */
+#define NO_OPEN_3           /* For my_create() */
+#define SIGQUIT     SIGTERM     /* No SIGQUIT */
+#define SIGALRM     14      /* Alarm */
 
 #define NO_FCNTL_NONBLOCK
 
-#define EFBIG			   E2BIG
-/*#define ENFILE		  EMFILE    */
-/*#define ENAMETOOLONG		(EOS2ERR+2) */
-/*#define ETIMEDOUT		  145       */
-/*#define EPIPE			  146       */
-#define EROFS			147
+#define EFBIG              E2BIG
+/*#define ENFILE          EMFILE    */
+/*#define ENAMETOOLONG      (EOS2ERR+2) */
+/*#define ETIMEDOUT       145       */
+/*#define EPIPE           146       */
+#define EROFS           147
 
-#define sleep(A)	DosSleep((A)*1000)
-#define closesocket(A)	soclose(A)
+#define sleep(A)    DosSleep((A)*1000)
+#define closesocket(A)  soclose(A)
 
-#define F_OK		0
-#define W_OK		2
+#define F_OK        0
+#define W_OK        2
 
-#define bzero(x,y)	memset((x),'\0',(y))
-#define bcopy(x,y,z)	memcpy((y),(x),(z))
-#define bcmp(x,y,z)	memcmp((y),(x),(z))
+#define bzero(x,y)  memset((x),'\0',(y))
+#define bcopy(x,y,z)    memcpy((y),(x),(z))
+#define bcmp(x,y,z) memcmp((y),(x),(z))
 
-#define F_RDLCK		4	    /* Read lock.  */
-#define F_WRLCK		2	    /* Write lock.  */
-#define F_UNLCK		0	    /* Remove lock.  */
+#define F_RDLCK     4       /* Read lock.  */
+#define F_WRLCK     2       /* Write lock.  */
+#define F_UNLCK     0       /* Remove lock.  */
 
-#define S_IFMT		0x17000	    /* Mask for file type */
-#define F_TO_EOF	0L	    /* Param to lockf() to lock rest of file */
+#define S_IFMT      0x17000     /* Mask for file type */
+#define F_TO_EOF    0L      /* Param to lockf() to lock rest of file */
 
 #define HUGE_PTR
 
@@ -97,15 +97,15 @@ extern "C"
 #endif
 double _cdecl rint( double nr);
 
-DWORD	 TlsAlloc( void);
-BOOL	 TlsFree( DWORD);
-PVOID	 TlsGetValue( DWORD);
-BOOL	 TlsSetValue( DWORD, PVOID);
+DWORD    TlsAlloc( void);
+BOOL     TlsFree( DWORD);
+PVOID    TlsGetValue( DWORD);
+BOOL     TlsSetValue( DWORD, PVOID);
 
 /* support for > 2GB file size */
-#define SIZEOF_OFF_T	8
-#define lseek(A,B,C)	_lseek64( A, B, C)
-#define tell(A)		_lseek64( A, 0, SEEK_CUR)
+#define SIZEOF_OFF_T    8
+#define lseek(A,B,C)    _lseek64( A, B, C)
+#define tell(A)     _lseek64( A, 0, SEEK_CUR)
 
 void* dlopen( char* path, int flag);
 char* dlerror( void);
@@ -147,7 +147,7 @@ typedef unsigned long long os_off_t;
 /* Define if your struct stat has st_rdev.  */
 #define HAVE_ST_RDEV 1
 
-/* Define if you have  that is POSIX.1 compatible.	*/
+/* Define if you have  that is POSIX.1 compatible.  */
 /* #define HAVE_SYS_WAIT_H 1 */
 
 /* Define if you don't have tm_zone but do have the external array
@@ -166,7 +166,7 @@ typedef unsigned long long os_off_t;
 /* Define to `long' if  doesn't define.  */
 /* #undef off_t */
 
-/* Define as the return type of signal handlers (int or void).	*/
+/* Define as the return type of signal handlers (int or void).  */
 #define RETSIGTYPE void
 
 /* Define to `unsigned' if  doesn't define.  */
@@ -184,7 +184,7 @@ typedef unsigned long long os_off_t;
 /* Define if the `S_IS*' macros in  do not work properly.  */
 /* #undef STAT_MACROS_BROKEN */
 
-/* Define if you have the ANSI C header files.	*/
+/* Define if you have the ANSI C header files.  */
 #define STDC_HEADERS 1
 
 /* Define if you can safely include both  and .  */
@@ -194,7 +194,7 @@ typedef unsigned long long os_off_t;
 /* #undef TM_IN_SYS_TIME */
 
 /* Define if your processor stores words with the most significant
-   byte first (like Motorola and SPARC, unlike Intel and VAX).	*/
+   byte first (like Motorola and SPARC, unlike Intel and VAX).  */
 /* #undef WORDS_BIGENDIAN */
 
 /* Version of .frm files */
@@ -373,7 +373,7 @@ typedef unsigned long long os_off_t;
 /* The number of bytes in a long.  */
 #define SIZEOF_LONG 4
 
-/* The number of bytes in a long long.	*/
+/* The number of bytes in a long long.  */
 #define SIZEOF_LONG_LONG 8
 
 /* Define if you have the alarm function.  */
@@ -469,7 +469,7 @@ typedef unsigned long long os_off_t;
 /* Define if you have the index function.  */
 #define HAVE_INDEX 1
 
-/* Define if you have the initgroups function.	*/
+/* Define if you have the initgroups function.  */
 /* #undef HAVE_INITGROUPS */
 
 /* Define if you have the localtime_r function.  */
@@ -517,7 +517,7 @@ typedef unsigned long long os_off_t;
 /* Define if you have the pthread_attr_setprio function.  */
 #define HAVE_PTHREAD_ATTR_SETPRIO 1
 
-/* Define if you have the pthread_attr_setschedparam function.	*/
+/* Define if you have the pthread_attr_setschedparam function.  */
 /* #undef HAVE_PTHREAD_ATTR_SETSCHEDPARAM */
 
 /* Define if you have the pthread_attr_setstacksize function.  */
@@ -538,7 +538,7 @@ typedef unsigned long long os_off_t;
 /* Define if you have the pthread_setprio function.  */
 #define HAVE_PTHREAD_SETPRIO 1
 
-/* Define if you have the pthread_setprio_np function.	*/
+/* Define if you have the pthread_setprio_np function.  */
 /* #undef HAVE_PTHREAD_SETPRIO_NP */
 
 /* Define if you have the pthread_setschedparam function.  */
@@ -595,7 +595,7 @@ typedef unsigned long long os_off_t;
 /* Define if you have the stpcpy function.  */
 /* #undef HAVE_STPCPY */
 
-/* Define if you have the strcasecmp function.	*/
+/* Define if you have the strcasecmp function.  */
 /* #undef HAVE_STRCASECMP */
 
 /* Define if you have the strcoll function.  */
@@ -634,7 +634,7 @@ typedef unsigned long long os_off_t;
 /* Define if you have the tempnam function.  */
 #define HAVE_TEMPNAM 1
 
-/* Define if you have the thr_setconcurrency function.	*/
+/* Define if you have the thr_setconcurrency function.  */
 /* #undef HAVE_THR_SETCONCURRENCY */
 
 /* Define if you have the vidattr function.  */
@@ -667,7 +667,7 @@ typedef unsigned long long os_off_t;
 /* Define if you have the  header file.  */
 /* #undef HAVE_FLOATINGPOINT_H */
 
-/* Define if you have the  header file.	*/
+/* Define if you have the  header file.  */
 /* #define HAVE_GRP_H 1 */
 
 /* Define if you have the  header file.  */
@@ -691,7 +691,7 @@ typedef unsigned long long os_off_t;
 /* Define if you have the  header file.  */
 /* #undef HAVE_PATHS_H */
 
-/* Define if you have the  header file.	*/
+/* Define if you have the  header file.  */
 /* #define HAVE_PWD_H 1 */
 
 /* Define if you have the  header file.  */
@@ -760,7 +760,7 @@ typedef unsigned long long os_off_t;
 /* Define if you have the  header file.  */
 #define HAVE_SYS_UTIME_H 1
 
-/* Define if you have the  header file.	*/
+/* Define if you have the  header file.  */
 /* #undef HAVE_SYS_VADVISE_H */
 
 /* Define if you have the  header file.  */
@@ -793,7 +793,7 @@ typedef unsigned long long os_off_t;
 /* Define if you have the bind library (-lbind).  */
 /* #undef HAVE_LIBBIND */
 
-/* Define if you have the c_r library (-lc_r).	*/
+/* Define if you have the c_r library (-lc_r).  */
 /* #undef HAVE_LIBC_R */
 
 /* Define if you have the compat library (-lcompat).  */
@@ -805,19 +805,19 @@ typedef unsigned long long os_off_t;
 /* Define if you have the dl library (-ldl).  */
 #define HAVE_LIBDL 1
 
-/* Define if you have the gen library (-lgen).	*/
+/* Define if you have the gen library (-lgen).  */
 /* #undef HAVE_LIBGEN */
 
 /* Define if you have the m library (-lm).  */
 #define HAVE_LIBM 1
 
-/* Define if you have the nsl library (-lnsl).	*/
+/* Define if you have the nsl library (-lnsl).  */
 /* #undef HAVE_LIBNSL */
 
 /* Define if you have the nsl_r library (-lnsl_r).  */
 /* #undef HAVE_LIBNSL_R */
 
-/* Define if you have the pthread library (-lpthread).	*/
+/* Define if you have the pthread library (-lpthread).  */
 /* #undef HAVE_LIBPTHREAD */
 
 /* Define if you have the socket library (-lsocket).  */
diff --git a/dep/include/mysql/config-win.h b/dep/include/mysql/config-win.h
index 45bfeb5ba26..f23a92385fe 100644
--- a/dep/include/mysql/config-win.h
+++ b/dep/include/mysql/config-win.h
@@ -31,7 +31,7 @@ functions */
 
 #include 
 #include 
-#include 			/* Because of rint() */
+#include            /* Because of rint() */
 #include 
 #include 
 #include 
@@ -39,34 +39,34 @@ functions */
 #define BIG_TABLES 1
 #define HAVE_SMEM 1
 
-#if defined(_WIN64) || defined(WIN64) 
-#define SYSTEM_TYPE	"Win64" 
-#elif defined(_WIN32) || defined(WIN32) 
-#define SYSTEM_TYPE	"Win32" 
+#if defined(_WIN64) || defined(WIN64)
+#define SYSTEM_TYPE "Win64"
+#elif defined(_WIN32) || defined(WIN32)
+#define SYSTEM_TYPE "Win32"
 #else
-#define SYSTEM_TYPE	"Windows"
+#define SYSTEM_TYPE "Windows"
 #endif
 
-#if defined(_M_IA64) 
-#define MACHINE_TYPE	"ia64" 
-#elif defined(_M_IX86) 
-#define MACHINE_TYPE	"ia32" 
-#elif defined(_M_ALPHA) 
-#define MACHINE_TYPE	"axp" 
+#if defined(_M_IA64)
+#define MACHINE_TYPE    "ia64"
+#elif defined(_M_IX86)
+#define MACHINE_TYPE    "ia32"
+#elif defined(_M_ALPHA)
+#define MACHINE_TYPE    "axp"
 #else
-#define MACHINE_TYPE	"unknown"	/* Define to machine type name */
-#endif 
- 
-#if !(defined(_WIN64) || defined(WIN64)) 
+#define MACHINE_TYPE    "unknown"   /* Define to machine type name */
+#endif
+
+#if !(defined(_WIN64) || defined(WIN64))
 #ifndef _WIN32
-#define _WIN32				/* Compatible with old source */
+#define _WIN32              /* Compatible with old source */
 #endif
 #ifndef __WIN32__
 #define __WIN32__
 #endif
 #endif /* _WIN64 */
 #ifndef __WIN__
-#define __WIN__			      /* To make it easier in VC++ */
+#define __WIN__               /* To make it easier in VC++ */
 #endif
 
 #ifndef MAX_INDEXES
@@ -74,42 +74,42 @@ functions */
 #endif
 
 /* File and lock constants */
-#define O_SHARE		0x1000		/* Open file in sharing mode */
+#define O_SHARE     0x1000      /* Open file in sharing mode */
 #ifdef __BORLANDC__
-#define F_RDLCK		LK_NBLCK	/* read lock */
-#define F_WRLCK		LK_NBRLCK	/* write lock */
-#define F_UNLCK		LK_UNLCK	/* remove lock(s) */
+#define F_RDLCK     LK_NBLCK    /* read lock */
+#define F_WRLCK     LK_NBRLCK   /* write lock */
+#define F_UNLCK     LK_UNLCK    /* remove lock(s) */
 #else
-#define F_RDLCK		_LK_NBLCK	/* read lock */
-#define F_WRLCK		_LK_NBRLCK	/* write lock */
-#define F_UNLCK		_LK_UNLCK	/* remove lock(s) */
+#define F_RDLCK     _LK_NBLCK   /* read lock */
+#define F_WRLCK     _LK_NBRLCK  /* write lock */
+#define F_UNLCK     _LK_UNLCK   /* remove lock(s) */
 #endif
 
-#define F_EXCLUSIVE	1		/* We have only exclusive locking */
-#define F_TO_EOF	(INT_MAX32/2)	/* size for lock of all file */
-#define F_OK		0		/* parameter to access() */
-#define W_OK		2
+#define F_EXCLUSIVE 1       /* We have only exclusive locking */
+#define F_TO_EOF    (INT_MAX32/2)   /* size for lock of all file */
+#define F_OK        0       /* parameter to access() */
+#define W_OK        2
 
-#define S_IROTH		S_IREAD		/* for my_lib */
+#define S_IROTH     S_IREAD     /* for my_lib */
 
 #ifdef __BORLANDC__
-#define FILE_BINARY	O_BINARY	/* my_fopen in binary mode */
-#define O_TEMPORARY	0
-#define O_SHORT_LIVED	0
-#define SH_DENYNO	_SH_DENYNO
+#define FILE_BINARY O_BINARY    /* my_fopen in binary mode */
+#define O_TEMPORARY 0
+#define O_SHORT_LIVED   0
+#define SH_DENYNO   _SH_DENYNO
 #else
-#define O_BINARY	_O_BINARY	/* compability with MSDOS */
-#define FILE_BINARY	_O_BINARY	/* my_fopen in binary mode */
-#define O_TEMPORARY	_O_TEMPORARY
-#define O_SHORT_LIVED	_O_SHORT_LIVED
-#define SH_DENYNO	_SH_DENYNO
+#define O_BINARY    _O_BINARY   /* compability with MSDOS */
+#define FILE_BINARY _O_BINARY   /* my_fopen in binary mode */
+#define O_TEMPORARY _O_TEMPORARY
+#define O_SHORT_LIVED   _O_SHORT_LIVED
+#define SH_DENYNO   _SH_DENYNO
 #endif
-#define NO_OPEN_3			/* For my_create() */
+#define NO_OPEN_3           /* For my_create() */
 
-#define SIGQUIT		SIGTERM		/* No SIGQUIT */
+#define SIGQUIT     SIGTERM     /* No SIGQUIT */
 
-#undef _REENTRANT			/* Crashes something for win32 */
-#undef SAFE_MUTEX			/* Can't be used on windows */
+#undef _REENTRANT           /* Crashes something for win32 */
+#undef SAFE_MUTEX           /* Can't be used on windows */
 
 #if defined(_MSC_VER) && _MSC_VER >= 1310
 #define LL(A)           A##ll
@@ -119,20 +119,20 @@ functions */
 #define ULL(A)          ((unsigned __int64) A)
 #endif
 
-#define LONGLONG_MIN	LL(0x8000000000000000)
-#define LONGLONG_MAX	LL(0x7FFFFFFFFFFFFFFF)
-#define ULONGLONG_MAX	ULL(0xFFFFFFFFFFFFFFFF)
+#define LONGLONG_MIN    LL(0x8000000000000000)
+#define LONGLONG_MAX    LL(0x7FFFFFFFFFFFFFFF)
+#define ULONGLONG_MAX   ULL(0xFFFFFFFFFFFFFFFF)
 
 /* Type information */
 
 #if defined(__EMX__) || !defined(HAVE_UINT)
 #undef HAVE_UINT
 #define HAVE_UINT
-typedef unsigned short	ushort;
-typedef unsigned int	uint;
+typedef unsigned short  ushort;
+typedef unsigned int    uint;
 #endif /* defined(__EMX__) || !defined(HAVE_UINT) */
 
-typedef unsigned __int64 ulonglong;	/* Microsofts 64 bit types */
+typedef unsigned __int64 ulonglong; /* Microsofts 64 bit types */
 typedef __int64 longlong;
 #ifndef HAVE_SIGSET_T
 typedef int sigset_t;
@@ -167,7 +167,7 @@ typedef uint rf_SetTimer;
 #define bool_defined
 #define byte_defined
 #define HUGE_PTR
-#define STDCALL __stdcall	    /* Used by libmysql.dll */
+#define STDCALL __stdcall       /* Used by libmysql.dll */
 #define isnan(X) _isnan(X)
 #define finite(X) _finite(X)
 
@@ -175,18 +175,18 @@ typedef uint rf_SetTimer;
 #define THREAD
 #endif
 #define VOID_SIGHANDLER
-#define SIZEOF_CHAR		1
-#define SIZEOF_LONG		4
-#define SIZEOF_LONG_LONG	8
-#define SIZEOF_OFF_T		8
+#define SIZEOF_CHAR     1
+#define SIZEOF_LONG     4
+#define SIZEOF_LONG_LONG    8
+#define SIZEOF_OFF_T        8
 #ifdef _WIN64
-#define SIZEOF_CHARP		8
+#define SIZEOF_CHARP        8
 #else
-#define SIZEOF_CHARP		4
+#define SIZEOF_CHARP        4
 #endif
 #define HAVE_BROKEN_NETINET_INCLUDES
 #ifdef __NT__
-#define HAVE_NAMED_PIPE			/* We can only create pipes on NT */
+#define HAVE_NAMED_PIPE         /* We can only create pipes on NT */
 #endif
 
 /* ERROR is defined in wingdi.h */
@@ -258,48 +258,48 @@ inline double ulonglong2double(ulonglong value)
 /* Optimized store functions for Intel x86 */
 
 #ifndef _WIN64
-#define sint2korr(A)	(*((int16 *) (A)))
-#define sint3korr(A)	((int32) ((((uchar) (A)[2]) & 128) ? \
-				  (((uint32) 255L << 24) | \
-				   (((uint32) (uchar) (A)[2]) << 16) |\
-				   (((uint32) (uchar) (A)[1]) << 8) | \
-				   ((uint32) (uchar) (A)[0])) : \
-				  (((uint32) (uchar) (A)[2]) << 16) |\
-				  (((uint32) (uchar) (A)[1]) << 8) | \
-				  ((uint32) (uchar) (A)[0])))
-#define sint4korr(A)	(*((long *) (A)))
-#define uint2korr(A)	(*((uint16 *) (A)))
+#define sint2korr(A)    (*((int16 *) (A)))
+#define sint3korr(A)    ((int32) ((((uchar) (A)[2]) & 128) ? \
+                  (((uint32) 255L << 24) | \
+                   (((uint32) (uchar) (A)[2]) << 16) |\
+                   (((uint32) (uchar) (A)[1]) << 8) | \
+                   ((uint32) (uchar) (A)[0])) : \
+                  (((uint32) (uchar) (A)[2]) << 16) |\
+                  (((uint32) (uchar) (A)[1]) << 8) | \
+                  ((uint32) (uchar) (A)[0])))
+#define sint4korr(A)    (*((long *) (A)))
+#define uint2korr(A)    (*((uint16 *) (A)))
 /*
    ATTENTION !
-   
+
     Please, note, uint3korr reads 4 bytes (not 3) !
     It means, that you have to provide enough allocated space !
 */
-#define uint3korr(A)	(long) (*((unsigned int *) (A)) & 0xFFFFFF)
-#define uint4korr(A)	(*((unsigned long *) (A)))
-#define uint5korr(A)	((ulonglong)(((uint32) ((uchar) (A)[0])) +\
-				    (((uint32) ((uchar) (A)[1])) << 8) +\
-				    (((uint32) ((uchar) (A)[2])) << 16) +\
-				    (((uint32) ((uchar) (A)[3])) << 24)) +\
-				    (((ulonglong) ((uchar) (A)[4])) << 32))
-#define uint8korr(A)	(*((ulonglong *) (A)))
-#define sint8korr(A)	(*((longlong *) (A)))
-#define int2store(T,A)	*((uint16*) (T))= (uint16) (A)
-#define int3store(T,A)		{ *(T)=  (uchar) ((A));\
-				  *(T+1)=(uchar) (((uint) (A) >> 8));\
-				  *(T+2)=(uchar) (((A) >> 16)); }
-#define int4store(T,A)	*((long *) (T))= (long) (A)
-#define int5store(T,A)	{ *(T)= (uchar)((A));\
-			  *((T)+1)=(uchar) (((A) >> 8));\
-			  *((T)+2)=(uchar) (((A) >> 16));\
-			  *((T)+3)=(uchar) (((A) >> 24)); \
-			  *((T)+4)=(uchar) (((A) >> 32)); }
-#define int8store(T,A)	*((ulonglong *) (T))= (ulonglong) (A)
+#define uint3korr(A)    (long) (*((unsigned int *) (A)) & 0xFFFFFF)
+#define uint4korr(A)    (*((unsigned long *) (A)))
+#define uint5korr(A)    ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
+                    (((uint32) ((uchar) (A)[1])) << 8) +\
+                    (((uint32) ((uchar) (A)[2])) << 16) +\
+                    (((uint32) ((uchar) (A)[3])) << 24)) +\
+                    (((ulonglong) ((uchar) (A)[4])) << 32))
+#define uint8korr(A)    (*((ulonglong *) (A)))
+#define sint8korr(A)    (*((longlong *) (A)))
+#define int2store(T,A)  *((uint16*) (T))= (uint16) (A)
+#define int3store(T,A)      { *(T)=  (uchar) ((A));\
+                  *(T+1)=(uchar) (((uint) (A) >> 8));\
+                  *(T+2)=(uchar) (((A) >> 16)); }
+#define int4store(T,A)  *((long *) (T))= (long) (A)
+#define int5store(T,A)  { *(T)= (uchar)((A));\
+              *((T)+1)=(uchar) (((A) >> 8));\
+              *((T)+2)=(uchar) (((A) >> 16));\
+              *((T)+3)=(uchar) (((A) >> 24)); \
+              *((T)+4)=(uchar) (((A) >> 32)); }
+#define int8store(T,A)  *((ulonglong *) (T))= (ulonglong) (A)
 
-#define doubleget(V,M)	do { *((long *) &V) = *((long*) M); \
-			    *(((long *) &V)+1) = *(((long*) M)+1); } while(0)
+#define doubleget(V,M)  do { *((long *) &V) = *((long*) M); \
+                *(((long *) &V)+1) = *(((long*) M)+1); } while(0)
 #define doublestore(T,V) do { *((long *) T) = *((long*) &V); \
-			      *(((long *) T)+1) = *(((long*) &V)+1); } while(0)
+                  *(((long *) T)+1) = *(((long*) &V)+1); } while(0)
 #define float4get(V,M) { *((long *) &(V)) = *((long*) (M)); }
 #define floatstore(T,V) memcpy((byte*)(T), (byte*)(&V), sizeof(float))
 #define floatget(V,M)   memcpy((byte*)(&V), (byte*)(M), sizeof(float))
@@ -310,12 +310,12 @@ inline double ulonglong2double(ulonglong value)
 
 #define HAVE_PERROR
 #define HAVE_VFPRINT
-#define HAVE_RENAME		/* Have rename() as function */
-#define HAVE_BINARY_STREAMS	/* Have "b" flag in streams */
-#define HAVE_LONG_JMP		/* Have long jump function */
-#define HAVE_LOCKING		/* have locking() call */
-#define HAVE_ERRNO_AS_DEFINE	/* errno is a define */
-#define HAVE_STDLIB		/* everything is include in this file */
+#define HAVE_RENAME     /* Have rename() as function */
+#define HAVE_BINARY_STREAMS /* Have "b" flag in streams */
+#define HAVE_LONG_JMP       /* Have long jump function */
+#define HAVE_LOCKING        /* have locking() call */
+#define HAVE_ERRNO_AS_DEFINE    /* errno is a define */
+#define HAVE_STDLIB     /* everything is include in this file */
 #define HAVE_MEMCPY
 #define HAVE_MEMMOVE
 #define HAVE_GETCWD
@@ -324,12 +324,12 @@ inline double ulonglong2double(ulonglong value)
 #define HAVE_PUTENV
 #define HAVE_SELECT
 #define HAVE_SETLOCALE
-#define HAVE_SOCKET		/* Giangi */
+#define HAVE_SOCKET     /* Giangi */
 #define HAVE_FLOAT_H
 #define HAVE_LIMITS_H
 #define HAVE_STDDEF_H
-#define HAVE_RINT		/* defined in this file */
-#define NO_FCNTL_NONBLOCK	/* No FCNTL */
+#define HAVE_RINT       /* defined in this file */
+#define NO_FCNTL_NONBLOCK   /* No FCNTL */
 #define HAVE_ALLOCA
 #define HAVE_STRPBRK
 #define HAVE_STRSTR
@@ -349,12 +349,12 @@ inline double ulonglong2double(ulonglong value)
 #endif
 
 #ifdef NOT_USED
-#define HAVE_SNPRINTF		/* Gave link error */
+#define HAVE_SNPRINTF       /* Gave link error */
 #define _snprintf snprintf
 #endif
 
 #ifdef _MSC_VER
-#define HAVE_LDIV		/* The optimizer breaks in zortech for ldiv */
+#define HAVE_LDIV       /* The optimizer breaks in zortech for ldiv */
 #define HAVE_ANSI_INCLUDE
 #define HAVE_SYS_UTIME_H
 #define HAVE_STRTOUL
@@ -368,12 +368,12 @@ inline double ulonglong2double(ulonglong value)
 #ifdef _CUSTOMCONFIG_
 #include 
 #else
-#define DEFAULT_MYSQL_HOME	"c:\\mysql"
-#define DATADIR         	"c:\\mysql\\data"
-#define PACKAGE			"mysql"
-#define DEFAULT_BASEDIR		"C:\\"
-#define SHAREDIR		"share"
-#define DEFAULT_CHARSET_HOME	"C:/mysql/"
+#define DEFAULT_MYSQL_HOME  "c:\\mysql"
+#define DATADIR             "c:\\mysql\\data"
+#define PACKAGE         "mysql"
+#define DEFAULT_BASEDIR     "C:\\"
+#define SHAREDIR        "share"
+#define DEFAULT_CHARSET_HOME    "C:/mysql/"
 #endif
 #ifndef DEFAULT_HOME_ENV
 #define DEFAULT_HOME_ENV MYSQL_HOME
@@ -384,12 +384,12 @@ inline double ulonglong2double(ulonglong value)
 
 /* File name handling */
 
-#define FN_LIBCHAR	'\\'
-#define FN_ROOTDIR	"\\"
-#define FN_DEVCHAR	':'
-#define FN_NETWORK_DRIVES	/* Uses \\ to indicate network drives */
-#define FN_NO_CASE_SENCE	/* Files are not case-sensitive */
-#define OS_FILE_LIMIT	2048
+#define FN_LIBCHAR  '\\'
+#define FN_ROOTDIR  "\\"
+#define FN_DEVCHAR  ':'
+#define FN_NETWORK_DRIVES   /* Uses \\ to indicate network drives */
+#define FN_NO_CASE_SENCE    /* Files are not case-sensitive */
+#define OS_FILE_LIMIT   2048
 
 #define DO_NOT_REMOVE_THREAD_WRAPPERS
 #define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V))
@@ -401,10 +401,10 @@ inline double ulonglong2double(ulonglong value)
 #define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
 #else
 #define thread_safe_add(V,C,L) \
-	pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L));
+    pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L));
 #define thread_safe_sub(V,C,L) \
-	pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L));
-#define statistic_add(V,C,L)	 (V)+=(C)
+    pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L));
+#define statistic_add(V,C,L)     (V)+=(C)
 #endif
 #define statistic_increment(V,L) thread_safe_increment((V),(L))
 #define statistic_decrement(V,L) thread_safe_decrement((V),(L))
diff --git a/dep/include/mysql/errmsg.h b/dep/include/mysql/errmsg.h
index 8b20b36eed7..627ac7b00cc 100644
--- a/dep/include/mysql/errmsg.h
+++ b/dep/include/mysql/errmsg.h
@@ -16,66 +16,66 @@
 /* Error messages for MySQL clients */
 /* (Error messages for the daemon are in share/language/errmsg.sys) */
 
-#ifdef	__cplusplus
+#ifdef  __cplusplus
 extern "C" {
 #endif
-void	init_client_errs(void);
-void	finish_client_errs(void);
-extern const char *client_errors[];	/* Error messages */
-#ifdef	__cplusplus
+void    init_client_errs(void);
+void    finish_client_errs(void);
+extern const char *client_errors[]; /* Error messages */
+#ifdef  __cplusplus
 }
 #endif
 
-#define CR_MIN_ERROR		2000	/* For easier client code */
-#define CR_MAX_ERROR		2999
+#define CR_MIN_ERROR        2000    /* For easier client code */
+#define CR_MAX_ERROR        2999
 #if defined(OS2) && defined(MYSQL_SERVER)
 #define CER(X) client_errors[(X)-CR_MIN_ERROR]
 #elif !defined(ER)
 #define ER(X) client_errors[(X)-CR_MIN_ERROR]
 #endif
-#define CLIENT_ERRMAP		2	/* Errormap used by my_error() */
+#define CLIENT_ERRMAP       2   /* Errormap used by my_error() */
 
 /* Do not add error numbers before CR_ERROR_FIRST. */
 /* If necessary to add lower numbers, change CR_ERROR_FIRST accordingly. */
-#define CR_ERROR_FIRST  	2000 /*Copy first error nr.*/
-#define CR_UNKNOWN_ERROR	2000
-#define CR_SOCKET_CREATE_ERROR	2001
-#define CR_CONNECTION_ERROR	2002
-#define CR_CONN_HOST_ERROR	2003
-#define CR_IPSOCK_ERROR		2004
-#define CR_UNKNOWN_HOST		2005
-#define CR_SERVER_GONE_ERROR	2006
-#define CR_VERSION_ERROR	2007
-#define CR_OUT_OF_MEMORY	2008
-#define CR_WRONG_HOST_INFO	2009
+#define CR_ERROR_FIRST      2000 /*Copy first error nr.*/
+#define CR_UNKNOWN_ERROR    2000
+#define CR_SOCKET_CREATE_ERROR  2001
+#define CR_CONNECTION_ERROR 2002
+#define CR_CONN_HOST_ERROR  2003
+#define CR_IPSOCK_ERROR     2004
+#define CR_UNKNOWN_HOST     2005
+#define CR_SERVER_GONE_ERROR    2006
+#define CR_VERSION_ERROR    2007
+#define CR_OUT_OF_MEMORY    2008
+#define CR_WRONG_HOST_INFO  2009
 #define CR_LOCALHOST_CONNECTION 2010
-#define CR_TCP_CONNECTION	2011
+#define CR_TCP_CONNECTION   2011
 #define CR_SERVER_HANDSHAKE_ERR 2012
-#define CR_SERVER_LOST		2013
+#define CR_SERVER_LOST      2013
 #define CR_COMMANDS_OUT_OF_SYNC 2014
 #define CR_NAMEDPIPE_CONNECTION 2015
 #define CR_NAMEDPIPEWAIT_ERROR  2016
 #define CR_NAMEDPIPEOPEN_ERROR  2017
 #define CR_NAMEDPIPESETSTATE_ERROR 2018
-#define CR_CANT_READ_CHARSET	2019
+#define CR_CANT_READ_CHARSET    2019
 #define CR_NET_PACKET_TOO_LARGE 2020
-#define CR_EMBEDDED_CONNECTION	2021
+#define CR_EMBEDDED_CONNECTION  2021
 #define CR_PROBE_SLAVE_STATUS   2022
 #define CR_PROBE_SLAVE_HOSTS    2023
 #define CR_PROBE_SLAVE_CONNECT  2024
 #define CR_PROBE_MASTER_CONNECT 2025
 #define CR_SSL_CONNECTION_ERROR 2026
 #define CR_MALFORMED_PACKET     2027
-#define CR_WRONG_LICENSE	2028
+#define CR_WRONG_LICENSE    2028
 
 /* new 4.1 error codes */
-#define CR_NULL_POINTER		2029
-#define CR_NO_PREPARE_STMT	2030
-#define CR_PARAMS_NOT_BOUND	2031
-#define CR_DATA_TRUNCATED	2032
+#define CR_NULL_POINTER     2029
+#define CR_NO_PREPARE_STMT  2030
+#define CR_PARAMS_NOT_BOUND 2031
+#define CR_DATA_TRUNCATED   2032
 #define CR_NO_PARAMETERS_EXISTS 2033
 #define CR_INVALID_PARAMETER_NO 2034
-#define CR_INVALID_BUFFER_USE	2035
+#define CR_INVALID_BUFFER_USE   2035
 #define CR_UNSUPPORTED_PARAM_TYPE 2036
 
 #define CR_SHARED_MEMORY_CONNECTION             2037
@@ -85,18 +85,18 @@ extern const char *client_errors[];	/* Error messages */
 #define CR_SHARED_MEMORY_CONNECT_MAP_ERROR      2041
 #define CR_SHARED_MEMORY_FILE_MAP_ERROR         2042
 #define CR_SHARED_MEMORY_MAP_ERROR              2043
-#define CR_SHARED_MEMORY_EVENT_ERROR     	2044
+#define CR_SHARED_MEMORY_EVENT_ERROR        2044
 #define CR_SHARED_MEMORY_CONNECT_ABANDONED_ERROR 2045
 #define CR_SHARED_MEMORY_CONNECT_SET_ERROR      2046
-#define CR_CONN_UNKNOW_PROTOCOL 		2047
-#define CR_INVALID_CONN_HANDLE			2048
+#define CR_CONN_UNKNOW_PROTOCOL         2047
+#define CR_INVALID_CONN_HANDLE          2048
 #define CR_SECURE_AUTH                          2049
 #define CR_FETCH_CANCELED                       2050
 #define CR_NO_DATA                              2051
 #define CR_NO_STMT_METADATA                     2052
 #define CR_NO_RESULT_SET                        2053
 #define CR_NOT_IMPLEMENTED                      2054
-#define CR_SERVER_LOST_EXTENDED			2055
+#define CR_SERVER_LOST_EXTENDED         2055
 #define CR_ERROR_LAST  /*Copy last error nr:*/  2055
 /* Add error numbers before CR_ERROR_LAST and change it accordingly. */
 
diff --git a/dep/include/mysql/mysql.h b/dep/include/mysql/mysql.h
index 18b82b8a943..1f106429f0d 100644
--- a/dep/include/mysql/mysql.h
+++ b/dep/include/mysql/mysql.h
@@ -39,14 +39,14 @@
 #undef __WIN__
 #endif
 
-#ifdef	__cplusplus
+#ifdef  __cplusplus
 extern "C" {
 #endif
 
-#ifndef _global_h				/* If not standard header */
+#ifndef _global_h               /* If not standard header */
 #include 
 #ifdef __LCC__
-#include 				/* For windows */
+#include                 /* For windows */
 #endif
 typedef char my_bool;
 #if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__)
@@ -78,24 +78,24 @@ typedef int my_socket;
 extern unsigned int mysql_port;
 extern char *mysql_unix_port;
 
-#define CLIENT_NET_READ_TIMEOUT		365*24*3600	/* Timeout on read */
-#define CLIENT_NET_WRITE_TIMEOUT	365*24*3600	/* Timeout on write */
+#define CLIENT_NET_READ_TIMEOUT     365*24*3600 /* Timeout on read */
+#define CLIENT_NET_WRITE_TIMEOUT    365*24*3600 /* Timeout on write */
 
 #ifdef __NETWARE__
 // GCC have alternative #pragma pack(8) syntax and old gcc version not support pack(push,8), also any gcc version not support it at some paltform
 #if defined( __GNUC__ )
-#pragma pack(8) 
-#else 
-#pragma pack(push,8) 
-#endif 
+#pragma pack(8)
+#else
+#pragma pack(push,8)
+#endif
 
 #endif
 
-#define IS_PRI_KEY(n)	((n) & PRI_KEY_FLAG)
-#define IS_NOT_NULL(n)	((n) & NOT_NULL_FLAG)
-#define IS_BLOB(n)	((n) & BLOB_FLAG)
-#define IS_NUM(t)	((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR || (t) == FIELD_TYPE_NEWDECIMAL)
-#define IS_NUM_FIELD(f)	 ((f)->flags & NUM_FLAG)
+#define IS_PRI_KEY(n)   ((n) & PRI_KEY_FLAG)
+#define IS_NOT_NULL(n)  ((n) & NOT_NULL_FLAG)
+#define IS_BLOB(n)  ((n) & BLOB_FLAG)
+#define IS_NUM(t)   ((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR || (t) == FIELD_TYPE_NEWDECIMAL)
+#define IS_NUM_FIELD(f)  ((f)->flags & NUM_FLAG)
 #define INTERNAL_NUM_FIELD(f) (((f)->type <= FIELD_TYPE_INT24 && ((f)->type != FIELD_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == FIELD_TYPE_YEAR)
 #define IS_LONGDATA(t) ((t) >= MYSQL_TYPE_TINY_BLOB && (t) <= MYSQL_TYPE_STRING)
 
@@ -106,7 +106,7 @@ typedef struct st_mysql_field {
   char *table;                /* Table of column if column was a field */
   char *org_table;            /* Org table name, if table was an alias */
   char *db;                   /* Database for table */
-  char *catalog;	      /* Catalog for table */
+  char *catalog;          /* Catalog for table */
   char *def;                  /* Default value (set by mysql_list_fields) */
   unsigned long length;       /* Width of column (create length) */
   unsigned long max_length;   /* Max width for selected set */
@@ -123,7 +123,7 @@ typedef struct st_mysql_field {
   enum enum_field_types type; /* Type of field. See mysql_com.h for types */
 } MYSQL_FIELD;
 
-typedef char **MYSQL_ROW;		/* return data as array of strings */
+typedef char **MYSQL_ROW;       /* return data as array of strings */
 typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */
 
 #ifndef _global_h
@@ -142,12 +142,12 @@ typedef unsigned long long my_ulonglong;
 #define ER_WARN_DATA_TRUNCATED WARN_DATA_TRUNCATED
 
 typedef struct st_mysql_rows {
-  struct st_mysql_rows *next;		/* list of rows */
+  struct st_mysql_rows *next;       /* list of rows */
   MYSQL_ROW data;
   unsigned long length;
 } MYSQL_ROWS;
 
-typedef MYSQL_ROWS *MYSQL_ROW_OFFSET;	/* offset to current row */
+typedef MYSQL_ROWS *MYSQL_ROW_OFFSET;   /* offset to current row */
 
 #include "my_alloc.h"
 
@@ -161,7 +161,7 @@ typedef struct st_mysql_data {
   struct embedded_query_result *embedded_info;
 } MYSQL_DATA;
 
-enum mysql_option 
+enum mysql_option
 {
   MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE,
   MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP,
@@ -181,14 +181,14 @@ struct st_mysql_options {
   char *host,*user,*password,*unix_socket,*db;
   struct st_dynamic_array *init_commands;
   char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name;
-  char *ssl_key;				/* PEM key file */
-  char *ssl_cert;				/* PEM cert file */
-  char *ssl_ca;					/* PEM CA file */
-  char *ssl_capath;				/* PEM directory of CA-s? */
-  char *ssl_cipher;				/* cipher to use */
+  char *ssl_key;                /* PEM key file */
+  char *ssl_cert;               /* PEM cert file */
+  char *ssl_ca;                 /* PEM CA file */
+  char *ssl_capath;             /* PEM directory of CA-s? */
+  char *ssl_cipher;             /* cipher to use */
   char *shared_memory_base_name;
   unsigned long max_allowed_packet;
-  my_bool use_ssl;				/* if to use SSL or not */
+  my_bool use_ssl;              /* if to use SSL or not */
   my_bool compress,named_pipe;
  /*
    On connect, find out the replication role of the server, and
@@ -223,12 +223,12 @@ struct st_mysql_options {
   void *local_infile_userdata;
 };
 
-enum mysql_status 
+enum mysql_status
 {
   MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT,MYSQL_STATUS_USE_RESULT
 };
 
-enum mysql_protocol_type 
+enum mysql_protocol_type
 {
   MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
   MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
@@ -238,7 +238,7 @@ enum mysql_protocol_type
   the master, the ones that go to a slave, and the adminstrative
   type which must happen on the pivot connectioin
 */
-enum mysql_rpl_type 
+enum mysql_rpl_type
 {
   MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN
 };
@@ -260,32 +260,32 @@ struct st_mysql_stmt;
 
 typedef struct st_mysql
 {
-  NET		net;			/* Communication parameters */
-  gptr		connector_fd;		/* ConnectorFd for SSL */
-  char		*host,*user,*passwd,*unix_socket,*server_version,*host_info,*info;
+  NET       net;            /* Communication parameters */
+  gptr      connector_fd;       /* ConnectorFd for SSL */
+  char      *host,*user,*passwd,*unix_socket,*server_version,*host_info,*info;
   char          *db;
   struct charset_info_st *charset;
-  MYSQL_FIELD	*fields;
-  MEM_ROOT	field_alloc;
+  MYSQL_FIELD   *fields;
+  MEM_ROOT  field_alloc;
   my_ulonglong affected_rows;
-  my_ulonglong insert_id;		/* id if insert on table with NEXTNR */
-  my_ulonglong extra_info;		/* Not used */
-  unsigned long thread_id;		/* Id for connection in server */
+  my_ulonglong insert_id;       /* id if insert on table with NEXTNR */
+  my_ulonglong extra_info;      /* Not used */
+  unsigned long thread_id;      /* Id for connection in server */
   unsigned long packet_length;
-  unsigned int	port;
+  unsigned int  port;
   unsigned long client_flag,server_capabilities;
-  unsigned int	protocol_version;
-  unsigned int	field_count;
-  unsigned int 	server_status;
+  unsigned int  protocol_version;
+  unsigned int  field_count;
+  unsigned int  server_status;
   unsigned int  server_language;
-  unsigned int	warning_count;
+  unsigned int  warning_count;
   struct st_mysql_options options;
   enum mysql_status status;
-  my_bool	free_me;		/* If free in mysql_close */
-  my_bool	reconnect;		/* set to 1 if automatic reconnect */
+  my_bool   free_me;        /* If free in mysql_close */
+  my_bool   reconnect;      /* set to 1 if automatic reconnect */
 
   /* session-wide random string */
-  char	        scramble[SCRAMBLE_LENGTH+1];
+  char          scramble[SCRAMBLE_LENGTH+1];
 
  /*
    Set if this is the original connection, not a master or a slave we have
@@ -306,7 +306,7 @@ typedef struct st_mysql
   const struct st_mysql_methods *methods;
   void *thd;
   /*
-    Points to boolean flag in MYSQL_RES  or MYSQL_STMT. We set this flag 
+    Points to boolean flag in MYSQL_RES  or MYSQL_STMT. We set this flag
     from mysql_stmt_close if close had to cancel result set of this object.
   */
   my_bool *unbuffered_fetch_owner;
@@ -318,22 +318,22 @@ typedef struct st_mysql
 
 typedef struct st_mysql_res {
   my_ulonglong row_count;
-  MYSQL_FIELD	*fields;
-  MYSQL_DATA	*data;
-  MYSQL_ROWS	*data_cursor;
-  unsigned long *lengths;		/* column lengths of current row */
-  MYSQL		*handle;		/* for unbuffered reads */
-  MEM_ROOT	field_alloc;
-  unsigned int	field_count, current_field;
-  MYSQL_ROW	row;			/* If unbuffered read */
-  MYSQL_ROW	current_row;		/* buffer to current row */
-  my_bool	eof;			/* Used by mysql_fetch_row */
+  MYSQL_FIELD   *fields;
+  MYSQL_DATA    *data;
+  MYSQL_ROWS    *data_cursor;
+  unsigned long *lengths;       /* column lengths of current row */
+  MYSQL     *handle;        /* for unbuffered reads */
+  MEM_ROOT  field_alloc;
+  unsigned int  field_count, current_field;
+  MYSQL_ROW row;            /* If unbuffered read */
+  MYSQL_ROW current_row;        /* buffer to current row */
+  my_bool   eof;            /* Used by mysql_fetch_row */
   /* mysql_stmt_close() had to cancel this result */
-  my_bool       unbuffered_fetch_cancelled;  
+  my_bool       unbuffered_fetch_cancelled;
   const struct st_mysql_methods *methods;
 } MYSQL_RES;
 
-#define MAX_MYSQL_MANAGER_ERR 256  
+#define MAX_MYSQL_MANAGER_ERR 256
 #define MAX_MYSQL_MANAGER_MSG 256
 
 #define MANAGER_OK           200
@@ -411,7 +411,7 @@ my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res);
 unsigned int STDCALL mysql_num_fields(MYSQL_RES *res);
 my_bool STDCALL mysql_eof(MYSQL_RES *res);
 MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res,
-					      unsigned int fieldnr);
+                          unsigned int fieldnr);
 MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res);
 MYSQL_ROW_OFFSET STDCALL mysql_row_tell(MYSQL_RES *res);
 MYSQL_FIELD_OFFSET STDCALL mysql_field_tell(MYSQL_RES *res);
@@ -428,39 +428,39 @@ unsigned long STDCALL mysql_thread_id(MYSQL *mysql);
 const char * STDCALL mysql_character_set_name(MYSQL *mysql);
 int          STDCALL mysql_set_character_set(MYSQL *mysql, const char *csname);
 
-MYSQL *		STDCALL mysql_init(MYSQL *mysql);
-my_bool		STDCALL mysql_ssl_set(MYSQL *mysql, const char *key,
-				      const char *cert, const char *ca,
-				      const char *capath, const char *cipher);
+MYSQL *     STDCALL mysql_init(MYSQL *mysql);
+my_bool     STDCALL mysql_ssl_set(MYSQL *mysql, const char *key,
+                      const char *cert, const char *ca,
+                      const char *capath, const char *cipher);
 const char *    STDCALL mysql_get_ssl_cipher(MYSQL *mysql);
-my_bool		STDCALL mysql_change_user(MYSQL *mysql, const char *user, 
-					  const char *passwd, const char *db);
-MYSQL *		STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
-					   const char *user,
-					   const char *passwd,
-					   const char *db,
-					   unsigned int port,
-					   const char *unix_socket,
-					   unsigned long clientflag);
-int		STDCALL mysql_select_db(MYSQL *mysql, const char *db);
-int		STDCALL mysql_query(MYSQL *mysql, const char *q);
-int		STDCALL mysql_send_query(MYSQL *mysql, const char *q,
-					 unsigned long length);
-int		STDCALL mysql_real_query(MYSQL *mysql, const char *q,
-					unsigned long length);
+my_bool     STDCALL mysql_change_user(MYSQL *mysql, const char *user,
+                      const char *passwd, const char *db);
+MYSQL *     STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
+                       const char *user,
+                       const char *passwd,
+                       const char *db,
+                       unsigned int port,
+                       const char *unix_socket,
+                       unsigned long clientflag);
+int     STDCALL mysql_select_db(MYSQL *mysql, const char *db);
+int     STDCALL mysql_query(MYSQL *mysql, const char *q);
+int     STDCALL mysql_send_query(MYSQL *mysql, const char *q,
+                     unsigned long length);
+int     STDCALL mysql_real_query(MYSQL *mysql, const char *q,
+                    unsigned long length);
 MYSQL_RES *     STDCALL mysql_store_result(MYSQL *mysql);
 MYSQL_RES *     STDCALL mysql_use_result(MYSQL *mysql);
 
 /* perform query on master */
-my_bool		STDCALL mysql_master_query(MYSQL *mysql, const char *q,
-					   unsigned long length);
-my_bool		STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
-						unsigned long length);
-/* perform query on slave */  
-my_bool		STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
-					  unsigned long length);
-my_bool		STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
-					       unsigned long length);
+my_bool     STDCALL mysql_master_query(MYSQL *mysql, const char *q,
+                       unsigned long length);
+my_bool     STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
+                        unsigned long length);
+/* perform query on slave */
+my_bool     STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
+                      unsigned long length);
+my_bool     STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
+                           unsigned long length);
 void        STDCALL mysql_get_character_set_info(MYSQL *mysql,
                            MY_CHARSET_INFO *charset);
 
@@ -473,10 +473,10 @@ mysql_set_local_infile_handler(MYSQL *mysql,
                                int (*local_infile_init)(void **, const char *,
                             void *),
                                int (*local_infile_read)(void *, char *,
-							unsigned int),
+                            unsigned int),
                                void (*local_infile_end)(void *),
                                int (*local_infile_error)(void *, char*,
-							 unsigned int),
+                             unsigned int),
                                void *);
 
 void
@@ -489,93 +489,93 @@ mysql_set_local_infile_default(MYSQL *mysql);
 */
 void            STDCALL mysql_enable_rpl_parse(MYSQL* mysql);
 void            STDCALL mysql_disable_rpl_parse(MYSQL* mysql);
-/* get the value of the parse flag */  
+/* get the value of the parse flag */
 int             STDCALL mysql_rpl_parse_enabled(MYSQL* mysql);
 
 /*  enable/disable reads from master */
 void            STDCALL mysql_enable_reads_from_master(MYSQL* mysql);
 void            STDCALL mysql_disable_reads_from_master(MYSQL* mysql);
-/* get the value of the master read flag */  
-my_bool		STDCALL mysql_reads_from_master_enabled(MYSQL* mysql);
+/* get the value of the master read flag */
+my_bool     STDCALL mysql_reads_from_master_enabled(MYSQL* mysql);
 
-enum mysql_rpl_type     STDCALL mysql_rpl_query_type(const char* q, int len);  
+enum mysql_rpl_type     STDCALL mysql_rpl_query_type(const char* q, int len);
 
-/* discover the master and its slaves */  
-my_bool		STDCALL mysql_rpl_probe(MYSQL* mysql);
+/* discover the master and its slaves */
+my_bool     STDCALL mysql_rpl_probe(MYSQL* mysql);
 
 /* set the master, close/free the old one, if it is not a pivot */
 int             STDCALL mysql_set_master(MYSQL* mysql, const char* host,
-					 unsigned int port,
-					 const char* user,
-					 const char* passwd);
+                     unsigned int port,
+                     const char* user,
+                     const char* passwd);
 int             STDCALL mysql_add_slave(MYSQL* mysql, const char* host,
-					unsigned int port,
-					const char* user,
-					const char* passwd);
+                    unsigned int port,
+                    const char* user,
+                    const char* passwd);
 
-int		STDCALL mysql_shutdown(MYSQL *mysql,
+int     STDCALL mysql_shutdown(MYSQL *mysql,
                                        enum mysql_enum_shutdown_level
                                        shutdown_level);
-int		STDCALL mysql_dump_debug_info(MYSQL *mysql);
-int		STDCALL mysql_refresh(MYSQL *mysql,
-				     unsigned int refresh_options);
-int		STDCALL mysql_kill(MYSQL *mysql,unsigned long pid);
-int		STDCALL mysql_set_server_option(MYSQL *mysql,
-						enum enum_mysql_set_option
-						option);
-int		STDCALL mysql_ping(MYSQL *mysql);
-const char *	STDCALL mysql_stat(MYSQL *mysql);
-const char *	STDCALL mysql_get_server_info(MYSQL *mysql);
-const char *	STDCALL mysql_get_client_info(void);
-unsigned long	STDCALL mysql_get_client_version(void);
-const char *	STDCALL mysql_get_host_info(MYSQL *mysql);
-unsigned long	STDCALL mysql_get_server_version(MYSQL *mysql);
-unsigned int	STDCALL mysql_get_proto_info(MYSQL *mysql);
-MYSQL_RES *	STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild);
-MYSQL_RES *	STDCALL mysql_list_tables(MYSQL *mysql,const char *wild);
-MYSQL_RES *	STDCALL mysql_list_processes(MYSQL *mysql);
-int		STDCALL mysql_options(MYSQL *mysql,enum mysql_option option,
-				      const char *arg);
-void		STDCALL mysql_free_result(MYSQL_RES *result);
-void		STDCALL mysql_data_seek(MYSQL_RES *result,
-					my_ulonglong offset);
+int     STDCALL mysql_dump_debug_info(MYSQL *mysql);
+int     STDCALL mysql_refresh(MYSQL *mysql,
+                     unsigned int refresh_options);
+int     STDCALL mysql_kill(MYSQL *mysql,unsigned long pid);
+int     STDCALL mysql_set_server_option(MYSQL *mysql,
+                        enum enum_mysql_set_option
+                        option);
+int     STDCALL mysql_ping(MYSQL *mysql);
+const char *    STDCALL mysql_stat(MYSQL *mysql);
+const char *    STDCALL mysql_get_server_info(MYSQL *mysql);
+const char *    STDCALL mysql_get_client_info(void);
+unsigned long   STDCALL mysql_get_client_version(void);
+const char *    STDCALL mysql_get_host_info(MYSQL *mysql);
+unsigned long   STDCALL mysql_get_server_version(MYSQL *mysql);
+unsigned int    STDCALL mysql_get_proto_info(MYSQL *mysql);
+MYSQL_RES * STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild);
+MYSQL_RES * STDCALL mysql_list_tables(MYSQL *mysql,const char *wild);
+MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql);
+int     STDCALL mysql_options(MYSQL *mysql,enum mysql_option option,
+                      const char *arg);
+void        STDCALL mysql_free_result(MYSQL_RES *result);
+void        STDCALL mysql_data_seek(MYSQL_RES *result,
+                    my_ulonglong offset);
 MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result,
-						MYSQL_ROW_OFFSET offset);
+                        MYSQL_ROW_OFFSET offset);
 MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result,
-					   MYSQL_FIELD_OFFSET offset);
-MYSQL_ROW	STDCALL mysql_fetch_row(MYSQL_RES *result);
+                       MYSQL_FIELD_OFFSET offset);
+MYSQL_ROW   STDCALL mysql_fetch_row(MYSQL_RES *result);
 unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result);
-MYSQL_FIELD *	STDCALL mysql_fetch_field(MYSQL_RES *result);
+MYSQL_FIELD *   STDCALL mysql_fetch_field(MYSQL_RES *result);
 MYSQL_RES *     STDCALL mysql_list_fields(MYSQL *mysql, const char *table,
-					  const char *wild);
-unsigned long	STDCALL mysql_escape_string(char *to,const char *from,
-					    unsigned long from_length);
-unsigned long	STDCALL mysql_hex_string(char *to,const char *from,
+                      const char *wild);
+unsigned long   STDCALL mysql_escape_string(char *to,const char *from,
+                        unsigned long from_length);
+unsigned long   STDCALL mysql_hex_string(char *to,const char *from,
                                          unsigned long from_length);
 unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql,
-					       char *to,const char *from,
-					       unsigned long length);
-void		STDCALL mysql_debug(const char *debug);
-void 		STDCALL myodbc_remove_escape(MYSQL *mysql,char *name);
-unsigned int	STDCALL mysql_thread_safe(void);
-my_bool		STDCALL mysql_embedded(void);
-MYSQL_MANAGER*  STDCALL mysql_manager_init(MYSQL_MANAGER* con);  
+                           char *to,const char *from,
+                           unsigned long length);
+void        STDCALL mysql_debug(const char *debug);
+void        STDCALL myodbc_remove_escape(MYSQL *mysql,char *name);
+unsigned int    STDCALL mysql_thread_safe(void);
+my_bool     STDCALL mysql_embedded(void);
+MYSQL_MANAGER*  STDCALL mysql_manager_init(MYSQL_MANAGER* con);
 MYSQL_MANAGER*  STDCALL mysql_manager_connect(MYSQL_MANAGER* con,
-					      const char* host,
-					      const char* user,
-					      const char* passwd,
-					      unsigned int port);
+                          const char* host,
+                          const char* user,
+                          const char* passwd,
+                          unsigned int port);
 void            STDCALL mysql_manager_close(MYSQL_MANAGER* con);
 int             STDCALL mysql_manager_command(MYSQL_MANAGER* con,
-						const char* cmd, int cmd_len);
+                        const char* cmd, int cmd_len);
 int             STDCALL mysql_manager_fetch_line(MYSQL_MANAGER* con,
-						  char* res_buf,
-						 int res_buf_size);
+                          char* res_buf,
+                         int res_buf_size);
 my_bool         STDCALL mysql_read_query_result(MYSQL *mysql);
 
 
 /*
-  The following definitions are added for the enhanced 
+  The following definitions are added for the enhanced
   client-server protocol
 */
 
@@ -652,28 +652,28 @@ enum enum_mysql_stmt_state
 
 typedef struct st_mysql_bind
 {
-  unsigned long	*length;          /* output length pointer */
-  my_bool       *is_null;	  /* Pointer to null indicator */
-  void		*buffer;	  /* buffer to get/put data */
+  unsigned long *length;          /* output length pointer */
+  my_bool       *is_null;     /* Pointer to null indicator */
+  void      *buffer;      /* buffer to get/put data */
   /* set this if you want to track data truncations happened during fetch */
   my_bool       *error;
-  enum enum_field_types buffer_type;	/* buffer type */
+  enum enum_field_types buffer_type;    /* buffer type */
   /* output buffer length, must be set when fetching str/binary */
   unsigned long buffer_length;
   unsigned char *row_ptr;         /* for the current data position */
   unsigned long offset;           /* offset position for char/binary fetch */
-  unsigned long	length_value;     /* Used if length is 0 */
-  unsigned int	param_number;	  /* For null count and error messages */
-  unsigned int  pack_length;	  /* Internal length for packed data */
+  unsigned long length_value;     /* Used if length is 0 */
+  unsigned int  param_number;     /* For null count and error messages */
+  unsigned int  pack_length;      /* Internal length for packed data */
   my_bool       error_value;      /* used if error is 0 */
   my_bool       is_unsigned;      /* set if integer type is unsigned */
-  my_bool	long_data_used;	  /* If used with mysql_send_long_data */
-  my_bool	is_null_value;    /* Used if is_null is 0 */
+  my_bool   long_data_used;   /* If used with mysql_send_long_data */
+  my_bool   is_null_value;    /* Used if is_null is 0 */
   void (*store_param_func)(NET *net, struct st_mysql_bind *param);
   void (*fetch_result)(struct st_mysql_bind *, MYSQL_FIELD *,
                        unsigned char **row);
   void (*skip_result)(struct st_mysql_bind *, MYSQL_FIELD *,
-		      unsigned char **row);
+              unsigned char **row);
 } MYSQL_BIND;
 
 
@@ -695,9 +695,9 @@ typedef struct st_mysql_stmt
     mysql_stmt_fetch() calls this function to fetch one row (it's different
     for buffered, unbuffered and cursor fetch).
   */
-  int            (*read_row_func)(struct st_mysql_stmt *stmt, 
+  int            (*read_row_func)(struct st_mysql_stmt *stmt,
                                   unsigned char **row);
-  unsigned long	 stmt_id;	       /* Id for prepared statement */
+  unsigned long  stmt_id;          /* Id for prepared statement */
   unsigned long  flags;                /* i.e. type of cursor to open */
   unsigned long  prefetch_rows;        /* number of rows per one COM_FETCH */
   /*
@@ -705,30 +705,30 @@ typedef struct st_mysql_stmt
     server-side cursor status for this statement.
   */
   unsigned int   server_status;
-  unsigned int	 last_errno;	       /* error code */
+  unsigned int   last_errno;           /* error code */
   unsigned int   param_count;          /* input parameter count */
   unsigned int   field_count;          /* number of columns in result set */
   enum enum_mysql_stmt_state state;    /* statement state */
-  char		 last_error[MYSQL_ERRMSG_SIZE]; /* error message */
-  char		 sqlstate[SQLSTATE_LENGTH+1];
+  char       last_error[MYSQL_ERRMSG_SIZE]; /* error message */
+  char       sqlstate[SQLSTATE_LENGTH+1];
   /* Types of input parameters should be sent to server */
   my_bool        send_types_to_server;
   my_bool        bind_param_done;      /* input buffers were supplied */
   unsigned char  bind_result_done;     /* output buffers were supplied */
   /* mysql_stmt_close() had to cancel this result */
-  my_bool       unbuffered_fetch_cancelled;  
+  my_bool       unbuffered_fetch_cancelled;
   /*
-    Is set to true if we need to calculate field->max_length for 
+    Is set to true if we need to calculate field->max_length for
     metadata fields when doing mysql_stmt_store_result.
   */
-  my_bool       update_max_length;     
+  my_bool       update_max_length;
 } MYSQL_STMT;
 
 enum enum_stmt_attr_type
 {
   /*
     When doing mysql_stmt_store_result calculate max_length attribute
-    of statement metadata. This is to be consistent with the old API, 
+    of statement metadata. This is to be consistent with the old API,
     where this was done automatically.
     In the new API we do that only by request because it slows down
     mysql_stmt_store_result sufficiently.
@@ -751,18 +751,18 @@ typedef struct st_mysql_methods
 {
   my_bool (*read_query_result)(MYSQL *mysql);
   my_bool (*advanced_command)(MYSQL *mysql,
-			      enum enum_server_command command,
-			      const char *header,
-			      unsigned long header_length,
-			      const char *arg,
-			      unsigned long arg_length,
-			      my_bool skip_check,
+                  enum enum_server_command command,
+                  const char *header,
+                  unsigned long header_length,
+                  const char *arg,
+                  unsigned long arg_length,
+                  my_bool skip_check,
                               MYSQL_STMT *stmt);
   MYSQL_DATA *(*read_rows)(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
-			   unsigned int fields);
+               unsigned int fields);
   MYSQL_RES * (*use_result)(MYSQL *mysql);
-  void (*fetch_lengths)(unsigned long *to, 
-			MYSQL_ROW column, unsigned int field_count);
+  void (*fetch_lengths)(unsigned long *to,
+            MYSQL_ROW column, unsigned int field_count);
   void (*flush_use_result)(MYSQL *mysql);
 #if !defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY)
   MYSQL_FIELD * (*list_fields)(MYSQL *mysql);
@@ -784,7 +784,7 @@ int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query,
                                unsigned long length);
 int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt);
 int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt);
-int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg, 
+int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg,
                                     unsigned int column,
                                     unsigned long offset);
 int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt);
@@ -800,16 +800,16 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
 my_bool STDCALL mysql_stmt_close(MYSQL_STMT * stmt);
 my_bool STDCALL mysql_stmt_reset(MYSQL_STMT * stmt);
 my_bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt);
-my_bool STDCALL mysql_stmt_send_long_data(MYSQL_STMT *stmt, 
+my_bool STDCALL mysql_stmt_send_long_data(MYSQL_STMT *stmt,
                                           unsigned int param_number,
-                                          const char *data, 
+                                          const char *data,
                                           unsigned long length);
 MYSQL_RES *STDCALL mysql_stmt_result_metadata(MYSQL_STMT *stmt);
 MYSQL_RES *STDCALL mysql_stmt_param_metadata(MYSQL_STMT *stmt);
 unsigned int STDCALL mysql_stmt_errno(MYSQL_STMT * stmt);
 const char *STDCALL mysql_stmt_error(MYSQL_STMT * stmt);
 const char *STDCALL mysql_stmt_sqlstate(MYSQL_STMT * stmt);
-MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_seek(MYSQL_STMT *stmt, 
+MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_seek(MYSQL_STMT *stmt,
                                              MYSQL_ROW_OFFSET offset);
 MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_tell(MYSQL_STMT *stmt);
 void STDCALL mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong offset);
@@ -833,11 +833,11 @@ void STDCALL mysql_close(MYSQL *sock);
 #define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
 
 #ifdef USE_OLD_FUNCTIONS
-MYSQL *		STDCALL mysql_connect(MYSQL *mysql, const char *host,
-				      const char *user, const char *passwd);
-int		STDCALL mysql_create_db(MYSQL *mysql, const char *DB);
-int		STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
-#define	 mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
+MYSQL *     STDCALL mysql_connect(MYSQL *mysql, const char *host,
+                      const char *user, const char *passwd);
+int     STDCALL mysql_create_db(MYSQL *mysql, const char *DB);
+int     STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
+#define  mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
 #endif
 #define HAVE_MYSQL_REAL_CONNECT
 
@@ -860,11 +860,11 @@ int		STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
 #pragma pack()
 #else
 #pragma pack(pop)
-#endif 
+#endif
 
 #endif
 
-#ifdef	__cplusplus
+#ifdef  __cplusplus
 }
 #endif
 
diff --git a/dep/include/mysql/raid.h b/dep/include/mysql/raid.h
index 9d098305d14..c3b256042f5 100644
--- a/dep/include/mysql/raid.h
+++ b/dep/include/mysql/raid.h
@@ -57,16 +57,16 @@ extern "C" {
 
   bool is_raid(File fd);
   File my_raid_create(const char *FileName, int CreateFlags, int access_flags,
-		      uint raid_type, uint raid_chunks, ulong raid_chunksize,
-		      myf MyFlags);
+              uint raid_type, uint raid_chunks, ulong raid_chunksize,
+              myf MyFlags);
   File my_raid_open(const char *FileName, int Flags,
-		    uint raid_type, uint raid_chunks, ulong raid_chunksize,
-		    myf MyFlags);
+            uint raid_type, uint raid_chunks, ulong raid_chunksize,
+            myf MyFlags);
   int my_raid_rename(const char *from, const char *to, uint raid_chunks,
-		     myf MyFlags);
+             myf MyFlags);
   int my_raid_delete(const char *from, uint raid_chunks, myf MyFlags);
   int my_raid_redel(const char *old_name, const char *new_name,
-		    uint raid_chunks, myf MyFlags);
+            uint raid_chunks, myf MyFlags);
 
   my_off_t my_raid_seek(File fd, my_off_t pos, int whence, myf MyFlags);
   my_off_t my_raid_tell(File fd, myf MyFlags);
@@ -75,12 +75,12 @@ extern "C" {
   uint my_raid_read(File Filedes, byte *Buffer, uint Count, myf MyFlags);
 
   uint my_raid_pread(File Filedes, byte *Buffer, uint Count, my_off_t offset,
-		     myf MyFlags);
+             myf MyFlags);
   uint my_raid_pwrite(int Filedes, const byte *Buffer, uint Count,
-		      my_off_t offset, myf MyFlags);
+              my_off_t offset, myf MyFlags);
 
   int my_raid_lock(File,int locktype, my_off_t start, my_off_t length,
-		   myf MyFlags);
+           myf MyFlags);
   int my_raid_chsize(File fd, my_off_t newlength, int filler, myf MyFlags);
   int my_raid_close(File, myf MyFlags);
   int my_raid_fstat(int Filedes, struct stat *buf,  myf MyFlags);
@@ -89,7 +89,7 @@ extern "C" {
 }
 
 #ifdef USE_PRAGMA_INTERFACE
-#pragma interface			/* gcc class implementation */
+#pragma interface           /* gcc class implementation */
 #endif
 
 class RaidName {
@@ -109,7 +109,7 @@ class RaidFd {
     RaidFd(uint raid_type, uint raid_chunks , ulong raid_chunksize);
     ~RaidFd();
     File Create(const char *FileName, int CreateFlags, int access_flags,
-		myf MyFlags);
+        myf MyFlags);
     File Open(const char *FileName, int Flags, myf MyFlags);
     my_off_t Seek(my_off_t pos,int whence,myf MyFlags);
     my_off_t Tell(myf MyFlags);
@@ -120,7 +120,7 @@ class RaidFd {
     int Fstat(int fd, MY_STAT *stat_area, myf MyFlags );
     int Close(myf MyFlags);
     static bool IsRaid(File fd);
-    static DYNAMIC_ARRAY _raid_map;		/* Map of RaidFD* */
+    static DYNAMIC_ARRAY _raid_map;     /* Map of RaidFD* */
   private:
 
     uint _raid_type;       /* RAID_TYPE_0 or RAID_TYPE_1 or RAID_TYPE_5 */
@@ -134,22 +134,22 @@ class RaidFd {
     my_off_t _position;
     my_off_t _size;        /* Cached file size for faster seek(SEEK_END) */
     File _fd;
-    File *_fd_vector;		/* Array of File */
-    off_t *_seek_vector;	/* Array of cached seek positions */
+    File *_fd_vector;       /* Array of File */
+    off_t *_seek_vector;    /* Array of cached seek positions */
 
     inline void Calculate()
     {
       DBUG_ENTER("RaidFd::_Calculate");
       DBUG_PRINT("info",("_position: %lu  _raid_chunksize: %lu  _size: %lu",
-			 (ulong) _position, _raid_chunksize, (ulong) _size));
+             (ulong) _position, _raid_chunksize, (ulong) _size));
 
       _total_block = (ulong) (_position / _raid_chunksize);
       _this_block = _total_block % _raid_chunks;    /* can be 0.._raid_chunks */
       _remaining_bytes = (uint) (_raid_chunksize -
-				 (_position - _total_block * _raid_chunksize));
+                 (_position - _total_block * _raid_chunksize));
       DBUG_PRINT("info",
-		 ("_total_block: %lu  this_block: %d  _remaining_bytes: %d",
-		  _total_block, _this_block, _remaining_bytes));
+         ("_total_block: %lu  this_block: %d  _remaining_bytes: %d",
+          _total_block, _this_block, _remaining_bytes));
       DBUG_VOID_RETURN;
     }
 };
diff --git a/dep/include/mysql/typelib.h b/dep/include/mysql/typelib.h
index 75d170e59d3..2a62f344cd0 100644
--- a/dep/include/mysql/typelib.h
+++ b/dep/include/mysql/typelib.h
@@ -19,9 +19,9 @@
 
 #include "my_alloc.h"
 
-typedef struct st_typelib {	/* Different types saved here */
-  unsigned int count;		/* How many types */
-  const char *name;		/* Name of typelib */
+typedef struct st_typelib { /* Different types saved here */
+  unsigned int count;       /* How many types */
+  const char *name;     /* Name of typelib */
   const char **type_names;
   unsigned int *type_lengths;
 } TYPELIB;
diff --git a/dep/include/openssl/aes.h b/dep/include/openssl/aes.h
index e6fc44a24d4..865c81618d4 100644
--- a/dep/include/openssl/aes.h
+++ b/dep/include/openssl/aes.h
@@ -7,7 +7,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -58,8 +58,8 @@
 #error AES is disabled.
 #endif
 
-#define AES_ENCRYPT	1
-#define AES_DECRYPT	0
+#define AES_ENCRYPT 1
+#define AES_DECRYPT 0
 
 /* Because array size can't be a const in C, the following two are macros.
    Both sizes are in bytes. */
@@ -84,51 +84,51 @@ typedef struct aes_key_st AES_KEY;
 const char *AES_options(void);
 
 int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
-	AES_KEY *key);
+    AES_KEY *key);
 int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
-	AES_KEY *key);
+    AES_KEY *key);
 
 void AES_encrypt(const unsigned char *in, unsigned char *out,
-	const AES_KEY *key);
+    const AES_KEY *key);
 void AES_decrypt(const unsigned char *in, unsigned char *out,
-	const AES_KEY *key);
+    const AES_KEY *key);
 
 void AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
-	const AES_KEY *key, const int enc);
+    const AES_KEY *key, const int enc);
 void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
-	const unsigned long length, const AES_KEY *key,
-	unsigned char *ivec, const int enc);
+    const unsigned long length, const AES_KEY *key,
+    unsigned char *ivec, const int enc);
 void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
-	const unsigned long length, const AES_KEY *key,
-	unsigned char *ivec, int *num, const int enc);
+    const unsigned long length, const AES_KEY *key,
+    unsigned char *ivec, int *num, const int enc);
 void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
-	const unsigned long length, const AES_KEY *key,
-	unsigned char *ivec, int *num, const int enc);
+    const unsigned long length, const AES_KEY *key,
+    unsigned char *ivec, int *num, const int enc);
 void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
-	const unsigned long length, const AES_KEY *key,
-	unsigned char *ivec, int *num, const int enc);
+    const unsigned long length, const AES_KEY *key,
+    unsigned char *ivec, int *num, const int enc);
 void AES_cfbr_encrypt_block(const unsigned char *in,unsigned char *out,
-			    const int nbits,const AES_KEY *key,
-			    unsigned char *ivec,const int enc);
+                const int nbits,const AES_KEY *key,
+                unsigned char *ivec,const int enc);
 void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
-	const unsigned long length, const AES_KEY *key,
-	unsigned char *ivec, int *num);
+    const unsigned long length, const AES_KEY *key,
+    unsigned char *ivec, int *num);
 void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,
-	const unsigned long length, const AES_KEY *key,
-	unsigned char ivec[AES_BLOCK_SIZE],
-	unsigned char ecount_buf[AES_BLOCK_SIZE],
-	unsigned int *num);
+    const unsigned long length, const AES_KEY *key,
+    unsigned char ivec[AES_BLOCK_SIZE],
+    unsigned char ecount_buf[AES_BLOCK_SIZE],
+    unsigned int *num);
 
 /* For IGE, see also http://www.links.org/files/openssl-ige.pdf */
 /* NB: the IV is _two_ blocks long */
 void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
-		     const unsigned long length, const AES_KEY *key,
-		     unsigned char *ivec, const int enc);
+             const unsigned long length, const AES_KEY *key,
+             unsigned char *ivec, const int enc);
 /* NB: the IV is _four_ blocks long */
 void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
-			const unsigned long length, const AES_KEY *key,
-			const AES_KEY *key2, const unsigned char *ivec,
-			const int enc);
+            const unsigned long length, const AES_KEY *key,
+            const AES_KEY *key2, const unsigned char *ivec,
+            const int enc);
 
 
 #ifdef  __cplusplus
diff --git a/dep/include/openssl/asn1.h b/dep/include/openssl/asn1.h
index 30f1eecd5b9..8bb4cec4c9e 100644
--- a/dep/include/openssl/asn1.h
+++ b/dep/include/openssl/asn1.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -83,80 +83,80 @@
 extern "C" {
 #endif
 
-#define V_ASN1_UNIVERSAL		0x00
-#define	V_ASN1_APPLICATION		0x40
-#define V_ASN1_CONTEXT_SPECIFIC		0x80
-#define V_ASN1_PRIVATE			0xc0
+#define V_ASN1_UNIVERSAL        0x00
+#define V_ASN1_APPLICATION      0x40
+#define V_ASN1_CONTEXT_SPECIFIC     0x80
+#define V_ASN1_PRIVATE          0xc0
 
-#define V_ASN1_CONSTRUCTED		0x20
-#define V_ASN1_PRIMITIVE_TAG		0x1f
-#define V_ASN1_PRIMATIVE_TAG		0x1f
+#define V_ASN1_CONSTRUCTED      0x20
+#define V_ASN1_PRIMITIVE_TAG        0x1f
+#define V_ASN1_PRIMATIVE_TAG        0x1f
 
-#define V_ASN1_APP_CHOOSE		-2	/* let the recipient choose */
-#define V_ASN1_OTHER			-3	/* used in ASN1_TYPE */
-#define V_ASN1_ANY			-4	/* used in ASN1 template code */
+#define V_ASN1_APP_CHOOSE       -2  /* let the recipient choose */
+#define V_ASN1_OTHER            -3  /* used in ASN1_TYPE */
+#define V_ASN1_ANY          -4  /* used in ASN1 template code */
 
-#define V_ASN1_NEG			0x100	/* negative flag */
+#define V_ASN1_NEG          0x100   /* negative flag */
 
-#define V_ASN1_UNDEF			-1
-#define V_ASN1_EOC			0
-#define V_ASN1_BOOLEAN			1	/**/
-#define V_ASN1_INTEGER			2
-#define V_ASN1_NEG_INTEGER		(2 | V_ASN1_NEG)
-#define V_ASN1_BIT_STRING		3
-#define V_ASN1_OCTET_STRING		4
-#define V_ASN1_NULL			5
-#define V_ASN1_OBJECT			6
-#define V_ASN1_OBJECT_DESCRIPTOR	7
-#define V_ASN1_EXTERNAL			8
-#define V_ASN1_REAL			9
-#define V_ASN1_ENUMERATED		10
-#define V_ASN1_NEG_ENUMERATED		(10 | V_ASN1_NEG)
-#define V_ASN1_UTF8STRING		12
-#define V_ASN1_SEQUENCE			16
-#define V_ASN1_SET			17
-#define V_ASN1_NUMERICSTRING		18	/**/
-#define V_ASN1_PRINTABLESTRING		19
-#define V_ASN1_T61STRING		20
-#define V_ASN1_TELETEXSTRING		20	/* alias */
-#define V_ASN1_VIDEOTEXSTRING		21	/**/
-#define V_ASN1_IA5STRING		22
-#define V_ASN1_UTCTIME			23
-#define V_ASN1_GENERALIZEDTIME		24	/**/
-#define V_ASN1_GRAPHICSTRING		25	/**/
-#define V_ASN1_ISO64STRING		26	/**/
-#define V_ASN1_VISIBLESTRING		26	/* alias */
-#define V_ASN1_GENERALSTRING		27	/**/
-#define V_ASN1_UNIVERSALSTRING		28	/**/
-#define V_ASN1_BMPSTRING		30
+#define V_ASN1_UNDEF            -1
+#define V_ASN1_EOC          0
+#define V_ASN1_BOOLEAN          1   /**/
+#define V_ASN1_INTEGER          2
+#define V_ASN1_NEG_INTEGER      (2 | V_ASN1_NEG)
+#define V_ASN1_BIT_STRING       3
+#define V_ASN1_OCTET_STRING     4
+#define V_ASN1_NULL         5
+#define V_ASN1_OBJECT           6
+#define V_ASN1_OBJECT_DESCRIPTOR    7
+#define V_ASN1_EXTERNAL         8
+#define V_ASN1_REAL         9
+#define V_ASN1_ENUMERATED       10
+#define V_ASN1_NEG_ENUMERATED       (10 | V_ASN1_NEG)
+#define V_ASN1_UTF8STRING       12
+#define V_ASN1_SEQUENCE         16
+#define V_ASN1_SET          17
+#define V_ASN1_NUMERICSTRING        18  /**/
+#define V_ASN1_PRINTABLESTRING      19
+#define V_ASN1_T61STRING        20
+#define V_ASN1_TELETEXSTRING        20  /* alias */
+#define V_ASN1_VIDEOTEXSTRING       21  /**/
+#define V_ASN1_IA5STRING        22
+#define V_ASN1_UTCTIME          23
+#define V_ASN1_GENERALIZEDTIME      24  /**/
+#define V_ASN1_GRAPHICSTRING        25  /**/
+#define V_ASN1_ISO64STRING      26  /**/
+#define V_ASN1_VISIBLESTRING        26  /* alias */
+#define V_ASN1_GENERALSTRING        27  /**/
+#define V_ASN1_UNIVERSALSTRING      28  /**/
+#define V_ASN1_BMPSTRING        30
 
 /* For use with d2i_ASN1_type_bytes() */
-#define B_ASN1_NUMERICSTRING	0x0001
-#define B_ASN1_PRINTABLESTRING	0x0002
-#define B_ASN1_T61STRING	0x0004
-#define B_ASN1_TELETEXSTRING	0x0004
-#define B_ASN1_VIDEOTEXSTRING	0x0008
-#define B_ASN1_IA5STRING	0x0010
-#define B_ASN1_GRAPHICSTRING	0x0020
-#define B_ASN1_ISO64STRING	0x0040
-#define B_ASN1_VISIBLESTRING	0x0040
-#define B_ASN1_GENERALSTRING	0x0080
-#define B_ASN1_UNIVERSALSTRING	0x0100
-#define B_ASN1_OCTET_STRING	0x0200
-#define B_ASN1_BIT_STRING	0x0400
-#define B_ASN1_BMPSTRING	0x0800
-#define B_ASN1_UNKNOWN		0x1000
-#define B_ASN1_UTF8STRING	0x2000
-#define B_ASN1_UTCTIME		0x4000
-#define B_ASN1_GENERALIZEDTIME	0x8000
-#define B_ASN1_SEQUENCE		0x10000
+#define B_ASN1_NUMERICSTRING    0x0001
+#define B_ASN1_PRINTABLESTRING  0x0002
+#define B_ASN1_T61STRING    0x0004
+#define B_ASN1_TELETEXSTRING    0x0004
+#define B_ASN1_VIDEOTEXSTRING   0x0008
+#define B_ASN1_IA5STRING    0x0010
+#define B_ASN1_GRAPHICSTRING    0x0020
+#define B_ASN1_ISO64STRING  0x0040
+#define B_ASN1_VISIBLESTRING    0x0040
+#define B_ASN1_GENERALSTRING    0x0080
+#define B_ASN1_UNIVERSALSTRING  0x0100
+#define B_ASN1_OCTET_STRING 0x0200
+#define B_ASN1_BIT_STRING   0x0400
+#define B_ASN1_BMPSTRING    0x0800
+#define B_ASN1_UNKNOWN      0x1000
+#define B_ASN1_UTF8STRING   0x2000
+#define B_ASN1_UTCTIME      0x4000
+#define B_ASN1_GENERALIZEDTIME  0x8000
+#define B_ASN1_SEQUENCE     0x10000
 
 /* For use with ASN1_mbstring_copy() */
-#define MBSTRING_FLAG		0x1000
-#define MBSTRING_UTF8		(MBSTRING_FLAG)
-#define MBSTRING_ASC		(MBSTRING_FLAG|1)
-#define MBSTRING_BMP		(MBSTRING_FLAG|2)
-#define MBSTRING_UNIV		(MBSTRING_FLAG|4)
+#define MBSTRING_FLAG       0x1000
+#define MBSTRING_UTF8       (MBSTRING_FLAG)
+#define MBSTRING_ASC        (MBSTRING_FLAG|1)
+#define MBSTRING_BMP        (MBSTRING_FLAG|2)
+#define MBSTRING_UNIV       (MBSTRING_FLAG|4)
 
 struct X509_algor_st;
 
@@ -168,68 +168,68 @@ struct X509_algor_st;
    the old ASN1 parsing macros are gone, we can throw this away
    as well... */
 typedef struct asn1_ctx_st
-	{
-	unsigned char *p;/* work char pointer */
-	int eos;	/* end of sequence read for indefinite encoding */
-	int error;	/* error code to use when returning an error */
-	int inf;	/* constructed if 0x20, indefinite is 0x21 */
-	int tag;	/* tag from last 'get object' */
-	int xclass;	/* class from last 'get object' */
-	long slen;	/* length of last 'get object' */
-	unsigned char *max; /* largest value of p allowed */
-	unsigned char *q;/* temporary variable */
-	unsigned char **pp;/* variable */
-	int line;	/* used in error processing */
-	} ASN1_CTX;
+    {
+    unsigned char *p;/* work char pointer */
+    int eos;    /* end of sequence read for indefinite encoding */
+    int error;  /* error code to use when returning an error */
+    int inf;    /* constructed if 0x20, indefinite is 0x21 */
+    int tag;    /* tag from last 'get object' */
+    int xclass; /* class from last 'get object' */
+    long slen;  /* length of last 'get object' */
+    unsigned char *max; /* largest value of p allowed */
+    unsigned char *q;/* temporary variable */
+    unsigned char **pp;/* variable */
+    int line;   /* used in error processing */
+    } ASN1_CTX;
 
 typedef struct asn1_const_ctx_st
-	{
-	const unsigned char *p;/* work char pointer */
-	int eos;	/* end of sequence read for indefinite encoding */
-	int error;	/* error code to use when returning an error */
-	int inf;	/* constructed if 0x20, indefinite is 0x21 */
-	int tag;	/* tag from last 'get object' */
-	int xclass;	/* class from last 'get object' */
-	long slen;	/* length of last 'get object' */
-	const unsigned char *max; /* largest value of p allowed */
-	const unsigned char *q;/* temporary variable */
-	const unsigned char **pp;/* variable */
-	int line;	/* used in error processing */
-	} ASN1_const_CTX;
+    {
+    const unsigned char *p;/* work char pointer */
+    int eos;    /* end of sequence read for indefinite encoding */
+    int error;  /* error code to use when returning an error */
+    int inf;    /* constructed if 0x20, indefinite is 0x21 */
+    int tag;    /* tag from last 'get object' */
+    int xclass; /* class from last 'get object' */
+    long slen;  /* length of last 'get object' */
+    const unsigned char *max; /* largest value of p allowed */
+    const unsigned char *q;/* temporary variable */
+    const unsigned char **pp;/* variable */
+    int line;   /* used in error processing */
+    } ASN1_const_CTX;
 
 /* These are used internally in the ASN1_OBJECT to keep track of
  * whether the names and data need to be free()ed */
-#define ASN1_OBJECT_FLAG_DYNAMIC	 0x01	/* internal use */
-#define ASN1_OBJECT_FLAG_CRITICAL	 0x02	/* critical x509v3 object id */
-#define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04	/* internal use */
-#define ASN1_OBJECT_FLAG_DYNAMIC_DATA 	 0x08	/* internal use */
+#define ASN1_OBJECT_FLAG_DYNAMIC     0x01   /* internal use */
+#define ASN1_OBJECT_FLAG_CRITICAL    0x02   /* critical x509v3 object id */
+#define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04   /* internal use */
+#define ASN1_OBJECT_FLAG_DYNAMIC_DATA    0x08   /* internal use */
 typedef struct asn1_object_st
-	{
-	const char *sn,*ln;
-	int nid;
-	int length;
-	unsigned char *data;
-	int flags;	/* Should we free this one */
-	} ASN1_OBJECT;
+    {
+    const char *sn,*ln;
+    int nid;
+    int length;
+    unsigned char *data;
+    int flags;  /* Should we free this one */
+    } ASN1_OBJECT;
 
 #define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */
 /* This indicates that the ASN1_STRING is not a real value but just a place
  * holder for the location where indefinite length constructed data should
- * be inserted in the memory buffer 
+ * be inserted in the memory buffer
  */
-#define ASN1_STRING_FLAG_NDEF 0x010 
+#define ASN1_STRING_FLAG_NDEF 0x010
 /* This is the base type that holds just about everything :-) */
 typedef struct asn1_string_st
-	{
-	int length;
-	int type;
-	unsigned char *data;
-	/* The value of the following field depends on the type being
-	 * held.  It is mostly being used for BIT_STRING so if the
-	 * input data has a non-zero 'unused bits' value, it will be
-	 * handled correctly */
-	long flags;
-	} ASN1_STRING;
+    {
+    int length;
+    int type;
+    unsigned char *data;
+    /* The value of the following field depends on the type being
+     * held.  It is mostly being used for BIT_STRING so if the
+     * input data has a non-zero 'unused bits' value, it will be
+     * handled correctly */
+    long flags;
+    } ASN1_STRING;
 
 /* ASN1_ENCODING structure: this is used to save the received
  * encoding of an ASN1 type. This is useful to get round
@@ -237,41 +237,41 @@ typedef struct asn1_string_st
  */
 
 typedef struct ASN1_ENCODING_st
-	{
-	unsigned char *enc;	/* DER encoding */
-	long len;		/* Length of encoding */
-	int modified;		 /* set to 1 if 'enc' is invalid */
-	} ASN1_ENCODING;
+    {
+    unsigned char *enc; /* DER encoding */
+    long len;       /* Length of encoding */
+    int modified;        /* set to 1 if 'enc' is invalid */
+    } ASN1_ENCODING;
 
 /* Used with ASN1 LONG type: if a long is set to this it is omitted */
-#define ASN1_LONG_UNDEF	0x7fffffffL
+#define ASN1_LONG_UNDEF 0x7fffffffL
 
-#define STABLE_FLAGS_MALLOC	0x01
-#define STABLE_NO_MASK		0x02
-#define DIRSTRING_TYPE	\
+#define STABLE_FLAGS_MALLOC 0x01
+#define STABLE_NO_MASK      0x02
+#define DIRSTRING_TYPE  \
  (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING)
 #define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING)
 
 typedef struct asn1_string_table_st {
-	int nid;
-	long minsize;
-	long maxsize;
-	unsigned long mask;
-	unsigned long flags;
+    int nid;
+    long minsize;
+    long maxsize;
+    unsigned long mask;
+    unsigned long flags;
 } ASN1_STRING_TABLE;
 
 DECLARE_STACK_OF(ASN1_STRING_TABLE)
 
 /* size limits: this stuff is taken straight from RFC2459 */
 
-#define ub_name				32768
-#define ub_common_name			64
-#define ub_locality_name		128
-#define ub_state_name			128
-#define ub_organization_name		64
-#define ub_organization_unit_name	64
-#define ub_title			64
-#define ub_email_address		128
+#define ub_name             32768
+#define ub_common_name          64
+#define ub_locality_name        128
+#define ub_state_name           128
+#define ub_organization_name        64
+#define ub_organization_unit_name   64
+#define ub_title            64
+#define ub_email_address        128
 
 /* Declarations for template structures: for full definitions
  * see asn1t.h
@@ -287,36 +287,36 @@ typedef struct ASN1_VALUE_st ASN1_VALUE;
 #define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type)
 
 #define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \
-	DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type)
+    DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type)
 
 #define DECLARE_ASN1_FUNCTIONS_name(type, name) \
-	DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
-	DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name)
+    DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
+    DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name)
 
 #define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \
-	DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
-	DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name)
+    DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
+    DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name)
 
-#define	DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \
-	type *d2i_##name(type **a, const unsigned char **in, long len); \
-	int i2d_##name(type *a, unsigned char **out); \
-	DECLARE_ASN1_ITEM(itname)
+#define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \
+    type *d2i_##name(type **a, const unsigned char **in, long len); \
+    int i2d_##name(type *a, unsigned char **out); \
+    DECLARE_ASN1_ITEM(itname)
 
-#define	DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \
-	type *d2i_##name(type **a, const unsigned char **in, long len); \
-	int i2d_##name(const type *a, unsigned char **out); \
-	DECLARE_ASN1_ITEM(name)
+#define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \
+    type *d2i_##name(type **a, const unsigned char **in, long len); \
+    int i2d_##name(const type *a, unsigned char **out); \
+    DECLARE_ASN1_ITEM(name)
 
-#define	DECLARE_ASN1_NDEF_FUNCTION(name) \
-	int i2d_##name##_NDEF(name *a, unsigned char **out);
+#define DECLARE_ASN1_NDEF_FUNCTION(name) \
+    int i2d_##name##_NDEF(name *a, unsigned char **out);
 
 #define DECLARE_ASN1_FUNCTIONS_const(name) \
-	name *name##_new(void); \
-	void name##_free(name *a);
+    name *name##_new(void); \
+    void name##_free(name *a);
 
 #define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
-	type *name##_new(void); \
-	void name##_free(type *a);
+    type *name##_new(void); \
+    void name##_free(type *a);
 
 #define D2I_OF(type) type *(*)(type **,const unsigned char **,long)
 #define I2D_OF(type) int (*)(type *,unsigned char **)
@@ -347,7 +347,7 @@ TYPEDEF_D2I2D_OF(void);
  *      ...
  *      ASN1_ITEM_EXP *iptr;
  *      ...
- * } SOMETHING; 
+ * } SOMETHING;
  *
  * It would be initialised as e.g.:
  *
@@ -377,7 +377,7 @@ typedef const ASN1_ITEM ASN1_ITEM_EXP;
 #define ASN1_ITEM_rptr(ref) (&(ref##_it))
 
 #define DECLARE_ASN1_ITEM(name) \
-	OPENSSL_EXTERN const ASN1_ITEM name##_it;
+    OPENSSL_EXTERN const ASN1_ITEM name##_it;
 
 #else
 
@@ -397,7 +397,7 @@ typedef const ASN1_ITEM * ASN1_ITEM_EXP(void);
 #define ASN1_ITEM_rptr(ref) (ref##_it())
 
 #define DECLARE_ASN1_ITEM(name) \
-	const ASN1_ITEM * name##_it(void);
+    const ASN1_ITEM * name##_it(void);
 
 #endif
 
@@ -408,9 +408,9 @@ typedef const ASN1_ITEM * ASN1_ITEM_EXP(void);
  * MSB set characters
  */
 
-#define ASN1_STRFLGS_ESC_2253		1
-#define ASN1_STRFLGS_ESC_CTRL		2
-#define ASN1_STRFLGS_ESC_MSB		4
+#define ASN1_STRFLGS_ESC_2253       1
+#define ASN1_STRFLGS_ESC_CTRL       2
+#define ASN1_STRFLGS_ESC_MSB        4
 
 
 /* This flag determines how we do escaping: normally
@@ -418,37 +418,37 @@ typedef const ASN1_ITEM * ASN1_ITEM_EXP(void);
  * quote.
  */
 
-#define ASN1_STRFLGS_ESC_QUOTE		8
+#define ASN1_STRFLGS_ESC_QUOTE      8
 
 
 /* These three flags are internal use only. */
 
 /* Character is a valid PrintableString character */
-#define CHARTYPE_PRINTABLESTRING	0x10
+#define CHARTYPE_PRINTABLESTRING    0x10
 /* Character needs escaping if it is the first character */
-#define CHARTYPE_FIRST_ESC_2253		0x20
+#define CHARTYPE_FIRST_ESC_2253     0x20
 /* Character needs escaping if it is the last character */
-#define CHARTYPE_LAST_ESC_2253		0x40
+#define CHARTYPE_LAST_ESC_2253      0x40
 
 /* NB the internal flags are safely reused below by flags
  * handled at the top level.
  */
 
 /* If this is set we convert all character strings
- * to UTF8 first 
+ * to UTF8 first
  */
 
-#define ASN1_STRFLGS_UTF8_CONVERT	0x10
+#define ASN1_STRFLGS_UTF8_CONVERT   0x10
 
 /* If this is set we don't attempt to interpret content:
  * just assume all strings are 1 byte per character. This
  * will produce some pretty odd looking output!
  */
 
-#define ASN1_STRFLGS_IGNORE_TYPE	0x20
+#define ASN1_STRFLGS_IGNORE_TYPE    0x20
 
 /* If this is set we include the string type in the output */
-#define ASN1_STRFLGS_SHOW_TYPE		0x40
+#define ASN1_STRFLGS_SHOW_TYPE      0x40
 
 /* This determines which strings to display and which to
  * 'dump' (hex dump of content octets or DER encoding). We can
@@ -458,27 +458,27 @@ typedef const ASN1_ITEM * ASN1_ITEM_EXP(void);
  * the usual escaping options.
  */
 
-#define ASN1_STRFLGS_DUMP_ALL		0x80
-#define ASN1_STRFLGS_DUMP_UNKNOWN	0x100
+#define ASN1_STRFLGS_DUMP_ALL       0x80
+#define ASN1_STRFLGS_DUMP_UNKNOWN   0x100
 
 /* These determine what 'dumping' does, we can dump the
  * content octets or the DER encoding: both use the
  * RFC2253 #XXXXX notation.
  */
 
-#define ASN1_STRFLGS_DUMP_DER		0x200
+#define ASN1_STRFLGS_DUMP_DER       0x200
 
 /* All the string flags consistent with RFC2253,
  * escaping control characters isn't essential in
  * RFC2253 but it is advisable anyway.
  */
 
-#define ASN1_STRFLGS_RFC2253	(ASN1_STRFLGS_ESC_2253 | \
-				ASN1_STRFLGS_ESC_CTRL | \
-				ASN1_STRFLGS_ESC_MSB | \
-				ASN1_STRFLGS_UTF8_CONVERT | \
-				ASN1_STRFLGS_DUMP_UNKNOWN | \
-				ASN1_STRFLGS_DUMP_DER)
+#define ASN1_STRFLGS_RFC2253    (ASN1_STRFLGS_ESC_2253 | \
+                ASN1_STRFLGS_ESC_CTRL | \
+                ASN1_STRFLGS_ESC_MSB | \
+                ASN1_STRFLGS_UTF8_CONVERT | \
+                ASN1_STRFLGS_DUMP_UNKNOWN | \
+                ASN1_STRFLGS_DUMP_DER)
 
 DECLARE_STACK_OF(ASN1_INTEGER)
 DECLARE_ASN1_SET_OF(ASN1_INTEGER)
@@ -486,315 +486,315 @@ DECLARE_ASN1_SET_OF(ASN1_INTEGER)
 DECLARE_STACK_OF(ASN1_GENERALSTRING)
 
 typedef struct asn1_type_st
-	{
-	int type;
-	union	{
-		char *ptr;
-		ASN1_BOOLEAN		boolean;
-		ASN1_STRING *		asn1_string;
-		ASN1_OBJECT *		object;
-		ASN1_INTEGER *		integer;
-		ASN1_ENUMERATED *	enumerated;
-		ASN1_BIT_STRING *	bit_string;
-		ASN1_OCTET_STRING *	octet_string;
-		ASN1_PRINTABLESTRING *	printablestring;
-		ASN1_T61STRING *	t61string;
-		ASN1_IA5STRING *	ia5string;
-		ASN1_GENERALSTRING *	generalstring;
-		ASN1_BMPSTRING *	bmpstring;
-		ASN1_UNIVERSALSTRING *	universalstring;
-		ASN1_UTCTIME *		utctime;
-		ASN1_GENERALIZEDTIME *	generalizedtime;
-		ASN1_VISIBLESTRING *	visiblestring;
-		ASN1_UTF8STRING *	utf8string;
-		/* set and sequence are left complete and still
-		 * contain the set or sequence bytes */
-		ASN1_STRING *		set;
-		ASN1_STRING *		sequence;
-		} value;
-	} ASN1_TYPE;
+    {
+    int type;
+    union   {
+        char *ptr;
+        ASN1_BOOLEAN        boolean;
+        ASN1_STRING *       asn1_string;
+        ASN1_OBJECT *       object;
+        ASN1_INTEGER *      integer;
+        ASN1_ENUMERATED *   enumerated;
+        ASN1_BIT_STRING *   bit_string;
+        ASN1_OCTET_STRING * octet_string;
+        ASN1_PRINTABLESTRING *  printablestring;
+        ASN1_T61STRING *    t61string;
+        ASN1_IA5STRING *    ia5string;
+        ASN1_GENERALSTRING *    generalstring;
+        ASN1_BMPSTRING *    bmpstring;
+        ASN1_UNIVERSALSTRING *  universalstring;
+        ASN1_UTCTIME *      utctime;
+        ASN1_GENERALIZEDTIME *  generalizedtime;
+        ASN1_VISIBLESTRING *    visiblestring;
+        ASN1_UTF8STRING *   utf8string;
+        /* set and sequence are left complete and still
+         * contain the set or sequence bytes */
+        ASN1_STRING *       set;
+        ASN1_STRING *       sequence;
+        } value;
+    } ASN1_TYPE;
 
 DECLARE_STACK_OF(ASN1_TYPE)
 DECLARE_ASN1_SET_OF(ASN1_TYPE)
 
 typedef struct asn1_method_st
-	{
-	i2d_of_void *i2d;
-	d2i_of_void *d2i;
-	void *(*create)(void);
-	void (*destroy)(void *);
-	} ASN1_METHOD;
+    {
+    i2d_of_void *i2d;
+    d2i_of_void *d2i;
+    void *(*create)(void);
+    void (*destroy)(void *);
+    } ASN1_METHOD;
 
 /* This is used when parsing some Netscape objects */
 typedef struct asn1_header_st
-	{
-	ASN1_OCTET_STRING *header;
-	void *data;
-	ASN1_METHOD *meth;
-	} ASN1_HEADER;
+    {
+    ASN1_OCTET_STRING *header;
+    void *data;
+    ASN1_METHOD *meth;
+    } ASN1_HEADER;
 
 /* This is used to contain a list of bit names */
 typedef struct BIT_STRING_BITNAME_st {
-	int bitnum;
-	const char *lname;
-	const char *sname;
+    int bitnum;
+    const char *lname;
+    const char *sname;
 } BIT_STRING_BITNAME;
 
 
-#define M_ASN1_STRING_length(x)	((x)->length)
-#define M_ASN1_STRING_length_set(x, n)	((x)->length = (n))
-#define M_ASN1_STRING_type(x)	((x)->type)
-#define M_ASN1_STRING_data(x)	((x)->data)
+#define M_ASN1_STRING_length(x) ((x)->length)
+#define M_ASN1_STRING_length_set(x, n)  ((x)->length = (n))
+#define M_ASN1_STRING_type(x)   ((x)->type)
+#define M_ASN1_STRING_data(x)   ((x)->data)
 
 /* Macros for string operations */
-#define M_ASN1_BIT_STRING_new()	(ASN1_BIT_STRING *)\
-		ASN1_STRING_type_new(V_ASN1_BIT_STRING)
-#define M_ASN1_BIT_STRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
+#define M_ASN1_BIT_STRING_new() (ASN1_BIT_STRING *)\
+        ASN1_STRING_type_new(V_ASN1_BIT_STRING)
+#define M_ASN1_BIT_STRING_free(a)   ASN1_STRING_free((ASN1_STRING *)a)
 #define M_ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\
-		ASN1_STRING_dup((ASN1_STRING *)a)
+        ASN1_STRING_dup((ASN1_STRING *)a)
 #define M_ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\
-		(ASN1_STRING *)a,(ASN1_STRING *)b)
+        (ASN1_STRING *)a,(ASN1_STRING *)b)
 #define M_ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c)
 
-#define M_ASN1_INTEGER_new()	(ASN1_INTEGER *)\
-		ASN1_STRING_type_new(V_ASN1_INTEGER)
-#define M_ASN1_INTEGER_free(a)		ASN1_STRING_free((ASN1_STRING *)a)
+#define M_ASN1_INTEGER_new()    (ASN1_INTEGER *)\
+        ASN1_STRING_type_new(V_ASN1_INTEGER)
+#define M_ASN1_INTEGER_free(a)      ASN1_STRING_free((ASN1_STRING *)a)
 #define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)ASN1_STRING_dup((ASN1_STRING *)a)
-#define M_ASN1_INTEGER_cmp(a,b)	ASN1_STRING_cmp(\
-		(ASN1_STRING *)a,(ASN1_STRING *)b)
+#define M_ASN1_INTEGER_cmp(a,b) ASN1_STRING_cmp(\
+        (ASN1_STRING *)a,(ASN1_STRING *)b)
 
-#define M_ASN1_ENUMERATED_new()	(ASN1_ENUMERATED *)\
-		ASN1_STRING_type_new(V_ASN1_ENUMERATED)
-#define M_ASN1_ENUMERATED_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
+#define M_ASN1_ENUMERATED_new() (ASN1_ENUMERATED *)\
+        ASN1_STRING_type_new(V_ASN1_ENUMERATED)
+#define M_ASN1_ENUMERATED_free(a)   ASN1_STRING_free((ASN1_STRING *)a)
 #define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)ASN1_STRING_dup((ASN1_STRING *)a)
-#define M_ASN1_ENUMERATED_cmp(a,b)	ASN1_STRING_cmp(\
-		(ASN1_STRING *)a,(ASN1_STRING *)b)
+#define M_ASN1_ENUMERATED_cmp(a,b)  ASN1_STRING_cmp(\
+        (ASN1_STRING *)a,(ASN1_STRING *)b)
 
-#define M_ASN1_OCTET_STRING_new()	(ASN1_OCTET_STRING *)\
-		ASN1_STRING_type_new(V_ASN1_OCTET_STRING)
-#define M_ASN1_OCTET_STRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
+#define M_ASN1_OCTET_STRING_new()   (ASN1_OCTET_STRING *)\
+        ASN1_STRING_type_new(V_ASN1_OCTET_STRING)
+#define M_ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
 #define M_ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\
-		ASN1_STRING_dup((ASN1_STRING *)a)
+        ASN1_STRING_dup((ASN1_STRING *)a)
 #define M_ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\
-		(ASN1_STRING *)a,(ASN1_STRING *)b)
-#define M_ASN1_OCTET_STRING_set(a,b,c)	ASN1_STRING_set((ASN1_STRING *)a,b,c)
-#define M_ASN1_OCTET_STRING_print(a,b)	ASN1_STRING_print(a,(ASN1_STRING *)b)
+        (ASN1_STRING *)a,(ASN1_STRING *)b)
+#define M_ASN1_OCTET_STRING_set(a,b,c)  ASN1_STRING_set((ASN1_STRING *)a,b,c)
+#define M_ASN1_OCTET_STRING_print(a,b)  ASN1_STRING_print(a,(ASN1_STRING *)b)
 #define M_i2d_ASN1_OCTET_STRING(a,pp) \
-		i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\
-		V_ASN1_UNIVERSAL)
+        i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\
+        V_ASN1_UNIVERSAL)
 
 #define B_ASN1_TIME \
-			B_ASN1_UTCTIME | \
-			B_ASN1_GENERALIZEDTIME
+            B_ASN1_UTCTIME | \
+            B_ASN1_GENERALIZEDTIME
 
 #define B_ASN1_PRINTABLE \
-			B_ASN1_PRINTABLESTRING| \
-			B_ASN1_T61STRING| \
-			B_ASN1_IA5STRING| \
-			B_ASN1_BIT_STRING| \
-			B_ASN1_UNIVERSALSTRING|\
-			B_ASN1_BMPSTRING|\
-			B_ASN1_UTF8STRING|\
-			B_ASN1_SEQUENCE|\
-			B_ASN1_UNKNOWN
+            B_ASN1_PRINTABLESTRING| \
+            B_ASN1_T61STRING| \
+            B_ASN1_IA5STRING| \
+            B_ASN1_BIT_STRING| \
+            B_ASN1_UNIVERSALSTRING|\
+            B_ASN1_BMPSTRING|\
+            B_ASN1_UTF8STRING|\
+            B_ASN1_SEQUENCE|\
+            B_ASN1_UNKNOWN
 
 #define B_ASN1_DIRECTORYSTRING \
-			B_ASN1_PRINTABLESTRING| \
-			B_ASN1_TELETEXSTRING|\
-			B_ASN1_BMPSTRING|\
-			B_ASN1_UNIVERSALSTRING|\
-			B_ASN1_UTF8STRING
+            B_ASN1_PRINTABLESTRING| \
+            B_ASN1_TELETEXSTRING|\
+            B_ASN1_BMPSTRING|\
+            B_ASN1_UNIVERSALSTRING|\
+            B_ASN1_UTF8STRING
 
 #define B_ASN1_DISPLAYTEXT \
-			B_ASN1_IA5STRING| \
-			B_ASN1_VISIBLESTRING| \
-			B_ASN1_BMPSTRING|\
-			B_ASN1_UTF8STRING
+            B_ASN1_IA5STRING| \
+            B_ASN1_VISIBLESTRING| \
+            B_ASN1_BMPSTRING|\
+            B_ASN1_UTF8STRING
 
-#define M_ASN1_PRINTABLE_new()	ASN1_STRING_type_new(V_ASN1_T61STRING)
-#define M_ASN1_PRINTABLE_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
+#define M_ASN1_PRINTABLE_new()  ASN1_STRING_type_new(V_ASN1_T61STRING)
+#define M_ASN1_PRINTABLE_free(a)    ASN1_STRING_free((ASN1_STRING *)a)
 #define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
-		pp,a->type,V_ASN1_UNIVERSAL)
+        pp,a->type,V_ASN1_UNIVERSAL)
 #define M_d2i_ASN1_PRINTABLE(a,pp,l) \
-		d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
-			B_ASN1_PRINTABLE)
+        d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
+            B_ASN1_PRINTABLE)
 
 #define M_DIRECTORYSTRING_new() ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)
-#define M_DIRECTORYSTRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
+#define M_DIRECTORYSTRING_free(a)   ASN1_STRING_free((ASN1_STRING *)a)
 #define M_i2d_DIRECTORYSTRING(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
-						pp,a->type,V_ASN1_UNIVERSAL)
+                        pp,a->type,V_ASN1_UNIVERSAL)
 #define M_d2i_DIRECTORYSTRING(a,pp,l) \
-		d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
-			B_ASN1_DIRECTORYSTRING)
+        d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
+            B_ASN1_DIRECTORYSTRING)
 
 #define M_DISPLAYTEXT_new() ASN1_STRING_type_new(V_ASN1_VISIBLESTRING)
 #define M_DISPLAYTEXT_free(a) ASN1_STRING_free((ASN1_STRING *)a)
 #define M_i2d_DISPLAYTEXT(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
-						pp,a->type,V_ASN1_UNIVERSAL)
+                        pp,a->type,V_ASN1_UNIVERSAL)
 #define M_d2i_DISPLAYTEXT(a,pp,l) \
-		d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
-			B_ASN1_DISPLAYTEXT)
+        d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
+            B_ASN1_DISPLAYTEXT)
 
 #define M_ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING *)\
-		ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)
-#define M_ASN1_PRINTABLESTRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
+        ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)
+#define M_ASN1_PRINTABLESTRING_free(a)  ASN1_STRING_free((ASN1_STRING *)a)
 #define M_i2d_ASN1_PRINTABLESTRING(a,pp) \
-		i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_PRINTABLESTRING,\
-		V_ASN1_UNIVERSAL)
+        i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_PRINTABLESTRING,\
+        V_ASN1_UNIVERSAL)
 #define M_d2i_ASN1_PRINTABLESTRING(a,pp,l) \
-		(ASN1_PRINTABLESTRING *)d2i_ASN1_type_bytes\
-		((ASN1_STRING **)a,pp,l,B_ASN1_PRINTABLESTRING)
+        (ASN1_PRINTABLESTRING *)d2i_ASN1_type_bytes\
+        ((ASN1_STRING **)a,pp,l,B_ASN1_PRINTABLESTRING)
 
-#define M_ASN1_T61STRING_new()	(ASN1_T61STRING *)\
-		ASN1_STRING_type_new(V_ASN1_T61STRING)
-#define M_ASN1_T61STRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
+#define M_ASN1_T61STRING_new()  (ASN1_T61STRING *)\
+        ASN1_STRING_type_new(V_ASN1_T61STRING)
+#define M_ASN1_T61STRING_free(a)    ASN1_STRING_free((ASN1_STRING *)a)
 #define M_i2d_ASN1_T61STRING(a,pp) \
-		i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_T61STRING,\
-		V_ASN1_UNIVERSAL)
+        i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_T61STRING,\
+        V_ASN1_UNIVERSAL)
 #define M_d2i_ASN1_T61STRING(a,pp,l) \
-		(ASN1_T61STRING *)d2i_ASN1_type_bytes\
-		((ASN1_STRING **)a,pp,l,B_ASN1_T61STRING)
+        (ASN1_T61STRING *)d2i_ASN1_type_bytes\
+        ((ASN1_STRING **)a,pp,l,B_ASN1_T61STRING)
 
-#define M_ASN1_IA5STRING_new()	(ASN1_IA5STRING *)\
-		ASN1_STRING_type_new(V_ASN1_IA5STRING)
-#define M_ASN1_IA5STRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
-#define M_ASN1_IA5STRING_dup(a)	\
-			(ASN1_IA5STRING *)ASN1_STRING_dup((ASN1_STRING *)a)
+#define M_ASN1_IA5STRING_new()  (ASN1_IA5STRING *)\
+        ASN1_STRING_type_new(V_ASN1_IA5STRING)
+#define M_ASN1_IA5STRING_free(a)    ASN1_STRING_free((ASN1_STRING *)a)
+#define M_ASN1_IA5STRING_dup(a) \
+            (ASN1_IA5STRING *)ASN1_STRING_dup((ASN1_STRING *)a)
 #define M_i2d_ASN1_IA5STRING(a,pp) \
-		i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\
-			V_ASN1_UNIVERSAL)
+        i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\
+            V_ASN1_UNIVERSAL)
 #define M_d2i_ASN1_IA5STRING(a,pp,l) \
-		(ASN1_IA5STRING *)d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l,\
-			B_ASN1_IA5STRING)
+        (ASN1_IA5STRING *)d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l,\
+            B_ASN1_IA5STRING)
 
-#define M_ASN1_UTCTIME_new()	(ASN1_UTCTIME *)\
-		ASN1_STRING_type_new(V_ASN1_UTCTIME)
-#define M_ASN1_UTCTIME_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
+#define M_ASN1_UTCTIME_new()    (ASN1_UTCTIME *)\
+        ASN1_STRING_type_new(V_ASN1_UTCTIME)
+#define M_ASN1_UTCTIME_free(a)  ASN1_STRING_free((ASN1_STRING *)a)
 #define M_ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)ASN1_STRING_dup((ASN1_STRING *)a)
 
-#define M_ASN1_GENERALIZEDTIME_new()	(ASN1_GENERALIZEDTIME *)\
-		ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME)
-#define M_ASN1_GENERALIZEDTIME_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
+#define M_ASN1_GENERALIZEDTIME_new()    (ASN1_GENERALIZEDTIME *)\
+        ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME)
+#define M_ASN1_GENERALIZEDTIME_free(a)  ASN1_STRING_free((ASN1_STRING *)a)
 #define M_ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup(\
-	(ASN1_STRING *)a)
+    (ASN1_STRING *)a)
 
-#define M_ASN1_TIME_new()	(ASN1_TIME *)\
-		ASN1_STRING_type_new(V_ASN1_UTCTIME)
-#define M_ASN1_TIME_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
+#define M_ASN1_TIME_new()   (ASN1_TIME *)\
+        ASN1_STRING_type_new(V_ASN1_UTCTIME)
+#define M_ASN1_TIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
 #define M_ASN1_TIME_dup(a) (ASN1_TIME *)ASN1_STRING_dup((ASN1_STRING *)a)
 
-#define M_ASN1_GENERALSTRING_new()	(ASN1_GENERALSTRING *)\
-		ASN1_STRING_type_new(V_ASN1_GENERALSTRING)
-#define M_ASN1_GENERALSTRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
+#define M_ASN1_GENERALSTRING_new()  (ASN1_GENERALSTRING *)\
+        ASN1_STRING_type_new(V_ASN1_GENERALSTRING)
+#define M_ASN1_GENERALSTRING_free(a)    ASN1_STRING_free((ASN1_STRING *)a)
 #define M_i2d_ASN1_GENERALSTRING(a,pp) \
-		i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_GENERALSTRING,\
-			V_ASN1_UNIVERSAL)
+        i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_GENERALSTRING,\
+            V_ASN1_UNIVERSAL)
 #define M_d2i_ASN1_GENERALSTRING(a,pp,l) \
-		(ASN1_GENERALSTRING *)d2i_ASN1_type_bytes\
-		((ASN1_STRING **)a,pp,l,B_ASN1_GENERALSTRING)
+        (ASN1_GENERALSTRING *)d2i_ASN1_type_bytes\
+        ((ASN1_STRING **)a,pp,l,B_ASN1_GENERALSTRING)
 
-#define M_ASN1_UNIVERSALSTRING_new()	(ASN1_UNIVERSALSTRING *)\
-		ASN1_STRING_type_new(V_ASN1_UNIVERSALSTRING)
-#define M_ASN1_UNIVERSALSTRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
+#define M_ASN1_UNIVERSALSTRING_new()    (ASN1_UNIVERSALSTRING *)\
+        ASN1_STRING_type_new(V_ASN1_UNIVERSALSTRING)
+#define M_ASN1_UNIVERSALSTRING_free(a)  ASN1_STRING_free((ASN1_STRING *)a)
 #define M_i2d_ASN1_UNIVERSALSTRING(a,pp) \
-		i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UNIVERSALSTRING,\
-			V_ASN1_UNIVERSAL)
+        i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UNIVERSALSTRING,\
+            V_ASN1_UNIVERSAL)
 #define M_d2i_ASN1_UNIVERSALSTRING(a,pp,l) \
-		(ASN1_UNIVERSALSTRING *)d2i_ASN1_type_bytes\
-		((ASN1_STRING **)a,pp,l,B_ASN1_UNIVERSALSTRING)
+        (ASN1_UNIVERSALSTRING *)d2i_ASN1_type_bytes\
+        ((ASN1_STRING **)a,pp,l,B_ASN1_UNIVERSALSTRING)
 
-#define M_ASN1_BMPSTRING_new()	(ASN1_BMPSTRING *)\
-		ASN1_STRING_type_new(V_ASN1_BMPSTRING)
-#define M_ASN1_BMPSTRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
+#define M_ASN1_BMPSTRING_new()  (ASN1_BMPSTRING *)\
+        ASN1_STRING_type_new(V_ASN1_BMPSTRING)
+#define M_ASN1_BMPSTRING_free(a)    ASN1_STRING_free((ASN1_STRING *)a)
 #define M_i2d_ASN1_BMPSTRING(a,pp) \
-		i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_BMPSTRING,\
-			V_ASN1_UNIVERSAL)
+        i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_BMPSTRING,\
+            V_ASN1_UNIVERSAL)
 #define M_d2i_ASN1_BMPSTRING(a,pp,l) \
-		(ASN1_BMPSTRING *)d2i_ASN1_type_bytes\
-		((ASN1_STRING **)a,pp,l,B_ASN1_BMPSTRING)
+        (ASN1_BMPSTRING *)d2i_ASN1_type_bytes\
+        ((ASN1_STRING **)a,pp,l,B_ASN1_BMPSTRING)
 
-#define M_ASN1_VISIBLESTRING_new()	(ASN1_VISIBLESTRING *)\
-		ASN1_STRING_type_new(V_ASN1_VISIBLESTRING)
-#define M_ASN1_VISIBLESTRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
+#define M_ASN1_VISIBLESTRING_new()  (ASN1_VISIBLESTRING *)\
+        ASN1_STRING_type_new(V_ASN1_VISIBLESTRING)
+#define M_ASN1_VISIBLESTRING_free(a)    ASN1_STRING_free((ASN1_STRING *)a)
 #define M_i2d_ASN1_VISIBLESTRING(a,pp) \
-		i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_VISIBLESTRING,\
-			V_ASN1_UNIVERSAL)
+        i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_VISIBLESTRING,\
+            V_ASN1_UNIVERSAL)
 #define M_d2i_ASN1_VISIBLESTRING(a,pp,l) \
-		(ASN1_VISIBLESTRING *)d2i_ASN1_type_bytes\
-		((ASN1_STRING **)a,pp,l,B_ASN1_VISIBLESTRING)
+        (ASN1_VISIBLESTRING *)d2i_ASN1_type_bytes\
+        ((ASN1_STRING **)a,pp,l,B_ASN1_VISIBLESTRING)
 
-#define M_ASN1_UTF8STRING_new()	(ASN1_UTF8STRING *)\
-		ASN1_STRING_type_new(V_ASN1_UTF8STRING)
-#define M_ASN1_UTF8STRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
+#define M_ASN1_UTF8STRING_new() (ASN1_UTF8STRING *)\
+        ASN1_STRING_type_new(V_ASN1_UTF8STRING)
+#define M_ASN1_UTF8STRING_free(a)   ASN1_STRING_free((ASN1_STRING *)a)
 #define M_i2d_ASN1_UTF8STRING(a,pp) \
-		i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UTF8STRING,\
-			V_ASN1_UNIVERSAL)
+        i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UTF8STRING,\
+            V_ASN1_UNIVERSAL)
 #define M_d2i_ASN1_UTF8STRING(a,pp,l) \
-		(ASN1_UTF8STRING *)d2i_ASN1_type_bytes\
-		((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING)
+        (ASN1_UTF8STRING *)d2i_ASN1_type_bytes\
+        ((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING)
 
   /* for the is_set parameter to i2d_ASN1_SET */
-#define IS_SEQUENCE	0
-#define IS_SET		1
+#define IS_SEQUENCE 0
+#define IS_SET      1
 
 DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE)
 
 int ASN1_TYPE_get(ASN1_TYPE *a);
 void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
 
-ASN1_OBJECT *	ASN1_OBJECT_new(void );
-void		ASN1_OBJECT_free(ASN1_OBJECT *a);
-int		i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp);
-ASN1_OBJECT *	c2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,
-			long length);
-ASN1_OBJECT *	d2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,
-			long length);
+ASN1_OBJECT *   ASN1_OBJECT_new(void );
+void        ASN1_OBJECT_free(ASN1_OBJECT *a);
+int     i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp);
+ASN1_OBJECT *   c2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,
+            long length);
+ASN1_OBJECT *   d2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,
+            long length);
 
 DECLARE_ASN1_ITEM(ASN1_OBJECT)
 
 DECLARE_STACK_OF(ASN1_OBJECT)
 DECLARE_ASN1_SET_OF(ASN1_OBJECT)
 
-ASN1_STRING *	ASN1_STRING_new(void);
-void		ASN1_STRING_free(ASN1_STRING *a);
-ASN1_STRING *	ASN1_STRING_dup(ASN1_STRING *a);
-ASN1_STRING *	ASN1_STRING_type_new(int type );
-int 		ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b);
+ASN1_STRING *   ASN1_STRING_new(void);
+void        ASN1_STRING_free(ASN1_STRING *a);
+ASN1_STRING *   ASN1_STRING_dup(ASN1_STRING *a);
+ASN1_STRING *   ASN1_STRING_type_new(int type );
+int         ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b);
   /* Since this is used to store all sorts of things, via macros, for now, make
      its data void * */
-int 		ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
+int         ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
 int ASN1_STRING_length(ASN1_STRING *x);
 void ASN1_STRING_length_set(ASN1_STRING *x, int n);
 int ASN1_STRING_type(ASN1_STRING *x);
 unsigned char * ASN1_STRING_data(ASN1_STRING *x);
 
 DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING)
-int		i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp);
+int     i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp);
 ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,const unsigned char **pp,
-			long length);
-int		ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d,
-			int length );
-int		ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
-int		ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);
+            long length);
+int     ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d,
+            int length );
+int     ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
+int     ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);
 
 #ifndef OPENSSL_NO_BIO
 int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
-				BIT_STRING_BITNAME *tbl, int indent);
+                BIT_STRING_BITNAME *tbl, int indent);
 #endif
 int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl);
 int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,
-				BIT_STRING_BITNAME *tbl);
+                BIT_STRING_BITNAME *tbl);
 
-int		i2d_ASN1_BOOLEAN(int a,unsigned char **pp);
-int 		d2i_ASN1_BOOLEAN(int *a,const unsigned char **pp,long length);
+int     i2d_ASN1_BOOLEAN(int a,unsigned char **pp);
+int         d2i_ASN1_BOOLEAN(int *a,const unsigned char **pp,long length);
 
 DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER)
-int		i2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp);
+int     i2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp);
 ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,const unsigned char **pp,
-			long length);
+            long length);
 ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp,
-			long length);
-ASN1_INTEGER *	ASN1_INTEGER_dup(ASN1_INTEGER *x);
+            long length);
+ASN1_INTEGER *  ASN1_INTEGER_dup(ASN1_INTEGER *x);
 int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y);
 
 DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED)
@@ -812,9 +812,9 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t)
 int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str);
 
 DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)
-ASN1_OCTET_STRING *	ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *a);
-int 	ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b);
-int 	ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len);
+ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *a);
+int     ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b);
+int     ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len);
 
 DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING)
 DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING)
@@ -844,10 +844,10 @@ int ASN1_TIME_check(ASN1_TIME *t);
 ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out);
 
 int i2d_ASN1_SET(STACK *a, unsigned char **pp,
-		 i2d_of_void *i2d, int ex_tag, int ex_class, int is_set);
-STACK *	d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length,
-		     d2i_of_void *d2i, void (*free_func)(void *),
-		     int ex_tag, int ex_class);
+         i2d_of_void *i2d, int ex_tag, int ex_class, int is_set);
+STACK * d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length,
+             d2i_of_void *d2i, void (*free_func)(void *),
+             int ex_tag, int ex_class);
 
 #ifndef OPENSSL_NO_BIO
 int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a);
@@ -862,7 +862,7 @@ int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a);
 
 int a2d_ASN1_OBJECT(unsigned char *out,int olen, const char *buf, int num);
 ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len,
-	const char *sn, const char *ln);
+    const char *sn, const char *ln);
 
 int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
 long ASN1_INTEGER_get(ASN1_INTEGER *a);
@@ -880,11 +880,11 @@ int ASN1_PRINTABLE_type(const unsigned char *s, int max);
 
 int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass);
 ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp,
-	long length, int Ptag, int Pclass);
+    long length, int Ptag, int Pclass);
 unsigned long ASN1_tag2bit(int tag);
 /* type is one or more of the B_ASN1_ values. */
 ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,const unsigned char **pp,
-		long length,int type);
+        long length,int type);
 
 /* PARSING */
 int asn1_Finish(ASN1_CTX *c);
@@ -892,33 +892,33 @@ int asn1_const_Finish(ASN1_const_CTX *c);
 
 /* SPECIALS */
 int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
-	int *pclass, long omax);
+    int *pclass, long omax);
 int ASN1_check_infinite_end(unsigned char **p,long len);
 int ASN1_const_check_infinite_end(const unsigned char **p,long len);
 void ASN1_put_object(unsigned char **pp, int constructed, int length,
-	int tag, int xclass);
+    int tag, int xclass);
 int ASN1_put_eoc(unsigned char **pp);
 int ASN1_object_size(int constructed, int length, int tag);
 
 /* Used to implement other functions */
 void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x);
 #define ASN1_dup_of(type,i2d,d2i,x) \
-	((type *(*)(I2D_OF(type),D2I_OF(type),type *))openssl_fcast(ASN1_dup))(i2d,d2i,x)
+    ((type *(*)(I2D_OF(type),D2I_OF(type),type *))openssl_fcast(ASN1_dup))(i2d,d2i,x)
 #define ASN1_dup_of_const(type,i2d,d2i,x) \
-	((type *(*)(I2D_OF_const(type),D2I_OF(type),type *))openssl_fcast(ASN1_dup))(i2d,d2i,x)
+    ((type *(*)(I2D_OF_const(type),D2I_OF(type),type *))openssl_fcast(ASN1_dup))(i2d,d2i,x)
 
 void *ASN1_item_dup(const ASN1_ITEM *it, void *x);
 
 #ifndef OPENSSL_NO_FP_API
 void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x);
 #define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \
-	((type *(*)(type *(*)(void),D2I_OF(type),FILE *,type **))openssl_fcast(ASN1_d2i_fp))(xnew,d2i,in,x)
+    ((type *(*)(type *(*)(void),D2I_OF(type),FILE *,type **))openssl_fcast(ASN1_d2i_fp))(xnew,d2i,in,x)
 void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);
 int ASN1_i2d_fp(i2d_of_void *i2d,FILE *out,void *x);
 #define ASN1_i2d_fp_of(type,i2d,out,x) \
-	((int (*)(I2D_OF(type),FILE *,type *))openssl_fcast(ASN1_i2d_fp))(i2d,out,x)
+    ((int (*)(I2D_OF(type),FILE *,type *))openssl_fcast(ASN1_i2d_fp))(i2d,out,x)
 #define ASN1_i2d_fp_of_const(type,i2d,out,x) \
-	((int (*)(I2D_OF_const(type),FILE *,type *))openssl_fcast(ASN1_i2d_fp))(i2d,out,x)
+    ((int (*)(I2D_OF_const(type),FILE *,type *))openssl_fcast(ASN1_i2d_fp))(i2d,out,x)
 int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x);
 int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags);
 #endif
@@ -928,13 +928,13 @@ int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in);
 #ifndef OPENSSL_NO_BIO
 void *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x);
 #define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \
-	((type *(*)(type *(*)(void),D2I_OF(type),BIO *,type **))openssl_fcast(ASN1_d2i_bio))(xnew,d2i,in,x)
+    ((type *(*)(type *(*)(void),D2I_OF(type),BIO *,type **))openssl_fcast(ASN1_d2i_bio))(xnew,d2i,in,x)
 void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);
 int ASN1_i2d_bio(i2d_of_void *i2d,BIO *out, unsigned char *x);
 #define ASN1_i2d_bio_of(type,i2d,out,x) \
-	((int (*)(I2D_OF(type),BIO *,type *))openssl_fcast(ASN1_i2d_bio))(i2d,out,x)
+    ((int (*)(I2D_OF(type),BIO *,type *))openssl_fcast(ASN1_i2d_bio))(i2d,out,x)
 #define ASN1_i2d_bio_of_const(type,i2d,out,x) \
-	((int (*)(I2D_OF_const(type),BIO *,const type *))openssl_fcast(ASN1_i2d_bio))(i2d,out,x)
+    ((int (*)(I2D_OF_const(type),BIO *,const type *))openssl_fcast(ASN1_i2d_bio))(i2d,out,x)
 int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x);
 int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a);
 int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a);
@@ -961,37 +961,37 @@ ASN1_METHOD *ASN1_IA5STRING_asn1_meth(void);
 ASN1_METHOD *ASN1_BIT_STRING_asn1_meth(void);
 
 int ASN1_TYPE_set_octetstring(ASN1_TYPE *a,
-	unsigned char *data, int len);
+    unsigned char *data, int len);
 int ASN1_TYPE_get_octetstring(ASN1_TYPE *a,
-	unsigned char *data, int max_len);
+    unsigned char *data, int max_len);
 int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num,
-	unsigned char *data, int len);
+    unsigned char *data, int len);
 int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num,
-	unsigned char *data, int max_len);
+    unsigned char *data, int max_len);
 
 STACK *ASN1_seq_unpack(const unsigned char *buf, int len,
-		       d2i_of_void *d2i, void (*free_func)(void *));
+               d2i_of_void *d2i, void (*free_func)(void *));
 unsigned char *ASN1_seq_pack(STACK *safes, i2d_of_void *i2d,
-			     unsigned char **buf, int *len );
+                 unsigned char **buf, int *len );
 void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i);
 void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);
 ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,
-			      ASN1_OCTET_STRING **oct);
+                  ASN1_OCTET_STRING **oct);
 #define ASN1_pack_string_of(type,obj,i2d,oct) \
-	((ASN1_STRING *(*)(type *,I2D_OF(type),ASN1_OCTET_STRING **))openssl_fcast(ASN1_pack_string))(obj,i2d,oct)
+    ((ASN1_STRING *(*)(type *,I2D_OF(type),ASN1_OCTET_STRING **))openssl_fcast(ASN1_pack_string))(obj,i2d,oct)
 ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct);
 
 void ASN1_STRING_set_default_mask(unsigned long mask);
 int ASN1_STRING_set_default_mask_asc(char *p);
 unsigned long ASN1_STRING_get_default_mask(void);
 int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,
-					int inform, unsigned long mask);
+                    int inform, unsigned long mask);
 int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
-					int inform, unsigned long mask, 
-					long minsize, long maxsize);
+                    int inform, unsigned long mask,
+                    long minsize, long maxsize);
 
-ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, 
-		const unsigned char *in, int inlen, int inform, int nid);
+ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out,
+        const unsigned char *in, int inlen, int inform, int nid);
 ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid);
 int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long);
 void ASN1_STRING_TABLE_cleanup(void);
@@ -1009,7 +1009,7 @@ void ASN1_add_oid_module(void);
 
 ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf);
 ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf);
-	
+
 /* BEGIN ERROR CODES */
 /* The following lines are auto generated by the script mkerr.pl. Any changes
  * made after this point may be overwritten when the script is next run.
@@ -1019,213 +1019,213 @@ void ERR_load_ASN1_strings(void);
 /* Error codes for the ASN1 functions. */
 
 /* Function codes. */
-#define ASN1_F_A2D_ASN1_OBJECT				 100
-#define ASN1_F_A2I_ASN1_ENUMERATED			 101
-#define ASN1_F_A2I_ASN1_INTEGER				 102
-#define ASN1_F_A2I_ASN1_STRING				 103
-#define ASN1_F_APPEND_EXP				 176
-#define ASN1_F_ASN1_BIT_STRING_SET_BIT			 183
-#define ASN1_F_ASN1_CB					 177
-#define ASN1_F_ASN1_CHECK_TLEN				 104
-#define ASN1_F_ASN1_COLLATE_PRIMITIVE			 105
-#define ASN1_F_ASN1_COLLECT				 106
-#define ASN1_F_ASN1_D2I_EX_PRIMITIVE			 108
-#define ASN1_F_ASN1_D2I_FP				 109
-#define ASN1_F_ASN1_D2I_READ_BIO			 107
-#define ASN1_F_ASN1_DIGEST				 184
-#define ASN1_F_ASN1_DO_ADB				 110
-#define ASN1_F_ASN1_DUP					 111
-#define ASN1_F_ASN1_ENUMERATED_SET			 112
-#define ASN1_F_ASN1_ENUMERATED_TO_BN			 113
-#define ASN1_F_ASN1_EX_C2I				 204
-#define ASN1_F_ASN1_FIND_END				 190
-#define ASN1_F_ASN1_GENERALIZEDTIME_SET			 185
-#define ASN1_F_ASN1_GENERATE_V3				 178
-#define ASN1_F_ASN1_GET_OBJECT				 114
-#define ASN1_F_ASN1_HEADER_NEW				 115
-#define ASN1_F_ASN1_I2D_BIO				 116
-#define ASN1_F_ASN1_I2D_FP				 117
-#define ASN1_F_ASN1_INTEGER_SET				 118
-#define ASN1_F_ASN1_INTEGER_TO_BN			 119
-#define ASN1_F_ASN1_ITEM_D2I_FP				 206
-#define ASN1_F_ASN1_ITEM_DUP				 191
-#define ASN1_F_ASN1_ITEM_EX_COMBINE_NEW			 121
-#define ASN1_F_ASN1_ITEM_EX_D2I				 120
-#define ASN1_F_ASN1_ITEM_I2D_BIO			 192
-#define ASN1_F_ASN1_ITEM_I2D_FP				 193
-#define ASN1_F_ASN1_ITEM_PACK				 198
-#define ASN1_F_ASN1_ITEM_SIGN				 195
-#define ASN1_F_ASN1_ITEM_UNPACK				 199
-#define ASN1_F_ASN1_ITEM_VERIFY				 197
-#define ASN1_F_ASN1_MBSTRING_NCOPY			 122
-#define ASN1_F_ASN1_OBJECT_NEW				 123
-#define ASN1_F_ASN1_PACK_STRING				 124
-#define ASN1_F_ASN1_PCTX_NEW				 205
-#define ASN1_F_ASN1_PKCS5_PBE_SET			 125
-#define ASN1_F_ASN1_SEQ_PACK				 126
-#define ASN1_F_ASN1_SEQ_UNPACK				 127
-#define ASN1_F_ASN1_SIGN				 128
-#define ASN1_F_ASN1_STR2TYPE				 179
-#define ASN1_F_ASN1_STRING_SET				 186
-#define ASN1_F_ASN1_STRING_TABLE_ADD			 129
-#define ASN1_F_ASN1_STRING_TYPE_NEW			 130
-#define ASN1_F_ASN1_TEMPLATE_EX_D2I			 132
-#define ASN1_F_ASN1_TEMPLATE_NEW			 133
-#define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I			 131
-#define ASN1_F_ASN1_TIME_SET				 175
-#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING		 134
-#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING		 135
-#define ASN1_F_ASN1_UNPACK_STRING			 136
-#define ASN1_F_ASN1_UTCTIME_SET				 187
-#define ASN1_F_ASN1_VERIFY				 137
-#define ASN1_F_BITSTR_CB				 180
-#define ASN1_F_BN_TO_ASN1_ENUMERATED			 138
-#define ASN1_F_BN_TO_ASN1_INTEGER			 139
-#define ASN1_F_C2I_ASN1_BIT_STRING			 189
-#define ASN1_F_C2I_ASN1_INTEGER				 194
-#define ASN1_F_C2I_ASN1_OBJECT				 196
-#define ASN1_F_COLLECT_DATA				 140
-#define ASN1_F_D2I_ASN1_BIT_STRING			 141
-#define ASN1_F_D2I_ASN1_BOOLEAN				 142
-#define ASN1_F_D2I_ASN1_BYTES				 143
-#define ASN1_F_D2I_ASN1_GENERALIZEDTIME			 144
-#define ASN1_F_D2I_ASN1_HEADER				 145
-#define ASN1_F_D2I_ASN1_INTEGER				 146
-#define ASN1_F_D2I_ASN1_OBJECT				 147
-#define ASN1_F_D2I_ASN1_SET				 148
-#define ASN1_F_D2I_ASN1_TYPE_BYTES			 149
-#define ASN1_F_D2I_ASN1_UINTEGER			 150
-#define ASN1_F_D2I_ASN1_UTCTIME				 151
-#define ASN1_F_D2I_NETSCAPE_RSA				 152
-#define ASN1_F_D2I_NETSCAPE_RSA_2			 153
-#define ASN1_F_D2I_PRIVATEKEY				 154
-#define ASN1_F_D2I_PUBLICKEY				 155
-#define ASN1_F_D2I_RSA_NET				 200
-#define ASN1_F_D2I_RSA_NET_2				 201
-#define ASN1_F_D2I_X509					 156
-#define ASN1_F_D2I_X509_CINF				 157
-#define ASN1_F_D2I_X509_PKEY				 159
-#define ASN1_F_I2D_ASN1_SET				 188
-#define ASN1_F_I2D_ASN1_TIME				 160
-#define ASN1_F_I2D_DSA_PUBKEY				 161
-#define ASN1_F_I2D_EC_PUBKEY				 181
-#define ASN1_F_I2D_PRIVATEKEY				 163
-#define ASN1_F_I2D_PUBLICKEY				 164
-#define ASN1_F_I2D_RSA_NET				 162
-#define ASN1_F_I2D_RSA_PUBKEY				 165
-#define ASN1_F_LONG_C2I					 166
-#define ASN1_F_OID_MODULE_INIT				 174
-#define ASN1_F_PARSE_TAGGING				 182
-#define ASN1_F_PKCS5_PBE2_SET				 167
-#define ASN1_F_PKCS5_PBE_SET				 202
-#define ASN1_F_X509_CINF_NEW				 168
-#define ASN1_F_X509_CRL_ADD0_REVOKED			 169
-#define ASN1_F_X509_INFO_NEW				 170
-#define ASN1_F_X509_NAME_ENCODE				 203
-#define ASN1_F_X509_NAME_EX_D2I				 158
-#define ASN1_F_X509_NAME_EX_NEW				 171
-#define ASN1_F_X509_NEW					 172
-#define ASN1_F_X509_PKEY_NEW				 173
+#define ASN1_F_A2D_ASN1_OBJECT               100
+#define ASN1_F_A2I_ASN1_ENUMERATED           101
+#define ASN1_F_A2I_ASN1_INTEGER              102
+#define ASN1_F_A2I_ASN1_STRING               103
+#define ASN1_F_APPEND_EXP                176
+#define ASN1_F_ASN1_BIT_STRING_SET_BIT           183
+#define ASN1_F_ASN1_CB                   177
+#define ASN1_F_ASN1_CHECK_TLEN               104
+#define ASN1_F_ASN1_COLLATE_PRIMITIVE            105
+#define ASN1_F_ASN1_COLLECT              106
+#define ASN1_F_ASN1_D2I_EX_PRIMITIVE             108
+#define ASN1_F_ASN1_D2I_FP               109
+#define ASN1_F_ASN1_D2I_READ_BIO             107
+#define ASN1_F_ASN1_DIGEST               184
+#define ASN1_F_ASN1_DO_ADB               110
+#define ASN1_F_ASN1_DUP                  111
+#define ASN1_F_ASN1_ENUMERATED_SET           112
+#define ASN1_F_ASN1_ENUMERATED_TO_BN             113
+#define ASN1_F_ASN1_EX_C2I               204
+#define ASN1_F_ASN1_FIND_END                 190
+#define ASN1_F_ASN1_GENERALIZEDTIME_SET          185
+#define ASN1_F_ASN1_GENERATE_V3              178
+#define ASN1_F_ASN1_GET_OBJECT               114
+#define ASN1_F_ASN1_HEADER_NEW               115
+#define ASN1_F_ASN1_I2D_BIO              116
+#define ASN1_F_ASN1_I2D_FP               117
+#define ASN1_F_ASN1_INTEGER_SET              118
+#define ASN1_F_ASN1_INTEGER_TO_BN            119
+#define ASN1_F_ASN1_ITEM_D2I_FP              206
+#define ASN1_F_ASN1_ITEM_DUP                 191
+#define ASN1_F_ASN1_ITEM_EX_COMBINE_NEW          121
+#define ASN1_F_ASN1_ITEM_EX_D2I              120
+#define ASN1_F_ASN1_ITEM_I2D_BIO             192
+#define ASN1_F_ASN1_ITEM_I2D_FP              193
+#define ASN1_F_ASN1_ITEM_PACK                198
+#define ASN1_F_ASN1_ITEM_SIGN                195
+#define ASN1_F_ASN1_ITEM_UNPACK              199
+#define ASN1_F_ASN1_ITEM_VERIFY              197
+#define ASN1_F_ASN1_MBSTRING_NCOPY           122
+#define ASN1_F_ASN1_OBJECT_NEW               123
+#define ASN1_F_ASN1_PACK_STRING              124
+#define ASN1_F_ASN1_PCTX_NEW                 205
+#define ASN1_F_ASN1_PKCS5_PBE_SET            125
+#define ASN1_F_ASN1_SEQ_PACK                 126
+#define ASN1_F_ASN1_SEQ_UNPACK               127
+#define ASN1_F_ASN1_SIGN                 128
+#define ASN1_F_ASN1_STR2TYPE                 179
+#define ASN1_F_ASN1_STRING_SET               186
+#define ASN1_F_ASN1_STRING_TABLE_ADD             129
+#define ASN1_F_ASN1_STRING_TYPE_NEW          130
+#define ASN1_F_ASN1_TEMPLATE_EX_D2I          132
+#define ASN1_F_ASN1_TEMPLATE_NEW             133
+#define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I           131
+#define ASN1_F_ASN1_TIME_SET                 175
+#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING         134
+#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING         135
+#define ASN1_F_ASN1_UNPACK_STRING            136
+#define ASN1_F_ASN1_UTCTIME_SET              187
+#define ASN1_F_ASN1_VERIFY               137
+#define ASN1_F_BITSTR_CB                 180
+#define ASN1_F_BN_TO_ASN1_ENUMERATED             138
+#define ASN1_F_BN_TO_ASN1_INTEGER            139
+#define ASN1_F_C2I_ASN1_BIT_STRING           189
+#define ASN1_F_C2I_ASN1_INTEGER              194
+#define ASN1_F_C2I_ASN1_OBJECT               196
+#define ASN1_F_COLLECT_DATA              140
+#define ASN1_F_D2I_ASN1_BIT_STRING           141
+#define ASN1_F_D2I_ASN1_BOOLEAN              142
+#define ASN1_F_D2I_ASN1_BYTES                143
+#define ASN1_F_D2I_ASN1_GENERALIZEDTIME          144
+#define ASN1_F_D2I_ASN1_HEADER               145
+#define ASN1_F_D2I_ASN1_INTEGER              146
+#define ASN1_F_D2I_ASN1_OBJECT               147
+#define ASN1_F_D2I_ASN1_SET              148
+#define ASN1_F_D2I_ASN1_TYPE_BYTES           149
+#define ASN1_F_D2I_ASN1_UINTEGER             150
+#define ASN1_F_D2I_ASN1_UTCTIME              151
+#define ASN1_F_D2I_NETSCAPE_RSA              152
+#define ASN1_F_D2I_NETSCAPE_RSA_2            153
+#define ASN1_F_D2I_PRIVATEKEY                154
+#define ASN1_F_D2I_PUBLICKEY                 155
+#define ASN1_F_D2I_RSA_NET               200
+#define ASN1_F_D2I_RSA_NET_2                 201
+#define ASN1_F_D2I_X509                  156
+#define ASN1_F_D2I_X509_CINF                 157
+#define ASN1_F_D2I_X509_PKEY                 159
+#define ASN1_F_I2D_ASN1_SET              188
+#define ASN1_F_I2D_ASN1_TIME                 160
+#define ASN1_F_I2D_DSA_PUBKEY                161
+#define ASN1_F_I2D_EC_PUBKEY                 181
+#define ASN1_F_I2D_PRIVATEKEY                163
+#define ASN1_F_I2D_PUBLICKEY                 164
+#define ASN1_F_I2D_RSA_NET               162
+#define ASN1_F_I2D_RSA_PUBKEY                165
+#define ASN1_F_LONG_C2I                  166
+#define ASN1_F_OID_MODULE_INIT               174
+#define ASN1_F_PARSE_TAGGING                 182
+#define ASN1_F_PKCS5_PBE2_SET                167
+#define ASN1_F_PKCS5_PBE_SET                 202
+#define ASN1_F_X509_CINF_NEW                 168
+#define ASN1_F_X509_CRL_ADD0_REVOKED             169
+#define ASN1_F_X509_INFO_NEW                 170
+#define ASN1_F_X509_NAME_ENCODE              203
+#define ASN1_F_X509_NAME_EX_D2I              158
+#define ASN1_F_X509_NAME_EX_NEW              171
+#define ASN1_F_X509_NEW                  172
+#define ASN1_F_X509_PKEY_NEW                 173
 
 /* Reason codes. */
-#define ASN1_R_ADDING_OBJECT				 171
-#define ASN1_R_AUX_ERROR				 100
-#define ASN1_R_BAD_CLASS				 101
-#define ASN1_R_BAD_OBJECT_HEADER			 102
-#define ASN1_R_BAD_PASSWORD_READ			 103
-#define ASN1_R_BAD_TAG					 104
-#define ASN1_R_BN_LIB					 105
-#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH			 106
-#define ASN1_R_BUFFER_TOO_SMALL				 107
-#define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER		 108
-#define ASN1_R_DATA_IS_WRONG				 109
-#define ASN1_R_DECODE_ERROR				 110
-#define ASN1_R_DECODING_ERROR				 111
-#define ASN1_R_DEPTH_EXCEEDED				 174
-#define ASN1_R_ENCODE_ERROR				 112
-#define ASN1_R_ERROR_GETTING_TIME			 173
-#define ASN1_R_ERROR_LOADING_SECTION			 172
-#define ASN1_R_ERROR_PARSING_SET_ELEMENT		 113
-#define ASN1_R_ERROR_SETTING_CIPHER_PARAMS		 114
-#define ASN1_R_EXPECTING_AN_INTEGER			 115
-#define ASN1_R_EXPECTING_AN_OBJECT			 116
-#define ASN1_R_EXPECTING_A_BOOLEAN			 117
-#define ASN1_R_EXPECTING_A_TIME				 118
-#define ASN1_R_EXPLICIT_LENGTH_MISMATCH			 119
-#define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED		 120
-#define ASN1_R_FIELD_MISSING				 121
-#define ASN1_R_FIRST_NUM_TOO_LARGE			 122
-#define ASN1_R_HEADER_TOO_LONG				 123
-#define ASN1_R_ILLEGAL_BITSTRING_FORMAT			 175
-#define ASN1_R_ILLEGAL_BOOLEAN				 176
-#define ASN1_R_ILLEGAL_CHARACTERS			 124
-#define ASN1_R_ILLEGAL_FORMAT				 177
-#define ASN1_R_ILLEGAL_HEX				 178
-#define ASN1_R_ILLEGAL_IMPLICIT_TAG			 179
-#define ASN1_R_ILLEGAL_INTEGER				 180
-#define ASN1_R_ILLEGAL_NESTED_TAGGING			 181
-#define ASN1_R_ILLEGAL_NULL				 125
-#define ASN1_R_ILLEGAL_NULL_VALUE			 182
-#define ASN1_R_ILLEGAL_OBJECT				 183
-#define ASN1_R_ILLEGAL_OPTIONAL_ANY			 126
-#define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE		 170
-#define ASN1_R_ILLEGAL_TAGGED_ANY			 127
-#define ASN1_R_ILLEGAL_TIME_VALUE			 184
-#define ASN1_R_INTEGER_NOT_ASCII_FORMAT			 185
-#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG		 128
-#define ASN1_R_INVALID_BMPSTRING_LENGTH			 129
-#define ASN1_R_INVALID_DIGIT				 130
-#define ASN1_R_INVALID_MODIFIER				 186
-#define ASN1_R_INVALID_NUMBER				 187
-#define ASN1_R_INVALID_SEPARATOR			 131
-#define ASN1_R_INVALID_TIME_FORMAT			 132
-#define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH		 133
-#define ASN1_R_INVALID_UTF8STRING			 134
-#define ASN1_R_IV_TOO_LARGE				 135
-#define ASN1_R_LENGTH_ERROR				 136
-#define ASN1_R_LIST_ERROR				 188
-#define ASN1_R_MISSING_EOC				 137
-#define ASN1_R_MISSING_SECOND_NUMBER			 138
-#define ASN1_R_MISSING_VALUE				 189
-#define ASN1_R_MSTRING_NOT_UNIVERSAL			 139
-#define ASN1_R_MSTRING_WRONG_TAG			 140
-#define ASN1_R_NESTED_ASN1_STRING			 197
-#define ASN1_R_NON_HEX_CHARACTERS			 141
-#define ASN1_R_NOT_ASCII_FORMAT				 190
-#define ASN1_R_NOT_ENOUGH_DATA				 142
-#define ASN1_R_NO_MATCHING_CHOICE_TYPE			 143
-#define ASN1_R_NULL_IS_WRONG_LENGTH			 144
-#define ASN1_R_OBJECT_NOT_ASCII_FORMAT			 191
-#define ASN1_R_ODD_NUMBER_OF_CHARS			 145
-#define ASN1_R_PRIVATE_KEY_HEADER_MISSING		 146
-#define ASN1_R_SECOND_NUMBER_TOO_LARGE			 147
-#define ASN1_R_SEQUENCE_LENGTH_MISMATCH			 148
-#define ASN1_R_SEQUENCE_NOT_CONSTRUCTED			 149
-#define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG		 192
-#define ASN1_R_SHORT_LINE				 150
-#define ASN1_R_STRING_TOO_LONG				 151
-#define ASN1_R_STRING_TOO_SHORT				 152
-#define ASN1_R_TAG_VALUE_TOO_HIGH			 153
+#define ASN1_R_ADDING_OBJECT                 171
+#define ASN1_R_AUX_ERROR                 100
+#define ASN1_R_BAD_CLASS                 101
+#define ASN1_R_BAD_OBJECT_HEADER             102
+#define ASN1_R_BAD_PASSWORD_READ             103
+#define ASN1_R_BAD_TAG                   104
+#define ASN1_R_BN_LIB                    105
+#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH           106
+#define ASN1_R_BUFFER_TOO_SMALL              107
+#define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER       108
+#define ASN1_R_DATA_IS_WRONG                 109
+#define ASN1_R_DECODE_ERROR              110
+#define ASN1_R_DECODING_ERROR                111
+#define ASN1_R_DEPTH_EXCEEDED                174
+#define ASN1_R_ENCODE_ERROR              112
+#define ASN1_R_ERROR_GETTING_TIME            173
+#define ASN1_R_ERROR_LOADING_SECTION             172
+#define ASN1_R_ERROR_PARSING_SET_ELEMENT         113
+#define ASN1_R_ERROR_SETTING_CIPHER_PARAMS       114
+#define ASN1_R_EXPECTING_AN_INTEGER          115
+#define ASN1_R_EXPECTING_AN_OBJECT           116
+#define ASN1_R_EXPECTING_A_BOOLEAN           117
+#define ASN1_R_EXPECTING_A_TIME              118
+#define ASN1_R_EXPLICIT_LENGTH_MISMATCH          119
+#define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED      120
+#define ASN1_R_FIELD_MISSING                 121
+#define ASN1_R_FIRST_NUM_TOO_LARGE           122
+#define ASN1_R_HEADER_TOO_LONG               123
+#define ASN1_R_ILLEGAL_BITSTRING_FORMAT          175
+#define ASN1_R_ILLEGAL_BOOLEAN               176
+#define ASN1_R_ILLEGAL_CHARACTERS            124
+#define ASN1_R_ILLEGAL_FORMAT                177
+#define ASN1_R_ILLEGAL_HEX               178
+#define ASN1_R_ILLEGAL_IMPLICIT_TAG          179
+#define ASN1_R_ILLEGAL_INTEGER               180
+#define ASN1_R_ILLEGAL_NESTED_TAGGING            181
+#define ASN1_R_ILLEGAL_NULL              125
+#define ASN1_R_ILLEGAL_NULL_VALUE            182
+#define ASN1_R_ILLEGAL_OBJECT                183
+#define ASN1_R_ILLEGAL_OPTIONAL_ANY          126
+#define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE      170
+#define ASN1_R_ILLEGAL_TAGGED_ANY            127
+#define ASN1_R_ILLEGAL_TIME_VALUE            184
+#define ASN1_R_INTEGER_NOT_ASCII_FORMAT          185
+#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG        128
+#define ASN1_R_INVALID_BMPSTRING_LENGTH          129
+#define ASN1_R_INVALID_DIGIT                 130
+#define ASN1_R_INVALID_MODIFIER              186
+#define ASN1_R_INVALID_NUMBER                187
+#define ASN1_R_INVALID_SEPARATOR             131
+#define ASN1_R_INVALID_TIME_FORMAT           132
+#define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH        133
+#define ASN1_R_INVALID_UTF8STRING            134
+#define ASN1_R_IV_TOO_LARGE              135
+#define ASN1_R_LENGTH_ERROR              136
+#define ASN1_R_LIST_ERROR                188
+#define ASN1_R_MISSING_EOC               137
+#define ASN1_R_MISSING_SECOND_NUMBER             138
+#define ASN1_R_MISSING_VALUE                 189
+#define ASN1_R_MSTRING_NOT_UNIVERSAL             139
+#define ASN1_R_MSTRING_WRONG_TAG             140
+#define ASN1_R_NESTED_ASN1_STRING            197
+#define ASN1_R_NON_HEX_CHARACTERS            141
+#define ASN1_R_NOT_ASCII_FORMAT              190
+#define ASN1_R_NOT_ENOUGH_DATA               142
+#define ASN1_R_NO_MATCHING_CHOICE_TYPE           143
+#define ASN1_R_NULL_IS_WRONG_LENGTH          144
+#define ASN1_R_OBJECT_NOT_ASCII_FORMAT           191
+#define ASN1_R_ODD_NUMBER_OF_CHARS           145
+#define ASN1_R_PRIVATE_KEY_HEADER_MISSING        146
+#define ASN1_R_SECOND_NUMBER_TOO_LARGE           147
+#define ASN1_R_SEQUENCE_LENGTH_MISMATCH          148
+#define ASN1_R_SEQUENCE_NOT_CONSTRUCTED          149
+#define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG      192
+#define ASN1_R_SHORT_LINE                150
+#define ASN1_R_STRING_TOO_LONG               151
+#define ASN1_R_STRING_TOO_SHORT              152
+#define ASN1_R_TAG_VALUE_TOO_HIGH            153
 #define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154
-#define ASN1_R_TIME_NOT_ASCII_FORMAT			 193
-#define ASN1_R_TOO_LONG					 155
-#define ASN1_R_TYPE_NOT_CONSTRUCTED			 156
-#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY			 157
-#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY		 158
-#define ASN1_R_UNEXPECTED_EOC				 159
-#define ASN1_R_UNKNOWN_FORMAT				 160
-#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM		 161
-#define ASN1_R_UNKNOWN_OBJECT_TYPE			 162
-#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE			 163
-#define ASN1_R_UNKNOWN_TAG				 194
-#define ASN1_R_UNKOWN_FORMAT				 195
-#define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE		 164
-#define ASN1_R_UNSUPPORTED_CIPHER			 165
-#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM		 166
-#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE		 167
-#define ASN1_R_UNSUPPORTED_TYPE				 196
-#define ASN1_R_WRONG_TAG				 168
-#define ASN1_R_WRONG_TYPE				 169
+#define ASN1_R_TIME_NOT_ASCII_FORMAT             193
+#define ASN1_R_TOO_LONG                  155
+#define ASN1_R_TYPE_NOT_CONSTRUCTED          156
+#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY          157
+#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY      158
+#define ASN1_R_UNEXPECTED_EOC                159
+#define ASN1_R_UNKNOWN_FORMAT                160
+#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM      161
+#define ASN1_R_UNKNOWN_OBJECT_TYPE           162
+#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE           163
+#define ASN1_R_UNKNOWN_TAG               194
+#define ASN1_R_UNKOWN_FORMAT                 195
+#define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE       164
+#define ASN1_R_UNSUPPORTED_CIPHER            165
+#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM      166
+#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE       167
+#define ASN1_R_UNSUPPORTED_TYPE              196
+#define ASN1_R_WRONG_TAG                 168
+#define ASN1_R_WRONG_TYPE                169
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/asn1_mac.h b/dep/include/openssl/asn1_mac.h
index d958ca60d9d..d826460a065 100644
--- a/dep/include/openssl/asn1_mac.h
+++ b/dep/include/openssl/asn1_mac.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -66,501 +66,501 @@ extern "C" {
 #endif
 
 #ifndef ASN1_MAC_ERR_LIB
-#define ASN1_MAC_ERR_LIB	ERR_LIB_ASN1
-#endif 
+#define ASN1_MAC_ERR_LIB    ERR_LIB_ASN1
+#endif
 
 #define ASN1_MAC_H_err(f,r,line) \
-	ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),__FILE__,(line))
+    ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),__FILE__,(line))
 
 #define M_ASN1_D2I_vars(a,type,func) \
-	ASN1_const_CTX c; \
-	type ret=NULL; \
-	\
-	c.pp=(const unsigned char **)pp; \
-	c.q= *(const unsigned char **)pp; \
-	c.error=ERR_R_NESTED_ASN1_ERROR; \
-	if ((a == NULL) || ((*a) == NULL)) \
-		{ if ((ret=(type)func()) == NULL) \
-			{ c.line=__LINE__; goto err; } } \
-	else	ret=(*a);
+    ASN1_const_CTX c; \
+    type ret=NULL; \
+    \
+    c.pp=(const unsigned char **)pp; \
+    c.q= *(const unsigned char **)pp; \
+    c.error=ERR_R_NESTED_ASN1_ERROR; \
+    if ((a == NULL) || ((*a) == NULL)) \
+        { if ((ret=(type)func()) == NULL) \
+            { c.line=__LINE__; goto err; } } \
+    else    ret=(*a);
 
 #define M_ASN1_D2I_Init() \
-	c.p= *(const unsigned char **)pp; \
-	c.max=(length == 0)?0:(c.p+length);
+    c.p= *(const unsigned char **)pp; \
+    c.max=(length == 0)?0:(c.p+length);
 
 #define M_ASN1_D2I_Finish_2(a) \
-	if (!asn1_const_Finish(&c)) \
-		{ c.line=__LINE__; goto err; } \
-	*(const unsigned char **)pp=c.p; \
-	if (a != NULL) (*a)=ret; \
-	return(ret);
+    if (!asn1_const_Finish(&c)) \
+        { c.line=__LINE__; goto err; } \
+    *(const unsigned char **)pp=c.p; \
+    if (a != NULL) (*a)=ret; \
+    return(ret);
 
 #define M_ASN1_D2I_Finish(a,func,e) \
-	M_ASN1_D2I_Finish_2(a); \
+    M_ASN1_D2I_Finish_2(a); \
 err:\
-	ASN1_MAC_H_err((e),c.error,c.line); \
-	asn1_add_error(*(const unsigned char **)pp,(int)(c.q- *pp)); \
-	if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \
-	return(NULL)
+    ASN1_MAC_H_err((e),c.error,c.line); \
+    asn1_add_error(*(const unsigned char **)pp,(int)(c.q- *pp)); \
+    if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \
+    return(NULL)
 
 #define M_ASN1_D2I_start_sequence() \
-	if (!asn1_GetSequence(&c,&length)) \
-		{ c.line=__LINE__; goto err; }
+    if (!asn1_GetSequence(&c,&length)) \
+        { c.line=__LINE__; goto err; }
 /* Begin reading ASN1 without a surrounding sequence */
 #define M_ASN1_D2I_begin() \
-	c.slen = length;
+    c.slen = length;
 
 /* End reading ASN1 with no check on length */
 #define M_ASN1_D2I_Finish_nolen(a, func, e) \
-	*pp=c.p; \
-	if (a != NULL) (*a)=ret; \
-	return(ret); \
+    *pp=c.p; \
+    if (a != NULL) (*a)=ret; \
+    return(ret); \
 err:\
-	ASN1_MAC_H_err((e),c.error,c.line); \
-	asn1_add_error(*pp,(int)(c.q- *pp)); \
-	if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \
-	return(NULL)
+    ASN1_MAC_H_err((e),c.error,c.line); \
+    asn1_add_error(*pp,(int)(c.q- *pp)); \
+    if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \
+    return(NULL)
 
 #define M_ASN1_D2I_end_sequence() \
-	(((c.inf&1) == 0)?(c.slen <= 0): \
-		(c.eos=ASN1_const_check_infinite_end(&c.p,c.slen)))
+    (((c.inf&1) == 0)?(c.slen <= 0): \
+        (c.eos=ASN1_const_check_infinite_end(&c.p,c.slen)))
 
 /* Don't use this with d2i_ASN1_BOOLEAN() */
 #define M_ASN1_D2I_get(b, func) \
-	c.q=c.p; \
-	if (func(&(b),&c.p,c.slen) == NULL) \
-		{c.line=__LINE__; goto err; } \
-	c.slen-=(c.p-c.q);
+    c.q=c.p; \
+    if (func(&(b),&c.p,c.slen) == NULL) \
+        {c.line=__LINE__; goto err; } \
+    c.slen-=(c.p-c.q);
 
 /* Don't use this with d2i_ASN1_BOOLEAN() */
 #define M_ASN1_D2I_get_x(type,b,func) \
-	c.q=c.p; \
-	if (((D2I_OF(type))func)(&(b),&c.p,c.slen) == NULL) \
-		{c.line=__LINE__; goto err; } \
-	c.slen-=(c.p-c.q);
+    c.q=c.p; \
+    if (((D2I_OF(type))func)(&(b),&c.p,c.slen) == NULL) \
+        {c.line=__LINE__; goto err; } \
+    c.slen-=(c.p-c.q);
 
 /* use this instead () */
 #define M_ASN1_D2I_get_int(b,func) \
-	c.q=c.p; \
-	if (func(&(b),&c.p,c.slen) < 0) \
-		{c.line=__LINE__; goto err; } \
-	c.slen-=(c.p-c.q);
+    c.q=c.p; \
+    if (func(&(b),&c.p,c.slen) < 0) \
+        {c.line=__LINE__; goto err; } \
+    c.slen-=(c.p-c.q);
 
 #define M_ASN1_D2I_get_opt(b,func,type) \
-	if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) \
-		== (V_ASN1_UNIVERSAL|(type)))) \
-		{ \
-		M_ASN1_D2I_get(b,func); \
-		}
+    if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) \
+        == (V_ASN1_UNIVERSAL|(type)))) \
+        { \
+        M_ASN1_D2I_get(b,func); \
+        }
 
 #define M_ASN1_D2I_get_imp(b,func, type) \
-	M_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \
-	c.q=c.p; \
-	if (func(&(b),&c.p,c.slen) == NULL) \
-		{c.line=__LINE__; M_ASN1_next_prev = _tmp; goto err; } \
-	c.slen-=(c.p-c.q);\
-	M_ASN1_next_prev=_tmp;
+    M_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \
+    c.q=c.p; \
+    if (func(&(b),&c.p,c.slen) == NULL) \
+        {c.line=__LINE__; M_ASN1_next_prev = _tmp; goto err; } \
+    c.slen-=(c.p-c.q);\
+    M_ASN1_next_prev=_tmp;
 
 #define M_ASN1_D2I_get_IMP_opt(b,func,tag,type) \
-	if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) == \
-		(V_ASN1_CONTEXT_SPECIFIC|(tag)))) \
-		{ \
-		unsigned char _tmp = M_ASN1_next; \
-		M_ASN1_D2I_get_imp(b,func, type);\
-		}
+    if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) == \
+        (V_ASN1_CONTEXT_SPECIFIC|(tag)))) \
+        { \
+        unsigned char _tmp = M_ASN1_next; \
+        M_ASN1_D2I_get_imp(b,func, type);\
+        }
 
 #define M_ASN1_D2I_get_set(r,func,free_func) \
-		M_ASN1_D2I_get_imp_set(r,func,free_func, \
-			V_ASN1_SET,V_ASN1_UNIVERSAL);
+        M_ASN1_D2I_get_imp_set(r,func,free_func, \
+            V_ASN1_SET,V_ASN1_UNIVERSAL);
 
 #define M_ASN1_D2I_get_set_type(type,r,func,free_func) \
-		M_ASN1_D2I_get_imp_set_type(type,r,func,free_func, \
-			V_ASN1_SET,V_ASN1_UNIVERSAL);
+        M_ASN1_D2I_get_imp_set_type(type,r,func,free_func, \
+            V_ASN1_SET,V_ASN1_UNIVERSAL);
 
 #define M_ASN1_D2I_get_set_opt(r,func,free_func) \
-	if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
-		V_ASN1_CONSTRUCTED|V_ASN1_SET)))\
-		{ M_ASN1_D2I_get_set(r,func,free_func); }
+    if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
+        V_ASN1_CONSTRUCTED|V_ASN1_SET)))\
+        { M_ASN1_D2I_get_set(r,func,free_func); }
 
 #define M_ASN1_D2I_get_set_opt_type(type,r,func,free_func) \
-	if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
-		V_ASN1_CONSTRUCTED|V_ASN1_SET)))\
-		{ M_ASN1_D2I_get_set_type(type,r,func,free_func); }
+    if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
+        V_ASN1_CONSTRUCTED|V_ASN1_SET)))\
+        { M_ASN1_D2I_get_set_type(type,r,func,free_func); }
 
 #define M_ASN1_I2D_len_SET_opt(a,f) \
-	if ((a != NULL) && (sk_num(a) != 0)) \
-		M_ASN1_I2D_len_SET(a,f);
+    if ((a != NULL) && (sk_num(a) != 0)) \
+        M_ASN1_I2D_len_SET(a,f);
 
 #define M_ASN1_I2D_put_SET_opt(a,f) \
-	if ((a != NULL) && (sk_num(a) != 0)) \
-		M_ASN1_I2D_put_SET(a,f);
+    if ((a != NULL) && (sk_num(a) != 0)) \
+        M_ASN1_I2D_put_SET(a,f);
 
 #define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \
-	if ((a != NULL) && (sk_num(a) != 0)) \
-		M_ASN1_I2D_put_SEQUENCE(a,f);
+    if ((a != NULL) && (sk_num(a) != 0)) \
+        M_ASN1_I2D_put_SEQUENCE(a,f);
 
 #define M_ASN1_I2D_put_SEQUENCE_opt_type(type,a,f) \
-	if ((a != NULL) && (sk_##type##_num(a) != 0)) \
-		M_ASN1_I2D_put_SEQUENCE_type(type,a,f);
+    if ((a != NULL) && (sk_##type##_num(a) != 0)) \
+        M_ASN1_I2D_put_SEQUENCE_type(type,a,f);
 
 #define M_ASN1_D2I_get_IMP_set_opt(b,func,free_func,tag) \
-	if ((c.slen != 0) && \
-		(M_ASN1_next == \
-		(V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\
-		{ \
-		M_ASN1_D2I_get_imp_set(b,func,free_func,\
-			tag,V_ASN1_CONTEXT_SPECIFIC); \
-		}
+    if ((c.slen != 0) && \
+        (M_ASN1_next == \
+        (V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\
+        { \
+        M_ASN1_D2I_get_imp_set(b,func,free_func,\
+            tag,V_ASN1_CONTEXT_SPECIFIC); \
+        }
 
 #define M_ASN1_D2I_get_IMP_set_opt_type(type,b,func,free_func,tag) \
-	if ((c.slen != 0) && \
-		(M_ASN1_next == \
-		(V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\
-		{ \
-		M_ASN1_D2I_get_imp_set_type(type,b,func,free_func,\
-			tag,V_ASN1_CONTEXT_SPECIFIC); \
-		}
+    if ((c.slen != 0) && \
+        (M_ASN1_next == \
+        (V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\
+        { \
+        M_ASN1_D2I_get_imp_set_type(type,b,func,free_func,\
+            tag,V_ASN1_CONTEXT_SPECIFIC); \
+        }
 
 #define M_ASN1_D2I_get_seq(r,func,free_func) \
-		M_ASN1_D2I_get_imp_set(r,func,free_func,\
-			V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
+        M_ASN1_D2I_get_imp_set(r,func,free_func,\
+            V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
 
 #define M_ASN1_D2I_get_seq_type(type,r,func,free_func) \
-		M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\
-					    V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL)
+        M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\
+                        V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL)
 
 #define M_ASN1_D2I_get_seq_opt(r,func,free_func) \
-	if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
-		V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\
-		{ M_ASN1_D2I_get_seq(r,func,free_func); }
+    if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
+        V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\
+        { M_ASN1_D2I_get_seq(r,func,free_func); }
 
 #define M_ASN1_D2I_get_seq_opt_type(type,r,func,free_func) \
-	if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
-		V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\
-		{ M_ASN1_D2I_get_seq_type(type,r,func,free_func); }
+    if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
+        V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\
+        { M_ASN1_D2I_get_seq_type(type,r,func,free_func); }
 
 #define M_ASN1_D2I_get_IMP_set(r,func,free_func,x) \
-		M_ASN1_D2I_get_imp_set(r,func,free_func,\
-			x,V_ASN1_CONTEXT_SPECIFIC);
+        M_ASN1_D2I_get_imp_set(r,func,free_func,\
+            x,V_ASN1_CONTEXT_SPECIFIC);
 
 #define M_ASN1_D2I_get_IMP_set_type(type,r,func,free_func,x) \
-		M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\
-			x,V_ASN1_CONTEXT_SPECIFIC);
+        M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\
+            x,V_ASN1_CONTEXT_SPECIFIC);
 
 #define M_ASN1_D2I_get_imp_set(r,func,free_func,a,b) \
-	c.q=c.p; \
-	if (d2i_ASN1_SET(&(r),&c.p,c.slen,(char *(*)())func,\
-		(void (*)())free_func,a,b) == NULL) \
-		{ c.line=__LINE__; goto err; } \
-	c.slen-=(c.p-c.q);
+    c.q=c.p; \
+    if (d2i_ASN1_SET(&(r),&c.p,c.slen,(char *(*)())func,\
+        (void (*)())free_func,a,b) == NULL) \
+        { c.line=__LINE__; goto err; } \
+    c.slen-=(c.p-c.q);
 
 #define M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,a,b) \
-	c.q=c.p; \
-	if (d2i_ASN1_SET_OF_##type(&(r),&c.p,c.slen,func,\
-				   free_func,a,b) == NULL) \
-		{ c.line=__LINE__; goto err; } \
-	c.slen-=(c.p-c.q);
+    c.q=c.p; \
+    if (d2i_ASN1_SET_OF_##type(&(r),&c.p,c.slen,func,\
+                   free_func,a,b) == NULL) \
+        { c.line=__LINE__; goto err; } \
+    c.slen-=(c.p-c.q);
 
 #define M_ASN1_D2I_get_set_strings(r,func,a,b) \
-	c.q=c.p; \
-	if (d2i_ASN1_STRING_SET(&(r),&c.p,c.slen,a,b) == NULL) \
-		{ c.line=__LINE__; goto err; } \
-	c.slen-=(c.p-c.q);
+    c.q=c.p; \
+    if (d2i_ASN1_STRING_SET(&(r),&c.p,c.slen,a,b) == NULL) \
+        { c.line=__LINE__; goto err; } \
+    c.slen-=(c.p-c.q);
 
 #define M_ASN1_D2I_get_EXP_opt(r,func,tag) \
-	if ((c.slen != 0L) && (M_ASN1_next == \
-		(V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \
-		{ \
-		int Tinf,Ttag,Tclass; \
-		long Tlen; \
-		\
-		c.q=c.p; \
-		Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
-		if (Tinf & 0x80) \
-			{ c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
-			c.line=__LINE__; goto err; } \
-		if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
-					Tlen = c.slen - (c.p - c.q) - 2; \
-		if (func(&(r),&c.p,Tlen) == NULL) \
-			{ c.line=__LINE__; goto err; } \
-		if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
-			Tlen = c.slen - (c.p - c.q); \
-			if(!ASN1_const_check_infinite_end(&c.p, Tlen)) \
-				{ c.error=ERR_R_MISSING_ASN1_EOS; \
-				c.line=__LINE__; goto err; } \
-		}\
-		c.slen-=(c.p-c.q); \
-		}
+    if ((c.slen != 0L) && (M_ASN1_next == \
+        (V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \
+        { \
+        int Tinf,Ttag,Tclass; \
+        long Tlen; \
+        \
+        c.q=c.p; \
+        Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
+        if (Tinf & 0x80) \
+            { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
+            c.line=__LINE__; goto err; } \
+        if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
+                    Tlen = c.slen - (c.p - c.q) - 2; \
+        if (func(&(r),&c.p,Tlen) == NULL) \
+            { c.line=__LINE__; goto err; } \
+        if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
+            Tlen = c.slen - (c.p - c.q); \
+            if(!ASN1_const_check_infinite_end(&c.p, Tlen)) \
+                { c.error=ERR_R_MISSING_ASN1_EOS; \
+                c.line=__LINE__; goto err; } \
+        }\
+        c.slen-=(c.p-c.q); \
+        }
 
 #define M_ASN1_D2I_get_EXP_set_opt(r,func,free_func,tag,b) \
-	if ((c.slen != 0) && (M_ASN1_next == \
-		(V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \
-		{ \
-		int Tinf,Ttag,Tclass; \
-		long Tlen; \
-		\
-		c.q=c.p; \
-		Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
-		if (Tinf & 0x80) \
-			{ c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
-			c.line=__LINE__; goto err; } \
-		if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
-					Tlen = c.slen - (c.p - c.q) - 2; \
-		if (d2i_ASN1_SET(&(r),&c.p,Tlen,(char *(*)())func, \
-			(void (*)())free_func, \
-			b,V_ASN1_UNIVERSAL) == NULL) \
-			{ c.line=__LINE__; goto err; } \
-		if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
-			Tlen = c.slen - (c.p - c.q); \
-			if(!ASN1_check_infinite_end(&c.p, Tlen)) \
-				{ c.error=ERR_R_MISSING_ASN1_EOS; \
-				c.line=__LINE__; goto err; } \
-		}\
-		c.slen-=(c.p-c.q); \
-		}
+    if ((c.slen != 0) && (M_ASN1_next == \
+        (V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \
+        { \
+        int Tinf,Ttag,Tclass; \
+        long Tlen; \
+        \
+        c.q=c.p; \
+        Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
+        if (Tinf & 0x80) \
+            { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
+            c.line=__LINE__; goto err; } \
+        if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
+                    Tlen = c.slen - (c.p - c.q) - 2; \
+        if (d2i_ASN1_SET(&(r),&c.p,Tlen,(char *(*)())func, \
+            (void (*)())free_func, \
+            b,V_ASN1_UNIVERSAL) == NULL) \
+            { c.line=__LINE__; goto err; } \
+        if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
+            Tlen = c.slen - (c.p - c.q); \
+            if(!ASN1_check_infinite_end(&c.p, Tlen)) \
+                { c.error=ERR_R_MISSING_ASN1_EOS; \
+                c.line=__LINE__; goto err; } \
+        }\
+        c.slen-=(c.p-c.q); \
+        }
 
 #define M_ASN1_D2I_get_EXP_set_opt_type(type,r,func,free_func,tag,b) \
-	if ((c.slen != 0) && (M_ASN1_next == \
-		(V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \
-		{ \
-		int Tinf,Ttag,Tclass; \
-		long Tlen; \
-		\
-		c.q=c.p; \
-		Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
-		if (Tinf & 0x80) \
-			{ c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
-			c.line=__LINE__; goto err; } \
-		if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
-					Tlen = c.slen - (c.p - c.q) - 2; \
-		if (d2i_ASN1_SET_OF_##type(&(r),&c.p,Tlen,func, \
-			free_func,b,V_ASN1_UNIVERSAL) == NULL) \
-			{ c.line=__LINE__; goto err; } \
-		if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
-			Tlen = c.slen - (c.p - c.q); \
-			if(!ASN1_check_infinite_end(&c.p, Tlen)) \
-				{ c.error=ERR_R_MISSING_ASN1_EOS; \
-				c.line=__LINE__; goto err; } \
-		}\
-		c.slen-=(c.p-c.q); \
-		}
+    if ((c.slen != 0) && (M_ASN1_next == \
+        (V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \
+        { \
+        int Tinf,Ttag,Tclass; \
+        long Tlen; \
+        \
+        c.q=c.p; \
+        Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
+        if (Tinf & 0x80) \
+            { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
+            c.line=__LINE__; goto err; } \
+        if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
+                    Tlen = c.slen - (c.p - c.q) - 2; \
+        if (d2i_ASN1_SET_OF_##type(&(r),&c.p,Tlen,func, \
+            free_func,b,V_ASN1_UNIVERSAL) == NULL) \
+            { c.line=__LINE__; goto err; } \
+        if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
+            Tlen = c.slen - (c.p - c.q); \
+            if(!ASN1_check_infinite_end(&c.p, Tlen)) \
+                { c.error=ERR_R_MISSING_ASN1_EOS; \
+                c.line=__LINE__; goto err; } \
+        }\
+        c.slen-=(c.p-c.q); \
+        }
 
 /* New macros */
 #define M_ASN1_New_Malloc(ret,type) \
-	if ((ret=(type *)OPENSSL_malloc(sizeof(type))) == NULL) \
-		{ c.line=__LINE__; goto err2; }
+    if ((ret=(type *)OPENSSL_malloc(sizeof(type))) == NULL) \
+        { c.line=__LINE__; goto err2; }
 
 #define M_ASN1_New(arg,func) \
-	if (((arg)=func()) == NULL) return(NULL)
+    if (((arg)=func()) == NULL) return(NULL)
 
 #define M_ASN1_New_Error(a) \
-/*	err:	ASN1_MAC_H_err((a),ERR_R_NESTED_ASN1_ERROR,c.line); \
-		return(NULL);*/ \
-	err2:	ASN1_MAC_H_err((a),ERR_R_MALLOC_FAILURE,c.line); \
-		return(NULL)
+/*  err:    ASN1_MAC_H_err((a),ERR_R_NESTED_ASN1_ERROR,c.line); \
+        return(NULL);*/ \
+    err2:   ASN1_MAC_H_err((a),ERR_R_MALLOC_FAILURE,c.line); \
+        return(NULL)
 
 
 /* BIG UGLY WARNING!  This is so damn ugly I wanna puke.  Unfortunately,
    some macros that use ASN1_const_CTX still insist on writing in the input
    stream.  ARGH!  ARGH!  ARGH!  Let's get rid of this macro package.
-   Please?						-- Richard Levitte */
-#define M_ASN1_next		(*((unsigned char *)(c.p)))
-#define M_ASN1_next_prev	(*((unsigned char *)(c.q)))
+   Please?                      -- Richard Levitte */
+#define M_ASN1_next     (*((unsigned char *)(c.p)))
+#define M_ASN1_next_prev    (*((unsigned char *)(c.q)))
 
 /*************************************************/
 
-#define M_ASN1_I2D_vars(a)	int r=0,ret=0; \
-				unsigned char *p; \
-				if (a == NULL) return(0)
+#define M_ASN1_I2D_vars(a)  int r=0,ret=0; \
+                unsigned char *p; \
+                if (a == NULL) return(0)
 
 /* Length Macros */
-#define M_ASN1_I2D_len(a,f)	ret+=f(a,NULL)
-#define M_ASN1_I2D_len_IMP_opt(a,f)	if (a != NULL) M_ASN1_I2D_len(a,f)
+#define M_ASN1_I2D_len(a,f) ret+=f(a,NULL)
+#define M_ASN1_I2D_len_IMP_opt(a,f) if (a != NULL) M_ASN1_I2D_len(a,f)
 
 #define M_ASN1_I2D_len_SET(a,f) \
-		ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET);
+        ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET);
 
 #define M_ASN1_I2D_len_SET_type(type,a,f) \
-		ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SET, \
-					    V_ASN1_UNIVERSAL,IS_SET);
+        ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SET, \
+                        V_ASN1_UNIVERSAL,IS_SET);
 
 #define M_ASN1_I2D_len_SEQUENCE(a,f) \
-		ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \
-				  IS_SEQUENCE);
+        ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \
+                  IS_SEQUENCE);
 
 #define M_ASN1_I2D_len_SEQUENCE_type(type,a,f) \
-		ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SEQUENCE, \
-					    V_ASN1_UNIVERSAL,IS_SEQUENCE)
+        ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SEQUENCE, \
+                        V_ASN1_UNIVERSAL,IS_SEQUENCE)
 
 #define M_ASN1_I2D_len_SEQUENCE_opt(a,f) \
-		if ((a != NULL) && (sk_num(a) != 0)) \
-			M_ASN1_I2D_len_SEQUENCE(a,f);
+        if ((a != NULL) && (sk_num(a) != 0)) \
+            M_ASN1_I2D_len_SEQUENCE(a,f);
 
 #define M_ASN1_I2D_len_SEQUENCE_opt_type(type,a,f) \
-		if ((a != NULL) && (sk_##type##_num(a) != 0)) \
-			M_ASN1_I2D_len_SEQUENCE_type(type,a,f);
+        if ((a != NULL) && (sk_##type##_num(a) != 0)) \
+            M_ASN1_I2D_len_SEQUENCE_type(type,a,f);
 
 #define M_ASN1_I2D_len_IMP_SET(a,f,x) \
-		ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET);
+        ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET);
 
 #define M_ASN1_I2D_len_IMP_SET_type(type,a,f,x) \
-		ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
-					    V_ASN1_CONTEXT_SPECIFIC,IS_SET);
+        ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
+                        V_ASN1_CONTEXT_SPECIFIC,IS_SET);
 
 #define M_ASN1_I2D_len_IMP_SET_opt(a,f,x) \
-		if ((a != NULL) && (sk_num(a) != 0)) \
-			ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
-					  IS_SET);
+        if ((a != NULL) && (sk_num(a) != 0)) \
+            ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
+                      IS_SET);
 
 #define M_ASN1_I2D_len_IMP_SET_opt_type(type,a,f,x) \
-		if ((a != NULL) && (sk_##type##_num(a) != 0)) \
-			ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
-					       V_ASN1_CONTEXT_SPECIFIC,IS_SET);
+        if ((a != NULL) && (sk_##type##_num(a) != 0)) \
+            ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
+                           V_ASN1_CONTEXT_SPECIFIC,IS_SET);
 
 #define M_ASN1_I2D_len_IMP_SEQUENCE(a,f,x) \
-		ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
-				  IS_SEQUENCE);
+        ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
+                  IS_SEQUENCE);
 
 #define M_ASN1_I2D_len_IMP_SEQUENCE_opt(a,f,x) \
-		if ((a != NULL) && (sk_num(a) != 0)) \
-			ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
-					  IS_SEQUENCE);
+        if ((a != NULL) && (sk_num(a) != 0)) \
+            ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
+                      IS_SEQUENCE);
 
 #define M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(type,a,f,x) \
-		if ((a != NULL) && (sk_##type##_num(a) != 0)) \
-			ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
-						    V_ASN1_CONTEXT_SPECIFIC, \
-						    IS_SEQUENCE);
+        if ((a != NULL) && (sk_##type##_num(a) != 0)) \
+            ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
+                            V_ASN1_CONTEXT_SPECIFIC, \
+                            IS_SEQUENCE);
 
 #define M_ASN1_I2D_len_EXP_opt(a,f,mtag,v) \
-		if (a != NULL)\
-			{ \
-			v=f(a,NULL); \
-			ret+=ASN1_object_size(1,v,mtag); \
-			}
+        if (a != NULL)\
+            { \
+            v=f(a,NULL); \
+            ret+=ASN1_object_size(1,v,mtag); \
+            }
 
 #define M_ASN1_I2D_len_EXP_SET_opt(a,f,mtag,tag,v) \
-		if ((a != NULL) && (sk_num(a) != 0))\
-			{ \
-			v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL,IS_SET); \
-			ret+=ASN1_object_size(1,v,mtag); \
-			}
+        if ((a != NULL) && (sk_num(a) != 0))\
+            { \
+            v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL,IS_SET); \
+            ret+=ASN1_object_size(1,v,mtag); \
+            }
 
 #define M_ASN1_I2D_len_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \
-		if ((a != NULL) && (sk_num(a) != 0))\
-			{ \
-			v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL, \
-				       IS_SEQUENCE); \
-			ret+=ASN1_object_size(1,v,mtag); \
-			}
+        if ((a != NULL) && (sk_num(a) != 0))\
+            { \
+            v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL, \
+                       IS_SEQUENCE); \
+            ret+=ASN1_object_size(1,v,mtag); \
+            }
 
 #define M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \
-		if ((a != NULL) && (sk_##type##_num(a) != 0))\
-			{ \
-			v=i2d_ASN1_SET_OF_##type(a,NULL,f,tag, \
-						 V_ASN1_UNIVERSAL, \
-						 IS_SEQUENCE); \
-			ret+=ASN1_object_size(1,v,mtag); \
-			}
+        if ((a != NULL) && (sk_##type##_num(a) != 0))\
+            { \
+            v=i2d_ASN1_SET_OF_##type(a,NULL,f,tag, \
+                         V_ASN1_UNIVERSAL, \
+                         IS_SEQUENCE); \
+            ret+=ASN1_object_size(1,v,mtag); \
+            }
 
 /* Put Macros */
-#define M_ASN1_I2D_put(a,f)	f(a,&p)
+#define M_ASN1_I2D_put(a,f) f(a,&p)
 
-#define M_ASN1_I2D_put_IMP_opt(a,f,t)	\
-		if (a != NULL) \
-			{ \
-			unsigned char *q=p; \
-			f(a,&p); \
-			*q=(V_ASN1_CONTEXT_SPECIFIC|t|(*q&V_ASN1_CONSTRUCTED));\
-			}
+#define M_ASN1_I2D_put_IMP_opt(a,f,t)   \
+        if (a != NULL) \
+            { \
+            unsigned char *q=p; \
+            f(a,&p); \
+            *q=(V_ASN1_CONTEXT_SPECIFIC|t|(*q&V_ASN1_CONSTRUCTED));\
+            }
 
 #define M_ASN1_I2D_put_SET(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SET,\
-			V_ASN1_UNIVERSAL,IS_SET)
+            V_ASN1_UNIVERSAL,IS_SET)
 #define M_ASN1_I2D_put_SET_type(type,a,f) \
      i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET)
 #define M_ASN1_I2D_put_IMP_SET(a,f,x) i2d_ASN1_SET(a,&p,f,x,\
-			V_ASN1_CONTEXT_SPECIFIC,IS_SET)
+            V_ASN1_CONTEXT_SPECIFIC,IS_SET)
 #define M_ASN1_I2D_put_IMP_SET_type(type,a,f,x) \
      i2d_ASN1_SET_OF_##type(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET)
 #define M_ASN1_I2D_put_IMP_SEQUENCE(a,f,x) i2d_ASN1_SET(a,&p,f,x,\
-			V_ASN1_CONTEXT_SPECIFIC,IS_SEQUENCE)
+            V_ASN1_CONTEXT_SPECIFIC,IS_SEQUENCE)
 
 #define M_ASN1_I2D_put_SEQUENCE(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SEQUENCE,\
-					     V_ASN1_UNIVERSAL,IS_SEQUENCE)
+                         V_ASN1_UNIVERSAL,IS_SEQUENCE)
 
 #define M_ASN1_I2D_put_SEQUENCE_type(type,a,f) \
      i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \
-			    IS_SEQUENCE)
+                IS_SEQUENCE)
 
 #define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \
-		if ((a != NULL) && (sk_num(a) != 0)) \
-			M_ASN1_I2D_put_SEQUENCE(a,f);
+        if ((a != NULL) && (sk_num(a) != 0)) \
+            M_ASN1_I2D_put_SEQUENCE(a,f);
 
 #define M_ASN1_I2D_put_IMP_SET_opt(a,f,x) \
-		if ((a != NULL) && (sk_num(a) != 0)) \
-			{ i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \
-				       IS_SET); }
+        if ((a != NULL) && (sk_num(a) != 0)) \
+            { i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \
+                       IS_SET); }
 
 #define M_ASN1_I2D_put_IMP_SET_opt_type(type,a,f,x) \
-		if ((a != NULL) && (sk_##type##_num(a) != 0)) \
-			{ i2d_ASN1_SET_OF_##type(a,&p,f,x, \
-						 V_ASN1_CONTEXT_SPECIFIC, \
-						 IS_SET); }
+        if ((a != NULL) && (sk_##type##_num(a) != 0)) \
+            { i2d_ASN1_SET_OF_##type(a,&p,f,x, \
+                         V_ASN1_CONTEXT_SPECIFIC, \
+                         IS_SET); }
 
 #define M_ASN1_I2D_put_IMP_SEQUENCE_opt(a,f,x) \
-		if ((a != NULL) && (sk_num(a) != 0)) \
-			{ i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \
-				       IS_SEQUENCE); }
+        if ((a != NULL) && (sk_num(a) != 0)) \
+            { i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \
+                       IS_SEQUENCE); }
 
 #define M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(type,a,f,x) \
-		if ((a != NULL) && (sk_##type##_num(a) != 0)) \
-			{ i2d_ASN1_SET_OF_##type(a,&p,f,x, \
-						 V_ASN1_CONTEXT_SPECIFIC, \
-						 IS_SEQUENCE); }
+        if ((a != NULL) && (sk_##type##_num(a) != 0)) \
+            { i2d_ASN1_SET_OF_##type(a,&p,f,x, \
+                         V_ASN1_CONTEXT_SPECIFIC, \
+                         IS_SEQUENCE); }
 
 #define M_ASN1_I2D_put_EXP_opt(a,f,tag,v) \
-		if (a != NULL) \
-			{ \
-			ASN1_put_object(&p,1,v,tag,V_ASN1_CONTEXT_SPECIFIC); \
-			f(a,&p); \
-			}
+        if (a != NULL) \
+            { \
+            ASN1_put_object(&p,1,v,tag,V_ASN1_CONTEXT_SPECIFIC); \
+            f(a,&p); \
+            }
 
 #define M_ASN1_I2D_put_EXP_SET_opt(a,f,mtag,tag,v) \
-		if ((a != NULL) && (sk_num(a) != 0)) \
-			{ \
-			ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \
-			i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SET); \
-			}
+        if ((a != NULL) && (sk_num(a) != 0)) \
+            { \
+            ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \
+            i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SET); \
+            }
 
 #define M_ASN1_I2D_put_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \
-		if ((a != NULL) && (sk_num(a) != 0)) \
-			{ \
-			ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \
-			i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SEQUENCE); \
-			}
+        if ((a != NULL) && (sk_num(a) != 0)) \
+            { \
+            ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \
+            i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SEQUENCE); \
+            }
 
 #define M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \
-		if ((a != NULL) && (sk_##type##_num(a) != 0)) \
-			{ \
-			ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \
-			i2d_ASN1_SET_OF_##type(a,&p,f,tag,V_ASN1_UNIVERSAL, \
-					       IS_SEQUENCE); \
-			}
+        if ((a != NULL) && (sk_##type##_num(a) != 0)) \
+            { \
+            ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \
+            i2d_ASN1_SET_OF_##type(a,&p,f,tag,V_ASN1_UNIVERSAL, \
+                           IS_SEQUENCE); \
+            }
 
 #define M_ASN1_I2D_seq_total() \
-		r=ASN1_object_size(1,ret,V_ASN1_SEQUENCE); \
-		if (pp == NULL) return(r); \
-		p= *pp; \
-		ASN1_put_object(&p,1,ret,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL)
+        r=ASN1_object_size(1,ret,V_ASN1_SEQUENCE); \
+        if (pp == NULL) return(r); \
+        p= *pp; \
+        ASN1_put_object(&p,1,ret,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL)
 
 #define M_ASN1_I2D_INF_seq_start(tag,ctx) \
-		*(p++)=(V_ASN1_CONSTRUCTED|(tag)|(ctx)); \
-		*(p++)=0x80
+        *(p++)=(V_ASN1_CONSTRUCTED|(tag)|(ctx)); \
+        *(p++)=0x80
 
 #define M_ASN1_I2D_INF_seq_end() *(p++)=0x00; *(p++)=0x00
 
-#define M_ASN1_I2D_finish()	*pp=p; \
-				return(r);
+#define M_ASN1_I2D_finish() *pp=p; \
+                return(r);
 
 int asn1_GetSequence(ASN1_const_CTX *c, long *length);
 void asn1_add_error(const unsigned char *address,int offset);
diff --git a/dep/include/openssl/asn1t.h b/dep/include/openssl/asn1t.h
index adbc2a63dd0..1efb83cd256 100644
--- a/dep/include/openssl/asn1t.h
+++ b/dep/include/openssl/asn1t.h
@@ -10,7 +10,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -83,10 +83,10 @@ extern "C" {
 /* Macros for start and end of ASN1_ITEM definition */
 
 #define ASN1_ITEM_start(itname) \
-	OPENSSL_GLOBAL const ASN1_ITEM itname##_it = {
+    OPENSSL_GLOBAL const ASN1_ITEM itname##_it = {
 
 #define ASN1_ITEM_end(itname) \
-		};
+        };
 
 #else
 
@@ -97,14 +97,14 @@ extern "C" {
 /* Macros for start and end of ASN1_ITEM definition */
 
 #define ASN1_ITEM_start(itname) \
-	const ASN1_ITEM * itname##_it(void) \
-	{ \
-		static const ASN1_ITEM local_it = { 
+    const ASN1_ITEM * itname##_it(void) \
+    { \
+        static const ASN1_ITEM local_it = {
 
 #define ASN1_ITEM_end(itname) \
-		}; \
-	return &local_it; \
-	}
+        }; \
+    return &local_it; \
+    }
 
 #endif
 
@@ -112,90 +112,90 @@ extern "C" {
 /* Macros to aid ASN1 template writing */
 
 #define ASN1_ITEM_TEMPLATE(tname) \
-	static const ASN1_TEMPLATE tname##_item_tt 
+    static const ASN1_TEMPLATE tname##_item_tt
 
 #define ASN1_ITEM_TEMPLATE_END(tname) \
-	;\
-	ASN1_ITEM_start(tname) \
-		ASN1_ITYPE_PRIMITIVE,\
-		-1,\
-		&tname##_item_tt,\
-		0,\
-		NULL,\
-		0,\
-		#tname \
-	ASN1_ITEM_end(tname)
+    ;\
+    ASN1_ITEM_start(tname) \
+        ASN1_ITYPE_PRIMITIVE,\
+        -1,\
+        &tname##_item_tt,\
+        0,\
+        NULL,\
+        0,\
+        #tname \
+    ASN1_ITEM_end(tname)
 
 
 /* This is a ASN1 type which just embeds a template */
- 
+
 /* This pair helps declare a SEQUENCE. We can do:
  *
- * 	ASN1_SEQUENCE(stname) = {
- * 		... SEQUENCE components ...
- * 	} ASN1_SEQUENCE_END(stname)
+ *  ASN1_SEQUENCE(stname) = {
+ *      ... SEQUENCE components ...
+ *  } ASN1_SEQUENCE_END(stname)
  *
- * 	This will produce an ASN1_ITEM called stname_it
- *	for a structure called stname.
+ *  This will produce an ASN1_ITEM called stname_it
+ *  for a structure called stname.
  *
- * 	If you want the same structure but a different
- *	name then use:
+ *  If you want the same structure but a different
+ *  name then use:
  *
- * 	ASN1_SEQUENCE(itname) = {
- * 		... SEQUENCE components ...
- * 	} ASN1_SEQUENCE_END_name(stname, itname)
+ *  ASN1_SEQUENCE(itname) = {
+ *      ... SEQUENCE components ...
+ *  } ASN1_SEQUENCE_END_name(stname, itname)
  *
- *	This will create an item called itname_it using
- *	a structure called stname.
+ *  This will create an item called itname_it using
+ *  a structure called stname.
  */
 
 #define ASN1_SEQUENCE(tname) \
-	static const ASN1_TEMPLATE tname##_seq_tt[] 
+    static const ASN1_TEMPLATE tname##_seq_tt[]
 
 #define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname)
 
 #define ASN1_SEQUENCE_END_name(stname, tname) \
-	;\
-	ASN1_ITEM_start(tname) \
-		ASN1_ITYPE_SEQUENCE,\
-		V_ASN1_SEQUENCE,\
-		tname##_seq_tt,\
-		sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
-		NULL,\
-		sizeof(stname),\
-		#stname \
-	ASN1_ITEM_end(tname)
+    ;\
+    ASN1_ITEM_start(tname) \
+        ASN1_ITYPE_SEQUENCE,\
+        V_ASN1_SEQUENCE,\
+        tname##_seq_tt,\
+        sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
+        NULL,\
+        sizeof(stname),\
+        #stname \
+    ASN1_ITEM_end(tname)
 
 #define ASN1_NDEF_SEQUENCE(tname) \
-	ASN1_SEQUENCE(tname)
+    ASN1_SEQUENCE(tname)
 
 #define ASN1_SEQUENCE_cb(tname, cb) \
-	static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \
-	ASN1_SEQUENCE(tname)
+    static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \
+    ASN1_SEQUENCE(tname)
 
 #define ASN1_BROKEN_SEQUENCE(tname) \
-	static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \
-	ASN1_SEQUENCE(tname)
+    static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \
+    ASN1_SEQUENCE(tname)
 
 #define ASN1_SEQUENCE_ref(tname, cb, lck) \
-	static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), lck, cb, 0}; \
-	ASN1_SEQUENCE(tname)
+    static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), lck, cb, 0}; \
+    ASN1_SEQUENCE(tname)
 
 #define ASN1_SEQUENCE_enc(tname, enc, cb) \
-	static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \
-	ASN1_SEQUENCE(tname)
+    static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \
+    ASN1_SEQUENCE(tname)
 
 #define ASN1_NDEF_SEQUENCE_END(tname) \
-	;\
-	ASN1_ITEM_start(tname) \
-		ASN1_ITYPE_NDEF_SEQUENCE,\
-		V_ASN1_SEQUENCE,\
-		tname##_seq_tt,\
-		sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
-		NULL,\
-		sizeof(tname),\
-		#tname \
-	ASN1_ITEM_end(tname)
+    ;\
+    ASN1_ITEM_start(tname) \
+        ASN1_ITYPE_NDEF_SEQUENCE,\
+        V_ASN1_SEQUENCE,\
+        tname##_seq_tt,\
+        sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
+        NULL,\
+        sizeof(tname),\
+        #tname \
+    ASN1_ITEM_end(tname)
 
 #define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname)
 
@@ -204,101 +204,101 @@ extern "C" {
 #define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
 
 #define ASN1_SEQUENCE_END_ref(stname, tname) \
-	;\
-	ASN1_ITEM_start(tname) \
-		ASN1_ITYPE_SEQUENCE,\
-		V_ASN1_SEQUENCE,\
-		tname##_seq_tt,\
-		sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
-		&tname##_aux,\
-		sizeof(stname),\
-		#stname \
-	ASN1_ITEM_end(tname)
+    ;\
+    ASN1_ITEM_start(tname) \
+        ASN1_ITYPE_SEQUENCE,\
+        V_ASN1_SEQUENCE,\
+        tname##_seq_tt,\
+        sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
+        &tname##_aux,\
+        sizeof(stname),\
+        #stname \
+    ASN1_ITEM_end(tname)
 
 
 /* This pair helps declare a CHOICE type. We can do:
  *
- * 	ASN1_CHOICE(chname) = {
- * 		... CHOICE options ...
- * 	ASN1_CHOICE_END(chname)
+ *  ASN1_CHOICE(chname) = {
+ *      ... CHOICE options ...
+ *  ASN1_CHOICE_END(chname)
  *
- * 	This will produce an ASN1_ITEM called chname_it
- *	for a structure called chname. The structure
- *	definition must look like this:
- *	typedef struct {
- *		int type;
- *		union {
- *			ASN1_SOMETHING *opt1;
- *			ASN1_SOMEOTHER *opt2;
- *		} value;
- *	} chname;
- *	
- *	the name of the selector must be 'type'.
- * 	to use an alternative selector name use the
+ *  This will produce an ASN1_ITEM called chname_it
+ *  for a structure called chname. The structure
+ *  definition must look like this:
+ *  typedef struct {
+ *      int type;
+ *      union {
+ *          ASN1_SOMETHING *opt1;
+ *          ASN1_SOMEOTHER *opt2;
+ *      } value;
+ *  } chname;
+ *
+ *  the name of the selector must be 'type'.
+ *  to use an alternative selector name use the
  *      ASN1_CHOICE_END_selector() version.
  */
 
 #define ASN1_CHOICE(tname) \
-	static const ASN1_TEMPLATE tname##_ch_tt[] 
+    static const ASN1_TEMPLATE tname##_ch_tt[]
 
 #define ASN1_CHOICE_cb(tname, cb) \
-	static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \
-	ASN1_CHOICE(tname)
+    static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \
+    ASN1_CHOICE(tname)
 
 #define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname)
 
 #define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type)
 
 #define ASN1_CHOICE_END_selector(stname, tname, selname) \
-	;\
-	ASN1_ITEM_start(tname) \
-		ASN1_ITYPE_CHOICE,\
-		offsetof(stname,selname) ,\
-		tname##_ch_tt,\
-		sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
-		NULL,\
-		sizeof(stname),\
-		#stname \
-	ASN1_ITEM_end(tname)
+    ;\
+    ASN1_ITEM_start(tname) \
+        ASN1_ITYPE_CHOICE,\
+        offsetof(stname,selname) ,\
+        tname##_ch_tt,\
+        sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
+        NULL,\
+        sizeof(stname),\
+        #stname \
+    ASN1_ITEM_end(tname)
 
 #define ASN1_CHOICE_END_cb(stname, tname, selname) \
-	;\
-	ASN1_ITEM_start(tname) \
-		ASN1_ITYPE_CHOICE,\
-		offsetof(stname,selname) ,\
-		tname##_ch_tt,\
-		sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
-		&tname##_aux,\
-		sizeof(stname),\
-		#stname \
-	ASN1_ITEM_end(tname)
+    ;\
+    ASN1_ITEM_start(tname) \
+        ASN1_ITYPE_CHOICE,\
+        offsetof(stname,selname) ,\
+        tname##_ch_tt,\
+        sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
+        &tname##_aux,\
+        sizeof(stname),\
+        #stname \
+    ASN1_ITEM_end(tname)
 
 /* This helps with the template wrapper form of ASN1_ITEM */
 
 #define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \
-	(flags), (tag), 0,\
-	#name, ASN1_ITEM_ref(type) }
+    (flags), (tag), 0,\
+    #name, ASN1_ITEM_ref(type) }
 
 /* These help with SEQUENCE or CHOICE components */
 
 /* used to declare other types */
 
 #define ASN1_EX_TYPE(flags, tag, stname, field, type) { \
-	(flags), (tag), offsetof(stname, field),\
-	#field, ASN1_ITEM_ref(type) }
+    (flags), (tag), offsetof(stname, field),\
+    #field, ASN1_ITEM_ref(type) }
 
 /* used when the structure is combined with the parent */
 
 #define ASN1_EX_COMBINE(flags, tag, type) { \
-	(flags)|ASN1_TFLG_COMBINE, (tag), 0, NULL, ASN1_ITEM_ref(type) }
+    (flags)|ASN1_TFLG_COMBINE, (tag), 0, NULL, ASN1_ITEM_ref(type) }
 
 /* implicit and explicit helper macros */
 
 #define ASN1_IMP_EX(stname, field, type, tag, ex) \
-		ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | ex, tag, stname, field, type)
+        ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | ex, tag, stname, field, type)
 
 #define ASN1_EXP_EX(stname, field, type, tag, ex) \
-		ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | ex, tag, stname, field, type)
+        ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | ex, tag, stname, field, type)
 
 /* Any defined by macros: the field used is in the table itself */
 
@@ -328,95 +328,95 @@ extern "C" {
 
 /* SEQUENCE OF type */
 #define ASN1_SEQUENCE_OF(stname, field, type) \
-		ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type)
+        ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type)
 
 /* OPTIONAL SEQUENCE OF */
 #define ASN1_SEQUENCE_OF_OPT(stname, field, type) \
-		ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type)
+        ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type)
 
 /* Same as above but for SET OF */
 
 #define ASN1_SET_OF(stname, field, type) \
-		ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type)
+        ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type)
 
 #define ASN1_SET_OF_OPT(stname, field, type) \
-		ASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type)
+        ASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type)
 
 /* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */
 
 #define ASN1_IMP_SET_OF(stname, field, type, tag) \
-			ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF)
+            ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF)
 
 #define ASN1_EXP_SET_OF(stname, field, type, tag) \
-			ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF)
+            ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF)
 
 #define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \
-			ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL)
+            ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL)
 
 #define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \
-			ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL)
+            ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL)
 
 #define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \
-			ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF)
+            ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF)
 
 #define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \
-			ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)
+            ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)
 
 #define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \
-			ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF)
+            ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF)
 
 #define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \
-			ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)
+            ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)
 
 /* EXPLICIT OPTIONAL using indefinite length constructed form */
 #define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \
-			ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF)
+            ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF)
 
 /* Macros for the ASN1_ADB structure */
 
 #define ASN1_ADB(name) \
-	static const ASN1_ADB_TABLE name##_adbtbl[] 
+    static const ASN1_ADB_TABLE name##_adbtbl[]
 
 #ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
 
 #define ASN1_ADB_END(name, flags, field, app_table, def, none) \
-	;\
-	static const ASN1_ADB name##_adb = {\
-		flags,\
-		offsetof(name, field),\
-		app_table,\
-		name##_adbtbl,\
-		sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
-		def,\
-		none\
-	}
+    ;\
+    static const ASN1_ADB name##_adb = {\
+        flags,\
+        offsetof(name, field),\
+        app_table,\
+        name##_adbtbl,\
+        sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
+        def,\
+        none\
+    }
 
 #else
 
 #define ASN1_ADB_END(name, flags, field, app_table, def, none) \
-	;\
-	static const ASN1_ITEM *name##_adb(void) \
-	{ \
-	static const ASN1_ADB internal_adb = \
-		{\
-		flags,\
-		offsetof(name, field),\
-		app_table,\
-		name##_adbtbl,\
-		sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
-		def,\
-		none\
-		}; \
-		return (const ASN1_ITEM *) &internal_adb; \
-	} \
-	void dummy_function(void)
+    ;\
+    static const ASN1_ITEM *name##_adb(void) \
+    { \
+    static const ASN1_ADB internal_adb = \
+        {\
+        flags,\
+        offsetof(name, field),\
+        app_table,\
+        name##_adbtbl,\
+        sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
+        def,\
+        none\
+        }; \
+        return (const ASN1_ITEM *) &internal_adb; \
+    } \
+    void dummy_function(void)
 
 #endif
 
 #define ADB_ENTRY(val, template) {val, template}
 
 #define ASN1_ADB_TEMPLATE(name) \
-	static const ASN1_TEMPLATE name##_tt 
+    static const ASN1_TEMPLATE name##_tt
 
 /* This is the ASN1 template structure that defines
  * a wrapper round the actual type. It determines the
@@ -425,13 +425,13 @@ extern "C" {
  */
 
 struct ASN1_TEMPLATE_st {
-unsigned long flags;		/* Various flags */
-long tag;			/* tag, not used if no tagging */
-unsigned long offset;		/* Offset of this field in structure */
+unsigned long flags;        /* Various flags */
+long tag;           /* tag, not used if no tagging */
+unsigned long offset;       /* Offset of this field in structure */
 #ifndef NO_ASN1_FIELD_NAMES
-const char *field_name;		/* Field name */
+const char *field_name;     /* Field name */
 #endif
-ASN1_ITEM_EXP *item;		/* Relevant ASN1_ITEM or ASN1_ADB */
+ASN1_ITEM_EXP *item;        /* Relevant ASN1_ITEM or ASN1_ADB */
 };
 
 /* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */
@@ -443,40 +443,40 @@ typedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE;
 typedef struct ASN1_ADB_st ASN1_ADB;
 
 struct ASN1_ADB_st {
-	unsigned long flags;	/* Various flags */
-	unsigned long offset;	/* Offset of selector field */
-	STACK_OF(ASN1_ADB_TABLE) **app_items; /* Application defined items */
-	const ASN1_ADB_TABLE *tbl;	/* Table of possible types */
-	long tblcount;		/* Number of entries in tbl */
-	const ASN1_TEMPLATE *default_tt;  /* Type to use if no match */
-	const ASN1_TEMPLATE *null_tt;  /* Type to use if selector is NULL */
+    unsigned long flags;    /* Various flags */
+    unsigned long offset;   /* Offset of selector field */
+    STACK_OF(ASN1_ADB_TABLE) **app_items; /* Application defined items */
+    const ASN1_ADB_TABLE *tbl;  /* Table of possible types */
+    long tblcount;      /* Number of entries in tbl */
+    const ASN1_TEMPLATE *default_tt;  /* Type to use if no match */
+    const ASN1_TEMPLATE *null_tt;  /* Type to use if selector is NULL */
 };
 
 struct ASN1_ADB_TABLE_st {
-	long value;		/* NID for an object or value for an int */
-	const ASN1_TEMPLATE tt;		/* item for this value */
+    long value;     /* NID for an object or value for an int */
+    const ASN1_TEMPLATE tt;     /* item for this value */
 };
 
 /* template flags */
 
 /* Field is optional */
-#define ASN1_TFLG_OPTIONAL	(0x1)
+#define ASN1_TFLG_OPTIONAL  (0x1)
 
 /* Field is a SET OF */
-#define ASN1_TFLG_SET_OF	(0x1 << 1)
+#define ASN1_TFLG_SET_OF    (0x1 << 1)
 
 /* Field is a SEQUENCE OF */
-#define ASN1_TFLG_SEQUENCE_OF	(0x2 << 1)
+#define ASN1_TFLG_SEQUENCE_OF   (0x2 << 1)
 
 /* Special case: this refers to a SET OF that
  * will be sorted into DER order when encoded *and*
  * the corresponding STACK will be modified to match
  * the new order.
  */
-#define ASN1_TFLG_SET_ORDER	(0x3 << 1)
+#define ASN1_TFLG_SET_ORDER (0x3 << 1)
 
 /* Mask for SET OF or SEQUENCE OF */
-#define ASN1_TFLG_SK_MASK	(0x3 << 1)
+#define ASN1_TFLG_SK_MASK   (0x3 << 1)
 
 /* These flags mean the tag should be taken from the
  * tag field. If EXPLICIT then the underlying type
@@ -484,36 +484,36 @@ struct ASN1_ADB_TABLE_st {
  */
 
 /* IMPLICIT tagging */
-#define ASN1_TFLG_IMPTAG	(0x1 << 3)
+#define ASN1_TFLG_IMPTAG    (0x1 << 3)
 
 
 /* EXPLICIT tagging, inner tag from underlying type */
-#define ASN1_TFLG_EXPTAG	(0x2 << 3)
+#define ASN1_TFLG_EXPTAG    (0x2 << 3)
 
-#define ASN1_TFLG_TAG_MASK	(0x3 << 3)
+#define ASN1_TFLG_TAG_MASK  (0x3 << 3)
 
 /* context specific IMPLICIT */
-#define ASN1_TFLG_IMPLICIT	ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT
+#define ASN1_TFLG_IMPLICIT  ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT
 
 /* context specific EXPLICIT */
-#define ASN1_TFLG_EXPLICIT	ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT
+#define ASN1_TFLG_EXPLICIT  ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT
 
 /* If tagging is in force these determine the
  * type of tag to use. Otherwise the tag is
- * determined by the underlying type. These 
+ * determined by the underlying type. These
  * values reflect the actual octet format.
  */
 
-/* Universal tag */ 
-#define ASN1_TFLG_UNIVERSAL	(0x0<<6)
-/* Application tag */ 
-#define ASN1_TFLG_APPLICATION	(0x1<<6)
-/* Context specific tag */ 
-#define ASN1_TFLG_CONTEXT	(0x2<<6)
-/* Private tag */ 
-#define ASN1_TFLG_PRIVATE	(0x3<<6)
+/* Universal tag */
+#define ASN1_TFLG_UNIVERSAL (0x0<<6)
+/* Application tag */
+#define ASN1_TFLG_APPLICATION   (0x1<<6)
+/* Context specific tag */
+#define ASN1_TFLG_CONTEXT   (0x2<<6)
+/* Private tag */
+#define ASN1_TFLG_PRIVATE   (0x3<<6)
 
-#define ASN1_TFLG_TAG_CLASS	(0x3<<6)
+#define ASN1_TFLG_TAG_CLASS (0x3<<6)
 
 /* These are for ANY DEFINED BY type. In this case
  * the 'item' field points to an ASN1_ADB structure
@@ -521,11 +521,11 @@ struct ASN1_ADB_TABLE_st {
  * relevant type
  */
 
-#define ASN1_TFLG_ADB_MASK	(0x3<<8)
+#define ASN1_TFLG_ADB_MASK  (0x3<<8)
 
-#define ASN1_TFLG_ADB_OID	(0x1<<8)
+#define ASN1_TFLG_ADB_OID   (0x1<<8)
 
-#define ASN1_TFLG_ADB_INT	(0x1<<9)
+#define ASN1_TFLG_ADB_INT   (0x1<<9)
 
 /* This flag means a parent structure is passed
  * instead of the field: this is useful is a
@@ -535,26 +535,26 @@ struct ASN1_ADB_TABLE_st {
  * ASN1_CHOICE_END_name() macro for example.
  */
 
-#define ASN1_TFLG_COMBINE	(0x1<<10)
+#define ASN1_TFLG_COMBINE   (0x1<<10)
 
 /* This flag when present in a SEQUENCE OF, SET OF
  * or EXPLICIT causes indefinite length constructed
  * encoding to be used if required.
  */
 
-#define ASN1_TFLG_NDEF		(0x1<<11)
+#define ASN1_TFLG_NDEF      (0x1<<11)
 
 /* This is the actual ASN1 item itself */
 
 struct ASN1_ITEM_st {
-char itype;			/* The item type, primitive, SEQUENCE, CHOICE or extern */
-long utype;			/* underlying type */
-const ASN1_TEMPLATE *templates;	/* If SEQUENCE or CHOICE this contains the contents */
-long tcount;			/* Number of templates if SEQUENCE or CHOICE */
-const void *funcs;		/* functions that handle this type */
-long size;			/* Structure size (usually)*/
+char itype;         /* The item type, primitive, SEQUENCE, CHOICE or extern */
+long utype;         /* underlying type */
+const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains the contents */
+long tcount;            /* Number of templates if SEQUENCE or CHOICE */
+const void *funcs;      /* functions that handle this type */
+long size;          /* Structure size (usually)*/
 #ifndef NO_ASN1_FIELD_NAMES
-const char *sname;		/* Structure name */
+const char *sname;      /* Structure name */
 #endif
 };
 
@@ -564,7 +564,7 @@ const char *sname;		/* Structure name */
  * For PRIMITIVE types the underlying type
  * determines the behaviour if items is NULL.
  *
- * Otherwise templates must contain a single 
+ * Otherwise templates must contain a single
  * template and the type is treated in the
  * same way as the type specified in the template.
  *
@@ -578,7 +578,7 @@ const char *sname;		/* Structure name */
  * selector.
  *
  * The 'funcs' field is used for application
- * specific functions. 
+ * specific functions.
  *
  * For COMPAT types the funcs field gives a
  * set of functions that handle this type, this
@@ -602,19 +602,19 @@ const char *sname;		/* Structure name */
  *
  */
 
-#define ASN1_ITYPE_PRIMITIVE		0x0
+#define ASN1_ITYPE_PRIMITIVE        0x0
 
-#define ASN1_ITYPE_SEQUENCE		0x1
+#define ASN1_ITYPE_SEQUENCE     0x1
 
-#define ASN1_ITYPE_CHOICE		0x2
+#define ASN1_ITYPE_CHOICE       0x2
 
-#define ASN1_ITYPE_COMPAT		0x3
+#define ASN1_ITYPE_COMPAT       0x3
 
-#define ASN1_ITYPE_EXTERN		0x4
+#define ASN1_ITYPE_EXTERN       0x4
 
-#define ASN1_ITYPE_MSTRING		0x5
+#define ASN1_ITYPE_MSTRING      0x5
 
-#define ASN1_ITYPE_NDEF_SEQUENCE	0x6
+#define ASN1_ITYPE_NDEF_SEQUENCE    0x6
 
 /* Cache for ASN1 tag and length, so we
  * don't keep re-reading it for things
@@ -622,12 +622,12 @@ const char *sname;		/* Structure name */
  */
 
 struct ASN1_TLC_st{
-	char valid;	/* Values below are valid */
-	int ret;	/* return value */
-	long plen;	/* length */
-	int ptag;	/* class value */
-	int pclass;	/* class value */
-	int hdrlen;	/* header length */
+    char valid; /* Values below are valid */
+    int ret;    /* return value */
+    long plen;  /* length */
+    int ptag;   /* class value */
+    int pclass; /* class value */
+    int hdrlen; /* header length */
 };
 
 /* Typedefs for ASN1 function pointers */
@@ -638,7 +638,7 @@ typedef ASN1_VALUE * ASN1_d2i_func(ASN1_VALUE **a, const unsigned char ** in, lo
 typedef int ASN1_i2d_func(ASN1_VALUE * a, unsigned char **in);
 
 typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it,
-					int tag, int aclass, char opt, ASN1_TLC *ctx);
+                    int tag, int aclass, char opt, ASN1_TLC *ctx);
 
 typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass);
 typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
@@ -648,29 +648,29 @@ typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, int *puty
 typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it);
 
 typedef struct ASN1_COMPAT_FUNCS_st {
-	ASN1_new_func *asn1_new;
-	ASN1_free_func *asn1_free;
-	ASN1_d2i_func *asn1_d2i;
-	ASN1_i2d_func *asn1_i2d;
+    ASN1_new_func *asn1_new;
+    ASN1_free_func *asn1_free;
+    ASN1_d2i_func *asn1_d2i;
+    ASN1_i2d_func *asn1_i2d;
 } ASN1_COMPAT_FUNCS;
 
 typedef struct ASN1_EXTERN_FUNCS_st {
-	void *app_data;
-	ASN1_ex_new_func *asn1_ex_new;
-	ASN1_ex_free_func *asn1_ex_free;
-	ASN1_ex_free_func *asn1_ex_clear;
-	ASN1_ex_d2i *asn1_ex_d2i;
-	ASN1_ex_i2d *asn1_ex_i2d;
+    void *app_data;
+    ASN1_ex_new_func *asn1_ex_new;
+    ASN1_ex_free_func *asn1_ex_free;
+    ASN1_ex_free_func *asn1_ex_clear;
+    ASN1_ex_d2i *asn1_ex_d2i;
+    ASN1_ex_i2d *asn1_ex_i2d;
 } ASN1_EXTERN_FUNCS;
 
 typedef struct ASN1_PRIMITIVE_FUNCS_st {
-	void *app_data;
-	unsigned long flags;
-	ASN1_ex_new_func *prim_new;
-	ASN1_ex_free_func *prim_free;
-	ASN1_ex_free_func *prim_clear;
-	ASN1_primitive_c2i *prim_c2i;
-	ASN1_primitive_i2c *prim_i2c;
+    void *app_data;
+    unsigned long flags;
+    ASN1_ex_new_func *prim_new;
+    ASN1_ex_free_func *prim_free;
+    ASN1_ex_free_func *prim_clear;
+    ASN1_primitive_c2i *prim_c2i;
+    ASN1_primitive_i2c *prim_i2c;
 } ASN1_PRIMITIVE_FUNCS;
 
 /* This is the ASN1_AUX structure: it handles various
@@ -683,7 +683,7 @@ typedef struct ASN1_PRIMITIVE_FUNCS_st {
  * used. This is most useful where the supplied routines
  * *almost* do the right thing but need some extra help
  * at a few points. If the callback returns zero then
- * it is assumed a fatal error has occurred and the 
+ * it is assumed a fatal error has occurred and the
  * main operation should be abandoned.
  *
  * If major changes in the default behaviour are required
@@ -693,78 +693,78 @@ typedef struct ASN1_PRIMITIVE_FUNCS_st {
 typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it);
 
 typedef struct ASN1_AUX_st {
-	void *app_data;
-	int flags;
-	int ref_offset;		/* Offset of reference value */
-	int ref_lock;		/* Lock type to use */
-	ASN1_aux_cb *asn1_cb;
-	int enc_offset;		/* Offset of ASN1_ENCODING structure */
+    void *app_data;
+    int flags;
+    int ref_offset;     /* Offset of reference value */
+    int ref_lock;       /* Lock type to use */
+    ASN1_aux_cb *asn1_cb;
+    int enc_offset;     /* Offset of ASN1_ENCODING structure */
 } ASN1_AUX;
 
 /* Flags in ASN1_AUX */
 
 /* Use a reference count */
-#define ASN1_AFLG_REFCOUNT	1
+#define ASN1_AFLG_REFCOUNT  1
 /* Save the encoding of structure (useful for signatures) */
-#define ASN1_AFLG_ENCODING	2
+#define ASN1_AFLG_ENCODING  2
 /* The Sequence length is invalid */
-#define ASN1_AFLG_BROKEN	4
+#define ASN1_AFLG_BROKEN    4
 
 /* operation values for asn1_cb */
 
-#define ASN1_OP_NEW_PRE		0
-#define ASN1_OP_NEW_POST	1
-#define ASN1_OP_FREE_PRE	2
-#define ASN1_OP_FREE_POST	3
-#define ASN1_OP_D2I_PRE		4
-#define ASN1_OP_D2I_POST	5
-#define ASN1_OP_I2D_PRE		6
-#define ASN1_OP_I2D_POST	7
+#define ASN1_OP_NEW_PRE     0
+#define ASN1_OP_NEW_POST    1
+#define ASN1_OP_FREE_PRE    2
+#define ASN1_OP_FREE_POST   3
+#define ASN1_OP_D2I_PRE     4
+#define ASN1_OP_D2I_POST    5
+#define ASN1_OP_I2D_PRE     6
+#define ASN1_OP_I2D_POST    7
 
 /* Macro to implement a primitive type */
 #define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0)
 #define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \
-				ASN1_ITEM_start(itname) \
-					ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
-				ASN1_ITEM_end(itname)
+                ASN1_ITEM_start(itname) \
+                    ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
+                ASN1_ITEM_end(itname)
 
 /* Macro to implement a multi string type */
 #define IMPLEMENT_ASN1_MSTRING(itname, mask) \
-				ASN1_ITEM_start(itname) \
-					ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \
-				ASN1_ITEM_end(itname)
+                ASN1_ITEM_start(itname) \
+                    ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \
+                ASN1_ITEM_end(itname)
 
 /* Macro to implement an ASN1_ITEM in terms of old style funcs */
 
 #define IMPLEMENT_COMPAT_ASN1(sname) IMPLEMENT_COMPAT_ASN1_type(sname, V_ASN1_SEQUENCE)
 
 #define IMPLEMENT_COMPAT_ASN1_type(sname, tag) \
-	static const ASN1_COMPAT_FUNCS sname##_ff = { \
-		(ASN1_new_func *)sname##_new, \
-		(ASN1_free_func *)sname##_free, \
-		(ASN1_d2i_func *)d2i_##sname, \
-		(ASN1_i2d_func *)i2d_##sname, \
-	}; \
-	ASN1_ITEM_start(sname) \
-		ASN1_ITYPE_COMPAT, \
-		tag, \
-		NULL, \
-		0, \
-		&sname##_ff, \
-		0, \
-		#sname \
-	ASN1_ITEM_end(sname)
+    static const ASN1_COMPAT_FUNCS sname##_ff = { \
+        (ASN1_new_func *)sname##_new, \
+        (ASN1_free_func *)sname##_free, \
+        (ASN1_d2i_func *)d2i_##sname, \
+        (ASN1_i2d_func *)i2d_##sname, \
+    }; \
+    ASN1_ITEM_start(sname) \
+        ASN1_ITYPE_COMPAT, \
+        tag, \
+        NULL, \
+        0, \
+        &sname##_ff, \
+        0, \
+        #sname \
+    ASN1_ITEM_end(sname)
 
 #define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \
-	ASN1_ITEM_start(sname) \
-		ASN1_ITYPE_EXTERN, \
-		tag, \
-		NULL, \
-		0, \
-		&fptrs, \
-		0, \
-		#sname \
-	ASN1_ITEM_end(sname)
+    ASN1_ITEM_start(sname) \
+        ASN1_ITYPE_EXTERN, \
+        tag, \
+        NULL, \
+        0, \
+        &fptrs, \
+        0, \
+        #sname \
+    ASN1_ITEM_end(sname)
 
 /* Macro to implement standard functions in terms of ASN1_ITEM structures */
 
@@ -773,66 +773,66 @@ typedef struct ASN1_AUX_st {
 #define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname)
 
 #define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \
-			IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname)
+            IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname)
 
 #define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \
-		IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname)
+        IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname)
 
 #define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \
-	stname *fname##_new(void) \
-	{ \
-		return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
-	} \
-	void fname##_free(stname *a) \
-	{ \
-		ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
-	}
+    stname *fname##_new(void) \
+    { \
+        return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
+    } \
+    void fname##_free(stname *a) \
+    { \
+        ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
+    }
 
 #define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \
-	IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \
-	IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname)
+    IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \
+    IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname)
 
 #define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \
-	stname *d2i_##fname(stname **a, const unsigned char **in, long len) \
-	{ \
-		return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
-	} \
-	int i2d_##fname(stname *a, unsigned char **out) \
-	{ \
-		return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
-	} 
+    stname *d2i_##fname(stname **a, const unsigned char **in, long len) \
+    { \
+        return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
+    } \
+    int i2d_##fname(stname *a, unsigned char **out) \
+    { \
+        return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
+    }
 
 #define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \
-	int i2d_##stname##_NDEF(stname *a, unsigned char **out) \
-	{ \
-		return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\
-	} 
+    int i2d_##stname##_NDEF(stname *a, unsigned char **out) \
+    { \
+        return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\
+    }
 
 /* This includes evil casts to remove const: they will go away when full
  * ASN1 constification is done.
  */
 #define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \
-	stname *d2i_##fname(stname **a, const unsigned char **in, long len) \
-	{ \
-		return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
-	} \
-	int i2d_##fname(const stname *a, unsigned char **out) \
-	{ \
-		return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
-	} 
+    stname *d2i_##fname(stname **a, const unsigned char **in, long len) \
+    { \
+        return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
+    } \
+    int i2d_##fname(const stname *a, unsigned char **out) \
+    { \
+        return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
+    }
 
 #define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \
-	stname * stname##_dup(stname *x) \
+    stname * stname##_dup(stname *x) \
         { \
         return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \
         }
 
 #define IMPLEMENT_ASN1_FUNCTIONS_const(name) \
-		IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name)
+        IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name)
 
 #define IMPLEMENT_ASN1_FUNCTIONS_const_fname(stname, itname, fname) \
-	IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \
-	IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname)
+    IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \
+    IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname)
 
 /* external definitions for primitive types */
 
@@ -857,7 +857,7 @@ int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
 void ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
 int ASN1_template_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_TEMPLATE *tt);
 int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it,
-				int tag, int aclass, char opt, ASN1_TLC *ctx);
+                int tag, int aclass, char opt, ASN1_TLC *ctx);
 
 int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass);
 int ASN1_template_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_TEMPLATE *tt);
diff --git a/dep/include/openssl/bio.h b/dep/include/openssl/bio.h
index 2c9e8a7c804..22b8316e24d 100644
--- a/dep/include/openssl/bio.h
+++ b/dep/include/openssl/bio.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -73,64 +73,64 @@ extern "C" {
 #endif
 
 /* These are the 'types' of BIOs */
-#define BIO_TYPE_NONE		0
-#define BIO_TYPE_MEM		(1|0x0400)
-#define BIO_TYPE_FILE		(2|0x0400)
+#define BIO_TYPE_NONE       0
+#define BIO_TYPE_MEM        (1|0x0400)
+#define BIO_TYPE_FILE       (2|0x0400)
 
-#define BIO_TYPE_FD		(4|0x0400|0x0100)
-#define BIO_TYPE_SOCKET		(5|0x0400|0x0100)
-#define BIO_TYPE_NULL		(6|0x0400)
-#define BIO_TYPE_SSL		(7|0x0200)
-#define BIO_TYPE_MD		(8|0x0200)		/* passive filter */
-#define BIO_TYPE_BUFFER		(9|0x0200)		/* filter */
-#define BIO_TYPE_CIPHER		(10|0x0200)		/* filter */
-#define BIO_TYPE_BASE64		(11|0x0200)		/* filter */
-#define BIO_TYPE_CONNECT	(12|0x0400|0x0100)	/* socket - connect */
-#define BIO_TYPE_ACCEPT		(13|0x0400|0x0100)	/* socket for accept */
-#define BIO_TYPE_PROXY_CLIENT	(14|0x0200)		/* client proxy BIO */
-#define BIO_TYPE_PROXY_SERVER	(15|0x0200)		/* server proxy BIO */
-#define BIO_TYPE_NBIO_TEST	(16|0x0200)		/* server proxy BIO */
-#define BIO_TYPE_NULL_FILTER	(17|0x0200)
-#define BIO_TYPE_BER		(18|0x0200)		/* BER -> bin filter */
-#define BIO_TYPE_BIO		(19|0x0400)		/* (half a) BIO pair */
-#define BIO_TYPE_LINEBUFFER	(20|0x0200)		/* filter */
-#define BIO_TYPE_DGRAM		(21|0x0400|0x0100)
+#define BIO_TYPE_FD     (4|0x0400|0x0100)
+#define BIO_TYPE_SOCKET     (5|0x0400|0x0100)
+#define BIO_TYPE_NULL       (6|0x0400)
+#define BIO_TYPE_SSL        (7|0x0200)
+#define BIO_TYPE_MD     (8|0x0200)      /* passive filter */
+#define BIO_TYPE_BUFFER     (9|0x0200)      /* filter */
+#define BIO_TYPE_CIPHER     (10|0x0200)     /* filter */
+#define BIO_TYPE_BASE64     (11|0x0200)     /* filter */
+#define BIO_TYPE_CONNECT    (12|0x0400|0x0100)  /* socket - connect */
+#define BIO_TYPE_ACCEPT     (13|0x0400|0x0100)  /* socket for accept */
+#define BIO_TYPE_PROXY_CLIENT   (14|0x0200)     /* client proxy BIO */
+#define BIO_TYPE_PROXY_SERVER   (15|0x0200)     /* server proxy BIO */
+#define BIO_TYPE_NBIO_TEST  (16|0x0200)     /* server proxy BIO */
+#define BIO_TYPE_NULL_FILTER    (17|0x0200)
+#define BIO_TYPE_BER        (18|0x0200)     /* BER -> bin filter */
+#define BIO_TYPE_BIO        (19|0x0400)     /* (half a) BIO pair */
+#define BIO_TYPE_LINEBUFFER (20|0x0200)     /* filter */
+#define BIO_TYPE_DGRAM      (21|0x0400|0x0100)
 
-#define BIO_TYPE_DESCRIPTOR	0x0100	/* socket, fd, connect or accept */
-#define BIO_TYPE_FILTER		0x0200
-#define BIO_TYPE_SOURCE_SINK	0x0400
+#define BIO_TYPE_DESCRIPTOR 0x0100  /* socket, fd, connect or accept */
+#define BIO_TYPE_FILTER     0x0200
+#define BIO_TYPE_SOURCE_SINK    0x0400
 
 /* BIO_FILENAME_READ|BIO_CLOSE to open or close on free.
  * BIO_set_fp(in,stdin,BIO_NOCLOSE); */
-#define BIO_NOCLOSE		0x00
-#define BIO_CLOSE		0x01
+#define BIO_NOCLOSE     0x00
+#define BIO_CLOSE       0x01
 
 /* These are used in the following macros and are passed to
  * BIO_ctrl() */
-#define BIO_CTRL_RESET		1  /* opt - rewind/zero etc */
-#define BIO_CTRL_EOF		2  /* opt - are we at the eof */
-#define BIO_CTRL_INFO		3  /* opt - extra tit-bits */
-#define BIO_CTRL_SET		4  /* man - set the 'IO' type */
-#define BIO_CTRL_GET		5  /* man - get the 'IO' type */
-#define BIO_CTRL_PUSH		6  /* opt - internal, used to signify change */
-#define BIO_CTRL_POP		7  /* opt - internal, used to signify change */
-#define BIO_CTRL_GET_CLOSE	8  /* man - set the 'close' on free */
-#define BIO_CTRL_SET_CLOSE	9  /* man - set the 'close' on free */
-#define BIO_CTRL_PENDING	10  /* opt - is their more data buffered */
-#define BIO_CTRL_FLUSH		11  /* opt - 'flush' buffered output */
-#define BIO_CTRL_DUP		12  /* man - extra stuff for 'duped' BIO */
-#define BIO_CTRL_WPENDING	13  /* opt - number of bytes still to write */
+#define BIO_CTRL_RESET      1  /* opt - rewind/zero etc */
+#define BIO_CTRL_EOF        2  /* opt - are we at the eof */
+#define BIO_CTRL_INFO       3  /* opt - extra tit-bits */
+#define BIO_CTRL_SET        4  /* man - set the 'IO' type */
+#define BIO_CTRL_GET        5  /* man - get the 'IO' type */
+#define BIO_CTRL_PUSH       6  /* opt - internal, used to signify change */
+#define BIO_CTRL_POP        7  /* opt - internal, used to signify change */
+#define BIO_CTRL_GET_CLOSE  8  /* man - set the 'close' on free */
+#define BIO_CTRL_SET_CLOSE  9  /* man - set the 'close' on free */
+#define BIO_CTRL_PENDING    10  /* opt - is their more data buffered */
+#define BIO_CTRL_FLUSH      11  /* opt - 'flush' buffered output */
+#define BIO_CTRL_DUP        12  /* man - extra stuff for 'duped' BIO */
+#define BIO_CTRL_WPENDING   13  /* opt - number of bytes still to write */
 /* callback is int cb(BIO *bio,state,ret); */
-#define BIO_CTRL_SET_CALLBACK	14  /* opt - set callback function */
-#define BIO_CTRL_GET_CALLBACK	15  /* opt - set callback function */
+#define BIO_CTRL_SET_CALLBACK   14  /* opt - set callback function */
+#define BIO_CTRL_GET_CALLBACK   15  /* opt - set callback function */
 
-#define BIO_CTRL_SET_FILENAME	30	/* BIO_s_file special */
+#define BIO_CTRL_SET_FILENAME   30  /* BIO_s_file special */
 
 /* dgram BIO stuff */
 #define BIO_CTRL_DGRAM_CONNECT       31  /* BIO dgram special */
 #define BIO_CTRL_DGRAM_SET_CONNECTED 32  /* allow for an externally
-										  * connected socket to be
-										  * passed in */ 
+                                          * connected socket to be
+                                          * passed in */
 #define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33 /* setsockopt, essentially */
 #define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34 /* getsockopt, essentially */
 #define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35 /* setsockopt, essentially */
@@ -138,7 +138,7 @@ extern "C" {
 
 #define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37 /* flag whether the last */
 #define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38 /* I/O operation tiemd out */
-					
+
 /* #ifdef IP_MTU_DISCOVER */
 #define BIO_CTRL_DGRAM_MTU_DISCOVER       39 /* set DF bit on egress packets */
 /* #endif */
@@ -146,55 +146,55 @@ extern "C" {
 #define BIO_CTRL_DGRAM_QUERY_MTU          40 /* as kernel for current MTU */
 #define BIO_CTRL_DGRAM_GET_MTU            41 /* get cached value for MTU */
 #define BIO_CTRL_DGRAM_SET_MTU            42 /* set cached value for
-											  * MTU. want to use this
+                                              * MTU. want to use this
                                               * if asking the kernel
                                               * fails */
 
 #define BIO_CTRL_DGRAM_MTU_EXCEEDED       43 /* check whether the MTU
-											  * was exceed in the
-											  * previous write
-											  * operation */
+                                              * was exceed in the
+                                              * previous write
+                                              * operation */
 
 #define BIO_CTRL_DGRAM_SET_PEER           44 /* Destination for the data */
 
 
 /* modifiers */
-#define BIO_FP_READ		0x02
-#define BIO_FP_WRITE		0x04
-#define BIO_FP_APPEND		0x08
-#define BIO_FP_TEXT		0x10
+#define BIO_FP_READ     0x02
+#define BIO_FP_WRITE        0x04
+#define BIO_FP_APPEND       0x08
+#define BIO_FP_TEXT     0x10
 
-#define BIO_FLAGS_READ		0x01
-#define BIO_FLAGS_WRITE		0x02
-#define BIO_FLAGS_IO_SPECIAL	0x04
+#define BIO_FLAGS_READ      0x01
+#define BIO_FLAGS_WRITE     0x02
+#define BIO_FLAGS_IO_SPECIAL    0x04
 #define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL)
-#define BIO_FLAGS_SHOULD_RETRY	0x08
-#ifndef	BIO_FLAGS_UPLINK
+#define BIO_FLAGS_SHOULD_RETRY  0x08
+#ifndef BIO_FLAGS_UPLINK
 /* "UPLINK" flag denotes file descriptors provided by application.
    It defaults to 0, as most platforms don't require UPLINK interface. */
-#define	BIO_FLAGS_UPLINK	0
+#define BIO_FLAGS_UPLINK    0
 #endif
 
 /* Used in BIO_gethostbyname() */
-#define BIO_GHBN_CTRL_HITS		1
-#define BIO_GHBN_CTRL_MISSES		2
-#define BIO_GHBN_CTRL_CACHE_SIZE	3
-#define BIO_GHBN_CTRL_GET_ENTRY		4
-#define BIO_GHBN_CTRL_FLUSH		5
+#define BIO_GHBN_CTRL_HITS      1
+#define BIO_GHBN_CTRL_MISSES        2
+#define BIO_GHBN_CTRL_CACHE_SIZE    3
+#define BIO_GHBN_CTRL_GET_ENTRY     4
+#define BIO_GHBN_CTRL_FLUSH     5
 
 /* Mostly used in the SSL BIO */
 /* Not used anymore
  * #define BIO_FLAGS_PROTOCOL_DELAYED_READ 0x10
  * #define BIO_FLAGS_PROTOCOL_DELAYED_WRITE 0x20
- * #define BIO_FLAGS_PROTOCOL_STARTUP	0x40
+ * #define BIO_FLAGS_PROTOCOL_STARTUP   0x40
  */
 
-#define BIO_FLAGS_BASE64_NO_NL	0x100
+#define BIO_FLAGS_BASE64_NO_NL  0x100
 
 /* This is used with memory BIOs: it means we shouldn't free up or change the
  * data in any way.
  */
-#define BIO_FLAGS_MEM_RDONLY	0x200
+#define BIO_FLAGS_MEM_RDONLY    0x200
 
 typedef struct bio_st BIO;
 
@@ -204,55 +204,55 @@ void BIO_clear_flags(BIO *b, int flags);
 
 #define BIO_get_flags(b) BIO_test_flags(b, ~(0x0))
 #define BIO_set_retry_special(b) \
-		BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY))
+        BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY))
 #define BIO_set_retry_read(b) \
-		BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY))
+        BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY))
 #define BIO_set_retry_write(b) \
-		BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY))
+        BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY))
 
 /* These are normally used internally in BIOs */
 #define BIO_clear_retry_flags(b) \
-		BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
+        BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
 #define BIO_get_retry_flags(b) \
-		BIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
+        BIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
 
 /* These should be used by the application to tell why we should retry */
-#define BIO_should_read(a)		BIO_test_flags(a, BIO_FLAGS_READ)
-#define BIO_should_write(a)		BIO_test_flags(a, BIO_FLAGS_WRITE)
-#define BIO_should_io_special(a)	BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL)
-#define BIO_retry_type(a)		BIO_test_flags(a, BIO_FLAGS_RWS)
-#define BIO_should_retry(a)		BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY)
+#define BIO_should_read(a)      BIO_test_flags(a, BIO_FLAGS_READ)
+#define BIO_should_write(a)     BIO_test_flags(a, BIO_FLAGS_WRITE)
+#define BIO_should_io_special(a)    BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL)
+#define BIO_retry_type(a)       BIO_test_flags(a, BIO_FLAGS_RWS)
+#define BIO_should_retry(a)     BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY)
 
 /* The next three are used in conjunction with the
  * BIO_should_io_special() condition.  After this returns true,
- * BIO *BIO_get_retry_BIO(BIO *bio, int *reason); will walk the BIO 
+ * BIO *BIO_get_retry_BIO(BIO *bio, int *reason); will walk the BIO
  * stack and return the 'reason' for the special and the offending BIO.
  * Given a BIO, BIO_get_retry_reason(bio) will return the code. */
 /* Returned from the SSL bio when the certificate retrieval code had an error */
-#define BIO_RR_SSL_X509_LOOKUP		0x01
+#define BIO_RR_SSL_X509_LOOKUP      0x01
 /* Returned from the connect BIO when a connect would have blocked */
-#define BIO_RR_CONNECT			0x02
+#define BIO_RR_CONNECT          0x02
 /* Returned from the accept BIO when an accept would have blocked */
-#define BIO_RR_ACCEPT			0x03
+#define BIO_RR_ACCEPT           0x03
 
 /* These are passed by the BIO callback */
-#define BIO_CB_FREE	0x01
-#define BIO_CB_READ	0x02
-#define BIO_CB_WRITE	0x03
-#define BIO_CB_PUTS	0x04
-#define BIO_CB_GETS	0x05
-#define BIO_CB_CTRL	0x06
+#define BIO_CB_FREE 0x01
+#define BIO_CB_READ 0x02
+#define BIO_CB_WRITE    0x03
+#define BIO_CB_PUTS 0x04
+#define BIO_CB_GETS 0x05
+#define BIO_CB_CTRL 0x06
 
 /* The callback is called before and after the underling operation,
  * The BIO_CB_RETURN flag indicates if it is after the call */
-#define BIO_CB_RETURN	0x80
+#define BIO_CB_RETURN   0x80
 #define BIO_CB_return(a) ((a)|BIO_CB_RETURN))
-#define BIO_cb_pre(a)	(!((a)&BIO_CB_RETURN))
-#define BIO_cb_post(a)	((a)&BIO_CB_RETURN)
+#define BIO_cb_pre(a)   (!((a)&BIO_CB_RETURN))
+#define BIO_cb_post(a)  ((a)&BIO_CB_RETURN)
 
 long (*BIO_get_callback(const BIO *b)) (struct bio_st *,int,const char *,int, long,long);
-void BIO_set_callback(BIO *b, 
-	long (*callback)(struct bio_st *,int,const char *,int, long,long));
+void BIO_set_callback(BIO *b,
+    long (*callback)(struct bio_st *,int,const char *,int, long,long));
 char *BIO_get_callback_arg(const BIO *b);
 void BIO_set_callback_arg(BIO *b, char *arg);
 
@@ -263,172 +263,172 @@ typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long);
 
 #ifndef OPENSSL_SYS_WIN16
 typedef struct bio_method_st
-	{
-	int type;
-	const char *name;
-	int (*bwrite)(BIO *, const char *, int);
-	int (*bread)(BIO *, char *, int);
-	int (*bputs)(BIO *, const char *);
-	int (*bgets)(BIO *, char *, int);
-	long (*ctrl)(BIO *, int, long, void *);
-	int (*create)(BIO *);
-	int (*destroy)(BIO *);
+    {
+    int type;
+    const char *name;
+    int (*bwrite)(BIO *, const char *, int);
+    int (*bread)(BIO *, char *, int);
+    int (*bputs)(BIO *, const char *);
+    int (*bgets)(BIO *, char *, int);
+    long (*ctrl)(BIO *, int, long, void *);
+    int (*create)(BIO *);
+    int (*destroy)(BIO *);
         long (*callback_ctrl)(BIO *, int, bio_info_cb *);
-	} BIO_METHOD;
+    } BIO_METHOD;
 #else
 typedef struct bio_method_st
-	{
-	int type;
-	const char *name;
-	int (_far *bwrite)();
-	int (_far *bread)();
-	int (_far *bputs)();
-	int (_far *bgets)();
-	long (_far *ctrl)();
-	int (_far *create)();
-	int (_far *destroy)();
-	long (_far *callback_ctrl)();
-	} BIO_METHOD;
+    {
+    int type;
+    const char *name;
+    int (_far *bwrite)();
+    int (_far *bread)();
+    int (_far *bputs)();
+    int (_far *bgets)();
+    long (_far *ctrl)();
+    int (_far *create)();
+    int (_far *destroy)();
+    long (_far *callback_ctrl)();
+    } BIO_METHOD;
 #endif
 
 struct bio_st
-	{
-	BIO_METHOD *method;
-	/* bio, mode, argp, argi, argl, ret */
-	long (*callback)(struct bio_st *,int,const char *,int, long,long);
-	char *cb_arg; /* first argument for the callback */
+    {
+    BIO_METHOD *method;
+    /* bio, mode, argp, argi, argl, ret */
+    long (*callback)(struct bio_st *,int,const char *,int, long,long);
+    char *cb_arg; /* first argument for the callback */
 
-	int init;
-	int shutdown;
-	int flags;	/* extra storage */
-	int retry_reason;
-	int num;
-	void *ptr;
-	struct bio_st *next_bio;	/* used by filter BIOs */
-	struct bio_st *prev_bio;	/* used by filter BIOs */
-	int references;
-	unsigned long num_read;
-	unsigned long num_write;
+    int init;
+    int shutdown;
+    int flags;  /* extra storage */
+    int retry_reason;
+    int num;
+    void *ptr;
+    struct bio_st *next_bio;    /* used by filter BIOs */
+    struct bio_st *prev_bio;    /* used by filter BIOs */
+    int references;
+    unsigned long num_read;
+    unsigned long num_write;
 
-	CRYPTO_EX_DATA ex_data;
-	};
+    CRYPTO_EX_DATA ex_data;
+    };
 
 DECLARE_STACK_OF(BIO)
 
 typedef struct bio_f_buffer_ctx_struct
-	{
-	/* BIO *bio; */ /* this is now in the BIO struct */
-	int ibuf_size;	/* how big is the input buffer */
-	int obuf_size;	/* how big is the output buffer */
+    {
+    /* BIO *bio; */ /* this is now in the BIO struct */
+    int ibuf_size;  /* how big is the input buffer */
+    int obuf_size;  /* how big is the output buffer */
 
-	char *ibuf;		/* the char array */
-	int ibuf_len;		/* how many bytes are in it */
-	int ibuf_off;		/* write/read offset */
+    char *ibuf;     /* the char array */
+    int ibuf_len;       /* how many bytes are in it */
+    int ibuf_off;       /* write/read offset */
 
-	char *obuf;		/* the char array */
-	int obuf_len;		/* how many bytes are in it */
-	int obuf_off;		/* write/read offset */
-	} BIO_F_BUFFER_CTX;
+    char *obuf;     /* the char array */
+    int obuf_len;       /* how many bytes are in it */
+    int obuf_off;       /* write/read offset */
+    } BIO_F_BUFFER_CTX;
 
 /* connect BIO stuff */
-#define BIO_CONN_S_BEFORE		1
-#define BIO_CONN_S_GET_IP		2
-#define BIO_CONN_S_GET_PORT		3
-#define BIO_CONN_S_CREATE_SOCKET	4
-#define BIO_CONN_S_CONNECT		5
-#define BIO_CONN_S_OK			6
-#define BIO_CONN_S_BLOCKED_CONNECT	7
-#define BIO_CONN_S_NBIO			8
-/*#define BIO_CONN_get_param_hostname	BIO_ctrl */
+#define BIO_CONN_S_BEFORE       1
+#define BIO_CONN_S_GET_IP       2
+#define BIO_CONN_S_GET_PORT     3
+#define BIO_CONN_S_CREATE_SOCKET    4
+#define BIO_CONN_S_CONNECT      5
+#define BIO_CONN_S_OK           6
+#define BIO_CONN_S_BLOCKED_CONNECT  7
+#define BIO_CONN_S_NBIO         8
+/*#define BIO_CONN_get_param_hostname   BIO_ctrl */
 
-#define BIO_C_SET_CONNECT			100
-#define BIO_C_DO_STATE_MACHINE			101
-#define BIO_C_SET_NBIO				102
-#define BIO_C_SET_PROXY_PARAM			103
-#define BIO_C_SET_FD				104
-#define BIO_C_GET_FD				105
-#define BIO_C_SET_FILE_PTR			106
-#define BIO_C_GET_FILE_PTR			107
-#define BIO_C_SET_FILENAME			108
-#define BIO_C_SET_SSL				109
-#define BIO_C_GET_SSL				110
-#define BIO_C_SET_MD				111
-#define BIO_C_GET_MD				112
-#define BIO_C_GET_CIPHER_STATUS			113
-#define BIO_C_SET_BUF_MEM			114
-#define BIO_C_GET_BUF_MEM_PTR			115
-#define BIO_C_GET_BUFF_NUM_LINES		116
-#define BIO_C_SET_BUFF_SIZE			117
-#define BIO_C_SET_ACCEPT			118
-#define BIO_C_SSL_MODE				119
-#define BIO_C_GET_MD_CTX			120
-#define BIO_C_GET_PROXY_PARAM			121
-#define BIO_C_SET_BUFF_READ_DATA		122 /* data to read first */
-#define BIO_C_GET_CONNECT			123
-#define BIO_C_GET_ACCEPT			124
-#define BIO_C_SET_SSL_RENEGOTIATE_BYTES		125
-#define BIO_C_GET_SSL_NUM_RENEGOTIATES		126
-#define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT	127
-#define BIO_C_FILE_SEEK				128
-#define BIO_C_GET_CIPHER_CTX			129
-#define BIO_C_SET_BUF_MEM_EOF_RETURN		130/*return end of input value*/
-#define BIO_C_SET_BIND_MODE			131
-#define BIO_C_GET_BIND_MODE			132
-#define BIO_C_FILE_TELL				133
-#define BIO_C_GET_SOCKS				134
-#define BIO_C_SET_SOCKS				135
+#define BIO_C_SET_CONNECT           100
+#define BIO_C_DO_STATE_MACHINE          101
+#define BIO_C_SET_NBIO              102
+#define BIO_C_SET_PROXY_PARAM           103
+#define BIO_C_SET_FD                104
+#define BIO_C_GET_FD                105
+#define BIO_C_SET_FILE_PTR          106
+#define BIO_C_GET_FILE_PTR          107
+#define BIO_C_SET_FILENAME          108
+#define BIO_C_SET_SSL               109
+#define BIO_C_GET_SSL               110
+#define BIO_C_SET_MD                111
+#define BIO_C_GET_MD                112
+#define BIO_C_GET_CIPHER_STATUS         113
+#define BIO_C_SET_BUF_MEM           114
+#define BIO_C_GET_BUF_MEM_PTR           115
+#define BIO_C_GET_BUFF_NUM_LINES        116
+#define BIO_C_SET_BUFF_SIZE         117
+#define BIO_C_SET_ACCEPT            118
+#define BIO_C_SSL_MODE              119
+#define BIO_C_GET_MD_CTX            120
+#define BIO_C_GET_PROXY_PARAM           121
+#define BIO_C_SET_BUFF_READ_DATA        122 /* data to read first */
+#define BIO_C_GET_CONNECT           123
+#define BIO_C_GET_ACCEPT            124
+#define BIO_C_SET_SSL_RENEGOTIATE_BYTES     125
+#define BIO_C_GET_SSL_NUM_RENEGOTIATES      126
+#define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT   127
+#define BIO_C_FILE_SEEK             128
+#define BIO_C_GET_CIPHER_CTX            129
+#define BIO_C_SET_BUF_MEM_EOF_RETURN        130/*return end of input value*/
+#define BIO_C_SET_BIND_MODE         131
+#define BIO_C_GET_BIND_MODE         132
+#define BIO_C_FILE_TELL             133
+#define BIO_C_GET_SOCKS             134
+#define BIO_C_SET_SOCKS             135
 
-#define BIO_C_SET_WRITE_BUF_SIZE		136/* for BIO_s_bio */
-#define BIO_C_GET_WRITE_BUF_SIZE		137
-#define BIO_C_MAKE_BIO_PAIR			138
-#define BIO_C_DESTROY_BIO_PAIR			139
-#define BIO_C_GET_WRITE_GUARANTEE		140
-#define BIO_C_GET_READ_REQUEST			141
-#define BIO_C_SHUTDOWN_WR			142
-#define BIO_C_NREAD0				143
-#define BIO_C_NREAD				144
-#define BIO_C_NWRITE0				145
-#define BIO_C_NWRITE				146
-#define BIO_C_RESET_READ_REQUEST		147
-#define BIO_C_SET_MD_CTX			148
+#define BIO_C_SET_WRITE_BUF_SIZE        136/* for BIO_s_bio */
+#define BIO_C_GET_WRITE_BUF_SIZE        137
+#define BIO_C_MAKE_BIO_PAIR         138
+#define BIO_C_DESTROY_BIO_PAIR          139
+#define BIO_C_GET_WRITE_GUARANTEE       140
+#define BIO_C_GET_READ_REQUEST          141
+#define BIO_C_SHUTDOWN_WR           142
+#define BIO_C_NREAD0                143
+#define BIO_C_NREAD             144
+#define BIO_C_NWRITE0               145
+#define BIO_C_NWRITE                146
+#define BIO_C_RESET_READ_REQUEST        147
+#define BIO_C_SET_MD_CTX            148
 
 
-#define BIO_set_app_data(s,arg)		BIO_set_ex_data(s,0,arg)
-#define BIO_get_app_data(s)		BIO_get_ex_data(s,0)
+#define BIO_set_app_data(s,arg)     BIO_set_ex_data(s,0,arg)
+#define BIO_get_app_data(s)     BIO_get_ex_data(s,0)
 
 /* BIO_s_connect() and BIO_s_socks4a_connect() */
 #define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0,(char *)name)
 #define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1,(char *)port)
-#define BIO_set_conn_ip(b,ip)	  BIO_ctrl(b,BIO_C_SET_CONNECT,2,(char *)ip)
+#define BIO_set_conn_ip(b,ip)     BIO_ctrl(b,BIO_C_SET_CONNECT,2,(char *)ip)
 #define BIO_set_conn_int_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,3,(char *)port)
 #define BIO_get_conn_hostname(b)  BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0)
 #define BIO_get_conn_port(b)      BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1)
-#define BIO_get_conn_ip(b) 		 BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2)
+#define BIO_get_conn_ip(b)       BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2)
 #define BIO_get_conn_int_port(b) BIO_int_ctrl(b,BIO_C_GET_CONNECT,3)
 
 
-#define BIO_set_nbio(b,n)	BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL)
+#define BIO_set_nbio(b,n)   BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL)
 
 /* BIO_s_accept_socket() */
 #define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name)
-#define BIO_get_accept_port(b)	BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0)
-/* #define BIO_set_nbio(b,n)	BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */
+#define BIO_get_accept_port(b)  BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0)
+/* #define BIO_set_nbio(b,n)    BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */
 #define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,1,(n)?"a":NULL)
 #define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(char *)bio)
 
-#define BIO_BIND_NORMAL			0
-#define BIO_BIND_REUSEADDR_IF_UNUSED	1
-#define BIO_BIND_REUSEADDR		2
+#define BIO_BIND_NORMAL         0
+#define BIO_BIND_REUSEADDR_IF_UNUSED    1
+#define BIO_BIND_REUSEADDR      2
 #define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL)
 #define BIO_get_bind_mode(b,mode) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL)
 
-#define BIO_do_connect(b)	BIO_do_handshake(b)
-#define BIO_do_accept(b)	BIO_do_handshake(b)
-#define BIO_do_handshake(b)	BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL)
+#define BIO_do_connect(b)   BIO_do_handshake(b)
+#define BIO_do_accept(b)    BIO_do_handshake(b)
+#define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL)
 
 /* BIO_s_proxy_client() */
-#define BIO_set_url(b,url)	BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,0,(char *)(url))
-#define BIO_set_proxies(b,p)	BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,1,(char *)(p))
+#define BIO_set_url(b,url)  BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,0,(char *)(url))
+#define BIO_set_proxies(b,p)    BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,1,(char *)(p))
 /* BIO_set_nbio(b,n) */
 #define BIO_set_filter_bio(b,s) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,2,(char *)(s))
 /* BIO *BIO_get_filter_bio(BIO *bio); */
@@ -438,17 +438,17 @@ typedef struct bio_f_buffer_ctx_struct
 
 #define BIO_get_proxy_header(b,skp) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,0,(char *)skp)
 #define BIO_get_proxies(b,pxy_p) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,1,(char *)(pxy_p))
-#define BIO_get_url(b,url)	BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,2,(char *)(url))
-#define BIO_get_no_connect_return(b)	BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,5,NULL)
+#define BIO_get_url(b,url)  BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,2,(char *)(url))
+#define BIO_get_no_connect_return(b)    BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,5,NULL)
 
-#define BIO_set_fd(b,fd,c)	BIO_int_ctrl(b,BIO_C_SET_FD,c,fd)
-#define BIO_get_fd(b,c)		BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c)
+#define BIO_set_fd(b,fd,c)  BIO_int_ctrl(b,BIO_C_SET_FD,c,fd)
+#define BIO_get_fd(b,c)     BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c)
 
-#define BIO_set_fp(b,fp,c)	BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)fp)
-#define BIO_get_fp(b,fpp)	BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)fpp)
+#define BIO_set_fp(b,fp,c)  BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)fp)
+#define BIO_get_fp(b,fpp)   BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)fpp)
 
-#define BIO_seek(b,ofs)	(int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL)
-#define BIO_tell(b)	(int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL)
+#define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL)
+#define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL)
 
 /* name is cast to lose const, but might be better to route through a function
    so we can do it safely */
@@ -459,60 +459,60 @@ typedef struct bio_f_buffer_ctx_struct
 int BIO_read_filename(BIO *b,const char *name);
 #else
 #define BIO_read_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
-		BIO_CLOSE|BIO_FP_READ,(char *)name)
+        BIO_CLOSE|BIO_FP_READ,(char *)name)
 #endif
 #define BIO_write_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
-		BIO_CLOSE|BIO_FP_WRITE,name)
+        BIO_CLOSE|BIO_FP_WRITE,name)
 #define BIO_append_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
-		BIO_CLOSE|BIO_FP_APPEND,name)
+        BIO_CLOSE|BIO_FP_APPEND,name)
 #define BIO_rw_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
-		BIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name)
+        BIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name)
 
 /* WARNING WARNING, this ups the reference count on the read bio of the
  * SSL structure.  This is because the ssl read BIO is now pointed to by
  * the next_bio field in the bio.  So when you free the BIO, make sure
  * you are doing a BIO_free_all() to catch the underlying BIO. */
-#define BIO_set_ssl(b,ssl,c)	BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)ssl)
-#define BIO_get_ssl(b,sslp)	BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)sslp)
-#define BIO_set_ssl_mode(b,client)	BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL)
+#define BIO_set_ssl(b,ssl,c)    BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)ssl)
+#define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)sslp)
+#define BIO_set_ssl_mode(b,client)  BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL)
 #define BIO_set_ssl_renegotiate_bytes(b,num) \
-	BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL);
+    BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL);
 #define BIO_get_num_renegotiates(b) \
-	BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL);
+    BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL);
 #define BIO_set_ssl_renegotiate_timeout(b,seconds) \
-	BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL);
+    BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL);
 
 /* defined in evp.h */
-/* #define BIO_set_md(b,md)	BIO_ctrl(b,BIO_C_SET_MD,1,(char *)md) */
+/* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)md) */
 
-#define BIO_get_mem_data(b,pp)	BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)pp)
-#define BIO_set_mem_buf(b,bm,c)	BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)bm)
-#define BIO_get_mem_ptr(b,pp)	BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0,(char *)pp)
+#define BIO_get_mem_data(b,pp)  BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)pp)
+#define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)bm)
+#define BIO_get_mem_ptr(b,pp)   BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0,(char *)pp)
 #define BIO_set_mem_eof_return(b,v) \
-				BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL)
+                BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL)
 
 /* For the BIO_f_buffer() type */
-#define BIO_get_buffer_num_lines(b)	BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL)
-#define BIO_set_buffer_size(b,size)	BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL)
+#define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL)
+#define BIO_set_buffer_size(b,size) BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL)
 #define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0)
 #define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1)
 #define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf)
 
 /* Don't use the next one unless you know what you are doing :-) */
-#define BIO_dup_state(b,ret)	BIO_ctrl(b,BIO_CTRL_DUP,0,(char *)(ret))
+#define BIO_dup_state(b,ret)    BIO_ctrl(b,BIO_CTRL_DUP,0,(char *)(ret))
 
-#define BIO_reset(b)		(int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL)
-#define BIO_eof(b)		(int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL)
-#define BIO_set_close(b,c)	(int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL)
-#define BIO_get_close(b)	(int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL)
-#define BIO_pending(b)		(int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL)
-#define BIO_wpending(b)		(int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL)
+#define BIO_reset(b)        (int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL)
+#define BIO_eof(b)      (int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL)
+#define BIO_set_close(b,c)  (int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL)
+#define BIO_get_close(b)    (int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL)
+#define BIO_pending(b)      (int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL)
+#define BIO_wpending(b)     (int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL)
 /* ...pending macros have inappropriate return type */
 size_t BIO_ctrl_pending(BIO *b);
 size_t BIO_ctrl_wpending(BIO *b);
-#define BIO_flush(b)		(int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL)
+#define BIO_flush(b)        (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL)
 #define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0, \
-						   cbp)
+                           cbp)
 #define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb)
 
 /* For the BIO_f_buffer() type */
@@ -549,7 +549,7 @@ int BIO_ctrl_reset_read_request(BIO *b);
 int BIO_set_ex_data(BIO *bio,int idx,void *data);
 void *BIO_get_ex_data(BIO *bio,int idx);
 int BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
-	CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+    CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
 unsigned long BIO_number_read(BIO *bio);
 unsigned long BIO_number_written(BIO *bio);
 
@@ -558,39 +558,39 @@ unsigned long BIO_number_written(BIO *bio);
 BIO_METHOD *BIO_s_file_internal(void);
 BIO *BIO_new_file_internal(char *filename, char *mode);
 BIO *BIO_new_fp_internal(FILE *stream, int close_flag);
-#    define BIO_s_file	BIO_s_file_internal
-#    define BIO_new_file	BIO_new_file_internal
-#    define BIO_new_fp	BIO_new_fp_internal
+#    define BIO_s_file  BIO_s_file_internal
+#    define BIO_new_file    BIO_new_file_internal
+#    define BIO_new_fp  BIO_new_fp_internal
 #  else /* FP_API */
 BIO_METHOD *BIO_s_file(void );
 BIO *BIO_new_file(const char *filename, const char *mode);
 BIO *BIO_new_fp(FILE *stream, int close_flag);
-#    define BIO_s_file_internal		BIO_s_file
-#    define BIO_new_file_internal	BIO_new_file
-#    define BIO_new_fp_internal		BIO_s_file
+#    define BIO_s_file_internal     BIO_s_file
+#    define BIO_new_file_internal   BIO_new_file
+#    define BIO_new_fp_internal     BIO_s_file
 #  endif /* FP_API */
 # endif
-BIO *	BIO_new(BIO_METHOD *type);
-int	BIO_set(BIO *a,BIO_METHOD *type);
-int	BIO_free(BIO *a);
-void	BIO_vfree(BIO *a);
-int	BIO_read(BIO *b, void *data, int len);
-int	BIO_gets(BIO *bp,char *buf, int size);
-int	BIO_write(BIO *b, const void *data, int len);
-int	BIO_puts(BIO *bp,const char *buf);
-int	BIO_indent(BIO *b,int indent,int max);
-long	BIO_ctrl(BIO *bp,int cmd,long larg,void *parg);
+BIO *   BIO_new(BIO_METHOD *type);
+int BIO_set(BIO *a,BIO_METHOD *type);
+int BIO_free(BIO *a);
+void    BIO_vfree(BIO *a);
+int BIO_read(BIO *b, void *data, int len);
+int BIO_gets(BIO *bp,char *buf, int size);
+int BIO_write(BIO *b, const void *data, int len);
+int BIO_puts(BIO *bp,const char *buf);
+int BIO_indent(BIO *b,int indent,int max);
+long    BIO_ctrl(BIO *bp,int cmd,long larg,void *parg);
 long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long));
-char *	BIO_ptr_ctrl(BIO *bp,int cmd,long larg);
-long	BIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg);
-BIO *	BIO_push(BIO *b,BIO *append);
-BIO *	BIO_pop(BIO *b);
-void	BIO_free_all(BIO *a);
-BIO *	BIO_find_type(BIO *b,int bio_type);
-BIO *	BIO_next(BIO *b);
-BIO *	BIO_get_retry_BIO(BIO *bio, int *reason);
-int	BIO_get_retry_reason(BIO *bio);
-BIO *	BIO_dup_chain(BIO *in);
+char *  BIO_ptr_ctrl(BIO *bp,int cmd,long larg);
+long    BIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg);
+BIO *   BIO_push(BIO *b,BIO *append);
+BIO *   BIO_pop(BIO *b);
+void    BIO_free_all(BIO *a);
+BIO *   BIO_find_type(BIO *b,int bio_type);
+BIO *   BIO_next(BIO *b);
+BIO *   BIO_get_retry_BIO(BIO *bio, int *reason);
+int BIO_get_retry_reason(BIO *bio);
+BIO *   BIO_dup_chain(BIO *in);
 
 int BIO_nread0(BIO *bio, char **buf);
 int BIO_nread(BIO *bio, char **buf, int num);
@@ -599,10 +599,10 @@ int BIO_nwrite(BIO *bio, char **buf, int num);
 
 #ifndef OPENSSL_SYS_WIN16
 long BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi,
-	long argl,long ret);
+    long argl,long ret);
 #else
 long _far _loadds BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi,
-	long argl,long ret);
+    long argl,long ret);
 #endif
 
 BIO_METHOD *BIO_s_mem(void);
@@ -635,9 +635,9 @@ int BIO_dgram_non_fatal_error(int error);
 int BIO_fd_should_retry(int i);
 int BIO_fd_non_fatal_error(int error);
 int BIO_dump_cb(int (*cb)(const void *data, size_t len, void *u),
-		void *u, const char *s, int len);
+        void *u, const char *s, int len);
 int BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u),
-		       void *u, const char *s, int len, int indent);
+               void *u, const char *s, int len, int indent);
 int BIO_dump(BIO *b,const char *bytes,int len);
 int BIO_dump_indent(BIO *b,const char *bytes,int len,int indent);
 #ifndef OPENSSL_NO_FP_API
@@ -671,7 +671,7 @@ BIO *BIO_new_connect(char *host_port);
 BIO *BIO_new_accept(char *host_port);
 
 int BIO_new_bio_pair(BIO **bio1, size_t writebuf1,
-	BIO **bio2, size_t writebuf2);
+    BIO **bio2, size_t writebuf2);
 /* If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints.
  * Otherwise returns 0 and sets *bio1 and *bio2 to NULL.
  * Size 0 uses default value.
@@ -687,13 +687,13 @@ void BIO_copy_next_retry(BIO *b);
 #  define __bio_h__attr__(x)
 #endif
 int BIO_printf(BIO *bio, const char *format, ...)
-	__bio_h__attr__((__format__(__printf__,2,3)));
+    __bio_h__attr__((__format__(__printf__,2,3)));
 int BIO_vprintf(BIO *bio, const char *format, va_list args)
-	__bio_h__attr__((__format__(__printf__,2,0)));
+    __bio_h__attr__((__format__(__printf__,2,0)));
 int BIO_snprintf(char *buf, size_t n, const char *format, ...)
-	__bio_h__attr__((__format__(__printf__,3,4)));
+    __bio_h__attr__((__format__(__printf__,3,4)));
 int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
-	__bio_h__attr__((__format__(__printf__,3,0)));
+    __bio_h__attr__((__format__(__printf__,3,0)));
 #undef __bio_h__attr__
 
 /* BEGIN ERROR CODES */
@@ -705,69 +705,69 @@ void ERR_load_BIO_strings(void);
 /* Error codes for the BIO functions. */
 
 /* Function codes. */
-#define BIO_F_ACPT_STATE				 100
-#define BIO_F_BIO_ACCEPT				 101
-#define BIO_F_BIO_BER_GET_HEADER			 102
-#define BIO_F_BIO_CALLBACK_CTRL				 131
-#define BIO_F_BIO_CTRL					 103
-#define BIO_F_BIO_GETHOSTBYNAME				 120
-#define BIO_F_BIO_GETS					 104
-#define BIO_F_BIO_GET_ACCEPT_SOCKET			 105
-#define BIO_F_BIO_GET_HOST_IP				 106
-#define BIO_F_BIO_GET_PORT				 107
-#define BIO_F_BIO_MAKE_PAIR				 121
-#define BIO_F_BIO_NEW					 108
-#define BIO_F_BIO_NEW_FILE				 109
-#define BIO_F_BIO_NEW_MEM_BUF				 126
-#define BIO_F_BIO_NREAD					 123
-#define BIO_F_BIO_NREAD0				 124
-#define BIO_F_BIO_NWRITE				 125
-#define BIO_F_BIO_NWRITE0				 122
-#define BIO_F_BIO_PUTS					 110
-#define BIO_F_BIO_READ					 111
-#define BIO_F_BIO_SOCK_INIT				 112
-#define BIO_F_BIO_WRITE					 113
-#define BIO_F_BUFFER_CTRL				 114
-#define BIO_F_CONN_CTRL					 127
-#define BIO_F_CONN_STATE				 115
-#define BIO_F_FILE_CTRL					 116
-#define BIO_F_FILE_READ					 130
-#define BIO_F_LINEBUFFER_CTRL				 129
-#define BIO_F_MEM_READ					 128
-#define BIO_F_MEM_WRITE					 117
-#define BIO_F_SSL_NEW					 118
-#define BIO_F_WSASTARTUP				 119
+#define BIO_F_ACPT_STATE                 100
+#define BIO_F_BIO_ACCEPT                 101
+#define BIO_F_BIO_BER_GET_HEADER             102
+#define BIO_F_BIO_CALLBACK_CTRL              131
+#define BIO_F_BIO_CTRL                   103
+#define BIO_F_BIO_GETHOSTBYNAME              120
+#define BIO_F_BIO_GETS                   104
+#define BIO_F_BIO_GET_ACCEPT_SOCKET          105
+#define BIO_F_BIO_GET_HOST_IP                106
+#define BIO_F_BIO_GET_PORT               107
+#define BIO_F_BIO_MAKE_PAIR              121
+#define BIO_F_BIO_NEW                    108
+#define BIO_F_BIO_NEW_FILE               109
+#define BIO_F_BIO_NEW_MEM_BUF                126
+#define BIO_F_BIO_NREAD                  123
+#define BIO_F_BIO_NREAD0                 124
+#define BIO_F_BIO_NWRITE                 125
+#define BIO_F_BIO_NWRITE0                122
+#define BIO_F_BIO_PUTS                   110
+#define BIO_F_BIO_READ                   111
+#define BIO_F_BIO_SOCK_INIT              112
+#define BIO_F_BIO_WRITE                  113
+#define BIO_F_BUFFER_CTRL                114
+#define BIO_F_CONN_CTRL                  127
+#define BIO_F_CONN_STATE                 115
+#define BIO_F_FILE_CTRL                  116
+#define BIO_F_FILE_READ                  130
+#define BIO_F_LINEBUFFER_CTRL                129
+#define BIO_F_MEM_READ                   128
+#define BIO_F_MEM_WRITE                  117
+#define BIO_F_SSL_NEW                    118
+#define BIO_F_WSASTARTUP                 119
 
 /* Reason codes. */
-#define BIO_R_ACCEPT_ERROR				 100
-#define BIO_R_BAD_FOPEN_MODE				 101
-#define BIO_R_BAD_HOSTNAME_LOOKUP			 102
-#define BIO_R_BROKEN_PIPE				 124
-#define BIO_R_CONNECT_ERROR				 103
-#define BIO_R_EOF_ON_MEMORY_BIO				 127
-#define BIO_R_ERROR_SETTING_NBIO			 104
-#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET	 105
-#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET	 106
-#define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET		 107
-#define BIO_R_INVALID_ARGUMENT				 125
-#define BIO_R_INVALID_IP_ADDRESS			 108
-#define BIO_R_IN_USE					 123
-#define BIO_R_KEEPALIVE					 109
-#define BIO_R_NBIO_CONNECT_ERROR			 110
-#define BIO_R_NO_ACCEPT_PORT_SPECIFIED			 111
-#define BIO_R_NO_HOSTNAME_SPECIFIED			 112
-#define BIO_R_NO_PORT_DEFINED				 113
-#define BIO_R_NO_PORT_SPECIFIED				 114
-#define BIO_R_NO_SUCH_FILE				 128
-#define BIO_R_NULL_PARAMETER				 115
-#define BIO_R_TAG_MISMATCH				 116
-#define BIO_R_UNABLE_TO_BIND_SOCKET			 117
-#define BIO_R_UNABLE_TO_CREATE_SOCKET			 118
-#define BIO_R_UNABLE_TO_LISTEN_SOCKET			 119
-#define BIO_R_UNINITIALIZED				 120
-#define BIO_R_UNSUPPORTED_METHOD			 121
-#define BIO_R_WRITE_TO_READ_ONLY_BIO			 126
-#define BIO_R_WSASTARTUP				 122
+#define BIO_R_ACCEPT_ERROR               100
+#define BIO_R_BAD_FOPEN_MODE                 101
+#define BIO_R_BAD_HOSTNAME_LOOKUP            102
+#define BIO_R_BROKEN_PIPE                124
+#define BIO_R_CONNECT_ERROR              103
+#define BIO_R_EOF_ON_MEMORY_BIO              127
+#define BIO_R_ERROR_SETTING_NBIO             104
+#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET  105
+#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET    106
+#define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET      107
+#define BIO_R_INVALID_ARGUMENT               125
+#define BIO_R_INVALID_IP_ADDRESS             108
+#define BIO_R_IN_USE                     123
+#define BIO_R_KEEPALIVE                  109
+#define BIO_R_NBIO_CONNECT_ERROR             110
+#define BIO_R_NO_ACCEPT_PORT_SPECIFIED           111
+#define BIO_R_NO_HOSTNAME_SPECIFIED          112
+#define BIO_R_NO_PORT_DEFINED                113
+#define BIO_R_NO_PORT_SPECIFIED              114
+#define BIO_R_NO_SUCH_FILE               128
+#define BIO_R_NULL_PARAMETER                 115
+#define BIO_R_TAG_MISMATCH               116
+#define BIO_R_UNABLE_TO_BIND_SOCKET          117
+#define BIO_R_UNABLE_TO_CREATE_SOCKET            118
+#define BIO_R_UNABLE_TO_LISTEN_SOCKET            119
+#define BIO_R_UNINITIALIZED              120
+#define BIO_R_UNSUPPORTED_METHOD             121
+#define BIO_R_WRITE_TO_READ_ONLY_BIO             126
+#define BIO_R_WSASTARTUP                 122
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/blowfish.h b/dep/include/openssl/blowfish.h
index cd49e85ab29..2acc081b810 100644
--- a/dep/include/openssl/blowfish.h
+++ b/dep/include/openssl/blowfish.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -69,8 +69,8 @@ extern "C" {
 #error BF is disabled.
 #endif
 
-#define BF_ENCRYPT	1
-#define BF_DECRYPT	0
+#define BF_ENCRYPT  1
+#define BF_DECRYPT  0
 
 /*
  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -89,35 +89,35 @@ extern "C" {
  * does it have on performance on none-T3E machines. I could declare
  * int, but at least on C90 sizeof(int) can be chosen at compile time.
  * So I've chosen long...
- *					
+ *                  
  */
 #else
 #define BF_LONG unsigned int
 #endif
 
-#define BF_ROUNDS	16
-#define BF_BLOCK	8
+#define BF_ROUNDS   16
+#define BF_BLOCK    8
 
 typedef struct bf_key_st
-	{
-	BF_LONG P[BF_ROUNDS+2];
-	BF_LONG S[4*256];
-	} BF_KEY;
+    {
+    BF_LONG P[BF_ROUNDS+2];
+    BF_LONG S[4*256];
+    } BF_KEY;
+
 
- 
 void BF_set_key(BF_KEY *key, int len, const unsigned char *data);
 
 void BF_encrypt(BF_LONG *data,const BF_KEY *key);
 void BF_decrypt(BF_LONG *data,const BF_KEY *key);
 
 void BF_ecb_encrypt(const unsigned char *in, unsigned char *out,
-	const BF_KEY *key, int enc);
+    const BF_KEY *key, int enc);
 void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
-	const BF_KEY *schedule, unsigned char *ivec, int enc);
+    const BF_KEY *schedule, unsigned char *ivec, int enc);
 void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length,
-	const BF_KEY *schedule, unsigned char *ivec, int *num, int enc);
+    const BF_KEY *schedule, unsigned char *ivec, int *num, int enc);
 void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length,
-	const BF_KEY *schedule, unsigned char *ivec, int *num);
+    const BF_KEY *schedule, unsigned char *ivec, int *num);
 const char *BF_options(void);
 
 #ifdef  __cplusplus
diff --git a/dep/include/openssl/bn.h b/dep/include/openssl/bn.h
index 95c5d643cbd..0eceb59303f 100644
--- a/dep/include/openssl/bn.h
+++ b/dep/include/openssl/bn.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -58,13 +58,13 @@
 /* ====================================================================
  * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
  *
- * Portions of the attached software ("Contribution") are developed by 
+ * Portions of the attached software ("Contribution") are developed by
  * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
  *
  * The Contribution is licensed pursuant to the Eric Young open source
  * license provided above.
  *
- * The binary polynomial arithmetic software is originally written by 
+ * The binary polynomial arithmetic software is originally written by
  * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories.
  *
  */
@@ -120,23 +120,23 @@ extern "C" {
  * unsigned long long is only 64 bits :-(, don't define
  * BN_LLONG for the DEC Alpha */
 #ifdef SIXTY_FOUR_BIT_LONG
-#define BN_ULLONG	unsigned long long
-#define BN_ULONG	unsigned long
-#define BN_LONG		long
-#define BN_BITS		128
-#define BN_BYTES	8
-#define BN_BITS2	64
-#define BN_BITS4	32
-#define BN_MASK		(0xffffffffffffffffffffffffffffffffLL)
-#define BN_MASK2	(0xffffffffffffffffL)
-#define BN_MASK2l	(0xffffffffL)
-#define BN_MASK2h	(0xffffffff00000000L)
-#define BN_MASK2h1	(0xffffffff80000000L)
-#define BN_TBIT		(0x8000000000000000L)
-#define BN_DEC_CONV	(10000000000000000000UL)
-#define BN_DEC_FMT1	"%lu"
-#define BN_DEC_FMT2	"%019lu"
-#define BN_DEC_NUM	19
+#define BN_ULLONG   unsigned long long
+#define BN_ULONG    unsigned long
+#define BN_LONG     long
+#define BN_BITS     128
+#define BN_BYTES    8
+#define BN_BITS2    64
+#define BN_BITS4    32
+#define BN_MASK     (0xffffffffffffffffffffffffffffffffLL)
+#define BN_MASK2    (0xffffffffffffffffL)
+#define BN_MASK2l   (0xffffffffL)
+#define BN_MASK2h   (0xffffffff00000000L)
+#define BN_MASK2h1  (0xffffffff80000000L)
+#define BN_TBIT     (0x8000000000000000L)
+#define BN_DEC_CONV (10000000000000000000UL)
+#define BN_DEC_FMT1 "%lu"
+#define BN_DEC_FMT2 "%019lu"
+#define BN_DEC_NUM  19
 #endif
 
 /* This is where the long long data type is 64 bits, but long is 32.
@@ -147,111 +147,111 @@ extern "C" {
 #ifdef SIXTY_FOUR_BIT
 #undef BN_LLONG
 #undef BN_ULLONG
-#define BN_ULONG	unsigned long long
-#define BN_LONG		long long
-#define BN_BITS		128
-#define BN_BYTES	8
-#define BN_BITS2	64
-#define BN_BITS4	32
-#define BN_MASK2	(0xffffffffffffffffLL)
-#define BN_MASK2l	(0xffffffffL)
-#define BN_MASK2h	(0xffffffff00000000LL)
-#define BN_MASK2h1	(0xffffffff80000000LL)
-#define BN_TBIT		(0x8000000000000000LL)
-#define BN_DEC_CONV	(10000000000000000000ULL)
-#define BN_DEC_FMT1	"%llu"
-#define BN_DEC_FMT2	"%019llu"
-#define BN_DEC_NUM	19
+#define BN_ULONG    unsigned long long
+#define BN_LONG     long long
+#define BN_BITS     128
+#define BN_BYTES    8
+#define BN_BITS2    64
+#define BN_BITS4    32
+#define BN_MASK2    (0xffffffffffffffffLL)
+#define BN_MASK2l   (0xffffffffL)
+#define BN_MASK2h   (0xffffffff00000000LL)
+#define BN_MASK2h1  (0xffffffff80000000LL)
+#define BN_TBIT     (0x8000000000000000LL)
+#define BN_DEC_CONV (10000000000000000000ULL)
+#define BN_DEC_FMT1 "%llu"
+#define BN_DEC_FMT2 "%019llu"
+#define BN_DEC_NUM  19
 #endif
 
 #ifdef THIRTY_TWO_BIT
 #ifdef BN_LLONG
 # if defined(OPENSSL_SYS_WIN32) && !defined(__GNUC__)
-#  define BN_ULLONG	unsigned __int64
+#  define BN_ULLONG unsigned __int64
 # else
-#  define BN_ULLONG	unsigned long long
+#  define BN_ULLONG unsigned long long
 # endif
 #endif
-#define BN_ULONG	unsigned long
-#define BN_LONG		long
-#define BN_BITS		64
-#define BN_BYTES	4
-#define BN_BITS2	32
-#define BN_BITS4	16
+#define BN_ULONG    unsigned long
+#define BN_LONG     long
+#define BN_BITS     64
+#define BN_BYTES    4
+#define BN_BITS2    32
+#define BN_BITS4    16
 #ifdef OPENSSL_SYS_WIN32
 /* VC++ doesn't like the LL suffix */
-#define BN_MASK		(0xffffffffffffffffL)
+#define BN_MASK     (0xffffffffffffffffL)
 #else
-#define BN_MASK		(0xffffffffffffffffLL)
+#define BN_MASK     (0xffffffffffffffffLL)
 #endif
-#define BN_MASK2	(0xffffffffL)
-#define BN_MASK2l	(0xffff)
-#define BN_MASK2h1	(0xffff8000L)
-#define BN_MASK2h	(0xffff0000L)
-#define BN_TBIT		(0x80000000L)
-#define BN_DEC_CONV	(1000000000L)
-#define BN_DEC_FMT1	"%lu"
-#define BN_DEC_FMT2	"%09lu"
-#define BN_DEC_NUM	9
+#define BN_MASK2    (0xffffffffL)
+#define BN_MASK2l   (0xffff)
+#define BN_MASK2h1  (0xffff8000L)
+#define BN_MASK2h   (0xffff0000L)
+#define BN_TBIT     (0x80000000L)
+#define BN_DEC_CONV (1000000000L)
+#define BN_DEC_FMT1 "%lu"
+#define BN_DEC_FMT2 "%09lu"
+#define BN_DEC_NUM  9
 #endif
 
 #ifdef SIXTEEN_BIT
 #ifndef BN_DIV2W
 #define BN_DIV2W
 #endif
-#define BN_ULLONG	unsigned long
-#define BN_ULONG	unsigned short
-#define BN_LONG		short
-#define BN_BITS		32
-#define BN_BYTES	2
-#define BN_BITS2	16
-#define BN_BITS4	8
-#define BN_MASK		(0xffffffff)
-#define BN_MASK2	(0xffff)
-#define BN_MASK2l	(0xff)
-#define BN_MASK2h1	(0xff80)
-#define BN_MASK2h	(0xff00)
-#define BN_TBIT		(0x8000)
-#define BN_DEC_CONV	(100000)
-#define BN_DEC_FMT1	"%u"
-#define BN_DEC_FMT2	"%05u"
-#define BN_DEC_NUM	5
+#define BN_ULLONG   unsigned long
+#define BN_ULONG    unsigned short
+#define BN_LONG     short
+#define BN_BITS     32
+#define BN_BYTES    2
+#define BN_BITS2    16
+#define BN_BITS4    8
+#define BN_MASK     (0xffffffff)
+#define BN_MASK2    (0xffff)
+#define BN_MASK2l   (0xff)
+#define BN_MASK2h1  (0xff80)
+#define BN_MASK2h   (0xff00)
+#define BN_TBIT     (0x8000)
+#define BN_DEC_CONV (100000)
+#define BN_DEC_FMT1 "%u"
+#define BN_DEC_FMT2 "%05u"
+#define BN_DEC_NUM  5
 #endif
 
 #ifdef EIGHT_BIT
 #ifndef BN_DIV2W
 #define BN_DIV2W
 #endif
-#define BN_ULLONG	unsigned short
-#define BN_ULONG	unsigned char
-#define BN_LONG		char
-#define BN_BITS		16
-#define BN_BYTES	1
-#define BN_BITS2	8
-#define BN_BITS4	4
-#define BN_MASK		(0xffff)
-#define BN_MASK2	(0xff)
-#define BN_MASK2l	(0xf)
-#define BN_MASK2h1	(0xf8)
-#define BN_MASK2h	(0xf0)
-#define BN_TBIT		(0x80)
-#define BN_DEC_CONV	(100)
-#define BN_DEC_FMT1	"%u"
-#define BN_DEC_FMT2	"%02u"
-#define BN_DEC_NUM	2
+#define BN_ULLONG   unsigned short
+#define BN_ULONG    unsigned char
+#define BN_LONG     char
+#define BN_BITS     16
+#define BN_BYTES    1
+#define BN_BITS2    8
+#define BN_BITS4    4
+#define BN_MASK     (0xffff)
+#define BN_MASK2    (0xff)
+#define BN_MASK2l   (0xf)
+#define BN_MASK2h1  (0xf8)
+#define BN_MASK2h   (0xf0)
+#define BN_TBIT     (0x80)
+#define BN_DEC_CONV (100)
+#define BN_DEC_FMT1 "%u"
+#define BN_DEC_FMT2 "%02u"
+#define BN_DEC_NUM  2
 #endif
 
-#define BN_DEFAULT_BITS	1280
+#define BN_DEFAULT_BITS 1280
 
-#define BN_FLG_MALLOCED		0x01
-#define BN_FLG_STATIC_DATA	0x02
-#define BN_FLG_EXP_CONSTTIME	0x04 /* avoid leaking exponent information through timings
-                            	      * (BN_mod_exp_mont() will call BN_mod_exp_mont_consttime) */
+#define BN_FLG_MALLOCED     0x01
+#define BN_FLG_STATIC_DATA  0x02
+#define BN_FLG_EXP_CONSTTIME    0x04 /* avoid leaking exponent information through timings
+                                      * (BN_mod_exp_mont() will call BN_mod_exp_mont_consttime) */
 #ifndef OPENSSL_NO_DEPRECATED
-#define BN_FLG_FREE		0x8000	/* used for debuging */
+#define BN_FLG_FREE     0x8000  /* used for debuging */
 #endif
-#define BN_set_flags(b,n)	((b)->flags|=(n))
-#define BN_get_flags(b,n)	((b)->flags&(n))
+#define BN_set_flags(b,n)   ((b)->flags|=(n))
+#define BN_get_flags(b,n)   ((b)->flags&(n))
 
 /* get a clone of a BIGNUM with changed flags, for *temporary* use only
  * (the two BIGNUMs cannot not be used in parallel!) */
@@ -276,69 +276,69 @@ typedef struct bn_gencb_st BN_GENCB;
 #endif
 
 struct bignum_st
-	{
-	BN_ULONG *d;	/* Pointer to an array of 'BN_BITS2' bit chunks. */
-	int top;	/* Index of last used d +1. */
-	/* The next are internal book keeping for bn_expand. */
-	int dmax;	/* Size of the d array. */
-	int neg;	/* one if the number is negative */
-	int flags;
-	};
+    {
+    BN_ULONG *d;    /* Pointer to an array of 'BN_BITS2' bit chunks. */
+    int top;    /* Index of last used d +1. */
+    /* The next are internal book keeping for bn_expand. */
+    int dmax;   /* Size of the d array. */
+    int neg;    /* one if the number is negative */
+    int flags;
+    };
 
 /* Used for montgomery multiplication */
 struct bn_mont_ctx_st
-	{
-	int ri;        /* number of bits in R */
-	BIGNUM RR;     /* used to convert to montgomery form */
-	BIGNUM N;      /* The modulus */
-	BIGNUM Ni;     /* R*(1/R mod N) - N*Ni = 1
-	                * (Ni is only stored for bignum algorithm) */
-	BN_ULONG n0;   /* least significant word of Ni */
-	int flags;
-	};
+    {
+    int ri;        /* number of bits in R */
+    BIGNUM RR;     /* used to convert to montgomery form */
+    BIGNUM N;      /* The modulus */
+    BIGNUM Ni;     /* R*(1/R mod N) - N*Ni = 1
+                    * (Ni is only stored for bignum algorithm) */
+    BN_ULONG n0;   /* least significant word of Ni */
+    int flags;
+    };
 
 /* Used for reciprocal division/mod functions
  * It cannot be shared between threads
  */
 struct bn_recp_ctx_st
-	{
-	BIGNUM N;	/* the divisor */
-	BIGNUM Nr;	/* the reciprocal */
-	int num_bits;
-	int shift;
-	int flags;
-	};
+    {
+    BIGNUM N;   /* the divisor */
+    BIGNUM Nr;  /* the reciprocal */
+    int num_bits;
+    int shift;
+    int flags;
+    };
 
 /* Used for slow "generation" functions. */
 struct bn_gencb_st
-	{
-	unsigned int ver;	/* To handle binary (in)compatibility */
-	void *arg;		/* callback-specific data */
-	union
-		{
-		/* if(ver==1) - handles old style callbacks */
-		void (*cb_1)(int, int, void *);
-		/* if(ver==2) - new callback style */
-		int (*cb_2)(int, int, BN_GENCB *);
-		} cb;
-	};
+    {
+    unsigned int ver;   /* To handle binary (in)compatibility */
+    void *arg;      /* callback-specific data */
+    union
+        {
+        /* if(ver==1) - handles old style callbacks */
+        void (*cb_1)(int, int, void *);
+        /* if(ver==2) - new callback style */
+        int (*cb_2)(int, int, BN_GENCB *);
+        } cb;
+    };
 /* Wrapper function to make using BN_GENCB easier,  */
 int BN_GENCB_call(BN_GENCB *cb, int a, int b);
 /* Macro to populate a BN_GENCB structure with an "old"-style callback */
 #define BN_GENCB_set_old(gencb, callback, cb_arg) { \
-		BN_GENCB *tmp_gencb = (gencb); \
-		tmp_gencb->ver = 1; \
-		tmp_gencb->arg = (cb_arg); \
-		tmp_gencb->cb.cb_1 = (callback); }
+        BN_GENCB *tmp_gencb = (gencb); \
+        tmp_gencb->ver = 1; \
+        tmp_gencb->arg = (cb_arg); \
+        tmp_gencb->cb.cb_1 = (callback); }
 /* Macro to populate a BN_GENCB structure with a "new"-style callback */
 #define BN_GENCB_set(gencb, callback, cb_arg) { \
-		BN_GENCB *tmp_gencb = (gencb); \
-		tmp_gencb->ver = 2; \
-		tmp_gencb->arg = (cb_arg); \
-		tmp_gencb->cb.cb_2 = (callback); }
+        BN_GENCB *tmp_gencb = (gencb); \
+        tmp_gencb->ver = 2; \
+        tmp_gencb->arg = (cb_arg); \
+        tmp_gencb->cb.cb_2 = (callback); }
 
 #define BN_prime_checks 0 /* default: select number of iterations
-			     based on the size of the number */
+                 based on the size of the number */
 
 /* number of Miller-Rabin iterations for an error rate  of less than 2^-80
  * for random 'b'-bit input, b >= 100 (taken from table 4.4 in the Handbook
@@ -358,181 +358,181 @@ int BN_GENCB_call(BN_GENCB *cb, int a, int b);
                                 (b) >=  150 ? 18 : \
                                 /* b >= 100 */ 27)
 
-#define BN_num_bytes(a)	((BN_num_bits(a)+7)/8)
+#define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
 
 /* Note that BN_abs_is_word didn't work reliably for w == 0 until 0.9.8 */
 #define BN_abs_is_word(a,w) ((((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w))) || \
-				(((w) == 0) && ((a)->top == 0)))
+                (((w) == 0) && ((a)->top == 0)))
 #define BN_is_zero(a)       ((a)->top == 0)
 #define BN_is_one(a)        (BN_abs_is_word((a),1) && !(a)->neg)
 #define BN_is_word(a,w)     (BN_abs_is_word((a),(w)) && (!(w) || !(a)->neg))
-#define BN_is_odd(a)	    (((a)->top > 0) && ((a)->d[0] & 1))
+#define BN_is_odd(a)        (((a)->top > 0) && ((a)->d[0] & 1))
 
-#define BN_one(a)	(BN_set_word((a),1))
+#define BN_one(a)   (BN_set_word((a),1))
 #define BN_zero_ex(a) \
-	do { \
-		BIGNUM *_tmp_bn = (a); \
-		_tmp_bn->top = 0; \
-		_tmp_bn->neg = 0; \
-	} while(0)
+    do { \
+        BIGNUM *_tmp_bn = (a); \
+        _tmp_bn->top = 0; \
+        _tmp_bn->neg = 0; \
+    } while(0)
 #ifdef OPENSSL_NO_DEPRECATED
-#define BN_zero(a)	BN_zero_ex(a)
+#define BN_zero(a)  BN_zero_ex(a)
 #else
-#define BN_zero(a)	(BN_set_word((a),0))
+#define BN_zero(a)  (BN_set_word((a),0))
 #endif
 
 const BIGNUM *BN_value_one(void);
-char *	BN_options(void);
+char *  BN_options(void);
 BN_CTX *BN_CTX_new(void);
 #ifndef OPENSSL_NO_DEPRECATED
-void	BN_CTX_init(BN_CTX *c);
+void    BN_CTX_init(BN_CTX *c);
 #endif
-void	BN_CTX_free(BN_CTX *c);
-void	BN_CTX_start(BN_CTX *ctx);
+void    BN_CTX_free(BN_CTX *c);
+void    BN_CTX_start(BN_CTX *ctx);
 BIGNUM *BN_CTX_get(BN_CTX *ctx);
-void	BN_CTX_end(BN_CTX *ctx);
+void    BN_CTX_end(BN_CTX *ctx);
 int     BN_rand(BIGNUM *rnd, int bits, int top,int bottom);
 int     BN_pseudo_rand(BIGNUM *rnd, int bits, int top,int bottom);
-int	BN_rand_range(BIGNUM *rnd, BIGNUM *range);
-int	BN_pseudo_rand_range(BIGNUM *rnd, BIGNUM *range);
-int	BN_num_bits(const BIGNUM *a);
-int	BN_num_bits_word(BN_ULONG);
+int BN_rand_range(BIGNUM *rnd, BIGNUM *range);
+int BN_pseudo_rand_range(BIGNUM *rnd, BIGNUM *range);
+int BN_num_bits(const BIGNUM *a);
+int BN_num_bits_word(BN_ULONG);
 BIGNUM *BN_new(void);
-void	BN_init(BIGNUM *);
-void	BN_clear_free(BIGNUM *a);
+void    BN_init(BIGNUM *);
+void    BN_clear_free(BIGNUM *a);
 BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b);
-void	BN_swap(BIGNUM *a, BIGNUM *b);
+void    BN_swap(BIGNUM *a, BIGNUM *b);
 BIGNUM *BN_bin2bn(const unsigned char *s,int len,BIGNUM *ret);
-int	BN_bn2bin(const BIGNUM *a, unsigned char *to);
+int BN_bn2bin(const BIGNUM *a, unsigned char *to);
 BIGNUM *BN_mpi2bn(const unsigned char *s,int len,BIGNUM *ret);
-int	BN_bn2mpi(const BIGNUM *a, unsigned char *to);
-int	BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
-int	BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
-int	BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
-int	BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
-int	BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
-int	BN_sqr(BIGNUM *r, const BIGNUM *a,BN_CTX *ctx);
+int BN_bn2mpi(const BIGNUM *a, unsigned char *to);
+int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
+int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
+int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
+int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
+int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
+int BN_sqr(BIGNUM *r, const BIGNUM *a,BN_CTX *ctx);
 /** BN_set_negative sets sign of a BIGNUM
  * \param  b  pointer to the BIGNUM object
- * \param  n  0 if the BIGNUM b should be positive and a value != 0 otherwise 
+ * \param  n  0 if the BIGNUM b should be positive and a value != 0 otherwise
  */
-void	BN_set_negative(BIGNUM *b, int n);
+void    BN_set_negative(BIGNUM *b, int n);
 /** BN_is_negative returns 1 if the BIGNUM is negative
  * \param  a  pointer to the BIGNUM object
  * \return 1 if a < 0 and 0 otherwise
  */
 #define BN_is_negative(a) ((a)->neg != 0)
 
-int	BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
-	BN_CTX *ctx);
+int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
+    BN_CTX *ctx);
 #define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
-int	BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx);
-int	BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
-int	BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m);
-int	BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
-int	BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m);
-int	BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
-	const BIGNUM *m, BN_CTX *ctx);
-int	BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
-int	BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
-int	BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m);
-int	BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, BN_CTX *ctx);
-int	BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m);
+int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx);
+int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
+int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m);
+int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
+int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m);
+int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+    const BIGNUM *m, BN_CTX *ctx);
+int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
+int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
+int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m);
+int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, BN_CTX *ctx);
+int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m);
 
 BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w);
 BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w);
-int	BN_mul_word(BIGNUM *a, BN_ULONG w);
-int	BN_add_word(BIGNUM *a, BN_ULONG w);
-int	BN_sub_word(BIGNUM *a, BN_ULONG w);
-int	BN_set_word(BIGNUM *a, BN_ULONG w);
+int BN_mul_word(BIGNUM *a, BN_ULONG w);
+int BN_add_word(BIGNUM *a, BN_ULONG w);
+int BN_sub_word(BIGNUM *a, BN_ULONG w);
+int BN_set_word(BIGNUM *a, BN_ULONG w);
 BN_ULONG BN_get_word(const BIGNUM *a);
 
-int	BN_cmp(const BIGNUM *a, const BIGNUM *b);
-void	BN_free(BIGNUM *a);
-int	BN_is_bit_set(const BIGNUM *a, int n);
-int	BN_lshift(BIGNUM *r, const BIGNUM *a, int n);
-int	BN_lshift1(BIGNUM *r, const BIGNUM *a);
-int	BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,BN_CTX *ctx);
+int BN_cmp(const BIGNUM *a, const BIGNUM *b);
+void    BN_free(BIGNUM *a);
+int BN_is_bit_set(const BIGNUM *a, int n);
+int BN_lshift(BIGNUM *r, const BIGNUM *a, int n);
+int BN_lshift1(BIGNUM *r, const BIGNUM *a);
+int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,BN_CTX *ctx);
 
-int	BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
-	const BIGNUM *m,BN_CTX *ctx);
-int	BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
-	const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
+int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+    const BIGNUM *m,BN_CTX *ctx);
+int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+    const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
 int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
-	const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont);
-int	BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p,
-	const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
-int	BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1,
-	const BIGNUM *a2, const BIGNUM *p2,const BIGNUM *m,
-	BN_CTX *ctx,BN_MONT_CTX *m_ctx);
-int	BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
-	const BIGNUM *m,BN_CTX *ctx);
+    const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont);
+int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p,
+    const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
+int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1,
+    const BIGNUM *a2, const BIGNUM *p2,const BIGNUM *m,
+    BN_CTX *ctx,BN_MONT_CTX *m_ctx);
+int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+    const BIGNUM *m,BN_CTX *ctx);
 
-int	BN_mask_bits(BIGNUM *a,int n);
+int BN_mask_bits(BIGNUM *a,int n);
 #ifndef OPENSSL_NO_FP_API
-int	BN_print_fp(FILE *fp, const BIGNUM *a);
+int BN_print_fp(FILE *fp, const BIGNUM *a);
 #endif
 #ifdef HEADER_BIO_H
-int	BN_print(BIO *fp, const BIGNUM *a);
+int BN_print(BIO *fp, const BIGNUM *a);
 #else
-int	BN_print(void *fp, const BIGNUM *a);
+int BN_print(void *fp, const BIGNUM *a);
 #endif
-int	BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx);
-int	BN_rshift(BIGNUM *r, const BIGNUM *a, int n);
-int	BN_rshift1(BIGNUM *r, const BIGNUM *a);
-void	BN_clear(BIGNUM *a);
+int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx);
+int BN_rshift(BIGNUM *r, const BIGNUM *a, int n);
+int BN_rshift1(BIGNUM *r, const BIGNUM *a);
+void    BN_clear(BIGNUM *a);
 BIGNUM *BN_dup(const BIGNUM *a);
-int	BN_ucmp(const BIGNUM *a, const BIGNUM *b);
-int	BN_set_bit(BIGNUM *a, int n);
-int	BN_clear_bit(BIGNUM *a, int n);
-char *	BN_bn2hex(const BIGNUM *a);
-char *	BN_bn2dec(const BIGNUM *a);
-int 	BN_hex2bn(BIGNUM **a, const char *str);
-int 	BN_dec2bn(BIGNUM **a, const char *str);
-int	BN_gcd(BIGNUM *r,const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx);
-int	BN_kronecker(const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx); /* returns -2 for error */
+int BN_ucmp(const BIGNUM *a, const BIGNUM *b);
+int BN_set_bit(BIGNUM *a, int n);
+int BN_clear_bit(BIGNUM *a, int n);
+char *  BN_bn2hex(const BIGNUM *a);
+char *  BN_bn2dec(const BIGNUM *a);
+int     BN_hex2bn(BIGNUM **a, const char *str);
+int     BN_dec2bn(BIGNUM **a, const char *str);
+int BN_gcd(BIGNUM *r,const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx);
+int BN_kronecker(const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx); /* returns -2 for error */
 BIGNUM *BN_mod_inverse(BIGNUM *ret,
-	const BIGNUM *a, const BIGNUM *n,BN_CTX *ctx);
+    const BIGNUM *a, const BIGNUM *n,BN_CTX *ctx);
 BIGNUM *BN_mod_sqrt(BIGNUM *ret,
-	const BIGNUM *a, const BIGNUM *n,BN_CTX *ctx);
+    const BIGNUM *a, const BIGNUM *n,BN_CTX *ctx);
 
 /* Deprecated versions */
 #ifndef OPENSSL_NO_DEPRECATED
 BIGNUM *BN_generate_prime(BIGNUM *ret,int bits,int safe,
-	const BIGNUM *add, const BIGNUM *rem,
-	void (*callback)(int,int,void *),void *cb_arg);
-int	BN_is_prime(const BIGNUM *p,int nchecks,
-	void (*callback)(int,int,void *),
-	BN_CTX *ctx,void *cb_arg);
-int	BN_is_prime_fasttest(const BIGNUM *p,int nchecks,
-	void (*callback)(int,int,void *),BN_CTX *ctx,void *cb_arg,
-	int do_trial_division);
+    const BIGNUM *add, const BIGNUM *rem,
+    void (*callback)(int,int,void *),void *cb_arg);
+int BN_is_prime(const BIGNUM *p,int nchecks,
+    void (*callback)(int,int,void *),
+    BN_CTX *ctx,void *cb_arg);
+int BN_is_prime_fasttest(const BIGNUM *p,int nchecks,
+    void (*callback)(int,int,void *),BN_CTX *ctx,void *cb_arg,
+    int do_trial_division);
 #endif /* !defined(OPENSSL_NO_DEPRECATED) */
 
 /* Newer versions */
-int	BN_generate_prime_ex(BIGNUM *ret,int bits,int safe, const BIGNUM *add,
-		const BIGNUM *rem, BN_GENCB *cb);
-int	BN_is_prime_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx, BN_GENCB *cb);
-int	BN_is_prime_fasttest_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx,
-		int do_trial_division, BN_GENCB *cb);
+int BN_generate_prime_ex(BIGNUM *ret,int bits,int safe, const BIGNUM *add,
+        const BIGNUM *rem, BN_GENCB *cb);
+int BN_is_prime_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx, BN_GENCB *cb);
+int BN_is_prime_fasttest_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx,
+        int do_trial_division, BN_GENCB *cb);
 
 BN_MONT_CTX *BN_MONT_CTX_new(void );
 void BN_MONT_CTX_init(BN_MONT_CTX *ctx);
 int BN_mod_mul_montgomery(BIGNUM *r,const BIGNUM *a,const BIGNUM *b,
-	BN_MONT_CTX *mont, BN_CTX *ctx);
-#define BN_to_montgomery(r,a,mont,ctx)	BN_mod_mul_montgomery(\
-	(r),(a),&((mont)->RR),(mont),(ctx))
+    BN_MONT_CTX *mont, BN_CTX *ctx);
+#define BN_to_montgomery(r,a,mont,ctx)  BN_mod_mul_montgomery(\
+    (r),(a),&((mont)->RR),(mont),(ctx))
 int BN_from_montgomery(BIGNUM *r,const BIGNUM *a,
-	BN_MONT_CTX *mont, BN_CTX *ctx);
+    BN_MONT_CTX *mont, BN_CTX *ctx);
 void BN_MONT_CTX_free(BN_MONT_CTX *mont);
 int BN_MONT_CTX_set(BN_MONT_CTX *mont,const BIGNUM *mod,BN_CTX *ctx);
 BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to,BN_MONT_CTX *from);
 BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock,
-					const BIGNUM *mod, BN_CTX *ctx);
+                    const BIGNUM *mod, BN_CTX *ctx);
 
 /* BN_BLINDING flags */
-#define	BN_BLINDING_NO_UPDATE	0x00000001
-#define	BN_BLINDING_NO_RECREATE	0x00000002
+#define BN_BLINDING_NO_UPDATE   0x00000001
+#define BN_BLINDING_NO_RECREATE 0x00000002
 
 BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod);
 void BN_BLINDING_free(BN_BLINDING *b);
@@ -546,28 +546,28 @@ void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long);
 unsigned long BN_BLINDING_get_flags(const BN_BLINDING *);
 void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long);
 BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
-	const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
-	int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
-			  const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx),
-	BN_MONT_CTX *m_ctx);
+    const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
+    int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+              const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx),
+    BN_MONT_CTX *m_ctx);
 
 #ifndef OPENSSL_NO_DEPRECATED
 void BN_set_params(int mul,int high,int low,int mont);
 int BN_get_params(int which); /* 0, mul, 1 high, 2 low, 3 mont */
 #endif
 
-void	BN_RECP_CTX_init(BN_RECP_CTX *recp);
+void    BN_RECP_CTX_init(BN_RECP_CTX *recp);
 BN_RECP_CTX *BN_RECP_CTX_new(void);
-void	BN_RECP_CTX_free(BN_RECP_CTX *recp);
-int	BN_RECP_CTX_set(BN_RECP_CTX *recp,const BIGNUM *rdiv,BN_CTX *ctx);
-int	BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y,
-	BN_RECP_CTX *recp,BN_CTX *ctx);
-int	BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
-	const BIGNUM *m, BN_CTX *ctx);
-int	BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
-	BN_RECP_CTX *recp, BN_CTX *ctx);
+void    BN_RECP_CTX_free(BN_RECP_CTX *recp);
+int BN_RECP_CTX_set(BN_RECP_CTX *recp,const BIGNUM *rdiv,BN_CTX *ctx);
+int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y,
+    BN_RECP_CTX *recp,BN_CTX *ctx);
+int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+    const BIGNUM *m, BN_CTX *ctx);
+int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
+    BN_RECP_CTX *recp, BN_CTX *ctx);
 
-/* Functions for arithmetic over binary polynomials represented by BIGNUMs. 
+/* Functions for arithmetic over binary polynomials represented by BIGNUMs.
  *
  * The BIGNUM::neg property of BIGNUMs representing binary polynomials is
  * ignored.
@@ -576,49 +576,49 @@ int	BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
  * be expanded to the appropriate size if needed.
  */
 
-int	BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); /*r = a + b*/
+int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); /*r = a + b*/
 #define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b)
-int	BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p); /*r=a mod p*/
-int	BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
-	const BIGNUM *p, BN_CTX *ctx); /* r = (a * b) mod p */
-int	BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
-	BN_CTX *ctx); /* r = (a * a) mod p */
-int	BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p,
-	BN_CTX *ctx); /* r = (1 / b) mod p */
-int	BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
-	const BIGNUM *p, BN_CTX *ctx); /* r = (a / b) mod p */
-int	BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
-	const BIGNUM *p, BN_CTX *ctx); /* r = (a ^ b) mod p */
-int	BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
-	BN_CTX *ctx); /* r = sqrt(a) mod p */
-int	BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
-	BN_CTX *ctx); /* r^2 + r = a mod p */
+int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p); /*r=a mod p*/
+int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+    const BIGNUM *p, BN_CTX *ctx); /* r = (a * b) mod p */
+int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+    BN_CTX *ctx); /* r = (a * a) mod p */
+int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p,
+    BN_CTX *ctx); /* r = (1 / b) mod p */
+int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+    const BIGNUM *p, BN_CTX *ctx); /* r = (a / b) mod p */
+int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+    const BIGNUM *p, BN_CTX *ctx); /* r = (a ^ b) mod p */
+int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+    BN_CTX *ctx); /* r = sqrt(a) mod p */
+int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+    BN_CTX *ctx); /* r^2 + r = a mod p */
 #define BN_GF2m_cmp(a, b) BN_ucmp((a), (b))
 /* Some functions allow for representation of the irreducible polynomials
  * as an unsigned int[], say p.  The irreducible f(t) is then of the form:
  *     t^p[0] + t^p[1] + ... + t^p[k]
  * where m = p[0] > p[1] > ... > p[k] = 0.
  */
-int	BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[]);
-	/* r = a mod p */
-int	BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
-	const unsigned int p[], BN_CTX *ctx); /* r = (a * b) mod p */
-int	BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[],
-	BN_CTX *ctx); /* r = (a * a) mod p */
-int	BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const unsigned int p[],
-	BN_CTX *ctx); /* r = (1 / b) mod p */
-int	BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
-	const unsigned int p[], BN_CTX *ctx); /* r = (a / b) mod p */
-int	BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
-	const unsigned int p[], BN_CTX *ctx); /* r = (a ^ b) mod p */
-int	BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a,
-	const unsigned int p[], BN_CTX *ctx); /* r = sqrt(a) mod p */
-int	BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a,
-	const unsigned int p[], BN_CTX *ctx); /* r^2 + r = a mod p */
-int	BN_GF2m_poly2arr(const BIGNUM *a, unsigned int p[], int max);
-int	BN_GF2m_arr2poly(const unsigned int p[], BIGNUM *a);
+int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[]);
+    /* r = a mod p */
+int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+    const unsigned int p[], BN_CTX *ctx); /* r = (a * b) mod p */
+int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[],
+    BN_CTX *ctx); /* r = (a * a) mod p */
+int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const unsigned int p[],
+    BN_CTX *ctx); /* r = (1 / b) mod p */
+int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+    const unsigned int p[], BN_CTX *ctx); /* r = (a / b) mod p */
+int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+    const unsigned int p[], BN_CTX *ctx); /* r = (a ^ b) mod p */
+int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a,
+    const unsigned int p[], BN_CTX *ctx); /* r = sqrt(a) mod p */
+int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a,
+    const unsigned int p[], BN_CTX *ctx); /* r^2 + r = a mod p */
+int BN_GF2m_poly2arr(const BIGNUM *a, unsigned int p[], int max);
+int BN_GF2m_arr2poly(const unsigned int p[], BIGNUM *a);
 
-/* faster mod functions for the 'NIST primes' 
+/* faster mod functions for the 'NIST primes'
  * 0 <= a < p^2 */
 int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
 int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
@@ -635,7 +635,7 @@ const BIGNUM *BN_get0_nist_prime_521(void);
 /* library internal functions */
 
 #define bn_expand(a,bits) ((((((bits+BN_BITS2-1))/BN_BITS2)) <= (a)->dmax)?\
-	(a):bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2))
+    (a):bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2))
 #define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words)))
 BIGNUM *bn_expand2(BIGNUM *a, int words);
 #ifndef OPENSSL_NO_DEPRECATED
@@ -682,20 +682,20 @@ int RAND_pseudo_bytes(unsigned char *buf,int num);
 #define BN_DEBUG_TRIX
 #endif
 #define bn_pollute(a) \
-	do { \
-		const BIGNUM *_bnum1 = (a); \
-		if(_bnum1->top < _bnum1->dmax) { \
-			unsigned char _tmp_char; \
-			/* We cast away const without the compiler knowing, any \
-			 * *genuinely* constant variables that aren't mutable \
-			 * wouldn't be constructed with top!=dmax. */ \
-			BN_ULONG *_not_const; \
-			memcpy(&_not_const, &_bnum1->d, sizeof(BN_ULONG*)); \
-			RAND_pseudo_bytes(&_tmp_char, 1); \
-			memset((unsigned char *)(_not_const + _bnum1->top), _tmp_char, \
-				(_bnum1->dmax - _bnum1->top) * sizeof(BN_ULONG)); \
-		} \
-	} while(0)
+    do { \
+        const BIGNUM *_bnum1 = (a); \
+        if(_bnum1->top < _bnum1->dmax) { \
+            unsigned char _tmp_char; \
+            /* We cast away const without the compiler knowing, any \
+             * *genuinely* constant variables that aren't mutable \
+             * wouldn't be constructed with top!=dmax. */ \
+            BN_ULONG *_not_const; \
+            memcpy(&_not_const, &_bnum1->d, sizeof(BN_ULONG*)); \
+            RAND_pseudo_bytes(&_tmp_char, 1); \
+            memset((unsigned char *)(_not_const + _bnum1->top), _tmp_char, \
+                (_bnum1->dmax - _bnum1->top) * sizeof(BN_ULONG)); \
+        } \
+    } while(0)
 #ifdef BN_DEBUG_TRIX
 #undef RAND_pseudo_bytes
 #endif
@@ -703,35 +703,35 @@ int RAND_pseudo_bytes(unsigned char *buf,int num);
 #define bn_pollute(a)
 #endif
 #define bn_check_top(a) \
-	do { \
-		const BIGNUM *_bnum2 = (a); \
-		if (_bnum2 != NULL) { \
-			assert((_bnum2->top == 0) || \
-				(_bnum2->d[_bnum2->top - 1] != 0)); \
-			bn_pollute(_bnum2); \
-		} \
-	} while(0)
+    do { \
+        const BIGNUM *_bnum2 = (a); \
+        if (_bnum2 != NULL) { \
+            assert((_bnum2->top == 0) || \
+                (_bnum2->d[_bnum2->top - 1] != 0)); \
+            bn_pollute(_bnum2); \
+        } \
+    } while(0)
 
-#define bn_fix_top(a)		bn_check_top(a)
+#define bn_fix_top(a)       bn_check_top(a)
 
 #else /* !BN_DEBUG */
 
 #define bn_pollute(a)
 #define bn_check_top(a)
-#define bn_fix_top(a)		bn_correct_top(a)
+#define bn_fix_top(a)       bn_correct_top(a)
 
 #endif
 
 #define bn_correct_top(a) \
         { \
         BN_ULONG *ftl; \
-	if ((a)->top > 0) \
-		{ \
-		for (ftl= &((a)->d[(a)->top-1]); (a)->top > 0; (a)->top--) \
-		if (*(ftl--)) break; \
-		} \
-	bn_pollute(a); \
-	}
+    if ((a)->top > 0) \
+        { \
+        for (ftl= &((a)->d[(a)->top-1]); (a)->top > 0; (a)->top--) \
+        if (*(ftl--)) break; \
+        } \
+    bn_pollute(a); \
+    }
 
 BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w);
 BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w);
@@ -763,63 +763,63 @@ void ERR_load_BN_strings(void);
 /* Error codes for the BN functions. */
 
 /* Function codes. */
-#define BN_F_BNRAND					 127
-#define BN_F_BN_BLINDING_CONVERT_EX			 100
-#define BN_F_BN_BLINDING_CREATE_PARAM			 128
-#define BN_F_BN_BLINDING_INVERT_EX			 101
-#define BN_F_BN_BLINDING_NEW				 102
-#define BN_F_BN_BLINDING_UPDATE				 103
-#define BN_F_BN_BN2DEC					 104
-#define BN_F_BN_BN2HEX					 105
-#define BN_F_BN_CTX_GET					 116
-#define BN_F_BN_CTX_NEW					 106
-#define BN_F_BN_CTX_START				 129
-#define BN_F_BN_DIV					 107
-#define BN_F_BN_DIV_RECP				 130
-#define BN_F_BN_EXP					 123
-#define BN_F_BN_EXPAND2					 108
-#define BN_F_BN_EXPAND_INTERNAL				 120
-#define BN_F_BN_GF2M_MOD				 131
-#define BN_F_BN_GF2M_MOD_EXP				 132
-#define BN_F_BN_GF2M_MOD_MUL				 133
-#define BN_F_BN_GF2M_MOD_SOLVE_QUAD			 134
-#define BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR			 135
-#define BN_F_BN_GF2M_MOD_SQR				 136
-#define BN_F_BN_GF2M_MOD_SQRT				 137
-#define BN_F_BN_MOD_EXP2_MONT				 118
-#define BN_F_BN_MOD_EXP_MONT				 109
-#define BN_F_BN_MOD_EXP_MONT_CONSTTIME			 124
-#define BN_F_BN_MOD_EXP_MONT_WORD			 117
-#define BN_F_BN_MOD_EXP_RECP				 125
-#define BN_F_BN_MOD_EXP_SIMPLE				 126
-#define BN_F_BN_MOD_INVERSE				 110
-#define BN_F_BN_MOD_LSHIFT_QUICK			 119
-#define BN_F_BN_MOD_MUL_RECIPROCAL			 111
-#define BN_F_BN_MOD_SQRT				 121
-#define BN_F_BN_MPI2BN					 112
-#define BN_F_BN_NEW					 113
-#define BN_F_BN_RAND					 114
-#define BN_F_BN_RAND_RANGE				 122
-#define BN_F_BN_USUB					 115
+#define BN_F_BNRAND                  127
+#define BN_F_BN_BLINDING_CONVERT_EX          100
+#define BN_F_BN_BLINDING_CREATE_PARAM            128
+#define BN_F_BN_BLINDING_INVERT_EX           101
+#define BN_F_BN_BLINDING_NEW                 102
+#define BN_F_BN_BLINDING_UPDATE              103
+#define BN_F_BN_BN2DEC                   104
+#define BN_F_BN_BN2HEX                   105
+#define BN_F_BN_CTX_GET                  116
+#define BN_F_BN_CTX_NEW                  106
+#define BN_F_BN_CTX_START                129
+#define BN_F_BN_DIV                  107
+#define BN_F_BN_DIV_RECP                 130
+#define BN_F_BN_EXP                  123
+#define BN_F_BN_EXPAND2                  108
+#define BN_F_BN_EXPAND_INTERNAL              120
+#define BN_F_BN_GF2M_MOD                 131
+#define BN_F_BN_GF2M_MOD_EXP                 132
+#define BN_F_BN_GF2M_MOD_MUL                 133
+#define BN_F_BN_GF2M_MOD_SOLVE_QUAD          134
+#define BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR          135
+#define BN_F_BN_GF2M_MOD_SQR                 136
+#define BN_F_BN_GF2M_MOD_SQRT                137
+#define BN_F_BN_MOD_EXP2_MONT                118
+#define BN_F_BN_MOD_EXP_MONT                 109
+#define BN_F_BN_MOD_EXP_MONT_CONSTTIME           124
+#define BN_F_BN_MOD_EXP_MONT_WORD            117
+#define BN_F_BN_MOD_EXP_RECP                 125
+#define BN_F_BN_MOD_EXP_SIMPLE               126
+#define BN_F_BN_MOD_INVERSE              110
+#define BN_F_BN_MOD_LSHIFT_QUICK             119
+#define BN_F_BN_MOD_MUL_RECIPROCAL           111
+#define BN_F_BN_MOD_SQRT                 121
+#define BN_F_BN_MPI2BN                   112
+#define BN_F_BN_NEW                  113
+#define BN_F_BN_RAND                     114
+#define BN_F_BN_RAND_RANGE               122
+#define BN_F_BN_USUB                     115
 
 /* Reason codes. */
-#define BN_R_ARG2_LT_ARG3				 100
-#define BN_R_BAD_RECIPROCAL				 101
-#define BN_R_BIGNUM_TOO_LONG				 114
-#define BN_R_CALLED_WITH_EVEN_MODULUS			 102
-#define BN_R_DIV_BY_ZERO				 103
-#define BN_R_ENCODING_ERROR				 104
-#define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA		 105
-#define BN_R_INPUT_NOT_REDUCED				 110
-#define BN_R_INVALID_LENGTH				 106
-#define BN_R_INVALID_RANGE				 115
-#define BN_R_NOT_A_SQUARE				 111
-#define BN_R_NOT_INITIALIZED				 107
-#define BN_R_NO_INVERSE					 108
-#define BN_R_NO_SOLUTION				 116
-#define BN_R_P_IS_NOT_PRIME				 112
-#define BN_R_TOO_MANY_ITERATIONS			 113
-#define BN_R_TOO_MANY_TEMPORARY_VARIABLES		 109
+#define BN_R_ARG2_LT_ARG3                100
+#define BN_R_BAD_RECIPROCAL              101
+#define BN_R_BIGNUM_TOO_LONG                 114
+#define BN_R_CALLED_WITH_EVEN_MODULUS            102
+#define BN_R_DIV_BY_ZERO                 103
+#define BN_R_ENCODING_ERROR              104
+#define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA        105
+#define BN_R_INPUT_NOT_REDUCED               110
+#define BN_R_INVALID_LENGTH              106
+#define BN_R_INVALID_RANGE               115
+#define BN_R_NOT_A_SQUARE                111
+#define BN_R_NOT_INITIALIZED                 107
+#define BN_R_NO_INVERSE                  108
+#define BN_R_NO_SOLUTION                 116
+#define BN_R_P_IS_NOT_PRIME              112
+#define BN_R_TOO_MANY_ITERATIONS             113
+#define BN_R_TOO_MANY_TEMPORARY_VARIABLES        109
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/buffer.h b/dep/include/openssl/buffer.h
index 1db96074503..82e07a96953 100644
--- a/dep/include/openssl/buffer.h
+++ b/dep/include/openssl/buffer.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -75,19 +75,19 @@ extern "C" {
 /* typedef struct buf_mem_st BUF_MEM; */
 
 struct buf_mem_st
-	{
-	int length;	/* current number of bytes */
-	char *data;
-	int max;	/* size of buffer */
-	};
+    {
+    int length; /* current number of bytes */
+    char *data;
+    int max;    /* size of buffer */
+    };
 
 BUF_MEM *BUF_MEM_new(void);
-void	BUF_MEM_free(BUF_MEM *a);
-int	BUF_MEM_grow(BUF_MEM *str, int len);
-int	BUF_MEM_grow_clean(BUF_MEM *str, int len);
-char *	BUF_strdup(const char *str);
-char *	BUF_strndup(const char *str, size_t siz);
-void *	BUF_memdup(const void *data, size_t siz);
+void    BUF_MEM_free(BUF_MEM *a);
+int BUF_MEM_grow(BUF_MEM *str, int len);
+int BUF_MEM_grow_clean(BUF_MEM *str, int len);
+char *  BUF_strdup(const char *str);
+char *  BUF_strndup(const char *str, size_t siz);
+void *  BUF_memdup(const void *data, size_t siz);
 
 /* safe string functions */
 size_t BUF_strlcpy(char *dst,const char *src,size_t siz);
@@ -103,12 +103,12 @@ void ERR_load_BUF_strings(void);
 /* Error codes for the BUF functions. */
 
 /* Function codes. */
-#define BUF_F_BUF_MEMDUP				 103
-#define BUF_F_BUF_MEM_GROW				 100
-#define BUF_F_BUF_MEM_GROW_CLEAN			 105
-#define BUF_F_BUF_MEM_NEW				 101
-#define BUF_F_BUF_STRDUP				 102
-#define BUF_F_BUF_STRNDUP				 104
+#define BUF_F_BUF_MEMDUP                 103
+#define BUF_F_BUF_MEM_GROW               100
+#define BUF_F_BUF_MEM_GROW_CLEAN             105
+#define BUF_F_BUF_MEM_NEW                101
+#define BUF_F_BUF_STRDUP                 102
+#define BUF_F_BUF_STRNDUP                104
 
 /* Reason codes. */
 
diff --git a/dep/include/openssl/cast.h b/dep/include/openssl/cast.h
index 90b45b950aa..812bb485319 100644
--- a/dep/include/openssl/cast.h
+++ b/dep/include/openssl/cast.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -69,34 +69,34 @@ extern "C" {
 #error CAST is disabled.
 #endif
 
-#define CAST_ENCRYPT	1
-#define CAST_DECRYPT	0
+#define CAST_ENCRYPT    1
+#define CAST_DECRYPT    0
 
 #define CAST_LONG unsigned long
 
-#define CAST_BLOCK	8
-#define CAST_KEY_LENGTH	16
+#define CAST_BLOCK  8
+#define CAST_KEY_LENGTH 16
 
 typedef struct cast_key_st
-	{
-	CAST_LONG data[32];
-	int short_key;	/* Use reduced rounds for short key */
-	} CAST_KEY;
+    {
+    CAST_LONG data[32];
+    int short_key;  /* Use reduced rounds for short key */
+    } CAST_KEY;
+
 
- 
 void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data);
 void CAST_ecb_encrypt(const unsigned char *in,unsigned char *out,CAST_KEY *key,
-		      int enc);
+              int enc);
 void CAST_encrypt(CAST_LONG *data,CAST_KEY *key);
 void CAST_decrypt(CAST_LONG *data,CAST_KEY *key);
 void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
-		      CAST_KEY *ks, unsigned char *iv, int enc);
+              CAST_KEY *ks, unsigned char *iv, int enc);
 void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out,
-			long length, CAST_KEY *schedule, unsigned char *ivec,
-			int *num, int enc);
-void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, 
-			long length, CAST_KEY *schedule, unsigned char *ivec,
-			int *num);
+            long length, CAST_KEY *schedule, unsigned char *ivec,
+            int *num, int enc);
+void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out,
+            long length, CAST_KEY *schedule, unsigned char *ivec,
+            int *num);
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/comp.h b/dep/include/openssl/comp.h
index 5d59354a571..c94262fc051 100644
--- a/dep/include/openssl/comp.h
+++ b/dep/include/openssl/comp.h
@@ -11,40 +11,40 @@ extern "C" {
 typedef struct comp_ctx_st COMP_CTX;
 
 typedef struct comp_method_st
-	{
-	int type;		/* NID for compression library */
-	const char *name;	/* A text string to identify the library */
-	int (*init)(COMP_CTX *ctx);
-	void (*finish)(COMP_CTX *ctx);
-	int (*compress)(COMP_CTX *ctx,
-			unsigned char *out, unsigned int olen,
-			unsigned char *in, unsigned int ilen);
-	int (*expand)(COMP_CTX *ctx,
-		      unsigned char *out, unsigned int olen,
-		      unsigned char *in, unsigned int ilen);
-	/* The following two do NOTHING, but are kept for backward compatibility */
-	long (*ctrl)(void);
-	long (*callback_ctrl)(void);
-	} COMP_METHOD;
+    {
+    int type;       /* NID for compression library */
+    const char *name;   /* A text string to identify the library */
+    int (*init)(COMP_CTX *ctx);
+    void (*finish)(COMP_CTX *ctx);
+    int (*compress)(COMP_CTX *ctx,
+            unsigned char *out, unsigned int olen,
+            unsigned char *in, unsigned int ilen);
+    int (*expand)(COMP_CTX *ctx,
+              unsigned char *out, unsigned int olen,
+              unsigned char *in, unsigned int ilen);
+    /* The following two do NOTHING, but are kept for backward compatibility */
+    long (*ctrl)(void);
+    long (*callback_ctrl)(void);
+    } COMP_METHOD;
 
 struct comp_ctx_st
-	{
-	COMP_METHOD *meth;
-	unsigned long compress_in;
-	unsigned long compress_out;
-	unsigned long expand_in;
-	unsigned long expand_out;
+    {
+    COMP_METHOD *meth;
+    unsigned long compress_in;
+    unsigned long compress_out;
+    unsigned long expand_in;
+    unsigned long expand_out;
 
-	CRYPTO_EX_DATA	ex_data;
-	};
+    CRYPTO_EX_DATA  ex_data;
+    };
 
 
 COMP_CTX *COMP_CTX_new(COMP_METHOD *meth);
 void COMP_CTX_free(COMP_CTX *ctx);
 int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
-	unsigned char *in, int ilen);
+    unsigned char *in, int ilen);
 int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,
-	unsigned char *in, int ilen);
+    unsigned char *in, int ilen);
 COMP_METHOD *COMP_rle(void );
 COMP_METHOD *COMP_zlib(void );
 
diff --git a/dep/include/openssl/conf.h b/dep/include/openssl/conf.h
index 4c073dd8317..30272a5ceca 100644
--- a/dep/include/openssl/conf.h
+++ b/dep/include/openssl/conf.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -72,11 +72,11 @@ extern "C" {
 #endif
 
 typedef struct
-	{
-	char *section;
-	char *name;
-	char *value;
-	} CONF_VALUE;
+    {
+    char *section;
+    char *name;
+    char *value;
+    } CONF_VALUE;
 
 DECLARE_STACK_OF(CONF_VALUE)
 DECLARE_STACK_OF(CONF_MODULE)
@@ -87,18 +87,18 @@ struct conf_method_st;
 typedef struct conf_method_st CONF_METHOD;
 
 struct conf_method_st
-	{
-	const char *name;
-	CONF *(*create)(CONF_METHOD *meth);
-	int (*init)(CONF *conf);
-	int (*destroy)(CONF *conf);
-	int (*destroy_data)(CONF *conf);
-	int (*load_bio)(CONF *conf, BIO *bp, long *eline);
-	int (*dump)(const CONF *conf, BIO *bp);
-	int (*is_number)(const CONF *conf, char c);
-	int (*to_int)(const CONF *conf, char c);
-	int (*load)(CONF *conf, const char *name, long *eline);
-	};
+    {
+    const char *name;
+    CONF *(*create)(CONF_METHOD *meth);
+    int (*init)(CONF *conf);
+    int (*destroy)(CONF *conf);
+    int (*destroy_data)(CONF *conf);
+    int (*load_bio)(CONF *conf, BIO *bp, long *eline);
+    int (*dump)(const CONF *conf, BIO *bp);
+    int (*is_number)(const CONF *conf, char c);
+    int (*to_int)(const CONF *conf, char c);
+    int (*load)(CONF *conf, const char *name, long *eline);
+    };
 
 /* Module definitions */
 
@@ -109,11 +109,11 @@ typedef struct conf_module_st CONF_MODULE;
 typedef int conf_init_func(CONF_IMODULE *md, const CONF *cnf);
 typedef void conf_finish_func(CONF_IMODULE *md);
 
-#define	CONF_MFLAGS_IGNORE_ERRORS	0x1
-#define CONF_MFLAGS_IGNORE_RETURN_CODES	0x2
-#define CONF_MFLAGS_SILENT		0x4
-#define CONF_MFLAGS_NO_DSO		0x8
-#define CONF_MFLAGS_IGNORE_MISSING_FILE	0x10
+#define CONF_MFLAGS_IGNORE_ERRORS   0x1
+#define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2
+#define CONF_MFLAGS_SILENT      0x4
+#define CONF_MFLAGS_NO_DSO      0x8
+#define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10
 
 int CONF_set_default_method(CONF_METHOD *meth);
 void CONF_set_nconf(CONF *conf,LHASH *hash);
@@ -136,11 +136,11 @@ void OPENSSL_no_config(void);
    If that wasn't the case, the above functions would have been replaced */
 
 struct conf_st
-	{
-	CONF_METHOD *meth;
-	void *meth_data;
-	LHASH *data;
-	};
+    {
+    CONF_METHOD *meth;
+    void *meth_data;
+    LHASH *data;
+    };
 
 CONF *NCONF_new(CONF_METHOD *meth);
 CONF_METHOD *NCONF_default(void);
@@ -159,28 +159,28 @@ int NCONF_load_bio(CONF *conf, BIO *bp,long *eline);
 STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section);
 char *NCONF_get_string(const CONF *conf,const char *group,const char *name);
 int NCONF_get_number_e(const CONF *conf,const char *group,const char *name,
-		       long *result);
+               long *result);
 int NCONF_dump_fp(const CONF *conf, FILE *out);
 int NCONF_dump_bio(const CONF *conf, BIO *out);
 
 #if 0 /* The following function has no error checking,
-	 and should therefore be avoided */
+     and should therefore be avoided */
 long NCONF_get_number(CONF *conf,char *group,char *name);
 #else
 #define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r)
 #endif
-  
+
 /* Module functions */
 
 int CONF_modules_load(const CONF *cnf, const char *appname,
-		      unsigned long flags);
+              unsigned long flags);
 int CONF_modules_load_file(const char *filename, const char *appname,
-			   unsigned long flags);
+               unsigned long flags);
 void CONF_modules_unload(int all);
 void CONF_modules_finish(void);
 void CONF_modules_free(void);
 int CONF_module_add(const char *name, conf_init_func *ifunc,
-		    conf_finish_func *ffunc);
+            conf_finish_func *ffunc);
 
 const char *CONF_imodule_get_name(const CONF_IMODULE *md);
 const char *CONF_imodule_get_value(const CONF_IMODULE *md);
@@ -195,7 +195,7 @@ void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data);
 char *CONF_get1_default_config_file(void);
 
 int CONF_parse_list(const char *list, int sep, int nospc,
-	int (*list_cb)(const char *elem, int len, void *usr), void *arg);
+    int (*list_cb)(const char *elem, int len, void *usr), void *arg);
 
 void OPENSSL_load_builtin_modules(void);
 
@@ -208,44 +208,44 @@ void ERR_load_CONF_strings(void);
 /* Error codes for the CONF functions. */
 
 /* Function codes. */
-#define CONF_F_CONF_DUMP_FP				 104
-#define CONF_F_CONF_LOAD				 100
-#define CONF_F_CONF_LOAD_BIO				 102
-#define CONF_F_CONF_LOAD_FP				 103
-#define CONF_F_CONF_MODULES_LOAD			 116
-#define CONF_F_DEF_LOAD					 120
-#define CONF_F_DEF_LOAD_BIO				 121
-#define CONF_F_MODULE_INIT				 115
-#define CONF_F_MODULE_LOAD_DSO				 117
-#define CONF_F_MODULE_RUN				 118
-#define CONF_F_NCONF_DUMP_BIO				 105
-#define CONF_F_NCONF_DUMP_FP				 106
-#define CONF_F_NCONF_GET_NUMBER				 107
-#define CONF_F_NCONF_GET_NUMBER_E			 112
-#define CONF_F_NCONF_GET_SECTION			 108
-#define CONF_F_NCONF_GET_STRING				 109
-#define CONF_F_NCONF_LOAD				 113
-#define CONF_F_NCONF_LOAD_BIO				 110
-#define CONF_F_NCONF_LOAD_FP				 114
-#define CONF_F_NCONF_NEW				 111
-#define CONF_F_STR_COPY					 101
+#define CONF_F_CONF_DUMP_FP              104
+#define CONF_F_CONF_LOAD                 100
+#define CONF_F_CONF_LOAD_BIO                 102
+#define CONF_F_CONF_LOAD_FP              103
+#define CONF_F_CONF_MODULES_LOAD             116
+#define CONF_F_DEF_LOAD                  120
+#define CONF_F_DEF_LOAD_BIO              121
+#define CONF_F_MODULE_INIT               115
+#define CONF_F_MODULE_LOAD_DSO               117
+#define CONF_F_MODULE_RUN                118
+#define CONF_F_NCONF_DUMP_BIO                105
+#define CONF_F_NCONF_DUMP_FP                 106
+#define CONF_F_NCONF_GET_NUMBER              107
+#define CONF_F_NCONF_GET_NUMBER_E            112
+#define CONF_F_NCONF_GET_SECTION             108
+#define CONF_F_NCONF_GET_STRING              109
+#define CONF_F_NCONF_LOAD                113
+#define CONF_F_NCONF_LOAD_BIO                110
+#define CONF_F_NCONF_LOAD_FP                 114
+#define CONF_F_NCONF_NEW                 111
+#define CONF_F_STR_COPY                  101
 
 /* Reason codes. */
-#define CONF_R_ERROR_LOADING_DSO			 110
-#define CONF_R_MISSING_CLOSE_SQUARE_BRACKET		 100
-#define CONF_R_MISSING_EQUAL_SIGN			 101
-#define CONF_R_MISSING_FINISH_FUNCTION			 111
-#define CONF_R_MISSING_INIT_FUNCTION			 112
-#define CONF_R_MODULE_INITIALIZATION_ERROR		 109
-#define CONF_R_NO_CLOSE_BRACE				 102
-#define CONF_R_NO_CONF					 105
-#define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE		 106
-#define CONF_R_NO_SECTION				 107
-#define CONF_R_NO_SUCH_FILE				 114
-#define CONF_R_NO_VALUE					 108
-#define CONF_R_UNABLE_TO_CREATE_NEW_SECTION		 103
-#define CONF_R_UNKNOWN_MODULE_NAME			 113
-#define CONF_R_VARIABLE_HAS_NO_VALUE			 104
+#define CONF_R_ERROR_LOADING_DSO             110
+#define CONF_R_MISSING_CLOSE_SQUARE_BRACKET      100
+#define CONF_R_MISSING_EQUAL_SIGN            101
+#define CONF_R_MISSING_FINISH_FUNCTION           111
+#define CONF_R_MISSING_INIT_FUNCTION             112
+#define CONF_R_MODULE_INITIALIZATION_ERROR       109
+#define CONF_R_NO_CLOSE_BRACE                102
+#define CONF_R_NO_CONF                   105
+#define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE       106
+#define CONF_R_NO_SECTION                107
+#define CONF_R_NO_SUCH_FILE              114
+#define CONF_R_NO_VALUE                  108
+#define CONF_R_UNABLE_TO_CREATE_NEW_SECTION      103
+#define CONF_R_UNKNOWN_MODULE_NAME           113
+#define CONF_R_VARIABLE_HAS_NO_VALUE             104
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/conf_api.h b/dep/include/openssl/conf_api.h
index 87a954aff63..b102271dc13 100644
--- a/dep/include/openssl/conf_api.h
+++ b/dep/include/openssl/conf_api.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -72,11 +72,11 @@ CONF_VALUE *_CONF_new_section(CONF *conf, const char *section);
 CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section);
 /* Up until OpenSSL 0.9.5a, this was CONF_get_section */
 STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf,
-					       const char *section);
+                           const char *section);
 
 int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value);
 char *_CONF_get_string(const CONF *conf, const char *section,
-		       const char *name);
+               const char *name);
 long _CONF_get_number(const CONF *conf, const char *section, const char *name);
 
 int _CONF_new_data(CONF *conf);
diff --git a/dep/include/openssl/crypto.h b/dep/include/openssl/crypto.h
index d2b5ffe3325..c29ae5b62af 100644
--- a/dep/include/openssl/crypto.h
+++ b/dep/include/openssl/crypto.h
@@ -7,7 +7,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -58,21 +58,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -87,10 +87,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -102,7 +102,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -110,7 +110,7 @@
  */
 /* ====================================================================
  * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
- * ECDH support in OpenSSL originally developed by 
+ * ECDH support in OpenSSL originally developed by
  * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
  */
 
@@ -145,106 +145,106 @@ extern "C" {
 /* Backward compatibility to SSLeay */
 /* This is more to be used to check the correct DLL is being used
  * in the MS world. */
-#define SSLEAY_VERSION_NUMBER	OPENSSL_VERSION_NUMBER
-#define SSLEAY_VERSION		0
-/* #define SSLEAY_OPTIONS	1 no longer supported */
-#define SSLEAY_CFLAGS		2
-#define SSLEAY_BUILT_ON		3
-#define SSLEAY_PLATFORM		4
-#define SSLEAY_DIR		5
+#define SSLEAY_VERSION_NUMBER   OPENSSL_VERSION_NUMBER
+#define SSLEAY_VERSION      0
+/* #define SSLEAY_OPTIONS   1 no longer supported */
+#define SSLEAY_CFLAGS       2
+#define SSLEAY_BUILT_ON     3
+#define SSLEAY_PLATFORM     4
+#define SSLEAY_DIR      5
 
 /* Already declared in ossl_typ.h */
 #if 0
 typedef struct crypto_ex_data_st CRYPTO_EX_DATA;
 /* Called when a new object is created */
 typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
-					int idx, long argl, void *argp);
+                    int idx, long argl, void *argp);
 /* Called when an object is free()ed */
 typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
-					int idx, long argl, void *argp);
+                    int idx, long argl, void *argp);
 /* Called when we need to dup an object */
-typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, 
-					int idx, long argl, void *argp);
+typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d,
+                    int idx, long argl, void *argp);
 #endif
 
 /* A generic structure to pass assorted data in a expandable way */
 typedef struct openssl_item_st
-	{
-	int code;
-	void *value;		/* Not used for flag attributes */
-	size_t value_size;	/* Max size of value for output, length for input */
-	size_t *value_length;	/* Returned length of value for output */
-	} OPENSSL_ITEM;
+    {
+    int code;
+    void *value;        /* Not used for flag attributes */
+    size_t value_size;  /* Max size of value for output, length for input */
+    size_t *value_length;   /* Returned length of value for output */
+    } OPENSSL_ITEM;
 
 
 /* When changing the CRYPTO_LOCK_* list, be sure to maintin the text lock
  * names in cryptlib.c
  */
 
-#define	CRYPTO_LOCK_ERR			1
-#define	CRYPTO_LOCK_EX_DATA		2
-#define	CRYPTO_LOCK_X509		3
-#define	CRYPTO_LOCK_X509_INFO		4
-#define	CRYPTO_LOCK_X509_PKEY		5
-#define CRYPTO_LOCK_X509_CRL		6
-#define CRYPTO_LOCK_X509_REQ		7
-#define CRYPTO_LOCK_DSA			8
-#define CRYPTO_LOCK_RSA			9
-#define CRYPTO_LOCK_EVP_PKEY		10
-#define CRYPTO_LOCK_X509_STORE		11
-#define CRYPTO_LOCK_SSL_CTX		12
-#define CRYPTO_LOCK_SSL_CERT		13
-#define CRYPTO_LOCK_SSL_SESSION		14
-#define CRYPTO_LOCK_SSL_SESS_CERT	15
-#define CRYPTO_LOCK_SSL			16
-#define CRYPTO_LOCK_SSL_METHOD		17
-#define CRYPTO_LOCK_RAND		18
-#define CRYPTO_LOCK_RAND2		19
-#define CRYPTO_LOCK_MALLOC		20
-#define CRYPTO_LOCK_BIO			21
-#define CRYPTO_LOCK_GETHOSTBYNAME	22
-#define CRYPTO_LOCK_GETSERVBYNAME	23
-#define CRYPTO_LOCK_READDIR		24
-#define CRYPTO_LOCK_RSA_BLINDING	25
-#define CRYPTO_LOCK_DH			26
-#define CRYPTO_LOCK_MALLOC2		27
-#define CRYPTO_LOCK_DSO			28
-#define CRYPTO_LOCK_DYNLOCK		29
-#define CRYPTO_LOCK_ENGINE		30
-#define CRYPTO_LOCK_UI			31
+#define CRYPTO_LOCK_ERR         1
+#define CRYPTO_LOCK_EX_DATA     2
+#define CRYPTO_LOCK_X509        3
+#define CRYPTO_LOCK_X509_INFO       4
+#define CRYPTO_LOCK_X509_PKEY       5
+#define CRYPTO_LOCK_X509_CRL        6
+#define CRYPTO_LOCK_X509_REQ        7
+#define CRYPTO_LOCK_DSA         8
+#define CRYPTO_LOCK_RSA         9
+#define CRYPTO_LOCK_EVP_PKEY        10
+#define CRYPTO_LOCK_X509_STORE      11
+#define CRYPTO_LOCK_SSL_CTX     12
+#define CRYPTO_LOCK_SSL_CERT        13
+#define CRYPTO_LOCK_SSL_SESSION     14
+#define CRYPTO_LOCK_SSL_SESS_CERT   15
+#define CRYPTO_LOCK_SSL         16
+#define CRYPTO_LOCK_SSL_METHOD      17
+#define CRYPTO_LOCK_RAND        18
+#define CRYPTO_LOCK_RAND2       19
+#define CRYPTO_LOCK_MALLOC      20
+#define CRYPTO_LOCK_BIO         21
+#define CRYPTO_LOCK_GETHOSTBYNAME   22
+#define CRYPTO_LOCK_GETSERVBYNAME   23
+#define CRYPTO_LOCK_READDIR     24
+#define CRYPTO_LOCK_RSA_BLINDING    25
+#define CRYPTO_LOCK_DH          26
+#define CRYPTO_LOCK_MALLOC2     27
+#define CRYPTO_LOCK_DSO         28
+#define CRYPTO_LOCK_DYNLOCK     29
+#define CRYPTO_LOCK_ENGINE      30
+#define CRYPTO_LOCK_UI          31
 #define CRYPTO_LOCK_ECDSA               32
-#define CRYPTO_LOCK_EC			33
-#define CRYPTO_LOCK_ECDH		34
-#define CRYPTO_LOCK_BN  		35
-#define CRYPTO_LOCK_EC_PRE_COMP		36
-#define CRYPTO_LOCK_STORE		37
-#define CRYPTO_LOCK_COMP		38
-#define CRYPTO_NUM_LOCKS		39
+#define CRYPTO_LOCK_EC          33
+#define CRYPTO_LOCK_ECDH        34
+#define CRYPTO_LOCK_BN          35
+#define CRYPTO_LOCK_EC_PRE_COMP     36
+#define CRYPTO_LOCK_STORE       37
+#define CRYPTO_LOCK_COMP        38
+#define CRYPTO_NUM_LOCKS        39
 
-#define CRYPTO_LOCK		1
-#define CRYPTO_UNLOCK		2
-#define CRYPTO_READ		4
-#define CRYPTO_WRITE		8
+#define CRYPTO_LOCK     1
+#define CRYPTO_UNLOCK       2
+#define CRYPTO_READ     4
+#define CRYPTO_WRITE        8
 
 #ifndef OPENSSL_NO_LOCKING
 #ifndef CRYPTO_w_lock
-#define CRYPTO_w_lock(type)	\
-	CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
-#define CRYPTO_w_unlock(type)	\
-	CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
-#define CRYPTO_r_lock(type)	\
-	CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__)
-#define CRYPTO_r_unlock(type)	\
-	CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__)
-#define CRYPTO_add(addr,amount,type)	\
-	CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__)
+#define CRYPTO_w_lock(type) \
+    CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
+#define CRYPTO_w_unlock(type)   \
+    CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
+#define CRYPTO_r_lock(type) \
+    CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__)
+#define CRYPTO_r_unlock(type)   \
+    CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__)
+#define CRYPTO_add(addr,amount,type)    \
+    CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__)
 #endif
 #else
 #define CRYPTO_w_lock(a)
 #define CRYPTO_w_unlock(a)
 #define CRYPTO_r_lock(a)
 #define CRYPTO_r_unlock(a)
-#define CRYPTO_add(a,b,c)	((*(a))+=(b))
+#define CRYPTO_add(a,b,c)   ((*(a))+=(b))
 #endif
 
 /* Some applications as well as some parts of OpenSSL need to allocate
@@ -252,27 +252,27 @@ typedef struct openssl_item_st
    makes this possible in a type-safe manner.  */
 /* struct CRYPTO_dynlock_value has to be defined by the application. */
 typedef struct
-	{
-	int references;
-	struct CRYPTO_dynlock_value *data;
-	} CRYPTO_dynlock;
+    {
+    int references;
+    struct CRYPTO_dynlock_value *data;
+    } CRYPTO_dynlock;
 
 
 /* The following can be used to detect memory leaks in the SSLeay library.
  * It used, it turns on malloc checking */
 
-#define CRYPTO_MEM_CHECK_OFF	0x0	/* an enume */
-#define CRYPTO_MEM_CHECK_ON	0x1	/* a bit */
-#define CRYPTO_MEM_CHECK_ENABLE	0x2	/* a bit */
-#define CRYPTO_MEM_CHECK_DISABLE 0x3	/* an enume */
+#define CRYPTO_MEM_CHECK_OFF    0x0 /* an enume */
+#define CRYPTO_MEM_CHECK_ON 0x1 /* a bit */
+#define CRYPTO_MEM_CHECK_ENABLE 0x2 /* a bit */
+#define CRYPTO_MEM_CHECK_DISABLE 0x3    /* an enume */
 
 /* The following are bit values to turn on or off options connected to the
  * malloc checking functionality */
 
 /* Adds time to the memory checking information */
-#define V_CRYPTO_MDEBUG_TIME	0x1 /* a bit */
+#define V_CRYPTO_MDEBUG_TIME    0x1 /* a bit */
 /* Adds thread number to the memory checking information */
-#define V_CRYPTO_MDEBUG_THREAD	0x2 /* a bit */
+#define V_CRYPTO_MDEBUG_THREAD  0x2 /* a bit */
 
 #define V_CRYPTO_MDEBUG_ALL (V_CRYPTO_MDEBUG_TIME | V_CRYPTO_MDEBUG_THREAD)
 
@@ -281,22 +281,22 @@ typedef struct
 typedef struct bio_st BIO_dummy;
 
 struct crypto_ex_data_st
-	{
-	STACK *sk;
-	int dummy; /* gcc is screwing up this data structure :-( */
-	};
+    {
+    STACK *sk;
+    int dummy; /* gcc is screwing up this data structure :-( */
+    };
 
 /* This stuff is basically class callback functions
  * The current classes are SSL_CTX, SSL, SSL_SESSION, and a few more */
 
 typedef struct crypto_ex_data_func_st
-	{
-	long argl;	/* Arbitary long */
-	void *argp;	/* Arbitary void * */
-	CRYPTO_EX_new *new_func;
-	CRYPTO_EX_free *free_func;
-	CRYPTO_EX_dup *dup_func;
-	} CRYPTO_EX_DATA_FUNCS;
+    {
+    long argl;  /* Arbitary long */
+    void *argp; /* Arbitary void * */
+    CRYPTO_EX_new *new_func;
+    CRYPTO_EX_free *free_func;
+    CRYPTO_EX_dup *dup_func;
+    } CRYPTO_EX_DATA_FUNCS;
 
 DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS)
 
@@ -304,34 +304,34 @@ DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS)
  * entry.
  */
 
-#define CRYPTO_EX_INDEX_BIO		0
-#define CRYPTO_EX_INDEX_SSL		1
-#define CRYPTO_EX_INDEX_SSL_CTX		2
-#define CRYPTO_EX_INDEX_SSL_SESSION	3
-#define CRYPTO_EX_INDEX_X509_STORE	4
-#define CRYPTO_EX_INDEX_X509_STORE_CTX	5
-#define CRYPTO_EX_INDEX_RSA		6
-#define CRYPTO_EX_INDEX_DSA		7
-#define CRYPTO_EX_INDEX_DH		8
-#define CRYPTO_EX_INDEX_ENGINE		9
-#define CRYPTO_EX_INDEX_X509		10
-#define CRYPTO_EX_INDEX_UI		11
-#define CRYPTO_EX_INDEX_ECDSA		12
-#define CRYPTO_EX_INDEX_ECDH		13
-#define CRYPTO_EX_INDEX_COMP		14
-#define CRYPTO_EX_INDEX_STORE		15
+#define CRYPTO_EX_INDEX_BIO     0
+#define CRYPTO_EX_INDEX_SSL     1
+#define CRYPTO_EX_INDEX_SSL_CTX     2
+#define CRYPTO_EX_INDEX_SSL_SESSION 3
+#define CRYPTO_EX_INDEX_X509_STORE  4
+#define CRYPTO_EX_INDEX_X509_STORE_CTX  5
+#define CRYPTO_EX_INDEX_RSA     6
+#define CRYPTO_EX_INDEX_DSA     7
+#define CRYPTO_EX_INDEX_DH      8
+#define CRYPTO_EX_INDEX_ENGINE      9
+#define CRYPTO_EX_INDEX_X509        10
+#define CRYPTO_EX_INDEX_UI      11
+#define CRYPTO_EX_INDEX_ECDSA       12
+#define CRYPTO_EX_INDEX_ECDH        13
+#define CRYPTO_EX_INDEX_COMP        14
+#define CRYPTO_EX_INDEX_STORE       15
 
 /* Dynamically assigned indexes start from this value (don't use directly, use
  * via CRYPTO_ex_data_new_class). */
-#define CRYPTO_EX_INDEX_USER		100
+#define CRYPTO_EX_INDEX_USER        100
 
 
 /* This is the default callbacks, but we can have others as well:
  * this is needed in Win32 where the application malloc and the
  * library malloc may not be the same.
  */
-#define CRYPTO_malloc_init()	CRYPTO_set_mem_functions(\
-	malloc, realloc, free)
+#define CRYPTO_malloc_init()    CRYPTO_set_mem_functions(\
+    malloc, realloc, free)
 
 #if defined CRYPTO_MDEBUG_ALL || defined CRYPTO_MDEBUG_TIME || defined CRYPTO_MDEBUG_THREAD
 # ifndef CRYPTO_MDEBUG /* avoid duplicate #define */
@@ -341,39 +341,39 @@ DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS)
 
 /* Set standard debugging functions (not done by default
  * unless CRYPTO_MDEBUG is defined) */
-#define CRYPTO_malloc_debug_init()	do {\
-	CRYPTO_set_mem_debug_functions(\
-		CRYPTO_dbg_malloc,\
-		CRYPTO_dbg_realloc,\
-		CRYPTO_dbg_free,\
-		CRYPTO_dbg_set_options,\
-		CRYPTO_dbg_get_options);\
-	} while(0)
+#define CRYPTO_malloc_debug_init()  do {\
+    CRYPTO_set_mem_debug_functions(\
+        CRYPTO_dbg_malloc,\
+        CRYPTO_dbg_realloc,\
+        CRYPTO_dbg_free,\
+        CRYPTO_dbg_set_options,\
+        CRYPTO_dbg_get_options);\
+    } while(0)
 
 int CRYPTO_mem_ctrl(int mode);
 int CRYPTO_is_mem_check_on(void);
 
 /* for applications */
 #define MemCheck_start() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON)
-#define MemCheck_stop()	CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF)
+#define MemCheck_stop() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF)
 
 /* for library-internal use */
-#define MemCheck_on()	CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE)
-#define MemCheck_off()	CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE)
+#define MemCheck_on()   CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE)
+#define MemCheck_off()  CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE)
 #define is_MemCheck_on() CRYPTO_is_mem_check_on()
 
-#define OPENSSL_malloc(num)	CRYPTO_malloc((int)num,__FILE__,__LINE__)
+#define OPENSSL_malloc(num) CRYPTO_malloc((int)num,__FILE__,__LINE__)
 #define OPENSSL_realloc(addr,num) \
-	CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__)
+    CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__)
 #define OPENSSL_realloc_clean(addr,old_num,num) \
-	CRYPTO_realloc_clean(addr,old_num,num,__FILE__,__LINE__)
+    CRYPTO_realloc_clean(addr,old_num,num,__FILE__,__LINE__)
 #define OPENSSL_remalloc(addr,num) \
-	CRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__)
-#define OPENSSL_freeFunc	CRYPTO_free
-#define OPENSSL_free(addr)	CRYPTO_free(addr)
+    CRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__)
+#define OPENSSL_freeFunc    CRYPTO_free
+#define OPENSSL_free(addr)  CRYPTO_free(addr)
 
 #define OPENSSL_malloc_locked(num) \
-	CRYPTO_malloc_locked((int)num,__FILE__,__LINE__)
+    CRYPTO_malloc_locked((int)num,__FILE__,__LINE__)
 #define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr)
 
 
@@ -383,7 +383,7 @@ unsigned long SSLeay(void);
 int OPENSSL_issetugid(void);
 
 /* An opaque type representing an implementation of "ex_data" support */
-typedef struct st_CRYPTO_EX_DATA_IMPL	CRYPTO_EX_DATA_IMPL;
+typedef struct st_CRYPTO_EX_DATA_IMPL   CRYPTO_EX_DATA_IMPL;
 /* Return an opaque pointer to the current "ex_data" implementation */
 const CRYPTO_EX_DATA_IMPL *CRYPTO_get_ex_data_implementation(void);
 /* Sets the "ex_data" implementation to be used (if it's not too late) */
@@ -392,13 +392,13 @@ int CRYPTO_set_ex_data_implementation(const CRYPTO_EX_DATA_IMPL *i);
 int CRYPTO_ex_data_new_class(void);
 /* Within a given class, get/register a new index */
 int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,
-		CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func,
-		CRYPTO_EX_free *free_func);
+        CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func,
+        CRYPTO_EX_free *free_func);
 /* Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a given
  * class (invokes whatever per-class callbacks are applicable) */
 int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
 int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,
-		CRYPTO_EX_DATA *from);
+        CRYPTO_EX_DATA *from);
 void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
 /* Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular index
  * (relative to the class type involved) */
@@ -413,19 +413,19 @@ int CRYPTO_get_new_lockid(char *name);
 int CRYPTO_num_locks(void); /* return CRYPTO_NUM_LOCKS (shared libs!) */
 void CRYPTO_lock(int mode, int type,const char *file,int line);
 void CRYPTO_set_locking_callback(void (*func)(int mode,int type,
-					      const char *file,int line));
+                          const char *file,int line));
 void (*CRYPTO_get_locking_callback(void))(int mode,int type,const char *file,
-		int line);
+        int line);
 void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount,int type,
-					      const char *file, int line));
+                          const char *file, int line));
 int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type,
-					  const char *file,int line);
+                      const char *file,int line);
 void CRYPTO_set_id_callback(unsigned long (*func)(void));
 unsigned long (*CRYPTO_get_id_callback(void))(void);
 unsigned long CRYPTO_thread_id(void);
 const char *CRYPTO_get_lock_name(int type);
 int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file,
-		    int line);
+            int line);
 
 int CRYPTO_get_new_dynlockid(void);
 void CRYPTO_destroy_dynlockid(int i);
@@ -447,10 +447,10 @@ int CRYPTO_set_mem_ex_functions(void *(*m)(size_t,const char *,int),
 int CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t,const char *,int),
                                        void (*free_func)(void *));
 int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int),
-				   void (*r)(void *,void *,int,const char *,int,int),
-				   void (*f)(void *,int),
-				   void (*so)(long),
-				   long (*go)(void));
+                   void (*r)(void *,void *,int,const char *,int,int),
+                   void (*f)(void *,int),
+                   void (*so)(long),
+                   long (*go)(void));
 void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *));
 void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *));
 void CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int),
@@ -459,10 +459,10 @@ void CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int),
 void CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t,const char *,int),
                                         void (**f)(void *));
 void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int),
-				    void (**r)(void *,void *,int,const char *,int,int),
-				    void (**f)(void *,int),
-				    void (**so)(long),
-				    long (**go)(void));
+                    void (**r)(void *,void *,int,const char *,int,int),
+                    void (**f)(void *,int),
+                    void (**so)(long),
+                    long (**go)(void));
 
 void *CRYPTO_malloc_locked(int num, const char *file, int line);
 void CRYPTO_free_locked(void *);
@@ -470,7 +470,7 @@ void *CRYPTO_malloc(int num, const char *file, int line);
 void CRYPTO_free(void *);
 void *CRYPTO_realloc(void *addr,int num, const char *file, int line);
 void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file,
-			   int line);
+               int line);
 void *CRYPTO_remalloc(void *addr,int num, const char *file, int line);
 
 void OPENSSL_cleanse(void *ptr, size_t len);
@@ -489,8 +489,8 @@ int CRYPTO_remove_all_info(void);
  * used as default in CRYPTO_MDEBUG compilations): */
 /* The last argument has the following significance:
  *
- * 0:	called before the actual memory allocation has taken place
- * 1:	called after the actual memory allocation has taken place
+ * 0:   called before the actual memory allocation has taken place
+ * 1:   called after the actual memory allocation has taken place
  */
 void CRYPTO_dbg_malloc(void *addr,int num,const char *file,int line,int before_p);
 void CRYPTO_dbg_realloc(void *addr1,void *addr2,int num,const char *file,int line,int before_p);
@@ -531,18 +531,18 @@ void ERR_load_CRYPTO_strings(void);
 /* Error codes for the CRYPTO functions. */
 
 /* Function codes. */
-#define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX		 100
-#define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID		 103
-#define CRYPTO_F_CRYPTO_GET_NEW_LOCKID			 101
-#define CRYPTO_F_CRYPTO_SET_EX_DATA			 102
-#define CRYPTO_F_DEF_ADD_INDEX				 104
-#define CRYPTO_F_DEF_GET_CLASS				 105
-#define CRYPTO_F_INT_DUP_EX_DATA			 106
-#define CRYPTO_F_INT_FREE_EX_DATA			 107
-#define CRYPTO_F_INT_NEW_EX_DATA			 108
+#define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX         100
+#define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID        103
+#define CRYPTO_F_CRYPTO_GET_NEW_LOCKID           101
+#define CRYPTO_F_CRYPTO_SET_EX_DATA          102
+#define CRYPTO_F_DEF_ADD_INDEX               104
+#define CRYPTO_F_DEF_GET_CLASS               105
+#define CRYPTO_F_INT_DUP_EX_DATA             106
+#define CRYPTO_F_INT_FREE_EX_DATA            107
+#define CRYPTO_F_INT_NEW_EX_DATA             108
 
 /* Reason codes. */
-#define CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK		 100
+#define CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK      100
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/des.h b/dep/include/openssl/des.h
index 3cbc2b568e9..c8306de0f88 100644
--- a/dep/include/openssl/des.h
+++ b/dep/include/openssl/des.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -59,8 +59,8 @@
 #ifndef HEADER_NEW_DES_H
 #define HEADER_NEW_DES_H
 
-#include 	/* OPENSSL_EXTERN, OPENSSL_NO_DES,
-				   DES_LONG (via openssl/opensslconf.h */
+#include   /* OPENSSL_EXTERN, OPENSSL_NO_DES,
+                   DES_LONG (via openssl/opensslconf.h */
 
 #ifdef OPENSSL_NO_DES
 #error DES is disabled.
@@ -83,12 +83,12 @@ typedef /* const */ unsigned char const_DES_cblock[8];
 typedef struct DES_ks
     {
     union
-	{
-	DES_cblock cblock;
-	/* make sure things are correct size on machines with
-	 * 8 byte longs */
-	DES_LONG deslong[2];
-	} ks[16];
+    {
+    DES_cblock cblock;
+    /* make sure things are correct size on machines with
+     * 8 byte longs */
+    DES_LONG deslong[2];
+    } ks[16];
     } DES_key_schedule;
 
 #ifndef OPENSSL_DISABLE_OLD_DES_SUPPORT
@@ -101,117 +101,117 @@ typedef struct DES_ks
 # include 
 #endif
 
-#define DES_KEY_SZ 	(sizeof(DES_cblock))
+#define DES_KEY_SZ  (sizeof(DES_cblock))
 #define DES_SCHEDULE_SZ (sizeof(DES_key_schedule))
 
-#define DES_ENCRYPT	1
-#define DES_DECRYPT	0
+#define DES_ENCRYPT 1
+#define DES_DECRYPT 0
 
-#define DES_CBC_MODE	0
-#define DES_PCBC_MODE	1
+#define DES_CBC_MODE    0
+#define DES_PCBC_MODE   1
 
 #define DES_ecb2_encrypt(i,o,k1,k2,e) \
-	DES_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
+    DES_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
 
 #define DES_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
-	DES_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
+    DES_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
 
 #define DES_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
-	DES_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
+    DES_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
 
 #define DES_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
-	DES_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
+    DES_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
 
-OPENSSL_DECLARE_GLOBAL(int,DES_check_key);	/* defaults to false */
+OPENSSL_DECLARE_GLOBAL(int,DES_check_key);  /* defaults to false */
 #define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key)
-OPENSSL_DECLARE_GLOBAL(int,DES_rw_mode);	/* defaults to DES_PCBC_MODE */
+OPENSSL_DECLARE_GLOBAL(int,DES_rw_mode);    /* defaults to DES_PCBC_MODE */
 #define DES_rw_mode OPENSSL_GLOBAL_REF(DES_rw_mode)
 
 const char *DES_options(void);
 void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output,
-		      DES_key_schedule *ks1,DES_key_schedule *ks2,
-		      DES_key_schedule *ks3, int enc);
+              DES_key_schedule *ks1,DES_key_schedule *ks2,
+              DES_key_schedule *ks3, int enc);
 DES_LONG DES_cbc_cksum(const unsigned char *input,DES_cblock *output,
-		       long length,DES_key_schedule *schedule,
-		       const_DES_cblock *ivec);
+               long length,DES_key_schedule *schedule,
+               const_DES_cblock *ivec);
 /* DES_cbc_encrypt does not update the IV!  Use DES_ncbc_encrypt instead. */
 void DES_cbc_encrypt(const unsigned char *input,unsigned char *output,
-		     long length,DES_key_schedule *schedule,DES_cblock *ivec,
-		     int enc);
+             long length,DES_key_schedule *schedule,DES_cblock *ivec,
+             int enc);
 void DES_ncbc_encrypt(const unsigned char *input,unsigned char *output,
-		      long length,DES_key_schedule *schedule,DES_cblock *ivec,
-		      int enc);
+              long length,DES_key_schedule *schedule,DES_cblock *ivec,
+              int enc);
 void DES_xcbc_encrypt(const unsigned char *input,unsigned char *output,
-		      long length,DES_key_schedule *schedule,DES_cblock *ivec,
-		      const_DES_cblock *inw,const_DES_cblock *outw,int enc);
+              long length,DES_key_schedule *schedule,DES_cblock *ivec,
+              const_DES_cblock *inw,const_DES_cblock *outw,int enc);
 void DES_cfb_encrypt(const unsigned char *in,unsigned char *out,int numbits,
-		     long length,DES_key_schedule *schedule,DES_cblock *ivec,
-		     int enc);
+             long length,DES_key_schedule *schedule,DES_cblock *ivec,
+             int enc);
 void DES_ecb_encrypt(const_DES_cblock *input,DES_cblock *output,
-		     DES_key_schedule *ks,int enc);
+             DES_key_schedule *ks,int enc);
 
-/* 	This is the DES encryption function that gets called by just about
-	every other DES routine in the library.  You should not use this
-	function except to implement 'modes' of DES.  I say this because the
-	functions that call this routine do the conversion from 'char *' to
-	long, and this needs to be done to make sure 'non-aligned' memory
-	access do not occur.  The characters are loaded 'little endian'.
-	Data is a pointer to 2 unsigned long's and ks is the
-	DES_key_schedule to use.  enc, is non zero specifies encryption,
-	zero if decryption. */
+/*  This is the DES encryption function that gets called by just about
+    every other DES routine in the library.  You should not use this
+    function except to implement 'modes' of DES.  I say this because the
+    functions that call this routine do the conversion from 'char *' to
+    long, and this needs to be done to make sure 'non-aligned' memory
+    access do not occur.  The characters are loaded 'little endian'.
+    Data is a pointer to 2 unsigned long's and ks is the
+    DES_key_schedule to use.  enc, is non zero specifies encryption,
+    zero if decryption. */
 void DES_encrypt1(DES_LONG *data,DES_key_schedule *ks, int enc);
 
-/* 	This functions is the same as DES_encrypt1() except that the DES
-	initial permutation (IP) and final permutation (FP) have been left
-	out.  As for DES_encrypt1(), you should not use this function.
-	It is used by the routines in the library that implement triple DES.
-	IP() DES_encrypt2() DES_encrypt2() DES_encrypt2() FP() is the same
-	as DES_encrypt1() DES_encrypt1() DES_encrypt1() except faster :-). */
+/*  This functions is the same as DES_encrypt1() except that the DES
+    initial permutation (IP) and final permutation (FP) have been left
+    out.  As for DES_encrypt1(), you should not use this function.
+    It is used by the routines in the library that implement triple DES.
+    IP() DES_encrypt2() DES_encrypt2() DES_encrypt2() FP() is the same
+    as DES_encrypt1() DES_encrypt1() DES_encrypt1() except faster :-). */
 void DES_encrypt2(DES_LONG *data,DES_key_schedule *ks, int enc);
 
 void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1,
-		  DES_key_schedule *ks2, DES_key_schedule *ks3);
+          DES_key_schedule *ks2, DES_key_schedule *ks3);
 void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1,
-		  DES_key_schedule *ks2, DES_key_schedule *ks3);
-void DES_ede3_cbc_encrypt(const unsigned char *input,unsigned char *output, 
-			  long length,
-			  DES_key_schedule *ks1,DES_key_schedule *ks2,
-			  DES_key_schedule *ks3,DES_cblock *ivec,int enc);
+          DES_key_schedule *ks2, DES_key_schedule *ks3);
+void DES_ede3_cbc_encrypt(const unsigned char *input,unsigned char *output,
+              long length,
+              DES_key_schedule *ks1,DES_key_schedule *ks2,
+              DES_key_schedule *ks3,DES_cblock *ivec,int enc);
 void DES_ede3_cbcm_encrypt(const unsigned char *in,unsigned char *out,
-			   long length,
-			   DES_key_schedule *ks1,DES_key_schedule *ks2,
-			   DES_key_schedule *ks3,
-			   DES_cblock *ivec1,DES_cblock *ivec2,
-			   int enc);
+               long length,
+               DES_key_schedule *ks1,DES_key_schedule *ks2,
+               DES_key_schedule *ks3,
+               DES_cblock *ivec1,DES_cblock *ivec2,
+               int enc);
 void DES_ede3_cfb64_encrypt(const unsigned char *in,unsigned char *out,
-			    long length,DES_key_schedule *ks1,
-			    DES_key_schedule *ks2,DES_key_schedule *ks3,
-			    DES_cblock *ivec,int *num,int enc);
+                long length,DES_key_schedule *ks1,
+                DES_key_schedule *ks2,DES_key_schedule *ks3,
+                DES_cblock *ivec,int *num,int enc);
 void DES_ede3_cfb_encrypt(const unsigned char *in,unsigned char *out,
-			  int numbits,long length,DES_key_schedule *ks1,
-			  DES_key_schedule *ks2,DES_key_schedule *ks3,
-			  DES_cblock *ivec,int enc);
+              int numbits,long length,DES_key_schedule *ks1,
+              DES_key_schedule *ks2,DES_key_schedule *ks3,
+              DES_cblock *ivec,int enc);
 void DES_ede3_ofb64_encrypt(const unsigned char *in,unsigned char *out,
-			    long length,DES_key_schedule *ks1,
-			    DES_key_schedule *ks2,DES_key_schedule *ks3,
-			    DES_cblock *ivec,int *num);
+                long length,DES_key_schedule *ks1,
+                DES_key_schedule *ks2,DES_key_schedule *ks3,
+                DES_cblock *ivec,int *num);
 
 void DES_xwhite_in2out(const_DES_cblock *DES_key,const_DES_cblock *in_white,
-		       DES_cblock *out_white);
+               DES_cblock *out_white);
 
 int DES_enc_read(int fd,void *buf,int len,DES_key_schedule *sched,
-		 DES_cblock *iv);
+         DES_cblock *iv);
 int DES_enc_write(int fd,const void *buf,int len,DES_key_schedule *sched,
-		  DES_cblock *iv);
+          DES_cblock *iv);
 char *DES_fcrypt(const char *buf,const char *salt, char *ret);
 char *DES_crypt(const char *buf,const char *salt);
 void DES_ofb_encrypt(const unsigned char *in,unsigned char *out,int numbits,
-		     long length,DES_key_schedule *schedule,DES_cblock *ivec);
+             long length,DES_key_schedule *schedule,DES_cblock *ivec);
 void DES_pcbc_encrypt(const unsigned char *input,unsigned char *output,
-		      long length,DES_key_schedule *schedule,DES_cblock *ivec,
-		      int enc);
+              long length,DES_key_schedule *schedule,DES_cblock *ivec,
+              int enc);
 DES_LONG DES_quad_cksum(const unsigned char *input,DES_cblock output[],
-			long length,int out_count,DES_cblock *seed);
+            long length,int out_count,DES_cblock *seed);
 int DES_random_key(DES_cblock *ret);
 void DES_set_odd_parity(DES_cblock *key);
 int DES_check_key_parity(const_DES_cblock *key);
@@ -226,14 +226,14 @@ void DES_set_key_unchecked(const_DES_cblock *key,DES_key_schedule *schedule);
 void DES_string_to_key(const char *str,DES_cblock *key);
 void DES_string_to_2keys(const char *str,DES_cblock *key1,DES_cblock *key2);
 void DES_cfb64_encrypt(const unsigned char *in,unsigned char *out,long length,
-		       DES_key_schedule *schedule,DES_cblock *ivec,int *num,
-		       int enc);
+               DES_key_schedule *schedule,DES_cblock *ivec,int *num,
+               int enc);
 void DES_ofb64_encrypt(const unsigned char *in,unsigned char *out,long length,
-		       DES_key_schedule *schedule,DES_cblock *ivec,int *num);
+               DES_key_schedule *schedule,DES_cblock *ivec,int *num);
 
 int DES_read_password(DES_cblock *key, const char *prompt, int verify);
 int DES_read_2passwords(DES_cblock *key1, DES_cblock *key2, const char *prompt,
-	int verify);
+    int verify);
 
 #define DES_fixup_key_parity DES_set_odd_parity
 
diff --git a/dep/include/openssl/des_old.h b/dep/include/openssl/des_old.h
index 1b0620c3a2e..11edf40471c 100644
--- a/dep/include/openssl/des_old.h
+++ b/dep/include/openssl/des_old.h
@@ -42,7 +42,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -91,7 +91,7 @@
 #ifndef HEADER_DES_H
 #define HEADER_DES_H
 
-#include 	/* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */
+#include   /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */
 
 #ifdef OPENSSL_NO_DES
 #error DES is disabled.
@@ -122,116 +122,116 @@ extern "C" {
 
 typedef unsigned char _ossl_old_des_cblock[8];
 typedef struct _ossl_old_des_ks_struct
-	{
-	union	{
-		_ossl_old_des_cblock _;
-		/* make sure things are correct size on machines with
-		 * 8 byte longs */
-		DES_LONG pad[2];
-		} ks;
-	} _ossl_old_des_key_schedule[16];
+    {
+    union   {
+        _ossl_old_des_cblock _;
+        /* make sure things are correct size on machines with
+         * 8 byte longs */
+        DES_LONG pad[2];
+        } ks;
+    } _ossl_old_des_key_schedule[16];
 
 #ifndef OPENSSL_DES_LIBDES_COMPATIBILITY
 #define des_cblock DES_cblock
 #define const_des_cblock const_DES_cblock
 #define des_key_schedule DES_key_schedule
 #define des_ecb3_encrypt(i,o,k1,k2,k3,e)\
-	DES_ecb3_encrypt((i),(o),&(k1),&(k2),&(k3),(e))
+    DES_ecb3_encrypt((i),(o),&(k1),&(k2),&(k3),(e))
 #define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\
-	DES_ede3_cbc_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(e))
+    DES_ede3_cbc_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(e))
 #define des_ede3_cbcm_encrypt(i,o,l,k1,k2,k3,iv1,iv2,e)\
-	DES_ede3_cbcm_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv1),(iv2),(e))
+    DES_ede3_cbcm_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv1),(iv2),(e))
 #define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\
-	DES_ede3_cfb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n),(e))
+    DES_ede3_cfb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n),(e))
 #define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\
-	DES_ede3_ofb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n))
+    DES_ede3_ofb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n))
 #define des_options()\
-	DES_options()
+    DES_options()
 #define des_cbc_cksum(i,o,l,k,iv)\
-	DES_cbc_cksum((i),(o),(l),&(k),(iv))
+    DES_cbc_cksum((i),(o),(l),&(k),(iv))
 #define des_cbc_encrypt(i,o,l,k,iv,e)\
-	DES_cbc_encrypt((i),(o),(l),&(k),(iv),(e))
+    DES_cbc_encrypt((i),(o),(l),&(k),(iv),(e))
 #define des_ncbc_encrypt(i,o,l,k,iv,e)\
-	DES_ncbc_encrypt((i),(o),(l),&(k),(iv),(e))
+    DES_ncbc_encrypt((i),(o),(l),&(k),(iv),(e))
 #define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\
-	DES_xcbc_encrypt((i),(o),(l),&(k),(iv),(inw),(outw),(e))
+    DES_xcbc_encrypt((i),(o),(l),&(k),(iv),(inw),(outw),(e))
 #define des_cfb_encrypt(i,o,n,l,k,iv,e)\
-	DES_cfb_encrypt((i),(o),(n),(l),&(k),(iv),(e))
+    DES_cfb_encrypt((i),(o),(n),(l),&(k),(iv),(e))
 #define des_ecb_encrypt(i,o,k,e)\
-	DES_ecb_encrypt((i),(o),&(k),(e))
+    DES_ecb_encrypt((i),(o),&(k),(e))
 #define des_encrypt1(d,k,e)\
-	DES_encrypt1((d),&(k),(e))
+    DES_encrypt1((d),&(k),(e))
 #define des_encrypt2(d,k,e)\
-	DES_encrypt2((d),&(k),(e))
+    DES_encrypt2((d),&(k),(e))
 #define des_encrypt3(d,k1,k2,k3)\
-	DES_encrypt3((d),&(k1),&(k2),&(k3))
+    DES_encrypt3((d),&(k1),&(k2),&(k3))
 #define des_decrypt3(d,k1,k2,k3)\
-	DES_decrypt3((d),&(k1),&(k2),&(k3))
+    DES_decrypt3((d),&(k1),&(k2),&(k3))
 #define des_xwhite_in2out(k,i,o)\
-	DES_xwhite_in2out((k),(i),(o))
+    DES_xwhite_in2out((k),(i),(o))
 #define des_enc_read(f,b,l,k,iv)\
-	DES_enc_read((f),(b),(l),&(k),(iv))
+    DES_enc_read((f),(b),(l),&(k),(iv))
 #define des_enc_write(f,b,l,k,iv)\
-	DES_enc_write((f),(b),(l),&(k),(iv))
+    DES_enc_write((f),(b),(l),&(k),(iv))
 #define des_fcrypt(b,s,r)\
-	DES_fcrypt((b),(s),(r))
+    DES_fcrypt((b),(s),(r))
 #if 0
 #define des_crypt(b,s)\
-	DES_crypt((b),(s))
+    DES_crypt((b),(s))
 #if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__)
 #define crypt(b,s)\
-	DES_crypt((b),(s))
+    DES_crypt((b),(s))
 #endif
 #endif
 #define des_ofb_encrypt(i,o,n,l,k,iv)\
-	DES_ofb_encrypt((i),(o),(n),(l),&(k),(iv))
+    DES_ofb_encrypt((i),(o),(n),(l),&(k),(iv))
 #define des_pcbc_encrypt(i,o,l,k,iv,e)\
-	DES_pcbc_encrypt((i),(o),(l),&(k),(iv),(e))
+    DES_pcbc_encrypt((i),(o),(l),&(k),(iv),(e))
 #define des_quad_cksum(i,o,l,c,s)\
-	DES_quad_cksum((i),(o),(l),(c),(s))
+    DES_quad_cksum((i),(o),(l),(c),(s))
 #define des_random_seed(k)\
-	_ossl_096_des_random_seed((k))
+    _ossl_096_des_random_seed((k))
 #define des_random_key(r)\
-	DES_random_key((r))
+    DES_random_key((r))
 #define des_read_password(k,p,v) \
-	DES_read_password((k),(p),(v))
+    DES_read_password((k),(p),(v))
 #define des_read_2passwords(k1,k2,p,v) \
-	DES_read_2passwords((k1),(k2),(p),(v))
+    DES_read_2passwords((k1),(k2),(p),(v))
 #define des_set_odd_parity(k)\
-	DES_set_odd_parity((k))
+    DES_set_odd_parity((k))
 #define des_check_key_parity(k)\
-	DES_check_key_parity((k))
+    DES_check_key_parity((k))
 #define des_is_weak_key(k)\
-	DES_is_weak_key((k))
+    DES_is_weak_key((k))
 #define des_set_key(k,ks)\
-	DES_set_key((k),&(ks))
+    DES_set_key((k),&(ks))
 #define des_key_sched(k,ks)\
-	DES_key_sched((k),&(ks))
+    DES_key_sched((k),&(ks))
 #define des_set_key_checked(k,ks)\
-	DES_set_key_checked((k),&(ks))
+    DES_set_key_checked((k),&(ks))
 #define des_set_key_unchecked(k,ks)\
-	DES_set_key_unchecked((k),&(ks))
+    DES_set_key_unchecked((k),&(ks))
 #define des_string_to_key(s,k)\
-	DES_string_to_key((s),(k))
+    DES_string_to_key((s),(k))
 #define des_string_to_2keys(s,k1,k2)\
-	DES_string_to_2keys((s),(k1),(k2))
+    DES_string_to_2keys((s),(k1),(k2))
 #define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\
-	DES_cfb64_encrypt((i),(o),(l),&(ks),(iv),(n),(e))
+    DES_cfb64_encrypt((i),(o),(l),&(ks),(iv),(n),(e))
 #define des_ofb64_encrypt(i,o,l,ks,iv,n)\
-	DES_ofb64_encrypt((i),(o),(l),&(ks),(iv),(n))
-		
+    DES_ofb64_encrypt((i),(o),(l),&(ks),(iv),(n))
+
 
 #define des_ecb2_encrypt(i,o,k1,k2,e) \
-	des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
+    des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
 
 #define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
-	des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
+    des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
 
 #define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
-	des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
+    des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
 
 #define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
-	des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
+    des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
 
 #define des_check_key DES_check_key
 #define des_rw_mode DES_rw_mode
@@ -241,92 +241,92 @@ typedef struct _ossl_old_des_ks_struct
 #define des_cblock _ossl_old_des_cblock
 #define des_key_schedule _ossl_old_des_key_schedule
 #define des_ecb3_encrypt(i,o,k1,k2,k3,e)\
-	_ossl_old_des_ecb3_encrypt((i),(o),(k1),(k2),(k3),(e))
+    _ossl_old_des_ecb3_encrypt((i),(o),(k1),(k2),(k3),(e))
 #define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\
-	_ossl_old_des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(e))
+    _ossl_old_des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(e))
 #define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\
-	_ossl_old_des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n),(e))
+    _ossl_old_des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n),(e))
 #define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\
-	_ossl_old_des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n))
+    _ossl_old_des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n))
 #define des_options()\
-	_ossl_old_des_options()
+    _ossl_old_des_options()
 #define des_cbc_cksum(i,o,l,k,iv)\
-	_ossl_old_des_cbc_cksum((i),(o),(l),(k),(iv))
+    _ossl_old_des_cbc_cksum((i),(o),(l),(k),(iv))
 #define des_cbc_encrypt(i,o,l,k,iv,e)\
-	_ossl_old_des_cbc_encrypt((i),(o),(l),(k),(iv),(e))
+    _ossl_old_des_cbc_encrypt((i),(o),(l),(k),(iv),(e))
 #define des_ncbc_encrypt(i,o,l,k,iv,e)\
-	_ossl_old_des_ncbc_encrypt((i),(o),(l),(k),(iv),(e))
+    _ossl_old_des_ncbc_encrypt((i),(o),(l),(k),(iv),(e))
 #define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\
-	_ossl_old_des_xcbc_encrypt((i),(o),(l),(k),(iv),(inw),(outw),(e))
+    _ossl_old_des_xcbc_encrypt((i),(o),(l),(k),(iv),(inw),(outw),(e))
 #define des_cfb_encrypt(i,o,n,l,k,iv,e)\
-	_ossl_old_des_cfb_encrypt((i),(o),(n),(l),(k),(iv),(e))
+    _ossl_old_des_cfb_encrypt((i),(o),(n),(l),(k),(iv),(e))
 #define des_ecb_encrypt(i,o,k,e)\
-	_ossl_old_des_ecb_encrypt((i),(o),(k),(e))
+    _ossl_old_des_ecb_encrypt((i),(o),(k),(e))
 #define des_encrypt(d,k,e)\
-	_ossl_old_des_encrypt((d),(k),(e))
+    _ossl_old_des_encrypt((d),(k),(e))
 #define des_encrypt2(d,k,e)\
-	_ossl_old_des_encrypt2((d),(k),(e))
+    _ossl_old_des_encrypt2((d),(k),(e))
 #define des_encrypt3(d,k1,k2,k3)\
-	_ossl_old_des_encrypt3((d),(k1),(k2),(k3))
+    _ossl_old_des_encrypt3((d),(k1),(k2),(k3))
 #define des_decrypt3(d,k1,k2,k3)\
-	_ossl_old_des_decrypt3((d),(k1),(k2),(k3))
+    _ossl_old_des_decrypt3((d),(k1),(k2),(k3))
 #define des_xwhite_in2out(k,i,o)\
-	_ossl_old_des_xwhite_in2out((k),(i),(o))
+    _ossl_old_des_xwhite_in2out((k),(i),(o))
 #define des_enc_read(f,b,l,k,iv)\
-	_ossl_old_des_enc_read((f),(b),(l),(k),(iv))
+    _ossl_old_des_enc_read((f),(b),(l),(k),(iv))
 #define des_enc_write(f,b,l,k,iv)\
-	_ossl_old_des_enc_write((f),(b),(l),(k),(iv))
+    _ossl_old_des_enc_write((f),(b),(l),(k),(iv))
 #define des_fcrypt(b,s,r)\
-	_ossl_old_des_fcrypt((b),(s),(r))
+    _ossl_old_des_fcrypt((b),(s),(r))
 #define des_crypt(b,s)\
-	_ossl_old_des_crypt((b),(s))
+    _ossl_old_des_crypt((b),(s))
 #if 0
 #define crypt(b,s)\
-	_ossl_old_crypt((b),(s))
+    _ossl_old_crypt((b),(s))
 #endif
 #define des_ofb_encrypt(i,o,n,l,k,iv)\
-	_ossl_old_des_ofb_encrypt((i),(o),(n),(l),(k),(iv))
+    _ossl_old_des_ofb_encrypt((i),(o),(n),(l),(k),(iv))
 #define des_pcbc_encrypt(i,o,l,k,iv,e)\
-	_ossl_old_des_pcbc_encrypt((i),(o),(l),(k),(iv),(e))
+    _ossl_old_des_pcbc_encrypt((i),(o),(l),(k),(iv),(e))
 #define des_quad_cksum(i,o,l,c,s)\
-	_ossl_old_des_quad_cksum((i),(o),(l),(c),(s))
+    _ossl_old_des_quad_cksum((i),(o),(l),(c),(s))
 #define des_random_seed(k)\
-	_ossl_old_des_random_seed((k))
+    _ossl_old_des_random_seed((k))
 #define des_random_key(r)\
-	_ossl_old_des_random_key((r))
+    _ossl_old_des_random_key((r))
 #define des_read_password(k,p,v) \
-	_ossl_old_des_read_password((k),(p),(v))
+    _ossl_old_des_read_password((k),(p),(v))
 #define des_read_2passwords(k1,k2,p,v) \
-	_ossl_old_des_read_2passwords((k1),(k2),(p),(v))
+    _ossl_old_des_read_2passwords((k1),(k2),(p),(v))
 #define des_set_odd_parity(k)\
-	_ossl_old_des_set_odd_parity((k))
+    _ossl_old_des_set_odd_parity((k))
 #define des_is_weak_key(k)\
-	_ossl_old_des_is_weak_key((k))
+    _ossl_old_des_is_weak_key((k))
 #define des_set_key(k,ks)\
-	_ossl_old_des_set_key((k),(ks))
+    _ossl_old_des_set_key((k),(ks))
 #define des_key_sched(k,ks)\
-	_ossl_old_des_key_sched((k),(ks))
+    _ossl_old_des_key_sched((k),(ks))
 #define des_string_to_key(s,k)\
-	_ossl_old_des_string_to_key((s),(k))
+    _ossl_old_des_string_to_key((s),(k))
 #define des_string_to_2keys(s,k1,k2)\
-	_ossl_old_des_string_to_2keys((s),(k1),(k2))
+    _ossl_old_des_string_to_2keys((s),(k1),(k2))
 #define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\
-	_ossl_old_des_cfb64_encrypt((i),(o),(l),(ks),(iv),(n),(e))
+    _ossl_old_des_cfb64_encrypt((i),(o),(l),(ks),(iv),(n),(e))
 #define des_ofb64_encrypt(i,o,l,ks,iv,n)\
-	_ossl_old_des_ofb64_encrypt((i),(o),(l),(ks),(iv),(n))
-		
+    _ossl_old_des_ofb64_encrypt((i),(o),(l),(ks),(iv),(n))
+
 
 #define des_ecb2_encrypt(i,o,k1,k2,e) \
-	des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
+    des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
 
 #define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
-	des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
+    des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
 
 #define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
-	des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
+    des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
 
 #define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
-	des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
+    des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
 
 #define des_check_key DES_check_key
 #define des_rw_mode DES_rw_mode
@@ -334,60 +334,60 @@ typedef struct _ossl_old_des_ks_struct
 
 const char *_ossl_old_des_options(void);
 void _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,
-	_ossl_old_des_key_schedule ks1,_ossl_old_des_key_schedule ks2,
-	_ossl_old_des_key_schedule ks3, int enc);
+    _ossl_old_des_key_schedule ks1,_ossl_old_des_key_schedule ks2,
+    _ossl_old_des_key_schedule ks3, int enc);
 DES_LONG _ossl_old_des_cbc_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,
-	long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec);
+    long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec);
 void _ossl_old_des_cbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,
-	_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);
+    _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);
 void _ossl_old_des_ncbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,
-	_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);
+    _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);
 void _ossl_old_des_xcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,
-	_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,
-	_ossl_old_des_cblock *inw,_ossl_old_des_cblock *outw,int enc);
+    _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,
+    _ossl_old_des_cblock *inw,_ossl_old_des_cblock *outw,int enc);
 void _ossl_old_des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits,
-	long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);
+    long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);
 void _ossl_old_des_ecb_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,
-	_ossl_old_des_key_schedule ks,int enc);
+    _ossl_old_des_key_schedule ks,int enc);
 void _ossl_old_des_encrypt(DES_LONG *data,_ossl_old_des_key_schedule ks, int enc);
 void _ossl_old_des_encrypt2(DES_LONG *data,_ossl_old_des_key_schedule ks, int enc);
 void _ossl_old_des_encrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1,
-	_ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3);
+    _ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3);
 void _ossl_old_des_decrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1,
-	_ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3);
-void _ossl_old_des_ede3_cbc_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output, 
-	long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, 
-	_ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int enc);
+    _ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3);
+void _ossl_old_des_ede3_cbc_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output,
+    long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2,
+    _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int enc);
 void _ossl_old_des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out,
-	long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2,
-	_ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num, int enc);
+    long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2,
+    _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num, int enc);
 void _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out,
-	long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2,
-	_ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num);
+    long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2,
+    _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num);
 
 void _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key), _ossl_old_des_cblock (*in_white),
-	_ossl_old_des_cblock (*out_white));
+    _ossl_old_des_cblock (*out_white));
 
 int _ossl_old_des_enc_read(int fd,char *buf,int len,_ossl_old_des_key_schedule sched,
-	_ossl_old_des_cblock *iv);
+    _ossl_old_des_cblock *iv);
 int _ossl_old_des_enc_write(int fd,char *buf,int len,_ossl_old_des_key_schedule sched,
-	_ossl_old_des_cblock *iv);
+    _ossl_old_des_cblock *iv);
 char *_ossl_old_des_fcrypt(const char *buf,const char *salt, char *ret);
 char *_ossl_old_des_crypt(const char *buf,const char *salt);
 #if !defined(PERL5) && !defined(NeXT)
 char *_ossl_old_crypt(const char *buf,const char *salt);
 #endif
 void _ossl_old_des_ofb_encrypt(unsigned char *in,unsigned char *out,
-	int numbits,long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec);
+    int numbits,long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec);
 void _ossl_old_des_pcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,
-	_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);
+    _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);
 DES_LONG _ossl_old_des_quad_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,
-	long length,int out_count,_ossl_old_des_cblock *seed);
+    long length,int out_count,_ossl_old_des_cblock *seed);
 void _ossl_old_des_random_seed(_ossl_old_des_cblock key);
 void _ossl_old_des_random_key(_ossl_old_des_cblock ret);
 int _ossl_old_des_read_password(_ossl_old_des_cblock *key,const char *prompt,int verify);
 int _ossl_old_des_read_2passwords(_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2,
-	const char *prompt,int verify);
+    const char *prompt,int verify);
 void _ossl_old_des_set_odd_parity(_ossl_old_des_cblock *key);
 int _ossl_old_des_is_weak_key(_ossl_old_des_cblock *key);
 int _ossl_old_des_set_key(_ossl_old_des_cblock *key,_ossl_old_des_key_schedule schedule);
@@ -395,9 +395,9 @@ int _ossl_old_des_key_sched(_ossl_old_des_cblock *key,_ossl_old_des_key_schedule
 void _ossl_old_des_string_to_key(char *str,_ossl_old_des_cblock *key);
 void _ossl_old_des_string_to_2keys(char *str,_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2);
 void _ossl_old_des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length,
-	_ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num, int enc);
+    _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num, int enc);
 void _ossl_old_des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length,
-	_ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num);
+    _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num);
 
 void _ossl_096_des_random_seed(des_cblock *key);
 
diff --git a/dep/include/openssl/dh.h b/dep/include/openssl/dh.h
index ccdf35ae1c2..a5232c70f05 100644
--- a/dep/include/openssl/dh.h
+++ b/dep/include/openssl/dh.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -72,9 +72,9 @@
 #ifndef OPENSSL_NO_DEPRECATED
 #include 
 #endif
-	
+
 #ifndef OPENSSL_DH_MAX_MODULUS_BITS
-# define OPENSSL_DH_MAX_MODULUS_BITS	10000
+# define OPENSSL_DH_MAX_MODULUS_BITS    10000
 #endif
 
 #define DH_FLAG_CACHE_MONT_P     0x01
@@ -95,73 +95,73 @@ extern "C" {
 /* typedef struct dh_method DH_METHOD; */
 
 struct dh_method
-	{
-	const char *name;
-	/* Methods here */
-	int (*generate_key)(DH *dh);
-	int (*compute_key)(unsigned char *key,const BIGNUM *pub_key,DH *dh);
-	int (*bn_mod_exp)(const DH *dh, BIGNUM *r, const BIGNUM *a,
-				const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
-				BN_MONT_CTX *m_ctx); /* Can be null */
+    {
+    const char *name;
+    /* Methods here */
+    int (*generate_key)(DH *dh);
+    int (*compute_key)(unsigned char *key,const BIGNUM *pub_key,DH *dh);
+    int (*bn_mod_exp)(const DH *dh, BIGNUM *r, const BIGNUM *a,
+                const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
+                BN_MONT_CTX *m_ctx); /* Can be null */
 
-	int (*init)(DH *dh);
-	int (*finish)(DH *dh);
-	int flags;
-	char *app_data;
-	/* If this is non-NULL, it will be used to generate parameters */
-	int (*generate_params)(DH *dh, int prime_len, int generator, BN_GENCB *cb);
-	};
+    int (*init)(DH *dh);
+    int (*finish)(DH *dh);
+    int flags;
+    char *app_data;
+    /* If this is non-NULL, it will be used to generate parameters */
+    int (*generate_params)(DH *dh, int prime_len, int generator, BN_GENCB *cb);
+    };
 
 struct dh_st
-	{
-	/* This first argument is used to pick up errors when
-	 * a DH is passed instead of a EVP_PKEY */
-	int pad;
-	int version;
-	BIGNUM *p;
-	BIGNUM *g;
-	long length; /* optional */
-	BIGNUM *pub_key;	/* g^x */
-	BIGNUM *priv_key;	/* x */
+    {
+    /* This first argument is used to pick up errors when
+     * a DH is passed instead of a EVP_PKEY */
+    int pad;
+    int version;
+    BIGNUM *p;
+    BIGNUM *g;
+    long length; /* optional */
+    BIGNUM *pub_key;    /* g^x */
+    BIGNUM *priv_key;   /* x */
 
-	int flags;
-	BN_MONT_CTX *method_mont_p;
-	/* Place holders if we want to do X9.42 DH */
-	BIGNUM *q;
-	BIGNUM *j;
-	unsigned char *seed;
-	int seedlen;
-	BIGNUM *counter;
+    int flags;
+    BN_MONT_CTX *method_mont_p;
+    /* Place holders if we want to do X9.42 DH */
+    BIGNUM *q;
+    BIGNUM *j;
+    unsigned char *seed;
+    int seedlen;
+    BIGNUM *counter;
 
-	int references;
-	CRYPTO_EX_DATA ex_data;
-	const DH_METHOD *meth;
-	ENGINE *engine;
-	};
+    int references;
+    CRYPTO_EX_DATA ex_data;
+    const DH_METHOD *meth;
+    ENGINE *engine;
+    };
 
-#define DH_GENERATOR_2		2
-/* #define DH_GENERATOR_3	3 */
-#define DH_GENERATOR_5		5
+#define DH_GENERATOR_2      2
+/* #define DH_GENERATOR_3   3 */
+#define DH_GENERATOR_5      5
 
 /* DH_check error codes */
-#define DH_CHECK_P_NOT_PRIME		0x01
-#define DH_CHECK_P_NOT_SAFE_PRIME	0x02
-#define DH_UNABLE_TO_CHECK_GENERATOR	0x04
-#define DH_NOT_SUITABLE_GENERATOR	0x08
+#define DH_CHECK_P_NOT_PRIME        0x01
+#define DH_CHECK_P_NOT_SAFE_PRIME   0x02
+#define DH_UNABLE_TO_CHECK_GENERATOR    0x04
+#define DH_NOT_SUITABLE_GENERATOR   0x08
 
 /* DH_check_pub_key error codes */
-#define DH_CHECK_PUBKEY_TOO_SMALL	0x01
-#define DH_CHECK_PUBKEY_TOO_LARGE	0x02
+#define DH_CHECK_PUBKEY_TOO_SMALL   0x01
+#define DH_CHECK_PUBKEY_TOO_LARGE   0x02
 
 /* primes p where (p-1)/2 is prime too are called "safe"; we define
    this for backward compatibility: */
-#define DH_CHECK_P_NOT_STRONG_PRIME	DH_CHECK_P_NOT_SAFE_PRIME
+#define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME
 
 #define DHparams_dup(x) ASN1_dup_of_const(DH,i2d_DHparams,d2i_DHparams,x)
 #define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \
-		(char *(*)())d2i_DHparams,(fp),(unsigned char **)(x))
+        (char *(*)())d2i_DHparams,(fp),(unsigned char **)(x))
 #define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \
-		(unsigned char *)(x))
+        (unsigned char *)(x))
 #define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x)
 #define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x)
 
@@ -172,37 +172,37 @@ const DH_METHOD *DH_get_default_method(void);
 int DH_set_method(DH *dh, const DH_METHOD *meth);
 DH *DH_new_method(ENGINE *engine);
 
-DH *	DH_new(void);
-void	DH_free(DH *dh);
-int	DH_up_ref(DH *dh);
-int	DH_size(const DH *dh);
+DH *    DH_new(void);
+void    DH_free(DH *dh);
+int DH_up_ref(DH *dh);
+int DH_size(const DH *dh);
 int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
-	     CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+         CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
 int DH_set_ex_data(DH *d, int idx, void *arg);
 void *DH_get_ex_data(DH *d, int idx);
 
 /* Deprecated version */
 #ifndef OPENSSL_NO_DEPRECATED
-DH *	DH_generate_parameters(int prime_len,int generator,
-		void (*callback)(int,int,void *),void *cb_arg);
+DH *    DH_generate_parameters(int prime_len,int generator,
+        void (*callback)(int,int,void *),void *cb_arg);
 #endif /* !defined(OPENSSL_NO_DEPRECATED) */
 
 /* New version */
-int	DH_generate_parameters_ex(DH *dh, int prime_len,int generator, BN_GENCB *cb);
+int DH_generate_parameters_ex(DH *dh, int prime_len,int generator, BN_GENCB *cb);
 
-int	DH_check(const DH *dh,int *codes);
-int	DH_check_pub_key(const DH *dh,const BIGNUM *pub_key, int *codes);
-int	DH_generate_key(DH *dh);
-int	DH_compute_key(unsigned char *key,const BIGNUM *pub_key,DH *dh);
-DH *	d2i_DHparams(DH **a,const unsigned char **pp, long length);
-int	i2d_DHparams(const DH *a,unsigned char **pp);
+int DH_check(const DH *dh,int *codes);
+int DH_check_pub_key(const DH *dh,const BIGNUM *pub_key, int *codes);
+int DH_generate_key(DH *dh);
+int DH_compute_key(unsigned char *key,const BIGNUM *pub_key,DH *dh);
+DH *    d2i_DHparams(DH **a,const unsigned char **pp, long length);
+int i2d_DHparams(const DH *a,unsigned char **pp);
 #ifndef OPENSSL_NO_FP_API
-int	DHparams_print_fp(FILE *fp, const DH *x);
+int DHparams_print_fp(FILE *fp, const DH *x);
 #endif
 #ifndef OPENSSL_NO_BIO
-int	DHparams_print(BIO *bp, const DH *x);
+int DHparams_print(BIO *bp, const DH *x);
 #else
-int	DHparams_print(char *bp, const DH *x);
+int DHparams_print(char *bp, const DH *x);
 #endif
 
 /* BEGIN ERROR CODES */
@@ -214,19 +214,19 @@ void ERR_load_DH_strings(void);
 /* Error codes for the DH functions. */
 
 /* Function codes. */
-#define DH_F_COMPUTE_KEY				 102
-#define DH_F_DHPARAMS_PRINT				 100
-#define DH_F_DHPARAMS_PRINT_FP				 101
-#define DH_F_DH_BUILTIN_GENPARAMS			 106
-#define DH_F_DH_NEW_METHOD				 105
-#define DH_F_GENERATE_KEY				 103
-#define DH_F_GENERATE_PARAMETERS			 104
+#define DH_F_COMPUTE_KEY                 102
+#define DH_F_DHPARAMS_PRINT              100
+#define DH_F_DHPARAMS_PRINT_FP               101
+#define DH_F_DH_BUILTIN_GENPARAMS            106
+#define DH_F_DH_NEW_METHOD               105
+#define DH_F_GENERATE_KEY                103
+#define DH_F_GENERATE_PARAMETERS             104
 
 /* Reason codes. */
-#define DH_R_BAD_GENERATOR				 101
-#define DH_R_INVALID_PUBKEY				 102
-#define DH_R_MODULUS_TOO_LARGE				 103
-#define DH_R_NO_PRIVATE_VALUE				 100
+#define DH_R_BAD_GENERATOR               101
+#define DH_R_INVALID_PUBKEY              102
+#define DH_R_MODULUS_TOO_LARGE               103
+#define DH_R_NO_PRIVATE_VALUE                100
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/dsa.h b/dep/include/openssl/dsa.h
index 3a8fe5b56bb..d9472400b59 100644
--- a/dep/include/openssl/dsa.h
+++ b/dep/include/openssl/dsa.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -85,10 +85,10 @@
 #endif
 
 #ifndef OPENSSL_DSA_MAX_MODULUS_BITS
-# define OPENSSL_DSA_MAX_MODULUS_BITS	10000
+# define OPENSSL_DSA_MAX_MODULUS_BITS   10000
 #endif
 
-#define DSA_FLAG_CACHE_MONT_P	0x01
+#define DSA_FLAG_CACHE_MONT_P   0x01
 #define DSA_FLAG_NO_EXP_CONSTTIME       0x02 /* new with 0.9.7h; the built-in DSA
                                               * implementation now uses constant time
                                               * modular exponentiation for secret exponents
@@ -106,142 +106,142 @@ extern "C" {
 /* typedef struct dsa_method DSA_METHOD; */
 
 typedef struct DSA_SIG_st
-	{
-	BIGNUM *r;
-	BIGNUM *s;
-	} DSA_SIG;
+    {
+    BIGNUM *r;
+    BIGNUM *s;
+    } DSA_SIG;
 
 struct dsa_method
-	{
-	const char *name;
-	DSA_SIG * (*dsa_do_sign)(const unsigned char *dgst, int dlen, DSA *dsa);
-	int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp,
-								BIGNUM **rp);
-	int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len,
-							DSA_SIG *sig, DSA *dsa);
-	int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1,
-			BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx,
-			BN_MONT_CTX *in_mont);
-	int (*bn_mod_exp)(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p,
-				const BIGNUM *m, BN_CTX *ctx,
-				BN_MONT_CTX *m_ctx); /* Can be null */
-	int (*init)(DSA *dsa);
-	int (*finish)(DSA *dsa);
-	int flags;
-	char *app_data;
-	/* If this is non-NULL, it is used to generate DSA parameters */
-	int (*dsa_paramgen)(DSA *dsa, int bits,
-			unsigned char *seed, int seed_len,
-			int *counter_ret, unsigned long *h_ret,
-			BN_GENCB *cb);
-	/* If this is non-NULL, it is used to generate DSA keys */
-	int (*dsa_keygen)(DSA *dsa);
-	};
+    {
+    const char *name;
+    DSA_SIG * (*dsa_do_sign)(const unsigned char *dgst, int dlen, DSA *dsa);
+    int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp,
+                                BIGNUM **rp);
+    int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len,
+                            DSA_SIG *sig, DSA *dsa);
+    int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1,
+            BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx,
+            BN_MONT_CTX *in_mont);
+    int (*bn_mod_exp)(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p,
+                const BIGNUM *m, BN_CTX *ctx,
+                BN_MONT_CTX *m_ctx); /* Can be null */
+    int (*init)(DSA *dsa);
+    int (*finish)(DSA *dsa);
+    int flags;
+    char *app_data;
+    /* If this is non-NULL, it is used to generate DSA parameters */
+    int (*dsa_paramgen)(DSA *dsa, int bits,
+            unsigned char *seed, int seed_len,
+            int *counter_ret, unsigned long *h_ret,
+            BN_GENCB *cb);
+    /* If this is non-NULL, it is used to generate DSA keys */
+    int (*dsa_keygen)(DSA *dsa);
+    };
 
 struct dsa_st
-	{
-	/* This first variable is used to pick up errors where
-	 * a DSA is passed instead of of a EVP_PKEY */
-	int pad;
-	long version;
-	int write_params;
-	BIGNUM *p;
-	BIGNUM *q;	/* == 20 */
-	BIGNUM *g;
+    {
+    /* This first variable is used to pick up errors where
+     * a DSA is passed instead of of a EVP_PKEY */
+    int pad;
+    long version;
+    int write_params;
+    BIGNUM *p;
+    BIGNUM *q;  /* == 20 */
+    BIGNUM *g;
 
-	BIGNUM *pub_key;  /* y public key */
-	BIGNUM *priv_key; /* x private key */
+    BIGNUM *pub_key;  /* y public key */
+    BIGNUM *priv_key; /* x private key */
 
-	BIGNUM *kinv;	/* Signing pre-calc */
-	BIGNUM *r;	/* Signing pre-calc */
+    BIGNUM *kinv;   /* Signing pre-calc */
+    BIGNUM *r;  /* Signing pre-calc */
 
-	int flags;
-	/* Normally used to cache montgomery values */
-	BN_MONT_CTX *method_mont_p;
-	int references;
-	CRYPTO_EX_DATA ex_data;
-	const DSA_METHOD *meth;
-	/* functional reference if 'meth' is ENGINE-provided */
-	ENGINE *engine;
-	};
+    int flags;
+    /* Normally used to cache montgomery values */
+    BN_MONT_CTX *method_mont_p;
+    int references;
+    CRYPTO_EX_DATA ex_data;
+    const DSA_METHOD *meth;
+    /* functional reference if 'meth' is ENGINE-provided */
+    ENGINE *engine;
+    };
 
 #define DSAparams_dup(x) ASN1_dup_of_const(DSA,i2d_DSAparams,d2i_DSAparams,x)
 #define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \
-		(char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x))
+        (char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x))
 #define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \
-		(unsigned char *)(x))
+        (unsigned char *)(x))
 #define d2i_DSAparams_bio(bp,x) ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSAparams,bp,x)
 #define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x)
 
 
 DSA_SIG * DSA_SIG_new(void);
-void	DSA_SIG_free(DSA_SIG *a);
-int	i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp);
+void    DSA_SIG_free(DSA_SIG *a);
+int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp);
 DSA_SIG * d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length);
 
 DSA_SIG * DSA_do_sign(const unsigned char *dgst,int dlen,DSA *dsa);
-int	DSA_do_verify(const unsigned char *dgst,int dgst_len,
-		      DSA_SIG *sig,DSA *dsa);
+int DSA_do_verify(const unsigned char *dgst,int dgst_len,
+              DSA_SIG *sig,DSA *dsa);
 
 const DSA_METHOD *DSA_OpenSSL(void);
 
-void	DSA_set_default_method(const DSA_METHOD *);
+void    DSA_set_default_method(const DSA_METHOD *);
 const DSA_METHOD *DSA_get_default_method(void);
-int	DSA_set_method(DSA *dsa, const DSA_METHOD *);
+int DSA_set_method(DSA *dsa, const DSA_METHOD *);
 
-DSA *	DSA_new(void);
-DSA *	DSA_new_method(ENGINE *engine);
-void	DSA_free (DSA *r);
+DSA *   DSA_new(void);
+DSA *   DSA_new_method(ENGINE *engine);
+void    DSA_free (DSA *r);
 /* "up" the DSA object's reference count */
-int	DSA_up_ref(DSA *r);
-int	DSA_size(const DSA *);
-	/* next 4 return -1 on error */
-int	DSA_sign_setup( DSA *dsa,BN_CTX *ctx_in,BIGNUM **kinvp,BIGNUM **rp);
-int	DSA_sign(int type,const unsigned char *dgst,int dlen,
-		unsigned char *sig, unsigned int *siglen, DSA *dsa);
-int	DSA_verify(int type,const unsigned char *dgst,int dgst_len,
-		const unsigned char *sigbuf, int siglen, DSA *dsa);
+int DSA_up_ref(DSA *r);
+int DSA_size(const DSA *);
+    /* next 4 return -1 on error */
+int DSA_sign_setup( DSA *dsa,BN_CTX *ctx_in,BIGNUM **kinvp,BIGNUM **rp);
+int DSA_sign(int type,const unsigned char *dgst,int dlen,
+        unsigned char *sig, unsigned int *siglen, DSA *dsa);
+int DSA_verify(int type,const unsigned char *dgst,int dgst_len,
+        const unsigned char *sigbuf, int siglen, DSA *dsa);
 int DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
-	     CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+         CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
 int DSA_set_ex_data(DSA *d, int idx, void *arg);
 void *DSA_get_ex_data(DSA *d, int idx);
 
-DSA *	d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length);
-DSA *	d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length);
-DSA * 	d2i_DSAparams(DSA **a, const unsigned char **pp, long length);
+DSA *   d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length);
+DSA *   d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length);
+DSA *   d2i_DSAparams(DSA **a, const unsigned char **pp, long length);
 
 /* Deprecated version */
 #ifndef OPENSSL_NO_DEPRECATED
-DSA *	DSA_generate_parameters(int bits,
-		unsigned char *seed,int seed_len,
-		int *counter_ret, unsigned long *h_ret,void
-		(*callback)(int, int, void *),void *cb_arg);
+DSA *   DSA_generate_parameters(int bits,
+        unsigned char *seed,int seed_len,
+        int *counter_ret, unsigned long *h_ret,void
+        (*callback)(int, int, void *),void *cb_arg);
 #endif /* !defined(OPENSSL_NO_DEPRECATED) */
 
 /* New version */
-int	DSA_generate_parameters_ex(DSA *dsa, int bits,
-		unsigned char *seed,int seed_len,
-		int *counter_ret, unsigned long *h_ret, BN_GENCB *cb);
+int DSA_generate_parameters_ex(DSA *dsa, int bits,
+        unsigned char *seed,int seed_len,
+        int *counter_ret, unsigned long *h_ret, BN_GENCB *cb);
 
-int	DSA_generate_key(DSA *a);
-int	i2d_DSAPublicKey(const DSA *a, unsigned char **pp);
-int 	i2d_DSAPrivateKey(const DSA *a, unsigned char **pp);
-int	i2d_DSAparams(const DSA *a,unsigned char **pp);
+int DSA_generate_key(DSA *a);
+int i2d_DSAPublicKey(const DSA *a, unsigned char **pp);
+int     i2d_DSAPrivateKey(const DSA *a, unsigned char **pp);
+int i2d_DSAparams(const DSA *a,unsigned char **pp);
 
 #ifndef OPENSSL_NO_BIO
-int	DSAparams_print(BIO *bp, const DSA *x);
-int	DSA_print(BIO *bp, const DSA *x, int off);
+int DSAparams_print(BIO *bp, const DSA *x);
+int DSA_print(BIO *bp, const DSA *x, int off);
 #endif
 #ifndef OPENSSL_NO_FP_API
-int	DSAparams_print_fp(FILE *fp, const DSA *x);
-int	DSA_print_fp(FILE *bp, const DSA *x, int off);
+int DSAparams_print_fp(FILE *fp, const DSA *x);
+int DSA_print_fp(FILE *bp, const DSA *x, int off);
 #endif
 
 #define DSS_prime_checks 50
 /* Primality test according to FIPS PUB 186[-1], Appendix 2.1:
  * 50 rounds of Rabin-Miller */
 #define DSA_is_prime(n, callback, cb_arg) \
-	BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg)
+    BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg)
 
 #ifndef OPENSSL_NO_DH
 /* Convert DSA structure (key or just parameters) into DH structure
@@ -258,26 +258,26 @@ void ERR_load_DSA_strings(void);
 /* Error codes for the DSA functions. */
 
 /* Function codes. */
-#define DSA_F_D2I_DSA_SIG				 110
-#define DSA_F_DSAPARAMS_PRINT				 100
-#define DSA_F_DSAPARAMS_PRINT_FP			 101
-#define DSA_F_DSA_DO_SIGN				 112
-#define DSA_F_DSA_DO_VERIFY				 113
-#define DSA_F_DSA_NEW_METHOD				 103
-#define DSA_F_DSA_PRINT					 104
-#define DSA_F_DSA_PRINT_FP				 105
-#define DSA_F_DSA_SIGN					 106
-#define DSA_F_DSA_SIGN_SETUP				 107
-#define DSA_F_DSA_SIG_NEW				 109
-#define DSA_F_DSA_VERIFY				 108
-#define DSA_F_I2D_DSA_SIG				 111
-#define DSA_F_SIG_CB					 114
+#define DSA_F_D2I_DSA_SIG                110
+#define DSA_F_DSAPARAMS_PRINT                100
+#define DSA_F_DSAPARAMS_PRINT_FP             101
+#define DSA_F_DSA_DO_SIGN                112
+#define DSA_F_DSA_DO_VERIFY              113
+#define DSA_F_DSA_NEW_METHOD                 103
+#define DSA_F_DSA_PRINT                  104
+#define DSA_F_DSA_PRINT_FP               105
+#define DSA_F_DSA_SIGN                   106
+#define DSA_F_DSA_SIGN_SETUP                 107
+#define DSA_F_DSA_SIG_NEW                109
+#define DSA_F_DSA_VERIFY                 108
+#define DSA_F_I2D_DSA_SIG                111
+#define DSA_F_SIG_CB                     114
 
 /* Reason codes. */
-#define DSA_R_BAD_Q_VALUE				 102
-#define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE		 100
-#define DSA_R_MISSING_PARAMETERS			 101
-#define DSA_R_MODULUS_TOO_LARGE				 103
+#define DSA_R_BAD_Q_VALUE                102
+#define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE        100
+#define DSA_R_MISSING_PARAMETERS             101
+#define DSA_R_MODULUS_TOO_LARGE              103
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/dso.h b/dep/include/openssl/dso.h
index 3e51913a725..9038b509bd6 100644
--- a/dep/include/openssl/dso.h
+++ b/dep/include/openssl/dso.h
@@ -10,7 +10,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -66,9 +66,9 @@ extern "C" {
 #endif
 
 /* These values are used as commands to DSO_ctrl() */
-#define DSO_CTRL_GET_FLAGS	1
-#define DSO_CTRL_SET_FLAGS	2
-#define DSO_CTRL_OR_FLAGS	3
+#define DSO_CTRL_GET_FLAGS  1
+#define DSO_CTRL_SET_FLAGS  2
+#define DSO_CTRL_OR_FLAGS   3
 
 /* By default, DSO_load() will translate the provided filename into a form
  * typical for the platform (more specifically the DSO_METHOD) using the
@@ -81,26 +81,26 @@ extern "C" {
  * DSO to prevent *any* native name-translation at all - eg. if the caller has
  * prompted the user for a path to a driver library so the filename should be
  * interpreted as-is. */
-#define DSO_FLAG_NO_NAME_TRANSLATION		0x01
+#define DSO_FLAG_NO_NAME_TRANSLATION        0x01
 /* An extra flag to give if only the extension should be added as
  * translation.  This is obviously only of importance on Unix and
  * other operating systems where the translation also may prefix
  * the name with something, like 'lib', and ignored everywhere else.
  * This flag is also ignored if DSO_FLAG_NO_NAME_TRANSLATION is used
  * at the same time. */
-#define DSO_FLAG_NAME_TRANSLATION_EXT_ONLY	0x02
+#define DSO_FLAG_NAME_TRANSLATION_EXT_ONLY  0x02
 
 /* The following flag controls the translation of symbol names to upper
  * case.  This is currently only being implemented for OpenVMS.
  */
-#define DSO_FLAG_UPCASE_SYMBOL			0x10
+#define DSO_FLAG_UPCASE_SYMBOL          0x10
 
 /* This flag loads the library with public symbols.
  * Meaning: The exported symbols of this library are public
  * to all libraries loaded after this library.
  * At the moment only implemented in unix.
  */
-#define DSO_FLAG_GLOBAL_SYMBOLS			0x20
+#define DSO_FLAG_GLOBAL_SYMBOLS         0x20
 
 
 typedef void (*DSO_FUNC_TYPE)(void);
@@ -132,104 +132,104 @@ typedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *);
 typedef char* (*DSO_MERGER_FUNC)(DSO *, const char *, const char *);
 
 typedef struct dso_meth_st
-	{
-	const char *name;
-	/* Loads a shared library, NB: new DSO_METHODs must ensure that a
-	 * successful load populates the loaded_filename field, and likewise a
-	 * successful unload OPENSSL_frees and NULLs it out. */
-	int (*dso_load)(DSO *dso);
-	/* Unloads a shared library */
-	int (*dso_unload)(DSO *dso);
-	/* Binds a variable */
-	void *(*dso_bind_var)(DSO *dso, const char *symname);
-	/* Binds a function - assumes a return type of DSO_FUNC_TYPE.
-	 * This should be cast to the real function prototype by the
-	 * caller. Platforms that don't have compatible representations
-	 * for different prototypes (this is possible within ANSI C)
-	 * are highly unlikely to have shared libraries at all, let
-	 * alone a DSO_METHOD implemented for them. */
-	DSO_FUNC_TYPE (*dso_bind_func)(DSO *dso, const char *symname);
+    {
+    const char *name;
+    /* Loads a shared library, NB: new DSO_METHODs must ensure that a
+     * successful load populates the loaded_filename field, and likewise a
+     * successful unload OPENSSL_frees and NULLs it out. */
+    int (*dso_load)(DSO *dso);
+    /* Unloads a shared library */
+    int (*dso_unload)(DSO *dso);
+    /* Binds a variable */
+    void *(*dso_bind_var)(DSO *dso, const char *symname);
+    /* Binds a function - assumes a return type of DSO_FUNC_TYPE.
+     * This should be cast to the real function prototype by the
+     * caller. Platforms that don't have compatible representations
+     * for different prototypes (this is possible within ANSI C)
+     * are highly unlikely to have shared libraries at all, let
+     * alone a DSO_METHOD implemented for them. */
+    DSO_FUNC_TYPE (*dso_bind_func)(DSO *dso, const char *symname);
 
 /* I don't think this would actually be used in any circumstances. */
 #if 0
-	/* Unbinds a variable */
-	int (*dso_unbind_var)(DSO *dso, char *symname, void *symptr);
-	/* Unbinds a function */
-	int (*dso_unbind_func)(DSO *dso, char *symname, DSO_FUNC_TYPE symptr);
+    /* Unbinds a variable */
+    int (*dso_unbind_var)(DSO *dso, char *symname, void *symptr);
+    /* Unbinds a function */
+    int (*dso_unbind_func)(DSO *dso, char *symname, DSO_FUNC_TYPE symptr);
 #endif
-	/* The generic (yuck) "ctrl()" function. NB: Negative return
-	 * values (rather than zero) indicate errors. */
-	long (*dso_ctrl)(DSO *dso, int cmd, long larg, void *parg);
-	/* The default DSO_METHOD-specific function for converting filenames to
-	 * a canonical native form. */
-	DSO_NAME_CONVERTER_FUNC dso_name_converter;
-	/* The default DSO_METHOD-specific function for converting filenames to
-	 * a canonical native form. */
-	DSO_MERGER_FUNC dso_merger;
+    /* The generic (yuck) "ctrl()" function. NB: Negative return
+     * values (rather than zero) indicate errors. */
+    long (*dso_ctrl)(DSO *dso, int cmd, long larg, void *parg);
+    /* The default DSO_METHOD-specific function for converting filenames to
+     * a canonical native form. */
+    DSO_NAME_CONVERTER_FUNC dso_name_converter;
+    /* The default DSO_METHOD-specific function for converting filenames to
+     * a canonical native form. */
+    DSO_MERGER_FUNC dso_merger;
 
-	/* [De]Initialisation handlers. */
-	int (*init)(DSO *dso);
-	int (*finish)(DSO *dso);
-	} DSO_METHOD;
+    /* [De]Initialisation handlers. */
+    int (*init)(DSO *dso);
+    int (*finish)(DSO *dso);
+    } DSO_METHOD;
 
 /**********************************************************************/
 /* The low-level handle type used to refer to a loaded shared library */
 
 struct dso_st
-	{
-	DSO_METHOD *meth;
-	/* Standard dlopen uses a (void *). Win32 uses a HANDLE. VMS
-	 * doesn't use anything but will need to cache the filename
-	 * for use in the dso_bind handler. All in all, let each
-	 * method control its own destiny. "Handles" and such go in
-	 * a STACK. */
-	STACK *meth_data;
-	int references;
-	int flags;
-	/* For use by applications etc ... use this for your bits'n'pieces,
-	 * don't touch meth_data! */
-	CRYPTO_EX_DATA ex_data;
-	/* If this callback function pointer is set to non-NULL, then it will
-	 * be used in DSO_load() in place of meth->dso_name_converter. NB: This
-	 * should normally set using DSO_set_name_converter(). */
-	DSO_NAME_CONVERTER_FUNC name_converter;
-	/* If this callback function pointer is set to non-NULL, then it will
-	 * be used in DSO_load() in place of meth->dso_merger. NB: This
-	 * should normally set using DSO_set_merger(). */
-	DSO_MERGER_FUNC merger;
-	/* This is populated with (a copy of) the platform-independant
-	 * filename used for this DSO. */
-	char *filename;
-	/* This is populated with (a copy of) the translated filename by which
-	 * the DSO was actually loaded. It is NULL iff the DSO is not currently
-	 * loaded. NB: This is here because the filename translation process
-	 * may involve a callback being invoked more than once not only to
-	 * convert to a platform-specific form, but also to try different
-	 * filenames in the process of trying to perform a load. As such, this
-	 * variable can be used to indicate (a) whether this DSO structure
-	 * corresponds to a loaded library or not, and (b) the filename with
-	 * which it was actually loaded. */
-	char *loaded_filename;
-	};
+    {
+    DSO_METHOD *meth;
+    /* Standard dlopen uses a (void *). Win32 uses a HANDLE. VMS
+     * doesn't use anything but will need to cache the filename
+     * for use in the dso_bind handler. All in all, let each
+     * method control its own destiny. "Handles" and such go in
+     * a STACK. */
+    STACK *meth_data;
+    int references;
+    int flags;
+    /* For use by applications etc ... use this for your bits'n'pieces,
+     * don't touch meth_data! */
+    CRYPTO_EX_DATA ex_data;
+    /* If this callback function pointer is set to non-NULL, then it will
+     * be used in DSO_load() in place of meth->dso_name_converter. NB: This
+     * should normally set using DSO_set_name_converter(). */
+    DSO_NAME_CONVERTER_FUNC name_converter;
+    /* If this callback function pointer is set to non-NULL, then it will
+     * be used in DSO_load() in place of meth->dso_merger. NB: This
+     * should normally set using DSO_set_merger(). */
+    DSO_MERGER_FUNC merger;
+    /* This is populated with (a copy of) the platform-independant
+     * filename used for this DSO. */
+    char *filename;
+    /* This is populated with (a copy of) the translated filename by which
+     * the DSO was actually loaded. It is NULL iff the DSO is not currently
+     * loaded. NB: This is here because the filename translation process
+     * may involve a callback being invoked more than once not only to
+     * convert to a platform-specific form, but also to try different
+     * filenames in the process of trying to perform a load. As such, this
+     * variable can be used to indicate (a) whether this DSO structure
+     * corresponds to a loaded library or not, and (b) the filename with
+     * which it was actually loaded. */
+    char *loaded_filename;
+    };
 
 
-DSO *	DSO_new(void);
-DSO *	DSO_new_method(DSO_METHOD *method);
-int	DSO_free(DSO *dso);
-int	DSO_flags(DSO *dso);
-int	DSO_up_ref(DSO *dso);
-long	DSO_ctrl(DSO *dso, int cmd, long larg, void *parg);
+DSO *   DSO_new(void);
+DSO *   DSO_new_method(DSO_METHOD *method);
+int DSO_free(DSO *dso);
+int DSO_flags(DSO *dso);
+int DSO_up_ref(DSO *dso);
+long    DSO_ctrl(DSO *dso, int cmd, long larg, void *parg);
 
 /* This function sets the DSO's name_converter callback. If it is non-NULL,
  * then it will be used instead of the associated DSO_METHOD's function. If
  * oldcb is non-NULL then it is set to the function pointer value being
  * replaced. Return value is non-zero for success. */
-int	DSO_set_name_converter(DSO *dso, DSO_NAME_CONVERTER_FUNC cb,
-				DSO_NAME_CONVERTER_FUNC *oldcb);
+int DSO_set_name_converter(DSO *dso, DSO_NAME_CONVERTER_FUNC cb,
+                DSO_NAME_CONVERTER_FUNC *oldcb);
 /* These functions can be used to get/set the platform-independant filename
  * used for a DSO. NB: set will fail if the DSO is already loaded. */
 const char *DSO_get_filename(DSO *dso);
-int	DSO_set_filename(DSO *dso, const char *filename);
+int DSO_set_filename(DSO *dso, const char *filename);
 /* This function will invoke the DSO's name_converter callback to translate a
  * filename, or if the callback isn't set it will instead use the DSO_METHOD's
  * converter. If "filename" is NULL, the "filename" in the DSO itself will be
@@ -238,12 +238,12 @@ int	DSO_set_filename(DSO *dso, const char *filename);
  * DSO_METHOD during the processing of a DSO_load() call, and is exposed so that
  * caller-created DSO_METHODs can do the same thing. A non-NULL return value
  * will need to be OPENSSL_free()'d. */
-char	*DSO_convert_filename(DSO *dso, const char *filename);
+char    *DSO_convert_filename(DSO *dso, const char *filename);
 /* This function will invoke the DSO's merger callback to merge two file
  * specifications, or if the callback isn't set it will instead use the
  * DSO_METHOD's merger.  A non-NULL return value will need to be
  * OPENSSL_free()'d. */
-char	*DSO_merge(DSO *dso, const char *filespec1, const char *filespec2);
+char    *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2);
 /* If the DSO is currently loaded, this returns the filename that it was loaded
  * under, otherwise it returns NULL. So it is also useful as a test as to
  * whether the DSO is currently loaded. NB: This will not necessarily return
@@ -253,7 +253,7 @@ char	*DSO_merge(DSO *dso, const char *filespec1, const char *filespec2);
  * actually loaded. */
 const char *DSO_get_loaded_filename(DSO *dso);
 
-void	DSO_set_default_method(DSO_METHOD *meth);
+void    DSO_set_default_method(DSO_METHOD *meth);
 DSO_METHOD *DSO_get_default_method(void);
 DSO_METHOD *DSO_get_method(DSO *dso);
 DSO_METHOD *DSO_set_method(DSO *dso, DSO_METHOD *meth);
@@ -285,7 +285,7 @@ DSO_METHOD *DSO_METHOD_null(void);
  * this method. If not, this method will return NULL. */
 DSO_METHOD *DSO_METHOD_dlfcn(void);
 
-/* If DSO_DL is defined, the standard dl.h-style functions (shl_load, 
+/* If DSO_DL is defined, the standard dl.h-style functions (shl_load,
  * shl_unload, shl_findsym, etc) will be used and incorporated into
  * this method. If not, this method will return NULL. */
 DSO_METHOD *DSO_METHOD_dl(void);
@@ -305,62 +305,62 @@ void ERR_load_DSO_strings(void);
 /* Error codes for the DSO functions. */
 
 /* Function codes. */
-#define DSO_F_DLFCN_BIND_FUNC				 100
-#define DSO_F_DLFCN_BIND_VAR				 101
-#define DSO_F_DLFCN_LOAD				 102
-#define DSO_F_DLFCN_MERGER				 130
-#define DSO_F_DLFCN_NAME_CONVERTER			 123
-#define DSO_F_DLFCN_UNLOAD				 103
-#define DSO_F_DL_BIND_FUNC				 104
-#define DSO_F_DL_BIND_VAR				 105
-#define DSO_F_DL_LOAD					 106
-#define DSO_F_DL_MERGER					 131
-#define DSO_F_DL_NAME_CONVERTER				 124
-#define DSO_F_DL_UNLOAD					 107
-#define DSO_F_DSO_BIND_FUNC				 108
-#define DSO_F_DSO_BIND_VAR				 109
-#define DSO_F_DSO_CONVERT_FILENAME			 126
-#define DSO_F_DSO_CTRL					 110
-#define DSO_F_DSO_FREE					 111
-#define DSO_F_DSO_GET_FILENAME				 127
-#define DSO_F_DSO_GET_LOADED_FILENAME			 128
-#define DSO_F_DSO_LOAD					 112
-#define DSO_F_DSO_MERGE					 132
-#define DSO_F_DSO_NEW_METHOD				 113
-#define DSO_F_DSO_SET_FILENAME				 129
-#define DSO_F_DSO_SET_NAME_CONVERTER			 122
-#define DSO_F_DSO_UP_REF				 114
-#define DSO_F_VMS_BIND_SYM				 115
-#define DSO_F_VMS_LOAD					 116
-#define DSO_F_VMS_MERGER				 133
-#define DSO_F_VMS_UNLOAD				 117
-#define DSO_F_WIN32_BIND_FUNC				 118
-#define DSO_F_WIN32_BIND_VAR				 119
-#define DSO_F_WIN32_JOINER				 135
-#define DSO_F_WIN32_LOAD				 120
-#define DSO_F_WIN32_MERGER				 134
-#define DSO_F_WIN32_NAME_CONVERTER			 125
-#define DSO_F_WIN32_SPLITTER				 136
-#define DSO_F_WIN32_UNLOAD				 121
+#define DSO_F_DLFCN_BIND_FUNC                100
+#define DSO_F_DLFCN_BIND_VAR                 101
+#define DSO_F_DLFCN_LOAD                 102
+#define DSO_F_DLFCN_MERGER               130
+#define DSO_F_DLFCN_NAME_CONVERTER           123
+#define DSO_F_DLFCN_UNLOAD               103
+#define DSO_F_DL_BIND_FUNC               104
+#define DSO_F_DL_BIND_VAR                105
+#define DSO_F_DL_LOAD                    106
+#define DSO_F_DL_MERGER                  131
+#define DSO_F_DL_NAME_CONVERTER              124
+#define DSO_F_DL_UNLOAD                  107
+#define DSO_F_DSO_BIND_FUNC              108
+#define DSO_F_DSO_BIND_VAR               109
+#define DSO_F_DSO_CONVERT_FILENAME           126
+#define DSO_F_DSO_CTRL                   110
+#define DSO_F_DSO_FREE                   111
+#define DSO_F_DSO_GET_FILENAME               127
+#define DSO_F_DSO_GET_LOADED_FILENAME            128
+#define DSO_F_DSO_LOAD                   112
+#define DSO_F_DSO_MERGE                  132
+#define DSO_F_DSO_NEW_METHOD                 113
+#define DSO_F_DSO_SET_FILENAME               129
+#define DSO_F_DSO_SET_NAME_CONVERTER             122
+#define DSO_F_DSO_UP_REF                 114
+#define DSO_F_VMS_BIND_SYM               115
+#define DSO_F_VMS_LOAD                   116
+#define DSO_F_VMS_MERGER                 133
+#define DSO_F_VMS_UNLOAD                 117
+#define DSO_F_WIN32_BIND_FUNC                118
+#define DSO_F_WIN32_BIND_VAR                 119
+#define DSO_F_WIN32_JOINER               135
+#define DSO_F_WIN32_LOAD                 120
+#define DSO_F_WIN32_MERGER               134
+#define DSO_F_WIN32_NAME_CONVERTER           125
+#define DSO_F_WIN32_SPLITTER                 136
+#define DSO_F_WIN32_UNLOAD               121
 
 /* Reason codes. */
-#define DSO_R_CTRL_FAILED				 100
-#define DSO_R_DSO_ALREADY_LOADED			 110
-#define DSO_R_EMPTY_FILE_STRUCTURE			 113
-#define DSO_R_FAILURE					 114
-#define DSO_R_FILENAME_TOO_BIG				 101
-#define DSO_R_FINISH_FAILED				 102
-#define DSO_R_INCORRECT_FILE_SYNTAX			 115
-#define DSO_R_LOAD_FAILED				 103
-#define DSO_R_NAME_TRANSLATION_FAILED			 109
-#define DSO_R_NO_FILENAME				 111
-#define DSO_R_NO_FILE_SPECIFICATION			 116
-#define DSO_R_NULL_HANDLE				 104
-#define DSO_R_SET_FILENAME_FAILED			 112
-#define DSO_R_STACK_ERROR				 105
-#define DSO_R_SYM_FAILURE				 106
-#define DSO_R_UNLOAD_FAILED				 107
-#define DSO_R_UNSUPPORTED				 108
+#define DSO_R_CTRL_FAILED                100
+#define DSO_R_DSO_ALREADY_LOADED             110
+#define DSO_R_EMPTY_FILE_STRUCTURE           113
+#define DSO_R_FAILURE                    114
+#define DSO_R_FILENAME_TOO_BIG               101
+#define DSO_R_FINISH_FAILED              102
+#define DSO_R_INCORRECT_FILE_SYNTAX          115
+#define DSO_R_LOAD_FAILED                103
+#define DSO_R_NAME_TRANSLATION_FAILED            109
+#define DSO_R_NO_FILENAME                111
+#define DSO_R_NO_FILE_SPECIFICATION          116
+#define DSO_R_NULL_HANDLE                104
+#define DSO_R_SET_FILENAME_FAILED            112
+#define DSO_R_STACK_ERROR                105
+#define DSO_R_SYM_FAILURE                106
+#define DSO_R_UNLOAD_FAILED              107
+#define DSO_R_UNSUPPORTED                108
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/dtls1.h b/dep/include/openssl/dtls1.h
index b377cc5f6b2..dad6c563ff7 100644
--- a/dep/include/openssl/dtls1.h
+++ b/dep/include/openssl/dtls1.h
@@ -1,7 +1,7 @@
 /* ssl/dtls1.h */
-/* 
+/*
  * DTLS implementation written by Nagendra Modadugu
- * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.  
+ * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
  */
 /* ====================================================================
  * Copyright (c) 1999-2005 The OpenSSL Project.  All rights reserved.
@@ -11,7 +11,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -57,8 +57,8 @@
  *
  */
 
-#ifndef HEADER_DTLS1_H 
-#define HEADER_DTLS1_H 
+#ifndef HEADER_DTLS1_H
+#define HEADER_DTLS1_H
 
 #include 
 #include 
@@ -67,9 +67,9 @@
 extern "C" {
 #endif
 
-#define DTLS1_VERSION			0x0100
-#define DTLS1_VERSION_MAJOR		0x01
-#define DTLS1_VERSION_MINOR		0x00
+#define DTLS1_VERSION           0x0100
+#define DTLS1_VERSION_MAJOR     0x01
+#define DTLS1_VERSION_MINOR     0x00
 
 #define DTLS1_AD_MISSING_HANDSHAKE_MESSAGE    110
 
@@ -89,114 +89,114 @@ extern "C" {
 
 
 typedef struct dtls1_bitmap_st
-	{
-	PQ_64BIT map;
-	unsigned long length;     /* sizeof the bitmap in bits */
-	PQ_64BIT max_seq_num;  /* max record number seen so far */
-	} DTLS1_BITMAP;
+    {
+    PQ_64BIT map;
+    unsigned long length;     /* sizeof the bitmap in bits */
+    PQ_64BIT max_seq_num;  /* max record number seen so far */
+    } DTLS1_BITMAP;
 
 struct hm_header_st
-	{
-	unsigned char type;
-	unsigned long msg_len;
-	unsigned short seq;
-	unsigned long frag_off;
-	unsigned long frag_len;
-	unsigned int is_ccs;
-	};
+    {
+    unsigned char type;
+    unsigned long msg_len;
+    unsigned short seq;
+    unsigned long frag_off;
+    unsigned long frag_len;
+    unsigned int is_ccs;
+    };
 
 struct ccs_header_st
-	{
-	unsigned char type;
-	unsigned short seq;
-	};
+    {
+    unsigned char type;
+    unsigned short seq;
+    };
 
 struct dtls1_timeout_st
-	{
-	/* Number of read timeouts so far */
-	unsigned int read_timeouts;
-	
-	/* Number of write timeouts so far */
-	unsigned int write_timeouts;
-	
-	/* Number of alerts received so far */
-	unsigned int num_alerts;
-	};
+    {
+    /* Number of read timeouts so far */
+    unsigned int read_timeouts;
+
+    /* Number of write timeouts so far */
+    unsigned int write_timeouts;
+
+    /* Number of alerts received so far */
+    unsigned int num_alerts;
+    };
 
 typedef struct record_pqueue_st
-	{
-	unsigned short epoch;
-	pqueue q;
-	} record_pqueue;
+    {
+    unsigned short epoch;
+    pqueue q;
+    } record_pqueue;
 
 typedef struct hm_fragment_st
-	{
-	struct hm_header_st msg_header;
-	unsigned char *fragment;
-	} hm_fragment;
+    {
+    struct hm_header_st msg_header;
+    unsigned char *fragment;
+    } hm_fragment;
 
 typedef struct dtls1_state_st
-	{
-	unsigned int send_cookie;
-	unsigned char cookie[DTLS1_COOKIE_LENGTH];
-	unsigned char rcvd_cookie[DTLS1_COOKIE_LENGTH];
-	unsigned int cookie_len;
+    {
+    unsigned int send_cookie;
+    unsigned char cookie[DTLS1_COOKIE_LENGTH];
+    unsigned char rcvd_cookie[DTLS1_COOKIE_LENGTH];
+    unsigned int cookie_len;
 
-	/* 
-	 * The current data and handshake epoch.  This is initially
-	 * undefined, and starts at zero once the initial handshake is
-	 * completed 
-	 */
-	unsigned short r_epoch;
-	unsigned short w_epoch;
+    /*
+     * The current data and handshake epoch.  This is initially
+     * undefined, and starts at zero once the initial handshake is
+     * completed
+     */
+    unsigned short r_epoch;
+    unsigned short w_epoch;
 
-	/* records being received in the current epoch */
-	DTLS1_BITMAP bitmap;
+    /* records being received in the current epoch */
+    DTLS1_BITMAP bitmap;
 
-	/* renegotiation starts a new set of sequence numbers */
-	DTLS1_BITMAP next_bitmap;
+    /* renegotiation starts a new set of sequence numbers */
+    DTLS1_BITMAP next_bitmap;
 
-	/* handshake message numbers */
-	unsigned short handshake_write_seq;
-	unsigned short next_handshake_write_seq;
+    /* handshake message numbers */
+    unsigned short handshake_write_seq;
+    unsigned short next_handshake_write_seq;
 
-	unsigned short handshake_read_seq;
+    unsigned short handshake_read_seq;
 
-	/* Received handshake records (processed and unprocessed) */
-	record_pqueue unprocessed_rcds;
-	record_pqueue processed_rcds;
+    /* Received handshake records (processed and unprocessed) */
+    record_pqueue unprocessed_rcds;
+    record_pqueue processed_rcds;
 
-	/* Buffered handshake messages */
-	pqueue buffered_messages;
+    /* Buffered handshake messages */
+    pqueue buffered_messages;
 
-	/* Buffered (sent) handshake records */
-	pqueue sent_messages;
+    /* Buffered (sent) handshake records */
+    pqueue sent_messages;
 
-	unsigned int mtu; /* max wire packet size */
+    unsigned int mtu; /* max wire packet size */
 
-	struct hm_header_st w_msg_hdr;
-	struct hm_header_st r_msg_hdr;
+    struct hm_header_st w_msg_hdr;
+    struct hm_header_st r_msg_hdr;
 
-	struct dtls1_timeout_st timeout;
-	
-	/* storage for Alert/Handshake protocol data received but not
-	 * yet processed by ssl3_read_bytes: */
-	unsigned char alert_fragment[DTLS1_AL_HEADER_LENGTH];
-	unsigned int alert_fragment_len;
-	unsigned char handshake_fragment[DTLS1_HM_HEADER_LENGTH];
-	unsigned int handshake_fragment_len;
+    struct dtls1_timeout_st timeout;
 
-	unsigned int retransmitting;
+    /* storage for Alert/Handshake protocol data received but not
+     * yet processed by ssl3_read_bytes: */
+    unsigned char alert_fragment[DTLS1_AL_HEADER_LENGTH];
+    unsigned int alert_fragment_len;
+    unsigned char handshake_fragment[DTLS1_HM_HEADER_LENGTH];
+    unsigned int handshake_fragment_len;
 
-	} DTLS1_STATE;
+    unsigned int retransmitting;
+
+    } DTLS1_STATE;
 
 typedef struct dtls1_record_data_st
-	{
-	unsigned char *packet;
-	unsigned int   packet_length;
-	SSL3_BUFFER    rbuf;
-	SSL3_RECORD    rrec;
-	} DTLS1_RECORD_DATA;
+    {
+    unsigned char *packet;
+    unsigned int   packet_length;
+    SSL3_BUFFER    rbuf;
+    SSL3_RECORD    rrec;
+    } DTLS1_RECORD_DATA;
 
 
 /* Timeout multipliers (timeout slice is defined in apps/timeouts.h */
diff --git a/dep/include/openssl/e_os2.h b/dep/include/openssl/e_os2.h
index 9da0b654481..b9d3486e645 100644
--- a/dep/include/openssl/e_os2.h
+++ b/dep/include/openssl/e_os2.h
@@ -7,7 +7,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -254,17 +254,17 @@ extern "C" {
    required (if a shared library version requvres it, for example.
    The way it's done allows definitions like this:
 
-	// in foobar.c
-	OPENSSL_IMPLEMENT_GLOBAL(int,foobar) = 0;
-	// in foobar.h
-	OPENSSL_DECLARE_GLOBAL(int,foobar);
-	#define foobar OPENSSL_GLOBAL_REF(foobar)
+    // in foobar.c
+    OPENSSL_IMPLEMENT_GLOBAL(int,foobar) = 0;
+    // in foobar.h
+    OPENSSL_DECLARE_GLOBAL(int,foobar);
+    #define foobar OPENSSL_GLOBAL_REF(foobar)
 */
 #ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION
-# define OPENSSL_IMPLEMENT_GLOBAL(type,name)			     \
-	extern type _hide_##name;				     \
-	type *_shadow_##name(void) { return &_hide_##name; }	     \
-	static type _hide_##name
+# define OPENSSL_IMPLEMENT_GLOBAL(type,name)                 \
+    extern type _hide_##name;                    \
+    type *_shadow_##name(void) { return &_hide_##name; }         \
+    static type _hide_##name
 # define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void)
 # define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name()))
 #else
diff --git a/dep/include/openssl/ec.h b/dep/include/openssl/ec.h
index 3c96fbd0d86..d068a42cb8b 100644
--- a/dep/include/openssl/ec.h
+++ b/dep/include/openssl/ec.h
@@ -10,7 +10,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -58,13 +58,13 @@
 /* ====================================================================
  * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
  *
- * Portions of the attached software ("Contribution") are developed by 
+ * Portions of the attached software ("Contribution") are developed by
  * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
  *
  * The Contribution is licensed pursuant to the OpenSSL open source
  * license provided above.
  *
- * The elliptic curve binary polynomial software is originally written by 
+ * The elliptic curve binary polynomial software is originally written by
  * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories.
  *
  */
@@ -98,25 +98,25 @@ extern "C" {
 #endif
 
 typedef enum {
-	/* values as defined in X9.62 (ECDSA) and elsewhere */
-	POINT_CONVERSION_COMPRESSED = 2,
-	POINT_CONVERSION_UNCOMPRESSED = 4,
-	POINT_CONVERSION_HYBRID = 6
+    /* values as defined in X9.62 (ECDSA) and elsewhere */
+    POINT_CONVERSION_COMPRESSED = 2,
+    POINT_CONVERSION_UNCOMPRESSED = 4,
+    POINT_CONVERSION_HYBRID = 6
 } point_conversion_form_t;
 
 
 typedef struct ec_method_st EC_METHOD;
 
 typedef struct ec_group_st
-	/*
-	 EC_METHOD *meth;
-	 -- field definition
-	 -- curve coefficients
-	 -- optional generator with associated information (order, cofactor)
-	 -- optional extra data (precomputed table for fast computation of multiples of generator)
-	 -- ASN1 stuff
-	*/
-	EC_GROUP;
+    /*
+     EC_METHOD *meth;
+     -- field definition
+     -- curve coefficients
+     -- optional generator with associated information (order, cofactor)
+     -- optional extra data (precomputed table for fast computation of multiples of generator)
+     -- ASN1 stuff
+    */
+    EC_GROUP;
 
 typedef struct ec_point_st EC_POINT;
 
@@ -186,13 +186,13 @@ EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, const BIGNUM
  * specified by a curve name (in form of a NID) */
 EC_GROUP *EC_GROUP_new_by_curve_name(int nid);
 /* handling of internal curves */
-typedef struct { 
-	int nid;
-	const char *comment;
-	} EC_builtin_curve;
-/* EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number 
- * of all available curves or zero if a error occurred. 
- * In case r ist not zero nitems EC_builtin_curve structures 
+typedef struct {
+    int nid;
+    const char *comment;
+    } EC_builtin_curve;
+/* EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number
+ * of all available curves or zero if a error occurred.
+ * In case r ist not zero nitems EC_builtin_curve structures
  * are filled with the data of the first nitems internal groups */
 size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems);
 
@@ -204,27 +204,27 @@ void EC_POINT_free(EC_POINT *);
 void EC_POINT_clear_free(EC_POINT *);
 int EC_POINT_copy(EC_POINT *, const EC_POINT *);
 EC_POINT *EC_POINT_dup(const EC_POINT *, const EC_GROUP *);
- 
+
 const EC_METHOD *EC_POINT_method_of(const EC_POINT *);
 
 int EC_POINT_set_to_infinity(const EC_GROUP *, EC_POINT *);
 int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *, EC_POINT *,
-	const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *);
+    const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *);
 int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *, const EC_POINT *,
-	BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *);
+    BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *);
 int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *, EC_POINT *,
-	const BIGNUM *x, const BIGNUM *y, BN_CTX *);
+    const BIGNUM *x, const BIGNUM *y, BN_CTX *);
 int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *, const EC_POINT *,
-	BIGNUM *x, BIGNUM *y, BN_CTX *);
+    BIGNUM *x, BIGNUM *y, BN_CTX *);
 int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *, EC_POINT *,
-	const BIGNUM *x, int y_bit, BN_CTX *);
+    const BIGNUM *x, int y_bit, BN_CTX *);
 
 int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *, EC_POINT *,
-	const BIGNUM *x, const BIGNUM *y, BN_CTX *);
+    const BIGNUM *x, const BIGNUM *y, BN_CTX *);
 int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *, const EC_POINT *,
-	BIGNUM *x, BIGNUM *y, BN_CTX *);
+    BIGNUM *x, BIGNUM *y, BN_CTX *);
 int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *, EC_POINT *,
-	const BIGNUM *x, int y_bit, BN_CTX *);
+    const BIGNUM *x, int y_bit, BN_CTX *);
 
 size_t EC_POINT_point2oct(const EC_GROUP *, const EC_POINT *, point_conversion_form_t form,
         unsigned char *buf, size_t len, BN_CTX *);
@@ -233,13 +233,13 @@ int EC_POINT_oct2point(const EC_GROUP *, EC_POINT *,
 
 /* other interfaces to point2oct/oct2point: */
 BIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *,
-	point_conversion_form_t form, BIGNUM *, BN_CTX *);
+    point_conversion_form_t form, BIGNUM *, BN_CTX *);
 EC_POINT *EC_POINT_bn2point(const EC_GROUP *, const BIGNUM *,
-	EC_POINT *, BN_CTX *);
+    EC_POINT *, BN_CTX *);
 char *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *,
-	point_conversion_form_t form, BN_CTX *);
+    point_conversion_form_t form, BN_CTX *);
 EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *,
-	EC_POINT *, BN_CTX *);
+    EC_POINT *, BN_CTX *);
 
 int EC_POINT_add(const EC_GROUP *, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *);
 int EC_POINT_dbl(const EC_GROUP *, EC_POINT *r, const EC_POINT *a, BN_CTX *);
@@ -269,10 +269,10 @@ int EC_GROUP_have_precompute_mult(const EC_GROUP *);
  * used to represent the field elements */
 int EC_GROUP_get_basis_type(const EC_GROUP *);
 int EC_GROUP_get_trinomial_basis(const EC_GROUP *, unsigned int *k);
-int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1, 
-	unsigned int *k2, unsigned int *k3);
+int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1,
+    unsigned int *k2, unsigned int *k3);
 
-#define OPENSSL_EC_NAMED_CURVE	0x001
+#define OPENSSL_EC_NAMED_CURVE  0x001
 
 typedef struct ecpk_parameters_st ECPKPARAMETERS;
 
@@ -284,7 +284,7 @@ int i2d_ECPKParameters(const EC_GROUP *, unsigned char **out);
 #define d2i_ECPKParameters_fp(fp,x) (EC_GROUP *)ASN1_d2i_fp(NULL, \
                 (char *(*)())d2i_ECPKParameters,(fp),(unsigned char **)(x))
 #define i2d_ECPKParameters_fp(fp,x) ASN1_i2d_fp(i2d_ECPKParameters,(fp), \
-		(unsigned char *)(x))
+        (unsigned char *)(x))
 
 #ifndef OPENSSL_NO_BIO
 int     ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off);
@@ -297,8 +297,8 @@ int     ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off);
 typedef struct ec_key_st EC_KEY;
 
 /* some values for the encoding_flag */
-#define EC_PKEY_NO_PARAMETERS	0x001
-#define EC_PKEY_NO_PUBKEY	0x002
+#define EC_PKEY_NO_PARAMETERS   0x001
+#define EC_PKEY_NO_PUBKEY   0x002
 
 EC_KEY *EC_KEY_new(void);
 EC_KEY *EC_KEY_new_by_curve_name(int nid);
@@ -319,10 +319,10 @@ void EC_KEY_set_enc_flags(EC_KEY *, unsigned int);
 point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *);
 void EC_KEY_set_conv_form(EC_KEY *, point_conversion_form_t);
 /* functions to set/get method specific data  */
-void *EC_KEY_get_key_method_data(EC_KEY *, 
-	void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *));
+void *EC_KEY_get_key_method_data(EC_KEY *,
+    void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *));
 void EC_KEY_insert_key_method_data(EC_KEY *, void *data,
-	void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *));
+    void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *));
 /* wrapper functions for the underlying EC_GROUP object */
 void EC_KEY_set_asn1_flag(EC_KEY *, int);
 int EC_KEY_precompute_mult(EC_KEY *, BN_CTX *ctx);
@@ -344,12 +344,12 @@ EC_KEY *o2i_ECPublicKey(EC_KEY **a, const unsigned char **in, long len);
 int i2o_ECPublicKey(EC_KEY *a, unsigned char **out);
 
 #ifndef OPENSSL_NO_BIO
-int	ECParameters_print(BIO *bp, const EC_KEY *x);
-int	EC_KEY_print(BIO *bp, const EC_KEY *x, int off);
+int ECParameters_print(BIO *bp, const EC_KEY *x);
+int EC_KEY_print(BIO *bp, const EC_KEY *x, int off);
 #endif
 #ifndef OPENSSL_NO_FP_API
-int	ECParameters_print_fp(FILE *fp, const EC_KEY *x);
-int	EC_KEY_print_fp(FILE *fp, const EC_KEY *x, int off);
+int ECParameters_print_fp(FILE *fp, const EC_KEY *x);
+int EC_KEY_print_fp(FILE *fp, const EC_KEY *x, int off);
 #endif
 
 #define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x)
@@ -371,153 +371,153 @@ void ERR_load_EC_strings(void);
 /* Error codes for the EC functions. */
 
 /* Function codes. */
-#define EC_F_COMPUTE_WNAF				 143
-#define EC_F_D2I_ECPARAMETERS				 144
-#define EC_F_D2I_ECPKPARAMETERS				 145
-#define EC_F_D2I_ECPRIVATEKEY				 146
-#define EC_F_ECPARAMETERS_PRINT				 147
-#define EC_F_ECPARAMETERS_PRINT_FP			 148
-#define EC_F_ECPKPARAMETERS_PRINT			 149
-#define EC_F_ECPKPARAMETERS_PRINT_FP			 150
-#define EC_F_ECP_NIST_MOD_192				 203
-#define EC_F_ECP_NIST_MOD_224				 204
-#define EC_F_ECP_NIST_MOD_256				 205
-#define EC_F_ECP_NIST_MOD_521				 206
-#define EC_F_EC_ASN1_GROUP2CURVE			 153
-#define EC_F_EC_ASN1_GROUP2FIELDID			 154
-#define EC_F_EC_ASN1_GROUP2PARAMETERS			 155
-#define EC_F_EC_ASN1_GROUP2PKPARAMETERS			 156
-#define EC_F_EC_ASN1_PARAMETERS2GROUP			 157
-#define EC_F_EC_ASN1_PKPARAMETERS2GROUP			 158
-#define EC_F_EC_EX_DATA_SET_DATA			 211
-#define EC_F_EC_GF2M_MONTGOMERY_POINT_MULTIPLY		 208
-#define EC_F_EC_GF2M_SIMPLE_GROUP_CHECK_DISCRIMINANT	 159
-#define EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE		 195
-#define EC_F_EC_GF2M_SIMPLE_OCT2POINT			 160
-#define EC_F_EC_GF2M_SIMPLE_POINT2OCT			 161
+#define EC_F_COMPUTE_WNAF                143
+#define EC_F_D2I_ECPARAMETERS                144
+#define EC_F_D2I_ECPKPARAMETERS              145
+#define EC_F_D2I_ECPRIVATEKEY                146
+#define EC_F_ECPARAMETERS_PRINT              147
+#define EC_F_ECPARAMETERS_PRINT_FP           148
+#define EC_F_ECPKPARAMETERS_PRINT            149
+#define EC_F_ECPKPARAMETERS_PRINT_FP             150
+#define EC_F_ECP_NIST_MOD_192                203
+#define EC_F_ECP_NIST_MOD_224                204
+#define EC_F_ECP_NIST_MOD_256                205
+#define EC_F_ECP_NIST_MOD_521                206
+#define EC_F_EC_ASN1_GROUP2CURVE             153
+#define EC_F_EC_ASN1_GROUP2FIELDID           154
+#define EC_F_EC_ASN1_GROUP2PARAMETERS            155
+#define EC_F_EC_ASN1_GROUP2PKPARAMETERS          156
+#define EC_F_EC_ASN1_PARAMETERS2GROUP            157
+#define EC_F_EC_ASN1_PKPARAMETERS2GROUP          158
+#define EC_F_EC_EX_DATA_SET_DATA             211
+#define EC_F_EC_GF2M_MONTGOMERY_POINT_MULTIPLY       208
+#define EC_F_EC_GF2M_SIMPLE_GROUP_CHECK_DISCRIMINANT     159
+#define EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE      195
+#define EC_F_EC_GF2M_SIMPLE_OCT2POINT            160
+#define EC_F_EC_GF2M_SIMPLE_POINT2OCT            161
 #define EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES 162
 #define EC_F_EC_GF2M_SIMPLE_POINT_SET_AFFINE_COORDINATES 163
-#define EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES	 164
-#define EC_F_EC_GFP_MONT_FIELD_DECODE			 133
-#define EC_F_EC_GFP_MONT_FIELD_ENCODE			 134
-#define EC_F_EC_GFP_MONT_FIELD_MUL			 131
-#define EC_F_EC_GFP_MONT_FIELD_SET_TO_ONE		 209
-#define EC_F_EC_GFP_MONT_FIELD_SQR			 132
-#define EC_F_EC_GFP_MONT_GROUP_SET_CURVE		 189
-#define EC_F_EC_GFP_MONT_GROUP_SET_CURVE_GFP		 135
-#define EC_F_EC_GFP_NIST_FIELD_MUL			 200
-#define EC_F_EC_GFP_NIST_FIELD_SQR			 201
-#define EC_F_EC_GFP_NIST_GROUP_SET_CURVE		 202
-#define EC_F_EC_GFP_SIMPLE_GROUP_CHECK_DISCRIMINANT	 165
-#define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE		 166
-#define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE_GFP		 100
-#define EC_F_EC_GFP_SIMPLE_GROUP_SET_GENERATOR		 101
-#define EC_F_EC_GFP_SIMPLE_MAKE_AFFINE			 102
-#define EC_F_EC_GFP_SIMPLE_OCT2POINT			 103
-#define EC_F_EC_GFP_SIMPLE_POINT2OCT			 104
-#define EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE		 137
-#define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES	 167
+#define EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES   164
+#define EC_F_EC_GFP_MONT_FIELD_DECODE            133
+#define EC_F_EC_GFP_MONT_FIELD_ENCODE            134
+#define EC_F_EC_GFP_MONT_FIELD_MUL           131
+#define EC_F_EC_GFP_MONT_FIELD_SET_TO_ONE        209
+#define EC_F_EC_GFP_MONT_FIELD_SQR           132
+#define EC_F_EC_GFP_MONT_GROUP_SET_CURVE         189
+#define EC_F_EC_GFP_MONT_GROUP_SET_CURVE_GFP         135
+#define EC_F_EC_GFP_NIST_FIELD_MUL           200
+#define EC_F_EC_GFP_NIST_FIELD_SQR           201
+#define EC_F_EC_GFP_NIST_GROUP_SET_CURVE         202
+#define EC_F_EC_GFP_SIMPLE_GROUP_CHECK_DISCRIMINANT  165
+#define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE       166
+#define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE_GFP       100
+#define EC_F_EC_GFP_SIMPLE_GROUP_SET_GENERATOR       101
+#define EC_F_EC_GFP_SIMPLE_MAKE_AFFINE           102
+#define EC_F_EC_GFP_SIMPLE_OCT2POINT             103
+#define EC_F_EC_GFP_SIMPLE_POINT2OCT             104
+#define EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE        137
+#define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES  167
 #define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES_GFP 105
-#define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES	 168
+#define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES  168
 #define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES_GFP 128
-#define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES	 169
+#define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES    169
 #define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES_GFP 129
-#define EC_F_EC_GROUP_CHECK				 170
-#define EC_F_EC_GROUP_CHECK_DISCRIMINANT		 171
-#define EC_F_EC_GROUP_COPY				 106
-#define EC_F_EC_GROUP_GET0_GENERATOR			 139
-#define EC_F_EC_GROUP_GET_COFACTOR			 140
-#define EC_F_EC_GROUP_GET_CURVE_GF2M			 172
-#define EC_F_EC_GROUP_GET_CURVE_GFP			 130
-#define EC_F_EC_GROUP_GET_DEGREE			 173
-#define EC_F_EC_GROUP_GET_ORDER				 141
-#define EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS		 193
-#define EC_F_EC_GROUP_GET_TRINOMIAL_BASIS		 194
-#define EC_F_EC_GROUP_NEW				 108
-#define EC_F_EC_GROUP_NEW_BY_CURVE_NAME			 174
-#define EC_F_EC_GROUP_NEW_FROM_DATA			 175
-#define EC_F_EC_GROUP_PRECOMPUTE_MULT			 142
-#define EC_F_EC_GROUP_SET_CURVE_GF2M			 176
-#define EC_F_EC_GROUP_SET_CURVE_GFP			 109
-#define EC_F_EC_GROUP_SET_EXTRA_DATA			 110
-#define EC_F_EC_GROUP_SET_GENERATOR			 111
-#define EC_F_EC_KEY_CHECK_KEY				 177
-#define EC_F_EC_KEY_COPY				 178
-#define EC_F_EC_KEY_GENERATE_KEY			 179
-#define EC_F_EC_KEY_NEW					 182
-#define EC_F_EC_KEY_PRINT				 180
-#define EC_F_EC_KEY_PRINT_FP				 181
-#define EC_F_EC_POINTS_MAKE_AFFINE			 136
-#define EC_F_EC_POINTS_MUL				 138
-#define EC_F_EC_POINT_ADD				 112
-#define EC_F_EC_POINT_CMP				 113
-#define EC_F_EC_POINT_COPY				 114
-#define EC_F_EC_POINT_DBL				 115
-#define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M	 183
-#define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP	 116
-#define EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP	 117
-#define EC_F_EC_POINT_INVERT				 210
-#define EC_F_EC_POINT_IS_AT_INFINITY			 118
-#define EC_F_EC_POINT_IS_ON_CURVE			 119
-#define EC_F_EC_POINT_MAKE_AFFINE			 120
-#define EC_F_EC_POINT_MUL				 184
-#define EC_F_EC_POINT_NEW				 121
-#define EC_F_EC_POINT_OCT2POINT				 122
-#define EC_F_EC_POINT_POINT2OCT				 123
-#define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M	 185
-#define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP	 124
-#define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M	 186
-#define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP	 125
-#define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP	 126
-#define EC_F_EC_POINT_SET_TO_INFINITY			 127
-#define EC_F_EC_PRE_COMP_DUP				 207
-#define EC_F_EC_WNAF_MUL				 187
-#define EC_F_EC_WNAF_PRECOMPUTE_MULT			 188
-#define EC_F_I2D_ECPARAMETERS				 190
-#define EC_F_I2D_ECPKPARAMETERS				 191
-#define EC_F_I2D_ECPRIVATEKEY				 192
-#define EC_F_I2O_ECPUBLICKEY				 151
-#define EC_F_O2I_ECPUBLICKEY				 152
+#define EC_F_EC_GROUP_CHECK              170
+#define EC_F_EC_GROUP_CHECK_DISCRIMINANT         171
+#define EC_F_EC_GROUP_COPY               106
+#define EC_F_EC_GROUP_GET0_GENERATOR             139
+#define EC_F_EC_GROUP_GET_COFACTOR           140
+#define EC_F_EC_GROUP_GET_CURVE_GF2M             172
+#define EC_F_EC_GROUP_GET_CURVE_GFP          130
+#define EC_F_EC_GROUP_GET_DEGREE             173
+#define EC_F_EC_GROUP_GET_ORDER              141
+#define EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS      193
+#define EC_F_EC_GROUP_GET_TRINOMIAL_BASIS        194
+#define EC_F_EC_GROUP_NEW                108
+#define EC_F_EC_GROUP_NEW_BY_CURVE_NAME          174
+#define EC_F_EC_GROUP_NEW_FROM_DATA          175
+#define EC_F_EC_GROUP_PRECOMPUTE_MULT            142
+#define EC_F_EC_GROUP_SET_CURVE_GF2M             176
+#define EC_F_EC_GROUP_SET_CURVE_GFP          109
+#define EC_F_EC_GROUP_SET_EXTRA_DATA             110
+#define EC_F_EC_GROUP_SET_GENERATOR          111
+#define EC_F_EC_KEY_CHECK_KEY                177
+#define EC_F_EC_KEY_COPY                 178
+#define EC_F_EC_KEY_GENERATE_KEY             179
+#define EC_F_EC_KEY_NEW                  182
+#define EC_F_EC_KEY_PRINT                180
+#define EC_F_EC_KEY_PRINT_FP                 181
+#define EC_F_EC_POINTS_MAKE_AFFINE           136
+#define EC_F_EC_POINTS_MUL               138
+#define EC_F_EC_POINT_ADD                112
+#define EC_F_EC_POINT_CMP                113
+#define EC_F_EC_POINT_COPY               114
+#define EC_F_EC_POINT_DBL                115
+#define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M    183
+#define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP     116
+#define EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP    117
+#define EC_F_EC_POINT_INVERT                 210
+#define EC_F_EC_POINT_IS_AT_INFINITY             118
+#define EC_F_EC_POINT_IS_ON_CURVE            119
+#define EC_F_EC_POINT_MAKE_AFFINE            120
+#define EC_F_EC_POINT_MUL                184
+#define EC_F_EC_POINT_NEW                121
+#define EC_F_EC_POINT_OCT2POINT              122
+#define EC_F_EC_POINT_POINT2OCT              123
+#define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M    185
+#define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP     124
+#define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M    186
+#define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP     125
+#define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP    126
+#define EC_F_EC_POINT_SET_TO_INFINITY            127
+#define EC_F_EC_PRE_COMP_DUP                 207
+#define EC_F_EC_WNAF_MUL                 187
+#define EC_F_EC_WNAF_PRECOMPUTE_MULT             188
+#define EC_F_I2D_ECPARAMETERS                190
+#define EC_F_I2D_ECPKPARAMETERS              191
+#define EC_F_I2D_ECPRIVATEKEY                192
+#define EC_F_I2O_ECPUBLICKEY                 151
+#define EC_F_O2I_ECPUBLICKEY                 152
 
 /* Reason codes. */
-#define EC_R_ASN1_ERROR					 115
-#define EC_R_ASN1_UNKNOWN_FIELD				 116
-#define EC_R_BUFFER_TOO_SMALL				 100
-#define EC_R_D2I_ECPKPARAMETERS_FAILURE			 117
-#define EC_R_DISCRIMINANT_IS_ZERO			 118
-#define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE		 119
-#define EC_R_FIELD_TOO_LARGE				 138
-#define EC_R_GROUP2PKPARAMETERS_FAILURE			 120
-#define EC_R_I2D_ECPKPARAMETERS_FAILURE			 121
-#define EC_R_INCOMPATIBLE_OBJECTS			 101
-#define EC_R_INVALID_ARGUMENT				 112
-#define EC_R_INVALID_COMPRESSED_POINT			 110
-#define EC_R_INVALID_COMPRESSION_BIT			 109
-#define EC_R_INVALID_ENCODING				 102
-#define EC_R_INVALID_FIELD				 103
-#define EC_R_INVALID_FORM				 104
-#define EC_R_INVALID_GROUP_ORDER			 122
-#define EC_R_INVALID_PENTANOMIAL_BASIS			 132
-#define EC_R_INVALID_PRIVATE_KEY			 123
-#define EC_R_INVALID_TRINOMIAL_BASIS			 137
-#define EC_R_MISSING_PARAMETERS				 124
-#define EC_R_MISSING_PRIVATE_KEY			 125
-#define EC_R_NOT_A_NIST_PRIME				 135
-#define EC_R_NOT_A_SUPPORTED_NIST_PRIME			 136
-#define EC_R_NOT_IMPLEMENTED				 126
-#define EC_R_NOT_INITIALIZED				 111
-#define EC_R_NO_FIELD_MOD				 133
-#define EC_R_PASSED_NULL_PARAMETER			 134
-#define EC_R_PKPARAMETERS2GROUP_FAILURE			 127
-#define EC_R_POINT_AT_INFINITY				 106
-#define EC_R_POINT_IS_NOT_ON_CURVE			 107
-#define EC_R_SLOT_FULL					 108
-#define EC_R_UNDEFINED_GENERATOR			 113
-#define EC_R_UNDEFINED_ORDER				 128
-#define EC_R_UNKNOWN_GROUP				 129
-#define EC_R_UNKNOWN_ORDER				 114
-#define EC_R_UNSUPPORTED_FIELD				 131
-#define EC_R_WRONG_ORDER				 130
+#define EC_R_ASN1_ERROR                  115
+#define EC_R_ASN1_UNKNOWN_FIELD              116
+#define EC_R_BUFFER_TOO_SMALL                100
+#define EC_R_D2I_ECPKPARAMETERS_FAILURE          117
+#define EC_R_DISCRIMINANT_IS_ZERO            118
+#define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE        119
+#define EC_R_FIELD_TOO_LARGE                 138
+#define EC_R_GROUP2PKPARAMETERS_FAILURE          120
+#define EC_R_I2D_ECPKPARAMETERS_FAILURE          121
+#define EC_R_INCOMPATIBLE_OBJECTS            101
+#define EC_R_INVALID_ARGUMENT                112
+#define EC_R_INVALID_COMPRESSED_POINT            110
+#define EC_R_INVALID_COMPRESSION_BIT             109
+#define EC_R_INVALID_ENCODING                102
+#define EC_R_INVALID_FIELD               103
+#define EC_R_INVALID_FORM                104
+#define EC_R_INVALID_GROUP_ORDER             122
+#define EC_R_INVALID_PENTANOMIAL_BASIS           132
+#define EC_R_INVALID_PRIVATE_KEY             123
+#define EC_R_INVALID_TRINOMIAL_BASIS             137
+#define EC_R_MISSING_PARAMETERS              124
+#define EC_R_MISSING_PRIVATE_KEY             125
+#define EC_R_NOT_A_NIST_PRIME                135
+#define EC_R_NOT_A_SUPPORTED_NIST_PRIME          136
+#define EC_R_NOT_IMPLEMENTED                 126
+#define EC_R_NOT_INITIALIZED                 111
+#define EC_R_NO_FIELD_MOD                133
+#define EC_R_PASSED_NULL_PARAMETER           134
+#define EC_R_PKPARAMETERS2GROUP_FAILURE          127
+#define EC_R_POINT_AT_INFINITY               106
+#define EC_R_POINT_IS_NOT_ON_CURVE           107
+#define EC_R_SLOT_FULL                   108
+#define EC_R_UNDEFINED_GENERATOR             113
+#define EC_R_UNDEFINED_ORDER                 128
+#define EC_R_UNKNOWN_GROUP               129
+#define EC_R_UNKNOWN_ORDER               114
+#define EC_R_UNSUPPORTED_FIELD               131
+#define EC_R_WRONG_ORDER                 130
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/ecdh.h b/dep/include/openssl/ecdh.h
index b4b58ee65ba..1aecaeafb7b 100644
--- a/dep/include/openssl/ecdh.h
+++ b/dep/include/openssl/ecdh.h
@@ -21,7 +21,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -87,17 +87,17 @@ extern "C" {
 
 const ECDH_METHOD *ECDH_OpenSSL(void);
 
-void	  ECDH_set_default_method(const ECDH_METHOD *);
+void      ECDH_set_default_method(const ECDH_METHOD *);
 const ECDH_METHOD *ECDH_get_default_method(void);
-int 	  ECDH_set_method(EC_KEY *, const ECDH_METHOD *);
+int       ECDH_set_method(EC_KEY *, const ECDH_METHOD *);
 
 int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh,
                      void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen));
 
-int 	  ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new 
-		*new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
-int 	  ECDH_set_ex_data(EC_KEY *d, int idx, void *arg);
-void 	  *ECDH_get_ex_data(EC_KEY *d, int idx);
+int       ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new
+        *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+int       ECDH_set_ex_data(EC_KEY *d, int idx, void *arg);
+void      *ECDH_get_ex_data(EC_KEY *d, int idx);
 
 
 /* BEGIN ERROR CODES */
@@ -109,13 +109,13 @@ void ERR_load_ECDH_strings(void);
 /* Error codes for the ECDH functions. */
 
 /* Function codes. */
-#define ECDH_F_ECDH_COMPUTE_KEY				 100
-#define ECDH_F_ECDH_DATA_NEW_METHOD			 101
+#define ECDH_F_ECDH_COMPUTE_KEY              100
+#define ECDH_F_ECDH_DATA_NEW_METHOD          101
 
 /* Reason codes. */
-#define ECDH_R_KDF_FAILED				 102
-#define ECDH_R_NO_PRIVATE_VALUE				 100
-#define ECDH_R_POINT_ARITHMETIC_FAILURE			 101
+#define ECDH_R_KDF_FAILED                102
+#define ECDH_R_NO_PRIVATE_VALUE              100
+#define ECDH_R_POINT_ARITHMETIC_FAILURE          101
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/ecdsa.h b/dep/include/openssl/ecdsa.h
index f20c8ee7381..f2dbc0dfe74 100644
--- a/dep/include/openssl/ecdsa.h
+++ b/dep/include/openssl/ecdsa.h
@@ -11,7 +11,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -76,10 +76,10 @@ extern "C" {
 #endif
 
 typedef struct ECDSA_SIG_st
-	{
-	BIGNUM *r;
-	BIGNUM *s;
-	} ECDSA_SIG;
+    {
+    BIGNUM *r;
+    BIGNUM *s;
+    } ECDSA_SIG;
 
 /** ECDSA_SIG *ECDSA_SIG_new(void)
  * allocates and initialize a ECDSA_SIG structure
@@ -91,20 +91,20 @@ ECDSA_SIG *ECDSA_SIG_new(void);
  * frees a ECDSA_SIG structure
  * \param a pointer to the ECDSA_SIG structure
  */
-void	  ECDSA_SIG_free(ECDSA_SIG *a);
+void      ECDSA_SIG_free(ECDSA_SIG *a);
 
 /** i2d_ECDSA_SIG
  * DER encode content of ECDSA_SIG object (note: this function modifies *pp
  * (*pp += length of the DER encoded signature)).
  * \param a  pointer to the ECDSA_SIG object
  * \param pp pointer to a unsigned char pointer for the output or NULL
- * \return the length of the DER encoded ECDSA_SIG object or 0 
+ * \return the length of the DER encoded ECDSA_SIG object or 0
  */
-int	  i2d_ECDSA_SIG(const ECDSA_SIG *a, unsigned char **pp);
+int   i2d_ECDSA_SIG(const ECDSA_SIG *a, unsigned char **pp);
 
 /** d2i_ECDSA_SIG
  * decodes a DER encoded ECDSA signature (note: this function changes *pp
- * (*pp += len)). 
+ * (*pp += len)).
  * \param v pointer to ECDSA_SIG pointer (may be NULL)
  * \param pp buffer with the DER encoded signature
  * \param len bufferlength
@@ -128,13 +128,13 @@ ECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst,int dgst_len,EC_KEY *eckey);
  * \param dgst pointer to the hash value to sign
  * \param dgstlen length of the hash value
  * \param kinv optional pointer to a pre-computed inverse k
- * \param rp optional pointer to the pre-computed rp value (see 
+ * \param rp optional pointer to the pre-computed rp value (see
  *        ECDSA_sign_setup
  * \param eckey pointer to the EC_KEY object containing a private EC key
  * \return pointer to a ECDSA_SIG structure or NULL
  */
-ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen, 
-		const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey);
+ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen,
+        const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey);
 
 /** ECDSA_do_verify
  * verifies that the supplied signature is a valid ECDSA
@@ -145,8 +145,8 @@ ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen,
  * \param eckey pointer to the EC_KEY object containing a public EC key
  * \return 1 if the signature is valid, 0 if the signature is invalid and -1 on error
  */
-int	  ECDSA_do_verify(const unsigned char *dgst, int dgst_len,
-		const ECDSA_SIG *sig, EC_KEY* eckey);
+int   ECDSA_do_verify(const unsigned char *dgst, int dgst_len,
+        const ECDSA_SIG *sig, EC_KEY* eckey);
 
 const ECDSA_METHOD *ECDSA_OpenSSL(void);
 
@@ -154,7 +154,7 @@ const ECDSA_METHOD *ECDSA_OpenSSL(void);
  * sets the default ECDSA method
  * \param meth the new default ECDSA_METHOD
  */
-void	  ECDSA_set_default_method(const ECDSA_METHOD *meth);
+void      ECDSA_set_default_method(const ECDSA_METHOD *meth);
 
 /** ECDSA_get_default_method
  * returns the default ECDSA method
@@ -166,27 +166,27 @@ const ECDSA_METHOD *ECDSA_get_default_method(void);
  * sets method to be used for the ECDSA operations
  * \param eckey pointer to the EC_KEY object
  * \param meth  pointer to the new method
- * \return 1 on success and 0 otherwise 
+ * \return 1 on success and 0 otherwise
  */
-int 	  ECDSA_set_method(EC_KEY *eckey, const ECDSA_METHOD *meth);
+int       ECDSA_set_method(EC_KEY *eckey, const ECDSA_METHOD *meth);
 
 /** ECDSA_size
  * returns the maximum length of the DER encoded signature
  * \param  eckey pointer to a EC_KEY object
  * \return numbers of bytes required for the DER encoded signature
  */
-int	  ECDSA_size(const EC_KEY *eckey);
+int   ECDSA_size(const EC_KEY *eckey);
 
 /** ECDSA_sign_setup
- * precompute parts of the signing operation. 
+ * precompute parts of the signing operation.
  * \param eckey pointer to the EC_KEY object containing a private EC key
  * \param ctx  pointer to a BN_CTX object (may be NULL)
  * \param kinv pointer to a BIGNUM pointer for the inverse of k
  * \param rp   pointer to a BIGNUM pointer for x coordinate of k * generator
  * \return 1 on success and 0 otherwise
  */
-int 	  ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv, 
-		BIGNUM **rp);
+int       ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv,
+        BIGNUM **rp);
 
 /** ECDSA_sign
  * computes ECDSA signature of a given hash value using the supplied
@@ -199,8 +199,8 @@ int 	  ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv,
  * \param eckey pointer to the EC_KEY object containing a private EC key
  * \return 1 on success and 0 otherwise
  */
-int	  ECDSA_sign(int type, const unsigned char *dgst, int dgstlen, 
-		unsigned char *sig, unsigned int *siglen, EC_KEY *eckey);
+int   ECDSA_sign(int type, const unsigned char *dgst, int dgstlen,
+        unsigned char *sig, unsigned int *siglen, EC_KEY *eckey);
 
 
 /** ECDSA_sign_ex
@@ -212,34 +212,34 @@ int	  ECDSA_sign(int type, const unsigned char *dgst, int dgstlen,
  * \param sig buffer to hold the DER encoded signature
  * \param siglen pointer to the length of the returned signature
  * \param kinv optional pointer to a pre-computed inverse k
- * \param rp optional pointer to the pre-computed rp value (see 
+ * \param rp optional pointer to the pre-computed rp value (see
  *        ECDSA_sign_setup
  * \param eckey pointer to the EC_KEY object containing a private EC key
  * \return 1 on success and 0 otherwise
  */
-int	  ECDSA_sign_ex(int type, const unsigned char *dgst, int dgstlen, 
-		unsigned char *sig, unsigned int *siglen, const BIGNUM *kinv,
-		const BIGNUM *rp, EC_KEY *eckey);
+int   ECDSA_sign_ex(int type, const unsigned char *dgst, int dgstlen,
+        unsigned char *sig, unsigned int *siglen, const BIGNUM *kinv,
+        const BIGNUM *rp, EC_KEY *eckey);
 
 /** ECDSA_verify
  * verifies that the given signature is valid ECDSA signature
  * of the supplied hash value using the specified public key.
  * \param type this parameter is ignored
- * \param dgst pointer to the hash value 
+ * \param dgst pointer to the hash value
  * \param dgstlen length of the hash value
  * \param sig  pointer to the DER encoded signature
  * \param siglen length of the DER encoded signature
  * \param eckey pointer to the EC_KEY object containing a public EC key
  * \return 1 if the signature is valid, 0 if the signature is invalid and -1 on error
  */
-int 	  ECDSA_verify(int type, const unsigned char *dgst, int dgstlen, 
-		const unsigned char *sig, int siglen, EC_KEY *eckey);
+int       ECDSA_verify(int type, const unsigned char *dgst, int dgstlen,
+        const unsigned char *sig, int siglen, EC_KEY *eckey);
 
 /* the standard ex_data functions */
-int 	  ECDSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new 
-		*new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
-int 	  ECDSA_set_ex_data(EC_KEY *d, int idx, void *arg);
-void 	  *ECDSA_get_ex_data(EC_KEY *d, int idx);
+int       ECDSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new
+        *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+int       ECDSA_set_ex_data(EC_KEY *d, int idx, void *arg);
+void      *ECDSA_get_ex_data(EC_KEY *d, int idx);
 
 
 /* BEGIN ERROR CODES */
@@ -251,19 +251,19 @@ void ERR_load_ECDSA_strings(void);
 /* Error codes for the ECDSA functions. */
 
 /* Function codes. */
-#define ECDSA_F_ECDSA_DATA_NEW_METHOD			 100
-#define ECDSA_F_ECDSA_DO_SIGN				 101
-#define ECDSA_F_ECDSA_DO_VERIFY				 102
-#define ECDSA_F_ECDSA_SIGN_SETUP			 103
+#define ECDSA_F_ECDSA_DATA_NEW_METHOD            100
+#define ECDSA_F_ECDSA_DO_SIGN                101
+#define ECDSA_F_ECDSA_DO_VERIFY              102
+#define ECDSA_F_ECDSA_SIGN_SETUP             103
 
 /* Reason codes. */
-#define ECDSA_R_BAD_SIGNATURE				 100
-#define ECDSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE		 101
-#define ECDSA_R_ERR_EC_LIB				 102
-#define ECDSA_R_MISSING_PARAMETERS			 103
-#define ECDSA_R_NEED_NEW_SETUP_VALUES			 106
-#define ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED		 104
-#define ECDSA_R_SIGNATURE_MALLOC_FAILED			 105
+#define ECDSA_R_BAD_SIGNATURE                100
+#define ECDSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE      101
+#define ECDSA_R_ERR_EC_LIB               102
+#define ECDSA_R_MISSING_PARAMETERS           103
+#define ECDSA_R_NEED_NEW_SETUP_VALUES            106
+#define ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED      104
+#define ECDSA_R_SIGNATURE_MALLOC_FAILED          105
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/engine.h b/dep/include/openssl/engine.h
index 3ec59338ffd..dc931f44c49 100644
--- a/dep/include/openssl/engine.h
+++ b/dep/include/openssl/engine.h
@@ -10,7 +10,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -57,7 +57,7 @@
  */
 /* ====================================================================
  * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
- * ECDH support in OpenSSL originally developed by 
+ * ECDH support in OpenSSL originally developed by
  * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
  */
 
@@ -102,32 +102,32 @@ extern "C" {
 
 /* These flags are used to control combinations of algorithm (methods)
  * by bitwise "OR"ing. */
-#define ENGINE_METHOD_RSA		(unsigned int)0x0001
-#define ENGINE_METHOD_DSA		(unsigned int)0x0002
-#define ENGINE_METHOD_DH		(unsigned int)0x0004
-#define ENGINE_METHOD_RAND		(unsigned int)0x0008
-#define ENGINE_METHOD_ECDH		(unsigned int)0x0010
-#define ENGINE_METHOD_ECDSA		(unsigned int)0x0020
-#define ENGINE_METHOD_CIPHERS		(unsigned int)0x0040
-#define ENGINE_METHOD_DIGESTS		(unsigned int)0x0080
-#define ENGINE_METHOD_STORE		(unsigned int)0x0100
+#define ENGINE_METHOD_RSA       (unsigned int)0x0001
+#define ENGINE_METHOD_DSA       (unsigned int)0x0002
+#define ENGINE_METHOD_DH        (unsigned int)0x0004
+#define ENGINE_METHOD_RAND      (unsigned int)0x0008
+#define ENGINE_METHOD_ECDH      (unsigned int)0x0010
+#define ENGINE_METHOD_ECDSA     (unsigned int)0x0020
+#define ENGINE_METHOD_CIPHERS       (unsigned int)0x0040
+#define ENGINE_METHOD_DIGESTS       (unsigned int)0x0080
+#define ENGINE_METHOD_STORE     (unsigned int)0x0100
 /* Obvious all-or-nothing cases. */
-#define ENGINE_METHOD_ALL		(unsigned int)0xFFFF
-#define ENGINE_METHOD_NONE		(unsigned int)0x0000
+#define ENGINE_METHOD_ALL       (unsigned int)0xFFFF
+#define ENGINE_METHOD_NONE      (unsigned int)0x0000
 
 /* This(ese) flag(s) controls behaviour of the ENGINE_TABLE mechanism used
  * internally to control registration of ENGINE implementations, and can be set
  * by ENGINE_set_table_flags(). The "NOINIT" flag prevents attempts to
  * initialise registered ENGINEs if they are not already initialised. */
-#define ENGINE_TABLE_FLAG_NOINIT	(unsigned int)0x0001
+#define ENGINE_TABLE_FLAG_NOINIT    (unsigned int)0x0001
 
 /* ENGINE flags that can be set by ENGINE_set_flags(). */
-/* #define ENGINE_FLAGS_MALLOCED	0x0001 */ /* Not used */
+/* #define ENGINE_FLAGS_MALLOCED    0x0001 */ /* Not used */
 
 /* This flag is for ENGINEs that wish to handle the various 'CMD'-related
  * control commands on their own. Without this flag, ENGINE_ctrl() handles these
  * control commands on behalf of the ENGINE using their "cmd_defns" data. */
-#define ENGINE_FLAGS_MANUAL_CMD_CTRL	(int)0x0002
+#define ENGINE_FLAGS_MANUAL_CMD_CTRL    (int)0x0002
 
 /* This flag is for ENGINEs who return new duplicate structures when found via
  * "ENGINE_by_id()". When an ENGINE must store state (eg. if ENGINE_ctrl()
@@ -136,7 +136,7 @@ extern "C" {
  * to obtain the ENGINE will result in it being copied into a new structure.
  * Normally, ENGINEs don't declare this flag so ENGINE_by_id() just increments
  * the existing ENGINE's structural reference count. */
-#define ENGINE_FLAGS_BY_ID_COPY		(int)0x0004
+#define ENGINE_FLAGS_BY_ID_COPY     (int)0x0004
 
 /* ENGINEs can support their own command types, and these flags are used in
  * ENGINE_CTRL_GET_CMD_FLAGS to indicate to the caller what kind of input each
@@ -149,17 +149,17 @@ extern "C" {
  * ENGINE_cmd_is_executable() and ENGINE_ctrl_cmd_string(). */
 
 /* accepts a 'long' input value (3rd parameter to ENGINE_ctrl) */
-#define ENGINE_CMD_FLAG_NUMERIC		(unsigned int)0x0001
+#define ENGINE_CMD_FLAG_NUMERIC     (unsigned int)0x0001
 /* accepts string input (cast from 'void*' to 'const char *', 4th parameter to
  * ENGINE_ctrl) */
-#define ENGINE_CMD_FLAG_STRING		(unsigned int)0x0002
+#define ENGINE_CMD_FLAG_STRING      (unsigned int)0x0002
 /* Indicates that the control command takes *no* input. Ie. the control command
  * is unparameterised. */
-#define ENGINE_CMD_FLAG_NO_INPUT	(unsigned int)0x0004
+#define ENGINE_CMD_FLAG_NO_INPUT    (unsigned int)0x0004
 /* Indicates that the control command is internal. This control command won't
  * be shown in any output, and is only usable through the ENGINE_ctrl_cmd()
  * function. */
-#define ENGINE_CMD_FLAG_INTERNAL	(unsigned int)0x0008
+#define ENGINE_CMD_FLAG_INTERNAL    (unsigned int)0x0008
 
 /* NB: These 3 control commands are deprecated and should not be used. ENGINEs
  * relying on these commands should compile conditional support for
@@ -174,21 +174,21 @@ extern "C" {
  * All command numbers are shared between all engines, even if some don't
  * make sense to some engines.  In such a case, they do nothing but return
  * the error ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED. */
-#define ENGINE_CTRL_SET_LOGSTREAM		1
-#define ENGINE_CTRL_SET_PASSWORD_CALLBACK	2
-#define ENGINE_CTRL_HUP				3 /* Close and reinitialise any
-						     handles/connections etc. */
+#define ENGINE_CTRL_SET_LOGSTREAM       1
+#define ENGINE_CTRL_SET_PASSWORD_CALLBACK   2
+#define ENGINE_CTRL_HUP             3 /* Close and reinitialise any
+                             handles/connections etc. */
 #define ENGINE_CTRL_SET_USER_INTERFACE          4 /* Alternative to callback */
 #define ENGINE_CTRL_SET_CALLBACK_DATA           5 /* User-specific data, used
-						     when calling the password
-						     callback and the user
-						     interface */
-#define ENGINE_CTRL_LOAD_CONFIGURATION		6 /* Load a configuration, given
-						     a string that represents a
-						     file name or so */
-#define ENGINE_CTRL_LOAD_SECTION		7 /* Load data from a given
-						     section in the already loaded
-						     configuration */
+                             when calling the password
+                             callback and the user
+                             interface */
+#define ENGINE_CTRL_LOAD_CONFIGURATION      6 /* Load a configuration, given
+                             a string that represents a
+                             file name or so */
+#define ENGINE_CTRL_LOAD_SECTION        7 /* Load data from a given
+                             section in the already loaded
+                             configuration */
 
 /* These control commands allow an application to deal with an arbitrary engine
  * in a dynamic way. Warn: Negative return values indicate errors FOR THESE
@@ -207,35 +207,35 @@ extern "C" {
  * all the remaining control commands will return failure, so it is worth
  * checking this first if the caller is trying to "discover" the engine's
  * capabilities and doesn't want errors generated unnecessarily. */
-#define ENGINE_CTRL_HAS_CTRL_FUNCTION		10
+#define ENGINE_CTRL_HAS_CTRL_FUNCTION       10
 /* Returns a positive command number for the first command supported by the
  * engine. Returns zero if no ctrl commands are supported. */
-#define ENGINE_CTRL_GET_FIRST_CMD_TYPE		11
+#define ENGINE_CTRL_GET_FIRST_CMD_TYPE      11
 /* The 'long' argument specifies a command implemented by the engine, and the
  * return value is the next command supported, or zero if there are no more. */
-#define ENGINE_CTRL_GET_NEXT_CMD_TYPE		12
+#define ENGINE_CTRL_GET_NEXT_CMD_TYPE       12
 /* The 'void*' argument is a command name (cast from 'const char *'), and the
  * return value is the command that corresponds to it. */
-#define ENGINE_CTRL_GET_CMD_FROM_NAME		13
+#define ENGINE_CTRL_GET_CMD_FROM_NAME       13
 /* The next two allow a command to be converted into its corresponding string
  * form. In each case, the 'long' argument supplies the command. In the NAME_LEN
  * case, the return value is the length of the command name (not counting a
  * trailing EOL). In the NAME case, the 'void*' argument must be a string buffer
  * large enough, and it will be populated with the name of the command (WITH a
  * trailing EOL). */
-#define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD	14
-#define ENGINE_CTRL_GET_NAME_FROM_CMD		15
+#define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD   14
+#define ENGINE_CTRL_GET_NAME_FROM_CMD       15
 /* The next two are similar but give a "short description" of a command. */
-#define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD	16
-#define ENGINE_CTRL_GET_DESC_FROM_CMD		17
+#define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD   16
+#define ENGINE_CTRL_GET_DESC_FROM_CMD       17
 /* With this command, the return value is the OR'd combination of
  * ENGINE_CMD_FLAG_*** values that indicate what kind of input a given
  * engine-specific ctrl command expects. */
-#define ENGINE_CTRL_GET_CMD_FLAGS		18
+#define ENGINE_CTRL_GET_CMD_FLAGS       18
 
 /* ENGINE implementations should start the numbering of their own control
  * commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc). */
-#define ENGINE_CMD_BASE				200
+#define ENGINE_CMD_BASE             200
 
 /* NB: These 2 nCipher "chil" control commands are deprecated, and their
  * functionality is now available through ENGINE-specific control commands
@@ -244,14 +244,14 @@ extern "C" {
  * are removed. */
 
 /* Flags specific to the nCipher "chil" engine */
-#define ENGINE_CTRL_CHIL_SET_FORKCHECK		100
-	/* Depending on the value of the (long)i argument, this sets or
-	 * unsets the SimpleForkCheck flag in the CHIL API to enable or
-	 * disable checking and workarounds for applications that fork().
-	 */
-#define ENGINE_CTRL_CHIL_NO_LOCKING		101
-	/* This prevents the initialisation function from providing mutex
-	 * callbacks to the nCipher library. */
+#define ENGINE_CTRL_CHIL_SET_FORKCHECK      100
+    /* Depending on the value of the (long)i argument, this sets or
+     * unsets the SimpleForkCheck flag in the CHIL API to enable or
+     * disable checking and workarounds for applications that fork().
+     */
+#define ENGINE_CTRL_CHIL_NO_LOCKING     101
+    /* This prevents the initialisation function from providing mutex
+     * callbacks to the nCipher library. */
 
 /* If an ENGINE supports its own specific control commands and wishes the
  * framework to handle the above 'ENGINE_CMD_***'-manipulation commands on its
@@ -262,12 +262,12 @@ extern "C" {
  * "null-terminated" means that the last ENGINE_CMD_DEFN element has cmd_num set
  * to zero and/or cmd_name set to NULL. */
 typedef struct ENGINE_CMD_DEFN_st
-	{
-	unsigned int cmd_num; /* The command number */
-	const char *cmd_name; /* The command name itself */
-	const char *cmd_desc; /* A short description of the command */
-	unsigned int cmd_flags; /* The input the command expects */
-	} ENGINE_CMD_DEFN;
+    {
+    unsigned int cmd_num; /* The command number */
+    const char *cmd_name; /* The command name itself */
+    const char *cmd_desc; /* A short description of the command */
+    unsigned int cmd_flags; /* The input the command expects */
+    } ENGINE_CMD_DEFN;
 
 /* Generic function pointer */
 typedef int (*ENGINE_GEN_FUNC_PTR)(void);
@@ -277,7 +277,7 @@ typedef int (*ENGINE_GEN_INT_FUNC_PTR)(ENGINE *);
 typedef int (*ENGINE_CTRL_FUNC_PTR)(ENGINE *, int, long, void *, void (*f)(void));
 /* Generic load_key function pointer */
 typedef EVP_PKEY * (*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *,
-	UI_METHOD *ui_method, void *callback_data);
+    UI_METHOD *ui_method, void *callback_data);
 /* These callback types are for an ENGINE's handler for cipher and digest logic.
  * These handlers have these prototypes;
  *   int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid);
@@ -433,7 +433,7 @@ int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name,
  * compliant ENGINE-based applications can work consistently with the same
  * configuration for the same ENGINE-enabled devices, across applications. */
 int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg,
-				int cmd_optional);
+                int cmd_optional);
 
 /* These functions are useful for manufacturing new ENGINE structures. They
  * don't address reference counting at all - one uses them to populate an ENGINE
@@ -465,7 +465,7 @@ int ENGINE_set_flags(ENGINE *e, int flags);
 int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns);
 /* These functions allow control over any per-structure ENGINE data. */
 int ENGINE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
-		CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+        CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
 int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg);
 void *ENGINE_get_ex_data(const ENGINE *e, int idx);
 
@@ -526,9 +526,9 @@ int ENGINE_finish(ENGINE *e);
  * location, handled by the engine.  The storage may be on a card or
  * whatever. */
 EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id,
-	UI_METHOD *ui_method, void *callback_data);
+    UI_METHOD *ui_method, void *callback_data);
 EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id,
-	UI_METHOD *ui_method, void *callback_data);
+    UI_METHOD *ui_method, void *callback_data);
 
 /* This returns a pointer for the current ENGINE structure that
  * is (by default) performing any RSA operations. The value returned
@@ -578,10 +578,10 @@ void ENGINE_add_conf_module(void);
 /**************************/
 
 /* Binary/behaviour compatibility levels */
-#define OSSL_DYNAMIC_VERSION		(unsigned long)0x00020000
+#define OSSL_DYNAMIC_VERSION        (unsigned long)0x00020000
 /* Binary versions older than this are too old for us (whether we're a loader or
  * a loadee) */
-#define OSSL_DYNAMIC_OLDEST		(unsigned long)0x00020000
+#define OSSL_DYNAMIC_OLDEST     (unsigned long)0x00020000
 
 /* When compiling an ENGINE entirely as an external shared library, loadable by
  * the "dynamic" ENGINE, these types are needed. The 'dynamic_fns' structure
@@ -596,35 +596,35 @@ typedef void *(*dyn_MEM_malloc_cb)(size_t);
 typedef void *(*dyn_MEM_realloc_cb)(void *, size_t);
 typedef void (*dyn_MEM_free_cb)(void *);
 typedef struct st_dynamic_MEM_fns {
-	dyn_MEM_malloc_cb			malloc_cb;
-	dyn_MEM_realloc_cb			realloc_cb;
-	dyn_MEM_free_cb				free_cb;
-	} dynamic_MEM_fns;
+    dyn_MEM_malloc_cb           malloc_cb;
+    dyn_MEM_realloc_cb          realloc_cb;
+    dyn_MEM_free_cb             free_cb;
+    } dynamic_MEM_fns;
 /* FIXME: Perhaps the memory and locking code (crypto.h) should declare and use
  * these types so we (and any other dependant code) can simplify a bit?? */
 typedef void (*dyn_lock_locking_cb)(int,int,const char *,int);
 typedef int (*dyn_lock_add_lock_cb)(int*,int,int,const char *,int);
 typedef struct CRYPTO_dynlock_value *(*dyn_dynlock_create_cb)(
-						const char *,int);
+                        const char *,int);
 typedef void (*dyn_dynlock_lock_cb)(int,struct CRYPTO_dynlock_value *,
-						const char *,int);
+                        const char *,int);
 typedef void (*dyn_dynlock_destroy_cb)(struct CRYPTO_dynlock_value *,
-						const char *,int);
+                        const char *,int);
 typedef struct st_dynamic_LOCK_fns {
-	dyn_lock_locking_cb			lock_locking_cb;
-	dyn_lock_add_lock_cb			lock_add_lock_cb;
-	dyn_dynlock_create_cb			dynlock_create_cb;
-	dyn_dynlock_lock_cb			dynlock_lock_cb;
-	dyn_dynlock_destroy_cb			dynlock_destroy_cb;
-	} dynamic_LOCK_fns;
+    dyn_lock_locking_cb         lock_locking_cb;
+    dyn_lock_add_lock_cb            lock_add_lock_cb;
+    dyn_dynlock_create_cb           dynlock_create_cb;
+    dyn_dynlock_lock_cb         dynlock_lock_cb;
+    dyn_dynlock_destroy_cb          dynlock_destroy_cb;
+    } dynamic_LOCK_fns;
 /* The top-level structure */
 typedef struct st_dynamic_fns {
-	void 					*static_state;
-	const ERR_FNS				*err_fns;
-	const CRYPTO_EX_DATA_IMPL		*ex_data_fns;
-	dynamic_MEM_fns				mem_fns;
-	dynamic_LOCK_fns			lock_fns;
-	} dynamic_fns;
+    void                    *static_state;
+    const ERR_FNS               *err_fns;
+    const CRYPTO_EX_DATA_IMPL       *ex_data_fns;
+    dynamic_MEM_fns             mem_fns;
+    dynamic_LOCK_fns            lock_fns;
+    } dynamic_fns;
 
 /* The version checking function should be of this prototype. NB: The
  * ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading code.
@@ -637,9 +637,9 @@ typedef struct st_dynamic_fns {
  * can be fully instantiated with IMPLEMENT_DYNAMIC_CHECK_FN(). */
 typedef unsigned long (*dynamic_v_check_fn)(unsigned long ossl_version);
 #define IMPLEMENT_DYNAMIC_CHECK_FN() \
-	OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \
-		if(v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \
-		return 0; }
+    OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \
+        if(v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \
+        return 0; }
 
 /* This function is passed the ENGINE structure to initialise with its own
  * function and command settings. It should not adjust the structural or
@@ -657,25 +657,25 @@ typedef unsigned long (*dynamic_v_check_fn)(unsigned long ossl_version);
  * and returns an int value (zero for failure). 'fn' should have prototype;
  *    [static] int fn(ENGINE *e, const char *id); */
 typedef int (*dynamic_bind_engine)(ENGINE *e, const char *id,
-				const dynamic_fns *fns);
+                const dynamic_fns *fns);
 #define IMPLEMENT_DYNAMIC_BIND_FN(fn) \
-	OPENSSL_EXPORT \
-	int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \
-		if(ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \
-		if(!CRYPTO_set_mem_functions(fns->mem_fns.malloc_cb, \
-			fns->mem_fns.realloc_cb, fns->mem_fns.free_cb)) \
-			return 0; \
-		CRYPTO_set_locking_callback(fns->lock_fns.lock_locking_cb); \
-		CRYPTO_set_add_lock_callback(fns->lock_fns.lock_add_lock_cb); \
-		CRYPTO_set_dynlock_create_callback(fns->lock_fns.dynlock_create_cb); \
-		CRYPTO_set_dynlock_lock_callback(fns->lock_fns.dynlock_lock_cb); \
-		CRYPTO_set_dynlock_destroy_callback(fns->lock_fns.dynlock_destroy_cb); \
-		if(!CRYPTO_set_ex_data_implementation(fns->ex_data_fns)) \
-			return 0; \
-		if(!ERR_set_implementation(fns->err_fns)) return 0; \
-	skip_cbs: \
-		if(!fn(e,id)) return 0; \
-		return 1; }
+    OPENSSL_EXPORT \
+    int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \
+        if(ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \
+        if(!CRYPTO_set_mem_functions(fns->mem_fns.malloc_cb, \
+            fns->mem_fns.realloc_cb, fns->mem_fns.free_cb)) \
+            return 0; \
+        CRYPTO_set_locking_callback(fns->lock_fns.lock_locking_cb); \
+        CRYPTO_set_add_lock_callback(fns->lock_fns.lock_add_lock_cb); \
+        CRYPTO_set_dynlock_create_callback(fns->lock_fns.dynlock_create_cb); \
+        CRYPTO_set_dynlock_lock_callback(fns->lock_fns.dynlock_lock_cb); \
+        CRYPTO_set_dynlock_destroy_callback(fns->lock_fns.dynlock_destroy_cb); \
+        if(!CRYPTO_set_ex_data_implementation(fns->ex_data_fns)) \
+            return 0; \
+        if(!ERR_set_implementation(fns->err_fns)) return 0; \
+    skip_cbs: \
+        if(!fn(e,id)) return 0; \
+        return 1; }
 
 /* If the loading application (or library) and the loaded ENGINE library share
  * the same static data (eg. they're both dynamically linked to the same
@@ -701,83 +701,83 @@ void ERR_load_ENGINE_strings(void);
 /* Error codes for the ENGINE functions. */
 
 /* Function codes. */
-#define ENGINE_F_DYNAMIC_CTRL				 180
-#define ENGINE_F_DYNAMIC_GET_DATA_CTX			 181
-#define ENGINE_F_DYNAMIC_LOAD				 182
-#define ENGINE_F_DYNAMIC_SET_DATA_CTX			 183
-#define ENGINE_F_ENGINE_ADD				 105
-#define ENGINE_F_ENGINE_BY_ID				 106
-#define ENGINE_F_ENGINE_CMD_IS_EXECUTABLE		 170
-#define ENGINE_F_ENGINE_CTRL				 142
-#define ENGINE_F_ENGINE_CTRL_CMD			 178
-#define ENGINE_F_ENGINE_CTRL_CMD_STRING			 171
-#define ENGINE_F_ENGINE_FINISH				 107
-#define ENGINE_F_ENGINE_FREE_UTIL			 108
-#define ENGINE_F_ENGINE_GET_CIPHER			 185
-#define ENGINE_F_ENGINE_GET_DEFAULT_TYPE		 177
-#define ENGINE_F_ENGINE_GET_DIGEST			 186
-#define ENGINE_F_ENGINE_GET_NEXT			 115
-#define ENGINE_F_ENGINE_GET_PREV			 116
-#define ENGINE_F_ENGINE_INIT				 119
-#define ENGINE_F_ENGINE_LIST_ADD			 120
-#define ENGINE_F_ENGINE_LIST_REMOVE			 121
-#define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY		 150
-#define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY			 151
-#define ENGINE_F_ENGINE_NEW				 122
-#define ENGINE_F_ENGINE_REMOVE				 123
-#define ENGINE_F_ENGINE_SET_DEFAULT_STRING		 189
-#define ENGINE_F_ENGINE_SET_DEFAULT_TYPE		 126
-#define ENGINE_F_ENGINE_SET_ID				 129
-#define ENGINE_F_ENGINE_SET_NAME			 130
-#define ENGINE_F_ENGINE_TABLE_REGISTER			 184
-#define ENGINE_F_ENGINE_UNLOAD_KEY			 152
-#define ENGINE_F_ENGINE_UNLOCKED_FINISH			 191
-#define ENGINE_F_ENGINE_UP_REF				 190
-#define ENGINE_F_INT_CTRL_HELPER			 172
-#define ENGINE_F_INT_ENGINE_CONFIGURE			 188
-#define ENGINE_F_INT_ENGINE_MODULE_INIT			 187
-#define ENGINE_F_LOG_MESSAGE				 141
+#define ENGINE_F_DYNAMIC_CTRL                180
+#define ENGINE_F_DYNAMIC_GET_DATA_CTX            181
+#define ENGINE_F_DYNAMIC_LOAD                182
+#define ENGINE_F_DYNAMIC_SET_DATA_CTX            183
+#define ENGINE_F_ENGINE_ADD              105
+#define ENGINE_F_ENGINE_BY_ID                106
+#define ENGINE_F_ENGINE_CMD_IS_EXECUTABLE        170
+#define ENGINE_F_ENGINE_CTRL                 142
+#define ENGINE_F_ENGINE_CTRL_CMD             178
+#define ENGINE_F_ENGINE_CTRL_CMD_STRING          171
+#define ENGINE_F_ENGINE_FINISH               107
+#define ENGINE_F_ENGINE_FREE_UTIL            108
+#define ENGINE_F_ENGINE_GET_CIPHER           185
+#define ENGINE_F_ENGINE_GET_DEFAULT_TYPE         177
+#define ENGINE_F_ENGINE_GET_DIGEST           186
+#define ENGINE_F_ENGINE_GET_NEXT             115
+#define ENGINE_F_ENGINE_GET_PREV             116
+#define ENGINE_F_ENGINE_INIT                 119
+#define ENGINE_F_ENGINE_LIST_ADD             120
+#define ENGINE_F_ENGINE_LIST_REMOVE          121
+#define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY         150
+#define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY          151
+#define ENGINE_F_ENGINE_NEW              122
+#define ENGINE_F_ENGINE_REMOVE               123
+#define ENGINE_F_ENGINE_SET_DEFAULT_STRING       189
+#define ENGINE_F_ENGINE_SET_DEFAULT_TYPE         126
+#define ENGINE_F_ENGINE_SET_ID               129
+#define ENGINE_F_ENGINE_SET_NAME             130
+#define ENGINE_F_ENGINE_TABLE_REGISTER           184
+#define ENGINE_F_ENGINE_UNLOAD_KEY           152
+#define ENGINE_F_ENGINE_UNLOCKED_FINISH          191
+#define ENGINE_F_ENGINE_UP_REF               190
+#define ENGINE_F_INT_CTRL_HELPER             172
+#define ENGINE_F_INT_ENGINE_CONFIGURE            188
+#define ENGINE_F_INT_ENGINE_MODULE_INIT          187
+#define ENGINE_F_LOG_MESSAGE                 141
 
 /* Reason codes. */
-#define ENGINE_R_ALREADY_LOADED				 100
-#define ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER		 133
-#define ENGINE_R_CMD_NOT_EXECUTABLE			 134
-#define ENGINE_R_COMMAND_TAKES_INPUT			 135
-#define ENGINE_R_COMMAND_TAKES_NO_INPUT			 136
-#define ENGINE_R_CONFLICTING_ENGINE_ID			 103
-#define ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED		 119
-#define ENGINE_R_DH_NOT_IMPLEMENTED			 139
-#define ENGINE_R_DSA_NOT_IMPLEMENTED			 140
-#define ENGINE_R_DSO_FAILURE				 104
-#define ENGINE_R_DSO_NOT_FOUND				 132
-#define ENGINE_R_ENGINES_SECTION_ERROR			 148
-#define ENGINE_R_ENGINE_IS_NOT_IN_LIST			 105
-#define ENGINE_R_ENGINE_SECTION_ERROR			 149
-#define ENGINE_R_FAILED_LOADING_PRIVATE_KEY		 128
-#define ENGINE_R_FAILED_LOADING_PUBLIC_KEY		 129
-#define ENGINE_R_FINISH_FAILED				 106
-#define ENGINE_R_GET_HANDLE_FAILED			 107
-#define ENGINE_R_ID_OR_NAME_MISSING			 108
-#define ENGINE_R_INIT_FAILED				 109
-#define ENGINE_R_INTERNAL_LIST_ERROR			 110
-#define ENGINE_R_INVALID_ARGUMENT			 143
-#define ENGINE_R_INVALID_CMD_NAME			 137
-#define ENGINE_R_INVALID_CMD_NUMBER			 138
-#define ENGINE_R_INVALID_INIT_VALUE			 151
-#define ENGINE_R_INVALID_STRING				 150
-#define ENGINE_R_NOT_INITIALISED			 117
-#define ENGINE_R_NOT_LOADED				 112
-#define ENGINE_R_NO_CONTROL_FUNCTION			 120
-#define ENGINE_R_NO_INDEX				 144
-#define ENGINE_R_NO_LOAD_FUNCTION			 125
-#define ENGINE_R_NO_REFERENCE				 130
-#define ENGINE_R_NO_SUCH_ENGINE				 116
-#define ENGINE_R_NO_UNLOAD_FUNCTION			 126
-#define ENGINE_R_PROVIDE_PARAMETERS			 113
-#define ENGINE_R_RSA_NOT_IMPLEMENTED			 141
-#define ENGINE_R_UNIMPLEMENTED_CIPHER			 146
-#define ENGINE_R_UNIMPLEMENTED_DIGEST			 147
-#define ENGINE_R_VERSION_INCOMPATIBILITY		 145
+#define ENGINE_R_ALREADY_LOADED              100
+#define ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER        133
+#define ENGINE_R_CMD_NOT_EXECUTABLE          134
+#define ENGINE_R_COMMAND_TAKES_INPUT             135
+#define ENGINE_R_COMMAND_TAKES_NO_INPUT          136
+#define ENGINE_R_CONFLICTING_ENGINE_ID           103
+#define ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED        119
+#define ENGINE_R_DH_NOT_IMPLEMENTED          139
+#define ENGINE_R_DSA_NOT_IMPLEMENTED             140
+#define ENGINE_R_DSO_FAILURE                 104
+#define ENGINE_R_DSO_NOT_FOUND               132
+#define ENGINE_R_ENGINES_SECTION_ERROR           148
+#define ENGINE_R_ENGINE_IS_NOT_IN_LIST           105
+#define ENGINE_R_ENGINE_SECTION_ERROR            149
+#define ENGINE_R_FAILED_LOADING_PRIVATE_KEY      128
+#define ENGINE_R_FAILED_LOADING_PUBLIC_KEY       129
+#define ENGINE_R_FINISH_FAILED               106
+#define ENGINE_R_GET_HANDLE_FAILED           107
+#define ENGINE_R_ID_OR_NAME_MISSING          108
+#define ENGINE_R_INIT_FAILED                 109
+#define ENGINE_R_INTERNAL_LIST_ERROR             110
+#define ENGINE_R_INVALID_ARGUMENT            143
+#define ENGINE_R_INVALID_CMD_NAME            137
+#define ENGINE_R_INVALID_CMD_NUMBER          138
+#define ENGINE_R_INVALID_INIT_VALUE          151
+#define ENGINE_R_INVALID_STRING              150
+#define ENGINE_R_NOT_INITIALISED             117
+#define ENGINE_R_NOT_LOADED              112
+#define ENGINE_R_NO_CONTROL_FUNCTION             120
+#define ENGINE_R_NO_INDEX                144
+#define ENGINE_R_NO_LOAD_FUNCTION            125
+#define ENGINE_R_NO_REFERENCE                130
+#define ENGINE_R_NO_SUCH_ENGINE              116
+#define ENGINE_R_NO_UNLOAD_FUNCTION          126
+#define ENGINE_R_PROVIDE_PARAMETERS          113
+#define ENGINE_R_RSA_NOT_IMPLEMENTED             141
+#define ENGINE_R_UNIMPLEMENTED_CIPHER            146
+#define ENGINE_R_UNIMPLEMENTED_DIGEST            147
+#define ENGINE_R_VERSION_INCOMPATIBILITY         145
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/err.h b/dep/include/openssl/err.h
index b723cd977a4..b52d92cf7a1 100644
--- a/dep/include/openssl/err.h
+++ b/dep/include/openssl/err.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -74,74 +74,74 @@
 #include 
 #endif
 
-#ifdef	__cplusplus
+#ifdef  __cplusplus
 extern "C" {
 #endif
 
 #ifndef OPENSSL_NO_ERR
-#define ERR_PUT_error(a,b,c,d,e)	ERR_put_error(a,b,c,d,e)
+#define ERR_PUT_error(a,b,c,d,e)    ERR_put_error(a,b,c,d,e)
 #else
-#define ERR_PUT_error(a,b,c,d,e)	ERR_put_error(a,b,c,NULL,0)
+#define ERR_PUT_error(a,b,c,d,e)    ERR_put_error(a,b,c,NULL,0)
 #endif
 
 #include 
 
-#define ERR_TXT_MALLOCED	0x01
-#define ERR_TXT_STRING		0x02
+#define ERR_TXT_MALLOCED    0x01
+#define ERR_TXT_STRING      0x02
 
-#define ERR_FLAG_MARK		0x01
+#define ERR_FLAG_MARK       0x01
 
-#define ERR_NUM_ERRORS	16
+#define ERR_NUM_ERRORS  16
 typedef struct err_state_st
-	{
-	unsigned long pid;
-	int err_flags[ERR_NUM_ERRORS];
-	unsigned long err_buffer[ERR_NUM_ERRORS];
-	char *err_data[ERR_NUM_ERRORS];
-	int err_data_flags[ERR_NUM_ERRORS];
-	const char *err_file[ERR_NUM_ERRORS];
-	int err_line[ERR_NUM_ERRORS];
-	int top,bottom;
-	} ERR_STATE;
+    {
+    unsigned long pid;
+    int err_flags[ERR_NUM_ERRORS];
+    unsigned long err_buffer[ERR_NUM_ERRORS];
+    char *err_data[ERR_NUM_ERRORS];
+    int err_data_flags[ERR_NUM_ERRORS];
+    const char *err_file[ERR_NUM_ERRORS];
+    int err_line[ERR_NUM_ERRORS];
+    int top,bottom;
+    } ERR_STATE;
 
 /* library */
-#define ERR_LIB_NONE		1
-#define ERR_LIB_SYS		2
-#define ERR_LIB_BN		3
-#define ERR_LIB_RSA		4
-#define ERR_LIB_DH		5
-#define ERR_LIB_EVP		6
-#define ERR_LIB_BUF		7
-#define ERR_LIB_OBJ		8
-#define ERR_LIB_PEM		9
-#define ERR_LIB_DSA		10
-#define ERR_LIB_X509		11
+#define ERR_LIB_NONE        1
+#define ERR_LIB_SYS     2
+#define ERR_LIB_BN      3
+#define ERR_LIB_RSA     4
+#define ERR_LIB_DH      5
+#define ERR_LIB_EVP     6
+#define ERR_LIB_BUF     7
+#define ERR_LIB_OBJ     8
+#define ERR_LIB_PEM     9
+#define ERR_LIB_DSA     10
+#define ERR_LIB_X509        11
 /* #define ERR_LIB_METH         12 */
-#define ERR_LIB_ASN1		13
-#define ERR_LIB_CONF		14
-#define ERR_LIB_CRYPTO		15
-#define ERR_LIB_EC		16
-#define ERR_LIB_SSL		20
+#define ERR_LIB_ASN1        13
+#define ERR_LIB_CONF        14
+#define ERR_LIB_CRYPTO      15
+#define ERR_LIB_EC      16
+#define ERR_LIB_SSL     20
 /* #define ERR_LIB_SSL23        21 */
 /* #define ERR_LIB_SSL2         22 */
 /* #define ERR_LIB_SSL3         23 */
 /* #define ERR_LIB_RSAREF       30 */
 /* #define ERR_LIB_PROXY        31 */
-#define ERR_LIB_BIO		32
-#define ERR_LIB_PKCS7		33
-#define ERR_LIB_X509V3		34
-#define ERR_LIB_PKCS12		35
-#define ERR_LIB_RAND		36
-#define ERR_LIB_DSO		37
-#define ERR_LIB_ENGINE		38
+#define ERR_LIB_BIO     32
+#define ERR_LIB_PKCS7       33
+#define ERR_LIB_X509V3      34
+#define ERR_LIB_PKCS12      35
+#define ERR_LIB_RAND        36
+#define ERR_LIB_DSO     37
+#define ERR_LIB_ENGINE      38
 #define ERR_LIB_OCSP            39
 #define ERR_LIB_UI              40
 #define ERR_LIB_COMP            41
-#define ERR_LIB_ECDSA		42
-#define ERR_LIB_ECDH		43
+#define ERR_LIB_ECDSA       42
+#define ERR_LIB_ECDH        43
 #define ERR_LIB_STORE           44
 
-#define ERR_LIB_USER		128
+#define ERR_LIB_USER        128
 
 #define SYSerr(f,r)  ERR_PUT_error(ERR_LIB_SYS,(f),(r),__FILE__,__LINE__)
 #define BNerr(f,r)   ERR_PUT_error(ERR_LIB_BN,(f),(r),__FILE__,__LINE__)
@@ -174,83 +174,83 @@ typedef struct err_state_st
 
 /* Borland C seems too stupid to be able to shift and do longs in
  * the pre-processor :-( */
-#define ERR_PACK(l,f,r)		(((((unsigned long)l)&0xffL)*0x1000000)| \
-				((((unsigned long)f)&0xfffL)*0x1000)| \
-				((((unsigned long)r)&0xfffL)))
-#define ERR_GET_LIB(l)		(int)((((unsigned long)l)>>24L)&0xffL)
-#define ERR_GET_FUNC(l)		(int)((((unsigned long)l)>>12L)&0xfffL)
-#define ERR_GET_REASON(l)	(int)((l)&0xfffL)
-#define ERR_FATAL_ERROR(l)	(int)((l)&ERR_R_FATAL)
+#define ERR_PACK(l,f,r)     (((((unsigned long)l)&0xffL)*0x1000000)| \
+                ((((unsigned long)f)&0xfffL)*0x1000)| \
+                ((((unsigned long)r)&0xfffL)))
+#define ERR_GET_LIB(l)      (int)((((unsigned long)l)>>24L)&0xffL)
+#define ERR_GET_FUNC(l)     (int)((((unsigned long)l)>>12L)&0xfffL)
+#define ERR_GET_REASON(l)   (int)((l)&0xfffL)
+#define ERR_FATAL_ERROR(l)  (int)((l)&ERR_R_FATAL)
 
 
 /* OS functions */
-#define SYS_F_FOPEN		1
-#define SYS_F_CONNECT		2
-#define SYS_F_GETSERVBYNAME	3
-#define SYS_F_SOCKET		4
-#define SYS_F_IOCTLSOCKET	5
-#define SYS_F_BIND		6
-#define SYS_F_LISTEN		7
-#define SYS_F_ACCEPT		8
-#define SYS_F_WSASTARTUP	9 /* Winsock stuff */
-#define SYS_F_OPENDIR		10
-#define SYS_F_FREAD		11
+#define SYS_F_FOPEN     1
+#define SYS_F_CONNECT       2
+#define SYS_F_GETSERVBYNAME 3
+#define SYS_F_SOCKET        4
+#define SYS_F_IOCTLSOCKET   5
+#define SYS_F_BIND      6
+#define SYS_F_LISTEN        7
+#define SYS_F_ACCEPT        8
+#define SYS_F_WSASTARTUP    9 /* Winsock stuff */
+#define SYS_F_OPENDIR       10
+#define SYS_F_FREAD     11
 
 
 /* reasons */
-#define ERR_R_SYS_LIB	ERR_LIB_SYS       /* 2 */
-#define ERR_R_BN_LIB	ERR_LIB_BN        /* 3 */
-#define ERR_R_RSA_LIB	ERR_LIB_RSA       /* 4 */
-#define ERR_R_DH_LIB	ERR_LIB_DH        /* 5 */
-#define ERR_R_EVP_LIB	ERR_LIB_EVP       /* 6 */
-#define ERR_R_BUF_LIB	ERR_LIB_BUF       /* 7 */
-#define ERR_R_OBJ_LIB	ERR_LIB_OBJ       /* 8 */
-#define ERR_R_PEM_LIB	ERR_LIB_PEM       /* 9 */
-#define ERR_R_DSA_LIB	ERR_LIB_DSA      /* 10 */
-#define ERR_R_X509_LIB	ERR_LIB_X509     /* 11 */
-#define ERR_R_ASN1_LIB	ERR_LIB_ASN1     /* 13 */
-#define ERR_R_CONF_LIB	ERR_LIB_CONF     /* 14 */
+#define ERR_R_SYS_LIB   ERR_LIB_SYS       /* 2 */
+#define ERR_R_BN_LIB    ERR_LIB_BN        /* 3 */
+#define ERR_R_RSA_LIB   ERR_LIB_RSA       /* 4 */
+#define ERR_R_DH_LIB    ERR_LIB_DH        /* 5 */
+#define ERR_R_EVP_LIB   ERR_LIB_EVP       /* 6 */
+#define ERR_R_BUF_LIB   ERR_LIB_BUF       /* 7 */
+#define ERR_R_OBJ_LIB   ERR_LIB_OBJ       /* 8 */
+#define ERR_R_PEM_LIB   ERR_LIB_PEM       /* 9 */
+#define ERR_R_DSA_LIB   ERR_LIB_DSA      /* 10 */
+#define ERR_R_X509_LIB  ERR_LIB_X509     /* 11 */
+#define ERR_R_ASN1_LIB  ERR_LIB_ASN1     /* 13 */
+#define ERR_R_CONF_LIB  ERR_LIB_CONF     /* 14 */
 #define ERR_R_CRYPTO_LIB ERR_LIB_CRYPTO  /* 15 */
-#define ERR_R_EC_LIB	ERR_LIB_EC       /* 16 */
-#define ERR_R_SSL_LIB	ERR_LIB_SSL      /* 20 */
-#define ERR_R_BIO_LIB	ERR_LIB_BIO      /* 32 */
-#define ERR_R_PKCS7_LIB	ERR_LIB_PKCS7    /* 33 */
+#define ERR_R_EC_LIB    ERR_LIB_EC       /* 16 */
+#define ERR_R_SSL_LIB   ERR_LIB_SSL      /* 20 */
+#define ERR_R_BIO_LIB   ERR_LIB_BIO      /* 32 */
+#define ERR_R_PKCS7_LIB ERR_LIB_PKCS7    /* 33 */
 #define ERR_R_X509V3_LIB ERR_LIB_X509V3  /* 34 */
 #define ERR_R_PKCS12_LIB ERR_LIB_PKCS12  /* 35 */
-#define ERR_R_RAND_LIB	ERR_LIB_RAND     /* 36 */
-#define ERR_R_DSO_LIB	ERR_LIB_DSO      /* 37 */
+#define ERR_R_RAND_LIB  ERR_LIB_RAND     /* 36 */
+#define ERR_R_DSO_LIB   ERR_LIB_DSO      /* 37 */
 #define ERR_R_ENGINE_LIB ERR_LIB_ENGINE  /* 38 */
 #define ERR_R_OCSP_LIB  ERR_LIB_OCSP     /* 39 */
 #define ERR_R_UI_LIB    ERR_LIB_UI       /* 40 */
-#define ERR_R_COMP_LIB	ERR_LIB_COMP     /* 41 */
-#define ERR_R_ECDSA_LIB ERR_LIB_ECDSA	 /* 42 */
-#define ERR_R_ECDH_LIB  ERR_LIB_ECDH	 /* 43 */
+#define ERR_R_COMP_LIB  ERR_LIB_COMP     /* 41 */
+#define ERR_R_ECDSA_LIB ERR_LIB_ECDSA    /* 42 */
+#define ERR_R_ECDH_LIB  ERR_LIB_ECDH     /* 43 */
 #define ERR_R_STORE_LIB ERR_LIB_STORE    /* 44 */
 
-#define ERR_R_NESTED_ASN1_ERROR			58
-#define ERR_R_BAD_ASN1_OBJECT_HEADER		59
-#define ERR_R_BAD_GET_ASN1_OBJECT_CALL		60
-#define ERR_R_EXPECTING_AN_ASN1_SEQUENCE	61
-#define ERR_R_ASN1_LENGTH_MISMATCH		62
-#define ERR_R_MISSING_ASN1_EOS			63
+#define ERR_R_NESTED_ASN1_ERROR         58
+#define ERR_R_BAD_ASN1_OBJECT_HEADER        59
+#define ERR_R_BAD_GET_ASN1_OBJECT_CALL      60
+#define ERR_R_EXPECTING_AN_ASN1_SEQUENCE    61
+#define ERR_R_ASN1_LENGTH_MISMATCH      62
+#define ERR_R_MISSING_ASN1_EOS          63
 
 /* fatal error */
-#define ERR_R_FATAL				64
-#define	ERR_R_MALLOC_FAILURE			(1|ERR_R_FATAL)
-#define	ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED	(2|ERR_R_FATAL)
-#define	ERR_R_PASSED_NULL_PARAMETER		(3|ERR_R_FATAL)
-#define	ERR_R_INTERNAL_ERROR			(4|ERR_R_FATAL)
-#define	ERR_R_DISABLED				(5|ERR_R_FATAL)
+#define ERR_R_FATAL             64
+#define ERR_R_MALLOC_FAILURE            (1|ERR_R_FATAL)
+#define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED   (2|ERR_R_FATAL)
+#define ERR_R_PASSED_NULL_PARAMETER     (3|ERR_R_FATAL)
+#define ERR_R_INTERNAL_ERROR            (4|ERR_R_FATAL)
+#define ERR_R_DISABLED              (5|ERR_R_FATAL)
 
 /* 99 is the maximum possible ERR_R_... code, higher values
  * are reserved for the individual libraries */
 
 
 typedef struct ERR_string_data_st
-	{
-	unsigned long error;
-	const char *string;
-	} ERR_STRING_DATA;
+    {
+    unsigned long error;
+    const char *string;
+    } ERR_STRING_DATA;
 
 void ERR_put_error(int lib, int func,int reason,const char *file,int line);
 void ERR_set_error_data(char *data,int flags);
@@ -258,15 +258,15 @@ void ERR_set_error_data(char *data,int flags);
 unsigned long ERR_get_error(void);
 unsigned long ERR_get_error_line(const char **file,int *line);
 unsigned long ERR_get_error_line_data(const char **file,int *line,
-				      const char **data, int *flags);
+                      const char **data, int *flags);
 unsigned long ERR_peek_error(void);
 unsigned long ERR_peek_error_line(const char **file,int *line);
 unsigned long ERR_peek_error_line_data(const char **file,int *line,
-				       const char **data,int *flags);
+                       const char **data,int *flags);
 unsigned long ERR_peek_last_error(void);
 unsigned long ERR_peek_last_error_line(const char **file,int *line);
 unsigned long ERR_peek_last_error_line_data(const char **file,int *line,
-				       const char **data,int *flags);
+                       const char **data,int *flags);
 void ERR_clear_error(void );
 char *ERR_error_string(unsigned long e,char *buf);
 void ERR_error_string_n(unsigned long e, char *buf, size_t len);
@@ -274,7 +274,7 @@ const char *ERR_lib_error_string(unsigned long e);
 const char *ERR_func_error_string(unsigned long e);
 const char *ERR_reason_error_string(unsigned long e);
 void ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u),
-			 void *u);
+             void *u);
 #ifndef OPENSSL_NO_FP_API
 void ERR_print_errors_fp(FILE *fp);
 #endif
@@ -311,7 +311,7 @@ const ERR_FNS *ERR_get_implementation(void);
  * the application's "ERR_FNS". */
 int ERR_set_implementation(const ERR_FNS *fns);
 
-#ifdef	__cplusplus
+#ifdef  __cplusplus
 }
 #endif
 
diff --git a/dep/include/openssl/evp.h b/dep/include/openssl/evp.h
index 636f426c699..a0f3a0e2f86 100644
--- a/dep/include/openssl/evp.h
+++ b/dep/include/openssl/evp.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -76,47 +76,47 @@
 #endif
 
 /*
-#define EVP_RC2_KEY_SIZE		16
-#define EVP_RC4_KEY_SIZE		16
-#define EVP_BLOWFISH_KEY_SIZE		16
-#define EVP_CAST5_KEY_SIZE		16
-#define EVP_RC5_32_12_16_KEY_SIZE	16
+#define EVP_RC2_KEY_SIZE        16
+#define EVP_RC4_KEY_SIZE        16
+#define EVP_BLOWFISH_KEY_SIZE       16
+#define EVP_CAST5_KEY_SIZE      16
+#define EVP_RC5_32_12_16_KEY_SIZE   16
 */
-#define EVP_MAX_MD_SIZE			64	/* longest known is SHA512 */
-#define EVP_MAX_KEY_LENGTH		32
-#define EVP_MAX_IV_LENGTH		16
-#define EVP_MAX_BLOCK_LENGTH		32
+#define EVP_MAX_MD_SIZE         64  /* longest known is SHA512 */
+#define EVP_MAX_KEY_LENGTH      32
+#define EVP_MAX_IV_LENGTH       16
+#define EVP_MAX_BLOCK_LENGTH        32
 
-#define PKCS5_SALT_LEN			8
+#define PKCS5_SALT_LEN          8
 /* Default PKCS#5 iteration count */
-#define PKCS5_DEFAULT_ITER		2048
+#define PKCS5_DEFAULT_ITER      2048
 
 #include 
 
-#define EVP_PK_RSA	0x0001
-#define EVP_PK_DSA	0x0002
-#define EVP_PK_DH	0x0004
-#define EVP_PK_EC	0x0008
-#define EVP_PKT_SIGN	0x0010
-#define EVP_PKT_ENC	0x0020
-#define EVP_PKT_EXCH	0x0040
-#define EVP_PKS_RSA	0x0100
-#define EVP_PKS_DSA	0x0200
-#define EVP_PKS_EC	0x0400
-#define EVP_PKT_EXP	0x1000 /* <= 512 bit key */
+#define EVP_PK_RSA  0x0001
+#define EVP_PK_DSA  0x0002
+#define EVP_PK_DH   0x0004
+#define EVP_PK_EC   0x0008
+#define EVP_PKT_SIGN    0x0010
+#define EVP_PKT_ENC 0x0020
+#define EVP_PKT_EXCH    0x0040
+#define EVP_PKS_RSA 0x0100
+#define EVP_PKS_DSA 0x0200
+#define EVP_PKS_EC  0x0400
+#define EVP_PKT_EXP 0x1000 /* <= 512 bit key */
 
-#define EVP_PKEY_NONE	NID_undef
-#define EVP_PKEY_RSA	NID_rsaEncryption
-#define EVP_PKEY_RSA2	NID_rsa
-#define EVP_PKEY_DSA	NID_dsa
-#define EVP_PKEY_DSA1	NID_dsa_2
-#define EVP_PKEY_DSA2	NID_dsaWithSHA
-#define EVP_PKEY_DSA3	NID_dsaWithSHA1
-#define EVP_PKEY_DSA4	NID_dsaWithSHA1_2
-#define EVP_PKEY_DH	NID_dhKeyAgreement
-#define EVP_PKEY_EC	NID_X9_62_id_ecPublicKey
+#define EVP_PKEY_NONE   NID_undef
+#define EVP_PKEY_RSA    NID_rsaEncryption
+#define EVP_PKEY_RSA2   NID_rsa
+#define EVP_PKEY_DSA    NID_dsa
+#define EVP_PKEY_DSA1   NID_dsa_2
+#define EVP_PKEY_DSA2   NID_dsaWithSHA
+#define EVP_PKEY_DSA3   NID_dsaWithSHA1
+#define EVP_PKEY_DSA4   NID_dsaWithSHA1_2
+#define EVP_PKEY_DH NID_dhKeyAgreement
+#define EVP_PKEY_EC NID_X9_62_id_ecPublicKey
 
-#ifdef	__cplusplus
+#ifdef  __cplusplus
 extern "C" {
 #endif
 
@@ -124,33 +124,33 @@ extern "C" {
  * Sub-type needs to be for variations on the method, as in, can it do
  * arbitrary encryption.... */
 struct evp_pkey_st
-	{
-	int type;
-	int save_type;
-	int references;
-	union	{
-		char *ptr;
+    {
+    int type;
+    int save_type;
+    int references;
+    union   {
+        char *ptr;
 #ifndef OPENSSL_NO_RSA
-		struct rsa_st *rsa;	/* RSA */
+        struct rsa_st *rsa; /* RSA */
 #endif
 #ifndef OPENSSL_NO_DSA
-		struct dsa_st *dsa;	/* DSA */
+        struct dsa_st *dsa; /* DSA */
 #endif
 #ifndef OPENSSL_NO_DH
-		struct dh_st *dh;	/* DH */
+        struct dh_st *dh;   /* DH */
 #endif
 #ifndef OPENSSL_NO_EC
-		struct ec_key_st *ec;	/* ECC */
+        struct ec_key_st *ec;   /* ECC */
 #endif
-		} pkey;
-	int save_parameters;
-	STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */
-	} /* EVP_PKEY */;
+        } pkey;
+    int save_parameters;
+    STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */
+    } /* EVP_PKEY */;
 
-#define EVP_PKEY_MO_SIGN	0x0001
-#define EVP_PKEY_MO_VERIFY	0x0002
-#define EVP_PKEY_MO_ENCRYPT	0x0004
-#define EVP_PKEY_MO_DECRYPT	0x0008
+#define EVP_PKEY_MO_SIGN    0x0001
+#define EVP_PKEY_MO_VERIFY  0x0002
+#define EVP_PKEY_MO_ENCRYPT 0x0004
+#define EVP_PKEY_MO_DECRYPT 0x0008
 
 #if 0
 /* This structure is required to tie the message digest and signing together.
@@ -164,258 +164,258 @@ struct evp_pkey_st
  * routines.
  */
 typedef struct evp_pkey_md_st
-	{
-	int oid;
-	EVP_MD *md;
-	EVP_PKEY_METHOD *pkey;
-	} EVP_PKEY_MD;
+    {
+    int oid;
+    EVP_MD *md;
+    EVP_PKEY_METHOD *pkey;
+    } EVP_PKEY_MD;
 
 #define EVP_rsa_md2() \
-		EVP_PKEY_MD_add(NID_md2WithRSAEncryption,\
-			EVP_rsa_pkcs1(),EVP_md2())
+        EVP_PKEY_MD_add(NID_md2WithRSAEncryption,\
+            EVP_rsa_pkcs1(),EVP_md2())
 #define EVP_rsa_md5() \
-		EVP_PKEY_MD_add(NID_md5WithRSAEncryption,\
-			EVP_rsa_pkcs1(),EVP_md5())
+        EVP_PKEY_MD_add(NID_md5WithRSAEncryption,\
+            EVP_rsa_pkcs1(),EVP_md5())
 #define EVP_rsa_sha0() \
-		EVP_PKEY_MD_add(NID_shaWithRSAEncryption,\
-			EVP_rsa_pkcs1(),EVP_sha())
+        EVP_PKEY_MD_add(NID_shaWithRSAEncryption,\
+            EVP_rsa_pkcs1(),EVP_sha())
 #define EVP_rsa_sha1() \
-		EVP_PKEY_MD_add(NID_sha1WithRSAEncryption,\
-			EVP_rsa_pkcs1(),EVP_sha1())
+        EVP_PKEY_MD_add(NID_sha1WithRSAEncryption,\
+            EVP_rsa_pkcs1(),EVP_sha1())
 #define EVP_rsa_ripemd160() \
-		EVP_PKEY_MD_add(NID_ripemd160WithRSA,\
-			EVP_rsa_pkcs1(),EVP_ripemd160())
+        EVP_PKEY_MD_add(NID_ripemd160WithRSA,\
+            EVP_rsa_pkcs1(),EVP_ripemd160())
 #define EVP_rsa_mdc2() \
-		EVP_PKEY_MD_add(NID_mdc2WithRSA,\
-			EVP_rsa_octet_string(),EVP_mdc2())
+        EVP_PKEY_MD_add(NID_mdc2WithRSA,\
+            EVP_rsa_octet_string(),EVP_mdc2())
 #define EVP_dsa_sha() \
-		EVP_PKEY_MD_add(NID_dsaWithSHA,\
-			EVP_dsa(),EVP_sha())
+        EVP_PKEY_MD_add(NID_dsaWithSHA,\
+            EVP_dsa(),EVP_sha())
 #define EVP_dsa_sha1() \
-		EVP_PKEY_MD_add(NID_dsaWithSHA1,\
-			EVP_dsa(),EVP_sha1())
+        EVP_PKEY_MD_add(NID_dsaWithSHA1,\
+            EVP_dsa(),EVP_sha1())
 
 typedef struct evp_pkey_method_st
-	{
-	char *name;
-	int flags;
-	int type;		/* RSA, DSA, an SSLeay specific constant */
-	int oid;		/* For the pub-key type */
-	int encrypt_oid;	/* pub/priv key encryption */
+    {
+    char *name;
+    int flags;
+    int type;       /* RSA, DSA, an SSLeay specific constant */
+    int oid;        /* For the pub-key type */
+    int encrypt_oid;    /* pub/priv key encryption */
 
-	int (*sign)();
-	int (*verify)();
-	struct	{
-		int (*set)();	/* get and/or set the underlying type */
-		int (*get)();
-		int (*encrypt)();
-		int (*decrypt)();
-		int (*i2d)();
-		int (*d2i)();
-		int (*dup)();
-		} pub,priv;
-	int (*set_asn1_parameters)();
-	int (*get_asn1_parameters)();
-	} EVP_PKEY_METHOD;
+    int (*sign)();
+    int (*verify)();
+    struct  {
+        int (*set)();   /* get and/or set the underlying type */
+        int (*get)();
+        int (*encrypt)();
+        int (*decrypt)();
+        int (*i2d)();
+        int (*d2i)();
+        int (*dup)();
+        } pub,priv;
+    int (*set_asn1_parameters)();
+    int (*get_asn1_parameters)();
+    } EVP_PKEY_METHOD;
 #endif
 
 #ifndef EVP_MD
 struct env_md_st
-	{
-	int type;
-	int pkey_type;
-	int md_size;
-	unsigned long flags;
-	int (*init)(EVP_MD_CTX *ctx);
-	int (*update)(EVP_MD_CTX *ctx,const void *data,size_t count);
-	int (*final)(EVP_MD_CTX *ctx,unsigned char *md);
-	int (*copy)(EVP_MD_CTX *to,const EVP_MD_CTX *from);
-	int (*cleanup)(EVP_MD_CTX *ctx);
+    {
+    int type;
+    int pkey_type;
+    int md_size;
+    unsigned long flags;
+    int (*init)(EVP_MD_CTX *ctx);
+    int (*update)(EVP_MD_CTX *ctx,const void *data,size_t count);
+    int (*final)(EVP_MD_CTX *ctx,unsigned char *md);
+    int (*copy)(EVP_MD_CTX *to,const EVP_MD_CTX *from);
+    int (*cleanup)(EVP_MD_CTX *ctx);
 
-	/* FIXME: prototype these some day */
-	int (*sign)(int type, const unsigned char *m, unsigned int m_length,
-		    unsigned char *sigret, unsigned int *siglen, void *key);
-	int (*verify)(int type, const unsigned char *m, unsigned int m_length,
-		      const unsigned char *sigbuf, unsigned int siglen,
-		      void *key);
-	int required_pkey_type[5]; /*EVP_PKEY_xxx */
-	int block_size;
-	int ctx_size; /* how big does the ctx->md_data need to be */
-	} /* EVP_MD */;
+    /* FIXME: prototype these some day */
+    int (*sign)(int type, const unsigned char *m, unsigned int m_length,
+            unsigned char *sigret, unsigned int *siglen, void *key);
+    int (*verify)(int type, const unsigned char *m, unsigned int m_length,
+              const unsigned char *sigbuf, unsigned int siglen,
+              void *key);
+    int required_pkey_type[5]; /*EVP_PKEY_xxx */
+    int block_size;
+    int ctx_size; /* how big does the ctx->md_data need to be */
+    } /* EVP_MD */;
 
 typedef int evp_sign_method(int type,const unsigned char *m,
-			    unsigned int m_length,unsigned char *sigret,
-			    unsigned int *siglen, void *key);
+                unsigned int m_length,unsigned char *sigret,
+                unsigned int *siglen, void *key);
 typedef int evp_verify_method(int type,const unsigned char *m,
-			    unsigned int m_length,const unsigned char *sigbuf,
-			    unsigned int siglen, void *key);
+                unsigned int m_length,const unsigned char *sigbuf,
+                unsigned int siglen, void *key);
 
-#define EVP_MD_FLAG_ONESHOT	0x0001 /* digest can only handle a single
-					* block */
+#define EVP_MD_FLAG_ONESHOT 0x0001 /* digest can only handle a single
+                    * block */
 
-#define EVP_PKEY_NULL_method	NULL,NULL,{0,0,0,0}
+#define EVP_PKEY_NULL_method    NULL,NULL,{0,0,0,0}
 
 #ifndef OPENSSL_NO_DSA
-#define EVP_PKEY_DSA_method	(evp_sign_method *)DSA_sign, \
-				(evp_verify_method *)DSA_verify, \
-				{EVP_PKEY_DSA,EVP_PKEY_DSA2,EVP_PKEY_DSA3, \
-					EVP_PKEY_DSA4,0}
+#define EVP_PKEY_DSA_method (evp_sign_method *)DSA_sign, \
+                (evp_verify_method *)DSA_verify, \
+                {EVP_PKEY_DSA,EVP_PKEY_DSA2,EVP_PKEY_DSA3, \
+                    EVP_PKEY_DSA4,0}
 #else
-#define EVP_PKEY_DSA_method	EVP_PKEY_NULL_method
+#define EVP_PKEY_DSA_method EVP_PKEY_NULL_method
 #endif
 
 #ifndef OPENSSL_NO_ECDSA
 #define EVP_PKEY_ECDSA_method   (evp_sign_method *)ECDSA_sign, \
-				(evp_verify_method *)ECDSA_verify, \
+                (evp_verify_method *)ECDSA_verify, \
                                  {EVP_PKEY_EC,0,0,0}
-#else   
+#else
 #define EVP_PKEY_ECDSA_method   EVP_PKEY_NULL_method
 #endif
 
 #ifndef OPENSSL_NO_RSA
-#define EVP_PKEY_RSA_method	(evp_sign_method *)RSA_sign, \
-				(evp_verify_method *)RSA_verify, \
-				{EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0}
+#define EVP_PKEY_RSA_method (evp_sign_method *)RSA_sign, \
+                (evp_verify_method *)RSA_verify, \
+                {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0}
 #define EVP_PKEY_RSA_ASN1_OCTET_STRING_method \
-				(evp_sign_method *)RSA_sign_ASN1_OCTET_STRING, \
-				(evp_verify_method *)RSA_verify_ASN1_OCTET_STRING, \
-				{EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0}
+                (evp_sign_method *)RSA_sign_ASN1_OCTET_STRING, \
+                (evp_verify_method *)RSA_verify_ASN1_OCTET_STRING, \
+                {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0}
 #else
-#define EVP_PKEY_RSA_method	EVP_PKEY_NULL_method
+#define EVP_PKEY_RSA_method EVP_PKEY_NULL_method
 #define EVP_PKEY_RSA_ASN1_OCTET_STRING_method EVP_PKEY_NULL_method
 #endif
 
 #endif /* !EVP_MD */
 
 struct env_md_ctx_st
-	{
-	const EVP_MD *digest;
-	ENGINE *engine; /* functional reference if 'digest' is ENGINE-provided */
-	unsigned long flags;
-	void *md_data;
-	} /* EVP_MD_CTX */;
+    {
+    const EVP_MD *digest;
+    ENGINE *engine; /* functional reference if 'digest' is ENGINE-provided */
+    unsigned long flags;
+    void *md_data;
+    } /* EVP_MD_CTX */;
 
 /* values for EVP_MD_CTX flags */
 
-#define EVP_MD_CTX_FLAG_ONESHOT		0x0001 /* digest update will be called
-						* once only */
-#define EVP_MD_CTX_FLAG_CLEANED		0x0002 /* context has already been
-						* cleaned */
-#define EVP_MD_CTX_FLAG_REUSE		0x0004 /* Don't free up ctx->md_data
-						* in EVP_MD_CTX_cleanup */
+#define EVP_MD_CTX_FLAG_ONESHOT     0x0001 /* digest update will be called
+                        * once only */
+#define EVP_MD_CTX_FLAG_CLEANED     0x0002 /* context has already been
+                        * cleaned */
+#define EVP_MD_CTX_FLAG_REUSE       0x0004 /* Don't free up ctx->md_data
+                        * in EVP_MD_CTX_cleanup */
 
 struct evp_cipher_st
-	{
-	int nid;
-	int block_size;
-	int key_len;		/* Default value for variable length ciphers */
-	int iv_len;
-	unsigned long flags;	/* Various flags */
-	int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key,
-		    const unsigned char *iv, int enc);	/* init key */
-	int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out,
-			 const unsigned char *in, unsigned int inl);/* encrypt/decrypt data */
-	int (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */
-	int ctx_size;		/* how big ctx->cipher_data needs to be */
-	int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */
-	int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */
-	int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */
-	void *app_data;		/* Application data */
-	} /* EVP_CIPHER */;
+    {
+    int nid;
+    int block_size;
+    int key_len;        /* Default value for variable length ciphers */
+    int iv_len;
+    unsigned long flags;    /* Various flags */
+    int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key,
+            const unsigned char *iv, int enc);  /* init key */
+    int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out,
+             const unsigned char *in, unsigned int inl);/* encrypt/decrypt data */
+    int (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */
+    int ctx_size;       /* how big ctx->cipher_data needs to be */
+    int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */
+    int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */
+    int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */
+    void *app_data;     /* Application data */
+    } /* EVP_CIPHER */;
 
 /* Values for cipher flags */
 
 /* Modes for ciphers */
 
-#define		EVP_CIPH_STREAM_CIPHER		0x0
-#define		EVP_CIPH_ECB_MODE		0x1
-#define		EVP_CIPH_CBC_MODE		0x2
-#define		EVP_CIPH_CFB_MODE		0x3
-#define		EVP_CIPH_OFB_MODE		0x4
-#define 	EVP_CIPH_MODE			0x7
+#define     EVP_CIPH_STREAM_CIPHER      0x0
+#define     EVP_CIPH_ECB_MODE       0x1
+#define     EVP_CIPH_CBC_MODE       0x2
+#define     EVP_CIPH_CFB_MODE       0x3
+#define     EVP_CIPH_OFB_MODE       0x4
+#define     EVP_CIPH_MODE           0x7
 /* Set if variable length cipher */
-#define 	EVP_CIPH_VARIABLE_LENGTH	0x8
+#define     EVP_CIPH_VARIABLE_LENGTH    0x8
 /* Set if the iv handling should be done by the cipher itself */
-#define 	EVP_CIPH_CUSTOM_IV		0x10
+#define     EVP_CIPH_CUSTOM_IV      0x10
 /* Set if the cipher's init() function should be called if key is NULL */
-#define 	EVP_CIPH_ALWAYS_CALL_INIT	0x20
+#define     EVP_CIPH_ALWAYS_CALL_INIT   0x20
 /* Call ctrl() to init cipher parameters */
-#define 	EVP_CIPH_CTRL_INIT		0x40
+#define     EVP_CIPH_CTRL_INIT      0x40
 /* Don't use standard key length function */
-#define 	EVP_CIPH_CUSTOM_KEY_LENGTH	0x80
+#define     EVP_CIPH_CUSTOM_KEY_LENGTH  0x80
 /* Don't use standard block padding */
-#define 	EVP_CIPH_NO_PADDING		0x100
+#define     EVP_CIPH_NO_PADDING     0x100
 /* cipher handles random key generation */
-#define 	EVP_CIPH_RAND_KEY		0x200
+#define     EVP_CIPH_RAND_KEY       0x200
 
 /* ctrl() values */
 
-#define		EVP_CTRL_INIT			0x0
-#define 	EVP_CTRL_SET_KEY_LENGTH		0x1
-#define 	EVP_CTRL_GET_RC2_KEY_BITS	0x2
-#define 	EVP_CTRL_SET_RC2_KEY_BITS	0x3
-#define 	EVP_CTRL_GET_RC5_ROUNDS		0x4
-#define 	EVP_CTRL_SET_RC5_ROUNDS		0x5
-#define 	EVP_CTRL_RAND_KEY		0x6
+#define     EVP_CTRL_INIT           0x0
+#define     EVP_CTRL_SET_KEY_LENGTH     0x1
+#define     EVP_CTRL_GET_RC2_KEY_BITS   0x2
+#define     EVP_CTRL_SET_RC2_KEY_BITS   0x3
+#define     EVP_CTRL_GET_RC5_ROUNDS     0x4
+#define     EVP_CTRL_SET_RC5_ROUNDS     0x5
+#define     EVP_CTRL_RAND_KEY       0x6
 
 typedef struct evp_cipher_info_st
-	{
-	const EVP_CIPHER *cipher;
-	unsigned char iv[EVP_MAX_IV_LENGTH];
-	} EVP_CIPHER_INFO;
+    {
+    const EVP_CIPHER *cipher;
+    unsigned char iv[EVP_MAX_IV_LENGTH];
+    } EVP_CIPHER_INFO;
 
 struct evp_cipher_ctx_st
-	{
-	const EVP_CIPHER *cipher;
-	ENGINE *engine;	/* functional reference if 'cipher' is ENGINE-provided */
-	int encrypt;		/* encrypt or decrypt */
-	int buf_len;		/* number we have left */
+    {
+    const EVP_CIPHER *cipher;
+    ENGINE *engine; /* functional reference if 'cipher' is ENGINE-provided */
+    int encrypt;        /* encrypt or decrypt */
+    int buf_len;        /* number we have left */
 
-	unsigned char  oiv[EVP_MAX_IV_LENGTH];	/* original iv */
-	unsigned char  iv[EVP_MAX_IV_LENGTH];	/* working iv */
-	unsigned char buf[EVP_MAX_BLOCK_LENGTH];/* saved partial block */
-	int num;				/* used by cfb/ofb mode */
+    unsigned char  oiv[EVP_MAX_IV_LENGTH];  /* original iv */
+    unsigned char  iv[EVP_MAX_IV_LENGTH];   /* working iv */
+    unsigned char buf[EVP_MAX_BLOCK_LENGTH];/* saved partial block */
+    int num;                /* used by cfb/ofb mode */
 
-	void *app_data;		/* application stuff */
-	int key_len;		/* May change for variable length cipher */
-	unsigned long flags;	/* Various flags */
-	void *cipher_data; /* per EVP data */
-	int final_used;
-	int block_mask;
-	unsigned char final[EVP_MAX_BLOCK_LENGTH];/* possible final block */
-	} /* EVP_CIPHER_CTX */;
+    void *app_data;     /* application stuff */
+    int key_len;        /* May change for variable length cipher */
+    unsigned long flags;    /* Various flags */
+    void *cipher_data; /* per EVP data */
+    int final_used;
+    int block_mask;
+    unsigned char final[EVP_MAX_BLOCK_LENGTH];/* possible final block */
+    } /* EVP_CIPHER_CTX */;
 
 typedef struct evp_Encode_Ctx_st
-	{
-	int num;	/* number saved in a partial encode/decode */
-	int length;	/* The length is either the output line length
-			 * (in input bytes) or the shortest input line
-			 * length that is ok.  Once decoding begins,
-			 * the length is adjusted up each time a longer
-			 * line is decoded */
-	unsigned char enc_data[80];	/* data to encode */
-	int line_num;	/* number read on current line */
-	int expect_nl;
-	} EVP_ENCODE_CTX;
+    {
+    int num;    /* number saved in a partial encode/decode */
+    int length; /* The length is either the output line length
+             * (in input bytes) or the shortest input line
+             * length that is ok.  Once decoding begins,
+             * the length is adjusted up each time a longer
+             * line is decoded */
+    unsigned char enc_data[80]; /* data to encode */
+    int line_num;   /* number read on current line */
+    int expect_nl;
+    } EVP_ENCODE_CTX;
 
 /* Password based encryption function */
 typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
-		ASN1_TYPE *param, const EVP_CIPHER *cipher,
+        ASN1_TYPE *param, const EVP_CIPHER *cipher,
                 const EVP_MD *md, int en_de);
 
 #ifndef OPENSSL_NO_RSA
 #define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\
-					(char *)(rsa))
+                    (char *)(rsa))
 #endif
 
 #ifndef OPENSSL_NO_DSA
 #define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\
-					(char *)(dsa))
+                    (char *)(dsa))
 #endif
 
 #ifndef OPENSSL_NO_DH
 #define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\
-					(char *)(dh))
+                    (char *)(dh))
 #endif
 
 #ifndef OPENSSL_NO_EC
@@ -430,24 +430,24 @@ typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
 #define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a))
 
 int EVP_MD_type(const EVP_MD *md);
-#define EVP_MD_nid(e)			EVP_MD_type(e)
-#define EVP_MD_name(e)			OBJ_nid2sn(EVP_MD_nid(e))
-int EVP_MD_pkey_type(const EVP_MD *md);	
+#define EVP_MD_nid(e)           EVP_MD_type(e)
+#define EVP_MD_name(e)          OBJ_nid2sn(EVP_MD_nid(e))
+int EVP_MD_pkey_type(const EVP_MD *md);
 int EVP_MD_size(const EVP_MD *md);
 int EVP_MD_block_size(const EVP_MD *md);
 
 const EVP_MD * EVP_MD_CTX_md(const EVP_MD_CTX *ctx);
-#define EVP_MD_CTX_size(e)		EVP_MD_size(EVP_MD_CTX_md(e))
-#define EVP_MD_CTX_block_size(e)	EVP_MD_block_size(EVP_MD_CTX_md(e))
-#define EVP_MD_CTX_type(e)		EVP_MD_type(EVP_MD_CTX_md(e))
+#define EVP_MD_CTX_size(e)      EVP_MD_size(EVP_MD_CTX_md(e))
+#define EVP_MD_CTX_block_size(e)    EVP_MD_block_size(EVP_MD_CTX_md(e))
+#define EVP_MD_CTX_type(e)      EVP_MD_type(EVP_MD_CTX_md(e))
 
 int EVP_CIPHER_nid(const EVP_CIPHER *cipher);
-#define EVP_CIPHER_name(e)		OBJ_nid2sn(EVP_CIPHER_nid(e))
+#define EVP_CIPHER_name(e)      OBJ_nid2sn(EVP_CIPHER_nid(e))
 int EVP_CIPHER_block_size(const EVP_CIPHER *cipher);
 int EVP_CIPHER_key_length(const EVP_CIPHER *cipher);
 int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher);
 unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher);
-#define EVP_CIPHER_mode(e)		(EVP_CIPHER_flags(e) & EVP_CIPH_MODE)
+#define EVP_CIPHER_mode(e)      (EVP_CIPHER_flags(e) & EVP_CIPH_MODE)
 
 const EVP_CIPHER * EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx);
 int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx);
@@ -458,129 +458,129 @@ void * EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx);
 void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data);
 #define EVP_CIPHER_CTX_type(c)         EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c))
 unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx);
-#define EVP_CIPHER_CTX_mode(e)		(EVP_CIPHER_CTX_flags(e) & EVP_CIPH_MODE)
+#define EVP_CIPHER_CTX_mode(e)      (EVP_CIPHER_CTX_flags(e) & EVP_CIPH_MODE)
 
-#define EVP_ENCODE_LENGTH(l)	(((l+2)/3*4)+(l/48+1)*2+80)
-#define EVP_DECODE_LENGTH(l)	((l+3)/4*3+80)
+#define EVP_ENCODE_LENGTH(l)    (((l+2)/3*4)+(l/48+1)*2+80)
+#define EVP_DECODE_LENGTH(l)    ((l+3)/4*3+80)
 
-#define EVP_SignInit_ex(a,b,c)		EVP_DigestInit_ex(a,b,c)
-#define EVP_SignInit(a,b)		EVP_DigestInit(a,b)
-#define EVP_SignUpdate(a,b,c)		EVP_DigestUpdate(a,b,c)
-#define	EVP_VerifyInit_ex(a,b,c)	EVP_DigestInit_ex(a,b,c)
-#define	EVP_VerifyInit(a,b)		EVP_DigestInit(a,b)
-#define	EVP_VerifyUpdate(a,b,c)		EVP_DigestUpdate(a,b,c)
-#define EVP_OpenUpdate(a,b,c,d,e)	EVP_DecryptUpdate(a,b,c,d,e)
-#define EVP_SealUpdate(a,b,c,d,e)	EVP_EncryptUpdate(a,b,c,d,e)	
+#define EVP_SignInit_ex(a,b,c)      EVP_DigestInit_ex(a,b,c)
+#define EVP_SignInit(a,b)       EVP_DigestInit(a,b)
+#define EVP_SignUpdate(a,b,c)       EVP_DigestUpdate(a,b,c)
+#define EVP_VerifyInit_ex(a,b,c)    EVP_DigestInit_ex(a,b,c)
+#define EVP_VerifyInit(a,b)     EVP_DigestInit(a,b)
+#define EVP_VerifyUpdate(a,b,c)     EVP_DigestUpdate(a,b,c)
+#define EVP_OpenUpdate(a,b,c,d,e)   EVP_DecryptUpdate(a,b,c,d,e)
+#define EVP_SealUpdate(a,b,c,d,e)   EVP_EncryptUpdate(a,b,c,d,e)
 
 #ifdef CONST_STRICT
 void BIO_set_md(BIO *,const EVP_MD *md);
 #else
-# define BIO_set_md(b,md)		BIO_ctrl(b,BIO_C_SET_MD,0,(char *)md)
+# define BIO_set_md(b,md)       BIO_ctrl(b,BIO_C_SET_MD,0,(char *)md)
 #endif
-#define BIO_get_md(b,mdp)		BIO_ctrl(b,BIO_C_GET_MD,0,(char *)mdp)
+#define BIO_get_md(b,mdp)       BIO_ctrl(b,BIO_C_GET_MD,0,(char *)mdp)
 #define BIO_get_md_ctx(b,mdcp)     BIO_ctrl(b,BIO_C_GET_MD_CTX,0,(char *)mdcp)
 #define BIO_set_md_ctx(b,mdcp)     BIO_ctrl(b,BIO_C_SET_MD_CTX,0,(char *)mdcp)
-#define BIO_get_cipher_status(b)	BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL)
-#define BIO_get_cipher_ctx(b,c_pp)	BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp)
+#define BIO_get_cipher_status(b)    BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL)
+#define BIO_get_cipher_ctx(b,c_pp)  BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp)
 
 int EVP_Cipher(EVP_CIPHER_CTX *c,
-		unsigned char *out,
-		const unsigned char *in,
-		unsigned int inl);
+        unsigned char *out,
+        const unsigned char *in,
+        unsigned int inl);
 
 #define EVP_add_cipher_alias(n,alias) \
-	OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
+    OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
 #define EVP_add_digest_alias(n,alias) \
-	OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n))
+    OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n))
 #define EVP_delete_cipher_alias(alias) \
-	OBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS);
+    OBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS);
 #define EVP_delete_digest_alias(alias) \
-	OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS);
+    OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS);
 
-void	EVP_MD_CTX_init(EVP_MD_CTX *ctx);
-int	EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx);
+void    EVP_MD_CTX_init(EVP_MD_CTX *ctx);
+int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx);
 EVP_MD_CTX *EVP_MD_CTX_create(void);
-void	EVP_MD_CTX_destroy(EVP_MD_CTX *ctx);
-int     EVP_MD_CTX_copy_ex(EVP_MD_CTX *out,const EVP_MD_CTX *in);  
-void	EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags);
-void	EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags);
-int 	EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx,int flags);
-int	EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);
-int	EVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d,
-			 size_t cnt);
-int	EVP_DigestFinal_ex(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s);
-int	EVP_Digest(const void *data, size_t count,
-		unsigned char *md, unsigned int *size, const EVP_MD *type, ENGINE *impl);
+void    EVP_MD_CTX_destroy(EVP_MD_CTX *ctx);
+int     EVP_MD_CTX_copy_ex(EVP_MD_CTX *out,const EVP_MD_CTX *in);
+void    EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags);
+void    EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags);
+int     EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx,int flags);
+int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);
+int EVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d,
+             size_t cnt);
+int EVP_DigestFinal_ex(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s);
+int EVP_Digest(const void *data, size_t count,
+        unsigned char *md, unsigned int *size, const EVP_MD *type, ENGINE *impl);
 
-int     EVP_MD_CTX_copy(EVP_MD_CTX *out,const EVP_MD_CTX *in);  
-int	EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);
-int	EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s);
+int     EVP_MD_CTX_copy(EVP_MD_CTX *out,const EVP_MD_CTX *in);
+int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);
+int EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s);
 
-int	EVP_read_pw_string(char *buf,int length,const char *prompt,int verify);
-void	EVP_set_pw_prompt(const char *prompt);
-char *	EVP_get_pw_prompt(void);
+int EVP_read_pw_string(char *buf,int length,const char *prompt,int verify);
+void    EVP_set_pw_prompt(const char *prompt);
+char *  EVP_get_pw_prompt(void);
 
-int	EVP_BytesToKey(const EVP_CIPHER *type,const EVP_MD *md,
-		const unsigned char *salt, const unsigned char *data,
-		int datal, int count, unsigned char *key,unsigned char *iv);
+int EVP_BytesToKey(const EVP_CIPHER *type,const EVP_MD *md,
+        const unsigned char *salt, const unsigned char *data,
+        int datal, int count, unsigned char *key,unsigned char *iv);
 
-int	EVP_EncryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,
-		const unsigned char *key, const unsigned char *iv);
-int	EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,
-		const unsigned char *key, const unsigned char *iv);
-int	EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
-		int *outl, const unsigned char *in, int inl);
-int	EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
-int	EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
+int EVP_EncryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,
+        const unsigned char *key, const unsigned char *iv);
+int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,
+        const unsigned char *key, const unsigned char *iv);
+int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
+        int *outl, const unsigned char *in, int inl);
+int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
+int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
 
-int	EVP_DecryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,
-		const unsigned char *key, const unsigned char *iv);
-int	EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,
-		const unsigned char *key, const unsigned char *iv);
-int	EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
-		int *outl, const unsigned char *in, int inl);
-int	EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
-int	EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
+int EVP_DecryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,
+        const unsigned char *key, const unsigned char *iv);
+int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,
+        const unsigned char *key, const unsigned char *iv);
+int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
+        int *outl, const unsigned char *in, int inl);
+int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
+int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
 
-int	EVP_CipherInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,
-		       const unsigned char *key,const unsigned char *iv,
-		       int enc);
-int	EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,
-		       const unsigned char *key,const unsigned char *iv,
-		       int enc);
-int	EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
-		int *outl, const unsigned char *in, int inl);
-int	EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
-int	EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
+int EVP_CipherInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,
+               const unsigned char *key,const unsigned char *iv,
+               int enc);
+int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,
+               const unsigned char *key,const unsigned char *iv,
+               int enc);
+int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
+        int *outl, const unsigned char *in, int inl);
+int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
+int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
 
-int	EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s,
-		EVP_PKEY *pkey);
+int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s,
+        EVP_PKEY *pkey);
 
-int	EVP_VerifyFinal(EVP_MD_CTX *ctx,const unsigned char *sigbuf,
-		unsigned int siglen,EVP_PKEY *pkey);
+int EVP_VerifyFinal(EVP_MD_CTX *ctx,const unsigned char *sigbuf,
+        unsigned int siglen,EVP_PKEY *pkey);
 
-int	EVP_OpenInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type,
-		const unsigned char *ek, int ekl, const unsigned char *iv,
-		EVP_PKEY *priv);
-int	EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
+int EVP_OpenInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type,
+        const unsigned char *ek, int ekl, const unsigned char *iv,
+        EVP_PKEY *priv);
+int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
 
-int	EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
-		 unsigned char **ek, int *ekl, unsigned char *iv,
-		EVP_PKEY **pubk, int npubk);
-int	EVP_SealFinal(EVP_CIPHER_CTX *ctx,unsigned char *out,int *outl);
+int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
+         unsigned char **ek, int *ekl, unsigned char *iv,
+        EVP_PKEY **pubk, int npubk);
+int EVP_SealFinal(EVP_CIPHER_CTX *ctx,unsigned char *out,int *outl);
 
-void	EVP_EncodeInit(EVP_ENCODE_CTX *ctx);
-void	EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl,
-		const unsigned char *in,int inl);
-void	EVP_EncodeFinal(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl);
-int	EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n);
+void    EVP_EncodeInit(EVP_ENCODE_CTX *ctx);
+void    EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl,
+        const unsigned char *in,int inl);
+void    EVP_EncodeFinal(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl);
+int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n);
 
-void	EVP_DecodeInit(EVP_ENCODE_CTX *ctx);
-int	EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl,
-		const unsigned char *in, int inl);
-int	EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned
-		char *out, int *outl);
-int	EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n);
+void    EVP_DecodeInit(EVP_ENCODE_CTX *ctx);
+int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl,
+        const unsigned char *in, int inl);
+int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned
+        char *out, int *outl);
+int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n);
 
 void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a);
 int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a);
@@ -597,7 +597,7 @@ BIO_METHOD *BIO_f_base64(void);
 BIO_METHOD *BIO_f_cipher(void);
 BIO_METHOD *BIO_f_reliable(void);
 void BIO_set_cipher(BIO *b,const EVP_CIPHER *c,const unsigned char *k,
-		const unsigned char *i, int enc);
+        const unsigned char *i, int enc);
 #endif
 
 const EVP_MD *EVP_md_null(void);
@@ -631,7 +631,7 @@ const EVP_MD *EVP_mdc2(void);
 #ifndef OPENSSL_NO_RIPEMD
 const EVP_MD *EVP_ripemd160(void);
 #endif
-const EVP_CIPHER *EVP_enc_null(void);		/* does nothing :-) */
+const EVP_CIPHER *EVP_enc_null(void);       /* does nothing :-) */
 #ifndef OPENSSL_NO_DES
 const EVP_CIPHER *EVP_des_ecb(void);
 const EVP_CIPHER *EVP_des_ede(void);
@@ -771,10 +771,10 @@ void OPENSSL_add_all_algorithms_conf(void);
 
 #ifdef OPENSSL_LOAD_CONF
 #define OpenSSL_add_all_algorithms() \
-		OPENSSL_add_all_algorithms_conf()
+        OPENSSL_add_all_algorithms_conf()
 #else
 #define OpenSSL_add_all_algorithms() \
-		OPENSSL_add_all_algorithms_noconf()
+        OPENSSL_add_all_algorithms_noconf()
 #endif
 
 void OpenSSL_add_all_ciphers(void);
@@ -790,16 +790,16 @@ const EVP_CIPHER *EVP_get_cipherbyname(const char *name);
 const EVP_MD *EVP_get_digestbyname(const char *name);
 void EVP_cleanup(void);
 
-int		EVP_PKEY_decrypt(unsigned char *dec_key,
-			const unsigned char *enc_key,int enc_key_len,
-			EVP_PKEY *private_key);
-int		EVP_PKEY_encrypt(unsigned char *enc_key,
-			const unsigned char *key,int key_len,
-			EVP_PKEY *pub_key);
-int		EVP_PKEY_type(int type);
-int		EVP_PKEY_bits(EVP_PKEY *pkey);
-int		EVP_PKEY_size(EVP_PKEY *pkey);
-int 		EVP_PKEY_assign(EVP_PKEY *pkey,int type,char *key);
+int     EVP_PKEY_decrypt(unsigned char *dec_key,
+            const unsigned char *enc_key,int enc_key_len,
+            EVP_PKEY *private_key);
+int     EVP_PKEY_encrypt(unsigned char *enc_key,
+            const unsigned char *key,int key_len,
+            EVP_PKEY *pub_key);
+int     EVP_PKEY_type(int type);
+int     EVP_PKEY_bits(EVP_PKEY *pkey);
+int     EVP_PKEY_size(EVP_PKEY *pkey);
+int         EVP_PKEY_assign(EVP_PKEY *pkey,int type,char *key);
 
 #ifndef OPENSSL_NO_RSA
 struct rsa_st;
@@ -822,18 +822,18 @@ int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey,struct ec_key_st *key);
 struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey);
 #endif
 
-EVP_PKEY *	EVP_PKEY_new(void);
-void		EVP_PKEY_free(EVP_PKEY *pkey);
+EVP_PKEY *  EVP_PKEY_new(void);
+void        EVP_PKEY_free(EVP_PKEY *pkey);
 
-EVP_PKEY *	d2i_PublicKey(int type,EVP_PKEY **a, const unsigned char **pp,
-			long length);
-int		i2d_PublicKey(EVP_PKEY *a, unsigned char **pp);
+EVP_PKEY *  d2i_PublicKey(int type,EVP_PKEY **a, const unsigned char **pp,
+            long length);
+int     i2d_PublicKey(EVP_PKEY *a, unsigned char **pp);
 
-EVP_PKEY *	d2i_PrivateKey(int type,EVP_PKEY **a, const unsigned char **pp,
-			long length);
-EVP_PKEY *	d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
-			long length);
-int		i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp);
+EVP_PKEY *  d2i_PrivateKey(int type,EVP_PKEY **a, const unsigned char **pp,
+            long length);
+EVP_PKEY *  d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
+            long length);
+int     i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp);
 
 int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from);
 int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey);
@@ -854,21 +854,21 @@ int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type);
 
 /* PKCS5 password based encryption */
 int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
-			 ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md,
-			 int en_de);
+             ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md,
+             int en_de);
 int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,
-			   const unsigned char *salt, int saltlen, int iter,
-			   int keylen, unsigned char *out);
+               const unsigned char *salt, int saltlen, int iter,
+               int keylen, unsigned char *out);
 int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
-			 ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md,
-			 int en_de);
+             ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md,
+             int en_de);
 
 void PKCS5_PBE_add(void);
 
 int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
-	     ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de);
+         ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de);
 int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md,
-		    EVP_PBE_KEYGEN *keygen);
+            EVP_PBE_KEYGEN *keygen);
 void EVP_PBE_cleanup(void);
 
 /* BEGIN ERROR CODES */
@@ -880,89 +880,89 @@ void ERR_load_EVP_strings(void);
 /* Error codes for the EVP functions. */
 
 /* Function codes. */
-#define EVP_F_AES_INIT_KEY				 133
-#define EVP_F_CAMELLIA_INIT_KEY				 159
-#define EVP_F_D2I_PKEY					 100
-#define EVP_F_DSAPKEY2PKCS8				 134
-#define EVP_F_DSA_PKEY2PKCS8				 135
-#define EVP_F_ECDSA_PKEY2PKCS8				 129
-#define EVP_F_ECKEY_PKEY2PKCS8				 132
-#define EVP_F_EVP_CIPHERINIT_EX				 123
-#define EVP_F_EVP_CIPHER_CTX_CTRL			 124
-#define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH		 122
-#define EVP_F_EVP_DECRYPTFINAL_EX			 101
-#define EVP_F_EVP_DIGESTINIT_EX				 128
-#define EVP_F_EVP_ENCRYPTFINAL_EX			 127
-#define EVP_F_EVP_MD_CTX_COPY_EX			 110
-#define EVP_F_EVP_OPENINIT				 102
-#define EVP_F_EVP_PBE_ALG_ADD				 115
-#define EVP_F_EVP_PBE_CIPHERINIT			 116
-#define EVP_F_EVP_PKCS82PKEY				 111
-#define EVP_F_EVP_PKEY2PKCS8_BROKEN			 113
-#define EVP_F_EVP_PKEY_COPY_PARAMETERS			 103
-#define EVP_F_EVP_PKEY_DECRYPT				 104
-#define EVP_F_EVP_PKEY_ENCRYPT				 105
-#define EVP_F_EVP_PKEY_GET1_DH				 119
-#define EVP_F_EVP_PKEY_GET1_DSA				 120
-#define EVP_F_EVP_PKEY_GET1_ECDSA			 130
-#define EVP_F_EVP_PKEY_GET1_EC_KEY			 131
-#define EVP_F_EVP_PKEY_GET1_RSA				 121
-#define EVP_F_EVP_PKEY_NEW				 106
-#define EVP_F_EVP_RIJNDAEL				 126
-#define EVP_F_EVP_SIGNFINAL				 107
-#define EVP_F_EVP_VERIFYFINAL				 108
-#define EVP_F_PKCS5_PBE_KEYIVGEN			 117
-#define EVP_F_PKCS5_V2_PBE_KEYIVGEN			 118
-#define EVP_F_PKCS8_SET_BROKEN				 112
-#define EVP_F_RC2_MAGIC_TO_METH				 109
-#define EVP_F_RC5_CTRL					 125
+#define EVP_F_AES_INIT_KEY               133
+#define EVP_F_CAMELLIA_INIT_KEY              159
+#define EVP_F_D2I_PKEY                   100
+#define EVP_F_DSAPKEY2PKCS8              134
+#define EVP_F_DSA_PKEY2PKCS8                 135
+#define EVP_F_ECDSA_PKEY2PKCS8               129
+#define EVP_F_ECKEY_PKEY2PKCS8               132
+#define EVP_F_EVP_CIPHERINIT_EX              123
+#define EVP_F_EVP_CIPHER_CTX_CTRL            124
+#define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH      122
+#define EVP_F_EVP_DECRYPTFINAL_EX            101
+#define EVP_F_EVP_DIGESTINIT_EX              128
+#define EVP_F_EVP_ENCRYPTFINAL_EX            127
+#define EVP_F_EVP_MD_CTX_COPY_EX             110
+#define EVP_F_EVP_OPENINIT               102
+#define EVP_F_EVP_PBE_ALG_ADD                115
+#define EVP_F_EVP_PBE_CIPHERINIT             116
+#define EVP_F_EVP_PKCS82PKEY                 111
+#define EVP_F_EVP_PKEY2PKCS8_BROKEN          113
+#define EVP_F_EVP_PKEY_COPY_PARAMETERS           103
+#define EVP_F_EVP_PKEY_DECRYPT               104
+#define EVP_F_EVP_PKEY_ENCRYPT               105
+#define EVP_F_EVP_PKEY_GET1_DH               119
+#define EVP_F_EVP_PKEY_GET1_DSA              120
+#define EVP_F_EVP_PKEY_GET1_ECDSA            130
+#define EVP_F_EVP_PKEY_GET1_EC_KEY           131
+#define EVP_F_EVP_PKEY_GET1_RSA              121
+#define EVP_F_EVP_PKEY_NEW               106
+#define EVP_F_EVP_RIJNDAEL               126
+#define EVP_F_EVP_SIGNFINAL              107
+#define EVP_F_EVP_VERIFYFINAL                108
+#define EVP_F_PKCS5_PBE_KEYIVGEN             117
+#define EVP_F_PKCS5_V2_PBE_KEYIVGEN          118
+#define EVP_F_PKCS8_SET_BROKEN               112
+#define EVP_F_RC2_MAGIC_TO_METH              109
+#define EVP_F_RC5_CTRL                   125
 
 /* Reason codes. */
-#define EVP_R_AES_KEY_SETUP_FAILED			 143
-#define EVP_R_ASN1_LIB					 140
-#define EVP_R_BAD_BLOCK_LENGTH				 136
-#define EVP_R_BAD_DECRYPT				 100
-#define EVP_R_BAD_KEY_LENGTH				 137
-#define EVP_R_BN_DECODE_ERROR				 112
-#define EVP_R_BN_PUBKEY_ERROR				 113
-#define EVP_R_CAMELLIA_KEY_SETUP_FAILED			 157
-#define EVP_R_CIPHER_PARAMETER_ERROR			 122
-#define EVP_R_CTRL_NOT_IMPLEMENTED			 132
-#define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED		 133
-#define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH		 138
-#define EVP_R_DECODE_ERROR				 114
-#define EVP_R_DIFFERENT_KEY_TYPES			 101
-#define EVP_R_ENCODE_ERROR				 115
-#define EVP_R_EVP_PBE_CIPHERINIT_ERROR			 119
-#define EVP_R_EXPECTING_AN_RSA_KEY			 127
-#define EVP_R_EXPECTING_A_DH_KEY			 128
-#define EVP_R_EXPECTING_A_DSA_KEY			 129
-#define EVP_R_EXPECTING_A_ECDSA_KEY			 141
-#define EVP_R_EXPECTING_A_EC_KEY			 142
-#define EVP_R_INITIALIZATION_ERROR			 134
-#define EVP_R_INPUT_NOT_INITIALIZED			 111
-#define EVP_R_INVALID_KEY_LENGTH			 130
-#define EVP_R_IV_TOO_LARGE				 102
-#define EVP_R_KEYGEN_FAILURE				 120
-#define EVP_R_MISSING_PARAMETERS			 103
-#define EVP_R_NO_CIPHER_SET				 131
-#define EVP_R_NO_DIGEST_SET				 139
-#define EVP_R_NO_DSA_PARAMETERS				 116
-#define EVP_R_NO_SIGN_FUNCTION_CONFIGURED		 104
-#define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED		 105
-#define EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE			 117
-#define EVP_R_PUBLIC_KEY_NOT_RSA			 106
-#define EVP_R_UNKNOWN_PBE_ALGORITHM			 121
-#define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS		 135
-#define EVP_R_UNSUPPORTED_CIPHER			 107
-#define EVP_R_UNSUPPORTED_KEYLENGTH			 123
-#define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION	 124
-#define EVP_R_UNSUPPORTED_KEY_SIZE			 108
-#define EVP_R_UNSUPPORTED_PRF				 125
-#define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM		 118
-#define EVP_R_UNSUPPORTED_SALT_TYPE			 126
-#define EVP_R_WRONG_FINAL_BLOCK_LENGTH			 109
-#define EVP_R_WRONG_PUBLIC_KEY_TYPE			 110
+#define EVP_R_AES_KEY_SETUP_FAILED           143
+#define EVP_R_ASN1_LIB                   140
+#define EVP_R_BAD_BLOCK_LENGTH               136
+#define EVP_R_BAD_DECRYPT                100
+#define EVP_R_BAD_KEY_LENGTH                 137
+#define EVP_R_BN_DECODE_ERROR                112
+#define EVP_R_BN_PUBKEY_ERROR                113
+#define EVP_R_CAMELLIA_KEY_SETUP_FAILED          157
+#define EVP_R_CIPHER_PARAMETER_ERROR             122
+#define EVP_R_CTRL_NOT_IMPLEMENTED           132
+#define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED         133
+#define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH      138
+#define EVP_R_DECODE_ERROR               114
+#define EVP_R_DIFFERENT_KEY_TYPES            101
+#define EVP_R_ENCODE_ERROR               115
+#define EVP_R_EVP_PBE_CIPHERINIT_ERROR           119
+#define EVP_R_EXPECTING_AN_RSA_KEY           127
+#define EVP_R_EXPECTING_A_DH_KEY             128
+#define EVP_R_EXPECTING_A_DSA_KEY            129
+#define EVP_R_EXPECTING_A_ECDSA_KEY          141
+#define EVP_R_EXPECTING_A_EC_KEY             142
+#define EVP_R_INITIALIZATION_ERROR           134
+#define EVP_R_INPUT_NOT_INITIALIZED          111
+#define EVP_R_INVALID_KEY_LENGTH             130
+#define EVP_R_IV_TOO_LARGE               102
+#define EVP_R_KEYGEN_FAILURE                 120
+#define EVP_R_MISSING_PARAMETERS             103
+#define EVP_R_NO_CIPHER_SET              131
+#define EVP_R_NO_DIGEST_SET              139
+#define EVP_R_NO_DSA_PARAMETERS              116
+#define EVP_R_NO_SIGN_FUNCTION_CONFIGURED        104
+#define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED      105
+#define EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE          117
+#define EVP_R_PUBLIC_KEY_NOT_RSA             106
+#define EVP_R_UNKNOWN_PBE_ALGORITHM          121
+#define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS        135
+#define EVP_R_UNSUPPORTED_CIPHER             107
+#define EVP_R_UNSUPPORTED_KEYLENGTH          123
+#define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION    124
+#define EVP_R_UNSUPPORTED_KEY_SIZE           108
+#define EVP_R_UNSUPPORTED_PRF                125
+#define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM      118
+#define EVP_R_UNSUPPORTED_SALT_TYPE          126
+#define EVP_R_WRONG_FINAL_BLOCK_LENGTH           109
+#define EVP_R_WRONG_PUBLIC_KEY_TYPE          110
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/hmac.h b/dep/include/openssl/hmac.h
index 719fc408ace..ca1557b5bf8 100644
--- a/dep/include/openssl/hmac.h
+++ b/dep/include/openssl/hmac.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -66,23 +66,23 @@
 
 #include 
 
-#define HMAC_MAX_MD_CBLOCK	128	/* largest known is SHA512 */
+#define HMAC_MAX_MD_CBLOCK  128 /* largest known is SHA512 */
 
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
 typedef struct hmac_ctx_st
-	{
-	const EVP_MD *md;
-	EVP_MD_CTX md_ctx;
-	EVP_MD_CTX i_ctx;
-	EVP_MD_CTX o_ctx;
-	unsigned int key_length;
-	unsigned char key[HMAC_MAX_MD_CBLOCK];
-	} HMAC_CTX;
+    {
+    const EVP_MD *md;
+    EVP_MD_CTX md_ctx;
+    EVP_MD_CTX i_ctx;
+    EVP_MD_CTX o_ctx;
+    unsigned int key_length;
+    unsigned char key[HMAC_MAX_MD_CBLOCK];
+    } HMAC_CTX;
 
-#define HMAC_size(e)	(EVP_MD_size((e)->md))
+#define HMAC_size(e)    (EVP_MD_size((e)->md))
 
 
 void HMAC_CTX_init(HMAC_CTX *ctx);
@@ -91,14 +91,14 @@ void HMAC_CTX_cleanup(HMAC_CTX *ctx);
 #define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) /* deprecated */
 
 void HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
-	       const EVP_MD *md); /* deprecated */
+           const EVP_MD *md); /* deprecated */
 void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
-		  const EVP_MD *md, ENGINE *impl);
+          const EVP_MD *md, ENGINE *impl);
 void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len);
 void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);
 unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,
-		    const unsigned char *d, size_t n, unsigned char *md,
-		    unsigned int *md_len);
+            const unsigned char *d, size_t n, unsigned char *md,
+            unsigned int *md_len);
 
 
 #ifdef  __cplusplus
diff --git a/dep/include/openssl/idea.h b/dep/include/openssl/idea.h
index bf97a37e39b..a58bc3180d7 100644
--- a/dep/include/openssl/idea.h
+++ b/dep/include/openssl/idea.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -65,33 +65,33 @@
 #error IDEA is disabled.
 #endif
 
-#define IDEA_ENCRYPT	1
-#define IDEA_DECRYPT	0
+#define IDEA_ENCRYPT    1
+#define IDEA_DECRYPT    0
 
-#define IDEA_BLOCK	8
-#define IDEA_KEY_LENGTH	16
+#define IDEA_BLOCK  8
+#define IDEA_KEY_LENGTH 16
 
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
 typedef struct idea_key_st
-	{
-	IDEA_INT data[9][6];
-	} IDEA_KEY_SCHEDULE;
+    {
+    IDEA_INT data[9][6];
+    } IDEA_KEY_SCHEDULE;
 
 const char *idea_options(void);
 void idea_ecb_encrypt(const unsigned char *in, unsigned char *out,
-	IDEA_KEY_SCHEDULE *ks);
+    IDEA_KEY_SCHEDULE *ks);
 void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks);
 void idea_set_decrypt_key(const IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk);
 void idea_cbc_encrypt(const unsigned char *in, unsigned char *out,
-	long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,int enc);
+    long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,int enc);
 void idea_cfb64_encrypt(const unsigned char *in, unsigned char *out,
-	long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,
-	int *num,int enc);
+    long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,
+    int *num,int enc);
 void idea_ofb64_encrypt(const unsigned char *in, unsigned char *out,
-	long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, int *num);
+    long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, int *num);
 void idea_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks);
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/krb5_asn.h b/dep/include/openssl/krb5_asn.h
index 41725d0dc44..33c94fd7f85 100644
--- a/dep/include/openssl/krb5_asn.h
+++ b/dep/include/openssl/krb5_asn.h
@@ -11,7 +11,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -70,164 +70,164 @@ extern "C" {
 #endif
 
 
-/*	ASN.1 from Kerberos RFC 1510
+/*  ASN.1 from Kerberos RFC 1510
 */
 
-/*	EncryptedData ::=   SEQUENCE {
-**		etype[0]                      INTEGER, -- EncryptionType
-**		kvno[1]                       INTEGER OPTIONAL,
-**		cipher[2]                     OCTET STRING -- ciphertext
-**	}
+/*  EncryptedData ::=   SEQUENCE {
+**      etype[0]                      INTEGER, -- EncryptionType
+**      kvno[1]                       INTEGER OPTIONAL,
+**      cipher[2]                     OCTET STRING -- ciphertext
+**  }
 */
-typedef	struct	krb5_encdata_st
-	{
-	ASN1_INTEGER			*etype;
-	ASN1_INTEGER			*kvno;
-	ASN1_OCTET_STRING		*cipher;
-	}	KRB5_ENCDATA;
+typedef struct  krb5_encdata_st
+    {
+    ASN1_INTEGER            *etype;
+    ASN1_INTEGER            *kvno;
+    ASN1_OCTET_STRING       *cipher;
+    }   KRB5_ENCDATA;
 
 DECLARE_STACK_OF(KRB5_ENCDATA)
 
-/*	PrincipalName ::=   SEQUENCE {
-**		name-type[0]                  INTEGER,
-**		name-string[1]                SEQUENCE OF GeneralString
-**	}
+/*  PrincipalName ::=   SEQUENCE {
+**      name-type[0]                  INTEGER,
+**      name-string[1]                SEQUENCE OF GeneralString
+**  }
 */
-typedef	struct	krb5_princname_st
-	{
-	ASN1_INTEGER			*nametype;
-	STACK_OF(ASN1_GENERALSTRING)	*namestring;
-	}	KRB5_PRINCNAME;
+typedef struct  krb5_princname_st
+    {
+    ASN1_INTEGER            *nametype;
+    STACK_OF(ASN1_GENERALSTRING)    *namestring;
+    }   KRB5_PRINCNAME;
 
 DECLARE_STACK_OF(KRB5_PRINCNAME)
 
 
-/*	Ticket ::=	[APPLICATION 1] SEQUENCE {
-**		tkt-vno[0]                    INTEGER,
-**		realm[1]                      Realm,
-**		sname[2]                      PrincipalName,
-**		enc-part[3]                   EncryptedData
-**	}
+/*  Ticket ::=  [APPLICATION 1] SEQUENCE {
+**      tkt-vno[0]                    INTEGER,
+**      realm[1]                      Realm,
+**      sname[2]                      PrincipalName,
+**      enc-part[3]                   EncryptedData
+**  }
 */
-typedef	struct	krb5_tktbody_st
-	{
-	ASN1_INTEGER			*tktvno;
-	ASN1_GENERALSTRING		*realm;
-	KRB5_PRINCNAME			*sname;
-	KRB5_ENCDATA			*encdata;
-	}	KRB5_TKTBODY;
+typedef struct  krb5_tktbody_st
+    {
+    ASN1_INTEGER            *tktvno;
+    ASN1_GENERALSTRING      *realm;
+    KRB5_PRINCNAME          *sname;
+    KRB5_ENCDATA            *encdata;
+    }   KRB5_TKTBODY;
 
 typedef STACK_OF(KRB5_TKTBODY) KRB5_TICKET;
 DECLARE_STACK_OF(KRB5_TKTBODY)
 
 
-/*	AP-REQ ::=      [APPLICATION 14] SEQUENCE {
-**		pvno[0]                       INTEGER,
-**		msg-type[1]                   INTEGER,
-**		ap-options[2]                 APOptions,
-**		ticket[3]                     Ticket,
-**		authenticator[4]              EncryptedData
-**	}
+/*  AP-REQ ::=      [APPLICATION 14] SEQUENCE {
+**      pvno[0]                       INTEGER,
+**      msg-type[1]                   INTEGER,
+**      ap-options[2]                 APOptions,
+**      ticket[3]                     Ticket,
+**      authenticator[4]              EncryptedData
+**  }
 **
-**	APOptions ::=   BIT STRING {
-**		reserved(0), use-session-key(1), mutual-required(2) }
+**  APOptions ::=   BIT STRING {
+**      reserved(0), use-session-key(1), mutual-required(2) }
 */
-typedef	struct	krb5_ap_req_st
-	{
-	ASN1_INTEGER			*pvno;
-	ASN1_INTEGER			*msgtype;
-	ASN1_BIT_STRING			*apoptions;
-	KRB5_TICKET			*ticket;
-	KRB5_ENCDATA			*authenticator;
-	}	KRB5_APREQBODY;
+typedef struct  krb5_ap_req_st
+    {
+    ASN1_INTEGER            *pvno;
+    ASN1_INTEGER            *msgtype;
+    ASN1_BIT_STRING         *apoptions;
+    KRB5_TICKET         *ticket;
+    KRB5_ENCDATA            *authenticator;
+    }   KRB5_APREQBODY;
 
 typedef STACK_OF(KRB5_APREQBODY) KRB5_APREQ;
 DECLARE_STACK_OF(KRB5_APREQBODY)
 
 
-/*	Authenticator Stuff	*/
+/*  Authenticator Stuff */
 
 
-/*	Checksum ::=   SEQUENCE {
-**		cksumtype[0]                  INTEGER,
-**		checksum[1]                   OCTET STRING
-**	}
+/*  Checksum ::=   SEQUENCE {
+**      cksumtype[0]                  INTEGER,
+**      checksum[1]                   OCTET STRING
+**  }
 */
-typedef	struct	krb5_checksum_st
-	{
-	ASN1_INTEGER			*ctype;
-	ASN1_OCTET_STRING		*checksum;
-	}	KRB5_CHECKSUM;
+typedef struct  krb5_checksum_st
+    {
+    ASN1_INTEGER            *ctype;
+    ASN1_OCTET_STRING       *checksum;
+    }   KRB5_CHECKSUM;
 
 DECLARE_STACK_OF(KRB5_CHECKSUM)
 
 
-/*	EncryptionKey ::=   SEQUENCE {
-**		keytype[0]                    INTEGER,
-**		keyvalue[1]                   OCTET STRING
-**	}
+/*  EncryptionKey ::=   SEQUENCE {
+**      keytype[0]                    INTEGER,
+**      keyvalue[1]                   OCTET STRING
+**  }
 */
 typedef struct  krb5_encryptionkey_st
-	{
-	ASN1_INTEGER			*ktype;
-	ASN1_OCTET_STRING		*keyvalue;
-	}	KRB5_ENCKEY;
+    {
+    ASN1_INTEGER            *ktype;
+    ASN1_OCTET_STRING       *keyvalue;
+    }   KRB5_ENCKEY;
 
 DECLARE_STACK_OF(KRB5_ENCKEY)
 
 
-/*	AuthorizationData ::=   SEQUENCE OF SEQUENCE {
-**		ad-type[0]                    INTEGER,
+/*  AuthorizationData ::=   SEQUENCE OF SEQUENCE {
+**      ad-type[0]                    INTEGER,
 **              ad-data[1]                    OCTET STRING
-**	}
+**  }
 */
-typedef struct	krb5_authorization_st
-	{
-	ASN1_INTEGER			*adtype;
-	ASN1_OCTET_STRING		*addata;
-	}	KRB5_AUTHDATA;
+typedef struct  krb5_authorization_st
+    {
+    ASN1_INTEGER            *adtype;
+    ASN1_OCTET_STRING       *addata;
+    }   KRB5_AUTHDATA;
 
 DECLARE_STACK_OF(KRB5_AUTHDATA)
 
-			
-/*	-- Unencrypted authenticator
-**	Authenticator ::=    [APPLICATION 2] SEQUENCE    {
-**		authenticator-vno[0]          INTEGER,
-**		crealm[1]                     Realm,
-**		cname[2]                      PrincipalName,
-**		cksum[3]                      Checksum OPTIONAL,
-**		cusec[4]                      INTEGER,
-**		ctime[5]                      KerberosTime,
-**		subkey[6]                     EncryptionKey OPTIONAL,
-**		seq-number[7]                 INTEGER OPTIONAL,
-**		authorization-data[8]         AuthorizationData OPTIONAL
-**	}
+
+/*  -- Unencrypted authenticator
+**  Authenticator ::=    [APPLICATION 2] SEQUENCE    {
+**      authenticator-vno[0]          INTEGER,
+**      crealm[1]                     Realm,
+**      cname[2]                      PrincipalName,
+**      cksum[3]                      Checksum OPTIONAL,
+**      cusec[4]                      INTEGER,
+**      ctime[5]                      KerberosTime,
+**      subkey[6]                     EncryptionKey OPTIONAL,
+**      seq-number[7]                 INTEGER OPTIONAL,
+**      authorization-data[8]         AuthorizationData OPTIONAL
+**  }
 */
-typedef struct	krb5_authenticator_st
-	{
-	ASN1_INTEGER			*avno;
-	ASN1_GENERALSTRING		*crealm;
-	KRB5_PRINCNAME			*cname;
-	KRB5_CHECKSUM			*cksum;
-	ASN1_INTEGER			*cusec;
-	ASN1_GENERALIZEDTIME		*ctime;
-	KRB5_ENCKEY			*subkey;
-	ASN1_INTEGER			*seqnum;
-	KRB5_AUTHDATA			*authorization;
-	}	KRB5_AUTHENTBODY;
+typedef struct  krb5_authenticator_st
+    {
+    ASN1_INTEGER            *avno;
+    ASN1_GENERALSTRING      *crealm;
+    KRB5_PRINCNAME          *cname;
+    KRB5_CHECKSUM           *cksum;
+    ASN1_INTEGER            *cusec;
+    ASN1_GENERALIZEDTIME        *ctime;
+    KRB5_ENCKEY         *subkey;
+    ASN1_INTEGER            *seqnum;
+    KRB5_AUTHDATA           *authorization;
+    }   KRB5_AUTHENTBODY;
 
 typedef STACK_OF(KRB5_AUTHENTBODY) KRB5_AUTHENT;
 DECLARE_STACK_OF(KRB5_AUTHENTBODY)
 
 
 /*  DECLARE_ASN1_FUNCTIONS(type) = DECLARE_ASN1_FUNCTIONS_name(type, type) =
-**	type *name##_new(void);
-**	void name##_free(type *a);
-**	DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) =
-**	 DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) =
-**	  type *d2i_##name(type **a, const unsigned char **in, long len);
-**	  int i2d_##name(type *a, unsigned char **out);
-**	  DECLARE_ASN1_ITEM(itname) = OPENSSL_EXTERN const ASN1_ITEM itname##_it
+**  type *name##_new(void);
+**  void name##_free(type *a);
+**  DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) =
+**   DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) =
+**    type *d2i_##name(type **a, const unsigned char **in, long len);
+**    int i2d_##name(type *a, unsigned char **out);
+**    DECLARE_ASN1_ITEM(itname) = OPENSSL_EXTERN const ASN1_ITEM itname##_it
 */
 
 DECLARE_ASN1_FUNCTIONS(KRB5_ENCDATA)
diff --git a/dep/include/openssl/kssl.h b/dep/include/openssl/kssl.h
index a3d20e1ccbd..de1f8f04d01 100644
--- a/dep/include/openssl/kssl.h
+++ b/dep/include/openssl/kssl.h
@@ -10,7 +10,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -57,11 +57,11 @@
  */
 
 /*
-**	19990701	VRS 	Started.
+**  19990701    VRS     Started.
 */
 
-#ifndef	KSSL_H
-#define	KSSL_H
+#ifndef KSSL_H
+#define KSSL_H
 
 #include 
 
@@ -76,8 +76,8 @@ extern "C" {
 #endif
 
 /*
-**	Depending on which KRB5 implementation used, some types from
-**	the other may be missing.  Resolve that here and now
+**  Depending on which KRB5 implementation used, some types from
+**  the other may be missing.  Resolve that here and now
 */
 #ifdef KRB5_HEIMDAL
 typedef unsigned char krb5_octet;
@@ -90,64 +90,64 @@ typedef unsigned char krb5_octet;
 
 #endif
 
-/*	Uncomment this to debug kssl problems or
-**	to trace usage of the Kerberos session key
+/*  Uncomment this to debug kssl problems or
+**  to trace usage of the Kerberos session key
 **
-**	#define		KSSL_DEBUG
+**  #define     KSSL_DEBUG
 */
 
-#ifndef	KRB5SVC
-#define KRB5SVC	"host"
+#ifndef KRB5SVC
+#define KRB5SVC "host"
 #endif
 
-#ifndef	KRB5KEYTAB
-#define KRB5KEYTAB	"/etc/krb5.keytab"
+#ifndef KRB5KEYTAB
+#define KRB5KEYTAB  "/etc/krb5.keytab"
 #endif
 
 #ifndef KRB5SENDAUTH
-#define KRB5SENDAUTH	1
+#define KRB5SENDAUTH    1
 #endif
 
 #ifndef KRB5CHECKAUTH
-#define KRB5CHECKAUTH	1
+#define KRB5CHECKAUTH   1
 #endif
 
 #ifndef KSSL_CLOCKSKEW
-#define	KSSL_CLOCKSKEW	300;
+#define KSSL_CLOCKSKEW  300;
 #endif
 
-#define	KSSL_ERR_MAX	255
+#define KSSL_ERR_MAX    255
 typedef struct kssl_err_st  {
-	int  reason;
-	char text[KSSL_ERR_MAX+1];
-	} KSSL_ERR;
+    int  reason;
+    char text[KSSL_ERR_MAX+1];
+    } KSSL_ERR;
 
 
-/*	Context for passing
-**		(1) Kerberos session key to SSL, and
-**		(2)	Config data between application and SSL lib
+/*  Context for passing
+**      (1) Kerberos session key to SSL, and
+**      (2) Config data between application and SSL lib
 */
 typedef struct kssl_ctx_st
         {
-                                /*	used by:    disposition:            */
-	char *service_name;	/*	C,S	    default ok (kssl)       */
-	char *service_host;	/*	C	    input, REQUIRED         */
-	char *client_princ;	/*	S	    output from krb5 ticket */
-	char *keytab_file;	/*      S	    NULL (/etc/krb5.keytab) */
-	char *cred_cache;	/*	C	    NULL (default)          */
-	krb5_enctype enctype;
-	int length;
-	krb5_octet FAR *key;
-	} KSSL_CTX;
+                                /*  used by:    disposition:            */
+    char *service_name; /*  C,S     default ok (kssl)       */
+    char *service_host; /*  C       input, REQUIRED         */
+    char *client_princ; /*  S       output from krb5 ticket */
+    char *keytab_file;  /*      S       NULL (/etc/krb5.keytab) */
+    char *cred_cache;   /*  C       NULL (default)          */
+    krb5_enctype enctype;
+    int length;
+    krb5_octet FAR *key;
+    } KSSL_CTX;
 
-#define	KSSL_CLIENT 	1
-#define KSSL_SERVER 	2
-#define	KSSL_SERVICE	3
-#define	KSSL_KEYTAB 	4
+#define KSSL_CLIENT     1
+#define KSSL_SERVER     2
+#define KSSL_SERVICE    3
+#define KSSL_KEYTAB     4
 
-#define KSSL_CTX_OK 	0
-#define KSSL_CTX_ERR	1
-#define KSSL_NOMEM	2
+#define KSSL_CTX_OK     0
+#define KSSL_CTX_ERR    1
+#define KSSL_NOMEM  2
 
 /* Public (for use by applications that use OpenSSL with Kerberos 5 support */
 krb5_error_code kssl_ctx_setstring(KSSL_CTX *kssl_ctx, int which, char *text);
@@ -156,24 +156,24 @@ KSSL_CTX *kssl_ctx_free(KSSL_CTX *kssl_ctx);
 void kssl_ctx_show(KSSL_CTX *kssl_ctx);
 krb5_error_code kssl_ctx_setprinc(KSSL_CTX *kssl_ctx, int which,
         krb5_data *realm, krb5_data *entity, int nentities);
-krb5_error_code	kssl_cget_tkt(KSSL_CTX *kssl_ctx,  krb5_data **enc_tktp,
+krb5_error_code kssl_cget_tkt(KSSL_CTX *kssl_ctx,  krb5_data **enc_tktp,
         krb5_data *authenp, KSSL_ERR *kssl_err);
-krb5_error_code	kssl_sget_tkt(KSSL_CTX *kssl_ctx,  krb5_data *indata,
+krb5_error_code kssl_sget_tkt(KSSL_CTX *kssl_ctx,  krb5_data *indata,
         krb5_ticket_times *ttimes, KSSL_ERR *kssl_err);
 krb5_error_code kssl_ctx_setkey(KSSL_CTX *kssl_ctx, krb5_keyblock *session);
-void	kssl_err_set(KSSL_ERR *kssl_err, int reason, char *text);
+void    kssl_err_set(KSSL_ERR *kssl_err, int reason, char *text);
 void kssl_krb5_free_data_contents(krb5_context context, krb5_data *data);
 krb5_error_code  kssl_build_principal_2(krb5_context context,
-			krb5_principal *princ, int rlen, const char *realm,
-			int slen, const char *svc, int hlen, const char *host);
+            krb5_principal *princ, int rlen, const char *realm,
+            int slen, const char *svc, int hlen, const char *host);
 krb5_error_code  kssl_validate_times(krb5_timestamp atime,
-					krb5_ticket_times *ttimes);
+                    krb5_ticket_times *ttimes);
 krb5_error_code  kssl_check_authent(KSSL_CTX *kssl_ctx, krb5_data *authentp,
-			            krb5_timestamp *atimep, KSSL_ERR *kssl_err);
-unsigned char	*kssl_skip_confound(krb5_enctype enctype, unsigned char *authn);
+                        krb5_timestamp *atimep, KSSL_ERR *kssl_err);
+unsigned char   *kssl_skip_confound(krb5_enctype enctype, unsigned char *authn);
 
 #ifdef  __cplusplus
 }
 #endif
-#endif	/* OPENSSL_NO_KRB5	*/
-#endif	/* KSSL_H 	*/
+#endif  /* OPENSSL_NO_KRB5  */
+#endif  /* KSSL_H   */
diff --git a/dep/include/openssl/lhash.h b/dep/include/openssl/lhash.h
index d392d0cd80d..4d8fe1952dd 100644
--- a/dep/include/openssl/lhash.h
+++ b/dep/include/openssl/lhash.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -77,13 +77,13 @@ extern "C" {
 #endif
 
 typedef struct lhash_node_st
-	{
-	void *data;
-	struct lhash_node_st *next;
+    {
+    void *data;
+    struct lhash_node_st *next;
 #ifndef OPENSSL_NO_HASH_COMP
-	unsigned long hash;
+    unsigned long hash;
 #endif
-	} LHASH_NODE;
+    } LHASH_NODE;
 
 typedef int (*LHASH_COMP_FN_TYPE)(const void *, const void *);
 typedef unsigned long (*LHASH_HASH_FN_TYPE)(const void *);
@@ -99,77 +99,77 @@ typedef void (*LHASH_DOALL_ARG_FN_TYPE)(void *, void *);
 
 /* First: "hash" functions */
 #define DECLARE_LHASH_HASH_FN(f_name,o_type) \
-	unsigned long f_name##_LHASH_HASH(const void *);
+    unsigned long f_name##_LHASH_HASH(const void *);
 #define IMPLEMENT_LHASH_HASH_FN(f_name,o_type) \
-	unsigned long f_name##_LHASH_HASH(const void *arg) { \
-		o_type a = (o_type)arg; \
-		return f_name(a); }
+    unsigned long f_name##_LHASH_HASH(const void *arg) { \
+        o_type a = (o_type)arg; \
+        return f_name(a); }
 #define LHASH_HASH_FN(f_name) f_name##_LHASH_HASH
 
 /* Second: "compare" functions */
 #define DECLARE_LHASH_COMP_FN(f_name,o_type) \
-	int f_name##_LHASH_COMP(const void *, const void *);
+    int f_name##_LHASH_COMP(const void *, const void *);
 #define IMPLEMENT_LHASH_COMP_FN(f_name,o_type) \
-	int f_name##_LHASH_COMP(const void *arg1, const void *arg2) { \
-		o_type a = (o_type)arg1; \
-		o_type b = (o_type)arg2; \
-		return f_name(a,b); }
+    int f_name##_LHASH_COMP(const void *arg1, const void *arg2) { \
+        o_type a = (o_type)arg1; \
+        o_type b = (o_type)arg2; \
+        return f_name(a,b); }
 #define LHASH_COMP_FN(f_name) f_name##_LHASH_COMP
 
 /* Third: "doall" functions */
 #define DECLARE_LHASH_DOALL_FN(f_name,o_type) \
-	void f_name##_LHASH_DOALL(void *);
+    void f_name##_LHASH_DOALL(void *);
 #define IMPLEMENT_LHASH_DOALL_FN(f_name,o_type) \
-	void f_name##_LHASH_DOALL(void *arg) { \
-		o_type a = (o_type)arg; \
-		f_name(a); }
+    void f_name##_LHASH_DOALL(void *arg) { \
+        o_type a = (o_type)arg; \
+        f_name(a); }
 #define LHASH_DOALL_FN(f_name) f_name##_LHASH_DOALL
 
 /* Fourth: "doall_arg" functions */
 #define DECLARE_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \
-	void f_name##_LHASH_DOALL_ARG(void *, void *);
+    void f_name##_LHASH_DOALL_ARG(void *, void *);
 #define IMPLEMENT_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \
-	void f_name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \
-		o_type a = (o_type)arg1; \
-		a_type b = (a_type)arg2; \
-		f_name(a,b); }
+    void f_name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \
+        o_type a = (o_type)arg1; \
+        a_type b = (a_type)arg2; \
+        f_name(a,b); }
 #define LHASH_DOALL_ARG_FN(f_name) f_name##_LHASH_DOALL_ARG
 
 typedef struct lhash_st
-	{
-	LHASH_NODE **b;
-	LHASH_COMP_FN_TYPE comp;
-	LHASH_HASH_FN_TYPE hash;
-	unsigned int num_nodes;
-	unsigned int num_alloc_nodes;
-	unsigned int p;
-	unsigned int pmax;
-	unsigned long up_load; /* load times 256 */
-	unsigned long down_load; /* load times 256 */
-	unsigned long num_items;
+    {
+    LHASH_NODE **b;
+    LHASH_COMP_FN_TYPE comp;
+    LHASH_HASH_FN_TYPE hash;
+    unsigned int num_nodes;
+    unsigned int num_alloc_nodes;
+    unsigned int p;
+    unsigned int pmax;
+    unsigned long up_load; /* load times 256 */
+    unsigned long down_load; /* load times 256 */
+    unsigned long num_items;
 
-	unsigned long num_expands;
-	unsigned long num_expand_reallocs;
-	unsigned long num_contracts;
-	unsigned long num_contract_reallocs;
-	unsigned long num_hash_calls;
-	unsigned long num_comp_calls;
-	unsigned long num_insert;
-	unsigned long num_replace;
-	unsigned long num_delete;
-	unsigned long num_no_delete;
-	unsigned long num_retrieve;
-	unsigned long num_retrieve_miss;
-	unsigned long num_hash_comps;
+    unsigned long num_expands;
+    unsigned long num_expand_reallocs;
+    unsigned long num_contracts;
+    unsigned long num_contract_reallocs;
+    unsigned long num_hash_calls;
+    unsigned long num_comp_calls;
+    unsigned long num_insert;
+    unsigned long num_replace;
+    unsigned long num_delete;
+    unsigned long num_no_delete;
+    unsigned long num_retrieve;
+    unsigned long num_retrieve_miss;
+    unsigned long num_hash_comps;
 
-	int error;
-	} LHASH;
+    int error;
+    } LHASH;
 
-#define LH_LOAD_MULT	256
+#define LH_LOAD_MULT    256
 
 /* Indicates a malloc() error in the last call, this is only bad
  * in lh_insert(). */
-#define lh_error(lh)	((lh)->error)
+#define lh_error(lh)    ((lh)->error)
 
 LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c);
 void lh_free(LHASH *lh);
diff --git a/dep/include/openssl/md2.h b/dep/include/openssl/md2.h
index a46120e7d41..670a0be8bc6 100644
--- a/dep/include/openssl/md2.h
+++ b/dep/include/openssl/md2.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -65,20 +65,20 @@
 #endif
 #include 
 
-#define MD2_DIGEST_LENGTH	16
-#define MD2_BLOCK       	16
+#define MD2_DIGEST_LENGTH   16
+#define MD2_BLOCK           16
 
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
 typedef struct MD2state_st
-	{
-	unsigned int num;
-	unsigned char data[MD2_BLOCK];
-	MD2_INT cksm[MD2_BLOCK];
-	MD2_INT state[MD2_BLOCK];
-	} MD2_CTX;
+    {
+    unsigned int num;
+    unsigned char data[MD2_BLOCK];
+    MD2_INT cksm[MD2_BLOCK];
+    MD2_INT state[MD2_BLOCK];
+    } MD2_CTX;
 
 const char *MD2_options(void);
 int MD2_Init(MD2_CTX *c);
diff --git a/dep/include/openssl/md4.h b/dep/include/openssl/md4.h
index 5598c93a4fe..22f11ad0f31 100644
--- a/dep/include/openssl/md4.h
+++ b/dep/include/openssl/md4.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -73,7 +73,7 @@ extern "C" {
 /*
  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  * ! MD4_LONG has to be at least 32 bits wide. If it's wider, then !
- * ! MD4_LONG_LOG2 has to be defined along.			   !
+ * ! MD4_LONG_LOG2 has to be defined along.            !
  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  */
 
@@ -87,23 +87,23 @@ extern "C" {
  * does it have on performance on none-T3E machines. I could declare
  * int, but at least on C90 sizeof(int) can be chosen at compile time.
  * So I've chosen long...
- *					
+ *                  
  */
 #else
 #define MD4_LONG unsigned int
 #endif
 
-#define MD4_CBLOCK	64
-#define MD4_LBLOCK	(MD4_CBLOCK/4)
+#define MD4_CBLOCK  64
+#define MD4_LBLOCK  (MD4_CBLOCK/4)
 #define MD4_DIGEST_LENGTH 16
 
 typedef struct MD4state_st
-	{
-	MD4_LONG A,B,C,D;
-	MD4_LONG Nl,Nh;
-	MD4_LONG data[MD4_LBLOCK];
-	unsigned int num;
-	} MD4_CTX;
+    {
+    MD4_LONG A,B,C,D;
+    MD4_LONG Nl,Nh;
+    MD4_LONG data[MD4_LBLOCK];
+    unsigned int num;
+    } MD4_CTX;
 
 int MD4_Init(MD4_CTX *c);
 int MD4_Update(MD4_CTX *c, const void *data, size_t len);
diff --git a/dep/include/openssl/md5.h b/dep/include/openssl/md5.h
index dbdc0e1abc7..502be116801 100644
--- a/dep/include/openssl/md5.h
+++ b/dep/include/openssl/md5.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -73,7 +73,7 @@ extern "C" {
 /*
  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  * ! MD5_LONG has to be at least 32 bits wide. If it's wider, then !
- * ! MD5_LONG_LOG2 has to be defined along.			   !
+ * ! MD5_LONG_LOG2 has to be defined along.            !
  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  */
 
@@ -87,23 +87,23 @@ extern "C" {
  * does it have on performance on none-T3E machines. I could declare
  * int, but at least on C90 sizeof(int) can be chosen at compile time.
  * So I've chosen long...
- *					
+ *                  
  */
 #else
 #define MD5_LONG unsigned int
 #endif
 
-#define MD5_CBLOCK	64
-#define MD5_LBLOCK	(MD5_CBLOCK/4)
+#define MD5_CBLOCK  64
+#define MD5_LBLOCK  (MD5_CBLOCK/4)
 #define MD5_DIGEST_LENGTH 16
 
 typedef struct MD5state_st
-	{
-	MD5_LONG A,B,C,D;
-	MD5_LONG Nl,Nh;
-	MD5_LONG data[MD5_LBLOCK];
-	unsigned int num;
-	} MD5_CTX;
+    {
+    MD5_LONG A,B,C,D;
+    MD5_LONG Nl,Nh;
+    MD5_LONG data[MD5_LBLOCK];
+    unsigned int num;
+    } MD5_CTX;
 
 int MD5_Init(MD5_CTX *c);
 int MD5_Update(MD5_CTX *c, const void *data, size_t len);
diff --git a/dep/include/openssl/mdc2.h b/dep/include/openssl/mdc2.h
index e5ba226cae8..1bab9a6abab 100644
--- a/dep/include/openssl/mdc2.h
+++ b/dep/include/openssl/mdc2.h
@@ -73,19 +73,19 @@ extern "C" {
 #define MDC2_DIGEST_LENGTH      16
 
 typedef struct mdc2_ctx_st
-	{
-	int num;
-	unsigned char data[MDC2_BLOCK];
-	DES_cblock h,hh;
-	int pad_type; /* either 1 or 2, default 1 */
-	} MDC2_CTX;
+    {
+    int num;
+    unsigned char data[MDC2_BLOCK];
+    DES_cblock h,hh;
+    int pad_type; /* either 1 or 2, default 1 */
+    } MDC2_CTX;
 
 
 int MDC2_Init(MDC2_CTX *c);
 int MDC2_Update(MDC2_CTX *c, const unsigned char *data, unsigned long len);
 int MDC2_Final(unsigned char *md, MDC2_CTX *c);
 unsigned char *MDC2(const unsigned char *d, unsigned long n,
-	unsigned char *md);
+    unsigned char *md);
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/obj_mac.h b/dep/include/openssl/obj_mac.h
index f447bbe69af..0394cff616d 100644
--- a/dep/include/openssl/obj_mac.h
+++ b/dep/include/openssl/obj_mac.h
@@ -11,21 +11,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -40,10 +40,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -55,3354 +55,3354 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
  * [including the GNU Public Licence.]
  */
 
-#define SN_undef			"UNDEF"
-#define LN_undef			"undefined"
-#define NID_undef			0
-#define OBJ_undef			0L
-
-#define SN_itu_t		"ITU-T"
-#define LN_itu_t		"itu-t"
-#define NID_itu_t		645
-#define OBJ_itu_t		0L
-
-#define NID_ccitt		404
-#define OBJ_ccitt		OBJ_itu_t
-
-#define SN_iso		"ISO"
-#define LN_iso		"iso"
-#define NID_iso		181
-#define OBJ_iso		1L
-
-#define SN_joint_iso_itu_t		"JOINT-ISO-ITU-T"
-#define LN_joint_iso_itu_t		"joint-iso-itu-t"
-#define NID_joint_iso_itu_t		646
-#define OBJ_joint_iso_itu_t		2L
-
-#define NID_joint_iso_ccitt		393
-#define OBJ_joint_iso_ccitt		OBJ_joint_iso_itu_t
-
-#define SN_member_body		"member-body"
-#define LN_member_body		"ISO Member Body"
-#define NID_member_body		182
-#define OBJ_member_body		OBJ_iso,2L
+#define SN_undef            "UNDEF"
+#define LN_undef            "undefined"
+#define NID_undef           0
+#define OBJ_undef           0L
+
+#define SN_itu_t        "ITU-T"
+#define LN_itu_t        "itu-t"
+#define NID_itu_t       645
+#define OBJ_itu_t       0L
+
+#define NID_ccitt       404
+#define OBJ_ccitt       OBJ_itu_t
+
+#define SN_iso      "ISO"
+#define LN_iso      "iso"
+#define NID_iso     181
+#define OBJ_iso     1L
+
+#define SN_joint_iso_itu_t      "JOINT-ISO-ITU-T"
+#define LN_joint_iso_itu_t      "joint-iso-itu-t"
+#define NID_joint_iso_itu_t     646
+#define OBJ_joint_iso_itu_t     2L
+
+#define NID_joint_iso_ccitt     393
+#define OBJ_joint_iso_ccitt     OBJ_joint_iso_itu_t
+
+#define SN_member_body      "member-body"
+#define LN_member_body      "ISO Member Body"
+#define NID_member_body     182
+#define OBJ_member_body     OBJ_iso,2L
 
-#define SN_identified_organization		"identified-organization"
-#define NID_identified_organization		676
-#define OBJ_identified_organization		OBJ_iso,3L
+#define SN_identified_organization      "identified-organization"
+#define NID_identified_organization     676
+#define OBJ_identified_organization     OBJ_iso,3L
 
-#define SN_certicom_arc		"certicom-arc"
-#define NID_certicom_arc		677
-#define OBJ_certicom_arc		OBJ_identified_organization,132L
+#define SN_certicom_arc     "certicom-arc"
+#define NID_certicom_arc        677
+#define OBJ_certicom_arc        OBJ_identified_organization,132L
 
-#define SN_international_organizations		"international-organizations"
-#define LN_international_organizations		"International Organizations"
-#define NID_international_organizations		647
-#define OBJ_international_organizations		OBJ_joint_iso_itu_t,23L
-
-#define SN_wap		"wap"
-#define NID_wap		678
-#define OBJ_wap		OBJ_international_organizations,43L
-
-#define SN_wap_wsg		"wap-wsg"
-#define NID_wap_wsg		679
-#define OBJ_wap_wsg		OBJ_wap,13L
-
-#define SN_selected_attribute_types		"selected-attribute-types"
-#define LN_selected_attribute_types		"Selected Attribute Types"
-#define NID_selected_attribute_types		394
-#define OBJ_selected_attribute_types		OBJ_joint_iso_itu_t,5L,1L,5L
-
-#define SN_clearance		"clearance"
-#define NID_clearance		395
-#define OBJ_clearance		OBJ_selected_attribute_types,55L
-
-#define SN_ISO_US		"ISO-US"
-#define LN_ISO_US		"ISO US Member Body"
-#define NID_ISO_US		183
-#define OBJ_ISO_US		OBJ_member_body,840L
-
-#define SN_X9_57		"X9-57"
-#define LN_X9_57		"X9.57"
-#define NID_X9_57		184
-#define OBJ_X9_57		OBJ_ISO_US,10040L
+#define SN_international_organizations      "international-organizations"
+#define LN_international_organizations      "International Organizations"
+#define NID_international_organizations     647
+#define OBJ_international_organizations     OBJ_joint_iso_itu_t,23L
+
+#define SN_wap      "wap"
+#define NID_wap     678
+#define OBJ_wap     OBJ_international_organizations,43L
+
+#define SN_wap_wsg      "wap-wsg"
+#define NID_wap_wsg     679
+#define OBJ_wap_wsg     OBJ_wap,13L
+
+#define SN_selected_attribute_types     "selected-attribute-types"
+#define LN_selected_attribute_types     "Selected Attribute Types"
+#define NID_selected_attribute_types        394
+#define OBJ_selected_attribute_types        OBJ_joint_iso_itu_t,5L,1L,5L
+
+#define SN_clearance        "clearance"
+#define NID_clearance       395
+#define OBJ_clearance       OBJ_selected_attribute_types,55L
+
+#define SN_ISO_US       "ISO-US"
+#define LN_ISO_US       "ISO US Member Body"
+#define NID_ISO_US      183
+#define OBJ_ISO_US      OBJ_member_body,840L
+
+#define SN_X9_57        "X9-57"
+#define LN_X9_57        "X9.57"
+#define NID_X9_57       184
+#define OBJ_X9_57       OBJ_ISO_US,10040L
 
-#define SN_X9cm		"X9cm"
-#define LN_X9cm		"X9.57 CM ?"
-#define NID_X9cm		185
-#define OBJ_X9cm		OBJ_X9_57,4L
-
-#define SN_dsa		"DSA"
-#define LN_dsa		"dsaEncryption"
-#define NID_dsa		116
-#define OBJ_dsa		OBJ_X9cm,1L
-
-#define SN_dsaWithSHA1		"DSA-SHA1"
-#define LN_dsaWithSHA1		"dsaWithSHA1"
-#define NID_dsaWithSHA1		113
-#define OBJ_dsaWithSHA1		OBJ_X9cm,3L
-
-#define SN_ansi_X9_62		"ansi-X9-62"
-#define LN_ansi_X9_62		"ANSI X9.62"
-#define NID_ansi_X9_62		405
-#define OBJ_ansi_X9_62		OBJ_ISO_US,10045L
+#define SN_X9cm     "X9cm"
+#define LN_X9cm     "X9.57 CM ?"
+#define NID_X9cm        185
+#define OBJ_X9cm        OBJ_X9_57,4L
+
+#define SN_dsa      "DSA"
+#define LN_dsa      "dsaEncryption"
+#define NID_dsa     116
+#define OBJ_dsa     OBJ_X9cm,1L
+
+#define SN_dsaWithSHA1      "DSA-SHA1"
+#define LN_dsaWithSHA1      "dsaWithSHA1"
+#define NID_dsaWithSHA1     113
+#define OBJ_dsaWithSHA1     OBJ_X9cm,3L
+
+#define SN_ansi_X9_62       "ansi-X9-62"
+#define LN_ansi_X9_62       "ANSI X9.62"
+#define NID_ansi_X9_62      405
+#define OBJ_ansi_X9_62      OBJ_ISO_US,10045L
 
-#define OBJ_X9_62_id_fieldType		OBJ_ansi_X9_62,1L
-
-#define SN_X9_62_prime_field		"prime-field"
-#define NID_X9_62_prime_field		406
-#define OBJ_X9_62_prime_field		OBJ_X9_62_id_fieldType,1L
-
-#define SN_X9_62_characteristic_two_field		"characteristic-two-field"
-#define NID_X9_62_characteristic_two_field		407
-#define OBJ_X9_62_characteristic_two_field		OBJ_X9_62_id_fieldType,2L
-
-#define SN_X9_62_id_characteristic_two_basis		"id-characteristic-two-basis"
-#define NID_X9_62_id_characteristic_two_basis		680
-#define OBJ_X9_62_id_characteristic_two_basis		OBJ_X9_62_characteristic_two_field,3L
+#define OBJ_X9_62_id_fieldType      OBJ_ansi_X9_62,1L
+
+#define SN_X9_62_prime_field        "prime-field"
+#define NID_X9_62_prime_field       406
+#define OBJ_X9_62_prime_field       OBJ_X9_62_id_fieldType,1L
+
+#define SN_X9_62_characteristic_two_field       "characteristic-two-field"
+#define NID_X9_62_characteristic_two_field      407
+#define OBJ_X9_62_characteristic_two_field      OBJ_X9_62_id_fieldType,2L
+
+#define SN_X9_62_id_characteristic_two_basis        "id-characteristic-two-basis"
+#define NID_X9_62_id_characteristic_two_basis       680
+#define OBJ_X9_62_id_characteristic_two_basis       OBJ_X9_62_characteristic_two_field,3L
 
-#define SN_X9_62_onBasis		"onBasis"
-#define NID_X9_62_onBasis		681
-#define OBJ_X9_62_onBasis		OBJ_X9_62_id_characteristic_two_basis,1L
+#define SN_X9_62_onBasis        "onBasis"
+#define NID_X9_62_onBasis       681
+#define OBJ_X9_62_onBasis       OBJ_X9_62_id_characteristic_two_basis,1L
 
-#define SN_X9_62_tpBasis		"tpBasis"
-#define NID_X9_62_tpBasis		682
-#define OBJ_X9_62_tpBasis		OBJ_X9_62_id_characteristic_two_basis,2L
+#define SN_X9_62_tpBasis        "tpBasis"
+#define NID_X9_62_tpBasis       682
+#define OBJ_X9_62_tpBasis       OBJ_X9_62_id_characteristic_two_basis,2L
 
-#define SN_X9_62_ppBasis		"ppBasis"
-#define NID_X9_62_ppBasis		683
-#define OBJ_X9_62_ppBasis		OBJ_X9_62_id_characteristic_two_basis,3L
+#define SN_X9_62_ppBasis        "ppBasis"
+#define NID_X9_62_ppBasis       683
+#define OBJ_X9_62_ppBasis       OBJ_X9_62_id_characteristic_two_basis,3L
 
-#define OBJ_X9_62_id_publicKeyType		OBJ_ansi_X9_62,2L
+#define OBJ_X9_62_id_publicKeyType      OBJ_ansi_X9_62,2L
 
-#define SN_X9_62_id_ecPublicKey		"id-ecPublicKey"
-#define NID_X9_62_id_ecPublicKey		408
-#define OBJ_X9_62_id_ecPublicKey		OBJ_X9_62_id_publicKeyType,1L
+#define SN_X9_62_id_ecPublicKey     "id-ecPublicKey"
+#define NID_X9_62_id_ecPublicKey        408
+#define OBJ_X9_62_id_ecPublicKey        OBJ_X9_62_id_publicKeyType,1L
 
-#define OBJ_X9_62_ellipticCurve		OBJ_ansi_X9_62,3L
+#define OBJ_X9_62_ellipticCurve     OBJ_ansi_X9_62,3L
 
-#define OBJ_X9_62_c_TwoCurve		OBJ_X9_62_ellipticCurve,0L
+#define OBJ_X9_62_c_TwoCurve        OBJ_X9_62_ellipticCurve,0L
 
-#define SN_X9_62_c2pnb163v1		"c2pnb163v1"
-#define NID_X9_62_c2pnb163v1		684
-#define OBJ_X9_62_c2pnb163v1		OBJ_X9_62_c_TwoCurve,1L
+#define SN_X9_62_c2pnb163v1     "c2pnb163v1"
+#define NID_X9_62_c2pnb163v1        684
+#define OBJ_X9_62_c2pnb163v1        OBJ_X9_62_c_TwoCurve,1L
 
-#define SN_X9_62_c2pnb163v2		"c2pnb163v2"
-#define NID_X9_62_c2pnb163v2		685
-#define OBJ_X9_62_c2pnb163v2		OBJ_X9_62_c_TwoCurve,2L
+#define SN_X9_62_c2pnb163v2     "c2pnb163v2"
+#define NID_X9_62_c2pnb163v2        685
+#define OBJ_X9_62_c2pnb163v2        OBJ_X9_62_c_TwoCurve,2L
 
-#define SN_X9_62_c2pnb163v3		"c2pnb163v3"
-#define NID_X9_62_c2pnb163v3		686
-#define OBJ_X9_62_c2pnb163v3		OBJ_X9_62_c_TwoCurve,3L
+#define SN_X9_62_c2pnb163v3     "c2pnb163v3"
+#define NID_X9_62_c2pnb163v3        686
+#define OBJ_X9_62_c2pnb163v3        OBJ_X9_62_c_TwoCurve,3L
 
-#define SN_X9_62_c2pnb176v1		"c2pnb176v1"
-#define NID_X9_62_c2pnb176v1		687
-#define OBJ_X9_62_c2pnb176v1		OBJ_X9_62_c_TwoCurve,4L
+#define SN_X9_62_c2pnb176v1     "c2pnb176v1"
+#define NID_X9_62_c2pnb176v1        687
+#define OBJ_X9_62_c2pnb176v1        OBJ_X9_62_c_TwoCurve,4L
 
-#define SN_X9_62_c2tnb191v1		"c2tnb191v1"
-#define NID_X9_62_c2tnb191v1		688
-#define OBJ_X9_62_c2tnb191v1		OBJ_X9_62_c_TwoCurve,5L
+#define SN_X9_62_c2tnb191v1     "c2tnb191v1"
+#define NID_X9_62_c2tnb191v1        688
+#define OBJ_X9_62_c2tnb191v1        OBJ_X9_62_c_TwoCurve,5L
 
-#define SN_X9_62_c2tnb191v2		"c2tnb191v2"
-#define NID_X9_62_c2tnb191v2		689
-#define OBJ_X9_62_c2tnb191v2		OBJ_X9_62_c_TwoCurve,6L
+#define SN_X9_62_c2tnb191v2     "c2tnb191v2"
+#define NID_X9_62_c2tnb191v2        689
+#define OBJ_X9_62_c2tnb191v2        OBJ_X9_62_c_TwoCurve,6L
 
-#define SN_X9_62_c2tnb191v3		"c2tnb191v3"
-#define NID_X9_62_c2tnb191v3		690
-#define OBJ_X9_62_c2tnb191v3		OBJ_X9_62_c_TwoCurve,7L
+#define SN_X9_62_c2tnb191v3     "c2tnb191v3"
+#define NID_X9_62_c2tnb191v3        690
+#define OBJ_X9_62_c2tnb191v3        OBJ_X9_62_c_TwoCurve,7L
 
-#define SN_X9_62_c2onb191v4		"c2onb191v4"
-#define NID_X9_62_c2onb191v4		691
-#define OBJ_X9_62_c2onb191v4		OBJ_X9_62_c_TwoCurve,8L
+#define SN_X9_62_c2onb191v4     "c2onb191v4"
+#define NID_X9_62_c2onb191v4        691
+#define OBJ_X9_62_c2onb191v4        OBJ_X9_62_c_TwoCurve,8L
 
-#define SN_X9_62_c2onb191v5		"c2onb191v5"
-#define NID_X9_62_c2onb191v5		692
-#define OBJ_X9_62_c2onb191v5		OBJ_X9_62_c_TwoCurve,9L
+#define SN_X9_62_c2onb191v5     "c2onb191v5"
+#define NID_X9_62_c2onb191v5        692
+#define OBJ_X9_62_c2onb191v5        OBJ_X9_62_c_TwoCurve,9L
 
-#define SN_X9_62_c2pnb208w1		"c2pnb208w1"
-#define NID_X9_62_c2pnb208w1		693
-#define OBJ_X9_62_c2pnb208w1		OBJ_X9_62_c_TwoCurve,10L
+#define SN_X9_62_c2pnb208w1     "c2pnb208w1"
+#define NID_X9_62_c2pnb208w1        693
+#define OBJ_X9_62_c2pnb208w1        OBJ_X9_62_c_TwoCurve,10L
 
-#define SN_X9_62_c2tnb239v1		"c2tnb239v1"
-#define NID_X9_62_c2tnb239v1		694
-#define OBJ_X9_62_c2tnb239v1		OBJ_X9_62_c_TwoCurve,11L
+#define SN_X9_62_c2tnb239v1     "c2tnb239v1"
+#define NID_X9_62_c2tnb239v1        694
+#define OBJ_X9_62_c2tnb239v1        OBJ_X9_62_c_TwoCurve,11L
 
-#define SN_X9_62_c2tnb239v2		"c2tnb239v2"
-#define NID_X9_62_c2tnb239v2		695
-#define OBJ_X9_62_c2tnb239v2		OBJ_X9_62_c_TwoCurve,12L
+#define SN_X9_62_c2tnb239v2     "c2tnb239v2"
+#define NID_X9_62_c2tnb239v2        695
+#define OBJ_X9_62_c2tnb239v2        OBJ_X9_62_c_TwoCurve,12L
 
-#define SN_X9_62_c2tnb239v3		"c2tnb239v3"
-#define NID_X9_62_c2tnb239v3		696
-#define OBJ_X9_62_c2tnb239v3		OBJ_X9_62_c_TwoCurve,13L
+#define SN_X9_62_c2tnb239v3     "c2tnb239v3"
+#define NID_X9_62_c2tnb239v3        696
+#define OBJ_X9_62_c2tnb239v3        OBJ_X9_62_c_TwoCurve,13L
 
-#define SN_X9_62_c2onb239v4		"c2onb239v4"
-#define NID_X9_62_c2onb239v4		697
-#define OBJ_X9_62_c2onb239v4		OBJ_X9_62_c_TwoCurve,14L
+#define SN_X9_62_c2onb239v4     "c2onb239v4"
+#define NID_X9_62_c2onb239v4        697
+#define OBJ_X9_62_c2onb239v4        OBJ_X9_62_c_TwoCurve,14L
 
-#define SN_X9_62_c2onb239v5		"c2onb239v5"
-#define NID_X9_62_c2onb239v5		698
-#define OBJ_X9_62_c2onb239v5		OBJ_X9_62_c_TwoCurve,15L
+#define SN_X9_62_c2onb239v5     "c2onb239v5"
+#define NID_X9_62_c2onb239v5        698
+#define OBJ_X9_62_c2onb239v5        OBJ_X9_62_c_TwoCurve,15L
 
-#define SN_X9_62_c2pnb272w1		"c2pnb272w1"
-#define NID_X9_62_c2pnb272w1		699
-#define OBJ_X9_62_c2pnb272w1		OBJ_X9_62_c_TwoCurve,16L
+#define SN_X9_62_c2pnb272w1     "c2pnb272w1"
+#define NID_X9_62_c2pnb272w1        699
+#define OBJ_X9_62_c2pnb272w1        OBJ_X9_62_c_TwoCurve,16L
 
-#define SN_X9_62_c2pnb304w1		"c2pnb304w1"
-#define NID_X9_62_c2pnb304w1		700
-#define OBJ_X9_62_c2pnb304w1		OBJ_X9_62_c_TwoCurve,17L
+#define SN_X9_62_c2pnb304w1     "c2pnb304w1"
+#define NID_X9_62_c2pnb304w1        700
+#define OBJ_X9_62_c2pnb304w1        OBJ_X9_62_c_TwoCurve,17L
 
-#define SN_X9_62_c2tnb359v1		"c2tnb359v1"
-#define NID_X9_62_c2tnb359v1		701
-#define OBJ_X9_62_c2tnb359v1		OBJ_X9_62_c_TwoCurve,18L
+#define SN_X9_62_c2tnb359v1     "c2tnb359v1"
+#define NID_X9_62_c2tnb359v1        701
+#define OBJ_X9_62_c2tnb359v1        OBJ_X9_62_c_TwoCurve,18L
 
-#define SN_X9_62_c2pnb368w1		"c2pnb368w1"
-#define NID_X9_62_c2pnb368w1		702
-#define OBJ_X9_62_c2pnb368w1		OBJ_X9_62_c_TwoCurve,19L
+#define SN_X9_62_c2pnb368w1     "c2pnb368w1"
+#define NID_X9_62_c2pnb368w1        702
+#define OBJ_X9_62_c2pnb368w1        OBJ_X9_62_c_TwoCurve,19L
 
-#define SN_X9_62_c2tnb431r1		"c2tnb431r1"
-#define NID_X9_62_c2tnb431r1		703
-#define OBJ_X9_62_c2tnb431r1		OBJ_X9_62_c_TwoCurve,20L
+#define SN_X9_62_c2tnb431r1     "c2tnb431r1"
+#define NID_X9_62_c2tnb431r1        703
+#define OBJ_X9_62_c2tnb431r1        OBJ_X9_62_c_TwoCurve,20L
 
-#define OBJ_X9_62_primeCurve		OBJ_X9_62_ellipticCurve,1L
+#define OBJ_X9_62_primeCurve        OBJ_X9_62_ellipticCurve,1L
 
-#define SN_X9_62_prime192v1		"prime192v1"
-#define NID_X9_62_prime192v1		409
-#define OBJ_X9_62_prime192v1		OBJ_X9_62_primeCurve,1L
+#define SN_X9_62_prime192v1     "prime192v1"
+#define NID_X9_62_prime192v1        409
+#define OBJ_X9_62_prime192v1        OBJ_X9_62_primeCurve,1L
 
-#define SN_X9_62_prime192v2		"prime192v2"
-#define NID_X9_62_prime192v2		410
-#define OBJ_X9_62_prime192v2		OBJ_X9_62_primeCurve,2L
+#define SN_X9_62_prime192v2     "prime192v2"
+#define NID_X9_62_prime192v2        410
+#define OBJ_X9_62_prime192v2        OBJ_X9_62_primeCurve,2L
 
-#define SN_X9_62_prime192v3		"prime192v3"
-#define NID_X9_62_prime192v3		411
-#define OBJ_X9_62_prime192v3		OBJ_X9_62_primeCurve,3L
+#define SN_X9_62_prime192v3     "prime192v3"
+#define NID_X9_62_prime192v3        411
+#define OBJ_X9_62_prime192v3        OBJ_X9_62_primeCurve,3L
 
-#define SN_X9_62_prime239v1		"prime239v1"
-#define NID_X9_62_prime239v1		412
-#define OBJ_X9_62_prime239v1		OBJ_X9_62_primeCurve,4L
+#define SN_X9_62_prime239v1     "prime239v1"
+#define NID_X9_62_prime239v1        412
+#define OBJ_X9_62_prime239v1        OBJ_X9_62_primeCurve,4L
 
-#define SN_X9_62_prime239v2		"prime239v2"
-#define NID_X9_62_prime239v2		413
-#define OBJ_X9_62_prime239v2		OBJ_X9_62_primeCurve,5L
+#define SN_X9_62_prime239v2     "prime239v2"
+#define NID_X9_62_prime239v2        413
+#define OBJ_X9_62_prime239v2        OBJ_X9_62_primeCurve,5L
 
-#define SN_X9_62_prime239v3		"prime239v3"
-#define NID_X9_62_prime239v3		414
-#define OBJ_X9_62_prime239v3		OBJ_X9_62_primeCurve,6L
+#define SN_X9_62_prime239v3     "prime239v3"
+#define NID_X9_62_prime239v3        414
+#define OBJ_X9_62_prime239v3        OBJ_X9_62_primeCurve,6L
 
-#define SN_X9_62_prime256v1		"prime256v1"
-#define NID_X9_62_prime256v1		415
-#define OBJ_X9_62_prime256v1		OBJ_X9_62_primeCurve,7L
+#define SN_X9_62_prime256v1     "prime256v1"
+#define NID_X9_62_prime256v1        415
+#define OBJ_X9_62_prime256v1        OBJ_X9_62_primeCurve,7L
 
-#define OBJ_X9_62_id_ecSigType		OBJ_ansi_X9_62,4L
+#define OBJ_X9_62_id_ecSigType      OBJ_ansi_X9_62,4L
 
-#define SN_ecdsa_with_SHA1		"ecdsa-with-SHA1"
-#define NID_ecdsa_with_SHA1		416
-#define OBJ_ecdsa_with_SHA1		OBJ_X9_62_id_ecSigType,1L
+#define SN_ecdsa_with_SHA1      "ecdsa-with-SHA1"
+#define NID_ecdsa_with_SHA1     416
+#define OBJ_ecdsa_with_SHA1     OBJ_X9_62_id_ecSigType,1L
 
-#define OBJ_secg_ellipticCurve		OBJ_certicom_arc,0L
+#define OBJ_secg_ellipticCurve      OBJ_certicom_arc,0L
 
-#define SN_secp112r1		"secp112r1"
-#define NID_secp112r1		704
-#define OBJ_secp112r1		OBJ_secg_ellipticCurve,6L
+#define SN_secp112r1        "secp112r1"
+#define NID_secp112r1       704
+#define OBJ_secp112r1       OBJ_secg_ellipticCurve,6L
 
-#define SN_secp112r2		"secp112r2"
-#define NID_secp112r2		705
-#define OBJ_secp112r2		OBJ_secg_ellipticCurve,7L
+#define SN_secp112r2        "secp112r2"
+#define NID_secp112r2       705
+#define OBJ_secp112r2       OBJ_secg_ellipticCurve,7L
 
-#define SN_secp128r1		"secp128r1"
-#define NID_secp128r1		706
-#define OBJ_secp128r1		OBJ_secg_ellipticCurve,28L
+#define SN_secp128r1        "secp128r1"
+#define NID_secp128r1       706
+#define OBJ_secp128r1       OBJ_secg_ellipticCurve,28L
 
-#define SN_secp128r2		"secp128r2"
-#define NID_secp128r2		707
-#define OBJ_secp128r2		OBJ_secg_ellipticCurve,29L
+#define SN_secp128r2        "secp128r2"
+#define NID_secp128r2       707
+#define OBJ_secp128r2       OBJ_secg_ellipticCurve,29L
 
-#define SN_secp160k1		"secp160k1"
-#define NID_secp160k1		708
-#define OBJ_secp160k1		OBJ_secg_ellipticCurve,9L
+#define SN_secp160k1        "secp160k1"
+#define NID_secp160k1       708
+#define OBJ_secp160k1       OBJ_secg_ellipticCurve,9L
 
-#define SN_secp160r1		"secp160r1"
-#define NID_secp160r1		709
-#define OBJ_secp160r1		OBJ_secg_ellipticCurve,8L
+#define SN_secp160r1        "secp160r1"
+#define NID_secp160r1       709
+#define OBJ_secp160r1       OBJ_secg_ellipticCurve,8L
 
-#define SN_secp160r2		"secp160r2"
-#define NID_secp160r2		710
-#define OBJ_secp160r2		OBJ_secg_ellipticCurve,30L
+#define SN_secp160r2        "secp160r2"
+#define NID_secp160r2       710
+#define OBJ_secp160r2       OBJ_secg_ellipticCurve,30L
 
-#define SN_secp192k1		"secp192k1"
-#define NID_secp192k1		711
-#define OBJ_secp192k1		OBJ_secg_ellipticCurve,31L
+#define SN_secp192k1        "secp192k1"
+#define NID_secp192k1       711
+#define OBJ_secp192k1       OBJ_secg_ellipticCurve,31L
 
-#define SN_secp224k1		"secp224k1"
-#define NID_secp224k1		712
-#define OBJ_secp224k1		OBJ_secg_ellipticCurve,32L
+#define SN_secp224k1        "secp224k1"
+#define NID_secp224k1       712
+#define OBJ_secp224k1       OBJ_secg_ellipticCurve,32L
 
-#define SN_secp224r1		"secp224r1"
-#define NID_secp224r1		713
-#define OBJ_secp224r1		OBJ_secg_ellipticCurve,33L
+#define SN_secp224r1        "secp224r1"
+#define NID_secp224r1       713
+#define OBJ_secp224r1       OBJ_secg_ellipticCurve,33L
 
-#define SN_secp256k1		"secp256k1"
-#define NID_secp256k1		714
-#define OBJ_secp256k1		OBJ_secg_ellipticCurve,10L
+#define SN_secp256k1        "secp256k1"
+#define NID_secp256k1       714
+#define OBJ_secp256k1       OBJ_secg_ellipticCurve,10L
 
-#define SN_secp384r1		"secp384r1"
-#define NID_secp384r1		715
-#define OBJ_secp384r1		OBJ_secg_ellipticCurve,34L
+#define SN_secp384r1        "secp384r1"
+#define NID_secp384r1       715
+#define OBJ_secp384r1       OBJ_secg_ellipticCurve,34L
 
-#define SN_secp521r1		"secp521r1"
-#define NID_secp521r1		716
-#define OBJ_secp521r1		OBJ_secg_ellipticCurve,35L
+#define SN_secp521r1        "secp521r1"
+#define NID_secp521r1       716
+#define OBJ_secp521r1       OBJ_secg_ellipticCurve,35L
 
-#define SN_sect113r1		"sect113r1"
-#define NID_sect113r1		717
-#define OBJ_sect113r1		OBJ_secg_ellipticCurve,4L
+#define SN_sect113r1        "sect113r1"
+#define NID_sect113r1       717
+#define OBJ_sect113r1       OBJ_secg_ellipticCurve,4L
 
-#define SN_sect113r2		"sect113r2"
-#define NID_sect113r2		718
-#define OBJ_sect113r2		OBJ_secg_ellipticCurve,5L
+#define SN_sect113r2        "sect113r2"
+#define NID_sect113r2       718
+#define OBJ_sect113r2       OBJ_secg_ellipticCurve,5L
 
-#define SN_sect131r1		"sect131r1"
-#define NID_sect131r1		719
-#define OBJ_sect131r1		OBJ_secg_ellipticCurve,22L
+#define SN_sect131r1        "sect131r1"
+#define NID_sect131r1       719
+#define OBJ_sect131r1       OBJ_secg_ellipticCurve,22L
 
-#define SN_sect131r2		"sect131r2"
-#define NID_sect131r2		720
-#define OBJ_sect131r2		OBJ_secg_ellipticCurve,23L
+#define SN_sect131r2        "sect131r2"
+#define NID_sect131r2       720
+#define OBJ_sect131r2       OBJ_secg_ellipticCurve,23L
 
-#define SN_sect163k1		"sect163k1"
-#define NID_sect163k1		721
-#define OBJ_sect163k1		OBJ_secg_ellipticCurve,1L
+#define SN_sect163k1        "sect163k1"
+#define NID_sect163k1       721
+#define OBJ_sect163k1       OBJ_secg_ellipticCurve,1L
 
-#define SN_sect163r1		"sect163r1"
-#define NID_sect163r1		722
-#define OBJ_sect163r1		OBJ_secg_ellipticCurve,2L
+#define SN_sect163r1        "sect163r1"
+#define NID_sect163r1       722
+#define OBJ_sect163r1       OBJ_secg_ellipticCurve,2L
 
-#define SN_sect163r2		"sect163r2"
-#define NID_sect163r2		723
-#define OBJ_sect163r2		OBJ_secg_ellipticCurve,15L
+#define SN_sect163r2        "sect163r2"
+#define NID_sect163r2       723
+#define OBJ_sect163r2       OBJ_secg_ellipticCurve,15L
 
-#define SN_sect193r1		"sect193r1"
-#define NID_sect193r1		724
-#define OBJ_sect193r1		OBJ_secg_ellipticCurve,24L
+#define SN_sect193r1        "sect193r1"
+#define NID_sect193r1       724
+#define OBJ_sect193r1       OBJ_secg_ellipticCurve,24L
 
-#define SN_sect193r2		"sect193r2"
-#define NID_sect193r2		725
-#define OBJ_sect193r2		OBJ_secg_ellipticCurve,25L
+#define SN_sect193r2        "sect193r2"
+#define NID_sect193r2       725
+#define OBJ_sect193r2       OBJ_secg_ellipticCurve,25L
 
-#define SN_sect233k1		"sect233k1"
-#define NID_sect233k1		726
-#define OBJ_sect233k1		OBJ_secg_ellipticCurve,26L
+#define SN_sect233k1        "sect233k1"
+#define NID_sect233k1       726
+#define OBJ_sect233k1       OBJ_secg_ellipticCurve,26L
 
-#define SN_sect233r1		"sect233r1"
-#define NID_sect233r1		727
-#define OBJ_sect233r1		OBJ_secg_ellipticCurve,27L
+#define SN_sect233r1        "sect233r1"
+#define NID_sect233r1       727
+#define OBJ_sect233r1       OBJ_secg_ellipticCurve,27L
 
-#define SN_sect239k1		"sect239k1"
-#define NID_sect239k1		728
-#define OBJ_sect239k1		OBJ_secg_ellipticCurve,3L
+#define SN_sect239k1        "sect239k1"
+#define NID_sect239k1       728
+#define OBJ_sect239k1       OBJ_secg_ellipticCurve,3L
 
-#define SN_sect283k1		"sect283k1"
-#define NID_sect283k1		729
-#define OBJ_sect283k1		OBJ_secg_ellipticCurve,16L
+#define SN_sect283k1        "sect283k1"
+#define NID_sect283k1       729
+#define OBJ_sect283k1       OBJ_secg_ellipticCurve,16L
 
-#define SN_sect283r1		"sect283r1"
-#define NID_sect283r1		730
-#define OBJ_sect283r1		OBJ_secg_ellipticCurve,17L
+#define SN_sect283r1        "sect283r1"
+#define NID_sect283r1       730
+#define OBJ_sect283r1       OBJ_secg_ellipticCurve,17L
 
-#define SN_sect409k1		"sect409k1"
-#define NID_sect409k1		731
-#define OBJ_sect409k1		OBJ_secg_ellipticCurve,36L
+#define SN_sect409k1        "sect409k1"
+#define NID_sect409k1       731
+#define OBJ_sect409k1       OBJ_secg_ellipticCurve,36L
 
-#define SN_sect409r1		"sect409r1"
-#define NID_sect409r1		732
-#define OBJ_sect409r1		OBJ_secg_ellipticCurve,37L
+#define SN_sect409r1        "sect409r1"
+#define NID_sect409r1       732
+#define OBJ_sect409r1       OBJ_secg_ellipticCurve,37L
 
-#define SN_sect571k1		"sect571k1"
-#define NID_sect571k1		733
-#define OBJ_sect571k1		OBJ_secg_ellipticCurve,38L
+#define SN_sect571k1        "sect571k1"
+#define NID_sect571k1       733
+#define OBJ_sect571k1       OBJ_secg_ellipticCurve,38L
 
-#define SN_sect571r1		"sect571r1"
-#define NID_sect571r1		734
-#define OBJ_sect571r1		OBJ_secg_ellipticCurve,39L
+#define SN_sect571r1        "sect571r1"
+#define NID_sect571r1       734
+#define OBJ_sect571r1       OBJ_secg_ellipticCurve,39L
 
-#define OBJ_wap_wsg_idm_ecid		OBJ_wap_wsg,4L
-
-#define SN_wap_wsg_idm_ecid_wtls1		"wap-wsg-idm-ecid-wtls1"
-#define NID_wap_wsg_idm_ecid_wtls1		735
-#define OBJ_wap_wsg_idm_ecid_wtls1		OBJ_wap_wsg_idm_ecid,1L
-
-#define SN_wap_wsg_idm_ecid_wtls3		"wap-wsg-idm-ecid-wtls3"
-#define NID_wap_wsg_idm_ecid_wtls3		736
-#define OBJ_wap_wsg_idm_ecid_wtls3		OBJ_wap_wsg_idm_ecid,3L
-
-#define SN_wap_wsg_idm_ecid_wtls4		"wap-wsg-idm-ecid-wtls4"
-#define NID_wap_wsg_idm_ecid_wtls4		737
-#define OBJ_wap_wsg_idm_ecid_wtls4		OBJ_wap_wsg_idm_ecid,4L
-
-#define SN_wap_wsg_idm_ecid_wtls5		"wap-wsg-idm-ecid-wtls5"
-#define NID_wap_wsg_idm_ecid_wtls5		738
-#define OBJ_wap_wsg_idm_ecid_wtls5		OBJ_wap_wsg_idm_ecid,5L
-
-#define SN_wap_wsg_idm_ecid_wtls6		"wap-wsg-idm-ecid-wtls6"
-#define NID_wap_wsg_idm_ecid_wtls6		739
-#define OBJ_wap_wsg_idm_ecid_wtls6		OBJ_wap_wsg_idm_ecid,6L
-
-#define SN_wap_wsg_idm_ecid_wtls7		"wap-wsg-idm-ecid-wtls7"
-#define NID_wap_wsg_idm_ecid_wtls7		740
-#define OBJ_wap_wsg_idm_ecid_wtls7		OBJ_wap_wsg_idm_ecid,7L
-
-#define SN_wap_wsg_idm_ecid_wtls8		"wap-wsg-idm-ecid-wtls8"
-#define NID_wap_wsg_idm_ecid_wtls8		741
-#define OBJ_wap_wsg_idm_ecid_wtls8		OBJ_wap_wsg_idm_ecid,8L
-
-#define SN_wap_wsg_idm_ecid_wtls9		"wap-wsg-idm-ecid-wtls9"
-#define NID_wap_wsg_idm_ecid_wtls9		742
-#define OBJ_wap_wsg_idm_ecid_wtls9		OBJ_wap_wsg_idm_ecid,9L
-
-#define SN_wap_wsg_idm_ecid_wtls10		"wap-wsg-idm-ecid-wtls10"
-#define NID_wap_wsg_idm_ecid_wtls10		743
-#define OBJ_wap_wsg_idm_ecid_wtls10		OBJ_wap_wsg_idm_ecid,10L
-
-#define SN_wap_wsg_idm_ecid_wtls11		"wap-wsg-idm-ecid-wtls11"
-#define NID_wap_wsg_idm_ecid_wtls11		744
-#define OBJ_wap_wsg_idm_ecid_wtls11		OBJ_wap_wsg_idm_ecid,11L
-
-#define SN_wap_wsg_idm_ecid_wtls12		"wap-wsg-idm-ecid-wtls12"
-#define NID_wap_wsg_idm_ecid_wtls12		745
-#define OBJ_wap_wsg_idm_ecid_wtls12		OBJ_wap_wsg_idm_ecid,12L
-
-#define SN_cast5_cbc		"CAST5-CBC"
-#define LN_cast5_cbc		"cast5-cbc"
-#define NID_cast5_cbc		108
-#define OBJ_cast5_cbc		OBJ_ISO_US,113533L,7L,66L,10L
-
-#define SN_cast5_ecb		"CAST5-ECB"
-#define LN_cast5_ecb		"cast5-ecb"
-#define NID_cast5_ecb		109
-
-#define SN_cast5_cfb64		"CAST5-CFB"
-#define LN_cast5_cfb64		"cast5-cfb"
-#define NID_cast5_cfb64		110
-
-#define SN_cast5_ofb64		"CAST5-OFB"
-#define LN_cast5_ofb64		"cast5-ofb"
-#define NID_cast5_ofb64		111
-
-#define LN_pbeWithMD5AndCast5_CBC		"pbeWithMD5AndCast5CBC"
-#define NID_pbeWithMD5AndCast5_CBC		112
-#define OBJ_pbeWithMD5AndCast5_CBC		OBJ_ISO_US,113533L,7L,66L,12L
-
-#define SN_rsadsi		"rsadsi"
-#define LN_rsadsi		"RSA Data Security, Inc."
-#define NID_rsadsi		1
-#define OBJ_rsadsi		OBJ_ISO_US,113549L
-
-#define SN_pkcs		"pkcs"
-#define LN_pkcs		"RSA Data Security, Inc. PKCS"
-#define NID_pkcs		2
-#define OBJ_pkcs		OBJ_rsadsi,1L
-
-#define SN_pkcs1		"pkcs1"
-#define NID_pkcs1		186
-#define OBJ_pkcs1		OBJ_pkcs,1L
-
-#define LN_rsaEncryption		"rsaEncryption"
-#define NID_rsaEncryption		6
-#define OBJ_rsaEncryption		OBJ_pkcs1,1L
-
-#define SN_md2WithRSAEncryption		"RSA-MD2"
-#define LN_md2WithRSAEncryption		"md2WithRSAEncryption"
-#define NID_md2WithRSAEncryption		7
-#define OBJ_md2WithRSAEncryption		OBJ_pkcs1,2L
-
-#define SN_md4WithRSAEncryption		"RSA-MD4"
-#define LN_md4WithRSAEncryption		"md4WithRSAEncryption"
-#define NID_md4WithRSAEncryption		396
-#define OBJ_md4WithRSAEncryption		OBJ_pkcs1,3L
-
-#define SN_md5WithRSAEncryption		"RSA-MD5"
-#define LN_md5WithRSAEncryption		"md5WithRSAEncryption"
-#define NID_md5WithRSAEncryption		8
-#define OBJ_md5WithRSAEncryption		OBJ_pkcs1,4L
-
-#define SN_sha1WithRSAEncryption		"RSA-SHA1"
-#define LN_sha1WithRSAEncryption		"sha1WithRSAEncryption"
-#define NID_sha1WithRSAEncryption		65
-#define OBJ_sha1WithRSAEncryption		OBJ_pkcs1,5L
-
-#define SN_sha256WithRSAEncryption		"RSA-SHA256"
-#define LN_sha256WithRSAEncryption		"sha256WithRSAEncryption"
-#define NID_sha256WithRSAEncryption		668
-#define OBJ_sha256WithRSAEncryption		OBJ_pkcs1,11L
-
-#define SN_sha384WithRSAEncryption		"RSA-SHA384"
-#define LN_sha384WithRSAEncryption		"sha384WithRSAEncryption"
-#define NID_sha384WithRSAEncryption		669
-#define OBJ_sha384WithRSAEncryption		OBJ_pkcs1,12L
-
-#define SN_sha512WithRSAEncryption		"RSA-SHA512"
-#define LN_sha512WithRSAEncryption		"sha512WithRSAEncryption"
-#define NID_sha512WithRSAEncryption		670
-#define OBJ_sha512WithRSAEncryption		OBJ_pkcs1,13L
-
-#define SN_sha224WithRSAEncryption		"RSA-SHA224"
-#define LN_sha224WithRSAEncryption		"sha224WithRSAEncryption"
-#define NID_sha224WithRSAEncryption		671
-#define OBJ_sha224WithRSAEncryption		OBJ_pkcs1,14L
-
-#define SN_pkcs3		"pkcs3"
-#define NID_pkcs3		27
-#define OBJ_pkcs3		OBJ_pkcs,3L
-
-#define LN_dhKeyAgreement		"dhKeyAgreement"
-#define NID_dhKeyAgreement		28
-#define OBJ_dhKeyAgreement		OBJ_pkcs3,1L
-
-#define SN_pkcs5		"pkcs5"
-#define NID_pkcs5		187
-#define OBJ_pkcs5		OBJ_pkcs,5L
-
-#define SN_pbeWithMD2AndDES_CBC		"PBE-MD2-DES"
-#define LN_pbeWithMD2AndDES_CBC		"pbeWithMD2AndDES-CBC"
-#define NID_pbeWithMD2AndDES_CBC		9
-#define OBJ_pbeWithMD2AndDES_CBC		OBJ_pkcs5,1L
-
-#define SN_pbeWithMD5AndDES_CBC		"PBE-MD5-DES"
-#define LN_pbeWithMD5AndDES_CBC		"pbeWithMD5AndDES-CBC"
-#define NID_pbeWithMD5AndDES_CBC		10
-#define OBJ_pbeWithMD5AndDES_CBC		OBJ_pkcs5,3L
-
-#define SN_pbeWithMD2AndRC2_CBC		"PBE-MD2-RC2-64"
-#define LN_pbeWithMD2AndRC2_CBC		"pbeWithMD2AndRC2-CBC"
-#define NID_pbeWithMD2AndRC2_CBC		168
-#define OBJ_pbeWithMD2AndRC2_CBC		OBJ_pkcs5,4L
-
-#define SN_pbeWithMD5AndRC2_CBC		"PBE-MD5-RC2-64"
-#define LN_pbeWithMD5AndRC2_CBC		"pbeWithMD5AndRC2-CBC"
-#define NID_pbeWithMD5AndRC2_CBC		169
-#define OBJ_pbeWithMD5AndRC2_CBC		OBJ_pkcs5,6L
-
-#define SN_pbeWithSHA1AndDES_CBC		"PBE-SHA1-DES"
-#define LN_pbeWithSHA1AndDES_CBC		"pbeWithSHA1AndDES-CBC"
-#define NID_pbeWithSHA1AndDES_CBC		170
-#define OBJ_pbeWithSHA1AndDES_CBC		OBJ_pkcs5,10L
-
-#define SN_pbeWithSHA1AndRC2_CBC		"PBE-SHA1-RC2-64"
-#define LN_pbeWithSHA1AndRC2_CBC		"pbeWithSHA1AndRC2-CBC"
-#define NID_pbeWithSHA1AndRC2_CBC		68
-#define OBJ_pbeWithSHA1AndRC2_CBC		OBJ_pkcs5,11L
-
-#define LN_id_pbkdf2		"PBKDF2"
-#define NID_id_pbkdf2		69
-#define OBJ_id_pbkdf2		OBJ_pkcs5,12L
-
-#define LN_pbes2		"PBES2"
-#define NID_pbes2		161
-#define OBJ_pbes2		OBJ_pkcs5,13L
-
-#define LN_pbmac1		"PBMAC1"
-#define NID_pbmac1		162
-#define OBJ_pbmac1		OBJ_pkcs5,14L
-
-#define SN_pkcs7		"pkcs7"
-#define NID_pkcs7		20
-#define OBJ_pkcs7		OBJ_pkcs,7L
-
-#define LN_pkcs7_data		"pkcs7-data"
-#define NID_pkcs7_data		21
-#define OBJ_pkcs7_data		OBJ_pkcs7,1L
-
-#define LN_pkcs7_signed		"pkcs7-signedData"
-#define NID_pkcs7_signed		22
-#define OBJ_pkcs7_signed		OBJ_pkcs7,2L
-
-#define LN_pkcs7_enveloped		"pkcs7-envelopedData"
-#define NID_pkcs7_enveloped		23
-#define OBJ_pkcs7_enveloped		OBJ_pkcs7,3L
-
-#define LN_pkcs7_signedAndEnveloped		"pkcs7-signedAndEnvelopedData"
-#define NID_pkcs7_signedAndEnveloped		24
-#define OBJ_pkcs7_signedAndEnveloped		OBJ_pkcs7,4L
-
-#define LN_pkcs7_digest		"pkcs7-digestData"
-#define NID_pkcs7_digest		25
-#define OBJ_pkcs7_digest		OBJ_pkcs7,5L
-
-#define LN_pkcs7_encrypted		"pkcs7-encryptedData"
-#define NID_pkcs7_encrypted		26
-#define OBJ_pkcs7_encrypted		OBJ_pkcs7,6L
-
-#define SN_pkcs9		"pkcs9"
-#define NID_pkcs9		47
-#define OBJ_pkcs9		OBJ_pkcs,9L
-
-#define LN_pkcs9_emailAddress		"emailAddress"
-#define NID_pkcs9_emailAddress		48
-#define OBJ_pkcs9_emailAddress		OBJ_pkcs9,1L
-
-#define LN_pkcs9_unstructuredName		"unstructuredName"
-#define NID_pkcs9_unstructuredName		49
-#define OBJ_pkcs9_unstructuredName		OBJ_pkcs9,2L
-
-#define LN_pkcs9_contentType		"contentType"
-#define NID_pkcs9_contentType		50
-#define OBJ_pkcs9_contentType		OBJ_pkcs9,3L
-
-#define LN_pkcs9_messageDigest		"messageDigest"
-#define NID_pkcs9_messageDigest		51
-#define OBJ_pkcs9_messageDigest		OBJ_pkcs9,4L
-
-#define LN_pkcs9_signingTime		"signingTime"
-#define NID_pkcs9_signingTime		52
-#define OBJ_pkcs9_signingTime		OBJ_pkcs9,5L
-
-#define LN_pkcs9_countersignature		"countersignature"
-#define NID_pkcs9_countersignature		53
-#define OBJ_pkcs9_countersignature		OBJ_pkcs9,6L
-
-#define LN_pkcs9_challengePassword		"challengePassword"
-#define NID_pkcs9_challengePassword		54
-#define OBJ_pkcs9_challengePassword		OBJ_pkcs9,7L
-
-#define LN_pkcs9_unstructuredAddress		"unstructuredAddress"
-#define NID_pkcs9_unstructuredAddress		55
-#define OBJ_pkcs9_unstructuredAddress		OBJ_pkcs9,8L
-
-#define LN_pkcs9_extCertAttributes		"extendedCertificateAttributes"
-#define NID_pkcs9_extCertAttributes		56
-#define OBJ_pkcs9_extCertAttributes		OBJ_pkcs9,9L
-
-#define SN_ext_req		"extReq"
-#define LN_ext_req		"Extension Request"
-#define NID_ext_req		172
-#define OBJ_ext_req		OBJ_pkcs9,14L
-
-#define SN_SMIMECapabilities		"SMIME-CAPS"
-#define LN_SMIMECapabilities		"S/MIME Capabilities"
-#define NID_SMIMECapabilities		167
-#define OBJ_SMIMECapabilities		OBJ_pkcs9,15L
-
-#define SN_SMIME		"SMIME"
-#define LN_SMIME		"S/MIME"
-#define NID_SMIME		188
-#define OBJ_SMIME		OBJ_pkcs9,16L
+#define OBJ_wap_wsg_idm_ecid        OBJ_wap_wsg,4L
+
+#define SN_wap_wsg_idm_ecid_wtls1       "wap-wsg-idm-ecid-wtls1"
+#define NID_wap_wsg_idm_ecid_wtls1      735
+#define OBJ_wap_wsg_idm_ecid_wtls1      OBJ_wap_wsg_idm_ecid,1L
+
+#define SN_wap_wsg_idm_ecid_wtls3       "wap-wsg-idm-ecid-wtls3"
+#define NID_wap_wsg_idm_ecid_wtls3      736
+#define OBJ_wap_wsg_idm_ecid_wtls3      OBJ_wap_wsg_idm_ecid,3L
+
+#define SN_wap_wsg_idm_ecid_wtls4       "wap-wsg-idm-ecid-wtls4"
+#define NID_wap_wsg_idm_ecid_wtls4      737
+#define OBJ_wap_wsg_idm_ecid_wtls4      OBJ_wap_wsg_idm_ecid,4L
+
+#define SN_wap_wsg_idm_ecid_wtls5       "wap-wsg-idm-ecid-wtls5"
+#define NID_wap_wsg_idm_ecid_wtls5      738
+#define OBJ_wap_wsg_idm_ecid_wtls5      OBJ_wap_wsg_idm_ecid,5L
+
+#define SN_wap_wsg_idm_ecid_wtls6       "wap-wsg-idm-ecid-wtls6"
+#define NID_wap_wsg_idm_ecid_wtls6      739
+#define OBJ_wap_wsg_idm_ecid_wtls6      OBJ_wap_wsg_idm_ecid,6L
+
+#define SN_wap_wsg_idm_ecid_wtls7       "wap-wsg-idm-ecid-wtls7"
+#define NID_wap_wsg_idm_ecid_wtls7      740
+#define OBJ_wap_wsg_idm_ecid_wtls7      OBJ_wap_wsg_idm_ecid,7L
+
+#define SN_wap_wsg_idm_ecid_wtls8       "wap-wsg-idm-ecid-wtls8"
+#define NID_wap_wsg_idm_ecid_wtls8      741
+#define OBJ_wap_wsg_idm_ecid_wtls8      OBJ_wap_wsg_idm_ecid,8L
+
+#define SN_wap_wsg_idm_ecid_wtls9       "wap-wsg-idm-ecid-wtls9"
+#define NID_wap_wsg_idm_ecid_wtls9      742
+#define OBJ_wap_wsg_idm_ecid_wtls9      OBJ_wap_wsg_idm_ecid,9L
+
+#define SN_wap_wsg_idm_ecid_wtls10      "wap-wsg-idm-ecid-wtls10"
+#define NID_wap_wsg_idm_ecid_wtls10     743
+#define OBJ_wap_wsg_idm_ecid_wtls10     OBJ_wap_wsg_idm_ecid,10L
+
+#define SN_wap_wsg_idm_ecid_wtls11      "wap-wsg-idm-ecid-wtls11"
+#define NID_wap_wsg_idm_ecid_wtls11     744
+#define OBJ_wap_wsg_idm_ecid_wtls11     OBJ_wap_wsg_idm_ecid,11L
+
+#define SN_wap_wsg_idm_ecid_wtls12      "wap-wsg-idm-ecid-wtls12"
+#define NID_wap_wsg_idm_ecid_wtls12     745
+#define OBJ_wap_wsg_idm_ecid_wtls12     OBJ_wap_wsg_idm_ecid,12L
+
+#define SN_cast5_cbc        "CAST5-CBC"
+#define LN_cast5_cbc        "cast5-cbc"
+#define NID_cast5_cbc       108
+#define OBJ_cast5_cbc       OBJ_ISO_US,113533L,7L,66L,10L
+
+#define SN_cast5_ecb        "CAST5-ECB"
+#define LN_cast5_ecb        "cast5-ecb"
+#define NID_cast5_ecb       109
+
+#define SN_cast5_cfb64      "CAST5-CFB"
+#define LN_cast5_cfb64      "cast5-cfb"
+#define NID_cast5_cfb64     110
+
+#define SN_cast5_ofb64      "CAST5-OFB"
+#define LN_cast5_ofb64      "cast5-ofb"
+#define NID_cast5_ofb64     111
+
+#define LN_pbeWithMD5AndCast5_CBC       "pbeWithMD5AndCast5CBC"
+#define NID_pbeWithMD5AndCast5_CBC      112
+#define OBJ_pbeWithMD5AndCast5_CBC      OBJ_ISO_US,113533L,7L,66L,12L
+
+#define SN_rsadsi       "rsadsi"
+#define LN_rsadsi       "RSA Data Security, Inc."
+#define NID_rsadsi      1
+#define OBJ_rsadsi      OBJ_ISO_US,113549L
+
+#define SN_pkcs     "pkcs"
+#define LN_pkcs     "RSA Data Security, Inc. PKCS"
+#define NID_pkcs        2
+#define OBJ_pkcs        OBJ_rsadsi,1L
+
+#define SN_pkcs1        "pkcs1"
+#define NID_pkcs1       186
+#define OBJ_pkcs1       OBJ_pkcs,1L
+
+#define LN_rsaEncryption        "rsaEncryption"
+#define NID_rsaEncryption       6
+#define OBJ_rsaEncryption       OBJ_pkcs1,1L
+
+#define SN_md2WithRSAEncryption     "RSA-MD2"
+#define LN_md2WithRSAEncryption     "md2WithRSAEncryption"
+#define NID_md2WithRSAEncryption        7
+#define OBJ_md2WithRSAEncryption        OBJ_pkcs1,2L
+
+#define SN_md4WithRSAEncryption     "RSA-MD4"
+#define LN_md4WithRSAEncryption     "md4WithRSAEncryption"
+#define NID_md4WithRSAEncryption        396
+#define OBJ_md4WithRSAEncryption        OBJ_pkcs1,3L
+
+#define SN_md5WithRSAEncryption     "RSA-MD5"
+#define LN_md5WithRSAEncryption     "md5WithRSAEncryption"
+#define NID_md5WithRSAEncryption        8
+#define OBJ_md5WithRSAEncryption        OBJ_pkcs1,4L
+
+#define SN_sha1WithRSAEncryption        "RSA-SHA1"
+#define LN_sha1WithRSAEncryption        "sha1WithRSAEncryption"
+#define NID_sha1WithRSAEncryption       65
+#define OBJ_sha1WithRSAEncryption       OBJ_pkcs1,5L
+
+#define SN_sha256WithRSAEncryption      "RSA-SHA256"
+#define LN_sha256WithRSAEncryption      "sha256WithRSAEncryption"
+#define NID_sha256WithRSAEncryption     668
+#define OBJ_sha256WithRSAEncryption     OBJ_pkcs1,11L
+
+#define SN_sha384WithRSAEncryption      "RSA-SHA384"
+#define LN_sha384WithRSAEncryption      "sha384WithRSAEncryption"
+#define NID_sha384WithRSAEncryption     669
+#define OBJ_sha384WithRSAEncryption     OBJ_pkcs1,12L
+
+#define SN_sha512WithRSAEncryption      "RSA-SHA512"
+#define LN_sha512WithRSAEncryption      "sha512WithRSAEncryption"
+#define NID_sha512WithRSAEncryption     670
+#define OBJ_sha512WithRSAEncryption     OBJ_pkcs1,13L
+
+#define SN_sha224WithRSAEncryption      "RSA-SHA224"
+#define LN_sha224WithRSAEncryption      "sha224WithRSAEncryption"
+#define NID_sha224WithRSAEncryption     671
+#define OBJ_sha224WithRSAEncryption     OBJ_pkcs1,14L
+
+#define SN_pkcs3        "pkcs3"
+#define NID_pkcs3       27
+#define OBJ_pkcs3       OBJ_pkcs,3L
+
+#define LN_dhKeyAgreement       "dhKeyAgreement"
+#define NID_dhKeyAgreement      28
+#define OBJ_dhKeyAgreement      OBJ_pkcs3,1L
+
+#define SN_pkcs5        "pkcs5"
+#define NID_pkcs5       187
+#define OBJ_pkcs5       OBJ_pkcs,5L
+
+#define SN_pbeWithMD2AndDES_CBC     "PBE-MD2-DES"
+#define LN_pbeWithMD2AndDES_CBC     "pbeWithMD2AndDES-CBC"
+#define NID_pbeWithMD2AndDES_CBC        9
+#define OBJ_pbeWithMD2AndDES_CBC        OBJ_pkcs5,1L
+
+#define SN_pbeWithMD5AndDES_CBC     "PBE-MD5-DES"
+#define LN_pbeWithMD5AndDES_CBC     "pbeWithMD5AndDES-CBC"
+#define NID_pbeWithMD5AndDES_CBC        10
+#define OBJ_pbeWithMD5AndDES_CBC        OBJ_pkcs5,3L
+
+#define SN_pbeWithMD2AndRC2_CBC     "PBE-MD2-RC2-64"
+#define LN_pbeWithMD2AndRC2_CBC     "pbeWithMD2AndRC2-CBC"
+#define NID_pbeWithMD2AndRC2_CBC        168
+#define OBJ_pbeWithMD2AndRC2_CBC        OBJ_pkcs5,4L
+
+#define SN_pbeWithMD5AndRC2_CBC     "PBE-MD5-RC2-64"
+#define LN_pbeWithMD5AndRC2_CBC     "pbeWithMD5AndRC2-CBC"
+#define NID_pbeWithMD5AndRC2_CBC        169
+#define OBJ_pbeWithMD5AndRC2_CBC        OBJ_pkcs5,6L
+
+#define SN_pbeWithSHA1AndDES_CBC        "PBE-SHA1-DES"
+#define LN_pbeWithSHA1AndDES_CBC        "pbeWithSHA1AndDES-CBC"
+#define NID_pbeWithSHA1AndDES_CBC       170
+#define OBJ_pbeWithSHA1AndDES_CBC       OBJ_pkcs5,10L
+
+#define SN_pbeWithSHA1AndRC2_CBC        "PBE-SHA1-RC2-64"
+#define LN_pbeWithSHA1AndRC2_CBC        "pbeWithSHA1AndRC2-CBC"
+#define NID_pbeWithSHA1AndRC2_CBC       68
+#define OBJ_pbeWithSHA1AndRC2_CBC       OBJ_pkcs5,11L
+
+#define LN_id_pbkdf2        "PBKDF2"
+#define NID_id_pbkdf2       69
+#define OBJ_id_pbkdf2       OBJ_pkcs5,12L
+
+#define LN_pbes2        "PBES2"
+#define NID_pbes2       161
+#define OBJ_pbes2       OBJ_pkcs5,13L
+
+#define LN_pbmac1       "PBMAC1"
+#define NID_pbmac1      162
+#define OBJ_pbmac1      OBJ_pkcs5,14L
+
+#define SN_pkcs7        "pkcs7"
+#define NID_pkcs7       20
+#define OBJ_pkcs7       OBJ_pkcs,7L
+
+#define LN_pkcs7_data       "pkcs7-data"
+#define NID_pkcs7_data      21
+#define OBJ_pkcs7_data      OBJ_pkcs7,1L
+
+#define LN_pkcs7_signed     "pkcs7-signedData"
+#define NID_pkcs7_signed        22
+#define OBJ_pkcs7_signed        OBJ_pkcs7,2L
+
+#define LN_pkcs7_enveloped      "pkcs7-envelopedData"
+#define NID_pkcs7_enveloped     23
+#define OBJ_pkcs7_enveloped     OBJ_pkcs7,3L
+
+#define LN_pkcs7_signedAndEnveloped     "pkcs7-signedAndEnvelopedData"
+#define NID_pkcs7_signedAndEnveloped        24
+#define OBJ_pkcs7_signedAndEnveloped        OBJ_pkcs7,4L
+
+#define LN_pkcs7_digest     "pkcs7-digestData"
+#define NID_pkcs7_digest        25
+#define OBJ_pkcs7_digest        OBJ_pkcs7,5L
+
+#define LN_pkcs7_encrypted      "pkcs7-encryptedData"
+#define NID_pkcs7_encrypted     26
+#define OBJ_pkcs7_encrypted     OBJ_pkcs7,6L
+
+#define SN_pkcs9        "pkcs9"
+#define NID_pkcs9       47
+#define OBJ_pkcs9       OBJ_pkcs,9L
+
+#define LN_pkcs9_emailAddress       "emailAddress"
+#define NID_pkcs9_emailAddress      48
+#define OBJ_pkcs9_emailAddress      OBJ_pkcs9,1L
+
+#define LN_pkcs9_unstructuredName       "unstructuredName"
+#define NID_pkcs9_unstructuredName      49
+#define OBJ_pkcs9_unstructuredName      OBJ_pkcs9,2L
+
+#define LN_pkcs9_contentType        "contentType"
+#define NID_pkcs9_contentType       50
+#define OBJ_pkcs9_contentType       OBJ_pkcs9,3L
+
+#define LN_pkcs9_messageDigest      "messageDigest"
+#define NID_pkcs9_messageDigest     51
+#define OBJ_pkcs9_messageDigest     OBJ_pkcs9,4L
+
+#define LN_pkcs9_signingTime        "signingTime"
+#define NID_pkcs9_signingTime       52
+#define OBJ_pkcs9_signingTime       OBJ_pkcs9,5L
+
+#define LN_pkcs9_countersignature       "countersignature"
+#define NID_pkcs9_countersignature      53
+#define OBJ_pkcs9_countersignature      OBJ_pkcs9,6L
+
+#define LN_pkcs9_challengePassword      "challengePassword"
+#define NID_pkcs9_challengePassword     54
+#define OBJ_pkcs9_challengePassword     OBJ_pkcs9,7L
+
+#define LN_pkcs9_unstructuredAddress        "unstructuredAddress"
+#define NID_pkcs9_unstructuredAddress       55
+#define OBJ_pkcs9_unstructuredAddress       OBJ_pkcs9,8L
+
+#define LN_pkcs9_extCertAttributes      "extendedCertificateAttributes"
+#define NID_pkcs9_extCertAttributes     56
+#define OBJ_pkcs9_extCertAttributes     OBJ_pkcs9,9L
+
+#define SN_ext_req      "extReq"
+#define LN_ext_req      "Extension Request"
+#define NID_ext_req     172
+#define OBJ_ext_req     OBJ_pkcs9,14L
+
+#define SN_SMIMECapabilities        "SMIME-CAPS"
+#define LN_SMIMECapabilities        "S/MIME Capabilities"
+#define NID_SMIMECapabilities       167
+#define OBJ_SMIMECapabilities       OBJ_pkcs9,15L
+
+#define SN_SMIME        "SMIME"
+#define LN_SMIME        "S/MIME"
+#define NID_SMIME       188
+#define OBJ_SMIME       OBJ_pkcs9,16L
 
-#define SN_id_smime_mod		"id-smime-mod"
-#define NID_id_smime_mod		189
-#define OBJ_id_smime_mod		OBJ_SMIME,0L
+#define SN_id_smime_mod     "id-smime-mod"
+#define NID_id_smime_mod        189
+#define OBJ_id_smime_mod        OBJ_SMIME,0L
 
-#define SN_id_smime_ct		"id-smime-ct"
-#define NID_id_smime_ct		190
-#define OBJ_id_smime_ct		OBJ_SMIME,1L
+#define SN_id_smime_ct      "id-smime-ct"
+#define NID_id_smime_ct     190
+#define OBJ_id_smime_ct     OBJ_SMIME,1L
 
-#define SN_id_smime_aa		"id-smime-aa"
-#define NID_id_smime_aa		191
-#define OBJ_id_smime_aa		OBJ_SMIME,2L
+#define SN_id_smime_aa      "id-smime-aa"
+#define NID_id_smime_aa     191
+#define OBJ_id_smime_aa     OBJ_SMIME,2L
 
-#define SN_id_smime_alg		"id-smime-alg"
-#define NID_id_smime_alg		192
-#define OBJ_id_smime_alg		OBJ_SMIME,3L
+#define SN_id_smime_alg     "id-smime-alg"
+#define NID_id_smime_alg        192
+#define OBJ_id_smime_alg        OBJ_SMIME,3L
 
-#define SN_id_smime_cd		"id-smime-cd"
-#define NID_id_smime_cd		193
-#define OBJ_id_smime_cd		OBJ_SMIME,4L
+#define SN_id_smime_cd      "id-smime-cd"
+#define NID_id_smime_cd     193
+#define OBJ_id_smime_cd     OBJ_SMIME,4L
 
-#define SN_id_smime_spq		"id-smime-spq"
-#define NID_id_smime_spq		194
-#define OBJ_id_smime_spq		OBJ_SMIME,5L
+#define SN_id_smime_spq     "id-smime-spq"
+#define NID_id_smime_spq        194
+#define OBJ_id_smime_spq        OBJ_SMIME,5L
 
-#define SN_id_smime_cti		"id-smime-cti"
-#define NID_id_smime_cti		195
-#define OBJ_id_smime_cti		OBJ_SMIME,6L
+#define SN_id_smime_cti     "id-smime-cti"
+#define NID_id_smime_cti        195
+#define OBJ_id_smime_cti        OBJ_SMIME,6L
 
-#define SN_id_smime_mod_cms		"id-smime-mod-cms"
-#define NID_id_smime_mod_cms		196
-#define OBJ_id_smime_mod_cms		OBJ_id_smime_mod,1L
+#define SN_id_smime_mod_cms     "id-smime-mod-cms"
+#define NID_id_smime_mod_cms        196
+#define OBJ_id_smime_mod_cms        OBJ_id_smime_mod,1L
 
-#define SN_id_smime_mod_ess		"id-smime-mod-ess"
-#define NID_id_smime_mod_ess		197
-#define OBJ_id_smime_mod_ess		OBJ_id_smime_mod,2L
+#define SN_id_smime_mod_ess     "id-smime-mod-ess"
+#define NID_id_smime_mod_ess        197
+#define OBJ_id_smime_mod_ess        OBJ_id_smime_mod,2L
 
-#define SN_id_smime_mod_oid		"id-smime-mod-oid"
-#define NID_id_smime_mod_oid		198
-#define OBJ_id_smime_mod_oid		OBJ_id_smime_mod,3L
+#define SN_id_smime_mod_oid     "id-smime-mod-oid"
+#define NID_id_smime_mod_oid        198
+#define OBJ_id_smime_mod_oid        OBJ_id_smime_mod,3L
 
-#define SN_id_smime_mod_msg_v3		"id-smime-mod-msg-v3"
-#define NID_id_smime_mod_msg_v3		199
-#define OBJ_id_smime_mod_msg_v3		OBJ_id_smime_mod,4L
+#define SN_id_smime_mod_msg_v3      "id-smime-mod-msg-v3"
+#define NID_id_smime_mod_msg_v3     199
+#define OBJ_id_smime_mod_msg_v3     OBJ_id_smime_mod,4L
 
-#define SN_id_smime_mod_ets_eSignature_88		"id-smime-mod-ets-eSignature-88"
-#define NID_id_smime_mod_ets_eSignature_88		200
-#define OBJ_id_smime_mod_ets_eSignature_88		OBJ_id_smime_mod,5L
+#define SN_id_smime_mod_ets_eSignature_88       "id-smime-mod-ets-eSignature-88"
+#define NID_id_smime_mod_ets_eSignature_88      200
+#define OBJ_id_smime_mod_ets_eSignature_88      OBJ_id_smime_mod,5L
 
-#define SN_id_smime_mod_ets_eSignature_97		"id-smime-mod-ets-eSignature-97"
-#define NID_id_smime_mod_ets_eSignature_97		201
-#define OBJ_id_smime_mod_ets_eSignature_97		OBJ_id_smime_mod,6L
+#define SN_id_smime_mod_ets_eSignature_97       "id-smime-mod-ets-eSignature-97"
+#define NID_id_smime_mod_ets_eSignature_97      201
+#define OBJ_id_smime_mod_ets_eSignature_97      OBJ_id_smime_mod,6L
 
-#define SN_id_smime_mod_ets_eSigPolicy_88		"id-smime-mod-ets-eSigPolicy-88"
-#define NID_id_smime_mod_ets_eSigPolicy_88		202
-#define OBJ_id_smime_mod_ets_eSigPolicy_88		OBJ_id_smime_mod,7L
+#define SN_id_smime_mod_ets_eSigPolicy_88       "id-smime-mod-ets-eSigPolicy-88"
+#define NID_id_smime_mod_ets_eSigPolicy_88      202
+#define OBJ_id_smime_mod_ets_eSigPolicy_88      OBJ_id_smime_mod,7L
 
-#define SN_id_smime_mod_ets_eSigPolicy_97		"id-smime-mod-ets-eSigPolicy-97"
-#define NID_id_smime_mod_ets_eSigPolicy_97		203
-#define OBJ_id_smime_mod_ets_eSigPolicy_97		OBJ_id_smime_mod,8L
+#define SN_id_smime_mod_ets_eSigPolicy_97       "id-smime-mod-ets-eSigPolicy-97"
+#define NID_id_smime_mod_ets_eSigPolicy_97      203
+#define OBJ_id_smime_mod_ets_eSigPolicy_97      OBJ_id_smime_mod,8L
 
-#define SN_id_smime_ct_receipt		"id-smime-ct-receipt"
-#define NID_id_smime_ct_receipt		204
-#define OBJ_id_smime_ct_receipt		OBJ_id_smime_ct,1L
+#define SN_id_smime_ct_receipt      "id-smime-ct-receipt"
+#define NID_id_smime_ct_receipt     204
+#define OBJ_id_smime_ct_receipt     OBJ_id_smime_ct,1L
 
-#define SN_id_smime_ct_authData		"id-smime-ct-authData"
-#define NID_id_smime_ct_authData		205
-#define OBJ_id_smime_ct_authData		OBJ_id_smime_ct,2L
+#define SN_id_smime_ct_authData     "id-smime-ct-authData"
+#define NID_id_smime_ct_authData        205
+#define OBJ_id_smime_ct_authData        OBJ_id_smime_ct,2L
 
-#define SN_id_smime_ct_publishCert		"id-smime-ct-publishCert"
-#define NID_id_smime_ct_publishCert		206
-#define OBJ_id_smime_ct_publishCert		OBJ_id_smime_ct,3L
+#define SN_id_smime_ct_publishCert      "id-smime-ct-publishCert"
+#define NID_id_smime_ct_publishCert     206
+#define OBJ_id_smime_ct_publishCert     OBJ_id_smime_ct,3L
 
-#define SN_id_smime_ct_TSTInfo		"id-smime-ct-TSTInfo"
-#define NID_id_smime_ct_TSTInfo		207
-#define OBJ_id_smime_ct_TSTInfo		OBJ_id_smime_ct,4L
+#define SN_id_smime_ct_TSTInfo      "id-smime-ct-TSTInfo"
+#define NID_id_smime_ct_TSTInfo     207
+#define OBJ_id_smime_ct_TSTInfo     OBJ_id_smime_ct,4L
 
-#define SN_id_smime_ct_TDTInfo		"id-smime-ct-TDTInfo"
-#define NID_id_smime_ct_TDTInfo		208
-#define OBJ_id_smime_ct_TDTInfo		OBJ_id_smime_ct,5L
+#define SN_id_smime_ct_TDTInfo      "id-smime-ct-TDTInfo"
+#define NID_id_smime_ct_TDTInfo     208
+#define OBJ_id_smime_ct_TDTInfo     OBJ_id_smime_ct,5L
 
-#define SN_id_smime_ct_contentInfo		"id-smime-ct-contentInfo"
-#define NID_id_smime_ct_contentInfo		209
-#define OBJ_id_smime_ct_contentInfo		OBJ_id_smime_ct,6L
+#define SN_id_smime_ct_contentInfo      "id-smime-ct-contentInfo"
+#define NID_id_smime_ct_contentInfo     209
+#define OBJ_id_smime_ct_contentInfo     OBJ_id_smime_ct,6L
 
-#define SN_id_smime_ct_DVCSRequestData		"id-smime-ct-DVCSRequestData"
-#define NID_id_smime_ct_DVCSRequestData		210
-#define OBJ_id_smime_ct_DVCSRequestData		OBJ_id_smime_ct,7L
+#define SN_id_smime_ct_DVCSRequestData      "id-smime-ct-DVCSRequestData"
+#define NID_id_smime_ct_DVCSRequestData     210
+#define OBJ_id_smime_ct_DVCSRequestData     OBJ_id_smime_ct,7L
 
-#define SN_id_smime_ct_DVCSResponseData		"id-smime-ct-DVCSResponseData"
-#define NID_id_smime_ct_DVCSResponseData		211
-#define OBJ_id_smime_ct_DVCSResponseData		OBJ_id_smime_ct,8L
+#define SN_id_smime_ct_DVCSResponseData     "id-smime-ct-DVCSResponseData"
+#define NID_id_smime_ct_DVCSResponseData        211
+#define OBJ_id_smime_ct_DVCSResponseData        OBJ_id_smime_ct,8L
 
-#define SN_id_smime_aa_receiptRequest		"id-smime-aa-receiptRequest"
-#define NID_id_smime_aa_receiptRequest		212
-#define OBJ_id_smime_aa_receiptRequest		OBJ_id_smime_aa,1L
+#define SN_id_smime_aa_receiptRequest       "id-smime-aa-receiptRequest"
+#define NID_id_smime_aa_receiptRequest      212
+#define OBJ_id_smime_aa_receiptRequest      OBJ_id_smime_aa,1L
 
-#define SN_id_smime_aa_securityLabel		"id-smime-aa-securityLabel"
-#define NID_id_smime_aa_securityLabel		213
-#define OBJ_id_smime_aa_securityLabel		OBJ_id_smime_aa,2L
+#define SN_id_smime_aa_securityLabel        "id-smime-aa-securityLabel"
+#define NID_id_smime_aa_securityLabel       213
+#define OBJ_id_smime_aa_securityLabel       OBJ_id_smime_aa,2L
 
-#define SN_id_smime_aa_mlExpandHistory		"id-smime-aa-mlExpandHistory"
-#define NID_id_smime_aa_mlExpandHistory		214
-#define OBJ_id_smime_aa_mlExpandHistory		OBJ_id_smime_aa,3L
+#define SN_id_smime_aa_mlExpandHistory      "id-smime-aa-mlExpandHistory"
+#define NID_id_smime_aa_mlExpandHistory     214
+#define OBJ_id_smime_aa_mlExpandHistory     OBJ_id_smime_aa,3L
 
-#define SN_id_smime_aa_contentHint		"id-smime-aa-contentHint"
-#define NID_id_smime_aa_contentHint		215
-#define OBJ_id_smime_aa_contentHint		OBJ_id_smime_aa,4L
+#define SN_id_smime_aa_contentHint      "id-smime-aa-contentHint"
+#define NID_id_smime_aa_contentHint     215
+#define OBJ_id_smime_aa_contentHint     OBJ_id_smime_aa,4L
 
-#define SN_id_smime_aa_msgSigDigest		"id-smime-aa-msgSigDigest"
-#define NID_id_smime_aa_msgSigDigest		216
-#define OBJ_id_smime_aa_msgSigDigest		OBJ_id_smime_aa,5L
+#define SN_id_smime_aa_msgSigDigest     "id-smime-aa-msgSigDigest"
+#define NID_id_smime_aa_msgSigDigest        216
+#define OBJ_id_smime_aa_msgSigDigest        OBJ_id_smime_aa,5L
 
-#define SN_id_smime_aa_encapContentType		"id-smime-aa-encapContentType"
-#define NID_id_smime_aa_encapContentType		217
-#define OBJ_id_smime_aa_encapContentType		OBJ_id_smime_aa,6L
+#define SN_id_smime_aa_encapContentType     "id-smime-aa-encapContentType"
+#define NID_id_smime_aa_encapContentType        217
+#define OBJ_id_smime_aa_encapContentType        OBJ_id_smime_aa,6L
 
-#define SN_id_smime_aa_contentIdentifier		"id-smime-aa-contentIdentifier"
-#define NID_id_smime_aa_contentIdentifier		218
-#define OBJ_id_smime_aa_contentIdentifier		OBJ_id_smime_aa,7L
+#define SN_id_smime_aa_contentIdentifier        "id-smime-aa-contentIdentifier"
+#define NID_id_smime_aa_contentIdentifier       218
+#define OBJ_id_smime_aa_contentIdentifier       OBJ_id_smime_aa,7L
 
-#define SN_id_smime_aa_macValue		"id-smime-aa-macValue"
-#define NID_id_smime_aa_macValue		219
-#define OBJ_id_smime_aa_macValue		OBJ_id_smime_aa,8L
+#define SN_id_smime_aa_macValue     "id-smime-aa-macValue"
+#define NID_id_smime_aa_macValue        219
+#define OBJ_id_smime_aa_macValue        OBJ_id_smime_aa,8L
 
-#define SN_id_smime_aa_equivalentLabels		"id-smime-aa-equivalentLabels"
-#define NID_id_smime_aa_equivalentLabels		220
-#define OBJ_id_smime_aa_equivalentLabels		OBJ_id_smime_aa,9L
+#define SN_id_smime_aa_equivalentLabels     "id-smime-aa-equivalentLabels"
+#define NID_id_smime_aa_equivalentLabels        220
+#define OBJ_id_smime_aa_equivalentLabels        OBJ_id_smime_aa,9L
 
-#define SN_id_smime_aa_contentReference		"id-smime-aa-contentReference"
-#define NID_id_smime_aa_contentReference		221
-#define OBJ_id_smime_aa_contentReference		OBJ_id_smime_aa,10L
+#define SN_id_smime_aa_contentReference     "id-smime-aa-contentReference"
+#define NID_id_smime_aa_contentReference        221
+#define OBJ_id_smime_aa_contentReference        OBJ_id_smime_aa,10L
 
-#define SN_id_smime_aa_encrypKeyPref		"id-smime-aa-encrypKeyPref"
-#define NID_id_smime_aa_encrypKeyPref		222
-#define OBJ_id_smime_aa_encrypKeyPref		OBJ_id_smime_aa,11L
+#define SN_id_smime_aa_encrypKeyPref        "id-smime-aa-encrypKeyPref"
+#define NID_id_smime_aa_encrypKeyPref       222
+#define OBJ_id_smime_aa_encrypKeyPref       OBJ_id_smime_aa,11L
 
-#define SN_id_smime_aa_signingCertificate		"id-smime-aa-signingCertificate"
-#define NID_id_smime_aa_signingCertificate		223
-#define OBJ_id_smime_aa_signingCertificate		OBJ_id_smime_aa,12L
+#define SN_id_smime_aa_signingCertificate       "id-smime-aa-signingCertificate"
+#define NID_id_smime_aa_signingCertificate      223
+#define OBJ_id_smime_aa_signingCertificate      OBJ_id_smime_aa,12L
 
-#define SN_id_smime_aa_smimeEncryptCerts		"id-smime-aa-smimeEncryptCerts"
-#define NID_id_smime_aa_smimeEncryptCerts		224
-#define OBJ_id_smime_aa_smimeEncryptCerts		OBJ_id_smime_aa,13L
+#define SN_id_smime_aa_smimeEncryptCerts        "id-smime-aa-smimeEncryptCerts"
+#define NID_id_smime_aa_smimeEncryptCerts       224
+#define OBJ_id_smime_aa_smimeEncryptCerts       OBJ_id_smime_aa,13L
 
-#define SN_id_smime_aa_timeStampToken		"id-smime-aa-timeStampToken"
-#define NID_id_smime_aa_timeStampToken		225
-#define OBJ_id_smime_aa_timeStampToken		OBJ_id_smime_aa,14L
+#define SN_id_smime_aa_timeStampToken       "id-smime-aa-timeStampToken"
+#define NID_id_smime_aa_timeStampToken      225
+#define OBJ_id_smime_aa_timeStampToken      OBJ_id_smime_aa,14L
 
-#define SN_id_smime_aa_ets_sigPolicyId		"id-smime-aa-ets-sigPolicyId"
-#define NID_id_smime_aa_ets_sigPolicyId		226
-#define OBJ_id_smime_aa_ets_sigPolicyId		OBJ_id_smime_aa,15L
+#define SN_id_smime_aa_ets_sigPolicyId      "id-smime-aa-ets-sigPolicyId"
+#define NID_id_smime_aa_ets_sigPolicyId     226
+#define OBJ_id_smime_aa_ets_sigPolicyId     OBJ_id_smime_aa,15L
 
-#define SN_id_smime_aa_ets_commitmentType		"id-smime-aa-ets-commitmentType"
-#define NID_id_smime_aa_ets_commitmentType		227
-#define OBJ_id_smime_aa_ets_commitmentType		OBJ_id_smime_aa,16L
+#define SN_id_smime_aa_ets_commitmentType       "id-smime-aa-ets-commitmentType"
+#define NID_id_smime_aa_ets_commitmentType      227
+#define OBJ_id_smime_aa_ets_commitmentType      OBJ_id_smime_aa,16L
 
-#define SN_id_smime_aa_ets_signerLocation		"id-smime-aa-ets-signerLocation"
-#define NID_id_smime_aa_ets_signerLocation		228
-#define OBJ_id_smime_aa_ets_signerLocation		OBJ_id_smime_aa,17L
+#define SN_id_smime_aa_ets_signerLocation       "id-smime-aa-ets-signerLocation"
+#define NID_id_smime_aa_ets_signerLocation      228
+#define OBJ_id_smime_aa_ets_signerLocation      OBJ_id_smime_aa,17L
 
-#define SN_id_smime_aa_ets_signerAttr		"id-smime-aa-ets-signerAttr"
-#define NID_id_smime_aa_ets_signerAttr		229
-#define OBJ_id_smime_aa_ets_signerAttr		OBJ_id_smime_aa,18L
+#define SN_id_smime_aa_ets_signerAttr       "id-smime-aa-ets-signerAttr"
+#define NID_id_smime_aa_ets_signerAttr      229
+#define OBJ_id_smime_aa_ets_signerAttr      OBJ_id_smime_aa,18L
 
-#define SN_id_smime_aa_ets_otherSigCert		"id-smime-aa-ets-otherSigCert"
-#define NID_id_smime_aa_ets_otherSigCert		230
-#define OBJ_id_smime_aa_ets_otherSigCert		OBJ_id_smime_aa,19L
+#define SN_id_smime_aa_ets_otherSigCert     "id-smime-aa-ets-otherSigCert"
+#define NID_id_smime_aa_ets_otherSigCert        230
+#define OBJ_id_smime_aa_ets_otherSigCert        OBJ_id_smime_aa,19L
 
-#define SN_id_smime_aa_ets_contentTimestamp		"id-smime-aa-ets-contentTimestamp"
-#define NID_id_smime_aa_ets_contentTimestamp		231
-#define OBJ_id_smime_aa_ets_contentTimestamp		OBJ_id_smime_aa,20L
+#define SN_id_smime_aa_ets_contentTimestamp     "id-smime-aa-ets-contentTimestamp"
+#define NID_id_smime_aa_ets_contentTimestamp        231
+#define OBJ_id_smime_aa_ets_contentTimestamp        OBJ_id_smime_aa,20L
 
-#define SN_id_smime_aa_ets_CertificateRefs		"id-smime-aa-ets-CertificateRefs"
-#define NID_id_smime_aa_ets_CertificateRefs		232
-#define OBJ_id_smime_aa_ets_CertificateRefs		OBJ_id_smime_aa,21L
+#define SN_id_smime_aa_ets_CertificateRefs      "id-smime-aa-ets-CertificateRefs"
+#define NID_id_smime_aa_ets_CertificateRefs     232
+#define OBJ_id_smime_aa_ets_CertificateRefs     OBJ_id_smime_aa,21L
 
-#define SN_id_smime_aa_ets_RevocationRefs		"id-smime-aa-ets-RevocationRefs"
-#define NID_id_smime_aa_ets_RevocationRefs		233
-#define OBJ_id_smime_aa_ets_RevocationRefs		OBJ_id_smime_aa,22L
+#define SN_id_smime_aa_ets_RevocationRefs       "id-smime-aa-ets-RevocationRefs"
+#define NID_id_smime_aa_ets_RevocationRefs      233
+#define OBJ_id_smime_aa_ets_RevocationRefs      OBJ_id_smime_aa,22L
 
-#define SN_id_smime_aa_ets_certValues		"id-smime-aa-ets-certValues"
-#define NID_id_smime_aa_ets_certValues		234
-#define OBJ_id_smime_aa_ets_certValues		OBJ_id_smime_aa,23L
+#define SN_id_smime_aa_ets_certValues       "id-smime-aa-ets-certValues"
+#define NID_id_smime_aa_ets_certValues      234
+#define OBJ_id_smime_aa_ets_certValues      OBJ_id_smime_aa,23L
 
-#define SN_id_smime_aa_ets_revocationValues		"id-smime-aa-ets-revocationValues"
-#define NID_id_smime_aa_ets_revocationValues		235
-#define OBJ_id_smime_aa_ets_revocationValues		OBJ_id_smime_aa,24L
+#define SN_id_smime_aa_ets_revocationValues     "id-smime-aa-ets-revocationValues"
+#define NID_id_smime_aa_ets_revocationValues        235
+#define OBJ_id_smime_aa_ets_revocationValues        OBJ_id_smime_aa,24L
 
-#define SN_id_smime_aa_ets_escTimeStamp		"id-smime-aa-ets-escTimeStamp"
-#define NID_id_smime_aa_ets_escTimeStamp		236
-#define OBJ_id_smime_aa_ets_escTimeStamp		OBJ_id_smime_aa,25L
+#define SN_id_smime_aa_ets_escTimeStamp     "id-smime-aa-ets-escTimeStamp"
+#define NID_id_smime_aa_ets_escTimeStamp        236
+#define OBJ_id_smime_aa_ets_escTimeStamp        OBJ_id_smime_aa,25L
 
-#define SN_id_smime_aa_ets_certCRLTimestamp		"id-smime-aa-ets-certCRLTimestamp"
-#define NID_id_smime_aa_ets_certCRLTimestamp		237
-#define OBJ_id_smime_aa_ets_certCRLTimestamp		OBJ_id_smime_aa,26L
+#define SN_id_smime_aa_ets_certCRLTimestamp     "id-smime-aa-ets-certCRLTimestamp"
+#define NID_id_smime_aa_ets_certCRLTimestamp        237
+#define OBJ_id_smime_aa_ets_certCRLTimestamp        OBJ_id_smime_aa,26L
 
-#define SN_id_smime_aa_ets_archiveTimeStamp		"id-smime-aa-ets-archiveTimeStamp"
-#define NID_id_smime_aa_ets_archiveTimeStamp		238
-#define OBJ_id_smime_aa_ets_archiveTimeStamp		OBJ_id_smime_aa,27L
+#define SN_id_smime_aa_ets_archiveTimeStamp     "id-smime-aa-ets-archiveTimeStamp"
+#define NID_id_smime_aa_ets_archiveTimeStamp        238
+#define OBJ_id_smime_aa_ets_archiveTimeStamp        OBJ_id_smime_aa,27L
 
-#define SN_id_smime_aa_signatureType		"id-smime-aa-signatureType"
-#define NID_id_smime_aa_signatureType		239
-#define OBJ_id_smime_aa_signatureType		OBJ_id_smime_aa,28L
+#define SN_id_smime_aa_signatureType        "id-smime-aa-signatureType"
+#define NID_id_smime_aa_signatureType       239
+#define OBJ_id_smime_aa_signatureType       OBJ_id_smime_aa,28L
 
-#define SN_id_smime_aa_dvcs_dvc		"id-smime-aa-dvcs-dvc"
-#define NID_id_smime_aa_dvcs_dvc		240
-#define OBJ_id_smime_aa_dvcs_dvc		OBJ_id_smime_aa,29L
+#define SN_id_smime_aa_dvcs_dvc     "id-smime-aa-dvcs-dvc"
+#define NID_id_smime_aa_dvcs_dvc        240
+#define OBJ_id_smime_aa_dvcs_dvc        OBJ_id_smime_aa,29L
 
-#define SN_id_smime_alg_ESDHwith3DES		"id-smime-alg-ESDHwith3DES"
-#define NID_id_smime_alg_ESDHwith3DES		241
-#define OBJ_id_smime_alg_ESDHwith3DES		OBJ_id_smime_alg,1L
+#define SN_id_smime_alg_ESDHwith3DES        "id-smime-alg-ESDHwith3DES"
+#define NID_id_smime_alg_ESDHwith3DES       241
+#define OBJ_id_smime_alg_ESDHwith3DES       OBJ_id_smime_alg,1L
 
-#define SN_id_smime_alg_ESDHwithRC2		"id-smime-alg-ESDHwithRC2"
-#define NID_id_smime_alg_ESDHwithRC2		242
-#define OBJ_id_smime_alg_ESDHwithRC2		OBJ_id_smime_alg,2L
+#define SN_id_smime_alg_ESDHwithRC2     "id-smime-alg-ESDHwithRC2"
+#define NID_id_smime_alg_ESDHwithRC2        242
+#define OBJ_id_smime_alg_ESDHwithRC2        OBJ_id_smime_alg,2L
 
-#define SN_id_smime_alg_3DESwrap		"id-smime-alg-3DESwrap"
-#define NID_id_smime_alg_3DESwrap		243
-#define OBJ_id_smime_alg_3DESwrap		OBJ_id_smime_alg,3L
+#define SN_id_smime_alg_3DESwrap        "id-smime-alg-3DESwrap"
+#define NID_id_smime_alg_3DESwrap       243
+#define OBJ_id_smime_alg_3DESwrap       OBJ_id_smime_alg,3L
 
-#define SN_id_smime_alg_RC2wrap		"id-smime-alg-RC2wrap"
-#define NID_id_smime_alg_RC2wrap		244
-#define OBJ_id_smime_alg_RC2wrap		OBJ_id_smime_alg,4L
+#define SN_id_smime_alg_RC2wrap     "id-smime-alg-RC2wrap"
+#define NID_id_smime_alg_RC2wrap        244
+#define OBJ_id_smime_alg_RC2wrap        OBJ_id_smime_alg,4L
 
-#define SN_id_smime_alg_ESDH		"id-smime-alg-ESDH"
-#define NID_id_smime_alg_ESDH		245
-#define OBJ_id_smime_alg_ESDH		OBJ_id_smime_alg,5L
+#define SN_id_smime_alg_ESDH        "id-smime-alg-ESDH"
+#define NID_id_smime_alg_ESDH       245
+#define OBJ_id_smime_alg_ESDH       OBJ_id_smime_alg,5L
 
-#define SN_id_smime_alg_CMS3DESwrap		"id-smime-alg-CMS3DESwrap"
-#define NID_id_smime_alg_CMS3DESwrap		246
-#define OBJ_id_smime_alg_CMS3DESwrap		OBJ_id_smime_alg,6L
+#define SN_id_smime_alg_CMS3DESwrap     "id-smime-alg-CMS3DESwrap"
+#define NID_id_smime_alg_CMS3DESwrap        246
+#define OBJ_id_smime_alg_CMS3DESwrap        OBJ_id_smime_alg,6L
 
-#define SN_id_smime_alg_CMSRC2wrap		"id-smime-alg-CMSRC2wrap"
-#define NID_id_smime_alg_CMSRC2wrap		247
-#define OBJ_id_smime_alg_CMSRC2wrap		OBJ_id_smime_alg,7L
+#define SN_id_smime_alg_CMSRC2wrap      "id-smime-alg-CMSRC2wrap"
+#define NID_id_smime_alg_CMSRC2wrap     247
+#define OBJ_id_smime_alg_CMSRC2wrap     OBJ_id_smime_alg,7L
 
-#define SN_id_smime_cd_ldap		"id-smime-cd-ldap"
-#define NID_id_smime_cd_ldap		248
-#define OBJ_id_smime_cd_ldap		OBJ_id_smime_cd,1L
+#define SN_id_smime_cd_ldap     "id-smime-cd-ldap"
+#define NID_id_smime_cd_ldap        248
+#define OBJ_id_smime_cd_ldap        OBJ_id_smime_cd,1L
 
-#define SN_id_smime_spq_ets_sqt_uri		"id-smime-spq-ets-sqt-uri"
-#define NID_id_smime_spq_ets_sqt_uri		249
-#define OBJ_id_smime_spq_ets_sqt_uri		OBJ_id_smime_spq,1L
+#define SN_id_smime_spq_ets_sqt_uri     "id-smime-spq-ets-sqt-uri"
+#define NID_id_smime_spq_ets_sqt_uri        249
+#define OBJ_id_smime_spq_ets_sqt_uri        OBJ_id_smime_spq,1L
 
-#define SN_id_smime_spq_ets_sqt_unotice		"id-smime-spq-ets-sqt-unotice"
-#define NID_id_smime_spq_ets_sqt_unotice		250
-#define OBJ_id_smime_spq_ets_sqt_unotice		OBJ_id_smime_spq,2L
+#define SN_id_smime_spq_ets_sqt_unotice     "id-smime-spq-ets-sqt-unotice"
+#define NID_id_smime_spq_ets_sqt_unotice        250
+#define OBJ_id_smime_spq_ets_sqt_unotice        OBJ_id_smime_spq,2L
 
-#define SN_id_smime_cti_ets_proofOfOrigin		"id-smime-cti-ets-proofOfOrigin"
-#define NID_id_smime_cti_ets_proofOfOrigin		251
-#define OBJ_id_smime_cti_ets_proofOfOrigin		OBJ_id_smime_cti,1L
+#define SN_id_smime_cti_ets_proofOfOrigin       "id-smime-cti-ets-proofOfOrigin"
+#define NID_id_smime_cti_ets_proofOfOrigin      251
+#define OBJ_id_smime_cti_ets_proofOfOrigin      OBJ_id_smime_cti,1L
 
-#define SN_id_smime_cti_ets_proofOfReceipt		"id-smime-cti-ets-proofOfReceipt"
-#define NID_id_smime_cti_ets_proofOfReceipt		252
-#define OBJ_id_smime_cti_ets_proofOfReceipt		OBJ_id_smime_cti,2L
+#define SN_id_smime_cti_ets_proofOfReceipt      "id-smime-cti-ets-proofOfReceipt"
+#define NID_id_smime_cti_ets_proofOfReceipt     252
+#define OBJ_id_smime_cti_ets_proofOfReceipt     OBJ_id_smime_cti,2L
 
-#define SN_id_smime_cti_ets_proofOfDelivery		"id-smime-cti-ets-proofOfDelivery"
-#define NID_id_smime_cti_ets_proofOfDelivery		253
-#define OBJ_id_smime_cti_ets_proofOfDelivery		OBJ_id_smime_cti,3L
+#define SN_id_smime_cti_ets_proofOfDelivery     "id-smime-cti-ets-proofOfDelivery"
+#define NID_id_smime_cti_ets_proofOfDelivery        253
+#define OBJ_id_smime_cti_ets_proofOfDelivery        OBJ_id_smime_cti,3L
 
-#define SN_id_smime_cti_ets_proofOfSender		"id-smime-cti-ets-proofOfSender"
-#define NID_id_smime_cti_ets_proofOfSender		254
-#define OBJ_id_smime_cti_ets_proofOfSender		OBJ_id_smime_cti,4L
+#define SN_id_smime_cti_ets_proofOfSender       "id-smime-cti-ets-proofOfSender"
+#define NID_id_smime_cti_ets_proofOfSender      254
+#define OBJ_id_smime_cti_ets_proofOfSender      OBJ_id_smime_cti,4L
 
-#define SN_id_smime_cti_ets_proofOfApproval		"id-smime-cti-ets-proofOfApproval"
-#define NID_id_smime_cti_ets_proofOfApproval		255
-#define OBJ_id_smime_cti_ets_proofOfApproval		OBJ_id_smime_cti,5L
+#define SN_id_smime_cti_ets_proofOfApproval     "id-smime-cti-ets-proofOfApproval"
+#define NID_id_smime_cti_ets_proofOfApproval        255
+#define OBJ_id_smime_cti_ets_proofOfApproval        OBJ_id_smime_cti,5L
 
-#define SN_id_smime_cti_ets_proofOfCreation		"id-smime-cti-ets-proofOfCreation"
-#define NID_id_smime_cti_ets_proofOfCreation		256
-#define OBJ_id_smime_cti_ets_proofOfCreation		OBJ_id_smime_cti,6L
+#define SN_id_smime_cti_ets_proofOfCreation     "id-smime-cti-ets-proofOfCreation"
+#define NID_id_smime_cti_ets_proofOfCreation        256
+#define OBJ_id_smime_cti_ets_proofOfCreation        OBJ_id_smime_cti,6L
 
-#define LN_friendlyName		"friendlyName"
-#define NID_friendlyName		156
-#define OBJ_friendlyName		OBJ_pkcs9,20L
+#define LN_friendlyName     "friendlyName"
+#define NID_friendlyName        156
+#define OBJ_friendlyName        OBJ_pkcs9,20L
 
-#define LN_localKeyID		"localKeyID"
-#define NID_localKeyID		157
-#define OBJ_localKeyID		OBJ_pkcs9,21L
+#define LN_localKeyID       "localKeyID"
+#define NID_localKeyID      157
+#define OBJ_localKeyID      OBJ_pkcs9,21L
 
-#define SN_ms_csp_name		"CSPName"
-#define LN_ms_csp_name		"Microsoft CSP Name"
-#define NID_ms_csp_name		417
-#define OBJ_ms_csp_name		1L,3L,6L,1L,4L,1L,311L,17L,1L
+#define SN_ms_csp_name      "CSPName"
+#define LN_ms_csp_name      "Microsoft CSP Name"
+#define NID_ms_csp_name     417
+#define OBJ_ms_csp_name     1L,3L,6L,1L,4L,1L,311L,17L,1L
 
-#define OBJ_certTypes		OBJ_pkcs9,22L
+#define OBJ_certTypes       OBJ_pkcs9,22L
 
-#define LN_x509Certificate		"x509Certificate"
-#define NID_x509Certificate		158
-#define OBJ_x509Certificate		OBJ_certTypes,1L
+#define LN_x509Certificate      "x509Certificate"
+#define NID_x509Certificate     158
+#define OBJ_x509Certificate     OBJ_certTypes,1L
 
-#define LN_sdsiCertificate		"sdsiCertificate"
-#define NID_sdsiCertificate		159
-#define OBJ_sdsiCertificate		OBJ_certTypes,2L
+#define LN_sdsiCertificate      "sdsiCertificate"
+#define NID_sdsiCertificate     159
+#define OBJ_sdsiCertificate     OBJ_certTypes,2L
 
-#define OBJ_crlTypes		OBJ_pkcs9,23L
+#define OBJ_crlTypes        OBJ_pkcs9,23L
 
-#define LN_x509Crl		"x509Crl"
-#define NID_x509Crl		160
-#define OBJ_x509Crl		OBJ_crlTypes,1L
+#define LN_x509Crl      "x509Crl"
+#define NID_x509Crl     160
+#define OBJ_x509Crl     OBJ_crlTypes,1L
 
-#define OBJ_pkcs12		OBJ_pkcs,12L
+#define OBJ_pkcs12      OBJ_pkcs,12L
 
-#define OBJ_pkcs12_pbeids		OBJ_pkcs12,1L
+#define OBJ_pkcs12_pbeids       OBJ_pkcs12,1L
 
-#define SN_pbe_WithSHA1And128BitRC4		"PBE-SHA1-RC4-128"
-#define LN_pbe_WithSHA1And128BitRC4		"pbeWithSHA1And128BitRC4"
-#define NID_pbe_WithSHA1And128BitRC4		144
-#define OBJ_pbe_WithSHA1And128BitRC4		OBJ_pkcs12_pbeids,1L
+#define SN_pbe_WithSHA1And128BitRC4     "PBE-SHA1-RC4-128"
+#define LN_pbe_WithSHA1And128BitRC4     "pbeWithSHA1And128BitRC4"
+#define NID_pbe_WithSHA1And128BitRC4        144
+#define OBJ_pbe_WithSHA1And128BitRC4        OBJ_pkcs12_pbeids,1L
 
-#define SN_pbe_WithSHA1And40BitRC4		"PBE-SHA1-RC4-40"
-#define LN_pbe_WithSHA1And40BitRC4		"pbeWithSHA1And40BitRC4"
-#define NID_pbe_WithSHA1And40BitRC4		145
-#define OBJ_pbe_WithSHA1And40BitRC4		OBJ_pkcs12_pbeids,2L
+#define SN_pbe_WithSHA1And40BitRC4      "PBE-SHA1-RC4-40"
+#define LN_pbe_WithSHA1And40BitRC4      "pbeWithSHA1And40BitRC4"
+#define NID_pbe_WithSHA1And40BitRC4     145
+#define OBJ_pbe_WithSHA1And40BitRC4     OBJ_pkcs12_pbeids,2L
 
-#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC		"PBE-SHA1-3DES"
-#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC		"pbeWithSHA1And3-KeyTripleDES-CBC"
-#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC		146
-#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC		OBJ_pkcs12_pbeids,3L
+#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC       "PBE-SHA1-3DES"
+#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC       "pbeWithSHA1And3-KeyTripleDES-CBC"
+#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC      146
+#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC      OBJ_pkcs12_pbeids,3L
 
-#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC		"PBE-SHA1-2DES"
-#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC		"pbeWithSHA1And2-KeyTripleDES-CBC"
-#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC		147
-#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC		OBJ_pkcs12_pbeids,4L
+#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC       "PBE-SHA1-2DES"
+#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC       "pbeWithSHA1And2-KeyTripleDES-CBC"
+#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC      147
+#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC      OBJ_pkcs12_pbeids,4L
 
-#define SN_pbe_WithSHA1And128BitRC2_CBC		"PBE-SHA1-RC2-128"
-#define LN_pbe_WithSHA1And128BitRC2_CBC		"pbeWithSHA1And128BitRC2-CBC"
-#define NID_pbe_WithSHA1And128BitRC2_CBC		148
-#define OBJ_pbe_WithSHA1And128BitRC2_CBC		OBJ_pkcs12_pbeids,5L
+#define SN_pbe_WithSHA1And128BitRC2_CBC     "PBE-SHA1-RC2-128"
+#define LN_pbe_WithSHA1And128BitRC2_CBC     "pbeWithSHA1And128BitRC2-CBC"
+#define NID_pbe_WithSHA1And128BitRC2_CBC        148
+#define OBJ_pbe_WithSHA1And128BitRC2_CBC        OBJ_pkcs12_pbeids,5L
 
-#define SN_pbe_WithSHA1And40BitRC2_CBC		"PBE-SHA1-RC2-40"
-#define LN_pbe_WithSHA1And40BitRC2_CBC		"pbeWithSHA1And40BitRC2-CBC"
-#define NID_pbe_WithSHA1And40BitRC2_CBC		149
-#define OBJ_pbe_WithSHA1And40BitRC2_CBC		OBJ_pkcs12_pbeids,6L
+#define SN_pbe_WithSHA1And40BitRC2_CBC      "PBE-SHA1-RC2-40"
+#define LN_pbe_WithSHA1And40BitRC2_CBC      "pbeWithSHA1And40BitRC2-CBC"
+#define NID_pbe_WithSHA1And40BitRC2_CBC     149
+#define OBJ_pbe_WithSHA1And40BitRC2_CBC     OBJ_pkcs12_pbeids,6L
 
-#define OBJ_pkcs12_Version1		OBJ_pkcs12,10L
-
-#define OBJ_pkcs12_BagIds		OBJ_pkcs12_Version1,1L
+#define OBJ_pkcs12_Version1     OBJ_pkcs12,10L
+
+#define OBJ_pkcs12_BagIds       OBJ_pkcs12_Version1,1L
 
-#define LN_keyBag		"keyBag"
-#define NID_keyBag		150
-#define OBJ_keyBag		OBJ_pkcs12_BagIds,1L
+#define LN_keyBag       "keyBag"
+#define NID_keyBag      150
+#define OBJ_keyBag      OBJ_pkcs12_BagIds,1L
 
-#define LN_pkcs8ShroudedKeyBag		"pkcs8ShroudedKeyBag"
-#define NID_pkcs8ShroudedKeyBag		151
-#define OBJ_pkcs8ShroudedKeyBag		OBJ_pkcs12_BagIds,2L
+#define LN_pkcs8ShroudedKeyBag      "pkcs8ShroudedKeyBag"
+#define NID_pkcs8ShroudedKeyBag     151
+#define OBJ_pkcs8ShroudedKeyBag     OBJ_pkcs12_BagIds,2L
 
-#define LN_certBag		"certBag"
-#define NID_certBag		152
-#define OBJ_certBag		OBJ_pkcs12_BagIds,3L
-
-#define LN_crlBag		"crlBag"
-#define NID_crlBag		153
-#define OBJ_crlBag		OBJ_pkcs12_BagIds,4L
-
-#define LN_secretBag		"secretBag"
-#define NID_secretBag		154
-#define OBJ_secretBag		OBJ_pkcs12_BagIds,5L
-
-#define LN_safeContentsBag		"safeContentsBag"
-#define NID_safeContentsBag		155
-#define OBJ_safeContentsBag		OBJ_pkcs12_BagIds,6L
-
-#define SN_md2		"MD2"
-#define LN_md2		"md2"
-#define NID_md2		3
-#define OBJ_md2		OBJ_rsadsi,2L,2L
-
-#define SN_md4		"MD4"
-#define LN_md4		"md4"
-#define NID_md4		257
-#define OBJ_md4		OBJ_rsadsi,2L,4L
-
-#define SN_md5		"MD5"
-#define LN_md5		"md5"
-#define NID_md5		4
-#define OBJ_md5		OBJ_rsadsi,2L,5L
-
-#define SN_md5_sha1		"MD5-SHA1"
-#define LN_md5_sha1		"md5-sha1"
-#define NID_md5_sha1		114
-
-#define LN_hmacWithSHA1		"hmacWithSHA1"
-#define NID_hmacWithSHA1		163
-#define OBJ_hmacWithSHA1		OBJ_rsadsi,2L,7L
-
-#define SN_rc2_cbc		"RC2-CBC"
-#define LN_rc2_cbc		"rc2-cbc"
-#define NID_rc2_cbc		37
-#define OBJ_rc2_cbc		OBJ_rsadsi,3L,2L
-
-#define SN_rc2_ecb		"RC2-ECB"
-#define LN_rc2_ecb		"rc2-ecb"
-#define NID_rc2_ecb		38
-
-#define SN_rc2_cfb64		"RC2-CFB"
-#define LN_rc2_cfb64		"rc2-cfb"
-#define NID_rc2_cfb64		39
-
-#define SN_rc2_ofb64		"RC2-OFB"
-#define LN_rc2_ofb64		"rc2-ofb"
-#define NID_rc2_ofb64		40
-
-#define SN_rc2_40_cbc		"RC2-40-CBC"
-#define LN_rc2_40_cbc		"rc2-40-cbc"
-#define NID_rc2_40_cbc		98
-
-#define SN_rc2_64_cbc		"RC2-64-CBC"
-#define LN_rc2_64_cbc		"rc2-64-cbc"
-#define NID_rc2_64_cbc		166
-
-#define SN_rc4		"RC4"
-#define LN_rc4		"rc4"
-#define NID_rc4		5
-#define OBJ_rc4		OBJ_rsadsi,3L,4L
-
-#define SN_rc4_40		"RC4-40"
-#define LN_rc4_40		"rc4-40"
-#define NID_rc4_40		97
-
-#define SN_des_ede3_cbc		"DES-EDE3-CBC"
-#define LN_des_ede3_cbc		"des-ede3-cbc"
-#define NID_des_ede3_cbc		44
-#define OBJ_des_ede3_cbc		OBJ_rsadsi,3L,7L
-
-#define SN_rc5_cbc		"RC5-CBC"
-#define LN_rc5_cbc		"rc5-cbc"
-#define NID_rc5_cbc		120
-#define OBJ_rc5_cbc		OBJ_rsadsi,3L,8L
-
-#define SN_rc5_ecb		"RC5-ECB"
-#define LN_rc5_ecb		"rc5-ecb"
-#define NID_rc5_ecb		121
-
-#define SN_rc5_cfb64		"RC5-CFB"
-#define LN_rc5_cfb64		"rc5-cfb"
-#define NID_rc5_cfb64		122
-
-#define SN_rc5_ofb64		"RC5-OFB"
-#define LN_rc5_ofb64		"rc5-ofb"
-#define NID_rc5_ofb64		123
-
-#define SN_ms_ext_req		"msExtReq"
-#define LN_ms_ext_req		"Microsoft Extension Request"
-#define NID_ms_ext_req		171
-#define OBJ_ms_ext_req		1L,3L,6L,1L,4L,1L,311L,2L,1L,14L
-
-#define SN_ms_code_ind		"msCodeInd"
-#define LN_ms_code_ind		"Microsoft Individual Code Signing"
-#define NID_ms_code_ind		134
-#define OBJ_ms_code_ind		1L,3L,6L,1L,4L,1L,311L,2L,1L,21L
-
-#define SN_ms_code_com		"msCodeCom"
-#define LN_ms_code_com		"Microsoft Commercial Code Signing"
-#define NID_ms_code_com		135
-#define OBJ_ms_code_com		1L,3L,6L,1L,4L,1L,311L,2L,1L,22L
-
-#define SN_ms_ctl_sign		"msCTLSign"
-#define LN_ms_ctl_sign		"Microsoft Trust List Signing"
-#define NID_ms_ctl_sign		136
-#define OBJ_ms_ctl_sign		1L,3L,6L,1L,4L,1L,311L,10L,3L,1L
-
-#define SN_ms_sgc		"msSGC"
-#define LN_ms_sgc		"Microsoft Server Gated Crypto"
-#define NID_ms_sgc		137
-#define OBJ_ms_sgc		1L,3L,6L,1L,4L,1L,311L,10L,3L,3L
-
-#define SN_ms_efs		"msEFS"
-#define LN_ms_efs		"Microsoft Encrypted File System"
-#define NID_ms_efs		138
-#define OBJ_ms_efs		1L,3L,6L,1L,4L,1L,311L,10L,3L,4L
-
-#define SN_ms_smartcard_login		"msSmartcardLogin"
-#define LN_ms_smartcard_login		"Microsoft Smartcardlogin"
-#define NID_ms_smartcard_login		648
-#define OBJ_ms_smartcard_login		1L,3L,6L,1L,4L,1L,311L,20L,2L,2L
-
-#define SN_ms_upn		"msUPN"
-#define LN_ms_upn		"Microsoft Universal Principal Name"
-#define NID_ms_upn		649
-#define OBJ_ms_upn		1L,3L,6L,1L,4L,1L,311L,20L,2L,3L
-
-#define SN_idea_cbc		"IDEA-CBC"
-#define LN_idea_cbc		"idea-cbc"
-#define NID_idea_cbc		34
-#define OBJ_idea_cbc		1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L
-
-#define SN_idea_ecb		"IDEA-ECB"
-#define LN_idea_ecb		"idea-ecb"
-#define NID_idea_ecb		36
-
-#define SN_idea_cfb64		"IDEA-CFB"
-#define LN_idea_cfb64		"idea-cfb"
-#define NID_idea_cfb64		35
-
-#define SN_idea_ofb64		"IDEA-OFB"
-#define LN_idea_ofb64		"idea-ofb"
-#define NID_idea_ofb64		46
-
-#define SN_bf_cbc		"BF-CBC"
-#define LN_bf_cbc		"bf-cbc"
-#define NID_bf_cbc		91
-#define OBJ_bf_cbc		1L,3L,6L,1L,4L,1L,3029L,1L,2L
-
-#define SN_bf_ecb		"BF-ECB"
-#define LN_bf_ecb		"bf-ecb"
-#define NID_bf_ecb		92
-
-#define SN_bf_cfb64		"BF-CFB"
-#define LN_bf_cfb64		"bf-cfb"
-#define NID_bf_cfb64		93
-
-#define SN_bf_ofb64		"BF-OFB"
-#define LN_bf_ofb64		"bf-ofb"
-#define NID_bf_ofb64		94
-
-#define SN_id_pkix		"PKIX"
-#define NID_id_pkix		127
-#define OBJ_id_pkix		1L,3L,6L,1L,5L,5L,7L
-
-#define SN_id_pkix_mod		"id-pkix-mod"
-#define NID_id_pkix_mod		258
-#define OBJ_id_pkix_mod		OBJ_id_pkix,0L
-
-#define SN_id_pe		"id-pe"
-#define NID_id_pe		175
-#define OBJ_id_pe		OBJ_id_pkix,1L
-
-#define SN_id_qt		"id-qt"
-#define NID_id_qt		259
-#define OBJ_id_qt		OBJ_id_pkix,2L
-
-#define SN_id_kp		"id-kp"
-#define NID_id_kp		128
-#define OBJ_id_kp		OBJ_id_pkix,3L
-
-#define SN_id_it		"id-it"
-#define NID_id_it		260
-#define OBJ_id_it		OBJ_id_pkix,4L
-
-#define SN_id_pkip		"id-pkip"
-#define NID_id_pkip		261
-#define OBJ_id_pkip		OBJ_id_pkix,5L
-
-#define SN_id_alg		"id-alg"
-#define NID_id_alg		262
-#define OBJ_id_alg		OBJ_id_pkix,6L
-
-#define SN_id_cmc		"id-cmc"
-#define NID_id_cmc		263
-#define OBJ_id_cmc		OBJ_id_pkix,7L
-
-#define SN_id_on		"id-on"
-#define NID_id_on		264
-#define OBJ_id_on		OBJ_id_pkix,8L
-
-#define SN_id_pda		"id-pda"
-#define NID_id_pda		265
-#define OBJ_id_pda		OBJ_id_pkix,9L
-
-#define SN_id_aca		"id-aca"
-#define NID_id_aca		266
-#define OBJ_id_aca		OBJ_id_pkix,10L
-
-#define SN_id_qcs		"id-qcs"
-#define NID_id_qcs		267
-#define OBJ_id_qcs		OBJ_id_pkix,11L
-
-#define SN_id_cct		"id-cct"
-#define NID_id_cct		268
-#define OBJ_id_cct		OBJ_id_pkix,12L
-
-#define SN_id_ppl		"id-ppl"
-#define NID_id_ppl		662
-#define OBJ_id_ppl		OBJ_id_pkix,21L
-
-#define SN_id_ad		"id-ad"
-#define NID_id_ad		176
-#define OBJ_id_ad		OBJ_id_pkix,48L
-
-#define SN_id_pkix1_explicit_88		"id-pkix1-explicit-88"
-#define NID_id_pkix1_explicit_88		269
-#define OBJ_id_pkix1_explicit_88		OBJ_id_pkix_mod,1L
-
-#define SN_id_pkix1_implicit_88		"id-pkix1-implicit-88"
-#define NID_id_pkix1_implicit_88		270
-#define OBJ_id_pkix1_implicit_88		OBJ_id_pkix_mod,2L
-
-#define SN_id_pkix1_explicit_93		"id-pkix1-explicit-93"
-#define NID_id_pkix1_explicit_93		271
-#define OBJ_id_pkix1_explicit_93		OBJ_id_pkix_mod,3L
-
-#define SN_id_pkix1_implicit_93		"id-pkix1-implicit-93"
-#define NID_id_pkix1_implicit_93		272
-#define OBJ_id_pkix1_implicit_93		OBJ_id_pkix_mod,4L
-
-#define SN_id_mod_crmf		"id-mod-crmf"
-#define NID_id_mod_crmf		273
-#define OBJ_id_mod_crmf		OBJ_id_pkix_mod,5L
-
-#define SN_id_mod_cmc		"id-mod-cmc"
-#define NID_id_mod_cmc		274
-#define OBJ_id_mod_cmc		OBJ_id_pkix_mod,6L
-
-#define SN_id_mod_kea_profile_88		"id-mod-kea-profile-88"
-#define NID_id_mod_kea_profile_88		275
-#define OBJ_id_mod_kea_profile_88		OBJ_id_pkix_mod,7L
-
-#define SN_id_mod_kea_profile_93		"id-mod-kea-profile-93"
-#define NID_id_mod_kea_profile_93		276
-#define OBJ_id_mod_kea_profile_93		OBJ_id_pkix_mod,8L
-
-#define SN_id_mod_cmp		"id-mod-cmp"
-#define NID_id_mod_cmp		277
-#define OBJ_id_mod_cmp		OBJ_id_pkix_mod,9L
-
-#define SN_id_mod_qualified_cert_88		"id-mod-qualified-cert-88"
-#define NID_id_mod_qualified_cert_88		278
-#define OBJ_id_mod_qualified_cert_88		OBJ_id_pkix_mod,10L
-
-#define SN_id_mod_qualified_cert_93		"id-mod-qualified-cert-93"
-#define NID_id_mod_qualified_cert_93		279
-#define OBJ_id_mod_qualified_cert_93		OBJ_id_pkix_mod,11L
-
-#define SN_id_mod_attribute_cert		"id-mod-attribute-cert"
-#define NID_id_mod_attribute_cert		280
-#define OBJ_id_mod_attribute_cert		OBJ_id_pkix_mod,12L
-
-#define SN_id_mod_timestamp_protocol		"id-mod-timestamp-protocol"
-#define NID_id_mod_timestamp_protocol		281
-#define OBJ_id_mod_timestamp_protocol		OBJ_id_pkix_mod,13L
-
-#define SN_id_mod_ocsp		"id-mod-ocsp"
-#define NID_id_mod_ocsp		282
-#define OBJ_id_mod_ocsp		OBJ_id_pkix_mod,14L
-
-#define SN_id_mod_dvcs		"id-mod-dvcs"
-#define NID_id_mod_dvcs		283
-#define OBJ_id_mod_dvcs		OBJ_id_pkix_mod,15L
-
-#define SN_id_mod_cmp2000		"id-mod-cmp2000"
-#define NID_id_mod_cmp2000		284
-#define OBJ_id_mod_cmp2000		OBJ_id_pkix_mod,16L
-
-#define SN_info_access		"authorityInfoAccess"
-#define LN_info_access		"Authority Information Access"
-#define NID_info_access		177
-#define OBJ_info_access		OBJ_id_pe,1L
-
-#define SN_biometricInfo		"biometricInfo"
-#define LN_biometricInfo		"Biometric Info"
-#define NID_biometricInfo		285
-#define OBJ_biometricInfo		OBJ_id_pe,2L
-
-#define SN_qcStatements		"qcStatements"
-#define NID_qcStatements		286
-#define OBJ_qcStatements		OBJ_id_pe,3L
-
-#define SN_ac_auditEntity		"ac-auditEntity"
-#define NID_ac_auditEntity		287
-#define OBJ_ac_auditEntity		OBJ_id_pe,4L
-
-#define SN_ac_targeting		"ac-targeting"
-#define NID_ac_targeting		288
-#define OBJ_ac_targeting		OBJ_id_pe,5L
-
-#define SN_aaControls		"aaControls"
-#define NID_aaControls		289
-#define OBJ_aaControls		OBJ_id_pe,6L
-
-#define SN_sbgp_ipAddrBlock		"sbgp-ipAddrBlock"
-#define NID_sbgp_ipAddrBlock		290
-#define OBJ_sbgp_ipAddrBlock		OBJ_id_pe,7L
-
-#define SN_sbgp_autonomousSysNum		"sbgp-autonomousSysNum"
-#define NID_sbgp_autonomousSysNum		291
-#define OBJ_sbgp_autonomousSysNum		OBJ_id_pe,8L
-
-#define SN_sbgp_routerIdentifier		"sbgp-routerIdentifier"
-#define NID_sbgp_routerIdentifier		292
-#define OBJ_sbgp_routerIdentifier		OBJ_id_pe,9L
-
-#define SN_ac_proxying		"ac-proxying"
-#define NID_ac_proxying		397
-#define OBJ_ac_proxying		OBJ_id_pe,10L
-
-#define SN_sinfo_access		"subjectInfoAccess"
-#define LN_sinfo_access		"Subject Information Access"
-#define NID_sinfo_access		398
-#define OBJ_sinfo_access		OBJ_id_pe,11L
-
-#define SN_proxyCertInfo		"proxyCertInfo"
-#define LN_proxyCertInfo		"Proxy Certificate Information"
-#define NID_proxyCertInfo		663
-#define OBJ_proxyCertInfo		OBJ_id_pe,14L
-
-#define SN_id_qt_cps		"id-qt-cps"
-#define LN_id_qt_cps		"Policy Qualifier CPS"
-#define NID_id_qt_cps		164
-#define OBJ_id_qt_cps		OBJ_id_qt,1L
-
-#define SN_id_qt_unotice		"id-qt-unotice"
-#define LN_id_qt_unotice		"Policy Qualifier User Notice"
-#define NID_id_qt_unotice		165
-#define OBJ_id_qt_unotice		OBJ_id_qt,2L
-
-#define SN_textNotice		"textNotice"
-#define NID_textNotice		293
-#define OBJ_textNotice		OBJ_id_qt,3L
-
-#define SN_server_auth		"serverAuth"
-#define LN_server_auth		"TLS Web Server Authentication"
-#define NID_server_auth		129
-#define OBJ_server_auth		OBJ_id_kp,1L
-
-#define SN_client_auth		"clientAuth"
-#define LN_client_auth		"TLS Web Client Authentication"
-#define NID_client_auth		130
-#define OBJ_client_auth		OBJ_id_kp,2L
-
-#define SN_code_sign		"codeSigning"
-#define LN_code_sign		"Code Signing"
-#define NID_code_sign		131
-#define OBJ_code_sign		OBJ_id_kp,3L
-
-#define SN_email_protect		"emailProtection"
-#define LN_email_protect		"E-mail Protection"
-#define NID_email_protect		132
-#define OBJ_email_protect		OBJ_id_kp,4L
-
-#define SN_ipsecEndSystem		"ipsecEndSystem"
-#define LN_ipsecEndSystem		"IPSec End System"
-#define NID_ipsecEndSystem		294
-#define OBJ_ipsecEndSystem		OBJ_id_kp,5L
-
-#define SN_ipsecTunnel		"ipsecTunnel"
-#define LN_ipsecTunnel		"IPSec Tunnel"
-#define NID_ipsecTunnel		295
-#define OBJ_ipsecTunnel		OBJ_id_kp,6L
-
-#define SN_ipsecUser		"ipsecUser"
-#define LN_ipsecUser		"IPSec User"
-#define NID_ipsecUser		296
-#define OBJ_ipsecUser		OBJ_id_kp,7L
-
-#define SN_time_stamp		"timeStamping"
-#define LN_time_stamp		"Time Stamping"
-#define NID_time_stamp		133
-#define OBJ_time_stamp		OBJ_id_kp,8L
-
-#define SN_OCSP_sign		"OCSPSigning"
-#define LN_OCSP_sign		"OCSP Signing"
-#define NID_OCSP_sign		180
-#define OBJ_OCSP_sign		OBJ_id_kp,9L
-
-#define SN_dvcs		"DVCS"
-#define LN_dvcs		"dvcs"
-#define NID_dvcs		297
-#define OBJ_dvcs		OBJ_id_kp,10L
-
-#define SN_id_it_caProtEncCert		"id-it-caProtEncCert"
-#define NID_id_it_caProtEncCert		298
-#define OBJ_id_it_caProtEncCert		OBJ_id_it,1L
-
-#define SN_id_it_signKeyPairTypes		"id-it-signKeyPairTypes"
-#define NID_id_it_signKeyPairTypes		299
-#define OBJ_id_it_signKeyPairTypes		OBJ_id_it,2L
-
-#define SN_id_it_encKeyPairTypes		"id-it-encKeyPairTypes"
-#define NID_id_it_encKeyPairTypes		300
-#define OBJ_id_it_encKeyPairTypes		OBJ_id_it,3L
-
-#define SN_id_it_preferredSymmAlg		"id-it-preferredSymmAlg"
-#define NID_id_it_preferredSymmAlg		301
-#define OBJ_id_it_preferredSymmAlg		OBJ_id_it,4L
-
-#define SN_id_it_caKeyUpdateInfo		"id-it-caKeyUpdateInfo"
-#define NID_id_it_caKeyUpdateInfo		302
-#define OBJ_id_it_caKeyUpdateInfo		OBJ_id_it,5L
-
-#define SN_id_it_currentCRL		"id-it-currentCRL"
-#define NID_id_it_currentCRL		303
-#define OBJ_id_it_currentCRL		OBJ_id_it,6L
-
-#define SN_id_it_unsupportedOIDs		"id-it-unsupportedOIDs"
-#define NID_id_it_unsupportedOIDs		304
-#define OBJ_id_it_unsupportedOIDs		OBJ_id_it,7L
-
-#define SN_id_it_subscriptionRequest		"id-it-subscriptionRequest"
-#define NID_id_it_subscriptionRequest		305
-#define OBJ_id_it_subscriptionRequest		OBJ_id_it,8L
-
-#define SN_id_it_subscriptionResponse		"id-it-subscriptionResponse"
-#define NID_id_it_subscriptionResponse		306
-#define OBJ_id_it_subscriptionResponse		OBJ_id_it,9L
-
-#define SN_id_it_keyPairParamReq		"id-it-keyPairParamReq"
-#define NID_id_it_keyPairParamReq		307
-#define OBJ_id_it_keyPairParamReq		OBJ_id_it,10L
-
-#define SN_id_it_keyPairParamRep		"id-it-keyPairParamRep"
-#define NID_id_it_keyPairParamRep		308
-#define OBJ_id_it_keyPairParamRep		OBJ_id_it,11L
-
-#define SN_id_it_revPassphrase		"id-it-revPassphrase"
-#define NID_id_it_revPassphrase		309
-#define OBJ_id_it_revPassphrase		OBJ_id_it,12L
-
-#define SN_id_it_implicitConfirm		"id-it-implicitConfirm"
-#define NID_id_it_implicitConfirm		310
-#define OBJ_id_it_implicitConfirm		OBJ_id_it,13L
-
-#define SN_id_it_confirmWaitTime		"id-it-confirmWaitTime"
-#define NID_id_it_confirmWaitTime		311
-#define OBJ_id_it_confirmWaitTime		OBJ_id_it,14L
-
-#define SN_id_it_origPKIMessage		"id-it-origPKIMessage"
-#define NID_id_it_origPKIMessage		312
-#define OBJ_id_it_origPKIMessage		OBJ_id_it,15L
-
-#define SN_id_regCtrl		"id-regCtrl"
-#define NID_id_regCtrl		313
-#define OBJ_id_regCtrl		OBJ_id_pkip,1L
-
-#define SN_id_regInfo		"id-regInfo"
-#define NID_id_regInfo		314
-#define OBJ_id_regInfo		OBJ_id_pkip,2L
-
-#define SN_id_regCtrl_regToken		"id-regCtrl-regToken"
-#define NID_id_regCtrl_regToken		315
-#define OBJ_id_regCtrl_regToken		OBJ_id_regCtrl,1L
-
-#define SN_id_regCtrl_authenticator		"id-regCtrl-authenticator"
-#define NID_id_regCtrl_authenticator		316
-#define OBJ_id_regCtrl_authenticator		OBJ_id_regCtrl,2L
-
-#define SN_id_regCtrl_pkiPublicationInfo		"id-regCtrl-pkiPublicationInfo"
-#define NID_id_regCtrl_pkiPublicationInfo		317
-#define OBJ_id_regCtrl_pkiPublicationInfo		OBJ_id_regCtrl,3L
+#define LN_certBag      "certBag"
+#define NID_certBag     152
+#define OBJ_certBag     OBJ_pkcs12_BagIds,3L
+
+#define LN_crlBag       "crlBag"
+#define NID_crlBag      153
+#define OBJ_crlBag      OBJ_pkcs12_BagIds,4L
+
+#define LN_secretBag        "secretBag"
+#define NID_secretBag       154
+#define OBJ_secretBag       OBJ_pkcs12_BagIds,5L
+
+#define LN_safeContentsBag      "safeContentsBag"
+#define NID_safeContentsBag     155
+#define OBJ_safeContentsBag     OBJ_pkcs12_BagIds,6L
+
+#define SN_md2      "MD2"
+#define LN_md2      "md2"
+#define NID_md2     3
+#define OBJ_md2     OBJ_rsadsi,2L,2L
+
+#define SN_md4      "MD4"
+#define LN_md4      "md4"
+#define NID_md4     257
+#define OBJ_md4     OBJ_rsadsi,2L,4L
+
+#define SN_md5      "MD5"
+#define LN_md5      "md5"
+#define NID_md5     4
+#define OBJ_md5     OBJ_rsadsi,2L,5L
+
+#define SN_md5_sha1     "MD5-SHA1"
+#define LN_md5_sha1     "md5-sha1"
+#define NID_md5_sha1        114
+
+#define LN_hmacWithSHA1     "hmacWithSHA1"
+#define NID_hmacWithSHA1        163
+#define OBJ_hmacWithSHA1        OBJ_rsadsi,2L,7L
+
+#define SN_rc2_cbc      "RC2-CBC"
+#define LN_rc2_cbc      "rc2-cbc"
+#define NID_rc2_cbc     37
+#define OBJ_rc2_cbc     OBJ_rsadsi,3L,2L
+
+#define SN_rc2_ecb      "RC2-ECB"
+#define LN_rc2_ecb      "rc2-ecb"
+#define NID_rc2_ecb     38
+
+#define SN_rc2_cfb64        "RC2-CFB"
+#define LN_rc2_cfb64        "rc2-cfb"
+#define NID_rc2_cfb64       39
+
+#define SN_rc2_ofb64        "RC2-OFB"
+#define LN_rc2_ofb64        "rc2-ofb"
+#define NID_rc2_ofb64       40
+
+#define SN_rc2_40_cbc       "RC2-40-CBC"
+#define LN_rc2_40_cbc       "rc2-40-cbc"
+#define NID_rc2_40_cbc      98
+
+#define SN_rc2_64_cbc       "RC2-64-CBC"
+#define LN_rc2_64_cbc       "rc2-64-cbc"
+#define NID_rc2_64_cbc      166
+
+#define SN_rc4      "RC4"
+#define LN_rc4      "rc4"
+#define NID_rc4     5
+#define OBJ_rc4     OBJ_rsadsi,3L,4L
+
+#define SN_rc4_40       "RC4-40"
+#define LN_rc4_40       "rc4-40"
+#define NID_rc4_40      97
+
+#define SN_des_ede3_cbc     "DES-EDE3-CBC"
+#define LN_des_ede3_cbc     "des-ede3-cbc"
+#define NID_des_ede3_cbc        44
+#define OBJ_des_ede3_cbc        OBJ_rsadsi,3L,7L
+
+#define SN_rc5_cbc      "RC5-CBC"
+#define LN_rc5_cbc      "rc5-cbc"
+#define NID_rc5_cbc     120
+#define OBJ_rc5_cbc     OBJ_rsadsi,3L,8L
+
+#define SN_rc5_ecb      "RC5-ECB"
+#define LN_rc5_ecb      "rc5-ecb"
+#define NID_rc5_ecb     121
+
+#define SN_rc5_cfb64        "RC5-CFB"
+#define LN_rc5_cfb64        "rc5-cfb"
+#define NID_rc5_cfb64       122
+
+#define SN_rc5_ofb64        "RC5-OFB"
+#define LN_rc5_ofb64        "rc5-ofb"
+#define NID_rc5_ofb64       123
+
+#define SN_ms_ext_req       "msExtReq"
+#define LN_ms_ext_req       "Microsoft Extension Request"
+#define NID_ms_ext_req      171
+#define OBJ_ms_ext_req      1L,3L,6L,1L,4L,1L,311L,2L,1L,14L
+
+#define SN_ms_code_ind      "msCodeInd"
+#define LN_ms_code_ind      "Microsoft Individual Code Signing"
+#define NID_ms_code_ind     134
+#define OBJ_ms_code_ind     1L,3L,6L,1L,4L,1L,311L,2L,1L,21L
+
+#define SN_ms_code_com      "msCodeCom"
+#define LN_ms_code_com      "Microsoft Commercial Code Signing"
+#define NID_ms_code_com     135
+#define OBJ_ms_code_com     1L,3L,6L,1L,4L,1L,311L,2L,1L,22L
+
+#define SN_ms_ctl_sign      "msCTLSign"
+#define LN_ms_ctl_sign      "Microsoft Trust List Signing"
+#define NID_ms_ctl_sign     136
+#define OBJ_ms_ctl_sign     1L,3L,6L,1L,4L,1L,311L,10L,3L,1L
+
+#define SN_ms_sgc       "msSGC"
+#define LN_ms_sgc       "Microsoft Server Gated Crypto"
+#define NID_ms_sgc      137
+#define OBJ_ms_sgc      1L,3L,6L,1L,4L,1L,311L,10L,3L,3L
+
+#define SN_ms_efs       "msEFS"
+#define LN_ms_efs       "Microsoft Encrypted File System"
+#define NID_ms_efs      138
+#define OBJ_ms_efs      1L,3L,6L,1L,4L,1L,311L,10L,3L,4L
+
+#define SN_ms_smartcard_login       "msSmartcardLogin"
+#define LN_ms_smartcard_login       "Microsoft Smartcardlogin"
+#define NID_ms_smartcard_login      648
+#define OBJ_ms_smartcard_login      1L,3L,6L,1L,4L,1L,311L,20L,2L,2L
+
+#define SN_ms_upn       "msUPN"
+#define LN_ms_upn       "Microsoft Universal Principal Name"
+#define NID_ms_upn      649
+#define OBJ_ms_upn      1L,3L,6L,1L,4L,1L,311L,20L,2L,3L
+
+#define SN_idea_cbc     "IDEA-CBC"
+#define LN_idea_cbc     "idea-cbc"
+#define NID_idea_cbc        34
+#define OBJ_idea_cbc        1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L
+
+#define SN_idea_ecb     "IDEA-ECB"
+#define LN_idea_ecb     "idea-ecb"
+#define NID_idea_ecb        36
+
+#define SN_idea_cfb64       "IDEA-CFB"
+#define LN_idea_cfb64       "idea-cfb"
+#define NID_idea_cfb64      35
+
+#define SN_idea_ofb64       "IDEA-OFB"
+#define LN_idea_ofb64       "idea-ofb"
+#define NID_idea_ofb64      46
+
+#define SN_bf_cbc       "BF-CBC"
+#define LN_bf_cbc       "bf-cbc"
+#define NID_bf_cbc      91
+#define OBJ_bf_cbc      1L,3L,6L,1L,4L,1L,3029L,1L,2L
+
+#define SN_bf_ecb       "BF-ECB"
+#define LN_bf_ecb       "bf-ecb"
+#define NID_bf_ecb      92
+
+#define SN_bf_cfb64     "BF-CFB"
+#define LN_bf_cfb64     "bf-cfb"
+#define NID_bf_cfb64        93
+
+#define SN_bf_ofb64     "BF-OFB"
+#define LN_bf_ofb64     "bf-ofb"
+#define NID_bf_ofb64        94
+
+#define SN_id_pkix      "PKIX"
+#define NID_id_pkix     127
+#define OBJ_id_pkix     1L,3L,6L,1L,5L,5L,7L
+
+#define SN_id_pkix_mod      "id-pkix-mod"
+#define NID_id_pkix_mod     258
+#define OBJ_id_pkix_mod     OBJ_id_pkix,0L
+
+#define SN_id_pe        "id-pe"
+#define NID_id_pe       175
+#define OBJ_id_pe       OBJ_id_pkix,1L
+
+#define SN_id_qt        "id-qt"
+#define NID_id_qt       259
+#define OBJ_id_qt       OBJ_id_pkix,2L
+
+#define SN_id_kp        "id-kp"
+#define NID_id_kp       128
+#define OBJ_id_kp       OBJ_id_pkix,3L
+
+#define SN_id_it        "id-it"
+#define NID_id_it       260
+#define OBJ_id_it       OBJ_id_pkix,4L
+
+#define SN_id_pkip      "id-pkip"
+#define NID_id_pkip     261
+#define OBJ_id_pkip     OBJ_id_pkix,5L
+
+#define SN_id_alg       "id-alg"
+#define NID_id_alg      262
+#define OBJ_id_alg      OBJ_id_pkix,6L
+
+#define SN_id_cmc       "id-cmc"
+#define NID_id_cmc      263
+#define OBJ_id_cmc      OBJ_id_pkix,7L
+
+#define SN_id_on        "id-on"
+#define NID_id_on       264
+#define OBJ_id_on       OBJ_id_pkix,8L
+
+#define SN_id_pda       "id-pda"
+#define NID_id_pda      265
+#define OBJ_id_pda      OBJ_id_pkix,9L
+
+#define SN_id_aca       "id-aca"
+#define NID_id_aca      266
+#define OBJ_id_aca      OBJ_id_pkix,10L
+
+#define SN_id_qcs       "id-qcs"
+#define NID_id_qcs      267
+#define OBJ_id_qcs      OBJ_id_pkix,11L
+
+#define SN_id_cct       "id-cct"
+#define NID_id_cct      268
+#define OBJ_id_cct      OBJ_id_pkix,12L
+
+#define SN_id_ppl       "id-ppl"
+#define NID_id_ppl      662
+#define OBJ_id_ppl      OBJ_id_pkix,21L
+
+#define SN_id_ad        "id-ad"
+#define NID_id_ad       176
+#define OBJ_id_ad       OBJ_id_pkix,48L
+
+#define SN_id_pkix1_explicit_88     "id-pkix1-explicit-88"
+#define NID_id_pkix1_explicit_88        269
+#define OBJ_id_pkix1_explicit_88        OBJ_id_pkix_mod,1L
+
+#define SN_id_pkix1_implicit_88     "id-pkix1-implicit-88"
+#define NID_id_pkix1_implicit_88        270
+#define OBJ_id_pkix1_implicit_88        OBJ_id_pkix_mod,2L
+
+#define SN_id_pkix1_explicit_93     "id-pkix1-explicit-93"
+#define NID_id_pkix1_explicit_93        271
+#define OBJ_id_pkix1_explicit_93        OBJ_id_pkix_mod,3L
+
+#define SN_id_pkix1_implicit_93     "id-pkix1-implicit-93"
+#define NID_id_pkix1_implicit_93        272
+#define OBJ_id_pkix1_implicit_93        OBJ_id_pkix_mod,4L
+
+#define SN_id_mod_crmf      "id-mod-crmf"
+#define NID_id_mod_crmf     273
+#define OBJ_id_mod_crmf     OBJ_id_pkix_mod,5L
+
+#define SN_id_mod_cmc       "id-mod-cmc"
+#define NID_id_mod_cmc      274
+#define OBJ_id_mod_cmc      OBJ_id_pkix_mod,6L
+
+#define SN_id_mod_kea_profile_88        "id-mod-kea-profile-88"
+#define NID_id_mod_kea_profile_88       275
+#define OBJ_id_mod_kea_profile_88       OBJ_id_pkix_mod,7L
+
+#define SN_id_mod_kea_profile_93        "id-mod-kea-profile-93"
+#define NID_id_mod_kea_profile_93       276
+#define OBJ_id_mod_kea_profile_93       OBJ_id_pkix_mod,8L
+
+#define SN_id_mod_cmp       "id-mod-cmp"
+#define NID_id_mod_cmp      277
+#define OBJ_id_mod_cmp      OBJ_id_pkix_mod,9L
+
+#define SN_id_mod_qualified_cert_88     "id-mod-qualified-cert-88"
+#define NID_id_mod_qualified_cert_88        278
+#define OBJ_id_mod_qualified_cert_88        OBJ_id_pkix_mod,10L
+
+#define SN_id_mod_qualified_cert_93     "id-mod-qualified-cert-93"
+#define NID_id_mod_qualified_cert_93        279
+#define OBJ_id_mod_qualified_cert_93        OBJ_id_pkix_mod,11L
+
+#define SN_id_mod_attribute_cert        "id-mod-attribute-cert"
+#define NID_id_mod_attribute_cert       280
+#define OBJ_id_mod_attribute_cert       OBJ_id_pkix_mod,12L
+
+#define SN_id_mod_timestamp_protocol        "id-mod-timestamp-protocol"
+#define NID_id_mod_timestamp_protocol       281
+#define OBJ_id_mod_timestamp_protocol       OBJ_id_pkix_mod,13L
+
+#define SN_id_mod_ocsp      "id-mod-ocsp"
+#define NID_id_mod_ocsp     282
+#define OBJ_id_mod_ocsp     OBJ_id_pkix_mod,14L
+
+#define SN_id_mod_dvcs      "id-mod-dvcs"
+#define NID_id_mod_dvcs     283
+#define OBJ_id_mod_dvcs     OBJ_id_pkix_mod,15L
+
+#define SN_id_mod_cmp2000       "id-mod-cmp2000"
+#define NID_id_mod_cmp2000      284
+#define OBJ_id_mod_cmp2000      OBJ_id_pkix_mod,16L
+
+#define SN_info_access      "authorityInfoAccess"
+#define LN_info_access      "Authority Information Access"
+#define NID_info_access     177
+#define OBJ_info_access     OBJ_id_pe,1L
+
+#define SN_biometricInfo        "biometricInfo"
+#define LN_biometricInfo        "Biometric Info"
+#define NID_biometricInfo       285
+#define OBJ_biometricInfo       OBJ_id_pe,2L
+
+#define SN_qcStatements     "qcStatements"
+#define NID_qcStatements        286
+#define OBJ_qcStatements        OBJ_id_pe,3L
+
+#define SN_ac_auditEntity       "ac-auditEntity"
+#define NID_ac_auditEntity      287
+#define OBJ_ac_auditEntity      OBJ_id_pe,4L
+
+#define SN_ac_targeting     "ac-targeting"
+#define NID_ac_targeting        288
+#define OBJ_ac_targeting        OBJ_id_pe,5L
+
+#define SN_aaControls       "aaControls"
+#define NID_aaControls      289
+#define OBJ_aaControls      OBJ_id_pe,6L
+
+#define SN_sbgp_ipAddrBlock     "sbgp-ipAddrBlock"
+#define NID_sbgp_ipAddrBlock        290
+#define OBJ_sbgp_ipAddrBlock        OBJ_id_pe,7L
+
+#define SN_sbgp_autonomousSysNum        "sbgp-autonomousSysNum"
+#define NID_sbgp_autonomousSysNum       291
+#define OBJ_sbgp_autonomousSysNum       OBJ_id_pe,8L
+
+#define SN_sbgp_routerIdentifier        "sbgp-routerIdentifier"
+#define NID_sbgp_routerIdentifier       292
+#define OBJ_sbgp_routerIdentifier       OBJ_id_pe,9L
+
+#define SN_ac_proxying      "ac-proxying"
+#define NID_ac_proxying     397
+#define OBJ_ac_proxying     OBJ_id_pe,10L
+
+#define SN_sinfo_access     "subjectInfoAccess"
+#define LN_sinfo_access     "Subject Information Access"
+#define NID_sinfo_access        398
+#define OBJ_sinfo_access        OBJ_id_pe,11L
+
+#define SN_proxyCertInfo        "proxyCertInfo"
+#define LN_proxyCertInfo        "Proxy Certificate Information"
+#define NID_proxyCertInfo       663
+#define OBJ_proxyCertInfo       OBJ_id_pe,14L
+
+#define SN_id_qt_cps        "id-qt-cps"
+#define LN_id_qt_cps        "Policy Qualifier CPS"
+#define NID_id_qt_cps       164
+#define OBJ_id_qt_cps       OBJ_id_qt,1L
+
+#define SN_id_qt_unotice        "id-qt-unotice"
+#define LN_id_qt_unotice        "Policy Qualifier User Notice"
+#define NID_id_qt_unotice       165
+#define OBJ_id_qt_unotice       OBJ_id_qt,2L
+
+#define SN_textNotice       "textNotice"
+#define NID_textNotice      293
+#define OBJ_textNotice      OBJ_id_qt,3L
+
+#define SN_server_auth      "serverAuth"
+#define LN_server_auth      "TLS Web Server Authentication"
+#define NID_server_auth     129
+#define OBJ_server_auth     OBJ_id_kp,1L
+
+#define SN_client_auth      "clientAuth"
+#define LN_client_auth      "TLS Web Client Authentication"
+#define NID_client_auth     130
+#define OBJ_client_auth     OBJ_id_kp,2L
+
+#define SN_code_sign        "codeSigning"
+#define LN_code_sign        "Code Signing"
+#define NID_code_sign       131
+#define OBJ_code_sign       OBJ_id_kp,3L
+
+#define SN_email_protect        "emailProtection"
+#define LN_email_protect        "E-mail Protection"
+#define NID_email_protect       132
+#define OBJ_email_protect       OBJ_id_kp,4L
+
+#define SN_ipsecEndSystem       "ipsecEndSystem"
+#define LN_ipsecEndSystem       "IPSec End System"
+#define NID_ipsecEndSystem      294
+#define OBJ_ipsecEndSystem      OBJ_id_kp,5L
+
+#define SN_ipsecTunnel      "ipsecTunnel"
+#define LN_ipsecTunnel      "IPSec Tunnel"
+#define NID_ipsecTunnel     295
+#define OBJ_ipsecTunnel     OBJ_id_kp,6L
+
+#define SN_ipsecUser        "ipsecUser"
+#define LN_ipsecUser        "IPSec User"
+#define NID_ipsecUser       296
+#define OBJ_ipsecUser       OBJ_id_kp,7L
+
+#define SN_time_stamp       "timeStamping"
+#define LN_time_stamp       "Time Stamping"
+#define NID_time_stamp      133
+#define OBJ_time_stamp      OBJ_id_kp,8L
+
+#define SN_OCSP_sign        "OCSPSigning"
+#define LN_OCSP_sign        "OCSP Signing"
+#define NID_OCSP_sign       180
+#define OBJ_OCSP_sign       OBJ_id_kp,9L
+
+#define SN_dvcs     "DVCS"
+#define LN_dvcs     "dvcs"
+#define NID_dvcs        297
+#define OBJ_dvcs        OBJ_id_kp,10L
+
+#define SN_id_it_caProtEncCert      "id-it-caProtEncCert"
+#define NID_id_it_caProtEncCert     298
+#define OBJ_id_it_caProtEncCert     OBJ_id_it,1L
+
+#define SN_id_it_signKeyPairTypes       "id-it-signKeyPairTypes"
+#define NID_id_it_signKeyPairTypes      299
+#define OBJ_id_it_signKeyPairTypes      OBJ_id_it,2L
+
+#define SN_id_it_encKeyPairTypes        "id-it-encKeyPairTypes"
+#define NID_id_it_encKeyPairTypes       300
+#define OBJ_id_it_encKeyPairTypes       OBJ_id_it,3L
+
+#define SN_id_it_preferredSymmAlg       "id-it-preferredSymmAlg"
+#define NID_id_it_preferredSymmAlg      301
+#define OBJ_id_it_preferredSymmAlg      OBJ_id_it,4L
+
+#define SN_id_it_caKeyUpdateInfo        "id-it-caKeyUpdateInfo"
+#define NID_id_it_caKeyUpdateInfo       302
+#define OBJ_id_it_caKeyUpdateInfo       OBJ_id_it,5L
+
+#define SN_id_it_currentCRL     "id-it-currentCRL"
+#define NID_id_it_currentCRL        303
+#define OBJ_id_it_currentCRL        OBJ_id_it,6L
+
+#define SN_id_it_unsupportedOIDs        "id-it-unsupportedOIDs"
+#define NID_id_it_unsupportedOIDs       304
+#define OBJ_id_it_unsupportedOIDs       OBJ_id_it,7L
+
+#define SN_id_it_subscriptionRequest        "id-it-subscriptionRequest"
+#define NID_id_it_subscriptionRequest       305
+#define OBJ_id_it_subscriptionRequest       OBJ_id_it,8L
+
+#define SN_id_it_subscriptionResponse       "id-it-subscriptionResponse"
+#define NID_id_it_subscriptionResponse      306
+#define OBJ_id_it_subscriptionResponse      OBJ_id_it,9L
+
+#define SN_id_it_keyPairParamReq        "id-it-keyPairParamReq"
+#define NID_id_it_keyPairParamReq       307
+#define OBJ_id_it_keyPairParamReq       OBJ_id_it,10L
+
+#define SN_id_it_keyPairParamRep        "id-it-keyPairParamRep"
+#define NID_id_it_keyPairParamRep       308
+#define OBJ_id_it_keyPairParamRep       OBJ_id_it,11L
+
+#define SN_id_it_revPassphrase      "id-it-revPassphrase"
+#define NID_id_it_revPassphrase     309
+#define OBJ_id_it_revPassphrase     OBJ_id_it,12L
+
+#define SN_id_it_implicitConfirm        "id-it-implicitConfirm"
+#define NID_id_it_implicitConfirm       310
+#define OBJ_id_it_implicitConfirm       OBJ_id_it,13L
+
+#define SN_id_it_confirmWaitTime        "id-it-confirmWaitTime"
+#define NID_id_it_confirmWaitTime       311
+#define OBJ_id_it_confirmWaitTime       OBJ_id_it,14L
+
+#define SN_id_it_origPKIMessage     "id-it-origPKIMessage"
+#define NID_id_it_origPKIMessage        312
+#define OBJ_id_it_origPKIMessage        OBJ_id_it,15L
+
+#define SN_id_regCtrl       "id-regCtrl"
+#define NID_id_regCtrl      313
+#define OBJ_id_regCtrl      OBJ_id_pkip,1L
+
+#define SN_id_regInfo       "id-regInfo"
+#define NID_id_regInfo      314
+#define OBJ_id_regInfo      OBJ_id_pkip,2L
+
+#define SN_id_regCtrl_regToken      "id-regCtrl-regToken"
+#define NID_id_regCtrl_regToken     315
+#define OBJ_id_regCtrl_regToken     OBJ_id_regCtrl,1L
+
+#define SN_id_regCtrl_authenticator     "id-regCtrl-authenticator"
+#define NID_id_regCtrl_authenticator        316
+#define OBJ_id_regCtrl_authenticator        OBJ_id_regCtrl,2L
+
+#define SN_id_regCtrl_pkiPublicationInfo        "id-regCtrl-pkiPublicationInfo"
+#define NID_id_regCtrl_pkiPublicationInfo       317
+#define OBJ_id_regCtrl_pkiPublicationInfo       OBJ_id_regCtrl,3L
 
-#define SN_id_regCtrl_pkiArchiveOptions		"id-regCtrl-pkiArchiveOptions"
-#define NID_id_regCtrl_pkiArchiveOptions		318
-#define OBJ_id_regCtrl_pkiArchiveOptions		OBJ_id_regCtrl,4L
+#define SN_id_regCtrl_pkiArchiveOptions     "id-regCtrl-pkiArchiveOptions"
+#define NID_id_regCtrl_pkiArchiveOptions        318
+#define OBJ_id_regCtrl_pkiArchiveOptions        OBJ_id_regCtrl,4L
 
-#define SN_id_regCtrl_oldCertID		"id-regCtrl-oldCertID"
-#define NID_id_regCtrl_oldCertID		319
-#define OBJ_id_regCtrl_oldCertID		OBJ_id_regCtrl,5L
+#define SN_id_regCtrl_oldCertID     "id-regCtrl-oldCertID"
+#define NID_id_regCtrl_oldCertID        319
+#define OBJ_id_regCtrl_oldCertID        OBJ_id_regCtrl,5L
 
-#define SN_id_regCtrl_protocolEncrKey		"id-regCtrl-protocolEncrKey"
-#define NID_id_regCtrl_protocolEncrKey		320
-#define OBJ_id_regCtrl_protocolEncrKey		OBJ_id_regCtrl,6L
+#define SN_id_regCtrl_protocolEncrKey       "id-regCtrl-protocolEncrKey"
+#define NID_id_regCtrl_protocolEncrKey      320
+#define OBJ_id_regCtrl_protocolEncrKey      OBJ_id_regCtrl,6L
 
-#define SN_id_regInfo_utf8Pairs		"id-regInfo-utf8Pairs"
-#define NID_id_regInfo_utf8Pairs		321
-#define OBJ_id_regInfo_utf8Pairs		OBJ_id_regInfo,1L
+#define SN_id_regInfo_utf8Pairs     "id-regInfo-utf8Pairs"
+#define NID_id_regInfo_utf8Pairs        321
+#define OBJ_id_regInfo_utf8Pairs        OBJ_id_regInfo,1L
 
-#define SN_id_regInfo_certReq		"id-regInfo-certReq"
-#define NID_id_regInfo_certReq		322
-#define OBJ_id_regInfo_certReq		OBJ_id_regInfo,2L
+#define SN_id_regInfo_certReq       "id-regInfo-certReq"
+#define NID_id_regInfo_certReq      322
+#define OBJ_id_regInfo_certReq      OBJ_id_regInfo,2L
 
-#define SN_id_alg_des40		"id-alg-des40"
-#define NID_id_alg_des40		323
-#define OBJ_id_alg_des40		OBJ_id_alg,1L
+#define SN_id_alg_des40     "id-alg-des40"
+#define NID_id_alg_des40        323
+#define OBJ_id_alg_des40        OBJ_id_alg,1L
 
-#define SN_id_alg_noSignature		"id-alg-noSignature"
-#define NID_id_alg_noSignature		324
-#define OBJ_id_alg_noSignature		OBJ_id_alg,2L
+#define SN_id_alg_noSignature       "id-alg-noSignature"
+#define NID_id_alg_noSignature      324
+#define OBJ_id_alg_noSignature      OBJ_id_alg,2L
 
-#define SN_id_alg_dh_sig_hmac_sha1		"id-alg-dh-sig-hmac-sha1"
-#define NID_id_alg_dh_sig_hmac_sha1		325
-#define OBJ_id_alg_dh_sig_hmac_sha1		OBJ_id_alg,3L
+#define SN_id_alg_dh_sig_hmac_sha1      "id-alg-dh-sig-hmac-sha1"
+#define NID_id_alg_dh_sig_hmac_sha1     325
+#define OBJ_id_alg_dh_sig_hmac_sha1     OBJ_id_alg,3L
 
-#define SN_id_alg_dh_pop		"id-alg-dh-pop"
-#define NID_id_alg_dh_pop		326
-#define OBJ_id_alg_dh_pop		OBJ_id_alg,4L
+#define SN_id_alg_dh_pop        "id-alg-dh-pop"
+#define NID_id_alg_dh_pop       326
+#define OBJ_id_alg_dh_pop       OBJ_id_alg,4L
 
-#define SN_id_cmc_statusInfo		"id-cmc-statusInfo"
-#define NID_id_cmc_statusInfo		327
-#define OBJ_id_cmc_statusInfo		OBJ_id_cmc,1L
+#define SN_id_cmc_statusInfo        "id-cmc-statusInfo"
+#define NID_id_cmc_statusInfo       327
+#define OBJ_id_cmc_statusInfo       OBJ_id_cmc,1L
 
-#define SN_id_cmc_identification		"id-cmc-identification"
-#define NID_id_cmc_identification		328
-#define OBJ_id_cmc_identification		OBJ_id_cmc,2L
+#define SN_id_cmc_identification        "id-cmc-identification"
+#define NID_id_cmc_identification       328
+#define OBJ_id_cmc_identification       OBJ_id_cmc,2L
 
-#define SN_id_cmc_identityProof		"id-cmc-identityProof"
-#define NID_id_cmc_identityProof		329
-#define OBJ_id_cmc_identityProof		OBJ_id_cmc,3L
+#define SN_id_cmc_identityProof     "id-cmc-identityProof"
+#define NID_id_cmc_identityProof        329
+#define OBJ_id_cmc_identityProof        OBJ_id_cmc,3L
 
-#define SN_id_cmc_dataReturn		"id-cmc-dataReturn"
-#define NID_id_cmc_dataReturn		330
-#define OBJ_id_cmc_dataReturn		OBJ_id_cmc,4L
+#define SN_id_cmc_dataReturn        "id-cmc-dataReturn"
+#define NID_id_cmc_dataReturn       330
+#define OBJ_id_cmc_dataReturn       OBJ_id_cmc,4L
 
-#define SN_id_cmc_transactionId		"id-cmc-transactionId"
-#define NID_id_cmc_transactionId		331
-#define OBJ_id_cmc_transactionId		OBJ_id_cmc,5L
+#define SN_id_cmc_transactionId     "id-cmc-transactionId"
+#define NID_id_cmc_transactionId        331
+#define OBJ_id_cmc_transactionId        OBJ_id_cmc,5L
 
-#define SN_id_cmc_senderNonce		"id-cmc-senderNonce"
-#define NID_id_cmc_senderNonce		332
-#define OBJ_id_cmc_senderNonce		OBJ_id_cmc,6L
+#define SN_id_cmc_senderNonce       "id-cmc-senderNonce"
+#define NID_id_cmc_senderNonce      332
+#define OBJ_id_cmc_senderNonce      OBJ_id_cmc,6L
 
-#define SN_id_cmc_recipientNonce		"id-cmc-recipientNonce"
-#define NID_id_cmc_recipientNonce		333
-#define OBJ_id_cmc_recipientNonce		OBJ_id_cmc,7L
+#define SN_id_cmc_recipientNonce        "id-cmc-recipientNonce"
+#define NID_id_cmc_recipientNonce       333
+#define OBJ_id_cmc_recipientNonce       OBJ_id_cmc,7L
 
-#define SN_id_cmc_addExtensions		"id-cmc-addExtensions"
-#define NID_id_cmc_addExtensions		334
-#define OBJ_id_cmc_addExtensions		OBJ_id_cmc,8L
+#define SN_id_cmc_addExtensions     "id-cmc-addExtensions"
+#define NID_id_cmc_addExtensions        334
+#define OBJ_id_cmc_addExtensions        OBJ_id_cmc,8L
 
-#define SN_id_cmc_encryptedPOP		"id-cmc-encryptedPOP"
-#define NID_id_cmc_encryptedPOP		335
-#define OBJ_id_cmc_encryptedPOP		OBJ_id_cmc,9L
+#define SN_id_cmc_encryptedPOP      "id-cmc-encryptedPOP"
+#define NID_id_cmc_encryptedPOP     335
+#define OBJ_id_cmc_encryptedPOP     OBJ_id_cmc,9L
 
-#define SN_id_cmc_decryptedPOP		"id-cmc-decryptedPOP"
-#define NID_id_cmc_decryptedPOP		336
-#define OBJ_id_cmc_decryptedPOP		OBJ_id_cmc,10L
+#define SN_id_cmc_decryptedPOP      "id-cmc-decryptedPOP"
+#define NID_id_cmc_decryptedPOP     336
+#define OBJ_id_cmc_decryptedPOP     OBJ_id_cmc,10L
 
-#define SN_id_cmc_lraPOPWitness		"id-cmc-lraPOPWitness"
-#define NID_id_cmc_lraPOPWitness		337
-#define OBJ_id_cmc_lraPOPWitness		OBJ_id_cmc,11L
+#define SN_id_cmc_lraPOPWitness     "id-cmc-lraPOPWitness"
+#define NID_id_cmc_lraPOPWitness        337
+#define OBJ_id_cmc_lraPOPWitness        OBJ_id_cmc,11L
 
-#define SN_id_cmc_getCert		"id-cmc-getCert"
-#define NID_id_cmc_getCert		338
-#define OBJ_id_cmc_getCert		OBJ_id_cmc,15L
+#define SN_id_cmc_getCert       "id-cmc-getCert"
+#define NID_id_cmc_getCert      338
+#define OBJ_id_cmc_getCert      OBJ_id_cmc,15L
 
-#define SN_id_cmc_getCRL		"id-cmc-getCRL"
-#define NID_id_cmc_getCRL		339
-#define OBJ_id_cmc_getCRL		OBJ_id_cmc,16L
+#define SN_id_cmc_getCRL        "id-cmc-getCRL"
+#define NID_id_cmc_getCRL       339
+#define OBJ_id_cmc_getCRL       OBJ_id_cmc,16L
 
-#define SN_id_cmc_revokeRequest		"id-cmc-revokeRequest"
-#define NID_id_cmc_revokeRequest		340
-#define OBJ_id_cmc_revokeRequest		OBJ_id_cmc,17L
+#define SN_id_cmc_revokeRequest     "id-cmc-revokeRequest"
+#define NID_id_cmc_revokeRequest        340
+#define OBJ_id_cmc_revokeRequest        OBJ_id_cmc,17L
 
-#define SN_id_cmc_regInfo		"id-cmc-regInfo"
-#define NID_id_cmc_regInfo		341
-#define OBJ_id_cmc_regInfo		OBJ_id_cmc,18L
+#define SN_id_cmc_regInfo       "id-cmc-regInfo"
+#define NID_id_cmc_regInfo      341
+#define OBJ_id_cmc_regInfo      OBJ_id_cmc,18L
 
-#define SN_id_cmc_responseInfo		"id-cmc-responseInfo"
-#define NID_id_cmc_responseInfo		342
-#define OBJ_id_cmc_responseInfo		OBJ_id_cmc,19L
+#define SN_id_cmc_responseInfo      "id-cmc-responseInfo"
+#define NID_id_cmc_responseInfo     342
+#define OBJ_id_cmc_responseInfo     OBJ_id_cmc,19L
 
-#define SN_id_cmc_queryPending		"id-cmc-queryPending"
-#define NID_id_cmc_queryPending		343
-#define OBJ_id_cmc_queryPending		OBJ_id_cmc,21L
-
-#define SN_id_cmc_popLinkRandom		"id-cmc-popLinkRandom"
-#define NID_id_cmc_popLinkRandom		344
-#define OBJ_id_cmc_popLinkRandom		OBJ_id_cmc,22L
-
-#define SN_id_cmc_popLinkWitness		"id-cmc-popLinkWitness"
-#define NID_id_cmc_popLinkWitness		345
-#define OBJ_id_cmc_popLinkWitness		OBJ_id_cmc,23L
-
-#define SN_id_cmc_confirmCertAcceptance		"id-cmc-confirmCertAcceptance"
-#define NID_id_cmc_confirmCertAcceptance		346
-#define OBJ_id_cmc_confirmCertAcceptance		OBJ_id_cmc,24L
-
-#define SN_id_on_personalData		"id-on-personalData"
-#define NID_id_on_personalData		347
-#define OBJ_id_on_personalData		OBJ_id_on,1L
-
-#define SN_id_pda_dateOfBirth		"id-pda-dateOfBirth"
-#define NID_id_pda_dateOfBirth		348
-#define OBJ_id_pda_dateOfBirth		OBJ_id_pda,1L
-
-#define SN_id_pda_placeOfBirth		"id-pda-placeOfBirth"
-#define NID_id_pda_placeOfBirth		349
-#define OBJ_id_pda_placeOfBirth		OBJ_id_pda,2L
-
-#define SN_id_pda_gender		"id-pda-gender"
-#define NID_id_pda_gender		351
-#define OBJ_id_pda_gender		OBJ_id_pda,3L
-
-#define SN_id_pda_countryOfCitizenship		"id-pda-countryOfCitizenship"
-#define NID_id_pda_countryOfCitizenship		352
-#define OBJ_id_pda_countryOfCitizenship		OBJ_id_pda,4L
-
-#define SN_id_pda_countryOfResidence		"id-pda-countryOfResidence"
-#define NID_id_pda_countryOfResidence		353
-#define OBJ_id_pda_countryOfResidence		OBJ_id_pda,5L
-
-#define SN_id_aca_authenticationInfo		"id-aca-authenticationInfo"
-#define NID_id_aca_authenticationInfo		354
-#define OBJ_id_aca_authenticationInfo		OBJ_id_aca,1L
-
-#define SN_id_aca_accessIdentity		"id-aca-accessIdentity"
-#define NID_id_aca_accessIdentity		355
-#define OBJ_id_aca_accessIdentity		OBJ_id_aca,2L
-
-#define SN_id_aca_chargingIdentity		"id-aca-chargingIdentity"
-#define NID_id_aca_chargingIdentity		356
-#define OBJ_id_aca_chargingIdentity		OBJ_id_aca,3L
-
-#define SN_id_aca_group		"id-aca-group"
-#define NID_id_aca_group		357
-#define OBJ_id_aca_group		OBJ_id_aca,4L
-
-#define SN_id_aca_role		"id-aca-role"
-#define NID_id_aca_role		358
-#define OBJ_id_aca_role		OBJ_id_aca,5L
-
-#define SN_id_aca_encAttrs		"id-aca-encAttrs"
-#define NID_id_aca_encAttrs		399
-#define OBJ_id_aca_encAttrs		OBJ_id_aca,6L
-
-#define SN_id_qcs_pkixQCSyntax_v1		"id-qcs-pkixQCSyntax-v1"
-#define NID_id_qcs_pkixQCSyntax_v1		359
-#define OBJ_id_qcs_pkixQCSyntax_v1		OBJ_id_qcs,1L
-
-#define SN_id_cct_crs		"id-cct-crs"
-#define NID_id_cct_crs		360
-#define OBJ_id_cct_crs		OBJ_id_cct,1L
-
-#define SN_id_cct_PKIData		"id-cct-PKIData"
-#define NID_id_cct_PKIData		361
-#define OBJ_id_cct_PKIData		OBJ_id_cct,2L
-
-#define SN_id_cct_PKIResponse		"id-cct-PKIResponse"
-#define NID_id_cct_PKIResponse		362
-#define OBJ_id_cct_PKIResponse		OBJ_id_cct,3L
-
-#define SN_id_ppl_anyLanguage		"id-ppl-anyLanguage"
-#define LN_id_ppl_anyLanguage		"Any language"
-#define NID_id_ppl_anyLanguage		664
-#define OBJ_id_ppl_anyLanguage		OBJ_id_ppl,0L
-
-#define SN_id_ppl_inheritAll		"id-ppl-inheritAll"
-#define LN_id_ppl_inheritAll		"Inherit all"
-#define NID_id_ppl_inheritAll		665
-#define OBJ_id_ppl_inheritAll		OBJ_id_ppl,1L
-
-#define SN_Independent		"id-ppl-independent"
-#define LN_Independent		"Independent"
-#define NID_Independent		667
-#define OBJ_Independent		OBJ_id_ppl,2L
-
-#define SN_ad_OCSP		"OCSP"
-#define LN_ad_OCSP		"OCSP"
-#define NID_ad_OCSP		178
-#define OBJ_ad_OCSP		OBJ_id_ad,1L
-
-#define SN_ad_ca_issuers		"caIssuers"
-#define LN_ad_ca_issuers		"CA Issuers"
-#define NID_ad_ca_issuers		179
-#define OBJ_ad_ca_issuers		OBJ_id_ad,2L
-
-#define SN_ad_timeStamping		"ad_timestamping"
-#define LN_ad_timeStamping		"AD Time Stamping"
-#define NID_ad_timeStamping		363
-#define OBJ_ad_timeStamping		OBJ_id_ad,3L
-
-#define SN_ad_dvcs		"AD_DVCS"
-#define LN_ad_dvcs		"ad dvcs"
-#define NID_ad_dvcs		364
-#define OBJ_ad_dvcs		OBJ_id_ad,4L
-
-#define OBJ_id_pkix_OCSP		OBJ_ad_OCSP
-
-#define SN_id_pkix_OCSP_basic		"basicOCSPResponse"
-#define LN_id_pkix_OCSP_basic		"Basic OCSP Response"
-#define NID_id_pkix_OCSP_basic		365
-#define OBJ_id_pkix_OCSP_basic		OBJ_id_pkix_OCSP,1L
-
-#define SN_id_pkix_OCSP_Nonce		"Nonce"
-#define LN_id_pkix_OCSP_Nonce		"OCSP Nonce"
-#define NID_id_pkix_OCSP_Nonce		366
-#define OBJ_id_pkix_OCSP_Nonce		OBJ_id_pkix_OCSP,2L
-
-#define SN_id_pkix_OCSP_CrlID		"CrlID"
-#define LN_id_pkix_OCSP_CrlID		"OCSP CRL ID"
-#define NID_id_pkix_OCSP_CrlID		367
-#define OBJ_id_pkix_OCSP_CrlID		OBJ_id_pkix_OCSP,3L
-
-#define SN_id_pkix_OCSP_acceptableResponses		"acceptableResponses"
-#define LN_id_pkix_OCSP_acceptableResponses		"Acceptable OCSP Responses"
-#define NID_id_pkix_OCSP_acceptableResponses		368
-#define OBJ_id_pkix_OCSP_acceptableResponses		OBJ_id_pkix_OCSP,4L
-
-#define SN_id_pkix_OCSP_noCheck		"noCheck"
-#define LN_id_pkix_OCSP_noCheck		"OCSP No Check"
-#define NID_id_pkix_OCSP_noCheck		369
-#define OBJ_id_pkix_OCSP_noCheck		OBJ_id_pkix_OCSP,5L
-
-#define SN_id_pkix_OCSP_archiveCutoff		"archiveCutoff"
-#define LN_id_pkix_OCSP_archiveCutoff		"OCSP Archive Cutoff"
-#define NID_id_pkix_OCSP_archiveCutoff		370
-#define OBJ_id_pkix_OCSP_archiveCutoff		OBJ_id_pkix_OCSP,6L
-
-#define SN_id_pkix_OCSP_serviceLocator		"serviceLocator"
-#define LN_id_pkix_OCSP_serviceLocator		"OCSP Service Locator"
-#define NID_id_pkix_OCSP_serviceLocator		371
-#define OBJ_id_pkix_OCSP_serviceLocator		OBJ_id_pkix_OCSP,7L
-
-#define SN_id_pkix_OCSP_extendedStatus		"extendedStatus"
-#define LN_id_pkix_OCSP_extendedStatus		"Extended OCSP Status"
-#define NID_id_pkix_OCSP_extendedStatus		372
-#define OBJ_id_pkix_OCSP_extendedStatus		OBJ_id_pkix_OCSP,8L
-
-#define SN_id_pkix_OCSP_valid		"valid"
-#define NID_id_pkix_OCSP_valid		373
-#define OBJ_id_pkix_OCSP_valid		OBJ_id_pkix_OCSP,9L
-
-#define SN_id_pkix_OCSP_path		"path"
-#define NID_id_pkix_OCSP_path		374
-#define OBJ_id_pkix_OCSP_path		OBJ_id_pkix_OCSP,10L
-
-#define SN_id_pkix_OCSP_trustRoot		"trustRoot"
-#define LN_id_pkix_OCSP_trustRoot		"Trust Root"
-#define NID_id_pkix_OCSP_trustRoot		375
-#define OBJ_id_pkix_OCSP_trustRoot		OBJ_id_pkix_OCSP,11L
-
-#define SN_algorithm		"algorithm"
-#define LN_algorithm		"algorithm"
-#define NID_algorithm		376
-#define OBJ_algorithm		1L,3L,14L,3L,2L
-
-#define SN_md5WithRSA		"RSA-NP-MD5"
-#define LN_md5WithRSA		"md5WithRSA"
-#define NID_md5WithRSA		104
-#define OBJ_md5WithRSA		OBJ_algorithm,3L
-
-#define SN_des_ecb		"DES-ECB"
-#define LN_des_ecb		"des-ecb"
-#define NID_des_ecb		29
-#define OBJ_des_ecb		OBJ_algorithm,6L
-
-#define SN_des_cbc		"DES-CBC"
-#define LN_des_cbc		"des-cbc"
-#define NID_des_cbc		31
-#define OBJ_des_cbc		OBJ_algorithm,7L
-
-#define SN_des_ofb64		"DES-OFB"
-#define LN_des_ofb64		"des-ofb"
-#define NID_des_ofb64		45
-#define OBJ_des_ofb64		OBJ_algorithm,8L
-
-#define SN_des_cfb64		"DES-CFB"
-#define LN_des_cfb64		"des-cfb"
-#define NID_des_cfb64		30
-#define OBJ_des_cfb64		OBJ_algorithm,9L
-
-#define SN_rsaSignature		"rsaSignature"
-#define NID_rsaSignature		377
-#define OBJ_rsaSignature		OBJ_algorithm,11L
-
-#define SN_dsa_2		"DSA-old"
-#define LN_dsa_2		"dsaEncryption-old"
-#define NID_dsa_2		67
-#define OBJ_dsa_2		OBJ_algorithm,12L
-
-#define SN_dsaWithSHA		"DSA-SHA"
-#define LN_dsaWithSHA		"dsaWithSHA"
-#define NID_dsaWithSHA		66
-#define OBJ_dsaWithSHA		OBJ_algorithm,13L
-
-#define SN_shaWithRSAEncryption		"RSA-SHA"
-#define LN_shaWithRSAEncryption		"shaWithRSAEncryption"
-#define NID_shaWithRSAEncryption		42
-#define OBJ_shaWithRSAEncryption		OBJ_algorithm,15L
-
-#define SN_des_ede_ecb		"DES-EDE"
-#define LN_des_ede_ecb		"des-ede"
-#define NID_des_ede_ecb		32
-#define OBJ_des_ede_ecb		OBJ_algorithm,17L
-
-#define SN_des_ede3_ecb		"DES-EDE3"
-#define LN_des_ede3_ecb		"des-ede3"
-#define NID_des_ede3_ecb		33
-
-#define SN_des_ede_cbc		"DES-EDE-CBC"
-#define LN_des_ede_cbc		"des-ede-cbc"
-#define NID_des_ede_cbc		43
-
-#define SN_des_ede_cfb64		"DES-EDE-CFB"
-#define LN_des_ede_cfb64		"des-ede-cfb"
-#define NID_des_ede_cfb64		60
-
-#define SN_des_ede3_cfb64		"DES-EDE3-CFB"
-#define LN_des_ede3_cfb64		"des-ede3-cfb"
-#define NID_des_ede3_cfb64		61
-
-#define SN_des_ede_ofb64		"DES-EDE-OFB"
-#define LN_des_ede_ofb64		"des-ede-ofb"
-#define NID_des_ede_ofb64		62
-
-#define SN_des_ede3_ofb64		"DES-EDE3-OFB"
-#define LN_des_ede3_ofb64		"des-ede3-ofb"
-#define NID_des_ede3_ofb64		63
-
-#define SN_desx_cbc		"DESX-CBC"
-#define LN_desx_cbc		"desx-cbc"
-#define NID_desx_cbc		80
-
-#define SN_sha		"SHA"
-#define LN_sha		"sha"
-#define NID_sha		41
-#define OBJ_sha		OBJ_algorithm,18L
-
-#define SN_sha1		"SHA1"
-#define LN_sha1		"sha1"
-#define NID_sha1		64
-#define OBJ_sha1		OBJ_algorithm,26L
-
-#define SN_dsaWithSHA1_2		"DSA-SHA1-old"
-#define LN_dsaWithSHA1_2		"dsaWithSHA1-old"
-#define NID_dsaWithSHA1_2		70
-#define OBJ_dsaWithSHA1_2		OBJ_algorithm,27L
-
-#define SN_sha1WithRSA		"RSA-SHA1-2"
-#define LN_sha1WithRSA		"sha1WithRSA"
-#define NID_sha1WithRSA		115
-#define OBJ_sha1WithRSA		OBJ_algorithm,29L
-
-#define SN_ripemd160		"RIPEMD160"
-#define LN_ripemd160		"ripemd160"
-#define NID_ripemd160		117
-#define OBJ_ripemd160		1L,3L,36L,3L,2L,1L
-
-#define SN_ripemd160WithRSA		"RSA-RIPEMD160"
-#define LN_ripemd160WithRSA		"ripemd160WithRSA"
-#define NID_ripemd160WithRSA		119
-#define OBJ_ripemd160WithRSA		1L,3L,36L,3L,3L,1L,2L
-
-#define SN_sxnet		"SXNetID"
-#define LN_sxnet		"Strong Extranet ID"
-#define NID_sxnet		143
-#define OBJ_sxnet		1L,3L,101L,1L,4L,1L
-
-#define SN_X500		"X500"
-#define LN_X500		"directory services (X.500)"
-#define NID_X500		11
-#define OBJ_X500		2L,5L
-
-#define SN_X509		"X509"
-#define NID_X509		12
-#define OBJ_X509		OBJ_X500,4L
-
-#define SN_commonName		"CN"
-#define LN_commonName		"commonName"
-#define NID_commonName		13
-#define OBJ_commonName		OBJ_X509,3L
-
-#define SN_surname		"SN"
-#define LN_surname		"surname"
-#define NID_surname		100
-#define OBJ_surname		OBJ_X509,4L
-
-#define LN_serialNumber		"serialNumber"
-#define NID_serialNumber		105
-#define OBJ_serialNumber		OBJ_X509,5L
-
-#define SN_countryName		"C"
-#define LN_countryName		"countryName"
-#define NID_countryName		14
-#define OBJ_countryName		OBJ_X509,6L
-
-#define SN_localityName		"L"
-#define LN_localityName		"localityName"
-#define NID_localityName		15
-#define OBJ_localityName		OBJ_X509,7L
-
-#define SN_stateOrProvinceName		"ST"
-#define LN_stateOrProvinceName		"stateOrProvinceName"
-#define NID_stateOrProvinceName		16
-#define OBJ_stateOrProvinceName		OBJ_X509,8L
-
-#define LN_streetAddress		"streetAddress"
-#define NID_streetAddress		660
-#define OBJ_streetAddress		OBJ_X509,9L
-
-#define SN_organizationName		"O"
-#define LN_organizationName		"organizationName"
-#define NID_organizationName		17
-#define OBJ_organizationName		OBJ_X509,10L
-
-#define SN_organizationalUnitName		"OU"
-#define LN_organizationalUnitName		"organizationalUnitName"
-#define NID_organizationalUnitName		18
-#define OBJ_organizationalUnitName		OBJ_X509,11L
-
-#define LN_title		"title"
-#define NID_title		106
-#define OBJ_title		OBJ_X509,12L
-
-#define LN_description		"description"
-#define NID_description		107
-#define OBJ_description		OBJ_X509,13L
-
-#define LN_postalCode		"postalCode"
-#define NID_postalCode		661
-#define OBJ_postalCode		OBJ_X509,17L
-
-#define SN_name		"name"
-#define LN_name		"name"
-#define NID_name		173
-#define OBJ_name		OBJ_X509,41L
-
-#define SN_givenName		"GN"
-#define LN_givenName		"givenName"
-#define NID_givenName		99
-#define OBJ_givenName		OBJ_X509,42L
-
-#define LN_initials		"initials"
-#define NID_initials		101
-#define OBJ_initials		OBJ_X509,43L
-
-#define LN_generationQualifier		"generationQualifier"
-#define NID_generationQualifier		509
-#define OBJ_generationQualifier		OBJ_X509,44L
-
-#define LN_x500UniqueIdentifier		"x500UniqueIdentifier"
-#define NID_x500UniqueIdentifier		503
-#define OBJ_x500UniqueIdentifier		OBJ_X509,45L
-
-#define SN_dnQualifier		"dnQualifier"
-#define LN_dnQualifier		"dnQualifier"
-#define NID_dnQualifier		174
-#define OBJ_dnQualifier		OBJ_X509,46L
-
-#define LN_pseudonym		"pseudonym"
-#define NID_pseudonym		510
-#define OBJ_pseudonym		OBJ_X509,65L
-
-#define SN_role		"role"
-#define LN_role		"role"
-#define NID_role		400
-#define OBJ_role		OBJ_X509,72L
-
-#define SN_X500algorithms		"X500algorithms"
-#define LN_X500algorithms		"directory services - algorithms"
-#define NID_X500algorithms		378
-#define OBJ_X500algorithms		OBJ_X500,8L
-
-#define SN_rsa		"RSA"
-#define LN_rsa		"rsa"
-#define NID_rsa		19
-#define OBJ_rsa		OBJ_X500algorithms,1L,1L
-
-#define SN_mdc2WithRSA		"RSA-MDC2"
-#define LN_mdc2WithRSA		"mdc2WithRSA"
-#define NID_mdc2WithRSA		96
-#define OBJ_mdc2WithRSA		OBJ_X500algorithms,3L,100L
-
-#define SN_mdc2		"MDC2"
-#define LN_mdc2		"mdc2"
-#define NID_mdc2		95
-#define OBJ_mdc2		OBJ_X500algorithms,3L,101L
-
-#define SN_id_ce		"id-ce"
-#define NID_id_ce		81
-#define OBJ_id_ce		OBJ_X500,29L
-
-#define SN_subject_directory_attributes		"subjectDirectoryAttributes"
-#define LN_subject_directory_attributes		"X509v3 Subject Directory Attributes"
-#define NID_subject_directory_attributes		769
-#define OBJ_subject_directory_attributes		OBJ_id_ce,9L
-
-#define SN_subject_key_identifier		"subjectKeyIdentifier"
-#define LN_subject_key_identifier		"X509v3 Subject Key Identifier"
-#define NID_subject_key_identifier		82
-#define OBJ_subject_key_identifier		OBJ_id_ce,14L
-
-#define SN_key_usage		"keyUsage"
-#define LN_key_usage		"X509v3 Key Usage"
-#define NID_key_usage		83
-#define OBJ_key_usage		OBJ_id_ce,15L
-
-#define SN_private_key_usage_period		"privateKeyUsagePeriod"
-#define LN_private_key_usage_period		"X509v3 Private Key Usage Period"
-#define NID_private_key_usage_period		84
-#define OBJ_private_key_usage_period		OBJ_id_ce,16L
-
-#define SN_subject_alt_name		"subjectAltName"
-#define LN_subject_alt_name		"X509v3 Subject Alternative Name"
-#define NID_subject_alt_name		85
-#define OBJ_subject_alt_name		OBJ_id_ce,17L
-
-#define SN_issuer_alt_name		"issuerAltName"
-#define LN_issuer_alt_name		"X509v3 Issuer Alternative Name"
-#define NID_issuer_alt_name		86
-#define OBJ_issuer_alt_name		OBJ_id_ce,18L
-
-#define SN_basic_constraints		"basicConstraints"
-#define LN_basic_constraints		"X509v3 Basic Constraints"
-#define NID_basic_constraints		87
-#define OBJ_basic_constraints		OBJ_id_ce,19L
-
-#define SN_crl_number		"crlNumber"
-#define LN_crl_number		"X509v3 CRL Number"
-#define NID_crl_number		88
-#define OBJ_crl_number		OBJ_id_ce,20L
-
-#define SN_crl_reason		"CRLReason"
-#define LN_crl_reason		"X509v3 CRL Reason Code"
-#define NID_crl_reason		141
-#define OBJ_crl_reason		OBJ_id_ce,21L
-
-#define SN_invalidity_date		"invalidityDate"
-#define LN_invalidity_date		"Invalidity Date"
-#define NID_invalidity_date		142
-#define OBJ_invalidity_date		OBJ_id_ce,24L
-
-#define SN_delta_crl		"deltaCRL"
-#define LN_delta_crl		"X509v3 Delta CRL Indicator"
-#define NID_delta_crl		140
-#define OBJ_delta_crl		OBJ_id_ce,27L
-
-#define SN_issuing_distribution_point		"issuingDistributionPoint"
-#define LN_issuing_distribution_point		"X509v3 Issuing Distrubution Point"
-#define NID_issuing_distribution_point		770
-#define OBJ_issuing_distribution_point		OBJ_id_ce,28L
-
-#define SN_certificate_issuer		"certificateIssuer"
-#define LN_certificate_issuer		"X509v3 Certificate Issuer"
-#define NID_certificate_issuer		771
-#define OBJ_certificate_issuer		OBJ_id_ce,29L
-
-#define SN_name_constraints		"nameConstraints"
-#define LN_name_constraints		"X509v3 Name Constraints"
-#define NID_name_constraints		666
-#define OBJ_name_constraints		OBJ_id_ce,30L
-
-#define SN_crl_distribution_points		"crlDistributionPoints"
-#define LN_crl_distribution_points		"X509v3 CRL Distribution Points"
-#define NID_crl_distribution_points		103
-#define OBJ_crl_distribution_points		OBJ_id_ce,31L
-
-#define SN_certificate_policies		"certificatePolicies"
-#define LN_certificate_policies		"X509v3 Certificate Policies"
-#define NID_certificate_policies		89
-#define OBJ_certificate_policies		OBJ_id_ce,32L
-
-#define SN_any_policy		"anyPolicy"
-#define LN_any_policy		"X509v3 Any Policy"
-#define NID_any_policy		746
-#define OBJ_any_policy		OBJ_certificate_policies,0L
-
-#define SN_policy_mappings		"policyMappings"
-#define LN_policy_mappings		"X509v3 Policy Mappings"
-#define NID_policy_mappings		747
-#define OBJ_policy_mappings		OBJ_id_ce,33L
-
-#define SN_authority_key_identifier		"authorityKeyIdentifier"
-#define LN_authority_key_identifier		"X509v3 Authority Key Identifier"
-#define NID_authority_key_identifier		90
-#define OBJ_authority_key_identifier		OBJ_id_ce,35L
-
-#define SN_policy_constraints		"policyConstraints"
-#define LN_policy_constraints		"X509v3 Policy Constraints"
-#define NID_policy_constraints		401
-#define OBJ_policy_constraints		OBJ_id_ce,36L
-
-#define SN_ext_key_usage		"extendedKeyUsage"
-#define LN_ext_key_usage		"X509v3 Extended Key Usage"
-#define NID_ext_key_usage		126
-#define OBJ_ext_key_usage		OBJ_id_ce,37L
-
-#define SN_inhibit_any_policy		"inhibitAnyPolicy"
-#define LN_inhibit_any_policy		"X509v3 Inhibit Any Policy"
-#define NID_inhibit_any_policy		748
-#define OBJ_inhibit_any_policy		OBJ_id_ce,54L
-
-#define SN_target_information		"targetInformation"
-#define LN_target_information		"X509v3 AC Targeting"
-#define NID_target_information		402
-#define OBJ_target_information		OBJ_id_ce,55L
-
-#define SN_no_rev_avail		"noRevAvail"
-#define LN_no_rev_avail		"X509v3 No Revocation Available"
-#define NID_no_rev_avail		403
-#define OBJ_no_rev_avail		OBJ_id_ce,56L
-
-#define SN_netscape		"Netscape"
-#define LN_netscape		"Netscape Communications Corp."
-#define NID_netscape		57
-#define OBJ_netscape		2L,16L,840L,1L,113730L
-
-#define SN_netscape_cert_extension		"nsCertExt"
-#define LN_netscape_cert_extension		"Netscape Certificate Extension"
-#define NID_netscape_cert_extension		58
-#define OBJ_netscape_cert_extension		OBJ_netscape,1L
-
-#define SN_netscape_data_type		"nsDataType"
-#define LN_netscape_data_type		"Netscape Data Type"
-#define NID_netscape_data_type		59
-#define OBJ_netscape_data_type		OBJ_netscape,2L
-
-#define SN_netscape_cert_type		"nsCertType"
-#define LN_netscape_cert_type		"Netscape Cert Type"
-#define NID_netscape_cert_type		71
-#define OBJ_netscape_cert_type		OBJ_netscape_cert_extension,1L
-
-#define SN_netscape_base_url		"nsBaseUrl"
-#define LN_netscape_base_url		"Netscape Base Url"
-#define NID_netscape_base_url		72
-#define OBJ_netscape_base_url		OBJ_netscape_cert_extension,2L
-
-#define SN_netscape_revocation_url		"nsRevocationUrl"
-#define LN_netscape_revocation_url		"Netscape Revocation Url"
-#define NID_netscape_revocation_url		73
-#define OBJ_netscape_revocation_url		OBJ_netscape_cert_extension,3L
-
-#define SN_netscape_ca_revocation_url		"nsCaRevocationUrl"
-#define LN_netscape_ca_revocation_url		"Netscape CA Revocation Url"
-#define NID_netscape_ca_revocation_url		74
-#define OBJ_netscape_ca_revocation_url		OBJ_netscape_cert_extension,4L
-
-#define SN_netscape_renewal_url		"nsRenewalUrl"
-#define LN_netscape_renewal_url		"Netscape Renewal Url"
-#define NID_netscape_renewal_url		75
-#define OBJ_netscape_renewal_url		OBJ_netscape_cert_extension,7L
-
-#define SN_netscape_ca_policy_url		"nsCaPolicyUrl"
-#define LN_netscape_ca_policy_url		"Netscape CA Policy Url"
-#define NID_netscape_ca_policy_url		76
-#define OBJ_netscape_ca_policy_url		OBJ_netscape_cert_extension,8L
-
-#define SN_netscape_ssl_server_name		"nsSslServerName"
-#define LN_netscape_ssl_server_name		"Netscape SSL Server Name"
-#define NID_netscape_ssl_server_name		77
-#define OBJ_netscape_ssl_server_name		OBJ_netscape_cert_extension,12L
-
-#define SN_netscape_comment		"nsComment"
-#define LN_netscape_comment		"Netscape Comment"
-#define NID_netscape_comment		78
-#define OBJ_netscape_comment		OBJ_netscape_cert_extension,13L
-
-#define SN_netscape_cert_sequence		"nsCertSequence"
-#define LN_netscape_cert_sequence		"Netscape Certificate Sequence"
-#define NID_netscape_cert_sequence		79
-#define OBJ_netscape_cert_sequence		OBJ_netscape_data_type,5L
-
-#define SN_ns_sgc		"nsSGC"
-#define LN_ns_sgc		"Netscape Server Gated Crypto"
-#define NID_ns_sgc		139
-#define OBJ_ns_sgc		OBJ_netscape,4L,1L
-
-#define SN_org		"ORG"
-#define LN_org		"org"
-#define NID_org		379
-#define OBJ_org		OBJ_iso,3L
-
-#define SN_dod		"DOD"
-#define LN_dod		"dod"
-#define NID_dod		380
-#define OBJ_dod		OBJ_org,6L
-
-#define SN_iana		"IANA"
-#define LN_iana		"iana"
-#define NID_iana		381
-#define OBJ_iana		OBJ_dod,1L
-
-#define OBJ_internet		OBJ_iana
-
-#define SN_Directory		"directory"
-#define LN_Directory		"Directory"
-#define NID_Directory		382
-#define OBJ_Directory		OBJ_internet,1L
-
-#define SN_Management		"mgmt"
-#define LN_Management		"Management"
-#define NID_Management		383
-#define OBJ_Management		OBJ_internet,2L
-
-#define SN_Experimental		"experimental"
-#define LN_Experimental		"Experimental"
-#define NID_Experimental		384
-#define OBJ_Experimental		OBJ_internet,3L
-
-#define SN_Private		"private"
-#define LN_Private		"Private"
-#define NID_Private		385
-#define OBJ_Private		OBJ_internet,4L
-
-#define SN_Security		"security"
-#define LN_Security		"Security"
-#define NID_Security		386
-#define OBJ_Security		OBJ_internet,5L
-
-#define SN_SNMPv2		"snmpv2"
-#define LN_SNMPv2		"SNMPv2"
-#define NID_SNMPv2		387
-#define OBJ_SNMPv2		OBJ_internet,6L
-
-#define LN_Mail		"Mail"
-#define NID_Mail		388
-#define OBJ_Mail		OBJ_internet,7L
-
-#define SN_Enterprises		"enterprises"
-#define LN_Enterprises		"Enterprises"
-#define NID_Enterprises		389
-#define OBJ_Enterprises		OBJ_Private,1L
-
-#define SN_dcObject		"dcobject"
-#define LN_dcObject		"dcObject"
-#define NID_dcObject		390
-#define OBJ_dcObject		OBJ_Enterprises,1466L,344L
-
-#define SN_mime_mhs		"mime-mhs"
-#define LN_mime_mhs		"MIME MHS"
-#define NID_mime_mhs		504
-#define OBJ_mime_mhs		OBJ_Mail,1L
-
-#define SN_mime_mhs_headings		"mime-mhs-headings"
-#define LN_mime_mhs_headings		"mime-mhs-headings"
-#define NID_mime_mhs_headings		505
-#define OBJ_mime_mhs_headings		OBJ_mime_mhs,1L
-
-#define SN_mime_mhs_bodies		"mime-mhs-bodies"
-#define LN_mime_mhs_bodies		"mime-mhs-bodies"
-#define NID_mime_mhs_bodies		506
-#define OBJ_mime_mhs_bodies		OBJ_mime_mhs,2L
-
-#define SN_id_hex_partial_message		"id-hex-partial-message"
-#define LN_id_hex_partial_message		"id-hex-partial-message"
-#define NID_id_hex_partial_message		507
-#define OBJ_id_hex_partial_message		OBJ_mime_mhs_headings,1L
-
-#define SN_id_hex_multipart_message		"id-hex-multipart-message"
-#define LN_id_hex_multipart_message		"id-hex-multipart-message"
-#define NID_id_hex_multipart_message		508
-#define OBJ_id_hex_multipart_message		OBJ_mime_mhs_headings,2L
-
-#define SN_rle_compression		"RLE"
-#define LN_rle_compression		"run length compression"
-#define NID_rle_compression		124
-#define OBJ_rle_compression		1L,1L,1L,1L,666L,1L
-
-#define SN_zlib_compression		"ZLIB"
-#define LN_zlib_compression		"zlib compression"
-#define NID_zlib_compression		125
-#define OBJ_zlib_compression		1L,1L,1L,1L,666L,2L
-
-#define OBJ_csor		2L,16L,840L,1L,101L,3L
-
-#define OBJ_nistAlgorithms		OBJ_csor,4L
-
-#define OBJ_aes		OBJ_nistAlgorithms,1L
-
-#define SN_aes_128_ecb		"AES-128-ECB"
-#define LN_aes_128_ecb		"aes-128-ecb"
-#define NID_aes_128_ecb		418
-#define OBJ_aes_128_ecb		OBJ_aes,1L
-
-#define SN_aes_128_cbc		"AES-128-CBC"
-#define LN_aes_128_cbc		"aes-128-cbc"
-#define NID_aes_128_cbc		419
-#define OBJ_aes_128_cbc		OBJ_aes,2L
-
-#define SN_aes_128_ofb128		"AES-128-OFB"
-#define LN_aes_128_ofb128		"aes-128-ofb"
-#define NID_aes_128_ofb128		420
-#define OBJ_aes_128_ofb128		OBJ_aes,3L
-
-#define SN_aes_128_cfb128		"AES-128-CFB"
-#define LN_aes_128_cfb128		"aes-128-cfb"
-#define NID_aes_128_cfb128		421
-#define OBJ_aes_128_cfb128		OBJ_aes,4L
-
-#define SN_aes_192_ecb		"AES-192-ECB"
-#define LN_aes_192_ecb		"aes-192-ecb"
-#define NID_aes_192_ecb		422
-#define OBJ_aes_192_ecb		OBJ_aes,21L
-
-#define SN_aes_192_cbc		"AES-192-CBC"
-#define LN_aes_192_cbc		"aes-192-cbc"
-#define NID_aes_192_cbc		423
-#define OBJ_aes_192_cbc		OBJ_aes,22L
-
-#define SN_aes_192_ofb128		"AES-192-OFB"
-#define LN_aes_192_ofb128		"aes-192-ofb"
-#define NID_aes_192_ofb128		424
-#define OBJ_aes_192_ofb128		OBJ_aes,23L
-
-#define SN_aes_192_cfb128		"AES-192-CFB"
-#define LN_aes_192_cfb128		"aes-192-cfb"
-#define NID_aes_192_cfb128		425
-#define OBJ_aes_192_cfb128		OBJ_aes,24L
-
-#define SN_aes_256_ecb		"AES-256-ECB"
-#define LN_aes_256_ecb		"aes-256-ecb"
-#define NID_aes_256_ecb		426
-#define OBJ_aes_256_ecb		OBJ_aes,41L
-
-#define SN_aes_256_cbc		"AES-256-CBC"
-#define LN_aes_256_cbc		"aes-256-cbc"
-#define NID_aes_256_cbc		427
-#define OBJ_aes_256_cbc		OBJ_aes,42L
-
-#define SN_aes_256_ofb128		"AES-256-OFB"
-#define LN_aes_256_ofb128		"aes-256-ofb"
-#define NID_aes_256_ofb128		428
-#define OBJ_aes_256_ofb128		OBJ_aes,43L
-
-#define SN_aes_256_cfb128		"AES-256-CFB"
-#define LN_aes_256_cfb128		"aes-256-cfb"
-#define NID_aes_256_cfb128		429
-#define OBJ_aes_256_cfb128		OBJ_aes,44L
-
-#define SN_aes_128_cfb1		"AES-128-CFB1"
-#define LN_aes_128_cfb1		"aes-128-cfb1"
-#define NID_aes_128_cfb1		650
-
-#define SN_aes_192_cfb1		"AES-192-CFB1"
-#define LN_aes_192_cfb1		"aes-192-cfb1"
-#define NID_aes_192_cfb1		651
-
-#define SN_aes_256_cfb1		"AES-256-CFB1"
-#define LN_aes_256_cfb1		"aes-256-cfb1"
-#define NID_aes_256_cfb1		652
-
-#define SN_aes_128_cfb8		"AES-128-CFB8"
-#define LN_aes_128_cfb8		"aes-128-cfb8"
-#define NID_aes_128_cfb8		653
-
-#define SN_aes_192_cfb8		"AES-192-CFB8"
-#define LN_aes_192_cfb8		"aes-192-cfb8"
-#define NID_aes_192_cfb8		654
-
-#define SN_aes_256_cfb8		"AES-256-CFB8"
-#define LN_aes_256_cfb8		"aes-256-cfb8"
-#define NID_aes_256_cfb8		655
-
-#define SN_des_cfb1		"DES-CFB1"
-#define LN_des_cfb1		"des-cfb1"
-#define NID_des_cfb1		656
-
-#define SN_des_cfb8		"DES-CFB8"
-#define LN_des_cfb8		"des-cfb8"
-#define NID_des_cfb8		657
-
-#define SN_des_ede3_cfb1		"DES-EDE3-CFB1"
-#define LN_des_ede3_cfb1		"des-ede3-cfb1"
-#define NID_des_ede3_cfb1		658
-
-#define SN_des_ede3_cfb8		"DES-EDE3-CFB8"
-#define LN_des_ede3_cfb8		"des-ede3-cfb8"
-#define NID_des_ede3_cfb8		659
-
-#define OBJ_nist_hashalgs		OBJ_nistAlgorithms,2L
-
-#define SN_sha256		"SHA256"
-#define LN_sha256		"sha256"
-#define NID_sha256		672
-#define OBJ_sha256		OBJ_nist_hashalgs,1L
-
-#define SN_sha384		"SHA384"
-#define LN_sha384		"sha384"
-#define NID_sha384		673
-#define OBJ_sha384		OBJ_nist_hashalgs,2L
-
-#define SN_sha512		"SHA512"
-#define LN_sha512		"sha512"
-#define NID_sha512		674
-#define OBJ_sha512		OBJ_nist_hashalgs,3L
-
-#define SN_sha224		"SHA224"
-#define LN_sha224		"sha224"
-#define NID_sha224		675
-#define OBJ_sha224		OBJ_nist_hashalgs,4L
-
-#define SN_hold_instruction_code		"holdInstructionCode"
-#define LN_hold_instruction_code		"Hold Instruction Code"
-#define NID_hold_instruction_code		430
-#define OBJ_hold_instruction_code		OBJ_id_ce,23L
-
-#define OBJ_holdInstruction		OBJ_X9_57,2L
-
-#define SN_hold_instruction_none		"holdInstructionNone"
-#define LN_hold_instruction_none		"Hold Instruction None"
-#define NID_hold_instruction_none		431
-#define OBJ_hold_instruction_none		OBJ_holdInstruction,1L
-
-#define SN_hold_instruction_call_issuer		"holdInstructionCallIssuer"
-#define LN_hold_instruction_call_issuer		"Hold Instruction Call Issuer"
-#define NID_hold_instruction_call_issuer		432
-#define OBJ_hold_instruction_call_issuer		OBJ_holdInstruction,2L
-
-#define SN_hold_instruction_reject		"holdInstructionReject"
-#define LN_hold_instruction_reject		"Hold Instruction Reject"
-#define NID_hold_instruction_reject		433
-#define OBJ_hold_instruction_reject		OBJ_holdInstruction,3L
-
-#define SN_data		"data"
-#define NID_data		434
-#define OBJ_data		OBJ_itu_t,9L
-
-#define SN_pss		"pss"
-#define NID_pss		435
-#define OBJ_pss		OBJ_data,2342L
-
-#define SN_ucl		"ucl"
-#define NID_ucl		436
-#define OBJ_ucl		OBJ_pss,19200300L
-
-#define SN_pilot		"pilot"
-#define NID_pilot		437
-#define OBJ_pilot		OBJ_ucl,100L
-
-#define LN_pilotAttributeType		"pilotAttributeType"
-#define NID_pilotAttributeType		438
-#define OBJ_pilotAttributeType		OBJ_pilot,1L
-
-#define LN_pilotAttributeSyntax		"pilotAttributeSyntax"
-#define NID_pilotAttributeSyntax		439
-#define OBJ_pilotAttributeSyntax		OBJ_pilot,3L
-
-#define LN_pilotObjectClass		"pilotObjectClass"
-#define NID_pilotObjectClass		440
-#define OBJ_pilotObjectClass		OBJ_pilot,4L
-
-#define LN_pilotGroups		"pilotGroups"
-#define NID_pilotGroups		441
-#define OBJ_pilotGroups		OBJ_pilot,10L
-
-#define LN_iA5StringSyntax		"iA5StringSyntax"
-#define NID_iA5StringSyntax		442
-#define OBJ_iA5StringSyntax		OBJ_pilotAttributeSyntax,4L
-
-#define LN_caseIgnoreIA5StringSyntax		"caseIgnoreIA5StringSyntax"
-#define NID_caseIgnoreIA5StringSyntax		443
-#define OBJ_caseIgnoreIA5StringSyntax		OBJ_pilotAttributeSyntax,5L
-
-#define LN_pilotObject		"pilotObject"
-#define NID_pilotObject		444
-#define OBJ_pilotObject		OBJ_pilotObjectClass,3L
-
-#define LN_pilotPerson		"pilotPerson"
-#define NID_pilotPerson		445
-#define OBJ_pilotPerson		OBJ_pilotObjectClass,4L
-
-#define SN_account		"account"
-#define NID_account		446
-#define OBJ_account		OBJ_pilotObjectClass,5L
-
-#define SN_document		"document"
-#define NID_document		447
-#define OBJ_document		OBJ_pilotObjectClass,6L
-
-#define SN_room		"room"
-#define NID_room		448
-#define OBJ_room		OBJ_pilotObjectClass,7L
-
-#define LN_documentSeries		"documentSeries"
-#define NID_documentSeries		449
-#define OBJ_documentSeries		OBJ_pilotObjectClass,9L
-
-#define SN_Domain		"domain"
-#define LN_Domain		"Domain"
-#define NID_Domain		392
-#define OBJ_Domain		OBJ_pilotObjectClass,13L
-
-#define LN_rFC822localPart		"rFC822localPart"
-#define NID_rFC822localPart		450
-#define OBJ_rFC822localPart		OBJ_pilotObjectClass,14L
-
-#define LN_dNSDomain		"dNSDomain"
-#define NID_dNSDomain		451
-#define OBJ_dNSDomain		OBJ_pilotObjectClass,15L
-
-#define LN_domainRelatedObject		"domainRelatedObject"
-#define NID_domainRelatedObject		452
-#define OBJ_domainRelatedObject		OBJ_pilotObjectClass,17L
-
-#define LN_friendlyCountry		"friendlyCountry"
-#define NID_friendlyCountry		453
-#define OBJ_friendlyCountry		OBJ_pilotObjectClass,18L
-
-#define LN_simpleSecurityObject		"simpleSecurityObject"
-#define NID_simpleSecurityObject		454
-#define OBJ_simpleSecurityObject		OBJ_pilotObjectClass,19L
-
-#define LN_pilotOrganization		"pilotOrganization"
-#define NID_pilotOrganization		455
-#define OBJ_pilotOrganization		OBJ_pilotObjectClass,20L
-
-#define LN_pilotDSA		"pilotDSA"
-#define NID_pilotDSA		456
-#define OBJ_pilotDSA		OBJ_pilotObjectClass,21L
-
-#define LN_qualityLabelledData		"qualityLabelledData"
-#define NID_qualityLabelledData		457
-#define OBJ_qualityLabelledData		OBJ_pilotObjectClass,22L
-
-#define SN_userId		"UID"
-#define LN_userId		"userId"
-#define NID_userId		458
-#define OBJ_userId		OBJ_pilotAttributeType,1L
-
-#define LN_textEncodedORAddress		"textEncodedORAddress"
-#define NID_textEncodedORAddress		459
-#define OBJ_textEncodedORAddress		OBJ_pilotAttributeType,2L
-
-#define SN_rfc822Mailbox		"mail"
-#define LN_rfc822Mailbox		"rfc822Mailbox"
-#define NID_rfc822Mailbox		460
-#define OBJ_rfc822Mailbox		OBJ_pilotAttributeType,3L
-
-#define SN_info		"info"
-#define NID_info		461
-#define OBJ_info		OBJ_pilotAttributeType,4L
-
-#define LN_favouriteDrink		"favouriteDrink"
-#define NID_favouriteDrink		462
-#define OBJ_favouriteDrink		OBJ_pilotAttributeType,5L
-
-#define LN_roomNumber		"roomNumber"
-#define NID_roomNumber		463
-#define OBJ_roomNumber		OBJ_pilotAttributeType,6L
-
-#define SN_photo		"photo"
-#define NID_photo		464
-#define OBJ_photo		OBJ_pilotAttributeType,7L
-
-#define LN_userClass		"userClass"
-#define NID_userClass		465
-#define OBJ_userClass		OBJ_pilotAttributeType,8L
-
-#define SN_host		"host"
-#define NID_host		466
-#define OBJ_host		OBJ_pilotAttributeType,9L
-
-#define SN_manager		"manager"
-#define NID_manager		467
-#define OBJ_manager		OBJ_pilotAttributeType,10L
-
-#define LN_documentIdentifier		"documentIdentifier"
-#define NID_documentIdentifier		468
-#define OBJ_documentIdentifier		OBJ_pilotAttributeType,11L
-
-#define LN_documentTitle		"documentTitle"
-#define NID_documentTitle		469
-#define OBJ_documentTitle		OBJ_pilotAttributeType,12L
-
-#define LN_documentVersion		"documentVersion"
-#define NID_documentVersion		470
-#define OBJ_documentVersion		OBJ_pilotAttributeType,13L
-
-#define LN_documentAuthor		"documentAuthor"
-#define NID_documentAuthor		471
-#define OBJ_documentAuthor		OBJ_pilotAttributeType,14L
-
-#define LN_documentLocation		"documentLocation"
-#define NID_documentLocation		472
-#define OBJ_documentLocation		OBJ_pilotAttributeType,15L
-
-#define LN_homeTelephoneNumber		"homeTelephoneNumber"
-#define NID_homeTelephoneNumber		473
-#define OBJ_homeTelephoneNumber		OBJ_pilotAttributeType,20L
-
-#define SN_secretary		"secretary"
-#define NID_secretary		474
-#define OBJ_secretary		OBJ_pilotAttributeType,21L
-
-#define LN_otherMailbox		"otherMailbox"
-#define NID_otherMailbox		475
-#define OBJ_otherMailbox		OBJ_pilotAttributeType,22L
-
-#define LN_lastModifiedTime		"lastModifiedTime"
-#define NID_lastModifiedTime		476
-#define OBJ_lastModifiedTime		OBJ_pilotAttributeType,23L
-
-#define LN_lastModifiedBy		"lastModifiedBy"
-#define NID_lastModifiedBy		477
-#define OBJ_lastModifiedBy		OBJ_pilotAttributeType,24L
-
-#define SN_domainComponent		"DC"
-#define LN_domainComponent		"domainComponent"
-#define NID_domainComponent		391
-#define OBJ_domainComponent		OBJ_pilotAttributeType,25L
+#define SN_id_cmc_queryPending      "id-cmc-queryPending"
+#define NID_id_cmc_queryPending     343
+#define OBJ_id_cmc_queryPending     OBJ_id_cmc,21L
+
+#define SN_id_cmc_popLinkRandom     "id-cmc-popLinkRandom"
+#define NID_id_cmc_popLinkRandom        344
+#define OBJ_id_cmc_popLinkRandom        OBJ_id_cmc,22L
+
+#define SN_id_cmc_popLinkWitness        "id-cmc-popLinkWitness"
+#define NID_id_cmc_popLinkWitness       345
+#define OBJ_id_cmc_popLinkWitness       OBJ_id_cmc,23L
+
+#define SN_id_cmc_confirmCertAcceptance     "id-cmc-confirmCertAcceptance"
+#define NID_id_cmc_confirmCertAcceptance        346
+#define OBJ_id_cmc_confirmCertAcceptance        OBJ_id_cmc,24L
+
+#define SN_id_on_personalData       "id-on-personalData"
+#define NID_id_on_personalData      347
+#define OBJ_id_on_personalData      OBJ_id_on,1L
+
+#define SN_id_pda_dateOfBirth       "id-pda-dateOfBirth"
+#define NID_id_pda_dateOfBirth      348
+#define OBJ_id_pda_dateOfBirth      OBJ_id_pda,1L
+
+#define SN_id_pda_placeOfBirth      "id-pda-placeOfBirth"
+#define NID_id_pda_placeOfBirth     349
+#define OBJ_id_pda_placeOfBirth     OBJ_id_pda,2L
+
+#define SN_id_pda_gender        "id-pda-gender"
+#define NID_id_pda_gender       351
+#define OBJ_id_pda_gender       OBJ_id_pda,3L
+
+#define SN_id_pda_countryOfCitizenship      "id-pda-countryOfCitizenship"
+#define NID_id_pda_countryOfCitizenship     352
+#define OBJ_id_pda_countryOfCitizenship     OBJ_id_pda,4L
+
+#define SN_id_pda_countryOfResidence        "id-pda-countryOfResidence"
+#define NID_id_pda_countryOfResidence       353
+#define OBJ_id_pda_countryOfResidence       OBJ_id_pda,5L
+
+#define SN_id_aca_authenticationInfo        "id-aca-authenticationInfo"
+#define NID_id_aca_authenticationInfo       354
+#define OBJ_id_aca_authenticationInfo       OBJ_id_aca,1L
+
+#define SN_id_aca_accessIdentity        "id-aca-accessIdentity"
+#define NID_id_aca_accessIdentity       355
+#define OBJ_id_aca_accessIdentity       OBJ_id_aca,2L
+
+#define SN_id_aca_chargingIdentity      "id-aca-chargingIdentity"
+#define NID_id_aca_chargingIdentity     356
+#define OBJ_id_aca_chargingIdentity     OBJ_id_aca,3L
+
+#define SN_id_aca_group     "id-aca-group"
+#define NID_id_aca_group        357
+#define OBJ_id_aca_group        OBJ_id_aca,4L
+
+#define SN_id_aca_role      "id-aca-role"
+#define NID_id_aca_role     358
+#define OBJ_id_aca_role     OBJ_id_aca,5L
+
+#define SN_id_aca_encAttrs      "id-aca-encAttrs"
+#define NID_id_aca_encAttrs     399
+#define OBJ_id_aca_encAttrs     OBJ_id_aca,6L
+
+#define SN_id_qcs_pkixQCSyntax_v1       "id-qcs-pkixQCSyntax-v1"
+#define NID_id_qcs_pkixQCSyntax_v1      359
+#define OBJ_id_qcs_pkixQCSyntax_v1      OBJ_id_qcs,1L
+
+#define SN_id_cct_crs       "id-cct-crs"
+#define NID_id_cct_crs      360
+#define OBJ_id_cct_crs      OBJ_id_cct,1L
+
+#define SN_id_cct_PKIData       "id-cct-PKIData"
+#define NID_id_cct_PKIData      361
+#define OBJ_id_cct_PKIData      OBJ_id_cct,2L
+
+#define SN_id_cct_PKIResponse       "id-cct-PKIResponse"
+#define NID_id_cct_PKIResponse      362
+#define OBJ_id_cct_PKIResponse      OBJ_id_cct,3L
+
+#define SN_id_ppl_anyLanguage       "id-ppl-anyLanguage"
+#define LN_id_ppl_anyLanguage       "Any language"
+#define NID_id_ppl_anyLanguage      664
+#define OBJ_id_ppl_anyLanguage      OBJ_id_ppl,0L
+
+#define SN_id_ppl_inheritAll        "id-ppl-inheritAll"
+#define LN_id_ppl_inheritAll        "Inherit all"
+#define NID_id_ppl_inheritAll       665
+#define OBJ_id_ppl_inheritAll       OBJ_id_ppl,1L
+
+#define SN_Independent      "id-ppl-independent"
+#define LN_Independent      "Independent"
+#define NID_Independent     667
+#define OBJ_Independent     OBJ_id_ppl,2L
+
+#define SN_ad_OCSP      "OCSP"
+#define LN_ad_OCSP      "OCSP"
+#define NID_ad_OCSP     178
+#define OBJ_ad_OCSP     OBJ_id_ad,1L
+
+#define SN_ad_ca_issuers        "caIssuers"
+#define LN_ad_ca_issuers        "CA Issuers"
+#define NID_ad_ca_issuers       179
+#define OBJ_ad_ca_issuers       OBJ_id_ad,2L
+
+#define SN_ad_timeStamping      "ad_timestamping"
+#define LN_ad_timeStamping      "AD Time Stamping"
+#define NID_ad_timeStamping     363
+#define OBJ_ad_timeStamping     OBJ_id_ad,3L
+
+#define SN_ad_dvcs      "AD_DVCS"
+#define LN_ad_dvcs      "ad dvcs"
+#define NID_ad_dvcs     364
+#define OBJ_ad_dvcs     OBJ_id_ad,4L
+
+#define OBJ_id_pkix_OCSP        OBJ_ad_OCSP
+
+#define SN_id_pkix_OCSP_basic       "basicOCSPResponse"
+#define LN_id_pkix_OCSP_basic       "Basic OCSP Response"
+#define NID_id_pkix_OCSP_basic      365
+#define OBJ_id_pkix_OCSP_basic      OBJ_id_pkix_OCSP,1L
+
+#define SN_id_pkix_OCSP_Nonce       "Nonce"
+#define LN_id_pkix_OCSP_Nonce       "OCSP Nonce"
+#define NID_id_pkix_OCSP_Nonce      366
+#define OBJ_id_pkix_OCSP_Nonce      OBJ_id_pkix_OCSP,2L
+
+#define SN_id_pkix_OCSP_CrlID       "CrlID"
+#define LN_id_pkix_OCSP_CrlID       "OCSP CRL ID"
+#define NID_id_pkix_OCSP_CrlID      367
+#define OBJ_id_pkix_OCSP_CrlID      OBJ_id_pkix_OCSP,3L
+
+#define SN_id_pkix_OCSP_acceptableResponses     "acceptableResponses"
+#define LN_id_pkix_OCSP_acceptableResponses     "Acceptable OCSP Responses"
+#define NID_id_pkix_OCSP_acceptableResponses        368
+#define OBJ_id_pkix_OCSP_acceptableResponses        OBJ_id_pkix_OCSP,4L
+
+#define SN_id_pkix_OCSP_noCheck     "noCheck"
+#define LN_id_pkix_OCSP_noCheck     "OCSP No Check"
+#define NID_id_pkix_OCSP_noCheck        369
+#define OBJ_id_pkix_OCSP_noCheck        OBJ_id_pkix_OCSP,5L
+
+#define SN_id_pkix_OCSP_archiveCutoff       "archiveCutoff"
+#define LN_id_pkix_OCSP_archiveCutoff       "OCSP Archive Cutoff"
+#define NID_id_pkix_OCSP_archiveCutoff      370
+#define OBJ_id_pkix_OCSP_archiveCutoff      OBJ_id_pkix_OCSP,6L
+
+#define SN_id_pkix_OCSP_serviceLocator      "serviceLocator"
+#define LN_id_pkix_OCSP_serviceLocator      "OCSP Service Locator"
+#define NID_id_pkix_OCSP_serviceLocator     371
+#define OBJ_id_pkix_OCSP_serviceLocator     OBJ_id_pkix_OCSP,7L
+
+#define SN_id_pkix_OCSP_extendedStatus      "extendedStatus"
+#define LN_id_pkix_OCSP_extendedStatus      "Extended OCSP Status"
+#define NID_id_pkix_OCSP_extendedStatus     372
+#define OBJ_id_pkix_OCSP_extendedStatus     OBJ_id_pkix_OCSP,8L
+
+#define SN_id_pkix_OCSP_valid       "valid"
+#define NID_id_pkix_OCSP_valid      373
+#define OBJ_id_pkix_OCSP_valid      OBJ_id_pkix_OCSP,9L
+
+#define SN_id_pkix_OCSP_path        "path"
+#define NID_id_pkix_OCSP_path       374
+#define OBJ_id_pkix_OCSP_path       OBJ_id_pkix_OCSP,10L
+
+#define SN_id_pkix_OCSP_trustRoot       "trustRoot"
+#define LN_id_pkix_OCSP_trustRoot       "Trust Root"
+#define NID_id_pkix_OCSP_trustRoot      375
+#define OBJ_id_pkix_OCSP_trustRoot      OBJ_id_pkix_OCSP,11L
+
+#define SN_algorithm        "algorithm"
+#define LN_algorithm        "algorithm"
+#define NID_algorithm       376
+#define OBJ_algorithm       1L,3L,14L,3L,2L
+
+#define SN_md5WithRSA       "RSA-NP-MD5"
+#define LN_md5WithRSA       "md5WithRSA"
+#define NID_md5WithRSA      104
+#define OBJ_md5WithRSA      OBJ_algorithm,3L
+
+#define SN_des_ecb      "DES-ECB"
+#define LN_des_ecb      "des-ecb"
+#define NID_des_ecb     29
+#define OBJ_des_ecb     OBJ_algorithm,6L
+
+#define SN_des_cbc      "DES-CBC"
+#define LN_des_cbc      "des-cbc"
+#define NID_des_cbc     31
+#define OBJ_des_cbc     OBJ_algorithm,7L
+
+#define SN_des_ofb64        "DES-OFB"
+#define LN_des_ofb64        "des-ofb"
+#define NID_des_ofb64       45
+#define OBJ_des_ofb64       OBJ_algorithm,8L
+
+#define SN_des_cfb64        "DES-CFB"
+#define LN_des_cfb64        "des-cfb"
+#define NID_des_cfb64       30
+#define OBJ_des_cfb64       OBJ_algorithm,9L
+
+#define SN_rsaSignature     "rsaSignature"
+#define NID_rsaSignature        377
+#define OBJ_rsaSignature        OBJ_algorithm,11L
+
+#define SN_dsa_2        "DSA-old"
+#define LN_dsa_2        "dsaEncryption-old"
+#define NID_dsa_2       67
+#define OBJ_dsa_2       OBJ_algorithm,12L
+
+#define SN_dsaWithSHA       "DSA-SHA"
+#define LN_dsaWithSHA       "dsaWithSHA"
+#define NID_dsaWithSHA      66
+#define OBJ_dsaWithSHA      OBJ_algorithm,13L
+
+#define SN_shaWithRSAEncryption     "RSA-SHA"
+#define LN_shaWithRSAEncryption     "shaWithRSAEncryption"
+#define NID_shaWithRSAEncryption        42
+#define OBJ_shaWithRSAEncryption        OBJ_algorithm,15L
+
+#define SN_des_ede_ecb      "DES-EDE"
+#define LN_des_ede_ecb      "des-ede"
+#define NID_des_ede_ecb     32
+#define OBJ_des_ede_ecb     OBJ_algorithm,17L
+
+#define SN_des_ede3_ecb     "DES-EDE3"
+#define LN_des_ede3_ecb     "des-ede3"
+#define NID_des_ede3_ecb        33
+
+#define SN_des_ede_cbc      "DES-EDE-CBC"
+#define LN_des_ede_cbc      "des-ede-cbc"
+#define NID_des_ede_cbc     43
+
+#define SN_des_ede_cfb64        "DES-EDE-CFB"
+#define LN_des_ede_cfb64        "des-ede-cfb"
+#define NID_des_ede_cfb64       60
+
+#define SN_des_ede3_cfb64       "DES-EDE3-CFB"
+#define LN_des_ede3_cfb64       "des-ede3-cfb"
+#define NID_des_ede3_cfb64      61
+
+#define SN_des_ede_ofb64        "DES-EDE-OFB"
+#define LN_des_ede_ofb64        "des-ede-ofb"
+#define NID_des_ede_ofb64       62
+
+#define SN_des_ede3_ofb64       "DES-EDE3-OFB"
+#define LN_des_ede3_ofb64       "des-ede3-ofb"
+#define NID_des_ede3_ofb64      63
+
+#define SN_desx_cbc     "DESX-CBC"
+#define LN_desx_cbc     "desx-cbc"
+#define NID_desx_cbc        80
+
+#define SN_sha      "SHA"
+#define LN_sha      "sha"
+#define NID_sha     41
+#define OBJ_sha     OBJ_algorithm,18L
+
+#define SN_sha1     "SHA1"
+#define LN_sha1     "sha1"
+#define NID_sha1        64
+#define OBJ_sha1        OBJ_algorithm,26L
+
+#define SN_dsaWithSHA1_2        "DSA-SHA1-old"
+#define LN_dsaWithSHA1_2        "dsaWithSHA1-old"
+#define NID_dsaWithSHA1_2       70
+#define OBJ_dsaWithSHA1_2       OBJ_algorithm,27L
+
+#define SN_sha1WithRSA      "RSA-SHA1-2"
+#define LN_sha1WithRSA      "sha1WithRSA"
+#define NID_sha1WithRSA     115
+#define OBJ_sha1WithRSA     OBJ_algorithm,29L
+
+#define SN_ripemd160        "RIPEMD160"
+#define LN_ripemd160        "ripemd160"
+#define NID_ripemd160       117
+#define OBJ_ripemd160       1L,3L,36L,3L,2L,1L
+
+#define SN_ripemd160WithRSA     "RSA-RIPEMD160"
+#define LN_ripemd160WithRSA     "ripemd160WithRSA"
+#define NID_ripemd160WithRSA        119
+#define OBJ_ripemd160WithRSA        1L,3L,36L,3L,3L,1L,2L
+
+#define SN_sxnet        "SXNetID"
+#define LN_sxnet        "Strong Extranet ID"
+#define NID_sxnet       143
+#define OBJ_sxnet       1L,3L,101L,1L,4L,1L
+
+#define SN_X500     "X500"
+#define LN_X500     "directory services (X.500)"
+#define NID_X500        11
+#define OBJ_X500        2L,5L
+
+#define SN_X509     "X509"
+#define NID_X509        12
+#define OBJ_X509        OBJ_X500,4L
+
+#define SN_commonName       "CN"
+#define LN_commonName       "commonName"
+#define NID_commonName      13
+#define OBJ_commonName      OBJ_X509,3L
+
+#define SN_surname      "SN"
+#define LN_surname      "surname"
+#define NID_surname     100
+#define OBJ_surname     OBJ_X509,4L
+
+#define LN_serialNumber     "serialNumber"
+#define NID_serialNumber        105
+#define OBJ_serialNumber        OBJ_X509,5L
+
+#define SN_countryName      "C"
+#define LN_countryName      "countryName"
+#define NID_countryName     14
+#define OBJ_countryName     OBJ_X509,6L
+
+#define SN_localityName     "L"
+#define LN_localityName     "localityName"
+#define NID_localityName        15
+#define OBJ_localityName        OBJ_X509,7L
+
+#define SN_stateOrProvinceName      "ST"
+#define LN_stateOrProvinceName      "stateOrProvinceName"
+#define NID_stateOrProvinceName     16
+#define OBJ_stateOrProvinceName     OBJ_X509,8L
+
+#define LN_streetAddress        "streetAddress"
+#define NID_streetAddress       660
+#define OBJ_streetAddress       OBJ_X509,9L
+
+#define SN_organizationName     "O"
+#define LN_organizationName     "organizationName"
+#define NID_organizationName        17
+#define OBJ_organizationName        OBJ_X509,10L
+
+#define SN_organizationalUnitName       "OU"
+#define LN_organizationalUnitName       "organizationalUnitName"
+#define NID_organizationalUnitName      18
+#define OBJ_organizationalUnitName      OBJ_X509,11L
+
+#define LN_title        "title"
+#define NID_title       106
+#define OBJ_title       OBJ_X509,12L
+
+#define LN_description      "description"
+#define NID_description     107
+#define OBJ_description     OBJ_X509,13L
+
+#define LN_postalCode       "postalCode"
+#define NID_postalCode      661
+#define OBJ_postalCode      OBJ_X509,17L
+
+#define SN_name     "name"
+#define LN_name     "name"
+#define NID_name        173
+#define OBJ_name        OBJ_X509,41L
+
+#define SN_givenName        "GN"
+#define LN_givenName        "givenName"
+#define NID_givenName       99
+#define OBJ_givenName       OBJ_X509,42L
+
+#define LN_initials     "initials"
+#define NID_initials        101
+#define OBJ_initials        OBJ_X509,43L
+
+#define LN_generationQualifier      "generationQualifier"
+#define NID_generationQualifier     509
+#define OBJ_generationQualifier     OBJ_X509,44L
+
+#define LN_x500UniqueIdentifier     "x500UniqueIdentifier"
+#define NID_x500UniqueIdentifier        503
+#define OBJ_x500UniqueIdentifier        OBJ_X509,45L
+
+#define SN_dnQualifier      "dnQualifier"
+#define LN_dnQualifier      "dnQualifier"
+#define NID_dnQualifier     174
+#define OBJ_dnQualifier     OBJ_X509,46L
+
+#define LN_pseudonym        "pseudonym"
+#define NID_pseudonym       510
+#define OBJ_pseudonym       OBJ_X509,65L
+
+#define SN_role     "role"
+#define LN_role     "role"
+#define NID_role        400
+#define OBJ_role        OBJ_X509,72L
+
+#define SN_X500algorithms       "X500algorithms"
+#define LN_X500algorithms       "directory services - algorithms"
+#define NID_X500algorithms      378
+#define OBJ_X500algorithms      OBJ_X500,8L
+
+#define SN_rsa      "RSA"
+#define LN_rsa      "rsa"
+#define NID_rsa     19
+#define OBJ_rsa     OBJ_X500algorithms,1L,1L
+
+#define SN_mdc2WithRSA      "RSA-MDC2"
+#define LN_mdc2WithRSA      "mdc2WithRSA"
+#define NID_mdc2WithRSA     96
+#define OBJ_mdc2WithRSA     OBJ_X500algorithms,3L,100L
+
+#define SN_mdc2     "MDC2"
+#define LN_mdc2     "mdc2"
+#define NID_mdc2        95
+#define OBJ_mdc2        OBJ_X500algorithms,3L,101L
+
+#define SN_id_ce        "id-ce"
+#define NID_id_ce       81
+#define OBJ_id_ce       OBJ_X500,29L
+
+#define SN_subject_directory_attributes     "subjectDirectoryAttributes"
+#define LN_subject_directory_attributes     "X509v3 Subject Directory Attributes"
+#define NID_subject_directory_attributes        769
+#define OBJ_subject_directory_attributes        OBJ_id_ce,9L
+
+#define SN_subject_key_identifier       "subjectKeyIdentifier"
+#define LN_subject_key_identifier       "X509v3 Subject Key Identifier"
+#define NID_subject_key_identifier      82
+#define OBJ_subject_key_identifier      OBJ_id_ce,14L
+
+#define SN_key_usage        "keyUsage"
+#define LN_key_usage        "X509v3 Key Usage"
+#define NID_key_usage       83
+#define OBJ_key_usage       OBJ_id_ce,15L
+
+#define SN_private_key_usage_period     "privateKeyUsagePeriod"
+#define LN_private_key_usage_period     "X509v3 Private Key Usage Period"
+#define NID_private_key_usage_period        84
+#define OBJ_private_key_usage_period        OBJ_id_ce,16L
+
+#define SN_subject_alt_name     "subjectAltName"
+#define LN_subject_alt_name     "X509v3 Subject Alternative Name"
+#define NID_subject_alt_name        85
+#define OBJ_subject_alt_name        OBJ_id_ce,17L
+
+#define SN_issuer_alt_name      "issuerAltName"
+#define LN_issuer_alt_name      "X509v3 Issuer Alternative Name"
+#define NID_issuer_alt_name     86
+#define OBJ_issuer_alt_name     OBJ_id_ce,18L
+
+#define SN_basic_constraints        "basicConstraints"
+#define LN_basic_constraints        "X509v3 Basic Constraints"
+#define NID_basic_constraints       87
+#define OBJ_basic_constraints       OBJ_id_ce,19L
+
+#define SN_crl_number       "crlNumber"
+#define LN_crl_number       "X509v3 CRL Number"
+#define NID_crl_number      88
+#define OBJ_crl_number      OBJ_id_ce,20L
+
+#define SN_crl_reason       "CRLReason"
+#define LN_crl_reason       "X509v3 CRL Reason Code"
+#define NID_crl_reason      141
+#define OBJ_crl_reason      OBJ_id_ce,21L
+
+#define SN_invalidity_date      "invalidityDate"
+#define LN_invalidity_date      "Invalidity Date"
+#define NID_invalidity_date     142
+#define OBJ_invalidity_date     OBJ_id_ce,24L
+
+#define SN_delta_crl        "deltaCRL"
+#define LN_delta_crl        "X509v3 Delta CRL Indicator"
+#define NID_delta_crl       140
+#define OBJ_delta_crl       OBJ_id_ce,27L
+
+#define SN_issuing_distribution_point       "issuingDistributionPoint"
+#define LN_issuing_distribution_point       "X509v3 Issuing Distrubution Point"
+#define NID_issuing_distribution_point      770
+#define OBJ_issuing_distribution_point      OBJ_id_ce,28L
+
+#define SN_certificate_issuer       "certificateIssuer"
+#define LN_certificate_issuer       "X509v3 Certificate Issuer"
+#define NID_certificate_issuer      771
+#define OBJ_certificate_issuer      OBJ_id_ce,29L
+
+#define SN_name_constraints     "nameConstraints"
+#define LN_name_constraints     "X509v3 Name Constraints"
+#define NID_name_constraints        666
+#define OBJ_name_constraints        OBJ_id_ce,30L
+
+#define SN_crl_distribution_points      "crlDistributionPoints"
+#define LN_crl_distribution_points      "X509v3 CRL Distribution Points"
+#define NID_crl_distribution_points     103
+#define OBJ_crl_distribution_points     OBJ_id_ce,31L
+
+#define SN_certificate_policies     "certificatePolicies"
+#define LN_certificate_policies     "X509v3 Certificate Policies"
+#define NID_certificate_policies        89
+#define OBJ_certificate_policies        OBJ_id_ce,32L
+
+#define SN_any_policy       "anyPolicy"
+#define LN_any_policy       "X509v3 Any Policy"
+#define NID_any_policy      746
+#define OBJ_any_policy      OBJ_certificate_policies,0L
+
+#define SN_policy_mappings      "policyMappings"
+#define LN_policy_mappings      "X509v3 Policy Mappings"
+#define NID_policy_mappings     747
+#define OBJ_policy_mappings     OBJ_id_ce,33L
+
+#define SN_authority_key_identifier     "authorityKeyIdentifier"
+#define LN_authority_key_identifier     "X509v3 Authority Key Identifier"
+#define NID_authority_key_identifier        90
+#define OBJ_authority_key_identifier        OBJ_id_ce,35L
+
+#define SN_policy_constraints       "policyConstraints"
+#define LN_policy_constraints       "X509v3 Policy Constraints"
+#define NID_policy_constraints      401
+#define OBJ_policy_constraints      OBJ_id_ce,36L
+
+#define SN_ext_key_usage        "extendedKeyUsage"
+#define LN_ext_key_usage        "X509v3 Extended Key Usage"
+#define NID_ext_key_usage       126
+#define OBJ_ext_key_usage       OBJ_id_ce,37L
+
+#define SN_inhibit_any_policy       "inhibitAnyPolicy"
+#define LN_inhibit_any_policy       "X509v3 Inhibit Any Policy"
+#define NID_inhibit_any_policy      748
+#define OBJ_inhibit_any_policy      OBJ_id_ce,54L
+
+#define SN_target_information       "targetInformation"
+#define LN_target_information       "X509v3 AC Targeting"
+#define NID_target_information      402
+#define OBJ_target_information      OBJ_id_ce,55L
+
+#define SN_no_rev_avail     "noRevAvail"
+#define LN_no_rev_avail     "X509v3 No Revocation Available"
+#define NID_no_rev_avail        403
+#define OBJ_no_rev_avail        OBJ_id_ce,56L
+
+#define SN_netscape     "Netscape"
+#define LN_netscape     "Netscape Communications Corp."
+#define NID_netscape        57
+#define OBJ_netscape        2L,16L,840L,1L,113730L
+
+#define SN_netscape_cert_extension      "nsCertExt"
+#define LN_netscape_cert_extension      "Netscape Certificate Extension"
+#define NID_netscape_cert_extension     58
+#define OBJ_netscape_cert_extension     OBJ_netscape,1L
+
+#define SN_netscape_data_type       "nsDataType"
+#define LN_netscape_data_type       "Netscape Data Type"
+#define NID_netscape_data_type      59
+#define OBJ_netscape_data_type      OBJ_netscape,2L
+
+#define SN_netscape_cert_type       "nsCertType"
+#define LN_netscape_cert_type       "Netscape Cert Type"
+#define NID_netscape_cert_type      71
+#define OBJ_netscape_cert_type      OBJ_netscape_cert_extension,1L
+
+#define SN_netscape_base_url        "nsBaseUrl"
+#define LN_netscape_base_url        "Netscape Base Url"
+#define NID_netscape_base_url       72
+#define OBJ_netscape_base_url       OBJ_netscape_cert_extension,2L
+
+#define SN_netscape_revocation_url      "nsRevocationUrl"
+#define LN_netscape_revocation_url      "Netscape Revocation Url"
+#define NID_netscape_revocation_url     73
+#define OBJ_netscape_revocation_url     OBJ_netscape_cert_extension,3L
+
+#define SN_netscape_ca_revocation_url       "nsCaRevocationUrl"
+#define LN_netscape_ca_revocation_url       "Netscape CA Revocation Url"
+#define NID_netscape_ca_revocation_url      74
+#define OBJ_netscape_ca_revocation_url      OBJ_netscape_cert_extension,4L
+
+#define SN_netscape_renewal_url     "nsRenewalUrl"
+#define LN_netscape_renewal_url     "Netscape Renewal Url"
+#define NID_netscape_renewal_url        75
+#define OBJ_netscape_renewal_url        OBJ_netscape_cert_extension,7L
+
+#define SN_netscape_ca_policy_url       "nsCaPolicyUrl"
+#define LN_netscape_ca_policy_url       "Netscape CA Policy Url"
+#define NID_netscape_ca_policy_url      76
+#define OBJ_netscape_ca_policy_url      OBJ_netscape_cert_extension,8L
+
+#define SN_netscape_ssl_server_name     "nsSslServerName"
+#define LN_netscape_ssl_server_name     "Netscape SSL Server Name"
+#define NID_netscape_ssl_server_name        77
+#define OBJ_netscape_ssl_server_name        OBJ_netscape_cert_extension,12L
+
+#define SN_netscape_comment     "nsComment"
+#define LN_netscape_comment     "Netscape Comment"
+#define NID_netscape_comment        78
+#define OBJ_netscape_comment        OBJ_netscape_cert_extension,13L
+
+#define SN_netscape_cert_sequence       "nsCertSequence"
+#define LN_netscape_cert_sequence       "Netscape Certificate Sequence"
+#define NID_netscape_cert_sequence      79
+#define OBJ_netscape_cert_sequence      OBJ_netscape_data_type,5L
+
+#define SN_ns_sgc       "nsSGC"
+#define LN_ns_sgc       "Netscape Server Gated Crypto"
+#define NID_ns_sgc      139
+#define OBJ_ns_sgc      OBJ_netscape,4L,1L
+
+#define SN_org      "ORG"
+#define LN_org      "org"
+#define NID_org     379
+#define OBJ_org     OBJ_iso,3L
+
+#define SN_dod      "DOD"
+#define LN_dod      "dod"
+#define NID_dod     380
+#define OBJ_dod     OBJ_org,6L
+
+#define SN_iana     "IANA"
+#define LN_iana     "iana"
+#define NID_iana        381
+#define OBJ_iana        OBJ_dod,1L
+
+#define OBJ_internet        OBJ_iana
+
+#define SN_Directory        "directory"
+#define LN_Directory        "Directory"
+#define NID_Directory       382
+#define OBJ_Directory       OBJ_internet,1L
+
+#define SN_Management       "mgmt"
+#define LN_Management       "Management"
+#define NID_Management      383
+#define OBJ_Management      OBJ_internet,2L
+
+#define SN_Experimental     "experimental"
+#define LN_Experimental     "Experimental"
+#define NID_Experimental        384
+#define OBJ_Experimental        OBJ_internet,3L
+
+#define SN_Private      "private"
+#define LN_Private      "Private"
+#define NID_Private     385
+#define OBJ_Private     OBJ_internet,4L
+
+#define SN_Security     "security"
+#define LN_Security     "Security"
+#define NID_Security        386
+#define OBJ_Security        OBJ_internet,5L
+
+#define SN_SNMPv2       "snmpv2"
+#define LN_SNMPv2       "SNMPv2"
+#define NID_SNMPv2      387
+#define OBJ_SNMPv2      OBJ_internet,6L
+
+#define LN_Mail     "Mail"
+#define NID_Mail        388
+#define OBJ_Mail        OBJ_internet,7L
+
+#define SN_Enterprises      "enterprises"
+#define LN_Enterprises      "Enterprises"
+#define NID_Enterprises     389
+#define OBJ_Enterprises     OBJ_Private,1L
+
+#define SN_dcObject     "dcobject"
+#define LN_dcObject     "dcObject"
+#define NID_dcObject        390
+#define OBJ_dcObject        OBJ_Enterprises,1466L,344L
+
+#define SN_mime_mhs     "mime-mhs"
+#define LN_mime_mhs     "MIME MHS"
+#define NID_mime_mhs        504
+#define OBJ_mime_mhs        OBJ_Mail,1L
+
+#define SN_mime_mhs_headings        "mime-mhs-headings"
+#define LN_mime_mhs_headings        "mime-mhs-headings"
+#define NID_mime_mhs_headings       505
+#define OBJ_mime_mhs_headings       OBJ_mime_mhs,1L
+
+#define SN_mime_mhs_bodies      "mime-mhs-bodies"
+#define LN_mime_mhs_bodies      "mime-mhs-bodies"
+#define NID_mime_mhs_bodies     506
+#define OBJ_mime_mhs_bodies     OBJ_mime_mhs,2L
+
+#define SN_id_hex_partial_message       "id-hex-partial-message"
+#define LN_id_hex_partial_message       "id-hex-partial-message"
+#define NID_id_hex_partial_message      507
+#define OBJ_id_hex_partial_message      OBJ_mime_mhs_headings,1L
+
+#define SN_id_hex_multipart_message     "id-hex-multipart-message"
+#define LN_id_hex_multipart_message     "id-hex-multipart-message"
+#define NID_id_hex_multipart_message        508
+#define OBJ_id_hex_multipart_message        OBJ_mime_mhs_headings,2L
+
+#define SN_rle_compression      "RLE"
+#define LN_rle_compression      "run length compression"
+#define NID_rle_compression     124
+#define OBJ_rle_compression     1L,1L,1L,1L,666L,1L
+
+#define SN_zlib_compression     "ZLIB"
+#define LN_zlib_compression     "zlib compression"
+#define NID_zlib_compression        125
+#define OBJ_zlib_compression        1L,1L,1L,1L,666L,2L
+
+#define OBJ_csor        2L,16L,840L,1L,101L,3L
+
+#define OBJ_nistAlgorithms      OBJ_csor,4L
+
+#define OBJ_aes     OBJ_nistAlgorithms,1L
+
+#define SN_aes_128_ecb      "AES-128-ECB"
+#define LN_aes_128_ecb      "aes-128-ecb"
+#define NID_aes_128_ecb     418
+#define OBJ_aes_128_ecb     OBJ_aes,1L
+
+#define SN_aes_128_cbc      "AES-128-CBC"
+#define LN_aes_128_cbc      "aes-128-cbc"
+#define NID_aes_128_cbc     419
+#define OBJ_aes_128_cbc     OBJ_aes,2L
+
+#define SN_aes_128_ofb128       "AES-128-OFB"
+#define LN_aes_128_ofb128       "aes-128-ofb"
+#define NID_aes_128_ofb128      420
+#define OBJ_aes_128_ofb128      OBJ_aes,3L
+
+#define SN_aes_128_cfb128       "AES-128-CFB"
+#define LN_aes_128_cfb128       "aes-128-cfb"
+#define NID_aes_128_cfb128      421
+#define OBJ_aes_128_cfb128      OBJ_aes,4L
+
+#define SN_aes_192_ecb      "AES-192-ECB"
+#define LN_aes_192_ecb      "aes-192-ecb"
+#define NID_aes_192_ecb     422
+#define OBJ_aes_192_ecb     OBJ_aes,21L
+
+#define SN_aes_192_cbc      "AES-192-CBC"
+#define LN_aes_192_cbc      "aes-192-cbc"
+#define NID_aes_192_cbc     423
+#define OBJ_aes_192_cbc     OBJ_aes,22L
+
+#define SN_aes_192_ofb128       "AES-192-OFB"
+#define LN_aes_192_ofb128       "aes-192-ofb"
+#define NID_aes_192_ofb128      424
+#define OBJ_aes_192_ofb128      OBJ_aes,23L
+
+#define SN_aes_192_cfb128       "AES-192-CFB"
+#define LN_aes_192_cfb128       "aes-192-cfb"
+#define NID_aes_192_cfb128      425
+#define OBJ_aes_192_cfb128      OBJ_aes,24L
+
+#define SN_aes_256_ecb      "AES-256-ECB"
+#define LN_aes_256_ecb      "aes-256-ecb"
+#define NID_aes_256_ecb     426
+#define OBJ_aes_256_ecb     OBJ_aes,41L
+
+#define SN_aes_256_cbc      "AES-256-CBC"
+#define LN_aes_256_cbc      "aes-256-cbc"
+#define NID_aes_256_cbc     427
+#define OBJ_aes_256_cbc     OBJ_aes,42L
+
+#define SN_aes_256_ofb128       "AES-256-OFB"
+#define LN_aes_256_ofb128       "aes-256-ofb"
+#define NID_aes_256_ofb128      428
+#define OBJ_aes_256_ofb128      OBJ_aes,43L
+
+#define SN_aes_256_cfb128       "AES-256-CFB"
+#define LN_aes_256_cfb128       "aes-256-cfb"
+#define NID_aes_256_cfb128      429
+#define OBJ_aes_256_cfb128      OBJ_aes,44L
+
+#define SN_aes_128_cfb1     "AES-128-CFB1"
+#define LN_aes_128_cfb1     "aes-128-cfb1"
+#define NID_aes_128_cfb1        650
+
+#define SN_aes_192_cfb1     "AES-192-CFB1"
+#define LN_aes_192_cfb1     "aes-192-cfb1"
+#define NID_aes_192_cfb1        651
+
+#define SN_aes_256_cfb1     "AES-256-CFB1"
+#define LN_aes_256_cfb1     "aes-256-cfb1"
+#define NID_aes_256_cfb1        652
+
+#define SN_aes_128_cfb8     "AES-128-CFB8"
+#define LN_aes_128_cfb8     "aes-128-cfb8"
+#define NID_aes_128_cfb8        653
+
+#define SN_aes_192_cfb8     "AES-192-CFB8"
+#define LN_aes_192_cfb8     "aes-192-cfb8"
+#define NID_aes_192_cfb8        654
+
+#define SN_aes_256_cfb8     "AES-256-CFB8"
+#define LN_aes_256_cfb8     "aes-256-cfb8"
+#define NID_aes_256_cfb8        655
+
+#define SN_des_cfb1     "DES-CFB1"
+#define LN_des_cfb1     "des-cfb1"
+#define NID_des_cfb1        656
+
+#define SN_des_cfb8     "DES-CFB8"
+#define LN_des_cfb8     "des-cfb8"
+#define NID_des_cfb8        657
+
+#define SN_des_ede3_cfb1        "DES-EDE3-CFB1"
+#define LN_des_ede3_cfb1        "des-ede3-cfb1"
+#define NID_des_ede3_cfb1       658
+
+#define SN_des_ede3_cfb8        "DES-EDE3-CFB8"
+#define LN_des_ede3_cfb8        "des-ede3-cfb8"
+#define NID_des_ede3_cfb8       659
+
+#define OBJ_nist_hashalgs       OBJ_nistAlgorithms,2L
+
+#define SN_sha256       "SHA256"
+#define LN_sha256       "sha256"
+#define NID_sha256      672
+#define OBJ_sha256      OBJ_nist_hashalgs,1L
+
+#define SN_sha384       "SHA384"
+#define LN_sha384       "sha384"
+#define NID_sha384      673
+#define OBJ_sha384      OBJ_nist_hashalgs,2L
+
+#define SN_sha512       "SHA512"
+#define LN_sha512       "sha512"
+#define NID_sha512      674
+#define OBJ_sha512      OBJ_nist_hashalgs,3L
+
+#define SN_sha224       "SHA224"
+#define LN_sha224       "sha224"
+#define NID_sha224      675
+#define OBJ_sha224      OBJ_nist_hashalgs,4L
+
+#define SN_hold_instruction_code        "holdInstructionCode"
+#define LN_hold_instruction_code        "Hold Instruction Code"
+#define NID_hold_instruction_code       430
+#define OBJ_hold_instruction_code       OBJ_id_ce,23L
+
+#define OBJ_holdInstruction     OBJ_X9_57,2L
+
+#define SN_hold_instruction_none        "holdInstructionNone"
+#define LN_hold_instruction_none        "Hold Instruction None"
+#define NID_hold_instruction_none       431
+#define OBJ_hold_instruction_none       OBJ_holdInstruction,1L
+
+#define SN_hold_instruction_call_issuer     "holdInstructionCallIssuer"
+#define LN_hold_instruction_call_issuer     "Hold Instruction Call Issuer"
+#define NID_hold_instruction_call_issuer        432
+#define OBJ_hold_instruction_call_issuer        OBJ_holdInstruction,2L
+
+#define SN_hold_instruction_reject      "holdInstructionReject"
+#define LN_hold_instruction_reject      "Hold Instruction Reject"
+#define NID_hold_instruction_reject     433
+#define OBJ_hold_instruction_reject     OBJ_holdInstruction,3L
+
+#define SN_data     "data"
+#define NID_data        434
+#define OBJ_data        OBJ_itu_t,9L
+
+#define SN_pss      "pss"
+#define NID_pss     435
+#define OBJ_pss     OBJ_data,2342L
+
+#define SN_ucl      "ucl"
+#define NID_ucl     436
+#define OBJ_ucl     OBJ_pss,19200300L
+
+#define SN_pilot        "pilot"
+#define NID_pilot       437
+#define OBJ_pilot       OBJ_ucl,100L
+
+#define LN_pilotAttributeType       "pilotAttributeType"
+#define NID_pilotAttributeType      438
+#define OBJ_pilotAttributeType      OBJ_pilot,1L
+
+#define LN_pilotAttributeSyntax     "pilotAttributeSyntax"
+#define NID_pilotAttributeSyntax        439
+#define OBJ_pilotAttributeSyntax        OBJ_pilot,3L
+
+#define LN_pilotObjectClass     "pilotObjectClass"
+#define NID_pilotObjectClass        440
+#define OBJ_pilotObjectClass        OBJ_pilot,4L
+
+#define LN_pilotGroups      "pilotGroups"
+#define NID_pilotGroups     441
+#define OBJ_pilotGroups     OBJ_pilot,10L
+
+#define LN_iA5StringSyntax      "iA5StringSyntax"
+#define NID_iA5StringSyntax     442
+#define OBJ_iA5StringSyntax     OBJ_pilotAttributeSyntax,4L
+
+#define LN_caseIgnoreIA5StringSyntax        "caseIgnoreIA5StringSyntax"
+#define NID_caseIgnoreIA5StringSyntax       443
+#define OBJ_caseIgnoreIA5StringSyntax       OBJ_pilotAttributeSyntax,5L
+
+#define LN_pilotObject      "pilotObject"
+#define NID_pilotObject     444
+#define OBJ_pilotObject     OBJ_pilotObjectClass,3L
+
+#define LN_pilotPerson      "pilotPerson"
+#define NID_pilotPerson     445
+#define OBJ_pilotPerson     OBJ_pilotObjectClass,4L
+
+#define SN_account      "account"
+#define NID_account     446
+#define OBJ_account     OBJ_pilotObjectClass,5L
+
+#define SN_document     "document"
+#define NID_document        447
+#define OBJ_document        OBJ_pilotObjectClass,6L
+
+#define SN_room     "room"
+#define NID_room        448
+#define OBJ_room        OBJ_pilotObjectClass,7L
+
+#define LN_documentSeries       "documentSeries"
+#define NID_documentSeries      449
+#define OBJ_documentSeries      OBJ_pilotObjectClass,9L
+
+#define SN_Domain       "domain"
+#define LN_Domain       "Domain"
+#define NID_Domain      392
+#define OBJ_Domain      OBJ_pilotObjectClass,13L
+
+#define LN_rFC822localPart      "rFC822localPart"
+#define NID_rFC822localPart     450
+#define OBJ_rFC822localPart     OBJ_pilotObjectClass,14L
+
+#define LN_dNSDomain        "dNSDomain"
+#define NID_dNSDomain       451
+#define OBJ_dNSDomain       OBJ_pilotObjectClass,15L
+
+#define LN_domainRelatedObject      "domainRelatedObject"
+#define NID_domainRelatedObject     452
+#define OBJ_domainRelatedObject     OBJ_pilotObjectClass,17L
+
+#define LN_friendlyCountry      "friendlyCountry"
+#define NID_friendlyCountry     453
+#define OBJ_friendlyCountry     OBJ_pilotObjectClass,18L
+
+#define LN_simpleSecurityObject     "simpleSecurityObject"
+#define NID_simpleSecurityObject        454
+#define OBJ_simpleSecurityObject        OBJ_pilotObjectClass,19L
+
+#define LN_pilotOrganization        "pilotOrganization"
+#define NID_pilotOrganization       455
+#define OBJ_pilotOrganization       OBJ_pilotObjectClass,20L
+
+#define LN_pilotDSA     "pilotDSA"
+#define NID_pilotDSA        456
+#define OBJ_pilotDSA        OBJ_pilotObjectClass,21L
+
+#define LN_qualityLabelledData      "qualityLabelledData"
+#define NID_qualityLabelledData     457
+#define OBJ_qualityLabelledData     OBJ_pilotObjectClass,22L
+
+#define SN_userId       "UID"
+#define LN_userId       "userId"
+#define NID_userId      458
+#define OBJ_userId      OBJ_pilotAttributeType,1L
+
+#define LN_textEncodedORAddress     "textEncodedORAddress"
+#define NID_textEncodedORAddress        459
+#define OBJ_textEncodedORAddress        OBJ_pilotAttributeType,2L
+
+#define SN_rfc822Mailbox        "mail"
+#define LN_rfc822Mailbox        "rfc822Mailbox"
+#define NID_rfc822Mailbox       460
+#define OBJ_rfc822Mailbox       OBJ_pilotAttributeType,3L
+
+#define SN_info     "info"
+#define NID_info        461
+#define OBJ_info        OBJ_pilotAttributeType,4L
+
+#define LN_favouriteDrink       "favouriteDrink"
+#define NID_favouriteDrink      462
+#define OBJ_favouriteDrink      OBJ_pilotAttributeType,5L
+
+#define LN_roomNumber       "roomNumber"
+#define NID_roomNumber      463
+#define OBJ_roomNumber      OBJ_pilotAttributeType,6L
+
+#define SN_photo        "photo"
+#define NID_photo       464
+#define OBJ_photo       OBJ_pilotAttributeType,7L
+
+#define LN_userClass        "userClass"
+#define NID_userClass       465
+#define OBJ_userClass       OBJ_pilotAttributeType,8L
+
+#define SN_host     "host"
+#define NID_host        466
+#define OBJ_host        OBJ_pilotAttributeType,9L
+
+#define SN_manager      "manager"
+#define NID_manager     467
+#define OBJ_manager     OBJ_pilotAttributeType,10L
+
+#define LN_documentIdentifier       "documentIdentifier"
+#define NID_documentIdentifier      468
+#define OBJ_documentIdentifier      OBJ_pilotAttributeType,11L
+
+#define LN_documentTitle        "documentTitle"
+#define NID_documentTitle       469
+#define OBJ_documentTitle       OBJ_pilotAttributeType,12L
+
+#define LN_documentVersion      "documentVersion"
+#define NID_documentVersion     470
+#define OBJ_documentVersion     OBJ_pilotAttributeType,13L
+
+#define LN_documentAuthor       "documentAuthor"
+#define NID_documentAuthor      471
+#define OBJ_documentAuthor      OBJ_pilotAttributeType,14L
+
+#define LN_documentLocation     "documentLocation"
+#define NID_documentLocation        472
+#define OBJ_documentLocation        OBJ_pilotAttributeType,15L
+
+#define LN_homeTelephoneNumber      "homeTelephoneNumber"
+#define NID_homeTelephoneNumber     473
+#define OBJ_homeTelephoneNumber     OBJ_pilotAttributeType,20L
+
+#define SN_secretary        "secretary"
+#define NID_secretary       474
+#define OBJ_secretary       OBJ_pilotAttributeType,21L
+
+#define LN_otherMailbox     "otherMailbox"
+#define NID_otherMailbox        475
+#define OBJ_otherMailbox        OBJ_pilotAttributeType,22L
+
+#define LN_lastModifiedTime     "lastModifiedTime"
+#define NID_lastModifiedTime        476
+#define OBJ_lastModifiedTime        OBJ_pilotAttributeType,23L
+
+#define LN_lastModifiedBy       "lastModifiedBy"
+#define NID_lastModifiedBy      477
+#define OBJ_lastModifiedBy      OBJ_pilotAttributeType,24L
+
+#define SN_domainComponent      "DC"
+#define LN_domainComponent      "domainComponent"
+#define NID_domainComponent     391
+#define OBJ_domainComponent     OBJ_pilotAttributeType,25L
 
-#define LN_aRecord		"aRecord"
-#define NID_aRecord		478
-#define OBJ_aRecord		OBJ_pilotAttributeType,26L
-
-#define LN_pilotAttributeType27		"pilotAttributeType27"
-#define NID_pilotAttributeType27		479
-#define OBJ_pilotAttributeType27		OBJ_pilotAttributeType,27L
-
-#define LN_mXRecord		"mXRecord"
-#define NID_mXRecord		480
-#define OBJ_mXRecord		OBJ_pilotAttributeType,28L
-
-#define LN_nSRecord		"nSRecord"
-#define NID_nSRecord		481
-#define OBJ_nSRecord		OBJ_pilotAttributeType,29L
-
-#define LN_sOARecord		"sOARecord"
-#define NID_sOARecord		482
-#define OBJ_sOARecord		OBJ_pilotAttributeType,30L
-
-#define LN_cNAMERecord		"cNAMERecord"
-#define NID_cNAMERecord		483
-#define OBJ_cNAMERecord		OBJ_pilotAttributeType,31L
-
-#define LN_associatedDomain		"associatedDomain"
-#define NID_associatedDomain		484
-#define OBJ_associatedDomain		OBJ_pilotAttributeType,37L
-
-#define LN_associatedName		"associatedName"
-#define NID_associatedName		485
-#define OBJ_associatedName		OBJ_pilotAttributeType,38L
-
-#define LN_homePostalAddress		"homePostalAddress"
-#define NID_homePostalAddress		486
-#define OBJ_homePostalAddress		OBJ_pilotAttributeType,39L
-
-#define LN_personalTitle		"personalTitle"
-#define NID_personalTitle		487
-#define OBJ_personalTitle		OBJ_pilotAttributeType,40L
-
-#define LN_mobileTelephoneNumber		"mobileTelephoneNumber"
-#define NID_mobileTelephoneNumber		488
-#define OBJ_mobileTelephoneNumber		OBJ_pilotAttributeType,41L
-
-#define LN_pagerTelephoneNumber		"pagerTelephoneNumber"
-#define NID_pagerTelephoneNumber		489
-#define OBJ_pagerTelephoneNumber		OBJ_pilotAttributeType,42L
-
-#define LN_friendlyCountryName		"friendlyCountryName"
-#define NID_friendlyCountryName		490
-#define OBJ_friendlyCountryName		OBJ_pilotAttributeType,43L
-
-#define LN_organizationalStatus		"organizationalStatus"
-#define NID_organizationalStatus		491
-#define OBJ_organizationalStatus		OBJ_pilotAttributeType,45L
-
-#define LN_janetMailbox		"janetMailbox"
-#define NID_janetMailbox		492
-#define OBJ_janetMailbox		OBJ_pilotAttributeType,46L
-
-#define LN_mailPreferenceOption		"mailPreferenceOption"
-#define NID_mailPreferenceOption		493
-#define OBJ_mailPreferenceOption		OBJ_pilotAttributeType,47L
-
-#define LN_buildingName		"buildingName"
-#define NID_buildingName		494
-#define OBJ_buildingName		OBJ_pilotAttributeType,48L
-
-#define LN_dSAQuality		"dSAQuality"
-#define NID_dSAQuality		495
-#define OBJ_dSAQuality		OBJ_pilotAttributeType,49L
-
-#define LN_singleLevelQuality		"singleLevelQuality"
-#define NID_singleLevelQuality		496
-#define OBJ_singleLevelQuality		OBJ_pilotAttributeType,50L
-
-#define LN_subtreeMinimumQuality		"subtreeMinimumQuality"
-#define NID_subtreeMinimumQuality		497
-#define OBJ_subtreeMinimumQuality		OBJ_pilotAttributeType,51L
-
-#define LN_subtreeMaximumQuality		"subtreeMaximumQuality"
-#define NID_subtreeMaximumQuality		498
-#define OBJ_subtreeMaximumQuality		OBJ_pilotAttributeType,52L
-
-#define LN_personalSignature		"personalSignature"
-#define NID_personalSignature		499
-#define OBJ_personalSignature		OBJ_pilotAttributeType,53L
-
-#define LN_dITRedirect		"dITRedirect"
-#define NID_dITRedirect		500
-#define OBJ_dITRedirect		OBJ_pilotAttributeType,54L
-
-#define SN_audio		"audio"
-#define NID_audio		501
-#define OBJ_audio		OBJ_pilotAttributeType,55L
-
-#define LN_documentPublisher		"documentPublisher"
-#define NID_documentPublisher		502
-#define OBJ_documentPublisher		OBJ_pilotAttributeType,56L
+#define LN_aRecord      "aRecord"
+#define NID_aRecord     478
+#define OBJ_aRecord     OBJ_pilotAttributeType,26L
+
+#define LN_pilotAttributeType27     "pilotAttributeType27"
+#define NID_pilotAttributeType27        479
+#define OBJ_pilotAttributeType27        OBJ_pilotAttributeType,27L
+
+#define LN_mXRecord     "mXRecord"
+#define NID_mXRecord        480
+#define OBJ_mXRecord        OBJ_pilotAttributeType,28L
+
+#define LN_nSRecord     "nSRecord"
+#define NID_nSRecord        481
+#define OBJ_nSRecord        OBJ_pilotAttributeType,29L
+
+#define LN_sOARecord        "sOARecord"
+#define NID_sOARecord       482
+#define OBJ_sOARecord       OBJ_pilotAttributeType,30L
+
+#define LN_cNAMERecord      "cNAMERecord"
+#define NID_cNAMERecord     483
+#define OBJ_cNAMERecord     OBJ_pilotAttributeType,31L
+
+#define LN_associatedDomain     "associatedDomain"
+#define NID_associatedDomain        484
+#define OBJ_associatedDomain        OBJ_pilotAttributeType,37L
+
+#define LN_associatedName       "associatedName"
+#define NID_associatedName      485
+#define OBJ_associatedName      OBJ_pilotAttributeType,38L
+
+#define LN_homePostalAddress        "homePostalAddress"
+#define NID_homePostalAddress       486
+#define OBJ_homePostalAddress       OBJ_pilotAttributeType,39L
+
+#define LN_personalTitle        "personalTitle"
+#define NID_personalTitle       487
+#define OBJ_personalTitle       OBJ_pilotAttributeType,40L
+
+#define LN_mobileTelephoneNumber        "mobileTelephoneNumber"
+#define NID_mobileTelephoneNumber       488
+#define OBJ_mobileTelephoneNumber       OBJ_pilotAttributeType,41L
+
+#define LN_pagerTelephoneNumber     "pagerTelephoneNumber"
+#define NID_pagerTelephoneNumber        489
+#define OBJ_pagerTelephoneNumber        OBJ_pilotAttributeType,42L
+
+#define LN_friendlyCountryName      "friendlyCountryName"
+#define NID_friendlyCountryName     490
+#define OBJ_friendlyCountryName     OBJ_pilotAttributeType,43L
+
+#define LN_organizationalStatus     "organizationalStatus"
+#define NID_organizationalStatus        491
+#define OBJ_organizationalStatus        OBJ_pilotAttributeType,45L
+
+#define LN_janetMailbox     "janetMailbox"
+#define NID_janetMailbox        492
+#define OBJ_janetMailbox        OBJ_pilotAttributeType,46L
+
+#define LN_mailPreferenceOption     "mailPreferenceOption"
+#define NID_mailPreferenceOption        493
+#define OBJ_mailPreferenceOption        OBJ_pilotAttributeType,47L
+
+#define LN_buildingName     "buildingName"
+#define NID_buildingName        494
+#define OBJ_buildingName        OBJ_pilotAttributeType,48L
+
+#define LN_dSAQuality       "dSAQuality"
+#define NID_dSAQuality      495
+#define OBJ_dSAQuality      OBJ_pilotAttributeType,49L
+
+#define LN_singleLevelQuality       "singleLevelQuality"
+#define NID_singleLevelQuality      496
+#define OBJ_singleLevelQuality      OBJ_pilotAttributeType,50L
+
+#define LN_subtreeMinimumQuality        "subtreeMinimumQuality"
+#define NID_subtreeMinimumQuality       497
+#define OBJ_subtreeMinimumQuality       OBJ_pilotAttributeType,51L
+
+#define LN_subtreeMaximumQuality        "subtreeMaximumQuality"
+#define NID_subtreeMaximumQuality       498
+#define OBJ_subtreeMaximumQuality       OBJ_pilotAttributeType,52L
+
+#define LN_personalSignature        "personalSignature"
+#define NID_personalSignature       499
+#define OBJ_personalSignature       OBJ_pilotAttributeType,53L
+
+#define LN_dITRedirect      "dITRedirect"
+#define NID_dITRedirect     500
+#define OBJ_dITRedirect     OBJ_pilotAttributeType,54L
+
+#define SN_audio        "audio"
+#define NID_audio       501
+#define OBJ_audio       OBJ_pilotAttributeType,55L
+
+#define LN_documentPublisher        "documentPublisher"
+#define NID_documentPublisher       502
+#define OBJ_documentPublisher       OBJ_pilotAttributeType,56L
 
-#define SN_id_set		"id-set"
-#define LN_id_set		"Secure Electronic Transactions"
-#define NID_id_set		512
-#define OBJ_id_set		OBJ_international_organizations,42L
-
-#define SN_set_ctype		"set-ctype"
-#define LN_set_ctype		"content types"
-#define NID_set_ctype		513
-#define OBJ_set_ctype		OBJ_id_set,0L
-
-#define SN_set_msgExt		"set-msgExt"
-#define LN_set_msgExt		"message extensions"
-#define NID_set_msgExt		514
-#define OBJ_set_msgExt		OBJ_id_set,1L
-
-#define SN_set_attr		"set-attr"
-#define NID_set_attr		515
-#define OBJ_set_attr		OBJ_id_set,3L
-
-#define SN_set_policy		"set-policy"
-#define NID_set_policy		516
-#define OBJ_set_policy		OBJ_id_set,5L
-
-#define SN_set_certExt		"set-certExt"
-#define LN_set_certExt		"certificate extensions"
-#define NID_set_certExt		517
-#define OBJ_set_certExt		OBJ_id_set,7L
+#define SN_id_set       "id-set"
+#define LN_id_set       "Secure Electronic Transactions"
+#define NID_id_set      512
+#define OBJ_id_set      OBJ_international_organizations,42L
+
+#define SN_set_ctype        "set-ctype"
+#define LN_set_ctype        "content types"
+#define NID_set_ctype       513
+#define OBJ_set_ctype       OBJ_id_set,0L
+
+#define SN_set_msgExt       "set-msgExt"
+#define LN_set_msgExt       "message extensions"
+#define NID_set_msgExt      514
+#define OBJ_set_msgExt      OBJ_id_set,1L
+
+#define SN_set_attr     "set-attr"
+#define NID_set_attr        515
+#define OBJ_set_attr        OBJ_id_set,3L
+
+#define SN_set_policy       "set-policy"
+#define NID_set_policy      516
+#define OBJ_set_policy      OBJ_id_set,5L
+
+#define SN_set_certExt      "set-certExt"
+#define LN_set_certExt      "certificate extensions"
+#define NID_set_certExt     517
+#define OBJ_set_certExt     OBJ_id_set,7L
 
-#define SN_set_brand		"set-brand"
-#define NID_set_brand		518
-#define OBJ_set_brand		OBJ_id_set,8L
+#define SN_set_brand        "set-brand"
+#define NID_set_brand       518
+#define OBJ_set_brand       OBJ_id_set,8L
 
-#define SN_setct_PANData		"setct-PANData"
-#define NID_setct_PANData		519
-#define OBJ_setct_PANData		OBJ_set_ctype,0L
+#define SN_setct_PANData        "setct-PANData"
+#define NID_setct_PANData       519
+#define OBJ_setct_PANData       OBJ_set_ctype,0L
 
-#define SN_setct_PANToken		"setct-PANToken"
-#define NID_setct_PANToken		520
-#define OBJ_setct_PANToken		OBJ_set_ctype,1L
+#define SN_setct_PANToken       "setct-PANToken"
+#define NID_setct_PANToken      520
+#define OBJ_setct_PANToken      OBJ_set_ctype,1L
 
-#define SN_setct_PANOnly		"setct-PANOnly"
-#define NID_setct_PANOnly		521
-#define OBJ_setct_PANOnly		OBJ_set_ctype,2L
+#define SN_setct_PANOnly        "setct-PANOnly"
+#define NID_setct_PANOnly       521
+#define OBJ_setct_PANOnly       OBJ_set_ctype,2L
 
-#define SN_setct_OIData		"setct-OIData"
-#define NID_setct_OIData		522
-#define OBJ_setct_OIData		OBJ_set_ctype,3L
+#define SN_setct_OIData     "setct-OIData"
+#define NID_setct_OIData        522
+#define OBJ_setct_OIData        OBJ_set_ctype,3L
 
-#define SN_setct_PI		"setct-PI"
-#define NID_setct_PI		523
-#define OBJ_setct_PI		OBJ_set_ctype,4L
+#define SN_setct_PI     "setct-PI"
+#define NID_setct_PI        523
+#define OBJ_setct_PI        OBJ_set_ctype,4L
 
-#define SN_setct_PIData		"setct-PIData"
-#define NID_setct_PIData		524
-#define OBJ_setct_PIData		OBJ_set_ctype,5L
+#define SN_setct_PIData     "setct-PIData"
+#define NID_setct_PIData        524
+#define OBJ_setct_PIData        OBJ_set_ctype,5L
 
-#define SN_setct_PIDataUnsigned		"setct-PIDataUnsigned"
-#define NID_setct_PIDataUnsigned		525
-#define OBJ_setct_PIDataUnsigned		OBJ_set_ctype,6L
+#define SN_setct_PIDataUnsigned     "setct-PIDataUnsigned"
+#define NID_setct_PIDataUnsigned        525
+#define OBJ_setct_PIDataUnsigned        OBJ_set_ctype,6L
 
-#define SN_setct_HODInput		"setct-HODInput"
-#define NID_setct_HODInput		526
-#define OBJ_setct_HODInput		OBJ_set_ctype,7L
+#define SN_setct_HODInput       "setct-HODInput"
+#define NID_setct_HODInput      526
+#define OBJ_setct_HODInput      OBJ_set_ctype,7L
 
-#define SN_setct_AuthResBaggage		"setct-AuthResBaggage"
-#define NID_setct_AuthResBaggage		527
-#define OBJ_setct_AuthResBaggage		OBJ_set_ctype,8L
+#define SN_setct_AuthResBaggage     "setct-AuthResBaggage"
+#define NID_setct_AuthResBaggage        527
+#define OBJ_setct_AuthResBaggage        OBJ_set_ctype,8L
 
-#define SN_setct_AuthRevReqBaggage		"setct-AuthRevReqBaggage"
-#define NID_setct_AuthRevReqBaggage		528
-#define OBJ_setct_AuthRevReqBaggage		OBJ_set_ctype,9L
+#define SN_setct_AuthRevReqBaggage      "setct-AuthRevReqBaggage"
+#define NID_setct_AuthRevReqBaggage     528
+#define OBJ_setct_AuthRevReqBaggage     OBJ_set_ctype,9L
 
-#define SN_setct_AuthRevResBaggage		"setct-AuthRevResBaggage"
-#define NID_setct_AuthRevResBaggage		529
-#define OBJ_setct_AuthRevResBaggage		OBJ_set_ctype,10L
+#define SN_setct_AuthRevResBaggage      "setct-AuthRevResBaggage"
+#define NID_setct_AuthRevResBaggage     529
+#define OBJ_setct_AuthRevResBaggage     OBJ_set_ctype,10L
 
-#define SN_setct_CapTokenSeq		"setct-CapTokenSeq"
-#define NID_setct_CapTokenSeq		530
-#define OBJ_setct_CapTokenSeq		OBJ_set_ctype,11L
+#define SN_setct_CapTokenSeq        "setct-CapTokenSeq"
+#define NID_setct_CapTokenSeq       530
+#define OBJ_setct_CapTokenSeq       OBJ_set_ctype,11L
 
-#define SN_setct_PInitResData		"setct-PInitResData"
-#define NID_setct_PInitResData		531
-#define OBJ_setct_PInitResData		OBJ_set_ctype,12L
+#define SN_setct_PInitResData       "setct-PInitResData"
+#define NID_setct_PInitResData      531
+#define OBJ_setct_PInitResData      OBJ_set_ctype,12L
 
-#define SN_setct_PI_TBS		"setct-PI-TBS"
-#define NID_setct_PI_TBS		532
-#define OBJ_setct_PI_TBS		OBJ_set_ctype,13L
+#define SN_setct_PI_TBS     "setct-PI-TBS"
+#define NID_setct_PI_TBS        532
+#define OBJ_setct_PI_TBS        OBJ_set_ctype,13L
 
-#define SN_setct_PResData		"setct-PResData"
-#define NID_setct_PResData		533
-#define OBJ_setct_PResData		OBJ_set_ctype,14L
+#define SN_setct_PResData       "setct-PResData"
+#define NID_setct_PResData      533
+#define OBJ_setct_PResData      OBJ_set_ctype,14L
 
-#define SN_setct_AuthReqTBS		"setct-AuthReqTBS"
-#define NID_setct_AuthReqTBS		534
-#define OBJ_setct_AuthReqTBS		OBJ_set_ctype,16L
+#define SN_setct_AuthReqTBS     "setct-AuthReqTBS"
+#define NID_setct_AuthReqTBS        534
+#define OBJ_setct_AuthReqTBS        OBJ_set_ctype,16L
 
-#define SN_setct_AuthResTBS		"setct-AuthResTBS"
-#define NID_setct_AuthResTBS		535
-#define OBJ_setct_AuthResTBS		OBJ_set_ctype,17L
+#define SN_setct_AuthResTBS     "setct-AuthResTBS"
+#define NID_setct_AuthResTBS        535
+#define OBJ_setct_AuthResTBS        OBJ_set_ctype,17L
 
-#define SN_setct_AuthResTBSX		"setct-AuthResTBSX"
-#define NID_setct_AuthResTBSX		536
-#define OBJ_setct_AuthResTBSX		OBJ_set_ctype,18L
+#define SN_setct_AuthResTBSX        "setct-AuthResTBSX"
+#define NID_setct_AuthResTBSX       536
+#define OBJ_setct_AuthResTBSX       OBJ_set_ctype,18L
 
-#define SN_setct_AuthTokenTBS		"setct-AuthTokenTBS"
-#define NID_setct_AuthTokenTBS		537
-#define OBJ_setct_AuthTokenTBS		OBJ_set_ctype,19L
+#define SN_setct_AuthTokenTBS       "setct-AuthTokenTBS"
+#define NID_setct_AuthTokenTBS      537
+#define OBJ_setct_AuthTokenTBS      OBJ_set_ctype,19L
 
-#define SN_setct_CapTokenData		"setct-CapTokenData"
-#define NID_setct_CapTokenData		538
-#define OBJ_setct_CapTokenData		OBJ_set_ctype,20L
+#define SN_setct_CapTokenData       "setct-CapTokenData"
+#define NID_setct_CapTokenData      538
+#define OBJ_setct_CapTokenData      OBJ_set_ctype,20L
 
-#define SN_setct_CapTokenTBS		"setct-CapTokenTBS"
-#define NID_setct_CapTokenTBS		539
-#define OBJ_setct_CapTokenTBS		OBJ_set_ctype,21L
+#define SN_setct_CapTokenTBS        "setct-CapTokenTBS"
+#define NID_setct_CapTokenTBS       539
+#define OBJ_setct_CapTokenTBS       OBJ_set_ctype,21L
 
-#define SN_setct_AcqCardCodeMsg		"setct-AcqCardCodeMsg"
-#define NID_setct_AcqCardCodeMsg		540
-#define OBJ_setct_AcqCardCodeMsg		OBJ_set_ctype,22L
+#define SN_setct_AcqCardCodeMsg     "setct-AcqCardCodeMsg"
+#define NID_setct_AcqCardCodeMsg        540
+#define OBJ_setct_AcqCardCodeMsg        OBJ_set_ctype,22L
 
-#define SN_setct_AuthRevReqTBS		"setct-AuthRevReqTBS"
-#define NID_setct_AuthRevReqTBS		541
-#define OBJ_setct_AuthRevReqTBS		OBJ_set_ctype,23L
+#define SN_setct_AuthRevReqTBS      "setct-AuthRevReqTBS"
+#define NID_setct_AuthRevReqTBS     541
+#define OBJ_setct_AuthRevReqTBS     OBJ_set_ctype,23L
 
-#define SN_setct_AuthRevResData		"setct-AuthRevResData"
-#define NID_setct_AuthRevResData		542
-#define OBJ_setct_AuthRevResData		OBJ_set_ctype,24L
+#define SN_setct_AuthRevResData     "setct-AuthRevResData"
+#define NID_setct_AuthRevResData        542
+#define OBJ_setct_AuthRevResData        OBJ_set_ctype,24L
 
-#define SN_setct_AuthRevResTBS		"setct-AuthRevResTBS"
-#define NID_setct_AuthRevResTBS		543
-#define OBJ_setct_AuthRevResTBS		OBJ_set_ctype,25L
+#define SN_setct_AuthRevResTBS      "setct-AuthRevResTBS"
+#define NID_setct_AuthRevResTBS     543
+#define OBJ_setct_AuthRevResTBS     OBJ_set_ctype,25L
 
-#define SN_setct_CapReqTBS		"setct-CapReqTBS"
-#define NID_setct_CapReqTBS		544
-#define OBJ_setct_CapReqTBS		OBJ_set_ctype,26L
+#define SN_setct_CapReqTBS      "setct-CapReqTBS"
+#define NID_setct_CapReqTBS     544
+#define OBJ_setct_CapReqTBS     OBJ_set_ctype,26L
 
-#define SN_setct_CapReqTBSX		"setct-CapReqTBSX"
-#define NID_setct_CapReqTBSX		545
-#define OBJ_setct_CapReqTBSX		OBJ_set_ctype,27L
+#define SN_setct_CapReqTBSX     "setct-CapReqTBSX"
+#define NID_setct_CapReqTBSX        545
+#define OBJ_setct_CapReqTBSX        OBJ_set_ctype,27L
 
-#define SN_setct_CapResData		"setct-CapResData"
-#define NID_setct_CapResData		546
-#define OBJ_setct_CapResData		OBJ_set_ctype,28L
+#define SN_setct_CapResData     "setct-CapResData"
+#define NID_setct_CapResData        546
+#define OBJ_setct_CapResData        OBJ_set_ctype,28L
 
-#define SN_setct_CapRevReqTBS		"setct-CapRevReqTBS"
-#define NID_setct_CapRevReqTBS		547
-#define OBJ_setct_CapRevReqTBS		OBJ_set_ctype,29L
+#define SN_setct_CapRevReqTBS       "setct-CapRevReqTBS"
+#define NID_setct_CapRevReqTBS      547
+#define OBJ_setct_CapRevReqTBS      OBJ_set_ctype,29L
 
-#define SN_setct_CapRevReqTBSX		"setct-CapRevReqTBSX"
-#define NID_setct_CapRevReqTBSX		548
-#define OBJ_setct_CapRevReqTBSX		OBJ_set_ctype,30L
+#define SN_setct_CapRevReqTBSX      "setct-CapRevReqTBSX"
+#define NID_setct_CapRevReqTBSX     548
+#define OBJ_setct_CapRevReqTBSX     OBJ_set_ctype,30L
 
-#define SN_setct_CapRevResData		"setct-CapRevResData"
-#define NID_setct_CapRevResData		549
-#define OBJ_setct_CapRevResData		OBJ_set_ctype,31L
+#define SN_setct_CapRevResData      "setct-CapRevResData"
+#define NID_setct_CapRevResData     549
+#define OBJ_setct_CapRevResData     OBJ_set_ctype,31L
 
-#define SN_setct_CredReqTBS		"setct-CredReqTBS"
-#define NID_setct_CredReqTBS		550
-#define OBJ_setct_CredReqTBS		OBJ_set_ctype,32L
+#define SN_setct_CredReqTBS     "setct-CredReqTBS"
+#define NID_setct_CredReqTBS        550
+#define OBJ_setct_CredReqTBS        OBJ_set_ctype,32L
 
-#define SN_setct_CredReqTBSX		"setct-CredReqTBSX"
-#define NID_setct_CredReqTBSX		551
-#define OBJ_setct_CredReqTBSX		OBJ_set_ctype,33L
+#define SN_setct_CredReqTBSX        "setct-CredReqTBSX"
+#define NID_setct_CredReqTBSX       551
+#define OBJ_setct_CredReqTBSX       OBJ_set_ctype,33L
 
-#define SN_setct_CredResData		"setct-CredResData"
-#define NID_setct_CredResData		552
-#define OBJ_setct_CredResData		OBJ_set_ctype,34L
+#define SN_setct_CredResData        "setct-CredResData"
+#define NID_setct_CredResData       552
+#define OBJ_setct_CredResData       OBJ_set_ctype,34L
 
-#define SN_setct_CredRevReqTBS		"setct-CredRevReqTBS"
-#define NID_setct_CredRevReqTBS		553
-#define OBJ_setct_CredRevReqTBS		OBJ_set_ctype,35L
+#define SN_setct_CredRevReqTBS      "setct-CredRevReqTBS"
+#define NID_setct_CredRevReqTBS     553
+#define OBJ_setct_CredRevReqTBS     OBJ_set_ctype,35L
 
-#define SN_setct_CredRevReqTBSX		"setct-CredRevReqTBSX"
-#define NID_setct_CredRevReqTBSX		554
-#define OBJ_setct_CredRevReqTBSX		OBJ_set_ctype,36L
+#define SN_setct_CredRevReqTBSX     "setct-CredRevReqTBSX"
+#define NID_setct_CredRevReqTBSX        554
+#define OBJ_setct_CredRevReqTBSX        OBJ_set_ctype,36L
 
-#define SN_setct_CredRevResData		"setct-CredRevResData"
-#define NID_setct_CredRevResData		555
-#define OBJ_setct_CredRevResData		OBJ_set_ctype,37L
+#define SN_setct_CredRevResData     "setct-CredRevResData"
+#define NID_setct_CredRevResData        555
+#define OBJ_setct_CredRevResData        OBJ_set_ctype,37L
 
-#define SN_setct_PCertReqData		"setct-PCertReqData"
-#define NID_setct_PCertReqData		556
-#define OBJ_setct_PCertReqData		OBJ_set_ctype,38L
+#define SN_setct_PCertReqData       "setct-PCertReqData"
+#define NID_setct_PCertReqData      556
+#define OBJ_setct_PCertReqData      OBJ_set_ctype,38L
 
-#define SN_setct_PCertResTBS		"setct-PCertResTBS"
-#define NID_setct_PCertResTBS		557
-#define OBJ_setct_PCertResTBS		OBJ_set_ctype,39L
+#define SN_setct_PCertResTBS        "setct-PCertResTBS"
+#define NID_setct_PCertResTBS       557
+#define OBJ_setct_PCertResTBS       OBJ_set_ctype,39L
 
-#define SN_setct_BatchAdminReqData		"setct-BatchAdminReqData"
-#define NID_setct_BatchAdminReqData		558
-#define OBJ_setct_BatchAdminReqData		OBJ_set_ctype,40L
+#define SN_setct_BatchAdminReqData      "setct-BatchAdminReqData"
+#define NID_setct_BatchAdminReqData     558
+#define OBJ_setct_BatchAdminReqData     OBJ_set_ctype,40L
 
-#define SN_setct_BatchAdminResData		"setct-BatchAdminResData"
-#define NID_setct_BatchAdminResData		559
-#define OBJ_setct_BatchAdminResData		OBJ_set_ctype,41L
+#define SN_setct_BatchAdminResData      "setct-BatchAdminResData"
+#define NID_setct_BatchAdminResData     559
+#define OBJ_setct_BatchAdminResData     OBJ_set_ctype,41L
 
-#define SN_setct_CardCInitResTBS		"setct-CardCInitResTBS"
-#define NID_setct_CardCInitResTBS		560
-#define OBJ_setct_CardCInitResTBS		OBJ_set_ctype,42L
+#define SN_setct_CardCInitResTBS        "setct-CardCInitResTBS"
+#define NID_setct_CardCInitResTBS       560
+#define OBJ_setct_CardCInitResTBS       OBJ_set_ctype,42L
 
-#define SN_setct_MeAqCInitResTBS		"setct-MeAqCInitResTBS"
-#define NID_setct_MeAqCInitResTBS		561
-#define OBJ_setct_MeAqCInitResTBS		OBJ_set_ctype,43L
+#define SN_setct_MeAqCInitResTBS        "setct-MeAqCInitResTBS"
+#define NID_setct_MeAqCInitResTBS       561
+#define OBJ_setct_MeAqCInitResTBS       OBJ_set_ctype,43L
 
-#define SN_setct_RegFormResTBS		"setct-RegFormResTBS"
-#define NID_setct_RegFormResTBS		562
-#define OBJ_setct_RegFormResTBS		OBJ_set_ctype,44L
+#define SN_setct_RegFormResTBS      "setct-RegFormResTBS"
+#define NID_setct_RegFormResTBS     562
+#define OBJ_setct_RegFormResTBS     OBJ_set_ctype,44L
 
-#define SN_setct_CertReqData		"setct-CertReqData"
-#define NID_setct_CertReqData		563
-#define OBJ_setct_CertReqData		OBJ_set_ctype,45L
+#define SN_setct_CertReqData        "setct-CertReqData"
+#define NID_setct_CertReqData       563
+#define OBJ_setct_CertReqData       OBJ_set_ctype,45L
 
-#define SN_setct_CertReqTBS		"setct-CertReqTBS"
-#define NID_setct_CertReqTBS		564
-#define OBJ_setct_CertReqTBS		OBJ_set_ctype,46L
+#define SN_setct_CertReqTBS     "setct-CertReqTBS"
+#define NID_setct_CertReqTBS        564
+#define OBJ_setct_CertReqTBS        OBJ_set_ctype,46L
 
-#define SN_setct_CertResData		"setct-CertResData"
-#define NID_setct_CertResData		565
-#define OBJ_setct_CertResData		OBJ_set_ctype,47L
+#define SN_setct_CertResData        "setct-CertResData"
+#define NID_setct_CertResData       565
+#define OBJ_setct_CertResData       OBJ_set_ctype,47L
 
-#define SN_setct_CertInqReqTBS		"setct-CertInqReqTBS"
-#define NID_setct_CertInqReqTBS		566
-#define OBJ_setct_CertInqReqTBS		OBJ_set_ctype,48L
+#define SN_setct_CertInqReqTBS      "setct-CertInqReqTBS"
+#define NID_setct_CertInqReqTBS     566
+#define OBJ_setct_CertInqReqTBS     OBJ_set_ctype,48L
 
-#define SN_setct_ErrorTBS		"setct-ErrorTBS"
-#define NID_setct_ErrorTBS		567
-#define OBJ_setct_ErrorTBS		OBJ_set_ctype,49L
+#define SN_setct_ErrorTBS       "setct-ErrorTBS"
+#define NID_setct_ErrorTBS      567
+#define OBJ_setct_ErrorTBS      OBJ_set_ctype,49L
 
-#define SN_setct_PIDualSignedTBE		"setct-PIDualSignedTBE"
-#define NID_setct_PIDualSignedTBE		568
-#define OBJ_setct_PIDualSignedTBE		OBJ_set_ctype,50L
+#define SN_setct_PIDualSignedTBE        "setct-PIDualSignedTBE"
+#define NID_setct_PIDualSignedTBE       568
+#define OBJ_setct_PIDualSignedTBE       OBJ_set_ctype,50L
 
-#define SN_setct_PIUnsignedTBE		"setct-PIUnsignedTBE"
-#define NID_setct_PIUnsignedTBE		569
-#define OBJ_setct_PIUnsignedTBE		OBJ_set_ctype,51L
+#define SN_setct_PIUnsignedTBE      "setct-PIUnsignedTBE"
+#define NID_setct_PIUnsignedTBE     569
+#define OBJ_setct_PIUnsignedTBE     OBJ_set_ctype,51L
 
-#define SN_setct_AuthReqTBE		"setct-AuthReqTBE"
-#define NID_setct_AuthReqTBE		570
-#define OBJ_setct_AuthReqTBE		OBJ_set_ctype,52L
+#define SN_setct_AuthReqTBE     "setct-AuthReqTBE"
+#define NID_setct_AuthReqTBE        570
+#define OBJ_setct_AuthReqTBE        OBJ_set_ctype,52L
 
-#define SN_setct_AuthResTBE		"setct-AuthResTBE"
-#define NID_setct_AuthResTBE		571
-#define OBJ_setct_AuthResTBE		OBJ_set_ctype,53L
+#define SN_setct_AuthResTBE     "setct-AuthResTBE"
+#define NID_setct_AuthResTBE        571
+#define OBJ_setct_AuthResTBE        OBJ_set_ctype,53L
 
-#define SN_setct_AuthResTBEX		"setct-AuthResTBEX"
-#define NID_setct_AuthResTBEX		572
-#define OBJ_setct_AuthResTBEX		OBJ_set_ctype,54L
+#define SN_setct_AuthResTBEX        "setct-AuthResTBEX"
+#define NID_setct_AuthResTBEX       572
+#define OBJ_setct_AuthResTBEX       OBJ_set_ctype,54L
 
-#define SN_setct_AuthTokenTBE		"setct-AuthTokenTBE"
-#define NID_setct_AuthTokenTBE		573
-#define OBJ_setct_AuthTokenTBE		OBJ_set_ctype,55L
+#define SN_setct_AuthTokenTBE       "setct-AuthTokenTBE"
+#define NID_setct_AuthTokenTBE      573
+#define OBJ_setct_AuthTokenTBE      OBJ_set_ctype,55L
 
-#define SN_setct_CapTokenTBE		"setct-CapTokenTBE"
-#define NID_setct_CapTokenTBE		574
-#define OBJ_setct_CapTokenTBE		OBJ_set_ctype,56L
+#define SN_setct_CapTokenTBE        "setct-CapTokenTBE"
+#define NID_setct_CapTokenTBE       574
+#define OBJ_setct_CapTokenTBE       OBJ_set_ctype,56L
 
-#define SN_setct_CapTokenTBEX		"setct-CapTokenTBEX"
-#define NID_setct_CapTokenTBEX		575
-#define OBJ_setct_CapTokenTBEX		OBJ_set_ctype,57L
+#define SN_setct_CapTokenTBEX       "setct-CapTokenTBEX"
+#define NID_setct_CapTokenTBEX      575
+#define OBJ_setct_CapTokenTBEX      OBJ_set_ctype,57L
 
-#define SN_setct_AcqCardCodeMsgTBE		"setct-AcqCardCodeMsgTBE"
-#define NID_setct_AcqCardCodeMsgTBE		576
-#define OBJ_setct_AcqCardCodeMsgTBE		OBJ_set_ctype,58L
+#define SN_setct_AcqCardCodeMsgTBE      "setct-AcqCardCodeMsgTBE"
+#define NID_setct_AcqCardCodeMsgTBE     576
+#define OBJ_setct_AcqCardCodeMsgTBE     OBJ_set_ctype,58L
 
-#define SN_setct_AuthRevReqTBE		"setct-AuthRevReqTBE"
-#define NID_setct_AuthRevReqTBE		577
-#define OBJ_setct_AuthRevReqTBE		OBJ_set_ctype,59L
+#define SN_setct_AuthRevReqTBE      "setct-AuthRevReqTBE"
+#define NID_setct_AuthRevReqTBE     577
+#define OBJ_setct_AuthRevReqTBE     OBJ_set_ctype,59L
 
-#define SN_setct_AuthRevResTBE		"setct-AuthRevResTBE"
-#define NID_setct_AuthRevResTBE		578
-#define OBJ_setct_AuthRevResTBE		OBJ_set_ctype,60L
+#define SN_setct_AuthRevResTBE      "setct-AuthRevResTBE"
+#define NID_setct_AuthRevResTBE     578
+#define OBJ_setct_AuthRevResTBE     OBJ_set_ctype,60L
 
-#define SN_setct_AuthRevResTBEB		"setct-AuthRevResTBEB"
-#define NID_setct_AuthRevResTBEB		579
-#define OBJ_setct_AuthRevResTBEB		OBJ_set_ctype,61L
+#define SN_setct_AuthRevResTBEB     "setct-AuthRevResTBEB"
+#define NID_setct_AuthRevResTBEB        579
+#define OBJ_setct_AuthRevResTBEB        OBJ_set_ctype,61L
 
-#define SN_setct_CapReqTBE		"setct-CapReqTBE"
-#define NID_setct_CapReqTBE		580
-#define OBJ_setct_CapReqTBE		OBJ_set_ctype,62L
+#define SN_setct_CapReqTBE      "setct-CapReqTBE"
+#define NID_setct_CapReqTBE     580
+#define OBJ_setct_CapReqTBE     OBJ_set_ctype,62L
 
-#define SN_setct_CapReqTBEX		"setct-CapReqTBEX"
-#define NID_setct_CapReqTBEX		581
-#define OBJ_setct_CapReqTBEX		OBJ_set_ctype,63L
+#define SN_setct_CapReqTBEX     "setct-CapReqTBEX"
+#define NID_setct_CapReqTBEX        581
+#define OBJ_setct_CapReqTBEX        OBJ_set_ctype,63L
 
-#define SN_setct_CapResTBE		"setct-CapResTBE"
-#define NID_setct_CapResTBE		582
-#define OBJ_setct_CapResTBE		OBJ_set_ctype,64L
+#define SN_setct_CapResTBE      "setct-CapResTBE"
+#define NID_setct_CapResTBE     582
+#define OBJ_setct_CapResTBE     OBJ_set_ctype,64L
 
-#define SN_setct_CapRevReqTBE		"setct-CapRevReqTBE"
-#define NID_setct_CapRevReqTBE		583
-#define OBJ_setct_CapRevReqTBE		OBJ_set_ctype,65L
+#define SN_setct_CapRevReqTBE       "setct-CapRevReqTBE"
+#define NID_setct_CapRevReqTBE      583
+#define OBJ_setct_CapRevReqTBE      OBJ_set_ctype,65L
 
-#define SN_setct_CapRevReqTBEX		"setct-CapRevReqTBEX"
-#define NID_setct_CapRevReqTBEX		584
-#define OBJ_setct_CapRevReqTBEX		OBJ_set_ctype,66L
+#define SN_setct_CapRevReqTBEX      "setct-CapRevReqTBEX"
+#define NID_setct_CapRevReqTBEX     584
+#define OBJ_setct_CapRevReqTBEX     OBJ_set_ctype,66L
 
-#define SN_setct_CapRevResTBE		"setct-CapRevResTBE"
-#define NID_setct_CapRevResTBE		585
-#define OBJ_setct_CapRevResTBE		OBJ_set_ctype,67L
+#define SN_setct_CapRevResTBE       "setct-CapRevResTBE"
+#define NID_setct_CapRevResTBE      585
+#define OBJ_setct_CapRevResTBE      OBJ_set_ctype,67L
 
-#define SN_setct_CredReqTBE		"setct-CredReqTBE"
-#define NID_setct_CredReqTBE		586
-#define OBJ_setct_CredReqTBE		OBJ_set_ctype,68L
+#define SN_setct_CredReqTBE     "setct-CredReqTBE"
+#define NID_setct_CredReqTBE        586
+#define OBJ_setct_CredReqTBE        OBJ_set_ctype,68L
 
-#define SN_setct_CredReqTBEX		"setct-CredReqTBEX"
-#define NID_setct_CredReqTBEX		587
-#define OBJ_setct_CredReqTBEX		OBJ_set_ctype,69L
+#define SN_setct_CredReqTBEX        "setct-CredReqTBEX"
+#define NID_setct_CredReqTBEX       587
+#define OBJ_setct_CredReqTBEX       OBJ_set_ctype,69L
 
-#define SN_setct_CredResTBE		"setct-CredResTBE"
-#define NID_setct_CredResTBE		588
-#define OBJ_setct_CredResTBE		OBJ_set_ctype,70L
+#define SN_setct_CredResTBE     "setct-CredResTBE"
+#define NID_setct_CredResTBE        588
+#define OBJ_setct_CredResTBE        OBJ_set_ctype,70L
 
-#define SN_setct_CredRevReqTBE		"setct-CredRevReqTBE"
-#define NID_setct_CredRevReqTBE		589
-#define OBJ_setct_CredRevReqTBE		OBJ_set_ctype,71L
+#define SN_setct_CredRevReqTBE      "setct-CredRevReqTBE"
+#define NID_setct_CredRevReqTBE     589
+#define OBJ_setct_CredRevReqTBE     OBJ_set_ctype,71L
 
-#define SN_setct_CredRevReqTBEX		"setct-CredRevReqTBEX"
-#define NID_setct_CredRevReqTBEX		590
-#define OBJ_setct_CredRevReqTBEX		OBJ_set_ctype,72L
+#define SN_setct_CredRevReqTBEX     "setct-CredRevReqTBEX"
+#define NID_setct_CredRevReqTBEX        590
+#define OBJ_setct_CredRevReqTBEX        OBJ_set_ctype,72L
 
-#define SN_setct_CredRevResTBE		"setct-CredRevResTBE"
-#define NID_setct_CredRevResTBE		591
-#define OBJ_setct_CredRevResTBE		OBJ_set_ctype,73L
+#define SN_setct_CredRevResTBE      "setct-CredRevResTBE"
+#define NID_setct_CredRevResTBE     591
+#define OBJ_setct_CredRevResTBE     OBJ_set_ctype,73L
 
-#define SN_setct_BatchAdminReqTBE		"setct-BatchAdminReqTBE"
-#define NID_setct_BatchAdminReqTBE		592
-#define OBJ_setct_BatchAdminReqTBE		OBJ_set_ctype,74L
+#define SN_setct_BatchAdminReqTBE       "setct-BatchAdminReqTBE"
+#define NID_setct_BatchAdminReqTBE      592
+#define OBJ_setct_BatchAdminReqTBE      OBJ_set_ctype,74L
 
-#define SN_setct_BatchAdminResTBE		"setct-BatchAdminResTBE"
-#define NID_setct_BatchAdminResTBE		593
-#define OBJ_setct_BatchAdminResTBE		OBJ_set_ctype,75L
+#define SN_setct_BatchAdminResTBE       "setct-BatchAdminResTBE"
+#define NID_setct_BatchAdminResTBE      593
+#define OBJ_setct_BatchAdminResTBE      OBJ_set_ctype,75L
 
-#define SN_setct_RegFormReqTBE		"setct-RegFormReqTBE"
-#define NID_setct_RegFormReqTBE		594
-#define OBJ_setct_RegFormReqTBE		OBJ_set_ctype,76L
+#define SN_setct_RegFormReqTBE      "setct-RegFormReqTBE"
+#define NID_setct_RegFormReqTBE     594
+#define OBJ_setct_RegFormReqTBE     OBJ_set_ctype,76L
 
-#define SN_setct_CertReqTBE		"setct-CertReqTBE"
-#define NID_setct_CertReqTBE		595
-#define OBJ_setct_CertReqTBE		OBJ_set_ctype,77L
+#define SN_setct_CertReqTBE     "setct-CertReqTBE"
+#define NID_setct_CertReqTBE        595
+#define OBJ_setct_CertReqTBE        OBJ_set_ctype,77L
 
-#define SN_setct_CertReqTBEX		"setct-CertReqTBEX"
-#define NID_setct_CertReqTBEX		596
-#define OBJ_setct_CertReqTBEX		OBJ_set_ctype,78L
+#define SN_setct_CertReqTBEX        "setct-CertReqTBEX"
+#define NID_setct_CertReqTBEX       596
+#define OBJ_setct_CertReqTBEX       OBJ_set_ctype,78L
 
-#define SN_setct_CertResTBE		"setct-CertResTBE"
-#define NID_setct_CertResTBE		597
-#define OBJ_setct_CertResTBE		OBJ_set_ctype,79L
+#define SN_setct_CertResTBE     "setct-CertResTBE"
+#define NID_setct_CertResTBE        597
+#define OBJ_setct_CertResTBE        OBJ_set_ctype,79L
 
-#define SN_setct_CRLNotificationTBS		"setct-CRLNotificationTBS"
-#define NID_setct_CRLNotificationTBS		598
-#define OBJ_setct_CRLNotificationTBS		OBJ_set_ctype,80L
+#define SN_setct_CRLNotificationTBS     "setct-CRLNotificationTBS"
+#define NID_setct_CRLNotificationTBS        598
+#define OBJ_setct_CRLNotificationTBS        OBJ_set_ctype,80L
 
-#define SN_setct_CRLNotificationResTBS		"setct-CRLNotificationResTBS"
-#define NID_setct_CRLNotificationResTBS		599
-#define OBJ_setct_CRLNotificationResTBS		OBJ_set_ctype,81L
-
-#define SN_setct_BCIDistributionTBS		"setct-BCIDistributionTBS"
-#define NID_setct_BCIDistributionTBS		600
-#define OBJ_setct_BCIDistributionTBS		OBJ_set_ctype,82L
-
-#define SN_setext_genCrypt		"setext-genCrypt"
-#define LN_setext_genCrypt		"generic cryptogram"
-#define NID_setext_genCrypt		601
-#define OBJ_setext_genCrypt		OBJ_set_msgExt,1L
-
-#define SN_setext_miAuth		"setext-miAuth"
-#define LN_setext_miAuth		"merchant initiated auth"
-#define NID_setext_miAuth		602
-#define OBJ_setext_miAuth		OBJ_set_msgExt,3L
-
-#define SN_setext_pinSecure		"setext-pinSecure"
-#define NID_setext_pinSecure		603
-#define OBJ_setext_pinSecure		OBJ_set_msgExt,4L
-
-#define SN_setext_pinAny		"setext-pinAny"
-#define NID_setext_pinAny		604
-#define OBJ_setext_pinAny		OBJ_set_msgExt,5L
-
-#define SN_setext_track2		"setext-track2"
-#define NID_setext_track2		605
-#define OBJ_setext_track2		OBJ_set_msgExt,7L
-
-#define SN_setext_cv		"setext-cv"
-#define LN_setext_cv		"additional verification"
-#define NID_setext_cv		606
-#define OBJ_setext_cv		OBJ_set_msgExt,8L
-
-#define SN_set_policy_root		"set-policy-root"
-#define NID_set_policy_root		607
-#define OBJ_set_policy_root		OBJ_set_policy,0L
-
-#define SN_setCext_hashedRoot		"setCext-hashedRoot"
-#define NID_setCext_hashedRoot		608
-#define OBJ_setCext_hashedRoot		OBJ_set_certExt,0L
-
-#define SN_setCext_certType		"setCext-certType"
-#define NID_setCext_certType		609
-#define OBJ_setCext_certType		OBJ_set_certExt,1L
-
-#define SN_setCext_merchData		"setCext-merchData"
-#define NID_setCext_merchData		610
-#define OBJ_setCext_merchData		OBJ_set_certExt,2L
-
-#define SN_setCext_cCertRequired		"setCext-cCertRequired"
-#define NID_setCext_cCertRequired		611
-#define OBJ_setCext_cCertRequired		OBJ_set_certExt,3L
-
-#define SN_setCext_tunneling		"setCext-tunneling"
-#define NID_setCext_tunneling		612
-#define OBJ_setCext_tunneling		OBJ_set_certExt,4L
-
-#define SN_setCext_setExt		"setCext-setExt"
-#define NID_setCext_setExt		613
-#define OBJ_setCext_setExt		OBJ_set_certExt,5L
-
-#define SN_setCext_setQualf		"setCext-setQualf"
-#define NID_setCext_setQualf		614
-#define OBJ_setCext_setQualf		OBJ_set_certExt,6L
-
-#define SN_setCext_PGWYcapabilities		"setCext-PGWYcapabilities"
-#define NID_setCext_PGWYcapabilities		615
-#define OBJ_setCext_PGWYcapabilities		OBJ_set_certExt,7L
-
-#define SN_setCext_TokenIdentifier		"setCext-TokenIdentifier"
-#define NID_setCext_TokenIdentifier		616
-#define OBJ_setCext_TokenIdentifier		OBJ_set_certExt,8L
-
-#define SN_setCext_Track2Data		"setCext-Track2Data"
-#define NID_setCext_Track2Data		617
-#define OBJ_setCext_Track2Data		OBJ_set_certExt,9L
-
-#define SN_setCext_TokenType		"setCext-TokenType"
-#define NID_setCext_TokenType		618
-#define OBJ_setCext_TokenType		OBJ_set_certExt,10L
-
-#define SN_setCext_IssuerCapabilities		"setCext-IssuerCapabilities"
-#define NID_setCext_IssuerCapabilities		619
-#define OBJ_setCext_IssuerCapabilities		OBJ_set_certExt,11L
-
-#define SN_setAttr_Cert		"setAttr-Cert"
-#define NID_setAttr_Cert		620
-#define OBJ_setAttr_Cert		OBJ_set_attr,0L
-
-#define SN_setAttr_PGWYcap		"setAttr-PGWYcap"
-#define LN_setAttr_PGWYcap		"payment gateway capabilities"
-#define NID_setAttr_PGWYcap		621
-#define OBJ_setAttr_PGWYcap		OBJ_set_attr,1L
-
-#define SN_setAttr_TokenType		"setAttr-TokenType"
-#define NID_setAttr_TokenType		622
-#define OBJ_setAttr_TokenType		OBJ_set_attr,2L
-
-#define SN_setAttr_IssCap		"setAttr-IssCap"
-#define LN_setAttr_IssCap		"issuer capabilities"
-#define NID_setAttr_IssCap		623
-#define OBJ_setAttr_IssCap		OBJ_set_attr,3L
-
-#define SN_set_rootKeyThumb		"set-rootKeyThumb"
-#define NID_set_rootKeyThumb		624
-#define OBJ_set_rootKeyThumb		OBJ_setAttr_Cert,0L
-
-#define SN_set_addPolicy		"set-addPolicy"
-#define NID_set_addPolicy		625
-#define OBJ_set_addPolicy		OBJ_setAttr_Cert,1L
-
-#define SN_setAttr_Token_EMV		"setAttr-Token-EMV"
-#define NID_setAttr_Token_EMV		626
-#define OBJ_setAttr_Token_EMV		OBJ_setAttr_TokenType,1L
-
-#define SN_setAttr_Token_B0Prime		"setAttr-Token-B0Prime"
-#define NID_setAttr_Token_B0Prime		627
-#define OBJ_setAttr_Token_B0Prime		OBJ_setAttr_TokenType,2L
-
-#define SN_setAttr_IssCap_CVM		"setAttr-IssCap-CVM"
-#define NID_setAttr_IssCap_CVM		628
-#define OBJ_setAttr_IssCap_CVM		OBJ_setAttr_IssCap,3L
-
-#define SN_setAttr_IssCap_T2		"setAttr-IssCap-T2"
-#define NID_setAttr_IssCap_T2		629
-#define OBJ_setAttr_IssCap_T2		OBJ_setAttr_IssCap,4L
-
-#define SN_setAttr_IssCap_Sig		"setAttr-IssCap-Sig"
-#define NID_setAttr_IssCap_Sig		630
-#define OBJ_setAttr_IssCap_Sig		OBJ_setAttr_IssCap,5L
-
-#define SN_setAttr_GenCryptgrm		"setAttr-GenCryptgrm"
-#define LN_setAttr_GenCryptgrm		"generate cryptogram"
-#define NID_setAttr_GenCryptgrm		631
-#define OBJ_setAttr_GenCryptgrm		OBJ_setAttr_IssCap_CVM,1L
-
-#define SN_setAttr_T2Enc		"setAttr-T2Enc"
-#define LN_setAttr_T2Enc		"encrypted track 2"
-#define NID_setAttr_T2Enc		632
-#define OBJ_setAttr_T2Enc		OBJ_setAttr_IssCap_T2,1L
-
-#define SN_setAttr_T2cleartxt		"setAttr-T2cleartxt"
-#define LN_setAttr_T2cleartxt		"cleartext track 2"
-#define NID_setAttr_T2cleartxt		633
-#define OBJ_setAttr_T2cleartxt		OBJ_setAttr_IssCap_T2,2L
-
-#define SN_setAttr_TokICCsig		"setAttr-TokICCsig"
-#define LN_setAttr_TokICCsig		"ICC or token signature"
-#define NID_setAttr_TokICCsig		634
-#define OBJ_setAttr_TokICCsig		OBJ_setAttr_IssCap_Sig,1L
-
-#define SN_setAttr_SecDevSig		"setAttr-SecDevSig"
-#define LN_setAttr_SecDevSig		"secure device signature"
-#define NID_setAttr_SecDevSig		635
-#define OBJ_setAttr_SecDevSig		OBJ_setAttr_IssCap_Sig,2L
-
-#define SN_set_brand_IATA_ATA		"set-brand-IATA-ATA"
-#define NID_set_brand_IATA_ATA		636
-#define OBJ_set_brand_IATA_ATA		OBJ_set_brand,1L
-
-#define SN_set_brand_Diners		"set-brand-Diners"
-#define NID_set_brand_Diners		637
-#define OBJ_set_brand_Diners		OBJ_set_brand,30L
-
-#define SN_set_brand_AmericanExpress		"set-brand-AmericanExpress"
-#define NID_set_brand_AmericanExpress		638
-#define OBJ_set_brand_AmericanExpress		OBJ_set_brand,34L
-
-#define SN_set_brand_JCB		"set-brand-JCB"
-#define NID_set_brand_JCB		639
-#define OBJ_set_brand_JCB		OBJ_set_brand,35L
-
-#define SN_set_brand_Visa		"set-brand-Visa"
-#define NID_set_brand_Visa		640
-#define OBJ_set_brand_Visa		OBJ_set_brand,4L
-
-#define SN_set_brand_MasterCard		"set-brand-MasterCard"
-#define NID_set_brand_MasterCard		641
-#define OBJ_set_brand_MasterCard		OBJ_set_brand,5L
-
-#define SN_set_brand_Novus		"set-brand-Novus"
-#define NID_set_brand_Novus		642
-#define OBJ_set_brand_Novus		OBJ_set_brand,6011L
-
-#define SN_des_cdmf		"DES-CDMF"
-#define LN_des_cdmf		"des-cdmf"
-#define NID_des_cdmf		643
-#define OBJ_des_cdmf		OBJ_rsadsi,3L,10L
-
-#define SN_rsaOAEPEncryptionSET		"rsaOAEPEncryptionSET"
-#define NID_rsaOAEPEncryptionSET		644
-#define OBJ_rsaOAEPEncryptionSET		OBJ_rsadsi,1L,1L,6L
-
-#define SN_ipsec3		"Oakley-EC2N-3"
-#define LN_ipsec3		"ipsec3"
-#define NID_ipsec3		749
-
-#define SN_ipsec4		"Oakley-EC2N-4"
-#define LN_ipsec4		"ipsec4"
-#define NID_ipsec4		750
-
-#define SN_camellia_128_cbc		"CAMELLIA-128-CBC"
-#define LN_camellia_128_cbc		"camellia-128-cbc"
-#define NID_camellia_128_cbc		751
-#define OBJ_camellia_128_cbc		1L,2L,392L,200011L,61L,1L,1L,1L,2L
-
-#define SN_camellia_192_cbc		"CAMELLIA-192-CBC"
-#define LN_camellia_192_cbc		"camellia-192-cbc"
-#define NID_camellia_192_cbc		752
-#define OBJ_camellia_192_cbc		1L,2L,392L,200011L,61L,1L,1L,1L,3L
-
-#define SN_camellia_256_cbc		"CAMELLIA-256-CBC"
-#define LN_camellia_256_cbc		"camellia-256-cbc"
-#define NID_camellia_256_cbc		753
-#define OBJ_camellia_256_cbc		1L,2L,392L,200011L,61L,1L,1L,1L,4L
-
-#define OBJ_ntt_ds		0L,3L,4401L,5L
-
-#define OBJ_camellia		OBJ_ntt_ds,3L,1L,9L
-
-#define SN_camellia_128_ecb		"CAMELLIA-128-ECB"
-#define LN_camellia_128_ecb		"camellia-128-ecb"
-#define NID_camellia_128_ecb		754
-#define OBJ_camellia_128_ecb		OBJ_camellia,1L
-
-#define SN_camellia_128_ofb128		"CAMELLIA-128-OFB"
-#define LN_camellia_128_ofb128		"camellia-128-ofb"
-#define NID_camellia_128_ofb128		766
-#define OBJ_camellia_128_ofb128		OBJ_camellia,3L
-
-#define SN_camellia_128_cfb128		"CAMELLIA-128-CFB"
-#define LN_camellia_128_cfb128		"camellia-128-cfb"
-#define NID_camellia_128_cfb128		757
-#define OBJ_camellia_128_cfb128		OBJ_camellia,4L
-
-#define SN_camellia_192_ecb		"CAMELLIA-192-ECB"
-#define LN_camellia_192_ecb		"camellia-192-ecb"
-#define NID_camellia_192_ecb		755
-#define OBJ_camellia_192_ecb		OBJ_camellia,21L
-
-#define SN_camellia_192_ofb128		"CAMELLIA-192-OFB"
-#define LN_camellia_192_ofb128		"camellia-192-ofb"
-#define NID_camellia_192_ofb128		767
-#define OBJ_camellia_192_ofb128		OBJ_camellia,23L
-
-#define SN_camellia_192_cfb128		"CAMELLIA-192-CFB"
-#define LN_camellia_192_cfb128		"camellia-192-cfb"
-#define NID_camellia_192_cfb128		758
-#define OBJ_camellia_192_cfb128		OBJ_camellia,24L
-
-#define SN_camellia_256_ecb		"CAMELLIA-256-ECB"
-#define LN_camellia_256_ecb		"camellia-256-ecb"
-#define NID_camellia_256_ecb		756
-#define OBJ_camellia_256_ecb		OBJ_camellia,41L
-
-#define SN_camellia_256_ofb128		"CAMELLIA-256-OFB"
-#define LN_camellia_256_ofb128		"camellia-256-ofb"
-#define NID_camellia_256_ofb128		768
-#define OBJ_camellia_256_ofb128		OBJ_camellia,43L
-
-#define SN_camellia_256_cfb128		"CAMELLIA-256-CFB"
-#define LN_camellia_256_cfb128		"camellia-256-cfb"
-#define NID_camellia_256_cfb128		759
-#define OBJ_camellia_256_cfb128		OBJ_camellia,44L
-
-#define SN_camellia_128_cfb1		"CAMELLIA-128-CFB1"
-#define LN_camellia_128_cfb1		"camellia-128-cfb1"
-#define NID_camellia_128_cfb1		760
-
-#define SN_camellia_192_cfb1		"CAMELLIA-192-CFB1"
-#define LN_camellia_192_cfb1		"camellia-192-cfb1"
-#define NID_camellia_192_cfb1		761
-
-#define SN_camellia_256_cfb1		"CAMELLIA-256-CFB1"
-#define LN_camellia_256_cfb1		"camellia-256-cfb1"
-#define NID_camellia_256_cfb1		762
-
-#define SN_camellia_128_cfb8		"CAMELLIA-128-CFB8"
-#define LN_camellia_128_cfb8		"camellia-128-cfb8"
-#define NID_camellia_128_cfb8		763
-
-#define SN_camellia_192_cfb8		"CAMELLIA-192-CFB8"
-#define LN_camellia_192_cfb8		"camellia-192-cfb8"
-#define NID_camellia_192_cfb8		764
-
-#define SN_camellia_256_cfb8		"CAMELLIA-256-CFB8"
-#define LN_camellia_256_cfb8		"camellia-256-cfb8"
-#define NID_camellia_256_cfb8		765
+#define SN_setct_CRLNotificationResTBS      "setct-CRLNotificationResTBS"
+#define NID_setct_CRLNotificationResTBS     599
+#define OBJ_setct_CRLNotificationResTBS     OBJ_set_ctype,81L
+
+#define SN_setct_BCIDistributionTBS     "setct-BCIDistributionTBS"
+#define NID_setct_BCIDistributionTBS        600
+#define OBJ_setct_BCIDistributionTBS        OBJ_set_ctype,82L
+
+#define SN_setext_genCrypt      "setext-genCrypt"
+#define LN_setext_genCrypt      "generic cryptogram"
+#define NID_setext_genCrypt     601
+#define OBJ_setext_genCrypt     OBJ_set_msgExt,1L
+
+#define SN_setext_miAuth        "setext-miAuth"
+#define LN_setext_miAuth        "merchant initiated auth"
+#define NID_setext_miAuth       602
+#define OBJ_setext_miAuth       OBJ_set_msgExt,3L
+
+#define SN_setext_pinSecure     "setext-pinSecure"
+#define NID_setext_pinSecure        603
+#define OBJ_setext_pinSecure        OBJ_set_msgExt,4L
+
+#define SN_setext_pinAny        "setext-pinAny"
+#define NID_setext_pinAny       604
+#define OBJ_setext_pinAny       OBJ_set_msgExt,5L
+
+#define SN_setext_track2        "setext-track2"
+#define NID_setext_track2       605
+#define OBJ_setext_track2       OBJ_set_msgExt,7L
+
+#define SN_setext_cv        "setext-cv"
+#define LN_setext_cv        "additional verification"
+#define NID_setext_cv       606
+#define OBJ_setext_cv       OBJ_set_msgExt,8L
+
+#define SN_set_policy_root      "set-policy-root"
+#define NID_set_policy_root     607
+#define OBJ_set_policy_root     OBJ_set_policy,0L
+
+#define SN_setCext_hashedRoot       "setCext-hashedRoot"
+#define NID_setCext_hashedRoot      608
+#define OBJ_setCext_hashedRoot      OBJ_set_certExt,0L
+
+#define SN_setCext_certType     "setCext-certType"
+#define NID_setCext_certType        609
+#define OBJ_setCext_certType        OBJ_set_certExt,1L
+
+#define SN_setCext_merchData        "setCext-merchData"
+#define NID_setCext_merchData       610
+#define OBJ_setCext_merchData       OBJ_set_certExt,2L
+
+#define SN_setCext_cCertRequired        "setCext-cCertRequired"
+#define NID_setCext_cCertRequired       611
+#define OBJ_setCext_cCertRequired       OBJ_set_certExt,3L
+
+#define SN_setCext_tunneling        "setCext-tunneling"
+#define NID_setCext_tunneling       612
+#define OBJ_setCext_tunneling       OBJ_set_certExt,4L
+
+#define SN_setCext_setExt       "setCext-setExt"
+#define NID_setCext_setExt      613
+#define OBJ_setCext_setExt      OBJ_set_certExt,5L
+
+#define SN_setCext_setQualf     "setCext-setQualf"
+#define NID_setCext_setQualf        614
+#define OBJ_setCext_setQualf        OBJ_set_certExt,6L
+
+#define SN_setCext_PGWYcapabilities     "setCext-PGWYcapabilities"
+#define NID_setCext_PGWYcapabilities        615
+#define OBJ_setCext_PGWYcapabilities        OBJ_set_certExt,7L
+
+#define SN_setCext_TokenIdentifier      "setCext-TokenIdentifier"
+#define NID_setCext_TokenIdentifier     616
+#define OBJ_setCext_TokenIdentifier     OBJ_set_certExt,8L
+
+#define SN_setCext_Track2Data       "setCext-Track2Data"
+#define NID_setCext_Track2Data      617
+#define OBJ_setCext_Track2Data      OBJ_set_certExt,9L
+
+#define SN_setCext_TokenType        "setCext-TokenType"
+#define NID_setCext_TokenType       618
+#define OBJ_setCext_TokenType       OBJ_set_certExt,10L
+
+#define SN_setCext_IssuerCapabilities       "setCext-IssuerCapabilities"
+#define NID_setCext_IssuerCapabilities      619
+#define OBJ_setCext_IssuerCapabilities      OBJ_set_certExt,11L
+
+#define SN_setAttr_Cert     "setAttr-Cert"
+#define NID_setAttr_Cert        620
+#define OBJ_setAttr_Cert        OBJ_set_attr,0L
+
+#define SN_setAttr_PGWYcap      "setAttr-PGWYcap"
+#define LN_setAttr_PGWYcap      "payment gateway capabilities"
+#define NID_setAttr_PGWYcap     621
+#define OBJ_setAttr_PGWYcap     OBJ_set_attr,1L
+
+#define SN_setAttr_TokenType        "setAttr-TokenType"
+#define NID_setAttr_TokenType       622
+#define OBJ_setAttr_TokenType       OBJ_set_attr,2L
+
+#define SN_setAttr_IssCap       "setAttr-IssCap"
+#define LN_setAttr_IssCap       "issuer capabilities"
+#define NID_setAttr_IssCap      623
+#define OBJ_setAttr_IssCap      OBJ_set_attr,3L
+
+#define SN_set_rootKeyThumb     "set-rootKeyThumb"
+#define NID_set_rootKeyThumb        624
+#define OBJ_set_rootKeyThumb        OBJ_setAttr_Cert,0L
+
+#define SN_set_addPolicy        "set-addPolicy"
+#define NID_set_addPolicy       625
+#define OBJ_set_addPolicy       OBJ_setAttr_Cert,1L
+
+#define SN_setAttr_Token_EMV        "setAttr-Token-EMV"
+#define NID_setAttr_Token_EMV       626
+#define OBJ_setAttr_Token_EMV       OBJ_setAttr_TokenType,1L
+
+#define SN_setAttr_Token_B0Prime        "setAttr-Token-B0Prime"
+#define NID_setAttr_Token_B0Prime       627
+#define OBJ_setAttr_Token_B0Prime       OBJ_setAttr_TokenType,2L
+
+#define SN_setAttr_IssCap_CVM       "setAttr-IssCap-CVM"
+#define NID_setAttr_IssCap_CVM      628
+#define OBJ_setAttr_IssCap_CVM      OBJ_setAttr_IssCap,3L
+
+#define SN_setAttr_IssCap_T2        "setAttr-IssCap-T2"
+#define NID_setAttr_IssCap_T2       629
+#define OBJ_setAttr_IssCap_T2       OBJ_setAttr_IssCap,4L
+
+#define SN_setAttr_IssCap_Sig       "setAttr-IssCap-Sig"
+#define NID_setAttr_IssCap_Sig      630
+#define OBJ_setAttr_IssCap_Sig      OBJ_setAttr_IssCap,5L
+
+#define SN_setAttr_GenCryptgrm      "setAttr-GenCryptgrm"
+#define LN_setAttr_GenCryptgrm      "generate cryptogram"
+#define NID_setAttr_GenCryptgrm     631
+#define OBJ_setAttr_GenCryptgrm     OBJ_setAttr_IssCap_CVM,1L
+
+#define SN_setAttr_T2Enc        "setAttr-T2Enc"
+#define LN_setAttr_T2Enc        "encrypted track 2"
+#define NID_setAttr_T2Enc       632
+#define OBJ_setAttr_T2Enc       OBJ_setAttr_IssCap_T2,1L
+
+#define SN_setAttr_T2cleartxt       "setAttr-T2cleartxt"
+#define LN_setAttr_T2cleartxt       "cleartext track 2"
+#define NID_setAttr_T2cleartxt      633
+#define OBJ_setAttr_T2cleartxt      OBJ_setAttr_IssCap_T2,2L
+
+#define SN_setAttr_TokICCsig        "setAttr-TokICCsig"
+#define LN_setAttr_TokICCsig        "ICC or token signature"
+#define NID_setAttr_TokICCsig       634
+#define OBJ_setAttr_TokICCsig       OBJ_setAttr_IssCap_Sig,1L
+
+#define SN_setAttr_SecDevSig        "setAttr-SecDevSig"
+#define LN_setAttr_SecDevSig        "secure device signature"
+#define NID_setAttr_SecDevSig       635
+#define OBJ_setAttr_SecDevSig       OBJ_setAttr_IssCap_Sig,2L
+
+#define SN_set_brand_IATA_ATA       "set-brand-IATA-ATA"
+#define NID_set_brand_IATA_ATA      636
+#define OBJ_set_brand_IATA_ATA      OBJ_set_brand,1L
+
+#define SN_set_brand_Diners     "set-brand-Diners"
+#define NID_set_brand_Diners        637
+#define OBJ_set_brand_Diners        OBJ_set_brand,30L
+
+#define SN_set_brand_AmericanExpress        "set-brand-AmericanExpress"
+#define NID_set_brand_AmericanExpress       638
+#define OBJ_set_brand_AmericanExpress       OBJ_set_brand,34L
+
+#define SN_set_brand_JCB        "set-brand-JCB"
+#define NID_set_brand_JCB       639
+#define OBJ_set_brand_JCB       OBJ_set_brand,35L
+
+#define SN_set_brand_Visa       "set-brand-Visa"
+#define NID_set_brand_Visa      640
+#define OBJ_set_brand_Visa      OBJ_set_brand,4L
+
+#define SN_set_brand_MasterCard     "set-brand-MasterCard"
+#define NID_set_brand_MasterCard        641
+#define OBJ_set_brand_MasterCard        OBJ_set_brand,5L
+
+#define SN_set_brand_Novus      "set-brand-Novus"
+#define NID_set_brand_Novus     642
+#define OBJ_set_brand_Novus     OBJ_set_brand,6011L
+
+#define SN_des_cdmf     "DES-CDMF"
+#define LN_des_cdmf     "des-cdmf"
+#define NID_des_cdmf        643
+#define OBJ_des_cdmf        OBJ_rsadsi,3L,10L
+
+#define SN_rsaOAEPEncryptionSET     "rsaOAEPEncryptionSET"
+#define NID_rsaOAEPEncryptionSET        644
+#define OBJ_rsaOAEPEncryptionSET        OBJ_rsadsi,1L,1L,6L
+
+#define SN_ipsec3       "Oakley-EC2N-3"
+#define LN_ipsec3       "ipsec3"
+#define NID_ipsec3      749
+
+#define SN_ipsec4       "Oakley-EC2N-4"
+#define LN_ipsec4       "ipsec4"
+#define NID_ipsec4      750
+
+#define SN_camellia_128_cbc     "CAMELLIA-128-CBC"
+#define LN_camellia_128_cbc     "camellia-128-cbc"
+#define NID_camellia_128_cbc        751
+#define OBJ_camellia_128_cbc        1L,2L,392L,200011L,61L,1L,1L,1L,2L
+
+#define SN_camellia_192_cbc     "CAMELLIA-192-CBC"
+#define LN_camellia_192_cbc     "camellia-192-cbc"
+#define NID_camellia_192_cbc        752
+#define OBJ_camellia_192_cbc        1L,2L,392L,200011L,61L,1L,1L,1L,3L
+
+#define SN_camellia_256_cbc     "CAMELLIA-256-CBC"
+#define LN_camellia_256_cbc     "camellia-256-cbc"
+#define NID_camellia_256_cbc        753
+#define OBJ_camellia_256_cbc        1L,2L,392L,200011L,61L,1L,1L,1L,4L
+
+#define OBJ_ntt_ds      0L,3L,4401L,5L
+
+#define OBJ_camellia        OBJ_ntt_ds,3L,1L,9L
+
+#define SN_camellia_128_ecb     "CAMELLIA-128-ECB"
+#define LN_camellia_128_ecb     "camellia-128-ecb"
+#define NID_camellia_128_ecb        754
+#define OBJ_camellia_128_ecb        OBJ_camellia,1L
+
+#define SN_camellia_128_ofb128      "CAMELLIA-128-OFB"
+#define LN_camellia_128_ofb128      "camellia-128-ofb"
+#define NID_camellia_128_ofb128     766
+#define OBJ_camellia_128_ofb128     OBJ_camellia,3L
+
+#define SN_camellia_128_cfb128      "CAMELLIA-128-CFB"
+#define LN_camellia_128_cfb128      "camellia-128-cfb"
+#define NID_camellia_128_cfb128     757
+#define OBJ_camellia_128_cfb128     OBJ_camellia,4L
+
+#define SN_camellia_192_ecb     "CAMELLIA-192-ECB"
+#define LN_camellia_192_ecb     "camellia-192-ecb"
+#define NID_camellia_192_ecb        755
+#define OBJ_camellia_192_ecb        OBJ_camellia,21L
+
+#define SN_camellia_192_ofb128      "CAMELLIA-192-OFB"
+#define LN_camellia_192_ofb128      "camellia-192-ofb"
+#define NID_camellia_192_ofb128     767
+#define OBJ_camellia_192_ofb128     OBJ_camellia,23L
+
+#define SN_camellia_192_cfb128      "CAMELLIA-192-CFB"
+#define LN_camellia_192_cfb128      "camellia-192-cfb"
+#define NID_camellia_192_cfb128     758
+#define OBJ_camellia_192_cfb128     OBJ_camellia,24L
+
+#define SN_camellia_256_ecb     "CAMELLIA-256-ECB"
+#define LN_camellia_256_ecb     "camellia-256-ecb"
+#define NID_camellia_256_ecb        756
+#define OBJ_camellia_256_ecb        OBJ_camellia,41L
+
+#define SN_camellia_256_ofb128      "CAMELLIA-256-OFB"
+#define LN_camellia_256_ofb128      "camellia-256-ofb"
+#define NID_camellia_256_ofb128     768
+#define OBJ_camellia_256_ofb128     OBJ_camellia,43L
+
+#define SN_camellia_256_cfb128      "CAMELLIA-256-CFB"
+#define LN_camellia_256_cfb128      "camellia-256-cfb"
+#define NID_camellia_256_cfb128     759
+#define OBJ_camellia_256_cfb128     OBJ_camellia,44L
+
+#define SN_camellia_128_cfb1        "CAMELLIA-128-CFB1"
+#define LN_camellia_128_cfb1        "camellia-128-cfb1"
+#define NID_camellia_128_cfb1       760
+
+#define SN_camellia_192_cfb1        "CAMELLIA-192-CFB1"
+#define LN_camellia_192_cfb1        "camellia-192-cfb1"
+#define NID_camellia_192_cfb1       761
+
+#define SN_camellia_256_cfb1        "CAMELLIA-256-CFB1"
+#define LN_camellia_256_cfb1        "camellia-256-cfb1"
+#define NID_camellia_256_cfb1       762
+
+#define SN_camellia_128_cfb8        "CAMELLIA-128-CFB8"
+#define LN_camellia_128_cfb8        "camellia-128-cfb8"
+#define NID_camellia_128_cfb8       763
+
+#define SN_camellia_192_cfb8        "CAMELLIA-192-CFB8"
+#define LN_camellia_192_cfb8        "camellia-192-cfb8"
+#define NID_camellia_192_cfb8       764
+
+#define SN_camellia_256_cfb8        "CAMELLIA-256-CFB8"
+#define LN_camellia_256_cfb8        "camellia-256-cfb8"
+#define NID_camellia_256_cfb8       765
 
diff --git a/dep/include/openssl/objects.h b/dep/include/openssl/objects.h
index 7242f76fb0f..b7e127296b8 100644
--- a/dep/include/openssl/objects.h
+++ b/dep/include/openssl/objects.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -64,912 +64,912 @@
 #ifdef USE_OBJ_MAC
 #include 
 #else
-#define SN_undef			"UNDEF"
-#define LN_undef			"undefined"
-#define NID_undef			0
-#define OBJ_undef			0L
+#define SN_undef            "UNDEF"
+#define LN_undef            "undefined"
+#define NID_undef           0
+#define OBJ_undef           0L
 
-#define SN_Algorithm			"Algorithm"
-#define LN_algorithm			"algorithm"
-#define NID_algorithm			38
-#define OBJ_algorithm			1L,3L,14L,3L,2L
+#define SN_Algorithm            "Algorithm"
+#define LN_algorithm            "algorithm"
+#define NID_algorithm           38
+#define OBJ_algorithm           1L,3L,14L,3L,2L
 
-#define LN_rsadsi			"rsadsi"
-#define NID_rsadsi			1
-#define OBJ_rsadsi			1L,2L,840L,113549L
+#define LN_rsadsi           "rsadsi"
+#define NID_rsadsi          1
+#define OBJ_rsadsi          1L,2L,840L,113549L
 
-#define LN_pkcs				"pkcs"
-#define NID_pkcs			2
-#define OBJ_pkcs			OBJ_rsadsi,1L
+#define LN_pkcs             "pkcs"
+#define NID_pkcs            2
+#define OBJ_pkcs            OBJ_rsadsi,1L
 
-#define SN_md2				"MD2"
-#define LN_md2				"md2"
-#define NID_md2				3
-#define OBJ_md2				OBJ_rsadsi,2L,2L
+#define SN_md2              "MD2"
+#define LN_md2              "md2"
+#define NID_md2             3
+#define OBJ_md2             OBJ_rsadsi,2L,2L
 
-#define SN_md5				"MD5"
-#define LN_md5				"md5"
-#define NID_md5				4
-#define OBJ_md5				OBJ_rsadsi,2L,5L
+#define SN_md5              "MD5"
+#define LN_md5              "md5"
+#define NID_md5             4
+#define OBJ_md5             OBJ_rsadsi,2L,5L
 
-#define SN_rc4				"RC4"
-#define LN_rc4				"rc4"
-#define NID_rc4				5
-#define OBJ_rc4				OBJ_rsadsi,3L,4L
+#define SN_rc4              "RC4"
+#define LN_rc4              "rc4"
+#define NID_rc4             5
+#define OBJ_rc4             OBJ_rsadsi,3L,4L
 
-#define LN_rsaEncryption		"rsaEncryption"
-#define NID_rsaEncryption		6
-#define OBJ_rsaEncryption		OBJ_pkcs,1L,1L
+#define LN_rsaEncryption        "rsaEncryption"
+#define NID_rsaEncryption       6
+#define OBJ_rsaEncryption       OBJ_pkcs,1L,1L
 
-#define SN_md2WithRSAEncryption		"RSA-MD2"
-#define LN_md2WithRSAEncryption		"md2WithRSAEncryption"
-#define NID_md2WithRSAEncryption	7
-#define OBJ_md2WithRSAEncryption	OBJ_pkcs,1L,2L
+#define SN_md2WithRSAEncryption     "RSA-MD2"
+#define LN_md2WithRSAEncryption     "md2WithRSAEncryption"
+#define NID_md2WithRSAEncryption    7
+#define OBJ_md2WithRSAEncryption    OBJ_pkcs,1L,2L
 
-#define SN_md5WithRSAEncryption		"RSA-MD5"
-#define LN_md5WithRSAEncryption		"md5WithRSAEncryption"
-#define NID_md5WithRSAEncryption	8
-#define OBJ_md5WithRSAEncryption	OBJ_pkcs,1L,4L
+#define SN_md5WithRSAEncryption     "RSA-MD5"
+#define LN_md5WithRSAEncryption     "md5WithRSAEncryption"
+#define NID_md5WithRSAEncryption    8
+#define OBJ_md5WithRSAEncryption    OBJ_pkcs,1L,4L
 
-#define SN_pbeWithMD2AndDES_CBC		"PBE-MD2-DES"
-#define LN_pbeWithMD2AndDES_CBC		"pbeWithMD2AndDES-CBC"
-#define NID_pbeWithMD2AndDES_CBC	9
-#define OBJ_pbeWithMD2AndDES_CBC	OBJ_pkcs,5L,1L
+#define SN_pbeWithMD2AndDES_CBC     "PBE-MD2-DES"
+#define LN_pbeWithMD2AndDES_CBC     "pbeWithMD2AndDES-CBC"
+#define NID_pbeWithMD2AndDES_CBC    9
+#define OBJ_pbeWithMD2AndDES_CBC    OBJ_pkcs,5L,1L
 
-#define SN_pbeWithMD5AndDES_CBC		"PBE-MD5-DES"
-#define LN_pbeWithMD5AndDES_CBC		"pbeWithMD5AndDES-CBC"
-#define NID_pbeWithMD5AndDES_CBC	10
-#define OBJ_pbeWithMD5AndDES_CBC	OBJ_pkcs,5L,3L
+#define SN_pbeWithMD5AndDES_CBC     "PBE-MD5-DES"
+#define LN_pbeWithMD5AndDES_CBC     "pbeWithMD5AndDES-CBC"
+#define NID_pbeWithMD5AndDES_CBC    10
+#define OBJ_pbeWithMD5AndDES_CBC    OBJ_pkcs,5L,3L
 
-#define LN_X500				"X500"
-#define NID_X500			11
-#define OBJ_X500			2L,5L
+#define LN_X500             "X500"
+#define NID_X500            11
+#define OBJ_X500            2L,5L
 
-#define LN_X509				"X509"
-#define NID_X509			12
-#define OBJ_X509			OBJ_X500,4L
+#define LN_X509             "X509"
+#define NID_X509            12
+#define OBJ_X509            OBJ_X500,4L
 
-#define SN_commonName			"CN"
-#define LN_commonName			"commonName"
-#define NID_commonName			13
-#define OBJ_commonName			OBJ_X509,3L
+#define SN_commonName           "CN"
+#define LN_commonName           "commonName"
+#define NID_commonName          13
+#define OBJ_commonName          OBJ_X509,3L
 
-#define SN_countryName			"C"
-#define LN_countryName			"countryName"
-#define NID_countryName			14
-#define OBJ_countryName			OBJ_X509,6L
+#define SN_countryName          "C"
+#define LN_countryName          "countryName"
+#define NID_countryName         14
+#define OBJ_countryName         OBJ_X509,6L
 
-#define SN_localityName			"L"
-#define LN_localityName			"localityName"
-#define NID_localityName		15
-#define OBJ_localityName		OBJ_X509,7L
+#define SN_localityName         "L"
+#define LN_localityName         "localityName"
+#define NID_localityName        15
+#define OBJ_localityName        OBJ_X509,7L
 
 /* Postal Address? PA */
 
 /* should be "ST" (rfc1327) but MS uses 'S' */
-#define SN_stateOrProvinceName		"ST"
-#define LN_stateOrProvinceName		"stateOrProvinceName"
-#define NID_stateOrProvinceName		16
-#define OBJ_stateOrProvinceName		OBJ_X509,8L
+#define SN_stateOrProvinceName      "ST"
+#define LN_stateOrProvinceName      "stateOrProvinceName"
+#define NID_stateOrProvinceName     16
+#define OBJ_stateOrProvinceName     OBJ_X509,8L
 
-#define SN_organizationName		"O"
-#define LN_organizationName		"organizationName"
-#define NID_organizationName		17
-#define OBJ_organizationName		OBJ_X509,10L
+#define SN_organizationName     "O"
+#define LN_organizationName     "organizationName"
+#define NID_organizationName        17
+#define OBJ_organizationName        OBJ_X509,10L
 
-#define SN_organizationalUnitName	"OU"
-#define LN_organizationalUnitName	"organizationalUnitName"
-#define NID_organizationalUnitName	18
-#define OBJ_organizationalUnitName	OBJ_X509,11L
+#define SN_organizationalUnitName   "OU"
+#define LN_organizationalUnitName   "organizationalUnitName"
+#define NID_organizationalUnitName  18
+#define OBJ_organizationalUnitName  OBJ_X509,11L
 
-#define SN_rsa				"RSA"
-#define LN_rsa				"rsa"
-#define NID_rsa				19
-#define OBJ_rsa				OBJ_X500,8L,1L,1L
+#define SN_rsa              "RSA"
+#define LN_rsa              "rsa"
+#define NID_rsa             19
+#define OBJ_rsa             OBJ_X500,8L,1L,1L
 
-#define LN_pkcs7			"pkcs7"
-#define NID_pkcs7			20
-#define OBJ_pkcs7			OBJ_pkcs,7L
+#define LN_pkcs7            "pkcs7"
+#define NID_pkcs7           20
+#define OBJ_pkcs7           OBJ_pkcs,7L
 
-#define LN_pkcs7_data			"pkcs7-data"
-#define NID_pkcs7_data			21
-#define OBJ_pkcs7_data			OBJ_pkcs7,1L
+#define LN_pkcs7_data           "pkcs7-data"
+#define NID_pkcs7_data          21
+#define OBJ_pkcs7_data          OBJ_pkcs7,1L
 
-#define LN_pkcs7_signed			"pkcs7-signedData"
-#define NID_pkcs7_signed		22
-#define OBJ_pkcs7_signed		OBJ_pkcs7,2L
+#define LN_pkcs7_signed         "pkcs7-signedData"
+#define NID_pkcs7_signed        22
+#define OBJ_pkcs7_signed        OBJ_pkcs7,2L
 
-#define LN_pkcs7_enveloped		"pkcs7-envelopedData"
-#define NID_pkcs7_enveloped		23
-#define OBJ_pkcs7_enveloped		OBJ_pkcs7,3L
+#define LN_pkcs7_enveloped      "pkcs7-envelopedData"
+#define NID_pkcs7_enveloped     23
+#define OBJ_pkcs7_enveloped     OBJ_pkcs7,3L
 
-#define LN_pkcs7_signedAndEnveloped	"pkcs7-signedAndEnvelopedData"
-#define NID_pkcs7_signedAndEnveloped	24
-#define OBJ_pkcs7_signedAndEnveloped	OBJ_pkcs7,4L
+#define LN_pkcs7_signedAndEnveloped "pkcs7-signedAndEnvelopedData"
+#define NID_pkcs7_signedAndEnveloped    24
+#define OBJ_pkcs7_signedAndEnveloped    OBJ_pkcs7,4L
 
-#define LN_pkcs7_digest			"pkcs7-digestData"
-#define NID_pkcs7_digest		25
-#define OBJ_pkcs7_digest		OBJ_pkcs7,5L
+#define LN_pkcs7_digest         "pkcs7-digestData"
+#define NID_pkcs7_digest        25
+#define OBJ_pkcs7_digest        OBJ_pkcs7,5L
 
-#define LN_pkcs7_encrypted		"pkcs7-encryptedData"
-#define NID_pkcs7_encrypted		26
-#define OBJ_pkcs7_encrypted		OBJ_pkcs7,6L
+#define LN_pkcs7_encrypted      "pkcs7-encryptedData"
+#define NID_pkcs7_encrypted     26
+#define OBJ_pkcs7_encrypted     OBJ_pkcs7,6L
 
-#define LN_pkcs3			"pkcs3"
-#define NID_pkcs3			27
-#define OBJ_pkcs3			OBJ_pkcs,3L
+#define LN_pkcs3            "pkcs3"
+#define NID_pkcs3           27
+#define OBJ_pkcs3           OBJ_pkcs,3L
 
-#define LN_dhKeyAgreement		"dhKeyAgreement"
-#define NID_dhKeyAgreement		28
-#define OBJ_dhKeyAgreement		OBJ_pkcs3,1L
+#define LN_dhKeyAgreement       "dhKeyAgreement"
+#define NID_dhKeyAgreement      28
+#define OBJ_dhKeyAgreement      OBJ_pkcs3,1L
 
-#define SN_des_ecb			"DES-ECB"
-#define LN_des_ecb			"des-ecb"
-#define NID_des_ecb			29
-#define OBJ_des_ecb			OBJ_algorithm,6L
+#define SN_des_ecb          "DES-ECB"
+#define LN_des_ecb          "des-ecb"
+#define NID_des_ecb         29
+#define OBJ_des_ecb         OBJ_algorithm,6L
 
-#define SN_des_cfb64			"DES-CFB"
-#define LN_des_cfb64			"des-cfb"
-#define NID_des_cfb64			30
+#define SN_des_cfb64            "DES-CFB"
+#define LN_des_cfb64            "des-cfb"
+#define NID_des_cfb64           30
 /* IV + num */
-#define OBJ_des_cfb64			OBJ_algorithm,9L
+#define OBJ_des_cfb64           OBJ_algorithm,9L
 
-#define SN_des_cbc			"DES-CBC"
-#define LN_des_cbc			"des-cbc"
-#define NID_des_cbc			31
+#define SN_des_cbc          "DES-CBC"
+#define LN_des_cbc          "des-cbc"
+#define NID_des_cbc         31
 /* IV */
-#define OBJ_des_cbc			OBJ_algorithm,7L
+#define OBJ_des_cbc         OBJ_algorithm,7L
 
-#define SN_des_ede			"DES-EDE"
-#define LN_des_ede			"des-ede"
-#define NID_des_ede			32
+#define SN_des_ede          "DES-EDE"
+#define LN_des_ede          "des-ede"
+#define NID_des_ede         32
 /* ?? */
-#define OBJ_des_ede			OBJ_algorithm,17L
+#define OBJ_des_ede         OBJ_algorithm,17L
 
-#define SN_des_ede3			"DES-EDE3"
-#define LN_des_ede3			"des-ede3"
-#define NID_des_ede3			33
+#define SN_des_ede3         "DES-EDE3"
+#define LN_des_ede3         "des-ede3"
+#define NID_des_ede3            33
 
-#define SN_idea_cbc			"IDEA-CBC"
-#define LN_idea_cbc			"idea-cbc"
-#define NID_idea_cbc			34
-#define OBJ_idea_cbc			1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L
+#define SN_idea_cbc         "IDEA-CBC"
+#define LN_idea_cbc         "idea-cbc"
+#define NID_idea_cbc            34
+#define OBJ_idea_cbc            1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L
 
-#define SN_idea_cfb64			"IDEA-CFB"
-#define LN_idea_cfb64			"idea-cfb"
-#define NID_idea_cfb64			35
+#define SN_idea_cfb64           "IDEA-CFB"
+#define LN_idea_cfb64           "idea-cfb"
+#define NID_idea_cfb64          35
 
-#define SN_idea_ecb			"IDEA-ECB"
-#define LN_idea_ecb			"idea-ecb"
-#define NID_idea_ecb			36
+#define SN_idea_ecb         "IDEA-ECB"
+#define LN_idea_ecb         "idea-ecb"
+#define NID_idea_ecb            36
 
-#define SN_rc2_cbc			"RC2-CBC"
-#define LN_rc2_cbc			"rc2-cbc"
-#define NID_rc2_cbc			37
-#define OBJ_rc2_cbc			OBJ_rsadsi,3L,2L
+#define SN_rc2_cbc          "RC2-CBC"
+#define LN_rc2_cbc          "rc2-cbc"
+#define NID_rc2_cbc         37
+#define OBJ_rc2_cbc         OBJ_rsadsi,3L,2L
 
-#define SN_rc2_ecb			"RC2-ECB"
-#define LN_rc2_ecb			"rc2-ecb"
-#define NID_rc2_ecb			38
+#define SN_rc2_ecb          "RC2-ECB"
+#define LN_rc2_ecb          "rc2-ecb"
+#define NID_rc2_ecb         38
 
-#define SN_rc2_cfb64			"RC2-CFB"
-#define LN_rc2_cfb64			"rc2-cfb"
-#define NID_rc2_cfb64			39
+#define SN_rc2_cfb64            "RC2-CFB"
+#define LN_rc2_cfb64            "rc2-cfb"
+#define NID_rc2_cfb64           39
 
-#define SN_rc2_ofb64			"RC2-OFB"
-#define LN_rc2_ofb64			"rc2-ofb"
-#define NID_rc2_ofb64			40
+#define SN_rc2_ofb64            "RC2-OFB"
+#define LN_rc2_ofb64            "rc2-ofb"
+#define NID_rc2_ofb64           40
 
-#define SN_sha				"SHA"
-#define LN_sha				"sha"
-#define NID_sha				41
-#define OBJ_sha				OBJ_algorithm,18L
+#define SN_sha              "SHA"
+#define LN_sha              "sha"
+#define NID_sha             41
+#define OBJ_sha             OBJ_algorithm,18L
 
-#define SN_shaWithRSAEncryption		"RSA-SHA"
-#define LN_shaWithRSAEncryption		"shaWithRSAEncryption"
-#define NID_shaWithRSAEncryption	42
-#define OBJ_shaWithRSAEncryption	OBJ_algorithm,15L
+#define SN_shaWithRSAEncryption     "RSA-SHA"
+#define LN_shaWithRSAEncryption     "shaWithRSAEncryption"
+#define NID_shaWithRSAEncryption    42
+#define OBJ_shaWithRSAEncryption    OBJ_algorithm,15L
 
-#define SN_des_ede_cbc			"DES-EDE-CBC"
-#define LN_des_ede_cbc			"des-ede-cbc"
-#define NID_des_ede_cbc			43
+#define SN_des_ede_cbc          "DES-EDE-CBC"
+#define LN_des_ede_cbc          "des-ede-cbc"
+#define NID_des_ede_cbc         43
 
-#define SN_des_ede3_cbc			"DES-EDE3-CBC"
-#define LN_des_ede3_cbc			"des-ede3-cbc"
-#define NID_des_ede3_cbc		44
-#define OBJ_des_ede3_cbc		OBJ_rsadsi,3L,7L
+#define SN_des_ede3_cbc         "DES-EDE3-CBC"
+#define LN_des_ede3_cbc         "des-ede3-cbc"
+#define NID_des_ede3_cbc        44
+#define OBJ_des_ede3_cbc        OBJ_rsadsi,3L,7L
 
-#define SN_des_ofb64			"DES-OFB"
-#define LN_des_ofb64			"des-ofb"
-#define NID_des_ofb64			45
-#define OBJ_des_ofb64			OBJ_algorithm,8L
+#define SN_des_ofb64            "DES-OFB"
+#define LN_des_ofb64            "des-ofb"
+#define NID_des_ofb64           45
+#define OBJ_des_ofb64           OBJ_algorithm,8L
 
-#define SN_idea_ofb64			"IDEA-OFB"
-#define LN_idea_ofb64			"idea-ofb"
-#define NID_idea_ofb64			46
+#define SN_idea_ofb64           "IDEA-OFB"
+#define LN_idea_ofb64           "idea-ofb"
+#define NID_idea_ofb64          46
 
-#define LN_pkcs9			"pkcs9"
-#define NID_pkcs9			47
-#define OBJ_pkcs9			OBJ_pkcs,9L
+#define LN_pkcs9            "pkcs9"
+#define NID_pkcs9           47
+#define OBJ_pkcs9           OBJ_pkcs,9L
 
-#define SN_pkcs9_emailAddress		"Email"
-#define LN_pkcs9_emailAddress		"emailAddress"
-#define NID_pkcs9_emailAddress		48
-#define OBJ_pkcs9_emailAddress		OBJ_pkcs9,1L
+#define SN_pkcs9_emailAddress       "Email"
+#define LN_pkcs9_emailAddress       "emailAddress"
+#define NID_pkcs9_emailAddress      48
+#define OBJ_pkcs9_emailAddress      OBJ_pkcs9,1L
 
-#define LN_pkcs9_unstructuredName	"unstructuredName"
-#define NID_pkcs9_unstructuredName	49
-#define OBJ_pkcs9_unstructuredName	OBJ_pkcs9,2L
+#define LN_pkcs9_unstructuredName   "unstructuredName"
+#define NID_pkcs9_unstructuredName  49
+#define OBJ_pkcs9_unstructuredName  OBJ_pkcs9,2L
 
-#define LN_pkcs9_contentType		"contentType"
-#define NID_pkcs9_contentType		50
-#define OBJ_pkcs9_contentType		OBJ_pkcs9,3L
+#define LN_pkcs9_contentType        "contentType"
+#define NID_pkcs9_contentType       50
+#define OBJ_pkcs9_contentType       OBJ_pkcs9,3L
 
-#define LN_pkcs9_messageDigest		"messageDigest"
-#define NID_pkcs9_messageDigest		51
-#define OBJ_pkcs9_messageDigest		OBJ_pkcs9,4L
+#define LN_pkcs9_messageDigest      "messageDigest"
+#define NID_pkcs9_messageDigest     51
+#define OBJ_pkcs9_messageDigest     OBJ_pkcs9,4L
 
-#define LN_pkcs9_signingTime		"signingTime"
-#define NID_pkcs9_signingTime		52
-#define OBJ_pkcs9_signingTime		OBJ_pkcs9,5L
+#define LN_pkcs9_signingTime        "signingTime"
+#define NID_pkcs9_signingTime       52
+#define OBJ_pkcs9_signingTime       OBJ_pkcs9,5L
 
-#define LN_pkcs9_countersignature	"countersignature"
-#define NID_pkcs9_countersignature	53
-#define OBJ_pkcs9_countersignature	OBJ_pkcs9,6L
+#define LN_pkcs9_countersignature   "countersignature"
+#define NID_pkcs9_countersignature  53
+#define OBJ_pkcs9_countersignature  OBJ_pkcs9,6L
 
-#define LN_pkcs9_challengePassword	"challengePassword"
-#define NID_pkcs9_challengePassword	54
-#define OBJ_pkcs9_challengePassword	OBJ_pkcs9,7L
+#define LN_pkcs9_challengePassword  "challengePassword"
+#define NID_pkcs9_challengePassword 54
+#define OBJ_pkcs9_challengePassword OBJ_pkcs9,7L
 
-#define LN_pkcs9_unstructuredAddress	"unstructuredAddress"
-#define NID_pkcs9_unstructuredAddress	55
-#define OBJ_pkcs9_unstructuredAddress	OBJ_pkcs9,8L
+#define LN_pkcs9_unstructuredAddress    "unstructuredAddress"
+#define NID_pkcs9_unstructuredAddress   55
+#define OBJ_pkcs9_unstructuredAddress   OBJ_pkcs9,8L
 
-#define LN_pkcs9_extCertAttributes	"extendedCertificateAttributes"
-#define NID_pkcs9_extCertAttributes	56
-#define OBJ_pkcs9_extCertAttributes	OBJ_pkcs9,9L
+#define LN_pkcs9_extCertAttributes  "extendedCertificateAttributes"
+#define NID_pkcs9_extCertAttributes 56
+#define OBJ_pkcs9_extCertAttributes OBJ_pkcs9,9L
 
-#define SN_netscape			"Netscape"
-#define LN_netscape			"Netscape Communications Corp."
-#define NID_netscape			57
-#define OBJ_netscape			2L,16L,840L,1L,113730L
+#define SN_netscape         "Netscape"
+#define LN_netscape         "Netscape Communications Corp."
+#define NID_netscape            57
+#define OBJ_netscape            2L,16L,840L,1L,113730L
 
-#define SN_netscape_cert_extension	"nsCertExt"
-#define LN_netscape_cert_extension	"Netscape Certificate Extension"
-#define NID_netscape_cert_extension	58
-#define OBJ_netscape_cert_extension	OBJ_netscape,1L
+#define SN_netscape_cert_extension  "nsCertExt"
+#define LN_netscape_cert_extension  "Netscape Certificate Extension"
+#define NID_netscape_cert_extension 58
+#define OBJ_netscape_cert_extension OBJ_netscape,1L
 
-#define SN_netscape_data_type		"nsDataType"
-#define LN_netscape_data_type		"Netscape Data Type"
-#define NID_netscape_data_type		59
-#define OBJ_netscape_data_type		OBJ_netscape,2L
+#define SN_netscape_data_type       "nsDataType"
+#define LN_netscape_data_type       "Netscape Data Type"
+#define NID_netscape_data_type      59
+#define OBJ_netscape_data_type      OBJ_netscape,2L
 
-#define SN_des_ede_cfb64		"DES-EDE-CFB"
-#define LN_des_ede_cfb64		"des-ede-cfb"
-#define NID_des_ede_cfb64		60
+#define SN_des_ede_cfb64        "DES-EDE-CFB"
+#define LN_des_ede_cfb64        "des-ede-cfb"
+#define NID_des_ede_cfb64       60
 
-#define SN_des_ede3_cfb64		"DES-EDE3-CFB"
-#define LN_des_ede3_cfb64		"des-ede3-cfb"
-#define NID_des_ede3_cfb64		61
+#define SN_des_ede3_cfb64       "DES-EDE3-CFB"
+#define LN_des_ede3_cfb64       "des-ede3-cfb"
+#define NID_des_ede3_cfb64      61
 
-#define SN_des_ede_ofb64		"DES-EDE-OFB"
-#define LN_des_ede_ofb64		"des-ede-ofb"
-#define NID_des_ede_ofb64		62
+#define SN_des_ede_ofb64        "DES-EDE-OFB"
+#define LN_des_ede_ofb64        "des-ede-ofb"
+#define NID_des_ede_ofb64       62
 
-#define SN_des_ede3_ofb64		"DES-EDE3-OFB"
-#define LN_des_ede3_ofb64		"des-ede3-ofb"
-#define NID_des_ede3_ofb64		63
+#define SN_des_ede3_ofb64       "DES-EDE3-OFB"
+#define LN_des_ede3_ofb64       "des-ede3-ofb"
+#define NID_des_ede3_ofb64      63
 
 /* I'm not sure about the object ID */
-#define SN_sha1				"SHA1"
-#define LN_sha1				"sha1"
-#define NID_sha1			64
-#define OBJ_sha1			OBJ_algorithm,26L
+#define SN_sha1             "SHA1"
+#define LN_sha1             "sha1"
+#define NID_sha1            64
+#define OBJ_sha1            OBJ_algorithm,26L
 /* 28 Jun 1996 - eay */
-/* #define OBJ_sha1			1L,3L,14L,2L,26L,05L <- wrong */
+/* #define OBJ_sha1         1L,3L,14L,2L,26L,05L <- wrong */
 
-#define SN_sha1WithRSAEncryption	"RSA-SHA1"
-#define LN_sha1WithRSAEncryption	"sha1WithRSAEncryption"
-#define NID_sha1WithRSAEncryption	65
-#define OBJ_sha1WithRSAEncryption	OBJ_pkcs,1L,5L
+#define SN_sha1WithRSAEncryption    "RSA-SHA1"
+#define LN_sha1WithRSAEncryption    "sha1WithRSAEncryption"
+#define NID_sha1WithRSAEncryption   65
+#define OBJ_sha1WithRSAEncryption   OBJ_pkcs,1L,5L
 
-#define SN_dsaWithSHA			"DSA-SHA"
-#define LN_dsaWithSHA			"dsaWithSHA"
-#define NID_dsaWithSHA			66
-#define OBJ_dsaWithSHA			OBJ_algorithm,13L
+#define SN_dsaWithSHA           "DSA-SHA"
+#define LN_dsaWithSHA           "dsaWithSHA"
+#define NID_dsaWithSHA          66
+#define OBJ_dsaWithSHA          OBJ_algorithm,13L
 
-#define SN_dsa_2			"DSA-old"
-#define LN_dsa_2			"dsaEncryption-old"
-#define NID_dsa_2			67
-#define OBJ_dsa_2			OBJ_algorithm,12L
+#define SN_dsa_2            "DSA-old"
+#define LN_dsa_2            "dsaEncryption-old"
+#define NID_dsa_2           67
+#define OBJ_dsa_2           OBJ_algorithm,12L
 
 /* proposed by microsoft to RSA */
-#define SN_pbeWithSHA1AndRC2_CBC	"PBE-SHA1-RC2-64"
-#define LN_pbeWithSHA1AndRC2_CBC	"pbeWithSHA1AndRC2-CBC"
-#define NID_pbeWithSHA1AndRC2_CBC	68
-#define OBJ_pbeWithSHA1AndRC2_CBC	OBJ_pkcs,5L,11L 
+#define SN_pbeWithSHA1AndRC2_CBC    "PBE-SHA1-RC2-64"
+#define LN_pbeWithSHA1AndRC2_CBC    "pbeWithSHA1AndRC2-CBC"
+#define NID_pbeWithSHA1AndRC2_CBC   68
+#define OBJ_pbeWithSHA1AndRC2_CBC   OBJ_pkcs,5L,11L
 
 /* proposed by microsoft to RSA as pbeWithSHA1AndRC4: it is now
  * defined explicitly in PKCS#5 v2.0 as id-PBKDF2 which is something
  * completely different.
  */
-#define LN_id_pbkdf2			"PBKDF2"
-#define NID_id_pbkdf2			69
-#define OBJ_id_pbkdf2			OBJ_pkcs,5L,12L 
+#define LN_id_pbkdf2            "PBKDF2"
+#define NID_id_pbkdf2           69
+#define OBJ_id_pbkdf2           OBJ_pkcs,5L,12L
 
-#define SN_dsaWithSHA1_2		"DSA-SHA1-old"
-#define LN_dsaWithSHA1_2		"dsaWithSHA1-old"
-#define NID_dsaWithSHA1_2		70
+#define SN_dsaWithSHA1_2        "DSA-SHA1-old"
+#define LN_dsaWithSHA1_2        "dsaWithSHA1-old"
+#define NID_dsaWithSHA1_2       70
 /* Got this one from 'sdn706r20.pdf' which is actually an NSA document :-) */
-#define OBJ_dsaWithSHA1_2		OBJ_algorithm,27L
+#define OBJ_dsaWithSHA1_2       OBJ_algorithm,27L
 
-#define SN_netscape_cert_type		"nsCertType"
-#define LN_netscape_cert_type		"Netscape Cert Type"
-#define NID_netscape_cert_type		71
-#define OBJ_netscape_cert_type		OBJ_netscape_cert_extension,1L
+#define SN_netscape_cert_type       "nsCertType"
+#define LN_netscape_cert_type       "Netscape Cert Type"
+#define NID_netscape_cert_type      71
+#define OBJ_netscape_cert_type      OBJ_netscape_cert_extension,1L
 
-#define SN_netscape_base_url		"nsBaseUrl"
-#define LN_netscape_base_url		"Netscape Base Url"
-#define NID_netscape_base_url		72
-#define OBJ_netscape_base_url		OBJ_netscape_cert_extension,2L
+#define SN_netscape_base_url        "nsBaseUrl"
+#define LN_netscape_base_url        "Netscape Base Url"
+#define NID_netscape_base_url       72
+#define OBJ_netscape_base_url       OBJ_netscape_cert_extension,2L
 
-#define SN_netscape_revocation_url	"nsRevocationUrl"
-#define LN_netscape_revocation_url	"Netscape Revocation Url"
-#define NID_netscape_revocation_url	73
-#define OBJ_netscape_revocation_url	OBJ_netscape_cert_extension,3L
+#define SN_netscape_revocation_url  "nsRevocationUrl"
+#define LN_netscape_revocation_url  "Netscape Revocation Url"
+#define NID_netscape_revocation_url 73
+#define OBJ_netscape_revocation_url OBJ_netscape_cert_extension,3L
 
-#define SN_netscape_ca_revocation_url	"nsCaRevocationUrl"
-#define LN_netscape_ca_revocation_url	"Netscape CA Revocation Url"
-#define NID_netscape_ca_revocation_url	74
-#define OBJ_netscape_ca_revocation_url	OBJ_netscape_cert_extension,4L
+#define SN_netscape_ca_revocation_url   "nsCaRevocationUrl"
+#define LN_netscape_ca_revocation_url   "Netscape CA Revocation Url"
+#define NID_netscape_ca_revocation_url  74
+#define OBJ_netscape_ca_revocation_url  OBJ_netscape_cert_extension,4L
 
-#define SN_netscape_renewal_url		"nsRenewalUrl"
-#define LN_netscape_renewal_url		"Netscape Renewal Url"
-#define NID_netscape_renewal_url	75
-#define OBJ_netscape_renewal_url	OBJ_netscape_cert_extension,7L
+#define SN_netscape_renewal_url     "nsRenewalUrl"
+#define LN_netscape_renewal_url     "Netscape Renewal Url"
+#define NID_netscape_renewal_url    75
+#define OBJ_netscape_renewal_url    OBJ_netscape_cert_extension,7L
 
-#define SN_netscape_ca_policy_url	"nsCaPolicyUrl"
-#define LN_netscape_ca_policy_url	"Netscape CA Policy Url"
-#define NID_netscape_ca_policy_url	76
-#define OBJ_netscape_ca_policy_url	OBJ_netscape_cert_extension,8L
+#define SN_netscape_ca_policy_url   "nsCaPolicyUrl"
+#define LN_netscape_ca_policy_url   "Netscape CA Policy Url"
+#define NID_netscape_ca_policy_url  76
+#define OBJ_netscape_ca_policy_url  OBJ_netscape_cert_extension,8L
 
-#define SN_netscape_ssl_server_name	"nsSslServerName"
-#define LN_netscape_ssl_server_name	"Netscape SSL Server Name"
-#define NID_netscape_ssl_server_name	77
-#define OBJ_netscape_ssl_server_name	OBJ_netscape_cert_extension,12L
+#define SN_netscape_ssl_server_name "nsSslServerName"
+#define LN_netscape_ssl_server_name "Netscape SSL Server Name"
+#define NID_netscape_ssl_server_name    77
+#define OBJ_netscape_ssl_server_name    OBJ_netscape_cert_extension,12L
 
-#define SN_netscape_comment		"nsComment"
-#define LN_netscape_comment		"Netscape Comment"
-#define NID_netscape_comment		78
-#define OBJ_netscape_comment		OBJ_netscape_cert_extension,13L
+#define SN_netscape_comment     "nsComment"
+#define LN_netscape_comment     "Netscape Comment"
+#define NID_netscape_comment        78
+#define OBJ_netscape_comment        OBJ_netscape_cert_extension,13L
 
-#define SN_netscape_cert_sequence	"nsCertSequence"
-#define LN_netscape_cert_sequence	"Netscape Certificate Sequence"
-#define NID_netscape_cert_sequence	79
-#define OBJ_netscape_cert_sequence	OBJ_netscape_data_type,5L
+#define SN_netscape_cert_sequence   "nsCertSequence"
+#define LN_netscape_cert_sequence   "Netscape Certificate Sequence"
+#define NID_netscape_cert_sequence  79
+#define OBJ_netscape_cert_sequence  OBJ_netscape_data_type,5L
 
-#define SN_desx_cbc			"DESX-CBC"
-#define LN_desx_cbc			"desx-cbc"
-#define NID_desx_cbc			80
+#define SN_desx_cbc         "DESX-CBC"
+#define LN_desx_cbc         "desx-cbc"
+#define NID_desx_cbc            80
 
-#define SN_id_ce			"id-ce"
-#define NID_id_ce			81
-#define OBJ_id_ce			2L,5L,29L
+#define SN_id_ce            "id-ce"
+#define NID_id_ce           81
+#define OBJ_id_ce           2L,5L,29L
 
-#define SN_subject_key_identifier	"subjectKeyIdentifier"
-#define LN_subject_key_identifier	"X509v3 Subject Key Identifier"
-#define NID_subject_key_identifier	82
-#define OBJ_subject_key_identifier	OBJ_id_ce,14L
+#define SN_subject_key_identifier   "subjectKeyIdentifier"
+#define LN_subject_key_identifier   "X509v3 Subject Key Identifier"
+#define NID_subject_key_identifier  82
+#define OBJ_subject_key_identifier  OBJ_id_ce,14L
 
-#define SN_key_usage			"keyUsage"
-#define LN_key_usage			"X509v3 Key Usage"
-#define NID_key_usage			83
-#define OBJ_key_usage			OBJ_id_ce,15L
+#define SN_key_usage            "keyUsage"
+#define LN_key_usage            "X509v3 Key Usage"
+#define NID_key_usage           83
+#define OBJ_key_usage           OBJ_id_ce,15L
 
-#define SN_private_key_usage_period	"privateKeyUsagePeriod"
-#define LN_private_key_usage_period	"X509v3 Private Key Usage Period"
-#define NID_private_key_usage_period	84
-#define OBJ_private_key_usage_period	OBJ_id_ce,16L
+#define SN_private_key_usage_period "privateKeyUsagePeriod"
+#define LN_private_key_usage_period "X509v3 Private Key Usage Period"
+#define NID_private_key_usage_period    84
+#define OBJ_private_key_usage_period    OBJ_id_ce,16L
 
-#define SN_subject_alt_name		"subjectAltName"
-#define LN_subject_alt_name		"X509v3 Subject Alternative Name"
-#define NID_subject_alt_name		85
-#define OBJ_subject_alt_name		OBJ_id_ce,17L
+#define SN_subject_alt_name     "subjectAltName"
+#define LN_subject_alt_name     "X509v3 Subject Alternative Name"
+#define NID_subject_alt_name        85
+#define OBJ_subject_alt_name        OBJ_id_ce,17L
 
-#define SN_issuer_alt_name		"issuerAltName"
-#define LN_issuer_alt_name		"X509v3 Issuer Alternative Name"
-#define NID_issuer_alt_name		86
-#define OBJ_issuer_alt_name		OBJ_id_ce,18L
+#define SN_issuer_alt_name      "issuerAltName"
+#define LN_issuer_alt_name      "X509v3 Issuer Alternative Name"
+#define NID_issuer_alt_name     86
+#define OBJ_issuer_alt_name     OBJ_id_ce,18L
 
-#define SN_basic_constraints		"basicConstraints"
-#define LN_basic_constraints		"X509v3 Basic Constraints"
-#define NID_basic_constraints		87
-#define OBJ_basic_constraints		OBJ_id_ce,19L
+#define SN_basic_constraints        "basicConstraints"
+#define LN_basic_constraints        "X509v3 Basic Constraints"
+#define NID_basic_constraints       87
+#define OBJ_basic_constraints       OBJ_id_ce,19L
 
-#define SN_crl_number			"crlNumber"
-#define LN_crl_number			"X509v3 CRL Number"
-#define NID_crl_number			88
-#define OBJ_crl_number			OBJ_id_ce,20L
+#define SN_crl_number           "crlNumber"
+#define LN_crl_number           "X509v3 CRL Number"
+#define NID_crl_number          88
+#define OBJ_crl_number          OBJ_id_ce,20L
 
-#define SN_certificate_policies		"certificatePolicies"
-#define LN_certificate_policies		"X509v3 Certificate Policies"
-#define NID_certificate_policies	89
-#define OBJ_certificate_policies	OBJ_id_ce,32L
+#define SN_certificate_policies     "certificatePolicies"
+#define LN_certificate_policies     "X509v3 Certificate Policies"
+#define NID_certificate_policies    89
+#define OBJ_certificate_policies    OBJ_id_ce,32L
 
-#define SN_authority_key_identifier	"authorityKeyIdentifier"
-#define LN_authority_key_identifier	"X509v3 Authority Key Identifier"
-#define NID_authority_key_identifier	90
-#define OBJ_authority_key_identifier	OBJ_id_ce,35L
+#define SN_authority_key_identifier "authorityKeyIdentifier"
+#define LN_authority_key_identifier "X509v3 Authority Key Identifier"
+#define NID_authority_key_identifier    90
+#define OBJ_authority_key_identifier    OBJ_id_ce,35L
 
-#define SN_bf_cbc			"BF-CBC"
-#define LN_bf_cbc			"bf-cbc"
-#define NID_bf_cbc			91
-#define OBJ_bf_cbc			1L,3L,6L,1L,4L,1L,3029L,1L,2L
+#define SN_bf_cbc           "BF-CBC"
+#define LN_bf_cbc           "bf-cbc"
+#define NID_bf_cbc          91
+#define OBJ_bf_cbc          1L,3L,6L,1L,4L,1L,3029L,1L,2L
 
-#define SN_bf_ecb			"BF-ECB"
-#define LN_bf_ecb			"bf-ecb"
-#define NID_bf_ecb			92
+#define SN_bf_ecb           "BF-ECB"
+#define LN_bf_ecb           "bf-ecb"
+#define NID_bf_ecb          92
 
-#define SN_bf_cfb64			"BF-CFB"
-#define LN_bf_cfb64			"bf-cfb"
-#define NID_bf_cfb64			93
+#define SN_bf_cfb64         "BF-CFB"
+#define LN_bf_cfb64         "bf-cfb"
+#define NID_bf_cfb64            93
 
-#define SN_bf_ofb64			"BF-OFB"
-#define LN_bf_ofb64			"bf-ofb"
-#define NID_bf_ofb64			94
+#define SN_bf_ofb64         "BF-OFB"
+#define LN_bf_ofb64         "bf-ofb"
+#define NID_bf_ofb64            94
 
-#define SN_mdc2				"MDC2"
-#define LN_mdc2				"mdc2"
-#define NID_mdc2			95
-#define OBJ_mdc2			2L,5L,8L,3L,101L
-/* An alternative?			1L,3L,14L,3L,2L,19L */
+#define SN_mdc2             "MDC2"
+#define LN_mdc2             "mdc2"
+#define NID_mdc2            95
+#define OBJ_mdc2            2L,5L,8L,3L,101L
+/* An alternative?          1L,3L,14L,3L,2L,19L */
 
-#define SN_mdc2WithRSA			"RSA-MDC2"
-#define LN_mdc2WithRSA			"mdc2withRSA"
-#define NID_mdc2WithRSA			96
-#define OBJ_mdc2WithRSA			2L,5L,8L,3L,100L
+#define SN_mdc2WithRSA          "RSA-MDC2"
+#define LN_mdc2WithRSA          "mdc2withRSA"
+#define NID_mdc2WithRSA         96
+#define OBJ_mdc2WithRSA         2L,5L,8L,3L,100L
 
-#define SN_rc4_40			"RC4-40"
-#define LN_rc4_40			"rc4-40"
-#define NID_rc4_40			97
+#define SN_rc4_40           "RC4-40"
+#define LN_rc4_40           "rc4-40"
+#define NID_rc4_40          97
 
-#define SN_rc2_40_cbc			"RC2-40-CBC"
-#define LN_rc2_40_cbc			"rc2-40-cbc"
-#define NID_rc2_40_cbc			98
+#define SN_rc2_40_cbc           "RC2-40-CBC"
+#define LN_rc2_40_cbc           "rc2-40-cbc"
+#define NID_rc2_40_cbc          98
 
-#define SN_givenName			"G"
-#define LN_givenName			"givenName"
-#define NID_givenName			99
-#define OBJ_givenName			OBJ_X509,42L
+#define SN_givenName            "G"
+#define LN_givenName            "givenName"
+#define NID_givenName           99
+#define OBJ_givenName           OBJ_X509,42L
 
-#define SN_surname			"S"
-#define LN_surname			"surname"
-#define NID_surname			100
-#define OBJ_surname			OBJ_X509,4L
+#define SN_surname          "S"
+#define LN_surname          "surname"
+#define NID_surname         100
+#define OBJ_surname         OBJ_X509,4L
 
-#define SN_initials			"I"
-#define LN_initials			"initials"
-#define NID_initials			101
-#define OBJ_initials			OBJ_X509,43L
+#define SN_initials         "I"
+#define LN_initials         "initials"
+#define NID_initials            101
+#define OBJ_initials            OBJ_X509,43L
 
-#define SN_uniqueIdentifier		"UID"
-#define LN_uniqueIdentifier		"uniqueIdentifier"
-#define NID_uniqueIdentifier		102
-#define OBJ_uniqueIdentifier		OBJ_X509,45L
+#define SN_uniqueIdentifier     "UID"
+#define LN_uniqueIdentifier     "uniqueIdentifier"
+#define NID_uniqueIdentifier        102
+#define OBJ_uniqueIdentifier        OBJ_X509,45L
 
-#define SN_crl_distribution_points	"crlDistributionPoints"
-#define LN_crl_distribution_points	"X509v3 CRL Distribution Points"
-#define NID_crl_distribution_points	103
-#define OBJ_crl_distribution_points	OBJ_id_ce,31L
+#define SN_crl_distribution_points  "crlDistributionPoints"
+#define LN_crl_distribution_points  "X509v3 CRL Distribution Points"
+#define NID_crl_distribution_points 103
+#define OBJ_crl_distribution_points OBJ_id_ce,31L
 
-#define SN_md5WithRSA			"RSA-NP-MD5"
-#define LN_md5WithRSA			"md5WithRSA"
-#define NID_md5WithRSA			104
-#define OBJ_md5WithRSA			OBJ_algorithm,3L
+#define SN_md5WithRSA           "RSA-NP-MD5"
+#define LN_md5WithRSA           "md5WithRSA"
+#define NID_md5WithRSA          104
+#define OBJ_md5WithRSA          OBJ_algorithm,3L
 
-#define SN_serialNumber			"SN"
-#define LN_serialNumber			"serialNumber"
-#define NID_serialNumber		105
-#define OBJ_serialNumber		OBJ_X509,5L
+#define SN_serialNumber         "SN"
+#define LN_serialNumber         "serialNumber"
+#define NID_serialNumber        105
+#define OBJ_serialNumber        OBJ_X509,5L
 
-#define SN_title			"T"
-#define LN_title			"title"
-#define NID_title			106
-#define OBJ_title			OBJ_X509,12L
+#define SN_title            "T"
+#define LN_title            "title"
+#define NID_title           106
+#define OBJ_title           OBJ_X509,12L
 
-#define SN_description			"D"
-#define LN_description			"description"
-#define NID_description			107
-#define OBJ_description			OBJ_X509,13L
+#define SN_description          "D"
+#define LN_description          "description"
+#define NID_description         107
+#define OBJ_description         OBJ_X509,13L
 
 /* CAST5 is CAST-128, I'm just sticking with the documentation */
-#define SN_cast5_cbc			"CAST5-CBC"
-#define LN_cast5_cbc			"cast5-cbc"
-#define NID_cast5_cbc			108
-#define OBJ_cast5_cbc			1L,2L,840L,113533L,7L,66L,10L
+#define SN_cast5_cbc            "CAST5-CBC"
+#define LN_cast5_cbc            "cast5-cbc"
+#define NID_cast5_cbc           108
+#define OBJ_cast5_cbc           1L,2L,840L,113533L,7L,66L,10L
 
-#define SN_cast5_ecb			"CAST5-ECB"
-#define LN_cast5_ecb			"cast5-ecb"
-#define NID_cast5_ecb			109
+#define SN_cast5_ecb            "CAST5-ECB"
+#define LN_cast5_ecb            "cast5-ecb"
+#define NID_cast5_ecb           109
 
-#define SN_cast5_cfb64			"CAST5-CFB"
-#define LN_cast5_cfb64			"cast5-cfb"
-#define NID_cast5_cfb64			110
+#define SN_cast5_cfb64          "CAST5-CFB"
+#define LN_cast5_cfb64          "cast5-cfb"
+#define NID_cast5_cfb64         110
 
-#define SN_cast5_ofb64			"CAST5-OFB"
-#define LN_cast5_ofb64			"cast5-ofb"
-#define NID_cast5_ofb64			111
+#define SN_cast5_ofb64          "CAST5-OFB"
+#define LN_cast5_ofb64          "cast5-ofb"
+#define NID_cast5_ofb64         111
 
-#define LN_pbeWithMD5AndCast5_CBC	"pbeWithMD5AndCast5CBC"
-#define NID_pbeWithMD5AndCast5_CBC	112
-#define OBJ_pbeWithMD5AndCast5_CBC	1L,2L,840L,113533L,7L,66L,12L
+#define LN_pbeWithMD5AndCast5_CBC   "pbeWithMD5AndCast5CBC"
+#define NID_pbeWithMD5AndCast5_CBC  112
+#define OBJ_pbeWithMD5AndCast5_CBC  1L,2L,840L,113533L,7L,66L,12L
 
 /* This is one sun will soon be using :-(
  * id-dsa-with-sha1 ID  ::= {
  *   iso(1) member-body(2) us(840) x9-57 (10040) x9cm(4) 3 }
  */
-#define SN_dsaWithSHA1			"DSA-SHA1"
-#define LN_dsaWithSHA1			"dsaWithSHA1"
-#define NID_dsaWithSHA1			113
-#define OBJ_dsaWithSHA1			1L,2L,840L,10040L,4L,3L
+#define SN_dsaWithSHA1          "DSA-SHA1"
+#define LN_dsaWithSHA1          "dsaWithSHA1"
+#define NID_dsaWithSHA1         113
+#define OBJ_dsaWithSHA1         1L,2L,840L,10040L,4L,3L
 
-#define NID_md5_sha1			114
-#define SN_md5_sha1			"MD5-SHA1"
-#define LN_md5_sha1			"md5-sha1"
+#define NID_md5_sha1            114
+#define SN_md5_sha1         "MD5-SHA1"
+#define LN_md5_sha1         "md5-sha1"
 
-#define SN_sha1WithRSA			"RSA-SHA1-2"
-#define LN_sha1WithRSA			"sha1WithRSA"
-#define NID_sha1WithRSA			115
-#define OBJ_sha1WithRSA			OBJ_algorithm,29L
+#define SN_sha1WithRSA          "RSA-SHA1-2"
+#define LN_sha1WithRSA          "sha1WithRSA"
+#define NID_sha1WithRSA         115
+#define OBJ_sha1WithRSA         OBJ_algorithm,29L
 
-#define SN_dsa				"DSA"
-#define LN_dsa				"dsaEncryption"
-#define NID_dsa				116
-#define OBJ_dsa				1L,2L,840L,10040L,4L,1L
+#define SN_dsa              "DSA"
+#define LN_dsa              "dsaEncryption"
+#define NID_dsa             116
+#define OBJ_dsa             1L,2L,840L,10040L,4L,1L
 
-#define SN_ripemd160			"RIPEMD160"
-#define LN_ripemd160			"ripemd160"
-#define NID_ripemd160			117
-#define OBJ_ripemd160			1L,3L,36L,3L,2L,1L
+#define SN_ripemd160            "RIPEMD160"
+#define LN_ripemd160            "ripemd160"
+#define NID_ripemd160           117
+#define OBJ_ripemd160           1L,3L,36L,3L,2L,1L
 
 /* The name should actually be rsaSignatureWithripemd160, but I'm going
  * to continue using the convention I'm using with the other ciphers */
-#define SN_ripemd160WithRSA		"RSA-RIPEMD160"
-#define LN_ripemd160WithRSA		"ripemd160WithRSA"
-#define NID_ripemd160WithRSA		119
-#define OBJ_ripemd160WithRSA		1L,3L,36L,3L,3L,1L,2L
+#define SN_ripemd160WithRSA     "RSA-RIPEMD160"
+#define LN_ripemd160WithRSA     "ripemd160WithRSA"
+#define NID_ripemd160WithRSA        119
+#define OBJ_ripemd160WithRSA        1L,3L,36L,3L,3L,1L,2L
 
 /* Taken from rfc2040
  *  RC5_CBC_Parameters ::= SEQUENCE {
- *	version           INTEGER (v1_0(16)),
- *	rounds            INTEGER (8..127),
- *	blockSizeInBits   INTEGER (64, 128),
- *	iv                OCTET STRING OPTIONAL
- *	}
+ *  version           INTEGER (v1_0(16)),
+ *  rounds            INTEGER (8..127),
+ *  blockSizeInBits   INTEGER (64, 128),
+ *  iv                OCTET STRING OPTIONAL
+ *  }
  */
-#define SN_rc5_cbc			"RC5-CBC"
-#define LN_rc5_cbc			"rc5-cbc"
-#define NID_rc5_cbc			120
-#define OBJ_rc5_cbc			OBJ_rsadsi,3L,8L
+#define SN_rc5_cbc          "RC5-CBC"
+#define LN_rc5_cbc          "rc5-cbc"
+#define NID_rc5_cbc         120
+#define OBJ_rc5_cbc         OBJ_rsadsi,3L,8L
 
-#define SN_rc5_ecb			"RC5-ECB"
-#define LN_rc5_ecb			"rc5-ecb"
-#define NID_rc5_ecb			121
+#define SN_rc5_ecb          "RC5-ECB"
+#define LN_rc5_ecb          "rc5-ecb"
+#define NID_rc5_ecb         121
 
-#define SN_rc5_cfb64			"RC5-CFB"
-#define LN_rc5_cfb64			"rc5-cfb"
-#define NID_rc5_cfb64			122
+#define SN_rc5_cfb64            "RC5-CFB"
+#define LN_rc5_cfb64            "rc5-cfb"
+#define NID_rc5_cfb64           122
 
-#define SN_rc5_ofb64			"RC5-OFB"
-#define LN_rc5_ofb64			"rc5-ofb"
-#define NID_rc5_ofb64			123
+#define SN_rc5_ofb64            "RC5-OFB"
+#define LN_rc5_ofb64            "rc5-ofb"
+#define NID_rc5_ofb64           123
 
-#define SN_rle_compression		"RLE"
-#define LN_rle_compression		"run length compression"
-#define NID_rle_compression		124
-#define OBJ_rle_compression		1L,1L,1L,1L,666L,1L
+#define SN_rle_compression      "RLE"
+#define LN_rle_compression      "run length compression"
+#define NID_rle_compression     124
+#define OBJ_rle_compression     1L,1L,1L,1L,666L,1L
 
-#define SN_zlib_compression		"ZLIB"
-#define LN_zlib_compression		"zlib compression"
-#define NID_zlib_compression		125
-#define OBJ_zlib_compression		1L,1L,1L,1L,666L,2L
+#define SN_zlib_compression     "ZLIB"
+#define LN_zlib_compression     "zlib compression"
+#define NID_zlib_compression        125
+#define OBJ_zlib_compression        1L,1L,1L,1L,666L,2L
 
-#define SN_ext_key_usage		"extendedKeyUsage"
-#define LN_ext_key_usage		"X509v3 Extended Key Usage"
-#define NID_ext_key_usage		126
-#define OBJ_ext_key_usage		OBJ_id_ce,37
+#define SN_ext_key_usage        "extendedKeyUsage"
+#define LN_ext_key_usage        "X509v3 Extended Key Usage"
+#define NID_ext_key_usage       126
+#define OBJ_ext_key_usage       OBJ_id_ce,37
 
-#define SN_id_pkix			"PKIX"
-#define NID_id_pkix			127
-#define OBJ_id_pkix			1L,3L,6L,1L,5L,5L,7L
+#define SN_id_pkix          "PKIX"
+#define NID_id_pkix         127
+#define OBJ_id_pkix         1L,3L,6L,1L,5L,5L,7L
 
-#define SN_id_kp			"id-kp"
-#define NID_id_kp			128
-#define OBJ_id_kp			OBJ_id_pkix,3L
+#define SN_id_kp            "id-kp"
+#define NID_id_kp           128
+#define OBJ_id_kp           OBJ_id_pkix,3L
 
 /* PKIX extended key usage OIDs */
 
-#define SN_server_auth			"serverAuth"
-#define LN_server_auth			"TLS Web Server Authentication"
-#define NID_server_auth			129
-#define OBJ_server_auth			OBJ_id_kp,1L
+#define SN_server_auth          "serverAuth"
+#define LN_server_auth          "TLS Web Server Authentication"
+#define NID_server_auth         129
+#define OBJ_server_auth         OBJ_id_kp,1L
 
-#define SN_client_auth			"clientAuth"
-#define LN_client_auth			"TLS Web Client Authentication"
-#define NID_client_auth			130
-#define OBJ_client_auth			OBJ_id_kp,2L
+#define SN_client_auth          "clientAuth"
+#define LN_client_auth          "TLS Web Client Authentication"
+#define NID_client_auth         130
+#define OBJ_client_auth         OBJ_id_kp,2L
 
-#define SN_code_sign			"codeSigning"
-#define LN_code_sign			"Code Signing"
-#define NID_code_sign			131
-#define OBJ_code_sign			OBJ_id_kp,3L
+#define SN_code_sign            "codeSigning"
+#define LN_code_sign            "Code Signing"
+#define NID_code_sign           131
+#define OBJ_code_sign           OBJ_id_kp,3L
 
-#define SN_email_protect		"emailProtection"
-#define LN_email_protect		"E-mail Protection"
-#define NID_email_protect		132
-#define OBJ_email_protect		OBJ_id_kp,4L
+#define SN_email_protect        "emailProtection"
+#define LN_email_protect        "E-mail Protection"
+#define NID_email_protect       132
+#define OBJ_email_protect       OBJ_id_kp,4L
 
-#define SN_time_stamp			"timeStamping"
-#define LN_time_stamp			"Time Stamping"
-#define NID_time_stamp			133
-#define OBJ_time_stamp			OBJ_id_kp,8L
+#define SN_time_stamp           "timeStamping"
+#define LN_time_stamp           "Time Stamping"
+#define NID_time_stamp          133
+#define OBJ_time_stamp          OBJ_id_kp,8L
 
 /* Additional extended key usage OIDs: Microsoft */
 
-#define SN_ms_code_ind			"msCodeInd"
-#define LN_ms_code_ind			"Microsoft Individual Code Signing"
-#define NID_ms_code_ind			134
-#define OBJ_ms_code_ind			1L,3L,6L,1L,4L,1L,311L,2L,1L,21L
+#define SN_ms_code_ind          "msCodeInd"
+#define LN_ms_code_ind          "Microsoft Individual Code Signing"
+#define NID_ms_code_ind         134
+#define OBJ_ms_code_ind         1L,3L,6L,1L,4L,1L,311L,2L,1L,21L
 
-#define SN_ms_code_com			"msCodeCom"
-#define LN_ms_code_com			"Microsoft Commercial Code Signing"
-#define NID_ms_code_com			135
-#define OBJ_ms_code_com			1L,3L,6L,1L,4L,1L,311L,2L,1L,22L
+#define SN_ms_code_com          "msCodeCom"
+#define LN_ms_code_com          "Microsoft Commercial Code Signing"
+#define NID_ms_code_com         135
+#define OBJ_ms_code_com         1L,3L,6L,1L,4L,1L,311L,2L,1L,22L
 
-#define SN_ms_ctl_sign			"msCTLSign"
-#define LN_ms_ctl_sign			"Microsoft Trust List Signing"
-#define NID_ms_ctl_sign			136
-#define OBJ_ms_ctl_sign			1L,3L,6L,1L,4L,1L,311L,10L,3L,1L
+#define SN_ms_ctl_sign          "msCTLSign"
+#define LN_ms_ctl_sign          "Microsoft Trust List Signing"
+#define NID_ms_ctl_sign         136
+#define OBJ_ms_ctl_sign         1L,3L,6L,1L,4L,1L,311L,10L,3L,1L
 
-#define SN_ms_sgc			"msSGC"
-#define LN_ms_sgc			"Microsoft Server Gated Crypto"
-#define NID_ms_sgc			137
-#define OBJ_ms_sgc			1L,3L,6L,1L,4L,1L,311L,10L,3L,3L
+#define SN_ms_sgc           "msSGC"
+#define LN_ms_sgc           "Microsoft Server Gated Crypto"
+#define NID_ms_sgc          137
+#define OBJ_ms_sgc          1L,3L,6L,1L,4L,1L,311L,10L,3L,3L
 
-#define SN_ms_efs			"msEFS"
-#define LN_ms_efs			"Microsoft Encrypted File System"
-#define NID_ms_efs			138
-#define OBJ_ms_efs			1L,3L,6L,1L,4L,1L,311L,10L,3L,4L
+#define SN_ms_efs           "msEFS"
+#define LN_ms_efs           "Microsoft Encrypted File System"
+#define NID_ms_efs          138
+#define OBJ_ms_efs          1L,3L,6L,1L,4L,1L,311L,10L,3L,4L
 
 /* Additional usage: Netscape */
 
-#define SN_ns_sgc			"nsSGC"
-#define LN_ns_sgc			"Netscape Server Gated Crypto"
-#define NID_ns_sgc			139
-#define OBJ_ns_sgc			OBJ_netscape,4L,1L
+#define SN_ns_sgc           "nsSGC"
+#define LN_ns_sgc           "Netscape Server Gated Crypto"
+#define NID_ns_sgc          139
+#define OBJ_ns_sgc          OBJ_netscape,4L,1L
 
-#define SN_delta_crl			"deltaCRL"
-#define LN_delta_crl			"X509v3 Delta CRL Indicator"
-#define NID_delta_crl			140
-#define OBJ_delta_crl			OBJ_id_ce,27L
+#define SN_delta_crl            "deltaCRL"
+#define LN_delta_crl            "X509v3 Delta CRL Indicator"
+#define NID_delta_crl           140
+#define OBJ_delta_crl           OBJ_id_ce,27L
 
-#define SN_crl_reason			"CRLReason"
-#define LN_crl_reason			"CRL Reason Code"
-#define NID_crl_reason			141
-#define OBJ_crl_reason			OBJ_id_ce,21L
+#define SN_crl_reason           "CRLReason"
+#define LN_crl_reason           "CRL Reason Code"
+#define NID_crl_reason          141
+#define OBJ_crl_reason          OBJ_id_ce,21L
 
-#define SN_invalidity_date		"invalidityDate"
-#define LN_invalidity_date		"Invalidity Date"
-#define NID_invalidity_date		142
-#define OBJ_invalidity_date		OBJ_id_ce,24L
+#define SN_invalidity_date      "invalidityDate"
+#define LN_invalidity_date      "Invalidity Date"
+#define NID_invalidity_date     142
+#define OBJ_invalidity_date     OBJ_id_ce,24L
 
-#define SN_sxnet			"SXNetID"
-#define LN_sxnet			"Strong Extranet ID"
-#define NID_sxnet			143
-#define OBJ_sxnet			1L,3L,101L,1L,4L,1L
+#define SN_sxnet            "SXNetID"
+#define LN_sxnet            "Strong Extranet ID"
+#define NID_sxnet           143
+#define OBJ_sxnet           1L,3L,101L,1L,4L,1L
 
 /* PKCS12 and related OBJECT IDENTIFIERS */
 
-#define OBJ_pkcs12			OBJ_pkcs,12L
-#define OBJ_pkcs12_pbeids		OBJ_pkcs12, 1
+#define OBJ_pkcs12          OBJ_pkcs,12L
+#define OBJ_pkcs12_pbeids       OBJ_pkcs12, 1
 
-#define SN_pbe_WithSHA1And128BitRC4	"PBE-SHA1-RC4-128"
-#define LN_pbe_WithSHA1And128BitRC4	"pbeWithSHA1And128BitRC4"
-#define NID_pbe_WithSHA1And128BitRC4	144
-#define OBJ_pbe_WithSHA1And128BitRC4	OBJ_pkcs12_pbeids, 1L
+#define SN_pbe_WithSHA1And128BitRC4 "PBE-SHA1-RC4-128"
+#define LN_pbe_WithSHA1And128BitRC4 "pbeWithSHA1And128BitRC4"
+#define NID_pbe_WithSHA1And128BitRC4    144
+#define OBJ_pbe_WithSHA1And128BitRC4    OBJ_pkcs12_pbeids, 1L
 
-#define SN_pbe_WithSHA1And40BitRC4	"PBE-SHA1-RC4-40"
-#define LN_pbe_WithSHA1And40BitRC4	"pbeWithSHA1And40BitRC4"
-#define NID_pbe_WithSHA1And40BitRC4	145
-#define OBJ_pbe_WithSHA1And40BitRC4	OBJ_pkcs12_pbeids, 2L
+#define SN_pbe_WithSHA1And40BitRC4  "PBE-SHA1-RC4-40"
+#define LN_pbe_WithSHA1And40BitRC4  "pbeWithSHA1And40BitRC4"
+#define NID_pbe_WithSHA1And40BitRC4 145
+#define OBJ_pbe_WithSHA1And40BitRC4 OBJ_pkcs12_pbeids, 2L
 
-#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC	"PBE-SHA1-3DES"
-#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC	"pbeWithSHA1And3-KeyTripleDES-CBC"
-#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC	146
-#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC	OBJ_pkcs12_pbeids, 3L
+#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC   "PBE-SHA1-3DES"
+#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC   "pbeWithSHA1And3-KeyTripleDES-CBC"
+#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC  146
+#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC  OBJ_pkcs12_pbeids, 3L
 
-#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC	"PBE-SHA1-2DES"
-#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC	"pbeWithSHA1And2-KeyTripleDES-CBC"
-#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC	147
-#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC	OBJ_pkcs12_pbeids, 4L
+#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC   "PBE-SHA1-2DES"
+#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC   "pbeWithSHA1And2-KeyTripleDES-CBC"
+#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC  147
+#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC  OBJ_pkcs12_pbeids, 4L
 
-#define SN_pbe_WithSHA1And128BitRC2_CBC		"PBE-SHA1-RC2-128"
-#define LN_pbe_WithSHA1And128BitRC2_CBC		"pbeWithSHA1And128BitRC2-CBC"
-#define NID_pbe_WithSHA1And128BitRC2_CBC	148
-#define OBJ_pbe_WithSHA1And128BitRC2_CBC	OBJ_pkcs12_pbeids, 5L
+#define SN_pbe_WithSHA1And128BitRC2_CBC     "PBE-SHA1-RC2-128"
+#define LN_pbe_WithSHA1And128BitRC2_CBC     "pbeWithSHA1And128BitRC2-CBC"
+#define NID_pbe_WithSHA1And128BitRC2_CBC    148
+#define OBJ_pbe_WithSHA1And128BitRC2_CBC    OBJ_pkcs12_pbeids, 5L
 
-#define SN_pbe_WithSHA1And40BitRC2_CBC	"PBE-SHA1-RC2-40"
-#define LN_pbe_WithSHA1And40BitRC2_CBC	"pbeWithSHA1And40BitRC2-CBC"
-#define NID_pbe_WithSHA1And40BitRC2_CBC	149
-#define OBJ_pbe_WithSHA1And40BitRC2_CBC	OBJ_pkcs12_pbeids, 6L
+#define SN_pbe_WithSHA1And40BitRC2_CBC  "PBE-SHA1-RC2-40"
+#define LN_pbe_WithSHA1And40BitRC2_CBC  "pbeWithSHA1And40BitRC2-CBC"
+#define NID_pbe_WithSHA1And40BitRC2_CBC 149
+#define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids, 6L
 
-#define OBJ_pkcs12_Version1	OBJ_pkcs12, 10L
+#define OBJ_pkcs12_Version1 OBJ_pkcs12, 10L
 
-#define OBJ_pkcs12_BagIds	OBJ_pkcs12_Version1, 1L
+#define OBJ_pkcs12_BagIds   OBJ_pkcs12_Version1, 1L
 
-#define LN_keyBag		"keyBag"
-#define NID_keyBag		150
-#define OBJ_keyBag		OBJ_pkcs12_BagIds, 1L
+#define LN_keyBag       "keyBag"
+#define NID_keyBag      150
+#define OBJ_keyBag      OBJ_pkcs12_BagIds, 1L
 
-#define LN_pkcs8ShroudedKeyBag	"pkcs8ShroudedKeyBag"
-#define NID_pkcs8ShroudedKeyBag	151
-#define OBJ_pkcs8ShroudedKeyBag	OBJ_pkcs12_BagIds, 2L
+#define LN_pkcs8ShroudedKeyBag  "pkcs8ShroudedKeyBag"
+#define NID_pkcs8ShroudedKeyBag 151
+#define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds, 2L
 
-#define LN_certBag		"certBag"
-#define NID_certBag		152
-#define OBJ_certBag		OBJ_pkcs12_BagIds, 3L
+#define LN_certBag      "certBag"
+#define NID_certBag     152
+#define OBJ_certBag     OBJ_pkcs12_BagIds, 3L
 
-#define LN_crlBag		"crlBag"
-#define NID_crlBag		153
-#define OBJ_crlBag		OBJ_pkcs12_BagIds, 4L
+#define LN_crlBag       "crlBag"
+#define NID_crlBag      153
+#define OBJ_crlBag      OBJ_pkcs12_BagIds, 4L
 
-#define LN_secretBag		"secretBag"
-#define NID_secretBag		154
-#define OBJ_secretBag		OBJ_pkcs12_BagIds, 5L
+#define LN_secretBag        "secretBag"
+#define NID_secretBag       154
+#define OBJ_secretBag       OBJ_pkcs12_BagIds, 5L
 
-#define LN_safeContentsBag	"safeContentsBag"
-#define NID_safeContentsBag	155
-#define OBJ_safeContentsBag	OBJ_pkcs12_BagIds, 6L
+#define LN_safeContentsBag  "safeContentsBag"
+#define NID_safeContentsBag 155
+#define OBJ_safeContentsBag OBJ_pkcs12_BagIds, 6L
 
-#define LN_friendlyName		"friendlyName"
-#define	NID_friendlyName	156
-#define OBJ_friendlyName	OBJ_pkcs9, 20L
+#define LN_friendlyName     "friendlyName"
+#define NID_friendlyName    156
+#define OBJ_friendlyName    OBJ_pkcs9, 20L
 
-#define LN_localKeyID		"localKeyID"
-#define	NID_localKeyID		157
-#define OBJ_localKeyID		OBJ_pkcs9, 21L
+#define LN_localKeyID       "localKeyID"
+#define NID_localKeyID      157
+#define OBJ_localKeyID      OBJ_pkcs9, 21L
 
-#define OBJ_certTypes		OBJ_pkcs9, 22L
+#define OBJ_certTypes       OBJ_pkcs9, 22L
 
-#define LN_x509Certificate	"x509Certificate"
-#define	NID_x509Certificate	158
-#define OBJ_x509Certificate	OBJ_certTypes, 1L
+#define LN_x509Certificate  "x509Certificate"
+#define NID_x509Certificate 158
+#define OBJ_x509Certificate OBJ_certTypes, 1L
 
-#define LN_sdsiCertificate	"sdsiCertificate"
-#define	NID_sdsiCertificate	159
-#define OBJ_sdsiCertificate	OBJ_certTypes, 2L
+#define LN_sdsiCertificate  "sdsiCertificate"
+#define NID_sdsiCertificate 159
+#define OBJ_sdsiCertificate OBJ_certTypes, 2L
 
-#define OBJ_crlTypes		OBJ_pkcs9, 23L
+#define OBJ_crlTypes        OBJ_pkcs9, 23L
 
-#define LN_x509Crl		"x509Crl"
-#define	NID_x509Crl		160
-#define OBJ_x509Crl		OBJ_crlTypes, 1L
+#define LN_x509Crl      "x509Crl"
+#define NID_x509Crl     160
+#define OBJ_x509Crl     OBJ_crlTypes, 1L
 
 /* PKCS#5 v2 OIDs */
 
-#define LN_pbes2		"PBES2"
-#define NID_pbes2		161
-#define OBJ_pbes2		OBJ_pkcs,5L,13L
+#define LN_pbes2        "PBES2"
+#define NID_pbes2       161
+#define OBJ_pbes2       OBJ_pkcs,5L,13L
 
-#define LN_pbmac1		"PBMAC1"
-#define NID_pbmac1		162
-#define OBJ_pbmac1		OBJ_pkcs,5L,14L
+#define LN_pbmac1       "PBMAC1"
+#define NID_pbmac1      162
+#define OBJ_pbmac1      OBJ_pkcs,5L,14L
 
-#define LN_hmacWithSHA1		"hmacWithSHA1"
-#define NID_hmacWithSHA1	163
-#define OBJ_hmacWithSHA1	OBJ_rsadsi,2L,7L
+#define LN_hmacWithSHA1     "hmacWithSHA1"
+#define NID_hmacWithSHA1    163
+#define OBJ_hmacWithSHA1    OBJ_rsadsi,2L,7L
 
 /* Policy Qualifier Ids */
 
-#define LN_id_qt_cps		"Policy Qualifier CPS"
-#define SN_id_qt_cps		"id-qt-cps"
-#define NID_id_qt_cps		164
-#define OBJ_id_qt_cps		OBJ_id_pkix,2L,1L
+#define LN_id_qt_cps        "Policy Qualifier CPS"
+#define SN_id_qt_cps        "id-qt-cps"
+#define NID_id_qt_cps       164
+#define OBJ_id_qt_cps       OBJ_id_pkix,2L,1L
 
-#define LN_id_qt_unotice	"Policy Qualifier User Notice"
-#define SN_id_qt_unotice	"id-qt-unotice"
-#define NID_id_qt_unotice	165
-#define OBJ_id_qt_unotice	OBJ_id_pkix,2L,2L
+#define LN_id_qt_unotice    "Policy Qualifier User Notice"
+#define SN_id_qt_unotice    "id-qt-unotice"
+#define NID_id_qt_unotice   165
+#define OBJ_id_qt_unotice   OBJ_id_pkix,2L,2L
 
-#define SN_rc2_64_cbc			"RC2-64-CBC"
-#define LN_rc2_64_cbc			"rc2-64-cbc"
-#define NID_rc2_64_cbc			166
+#define SN_rc2_64_cbc           "RC2-64-CBC"
+#define LN_rc2_64_cbc           "rc2-64-cbc"
+#define NID_rc2_64_cbc          166
 
-#define SN_SMIMECapabilities		"SMIME-CAPS"
-#define LN_SMIMECapabilities		"S/MIME Capabilities"
-#define NID_SMIMECapabilities		167
-#define OBJ_SMIMECapabilities		OBJ_pkcs9,15L
+#define SN_SMIMECapabilities        "SMIME-CAPS"
+#define LN_SMIMECapabilities        "S/MIME Capabilities"
+#define NID_SMIMECapabilities       167
+#define OBJ_SMIMECapabilities       OBJ_pkcs9,15L
 
-#define SN_pbeWithMD2AndRC2_CBC		"PBE-MD2-RC2-64"
-#define LN_pbeWithMD2AndRC2_CBC		"pbeWithMD2AndRC2-CBC"
-#define NID_pbeWithMD2AndRC2_CBC	168
-#define OBJ_pbeWithMD2AndRC2_CBC	OBJ_pkcs,5L,4L
+#define SN_pbeWithMD2AndRC2_CBC     "PBE-MD2-RC2-64"
+#define LN_pbeWithMD2AndRC2_CBC     "pbeWithMD2AndRC2-CBC"
+#define NID_pbeWithMD2AndRC2_CBC    168
+#define OBJ_pbeWithMD2AndRC2_CBC    OBJ_pkcs,5L,4L
 
-#define SN_pbeWithMD5AndRC2_CBC		"PBE-MD5-RC2-64"
-#define LN_pbeWithMD5AndRC2_CBC		"pbeWithMD5AndRC2-CBC"
-#define NID_pbeWithMD5AndRC2_CBC	169
-#define OBJ_pbeWithMD5AndRC2_CBC	OBJ_pkcs,5L,6L
+#define SN_pbeWithMD5AndRC2_CBC     "PBE-MD5-RC2-64"
+#define LN_pbeWithMD5AndRC2_CBC     "pbeWithMD5AndRC2-CBC"
+#define NID_pbeWithMD5AndRC2_CBC    169
+#define OBJ_pbeWithMD5AndRC2_CBC    OBJ_pkcs,5L,6L
 
-#define SN_pbeWithSHA1AndDES_CBC	"PBE-SHA1-DES"
-#define LN_pbeWithSHA1AndDES_CBC	"pbeWithSHA1AndDES-CBC"
-#define NID_pbeWithSHA1AndDES_CBC	170
-#define OBJ_pbeWithSHA1AndDES_CBC	OBJ_pkcs,5L,10L
+#define SN_pbeWithSHA1AndDES_CBC    "PBE-SHA1-DES"
+#define LN_pbeWithSHA1AndDES_CBC    "pbeWithSHA1AndDES-CBC"
+#define NID_pbeWithSHA1AndDES_CBC   170
+#define OBJ_pbeWithSHA1AndDES_CBC   OBJ_pkcs,5L,10L
 
 /* Extension request OIDs */
 
-#define LN_ms_ext_req			"Microsoft Extension Request"
-#define SN_ms_ext_req			"msExtReq"
-#define NID_ms_ext_req			171
-#define OBJ_ms_ext_req			1L,3L,6L,1L,4L,1L,311L,2L,1L,14L
+#define LN_ms_ext_req           "Microsoft Extension Request"
+#define SN_ms_ext_req           "msExtReq"
+#define NID_ms_ext_req          171
+#define OBJ_ms_ext_req          1L,3L,6L,1L,4L,1L,311L,2L,1L,14L
 
-#define LN_ext_req			"Extension Request"
-#define SN_ext_req			"extReq"
-#define NID_ext_req			172
-#define OBJ_ext_req			OBJ_pkcs9,14L
+#define LN_ext_req          "Extension Request"
+#define SN_ext_req          "extReq"
+#define NID_ext_req         172
+#define OBJ_ext_req         OBJ_pkcs9,14L
 
-#define SN_name				"name"
-#define LN_name				"name"
-#define NID_name			173
-#define OBJ_name			OBJ_X509,41L
+#define SN_name             "name"
+#define LN_name             "name"
+#define NID_name            173
+#define OBJ_name            OBJ_X509,41L
 
-#define SN_dnQualifier			"dnQualifier"
-#define LN_dnQualifier			"dnQualifier"
-#define NID_dnQualifier			174
-#define OBJ_dnQualifier			OBJ_X509,46L
+#define SN_dnQualifier          "dnQualifier"
+#define LN_dnQualifier          "dnQualifier"
+#define NID_dnQualifier         174
+#define OBJ_dnQualifier         OBJ_X509,46L
 
-#define SN_id_pe			"id-pe"
-#define NID_id_pe			175
-#define OBJ_id_pe			OBJ_id_pkix,1L
+#define SN_id_pe            "id-pe"
+#define NID_id_pe           175
+#define OBJ_id_pe           OBJ_id_pkix,1L
 
-#define SN_id_ad			"id-ad"
-#define NID_id_ad			176
-#define OBJ_id_ad			OBJ_id_pkix,48L
+#define SN_id_ad            "id-ad"
+#define NID_id_ad           176
+#define OBJ_id_ad           OBJ_id_pkix,48L
 
-#define SN_info_access			"authorityInfoAccess"
-#define LN_info_access			"Authority Information Access"
-#define NID_info_access			177
-#define OBJ_info_access			OBJ_id_pe,1L
+#define SN_info_access          "authorityInfoAccess"
+#define LN_info_access          "Authority Information Access"
+#define NID_info_access         177
+#define OBJ_info_access         OBJ_id_pe,1L
 
-#define SN_ad_OCSP			"OCSP"
-#define LN_ad_OCSP			"OCSP"
-#define NID_ad_OCSP			178
-#define OBJ_ad_OCSP			OBJ_id_ad,1L
+#define SN_ad_OCSP          "OCSP"
+#define LN_ad_OCSP          "OCSP"
+#define NID_ad_OCSP         178
+#define OBJ_ad_OCSP         OBJ_id_ad,1L
 
-#define SN_ad_ca_issuers		"caIssuers"
-#define LN_ad_ca_issuers		"CA Issuers"
-#define NID_ad_ca_issuers		179
-#define OBJ_ad_ca_issuers		OBJ_id_ad,2L
+#define SN_ad_ca_issuers        "caIssuers"
+#define LN_ad_ca_issuers        "CA Issuers"
+#define NID_ad_ca_issuers       179
+#define OBJ_ad_ca_issuers       OBJ_id_ad,2L
 
-#define SN_OCSP_sign			"OCSPSigning"
-#define LN_OCSP_sign			"OCSP Signing"
-#define NID_OCSP_sign			180
-#define OBJ_OCSP_sign			OBJ_id_kp,9L
+#define SN_OCSP_sign            "OCSPSigning"
+#define LN_OCSP_sign            "OCSP Signing"
+#define NID_OCSP_sign           180
+#define OBJ_OCSP_sign           OBJ_id_kp,9L
 #endif /* USE_OBJ_MAC */
 
 #include 
 #include 
 
-#define	OBJ_NAME_TYPE_UNDEF		0x00
-#define	OBJ_NAME_TYPE_MD_METH		0x01
-#define	OBJ_NAME_TYPE_CIPHER_METH	0x02
-#define	OBJ_NAME_TYPE_PKEY_METH		0x03
-#define	OBJ_NAME_TYPE_COMP_METH		0x04
-#define	OBJ_NAME_TYPE_NUM		0x05
+#define OBJ_NAME_TYPE_UNDEF     0x00
+#define OBJ_NAME_TYPE_MD_METH       0x01
+#define OBJ_NAME_TYPE_CIPHER_METH   0x02
+#define OBJ_NAME_TYPE_PKEY_METH     0x03
+#define OBJ_NAME_TYPE_COMP_METH     0x04
+#define OBJ_NAME_TYPE_NUM       0x05
 
-#define	OBJ_NAME_ALIAS			0x8000
+#define OBJ_NAME_ALIAS          0x8000
 
-#define OBJ_BSEARCH_VALUE_ON_NOMATCH		0x01
-#define OBJ_BSEARCH_FIRST_VALUE_ON_MATCH	0x02
+#define OBJ_BSEARCH_VALUE_ON_NOMATCH        0x01
+#define OBJ_BSEARCH_FIRST_VALUE_ON_MATCH    0x02
 
 
 #ifdef  __cplusplus
@@ -977,50 +977,50 @@ extern "C" {
 #endif
 
 typedef struct obj_name_st
-	{
-	int type;
-	int alias;
-	const char *name;
-	const char *data;
-	} OBJ_NAME;
+    {
+    int type;
+    int alias;
+    const char *name;
+    const char *data;
+    } OBJ_NAME;
 
-#define		OBJ_create_and_add_object(a,b,c) OBJ_create(a,b,c)
+#define     OBJ_create_and_add_object(a,b,c) OBJ_create(a,b,c)
 
 
 int OBJ_NAME_init(void);
 int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *),
-		       int (*cmp_func)(const char *, const char *),
-		       void (*free_func)(const char *, int, const char *));
+               int (*cmp_func)(const char *, const char *),
+               void (*free_func)(const char *, int, const char *));
 const char *OBJ_NAME_get(const char *name,int type);
 int OBJ_NAME_add(const char *name,int type,const char *data);
 int OBJ_NAME_remove(const char *name,int type);
 void OBJ_NAME_cleanup(int type); /* -1 for everything */
 void OBJ_NAME_do_all(int type,void (*fn)(const OBJ_NAME *,void *arg),
-		     void *arg);
+             void *arg);
 void OBJ_NAME_do_all_sorted(int type,void (*fn)(const OBJ_NAME *,void *arg),
-			    void *arg);
+                void *arg);
 
-ASN1_OBJECT *	OBJ_dup(const ASN1_OBJECT *o);
-ASN1_OBJECT *	OBJ_nid2obj(int n);
-const char *	OBJ_nid2ln(int n);
-const char *	OBJ_nid2sn(int n);
-int		OBJ_obj2nid(const ASN1_OBJECT *o);
-ASN1_OBJECT *	OBJ_txt2obj(const char *s, int no_name);
-int	OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name);
-int		OBJ_txt2nid(const char *s);
-int		OBJ_ln2nid(const char *s);
-int		OBJ_sn2nid(const char *s);
-int		OBJ_cmp(const ASN1_OBJECT *a,const ASN1_OBJECT *b);
-const char *	OBJ_bsearch(const char *key,const char *base,int num,int size,
-	int (*cmp)(const void *, const void *));
-const char *	OBJ_bsearch_ex(const char *key,const char *base,int num,
-	int size, int (*cmp)(const void *, const void *), int flags);
+ASN1_OBJECT *   OBJ_dup(const ASN1_OBJECT *o);
+ASN1_OBJECT *   OBJ_nid2obj(int n);
+const char *    OBJ_nid2ln(int n);
+const char *    OBJ_nid2sn(int n);
+int     OBJ_obj2nid(const ASN1_OBJECT *o);
+ASN1_OBJECT *   OBJ_txt2obj(const char *s, int no_name);
+int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name);
+int     OBJ_txt2nid(const char *s);
+int     OBJ_ln2nid(const char *s);
+int     OBJ_sn2nid(const char *s);
+int     OBJ_cmp(const ASN1_OBJECT *a,const ASN1_OBJECT *b);
+const char *    OBJ_bsearch(const char *key,const char *base,int num,int size,
+    int (*cmp)(const void *, const void *));
+const char *    OBJ_bsearch_ex(const char *key,const char *base,int num,
+    int size, int (*cmp)(const void *, const void *), int flags);
 
-int		OBJ_new_nid(int num);
-int		OBJ_add_object(const ASN1_OBJECT *obj);
-int		OBJ_create(const char *oid,const char *sn,const char *ln);
-void		OBJ_cleanup(void );
-int		OBJ_create_objects(BIO *in);
+int     OBJ_new_nid(int num);
+int     OBJ_add_object(const ASN1_OBJECT *obj);
+int     OBJ_create(const char *oid,const char *sn,const char *ln);
+void        OBJ_cleanup(void );
+int     OBJ_create_objects(BIO *in);
 
 /* BEGIN ERROR CODES */
 /* The following lines are auto generated by the script mkerr.pl. Any changes
@@ -1031,17 +1031,17 @@ void ERR_load_OBJ_strings(void);
 /* Error codes for the OBJ functions. */
 
 /* Function codes. */
-#define OBJ_F_OBJ_ADD_OBJECT				 105
-#define OBJ_F_OBJ_CREATE				 100
-#define OBJ_F_OBJ_DUP					 101
-#define OBJ_F_OBJ_NAME_NEW_INDEX			 106
-#define OBJ_F_OBJ_NID2LN				 102
-#define OBJ_F_OBJ_NID2OBJ				 103
-#define OBJ_F_OBJ_NID2SN				 104
+#define OBJ_F_OBJ_ADD_OBJECT                 105
+#define OBJ_F_OBJ_CREATE                 100
+#define OBJ_F_OBJ_DUP                    101
+#define OBJ_F_OBJ_NAME_NEW_INDEX             106
+#define OBJ_F_OBJ_NID2LN                 102
+#define OBJ_F_OBJ_NID2OBJ                103
+#define OBJ_F_OBJ_NID2SN                 104
 
 /* Reason codes. */
-#define OBJ_R_MALLOC_FAILURE				 100
-#define OBJ_R_UNKNOWN_NID				 101
+#define OBJ_R_MALLOC_FAILURE                 100
+#define OBJ_R_UNKNOWN_NID                101
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/ocsp.h b/dep/include/openssl/ocsp.h
index 53f3364af0c..85e148be9cb 100644
--- a/dep/include/openssl/ocsp.h
+++ b/dep/include/openssl/ocsp.h
@@ -15,7 +15,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -74,20 +74,20 @@ extern "C" {
 
 /* Various flags and values */
 
-#define OCSP_DEFAULT_NONCE_LENGTH	16
+#define OCSP_DEFAULT_NONCE_LENGTH   16
 
-#define OCSP_NOCERTS			0x1
-#define OCSP_NOINTERN			0x2
-#define OCSP_NOSIGS			0x4
-#define OCSP_NOCHAIN			0x8
-#define OCSP_NOVERIFY			0x10
-#define OCSP_NOEXPLICIT			0x20
-#define OCSP_NOCASIGN			0x40
-#define OCSP_NODELEGATED		0x80
-#define OCSP_NOCHECKS			0x100
-#define OCSP_TRUSTOTHER			0x200
-#define OCSP_RESPID_KEY			0x400
-#define OCSP_NOTIME			0x800
+#define OCSP_NOCERTS            0x1
+#define OCSP_NOINTERN           0x2
+#define OCSP_NOSIGS         0x4
+#define OCSP_NOCHAIN            0x8
+#define OCSP_NOVERIFY           0x10
+#define OCSP_NOEXPLICIT         0x20
+#define OCSP_NOCASIGN           0x40
+#define OCSP_NODELEGATED        0x80
+#define OCSP_NOCHECKS           0x100
+#define OCSP_TRUSTOTHER         0x200
+#define OCSP_RESPID_KEY         0x400
+#define OCSP_NOTIME         0x800
 
 /*   CertID ::= SEQUENCE {
  *       hashAlgorithm            AlgorithmIdentifier,
@@ -96,12 +96,12 @@ extern "C" {
  *       serialNumber       CertificateSerialNumber }
  */
 typedef struct ocsp_cert_id_st
-	{
-	X509_ALGOR *hashAlgorithm;
-	ASN1_OCTET_STRING *issuerNameHash;
-	ASN1_OCTET_STRING *issuerKeyHash;
-	ASN1_INTEGER *serialNumber;
-	} OCSP_CERTID;
+    {
+    X509_ALGOR *hashAlgorithm;
+    ASN1_OCTET_STRING *issuerNameHash;
+    ASN1_OCTET_STRING *issuerKeyHash;
+    ASN1_INTEGER *serialNumber;
+    } OCSP_CERTID;
 
 DECLARE_STACK_OF(OCSP_CERTID)
 
@@ -110,10 +110,10 @@ DECLARE_STACK_OF(OCSP_CERTID)
  *       singleRequestExtensions    [0] EXPLICIT Extensions OPTIONAL }
  */
 typedef struct ocsp_one_request_st
-	{
-	OCSP_CERTID *reqCert;
-	STACK_OF(X509_EXTENSION) *singleRequestExtensions;
-	} OCSP_ONEREQ;
+    {
+    OCSP_CERTID *reqCert;
+    STACK_OF(X509_EXTENSION) *singleRequestExtensions;
+    } OCSP_ONEREQ;
 
 DECLARE_STACK_OF(OCSP_ONEREQ)
 DECLARE_ASN1_SET_OF(OCSP_ONEREQ)
@@ -126,12 +126,12 @@ DECLARE_ASN1_SET_OF(OCSP_ONEREQ)
  *       requestExtensions   [2] EXPLICIT Extensions OPTIONAL }
  */
 typedef struct ocsp_req_info_st
-	{
-	ASN1_INTEGER *version;
-	GENERAL_NAME *requestorName;
-	STACK_OF(OCSP_ONEREQ) *requestList;
-	STACK_OF(X509_EXTENSION) *requestExtensions;
-	} OCSP_REQINFO;
+    {
+    ASN1_INTEGER *version;
+    GENERAL_NAME *requestorName;
+    STACK_OF(OCSP_ONEREQ) *requestList;
+    STACK_OF(X509_EXTENSION) *requestExtensions;
+    } OCSP_REQINFO;
 
 /*   Signature       ::=     SEQUENCE {
  *       signatureAlgorithm   AlgorithmIdentifier,
@@ -139,21 +139,21 @@ typedef struct ocsp_req_info_st
  *       certs                [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }
  */
 typedef struct ocsp_signature_st
-	{
-	X509_ALGOR *signatureAlgorithm;
-	ASN1_BIT_STRING *signature;
-	STACK_OF(X509) *certs;
-	} OCSP_SIGNATURE;
+    {
+    X509_ALGOR *signatureAlgorithm;
+    ASN1_BIT_STRING *signature;
+    STACK_OF(X509) *certs;
+    } OCSP_SIGNATURE;
 
 /*   OCSPRequest     ::=     SEQUENCE {
  *       tbsRequest                  TBSRequest,
  *       optionalSignature   [0]     EXPLICIT Signature OPTIONAL }
  */
 typedef struct ocsp_request_st
-	{
-	OCSP_REQINFO *tbsRequest;
-	OCSP_SIGNATURE *optionalSignature; /* OPTIONAL */
-	} OCSP_REQUEST;
+    {
+    OCSP_REQINFO *tbsRequest;
+    OCSP_SIGNATURE *optionalSignature; /* OPTIONAL */
+    } OCSP_REQUEST;
 
 /*   OCSPResponseStatus ::= ENUMERATED {
  *       successful            (0),      --Response has valid confirmations
@@ -177,20 +177,20 @@ typedef struct ocsp_request_st
  *       response       OCTET STRING }
  */
 typedef struct ocsp_resp_bytes_st
-	{
-	ASN1_OBJECT *responseType;
-	ASN1_OCTET_STRING *response;
-	} OCSP_RESPBYTES;
+    {
+    ASN1_OBJECT *responseType;
+    ASN1_OCTET_STRING *response;
+    } OCSP_RESPBYTES;
 
 /*   OCSPResponse ::= SEQUENCE {
  *      responseStatus         OCSPResponseStatus,
  *      responseBytes          [0] EXPLICIT ResponseBytes OPTIONAL }
  */
 typedef struct ocsp_response_st
-	{
-	ASN1_ENUMERATED *responseStatus;
-	OCSP_RESPBYTES  *responseBytes;
-	} OCSP_RESPONSE;
+    {
+    ASN1_ENUMERATED *responseStatus;
+    OCSP_RESPBYTES  *responseBytes;
+    } OCSP_RESPONSE;
 
 /*   ResponderID ::= CHOICE {
  *      byName   [1] Name,
@@ -199,13 +199,13 @@ typedef struct ocsp_response_st
 #define V_OCSP_RESPID_NAME 0
 #define V_OCSP_RESPID_KEY  1
 typedef struct ocsp_responder_id_st
-	{
-	int type;
-	union   {
-		X509_NAME* byName;
-        	ASN1_OCTET_STRING *byKey;
-		} value;
-	} OCSP_RESPID;
+    {
+    int type;
+    union   {
+        X509_NAME* byName;
+            ASN1_OCTET_STRING *byKey;
+        } value;
+    } OCSP_RESPID;
 /*   KeyHash ::= OCTET STRING --SHA-1 hash of responder's public key
  *                            --(excluding the tag and length fields)
  */
@@ -215,10 +215,10 @@ typedef struct ocsp_responder_id_st
  *       revocationReason    [0]     EXPLICIT CRLReason OPTIONAL }
  */
 typedef struct ocsp_revoked_info_st
-	{
-	ASN1_GENERALIZEDTIME *revocationTime;
-	ASN1_ENUMERATED *revocationReason;
-	} OCSP_REVOKEDINFO;
+    {
+    ASN1_GENERALIZEDTIME *revocationTime;
+    ASN1_ENUMERATED *revocationReason;
+    } OCSP_REVOKEDINFO;
 
 /*   CertStatus ::= CHOICE {
  *       good                [0]     IMPLICIT NULL,
@@ -229,14 +229,14 @@ typedef struct ocsp_revoked_info_st
 #define V_OCSP_CERTSTATUS_REVOKED 1
 #define V_OCSP_CERTSTATUS_UNKNOWN 2
 typedef struct ocsp_cert_status_st
-	{
-	int type;
-	union	{
-		ASN1_NULL *good;
-		OCSP_REVOKEDINFO *revoked;
-		ASN1_NULL *unknown;
-		} value;
-	} OCSP_CERTSTATUS;
+    {
+    int type;
+    union   {
+        ASN1_NULL *good;
+        OCSP_REVOKEDINFO *revoked;
+        ASN1_NULL *unknown;
+        } value;
+    } OCSP_CERTSTATUS;
 
 /*   SingleResponse ::= SEQUENCE {
  *      certID                       CertID,
@@ -246,13 +246,13 @@ typedef struct ocsp_cert_status_st
  *      singleExtensions     [1]     EXPLICIT Extensions OPTIONAL }
  */
 typedef struct ocsp_single_response_st
-	{
-	OCSP_CERTID *certId;
-	OCSP_CERTSTATUS *certStatus;
-	ASN1_GENERALIZEDTIME *thisUpdate;
-	ASN1_GENERALIZEDTIME *nextUpdate;
-	STACK_OF(X509_EXTENSION) *singleExtensions;
-	} OCSP_SINGLERESP;
+    {
+    OCSP_CERTID *certId;
+    OCSP_CERTSTATUS *certStatus;
+    ASN1_GENERALIZEDTIME *thisUpdate;
+    ASN1_GENERALIZEDTIME *nextUpdate;
+    STACK_OF(X509_EXTENSION) *singleExtensions;
+    } OCSP_SINGLERESP;
 
 DECLARE_STACK_OF(OCSP_SINGLERESP)
 DECLARE_ASN1_SET_OF(OCSP_SINGLERESP)
@@ -265,13 +265,13 @@ DECLARE_ASN1_SET_OF(OCSP_SINGLERESP)
  *      responseExtensions   [1] EXPLICIT Extensions OPTIONAL }
  */
 typedef struct ocsp_response_data_st
-	{
-	ASN1_INTEGER *version;
-	OCSP_RESPID  *responderId;
-	ASN1_GENERALIZEDTIME *producedAt;
-	STACK_OF(OCSP_SINGLERESP) *responses;
-	STACK_OF(X509_EXTENSION) *responseExtensions;
-	} OCSP_RESPDATA;
+    {
+    ASN1_INTEGER *version;
+    OCSP_RESPID  *responderId;
+    ASN1_GENERALIZEDTIME *producedAt;
+    STACK_OF(OCSP_SINGLERESP) *responses;
+    STACK_OF(X509_EXTENSION) *responseExtensions;
+    } OCSP_RESPDATA;
 
 /*   BasicOCSPResponse       ::= SEQUENCE {
  *      tbsResponseData      ResponseData,
@@ -288,20 +288,20 @@ typedef struct ocsp_response_data_st
      a bit odd, but that's the spec.  Also note that the data structures do not
      leave anywhere to independently specify the algorithm used for the initial
      hash. So, we look at the signature-specification algorithm, and try to do
-     something intelligent.	-- Kathy Weinhold, CertCo */
+     something intelligent. -- Kathy Weinhold, CertCo */
   /* Note 2:
      It seems that the mentioned passage from RFC 2560 (section 4.2.1) is open
      for interpretation.  I've done tests against another responder, and found
      that it doesn't do the double hashing that the RFC seems to say one
      should.  Therefore, all relevant functions take a flag saying which
-     variant should be used.	-- Richard Levitte, OpenSSL team and CeloCom */
+     variant should be used.    -- Richard Levitte, OpenSSL team and CeloCom */
 typedef struct ocsp_basic_response_st
-	{
-	OCSP_RESPDATA *tbsResponseData;
-	X509_ALGOR *signatureAlgorithm;
-	ASN1_BIT_STRING *signature;
-	STACK_OF(X509) *certs;
-	} OCSP_BASICRESP;
+    {
+    OCSP_RESPDATA *tbsResponseData;
+    X509_ALGOR *signatureAlgorithm;
+    ASN1_BIT_STRING *signature;
+    STACK_OF(X509) *certs;
+    } OCSP_BASICRESP;
 
 /*
  *   CRLReason ::= ENUMERATED {
@@ -331,9 +331,9 @@ typedef struct ocsp_basic_response_st
  */
 typedef struct ocsp_crl_id_st
         {
-	ASN1_IA5STRING *crlUrl;
-	ASN1_INTEGER *crlNum;
-	ASN1_GENERALIZEDTIME *crlTime;
+    ASN1_IA5STRING *crlUrl;
+    ASN1_INTEGER *crlNum;
+    ASN1_GENERALIZEDTIME *crlTime;
         } OCSP_CRLID;
 
 /* ServiceLocator ::= SEQUENCE {
@@ -342,68 +342,68 @@ typedef struct ocsp_crl_id_st
  */
 typedef struct ocsp_service_locator_st
         {
-	X509_NAME* issuer;
-	STACK_OF(ACCESS_DESCRIPTION) *locator;
+    X509_NAME* issuer;
+    STACK_OF(ACCESS_DESCRIPTION) *locator;
         } OCSP_SERVICELOC;
- 
-#define PEM_STRING_OCSP_REQUEST	"OCSP REQUEST"
+
+#define PEM_STRING_OCSP_REQUEST "OCSP REQUEST"
 #define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE"
 
 #define d2i_OCSP_REQUEST_bio(bp,p) ASN1_d2i_bio_of(OCSP_REQUEST,OCSP_REQUEST_new,d2i_OCSP_REQUEST,bp,p)
 
 #define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p)
 
-#define	PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \
+#define PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \
      (char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,bp,(char **)x,cb,NULL)
 
-#define	PEM_read_bio_OCSP_RESPONSE(bp,x,cb)(OCSP_RESPONSE *)PEM_ASN1_read_bio(\
+#define PEM_read_bio_OCSP_RESPONSE(bp,x,cb)(OCSP_RESPONSE *)PEM_ASN1_read_bio(\
      (char *(*)())d2i_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,bp,(char **)x,cb,NULL)
 
 #define PEM_write_bio_OCSP_REQUEST(bp,o) \
     PEM_ASN1_write_bio((int (*)())i2d_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,\
-			bp,(char *)o, NULL,NULL,0,NULL,NULL)
+            bp,(char *)o, NULL,NULL,0,NULL,NULL)
 
 #define PEM_write_bio_OCSP_RESPONSE(bp,o) \
     PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\
-			bp,(char *)o, NULL,NULL,0,NULL,NULL)
+            bp,(char *)o, NULL,NULL,0,NULL,NULL)
 
 #define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio_of(OCSP_RESPONSE,i2d_OCSP_RESPONSE,bp,o)
 
 #define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio_of(OCSP_REQUEST,i2d_OCSP_REQUEST,bp,o)
 
 #define OCSP_REQUEST_sign(o,pkey,md) \
-	ASN1_item_sign(ASN1_ITEM_rptr(OCSP_REQINFO),\
-		o->optionalSignature->signatureAlgorithm,NULL,\
-	        o->optionalSignature->signature,o->tbsRequest,pkey,md)
+    ASN1_item_sign(ASN1_ITEM_rptr(OCSP_REQINFO),\
+        o->optionalSignature->signatureAlgorithm,NULL,\
+            o->optionalSignature->signature,o->tbsRequest,pkey,md)
 
 #define OCSP_BASICRESP_sign(o,pkey,md,d) \
-	ASN1_item_sign(ASN1_ITEM_rptr(OCSP_RESPDATA),o->signatureAlgorithm,NULL,\
-		o->signature,o->tbsResponseData,pkey,md)
+    ASN1_item_sign(ASN1_ITEM_rptr(OCSP_RESPDATA),o->signatureAlgorithm,NULL,\
+        o->signature,o->tbsResponseData,pkey,md)
 
 #define OCSP_REQUEST_verify(a,r) ASN1_item_verify(ASN1_ITEM_rptr(OCSP_REQINFO),\
         a->optionalSignature->signatureAlgorithm,\
-	a->optionalSignature->signature,a->tbsRequest,r)
+    a->optionalSignature->signature,a->tbsRequest,r)
 
 #define OCSP_BASICRESP_verify(a,r,d) ASN1_item_verify(ASN1_ITEM_rptr(OCSP_RESPDATA),\
-	a->signatureAlgorithm,a->signature,a->tbsResponseData,r)
+    a->signatureAlgorithm,a->signature,a->tbsResponseData,r)
 
 #define ASN1_BIT_STRING_digest(data,type,md,len) \
-	ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len)
+    ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len)
 
 #define OCSP_CERTID_dup(cid) ASN1_dup_of(OCSP_CERTID,i2d_OCSP_CERTID,d2i_OCSP_CERTID,cid)
 
 #define OCSP_CERTSTATUS_dup(cs)\
                 (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\
-		(char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs))
+        (char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs))
 
 OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, char *path, OCSP_REQUEST *req);
 
 OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, X509 *subject, X509 *issuer);
 
-OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst, 
-			      X509_NAME *issuerName, 
-			      ASN1_BIT_STRING* issuerKey, 
-			      ASN1_INTEGER *serialNumber);
+OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst,
+                  X509_NAME *issuerName,
+                  ASN1_BIT_STRING* issuerKey,
+                  ASN1_INTEGER *serialNumber);
 
 OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid);
 
@@ -416,11 +416,11 @@ int OCSP_request_set1_name(OCSP_REQUEST *req, X509_NAME *nm);
 int OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert);
 
 int OCSP_request_sign(OCSP_REQUEST   *req,
-		      X509           *signer,
-		      EVP_PKEY       *key,
-		      const EVP_MD   *dgst,
-		      STACK_OF(X509) *certs,
-		      unsigned long flags);
+              X509           *signer,
+              EVP_PKEY       *key,
+              const EVP_MD   *dgst,
+              STACK_OF(X509) *certs,
+              unsigned long flags);
 
 int OCSP_response_status(OCSP_RESPONSE *resp);
 OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp);
@@ -429,17 +429,17 @@ int OCSP_resp_count(OCSP_BASICRESP *bs);
 OCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx);
 int OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last);
 int OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason,
-				ASN1_GENERALIZEDTIME **revtime,
-				ASN1_GENERALIZEDTIME **thisupd,
-				ASN1_GENERALIZEDTIME **nextupd);
+                ASN1_GENERALIZEDTIME **revtime,
+                ASN1_GENERALIZEDTIME **thisupd,
+                ASN1_GENERALIZEDTIME **nextupd);
 int OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status,
-				int *reason,
-				ASN1_GENERALIZEDTIME **revtime,
-				ASN1_GENERALIZEDTIME **thisupd,
-				ASN1_GENERALIZEDTIME **nextupd);
+                int *reason,
+                ASN1_GENERALIZEDTIME **revtime,
+                ASN1_GENERALIZEDTIME **thisupd,
+                ASN1_GENERALIZEDTIME **nextupd);
 int OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd,
-			ASN1_GENERALIZEDTIME *nextupd,
-			long sec, long maxsec);
+            ASN1_GENERALIZEDTIME *nextupd,
+            long sec, long maxsec);
 
 int OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs, X509_STORE *store, unsigned long flags);
 
@@ -452,22 +452,22 @@ int OCSP_request_onereq_count(OCSP_REQUEST *req);
 OCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i);
 OCSP_CERTID *OCSP_onereq_get0_id(OCSP_ONEREQ *one);
 int OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd,
-			ASN1_OCTET_STRING **pikeyHash,
-			ASN1_INTEGER **pserial, OCSP_CERTID *cid);
+            ASN1_OCTET_STRING **pikeyHash,
+            ASN1_INTEGER **pserial, OCSP_CERTID *cid);
 int OCSP_request_is_signed(OCSP_REQUEST *req);
 OCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs);
 OCSP_SINGLERESP *OCSP_basic_add1_status(OCSP_BASICRESP *rsp,
-						OCSP_CERTID *cid,
-						int status, int reason,
-						ASN1_TIME *revtime,
-					ASN1_TIME *thisupd, ASN1_TIME *nextupd);
+                        OCSP_CERTID *cid,
+                        int status, int reason,
+                        ASN1_TIME *revtime,
+                    ASN1_TIME *thisupd, ASN1_TIME *nextupd);
 int OCSP_basic_add1_cert(OCSP_BASICRESP *resp, X509 *cert);
-int OCSP_basic_sign(OCSP_BASICRESP *brsp, 
-			X509 *signer, EVP_PKEY *key, const EVP_MD *dgst,
-			STACK_OF(X509) *certs, unsigned long flags);
+int OCSP_basic_sign(OCSP_BASICRESP *brsp,
+            X509 *signer, EVP_PKEY *key, const EVP_MD *dgst,
+            STACK_OF(X509) *certs, unsigned long flags);
 
 ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d,
-				void *data, STACK_OF(ASN1_OBJECT) *sk);
+                void *data, STACK_OF(ASN1_OBJECT) *sk);
 #define ASN1_STRING_encode_of(type,s,i2d,data,sk) \
 ((ASN1_STRING *(*)(ASN1_STRING *,I2D_OF(type),type *,STACK_OF(ASN1_OBJECT) *))openssl_fcast(ASN1_STRING_encode))(s,i2d,data,sk)
 
@@ -487,7 +487,7 @@ X509_EXTENSION *OCSP_REQUEST_get_ext(OCSP_REQUEST *x, int loc);
 X509_EXTENSION *OCSP_REQUEST_delete_ext(OCSP_REQUEST *x, int loc);
 void *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit, int *idx);
 int OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value, int crit,
-							unsigned long flags);
+                            unsigned long flags);
 int OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc);
 
 int OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ *x);
@@ -498,7 +498,7 @@ X509_EXTENSION *OCSP_ONEREQ_get_ext(OCSP_ONEREQ *x, int loc);
 X509_EXTENSION *OCSP_ONEREQ_delete_ext(OCSP_ONEREQ *x, int loc);
 void *OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ *x, int nid, int *crit, int *idx);
 int OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit,
-							unsigned long flags);
+                            unsigned long flags);
 int OCSP_ONEREQ_add_ext(OCSP_ONEREQ *x, X509_EXTENSION *ex, int loc);
 
 int OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP *x);
@@ -509,7 +509,7 @@ X509_EXTENSION *OCSP_BASICRESP_get_ext(OCSP_BASICRESP *x, int loc);
 X509_EXTENSION *OCSP_BASICRESP_delete_ext(OCSP_BASICRESP *x, int loc);
 void *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit, int *idx);
 int OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value, int crit,
-							unsigned long flags);
+                            unsigned long flags);
 int OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc);
 
 int OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP *x);
@@ -520,7 +520,7 @@ X509_EXTENSION *OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP *x, int loc);
 X509_EXTENSION *OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP *x, int loc);
 void *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit, int *idx);
 int OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value, int crit,
-							unsigned long flags);
+                            unsigned long flags);
 int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc);
 
 DECLARE_ASN1_FUNCTIONS(OCSP_SINGLERESP)
@@ -547,7 +547,7 @@ int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST* a, unsigned long flags);
 int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags);
 
 int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs,
-				X509_STORE *st, unsigned long flags);
+                X509_STORE *st, unsigned long flags);
 
 /* BEGIN ERROR CODES */
 /* The following lines are auto generated by the script mkerr.pl. Any changes
@@ -558,55 +558,55 @@ void ERR_load_OCSP_strings(void);
 /* Error codes for the OCSP functions. */
 
 /* Function codes. */
-#define OCSP_F_ASN1_STRING_ENCODE			 100
-#define OCSP_F_D2I_OCSP_NONCE				 102
-#define OCSP_F_OCSP_BASIC_ADD1_STATUS			 103
-#define OCSP_F_OCSP_BASIC_SIGN				 104
-#define OCSP_F_OCSP_BASIC_VERIFY			 105
-#define OCSP_F_OCSP_CERT_ID_NEW				 101
-#define OCSP_F_OCSP_CHECK_DELEGATED			 106
-#define OCSP_F_OCSP_CHECK_IDS				 107
-#define OCSP_F_OCSP_CHECK_ISSUER			 108
-#define OCSP_F_OCSP_CHECK_VALIDITY			 115
-#define OCSP_F_OCSP_MATCH_ISSUERID			 109
-#define OCSP_F_OCSP_PARSE_URL				 114
-#define OCSP_F_OCSP_REQUEST_SIGN			 110
-#define OCSP_F_OCSP_REQUEST_VERIFY			 116
-#define OCSP_F_OCSP_RESPONSE_GET1_BASIC			 111
-#define OCSP_F_OCSP_SENDREQ_BIO				 112
-#define OCSP_F_REQUEST_VERIFY				 113
+#define OCSP_F_ASN1_STRING_ENCODE            100
+#define OCSP_F_D2I_OCSP_NONCE                102
+#define OCSP_F_OCSP_BASIC_ADD1_STATUS            103
+#define OCSP_F_OCSP_BASIC_SIGN               104
+#define OCSP_F_OCSP_BASIC_VERIFY             105
+#define OCSP_F_OCSP_CERT_ID_NEW              101
+#define OCSP_F_OCSP_CHECK_DELEGATED          106
+#define OCSP_F_OCSP_CHECK_IDS                107
+#define OCSP_F_OCSP_CHECK_ISSUER             108
+#define OCSP_F_OCSP_CHECK_VALIDITY           115
+#define OCSP_F_OCSP_MATCH_ISSUERID           109
+#define OCSP_F_OCSP_PARSE_URL                114
+#define OCSP_F_OCSP_REQUEST_SIGN             110
+#define OCSP_F_OCSP_REQUEST_VERIFY           116
+#define OCSP_F_OCSP_RESPONSE_GET1_BASIC          111
+#define OCSP_F_OCSP_SENDREQ_BIO              112
+#define OCSP_F_REQUEST_VERIFY                113
 
 /* Reason codes. */
-#define OCSP_R_BAD_DATA					 100
-#define OCSP_R_CERTIFICATE_VERIFY_ERROR			 101
-#define OCSP_R_DIGEST_ERR				 102
-#define OCSP_R_ERROR_IN_NEXTUPDATE_FIELD		 122
-#define OCSP_R_ERROR_IN_THISUPDATE_FIELD		 123
-#define OCSP_R_ERROR_PARSING_URL			 121
-#define OCSP_R_MISSING_OCSPSIGNING_USAGE		 103
-#define OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE		 124
-#define OCSP_R_NOT_BASIC_RESPONSE			 104
-#define OCSP_R_NO_CERTIFICATES_IN_CHAIN			 105
-#define OCSP_R_NO_CONTENT				 106
-#define OCSP_R_NO_PUBLIC_KEY				 107
-#define OCSP_R_NO_RESPONSE_DATA				 108
-#define OCSP_R_NO_REVOKED_TIME				 109
-#define OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE	 110
-#define OCSP_R_REQUEST_NOT_SIGNED			 128
-#define OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA	 111
-#define OCSP_R_ROOT_CA_NOT_TRUSTED			 112
-#define OCSP_R_SERVER_READ_ERROR			 113
-#define OCSP_R_SERVER_RESPONSE_ERROR			 114
-#define OCSP_R_SERVER_RESPONSE_PARSE_ERROR		 115
-#define OCSP_R_SERVER_WRITE_ERROR			 116
-#define OCSP_R_SIGNATURE_FAILURE			 117
-#define OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND		 118
-#define OCSP_R_STATUS_EXPIRED				 125
-#define OCSP_R_STATUS_NOT_YET_VALID			 126
-#define OCSP_R_STATUS_TOO_OLD				 127
-#define OCSP_R_UNKNOWN_MESSAGE_DIGEST			 119
-#define OCSP_R_UNKNOWN_NID				 120
-#define OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE		 129
+#define OCSP_R_BAD_DATA                  100
+#define OCSP_R_CERTIFICATE_VERIFY_ERROR          101
+#define OCSP_R_DIGEST_ERR                102
+#define OCSP_R_ERROR_IN_NEXTUPDATE_FIELD         122
+#define OCSP_R_ERROR_IN_THISUPDATE_FIELD         123
+#define OCSP_R_ERROR_PARSING_URL             121
+#define OCSP_R_MISSING_OCSPSIGNING_USAGE         103
+#define OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE      124
+#define OCSP_R_NOT_BASIC_RESPONSE            104
+#define OCSP_R_NO_CERTIFICATES_IN_CHAIN          105
+#define OCSP_R_NO_CONTENT                106
+#define OCSP_R_NO_PUBLIC_KEY                 107
+#define OCSP_R_NO_RESPONSE_DATA              108
+#define OCSP_R_NO_REVOKED_TIME               109
+#define OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE    110
+#define OCSP_R_REQUEST_NOT_SIGNED            128
+#define OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA  111
+#define OCSP_R_ROOT_CA_NOT_TRUSTED           112
+#define OCSP_R_SERVER_READ_ERROR             113
+#define OCSP_R_SERVER_RESPONSE_ERROR             114
+#define OCSP_R_SERVER_RESPONSE_PARSE_ERROR       115
+#define OCSP_R_SERVER_WRITE_ERROR            116
+#define OCSP_R_SIGNATURE_FAILURE             117
+#define OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND      118
+#define OCSP_R_STATUS_EXPIRED                125
+#define OCSP_R_STATUS_NOT_YET_VALID          126
+#define OCSP_R_STATUS_TOO_OLD                127
+#define OCSP_R_UNKNOWN_MESSAGE_DIGEST            119
+#define OCSP_R_UNKNOWN_NID               120
+#define OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE        129
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/opensslconf.h b/dep/include/openssl/opensslconf.h
index 4620e0e530e..8073c136922 100644
--- a/dep/include/openssl/opensslconf.h
+++ b/dep/include/openssl/opensslconf.h
@@ -179,31 +179,31 @@ YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
    even newer MIPS CPU's, but at the moment one size fits all for
    optimization options.  Older Sparc's work better with only UNROLL, but
    there's no way to tell at compile time what it is you're running on */
- 
-#if defined( sun )		/* Newer Sparc's */
+
+#if defined( sun )      /* Newer Sparc's */
 #  define DES_PTR
 #  define DES_RISC1
 #  define DES_UNROLL
-#elif defined( __ultrix )	/* Older MIPS */
+#elif defined( __ultrix )   /* Older MIPS */
 #  define DES_PTR
 #  define DES_RISC2
 #  define DES_UNROLL
-#elif defined( __osf1__ )	/* Alpha */
+#elif defined( __osf1__ )   /* Alpha */
 #  define DES_PTR
 #  define DES_RISC2
-#elif defined ( _AIX )		/* RS6000 */
+#elif defined ( _AIX )      /* RS6000 */
   /* Unknown */
-#elif defined( __hpux )		/* HP-PA */
+#elif defined( __hpux )     /* HP-PA */
   /* Unknown */
-#elif defined( __aux )		/* 68K */
+#elif defined( __aux )      /* 68K */
   /* Unknown */
-#elif defined( __dgux )		/* 88K (but P6 in latest boxes) */
+#elif defined( __dgux )     /* 88K (but P6 in latest boxes) */
 #  define DES_UNROLL
-#elif defined( __sgi )		/* Newer MIPS */
+#elif defined( __sgi )      /* Newer MIPS */
 #  define DES_PTR
 #  define DES_RISC2
 #  define DES_UNROLL
-#elif defined(i386) || defined(__i386__)	/* x86 boxes, should be gcc */
+#elif defined(i386) || defined(__i386__)    /* x86 boxes, should be gcc */
 #  define DES_PTR
 #  define DES_RISC1
 #  define DES_UNROLL
diff --git a/dep/include/openssl/opensslv.h b/dep/include/openssl/opensslv.h
index 8a5b34e4f07..fb9072ec8b1 100644
--- a/dep/include/openssl/opensslv.h
+++ b/dep/include/openssl/opensslv.h
@@ -6,14 +6,14 @@
  * The status nibble has one of the values 0 for development, 1 to e for betas
  * 1 to 14, and f for release.  The patch level is exactly that.
  * For example:
- * 0.9.3-dev	  0x00903000
- * 0.9.3-beta1	  0x00903001
+ * 0.9.3-dev      0x00903000
+ * 0.9.3-beta1    0x00903001
  * 0.9.3-beta2-dev 0x00903002
  * 0.9.3-beta2    0x00903002 (same as ...beta2-dev)
- * 0.9.3	  0x0090300f
- * 0.9.3a	  0x0090301f
- * 0.9.4	  0x0090400f
- * 1.2.3z	  0x102031af
+ * 0.9.3      0x0090300f
+ * 0.9.3a     0x0090301f
+ * 0.9.4      0x0090400f
+ * 1.2.3z     0x102031af
  *
  * For continuity reasons (because 0.9.5 is already out, and is coded
  * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level
@@ -25,13 +25,13 @@
  * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
  *  major minor fix final patch/beta)
  */
-#define OPENSSL_VERSION_NUMBER	0x0090805fL
+#define OPENSSL_VERSION_NUMBER  0x0090805fL
 #ifdef OPENSSL_FIPS
-#define OPENSSL_VERSION_TEXT	"OpenSSL 0.9.8e-fips 23 Feb 2007"
+#define OPENSSL_VERSION_TEXT    "OpenSSL 0.9.8e-fips 23 Feb 2007"
 #else
-#define OPENSSL_VERSION_TEXT	"OpenSSL 0.9.8e 23 Feb 2007"
+#define OPENSSL_VERSION_TEXT    "OpenSSL 0.9.8e 23 Feb 2007"
 #endif
-#define OPENSSL_VERSION_PTEXT	" part of " OPENSSL_VERSION_TEXT
+#define OPENSSL_VERSION_PTEXT   " part of " OPENSSL_VERSION_TEXT
 
 
 /* The macros below are to be used for shared library (.so, .dll, ...)
@@ -42,11 +42,11 @@
  * be greater or equal to what it was at application link time.  With this
  * scheme, the version number is usually part of the file name, like this:
  *
- *	libcrypto.so.0.9
+ *  libcrypto.so.0.9
  *
  * Some unixen also make a softlink with the major verson number only:
  *
- *	libcrypto.so.0
+ *  libcrypto.so.0
  *
  * On Tru64 and IRIX 6.x it works a little bit differently.  There, the
  * shared library version is stored in the file, and is actually a series
@@ -61,11 +61,11 @@
  * to highest, should be part of the string.  Consecutive builds would
  * give the following versions strings:
  *
- *	3.0
- *	3.0:3.1
- *	3.0:3.1:3.2
- *	4.0
- *	4.0:4.1
+ *  3.0
+ *  3.0:3.1
+ *  3.0:3.1:3.2
+ *  4.0
+ *  4.0:4.1
  *
  * Notice how version 4 is completely incompatible with version, and
  * therefore give the breach you can see.
diff --git a/dep/include/openssl/ossl_typ.h b/dep/include/openssl/ossl_typ.h
index 9c335a18190..5150bee0e36 100644
--- a/dep/include/openssl/ossl_typ.h
+++ b/dep/include/openssl/ossl_typ.h
@@ -6,7 +6,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -58,23 +58,23 @@
 #include 
 
 #ifdef NO_ASN1_TYPEDEFS
-#define ASN1_INTEGER		ASN1_STRING
-#define ASN1_ENUMERATED		ASN1_STRING
-#define ASN1_BIT_STRING		ASN1_STRING
-#define ASN1_OCTET_STRING	ASN1_STRING
-#define ASN1_PRINTABLESTRING	ASN1_STRING
-#define ASN1_T61STRING		ASN1_STRING
-#define ASN1_IA5STRING		ASN1_STRING
-#define ASN1_UTCTIME		ASN1_STRING
-#define ASN1_GENERALIZEDTIME	ASN1_STRING
-#define ASN1_TIME		ASN1_STRING
-#define ASN1_GENERALSTRING	ASN1_STRING
-#define ASN1_UNIVERSALSTRING	ASN1_STRING
-#define ASN1_BMPSTRING		ASN1_STRING
-#define ASN1_VISIBLESTRING	ASN1_STRING
-#define ASN1_UTF8STRING		ASN1_STRING
-#define ASN1_BOOLEAN		int
-#define ASN1_NULL		int
+#define ASN1_INTEGER        ASN1_STRING
+#define ASN1_ENUMERATED     ASN1_STRING
+#define ASN1_BIT_STRING     ASN1_STRING
+#define ASN1_OCTET_STRING   ASN1_STRING
+#define ASN1_PRINTABLESTRING    ASN1_STRING
+#define ASN1_T61STRING      ASN1_STRING
+#define ASN1_IA5STRING      ASN1_STRING
+#define ASN1_UTCTIME        ASN1_STRING
+#define ASN1_GENERALIZEDTIME    ASN1_STRING
+#define ASN1_TIME       ASN1_STRING
+#define ASN1_GENERALSTRING  ASN1_STRING
+#define ASN1_UNIVERSALSTRING    ASN1_STRING
+#define ASN1_BMPSTRING      ASN1_STRING
+#define ASN1_VISIBLESTRING  ASN1_STRING
+#define ASN1_UTF8STRING     ASN1_STRING
+#define ASN1_BOOLEAN        int
+#define ASN1_NULL       int
 #else
 typedef struct asn1_string_st ASN1_INTEGER;
 typedef struct asn1_string_st ASN1_ENUMERATED;
@@ -165,10 +165,10 @@ typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE;
 typedef struct crypto_ex_data_st CRYPTO_EX_DATA;
 /* Callback types for crypto.h */
 typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
-					int idx, long argl, void *argp);
+                    int idx, long argl, void *argp);
 typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
-					int idx, long argl, void *argp);
-typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, 
-					int idx, long argl, void *argp);
+                    int idx, long argl, void *argp);
+typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d,
+                    int idx, long argl, void *argp);
 
 #endif /* def HEADER_OPENSSL_TYPES_H */
diff --git a/dep/include/openssl/pem.h b/dep/include/openssl/pem.h
index c28706ddc03..9fb9a7f7af8 100644
--- a/dep/include/openssl/pem.h
+++ b/dep/include/openssl/pem.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -74,28 +74,28 @@
 extern "C" {
 #endif
 
-#define PEM_BUFSIZE		1024
+#define PEM_BUFSIZE     1024
 
-#define PEM_OBJ_UNDEF		0
-#define PEM_OBJ_X509		1
-#define PEM_OBJ_X509_REQ	2
-#define PEM_OBJ_CRL		3
-#define PEM_OBJ_SSL_SESSION	4
-#define PEM_OBJ_PRIV_KEY	10
-#define PEM_OBJ_PRIV_RSA	11
-#define PEM_OBJ_PRIV_DSA	12
-#define PEM_OBJ_PRIV_DH		13
-#define PEM_OBJ_PUB_RSA		14
-#define PEM_OBJ_PUB_DSA		15
-#define PEM_OBJ_PUB_DH		16
-#define PEM_OBJ_DHPARAMS	17
-#define PEM_OBJ_DSAPARAMS	18
-#define PEM_OBJ_PRIV_RSA_PUBLIC	19
-#define PEM_OBJ_PRIV_ECDSA	20
-#define PEM_OBJ_PUB_ECDSA	21
-#define PEM_OBJ_ECPARAMETERS	22
+#define PEM_OBJ_UNDEF       0
+#define PEM_OBJ_X509        1
+#define PEM_OBJ_X509_REQ    2
+#define PEM_OBJ_CRL     3
+#define PEM_OBJ_SSL_SESSION 4
+#define PEM_OBJ_PRIV_KEY    10
+#define PEM_OBJ_PRIV_RSA    11
+#define PEM_OBJ_PRIV_DSA    12
+#define PEM_OBJ_PRIV_DH     13
+#define PEM_OBJ_PUB_RSA     14
+#define PEM_OBJ_PUB_DSA     15
+#define PEM_OBJ_PUB_DH      16
+#define PEM_OBJ_DHPARAMS    17
+#define PEM_OBJ_DSAPARAMS   18
+#define PEM_OBJ_PRIV_RSA_PUBLIC 19
+#define PEM_OBJ_PRIV_ECDSA  20
+#define PEM_OBJ_PUB_ECDSA   21
+#define PEM_OBJ_ECPARAMETERS    22
 
-#define PEM_ERROR		30
+#define PEM_ERROR       30
 #define PEM_DEK_DES_CBC         40
 #define PEM_DEK_IDEA_CBC        45
 #define PEM_DEK_DES_EDE         50
@@ -104,105 +104,105 @@ extern "C" {
 #define PEM_DEK_RSA_MD2         80
 #define PEM_DEK_RSA_MD5         90
 
-#define PEM_MD_MD2		NID_md2
-#define PEM_MD_MD5		NID_md5
-#define PEM_MD_SHA		NID_sha
-#define PEM_MD_MD2_RSA		NID_md2WithRSAEncryption
-#define PEM_MD_MD5_RSA		NID_md5WithRSAEncryption
-#define PEM_MD_SHA_RSA		NID_sha1WithRSAEncryption
+#define PEM_MD_MD2      NID_md2
+#define PEM_MD_MD5      NID_md5
+#define PEM_MD_SHA      NID_sha
+#define PEM_MD_MD2_RSA      NID_md2WithRSAEncryption
+#define PEM_MD_MD5_RSA      NID_md5WithRSAEncryption
+#define PEM_MD_SHA_RSA      NID_sha1WithRSAEncryption
 
-#define PEM_STRING_X509_OLD	"X509 CERTIFICATE"
-#define PEM_STRING_X509		"CERTIFICATE"
-#define PEM_STRING_X509_PAIR	"CERTIFICATE PAIR"
-#define PEM_STRING_X509_TRUSTED	"TRUSTED CERTIFICATE"
-#define PEM_STRING_X509_REQ_OLD	"NEW CERTIFICATE REQUEST"
-#define PEM_STRING_X509_REQ	"CERTIFICATE REQUEST"
-#define PEM_STRING_X509_CRL	"X509 CRL"
-#define PEM_STRING_EVP_PKEY	"ANY PRIVATE KEY"
-#define PEM_STRING_PUBLIC	"PUBLIC KEY"
-#define PEM_STRING_RSA		"RSA PRIVATE KEY"
-#define PEM_STRING_RSA_PUBLIC	"RSA PUBLIC KEY"
-#define PEM_STRING_DSA		"DSA PRIVATE KEY"
-#define PEM_STRING_DSA_PUBLIC	"DSA PUBLIC KEY"
-#define PEM_STRING_PKCS7	"PKCS7"
-#define PEM_STRING_PKCS8	"ENCRYPTED PRIVATE KEY"
-#define PEM_STRING_PKCS8INF	"PRIVATE KEY"
-#define PEM_STRING_DHPARAMS	"DH PARAMETERS"
-#define PEM_STRING_SSL_SESSION	"SSL SESSION PARAMETERS"
-#define PEM_STRING_DSAPARAMS	"DSA PARAMETERS"
+#define PEM_STRING_X509_OLD "X509 CERTIFICATE"
+#define PEM_STRING_X509     "CERTIFICATE"
+#define PEM_STRING_X509_PAIR    "CERTIFICATE PAIR"
+#define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE"
+#define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST"
+#define PEM_STRING_X509_REQ "CERTIFICATE REQUEST"
+#define PEM_STRING_X509_CRL "X509 CRL"
+#define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY"
+#define PEM_STRING_PUBLIC   "PUBLIC KEY"
+#define PEM_STRING_RSA      "RSA PRIVATE KEY"
+#define PEM_STRING_RSA_PUBLIC   "RSA PUBLIC KEY"
+#define PEM_STRING_DSA      "DSA PRIVATE KEY"
+#define PEM_STRING_DSA_PUBLIC   "DSA PUBLIC KEY"
+#define PEM_STRING_PKCS7    "PKCS7"
+#define PEM_STRING_PKCS8    "ENCRYPTED PRIVATE KEY"
+#define PEM_STRING_PKCS8INF "PRIVATE KEY"
+#define PEM_STRING_DHPARAMS "DH PARAMETERS"
+#define PEM_STRING_SSL_SESSION  "SSL SESSION PARAMETERS"
+#define PEM_STRING_DSAPARAMS    "DSA PARAMETERS"
 #define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY"
 #define PEM_STRING_ECPARAMETERS "EC PARAMETERS"
-#define PEM_STRING_ECPRIVATEKEY	"EC PRIVATE KEY"
+#define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY"
 
   /* Note that this structure is initialised by PEM_SealInit and cleaned up
      by PEM_SealFinal (at least for now) */
 typedef struct PEM_Encode_Seal_st
-	{
-	EVP_ENCODE_CTX encode;
-	EVP_MD_CTX md;
-	EVP_CIPHER_CTX cipher;
-	} PEM_ENCODE_SEAL_CTX;
+    {
+    EVP_ENCODE_CTX encode;
+    EVP_MD_CTX md;
+    EVP_CIPHER_CTX cipher;
+    } PEM_ENCODE_SEAL_CTX;
 
 /* enc_type is one off */
 #define PEM_TYPE_ENCRYPTED      10
 #define PEM_TYPE_MIC_ONLY       20
 #define PEM_TYPE_MIC_CLEAR      30
-#define PEM_TYPE_CLEAR		40
+#define PEM_TYPE_CLEAR      40
 
 typedef struct pem_recip_st
-	{
-	char *name;
-	X509_NAME *dn;
+    {
+    char *name;
+    X509_NAME *dn;
 
-	int cipher;
-	int key_enc;
-	/*	char iv[8]; unused and wrong size */
-	} PEM_USER;
+    int cipher;
+    int key_enc;
+    /*  char iv[8]; unused and wrong size */
+    } PEM_USER;
 
 typedef struct pem_ctx_st
-	{
-	int type;		/* what type of object */
+    {
+    int type;       /* what type of object */
 
-	struct	{
-		int version;	
-		int mode;		
-		} proc_type;
+    struct  {
+        int version;
+        int mode;
+        } proc_type;
 
-	char *domain;
+    char *domain;
 
-	struct	{
-		int cipher;
-	/* unused, and wrong size
-	   unsigned char iv[8]; */
-		} DEK_info;
-		
-	PEM_USER *originator;
+    struct  {
+        int cipher;
+    /* unused, and wrong size
+       unsigned char iv[8]; */
+        } DEK_info;
 
-	int num_recipient;
-	PEM_USER **recipient;
+    PEM_USER *originator;
+
+    int num_recipient;
+    PEM_USER **recipient;
 
 #ifndef OPENSSL_NO_STACK
-	STACK *x509_chain;	/* certificate chain */
+    STACK *x509_chain;  /* certificate chain */
 #else
-	char *x509_chain;	/* certificate chain */
+    char *x509_chain;   /* certificate chain */
 #endif
-	EVP_MD *md;		/* signature type */
+    EVP_MD *md;     /* signature type */
 
-	int md_enc;		/* is the md encrypted or not? */
-	int md_len;		/* length of md_data */
-	char *md_data;		/* message digest, could be pkey encrypted */
+    int md_enc;     /* is the md encrypted or not? */
+    int md_len;     /* length of md_data */
+    char *md_data;      /* message digest, could be pkey encrypted */
 
-	EVP_CIPHER *dec;	/* date encryption cipher */
-	int key_len;		/* key length */
-	unsigned char *key;	/* key */
-	/* unused, and wrong size
-	   unsigned char iv[8]; */
+    EVP_CIPHER *dec;    /* date encryption cipher */
+    int key_len;        /* key length */
+    unsigned char *key; /* key */
+    /* unused, and wrong size
+       unsigned char iv[8]; */
 
-	
-	int  data_enc;		/* is the data encrypted */
-	int data_len;
-	unsigned char *data;
-	} PEM_CTX;
+
+    int  data_enc;      /* is the data encrypted */
+    int data_len;
+    unsigned char *data;
+    } PEM_CTX;
 
 /* These macros make the PEM_read/PEM_write functions easier to maintain and
  * write. Now they are all implemented with either:
@@ -221,7 +221,7 @@ typedef struct pem_ctx_st
 type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\
 { \
 return(((type *(*)(D2I_OF(type),char *,FILE *,type **,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_read))(d2i_##asn1, str,fp,x,cb,u)); \
-} 
+}
 
 #define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \
 int PEM_write_##name(FILE *fp, type *x) \
@@ -237,19 +237,19 @@ return(((int (*)(I2D_OF_const(type),const char *,FILE *, const type *, const EVP
 
 #define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \
 int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
-	     unsigned char *kstr, int klen, pem_password_cb *cb, \
-		  void *u) \
-	{ \
-	return(((int (*)(I2D_OF(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u)); \
-	}
+         unsigned char *kstr, int klen, pem_password_cb *cb, \
+          void *u) \
+    { \
+    return(((int (*)(I2D_OF(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u)); \
+    }
 
 #define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \
 int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
-	     unsigned char *kstr, int klen, pem_password_cb *cb, \
-		  void *u) \
-	{ \
-	return(((int (*)(I2D_OF_const(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u)); \
-	}
+         unsigned char *kstr, int klen, pem_password_cb *cb, \
+          void *u) \
+    { \
+    return(((int (*)(I2D_OF_const(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u)); \
+    }
 
 #endif
 
@@ -273,49 +273,49 @@ return(((int (*)(I2D_OF_const(type),const char *,BIO *,const type *, const EVP_C
 
 #define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
 int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
-	     unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
-	{ \
-	return(((int (*)(I2D_OF(type),const char *,BIO *,type *,const EVP_CIPHER *,unsigned char *,int,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u)); \
-	}
+         unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
+    { \
+    return(((int (*)(I2D_OF(type),const char *,BIO *,type *,const EVP_CIPHER *,unsigned char *,int,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u)); \
+    }
 
 #define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
 int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
-	     unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
-	{ \
-	return(((int (*)(I2D_OF_const(type),const char *,BIO *,type *,const EVP_CIPHER *,unsigned char *,int,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u)); \
-	}
+         unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
+    { \
+    return(((int (*)(I2D_OF_const(type),const char *,BIO *,type *,const EVP_CIPHER *,unsigned char *,int,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u)); \
+    }
 
 #define IMPLEMENT_PEM_write(name, type, str, asn1) \
-	IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
-	IMPLEMENT_PEM_write_fp(name, type, str, asn1) 
+    IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
+    IMPLEMENT_PEM_write_fp(name, type, str, asn1)
 
 #define IMPLEMENT_PEM_write_const(name, type, str, asn1) \
-	IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
-	IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) 
+    IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
+    IMPLEMENT_PEM_write_fp_const(name, type, str, asn1)
 
 #define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \
-	IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
-	IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) 
+    IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
+    IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1)
 
 #define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \
-	IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
-	IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) 
+    IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
+    IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1)
 
 #define IMPLEMENT_PEM_read(name, type, str, asn1) \
-	IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
-	IMPLEMENT_PEM_read_fp(name, type, str, asn1) 
+    IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
+    IMPLEMENT_PEM_read_fp(name, type, str, asn1)
 
 #define IMPLEMENT_PEM_rw(name, type, str, asn1) \
-	IMPLEMENT_PEM_read(name, type, str, asn1) \
-	IMPLEMENT_PEM_write(name, type, str, asn1)
+    IMPLEMENT_PEM_read(name, type, str, asn1) \
+    IMPLEMENT_PEM_write(name, type, str, asn1)
 
 #define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \
-	IMPLEMENT_PEM_read(name, type, str, asn1) \
-	IMPLEMENT_PEM_write_const(name, type, str, asn1)
+    IMPLEMENT_PEM_read(name, type, str, asn1) \
+    IMPLEMENT_PEM_write_const(name, type, str, asn1)
 
 #define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \
-	IMPLEMENT_PEM_read(name, type, str, asn1) \
-	IMPLEMENT_PEM_write_cb(name, type, str, asn1)
+    IMPLEMENT_PEM_read(name, type, str, asn1) \
+    IMPLEMENT_PEM_write_cb(name, type, str, asn1)
 
 /* These are the same except they are for the declarations */
 
@@ -328,33 +328,33 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
 #else
 
 #define DECLARE_PEM_read_fp(name, type) \
-	type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u);
+    type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u);
 
 #define DECLARE_PEM_write_fp(name, type) \
-	int PEM_write_##name(FILE *fp, type *x);
+    int PEM_write_##name(FILE *fp, type *x);
 
 #define DECLARE_PEM_write_fp_const(name, type) \
-	int PEM_write_##name(FILE *fp, const type *x);
+    int PEM_write_##name(FILE *fp, const type *x);
 
 #define DECLARE_PEM_write_cb_fp(name, type) \
-	int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
-	     unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
+    int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
+         unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
 
 #endif
 
 #ifndef OPENSSL_NO_BIO
 #define DECLARE_PEM_read_bio(name, type) \
-	type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u);
+    type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u);
 
 #define DECLARE_PEM_write_bio(name, type) \
-	int PEM_write_bio_##name(BIO *bp, type *x);
+    int PEM_write_bio_##name(BIO *bp, type *x);
 
 #define DECLARE_PEM_write_bio_const(name, type) \
-	int PEM_write_bio_##name(BIO *bp, const type *x);
+    int PEM_write_bio_##name(BIO *bp, const type *x);
 
 #define DECLARE_PEM_write_cb_bio(name, type) \
-	int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
-	     unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
+    int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
+         unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
 
 #else
 
@@ -365,162 +365,162 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
 #endif
 
 #define DECLARE_PEM_write(name, type) \
-	DECLARE_PEM_write_bio(name, type) \
-	DECLARE_PEM_write_fp(name, type) 
+    DECLARE_PEM_write_bio(name, type) \
+    DECLARE_PEM_write_fp(name, type)
 
 #define DECLARE_PEM_write_const(name, type) \
-	DECLARE_PEM_write_bio_const(name, type) \
-	DECLARE_PEM_write_fp_const(name, type)
+    DECLARE_PEM_write_bio_const(name, type) \
+    DECLARE_PEM_write_fp_const(name, type)
 
 #define DECLARE_PEM_write_cb(name, type) \
-	DECLARE_PEM_write_cb_bio(name, type) \
-	DECLARE_PEM_write_cb_fp(name, type) 
+    DECLARE_PEM_write_cb_bio(name, type) \
+    DECLARE_PEM_write_cb_fp(name, type)
 
 #define DECLARE_PEM_read(name, type) \
-	DECLARE_PEM_read_bio(name, type) \
-	DECLARE_PEM_read_fp(name, type)
+    DECLARE_PEM_read_bio(name, type) \
+    DECLARE_PEM_read_fp(name, type)
 
 #define DECLARE_PEM_rw(name, type) \
-	DECLARE_PEM_read(name, type) \
-	DECLARE_PEM_write(name, type)
+    DECLARE_PEM_read(name, type) \
+    DECLARE_PEM_write(name, type)
 
 #define DECLARE_PEM_rw_const(name, type) \
-	DECLARE_PEM_read(name, type) \
-	DECLARE_PEM_write_const(name, type)
+    DECLARE_PEM_read(name, type) \
+    DECLARE_PEM_write_const(name, type)
 
 #define DECLARE_PEM_rw_cb(name, type) \
-	DECLARE_PEM_read(name, type) \
-	DECLARE_PEM_write_cb(name, type)
+    DECLARE_PEM_read(name, type) \
+    DECLARE_PEM_write_cb(name, type)
 
 #ifdef SSLEAY_MACROS
 
 #define PEM_write_SSL_SESSION(fp,x) \
-		PEM_ASN1_write((int (*)())i2d_SSL_SESSION, \
-			PEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL,NULL)
+        PEM_ASN1_write((int (*)())i2d_SSL_SESSION, \
+            PEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL,NULL)
 #define PEM_write_X509(fp,x) \
-		PEM_ASN1_write((int (*)())i2d_X509,PEM_STRING_X509,fp, \
-			(char *)x, NULL,NULL,0,NULL,NULL)
+        PEM_ASN1_write((int (*)())i2d_X509,PEM_STRING_X509,fp, \
+            (char *)x, NULL,NULL,0,NULL,NULL)
 #define PEM_write_X509_REQ(fp,x) PEM_ASN1_write( \
-		(int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,fp,(char *)x, \
-			NULL,NULL,0,NULL,NULL)
+        (int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,fp,(char *)x, \
+            NULL,NULL,0,NULL,NULL)
 #define PEM_write_X509_CRL(fp,x) \
-		PEM_ASN1_write((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL, \
-			fp,(char *)x, NULL,NULL,0,NULL,NULL)
-#define	PEM_write_RSAPrivateKey(fp,x,enc,kstr,klen,cb,u) \
-		PEM_ASN1_write((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,fp,\
-			(char *)x,enc,kstr,klen,cb,u)
-#define	PEM_write_RSAPublicKey(fp,x) \
-		PEM_ASN1_write((int (*)())i2d_RSAPublicKey,\
-			PEM_STRING_RSA_PUBLIC,fp,(char *)x,NULL,NULL,0,NULL,NULL)
-#define	PEM_write_DSAPrivateKey(fp,x,enc,kstr,klen,cb,u) \
-		PEM_ASN1_write((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,fp,\
-			(char *)x,enc,kstr,klen,cb,u)
-#define	PEM_write_PrivateKey(bp,x,enc,kstr,klen,cb,u) \
-		PEM_ASN1_write((int (*)())i2d_PrivateKey,\
-		(((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\
-			bp,(char *)x,enc,kstr,klen,cb,u)
+        PEM_ASN1_write((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL, \
+            fp,(char *)x, NULL,NULL,0,NULL,NULL)
+#define PEM_write_RSAPrivateKey(fp,x,enc,kstr,klen,cb,u) \
+        PEM_ASN1_write((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,fp,\
+            (char *)x,enc,kstr,klen,cb,u)
+#define PEM_write_RSAPublicKey(fp,x) \
+        PEM_ASN1_write((int (*)())i2d_RSAPublicKey,\
+            PEM_STRING_RSA_PUBLIC,fp,(char *)x,NULL,NULL,0,NULL,NULL)
+#define PEM_write_DSAPrivateKey(fp,x,enc,kstr,klen,cb,u) \
+        PEM_ASN1_write((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,fp,\
+            (char *)x,enc,kstr,klen,cb,u)
+#define PEM_write_PrivateKey(bp,x,enc,kstr,klen,cb,u) \
+        PEM_ASN1_write((int (*)())i2d_PrivateKey,\
+        (((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\
+            bp,(char *)x,enc,kstr,klen,cb,u)
 #define PEM_write_PKCS7(fp,x) \
-		PEM_ASN1_write((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,fp, \
-			(char *)x, NULL,NULL,0,NULL,NULL)
+        PEM_ASN1_write((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,fp, \
+            (char *)x, NULL,NULL,0,NULL,NULL)
 #define PEM_write_DHparams(fp,x) \
-		PEM_ASN1_write((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,fp,\
-			(char *)x,NULL,NULL,0,NULL,NULL)
+        PEM_ASN1_write((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,fp,\
+            (char *)x,NULL,NULL,0,NULL,NULL)
 
 #define PEM_write_NETSCAPE_CERT_SEQUENCE(fp,x) \
                 PEM_ASN1_write((int (*)())i2d_NETSCAPE_CERT_SEQUENCE, \
-			PEM_STRING_X509,fp, \
+            PEM_STRING_X509,fp, \
                         (char *)x, NULL,NULL,0,NULL,NULL)
 
-#define	PEM_read_SSL_SESSION(fp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read( \
-	(char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb,u)
-#define	PEM_read_X509(fp,x,cb,u) (X509 *)PEM_ASN1_read( \
-	(char *(*)())d2i_X509,PEM_STRING_X509,fp,(char **)x,cb,u)
-#define	PEM_read_X509_REQ(fp,x,cb,u) (X509_REQ *)PEM_ASN1_read( \
-	(char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,fp,(char **)x,cb,u)
-#define	PEM_read_X509_CRL(fp,x,cb,u) (X509_CRL *)PEM_ASN1_read( \
-	(char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,fp,(char **)x,cb,u)
-#define	PEM_read_RSAPrivateKey(fp,x,cb,u) (RSA *)PEM_ASN1_read( \
-	(char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,fp,(char **)x,cb,u)
-#define	PEM_read_RSAPublicKey(fp,x,cb,u) (RSA *)PEM_ASN1_read( \
-	(char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,fp,(char **)x,cb,u)
-#define	PEM_read_DSAPrivateKey(fp,x,cb,u) (DSA *)PEM_ASN1_read( \
-	(char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,fp,(char **)x,cb,u)
-#define	PEM_read_PrivateKey(fp,x,cb,u) (EVP_PKEY *)PEM_ASN1_read( \
-	(char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,fp,(char **)x,cb,u)
-#define	PEM_read_PKCS7(fp,x,cb,u) (PKCS7 *)PEM_ASN1_read( \
-	(char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,fp,(char **)x,cb,u)
-#define	PEM_read_DHparams(fp,x,cb,u) (DH *)PEM_ASN1_read( \
-	(char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,fp,(char **)x,cb,u)
+#define PEM_read_SSL_SESSION(fp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read( \
+    (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb,u)
+#define PEM_read_X509(fp,x,cb,u) (X509 *)PEM_ASN1_read( \
+    (char *(*)())d2i_X509,PEM_STRING_X509,fp,(char **)x,cb,u)
+#define PEM_read_X509_REQ(fp,x,cb,u) (X509_REQ *)PEM_ASN1_read( \
+    (char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,fp,(char **)x,cb,u)
+#define PEM_read_X509_CRL(fp,x,cb,u) (X509_CRL *)PEM_ASN1_read( \
+    (char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,fp,(char **)x,cb,u)
+#define PEM_read_RSAPrivateKey(fp,x,cb,u) (RSA *)PEM_ASN1_read( \
+    (char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,fp,(char **)x,cb,u)
+#define PEM_read_RSAPublicKey(fp,x,cb,u) (RSA *)PEM_ASN1_read( \
+    (char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,fp,(char **)x,cb,u)
+#define PEM_read_DSAPrivateKey(fp,x,cb,u) (DSA *)PEM_ASN1_read( \
+    (char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,fp,(char **)x,cb,u)
+#define PEM_read_PrivateKey(fp,x,cb,u) (EVP_PKEY *)PEM_ASN1_read( \
+    (char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,fp,(char **)x,cb,u)
+#define PEM_read_PKCS7(fp,x,cb,u) (PKCS7 *)PEM_ASN1_read( \
+    (char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,fp,(char **)x,cb,u)
+#define PEM_read_DHparams(fp,x,cb,u) (DH *)PEM_ASN1_read( \
+    (char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,fp,(char **)x,cb,u)
 
 #define PEM_read_NETSCAPE_CERT_SEQUENCE(fp,x,cb,u) \
-		(NETSCAPE_CERT_SEQUENCE *)PEM_ASN1_read( \
+        (NETSCAPE_CERT_SEQUENCE *)PEM_ASN1_read( \
         (char *(*)())d2i_NETSCAPE_CERT_SEQUENCE,PEM_STRING_X509,fp,\
-							(char **)x,cb,u)
+                            (char **)x,cb,u)
 
 #define PEM_write_bio_X509(bp,x) \
-		PEM_ASN1_write_bio((int (*)())i2d_X509,PEM_STRING_X509,bp, \
-			(char *)x, NULL,NULL,0,NULL,NULL)
+        PEM_ASN1_write_bio((int (*)())i2d_X509,PEM_STRING_X509,bp, \
+            (char *)x, NULL,NULL,0,NULL,NULL)
 #define PEM_write_bio_X509_REQ(bp,x) PEM_ASN1_write_bio( \
-		(int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,bp,(char *)x, \
-			NULL,NULL,0,NULL,NULL)
+        (int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,bp,(char *)x, \
+            NULL,NULL,0,NULL,NULL)
 #define PEM_write_bio_X509_CRL(bp,x) \
-		PEM_ASN1_write_bio((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL,\
-			bp,(char *)x, NULL,NULL,0,NULL,NULL)
-#define	PEM_write_bio_RSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \
-		PEM_ASN1_write_bio((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,\
-			bp,(char *)x,enc,kstr,klen,cb,u)
-#define	PEM_write_bio_RSAPublicKey(bp,x) \
-		PEM_ASN1_write_bio((int (*)())i2d_RSAPublicKey, \
-			PEM_STRING_RSA_PUBLIC,\
-			bp,(char *)x,NULL,NULL,0,NULL,NULL)
-#define	PEM_write_bio_DSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \
-		PEM_ASN1_write_bio((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,\
-			bp,(char *)x,enc,kstr,klen,cb,u)
-#define	PEM_write_bio_PrivateKey(bp,x,enc,kstr,klen,cb,u) \
-		PEM_ASN1_write_bio((int (*)())i2d_PrivateKey,\
-		(((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\
-			bp,(char *)x,enc,kstr,klen,cb,u)
+        PEM_ASN1_write_bio((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL,\
+            bp,(char *)x, NULL,NULL,0,NULL,NULL)
+#define PEM_write_bio_RSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \
+        PEM_ASN1_write_bio((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,\
+            bp,(char *)x,enc,kstr,klen,cb,u)
+#define PEM_write_bio_RSAPublicKey(bp,x) \
+        PEM_ASN1_write_bio((int (*)())i2d_RSAPublicKey, \
+            PEM_STRING_RSA_PUBLIC,\
+            bp,(char *)x,NULL,NULL,0,NULL,NULL)
+#define PEM_write_bio_DSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \
+        PEM_ASN1_write_bio((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,\
+            bp,(char *)x,enc,kstr,klen,cb,u)
+#define PEM_write_bio_PrivateKey(bp,x,enc,kstr,klen,cb,u) \
+        PEM_ASN1_write_bio((int (*)())i2d_PrivateKey,\
+        (((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\
+            bp,(char *)x,enc,kstr,klen,cb,u)
 #define PEM_write_bio_PKCS7(bp,x) \
-		PEM_ASN1_write_bio((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,bp, \
-			(char *)x, NULL,NULL,0,NULL,NULL)
+        PEM_ASN1_write_bio((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,bp, \
+            (char *)x, NULL,NULL,0,NULL,NULL)
 #define PEM_write_bio_DHparams(bp,x) \
-		PEM_ASN1_write_bio((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,\
-			bp,(char *)x,NULL,NULL,0,NULL,NULL)
+        PEM_ASN1_write_bio((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,\
+            bp,(char *)x,NULL,NULL,0,NULL,NULL)
 #define PEM_write_bio_DSAparams(bp,x) \
-		PEM_ASN1_write_bio((int (*)())i2d_DSAparams, \
-			PEM_STRING_DSAPARAMS,bp,(char *)x,NULL,NULL,0,NULL,NULL)
+        PEM_ASN1_write_bio((int (*)())i2d_DSAparams, \
+            PEM_STRING_DSAPARAMS,bp,(char *)x,NULL,NULL,0,NULL,NULL)
 
 #define PEM_write_bio_NETSCAPE_CERT_SEQUENCE(bp,x) \
                 PEM_ASN1_write_bio((int (*)())i2d_NETSCAPE_CERT_SEQUENCE, \
-			PEM_STRING_X509,bp, \
+            PEM_STRING_X509,bp, \
                         (char *)x, NULL,NULL,0,NULL,NULL)
 
-#define	PEM_read_bio_X509(bp,x,cb,u) (X509 *)PEM_ASN1_read_bio( \
-	(char *(*)())d2i_X509,PEM_STRING_X509,bp,(char **)x,cb,u)
-#define	PEM_read_bio_X509_REQ(bp,x,cb,u) (X509_REQ *)PEM_ASN1_read_bio( \
-	(char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,bp,(char **)x,cb,u)
-#define	PEM_read_bio_X509_CRL(bp,x,cb,u) (X509_CRL *)PEM_ASN1_read_bio( \
-	(char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,bp,(char **)x,cb,u)
-#define	PEM_read_bio_RSAPrivateKey(bp,x,cb,u) (RSA *)PEM_ASN1_read_bio( \
-	(char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,bp,(char **)x,cb,u)
-#define	PEM_read_bio_RSAPublicKey(bp,x,cb,u) (RSA *)PEM_ASN1_read_bio( \
-	(char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,bp,(char **)x,cb,u)
-#define	PEM_read_bio_DSAPrivateKey(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \
-	(char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,bp,(char **)x,cb,u)
-#define	PEM_read_bio_PrivateKey(bp,x,cb,u) (EVP_PKEY *)PEM_ASN1_read_bio( \
-	(char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,bp,(char **)x,cb,u)
+#define PEM_read_bio_X509(bp,x,cb,u) (X509 *)PEM_ASN1_read_bio( \
+    (char *(*)())d2i_X509,PEM_STRING_X509,bp,(char **)x,cb,u)
+#define PEM_read_bio_X509_REQ(bp,x,cb,u) (X509_REQ *)PEM_ASN1_read_bio( \
+    (char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,bp,(char **)x,cb,u)
+#define PEM_read_bio_X509_CRL(bp,x,cb,u) (X509_CRL *)PEM_ASN1_read_bio( \
+    (char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,bp,(char **)x,cb,u)
+#define PEM_read_bio_RSAPrivateKey(bp,x,cb,u) (RSA *)PEM_ASN1_read_bio( \
+    (char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,bp,(char **)x,cb,u)
+#define PEM_read_bio_RSAPublicKey(bp,x,cb,u) (RSA *)PEM_ASN1_read_bio( \
+    (char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,bp,(char **)x,cb,u)
+#define PEM_read_bio_DSAPrivateKey(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \
+    (char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,bp,(char **)x,cb,u)
+#define PEM_read_bio_PrivateKey(bp,x,cb,u) (EVP_PKEY *)PEM_ASN1_read_bio( \
+    (char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,bp,(char **)x,cb,u)
 
-#define	PEM_read_bio_PKCS7(bp,x,cb,u) (PKCS7 *)PEM_ASN1_read_bio( \
-	(char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,bp,(char **)x,cb,u)
-#define	PEM_read_bio_DHparams(bp,x,cb,u) (DH *)PEM_ASN1_read_bio( \
-	(char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,bp,(char **)x,cb,u)
-#define	PEM_read_bio_DSAparams(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \
-	(char *(*)())d2i_DSAparams,PEM_STRING_DSAPARAMS,bp,(char **)x,cb,u)
+#define PEM_read_bio_PKCS7(bp,x,cb,u) (PKCS7 *)PEM_ASN1_read_bio( \
+    (char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,bp,(char **)x,cb,u)
+#define PEM_read_bio_DHparams(bp,x,cb,u) (DH *)PEM_ASN1_read_bio( \
+    (char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,bp,(char **)x,cb,u)
+#define PEM_read_bio_DSAparams(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \
+    (char *(*)())d2i_DSAparams,PEM_STRING_DSAPARAMS,bp,(char **)x,cb,u)
 
 #define PEM_read_bio_NETSCAPE_CERT_SEQUENCE(bp,x,cb,u) \
-		(NETSCAPE_CERT_SEQUENCE *)PEM_ASN1_read_bio( \
+        (NETSCAPE_CERT_SEQUENCE *)PEM_ASN1_read_bio( \
         (char *(*)())d2i_NETSCAPE_CERT_SEQUENCE,PEM_STRING_X509,bp,\
-							(char **)x,cb,u)
+                            (char **)x,cb,u)
 
 #endif
 
@@ -532,61 +532,61 @@ typedef int pem_password_cb(char *buf, int size, int rwflag, void *userdata);
 typedef int pem_password_cb(char *buf, int size, int rwflag);
 #endif
 
-int	PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher);
-int	PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len,
-	pem_password_cb *callback,void *u);
+int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher);
+int PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len,
+    pem_password_cb *callback,void *u);
 
 #ifndef OPENSSL_NO_BIO
-int	PEM_read_bio(BIO *bp, char **name, char **header,
-		unsigned char **data,long *len);
-int	PEM_write_bio(BIO *bp,const char *name,char *hdr,unsigned char *data,
-		long len);
+int PEM_read_bio(BIO *bp, char **name, char **header,
+        unsigned char **data,long *len);
+int PEM_write_bio(BIO *bp,const char *name,char *hdr,unsigned char *data,
+        long len);
 int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char *name, BIO *bp,
-	     pem_password_cb *cb, void *u);
-void *	PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp,
-			  void **x, pem_password_cb *cb, void *u);
+         pem_password_cb *cb, void *u);
+void *  PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp,
+              void **x, pem_password_cb *cb, void *u);
 #define PEM_ASN1_read_bio_of(type,d2i,name,bp,x,cb,u) \
 ((type *(*)(D2I_OF(type),const char *,BIO *,type **,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_read_bio))(d2i,name,bp,x,cb,u)
-int	PEM_ASN1_write_bio(i2d_of_void *i2d,const char *name,BIO *bp,char *x,
-			   const EVP_CIPHER *enc,unsigned char *kstr,int klen,
-			   pem_password_cb *cb, void *u);
+int PEM_ASN1_write_bio(i2d_of_void *i2d,const char *name,BIO *bp,char *x,
+               const EVP_CIPHER *enc,unsigned char *kstr,int klen,
+               pem_password_cb *cb, void *u);
 #define PEM_ASN1_write_bio_of(type,i2d,name,bp,x,enc,kstr,klen,cb,u) \
-	((int (*)(I2D_OF(type),const char *,BIO *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d,name,bp,x,enc,kstr,klen,cb,u)
+    ((int (*)(I2D_OF(type),const char *,BIO *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d,name,bp,x,enc,kstr,klen,cb,u)
 
-STACK_OF(X509_INFO) *	PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u);
-int	PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc,
-		unsigned char *kstr, int klen, pem_password_cb *cd, void *u);
+STACK_OF(X509_INFO) *   PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u);
+int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc,
+        unsigned char *kstr, int klen, pem_password_cb *cd, void *u);
 #endif
 
 #ifndef OPENSSL_SYS_WIN16
-int	PEM_read(FILE *fp, char **name, char **header,
-		unsigned char **data,long *len);
-int	PEM_write(FILE *fp,char *name,char *hdr,unsigned char *data,long len);
+int PEM_read(FILE *fp, char **name, char **header,
+        unsigned char **data,long *len);
+int PEM_write(FILE *fp,char *name,char *hdr,unsigned char *data,long len);
 void *  PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x,
-		      pem_password_cb *cb, void *u);
-int	PEM_ASN1_write(i2d_of_void *i2d,const char *name,FILE *fp,
-		       char *x,const EVP_CIPHER *enc,unsigned char *kstr,
-		       int klen,pem_password_cb *callback, void *u);
-STACK_OF(X509_INFO) *	PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,
-	pem_password_cb *cb, void *u);
+              pem_password_cb *cb, void *u);
+int PEM_ASN1_write(i2d_of_void *i2d,const char *name,FILE *fp,
+               char *x,const EVP_CIPHER *enc,unsigned char *kstr,
+               int klen,pem_password_cb *callback, void *u);
+STACK_OF(X509_INFO) *   PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,
+    pem_password_cb *cb, void *u);
 #endif
 
-int	PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type,
-		EVP_MD *md_type, unsigned char **ek, int *ekl,
-		unsigned char *iv, EVP_PKEY **pubk, int npubk);
-void	PEM_SealUpdate(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *out, int *outl,
-		unsigned char *in, int inl);
-int	PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig,int *sigl,
-		unsigned char *out, int *outl, EVP_PKEY *priv);
+int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type,
+        EVP_MD *md_type, unsigned char **ek, int *ekl,
+        unsigned char *iv, EVP_PKEY **pubk, int npubk);
+void    PEM_SealUpdate(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *out, int *outl,
+        unsigned char *in, int inl);
+int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig,int *sigl,
+        unsigned char *out, int *outl, EVP_PKEY *priv);
 
 void    PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type);
 void    PEM_SignUpdate(EVP_MD_CTX *ctx,unsigned char *d,unsigned int cnt);
-int	PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret,
-		unsigned int *siglen, EVP_PKEY *pkey);
+int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret,
+        unsigned int *siglen, EVP_PKEY *pkey);
 
-int	PEM_def_callback(char *buf, int num, int w, void *key);
-void	PEM_proc_type(char *buf, int type);
-void	PEM_dek_info(char *buf, const char *type, int len, char *str);
+int PEM_def_callback(char *buf, int num, int w, void *key);
+void    PEM_proc_type(char *buf, int type);
+void    PEM_dek_info(char *buf, const char *type, int len, char *str);
 
 #ifndef SSLEAY_MACROS
 
@@ -647,32 +647,32 @@ DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY)
 DECLARE_PEM_rw(PUBKEY, EVP_PKEY)
 
 int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid,
-				  char *kstr, int klen,
-				  pem_password_cb *cb, void *u);
+                  char *kstr, int klen,
+                  pem_password_cb *cb, void *u);
 int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *,
                                   char *, int, pem_password_cb *, void *);
 int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,
-				  char *kstr, int klen,
-				  pem_password_cb *cb, void *u);
+                  char *kstr, int klen,
+                  pem_password_cb *cb, void *u);
 int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid,
-				  char *kstr, int klen,
-				  pem_password_cb *cb, void *u);
+                  char *kstr, int klen,
+                  pem_password_cb *cb, void *u);
 EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u);
 
 int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
-				  char *kstr, int klen,
-				  pem_password_cb *cb, void *u);
+                  char *kstr, int klen,
+                  pem_password_cb *cb, void *u);
 int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid,
-				  char *kstr, int klen,
-				  pem_password_cb *cb, void *u);
+                  char *kstr, int klen,
+                  pem_password_cb *cb, void *u);
 int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid,
-				  char *kstr, int klen,
-				  pem_password_cb *cb, void *u);
+                  char *kstr, int klen,
+                  pem_password_cb *cb, void *u);
 
 EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u);
 
 int PEM_write_PKCS8PrivateKey(FILE *fp,EVP_PKEY *x,const EVP_CIPHER *enc,
-			      char *kstr,int klen, pem_password_cb *cd, void *u);
+                  char *kstr,int klen, pem_password_cb *cd, void *u);
 
 #endif /* SSLEAY_MACROS */
 
@@ -686,50 +686,50 @@ void ERR_load_PEM_strings(void);
 /* Error codes for the PEM functions. */
 
 /* Function codes. */
-#define PEM_F_D2I_PKCS8PRIVATEKEY_BIO			 120
-#define PEM_F_D2I_PKCS8PRIVATEKEY_FP			 121
-#define PEM_F_DO_PK8PKEY				 126
-#define PEM_F_DO_PK8PKEY_FP				 125
-#define PEM_F_LOAD_IV					 101
-#define PEM_F_PEM_ASN1_READ				 102
-#define PEM_F_PEM_ASN1_READ_BIO				 103
-#define PEM_F_PEM_ASN1_WRITE				 104
-#define PEM_F_PEM_ASN1_WRITE_BIO			 105
-#define PEM_F_PEM_DEF_CALLBACK				 100
-#define PEM_F_PEM_DO_HEADER				 106
-#define PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY		 118
-#define PEM_F_PEM_GET_EVP_CIPHER_INFO			 107
-#define PEM_F_PEM_PK8PKEY				 119
-#define PEM_F_PEM_READ					 108
-#define PEM_F_PEM_READ_BIO				 109
-#define PEM_F_PEM_READ_BIO_PRIVATEKEY			 123
-#define PEM_F_PEM_READ_PRIVATEKEY			 124
-#define PEM_F_PEM_SEALFINAL				 110
-#define PEM_F_PEM_SEALINIT				 111
-#define PEM_F_PEM_SIGNFINAL				 112
-#define PEM_F_PEM_WRITE					 113
-#define PEM_F_PEM_WRITE_BIO				 114
-#define PEM_F_PEM_X509_INFO_READ			 115
-#define PEM_F_PEM_X509_INFO_READ_BIO			 116
-#define PEM_F_PEM_X509_INFO_WRITE_BIO			 117
+#define PEM_F_D2I_PKCS8PRIVATEKEY_BIO            120
+#define PEM_F_D2I_PKCS8PRIVATEKEY_FP             121
+#define PEM_F_DO_PK8PKEY                 126
+#define PEM_F_DO_PK8PKEY_FP              125
+#define PEM_F_LOAD_IV                    101
+#define PEM_F_PEM_ASN1_READ              102
+#define PEM_F_PEM_ASN1_READ_BIO              103
+#define PEM_F_PEM_ASN1_WRITE                 104
+#define PEM_F_PEM_ASN1_WRITE_BIO             105
+#define PEM_F_PEM_DEF_CALLBACK               100
+#define PEM_F_PEM_DO_HEADER              106
+#define PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY        118
+#define PEM_F_PEM_GET_EVP_CIPHER_INFO            107
+#define PEM_F_PEM_PK8PKEY                119
+#define PEM_F_PEM_READ                   108
+#define PEM_F_PEM_READ_BIO               109
+#define PEM_F_PEM_READ_BIO_PRIVATEKEY            123
+#define PEM_F_PEM_READ_PRIVATEKEY            124
+#define PEM_F_PEM_SEALFINAL              110
+#define PEM_F_PEM_SEALINIT               111
+#define PEM_F_PEM_SIGNFINAL              112
+#define PEM_F_PEM_WRITE                  113
+#define PEM_F_PEM_WRITE_BIO              114
+#define PEM_F_PEM_X509_INFO_READ             115
+#define PEM_F_PEM_X509_INFO_READ_BIO             116
+#define PEM_F_PEM_X509_INFO_WRITE_BIO            117
 
 /* Reason codes. */
-#define PEM_R_BAD_BASE64_DECODE				 100
-#define PEM_R_BAD_DECRYPT				 101
-#define PEM_R_BAD_END_LINE				 102
-#define PEM_R_BAD_IV_CHARS				 103
-#define PEM_R_BAD_PASSWORD_READ				 104
-#define PEM_R_ERROR_CONVERTING_PRIVATE_KEY		 115
-#define PEM_R_NOT_DEK_INFO				 105
-#define PEM_R_NOT_ENCRYPTED				 106
-#define PEM_R_NOT_PROC_TYPE				 107
-#define PEM_R_NO_START_LINE				 108
-#define PEM_R_PROBLEMS_GETTING_PASSWORD			 109
-#define PEM_R_PUBLIC_KEY_NO_RSA				 110
-#define PEM_R_READ_KEY					 111
-#define PEM_R_SHORT_HEADER				 112
-#define PEM_R_UNSUPPORTED_CIPHER			 113
-#define PEM_R_UNSUPPORTED_ENCRYPTION			 114
+#define PEM_R_BAD_BASE64_DECODE              100
+#define PEM_R_BAD_DECRYPT                101
+#define PEM_R_BAD_END_LINE               102
+#define PEM_R_BAD_IV_CHARS               103
+#define PEM_R_BAD_PASSWORD_READ              104
+#define PEM_R_ERROR_CONVERTING_PRIVATE_KEY       115
+#define PEM_R_NOT_DEK_INFO               105
+#define PEM_R_NOT_ENCRYPTED              106
+#define PEM_R_NOT_PROC_TYPE              107
+#define PEM_R_NO_START_LINE              108
+#define PEM_R_PROBLEMS_GETTING_PASSWORD          109
+#define PEM_R_PUBLIC_KEY_NO_RSA              110
+#define PEM_R_READ_KEY                   111
+#define PEM_R_SHORT_HEADER               112
+#define PEM_R_UNSUPPORTED_CIPHER             113
+#define PEM_R_UNSUPPORTED_ENCRYPTION             114
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/pem2.h b/dep/include/openssl/pem2.h
index f31790d69cb..84897d5ec35 100644
--- a/dep/include/openssl/pem2.h
+++ b/dep/include/openssl/pem2.h
@@ -6,7 +6,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
diff --git a/dep/include/openssl/pkcs12.h b/dep/include/openssl/pkcs12.h
index a2d7e359a0f..6ad18e6fd2e 100644
--- a/dep/include/openssl/pkcs12.h
+++ b/dep/include/openssl/pkcs12.h
@@ -10,7 +10,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -66,18 +66,18 @@
 extern "C" {
 #endif
 
-#define PKCS12_KEY_ID	1
-#define PKCS12_IV_ID	2
-#define PKCS12_MAC_ID	3
+#define PKCS12_KEY_ID   1
+#define PKCS12_IV_ID    2
+#define PKCS12_MAC_ID   3
 
 /* Default iteration count */
 #ifndef PKCS12_DEFAULT_ITER
-#define PKCS12_DEFAULT_ITER	PKCS5_DEFAULT_ITER
+#define PKCS12_DEFAULT_ITER PKCS5_DEFAULT_ITER
 #endif
 
 #define PKCS12_MAC_KEY_LENGTH 20
 
-#define PKCS12_SALT_LEN	8
+#define PKCS12_SALT_LEN 8
 
 /* Uncomment out next line for unicode password and names, otherwise ASCII */
 
@@ -93,13 +93,13 @@ extern "C" {
 
 /* MS key usage constants */
 
-#define KEY_EX	0x10
+#define KEY_EX  0x10
 #define KEY_SIG 0x80
 
 typedef struct {
 X509_SIG *dinfo;
 ASN1_OCTET_STRING *salt;
-ASN1_INTEGER *iter;	/* defaults to 1 */
+ASN1_INTEGER *iter; /* defaults to 1 */
 } PKCS12_MAC_DATA;
 
 typedef struct {
@@ -113,11 +113,11 @@ PREDECLARE_STACK_OF(PKCS12_SAFEBAG)
 typedef struct {
 ASN1_OBJECT *type;
 union {
-	struct pkcs12_bag_st *bag; /* secret, crl and certbag */
-	struct pkcs8_priv_key_info_st	*keybag; /* keybag */
-	X509_SIG *shkeybag; /* shrouded key bag */
-	STACK_OF(PKCS12_SAFEBAG) *safes;
-	ASN1_TYPE *other;
+    struct pkcs12_bag_st *bag; /* secret, crl and certbag */
+    struct pkcs8_priv_key_info_st   *keybag; /* keybag */
+    X509_SIG *shkeybag; /* shrouded key bag */
+    STACK_OF(PKCS12_SAFEBAG) *safes;
+    ASN1_TYPE *other;
 }value;
 STACK_OF(X509_ATTRIBUTE) *attrib;
 } PKCS12_SAFEBAG;
@@ -129,16 +129,16 @@ DECLARE_PKCS12_STACK_OF(PKCS12_SAFEBAG)
 typedef struct pkcs12_bag_st {
 ASN1_OBJECT *type;
 union {
-	ASN1_OCTET_STRING *x509cert;
-	ASN1_OCTET_STRING *x509crl;
-	ASN1_OCTET_STRING *octet;
-	ASN1_IA5STRING *sdsicert;
-	ASN1_TYPE *other; /* Secret or other bag */
+    ASN1_OCTET_STRING *x509cert;
+    ASN1_OCTET_STRING *x509crl;
+    ASN1_OCTET_STRING *octet;
+    ASN1_IA5STRING *sdsicert;
+    ASN1_TYPE *other; /* Secret or other bag */
 }value;
 } PKCS12_BAGS;
 
-#define PKCS12_ERROR	0
-#define PKCS12_OK	1
+#define PKCS12_ERROR    0
+#define PKCS12_OK   1
 
 /* Compatibility macros */
 
@@ -146,7 +146,7 @@ union {
 #define M_PKCS12_x509crl2certbag PKCS12_x509crl2certbag
 
 #define M_PKCS12_certbag2x509 PKCS12_certbag2x509
-#define M_PKCS12_certbag2x509crl PKCS12_certbag2x509crl 
+#define M_PKCS12_certbag2x509crl PKCS12_certbag2x509crl
 
 #define M_PKCS12_unpack_p7data PKCS12_unpack_p7data
 #define M_PKCS12_pack_authsafes PKCS12_pack_authsafes
@@ -161,10 +161,10 @@ union {
 #define M_PKCS12_crl_bag_type M_PKCS12_cert_bag_type
 
 #define PKCS12_get_attr(bag, attr_nid) \
-			 PKCS12_get_attr_gen(bag->attrib, attr_nid)
+             PKCS12_get_attr_gen(bag->attrib, attr_nid)
 
 #define PKCS8_get_attr(p8, attr_nid) \
-		PKCS12_get_attr_gen(p8->attributes, attr_nid)
+        PKCS12_get_attr_gen(p8->attributes, attr_nid)
 
 #define PKCS12_mac_present(p12) ((p12)->mac ? 1 : 0)
 
@@ -175,24 +175,24 @@ X509 *PKCS12_certbag2x509(PKCS12_SAFEBAG *bag);
 X509_CRL *PKCS12_certbag2x509crl(PKCS12_SAFEBAG *bag);
 
 PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it, int nid1,
-	     int nid2);
+         int nid2);
 PKCS12_SAFEBAG *PKCS12_MAKE_KEYBAG(PKCS8_PRIV_KEY_INFO *p8);
 PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(X509_SIG *p8, const char *pass, int passlen);
 PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(PKCS12_SAFEBAG *bag, const char *pass,
-								int passlen);
-X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher, 
-			const char *pass, int passlen,
-			unsigned char *salt, int saltlen, int iter,
-			PKCS8_PRIV_KEY_INFO *p8);
+                                int passlen);
+X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher,
+            const char *pass, int passlen,
+            unsigned char *salt, int saltlen, int iter,
+            PKCS8_PRIV_KEY_INFO *p8);
 PKCS12_SAFEBAG *PKCS12_MAKE_SHKEYBAG(int pbe_nid, const char *pass,
-				     int passlen, unsigned char *salt,
-				     int saltlen, int iter,
-				     PKCS8_PRIV_KEY_INFO *p8);
+                     int passlen, unsigned char *salt,
+                     int saltlen, int iter,
+                     PKCS8_PRIV_KEY_INFO *p8);
 PKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk);
 STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7);
 PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen,
-			     unsigned char *salt, int saltlen, int iter,
-			     STACK_OF(PKCS12_SAFEBAG) *bags);
+                 unsigned char *salt, int saltlen, int iter,
+                 STACK_OF(PKCS12_SAFEBAG) *bags);
 STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass, int passlen);
 
 int PKCS12_pack_authsafes(PKCS12 *p12, STACK_OF(PKCS7) *safes);
@@ -200,38 +200,38 @@ STACK_OF(PKCS7) *PKCS12_unpack_authsafes(PKCS12 *p12);
 
 int PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name, int namelen);
 int PKCS12_add_friendlyname_asc(PKCS12_SAFEBAG *bag, const char *name,
-				int namelen);
+                int namelen);
 int PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name,
-				int namelen);
+                int namelen);
 int PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag, const unsigned char *name,
-				int namelen);
+                int namelen);
 int PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage);
 ASN1_TYPE *PKCS12_get_attr_gen(STACK_OF(X509_ATTRIBUTE) *attrs, int attr_nid);
 char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag);
 unsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass,
-				int passlen, unsigned char *in, int inlen,
-				unsigned char **data, int *datalen, int en_de);
+                int passlen, unsigned char *in, int inlen,
+                unsigned char **data, int *datalen, int en_de);
 void * PKCS12_item_decrypt_d2i(X509_ALGOR *algor, const ASN1_ITEM *it,
-	     const char *pass, int passlen, ASN1_OCTET_STRING *oct, int zbuf);
+         const char *pass, int passlen, ASN1_OCTET_STRING *oct, int zbuf);
 ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, const ASN1_ITEM *it,
-				       const char *pass, int passlen,
-				       void *obj, int zbuf);
+                       const char *pass, int passlen,
+                       void *obj, int zbuf);
 PKCS12 *PKCS12_init(int mode);
 int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt,
-		       int saltlen, int id, int iter, int n,
-		       unsigned char *out, const EVP_MD *md_type);
+               int saltlen, int id, int iter, int n,
+               unsigned char *out, const EVP_MD *md_type);
 int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, int saltlen, int id, int iter, int n, unsigned char *out, const EVP_MD *md_type);
 int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
-			 ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md_type,
-			 int en_de);
+             ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md_type,
+             int en_de);
 int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen,
-			 unsigned char *mac, unsigned int *maclen);
+             unsigned char *mac, unsigned int *maclen);
 int PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen);
 int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen,
-		   unsigned char *salt, int saltlen, int iter,
-		   const EVP_MD *md_type);
+           unsigned char *salt, int saltlen, int iter,
+           const EVP_MD *md_type);
 int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt,
-					 int saltlen, const EVP_MD *md_type);
+                     int saltlen, const EVP_MD *md_type);
 unsigned char *asc2uni(const char *asc, int asclen, unsigned char **uni, int *unilen);
 char *uni2asc(unsigned char *uni, int unilen);
 
@@ -245,17 +245,17 @@ DECLARE_ASN1_ITEM(PKCS12_AUTHSAFES)
 
 void PKCS12_PBE_add(void);
 int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert,
-		 STACK_OF(X509) **ca);
+         STACK_OF(X509) **ca);
 PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert,
-			 STACK_OF(X509) *ca, int nid_key, int nid_cert, int iter,
-						 int mac_iter, int keytype);
+             STACK_OF(X509) *ca, int nid_key, int nid_cert, int iter,
+                         int mac_iter, int keytype);
 
 PKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert);
 PKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags, EVP_PKEY *key,
-						int key_usage, int iter,
-						int key_nid, char *pass);
+                        int key_usage, int iter,
+                        int key_nid, char *pass);
 int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags,
-					int safe_nid, int iter, char *pass);
+                    int safe_nid, int iter, char *pass);
 PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid);
 
 int i2d_PKCS12_bio(BIO *bp, PKCS12 *p12);
@@ -273,59 +273,59 @@ void ERR_load_PKCS12_strings(void);
 /* Error codes for the PKCS12 functions. */
 
 /* Function codes. */
-#define PKCS12_F_PARSE_BAG				 129
-#define PKCS12_F_PARSE_BAGS				 103
-#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME		 100
-#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_ASC		 127
-#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI		 102
-#define PKCS12_F_PKCS12_ADD_LOCALKEYID			 104
-#define PKCS12_F_PKCS12_CREATE				 105
-#define PKCS12_F_PKCS12_GEN_MAC				 107
-#define PKCS12_F_PKCS12_INIT				 109
-#define PKCS12_F_PKCS12_ITEM_DECRYPT_D2I		 106
-#define PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT		 108
-#define PKCS12_F_PKCS12_ITEM_PACK_SAFEBAG		 117
-#define PKCS12_F_PKCS12_KEY_GEN_ASC			 110
-#define PKCS12_F_PKCS12_KEY_GEN_UNI			 111
-#define PKCS12_F_PKCS12_MAKE_KEYBAG			 112
-#define PKCS12_F_PKCS12_MAKE_SHKEYBAG			 113
-#define PKCS12_F_PKCS12_NEWPASS				 128
-#define PKCS12_F_PKCS12_PACK_P7DATA			 114
-#define PKCS12_F_PKCS12_PACK_P7ENCDATA			 115
-#define PKCS12_F_PKCS12_PARSE				 118
-#define PKCS12_F_PKCS12_PBE_CRYPT			 119
-#define PKCS12_F_PKCS12_PBE_KEYIVGEN			 120
-#define PKCS12_F_PKCS12_SETUP_MAC			 122
-#define PKCS12_F_PKCS12_SET_MAC				 123
-#define PKCS12_F_PKCS12_UNPACK_AUTHSAFES		 130
-#define PKCS12_F_PKCS12_UNPACK_P7DATA			 131
-#define PKCS12_F_PKCS12_VERIFY_MAC			 126
-#define PKCS12_F_PKCS8_ADD_KEYUSAGE			 124
-#define PKCS12_F_PKCS8_ENCRYPT				 125
+#define PKCS12_F_PARSE_BAG               129
+#define PKCS12_F_PARSE_BAGS              103
+#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME         100
+#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_ASC         127
+#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI         102
+#define PKCS12_F_PKCS12_ADD_LOCALKEYID           104
+#define PKCS12_F_PKCS12_CREATE               105
+#define PKCS12_F_PKCS12_GEN_MAC              107
+#define PKCS12_F_PKCS12_INIT                 109
+#define PKCS12_F_PKCS12_ITEM_DECRYPT_D2I         106
+#define PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT         108
+#define PKCS12_F_PKCS12_ITEM_PACK_SAFEBAG        117
+#define PKCS12_F_PKCS12_KEY_GEN_ASC          110
+#define PKCS12_F_PKCS12_KEY_GEN_UNI          111
+#define PKCS12_F_PKCS12_MAKE_KEYBAG          112
+#define PKCS12_F_PKCS12_MAKE_SHKEYBAG            113
+#define PKCS12_F_PKCS12_NEWPASS              128
+#define PKCS12_F_PKCS12_PACK_P7DATA          114
+#define PKCS12_F_PKCS12_PACK_P7ENCDATA           115
+#define PKCS12_F_PKCS12_PARSE                118
+#define PKCS12_F_PKCS12_PBE_CRYPT            119
+#define PKCS12_F_PKCS12_PBE_KEYIVGEN             120
+#define PKCS12_F_PKCS12_SETUP_MAC            122
+#define PKCS12_F_PKCS12_SET_MAC              123
+#define PKCS12_F_PKCS12_UNPACK_AUTHSAFES         130
+#define PKCS12_F_PKCS12_UNPACK_P7DATA            131
+#define PKCS12_F_PKCS12_VERIFY_MAC           126
+#define PKCS12_F_PKCS8_ADD_KEYUSAGE          124
+#define PKCS12_F_PKCS8_ENCRYPT               125
 
 /* Reason codes. */
-#define PKCS12_R_CANT_PACK_STRUCTURE			 100
-#define PKCS12_R_CONTENT_TYPE_NOT_DATA			 121
-#define PKCS12_R_DECODE_ERROR				 101
-#define PKCS12_R_ENCODE_ERROR				 102
-#define PKCS12_R_ENCRYPT_ERROR				 103
-#define PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE	 120
-#define PKCS12_R_INVALID_NULL_ARGUMENT			 104
-#define PKCS12_R_INVALID_NULL_PKCS12_POINTER		 105
-#define PKCS12_R_IV_GEN_ERROR				 106
-#define PKCS12_R_KEY_GEN_ERROR				 107
-#define PKCS12_R_MAC_ABSENT				 108
-#define PKCS12_R_MAC_GENERATION_ERROR			 109
-#define PKCS12_R_MAC_SETUP_ERROR			 110
-#define PKCS12_R_MAC_STRING_SET_ERROR			 111
-#define PKCS12_R_MAC_VERIFY_ERROR			 112
-#define PKCS12_R_MAC_VERIFY_FAILURE			 113
-#define PKCS12_R_PARSE_ERROR				 114
-#define PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR		 115
-#define PKCS12_R_PKCS12_CIPHERFINAL_ERROR		 116
-#define PKCS12_R_PKCS12_PBE_CRYPT_ERROR			 117
-#define PKCS12_R_UNKNOWN_DIGEST_ALGORITHM		 118
-#define PKCS12_R_UNSUPPORTED_PKCS12_MODE		 119
+#define PKCS12_R_CANT_PACK_STRUCTURE             100
+#define PKCS12_R_CONTENT_TYPE_NOT_DATA           121
+#define PKCS12_R_DECODE_ERROR                101
+#define PKCS12_R_ENCODE_ERROR                102
+#define PKCS12_R_ENCRYPT_ERROR               103
+#define PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE   120
+#define PKCS12_R_INVALID_NULL_ARGUMENT           104
+#define PKCS12_R_INVALID_NULL_PKCS12_POINTER         105
+#define PKCS12_R_IV_GEN_ERROR                106
+#define PKCS12_R_KEY_GEN_ERROR               107
+#define PKCS12_R_MAC_ABSENT              108
+#define PKCS12_R_MAC_GENERATION_ERROR            109
+#define PKCS12_R_MAC_SETUP_ERROR             110
+#define PKCS12_R_MAC_STRING_SET_ERROR            111
+#define PKCS12_R_MAC_VERIFY_ERROR            112
+#define PKCS12_R_MAC_VERIFY_FAILURE          113
+#define PKCS12_R_PARSE_ERROR                 114
+#define PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR       115
+#define PKCS12_R_PKCS12_CIPHERFINAL_ERROR        116
+#define PKCS12_R_PKCS12_PBE_CRYPT_ERROR          117
+#define PKCS12_R_UNKNOWN_DIGEST_ALGORITHM        118
+#define PKCS12_R_UNSUPPORTED_PKCS12_MODE         119
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/pkcs7.h b/dep/include/openssl/pkcs7.h
index cc092d262dc..16769d49116 100644
--- a/dep/include/openssl/pkcs7.h
+++ b/dep/include/openssl/pkcs7.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -77,168 +77,168 @@ extern "C" {
 #endif
 
 /*
-Encryption_ID		DES-CBC
-Digest_ID		MD5
-Digest_Encryption_ID	rsaEncryption
-Key_Encryption_ID	rsaEncryption
+Encryption_ID       DES-CBC
+Digest_ID       MD5
+Digest_Encryption_ID    rsaEncryption
+Key_Encryption_ID   rsaEncryption
 */
 
 typedef struct pkcs7_issuer_and_serial_st
-	{
-	X509_NAME *issuer;
-	ASN1_INTEGER *serial;
-	} PKCS7_ISSUER_AND_SERIAL;
+    {
+    X509_NAME *issuer;
+    ASN1_INTEGER *serial;
+    } PKCS7_ISSUER_AND_SERIAL;
 
 typedef struct pkcs7_signer_info_st
-	{
-	ASN1_INTEGER 			*version;	/* version 1 */
-	PKCS7_ISSUER_AND_SERIAL		*issuer_and_serial;
-	X509_ALGOR			*digest_alg;
-	STACK_OF(X509_ATTRIBUTE)	*auth_attr;	/* [ 0 ] */
-	X509_ALGOR			*digest_enc_alg;
-	ASN1_OCTET_STRING		*enc_digest;
-	STACK_OF(X509_ATTRIBUTE)	*unauth_attr;	/* [ 1 ] */
+    {
+    ASN1_INTEGER            *version;   /* version 1 */
+    PKCS7_ISSUER_AND_SERIAL     *issuer_and_serial;
+    X509_ALGOR          *digest_alg;
+    STACK_OF(X509_ATTRIBUTE)    *auth_attr; /* [ 0 ] */
+    X509_ALGOR          *digest_enc_alg;
+    ASN1_OCTET_STRING       *enc_digest;
+    STACK_OF(X509_ATTRIBUTE)    *unauth_attr;   /* [ 1 ] */
 
-	/* The private key to sign with */
-	EVP_PKEY			*pkey;
-	} PKCS7_SIGNER_INFO;
+    /* The private key to sign with */
+    EVP_PKEY            *pkey;
+    } PKCS7_SIGNER_INFO;
 
 DECLARE_STACK_OF(PKCS7_SIGNER_INFO)
 DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO)
 
 typedef struct pkcs7_recip_info_st
-	{
-	ASN1_INTEGER			*version;	/* version 0 */
-	PKCS7_ISSUER_AND_SERIAL		*issuer_and_serial;
-	X509_ALGOR			*key_enc_algor;
-	ASN1_OCTET_STRING		*enc_key;
-	X509				*cert; /* get the pub-key from this */
-	} PKCS7_RECIP_INFO;
+    {
+    ASN1_INTEGER            *version;   /* version 0 */
+    PKCS7_ISSUER_AND_SERIAL     *issuer_and_serial;
+    X509_ALGOR          *key_enc_algor;
+    ASN1_OCTET_STRING       *enc_key;
+    X509                *cert; /* get the pub-key from this */
+    } PKCS7_RECIP_INFO;
 
 DECLARE_STACK_OF(PKCS7_RECIP_INFO)
 DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO)
 
 typedef struct pkcs7_signed_st
-	{
-	ASN1_INTEGER			*version;	/* version 1 */
-	STACK_OF(X509_ALGOR)		*md_algs;	/* md used */
-	STACK_OF(X509)			*cert;		/* [ 0 ] */
-	STACK_OF(X509_CRL)		*crl;		/* [ 1 ] */
-	STACK_OF(PKCS7_SIGNER_INFO)	*signer_info;
+    {
+    ASN1_INTEGER            *version;   /* version 1 */
+    STACK_OF(X509_ALGOR)        *md_algs;   /* md used */
+    STACK_OF(X509)          *cert;      /* [ 0 ] */
+    STACK_OF(X509_CRL)      *crl;       /* [ 1 ] */
+    STACK_OF(PKCS7_SIGNER_INFO) *signer_info;
 
-	struct pkcs7_st			*contents;
-	} PKCS7_SIGNED;
+    struct pkcs7_st         *contents;
+    } PKCS7_SIGNED;
 /* The above structure is very very similar to PKCS7_SIGN_ENVELOPE.
  * How about merging the two */
 
 typedef struct pkcs7_enc_content_st
-	{
-	ASN1_OBJECT			*content_type;
-	X509_ALGOR			*algorithm;
-	ASN1_OCTET_STRING		*enc_data;	/* [ 0 ] */
-	const EVP_CIPHER		*cipher;
-	} PKCS7_ENC_CONTENT;
+    {
+    ASN1_OBJECT         *content_type;
+    X509_ALGOR          *algorithm;
+    ASN1_OCTET_STRING       *enc_data;  /* [ 0 ] */
+    const EVP_CIPHER        *cipher;
+    } PKCS7_ENC_CONTENT;
 
 typedef struct pkcs7_enveloped_st
-	{
-	ASN1_INTEGER			*version;	/* version 0 */
-	STACK_OF(PKCS7_RECIP_INFO)	*recipientinfo;
-	PKCS7_ENC_CONTENT		*enc_data;
-	} PKCS7_ENVELOPE;
+    {
+    ASN1_INTEGER            *version;   /* version 0 */
+    STACK_OF(PKCS7_RECIP_INFO)  *recipientinfo;
+    PKCS7_ENC_CONTENT       *enc_data;
+    } PKCS7_ENVELOPE;
 
 typedef struct pkcs7_signedandenveloped_st
-	{
-	ASN1_INTEGER			*version;	/* version 1 */
-	STACK_OF(X509_ALGOR)		*md_algs;	/* md used */
-	STACK_OF(X509)			*cert;		/* [ 0 ] */
-	STACK_OF(X509_CRL)		*crl;		/* [ 1 ] */
-	STACK_OF(PKCS7_SIGNER_INFO)	*signer_info;
+    {
+    ASN1_INTEGER            *version;   /* version 1 */
+    STACK_OF(X509_ALGOR)        *md_algs;   /* md used */
+    STACK_OF(X509)          *cert;      /* [ 0 ] */
+    STACK_OF(X509_CRL)      *crl;       /* [ 1 ] */
+    STACK_OF(PKCS7_SIGNER_INFO) *signer_info;
 
-	PKCS7_ENC_CONTENT		*enc_data;
-	STACK_OF(PKCS7_RECIP_INFO)	*recipientinfo;
-	} PKCS7_SIGN_ENVELOPE;
+    PKCS7_ENC_CONTENT       *enc_data;
+    STACK_OF(PKCS7_RECIP_INFO)  *recipientinfo;
+    } PKCS7_SIGN_ENVELOPE;
 
 typedef struct pkcs7_digest_st
-	{
-	ASN1_INTEGER			*version;	/* version 0 */
-	X509_ALGOR			*md;		/* md used */
-	struct pkcs7_st 		*contents;
-	ASN1_OCTET_STRING		*digest;
-	} PKCS7_DIGEST;
+    {
+    ASN1_INTEGER            *version;   /* version 0 */
+    X509_ALGOR          *md;        /* md used */
+    struct pkcs7_st         *contents;
+    ASN1_OCTET_STRING       *digest;
+    } PKCS7_DIGEST;
 
 typedef struct pkcs7_encrypted_st
-	{
-	ASN1_INTEGER			*version;	/* version 0 */
-	PKCS7_ENC_CONTENT		*enc_data;
-	} PKCS7_ENCRYPT;
+    {
+    ASN1_INTEGER            *version;   /* version 0 */
+    PKCS7_ENC_CONTENT       *enc_data;
+    } PKCS7_ENCRYPT;
 
 typedef struct pkcs7_st
-	{
-	/* The following is non NULL if it contains ASN1 encoding of
-	 * this structure */
-	unsigned char *asn1;
-	long length;
+    {
+    /* The following is non NULL if it contains ASN1 encoding of
+     * this structure */
+    unsigned char *asn1;
+    long length;
 
-#define PKCS7_S_HEADER	0
-#define PKCS7_S_BODY	1
-#define PKCS7_S_TAIL	2
-	int state; /* used during processing */
+#define PKCS7_S_HEADER  0
+#define PKCS7_S_BODY    1
+#define PKCS7_S_TAIL    2
+    int state; /* used during processing */
 
-	int detached;
+    int detached;
 
-	ASN1_OBJECT *type;
-	/* content as defined by the type */
-	/* all encryption/message digests are applied to the 'contents',
-	 * leaving out the 'type' field. */
-	union	{
-		char *ptr;
+    ASN1_OBJECT *type;
+    /* content as defined by the type */
+    /* all encryption/message digests are applied to the 'contents',
+     * leaving out the 'type' field. */
+    union   {
+        char *ptr;
 
-		/* NID_pkcs7_data */
-		ASN1_OCTET_STRING *data;
+        /* NID_pkcs7_data */
+        ASN1_OCTET_STRING *data;
 
-		/* NID_pkcs7_signed */
-		PKCS7_SIGNED *sign;
+        /* NID_pkcs7_signed */
+        PKCS7_SIGNED *sign;
 
-		/* NID_pkcs7_enveloped */
-		PKCS7_ENVELOPE *enveloped;
+        /* NID_pkcs7_enveloped */
+        PKCS7_ENVELOPE *enveloped;
 
-		/* NID_pkcs7_signedAndEnveloped */
-		PKCS7_SIGN_ENVELOPE *signed_and_enveloped;
+        /* NID_pkcs7_signedAndEnveloped */
+        PKCS7_SIGN_ENVELOPE *signed_and_enveloped;
 
-		/* NID_pkcs7_digest */
-		PKCS7_DIGEST *digest;
+        /* NID_pkcs7_digest */
+        PKCS7_DIGEST *digest;
 
-		/* NID_pkcs7_encrypted */
-		PKCS7_ENCRYPT *encrypted;
+        /* NID_pkcs7_encrypted */
+        PKCS7_ENCRYPT *encrypted;
 
-		/* Anything else */
-		ASN1_TYPE *other;
-		} d;
-	} PKCS7;
+        /* Anything else */
+        ASN1_TYPE *other;
+        } d;
+    } PKCS7;
 
 DECLARE_STACK_OF(PKCS7)
 DECLARE_ASN1_SET_OF(PKCS7)
 DECLARE_PKCS12_STACK_OF(PKCS7)
 
-#define PKCS7_OP_SET_DETACHED_SIGNATURE	1
-#define PKCS7_OP_GET_DETACHED_SIGNATURE	2
+#define PKCS7_OP_SET_DETACHED_SIGNATURE 1
+#define PKCS7_OP_GET_DETACHED_SIGNATURE 2
 
-#define PKCS7_get_signed_attributes(si)	((si)->auth_attr)
-#define PKCS7_get_attributes(si)	((si)->unauth_attr)
+#define PKCS7_get_signed_attributes(si) ((si)->auth_attr)
+#define PKCS7_get_attributes(si)    ((si)->unauth_attr)
 
 #define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed)
 #define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted)
 #define PKCS7_type_is_enveloped(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped)
 #define PKCS7_type_is_signedAndEnveloped(a) \
-		(OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped)
+        (OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped)
 #define PKCS7_type_is_data(a)   (OBJ_obj2nid((a)->type) == NID_pkcs7_data)
 
 #define PKCS7_type_is_digest(a)   (OBJ_obj2nid((a)->type) == NID_pkcs7_digest)
 
 #define PKCS7_set_detached(p,v) \
-		PKCS7_ctrl(p,PKCS7_OP_SET_DETACHED_SIGNATURE,v,NULL)
+        PKCS7_ctrl(p,PKCS7_OP_SET_DETACHED_SIGNATURE,v,NULL)
 #define PKCS7_get_detached(p) \
-		PKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL)
+        PKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL)
 
 #define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7))
 
@@ -246,44 +246,44 @@ DECLARE_PKCS12_STACK_OF(PKCS7)
 #ifndef PKCS7_ISSUER_AND_SERIAL_digest
 #define PKCS7_ISSUER_AND_SERIAL_digest(data,type,md,len) \
         ASN1_digest((int (*)())i2d_PKCS7_ISSUER_AND_SERIAL,type,\
-	                (char *)data,md,len)
+                    (char *)data,md,len)
 #endif
 #endif
 
 /* S/MIME related flags */
 
-#define PKCS7_TEXT		0x1
-#define PKCS7_NOCERTS		0x2
-#define PKCS7_NOSIGS		0x4
-#define PKCS7_NOCHAIN		0x8
-#define PKCS7_NOINTERN		0x10
-#define PKCS7_NOVERIFY		0x20
-#define PKCS7_DETACHED		0x40
-#define PKCS7_BINARY		0x80
-#define PKCS7_NOATTR		0x100
-#define	PKCS7_NOSMIMECAP	0x200
-#define PKCS7_NOOLDMIMETYPE	0x400
-#define PKCS7_CRLFEOL		0x800
-#define PKCS7_STREAM		0x1000
-#define PKCS7_NOCRL		0x2000
+#define PKCS7_TEXT      0x1
+#define PKCS7_NOCERTS       0x2
+#define PKCS7_NOSIGS        0x4
+#define PKCS7_NOCHAIN       0x8
+#define PKCS7_NOINTERN      0x10
+#define PKCS7_NOVERIFY      0x20
+#define PKCS7_DETACHED      0x40
+#define PKCS7_BINARY        0x80
+#define PKCS7_NOATTR        0x100
+#define PKCS7_NOSMIMECAP    0x200
+#define PKCS7_NOOLDMIMETYPE 0x400
+#define PKCS7_CRLFEOL       0x800
+#define PKCS7_STREAM        0x1000
+#define PKCS7_NOCRL     0x2000
 
 /* Flags: for compatibility with older code */
 
-#define SMIME_TEXT	PKCS7_TEXT
-#define SMIME_NOCERTS	PKCS7_NOCERTS
-#define SMIME_NOSIGS	PKCS7_NOSIGS
-#define SMIME_NOCHAIN	PKCS7_NOCHAIN
-#define SMIME_NOINTERN	PKCS7_NOINTERN
-#define SMIME_NOVERIFY	PKCS7_NOVERIFY
-#define SMIME_DETACHED	PKCS7_DETACHED
-#define SMIME_BINARY	PKCS7_BINARY
-#define SMIME_NOATTR	PKCS7_NOATTR
+#define SMIME_TEXT  PKCS7_TEXT
+#define SMIME_NOCERTS   PKCS7_NOCERTS
+#define SMIME_NOSIGS    PKCS7_NOSIGS
+#define SMIME_NOCHAIN   PKCS7_NOCHAIN
+#define SMIME_NOINTERN  PKCS7_NOINTERN
+#define SMIME_NOVERIFY  PKCS7_NOVERIFY
+#define SMIME_DETACHED  PKCS7_DETACHED
+#define SMIME_BINARY    PKCS7_BINARY
+#define SMIME_NOATTR    PKCS7_NOATTR
 
 DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL)
 
 #ifndef SSLEAY_MACROS
 int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data,const EVP_MD *type,
-	unsigned char *md,unsigned int *len);
+    unsigned char *md,unsigned int *len);
 #ifndef OPENSSL_NO_FP_API
 PKCS7 *d2i_PKCS7_fp(FILE *fp,PKCS7 **p7);
 int i2d_PKCS7_fp(FILE *fp,PKCS7 *p7);
@@ -314,15 +314,15 @@ int PKCS7_set_type(PKCS7 *p7, int type);
 int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other);
 int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data);
 int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey,
-	const EVP_MD *dgst);
+    const EVP_MD *dgst);
 int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i);
 int PKCS7_add_certificate(PKCS7 *p7, X509 *x509);
 int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509);
 int PKCS7_content_new(PKCS7 *p7, int nid);
 int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx,
-	BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si); 
+    BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si);
 int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si,
-								X509 *x509);
+                                X509 *x509);
 
 BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio);
 int PKCS7_dataFinal(PKCS7 *p7, BIO *bio);
@@ -330,7 +330,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert);
 
 
 PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509,
-	EVP_PKEY *pkey, const EVP_MD *dgst);
+    EVP_PKEY *pkey, const EVP_MD *dgst);
 X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si);
 int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md);
 STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7);
@@ -343,27 +343,27 @@ int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher);
 PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx);
 ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk);
 int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si,int nid,int type,
-	void *data);
+    void *data);
 int PKCS7_add_attribute (PKCS7_SIGNER_INFO *p7si, int nid, int atrtype,
-	void *value);
+    void *value);
 ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid);
 ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid);
 int PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si,
-				STACK_OF(X509_ATTRIBUTE) *sk);
+                STACK_OF(X509_ATTRIBUTE) *sk);
 int PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si,STACK_OF(X509_ATTRIBUTE) *sk);
 
 
 PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
-							BIO *data, int flags);
+                            BIO *data, int flags);
 int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
-					BIO *indata, BIO *out, int flags);
+                    BIO *indata, BIO *out, int flags);
 STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags);
 PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher,
-								int flags);
+                                int flags);
 int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags);
 
 int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si,
-			      STACK_OF(X509_ALGOR) *cap);
+                  STACK_OF(X509_ALGOR) *cap);
 STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si);
 int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg);
 
@@ -381,82 +381,82 @@ void ERR_load_PKCS7_strings(void);
 /* Error codes for the PKCS7 functions. */
 
 /* Function codes. */
-#define PKCS7_F_B64_READ_PKCS7				 120
-#define PKCS7_F_B64_WRITE_PKCS7				 121
-#define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP		 118
-#define PKCS7_F_PKCS7_ADD_CERTIFICATE			 100
-#define PKCS7_F_PKCS7_ADD_CRL				 101
-#define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO		 102
-#define PKCS7_F_PKCS7_ADD_SIGNER			 103
-#define PKCS7_F_PKCS7_BIO_ADD_DIGEST			 125
-#define PKCS7_F_PKCS7_CTRL				 104
-#define PKCS7_F_PKCS7_DATADECODE			 112
-#define PKCS7_F_PKCS7_DATAFINAL				 128
-#define PKCS7_F_PKCS7_DATAINIT				 105
-#define PKCS7_F_PKCS7_DATASIGN				 106
-#define PKCS7_F_PKCS7_DATAVERIFY			 107
-#define PKCS7_F_PKCS7_DECRYPT				 114
-#define PKCS7_F_PKCS7_ENCRYPT				 115
-#define PKCS7_F_PKCS7_FIND_DIGEST			 127
-#define PKCS7_F_PKCS7_GET0_SIGNERS			 124
-#define PKCS7_F_PKCS7_SET_CIPHER			 108
-#define PKCS7_F_PKCS7_SET_CONTENT			 109
-#define PKCS7_F_PKCS7_SET_DIGEST			 126
-#define PKCS7_F_PKCS7_SET_TYPE				 110
-#define PKCS7_F_PKCS7_SIGN				 116
-#define PKCS7_F_PKCS7_SIGNATUREVERIFY			 113
-#define PKCS7_F_PKCS7_SIMPLE_SMIMECAP			 119
-#define PKCS7_F_PKCS7_VERIFY				 117
-#define PKCS7_F_SMIME_READ_PKCS7			 122
-#define PKCS7_F_SMIME_TEXT				 123
+#define PKCS7_F_B64_READ_PKCS7               120
+#define PKCS7_F_B64_WRITE_PKCS7              121
+#define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP        118
+#define PKCS7_F_PKCS7_ADD_CERTIFICATE            100
+#define PKCS7_F_PKCS7_ADD_CRL                101
+#define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO         102
+#define PKCS7_F_PKCS7_ADD_SIGNER             103
+#define PKCS7_F_PKCS7_BIO_ADD_DIGEST             125
+#define PKCS7_F_PKCS7_CTRL               104
+#define PKCS7_F_PKCS7_DATADECODE             112
+#define PKCS7_F_PKCS7_DATAFINAL              128
+#define PKCS7_F_PKCS7_DATAINIT               105
+#define PKCS7_F_PKCS7_DATASIGN               106
+#define PKCS7_F_PKCS7_DATAVERIFY             107
+#define PKCS7_F_PKCS7_DECRYPT                114
+#define PKCS7_F_PKCS7_ENCRYPT                115
+#define PKCS7_F_PKCS7_FIND_DIGEST            127
+#define PKCS7_F_PKCS7_GET0_SIGNERS           124
+#define PKCS7_F_PKCS7_SET_CIPHER             108
+#define PKCS7_F_PKCS7_SET_CONTENT            109
+#define PKCS7_F_PKCS7_SET_DIGEST             126
+#define PKCS7_F_PKCS7_SET_TYPE               110
+#define PKCS7_F_PKCS7_SIGN               116
+#define PKCS7_F_PKCS7_SIGNATUREVERIFY            113
+#define PKCS7_F_PKCS7_SIMPLE_SMIMECAP            119
+#define PKCS7_F_PKCS7_VERIFY                 117
+#define PKCS7_F_SMIME_READ_PKCS7             122
+#define PKCS7_F_SMIME_TEXT               123
 
 /* Reason codes. */
-#define PKCS7_R_CERTIFICATE_VERIFY_ERROR		 117
-#define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER		 144
-#define PKCS7_R_CIPHER_NOT_INITIALIZED			 116
-#define PKCS7_R_CONTENT_AND_DATA_PRESENT		 118
-#define PKCS7_R_DECODE_ERROR				 130
-#define PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH		 100
-#define PKCS7_R_DECRYPT_ERROR				 119
-#define PKCS7_R_DIGEST_FAILURE				 101
-#define PKCS7_R_ERROR_ADDING_RECIPIENT			 120
-#define PKCS7_R_ERROR_SETTING_CIPHER			 121
-#define PKCS7_R_INVALID_MIME_TYPE			 131
-#define PKCS7_R_INVALID_NULL_POINTER			 143
-#define PKCS7_R_MIME_NO_CONTENT_TYPE			 132
-#define PKCS7_R_MIME_PARSE_ERROR			 133
-#define PKCS7_R_MIME_SIG_PARSE_ERROR			 134
-#define PKCS7_R_MISSING_CERIPEND_INFO			 103
-#define PKCS7_R_NO_CONTENT				 122
-#define PKCS7_R_NO_CONTENT_TYPE				 135
-#define PKCS7_R_NO_MULTIPART_BODY_FAILURE		 136
-#define PKCS7_R_NO_MULTIPART_BOUNDARY			 137
-#define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE	 115
-#define PKCS7_R_NO_RECIPIENT_MATCHES_KEY		 146
-#define PKCS7_R_NO_SIGNATURES_ON_DATA			 123
-#define PKCS7_R_NO_SIGNERS				 142
-#define PKCS7_R_NO_SIG_CONTENT_TYPE			 138
-#define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE	 104
-#define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR		 124
-#define PKCS7_R_PKCS7_DATAFINAL				 126
-#define PKCS7_R_PKCS7_DATAFINAL_ERROR			 125
-#define PKCS7_R_PKCS7_DATASIGN				 145
-#define PKCS7_R_PKCS7_PARSE_ERROR			 139
-#define PKCS7_R_PKCS7_SIG_PARSE_ERROR			 140
-#define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE	 127
-#define PKCS7_R_SIGNATURE_FAILURE			 105
-#define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND		 128
-#define PKCS7_R_SIG_INVALID_MIME_TYPE			 141
-#define PKCS7_R_SMIME_TEXT_ERROR			 129
-#define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE		 106
-#define PKCS7_R_UNABLE_TO_FIND_MEM_BIO			 107
-#define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST		 108
-#define PKCS7_R_UNKNOWN_DIGEST_TYPE			 109
-#define PKCS7_R_UNKNOWN_OPERATION			 110
-#define PKCS7_R_UNSUPPORTED_CIPHER_TYPE			 111
-#define PKCS7_R_UNSUPPORTED_CONTENT_TYPE		 112
-#define PKCS7_R_WRONG_CONTENT_TYPE			 113
-#define PKCS7_R_WRONG_PKCS7_TYPE			 114
+#define PKCS7_R_CERTIFICATE_VERIFY_ERROR         117
+#define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER      144
+#define PKCS7_R_CIPHER_NOT_INITIALIZED           116
+#define PKCS7_R_CONTENT_AND_DATA_PRESENT         118
+#define PKCS7_R_DECODE_ERROR                 130
+#define PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH        100
+#define PKCS7_R_DECRYPT_ERROR                119
+#define PKCS7_R_DIGEST_FAILURE               101
+#define PKCS7_R_ERROR_ADDING_RECIPIENT           120
+#define PKCS7_R_ERROR_SETTING_CIPHER             121
+#define PKCS7_R_INVALID_MIME_TYPE            131
+#define PKCS7_R_INVALID_NULL_POINTER             143
+#define PKCS7_R_MIME_NO_CONTENT_TYPE             132
+#define PKCS7_R_MIME_PARSE_ERROR             133
+#define PKCS7_R_MIME_SIG_PARSE_ERROR             134
+#define PKCS7_R_MISSING_CERIPEND_INFO            103
+#define PKCS7_R_NO_CONTENT               122
+#define PKCS7_R_NO_CONTENT_TYPE              135
+#define PKCS7_R_NO_MULTIPART_BODY_FAILURE        136
+#define PKCS7_R_NO_MULTIPART_BOUNDARY            137
+#define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE     115
+#define PKCS7_R_NO_RECIPIENT_MATCHES_KEY         146
+#define PKCS7_R_NO_SIGNATURES_ON_DATA            123
+#define PKCS7_R_NO_SIGNERS               142
+#define PKCS7_R_NO_SIG_CONTENT_TYPE          138
+#define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE     104
+#define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR        124
+#define PKCS7_R_PKCS7_DATAFINAL              126
+#define PKCS7_R_PKCS7_DATAFINAL_ERROR            125
+#define PKCS7_R_PKCS7_DATASIGN               145
+#define PKCS7_R_PKCS7_PARSE_ERROR            139
+#define PKCS7_R_PKCS7_SIG_PARSE_ERROR            140
+#define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE   127
+#define PKCS7_R_SIGNATURE_FAILURE            105
+#define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND         128
+#define PKCS7_R_SIG_INVALID_MIME_TYPE            141
+#define PKCS7_R_SMIME_TEXT_ERROR             129
+#define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE       106
+#define PKCS7_R_UNABLE_TO_FIND_MEM_BIO           107
+#define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST        108
+#define PKCS7_R_UNKNOWN_DIGEST_TYPE          109
+#define PKCS7_R_UNKNOWN_OPERATION            110
+#define PKCS7_R_UNSUPPORTED_CIPHER_TYPE          111
+#define PKCS7_R_UNSUPPORTED_CONTENT_TYPE         112
+#define PKCS7_R_WRONG_CONTENT_TYPE           113
+#define PKCS7_R_WRONG_PKCS7_TYPE             114
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/pq_compat.h b/dep/include/openssl/pq_compat.h
index 28c58a0261d..fd2b5bbf1a0 100644
--- a/dep/include/openssl/pq_compat.h
+++ b/dep/include/openssl/pq_compat.h
@@ -1,7 +1,7 @@
 /* crypto/pqueue/pqueue_compat.h */
-/* 
+/*
  * DTLS implementation written by Nagendra Modadugu
- * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.  
+ * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
  */
 /* ====================================================================
  * Copyright (c) 1999-2005 The OpenSSL Project.  All rights reserved.
@@ -11,7 +11,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -60,7 +60,7 @@
 #include "opensslconf.h"
 #include 
 
-/* 
+/*
  * The purpose of this header file is for supporting 64-bit integer
  * manipulation on 32-bit (and lower) machines.  Currently the only
  * such environment is VMS, Utrix and those with smaller default integer
@@ -128,7 +128,7 @@
 
 #define pq_64bit_assign(x, y)        (*(x) = *(y))
 #define pq_64bit_assign_word(x, y)   (*(x) = y)
-#define pq_64bit_gt(x, y)	         (*(x) > *(y))
+#define pq_64bit_gt(x, y)            (*(x) > *(y))
 #define pq_64bit_eq(x, y)            (*(x) == *(y))
 #define pq_64bit_add_word(x, w)      (*(x) = (*(x) + (w)))
 #define pq_64bit_sub(r, x, y)        (*(r) = (*(x) - *(y)))
diff --git a/dep/include/openssl/pqueue.h b/dep/include/openssl/pqueue.h
index 02386d130e9..6920a409282 100644
--- a/dep/include/openssl/pqueue.h
+++ b/dep/include/openssl/pqueue.h
@@ -1,7 +1,7 @@
 /* crypto/pqueue/pqueue.h */
-/* 
+/*
  * DTLS implementation written by Nagendra Modadugu
- * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.  
+ * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
  */
 /* ====================================================================
  * Copyright (c) 1999-2005 The OpenSSL Project.  All rights reserved.
@@ -11,7 +11,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -69,11 +69,11 @@
 typedef struct _pqueue *pqueue;
 
 typedef struct _pitem
-	{
-	PQ_64BIT priority;
-	void *data;
-	struct _pitem *next;
-	} pitem;
+    {
+    PQ_64BIT priority;
+    void *data;
+    struct _pitem *next;
+    } pitem;
 
 typedef struct _pitem *piterator;
 
diff --git a/dep/include/openssl/rand.h b/dep/include/openssl/rand.h
index ac6c0217636..fd1cb148faf 100644
--- a/dep/include/openssl/rand.h
+++ b/dep/include/openssl/rand.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -79,14 +79,14 @@ extern "C" {
 /* typedef struct rand_meth_st RAND_METHOD; */
 
 struct rand_meth_st
-	{
-	void (*seed)(const void *buf, int num);
-	int (*bytes)(unsigned char *buf, int num);
-	void (*cleanup)(void);
-	void (*add)(const void *buf, int num, double entropy);
-	int (*pseudorand)(unsigned char *buf, int num);
-	int (*status)(void);
-	};
+    {
+    void (*seed)(const void *buf, int num);
+    int (*bytes)(unsigned char *buf, int num);
+    void (*cleanup)(void);
+    void (*add)(const void *buf, int num, double entropy);
+    int (*pseudorand)(unsigned char *buf, int num);
+    int (*status)(void);
+    };
 
 #ifdef BN_DEBUG
 extern int rand_predictable;
@@ -128,11 +128,11 @@ void ERR_load_RAND_strings(void);
 /* Error codes for the RAND functions. */
 
 /* Function codes. */
-#define RAND_F_RAND_GET_RAND_METHOD			 101
-#define RAND_F_SSLEAY_RAND_BYTES			 100
+#define RAND_F_RAND_GET_RAND_METHOD          101
+#define RAND_F_SSLEAY_RAND_BYTES             100
 
 /* Reason codes. */
-#define RAND_R_PRNG_NOT_SEEDED				 100
+#define RAND_R_PRNG_NOT_SEEDED               100
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/rc2.h b/dep/include/openssl/rc2.h
index 34c83623172..e74f96c4d02 100644
--- a/dep/include/openssl/rc2.h
+++ b/dep/include/openssl/rc2.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -64,35 +64,35 @@
 #error RC2 is disabled.
 #endif
 
-#define RC2_ENCRYPT	1
-#define RC2_DECRYPT	0
+#define RC2_ENCRYPT 1
+#define RC2_DECRYPT 0
 
-#define RC2_BLOCK	8
-#define RC2_KEY_LENGTH	16
+#define RC2_BLOCK   8
+#define RC2_KEY_LENGTH  16
 
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
 typedef struct rc2_key_st
-	{
-	RC2_INT data[64];
-	} RC2_KEY;
+    {
+    RC2_INT data[64];
+    } RC2_KEY;
+
 
- 
 void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits);
 void RC2_ecb_encrypt(const unsigned char *in,unsigned char *out,RC2_KEY *key,
-		     int enc);
+             int enc);
 void RC2_encrypt(unsigned long *data,RC2_KEY *key);
 void RC2_decrypt(unsigned long *data,RC2_KEY *key);
 void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
-	RC2_KEY *ks, unsigned char *iv, int enc);
+    RC2_KEY *ks, unsigned char *iv, int enc);
 void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out,
-		       long length, RC2_KEY *schedule, unsigned char *ivec,
-		       int *num, int enc);
+               long length, RC2_KEY *schedule, unsigned char *ivec,
+               int *num, int enc);
 void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out,
-		       long length, RC2_KEY *schedule, unsigned char *ivec,
-		       int *num);
+               long length, RC2_KEY *schedule, unsigned char *ivec,
+               int *num);
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/rc4.h b/dep/include/openssl/rc4.h
index 7aec04fe93a..19391222ac0 100644
--- a/dep/include/openssl/rc4.h
+++ b/dep/include/openssl/rc4.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -69,16 +69,16 @@ extern "C" {
 #endif
 
 typedef struct rc4_key_st
-	{
-	RC4_INT x,y;
-	RC4_INT data[256];
-	} RC4_KEY;
+    {
+    RC4_INT x,y;
+    RC4_INT data[256];
+    } RC4_KEY;
+
 
- 
 const char *RC4_options(void);
 void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data);
 void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,
-		unsigned char *outdata);
+        unsigned char *outdata);
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/rc5.h b/dep/include/openssl/rc5.h
index de61ce83f49..a0fd12289e1 100644
--- a/dep/include/openssl/rc5.h
+++ b/dep/include/openssl/rc5.h
@@ -67,47 +67,47 @@ extern "C" {
 #error RC5 is disabled.
 #endif
 
-#define RC5_ENCRYPT	1
-#define RC5_DECRYPT	0
+#define RC5_ENCRYPT 1
+#define RC5_DECRYPT 0
 
 /* 32 bit.  For Alpha, things may get weird */
 #define RC5_32_INT unsigned long
 
-#define RC5_32_BLOCK		8
-#define RC5_32_KEY_LENGTH	16 /* This is a default, max is 255 */
+#define RC5_32_BLOCK        8
+#define RC5_32_KEY_LENGTH   16 /* This is a default, max is 255 */
 
 /* This are the only values supported.  Tweak the code if you want more
  * The most supported modes will be
  * RC5-32/12/16
  * RC5-32/16/8
  */
-#define RC5_8_ROUNDS	8
-#define RC5_12_ROUNDS	12
-#define RC5_16_ROUNDS	16
+#define RC5_8_ROUNDS    8
+#define RC5_12_ROUNDS   12
+#define RC5_16_ROUNDS   16
 
 typedef struct rc5_key_st
-	{
-	/* Number of rounds */
-	int rounds;
-	RC5_32_INT data[2*(RC5_16_ROUNDS+1)];
-	} RC5_32_KEY;
+    {
+    /* Number of rounds */
+    int rounds;
+    RC5_32_INT data[2*(RC5_16_ROUNDS+1)];
+    } RC5_32_KEY;
 
 
 void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
-	int rounds);
+    int rounds);
 void RC5_32_ecb_encrypt(const unsigned char *in,unsigned char *out,RC5_32_KEY *key,
-	int enc);
+    int enc);
 void RC5_32_encrypt(unsigned long *data,RC5_32_KEY *key);
 void RC5_32_decrypt(unsigned long *data,RC5_32_KEY *key);
 void RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out,
-			long length, RC5_32_KEY *ks, unsigned char *iv,
-			int enc);
+            long length, RC5_32_KEY *ks, unsigned char *iv,
+            int enc);
 void RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out,
-			  long length, RC5_32_KEY *schedule,
-			  unsigned char *ivec, int *num, int enc);
+              long length, RC5_32_KEY *schedule,
+              unsigned char *ivec, int *num, int enc);
 void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out,
-			  long length, RC5_32_KEY *schedule,
-			  unsigned char *ivec, int *num);
+              long length, RC5_32_KEY *schedule,
+              unsigned char *ivec, int *num);
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/ripemd.h b/dep/include/openssl/ripemd.h
index 033a5965b58..57a50715bed 100644
--- a/dep/include/openssl/ripemd.h
+++ b/dep/include/openssl/ripemd.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -79,23 +79,23 @@ extern "C" {
 #define RIPEMD160_LONG unsigned int
 #endif
 
-#define RIPEMD160_CBLOCK	64
-#define RIPEMD160_LBLOCK	(RIPEMD160_CBLOCK/4)
-#define RIPEMD160_DIGEST_LENGTH	20
+#define RIPEMD160_CBLOCK    64
+#define RIPEMD160_LBLOCK    (RIPEMD160_CBLOCK/4)
+#define RIPEMD160_DIGEST_LENGTH 20
 
 typedef struct RIPEMD160state_st
-	{
-	RIPEMD160_LONG A,B,C,D,E;
-	RIPEMD160_LONG Nl,Nh;
-	RIPEMD160_LONG data[RIPEMD160_LBLOCK];
-	unsigned int   num;
-	} RIPEMD160_CTX;
+    {
+    RIPEMD160_LONG A,B,C,D,E;
+    RIPEMD160_LONG Nl,Nh;
+    RIPEMD160_LONG data[RIPEMD160_LBLOCK];
+    unsigned int   num;
+    } RIPEMD160_CTX;
 
 int RIPEMD160_Init(RIPEMD160_CTX *c);
 int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len);
 int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c);
 unsigned char *RIPEMD160(const unsigned char *d, size_t n,
-	unsigned char *md);
+    unsigned char *md);
 void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b);
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/rsa.h b/dep/include/openssl/rsa.h
index b19c556930f..4b69c824145 100644
--- a/dep/include/openssl/rsa.h
+++ b/dep/include/openssl/rsa.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -83,28 +83,28 @@ extern "C" {
 /* typedef struct rsa_meth_st RSA_METHOD; */
 
 struct rsa_meth_st
-	{
-	const char *name;
-	int (*rsa_pub_enc)(int flen,const unsigned char *from,
-			   unsigned char *to,
-			   RSA *rsa,int padding);
-	int (*rsa_pub_dec)(int flen,const unsigned char *from,
-			   unsigned char *to,
-			   RSA *rsa,int padding);
-	int (*rsa_priv_enc)(int flen,const unsigned char *from,
-			    unsigned char *to,
-			    RSA *rsa,int padding);
-	int (*rsa_priv_dec)(int flen,const unsigned char *from,
-			    unsigned char *to,
-			    RSA *rsa,int padding);
-	int (*rsa_mod_exp)(BIGNUM *r0,const BIGNUM *I,RSA *rsa,BN_CTX *ctx); /* Can be null */
-	int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
-			  const BIGNUM *m, BN_CTX *ctx,
-			  BN_MONT_CTX *m_ctx); /* Can be null */
-	int (*init)(RSA *rsa);		/* called at new */
-	int (*finish)(RSA *rsa);	/* called at free */
-	int flags;			/* RSA_METHOD_FLAG_* things */
-	char *app_data;			/* may be needed! */
+    {
+    const char *name;
+    int (*rsa_pub_enc)(int flen,const unsigned char *from,
+               unsigned char *to,
+               RSA *rsa,int padding);
+    int (*rsa_pub_dec)(int flen,const unsigned char *from,
+               unsigned char *to,
+               RSA *rsa,int padding);
+    int (*rsa_priv_enc)(int flen,const unsigned char *from,
+                unsigned char *to,
+                RSA *rsa,int padding);
+    int (*rsa_priv_dec)(int flen,const unsigned char *from,
+                unsigned char *to,
+                RSA *rsa,int padding);
+    int (*rsa_mod_exp)(BIGNUM *r0,const BIGNUM *I,RSA *rsa,BN_CTX *ctx); /* Can be null */
+    int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+              const BIGNUM *m, BN_CTX *ctx,
+              BN_MONT_CTX *m_ctx); /* Can be null */
+    int (*init)(RSA *rsa);      /* called at new */
+    int (*finish)(RSA *rsa);    /* called at free */
+    int flags;          /* RSA_METHOD_FLAG_* things */
+    char *app_data;         /* may be needed! */
 /* New sign and verify functions: some libraries don't allow arbitrary data
  * to be signed/verified: this allows them to be used. Note: for this to work
  * the RSA_public_decrypt() and RSA_private_encrypt() should *NOT* be used
@@ -112,90 +112,90 @@ struct rsa_meth_st
  * compatibility this functionality is only enabled if the RSA_FLAG_SIGN_VER
  * option is set in 'flags'.
  */
-	int (*rsa_sign)(int type,
-		const unsigned char *m, unsigned int m_length,
-		unsigned char *sigret, unsigned int *siglen, const RSA *rsa);
-	int (*rsa_verify)(int dtype,
-		const unsigned char *m, unsigned int m_length,
-		unsigned char *sigbuf, unsigned int siglen, const RSA *rsa);
+    int (*rsa_sign)(int type,
+        const unsigned char *m, unsigned int m_length,
+        unsigned char *sigret, unsigned int *siglen, const RSA *rsa);
+    int (*rsa_verify)(int dtype,
+        const unsigned char *m, unsigned int m_length,
+        unsigned char *sigbuf, unsigned int siglen, const RSA *rsa);
 /* If this callback is NULL, the builtin software RSA key-gen will be used. This
  * is for behavioural compatibility whilst the code gets rewired, but one day
  * it would be nice to assume there are no such things as "builtin software"
  * implementations. */
-	int (*rsa_keygen)(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
-	};
+    int (*rsa_keygen)(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
+    };
 
 struct rsa_st
-	{
-	/* The first parameter is used to pickup errors where
-	 * this is passed instead of aEVP_PKEY, it is set to 0 */
-	int pad;
-	long version;
-	const RSA_METHOD *meth;
-	/* functional reference if 'meth' is ENGINE-provided */
-	ENGINE *engine;
-	BIGNUM *n;
-	BIGNUM *e;
-	BIGNUM *d;
-	BIGNUM *p;
-	BIGNUM *q;
-	BIGNUM *dmp1;
-	BIGNUM *dmq1;
-	BIGNUM *iqmp;
-	/* be careful using this if the RSA structure is shared */
-	CRYPTO_EX_DATA ex_data;
-	int references;
-	int flags;
+    {
+    /* The first parameter is used to pickup errors where
+     * this is passed instead of aEVP_PKEY, it is set to 0 */
+    int pad;
+    long version;
+    const RSA_METHOD *meth;
+    /* functional reference if 'meth' is ENGINE-provided */
+    ENGINE *engine;
+    BIGNUM *n;
+    BIGNUM *e;
+    BIGNUM *d;
+    BIGNUM *p;
+    BIGNUM *q;
+    BIGNUM *dmp1;
+    BIGNUM *dmq1;
+    BIGNUM *iqmp;
+    /* be careful using this if the RSA structure is shared */
+    CRYPTO_EX_DATA ex_data;
+    int references;
+    int flags;
 
-	/* Used to cache montgomery values */
-	BN_MONT_CTX *_method_mod_n;
-	BN_MONT_CTX *_method_mod_p;
-	BN_MONT_CTX *_method_mod_q;
+    /* Used to cache montgomery values */
+    BN_MONT_CTX *_method_mod_n;
+    BN_MONT_CTX *_method_mod_p;
+    BN_MONT_CTX *_method_mod_q;
 
-	/* all BIGNUM values are actually in the following data, if it is not
-	 * NULL */
-	char *bignum_data;
-	BN_BLINDING *blinding;
-	BN_BLINDING *mt_blinding;
-	};
+    /* all BIGNUM values are actually in the following data, if it is not
+     * NULL */
+    char *bignum_data;
+    BN_BLINDING *blinding;
+    BN_BLINDING *mt_blinding;
+    };
 
 #ifndef OPENSSL_RSA_MAX_MODULUS_BITS
-# define OPENSSL_RSA_MAX_MODULUS_BITS	16384
+# define OPENSSL_RSA_MAX_MODULUS_BITS   16384
 #endif
 
 #ifndef OPENSSL_RSA_SMALL_MODULUS_BITS
-# define OPENSSL_RSA_SMALL_MODULUS_BITS	3072
+# define OPENSSL_RSA_SMALL_MODULUS_BITS 3072
 #endif
 #ifndef OPENSSL_RSA_MAX_PUBEXP_BITS
-# define OPENSSL_RSA_MAX_PUBEXP_BITS	64 /* exponent limit enforced for "large" modulus only */
+# define OPENSSL_RSA_MAX_PUBEXP_BITS    64 /* exponent limit enforced for "large" modulus only */
 #endif
 
-#define RSA_3	0x3L
-#define RSA_F4	0x10001L
+#define RSA_3   0x3L
+#define RSA_F4  0x10001L
 
-#define RSA_METHOD_FLAG_NO_CHECK	0x0001 /* don't check pub/private match */
+#define RSA_METHOD_FLAG_NO_CHECK    0x0001 /* don't check pub/private match */
 
-#define RSA_FLAG_CACHE_PUBLIC		0x0002
-#define RSA_FLAG_CACHE_PRIVATE		0x0004
-#define RSA_FLAG_BLINDING		0x0008
-#define RSA_FLAG_THREAD_SAFE		0x0010
+#define RSA_FLAG_CACHE_PUBLIC       0x0002
+#define RSA_FLAG_CACHE_PRIVATE      0x0004
+#define RSA_FLAG_BLINDING       0x0008
+#define RSA_FLAG_THREAD_SAFE        0x0010
 /* This flag means the private key operations will be handled by rsa_mod_exp
  * and that they do not depend on the private key components being present:
  * for example a key stored in external hardware. Without this flag bn_mod_exp
  * gets called when private key components are absent.
  */
-#define RSA_FLAG_EXT_PKEY		0x0020
+#define RSA_FLAG_EXT_PKEY       0x0020
 
 /* This flag in the RSA_METHOD enables the new rsa_sign, rsa_verify functions.
  */
-#define RSA_FLAG_SIGN_VER		0x0040
+#define RSA_FLAG_SIGN_VER       0x0040
 
-#define RSA_FLAG_NO_BLINDING		0x0080 /* new with 0.9.6j and 0.9.7b; the built-in
+#define RSA_FLAG_NO_BLINDING        0x0080 /* new with 0.9.6j and 0.9.7b; the built-in
                                                 * RSA implementation now uses blinding by
                                                 * default (ignoring RSA_FLAG_BLINDING),
                                                 * but other engines might not need it
                                                 */
-#define RSA_FLAG_NO_EXP_CONSTTIME	0x0100 /* new with 0.9.7h; the built-in RSA
+#define RSA_FLAG_NO_EXP_CONSTTIME   0x0100 /* new with 0.9.7h; the built-in RSA
                                                 * implementation now uses constant time
                                                 * modular exponentiation for secret exponents
                                                 * by default. This flag causes the
@@ -203,45 +203,45 @@ struct rsa_st
                                                 * be used for all exponents.
                                                 */
 
-#define RSA_PKCS1_PADDING	1
-#define RSA_SSLV23_PADDING	2
-#define RSA_NO_PADDING		3
-#define RSA_PKCS1_OAEP_PADDING	4
-#define RSA_X931_PADDING	5
+#define RSA_PKCS1_PADDING   1
+#define RSA_SSLV23_PADDING  2
+#define RSA_NO_PADDING      3
+#define RSA_PKCS1_OAEP_PADDING  4
+#define RSA_X931_PADDING    5
 
-#define RSA_PKCS1_PADDING_SIZE	11
+#define RSA_PKCS1_PADDING_SIZE  11
 
 #define RSA_set_app_data(s,arg)         RSA_set_ex_data(s,0,arg)
 #define RSA_get_app_data(s)             RSA_get_ex_data(s,0)
 
-RSA *	RSA_new(void);
-RSA *	RSA_new_method(ENGINE *engine);
-int	RSA_size(const RSA *);
+RSA *   RSA_new(void);
+RSA *   RSA_new_method(ENGINE *engine);
+int RSA_size(const RSA *);
 
 /* Deprecated version */
 #ifndef OPENSSL_NO_DEPRECATED
-RSA *	RSA_generate_key(int bits, unsigned long e,void
-		(*callback)(int,int,void *),void *cb_arg);
+RSA *   RSA_generate_key(int bits, unsigned long e,void
+        (*callback)(int,int,void *),void *cb_arg);
 #endif /* !defined(OPENSSL_NO_DEPRECATED) */
 
 /* New version */
-int	RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
+int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
 
-int	RSA_check_key(const RSA *);
-	/* next 4 return -1 on error */
-int	RSA_public_encrypt(int flen, const unsigned char *from,
-		unsigned char *to, RSA *rsa,int padding);
-int	RSA_private_encrypt(int flen, const unsigned char *from,
-		unsigned char *to, RSA *rsa,int padding);
-int	RSA_public_decrypt(int flen, const unsigned char *from, 
-		unsigned char *to, RSA *rsa,int padding);
-int	RSA_private_decrypt(int flen, const unsigned char *from, 
-		unsigned char *to, RSA *rsa,int padding);
-void	RSA_free (RSA *r);
+int RSA_check_key(const RSA *);
+    /* next 4 return -1 on error */
+int RSA_public_encrypt(int flen, const unsigned char *from,
+        unsigned char *to, RSA *rsa,int padding);
+int RSA_private_encrypt(int flen, const unsigned char *from,
+        unsigned char *to, RSA *rsa,int padding);
+int RSA_public_decrypt(int flen, const unsigned char *from,
+        unsigned char *to, RSA *rsa,int padding);
+int RSA_private_decrypt(int flen, const unsigned char *from,
+        unsigned char *to, RSA *rsa,int padding);
+void    RSA_free (RSA *r);
 /* "up" the RSA object's reference count */
-int	RSA_up_ref(RSA *r);
+int RSA_up_ref(RSA *r);
 
-int	RSA_flags(const RSA *r);
+int RSA_flags(const RSA *r);
 
 void RSA_set_default_method(const RSA_METHOD *meth);
 const RSA_METHOD *RSA_get_default_method(void);
@@ -260,85 +260,85 @@ DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPublicKey)
 DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPrivateKey)
 
 #ifndef OPENSSL_NO_FP_API
-int	RSA_print_fp(FILE *fp, const RSA *r,int offset);
+int RSA_print_fp(FILE *fp, const RSA *r,int offset);
 #endif
 
 #ifndef OPENSSL_NO_BIO
-int	RSA_print(BIO *bp, const RSA *r,int offset);
+int RSA_print(BIO *bp, const RSA *r,int offset);
 #endif
 
 int i2d_RSA_NET(const RSA *a, unsigned char **pp,
-		int (*cb)(char *buf, int len, const char *prompt, int verify),
-		int sgckey);
+        int (*cb)(char *buf, int len, const char *prompt, int verify),
+        int sgckey);
 RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length,
-		 int (*cb)(char *buf, int len, const char *prompt, int verify),
-		 int sgckey);
+         int (*cb)(char *buf, int len, const char *prompt, int verify),
+         int sgckey);
 
 int i2d_Netscape_RSA(const RSA *a, unsigned char **pp,
-		     int (*cb)(char *buf, int len, const char *prompt,
-			       int verify));
+             int (*cb)(char *buf, int len, const char *prompt,
+                   int verify));
 RSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length,
-		      int (*cb)(char *buf, int len, const char *prompt,
-				int verify));
+              int (*cb)(char *buf, int len, const char *prompt,
+                int verify));
 
 /* The following 2 functions sign and verify a X509_SIG ASN1 object
  * inside PKCS#1 padded RSA encryption */
 int RSA_sign(int type, const unsigned char *m, unsigned int m_length,
-	unsigned char *sigret, unsigned int *siglen, RSA *rsa);
+    unsigned char *sigret, unsigned int *siglen, RSA *rsa);
 int RSA_verify(int type, const unsigned char *m, unsigned int m_length,
-	unsigned char *sigbuf, unsigned int siglen, RSA *rsa);
+    unsigned char *sigbuf, unsigned int siglen, RSA *rsa);
 
 /* The following 2 function sign and verify a ASN1_OCTET_STRING
  * object inside PKCS#1 padded RSA encryption */
 int RSA_sign_ASN1_OCTET_STRING(int type,
-	const unsigned char *m, unsigned int m_length,
-	unsigned char *sigret, unsigned int *siglen, RSA *rsa);
+    const unsigned char *m, unsigned int m_length,
+    unsigned char *sigret, unsigned int *siglen, RSA *rsa);
 int RSA_verify_ASN1_OCTET_STRING(int type,
-	const unsigned char *m, unsigned int m_length,
-	unsigned char *sigbuf, unsigned int siglen, RSA *rsa);
+    const unsigned char *m, unsigned int m_length,
+    unsigned char *sigbuf, unsigned int siglen, RSA *rsa);
 
 int RSA_blinding_on(RSA *rsa, BN_CTX *ctx);
 void RSA_blinding_off(RSA *rsa);
 BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx);
 
 int RSA_padding_add_PKCS1_type_1(unsigned char *to,int tlen,
-	const unsigned char *f,int fl);
+    const unsigned char *f,int fl);
 int RSA_padding_check_PKCS1_type_1(unsigned char *to,int tlen,
-	const unsigned char *f,int fl,int rsa_len);
+    const unsigned char *f,int fl,int rsa_len);
 int RSA_padding_add_PKCS1_type_2(unsigned char *to,int tlen,
-	const unsigned char *f,int fl);
+    const unsigned char *f,int fl);
 int RSA_padding_check_PKCS1_type_2(unsigned char *to,int tlen,
-	const unsigned char *f,int fl,int rsa_len);
+    const unsigned char *f,int fl,int rsa_len);
 int PKCS1_MGF1(unsigned char *mask, long len,
-	const unsigned char *seed, long seedlen, const EVP_MD *dgst);
+    const unsigned char *seed, long seedlen, const EVP_MD *dgst);
 int RSA_padding_add_PKCS1_OAEP(unsigned char *to,int tlen,
-	const unsigned char *f,int fl,
-	const unsigned char *p,int pl);
+    const unsigned char *f,int fl,
+    const unsigned char *p,int pl);
 int RSA_padding_check_PKCS1_OAEP(unsigned char *to,int tlen,
-	const unsigned char *f,int fl,int rsa_len,
-	const unsigned char *p,int pl);
+    const unsigned char *f,int fl,int rsa_len,
+    const unsigned char *p,int pl);
 int RSA_padding_add_SSLv23(unsigned char *to,int tlen,
-	const unsigned char *f,int fl);
+    const unsigned char *f,int fl);
 int RSA_padding_check_SSLv23(unsigned char *to,int tlen,
-	const unsigned char *f,int fl,int rsa_len);
+    const unsigned char *f,int fl,int rsa_len);
 int RSA_padding_add_none(unsigned char *to,int tlen,
-	const unsigned char *f,int fl);
+    const unsigned char *f,int fl);
 int RSA_padding_check_none(unsigned char *to,int tlen,
-	const unsigned char *f,int fl,int rsa_len);
+    const unsigned char *f,int fl,int rsa_len);
 int RSA_padding_add_X931(unsigned char *to,int tlen,
-	const unsigned char *f,int fl);
+    const unsigned char *f,int fl);
 int RSA_padding_check_X931(unsigned char *to,int tlen,
-	const unsigned char *f,int fl,int rsa_len);
+    const unsigned char *f,int fl,int rsa_len);
 int RSA_X931_hash_id(int nid);
 
 int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash,
-			const EVP_MD *Hash, const unsigned char *EM, int sLen);
+            const EVP_MD *Hash, const unsigned char *EM, int sLen);
 int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM,
-			const unsigned char *mHash,
-			const EVP_MD *Hash, int sLen);
+            const unsigned char *mHash,
+            const EVP_MD *Hash, int sLen);
 
 int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
-	CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+    CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
 int RSA_set_ex_data(RSA *r,int idx,void *arg);
 void *RSA_get_ex_data(const RSA *r, int idx);
 
@@ -354,86 +354,86 @@ void ERR_load_RSA_strings(void);
 /* Error codes for the RSA functions. */
 
 /* Function codes. */
-#define RSA_F_MEMORY_LOCK				 100
-#define RSA_F_RSA_BUILTIN_KEYGEN			 129
-#define RSA_F_RSA_CHECK_KEY				 123
-#define RSA_F_RSA_EAY_PRIVATE_DECRYPT			 101
-#define RSA_F_RSA_EAY_PRIVATE_ENCRYPT			 102
-#define RSA_F_RSA_EAY_PUBLIC_DECRYPT			 103
-#define RSA_F_RSA_EAY_PUBLIC_ENCRYPT			 104
-#define RSA_F_RSA_GENERATE_KEY				 105
-#define RSA_F_RSA_MEMORY_LOCK				 130
-#define RSA_F_RSA_NEW_METHOD				 106
-#define RSA_F_RSA_NULL					 124
-#define RSA_F_RSA_NULL_MOD_EXP				 131
-#define RSA_F_RSA_NULL_PRIVATE_DECRYPT			 132
-#define RSA_F_RSA_NULL_PRIVATE_ENCRYPT			 133
-#define RSA_F_RSA_NULL_PUBLIC_DECRYPT			 134
-#define RSA_F_RSA_NULL_PUBLIC_ENCRYPT			 135
-#define RSA_F_RSA_PADDING_ADD_NONE			 107
-#define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP		 121
-#define RSA_F_RSA_PADDING_ADD_PKCS1_PSS			 125
-#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1		 108
-#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2		 109
-#define RSA_F_RSA_PADDING_ADD_SSLV23			 110
-#define RSA_F_RSA_PADDING_ADD_X931			 127
-#define RSA_F_RSA_PADDING_CHECK_NONE			 111
-#define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP		 122
-#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1		 112
-#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2		 113
-#define RSA_F_RSA_PADDING_CHECK_SSLV23			 114
-#define RSA_F_RSA_PADDING_CHECK_X931			 128
-#define RSA_F_RSA_PRINT					 115
-#define RSA_F_RSA_PRINT_FP				 116
-#define RSA_F_RSA_SETUP_BLINDING			 136
-#define RSA_F_RSA_SIGN					 117
-#define RSA_F_RSA_SIGN_ASN1_OCTET_STRING		 118
-#define RSA_F_RSA_VERIFY				 119
-#define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING		 120
-#define RSA_F_RSA_VERIFY_PKCS1_PSS			 126
+#define RSA_F_MEMORY_LOCK                100
+#define RSA_F_RSA_BUILTIN_KEYGEN             129
+#define RSA_F_RSA_CHECK_KEY              123
+#define RSA_F_RSA_EAY_PRIVATE_DECRYPT            101
+#define RSA_F_RSA_EAY_PRIVATE_ENCRYPT            102
+#define RSA_F_RSA_EAY_PUBLIC_DECRYPT             103
+#define RSA_F_RSA_EAY_PUBLIC_ENCRYPT             104
+#define RSA_F_RSA_GENERATE_KEY               105
+#define RSA_F_RSA_MEMORY_LOCK                130
+#define RSA_F_RSA_NEW_METHOD                 106
+#define RSA_F_RSA_NULL                   124
+#define RSA_F_RSA_NULL_MOD_EXP               131
+#define RSA_F_RSA_NULL_PRIVATE_DECRYPT           132
+#define RSA_F_RSA_NULL_PRIVATE_ENCRYPT           133
+#define RSA_F_RSA_NULL_PUBLIC_DECRYPT            134
+#define RSA_F_RSA_NULL_PUBLIC_ENCRYPT            135
+#define RSA_F_RSA_PADDING_ADD_NONE           107
+#define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP         121
+#define RSA_F_RSA_PADDING_ADD_PKCS1_PSS          125
+#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1       108
+#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2       109
+#define RSA_F_RSA_PADDING_ADD_SSLV23             110
+#define RSA_F_RSA_PADDING_ADD_X931           127
+#define RSA_F_RSA_PADDING_CHECK_NONE             111
+#define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP       122
+#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1         112
+#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2         113
+#define RSA_F_RSA_PADDING_CHECK_SSLV23           114
+#define RSA_F_RSA_PADDING_CHECK_X931             128
+#define RSA_F_RSA_PRINT                  115
+#define RSA_F_RSA_PRINT_FP               116
+#define RSA_F_RSA_SETUP_BLINDING             136
+#define RSA_F_RSA_SIGN                   117
+#define RSA_F_RSA_SIGN_ASN1_OCTET_STRING         118
+#define RSA_F_RSA_VERIFY                 119
+#define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING       120
+#define RSA_F_RSA_VERIFY_PKCS1_PSS           126
 
 /* Reason codes. */
-#define RSA_R_ALGORITHM_MISMATCH			 100
-#define RSA_R_BAD_E_VALUE				 101
-#define RSA_R_BAD_FIXED_HEADER_DECRYPT			 102
-#define RSA_R_BAD_PAD_BYTE_COUNT			 103
-#define RSA_R_BAD_SIGNATURE				 104
-#define RSA_R_BLOCK_TYPE_IS_NOT_01			 106
-#define RSA_R_BLOCK_TYPE_IS_NOT_02			 107
-#define RSA_R_DATA_GREATER_THAN_MOD_LEN			 108
-#define RSA_R_DATA_TOO_LARGE				 109
-#define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE		 110
-#define RSA_R_DATA_TOO_LARGE_FOR_MODULUS		 132
-#define RSA_R_DATA_TOO_SMALL				 111
-#define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE		 122
-#define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY		 112
-#define RSA_R_DMP1_NOT_CONGRUENT_TO_D			 124
-#define RSA_R_DMQ1_NOT_CONGRUENT_TO_D			 125
-#define RSA_R_D_E_NOT_CONGRUENT_TO_1			 123
-#define RSA_R_FIRST_OCTET_INVALID			 133
-#define RSA_R_INVALID_HEADER				 137
-#define RSA_R_INVALID_MESSAGE_LENGTH			 131
-#define RSA_R_INVALID_PADDING				 138
-#define RSA_R_INVALID_TRAILER				 139
-#define RSA_R_IQMP_NOT_INVERSE_OF_Q			 126
-#define RSA_R_KEY_SIZE_TOO_SMALL			 120
-#define RSA_R_LAST_OCTET_INVALID			 134
-#define RSA_R_MODULUS_TOO_LARGE				 105
-#define RSA_R_NO_PUBLIC_EXPONENT			 140
-#define RSA_R_NULL_BEFORE_BLOCK_MISSING			 113
-#define RSA_R_N_DOES_NOT_EQUAL_P_Q			 127
-#define RSA_R_OAEP_DECODING_ERROR			 121
-#define RSA_R_PADDING_CHECK_FAILED			 114
-#define RSA_R_P_NOT_PRIME				 128
-#define RSA_R_Q_NOT_PRIME				 129
-#define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED		 130
-#define RSA_R_SLEN_CHECK_FAILED				 136
-#define RSA_R_SLEN_RECOVERY_FAILED			 135
-#define RSA_R_SSLV3_ROLLBACK_ATTACK			 115
+#define RSA_R_ALGORITHM_MISMATCH             100
+#define RSA_R_BAD_E_VALUE                101
+#define RSA_R_BAD_FIXED_HEADER_DECRYPT           102
+#define RSA_R_BAD_PAD_BYTE_COUNT             103
+#define RSA_R_BAD_SIGNATURE              104
+#define RSA_R_BLOCK_TYPE_IS_NOT_01           106
+#define RSA_R_BLOCK_TYPE_IS_NOT_02           107
+#define RSA_R_DATA_GREATER_THAN_MOD_LEN          108
+#define RSA_R_DATA_TOO_LARGE                 109
+#define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE        110
+#define RSA_R_DATA_TOO_LARGE_FOR_MODULUS         132
+#define RSA_R_DATA_TOO_SMALL                 111
+#define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE        122
+#define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY         112
+#define RSA_R_DMP1_NOT_CONGRUENT_TO_D            124
+#define RSA_R_DMQ1_NOT_CONGRUENT_TO_D            125
+#define RSA_R_D_E_NOT_CONGRUENT_TO_1             123
+#define RSA_R_FIRST_OCTET_INVALID            133
+#define RSA_R_INVALID_HEADER                 137
+#define RSA_R_INVALID_MESSAGE_LENGTH             131
+#define RSA_R_INVALID_PADDING                138
+#define RSA_R_INVALID_TRAILER                139
+#define RSA_R_IQMP_NOT_INVERSE_OF_Q          126
+#define RSA_R_KEY_SIZE_TOO_SMALL             120
+#define RSA_R_LAST_OCTET_INVALID             134
+#define RSA_R_MODULUS_TOO_LARGE              105
+#define RSA_R_NO_PUBLIC_EXPONENT             140
+#define RSA_R_NULL_BEFORE_BLOCK_MISSING          113
+#define RSA_R_N_DOES_NOT_EQUAL_P_Q           127
+#define RSA_R_OAEP_DECODING_ERROR            121
+#define RSA_R_PADDING_CHECK_FAILED           114
+#define RSA_R_P_NOT_PRIME                128
+#define RSA_R_Q_NOT_PRIME                129
+#define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED       130
+#define RSA_R_SLEN_CHECK_FAILED              136
+#define RSA_R_SLEN_RECOVERY_FAILED           135
+#define RSA_R_SSLV3_ROLLBACK_ATTACK          115
 #define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116
-#define RSA_R_UNKNOWN_ALGORITHM_TYPE			 117
-#define RSA_R_UNKNOWN_PADDING_TYPE			 118
-#define RSA_R_WRONG_SIGNATURE_LENGTH			 119
+#define RSA_R_UNKNOWN_ALGORITHM_TYPE             117
+#define RSA_R_UNKNOWN_PADDING_TYPE           118
+#define RSA_R_WRONG_SIGNATURE_LENGTH             119
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/safestack.h b/dep/include/openssl/safestack.h
index d496f365c27..69813945332 100644
--- a/dep/include/openssl/safestack.h
+++ b/dep/include/openssl/safestack.h
@@ -6,7 +6,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -76,76 +76,76 @@ STACK_OF(type) \
 /* SKM_sk_... stack macros are internal to safestack.h:
  * never use them directly, use sk__... instead */
 #define SKM_sk_new(type, cmp) \
-	((STACK_OF(type) * (*)(int (*)(const type * const *, const type * const *)))openssl_fcast(sk_new))(cmp)
+    ((STACK_OF(type) * (*)(int (*)(const type * const *, const type * const *)))openssl_fcast(sk_new))(cmp)
 #define SKM_sk_new_null(type) \
-	((STACK_OF(type) * (*)(void))openssl_fcast(sk_new_null))()
+    ((STACK_OF(type) * (*)(void))openssl_fcast(sk_new_null))()
 #define SKM_sk_free(type, st) \
-	((void (*)(STACK_OF(type) *))openssl_fcast(sk_free))(st)
+    ((void (*)(STACK_OF(type) *))openssl_fcast(sk_free))(st)
 #define SKM_sk_num(type, st) \
-	((int (*)(const STACK_OF(type) *))openssl_fcast(sk_num))(st)
+    ((int (*)(const STACK_OF(type) *))openssl_fcast(sk_num))(st)
 #define SKM_sk_value(type, st,i) \
-	((type * (*)(const STACK_OF(type) *, int))openssl_fcast(sk_value))(st, i)
+    ((type * (*)(const STACK_OF(type) *, int))openssl_fcast(sk_value))(st, i)
 #define SKM_sk_set(type, st,i,val) \
-	((type * (*)(STACK_OF(type) *, int, type *))openssl_fcast(sk_set))(st, i, val)
+    ((type * (*)(STACK_OF(type) *, int, type *))openssl_fcast(sk_set))(st, i, val)
 #define SKM_sk_zero(type, st) \
-	((void (*)(STACK_OF(type) *))openssl_fcast(sk_zero))(st)
+    ((void (*)(STACK_OF(type) *))openssl_fcast(sk_zero))(st)
 #define SKM_sk_push(type, st,val) \
-	((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_push))(st, val)
+    ((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_push))(st, val)
 #define SKM_sk_unshift(type, st,val) \
-	((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_unshift))(st, val)
+    ((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_unshift))(st, val)
 #define SKM_sk_find(type, st,val) \
-	((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_find))(st, val)
+    ((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_find))(st, val)
 #define SKM_sk_delete(type, st,i) \
-	((type * (*)(STACK_OF(type) *, int))openssl_fcast(sk_delete))(st, i)
+    ((type * (*)(STACK_OF(type) *, int))openssl_fcast(sk_delete))(st, i)
 #define SKM_sk_delete_ptr(type, st,ptr) \
-	((type * (*)(STACK_OF(type) *, type *))openssl_fcast(sk_delete_ptr))(st, ptr)
+    ((type * (*)(STACK_OF(type) *, type *))openssl_fcast(sk_delete_ptr))(st, ptr)
 #define SKM_sk_insert(type, st,val,i) \
-	((int (*)(STACK_OF(type) *, type *, int))openssl_fcast(sk_insert))(st, val, i)
+    ((int (*)(STACK_OF(type) *, type *, int))openssl_fcast(sk_insert))(st, val, i)
 #define SKM_sk_set_cmp_func(type, st,cmp) \
-	((int (*(*)(STACK_OF(type) *, int (*)(const type * const *, const type * const *))) \
-	  (const type * const *, const type * const *))openssl_fcast(sk_set_cmp_func))\
-	(st, cmp)
+    ((int (*(*)(STACK_OF(type) *, int (*)(const type * const *, const type * const *))) \
+      (const type * const *, const type * const *))openssl_fcast(sk_set_cmp_func))\
+    (st, cmp)
 #define SKM_sk_dup(type, st) \
-	((STACK_OF(type) *(*)(STACK_OF(type) *))openssl_fcast(sk_dup))(st)
+    ((STACK_OF(type) *(*)(STACK_OF(type) *))openssl_fcast(sk_dup))(st)
 #define SKM_sk_pop_free(type, st,free_func) \
-	((void (*)(STACK_OF(type) *, void (*)(type *)))openssl_fcast(sk_pop_free))\
-	(st, free_func)
+    ((void (*)(STACK_OF(type) *, void (*)(type *)))openssl_fcast(sk_pop_free))\
+    (st, free_func)
 #define SKM_sk_shift(type, st) \
-	((type * (*)(STACK_OF(type) *))openssl_fcast(sk_shift))(st)
+    ((type * (*)(STACK_OF(type) *))openssl_fcast(sk_shift))(st)
 #define SKM_sk_pop(type, st) \
-	((type * (*)(STACK_OF(type) *))openssl_fcast(sk_pop))(st)
+    ((type * (*)(STACK_OF(type) *))openssl_fcast(sk_pop))(st)
 #define SKM_sk_sort(type, st) \
-	((void (*)(STACK_OF(type) *))openssl_fcast(sk_sort))(st)
+    ((void (*)(STACK_OF(type) *))openssl_fcast(sk_sort))(st)
 #define SKM_sk_is_sorted(type, st) \
-	((int (*)(const STACK_OF(type) *))openssl_fcast(sk_is_sorted))(st)
+    ((int (*)(const STACK_OF(type) *))openssl_fcast(sk_is_sorted))(st)
 
-#define	SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+#define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
 ((STACK_OF(type) * (*) (STACK_OF(type) **,const unsigned char **, long , \
                          type *(*)(type **, const unsigned char **,long), \
                                 void (*)(type *), int ,int )) openssl_fcast(d2i_ASN1_SET)) \
-			(st,pp,length, d2i_func, free_func, ex_tag,ex_class)
-#define	SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	((int (*)(STACK_OF(type) *,unsigned char **, \
+            (st,pp,length, d2i_func, free_func, ex_tag,ex_class)
+#define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \
+    ((int (*)(STACK_OF(type) *,unsigned char **, \
         int (*)(type *,unsigned char **), int , int , int)) openssl_fcast(i2d_ASN1_SET)) \
-						(st,pp,i2d_func,ex_tag,ex_class,is_set)
+                        (st,pp,i2d_func,ex_tag,ex_class,is_set)
 
-#define	SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \
-	((unsigned char *(*)(STACK_OF(type) *, \
+#define SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \
+    ((unsigned char *(*)(STACK_OF(type) *, \
         int (*)(type *,unsigned char **), unsigned char **,int *)) openssl_fcast(ASN1_seq_pack)) \
-				(st, i2d_func, buf, len)
-#define	SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \
-	((STACK_OF(type) * (*)(const unsigned char *,int, \
+                (st, i2d_func, buf, len)
+#define SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \
+    ((STACK_OF(type) * (*)(const unsigned char *,int, \
                               type *(*)(type **,const unsigned char **, long), \
                               void (*)(type *)))openssl_fcast(ASN1_seq_unpack)) \
-					(buf,len,d2i_func, free_func)
+                    (buf,len,d2i_func, free_func)
 
 #define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \
-	((STACK_OF(type) * (*)(X509_ALGOR *, \
-            		type *(*)(type **, const unsigned char **, long), \
-				void (*)(type *), \
+    ((STACK_OF(type) * (*)(X509_ALGOR *, \
+                    type *(*)(type **, const unsigned char **, long), \
+                void (*)(type *), \
                                 const char *, int, \
                                 ASN1_STRING *, int))PKCS12_decrypt_d2i) \
-				(algor,d2i_func,free_func,pass,passlen,oct,seq)
+                (algor,d2i_func,free_func,pass,passlen,oct,seq)
 
 #else
 
@@ -155,59 +155,59 @@ STACK_OF(type) \
 #define IMPLEMENT_STACK_OF(type)  /* nada */
 
 #define SKM_sk_new(type, cmp) \
-	sk_new((int (*)(const char * const *, const char * const *))(cmp))
+    sk_new((int (*)(const char * const *, const char * const *))(cmp))
 #define SKM_sk_new_null(type) \
-	sk_new_null()
+    sk_new_null()
 #define SKM_sk_free(type, st) \
-	sk_free(st)
+    sk_free(st)
 #define SKM_sk_num(type, st) \
-	sk_num(st)
+    sk_num(st)
 #define SKM_sk_value(type, st,i) \
-	((type *)sk_value(st, i))
+    ((type *)sk_value(st, i))
 #define SKM_sk_set(type, st,i,val) \
-	((type *)sk_set(st, i,(char *)val))
+    ((type *)sk_set(st, i,(char *)val))
 #define SKM_sk_zero(type, st) \
-	sk_zero(st)
+    sk_zero(st)
 #define SKM_sk_push(type, st,val) \
-	sk_push(st, (char *)val)
+    sk_push(st, (char *)val)
 #define SKM_sk_unshift(type, st,val) \
-	sk_unshift(st, val)
+    sk_unshift(st, val)
 #define SKM_sk_find(type, st,val) \
-	sk_find(st, (char *)val)
+    sk_find(st, (char *)val)
 #define SKM_sk_delete(type, st,i) \
-	((type *)sk_delete(st, i))
+    ((type *)sk_delete(st, i))
 #define SKM_sk_delete_ptr(type, st,ptr) \
-	((type *)sk_delete_ptr(st,(char *)ptr))
+    ((type *)sk_delete_ptr(st,(char *)ptr))
 #define SKM_sk_insert(type, st,val,i) \
-	sk_insert(st, (char *)val, i)
+    sk_insert(st, (char *)val, i)
 #define SKM_sk_set_cmp_func(type, st,cmp) \
-	((int (*)(const type * const *,const type * const *)) \
-	sk_set_cmp_func(st, (int (*)(const char * const *, const char * const *))(cmp)))
+    ((int (*)(const type * const *,const type * const *)) \
+    sk_set_cmp_func(st, (int (*)(const char * const *, const char * const *))(cmp)))
 #define SKM_sk_dup(type, st) \
-	sk_dup(st)
+    sk_dup(st)
 #define SKM_sk_pop_free(type, st,free_func) \
-	sk_pop_free(st, (void (*)(void *))free_func)
+    sk_pop_free(st, (void (*)(void *))free_func)
 #define SKM_sk_shift(type, st) \
-	((type *)sk_shift(st))
+    ((type *)sk_shift(st))
 #define SKM_sk_pop(type, st) \
-	((type *)sk_pop(st))
+    ((type *)sk_pop(st))
 #define SKM_sk_sort(type, st) \
-	sk_sort(st)
+    sk_sort(st)
 #define SKM_sk_is_sorted(type, st) \
-	sk_is_sorted(st)
+    sk_is_sorted(st)
 
-#define	SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	d2i_ASN1_SET(st,pp,length, (void *(*)(void ** ,const unsigned char ** ,long))d2i_func, (void (*)(void *))free_func, ex_tag,ex_class)
-#define	SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	i2d_ASN1_SET(st,pp,(int (*)(void *, unsigned char **))i2d_func,ex_tag,ex_class,is_set)
+#define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
+    d2i_ASN1_SET(st,pp,length, (void *(*)(void ** ,const unsigned char ** ,long))d2i_func, (void (*)(void *))free_func, ex_tag,ex_class)
+#define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \
+    i2d_ASN1_SET(st,pp,(int (*)(void *, unsigned char **))i2d_func,ex_tag,ex_class,is_set)
 
-#define	SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \
-	ASN1_seq_pack(st, (int (*)(void *, unsigned char **))i2d_func, buf, len)
-#define	SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \
-	ASN1_seq_unpack(buf,len,(void *(*)(void **,const unsigned char **,long))d2i_func, (void(*)(void *))free_func)
+#define SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \
+    ASN1_seq_pack(st, (int (*)(void *, unsigned char **))i2d_func, buf, len)
+#define SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \
+    ASN1_seq_unpack(buf,len,(void *(*)(void **,const unsigned char **,long))d2i_func, (void(*)(void *))free_func)
 
 #define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \
-	((STACK *)PKCS12_decrypt_d2i(algor,(char *(*)())d2i_func, (void(*)(void *))free_func,pass,passlen,oct,seq))
+    ((STACK *)PKCS12_decrypt_d2i(algor,(char *(*)())d2i_func, (void(*)(void *))free_func,pass,passlen,oct,seq))
 
 #endif
 
@@ -1643,208 +1643,208 @@ STACK_OF(type) \
 #define sk_X509_VERIFY_PARAM_is_sorted(st) SKM_sk_is_sorted(X509_VERIFY_PARAM, (st))
 
 #define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	SKM_ASN1_SET_OF_d2i(ACCESS_DESCRIPTION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
+    SKM_ASN1_SET_OF_d2i(ACCESS_DESCRIPTION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
 #define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	SKM_ASN1_SET_OF_i2d(ACCESS_DESCRIPTION, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+    SKM_ASN1_SET_OF_i2d(ACCESS_DESCRIPTION, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
 #define ASN1_seq_pack_ACCESS_DESCRIPTION(st, i2d_func, buf, len) \
-	SKM_ASN1_seq_pack(ACCESS_DESCRIPTION, (st), (i2d_func), (buf), (len))
+    SKM_ASN1_seq_pack(ACCESS_DESCRIPTION, (st), (i2d_func), (buf), (len))
 #define ASN1_seq_unpack_ACCESS_DESCRIPTION(buf, len, d2i_func, free_func) \
-	SKM_ASN1_seq_unpack(ACCESS_DESCRIPTION, (buf), (len), (d2i_func), (free_func))
+    SKM_ASN1_seq_unpack(ACCESS_DESCRIPTION, (buf), (len), (d2i_func), (free_func))
 
 #define d2i_ASN1_SET_OF_ASN1_INTEGER(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	SKM_ASN1_SET_OF_d2i(ASN1_INTEGER, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
+    SKM_ASN1_SET_OF_d2i(ASN1_INTEGER, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
 #define i2d_ASN1_SET_OF_ASN1_INTEGER(st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	SKM_ASN1_SET_OF_i2d(ASN1_INTEGER, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+    SKM_ASN1_SET_OF_i2d(ASN1_INTEGER, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
 #define ASN1_seq_pack_ASN1_INTEGER(st, i2d_func, buf, len) \
-	SKM_ASN1_seq_pack(ASN1_INTEGER, (st), (i2d_func), (buf), (len))
+    SKM_ASN1_seq_pack(ASN1_INTEGER, (st), (i2d_func), (buf), (len))
 #define ASN1_seq_unpack_ASN1_INTEGER(buf, len, d2i_func, free_func) \
-	SKM_ASN1_seq_unpack(ASN1_INTEGER, (buf), (len), (d2i_func), (free_func))
+    SKM_ASN1_seq_unpack(ASN1_INTEGER, (buf), (len), (d2i_func), (free_func))
 
 #define d2i_ASN1_SET_OF_ASN1_OBJECT(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	SKM_ASN1_SET_OF_d2i(ASN1_OBJECT, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
+    SKM_ASN1_SET_OF_d2i(ASN1_OBJECT, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
 #define i2d_ASN1_SET_OF_ASN1_OBJECT(st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	SKM_ASN1_SET_OF_i2d(ASN1_OBJECT, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+    SKM_ASN1_SET_OF_i2d(ASN1_OBJECT, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
 #define ASN1_seq_pack_ASN1_OBJECT(st, i2d_func, buf, len) \
-	SKM_ASN1_seq_pack(ASN1_OBJECT, (st), (i2d_func), (buf), (len))
+    SKM_ASN1_seq_pack(ASN1_OBJECT, (st), (i2d_func), (buf), (len))
 #define ASN1_seq_unpack_ASN1_OBJECT(buf, len, d2i_func, free_func) \
-	SKM_ASN1_seq_unpack(ASN1_OBJECT, (buf), (len), (d2i_func), (free_func))
+    SKM_ASN1_seq_unpack(ASN1_OBJECT, (buf), (len), (d2i_func), (free_func))
 
 #define d2i_ASN1_SET_OF_ASN1_TYPE(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	SKM_ASN1_SET_OF_d2i(ASN1_TYPE, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
+    SKM_ASN1_SET_OF_d2i(ASN1_TYPE, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
 #define i2d_ASN1_SET_OF_ASN1_TYPE(st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	SKM_ASN1_SET_OF_i2d(ASN1_TYPE, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+    SKM_ASN1_SET_OF_i2d(ASN1_TYPE, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
 #define ASN1_seq_pack_ASN1_TYPE(st, i2d_func, buf, len) \
-	SKM_ASN1_seq_pack(ASN1_TYPE, (st), (i2d_func), (buf), (len))
+    SKM_ASN1_seq_pack(ASN1_TYPE, (st), (i2d_func), (buf), (len))
 #define ASN1_seq_unpack_ASN1_TYPE(buf, len, d2i_func, free_func) \
-	SKM_ASN1_seq_unpack(ASN1_TYPE, (buf), (len), (d2i_func), (free_func))
+    SKM_ASN1_seq_unpack(ASN1_TYPE, (buf), (len), (d2i_func), (free_func))
 
 #define d2i_ASN1_SET_OF_DIST_POINT(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	SKM_ASN1_SET_OF_d2i(DIST_POINT, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
+    SKM_ASN1_SET_OF_d2i(DIST_POINT, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
 #define i2d_ASN1_SET_OF_DIST_POINT(st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	SKM_ASN1_SET_OF_i2d(DIST_POINT, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+    SKM_ASN1_SET_OF_i2d(DIST_POINT, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
 #define ASN1_seq_pack_DIST_POINT(st, i2d_func, buf, len) \
-	SKM_ASN1_seq_pack(DIST_POINT, (st), (i2d_func), (buf), (len))
+    SKM_ASN1_seq_pack(DIST_POINT, (st), (i2d_func), (buf), (len))
 #define ASN1_seq_unpack_DIST_POINT(buf, len, d2i_func, free_func) \
-	SKM_ASN1_seq_unpack(DIST_POINT, (buf), (len), (d2i_func), (free_func))
+    SKM_ASN1_seq_unpack(DIST_POINT, (buf), (len), (d2i_func), (free_func))
 
 #define d2i_ASN1_SET_OF_GENERAL_NAME(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	SKM_ASN1_SET_OF_d2i(GENERAL_NAME, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
+    SKM_ASN1_SET_OF_d2i(GENERAL_NAME, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
 #define i2d_ASN1_SET_OF_GENERAL_NAME(st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	SKM_ASN1_SET_OF_i2d(GENERAL_NAME, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+    SKM_ASN1_SET_OF_i2d(GENERAL_NAME, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
 #define ASN1_seq_pack_GENERAL_NAME(st, i2d_func, buf, len) \
-	SKM_ASN1_seq_pack(GENERAL_NAME, (st), (i2d_func), (buf), (len))
+    SKM_ASN1_seq_pack(GENERAL_NAME, (st), (i2d_func), (buf), (len))
 #define ASN1_seq_unpack_GENERAL_NAME(buf, len, d2i_func, free_func) \
-	SKM_ASN1_seq_unpack(GENERAL_NAME, (buf), (len), (d2i_func), (free_func))
+    SKM_ASN1_seq_unpack(GENERAL_NAME, (buf), (len), (d2i_func), (free_func))
 
 #define d2i_ASN1_SET_OF_OCSP_ONEREQ(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	SKM_ASN1_SET_OF_d2i(OCSP_ONEREQ, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
+    SKM_ASN1_SET_OF_d2i(OCSP_ONEREQ, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
 #define i2d_ASN1_SET_OF_OCSP_ONEREQ(st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	SKM_ASN1_SET_OF_i2d(OCSP_ONEREQ, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+    SKM_ASN1_SET_OF_i2d(OCSP_ONEREQ, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
 #define ASN1_seq_pack_OCSP_ONEREQ(st, i2d_func, buf, len) \
-	SKM_ASN1_seq_pack(OCSP_ONEREQ, (st), (i2d_func), (buf), (len))
+    SKM_ASN1_seq_pack(OCSP_ONEREQ, (st), (i2d_func), (buf), (len))
 #define ASN1_seq_unpack_OCSP_ONEREQ(buf, len, d2i_func, free_func) \
-	SKM_ASN1_seq_unpack(OCSP_ONEREQ, (buf), (len), (d2i_func), (free_func))
+    SKM_ASN1_seq_unpack(OCSP_ONEREQ, (buf), (len), (d2i_func), (free_func))
 
 #define d2i_ASN1_SET_OF_OCSP_SINGLERESP(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	SKM_ASN1_SET_OF_d2i(OCSP_SINGLERESP, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
+    SKM_ASN1_SET_OF_d2i(OCSP_SINGLERESP, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
 #define i2d_ASN1_SET_OF_OCSP_SINGLERESP(st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	SKM_ASN1_SET_OF_i2d(OCSP_SINGLERESP, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+    SKM_ASN1_SET_OF_i2d(OCSP_SINGLERESP, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
 #define ASN1_seq_pack_OCSP_SINGLERESP(st, i2d_func, buf, len) \
-	SKM_ASN1_seq_pack(OCSP_SINGLERESP, (st), (i2d_func), (buf), (len))
+    SKM_ASN1_seq_pack(OCSP_SINGLERESP, (st), (i2d_func), (buf), (len))
 #define ASN1_seq_unpack_OCSP_SINGLERESP(buf, len, d2i_func, free_func) \
-	SKM_ASN1_seq_unpack(OCSP_SINGLERESP, (buf), (len), (d2i_func), (free_func))
+    SKM_ASN1_seq_unpack(OCSP_SINGLERESP, (buf), (len), (d2i_func), (free_func))
 
 #define d2i_ASN1_SET_OF_PKCS12_SAFEBAG(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	SKM_ASN1_SET_OF_d2i(PKCS12_SAFEBAG, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
+    SKM_ASN1_SET_OF_d2i(PKCS12_SAFEBAG, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
 #define i2d_ASN1_SET_OF_PKCS12_SAFEBAG(st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	SKM_ASN1_SET_OF_i2d(PKCS12_SAFEBAG, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+    SKM_ASN1_SET_OF_i2d(PKCS12_SAFEBAG, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
 #define ASN1_seq_pack_PKCS12_SAFEBAG(st, i2d_func, buf, len) \
-	SKM_ASN1_seq_pack(PKCS12_SAFEBAG, (st), (i2d_func), (buf), (len))
+    SKM_ASN1_seq_pack(PKCS12_SAFEBAG, (st), (i2d_func), (buf), (len))
 #define ASN1_seq_unpack_PKCS12_SAFEBAG(buf, len, d2i_func, free_func) \
-	SKM_ASN1_seq_unpack(PKCS12_SAFEBAG, (buf), (len), (d2i_func), (free_func))
+    SKM_ASN1_seq_unpack(PKCS12_SAFEBAG, (buf), (len), (d2i_func), (free_func))
 
 #define d2i_ASN1_SET_OF_PKCS7(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	SKM_ASN1_SET_OF_d2i(PKCS7, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
+    SKM_ASN1_SET_OF_d2i(PKCS7, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
 #define i2d_ASN1_SET_OF_PKCS7(st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	SKM_ASN1_SET_OF_i2d(PKCS7, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+    SKM_ASN1_SET_OF_i2d(PKCS7, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
 #define ASN1_seq_pack_PKCS7(st, i2d_func, buf, len) \
-	SKM_ASN1_seq_pack(PKCS7, (st), (i2d_func), (buf), (len))
+    SKM_ASN1_seq_pack(PKCS7, (st), (i2d_func), (buf), (len))
 #define ASN1_seq_unpack_PKCS7(buf, len, d2i_func, free_func) \
-	SKM_ASN1_seq_unpack(PKCS7, (buf), (len), (d2i_func), (free_func))
+    SKM_ASN1_seq_unpack(PKCS7, (buf), (len), (d2i_func), (free_func))
 
 #define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	SKM_ASN1_SET_OF_d2i(PKCS7_RECIP_INFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
+    SKM_ASN1_SET_OF_d2i(PKCS7_RECIP_INFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
 #define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	SKM_ASN1_SET_OF_i2d(PKCS7_RECIP_INFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+    SKM_ASN1_SET_OF_i2d(PKCS7_RECIP_INFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
 #define ASN1_seq_pack_PKCS7_RECIP_INFO(st, i2d_func, buf, len) \
-	SKM_ASN1_seq_pack(PKCS7_RECIP_INFO, (st), (i2d_func), (buf), (len))
+    SKM_ASN1_seq_pack(PKCS7_RECIP_INFO, (st), (i2d_func), (buf), (len))
 #define ASN1_seq_unpack_PKCS7_RECIP_INFO(buf, len, d2i_func, free_func) \
-	SKM_ASN1_seq_unpack(PKCS7_RECIP_INFO, (buf), (len), (d2i_func), (free_func))
+    SKM_ASN1_seq_unpack(PKCS7_RECIP_INFO, (buf), (len), (d2i_func), (free_func))
 
 #define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	SKM_ASN1_SET_OF_d2i(PKCS7_SIGNER_INFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
+    SKM_ASN1_SET_OF_d2i(PKCS7_SIGNER_INFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
 #define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	SKM_ASN1_SET_OF_i2d(PKCS7_SIGNER_INFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+    SKM_ASN1_SET_OF_i2d(PKCS7_SIGNER_INFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
 #define ASN1_seq_pack_PKCS7_SIGNER_INFO(st, i2d_func, buf, len) \
-	SKM_ASN1_seq_pack(PKCS7_SIGNER_INFO, (st), (i2d_func), (buf), (len))
+    SKM_ASN1_seq_pack(PKCS7_SIGNER_INFO, (st), (i2d_func), (buf), (len))
 #define ASN1_seq_unpack_PKCS7_SIGNER_INFO(buf, len, d2i_func, free_func) \
-	SKM_ASN1_seq_unpack(PKCS7_SIGNER_INFO, (buf), (len), (d2i_func), (free_func))
+    SKM_ASN1_seq_unpack(PKCS7_SIGNER_INFO, (buf), (len), (d2i_func), (free_func))
 
 #define d2i_ASN1_SET_OF_POLICYINFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	SKM_ASN1_SET_OF_d2i(POLICYINFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
+    SKM_ASN1_SET_OF_d2i(POLICYINFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
 #define i2d_ASN1_SET_OF_POLICYINFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	SKM_ASN1_SET_OF_i2d(POLICYINFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+    SKM_ASN1_SET_OF_i2d(POLICYINFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
 #define ASN1_seq_pack_POLICYINFO(st, i2d_func, buf, len) \
-	SKM_ASN1_seq_pack(POLICYINFO, (st), (i2d_func), (buf), (len))
+    SKM_ASN1_seq_pack(POLICYINFO, (st), (i2d_func), (buf), (len))
 #define ASN1_seq_unpack_POLICYINFO(buf, len, d2i_func, free_func) \
-	SKM_ASN1_seq_unpack(POLICYINFO, (buf), (len), (d2i_func), (free_func))
+    SKM_ASN1_seq_unpack(POLICYINFO, (buf), (len), (d2i_func), (free_func))
 
 #define d2i_ASN1_SET_OF_POLICYQUALINFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	SKM_ASN1_SET_OF_d2i(POLICYQUALINFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
+    SKM_ASN1_SET_OF_d2i(POLICYQUALINFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
 #define i2d_ASN1_SET_OF_POLICYQUALINFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	SKM_ASN1_SET_OF_i2d(POLICYQUALINFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+    SKM_ASN1_SET_OF_i2d(POLICYQUALINFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
 #define ASN1_seq_pack_POLICYQUALINFO(st, i2d_func, buf, len) \
-	SKM_ASN1_seq_pack(POLICYQUALINFO, (st), (i2d_func), (buf), (len))
+    SKM_ASN1_seq_pack(POLICYQUALINFO, (st), (i2d_func), (buf), (len))
 #define ASN1_seq_unpack_POLICYQUALINFO(buf, len, d2i_func, free_func) \
-	SKM_ASN1_seq_unpack(POLICYQUALINFO, (buf), (len), (d2i_func), (free_func))
+    SKM_ASN1_seq_unpack(POLICYQUALINFO, (buf), (len), (d2i_func), (free_func))
 
 #define d2i_ASN1_SET_OF_SXNETID(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	SKM_ASN1_SET_OF_d2i(SXNETID, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
+    SKM_ASN1_SET_OF_d2i(SXNETID, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
 #define i2d_ASN1_SET_OF_SXNETID(st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	SKM_ASN1_SET_OF_i2d(SXNETID, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+    SKM_ASN1_SET_OF_i2d(SXNETID, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
 #define ASN1_seq_pack_SXNETID(st, i2d_func, buf, len) \
-	SKM_ASN1_seq_pack(SXNETID, (st), (i2d_func), (buf), (len))
+    SKM_ASN1_seq_pack(SXNETID, (st), (i2d_func), (buf), (len))
 #define ASN1_seq_unpack_SXNETID(buf, len, d2i_func, free_func) \
-	SKM_ASN1_seq_unpack(SXNETID, (buf), (len), (d2i_func), (free_func))
+    SKM_ASN1_seq_unpack(SXNETID, (buf), (len), (d2i_func), (free_func))
 
 #define d2i_ASN1_SET_OF_X509(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	SKM_ASN1_SET_OF_d2i(X509, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
+    SKM_ASN1_SET_OF_d2i(X509, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
 #define i2d_ASN1_SET_OF_X509(st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	SKM_ASN1_SET_OF_i2d(X509, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+    SKM_ASN1_SET_OF_i2d(X509, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
 #define ASN1_seq_pack_X509(st, i2d_func, buf, len) \
-	SKM_ASN1_seq_pack(X509, (st), (i2d_func), (buf), (len))
+    SKM_ASN1_seq_pack(X509, (st), (i2d_func), (buf), (len))
 #define ASN1_seq_unpack_X509(buf, len, d2i_func, free_func) \
-	SKM_ASN1_seq_unpack(X509, (buf), (len), (d2i_func), (free_func))
+    SKM_ASN1_seq_unpack(X509, (buf), (len), (d2i_func), (free_func))
 
 #define d2i_ASN1_SET_OF_X509_ALGOR(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	SKM_ASN1_SET_OF_d2i(X509_ALGOR, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
+    SKM_ASN1_SET_OF_d2i(X509_ALGOR, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
 #define i2d_ASN1_SET_OF_X509_ALGOR(st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	SKM_ASN1_SET_OF_i2d(X509_ALGOR, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+    SKM_ASN1_SET_OF_i2d(X509_ALGOR, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
 #define ASN1_seq_pack_X509_ALGOR(st, i2d_func, buf, len) \
-	SKM_ASN1_seq_pack(X509_ALGOR, (st), (i2d_func), (buf), (len))
+    SKM_ASN1_seq_pack(X509_ALGOR, (st), (i2d_func), (buf), (len))
 #define ASN1_seq_unpack_X509_ALGOR(buf, len, d2i_func, free_func) \
-	SKM_ASN1_seq_unpack(X509_ALGOR, (buf), (len), (d2i_func), (free_func))
+    SKM_ASN1_seq_unpack(X509_ALGOR, (buf), (len), (d2i_func), (free_func))
 
 #define d2i_ASN1_SET_OF_X509_ATTRIBUTE(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	SKM_ASN1_SET_OF_d2i(X509_ATTRIBUTE, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
+    SKM_ASN1_SET_OF_d2i(X509_ATTRIBUTE, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
 #define i2d_ASN1_SET_OF_X509_ATTRIBUTE(st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	SKM_ASN1_SET_OF_i2d(X509_ATTRIBUTE, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+    SKM_ASN1_SET_OF_i2d(X509_ATTRIBUTE, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
 #define ASN1_seq_pack_X509_ATTRIBUTE(st, i2d_func, buf, len) \
-	SKM_ASN1_seq_pack(X509_ATTRIBUTE, (st), (i2d_func), (buf), (len))
+    SKM_ASN1_seq_pack(X509_ATTRIBUTE, (st), (i2d_func), (buf), (len))
 #define ASN1_seq_unpack_X509_ATTRIBUTE(buf, len, d2i_func, free_func) \
-	SKM_ASN1_seq_unpack(X509_ATTRIBUTE, (buf), (len), (d2i_func), (free_func))
+    SKM_ASN1_seq_unpack(X509_ATTRIBUTE, (buf), (len), (d2i_func), (free_func))
 
 #define d2i_ASN1_SET_OF_X509_CRL(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	SKM_ASN1_SET_OF_d2i(X509_CRL, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
+    SKM_ASN1_SET_OF_d2i(X509_CRL, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
 #define i2d_ASN1_SET_OF_X509_CRL(st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	SKM_ASN1_SET_OF_i2d(X509_CRL, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+    SKM_ASN1_SET_OF_i2d(X509_CRL, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
 #define ASN1_seq_pack_X509_CRL(st, i2d_func, buf, len) \
-	SKM_ASN1_seq_pack(X509_CRL, (st), (i2d_func), (buf), (len))
+    SKM_ASN1_seq_pack(X509_CRL, (st), (i2d_func), (buf), (len))
 #define ASN1_seq_unpack_X509_CRL(buf, len, d2i_func, free_func) \
-	SKM_ASN1_seq_unpack(X509_CRL, (buf), (len), (d2i_func), (free_func))
+    SKM_ASN1_seq_unpack(X509_CRL, (buf), (len), (d2i_func), (free_func))
 
 #define d2i_ASN1_SET_OF_X509_EXTENSION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	SKM_ASN1_SET_OF_d2i(X509_EXTENSION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
+    SKM_ASN1_SET_OF_d2i(X509_EXTENSION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
 #define i2d_ASN1_SET_OF_X509_EXTENSION(st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	SKM_ASN1_SET_OF_i2d(X509_EXTENSION, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+    SKM_ASN1_SET_OF_i2d(X509_EXTENSION, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
 #define ASN1_seq_pack_X509_EXTENSION(st, i2d_func, buf, len) \
-	SKM_ASN1_seq_pack(X509_EXTENSION, (st), (i2d_func), (buf), (len))
+    SKM_ASN1_seq_pack(X509_EXTENSION, (st), (i2d_func), (buf), (len))
 #define ASN1_seq_unpack_X509_EXTENSION(buf, len, d2i_func, free_func) \
-	SKM_ASN1_seq_unpack(X509_EXTENSION, (buf), (len), (d2i_func), (free_func))
+    SKM_ASN1_seq_unpack(X509_EXTENSION, (buf), (len), (d2i_func), (free_func))
 
 #define d2i_ASN1_SET_OF_X509_NAME_ENTRY(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	SKM_ASN1_SET_OF_d2i(X509_NAME_ENTRY, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
+    SKM_ASN1_SET_OF_d2i(X509_NAME_ENTRY, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
 #define i2d_ASN1_SET_OF_X509_NAME_ENTRY(st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	SKM_ASN1_SET_OF_i2d(X509_NAME_ENTRY, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+    SKM_ASN1_SET_OF_i2d(X509_NAME_ENTRY, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
 #define ASN1_seq_pack_X509_NAME_ENTRY(st, i2d_func, buf, len) \
-	SKM_ASN1_seq_pack(X509_NAME_ENTRY, (st), (i2d_func), (buf), (len))
+    SKM_ASN1_seq_pack(X509_NAME_ENTRY, (st), (i2d_func), (buf), (len))
 #define ASN1_seq_unpack_X509_NAME_ENTRY(buf, len, d2i_func, free_func) \
-	SKM_ASN1_seq_unpack(X509_NAME_ENTRY, (buf), (len), (d2i_func), (free_func))
+    SKM_ASN1_seq_unpack(X509_NAME_ENTRY, (buf), (len), (d2i_func), (free_func))
 
 #define d2i_ASN1_SET_OF_X509_REVOKED(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-	SKM_ASN1_SET_OF_d2i(X509_REVOKED, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
+    SKM_ASN1_SET_OF_d2i(X509_REVOKED, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
 #define i2d_ASN1_SET_OF_X509_REVOKED(st, pp, i2d_func, ex_tag, ex_class, is_set) \
-	SKM_ASN1_SET_OF_i2d(X509_REVOKED, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
+    SKM_ASN1_SET_OF_i2d(X509_REVOKED, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))
 #define ASN1_seq_pack_X509_REVOKED(st, i2d_func, buf, len) \
-	SKM_ASN1_seq_pack(X509_REVOKED, (st), (i2d_func), (buf), (len))
+    SKM_ASN1_seq_pack(X509_REVOKED, (st), (i2d_func), (buf), (len))
 #define ASN1_seq_unpack_X509_REVOKED(buf, len, d2i_func, free_func) \
-	SKM_ASN1_seq_unpack(X509_REVOKED, (buf), (len), (d2i_func), (free_func))
+    SKM_ASN1_seq_unpack(X509_REVOKED, (buf), (len), (d2i_func), (free_func))
 
 #define PKCS12_decrypt_d2i_PKCS12_SAFEBAG(algor, d2i_func, free_func, pass, passlen, oct, seq) \
-	SKM_PKCS12_decrypt_d2i(PKCS12_SAFEBAG, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq))
+    SKM_PKCS12_decrypt_d2i(PKCS12_SAFEBAG, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq))
 
 #define PKCS12_decrypt_d2i_PKCS7(algor, d2i_func, free_func, pass, passlen, oct, seq) \
-	SKM_PKCS12_decrypt_d2i(PKCS7, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq))
+    SKM_PKCS12_decrypt_d2i(PKCS7, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq))
 /* End of util/mkstack.pl block, you may now edit :-) */
 
 #endif /* !defined HEADER_SAFESTACK_H */
diff --git a/dep/include/openssl/sha.h b/dep/include/openssl/sha.h
index eed44d7f946..83fca212ab8 100644
--- a/dep/include/openssl/sha.h
+++ b/dep/include/openssl/sha.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -90,20 +90,20 @@ extern "C" {
 #define SHA_LONG unsigned int
 #endif
 
-#define SHA_LBLOCK	16
-#define SHA_CBLOCK	(SHA_LBLOCK*4)	/* SHA treats input data as a
-					 * contiguous array of 32 bit
-					 * wide big-endian values. */
+#define SHA_LBLOCK  16
+#define SHA_CBLOCK  (SHA_LBLOCK*4)  /* SHA treats input data as a
+                     * contiguous array of 32 bit
+                     * wide big-endian values. */
 #define SHA_LAST_BLOCK  (SHA_CBLOCK-8)
 #define SHA_DIGEST_LENGTH 20
 
 typedef struct SHAstate_st
-	{
-	SHA_LONG h0,h1,h2,h3,h4;
-	SHA_LONG Nl,Nh;
-	SHA_LONG data[SHA_LBLOCK];
-	unsigned int num;
-	} SHA_CTX;
+    {
+    SHA_LONG h0,h1,h2,h3,h4;
+    SHA_LONG Nl,Nh;
+    SHA_LONG data[SHA_LBLOCK];
+    unsigned int num;
+    } SHA_CTX;
 
 #ifndef OPENSSL_NO_SHA0
 int SHA_Init(SHA_CTX *c);
@@ -120,19 +120,19 @@ unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md);
 void SHA1_Transform(SHA_CTX *c, const unsigned char *data);
 #endif
 
-#define SHA256_CBLOCK	(SHA_LBLOCK*4)	/* SHA-256 treats input data as a
-					 * contiguous array of 32 bit
-					 * wide big-endian values. */
-#define SHA224_DIGEST_LENGTH	28
-#define SHA256_DIGEST_LENGTH	32
+#define SHA256_CBLOCK   (SHA_LBLOCK*4)  /* SHA-256 treats input data as a
+                     * contiguous array of 32 bit
+                     * wide big-endian values. */
+#define SHA224_DIGEST_LENGTH    28
+#define SHA256_DIGEST_LENGTH    32
 
 typedef struct SHA256state_st
-	{
-	SHA_LONG h[8];
-	SHA_LONG Nl,Nh;
-	SHA_LONG data[SHA_LBLOCK];
-	unsigned int num,md_len;
-	} SHA256_CTX;
+    {
+    SHA_LONG h[8];
+    SHA_LONG Nl,Nh;
+    SHA_LONG data[SHA_LBLOCK];
+    unsigned int num,md_len;
+    } SHA256_CTX;
 
 #ifndef OPENSSL_NO_SHA256
 int SHA224_Init(SHA256_CTX *c);
@@ -146,8 +146,8 @@ unsigned char *SHA256(const unsigned char *d, size_t n,unsigned char *md);
 void SHA256_Transform(SHA256_CTX *c, const unsigned char *data);
 #endif
 
-#define SHA384_DIGEST_LENGTH	48
-#define SHA512_DIGEST_LENGTH	64
+#define SHA384_DIGEST_LENGTH    48
+#define SHA512_DIGEST_LENGTH    64
 
 #ifndef OPENSSL_NO_SHA512
 /*
@@ -155,9 +155,9 @@ void SHA256_Transform(SHA256_CTX *c, const unsigned char *data);
  * being exactly 64-bit wide. See Implementation Notes in sha512.c
  * for further details.
  */
-#define SHA512_CBLOCK	(SHA_LBLOCK*8)	/* SHA-512 treats input data as a
-					 * contiguous array of 64 bit
-					 * wide big-endian values. */
+#define SHA512_CBLOCK   (SHA_LBLOCK*8)  /* SHA-512 treats input data as a
+                     * contiguous array of 64 bit
+                     * wide big-endian values. */
 #if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
 #define SHA_LONG64 unsigned __int64
 #define U64(C)     C##UI64
@@ -170,15 +170,15 @@ void SHA256_Transform(SHA256_CTX *c, const unsigned char *data);
 #endif
 
 typedef struct SHA512state_st
-	{
-	SHA_LONG64 h[8];
-	SHA_LONG64 Nl,Nh;
-	union {
-		SHA_LONG64	d[SHA_LBLOCK];
-		unsigned char	p[SHA512_CBLOCK];
-	} u;
-	unsigned int num,md_len;
-	} SHA512_CTX;
+    {
+    SHA_LONG64 h[8];
+    SHA_LONG64 Nl,Nh;
+    union {
+        SHA_LONG64  d[SHA_LBLOCK];
+        unsigned char   p[SHA512_CBLOCK];
+    } u;
+    unsigned int num,md_len;
+    } SHA512_CTX;
 #endif
 
 #ifndef OPENSSL_NO_SHA512
diff --git a/dep/include/openssl/ssl.h b/dep/include/openssl/ssl.h
index 2e067e7a78e..9e08588f132 100644
--- a/dep/include/openssl/ssl.h
+++ b/dep/include/openssl/ssl.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -63,7 +63,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -116,7 +116,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -163,12 +163,12 @@
  */
 /* ====================================================================
  * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
- * ECC cipher suite support in OpenSSL originally developed by 
+ * ECC cipher suite support in OpenSSL originally developed by
  * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
  */
 
-#ifndef HEADER_SSL_H 
-#define HEADER_SSL_H 
+#ifndef HEADER_SSL_H
+#define HEADER_SSL_H
 
 #include 
 
@@ -203,16 +203,16 @@ extern "C" {
 #define SSL_SESSION_ASN1_VERSION 0x0001
 
 /* text strings for the ciphers */
-#define SSL_TXT_NULL_WITH_MD5		SSL2_TXT_NULL_WITH_MD5			
-#define SSL_TXT_RC4_128_WITH_MD5	SSL2_TXT_RC4_128_WITH_MD5		
-#define SSL_TXT_RC4_128_EXPORT40_WITH_MD5 SSL2_TXT_RC4_128_EXPORT40_WITH_MD5	
-#define SSL_TXT_RC2_128_CBC_WITH_MD5	SSL2_TXT_RC2_128_CBC_WITH_MD5		
-#define SSL_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5	
-#define SSL_TXT_IDEA_128_CBC_WITH_MD5	SSL2_TXT_IDEA_128_CBC_WITH_MD5		
-#define SSL_TXT_DES_64_CBC_WITH_MD5	SSL2_TXT_DES_64_CBC_WITH_MD5		
-#define SSL_TXT_DES_64_CBC_WITH_SHA	SSL2_TXT_DES_64_CBC_WITH_SHA		
-#define SSL_TXT_DES_192_EDE3_CBC_WITH_MD5 SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5	
-#define SSL_TXT_DES_192_EDE3_CBC_WITH_SHA SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA	
+#define SSL_TXT_NULL_WITH_MD5       SSL2_TXT_NULL_WITH_MD5
+#define SSL_TXT_RC4_128_WITH_MD5    SSL2_TXT_RC4_128_WITH_MD5
+#define SSL_TXT_RC4_128_EXPORT40_WITH_MD5 SSL2_TXT_RC4_128_EXPORT40_WITH_MD5
+#define SSL_TXT_RC2_128_CBC_WITH_MD5    SSL2_TXT_RC2_128_CBC_WITH_MD5
+#define SSL_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5
+#define SSL_TXT_IDEA_128_CBC_WITH_MD5   SSL2_TXT_IDEA_128_CBC_WITH_MD5
+#define SSL_TXT_DES_64_CBC_WITH_MD5 SSL2_TXT_DES_64_CBC_WITH_MD5
+#define SSL_TXT_DES_64_CBC_WITH_SHA SSL2_TXT_DES_64_CBC_WITH_SHA
+#define SSL_TXT_DES_192_EDE3_CBC_WITH_MD5 SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5
+#define SSL_TXT_DES_192_EDE3_CBC_WITH_SHA SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA
 
 /*    VRS Additional Kerberos5 entries
  */
@@ -220,17 +220,17 @@ extern "C" {
 #define SSL_TXT_KRB5_DES_192_CBC3_SHA SSL3_TXT_KRB5_DES_192_CBC3_SHA
 #define SSL_TXT_KRB5_RC4_128_SHA      SSL3_TXT_KRB5_RC4_128_SHA
 #define SSL_TXT_KRB5_IDEA_128_CBC_SHA SSL3_TXT_KRB5_IDEA_128_CBC_SHA
-#define SSL_TXT_KRB5_DES_64_CBC_MD5   SSL3_TXT_KRB5_DES_64_CBC_MD5       
-#define SSL_TXT_KRB5_DES_192_CBC3_MD5 SSL3_TXT_KRB5_DES_192_CBC3_MD5       
+#define SSL_TXT_KRB5_DES_64_CBC_MD5   SSL3_TXT_KRB5_DES_64_CBC_MD5
+#define SSL_TXT_KRB5_DES_192_CBC3_MD5 SSL3_TXT_KRB5_DES_192_CBC3_MD5
 #define SSL_TXT_KRB5_RC4_128_MD5      SSL3_TXT_KRB5_RC4_128_MD5
-#define SSL_TXT_KRB5_IDEA_128_CBC_MD5 SSL3_TXT_KRB5_IDEA_128_CBC_MD5 
+#define SSL_TXT_KRB5_IDEA_128_CBC_MD5 SSL3_TXT_KRB5_IDEA_128_CBC_MD5
 
-#define SSL_TXT_KRB5_DES_40_CBC_SHA   SSL3_TXT_KRB5_DES_40_CBC_SHA 
-#define SSL_TXT_KRB5_RC2_40_CBC_SHA   SSL3_TXT_KRB5_RC2_40_CBC_SHA 
-#define SSL_TXT_KRB5_RC4_40_SHA	      SSL3_TXT_KRB5_RC4_40_SHA
-#define SSL_TXT_KRB5_DES_40_CBC_MD5   SSL3_TXT_KRB5_DES_40_CBC_MD5 
-#define SSL_TXT_KRB5_RC2_40_CBC_MD5   SSL3_TXT_KRB5_RC2_40_CBC_MD5 
-#define SSL_TXT_KRB5_RC4_40_MD5	      SSL3_TXT_KRB5_RC4_40_MD5
+#define SSL_TXT_KRB5_DES_40_CBC_SHA   SSL3_TXT_KRB5_DES_40_CBC_SHA
+#define SSL_TXT_KRB5_RC2_40_CBC_SHA   SSL3_TXT_KRB5_RC2_40_CBC_SHA
+#define SSL_TXT_KRB5_RC4_40_SHA       SSL3_TXT_KRB5_RC4_40_SHA
+#define SSL_TXT_KRB5_DES_40_CBC_MD5   SSL3_TXT_KRB5_DES_40_CBC_MD5
+#define SSL_TXT_KRB5_RC2_40_CBC_MD5   SSL3_TXT_KRB5_RC2_40_CBC_MD5
+#define SSL_TXT_KRB5_RC4_40_MD5       SSL3_TXT_KRB5_RC4_40_MD5
 
 #define SSL_TXT_KRB5_DES_40_CBC_SHA   SSL3_TXT_KRB5_DES_40_CBC_SHA
 #define SSL_TXT_KRB5_DES_40_CBC_MD5   SSL3_TXT_KRB5_DES_40_CBC_MD5
@@ -240,61 +240,61 @@ extern "C" {
 #define SSL_TXT_KRB5_DES_192_CBC3_MD5 SSL3_TXT_KRB5_DES_192_CBC3_MD5
 #define SSL_MAX_KRB5_PRINCIPAL_LENGTH  256
 
-#define SSL_MAX_SSL_SESSION_ID_LENGTH		32
-#define SSL_MAX_SID_CTX_LENGTH			32
+#define SSL_MAX_SSL_SESSION_ID_LENGTH       32
+#define SSL_MAX_SID_CTX_LENGTH          32
 
-#define SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES	(512/8)
-#define SSL_MAX_KEY_ARG_LENGTH			8
-#define SSL_MAX_MASTER_KEY_LENGTH		48
+#define SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES (512/8)
+#define SSL_MAX_KEY_ARG_LENGTH          8
+#define SSL_MAX_MASTER_KEY_LENGTH       48
 
 /* These are used to specify which ciphers to use and not to use */
-#define SSL_TXT_LOW		"LOW"
-#define SSL_TXT_MEDIUM		"MEDIUM"
-#define SSL_TXT_HIGH		"HIGH"
-#define SSL_TXT_kFZA		"kFZA"
-#define	SSL_TXT_aFZA		"aFZA"
-#define SSL_TXT_eFZA		"eFZA"
-#define SSL_TXT_FZA		"FZA"
+#define SSL_TXT_LOW     "LOW"
+#define SSL_TXT_MEDIUM      "MEDIUM"
+#define SSL_TXT_HIGH        "HIGH"
+#define SSL_TXT_kFZA        "kFZA"
+#define SSL_TXT_aFZA        "aFZA"
+#define SSL_TXT_eFZA        "eFZA"
+#define SSL_TXT_FZA     "FZA"
 
-#define	SSL_TXT_aNULL		"aNULL"
-#define	SSL_TXT_eNULL		"eNULL"
-#define	SSL_TXT_NULL		"NULL"
+#define SSL_TXT_aNULL       "aNULL"
+#define SSL_TXT_eNULL       "eNULL"
+#define SSL_TXT_NULL        "NULL"
 
-#define SSL_TXT_kKRB5     	"kKRB5"
-#define SSL_TXT_aKRB5     	"aKRB5"
-#define SSL_TXT_KRB5      	"KRB5"
+#define SSL_TXT_kKRB5       "kKRB5"
+#define SSL_TXT_aKRB5       "aKRB5"
+#define SSL_TXT_KRB5        "KRB5"
 
-#define SSL_TXT_kRSA		"kRSA"
-#define SSL_TXT_kDHr		"kDHr"
-#define SSL_TXT_kDHd		"kDHd"
-#define SSL_TXT_kEDH		"kEDH"
-#define	SSL_TXT_aRSA		"aRSA"
-#define	SSL_TXT_aDSS		"aDSS"
-#define	SSL_TXT_aDH		"aDH"
-#define	SSL_TXT_DSS		"DSS"
-#define SSL_TXT_DH		"DH"
-#define SSL_TXT_EDH		"EDH"
-#define SSL_TXT_ADH		"ADH"
-#define SSL_TXT_RSA		"RSA"
-#define SSL_TXT_DES		"DES"
-#define SSL_TXT_3DES		"3DES"
-#define SSL_TXT_RC4		"RC4"
-#define SSL_TXT_RC2		"RC2"
-#define SSL_TXT_IDEA		"IDEA"
-#define SSL_TXT_AES		"AES"
-#define SSL_TXT_CAMELLIA	"CAMELLIA"
-#define SSL_TXT_MD5		"MD5"
-#define SSL_TXT_SHA1		"SHA1"
-#define SSL_TXT_SHA		"SHA"
-#define SSL_TXT_EXP		"EXP"
-#define SSL_TXT_EXPORT		"EXPORT"
-#define SSL_TXT_EXP40		"EXPORT40"
-#define SSL_TXT_EXP56		"EXPORT56"
-#define SSL_TXT_SSLV2		"SSLv2"
-#define SSL_TXT_SSLV3		"SSLv3"
-#define SSL_TXT_TLSV1		"TLSv1"
-#define SSL_TXT_ALL		"ALL"
-#define SSL_TXT_ECC		"ECCdraft" /* ECC ciphersuites are not yet official */
+#define SSL_TXT_kRSA        "kRSA"
+#define SSL_TXT_kDHr        "kDHr"
+#define SSL_TXT_kDHd        "kDHd"
+#define SSL_TXT_kEDH        "kEDH"
+#define SSL_TXT_aRSA        "aRSA"
+#define SSL_TXT_aDSS        "aDSS"
+#define SSL_TXT_aDH     "aDH"
+#define SSL_TXT_DSS     "DSS"
+#define SSL_TXT_DH      "DH"
+#define SSL_TXT_EDH     "EDH"
+#define SSL_TXT_ADH     "ADH"
+#define SSL_TXT_RSA     "RSA"
+#define SSL_TXT_DES     "DES"
+#define SSL_TXT_3DES        "3DES"
+#define SSL_TXT_RC4     "RC4"
+#define SSL_TXT_RC2     "RC2"
+#define SSL_TXT_IDEA        "IDEA"
+#define SSL_TXT_AES     "AES"
+#define SSL_TXT_CAMELLIA    "CAMELLIA"
+#define SSL_TXT_MD5     "MD5"
+#define SSL_TXT_SHA1        "SHA1"
+#define SSL_TXT_SHA     "SHA"
+#define SSL_TXT_EXP     "EXP"
+#define SSL_TXT_EXPORT      "EXPORT"
+#define SSL_TXT_EXP40       "EXPORT40"
+#define SSL_TXT_EXP56       "EXPORT56"
+#define SSL_TXT_SSLV2       "SSLv2"
+#define SSL_TXT_SSLV3       "SSLv3"
+#define SSL_TXT_TLSV1       "TLSv1"
+#define SSL_TXT_ALL     "ALL"
+#define SSL_TXT_ECC     "ECCdraft" /* ECC ciphersuites are not yet official */
 
 /*
  * COMPLEMENTOF* definitions. These identifiers are used to (de-select)
@@ -310,21 +310,21 @@ extern "C" {
  * DEFAULT gets, as only selection is being done and no sorting as needed
  * for DEFAULT.
  */
-#define SSL_TXT_CMPALL		"COMPLEMENTOFALL"
-#define SSL_TXT_CMPDEF		"COMPLEMENTOFDEFAULT"
+#define SSL_TXT_CMPALL      "COMPLEMENTOFALL"
+#define SSL_TXT_CMPDEF      "COMPLEMENTOFDEFAULT"
 
 /* The following cipher list is used by default.
  * It also is substituted when an application-defined cipher list string
  * starts with 'DEFAULT'. */
 #ifdef OPENSSL_NO_CAMELLIA
-# define SSL_DEFAULT_CIPHER_LIST	"ALL:!ADH:+RC4:@STRENGTH" /* low priority for RC4 */
+# define SSL_DEFAULT_CIPHER_LIST    "ALL:!ADH:+RC4:@STRENGTH" /* low priority for RC4 */
 #else
-# define SSL_DEFAULT_CIPHER_LIST	"AES:CAMELLIA:ALL:!ADH:+RC4:@STRENGTH" /* low priority for RC4 */
+# define SSL_DEFAULT_CIPHER_LIST    "AES:CAMELLIA:ALL:!ADH:+RC4:@STRENGTH" /* low priority for RC4 */
 #endif
 
 /* Used in SSL_set_shutdown()/SSL_get_shutdown(); */
-#define SSL_SENT_SHUTDOWN	1
-#define SSL_RECEIVED_SHUTDOWN	2
+#define SSL_SENT_SHUTDOWN   1
+#define SSL_RECEIVED_SHUTDOWN   2
 
 #ifdef __cplusplus
 }
@@ -338,8 +338,8 @@ extern "C" {
 #define OPENSSL_NO_SSL2
 #endif
 
-#define SSL_FILETYPE_ASN1	X509_FILETYPE_ASN1
-#define SSL_FILETYPE_PEM	X509_FILETYPE_PEM
+#define SSL_FILETYPE_ASN1   X509_FILETYPE_ASN1
+#define SSL_FILETYPE_PEM    X509_FILETYPE_PEM
 
 /* This is needed to stop compilers complaining about the
  * 'struct ssl_st *' function parameters used to prototype callbacks
@@ -348,18 +348,18 @@ typedef struct ssl_st *ssl_crock_st;
 
 /* used to hold info on the particular ciphers used */
 typedef struct ssl_cipher_st
-	{
-	int valid;
-	const char *name;		/* text name */
-	unsigned long id;		/* id, 4 bytes, first is version */
-	unsigned long algorithms;	/* what ciphers are used */
-	unsigned long algo_strength;	/* strength and export flags */
-	unsigned long algorithm2;	/* Extra flags */
-	int strength_bits;		/* Number of bits really used */
-	int alg_bits;			/* Number of bits for algorithm */
-	unsigned long mask;		/* used for matching */
-	unsigned long mask_strength;	/* also used for matching */
-	} SSL_CIPHER;
+    {
+    int valid;
+    const char *name;       /* text name */
+    unsigned long id;       /* id, 4 bytes, first is version */
+    unsigned long algorithms;   /* what ciphers are used */
+    unsigned long algo_strength;    /* strength and export flags */
+    unsigned long algorithm2;   /* Extra flags */
+    int strength_bits;      /* Number of bits really used */
+    int alg_bits;           /* Number of bits for algorithm */
+    unsigned long mask;     /* used for matching */
+    unsigned long mask_strength;    /* also used for matching */
+    } SSL_CIPHER;
 
 DECLARE_STACK_OF(SSL_CIPHER)
 
@@ -368,127 +368,127 @@ typedef struct ssl_ctx_st SSL_CTX;
 
 /* Used to hold functions for SSLv2 or SSLv3/TLSv1 functions */
 typedef struct ssl_method_st
-	{
-	int version;
-	int (*ssl_new)(SSL *s);
-	void (*ssl_clear)(SSL *s);
-	void (*ssl_free)(SSL *s);
-	int (*ssl_accept)(SSL *s);
-	int (*ssl_connect)(SSL *s);
-	int (*ssl_read)(SSL *s,void *buf,int len);
-	int (*ssl_peek)(SSL *s,void *buf,int len);
-	int (*ssl_write)(SSL *s,const void *buf,int len);
-	int (*ssl_shutdown)(SSL *s);
-	int (*ssl_renegotiate)(SSL *s);
-	int (*ssl_renegotiate_check)(SSL *s);
-	long (*ssl_get_message)(SSL *s, int st1, int stn, int mt, long
-		max, int *ok);
-	int (*ssl_read_bytes)(SSL *s, int type, unsigned char *buf, int len, 
-		int peek);
-	int (*ssl_write_bytes)(SSL *s, int type, const void *buf_, int len);
-	int (*ssl_dispatch_alert)(SSL *s);
-	long (*ssl_ctrl)(SSL *s,int cmd,long larg,void *parg);
-	long (*ssl_ctx_ctrl)(SSL_CTX *ctx,int cmd,long larg,void *parg);
-	SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr);
-	int (*put_cipher_by_char)(const SSL_CIPHER *cipher,unsigned char *ptr);
-	int (*ssl_pending)(const SSL *s);
-	int (*num_ciphers)(void);
-	SSL_CIPHER *(*get_cipher)(unsigned ncipher);
-	struct ssl_method_st *(*get_ssl_method)(int version);
-	long (*get_timeout)(void);
-	struct ssl3_enc_method *ssl3_enc; /* Extra SSLv3/TLS stuff */
-	int (*ssl_version)(void);
-	long (*ssl_callback_ctrl)(SSL *s, int cb_id, void (*fp)(void));
-	long (*ssl_ctx_callback_ctrl)(SSL_CTX *s, int cb_id, void (*fp)(void));
-	} SSL_METHOD;
+    {
+    int version;
+    int (*ssl_new)(SSL *s);
+    void (*ssl_clear)(SSL *s);
+    void (*ssl_free)(SSL *s);
+    int (*ssl_accept)(SSL *s);
+    int (*ssl_connect)(SSL *s);
+    int (*ssl_read)(SSL *s,void *buf,int len);
+    int (*ssl_peek)(SSL *s,void *buf,int len);
+    int (*ssl_write)(SSL *s,const void *buf,int len);
+    int (*ssl_shutdown)(SSL *s);
+    int (*ssl_renegotiate)(SSL *s);
+    int (*ssl_renegotiate_check)(SSL *s);
+    long (*ssl_get_message)(SSL *s, int st1, int stn, int mt, long
+        max, int *ok);
+    int (*ssl_read_bytes)(SSL *s, int type, unsigned char *buf, int len,
+        int peek);
+    int (*ssl_write_bytes)(SSL *s, int type, const void *buf_, int len);
+    int (*ssl_dispatch_alert)(SSL *s);
+    long (*ssl_ctrl)(SSL *s,int cmd,long larg,void *parg);
+    long (*ssl_ctx_ctrl)(SSL_CTX *ctx,int cmd,long larg,void *parg);
+    SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr);
+    int (*put_cipher_by_char)(const SSL_CIPHER *cipher,unsigned char *ptr);
+    int (*ssl_pending)(const SSL *s);
+    int (*num_ciphers)(void);
+    SSL_CIPHER *(*get_cipher)(unsigned ncipher);
+    struct ssl_method_st *(*get_ssl_method)(int version);
+    long (*get_timeout)(void);
+    struct ssl3_enc_method *ssl3_enc; /* Extra SSLv3/TLS stuff */
+    int (*ssl_version)(void);
+    long (*ssl_callback_ctrl)(SSL *s, int cb_id, void (*fp)(void));
+    long (*ssl_ctx_callback_ctrl)(SSL_CTX *s, int cb_id, void (*fp)(void));
+    } SSL_METHOD;
 
 /* Lets make this into an ASN.1 type structure as follows
  * SSL_SESSION_ID ::= SEQUENCE {
- *	version 		INTEGER,	-- structure version number
- *	SSLversion 		INTEGER,	-- SSL version number
- *	Cipher 			OCTET_STRING,	-- the 3 byte cipher ID
- *	Session_ID 		OCTET_STRING,	-- the Session ID
- *	Master_key 		OCTET_STRING,	-- the master key
- *	KRB5_principal		OCTET_STRING	-- optional Kerberos principal
- *	Key_Arg [ 0 ] IMPLICIT	OCTET_STRING,	-- the optional Key argument
- *	Time [ 1 ] EXPLICIT	INTEGER,	-- optional Start Time
- *	Timeout [ 2 ] EXPLICIT	INTEGER,	-- optional Timeout ins seconds
- *	Peer [ 3 ] EXPLICIT	X509,		-- optional Peer Certificate
- *	Session_ID_context [ 4 ] EXPLICIT OCTET_STRING,   -- the Session ID context
- *	Verify_result [ 5 ] EXPLICIT INTEGER    -- X509_V_... code for `Peer'
- *	Compression [6] IMPLICIT ASN1_OBJECT	-- compression OID XXXXX
- *	}
+ *  version         INTEGER,    -- structure version number
+ *  SSLversion      INTEGER,    -- SSL version number
+ *  Cipher          OCTET_STRING,   -- the 3 byte cipher ID
+ *  Session_ID      OCTET_STRING,   -- the Session ID
+ *  Master_key      OCTET_STRING,   -- the master key
+ *  KRB5_principal      OCTET_STRING    -- optional Kerberos principal
+ *  Key_Arg [ 0 ] IMPLICIT  OCTET_STRING,   -- the optional Key argument
+ *  Time [ 1 ] EXPLICIT INTEGER,    -- optional Start Time
+ *  Timeout [ 2 ] EXPLICIT  INTEGER,    -- optional Timeout ins seconds
+ *  Peer [ 3 ] EXPLICIT X509,       -- optional Peer Certificate
+ *  Session_ID_context [ 4 ] EXPLICIT OCTET_STRING,   -- the Session ID context
+ *  Verify_result [ 5 ] EXPLICIT INTEGER    -- X509_V_... code for `Peer'
+ *  Compression [6] IMPLICIT ASN1_OBJECT    -- compression OID XXXXX
+ *  }
  * Look in ssl/ssl_asn1.c for more details
  * I'm using EXPLICIT tags so I can read the damn things using asn1parse :-).
  */
 typedef struct ssl_session_st
-	{
-	int ssl_version;	/* what ssl version session info is
-				 * being kept in here? */
+    {
+    int ssl_version;    /* what ssl version session info is
+                 * being kept in here? */
 
-	/* only really used in SSLv2 */
-	unsigned int key_arg_length;
-	unsigned char key_arg[SSL_MAX_KEY_ARG_LENGTH];
-	int master_key_length;
-	unsigned char master_key[SSL_MAX_MASTER_KEY_LENGTH];
-	/* session_id - valid? */
-	unsigned int session_id_length;
-	unsigned char session_id[SSL_MAX_SSL_SESSION_ID_LENGTH];
-	/* this is used to determine whether the session is being reused in
-	 * the appropriate context. It is up to the application to set this,
-	 * via SSL_new */
-	unsigned int sid_ctx_length;
-	unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];
+    /* only really used in SSLv2 */
+    unsigned int key_arg_length;
+    unsigned char key_arg[SSL_MAX_KEY_ARG_LENGTH];
+    int master_key_length;
+    unsigned char master_key[SSL_MAX_MASTER_KEY_LENGTH];
+    /* session_id - valid? */
+    unsigned int session_id_length;
+    unsigned char session_id[SSL_MAX_SSL_SESSION_ID_LENGTH];
+    /* this is used to determine whether the session is being reused in
+     * the appropriate context. It is up to the application to set this,
+     * via SSL_new */
+    unsigned int sid_ctx_length;
+    unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];
 
 #ifndef OPENSSL_NO_KRB5
         unsigned int krb5_client_princ_len;
         unsigned char krb5_client_princ[SSL_MAX_KRB5_PRINCIPAL_LENGTH];
 #endif /* OPENSSL_NO_KRB5 */
 
-	int not_resumable;
+    int not_resumable;
 
-	/* The cert is the certificate used to establish this connection */
-	struct sess_cert_st /* SESS_CERT */ *sess_cert;
+    /* The cert is the certificate used to establish this connection */
+    struct sess_cert_st /* SESS_CERT */ *sess_cert;
 
-	/* This is the cert for the other end.
-	 * On clients, it will be the same as sess_cert->peer_key->x509
-	 * (the latter is not enough as sess_cert is not retained
-	 * in the external representation of sessions, see ssl_asn1.c). */
-	X509 *peer;
-	/* when app_verify_callback accepts a session where the peer's certificate
-	 * is not ok, we must remember the error for session reuse: */
-	long verify_result; /* only for servers */
+    /* This is the cert for the other end.
+     * On clients, it will be the same as sess_cert->peer_key->x509
+     * (the latter is not enough as sess_cert is not retained
+     * in the external representation of sessions, see ssl_asn1.c). */
+    X509 *peer;
+    /* when app_verify_callback accepts a session where the peer's certificate
+     * is not ok, we must remember the error for session reuse: */
+    long verify_result; /* only for servers */
 
-	int references;
-	long timeout;
-	long time;
+    int references;
+    long timeout;
+    long time;
 
-	int compress_meth;		/* Need to lookup the method */
+    int compress_meth;      /* Need to lookup the method */
 
-	SSL_CIPHER *cipher;
-	unsigned long cipher_id;	/* when ASN.1 loaded, this
-					 * needs to be used to load
-					 * the 'cipher' structure */
+    SSL_CIPHER *cipher;
+    unsigned long cipher_id;    /* when ASN.1 loaded, this
+                     * needs to be used to load
+                     * the 'cipher' structure */
 
-	STACK_OF(SSL_CIPHER) *ciphers; /* shared ciphers? */
+    STACK_OF(SSL_CIPHER) *ciphers; /* shared ciphers? */
 
-	CRYPTO_EX_DATA ex_data; /* application specific data */
+    CRYPTO_EX_DATA ex_data; /* application specific data */
 
-	/* These are used to make removal of session-ids more
-	 * efficient and to implement a maximum cache size. */
-	struct ssl_session_st *prev,*next;
-	} SSL_SESSION;
+    /* These are used to make removal of session-ids more
+     * efficient and to implement a maximum cache size. */
+    struct ssl_session_st *prev,*next;
+    } SSL_SESSION;
 
 
-#define SSL_OP_MICROSOFT_SESS_ID_BUG			0x00000001L
-#define SSL_OP_NETSCAPE_CHALLENGE_BUG			0x00000002L
-#define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG		0x00000008L
-#define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG		0x00000010L
-#define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER		0x00000020L
-#define SSL_OP_MSIE_SSLV2_RSA_PADDING			0x00000040L /* no effect since 0.9.7h and 0.9.8b */
-#define SSL_OP_SSLEAY_080_CLIENT_DH_BUG			0x00000080L
-#define SSL_OP_TLS_D5_BUG				0x00000100L
-#define SSL_OP_TLS_BLOCK_PADDING_BUG			0x00000200L
+#define SSL_OP_MICROSOFT_SESS_ID_BUG            0x00000001L
+#define SSL_OP_NETSCAPE_CHALLENGE_BUG           0x00000002L
+#define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG     0x00000008L
+#define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG      0x00000010L
+#define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER       0x00000020L
+#define SSL_OP_MSIE_SSLV2_RSA_PADDING           0x00000040L /* no effect since 0.9.7h and 0.9.8b */
+#define SSL_OP_SSLEAY_080_CLIENT_DH_BUG         0x00000080L
+#define SSL_OP_TLS_D5_BUG               0x00000100L
+#define SSL_OP_TLS_BLOCK_PADDING_BUG            0x00000200L
 
 /* Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added
  * in OpenSSL 0.9.6d.  Usually (depending on the application protocol)
@@ -499,7 +499,7 @@ typedef struct ssl_session_st
 
 /* SSL_OP_ALL: various bug workarounds that should be rather harmless.
  *             This used to be 0x000FFFFFL before 0.9.7. */
-#define SSL_OP_ALL					0x00000FFFL
+#define SSL_OP_ALL                  0x00000FFFL
 
 /* DTLS options */
 #define SSL_OP_NO_QUERY_MTU                 0x00001000L
@@ -507,33 +507,33 @@ typedef struct ssl_session_st
 #define SSL_OP_COOKIE_EXCHANGE              0x00002000L
 
 /* As server, disallow session resumption on renegotiation */
-#define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION	0x00010000L
+#define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION   0x00010000L
 /* If set, always create a new key when using tmp_ecdh parameters */
-#define SSL_OP_SINGLE_ECDH_USE				0x00080000L
+#define SSL_OP_SINGLE_ECDH_USE              0x00080000L
 /* If set, always create a new key when using tmp_dh parameters */
-#define SSL_OP_SINGLE_DH_USE				0x00100000L
+#define SSL_OP_SINGLE_DH_USE                0x00100000L
 /* Set to always use the tmp_rsa key when doing RSA operations,
  * even when this violates protocol specs */
-#define SSL_OP_EPHEMERAL_RSA				0x00200000L
+#define SSL_OP_EPHEMERAL_RSA                0x00200000L
 /* Set on servers to choose the cipher according to the server's
  * preferences */
-#define SSL_OP_CIPHER_SERVER_PREFERENCE			0x00400000L
+#define SSL_OP_CIPHER_SERVER_PREFERENCE         0x00400000L
 /* If set, a server will allow a client to issue a SSLv3.0 version number
  * as latest version supported in the premaster secret, even when TLSv1.0
  * (version 3.1) was announced in the client hello. Normally this is
  * forbidden to prevent version rollback attacks. */
-#define SSL_OP_TLS_ROLLBACK_BUG				0x00800000L
+#define SSL_OP_TLS_ROLLBACK_BUG             0x00800000L
 
-#define SSL_OP_NO_SSLv2					0x01000000L
-#define SSL_OP_NO_SSLv3					0x02000000L
-#define SSL_OP_NO_TLSv1					0x04000000L
+#define SSL_OP_NO_SSLv2                 0x01000000L
+#define SSL_OP_NO_SSLv3                 0x02000000L
+#define SSL_OP_NO_TLSv1                 0x04000000L
 
 /* The next flag deliberately changes the ciphertest, this is a check
  * for the PKCS#1 attack */
-#define SSL_OP_PKCS1_CHECK_1				0x08000000L
-#define SSL_OP_PKCS1_CHECK_2				0x10000000L
-#define SSL_OP_NETSCAPE_CA_DN_BUG			0x20000000L
-#define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG		0x40000000L
+#define SSL_OP_PKCS1_CHECK_1                0x08000000L
+#define SSL_OP_PKCS1_CHECK_2                0x10000000L
+#define SSL_OP_NETSCAPE_CA_DN_BUG           0x20000000L
+#define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG      0x40000000L
 
 
 /* Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success
@@ -555,20 +555,20 @@ typedef struct ssl_session_st
  * they cannot be used to clear bits. */
 
 #define SSL_CTX_set_options(ctx,op) \
-	SSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,(op),NULL)
+    SSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,(op),NULL)
 #define SSL_CTX_get_options(ctx) \
-	SSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,0,NULL)
+    SSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,0,NULL)
 #define SSL_set_options(ssl,op) \
-	SSL_ctrl((ssl),SSL_CTRL_OPTIONS,(op),NULL)
+    SSL_ctrl((ssl),SSL_CTRL_OPTIONS,(op),NULL)
 #define SSL_get_options(ssl) \
         SSL_ctrl((ssl),SSL_CTRL_OPTIONS,0,NULL)
 
 #define SSL_CTX_set_mode(ctx,op) \
-	SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL)
+    SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL)
 #define SSL_CTX_get_mode(ctx) \
-	SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,0,NULL)
+    SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,0,NULL)
 #define SSL_set_mode(ssl,op) \
-	SSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL)
+    SSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL)
 #define SSL_get_mode(ssl) \
         SSL_ctrl((ssl),SSL_CTRL_MODE,0,NULL)
 #define SSL_set_mtu(ssl, mtu) \
@@ -588,7 +588,7 @@ void SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version, int con
 #define SSL_MAX_CERT_LIST_DEFAULT 1024*100 /* 100k max cert list :-) */
 #endif
 
-#define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT	(1024*20)
+#define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT  (1024*20)
 
 /* This callback type is used inside SSL_CTX, SSL, and in the functions that set
  * them. It is used to override the generation of SSL/TLS session IDs in a
@@ -604,192 +604,192 @@ void SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version, int con
  * returns in this case. It is also an error for the callback to set the size to
  * zero. */
 typedef int (*GEN_SESSION_CB)(const SSL *ssl, unsigned char *id,
-				unsigned int *id_len);
+                unsigned int *id_len);
 
 typedef struct ssl_comp_st
-	{
-	int id;
-	const char *name;
+    {
+    int id;
+    const char *name;
 #ifndef OPENSSL_NO_COMP
-	COMP_METHOD *method;
+    COMP_METHOD *method;
 #else
-	char *method;
+    char *method;
 #endif
-	} SSL_COMP;
+    } SSL_COMP;
 
 DECLARE_STACK_OF(SSL_COMP)
 
 struct ssl_ctx_st
-	{
-	SSL_METHOD *method;
+    {
+    SSL_METHOD *method;
 
-	STACK_OF(SSL_CIPHER) *cipher_list;
-	/* same as above but sorted for lookup */
-	STACK_OF(SSL_CIPHER) *cipher_list_by_id;
+    STACK_OF(SSL_CIPHER) *cipher_list;
+    /* same as above but sorted for lookup */
+    STACK_OF(SSL_CIPHER) *cipher_list_by_id;
 
-	struct x509_store_st /* X509_STORE */ *cert_store;
-	struct lhash_st /* LHASH */ *sessions;	/* a set of SSL_SESSIONs */
-	/* Most session-ids that will be cached, default is
-	 * SSL_SESSION_CACHE_MAX_SIZE_DEFAULT. 0 is unlimited. */
-	unsigned long session_cache_size;
-	struct ssl_session_st *session_cache_head;
-	struct ssl_session_st *session_cache_tail;
+    struct x509_store_st /* X509_STORE */ *cert_store;
+    struct lhash_st /* LHASH */ *sessions;  /* a set of SSL_SESSIONs */
+    /* Most session-ids that will be cached, default is
+     * SSL_SESSION_CACHE_MAX_SIZE_DEFAULT. 0 is unlimited. */
+    unsigned long session_cache_size;
+    struct ssl_session_st *session_cache_head;
+    struct ssl_session_st *session_cache_tail;
 
-	/* This can have one of 2 values, ored together,
-	 * SSL_SESS_CACHE_CLIENT,
-	 * SSL_SESS_CACHE_SERVER,
-	 * Default is SSL_SESSION_CACHE_SERVER, which means only
-	 * SSL_accept which cache SSL_SESSIONS. */
-	int session_cache_mode;
+    /* This can have one of 2 values, ored together,
+     * SSL_SESS_CACHE_CLIENT,
+     * SSL_SESS_CACHE_SERVER,
+     * Default is SSL_SESSION_CACHE_SERVER, which means only
+     * SSL_accept which cache SSL_SESSIONS. */
+    int session_cache_mode;
 
-	/* If timeout is not 0, it is the default timeout value set
-	 * when SSL_new() is called.  This has been put in to make
-	 * life easier to set things up */
-	long session_timeout;
+    /* If timeout is not 0, it is the default timeout value set
+     * when SSL_new() is called.  This has been put in to make
+     * life easier to set things up */
+    long session_timeout;
 
-	/* If this callback is not null, it will be called each
-	 * time a session id is added to the cache.  If this function
-	 * returns 1, it means that the callback will do a
-	 * SSL_SESSION_free() when it has finished using it.  Otherwise,
-	 * on 0, it means the callback has finished with it.
-	 * If remove_session_cb is not null, it will be called when
-	 * a session-id is removed from the cache.  After the call,
-	 * OpenSSL will SSL_SESSION_free() it. */
-	int (*new_session_cb)(struct ssl_st *ssl,SSL_SESSION *sess);
-	void (*remove_session_cb)(struct ssl_ctx_st *ctx,SSL_SESSION *sess);
-	SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl,
-		unsigned char *data,int len,int *copy);
+    /* If this callback is not null, it will be called each
+     * time a session id is added to the cache.  If this function
+     * returns 1, it means that the callback will do a
+     * SSL_SESSION_free() when it has finished using it.  Otherwise,
+     * on 0, it means the callback has finished with it.
+     * If remove_session_cb is not null, it will be called when
+     * a session-id is removed from the cache.  After the call,
+     * OpenSSL will SSL_SESSION_free() it. */
+    int (*new_session_cb)(struct ssl_st *ssl,SSL_SESSION *sess);
+    void (*remove_session_cb)(struct ssl_ctx_st *ctx,SSL_SESSION *sess);
+    SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl,
+        unsigned char *data,int len,int *copy);
 
-	struct
-		{
-		int sess_connect;	/* SSL new conn - started */
-		int sess_connect_renegotiate;/* SSL reneg - requested */
-		int sess_connect_good;	/* SSL new conne/reneg - finished */
-		int sess_accept;	/* SSL new accept - started */
-		int sess_accept_renegotiate;/* SSL reneg - requested */
-		int sess_accept_good;	/* SSL accept/reneg - finished */
-		int sess_miss;		/* session lookup misses  */
-		int sess_timeout;	/* reuse attempt on timeouted session */
-		int sess_cache_full;	/* session removed due to full cache */
-		int sess_hit;		/* session reuse actually done */
-		int sess_cb_hit;	/* session-id that was not
-					 * in the cache was
-					 * passed back via the callback.  This
-					 * indicates that the application is
-					 * supplying session-id's from other
-					 * processes - spooky :-) */
-		} stats;
+    struct
+        {
+        int sess_connect;   /* SSL new conn - started */
+        int sess_connect_renegotiate;/* SSL reneg - requested */
+        int sess_connect_good;  /* SSL new conne/reneg - finished */
+        int sess_accept;    /* SSL new accept - started */
+        int sess_accept_renegotiate;/* SSL reneg - requested */
+        int sess_accept_good;   /* SSL accept/reneg - finished */
+        int sess_miss;      /* session lookup misses  */
+        int sess_timeout;   /* reuse attempt on timeouted session */
+        int sess_cache_full;    /* session removed due to full cache */
+        int sess_hit;       /* session reuse actually done */
+        int sess_cb_hit;    /* session-id that was not
+                     * in the cache was
+                     * passed back via the callback.  This
+                     * indicates that the application is
+                     * supplying session-id's from other
+                     * processes - spooky :-) */
+        } stats;
 
-	int references;
+    int references;
 
-	/* if defined, these override the X509_verify_cert() calls */
-	int (*app_verify_callback)(X509_STORE_CTX *, void *);
-	void *app_verify_arg;
-	/* before OpenSSL 0.9.7, 'app_verify_arg' was ignored
-	 * ('app_verify_callback' was called with just one argument) */
+    /* if defined, these override the X509_verify_cert() calls */
+    int (*app_verify_callback)(X509_STORE_CTX *, void *);
+    void *app_verify_arg;
+    /* before OpenSSL 0.9.7, 'app_verify_arg' was ignored
+     * ('app_verify_callback' was called with just one argument) */
 
-	/* Default password callback. */
-	pem_password_cb *default_passwd_callback;
+    /* Default password callback. */
+    pem_password_cb *default_passwd_callback;
 
-	/* Default password callback user data. */
-	void *default_passwd_callback_userdata;
+    /* Default password callback user data. */
+    void *default_passwd_callback_userdata;
 
-	/* get client cert callback */
-	int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey);
+    /* get client cert callback */
+    int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey);
 
     /* cookie generate callback */
-    int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie, 
+    int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie,
         unsigned int *cookie_len);
 
     /* verify cookie callback */
-    int (*app_verify_cookie_cb)(SSL *ssl, unsigned char *cookie, 
+    int (*app_verify_cookie_cb)(SSL *ssl, unsigned char *cookie,
         unsigned int cookie_len);
 
-	CRYPTO_EX_DATA ex_data;
+    CRYPTO_EX_DATA ex_data;
 
-	const EVP_MD *rsa_md5;/* For SSLv2 - name is 'ssl2-md5' */
-	const EVP_MD *md5;	/* For SSLv3/TLSv1 'ssl3-md5' */
-	const EVP_MD *sha1;   /* For SSLv3/TLSv1 'ssl3->sha1' */
+    const EVP_MD *rsa_md5;/* For SSLv2 - name is 'ssl2-md5' */
+    const EVP_MD *md5;  /* For SSLv3/TLSv1 'ssl3-md5' */
+    const EVP_MD *sha1;   /* For SSLv3/TLSv1 'ssl3->sha1' */
 
-	STACK_OF(X509) *extra_certs;
-	STACK_OF(SSL_COMP) *comp_methods; /* stack of SSL_COMP, SSLv3/TLSv1 */
+    STACK_OF(X509) *extra_certs;
+    STACK_OF(SSL_COMP) *comp_methods; /* stack of SSL_COMP, SSLv3/TLSv1 */
 
 
-	/* Default values used when no per-SSL value is defined follow */
+    /* Default values used when no per-SSL value is defined follow */
 
-	void (*info_callback)(const SSL *ssl,int type,int val); /* used if SSL's info_callback is NULL */
+    void (*info_callback)(const SSL *ssl,int type,int val); /* used if SSL's info_callback is NULL */
 
-	/* what we put in client cert requests */
-	STACK_OF(X509_NAME) *client_CA;
+    /* what we put in client cert requests */
+    STACK_OF(X509_NAME) *client_CA;
 
 
-	/* Default values to use in SSL structures follow (these are copied by SSL_new) */
+    /* Default values to use in SSL structures follow (these are copied by SSL_new) */
 
-	unsigned long options;
-	unsigned long mode;
-	long max_cert_list;
+    unsigned long options;
+    unsigned long mode;
+    long max_cert_list;
 
-	struct cert_st /* CERT */ *cert;
-	int read_ahead;
+    struct cert_st /* CERT */ *cert;
+    int read_ahead;
 
-	/* callback that allows applications to peek at protocol messages */
-	void (*msg_callback)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg);
-	void *msg_callback_arg;
+    /* callback that allows applications to peek at protocol messages */
+    void (*msg_callback)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg);
+    void *msg_callback_arg;
 
-	int verify_mode;
-	unsigned int sid_ctx_length;
-	unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];
-	int (*default_verify_callback)(int ok,X509_STORE_CTX *ctx); /* called 'verify_callback' in the SSL */
+    int verify_mode;
+    unsigned int sid_ctx_length;
+    unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];
+    int (*default_verify_callback)(int ok,X509_STORE_CTX *ctx); /* called 'verify_callback' in the SSL */
 
-	/* Default generate session ID callback. */
-	GEN_SESSION_CB generate_session_id;
+    /* Default generate session ID callback. */
+    GEN_SESSION_CB generate_session_id;
 
-	X509_VERIFY_PARAM *param;
+    X509_VERIFY_PARAM *param;
 
 #if 0
-	int purpose;		/* Purpose setting */
-	int trust;		/* Trust setting */
+    int purpose;        /* Purpose setting */
+    int trust;      /* Trust setting */
 #endif
 
-	int quiet_shutdown;
-	};
+    int quiet_shutdown;
+    };
 
-#define SSL_SESS_CACHE_OFF			0x0000
-#define SSL_SESS_CACHE_CLIENT			0x0001
-#define SSL_SESS_CACHE_SERVER			0x0002
-#define SSL_SESS_CACHE_BOTH	(SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER)
-#define SSL_SESS_CACHE_NO_AUTO_CLEAR		0x0080
+#define SSL_SESS_CACHE_OFF          0x0000
+#define SSL_SESS_CACHE_CLIENT           0x0001
+#define SSL_SESS_CACHE_SERVER           0x0002
+#define SSL_SESS_CACHE_BOTH (SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER)
+#define SSL_SESS_CACHE_NO_AUTO_CLEAR        0x0080
 /* enough comments already ... see SSL_CTX_set_session_cache_mode(3) */
-#define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP	0x0100
-#define SSL_SESS_CACHE_NO_INTERNAL_STORE	0x0200
+#define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP   0x0100
+#define SSL_SESS_CACHE_NO_INTERNAL_STORE    0x0200
 #define SSL_SESS_CACHE_NO_INTERNAL \
-	(SSL_SESS_CACHE_NO_INTERNAL_LOOKUP|SSL_SESS_CACHE_NO_INTERNAL_STORE)
+    (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP|SSL_SESS_CACHE_NO_INTERNAL_STORE)
 
   struct lhash_st *SSL_CTX_sessions(SSL_CTX *ctx);
 #define SSL_CTX_sess_number(ctx) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_NUMBER,0,NULL)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_NUMBER,0,NULL)
 #define SSL_CTX_sess_connect(ctx) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT,0,NULL)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT,0,NULL)
 #define SSL_CTX_sess_connect_good(ctx) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_GOOD,0,NULL)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_GOOD,0,NULL)
 #define SSL_CTX_sess_connect_renegotiate(ctx) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_RENEGOTIATE,0,NULL)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_RENEGOTIATE,0,NULL)
 #define SSL_CTX_sess_accept(ctx) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT,0,NULL)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT,0,NULL)
 #define SSL_CTX_sess_accept_renegotiate(ctx) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_RENEGOTIATE,0,NULL)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_RENEGOTIATE,0,NULL)
 #define SSL_CTX_sess_accept_good(ctx) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_GOOD,0,NULL)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_GOOD,0,NULL)
 #define SSL_CTX_sess_hits(ctx) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_HIT,0,NULL)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_HIT,0,NULL)
 #define SSL_CTX_sess_cb_hits(ctx) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CB_HIT,0,NULL)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CB_HIT,0,NULL)
 #define SSL_CTX_sess_misses(ctx) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_MISSES,0,NULL)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_MISSES,0,NULL)
 #define SSL_CTX_sess_timeouts(ctx) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_TIMEOUTS,0,NULL)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_TIMEOUTS,0,NULL)
 #define SSL_CTX_sess_cache_full(ctx) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL)
 
 void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, int (*new_session_cb)(struct ssl_st *ssl,SSL_SESSION *sess));
 int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))(struct ssl_st *ssl, SSL_SESSION *sess);
@@ -804,176 +804,176 @@ int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY
 void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx, int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie, unsigned int *cookie_len));
 void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, int (*app_verify_cookie_cb)(SSL *ssl, unsigned char *cookie, unsigned int cookie_len));
 
-#define SSL_NOTHING	1
-#define SSL_WRITING	2
-#define SSL_READING	3
-#define SSL_X509_LOOKUP	4
+#define SSL_NOTHING 1
+#define SSL_WRITING 2
+#define SSL_READING 3
+#define SSL_X509_LOOKUP 4
 
 /* These will only be used when doing non-blocking IO */
-#define SSL_want_nothing(s)	(SSL_want(s) == SSL_NOTHING)
-#define SSL_want_read(s)	(SSL_want(s) == SSL_READING)
-#define SSL_want_write(s)	(SSL_want(s) == SSL_WRITING)
-#define SSL_want_x509_lookup(s)	(SSL_want(s) == SSL_X509_LOOKUP)
+#define SSL_want_nothing(s) (SSL_want(s) == SSL_NOTHING)
+#define SSL_want_read(s)    (SSL_want(s) == SSL_READING)
+#define SSL_want_write(s)   (SSL_want(s) == SSL_WRITING)
+#define SSL_want_x509_lookup(s) (SSL_want(s) == SSL_X509_LOOKUP)
 
 struct ssl_st
-	{
-	/* protocol version
-	 * (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION, DTLS1_VERSION)
-	 */
-	int version;
-	int type; /* SSL_ST_CONNECT or SSL_ST_ACCEPT */
+    {
+    /* protocol version
+     * (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION, DTLS1_VERSION)
+     */
+    int version;
+    int type; /* SSL_ST_CONNECT or SSL_ST_ACCEPT */
 
-	SSL_METHOD *method; /* SSLv3 */
+    SSL_METHOD *method; /* SSLv3 */
 
-	/* There are 2 BIO's even though they are normally both the
-	 * same.  This is so data can be read and written to different
-	 * handlers */
+    /* There are 2 BIO's even though they are normally both the
+     * same.  This is so data can be read and written to different
+     * handlers */
 
 #ifndef OPENSSL_NO_BIO
-	BIO *rbio; /* used by SSL_read */
-	BIO *wbio; /* used by SSL_write */
-	BIO *bbio; /* used during session-id reuse to concatenate
-		    * messages */
+    BIO *rbio; /* used by SSL_read */
+    BIO *wbio; /* used by SSL_write */
+    BIO *bbio; /* used during session-id reuse to concatenate
+            * messages */
 #else
-	char *rbio; /* used by SSL_read */
-	char *wbio; /* used by SSL_write */
-	char *bbio;
+    char *rbio; /* used by SSL_read */
+    char *wbio; /* used by SSL_write */
+    char *bbio;
 #endif
-	/* This holds a variable that indicates what we were doing
-	 * when a 0 or -1 is returned.  This is needed for
-	 * non-blocking IO so we know what request needs re-doing when
-	 * in SSL_accept or SSL_connect */
-	int rwstate;
+    /* This holds a variable that indicates what we were doing
+     * when a 0 or -1 is returned.  This is needed for
+     * non-blocking IO so we know what request needs re-doing when
+     * in SSL_accept or SSL_connect */
+    int rwstate;
 
-	/* true when we are actually in SSL_accept() or SSL_connect() */
-	int in_handshake;
-	int (*handshake_func)(SSL *);
+    /* true when we are actually in SSL_accept() or SSL_connect() */
+    int in_handshake;
+    int (*handshake_func)(SSL *);
 
-	/* Imagine that here's a boolean member "init" that is
-	 * switched as soon as SSL_set_{accept/connect}_state
-	 * is called for the first time, so that "state" and
-	 * "handshake_func" are properly initialized.  But as
-	 * handshake_func is == 0 until then, we use this
-	 * test instead of an "init" member.
-	 */
+    /* Imagine that here's a boolean member "init" that is
+     * switched as soon as SSL_set_{accept/connect}_state
+     * is called for the first time, so that "state" and
+     * "handshake_func" are properly initialized.  But as
+     * handshake_func is == 0 until then, we use this
+     * test instead of an "init" member.
+     */
 
-	int server;	/* are we the server side? - mostly used by SSL_clear*/
+    int server; /* are we the server side? - mostly used by SSL_clear*/
 
-	int new_session;/* 1 if we are to use a new session.
-	                 * 2 if we are a server and are inside a handshake
-	                 *   (i.e. not just sending a HelloRequest)
-	                 * NB: For servers, the 'new' session may actually be a previously
-	                 * cached session or even the previous session unless
-	                 * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION is set */
-	int quiet_shutdown;/* don't send shutdown packets */
-	int shutdown;	/* we have shut things down, 0x01 sent, 0x02
-			 * for received */
-	int state;	/* where we are */
-	int rstate;	/* where we are when reading */
+    int new_session;/* 1 if we are to use a new session.
+                     * 2 if we are a server and are inside a handshake
+                     *   (i.e. not just sending a HelloRequest)
+                     * NB: For servers, the 'new' session may actually be a previously
+                     * cached session or even the previous session unless
+                     * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION is set */
+    int quiet_shutdown;/* don't send shutdown packets */
+    int shutdown;   /* we have shut things down, 0x01 sent, 0x02
+             * for received */
+    int state;  /* where we are */
+    int rstate; /* where we are when reading */
 
-	BUF_MEM *init_buf;	/* buffer used during init */
-	void *init_msg;   	/* pointer to handshake message body, set by ssl3_get_message() */
-	int init_num;		/* amount read/written */
-	int init_off;		/* amount read/written */
+    BUF_MEM *init_buf;  /* buffer used during init */
+    void *init_msg;     /* pointer to handshake message body, set by ssl3_get_message() */
+    int init_num;       /* amount read/written */
+    int init_off;       /* amount read/written */
 
-	/* used internally to point at a raw packet */
-	unsigned char *packet;
-	unsigned int packet_length;
+    /* used internally to point at a raw packet */
+    unsigned char *packet;
+    unsigned int packet_length;
 
-	struct ssl2_state_st *s2; /* SSLv2 variables */
-	struct ssl3_state_st *s3; /* SSLv3 variables */
-	struct dtls1_state_st *d1; /* DTLSv1 variables */
+    struct ssl2_state_st *s2; /* SSLv2 variables */
+    struct ssl3_state_st *s3; /* SSLv3 variables */
+    struct dtls1_state_st *d1; /* DTLSv1 variables */
 
-	int read_ahead;		/* Read as many input bytes as possible
-	               	 	 * (for non-blocking reads) */
+    int read_ahead;     /* Read as many input bytes as possible
+                         * (for non-blocking reads) */
 
-	/* callback that allows applications to peek at protocol messages */
-	void (*msg_callback)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg);
-	void *msg_callback_arg;
+    /* callback that allows applications to peek at protocol messages */
+    void (*msg_callback)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg);
+    void *msg_callback_arg;
 
-	int hit;		/* reusing a previous session */
+    int hit;        /* reusing a previous session */
 
-	X509_VERIFY_PARAM *param;
+    X509_VERIFY_PARAM *param;
 
 #if 0
-	int purpose;		/* Purpose setting */
-	int trust;		/* Trust setting */
+    int purpose;        /* Purpose setting */
+    int trust;      /* Trust setting */
 #endif
 
-	/* crypto */
-	STACK_OF(SSL_CIPHER) *cipher_list;
-	STACK_OF(SSL_CIPHER) *cipher_list_by_id;
+    /* crypto */
+    STACK_OF(SSL_CIPHER) *cipher_list;
+    STACK_OF(SSL_CIPHER) *cipher_list_by_id;
 
-	/* These are the ones being used, the ones in SSL_SESSION are
-	 * the ones to be 'copied' into these ones */
+    /* These are the ones being used, the ones in SSL_SESSION are
+     * the ones to be 'copied' into these ones */
 
-	EVP_CIPHER_CTX *enc_read_ctx;		/* cryptographic state */
-	const EVP_MD *read_hash;		/* used for mac generation */
+    EVP_CIPHER_CTX *enc_read_ctx;       /* cryptographic state */
+    const EVP_MD *read_hash;        /* used for mac generation */
 #ifndef OPENSSL_NO_COMP
-	COMP_CTX *expand;			/* uncompress */
+    COMP_CTX *expand;           /* uncompress */
 #else
-	char *expand;
+    char *expand;
 #endif
 
-	EVP_CIPHER_CTX *enc_write_ctx;		/* cryptographic state */
-	const EVP_MD *write_hash;		/* used for mac generation */
+    EVP_CIPHER_CTX *enc_write_ctx;      /* cryptographic state */
+    const EVP_MD *write_hash;       /* used for mac generation */
 #ifndef OPENSSL_NO_COMP
-	COMP_CTX *compress;			/* compression */
+    COMP_CTX *compress;         /* compression */
 #else
-	char *compress;	
+    char *compress;
 #endif
 
-	/* session info */
+    /* session info */
 
-	/* client cert? */
-	/* This is used to hold the server certificate used */
-	struct cert_st /* CERT */ *cert;
+    /* client cert? */
+    /* This is used to hold the server certificate used */
+    struct cert_st /* CERT */ *cert;
 
-	/* the session_id_context is used to ensure sessions are only reused
-	 * in the appropriate context */
-	unsigned int sid_ctx_length;
-	unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];
+    /* the session_id_context is used to ensure sessions are only reused
+     * in the appropriate context */
+    unsigned int sid_ctx_length;
+    unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];
 
-	/* This can also be in the session once a session is established */
-	SSL_SESSION *session;
+    /* This can also be in the session once a session is established */
+    SSL_SESSION *session;
 
-	/* Default generate session ID callback. */
-	GEN_SESSION_CB generate_session_id;
+    /* Default generate session ID callback. */
+    GEN_SESSION_CB generate_session_id;
 
-	/* Used in SSL2 and SSL3 */
-	int verify_mode;	/* 0 don't care about verify failure.
-				 * 1 fail if verify fails */
-	int (*verify_callback)(int ok,X509_STORE_CTX *ctx); /* fail if callback returns 0 */
+    /* Used in SSL2 and SSL3 */
+    int verify_mode;    /* 0 don't care about verify failure.
+                 * 1 fail if verify fails */
+    int (*verify_callback)(int ok,X509_STORE_CTX *ctx); /* fail if callback returns 0 */
 
-	void (*info_callback)(const SSL *ssl,int type,int val); /* optional informational callback */
+    void (*info_callback)(const SSL *ssl,int type,int val); /* optional informational callback */
 
-	int error;		/* error bytes to be written */
-	int error_code;		/* actual code */
+    int error;      /* error bytes to be written */
+    int error_code;     /* actual code */
 
 #ifndef OPENSSL_NO_KRB5
-	KSSL_CTX *kssl_ctx;     /* Kerberos 5 context */
-#endif	/* OPENSSL_NO_KRB5 */
+    KSSL_CTX *kssl_ctx;     /* Kerberos 5 context */
+#endif  /* OPENSSL_NO_KRB5 */
 
-	SSL_CTX *ctx;
-	/* set this flag to 1 and a sleep(1) is put into all SSL_read()
-	 * and SSL_write() calls, good for nbio debuging :-) */
-	int debug;	
+    SSL_CTX *ctx;
+    /* set this flag to 1 and a sleep(1) is put into all SSL_read()
+     * and SSL_write() calls, good for nbio debuging :-) */
+    int debug;
 
-	/* extra application data */
-	long verify_result;
-	CRYPTO_EX_DATA ex_data;
+    /* extra application data */
+    long verify_result;
+    CRYPTO_EX_DATA ex_data;
 
-	/* for server side, keep the list of CA_dn we can use */
-	STACK_OF(X509_NAME) *client_CA;
+    /* for server side, keep the list of CA_dn we can use */
+    STACK_OF(X509_NAME) *client_CA;
 
-	int references;
-	unsigned long options; /* protocol behaviour */
-	unsigned long mode; /* API behaviour */
-	long max_cert_list;
-	int first_packet;
-	int client_version;	/* what was passed, used for
-				 * SSLv3/TLS rollback check */
-	};
+    int references;
+    unsigned long options; /* protocol behaviour */
+    unsigned long mode; /* API behaviour */
+    long max_cert_list;
+    int first_packet;
+    int client_version; /* what was passed, used for
+                 * SSLv3/TLS rollback check */
+    };
 
 #ifdef __cplusplus
 }
@@ -990,12 +990,12 @@ extern "C" {
 #endif
 
 /* compatibility */
-#define SSL_set_app_data(s,arg)		(SSL_set_ex_data(s,0,(char *)arg))
-#define SSL_get_app_data(s)		(SSL_get_ex_data(s,0))
-#define SSL_SESSION_set_app_data(s,a)	(SSL_SESSION_set_ex_data(s,0,(char *)a))
-#define SSL_SESSION_get_app_data(s)	(SSL_SESSION_get_ex_data(s,0))
-#define SSL_CTX_get_app_data(ctx)	(SSL_CTX_get_ex_data(ctx,0))
-#define SSL_CTX_set_app_data(ctx,arg)	(SSL_CTX_set_ex_data(ctx,0,(char *)arg))
+#define SSL_set_app_data(s,arg)     (SSL_set_ex_data(s,0,(char *)arg))
+#define SSL_get_app_data(s)     (SSL_get_ex_data(s,0))
+#define SSL_SESSION_set_app_data(s,a)   (SSL_SESSION_set_ex_data(s,0,(char *)a))
+#define SSL_SESSION_get_app_data(s) (SSL_SESSION_get_ex_data(s,0))
+#define SSL_CTX_get_app_data(ctx)   (SSL_CTX_get_ex_data(ctx,0))
+#define SSL_CTX_set_app_data(ctx,arg)   (SSL_CTX_set_ex_data(ctx,0,(char *)arg))
 
 /* The following are the possible values for ssl->state are are
  * used to indicate where we are up to in the SSL connection establishment.
@@ -1004,41 +1004,41 @@ extern "C" {
  * It can also be useful to work out where you were when the connection
  * failed */
 
-#define SSL_ST_CONNECT			0x1000
-#define SSL_ST_ACCEPT			0x2000
-#define SSL_ST_MASK			0x0FFF
-#define SSL_ST_INIT			(SSL_ST_CONNECT|SSL_ST_ACCEPT)
-#define SSL_ST_BEFORE			0x4000
-#define SSL_ST_OK			0x03
-#define SSL_ST_RENEGOTIATE		(0x04|SSL_ST_INIT)
+#define SSL_ST_CONNECT          0x1000
+#define SSL_ST_ACCEPT           0x2000
+#define SSL_ST_MASK         0x0FFF
+#define SSL_ST_INIT         (SSL_ST_CONNECT|SSL_ST_ACCEPT)
+#define SSL_ST_BEFORE           0x4000
+#define SSL_ST_OK           0x03
+#define SSL_ST_RENEGOTIATE      (0x04|SSL_ST_INIT)
 
-#define SSL_CB_LOOP			0x01
-#define SSL_CB_EXIT			0x02
-#define SSL_CB_READ			0x04
-#define SSL_CB_WRITE			0x08
-#define SSL_CB_ALERT			0x4000 /* used in callback */
-#define SSL_CB_READ_ALERT		(SSL_CB_ALERT|SSL_CB_READ)
-#define SSL_CB_WRITE_ALERT		(SSL_CB_ALERT|SSL_CB_WRITE)
-#define SSL_CB_ACCEPT_LOOP		(SSL_ST_ACCEPT|SSL_CB_LOOP)
-#define SSL_CB_ACCEPT_EXIT		(SSL_ST_ACCEPT|SSL_CB_EXIT)
-#define SSL_CB_CONNECT_LOOP		(SSL_ST_CONNECT|SSL_CB_LOOP)
-#define SSL_CB_CONNECT_EXIT		(SSL_ST_CONNECT|SSL_CB_EXIT)
-#define SSL_CB_HANDSHAKE_START		0x10
-#define SSL_CB_HANDSHAKE_DONE		0x20
+#define SSL_CB_LOOP         0x01
+#define SSL_CB_EXIT         0x02
+#define SSL_CB_READ         0x04
+#define SSL_CB_WRITE            0x08
+#define SSL_CB_ALERT            0x4000 /* used in callback */
+#define SSL_CB_READ_ALERT       (SSL_CB_ALERT|SSL_CB_READ)
+#define SSL_CB_WRITE_ALERT      (SSL_CB_ALERT|SSL_CB_WRITE)
+#define SSL_CB_ACCEPT_LOOP      (SSL_ST_ACCEPT|SSL_CB_LOOP)
+#define SSL_CB_ACCEPT_EXIT      (SSL_ST_ACCEPT|SSL_CB_EXIT)
+#define SSL_CB_CONNECT_LOOP     (SSL_ST_CONNECT|SSL_CB_LOOP)
+#define SSL_CB_CONNECT_EXIT     (SSL_ST_CONNECT|SSL_CB_EXIT)
+#define SSL_CB_HANDSHAKE_START      0x10
+#define SSL_CB_HANDSHAKE_DONE       0x20
 
 /* Is the SSL_connection established? */
-#define SSL_get_state(a)		SSL_state(a)
-#define SSL_is_init_finished(a)		(SSL_state(a) == SSL_ST_OK)
-#define SSL_in_init(a)			(SSL_state(a)&SSL_ST_INIT)
-#define SSL_in_before(a)		(SSL_state(a)&SSL_ST_BEFORE)
-#define SSL_in_connect_init(a)		(SSL_state(a)&SSL_ST_CONNECT)
-#define SSL_in_accept_init(a)		(SSL_state(a)&SSL_ST_ACCEPT)
+#define SSL_get_state(a)        SSL_state(a)
+#define SSL_is_init_finished(a)     (SSL_state(a) == SSL_ST_OK)
+#define SSL_in_init(a)          (SSL_state(a)&SSL_ST_INIT)
+#define SSL_in_before(a)        (SSL_state(a)&SSL_ST_BEFORE)
+#define SSL_in_connect_init(a)      (SSL_state(a)&SSL_ST_CONNECT)
+#define SSL_in_accept_init(a)       (SSL_state(a)&SSL_ST_ACCEPT)
 
 /* The following 2 states are kept in ssl->rstate when reads fail,
  * you should not need these */
-#define SSL_ST_READ_HEADER			0xF0
-#define SSL_ST_READ_BODY			0xF1
-#define SSL_ST_READ_DONE			0xF2
+#define SSL_ST_READ_HEADER          0xF0
+#define SSL_ST_READ_BODY            0xF1
+#define SSL_ST_READ_DONE            0xF2
 
 /* Obtain latest Finished message
  *   -- that we sent (SSL_get_finished)
@@ -1049,101 +1049,101 @@ size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count);
 
 /* use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 2 options
  * are 'ored' with SSL_VERIFY_PEER if they are desired */
-#define SSL_VERIFY_NONE			0x00
-#define SSL_VERIFY_PEER			0x01
-#define SSL_VERIFY_FAIL_IF_NO_PEER_CERT	0x02
-#define SSL_VERIFY_CLIENT_ONCE		0x04
+#define SSL_VERIFY_NONE         0x00
+#define SSL_VERIFY_PEER         0x01
+#define SSL_VERIFY_FAIL_IF_NO_PEER_CERT 0x02
+#define SSL_VERIFY_CLIENT_ONCE      0x04
 
-#define OpenSSL_add_ssl_algorithms()	SSL_library_init()
-#define SSLeay_add_ssl_algorithms()	SSL_library_init()
+#define OpenSSL_add_ssl_algorithms()    SSL_library_init()
+#define SSLeay_add_ssl_algorithms() SSL_library_init()
 
 /* this is for backward compatibility */
 #if 0 /* NEW_SSLEAY */
 #define SSL_CTX_set_default_verify(a,b,c) SSL_CTX_set_verify(a,b,c)
-#define SSL_set_pref_cipher(c,n)	SSL_set_cipher_list(c,n)
+#define SSL_set_pref_cipher(c,n)    SSL_set_cipher_list(c,n)
 #define SSL_add_session(a,b)            SSL_CTX_add_session((a),(b))
-#define SSL_remove_session(a,b)		SSL_CTX_remove_session((a),(b))
-#define SSL_flush_sessions(a,b)		SSL_CTX_flush_sessions((a),(b))
+#define SSL_remove_session(a,b)     SSL_CTX_remove_session((a),(b))
+#define SSL_flush_sessions(a,b)     SSL_CTX_flush_sessions((a),(b))
 #endif
 /* More backward compatibility */
 #define SSL_get_cipher(s) \
-		SSL_CIPHER_get_name(SSL_get_current_cipher(s))
+        SSL_CIPHER_get_name(SSL_get_current_cipher(s))
 #define SSL_get_cipher_bits(s,np) \
-		SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np)
+        SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np)
 #define SSL_get_cipher_version(s) \
-		SSL_CIPHER_get_version(SSL_get_current_cipher(s))
+        SSL_CIPHER_get_version(SSL_get_current_cipher(s))
 #define SSL_get_cipher_name(s) \
-		SSL_CIPHER_get_name(SSL_get_current_cipher(s))
-#define SSL_get_time(a)		SSL_SESSION_get_time(a)
-#define SSL_set_time(a,b)	SSL_SESSION_set_time((a),(b))
-#define SSL_get_timeout(a)	SSL_SESSION_get_timeout(a)
-#define SSL_set_timeout(a,b)	SSL_SESSION_set_timeout((a),(b))
+        SSL_CIPHER_get_name(SSL_get_current_cipher(s))
+#define SSL_get_time(a)     SSL_SESSION_get_time(a)
+#define SSL_set_time(a,b)   SSL_SESSION_set_time((a),(b))
+#define SSL_get_timeout(a)  SSL_SESSION_get_timeout(a)
+#define SSL_set_timeout(a,b)    SSL_SESSION_set_timeout((a),(b))
 
 #if 1 /*SSLEAY_MACROS*/
 #define d2i_SSL_SESSION_bio(bp,s_id) ASN1_d2i_bio_of(SSL_SESSION,SSL_SESSION_new,d2i_SSL_SESSION,bp,s_id)
 #define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio_of(SSL_SESSION,i2d_SSL_SESSION,bp,s_id)
 #define PEM_read_SSL_SESSION(fp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read( \
-	(char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb,u)
+    (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb,u)
 #define PEM_read_bio_SSL_SESSION(bp,x,cb,u) PEM_ASN1_read_bio_of(SSL_SESSION,d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,x,cb,u)
 #define PEM_write_SSL_SESSION(fp,x) \
-	PEM_ASN1_write((int (*)())i2d_SSL_SESSION, \
-		PEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL,NULL)
+    PEM_ASN1_write((int (*)())i2d_SSL_SESSION, \
+        PEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL,NULL)
 #define PEM_write_bio_SSL_SESSION(bp,x) \
-	PEM_ASN1_write_bio_of(SSL_SESSION,i2d_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,x,NULL,NULL,0,NULL,NULL)
+    PEM_ASN1_write_bio_of(SSL_SESSION,i2d_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,x,NULL,NULL,0,NULL,NULL)
 #endif
 
-#define SSL_AD_REASON_OFFSET		1000
+#define SSL_AD_REASON_OFFSET        1000
 /* These alert types are for SSLv3 and TLSv1 */
-#define SSL_AD_CLOSE_NOTIFY		SSL3_AD_CLOSE_NOTIFY
-#define SSL_AD_UNEXPECTED_MESSAGE	SSL3_AD_UNEXPECTED_MESSAGE /* fatal */
-#define SSL_AD_BAD_RECORD_MAC		SSL3_AD_BAD_RECORD_MAC     /* fatal */
-#define SSL_AD_DECRYPTION_FAILED	TLS1_AD_DECRYPTION_FAILED
-#define SSL_AD_RECORD_OVERFLOW		TLS1_AD_RECORD_OVERFLOW
-#define SSL_AD_DECOMPRESSION_FAILURE	SSL3_AD_DECOMPRESSION_FAILURE/* fatal */
-#define SSL_AD_HANDSHAKE_FAILURE	SSL3_AD_HANDSHAKE_FAILURE/* fatal */
-#define SSL_AD_NO_CERTIFICATE		SSL3_AD_NO_CERTIFICATE /* Not for TLS */
-#define SSL_AD_BAD_CERTIFICATE		SSL3_AD_BAD_CERTIFICATE
-#define SSL_AD_UNSUPPORTED_CERTIFICATE	SSL3_AD_UNSUPPORTED_CERTIFICATE
-#define SSL_AD_CERTIFICATE_REVOKED	SSL3_AD_CERTIFICATE_REVOKED
-#define SSL_AD_CERTIFICATE_EXPIRED	SSL3_AD_CERTIFICATE_EXPIRED
-#define SSL_AD_CERTIFICATE_UNKNOWN	SSL3_AD_CERTIFICATE_UNKNOWN
-#define SSL_AD_ILLEGAL_PARAMETER	SSL3_AD_ILLEGAL_PARAMETER   /* fatal */
-#define SSL_AD_UNKNOWN_CA		TLS1_AD_UNKNOWN_CA	/* fatal */
-#define SSL_AD_ACCESS_DENIED		TLS1_AD_ACCESS_DENIED	/* fatal */
-#define SSL_AD_DECODE_ERROR		TLS1_AD_DECODE_ERROR	/* fatal */
-#define SSL_AD_DECRYPT_ERROR		TLS1_AD_DECRYPT_ERROR
-#define SSL_AD_EXPORT_RESTRICTION	TLS1_AD_EXPORT_RESTRICTION/* fatal */
-#define SSL_AD_PROTOCOL_VERSION		TLS1_AD_PROTOCOL_VERSION /* fatal */
-#define SSL_AD_INSUFFICIENT_SECURITY	TLS1_AD_INSUFFICIENT_SECURITY/* fatal */
-#define SSL_AD_INTERNAL_ERROR		TLS1_AD_INTERNAL_ERROR	/* fatal */
-#define SSL_AD_USER_CANCELLED		TLS1_AD_USER_CANCELLED
-#define SSL_AD_NO_RENEGOTIATION		TLS1_AD_NO_RENEGOTIATION
+#define SSL_AD_CLOSE_NOTIFY     SSL3_AD_CLOSE_NOTIFY
+#define SSL_AD_UNEXPECTED_MESSAGE   SSL3_AD_UNEXPECTED_MESSAGE /* fatal */
+#define SSL_AD_BAD_RECORD_MAC       SSL3_AD_BAD_RECORD_MAC     /* fatal */
+#define SSL_AD_DECRYPTION_FAILED    TLS1_AD_DECRYPTION_FAILED
+#define SSL_AD_RECORD_OVERFLOW      TLS1_AD_RECORD_OVERFLOW
+#define SSL_AD_DECOMPRESSION_FAILURE    SSL3_AD_DECOMPRESSION_FAILURE/* fatal */
+#define SSL_AD_HANDSHAKE_FAILURE    SSL3_AD_HANDSHAKE_FAILURE/* fatal */
+#define SSL_AD_NO_CERTIFICATE       SSL3_AD_NO_CERTIFICATE /* Not for TLS */
+#define SSL_AD_BAD_CERTIFICATE      SSL3_AD_BAD_CERTIFICATE
+#define SSL_AD_UNSUPPORTED_CERTIFICATE  SSL3_AD_UNSUPPORTED_CERTIFICATE
+#define SSL_AD_CERTIFICATE_REVOKED  SSL3_AD_CERTIFICATE_REVOKED
+#define SSL_AD_CERTIFICATE_EXPIRED  SSL3_AD_CERTIFICATE_EXPIRED
+#define SSL_AD_CERTIFICATE_UNKNOWN  SSL3_AD_CERTIFICATE_UNKNOWN
+#define SSL_AD_ILLEGAL_PARAMETER    SSL3_AD_ILLEGAL_PARAMETER   /* fatal */
+#define SSL_AD_UNKNOWN_CA       TLS1_AD_UNKNOWN_CA  /* fatal */
+#define SSL_AD_ACCESS_DENIED        TLS1_AD_ACCESS_DENIED   /* fatal */
+#define SSL_AD_DECODE_ERROR     TLS1_AD_DECODE_ERROR    /* fatal */
+#define SSL_AD_DECRYPT_ERROR        TLS1_AD_DECRYPT_ERROR
+#define SSL_AD_EXPORT_RESTRICTION   TLS1_AD_EXPORT_RESTRICTION/* fatal */
+#define SSL_AD_PROTOCOL_VERSION     TLS1_AD_PROTOCOL_VERSION /* fatal */
+#define SSL_AD_INSUFFICIENT_SECURITY    TLS1_AD_INSUFFICIENT_SECURITY/* fatal */
+#define SSL_AD_INTERNAL_ERROR       TLS1_AD_INTERNAL_ERROR  /* fatal */
+#define SSL_AD_USER_CANCELLED       TLS1_AD_USER_CANCELLED
+#define SSL_AD_NO_RENEGOTIATION     TLS1_AD_NO_RENEGOTIATION
 
-#define SSL_ERROR_NONE			0
-#define SSL_ERROR_SSL			1
-#define SSL_ERROR_WANT_READ		2
-#define SSL_ERROR_WANT_WRITE		3
-#define SSL_ERROR_WANT_X509_LOOKUP	4
-#define SSL_ERROR_SYSCALL		5 /* look at error stack/return value/errno */
-#define SSL_ERROR_ZERO_RETURN		6
-#define SSL_ERROR_WANT_CONNECT		7
-#define SSL_ERROR_WANT_ACCEPT		8
+#define SSL_ERROR_NONE          0
+#define SSL_ERROR_SSL           1
+#define SSL_ERROR_WANT_READ     2
+#define SSL_ERROR_WANT_WRITE        3
+#define SSL_ERROR_WANT_X509_LOOKUP  4
+#define SSL_ERROR_SYSCALL       5 /* look at error stack/return value/errno */
+#define SSL_ERROR_ZERO_RETURN       6
+#define SSL_ERROR_WANT_CONNECT      7
+#define SSL_ERROR_WANT_ACCEPT       8
 
-#define SSL_CTRL_NEED_TMP_RSA			1
-#define SSL_CTRL_SET_TMP_RSA			2
-#define SSL_CTRL_SET_TMP_DH			3
-#define SSL_CTRL_SET_TMP_ECDH			4
-#define SSL_CTRL_SET_TMP_RSA_CB			5
-#define SSL_CTRL_SET_TMP_DH_CB			6
-#define SSL_CTRL_SET_TMP_ECDH_CB		7
+#define SSL_CTRL_NEED_TMP_RSA           1
+#define SSL_CTRL_SET_TMP_RSA            2
+#define SSL_CTRL_SET_TMP_DH         3
+#define SSL_CTRL_SET_TMP_ECDH           4
+#define SSL_CTRL_SET_TMP_RSA_CB         5
+#define SSL_CTRL_SET_TMP_DH_CB          6
+#define SSL_CTRL_SET_TMP_ECDH_CB        7
 
-#define SSL_CTRL_GET_SESSION_REUSED		8
-#define SSL_CTRL_GET_CLIENT_CERT_REQUEST	9
-#define SSL_CTRL_GET_NUM_RENEGOTIATIONS		10
-#define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS	11
-#define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS	12
-#define SSL_CTRL_GET_FLAGS			13
-#define SSL_CTRL_EXTRA_CHAIN_CERT		14
+#define SSL_CTRL_GET_SESSION_REUSED     8
+#define SSL_CTRL_GET_CLIENT_CERT_REQUEST    9
+#define SSL_CTRL_GET_NUM_RENEGOTIATIONS     10
+#define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS   11
+#define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS   12
+#define SSL_CTRL_GET_FLAGS          13
+#define SSL_CTRL_EXTRA_CHAIN_CERT       14
 
 #define SSL_CTRL_SET_MSG_CALLBACK               15
 #define SSL_CTRL_SET_MSG_CALLBACK_ARG           16
@@ -1151,60 +1151,60 @@ size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count);
 /* only applies to datagram connections */
 #define SSL_CTRL_SET_MTU                17
 /* Stats */
-#define SSL_CTRL_SESS_NUMBER			20
-#define SSL_CTRL_SESS_CONNECT			21
-#define SSL_CTRL_SESS_CONNECT_GOOD		22
-#define SSL_CTRL_SESS_CONNECT_RENEGOTIATE	23
-#define SSL_CTRL_SESS_ACCEPT			24
-#define SSL_CTRL_SESS_ACCEPT_GOOD		25
-#define SSL_CTRL_SESS_ACCEPT_RENEGOTIATE	26
-#define SSL_CTRL_SESS_HIT			27
-#define SSL_CTRL_SESS_CB_HIT			28
-#define SSL_CTRL_SESS_MISSES			29
-#define SSL_CTRL_SESS_TIMEOUTS			30
-#define SSL_CTRL_SESS_CACHE_FULL		31
-#define SSL_CTRL_OPTIONS			32
-#define SSL_CTRL_MODE				33
+#define SSL_CTRL_SESS_NUMBER            20
+#define SSL_CTRL_SESS_CONNECT           21
+#define SSL_CTRL_SESS_CONNECT_GOOD      22
+#define SSL_CTRL_SESS_CONNECT_RENEGOTIATE   23
+#define SSL_CTRL_SESS_ACCEPT            24
+#define SSL_CTRL_SESS_ACCEPT_GOOD       25
+#define SSL_CTRL_SESS_ACCEPT_RENEGOTIATE    26
+#define SSL_CTRL_SESS_HIT           27
+#define SSL_CTRL_SESS_CB_HIT            28
+#define SSL_CTRL_SESS_MISSES            29
+#define SSL_CTRL_SESS_TIMEOUTS          30
+#define SSL_CTRL_SESS_CACHE_FULL        31
+#define SSL_CTRL_OPTIONS            32
+#define SSL_CTRL_MODE               33
 
-#define SSL_CTRL_GET_READ_AHEAD			40
-#define SSL_CTRL_SET_READ_AHEAD			41
-#define SSL_CTRL_SET_SESS_CACHE_SIZE		42
-#define SSL_CTRL_GET_SESS_CACHE_SIZE		43
-#define SSL_CTRL_SET_SESS_CACHE_MODE		44
-#define SSL_CTRL_GET_SESS_CACHE_MODE		45
+#define SSL_CTRL_GET_READ_AHEAD         40
+#define SSL_CTRL_SET_READ_AHEAD         41
+#define SSL_CTRL_SET_SESS_CACHE_SIZE        42
+#define SSL_CTRL_GET_SESS_CACHE_SIZE        43
+#define SSL_CTRL_SET_SESS_CACHE_MODE        44
+#define SSL_CTRL_GET_SESS_CACHE_MODE        45
 
-#define SSL_CTRL_GET_MAX_CERT_LIST		50
-#define SSL_CTRL_SET_MAX_CERT_LIST		51
+#define SSL_CTRL_GET_MAX_CERT_LIST      50
+#define SSL_CTRL_SET_MAX_CERT_LIST      51
 
 #define SSL_session_reused(ssl) \
-	SSL_ctrl((ssl),SSL_CTRL_GET_SESSION_REUSED,0,NULL)
+    SSL_ctrl((ssl),SSL_CTRL_GET_SESSION_REUSED,0,NULL)
 #define SSL_num_renegotiations(ssl) \
-	SSL_ctrl((ssl),SSL_CTRL_GET_NUM_RENEGOTIATIONS,0,NULL)
+    SSL_ctrl((ssl),SSL_CTRL_GET_NUM_RENEGOTIATIONS,0,NULL)
 #define SSL_clear_num_renegotiations(ssl) \
-	SSL_ctrl((ssl),SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS,0,NULL)
+    SSL_ctrl((ssl),SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS,0,NULL)
 #define SSL_total_renegotiations(ssl) \
-	SSL_ctrl((ssl),SSL_CTRL_GET_TOTAL_RENEGOTIATIONS,0,NULL)
+    SSL_ctrl((ssl),SSL_CTRL_GET_TOTAL_RENEGOTIATIONS,0,NULL)
 
 #define SSL_CTX_need_tmp_RSA(ctx) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_NEED_TMP_RSA,0,NULL)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_NEED_TMP_RSA,0,NULL)
 #define SSL_CTX_set_tmp_rsa(ctx,rsa) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa)
 #define SSL_CTX_set_tmp_dh(ctx,dh) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,(char *)dh)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,(char *)dh)
 #define SSL_CTX_set_tmp_ecdh(ctx,ecdh) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH,0,(char *)ecdh)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH,0,(char *)ecdh)
 
 #define SSL_need_tmp_RSA(ssl) \
-	SSL_ctrl(ssl,SSL_CTRL_NEED_TMP_RSA,0,NULL)
+    SSL_ctrl(ssl,SSL_CTRL_NEED_TMP_RSA,0,NULL)
 #define SSL_set_tmp_rsa(ssl,rsa) \
-	SSL_ctrl(ssl,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa)
+    SSL_ctrl(ssl,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa)
 #define SSL_set_tmp_dh(ssl,dh) \
-	SSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH,0,(char *)dh)
+    SSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH,0,(char *)dh)
 #define SSL_set_tmp_ecdh(ssl,ecdh) \
-	SSL_ctrl(ssl,SSL_CTRL_SET_TMP_ECDH,0,(char *)ecdh)
+    SSL_ctrl(ssl,SSL_CTRL_SET_TMP_ECDH,0,(char *)ecdh)
 
 #define SSL_CTX_add_extra_chain_cert(ctx,x509) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)x509)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)x509)
 
 #ifndef OPENSSL_NO_BIO
 BIO_METHOD *BIO_f_ssl(void);
@@ -1216,112 +1216,112 @@ void BIO_ssl_shutdown(BIO *ssl_bio);
 
 #endif
 
-int	SSL_CTX_set_cipher_list(SSL_CTX *,const char *str);
+int SSL_CTX_set_cipher_list(SSL_CTX *,const char *str);
 SSL_CTX *SSL_CTX_new(SSL_METHOD *meth);
-void	SSL_CTX_free(SSL_CTX *);
+void    SSL_CTX_free(SSL_CTX *);
 long SSL_CTX_set_timeout(SSL_CTX *ctx,long t);
 long SSL_CTX_get_timeout(const SSL_CTX *ctx);
 X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *);
 void SSL_CTX_set_cert_store(SSL_CTX *,X509_STORE *);
 int SSL_want(const SSL *s);
-int	SSL_clear(SSL *s);
+int SSL_clear(SSL *s);
 
-void	SSL_CTX_flush_sessions(SSL_CTX *ctx,long tm);
+void    SSL_CTX_flush_sessions(SSL_CTX *ctx,long tm);
 
 SSL_CIPHER *SSL_get_current_cipher(const SSL *s);
-int	SSL_CIPHER_get_bits(const SSL_CIPHER *c,int *alg_bits);
-char *	SSL_CIPHER_get_version(const SSL_CIPHER *c);
-const char *	SSL_CIPHER_get_name(const SSL_CIPHER *c);
+int SSL_CIPHER_get_bits(const SSL_CIPHER *c,int *alg_bits);
+char *  SSL_CIPHER_get_version(const SSL_CIPHER *c);
+const char *    SSL_CIPHER_get_name(const SSL_CIPHER *c);
 
-int	SSL_get_fd(const SSL *s);
-int	SSL_get_rfd(const SSL *s);
-int	SSL_get_wfd(const SSL *s);
+int SSL_get_fd(const SSL *s);
+int SSL_get_rfd(const SSL *s);
+int SSL_get_wfd(const SSL *s);
 const char  * SSL_get_cipher_list(const SSL *s,int n);
-char *	SSL_get_shared_ciphers(const SSL *s, char *buf, int len);
-int	SSL_get_read_ahead(const SSL * s);
-int	SSL_pending(const SSL *s);
+char *  SSL_get_shared_ciphers(const SSL *s, char *buf, int len);
+int SSL_get_read_ahead(const SSL * s);
+int SSL_pending(const SSL *s);
 #ifndef OPENSSL_NO_SOCK
-int	SSL_set_fd(SSL *s, int fd);
-int	SSL_set_rfd(SSL *s, int fd);
-int	SSL_set_wfd(SSL *s, int fd);
+int SSL_set_fd(SSL *s, int fd);
+int SSL_set_rfd(SSL *s, int fd);
+int SSL_set_wfd(SSL *s, int fd);
 #endif
 #ifndef OPENSSL_NO_BIO
-void	SSL_set_bio(SSL *s, BIO *rbio,BIO *wbio);
-BIO *	SSL_get_rbio(const SSL *s);
-BIO *	SSL_get_wbio(const SSL *s);
+void    SSL_set_bio(SSL *s, BIO *rbio,BIO *wbio);
+BIO *   SSL_get_rbio(const SSL *s);
+BIO *   SSL_get_wbio(const SSL *s);
 #endif
-int	SSL_set_cipher_list(SSL *s, const char *str);
-void	SSL_set_read_ahead(SSL *s, int yes);
-int	SSL_get_verify_mode(const SSL *s);
-int	SSL_get_verify_depth(const SSL *s);
-int	(*SSL_get_verify_callback(const SSL *s))(int,X509_STORE_CTX *);
-void	SSL_set_verify(SSL *s, int mode,
-		       int (*callback)(int ok,X509_STORE_CTX *ctx));
-void	SSL_set_verify_depth(SSL *s, int depth);
+int SSL_set_cipher_list(SSL *s, const char *str);
+void    SSL_set_read_ahead(SSL *s, int yes);
+int SSL_get_verify_mode(const SSL *s);
+int SSL_get_verify_depth(const SSL *s);
+int (*SSL_get_verify_callback(const SSL *s))(int,X509_STORE_CTX *);
+void    SSL_set_verify(SSL *s, int mode,
+               int (*callback)(int ok,X509_STORE_CTX *ctx));
+void    SSL_set_verify_depth(SSL *s, int depth);
 #ifndef OPENSSL_NO_RSA
-int	SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa);
+int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa);
 #endif
-int	SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len);
-int	SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey);
-int	SSL_use_PrivateKey_ASN1(int pk,SSL *ssl, const unsigned char *d, long len);
-int	SSL_use_certificate(SSL *ssl, X509 *x);
-int	SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len);
+int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len);
+int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey);
+int SSL_use_PrivateKey_ASN1(int pk,SSL *ssl, const unsigned char *d, long len);
+int SSL_use_certificate(SSL *ssl, X509 *x);
+int SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len);
 
 #ifndef OPENSSL_NO_STDIO
-int	SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type);
-int	SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type);
-int	SSL_use_certificate_file(SSL *ssl, const char *file, int type);
-int	SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type);
-int	SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type);
-int	SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type);
-int	SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); /* PEM type */
+int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type);
+int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type);
+int SSL_use_certificate_file(SSL *ssl, const char *file, int type);
+int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type);
+int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type);
+int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type);
+int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); /* PEM type */
 STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file);
-int	SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,
-					    const char *file);
+int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,
+                        const char *file);
 #ifndef OPENSSL_SYS_VMS
 #ifndef OPENSSL_SYS_MACINTOSH_CLASSIC /* XXXXX: Better scheme needed! [was: #ifndef MAC_OS_pre_X] */
-int	SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,
-					   const char *dir);
+int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,
+                       const char *dir);
 #endif
 #endif
 
 #endif
 
-void	SSL_load_error_strings(void );
+void    SSL_load_error_strings(void );
 const char *SSL_state_string(const SSL *s);
 const char *SSL_rstate_string(const SSL *s);
 const char *SSL_state_string_long(const SSL *s);
 const char *SSL_rstate_string_long(const SSL *s);
-long	SSL_SESSION_get_time(const SSL_SESSION *s);
-long	SSL_SESSION_set_time(SSL_SESSION *s, long t);
-long	SSL_SESSION_get_timeout(const SSL_SESSION *s);
-long	SSL_SESSION_set_timeout(SSL_SESSION *s, long t);
-void	SSL_copy_session_id(SSL *to,const SSL *from);
+long    SSL_SESSION_get_time(const SSL_SESSION *s);
+long    SSL_SESSION_set_time(SSL_SESSION *s, long t);
+long    SSL_SESSION_get_timeout(const SSL_SESSION *s);
+long    SSL_SESSION_set_timeout(SSL_SESSION *s, long t);
+void    SSL_copy_session_id(SSL *to,const SSL *from);
 
 SSL_SESSION *SSL_SESSION_new(void);
 unsigned long SSL_SESSION_hash(const SSL_SESSION *a);
-int	SSL_SESSION_cmp(const SSL_SESSION *a,const SSL_SESSION *b);
+int SSL_SESSION_cmp(const SSL_SESSION *a,const SSL_SESSION *b);
 const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, unsigned int *len);
 #ifndef OPENSSL_NO_FP_API
-int	SSL_SESSION_print_fp(FILE *fp,const SSL_SESSION *ses);
+int SSL_SESSION_print_fp(FILE *fp,const SSL_SESSION *ses);
 #endif
 #ifndef OPENSSL_NO_BIO
-int	SSL_SESSION_print(BIO *fp,const SSL_SESSION *ses);
+int SSL_SESSION_print(BIO *fp,const SSL_SESSION *ses);
 #endif
-void	SSL_SESSION_free(SSL_SESSION *ses);
-int	i2d_SSL_SESSION(SSL_SESSION *in,unsigned char **pp);
-int	SSL_set_session(SSL *to, SSL_SESSION *session);
-int	SSL_CTX_add_session(SSL_CTX *s, SSL_SESSION *c);
-int	SSL_CTX_remove_session(SSL_CTX *,SSL_SESSION *c);
-int	SSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB);
-int	SSL_set_generate_session_id(SSL *, GEN_SESSION_CB);
-int	SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id,
-					unsigned int id_len);
+void    SSL_SESSION_free(SSL_SESSION *ses);
+int i2d_SSL_SESSION(SSL_SESSION *in,unsigned char **pp);
+int SSL_set_session(SSL *to, SSL_SESSION *session);
+int SSL_CTX_add_session(SSL_CTX *s, SSL_SESSION *c);
+int SSL_CTX_remove_session(SSL_CTX *,SSL_SESSION *c);
+int SSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB);
+int SSL_set_generate_session_id(SSL *, GEN_SESSION_CB);
+int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id,
+                    unsigned int id_len);
 SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,const unsigned char **pp,
-			     long length);
+                 long length);
 
 #ifdef HEADER_X509_H
-X509 *	SSL_get_peer_certificate(const SSL *s);
+X509 *  SSL_get_peer_certificate(const SSL *s);
 #endif
 
 STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s);
@@ -1330,7 +1330,7 @@ int SSL_CTX_get_verify_mode(const SSL_CTX *ctx);
 int SSL_CTX_get_verify_depth(const SSL_CTX *ctx);
 int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int,X509_STORE_CTX *);
 void SSL_CTX_set_verify(SSL_CTX *ctx,int mode,
-			int (*callback)(int, X509_STORE_CTX *));
+            int (*callback)(int, X509_STORE_CTX *));
 void SSL_CTX_set_verify_depth(SSL_CTX *ctx,int depth);
 void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, int (*cb)(X509_STORE_CTX *,void *), void *arg);
 #ifndef OPENSSL_NO_RSA
@@ -1339,7 +1339,7 @@ int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa);
 int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len);
 int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey);
 int SSL_CTX_use_PrivateKey_ASN1(int pk,SSL_CTX *ctx,
-	const unsigned char *d, long len);
+    const unsigned char *d, long len);
 int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x);
 int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, const unsigned char *d);
 
@@ -1349,54 +1349,54 @@ void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u);
 int SSL_CTX_check_private_key(const SSL_CTX *ctx);
 int SSL_check_private_key(const SSL *ctx);
 
-int	SSL_CTX_set_session_id_context(SSL_CTX *ctx,const unsigned char *sid_ctx,
-				       unsigned int sid_ctx_len);
+int SSL_CTX_set_session_id_context(SSL_CTX *ctx,const unsigned char *sid_ctx,
+                       unsigned int sid_ctx_len);
 
-SSL *	SSL_new(SSL_CTX *ctx);
-int	SSL_set_session_id_context(SSL *ssl,const unsigned char *sid_ctx,
-				   unsigned int sid_ctx_len);
+SSL *   SSL_new(SSL_CTX *ctx);
+int SSL_set_session_id_context(SSL *ssl,const unsigned char *sid_ctx,
+                   unsigned int sid_ctx_len);
 
 int SSL_CTX_set_purpose(SSL_CTX *s, int purpose);
 int SSL_set_purpose(SSL *s, int purpose);
 int SSL_CTX_set_trust(SSL_CTX *s, int trust);
 int SSL_set_trust(SSL *s, int trust);
 
-void	SSL_free(SSL *ssl);
-int 	SSL_accept(SSL *ssl);
-int 	SSL_connect(SSL *ssl);
-int 	SSL_read(SSL *ssl,void *buf,int num);
-int 	SSL_peek(SSL *ssl,void *buf,int num);
-int 	SSL_write(SSL *ssl,const void *buf,int num);
-long	SSL_ctrl(SSL *ssl,int cmd, long larg, void *parg);
-long	SSL_callback_ctrl(SSL *, int, void (*)(void));
-long	SSL_CTX_ctrl(SSL_CTX *ctx,int cmd, long larg, void *parg);
-long	SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void));
+void    SSL_free(SSL *ssl);
+int     SSL_accept(SSL *ssl);
+int     SSL_connect(SSL *ssl);
+int     SSL_read(SSL *ssl,void *buf,int num);
+int     SSL_peek(SSL *ssl,void *buf,int num);
+int     SSL_write(SSL *ssl,const void *buf,int num);
+long    SSL_ctrl(SSL *ssl,int cmd, long larg, void *parg);
+long    SSL_callback_ctrl(SSL *, int, void (*)(void));
+long    SSL_CTX_ctrl(SSL_CTX *ctx,int cmd, long larg, void *parg);
+long    SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void));
 
-int	SSL_get_error(const SSL *s,int ret_code);
+int SSL_get_error(const SSL *s,int ret_code);
 const char *SSL_get_version(const SSL *s);
 
 /* This sets the 'default' SSL version that SSL_new() will create */
 int SSL_CTX_set_ssl_version(SSL_CTX *ctx,SSL_METHOD *meth);
 
-SSL_METHOD *SSLv2_method(void);		/* SSLv2 */
-SSL_METHOD *SSLv2_server_method(void);	/* SSLv2 */
-SSL_METHOD *SSLv2_client_method(void);	/* SSLv2 */
+SSL_METHOD *SSLv2_method(void);     /* SSLv2 */
+SSL_METHOD *SSLv2_server_method(void);  /* SSLv2 */
+SSL_METHOD *SSLv2_client_method(void);  /* SSLv2 */
 
-SSL_METHOD *SSLv3_method(void);		/* SSLv3 */
-SSL_METHOD *SSLv3_server_method(void);	/* SSLv3 */
-SSL_METHOD *SSLv3_client_method(void);	/* SSLv3 */
+SSL_METHOD *SSLv3_method(void);     /* SSLv3 */
+SSL_METHOD *SSLv3_server_method(void);  /* SSLv3 */
+SSL_METHOD *SSLv3_client_method(void);  /* SSLv3 */
 
-SSL_METHOD *SSLv23_method(void);	/* SSLv3 but can rollback to v2 */
-SSL_METHOD *SSLv23_server_method(void);	/* SSLv3 but can rollback to v2 */
-SSL_METHOD *SSLv23_client_method(void);	/* SSLv3 but can rollback to v2 */
+SSL_METHOD *SSLv23_method(void);    /* SSLv3 but can rollback to v2 */
+SSL_METHOD *SSLv23_server_method(void); /* SSLv3 but can rollback to v2 */
+SSL_METHOD *SSLv23_client_method(void); /* SSLv3 but can rollback to v2 */
 
-SSL_METHOD *TLSv1_method(void);		/* TLSv1.0 */
-SSL_METHOD *TLSv1_server_method(void);	/* TLSv1.0 */
-SSL_METHOD *TLSv1_client_method(void);	/* TLSv1.0 */
+SSL_METHOD *TLSv1_method(void);     /* TLSv1.0 */
+SSL_METHOD *TLSv1_server_method(void);  /* TLSv1.0 */
+SSL_METHOD *TLSv1_client_method(void);  /* TLSv1.0 */
 
-SSL_METHOD *DTLSv1_method(void);		/* DTLSv1.0 */
-SSL_METHOD *DTLSv1_server_method(void);	/* DTLSv1.0 */
-SSL_METHOD *DTLSv1_client_method(void);	/* DTLSv1.0 */
+SSL_METHOD *DTLSv1_method(void);        /* DTLSv1.0 */
+SSL_METHOD *DTLSv1_server_method(void); /* DTLSv1.0 */
+SSL_METHOD *DTLSv1_client_method(void); /* DTLSv1.0 */
 
 STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s);
 
@@ -1443,13 +1443,13 @@ int SSL_get_shutdown(const SSL *ssl);
 int SSL_version(const SSL *ssl);
 int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx);
 int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile,
-	const char *CApath);
+    const char *CApath);
 #define SSL_get0_session SSL_get_session /* just peek at pointer */
 SSL_SESSION *SSL_get_session(const SSL *ssl);
 SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */
 SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl);
 void SSL_set_info_callback(SSL *ssl,
-			   void (*cb)(const SSL *ssl,int type,int val));
+               void (*cb)(const SSL *ssl,int type,int val));
 void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl,int type,int val);
 int SSL_state(const SSL *ssl);
 
@@ -1459,69 +1459,69 @@ long SSL_get_verify_result(const SSL *ssl);
 int SSL_set_ex_data(SSL *ssl,int idx,void *data);
 void *SSL_get_ex_data(const SSL *ssl,int idx);
 int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
-	CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+    CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
 
 int SSL_SESSION_set_ex_data(SSL_SESSION *ss,int idx,void *data);
 void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss,int idx);
 int SSL_SESSION_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
-	CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+    CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
 
 int SSL_CTX_set_ex_data(SSL_CTX *ssl,int idx,void *data);
 void *SSL_CTX_get_ex_data(const SSL_CTX *ssl,int idx);
 int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
-	CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+    CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
 
 int SSL_get_ex_data_X509_STORE_CTX_idx(void );
 
 #define SSL_CTX_sess_set_cache_size(ctx,t) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_SIZE,t,NULL)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_SIZE,t,NULL)
 #define SSL_CTX_sess_get_cache_size(ctx) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_SIZE,0,NULL)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_SIZE,0,NULL)
 #define SSL_CTX_set_session_cache_mode(ctx,m) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL)
 #define SSL_CTX_get_session_cache_mode(ctx) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,NULL)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,NULL)
 
 #define SSL_CTX_get_default_read_ahead(ctx) SSL_CTX_get_read_ahead(ctx)
 #define SSL_CTX_set_default_read_ahead(ctx,m) SSL_CTX_set_read_ahead(ctx,m)
 #define SSL_CTX_get_read_ahead(ctx) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_GET_READ_AHEAD,0,NULL)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_GET_READ_AHEAD,0,NULL)
 #define SSL_CTX_set_read_ahead(ctx,m) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,m,NULL)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,m,NULL)
 #define SSL_CTX_get_max_cert_list(ctx) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL)
 #define SSL_CTX_set_max_cert_list(ctx,m) \
-	SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL)
+    SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL)
 #define SSL_get_max_cert_list(ssl) \
-	SSL_ctrl(ssl,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL)
+    SSL_ctrl(ssl,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL)
 #define SSL_set_max_cert_list(ssl,m) \
-	SSL_ctrl(ssl,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL)
+    SSL_ctrl(ssl,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL)
 
      /* NB: the keylength is only applicable when is_export is true */
 #ifndef OPENSSL_NO_RSA
 void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx,
-				  RSA *(*cb)(SSL *ssl,int is_export,
-					     int keylength));
+                  RSA *(*cb)(SSL *ssl,int is_export,
+                         int keylength));
 
 void SSL_set_tmp_rsa_callback(SSL *ssl,
-				  RSA *(*cb)(SSL *ssl,int is_export,
-					     int keylength));
+                  RSA *(*cb)(SSL *ssl,int is_export,
+                         int keylength));
 #endif
 #ifndef OPENSSL_NO_DH
 void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx,
-				 DH *(*dh)(SSL *ssl,int is_export,
-					   int keylength));
+                 DH *(*dh)(SSL *ssl,int is_export,
+                       int keylength));
 void SSL_set_tmp_dh_callback(SSL *ssl,
-				 DH *(*dh)(SSL *ssl,int is_export,
-					   int keylength));
+                 DH *(*dh)(SSL *ssl,int is_export,
+                       int keylength));
 #endif
 #ifndef OPENSSL_NO_ECDH
 void SSL_CTX_set_tmp_ecdh_callback(SSL_CTX *ctx,
-				 EC_KEY *(*ecdh)(SSL *ssl,int is_export,
-					   int keylength));
+                 EC_KEY *(*ecdh)(SSL *ssl,int is_export,
+                       int keylength));
 void SSL_set_tmp_ecdh_callback(SSL *ssl,
-				 EC_KEY *(*ecdh)(SSL *ssl,int is_export,
-					   int keylength));
+                 EC_KEY *(*ecdh)(SSL *ssl,int is_export,
+                       int keylength));
 #endif
 
 #ifndef OPENSSL_NO_COMP
@@ -1547,412 +1547,412 @@ void ERR_load_SSL_strings(void);
 /* Error codes for the SSL functions. */
 
 /* Function codes. */
-#define SSL_F_CLIENT_CERTIFICATE			 100
-#define SSL_F_CLIENT_FINISHED				 167
-#define SSL_F_CLIENT_HELLO				 101
-#define SSL_F_CLIENT_MASTER_KEY				 102
-#define SSL_F_D2I_SSL_SESSION				 103
-#define SSL_F_DO_DTLS1_WRITE				 245
-#define SSL_F_DO_SSL3_WRITE				 104
-#define SSL_F_DTLS1_ACCEPT				 246
-#define SSL_F_DTLS1_BUFFER_RECORD			 247
-#define SSL_F_DTLS1_CLIENT_HELLO			 248
-#define SSL_F_DTLS1_CONNECT				 249
-#define SSL_F_DTLS1_ENC					 250
-#define SSL_F_DTLS1_GET_HELLO_VERIFY			 251
-#define SSL_F_DTLS1_GET_MESSAGE				 252
-#define SSL_F_DTLS1_GET_MESSAGE_FRAGMENT		 253
-#define SSL_F_DTLS1_GET_RECORD				 254
-#define SSL_F_DTLS1_OUTPUT_CERT_CHAIN			 255
-#define SSL_F_DTLS1_PROCESS_OUT_OF_SEQ_MESSAGE		 256
-#define SSL_F_DTLS1_PROCESS_RECORD			 257
-#define SSL_F_DTLS1_READ_BYTES				 258
-#define SSL_F_DTLS1_READ_FAILED				 259
-#define SSL_F_DTLS1_SEND_CERTIFICATE_REQUEST		 260
-#define SSL_F_DTLS1_SEND_CLIENT_CERTIFICATE		 261
-#define SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE		 262
-#define SSL_F_DTLS1_SEND_CLIENT_VERIFY			 263
-#define SSL_F_DTLS1_SEND_HELLO_VERIFY_REQUEST		 264
-#define SSL_F_DTLS1_SEND_SERVER_CERTIFICATE		 265
-#define SSL_F_DTLS1_SEND_SERVER_HELLO			 266
-#define SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE		 267
-#define SSL_F_DTLS1_WRITE_APP_DATA_BYTES		 268
-#define SSL_F_GET_CLIENT_FINISHED			 105
-#define SSL_F_GET_CLIENT_HELLO				 106
-#define SSL_F_GET_CLIENT_MASTER_KEY			 107
-#define SSL_F_GET_SERVER_FINISHED			 108
-#define SSL_F_GET_SERVER_HELLO				 109
-#define SSL_F_GET_SERVER_VERIFY				 110
-#define SSL_F_I2D_SSL_SESSION				 111
-#define SSL_F_READ_N					 112
-#define SSL_F_REQUEST_CERTIFICATE			 113
-#define SSL_F_SERVER_FINISH				 239
-#define SSL_F_SERVER_HELLO				 114
-#define SSL_F_SERVER_VERIFY				 240
-#define SSL_F_SSL23_ACCEPT				 115
-#define SSL_F_SSL23_CLIENT_HELLO			 116
-#define SSL_F_SSL23_CONNECT				 117
-#define SSL_F_SSL23_GET_CLIENT_HELLO			 118
-#define SSL_F_SSL23_GET_SERVER_HELLO			 119
-#define SSL_F_SSL23_PEEK				 237
-#define SSL_F_SSL23_READ				 120
-#define SSL_F_SSL23_WRITE				 121
-#define SSL_F_SSL2_ACCEPT				 122
-#define SSL_F_SSL2_CONNECT				 123
-#define SSL_F_SSL2_ENC_INIT				 124
-#define SSL_F_SSL2_GENERATE_KEY_MATERIAL		 241
-#define SSL_F_SSL2_PEEK					 234
-#define SSL_F_SSL2_READ					 125
-#define SSL_F_SSL2_READ_INTERNAL			 236
-#define SSL_F_SSL2_SET_CERTIFICATE			 126
-#define SSL_F_SSL2_WRITE				 127
-#define SSL_F_SSL3_ACCEPT				 128
-#define SSL_F_SSL3_CALLBACK_CTRL			 233
-#define SSL_F_SSL3_CHANGE_CIPHER_STATE			 129
-#define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM		 130
-#define SSL_F_SSL3_CLIENT_HELLO				 131
-#define SSL_F_SSL3_CONNECT				 132
-#define SSL_F_SSL3_CTRL					 213
-#define SSL_F_SSL3_CTX_CTRL				 133
-#define SSL_F_SSL3_ENC					 134
-#define SSL_F_SSL3_GENERATE_KEY_BLOCK			 238
-#define SSL_F_SSL3_GET_CERTIFICATE_REQUEST		 135
-#define SSL_F_SSL3_GET_CERT_VERIFY			 136
-#define SSL_F_SSL3_GET_CLIENT_CERTIFICATE		 137
-#define SSL_F_SSL3_GET_CLIENT_HELLO			 138
-#define SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE		 139
-#define SSL_F_SSL3_GET_FINISHED				 140
-#define SSL_F_SSL3_GET_KEY_EXCHANGE			 141
-#define SSL_F_SSL3_GET_MESSAGE				 142
-#define SSL_F_SSL3_GET_RECORD				 143
-#define SSL_F_SSL3_GET_SERVER_CERTIFICATE		 144
-#define SSL_F_SSL3_GET_SERVER_DONE			 145
-#define SSL_F_SSL3_GET_SERVER_HELLO			 146
-#define SSL_F_SSL3_OUTPUT_CERT_CHAIN			 147
-#define SSL_F_SSL3_PEEK					 235
-#define SSL_F_SSL3_READ_BYTES				 148
-#define SSL_F_SSL3_READ_N				 149
-#define SSL_F_SSL3_SEND_CERTIFICATE_REQUEST		 150
-#define SSL_F_SSL3_SEND_CLIENT_CERTIFICATE		 151
-#define SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE		 152
-#define SSL_F_SSL3_SEND_CLIENT_VERIFY			 153
-#define SSL_F_SSL3_SEND_SERVER_CERTIFICATE		 154
-#define SSL_F_SSL3_SEND_SERVER_HELLO			 242
-#define SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE		 155
-#define SSL_F_SSL3_SETUP_BUFFERS			 156
-#define SSL_F_SSL3_SETUP_KEY_BLOCK			 157
-#define SSL_F_SSL3_WRITE_BYTES				 158
-#define SSL_F_SSL3_WRITE_PENDING			 159
-#define SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK	 215
-#define SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK	 216
-#define SSL_F_SSL_BAD_METHOD				 160
-#define SSL_F_SSL_BYTES_TO_CIPHER_LIST			 161
-#define SSL_F_SSL_CERT_DUP				 221
-#define SSL_F_SSL_CERT_INST				 222
-#define SSL_F_SSL_CERT_INSTANTIATE			 214
-#define SSL_F_SSL_CERT_NEW				 162
-#define SSL_F_SSL_CHECK_PRIVATE_KEY			 163
-#define SSL_F_SSL_CIPHER_PROCESS_RULESTR		 230
-#define SSL_F_SSL_CIPHER_STRENGTH_SORT			 231
-#define SSL_F_SSL_CLEAR					 164
-#define SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD		 165
-#define SSL_F_SSL_CREATE_CIPHER_LIST			 166
-#define SSL_F_SSL_CTRL					 232
-#define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY			 168
-#define SSL_F_SSL_CTX_NEW				 169
-#define SSL_F_SSL_CTX_SET_CIPHER_LIST			 269
-#define SSL_F_SSL_CTX_SET_PURPOSE			 226
-#define SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT		 219
-#define SSL_F_SSL_CTX_SET_SSL_VERSION			 170
-#define SSL_F_SSL_CTX_SET_TRUST				 229
-#define SSL_F_SSL_CTX_USE_CERTIFICATE			 171
-#define SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1		 172
-#define SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE	 220
-#define SSL_F_SSL_CTX_USE_CERTIFICATE_FILE		 173
-#define SSL_F_SSL_CTX_USE_PRIVATEKEY			 174
-#define SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1		 175
-#define SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE		 176
-#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY			 177
-#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1		 178
-#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE		 179
-#define SSL_F_SSL_DO_HANDSHAKE				 180
-#define SSL_F_SSL_GET_NEW_SESSION			 181
-#define SSL_F_SSL_GET_PREV_SESSION			 217
-#define SSL_F_SSL_GET_SERVER_SEND_CERT			 182
-#define SSL_F_SSL_GET_SIGN_PKEY				 183
-#define SSL_F_SSL_INIT_WBIO_BUFFER			 184
-#define SSL_F_SSL_LOAD_CLIENT_CA_FILE			 185
-#define SSL_F_SSL_NEW					 186
-#define SSL_F_SSL_PEEK					 270
-#define SSL_F_SSL_READ					 223
-#define SSL_F_SSL_RSA_PRIVATE_DECRYPT			 187
-#define SSL_F_SSL_RSA_PUBLIC_ENCRYPT			 188
-#define SSL_F_SSL_SESSION_NEW				 189
-#define SSL_F_SSL_SESSION_PRINT_FP			 190
-#define SSL_F_SSL_SESS_CERT_NEW				 225
-#define SSL_F_SSL_SET_CERT				 191
-#define SSL_F_SSL_SET_CIPHER_LIST			 271
-#define SSL_F_SSL_SET_FD				 192
-#define SSL_F_SSL_SET_PKEY				 193
-#define SSL_F_SSL_SET_PURPOSE				 227
-#define SSL_F_SSL_SET_RFD				 194
-#define SSL_F_SSL_SET_SESSION				 195
-#define SSL_F_SSL_SET_SESSION_ID_CONTEXT		 218
-#define SSL_F_SSL_SET_TRUST				 228
-#define SSL_F_SSL_SET_WFD				 196
-#define SSL_F_SSL_SHUTDOWN				 224
-#define SSL_F_SSL_UNDEFINED_CONST_FUNCTION		 243
-#define SSL_F_SSL_UNDEFINED_FUNCTION			 197
-#define SSL_F_SSL_UNDEFINED_VOID_FUNCTION		 244
-#define SSL_F_SSL_USE_CERTIFICATE			 198
-#define SSL_F_SSL_USE_CERTIFICATE_ASN1			 199
-#define SSL_F_SSL_USE_CERTIFICATE_FILE			 200
-#define SSL_F_SSL_USE_PRIVATEKEY			 201
-#define SSL_F_SSL_USE_PRIVATEKEY_ASN1			 202
-#define SSL_F_SSL_USE_PRIVATEKEY_FILE			 203
-#define SSL_F_SSL_USE_RSAPRIVATEKEY			 204
-#define SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1		 205
-#define SSL_F_SSL_USE_RSAPRIVATEKEY_FILE		 206
-#define SSL_F_SSL_VERIFY_CERT_CHAIN			 207
-#define SSL_F_SSL_WRITE					 208
-#define SSL_F_TLS1_CHANGE_CIPHER_STATE			 209
-#define SSL_F_TLS1_ENC					 210
-#define SSL_F_TLS1_SETUP_KEY_BLOCK			 211
-#define SSL_F_WRITE_PENDING				 212
+#define SSL_F_CLIENT_CERTIFICATE             100
+#define SSL_F_CLIENT_FINISHED                167
+#define SSL_F_CLIENT_HELLO               101
+#define SSL_F_CLIENT_MASTER_KEY              102
+#define SSL_F_D2I_SSL_SESSION                103
+#define SSL_F_DO_DTLS1_WRITE                 245
+#define SSL_F_DO_SSL3_WRITE              104
+#define SSL_F_DTLS1_ACCEPT               246
+#define SSL_F_DTLS1_BUFFER_RECORD            247
+#define SSL_F_DTLS1_CLIENT_HELLO             248
+#define SSL_F_DTLS1_CONNECT              249
+#define SSL_F_DTLS1_ENC                  250
+#define SSL_F_DTLS1_GET_HELLO_VERIFY             251
+#define SSL_F_DTLS1_GET_MESSAGE              252
+#define SSL_F_DTLS1_GET_MESSAGE_FRAGMENT         253
+#define SSL_F_DTLS1_GET_RECORD               254
+#define SSL_F_DTLS1_OUTPUT_CERT_CHAIN            255
+#define SSL_F_DTLS1_PROCESS_OUT_OF_SEQ_MESSAGE       256
+#define SSL_F_DTLS1_PROCESS_RECORD           257
+#define SSL_F_DTLS1_READ_BYTES               258
+#define SSL_F_DTLS1_READ_FAILED              259
+#define SSL_F_DTLS1_SEND_CERTIFICATE_REQUEST         260
+#define SSL_F_DTLS1_SEND_CLIENT_CERTIFICATE      261
+#define SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE         262
+#define SSL_F_DTLS1_SEND_CLIENT_VERIFY           263
+#define SSL_F_DTLS1_SEND_HELLO_VERIFY_REQUEST        264
+#define SSL_F_DTLS1_SEND_SERVER_CERTIFICATE      265
+#define SSL_F_DTLS1_SEND_SERVER_HELLO            266
+#define SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE         267
+#define SSL_F_DTLS1_WRITE_APP_DATA_BYTES         268
+#define SSL_F_GET_CLIENT_FINISHED            105
+#define SSL_F_GET_CLIENT_HELLO               106
+#define SSL_F_GET_CLIENT_MASTER_KEY          107
+#define SSL_F_GET_SERVER_FINISHED            108
+#define SSL_F_GET_SERVER_HELLO               109
+#define SSL_F_GET_SERVER_VERIFY              110
+#define SSL_F_I2D_SSL_SESSION                111
+#define SSL_F_READ_N                     112
+#define SSL_F_REQUEST_CERTIFICATE            113
+#define SSL_F_SERVER_FINISH              239
+#define SSL_F_SERVER_HELLO               114
+#define SSL_F_SERVER_VERIFY              240
+#define SSL_F_SSL23_ACCEPT               115
+#define SSL_F_SSL23_CLIENT_HELLO             116
+#define SSL_F_SSL23_CONNECT              117
+#define SSL_F_SSL23_GET_CLIENT_HELLO             118
+#define SSL_F_SSL23_GET_SERVER_HELLO             119
+#define SSL_F_SSL23_PEEK                 237
+#define SSL_F_SSL23_READ                 120
+#define SSL_F_SSL23_WRITE                121
+#define SSL_F_SSL2_ACCEPT                122
+#define SSL_F_SSL2_CONNECT               123
+#define SSL_F_SSL2_ENC_INIT              124
+#define SSL_F_SSL2_GENERATE_KEY_MATERIAL         241
+#define SSL_F_SSL2_PEEK                  234
+#define SSL_F_SSL2_READ                  125
+#define SSL_F_SSL2_READ_INTERNAL             236
+#define SSL_F_SSL2_SET_CERTIFICATE           126
+#define SSL_F_SSL2_WRITE                 127
+#define SSL_F_SSL3_ACCEPT                128
+#define SSL_F_SSL3_CALLBACK_CTRL             233
+#define SSL_F_SSL3_CHANGE_CIPHER_STATE           129
+#define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM      130
+#define SSL_F_SSL3_CLIENT_HELLO              131
+#define SSL_F_SSL3_CONNECT               132
+#define SSL_F_SSL3_CTRL                  213
+#define SSL_F_SSL3_CTX_CTRL              133
+#define SSL_F_SSL3_ENC                   134
+#define SSL_F_SSL3_GENERATE_KEY_BLOCK            238
+#define SSL_F_SSL3_GET_CERTIFICATE_REQUEST       135
+#define SSL_F_SSL3_GET_CERT_VERIFY           136
+#define SSL_F_SSL3_GET_CLIENT_CERTIFICATE        137
+#define SSL_F_SSL3_GET_CLIENT_HELLO          138
+#define SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE       139
+#define SSL_F_SSL3_GET_FINISHED              140
+#define SSL_F_SSL3_GET_KEY_EXCHANGE          141
+#define SSL_F_SSL3_GET_MESSAGE               142
+#define SSL_F_SSL3_GET_RECORD                143
+#define SSL_F_SSL3_GET_SERVER_CERTIFICATE        144
+#define SSL_F_SSL3_GET_SERVER_DONE           145
+#define SSL_F_SSL3_GET_SERVER_HELLO          146
+#define SSL_F_SSL3_OUTPUT_CERT_CHAIN             147
+#define SSL_F_SSL3_PEEK                  235
+#define SSL_F_SSL3_READ_BYTES                148
+#define SSL_F_SSL3_READ_N                149
+#define SSL_F_SSL3_SEND_CERTIFICATE_REQUEST      150
+#define SSL_F_SSL3_SEND_CLIENT_CERTIFICATE       151
+#define SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE      152
+#define SSL_F_SSL3_SEND_CLIENT_VERIFY            153
+#define SSL_F_SSL3_SEND_SERVER_CERTIFICATE       154
+#define SSL_F_SSL3_SEND_SERVER_HELLO             242
+#define SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE      155
+#define SSL_F_SSL3_SETUP_BUFFERS             156
+#define SSL_F_SSL3_SETUP_KEY_BLOCK           157
+#define SSL_F_SSL3_WRITE_BYTES               158
+#define SSL_F_SSL3_WRITE_PENDING             159
+#define SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK     215
+#define SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK    216
+#define SSL_F_SSL_BAD_METHOD                 160
+#define SSL_F_SSL_BYTES_TO_CIPHER_LIST           161
+#define SSL_F_SSL_CERT_DUP               221
+#define SSL_F_SSL_CERT_INST              222
+#define SSL_F_SSL_CERT_INSTANTIATE           214
+#define SSL_F_SSL_CERT_NEW               162
+#define SSL_F_SSL_CHECK_PRIVATE_KEY          163
+#define SSL_F_SSL_CIPHER_PROCESS_RULESTR         230
+#define SSL_F_SSL_CIPHER_STRENGTH_SORT           231
+#define SSL_F_SSL_CLEAR                  164
+#define SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD        165
+#define SSL_F_SSL_CREATE_CIPHER_LIST             166
+#define SSL_F_SSL_CTRL                   232
+#define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY          168
+#define SSL_F_SSL_CTX_NEW                169
+#define SSL_F_SSL_CTX_SET_CIPHER_LIST            269
+#define SSL_F_SSL_CTX_SET_PURPOSE            226
+#define SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT         219
+#define SSL_F_SSL_CTX_SET_SSL_VERSION            170
+#define SSL_F_SSL_CTX_SET_TRUST              229
+#define SSL_F_SSL_CTX_USE_CERTIFICATE            171
+#define SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1       172
+#define SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE     220
+#define SSL_F_SSL_CTX_USE_CERTIFICATE_FILE       173
+#define SSL_F_SSL_CTX_USE_PRIVATEKEY             174
+#define SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1        175
+#define SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE        176
+#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY          177
+#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1         178
+#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE         179
+#define SSL_F_SSL_DO_HANDSHAKE               180
+#define SSL_F_SSL_GET_NEW_SESSION            181
+#define SSL_F_SSL_GET_PREV_SESSION           217
+#define SSL_F_SSL_GET_SERVER_SEND_CERT           182
+#define SSL_F_SSL_GET_SIGN_PKEY              183
+#define SSL_F_SSL_INIT_WBIO_BUFFER           184
+#define SSL_F_SSL_LOAD_CLIENT_CA_FILE            185
+#define SSL_F_SSL_NEW                    186
+#define SSL_F_SSL_PEEK                   270
+#define SSL_F_SSL_READ                   223
+#define SSL_F_SSL_RSA_PRIVATE_DECRYPT            187
+#define SSL_F_SSL_RSA_PUBLIC_ENCRYPT             188
+#define SSL_F_SSL_SESSION_NEW                189
+#define SSL_F_SSL_SESSION_PRINT_FP           190
+#define SSL_F_SSL_SESS_CERT_NEW              225
+#define SSL_F_SSL_SET_CERT               191
+#define SSL_F_SSL_SET_CIPHER_LIST            271
+#define SSL_F_SSL_SET_FD                 192
+#define SSL_F_SSL_SET_PKEY               193
+#define SSL_F_SSL_SET_PURPOSE                227
+#define SSL_F_SSL_SET_RFD                194
+#define SSL_F_SSL_SET_SESSION                195
+#define SSL_F_SSL_SET_SESSION_ID_CONTEXT         218
+#define SSL_F_SSL_SET_TRUST              228
+#define SSL_F_SSL_SET_WFD                196
+#define SSL_F_SSL_SHUTDOWN               224
+#define SSL_F_SSL_UNDEFINED_CONST_FUNCTION       243
+#define SSL_F_SSL_UNDEFINED_FUNCTION             197
+#define SSL_F_SSL_UNDEFINED_VOID_FUNCTION        244
+#define SSL_F_SSL_USE_CERTIFICATE            198
+#define SSL_F_SSL_USE_CERTIFICATE_ASN1           199
+#define SSL_F_SSL_USE_CERTIFICATE_FILE           200
+#define SSL_F_SSL_USE_PRIVATEKEY             201
+#define SSL_F_SSL_USE_PRIVATEKEY_ASN1            202
+#define SSL_F_SSL_USE_PRIVATEKEY_FILE            203
+#define SSL_F_SSL_USE_RSAPRIVATEKEY          204
+#define SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1         205
+#define SSL_F_SSL_USE_RSAPRIVATEKEY_FILE         206
+#define SSL_F_SSL_VERIFY_CERT_CHAIN          207
+#define SSL_F_SSL_WRITE                  208
+#define SSL_F_TLS1_CHANGE_CIPHER_STATE           209
+#define SSL_F_TLS1_ENC                   210
+#define SSL_F_TLS1_SETUP_KEY_BLOCK           211
+#define SSL_F_WRITE_PENDING              212
 
 /* Reason codes. */
-#define SSL_R_APP_DATA_IN_HANDSHAKE			 100
+#define SSL_R_APP_DATA_IN_HANDSHAKE          100
 #define SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT 272
-#define SSL_R_BAD_ALERT_RECORD				 101
-#define SSL_R_BAD_AUTHENTICATION_TYPE			 102
-#define SSL_R_BAD_CHANGE_CIPHER_SPEC			 103
-#define SSL_R_BAD_CHECKSUM				 104
-#define SSL_R_BAD_DATA_RETURNED_BY_CALLBACK		 106
-#define SSL_R_BAD_DECOMPRESSION				 107
-#define SSL_R_BAD_DH_G_LENGTH				 108
-#define SSL_R_BAD_DH_PUB_KEY_LENGTH			 109
-#define SSL_R_BAD_DH_P_LENGTH				 110
-#define SSL_R_BAD_DIGEST_LENGTH				 111
-#define SSL_R_BAD_DSA_SIGNATURE				 112
-#define SSL_R_BAD_ECC_CERT				 304
-#define SSL_R_BAD_ECDSA_SIGNATURE			 305
-#define SSL_R_BAD_ECPOINT				 306
-#define SSL_R_BAD_HELLO_REQUEST				 105
-#define SSL_R_BAD_LENGTH				 271
-#define SSL_R_BAD_MAC_DECODE				 113
-#define SSL_R_BAD_MESSAGE_TYPE				 114
-#define SSL_R_BAD_PACKET_LENGTH				 115
-#define SSL_R_BAD_PROTOCOL_VERSION_NUMBER		 116
-#define SSL_R_BAD_RESPONSE_ARGUMENT			 117
-#define SSL_R_BAD_RSA_DECRYPT				 118
-#define SSL_R_BAD_RSA_ENCRYPT				 119
-#define SSL_R_BAD_RSA_E_LENGTH				 120
-#define SSL_R_BAD_RSA_MODULUS_LENGTH			 121
-#define SSL_R_BAD_RSA_SIGNATURE				 122
-#define SSL_R_BAD_SIGNATURE				 123
-#define SSL_R_BAD_SSL_FILETYPE				 124
-#define SSL_R_BAD_SSL_SESSION_ID_LENGTH			 125
-#define SSL_R_BAD_STATE					 126
-#define SSL_R_BAD_WRITE_RETRY				 127
-#define SSL_R_BIO_NOT_SET				 128
-#define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG			 129
-#define SSL_R_BN_LIB					 130
-#define SSL_R_CA_DN_LENGTH_MISMATCH			 131
-#define SSL_R_CA_DN_TOO_LONG				 132
-#define SSL_R_CCS_RECEIVED_EARLY			 133
-#define SSL_R_CERTIFICATE_VERIFY_FAILED			 134
-#define SSL_R_CERT_LENGTH_MISMATCH			 135
-#define SSL_R_CHALLENGE_IS_DIFFERENT			 136
-#define SSL_R_CIPHER_CODE_WRONG_LENGTH			 137
-#define SSL_R_CIPHER_OR_HASH_UNAVAILABLE		 138
-#define SSL_R_CIPHER_TABLE_SRC_ERROR			 139
-#define SSL_R_COMPRESSED_LENGTH_TOO_LONG		 140
-#define SSL_R_COMPRESSION_FAILURE			 141
-#define SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE	 307
-#define SSL_R_COMPRESSION_LIBRARY_ERROR			 142
-#define SSL_R_CONNECTION_ID_IS_DIFFERENT		 143
-#define SSL_R_CONNECTION_TYPE_NOT_SET			 144
-#define SSL_R_COOKIE_MISMATCH				 308
-#define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED		 145
-#define SSL_R_DATA_LENGTH_TOO_LONG			 146
-#define SSL_R_DECRYPTION_FAILED				 147
-#define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC	 281
-#define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG		 148
-#define SSL_R_DIGEST_CHECK_FAILED			 149
-#define SSL_R_DUPLICATE_COMPRESSION_ID			 309
-#define SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER		 310
-#define SSL_R_ENCRYPTED_LENGTH_TOO_LONG			 150
-#define SSL_R_ERROR_GENERATING_TMP_RSA_KEY		 282
-#define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST		 151
-#define SSL_R_EXCESSIVE_MESSAGE_SIZE			 152
-#define SSL_R_EXTRA_DATA_IN_MESSAGE			 153
-#define SSL_R_GOT_A_FIN_BEFORE_A_CCS			 154
-#define SSL_R_HTTPS_PROXY_REQUEST			 155
-#define SSL_R_HTTP_REQUEST				 156
-#define SSL_R_ILLEGAL_PADDING				 283
-#define SSL_R_INVALID_CHALLENGE_LENGTH			 158
-#define SSL_R_INVALID_COMMAND				 280
-#define SSL_R_INVALID_PURPOSE				 278
-#define SSL_R_INVALID_TRUST				 279
-#define SSL_R_KEY_ARG_TOO_LONG				 284
-#define SSL_R_KRB5					 285
-#define SSL_R_KRB5_C_CC_PRINC				 286
-#define SSL_R_KRB5_C_GET_CRED				 287
-#define SSL_R_KRB5_C_INIT				 288
-#define SSL_R_KRB5_C_MK_REQ				 289
-#define SSL_R_KRB5_S_BAD_TICKET				 290
-#define SSL_R_KRB5_S_INIT				 291
-#define SSL_R_KRB5_S_RD_REQ				 292
-#define SSL_R_KRB5_S_TKT_EXPIRED			 293
-#define SSL_R_KRB5_S_TKT_NYV				 294
-#define SSL_R_KRB5_S_TKT_SKEW				 295
-#define SSL_R_LENGTH_MISMATCH				 159
-#define SSL_R_LENGTH_TOO_SHORT				 160
-#define SSL_R_LIBRARY_BUG				 274
-#define SSL_R_LIBRARY_HAS_NO_CIPHERS			 161
-#define SSL_R_MESSAGE_TOO_LONG				 296
-#define SSL_R_MISSING_DH_DSA_CERT			 162
-#define SSL_R_MISSING_DH_KEY				 163
-#define SSL_R_MISSING_DH_RSA_CERT			 164
-#define SSL_R_MISSING_DSA_SIGNING_CERT			 165
-#define SSL_R_MISSING_EXPORT_TMP_DH_KEY			 166
-#define SSL_R_MISSING_EXPORT_TMP_RSA_KEY		 167
-#define SSL_R_MISSING_RSA_CERTIFICATE			 168
-#define SSL_R_MISSING_RSA_ENCRYPTING_CERT		 169
-#define SSL_R_MISSING_RSA_SIGNING_CERT			 170
-#define SSL_R_MISSING_TMP_DH_KEY			 171
-#define SSL_R_MISSING_TMP_ECDH_KEY			 311
-#define SSL_R_MISSING_TMP_RSA_KEY			 172
-#define SSL_R_MISSING_TMP_RSA_PKEY			 173
-#define SSL_R_MISSING_VERIFY_MESSAGE			 174
-#define SSL_R_NON_SSLV2_INITIAL_PACKET			 175
-#define SSL_R_NO_CERTIFICATES_RETURNED			 176
-#define SSL_R_NO_CERTIFICATE_ASSIGNED			 177
-#define SSL_R_NO_CERTIFICATE_RETURNED			 178
-#define SSL_R_NO_CERTIFICATE_SET			 179
-#define SSL_R_NO_CERTIFICATE_SPECIFIED			 180
-#define SSL_R_NO_CIPHERS_AVAILABLE			 181
-#define SSL_R_NO_CIPHERS_PASSED				 182
-#define SSL_R_NO_CIPHERS_SPECIFIED			 183
-#define SSL_R_NO_CIPHER_LIST				 184
-#define SSL_R_NO_CIPHER_MATCH				 185
-#define SSL_R_NO_CLIENT_CERT_RECEIVED			 186
-#define SSL_R_NO_COMPRESSION_SPECIFIED			 187
-#define SSL_R_NO_METHOD_SPECIFIED			 188
-#define SSL_R_NO_PRIVATEKEY				 189
-#define SSL_R_NO_PRIVATE_KEY_ASSIGNED			 190
-#define SSL_R_NO_PROTOCOLS_AVAILABLE			 191
-#define SSL_R_NO_PUBLICKEY				 192
-#define SSL_R_NO_SHARED_CIPHER				 193
-#define SSL_R_NO_VERIFY_CALLBACK			 194
-#define SSL_R_NULL_SSL_CTX				 195
-#define SSL_R_NULL_SSL_METHOD_PASSED			 196
-#define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED		 197
-#define SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE		 297
-#define SSL_R_PACKET_LENGTH_TOO_LONG			 198
-#define SSL_R_PATH_TOO_LONG				 270
-#define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE		 199
-#define SSL_R_PEER_ERROR				 200
-#define SSL_R_PEER_ERROR_CERTIFICATE			 201
-#define SSL_R_PEER_ERROR_NO_CERTIFICATE			 202
-#define SSL_R_PEER_ERROR_NO_CIPHER			 203
-#define SSL_R_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE	 204
-#define SSL_R_PRE_MAC_LENGTH_TOO_LONG			 205
-#define SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIONS		 206
-#define SSL_R_PROTOCOL_IS_SHUTDOWN			 207
-#define SSL_R_PUBLIC_KEY_ENCRYPT_ERROR			 208
-#define SSL_R_PUBLIC_KEY_IS_NOT_RSA			 209
-#define SSL_R_PUBLIC_KEY_NOT_RSA			 210
-#define SSL_R_READ_BIO_NOT_SET				 211
-#define SSL_R_READ_TIMEOUT_EXPIRED			 312
-#define SSL_R_READ_WRONG_PACKET_TYPE			 212
-#define SSL_R_RECORD_LENGTH_MISMATCH			 213
-#define SSL_R_RECORD_TOO_LARGE				 214
-#define SSL_R_RECORD_TOO_SMALL				 298
-#define SSL_R_REQUIRED_CIPHER_MISSING			 215
-#define SSL_R_REUSE_CERT_LENGTH_NOT_ZERO		 216
-#define SSL_R_REUSE_CERT_TYPE_NOT_ZERO			 217
-#define SSL_R_REUSE_CIPHER_LIST_NOT_ZERO		 218
-#define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED		 277
-#define SSL_R_SHORT_READ				 219
-#define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE	 220
-#define SSL_R_SSL23_DOING_SESSION_ID_REUSE		 221
-#define SSL_R_SSL2_CONNECTION_ID_TOO_LONG		 299
-#define SSL_R_SSL3_SESSION_ID_TOO_LONG			 300
-#define SSL_R_SSL3_SESSION_ID_TOO_SHORT			 222
-#define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE		 1042
-#define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC		 1020
-#define SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED		 1045
-#define SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED		 1044
-#define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN		 1046
-#define SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE		 1030
-#define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE		 1040
-#define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER		 1047
-#define SSL_R_SSLV3_ALERT_NO_CERTIFICATE		 1041
-#define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE		 1010
-#define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE	 1043
-#define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION	 228
-#define SSL_R_SSL_HANDSHAKE_FAILURE			 229
-#define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS		 230
-#define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED		 301
-#define SSL_R_SSL_SESSION_ID_CONFLICT			 302
-#define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG		 273
-#define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH		 303
-#define SSL_R_SSL_SESSION_ID_IS_DIFFERENT		 231
-#define SSL_R_TLSV1_ALERT_ACCESS_DENIED			 1049
-#define SSL_R_TLSV1_ALERT_DECODE_ERROR			 1050
-#define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED		 1021
-#define SSL_R_TLSV1_ALERT_DECRYPT_ERROR			 1051
-#define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION		 1060
-#define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY		 1071
-#define SSL_R_TLSV1_ALERT_INTERNAL_ERROR		 1080
-#define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION		 1100
-#define SSL_R_TLSV1_ALERT_PROTOCOL_VERSION		 1070
-#define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW		 1022
-#define SSL_R_TLSV1_ALERT_UNKNOWN_CA			 1048
-#define SSL_R_TLSV1_ALERT_USER_CANCELLED		 1090
-#define SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER	 232
+#define SSL_R_BAD_ALERT_RECORD               101
+#define SSL_R_BAD_AUTHENTICATION_TYPE            102
+#define SSL_R_BAD_CHANGE_CIPHER_SPEC             103
+#define SSL_R_BAD_CHECKSUM               104
+#define SSL_R_BAD_DATA_RETURNED_BY_CALLBACK      106
+#define SSL_R_BAD_DECOMPRESSION              107
+#define SSL_R_BAD_DH_G_LENGTH                108
+#define SSL_R_BAD_DH_PUB_KEY_LENGTH          109
+#define SSL_R_BAD_DH_P_LENGTH                110
+#define SSL_R_BAD_DIGEST_LENGTH              111
+#define SSL_R_BAD_DSA_SIGNATURE              112
+#define SSL_R_BAD_ECC_CERT               304
+#define SSL_R_BAD_ECDSA_SIGNATURE            305
+#define SSL_R_BAD_ECPOINT                306
+#define SSL_R_BAD_HELLO_REQUEST              105
+#define SSL_R_BAD_LENGTH                 271
+#define SSL_R_BAD_MAC_DECODE                 113
+#define SSL_R_BAD_MESSAGE_TYPE               114
+#define SSL_R_BAD_PACKET_LENGTH              115
+#define SSL_R_BAD_PROTOCOL_VERSION_NUMBER        116
+#define SSL_R_BAD_RESPONSE_ARGUMENT          117
+#define SSL_R_BAD_RSA_DECRYPT                118
+#define SSL_R_BAD_RSA_ENCRYPT                119
+#define SSL_R_BAD_RSA_E_LENGTH               120
+#define SSL_R_BAD_RSA_MODULUS_LENGTH             121
+#define SSL_R_BAD_RSA_SIGNATURE              122
+#define SSL_R_BAD_SIGNATURE              123
+#define SSL_R_BAD_SSL_FILETYPE               124
+#define SSL_R_BAD_SSL_SESSION_ID_LENGTH          125
+#define SSL_R_BAD_STATE                  126
+#define SSL_R_BAD_WRITE_RETRY                127
+#define SSL_R_BIO_NOT_SET                128
+#define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG          129
+#define SSL_R_BN_LIB                     130
+#define SSL_R_CA_DN_LENGTH_MISMATCH          131
+#define SSL_R_CA_DN_TOO_LONG                 132
+#define SSL_R_CCS_RECEIVED_EARLY             133
+#define SSL_R_CERTIFICATE_VERIFY_FAILED          134
+#define SSL_R_CERT_LENGTH_MISMATCH           135
+#define SSL_R_CHALLENGE_IS_DIFFERENT             136
+#define SSL_R_CIPHER_CODE_WRONG_LENGTH           137
+#define SSL_R_CIPHER_OR_HASH_UNAVAILABLE         138
+#define SSL_R_CIPHER_TABLE_SRC_ERROR             139
+#define SSL_R_COMPRESSED_LENGTH_TOO_LONG         140
+#define SSL_R_COMPRESSION_FAILURE            141
+#define SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE    307
+#define SSL_R_COMPRESSION_LIBRARY_ERROR          142
+#define SSL_R_CONNECTION_ID_IS_DIFFERENT         143
+#define SSL_R_CONNECTION_TYPE_NOT_SET            144
+#define SSL_R_COOKIE_MISMATCH                308
+#define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED      145
+#define SSL_R_DATA_LENGTH_TOO_LONG           146
+#define SSL_R_DECRYPTION_FAILED              147
+#define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC    281
+#define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG        148
+#define SSL_R_DIGEST_CHECK_FAILED            149
+#define SSL_R_DUPLICATE_COMPRESSION_ID           309
+#define SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER       310
+#define SSL_R_ENCRYPTED_LENGTH_TOO_LONG          150
+#define SSL_R_ERROR_GENERATING_TMP_RSA_KEY       282
+#define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST      151
+#define SSL_R_EXCESSIVE_MESSAGE_SIZE             152
+#define SSL_R_EXTRA_DATA_IN_MESSAGE          153
+#define SSL_R_GOT_A_FIN_BEFORE_A_CCS             154
+#define SSL_R_HTTPS_PROXY_REQUEST            155
+#define SSL_R_HTTP_REQUEST               156
+#define SSL_R_ILLEGAL_PADDING                283
+#define SSL_R_INVALID_CHALLENGE_LENGTH           158
+#define SSL_R_INVALID_COMMAND                280
+#define SSL_R_INVALID_PURPOSE                278
+#define SSL_R_INVALID_TRUST              279
+#define SSL_R_KEY_ARG_TOO_LONG               284
+#define SSL_R_KRB5                   285
+#define SSL_R_KRB5_C_CC_PRINC                286
+#define SSL_R_KRB5_C_GET_CRED                287
+#define SSL_R_KRB5_C_INIT                288
+#define SSL_R_KRB5_C_MK_REQ              289
+#define SSL_R_KRB5_S_BAD_TICKET              290
+#define SSL_R_KRB5_S_INIT                291
+#define SSL_R_KRB5_S_RD_REQ              292
+#define SSL_R_KRB5_S_TKT_EXPIRED             293
+#define SSL_R_KRB5_S_TKT_NYV                 294
+#define SSL_R_KRB5_S_TKT_SKEW                295
+#define SSL_R_LENGTH_MISMATCH                159
+#define SSL_R_LENGTH_TOO_SHORT               160
+#define SSL_R_LIBRARY_BUG                274
+#define SSL_R_LIBRARY_HAS_NO_CIPHERS             161
+#define SSL_R_MESSAGE_TOO_LONG               296
+#define SSL_R_MISSING_DH_DSA_CERT            162
+#define SSL_R_MISSING_DH_KEY                 163
+#define SSL_R_MISSING_DH_RSA_CERT            164
+#define SSL_R_MISSING_DSA_SIGNING_CERT           165
+#define SSL_R_MISSING_EXPORT_TMP_DH_KEY          166
+#define SSL_R_MISSING_EXPORT_TMP_RSA_KEY         167
+#define SSL_R_MISSING_RSA_CERTIFICATE            168
+#define SSL_R_MISSING_RSA_ENCRYPTING_CERT        169
+#define SSL_R_MISSING_RSA_SIGNING_CERT           170
+#define SSL_R_MISSING_TMP_DH_KEY             171
+#define SSL_R_MISSING_TMP_ECDH_KEY           311
+#define SSL_R_MISSING_TMP_RSA_KEY            172
+#define SSL_R_MISSING_TMP_RSA_PKEY           173
+#define SSL_R_MISSING_VERIFY_MESSAGE             174
+#define SSL_R_NON_SSLV2_INITIAL_PACKET           175
+#define SSL_R_NO_CERTIFICATES_RETURNED           176
+#define SSL_R_NO_CERTIFICATE_ASSIGNED            177
+#define SSL_R_NO_CERTIFICATE_RETURNED            178
+#define SSL_R_NO_CERTIFICATE_SET             179
+#define SSL_R_NO_CERTIFICATE_SPECIFIED           180
+#define SSL_R_NO_CIPHERS_AVAILABLE           181
+#define SSL_R_NO_CIPHERS_PASSED              182
+#define SSL_R_NO_CIPHERS_SPECIFIED           183
+#define SSL_R_NO_CIPHER_LIST                 184
+#define SSL_R_NO_CIPHER_MATCH                185
+#define SSL_R_NO_CLIENT_CERT_RECEIVED            186
+#define SSL_R_NO_COMPRESSION_SPECIFIED           187
+#define SSL_R_NO_METHOD_SPECIFIED            188
+#define SSL_R_NO_PRIVATEKEY              189
+#define SSL_R_NO_PRIVATE_KEY_ASSIGNED            190
+#define SSL_R_NO_PROTOCOLS_AVAILABLE             191
+#define SSL_R_NO_PUBLICKEY               192
+#define SSL_R_NO_SHARED_CIPHER               193
+#define SSL_R_NO_VERIFY_CALLBACK             194
+#define SSL_R_NULL_SSL_CTX               195
+#define SSL_R_NULL_SSL_METHOD_PASSED             196
+#define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED        197
+#define SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE      297
+#define SSL_R_PACKET_LENGTH_TOO_LONG             198
+#define SSL_R_PATH_TOO_LONG              270
+#define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE      199
+#define SSL_R_PEER_ERROR                 200
+#define SSL_R_PEER_ERROR_CERTIFICATE             201
+#define SSL_R_PEER_ERROR_NO_CERTIFICATE          202
+#define SSL_R_PEER_ERROR_NO_CIPHER           203
+#define SSL_R_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE    204
+#define SSL_R_PRE_MAC_LENGTH_TOO_LONG            205
+#define SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIONS      206
+#define SSL_R_PROTOCOL_IS_SHUTDOWN           207
+#define SSL_R_PUBLIC_KEY_ENCRYPT_ERROR           208
+#define SSL_R_PUBLIC_KEY_IS_NOT_RSA          209
+#define SSL_R_PUBLIC_KEY_NOT_RSA             210
+#define SSL_R_READ_BIO_NOT_SET               211
+#define SSL_R_READ_TIMEOUT_EXPIRED           312
+#define SSL_R_READ_WRONG_PACKET_TYPE             212
+#define SSL_R_RECORD_LENGTH_MISMATCH             213
+#define SSL_R_RECORD_TOO_LARGE               214
+#define SSL_R_RECORD_TOO_SMALL               298
+#define SSL_R_REQUIRED_CIPHER_MISSING            215
+#define SSL_R_REUSE_CERT_LENGTH_NOT_ZERO         216
+#define SSL_R_REUSE_CERT_TYPE_NOT_ZERO           217
+#define SSL_R_REUSE_CIPHER_LIST_NOT_ZERO         218
+#define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED       277
+#define SSL_R_SHORT_READ                 219
+#define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE  220
+#define SSL_R_SSL23_DOING_SESSION_ID_REUSE       221
+#define SSL_R_SSL2_CONNECTION_ID_TOO_LONG        299
+#define SSL_R_SSL3_SESSION_ID_TOO_LONG           300
+#define SSL_R_SSL3_SESSION_ID_TOO_SHORT          222
+#define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE        1042
+#define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC         1020
+#define SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED        1045
+#define SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED        1044
+#define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN        1046
+#define SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE      1030
+#define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE      1040
+#define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER      1047
+#define SSL_R_SSLV3_ALERT_NO_CERTIFICATE         1041
+#define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE         1010
+#define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE    1043
+#define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION     228
+#define SSL_R_SSL_HANDSHAKE_FAILURE          229
+#define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS         230
+#define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED         301
+#define SSL_R_SSL_SESSION_ID_CONFLICT            302
+#define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG        273
+#define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH      303
+#define SSL_R_SSL_SESSION_ID_IS_DIFFERENT        231
+#define SSL_R_TLSV1_ALERT_ACCESS_DENIED          1049
+#define SSL_R_TLSV1_ALERT_DECODE_ERROR           1050
+#define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED      1021
+#define SSL_R_TLSV1_ALERT_DECRYPT_ERROR          1051
+#define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION         1060
+#define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY      1071
+#define SSL_R_TLSV1_ALERT_INTERNAL_ERROR         1080
+#define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION       1100
+#define SSL_R_TLSV1_ALERT_PROTOCOL_VERSION       1070
+#define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW        1022
+#define SSL_R_TLSV1_ALERT_UNKNOWN_CA             1048
+#define SSL_R_TLSV1_ALERT_USER_CANCELLED         1090
+#define SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER   232
 #define SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST 233
-#define SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG	 234
-#define SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER		 235
-#define SSL_R_UNABLE_TO_DECODE_DH_CERTS			 236
-#define SSL_R_UNABLE_TO_DECODE_ECDH_CERTS		 313
-#define SSL_R_UNABLE_TO_EXTRACT_PUBLIC_KEY		 237
-#define SSL_R_UNABLE_TO_FIND_DH_PARAMETERS		 238
-#define SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS		 314
-#define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS	 239
-#define SSL_R_UNABLE_TO_FIND_SSL_METHOD			 240
-#define SSL_R_UNABLE_TO_LOAD_SSL2_MD5_ROUTINES		 241
-#define SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES		 242
-#define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES		 243
-#define SSL_R_UNEXPECTED_MESSAGE			 244
-#define SSL_R_UNEXPECTED_RECORD				 245
-#define SSL_R_UNINITIALIZED				 276
-#define SSL_R_UNKNOWN_ALERT_TYPE			 246
-#define SSL_R_UNKNOWN_CERTIFICATE_TYPE			 247
-#define SSL_R_UNKNOWN_CIPHER_RETURNED			 248
-#define SSL_R_UNKNOWN_CIPHER_TYPE			 249
-#define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE			 250
-#define SSL_R_UNKNOWN_PKEY_TYPE				 251
-#define SSL_R_UNKNOWN_PROTOCOL				 252
-#define SSL_R_UNKNOWN_REMOTE_ERROR_TYPE			 253
-#define SSL_R_UNKNOWN_SSL_VERSION			 254
-#define SSL_R_UNKNOWN_STATE				 255
-#define SSL_R_UNSUPPORTED_CIPHER			 256
-#define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM		 257
-#define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE		 315
-#define SSL_R_UNSUPPORTED_PROTOCOL			 258
-#define SSL_R_UNSUPPORTED_SSL_VERSION			 259
-#define SSL_R_WRITE_BIO_NOT_SET				 260
-#define SSL_R_WRONG_CIPHER_RETURNED			 261
-#define SSL_R_WRONG_MESSAGE_TYPE			 262
-#define SSL_R_WRONG_NUMBER_OF_KEY_BITS			 263
-#define SSL_R_WRONG_SIGNATURE_LENGTH			 264
-#define SSL_R_WRONG_SIGNATURE_SIZE			 265
-#define SSL_R_WRONG_SSL_VERSION				 266
-#define SSL_R_WRONG_VERSION_NUMBER			 267
-#define SSL_R_X509_LIB					 268
-#define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS		 269
+#define SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG    234
+#define SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER        235
+#define SSL_R_UNABLE_TO_DECODE_DH_CERTS          236
+#define SSL_R_UNABLE_TO_DECODE_ECDH_CERTS        313
+#define SSL_R_UNABLE_TO_EXTRACT_PUBLIC_KEY       237
+#define SSL_R_UNABLE_TO_FIND_DH_PARAMETERS       238
+#define SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS         314
+#define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS   239
+#define SSL_R_UNABLE_TO_FIND_SSL_METHOD          240
+#define SSL_R_UNABLE_TO_LOAD_SSL2_MD5_ROUTINES       241
+#define SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES       242
+#define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES      243
+#define SSL_R_UNEXPECTED_MESSAGE             244
+#define SSL_R_UNEXPECTED_RECORD              245
+#define SSL_R_UNINITIALIZED              276
+#define SSL_R_UNKNOWN_ALERT_TYPE             246
+#define SSL_R_UNKNOWN_CERTIFICATE_TYPE           247
+#define SSL_R_UNKNOWN_CIPHER_RETURNED            248
+#define SSL_R_UNKNOWN_CIPHER_TYPE            249
+#define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE          250
+#define SSL_R_UNKNOWN_PKEY_TYPE              251
+#define SSL_R_UNKNOWN_PROTOCOL               252
+#define SSL_R_UNKNOWN_REMOTE_ERROR_TYPE          253
+#define SSL_R_UNKNOWN_SSL_VERSION            254
+#define SSL_R_UNKNOWN_STATE              255
+#define SSL_R_UNSUPPORTED_CIPHER             256
+#define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM      257
+#define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE         315
+#define SSL_R_UNSUPPORTED_PROTOCOL           258
+#define SSL_R_UNSUPPORTED_SSL_VERSION            259
+#define SSL_R_WRITE_BIO_NOT_SET              260
+#define SSL_R_WRONG_CIPHER_RETURNED          261
+#define SSL_R_WRONG_MESSAGE_TYPE             262
+#define SSL_R_WRONG_NUMBER_OF_KEY_BITS           263
+#define SSL_R_WRONG_SIGNATURE_LENGTH             264
+#define SSL_R_WRONG_SIGNATURE_SIZE           265
+#define SSL_R_WRONG_SSL_VERSION              266
+#define SSL_R_WRONG_VERSION_NUMBER           267
+#define SSL_R_X509_LIB                   268
+#define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS       269
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/ssl2.h b/dep/include/openssl/ssl2.h
index 99a52ea0dd9..347a2d44b7e 100644
--- a/dep/include/openssl/ssl2.h
+++ b/dep/include/openssl/ssl2.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,217 +49,217 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
  * [including the GNU Public Licence.]
  */
 
-#ifndef HEADER_SSL2_H 
-#define HEADER_SSL2_H 
+#ifndef HEADER_SSL2_H
+#define HEADER_SSL2_H
 
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
 /* Protocol Version Codes */
-#define SSL2_VERSION		0x0002
-#define SSL2_VERSION_MAJOR	0x00
-#define SSL2_VERSION_MINOR	0x02
-/* #define SSL2_CLIENT_VERSION	0x0002 */
-/* #define SSL2_SERVER_VERSION	0x0002 */
+#define SSL2_VERSION        0x0002
+#define SSL2_VERSION_MAJOR  0x00
+#define SSL2_VERSION_MINOR  0x02
+/* #define SSL2_CLIENT_VERSION  0x0002 */
+/* #define SSL2_SERVER_VERSION  0x0002 */
 
 /* Protocol Message Codes */
-#define SSL2_MT_ERROR			0
-#define SSL2_MT_CLIENT_HELLO		1
-#define SSL2_MT_CLIENT_MASTER_KEY	2
-#define SSL2_MT_CLIENT_FINISHED		3
-#define SSL2_MT_SERVER_HELLO		4
-#define SSL2_MT_SERVER_VERIFY		5
-#define SSL2_MT_SERVER_FINISHED		6
-#define SSL2_MT_REQUEST_CERTIFICATE	7
-#define SSL2_MT_CLIENT_CERTIFICATE	8
+#define SSL2_MT_ERROR           0
+#define SSL2_MT_CLIENT_HELLO        1
+#define SSL2_MT_CLIENT_MASTER_KEY   2
+#define SSL2_MT_CLIENT_FINISHED     3
+#define SSL2_MT_SERVER_HELLO        4
+#define SSL2_MT_SERVER_VERIFY       5
+#define SSL2_MT_SERVER_FINISHED     6
+#define SSL2_MT_REQUEST_CERTIFICATE 7
+#define SSL2_MT_CLIENT_CERTIFICATE  8
 
 /* Error Message Codes */
-#define SSL2_PE_UNDEFINED_ERROR		0x0000
-#define SSL2_PE_NO_CIPHER		0x0001
-#define SSL2_PE_NO_CERTIFICATE		0x0002
-#define SSL2_PE_BAD_CERTIFICATE		0x0004
+#define SSL2_PE_UNDEFINED_ERROR     0x0000
+#define SSL2_PE_NO_CIPHER       0x0001
+#define SSL2_PE_NO_CERTIFICATE      0x0002
+#define SSL2_PE_BAD_CERTIFICATE     0x0004
 #define SSL2_PE_UNSUPPORTED_CERTIFICATE_TYPE 0x0006
 
 /* Cipher Kind Values */
-#define SSL2_CK_NULL_WITH_MD5			0x02000000 /* v3 */
-#define SSL2_CK_RC4_128_WITH_MD5		0x02010080
-#define SSL2_CK_RC4_128_EXPORT40_WITH_MD5	0x02020080
-#define SSL2_CK_RC2_128_CBC_WITH_MD5		0x02030080
-#define SSL2_CK_RC2_128_CBC_EXPORT40_WITH_MD5	0x02040080
-#define SSL2_CK_IDEA_128_CBC_WITH_MD5		0x02050080
-#define SSL2_CK_DES_64_CBC_WITH_MD5		0x02060040
-#define SSL2_CK_DES_64_CBC_WITH_SHA		0x02060140 /* v3 */
-#define SSL2_CK_DES_192_EDE3_CBC_WITH_MD5	0x020700c0
-#define SSL2_CK_DES_192_EDE3_CBC_WITH_SHA	0x020701c0 /* v3 */
-#define SSL2_CK_RC4_64_WITH_MD5			0x02080080 /* MS hack */
- 
-#define SSL2_CK_DES_64_CFB64_WITH_MD5_1		0x02ff0800 /* SSLeay */
-#define SSL2_CK_NULL				0x02ff0810 /* SSLeay */
+#define SSL2_CK_NULL_WITH_MD5           0x02000000 /* v3 */
+#define SSL2_CK_RC4_128_WITH_MD5        0x02010080
+#define SSL2_CK_RC4_128_EXPORT40_WITH_MD5   0x02020080
+#define SSL2_CK_RC2_128_CBC_WITH_MD5        0x02030080
+#define SSL2_CK_RC2_128_CBC_EXPORT40_WITH_MD5   0x02040080
+#define SSL2_CK_IDEA_128_CBC_WITH_MD5       0x02050080
+#define SSL2_CK_DES_64_CBC_WITH_MD5     0x02060040
+#define SSL2_CK_DES_64_CBC_WITH_SHA     0x02060140 /* v3 */
+#define SSL2_CK_DES_192_EDE3_CBC_WITH_MD5   0x020700c0
+#define SSL2_CK_DES_192_EDE3_CBC_WITH_SHA   0x020701c0 /* v3 */
+#define SSL2_CK_RC4_64_WITH_MD5         0x02080080 /* MS hack */
 
-#define SSL2_TXT_DES_64_CFB64_WITH_MD5_1	"DES-CFB-M1"
-#define SSL2_TXT_NULL_WITH_MD5			"NULL-MD5"
-#define SSL2_TXT_RC4_128_WITH_MD5		"RC4-MD5"
-#define SSL2_TXT_RC4_128_EXPORT40_WITH_MD5	"EXP-RC4-MD5"
-#define SSL2_TXT_RC2_128_CBC_WITH_MD5		"RC2-CBC-MD5"
-#define SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5	"EXP-RC2-CBC-MD5"
-#define SSL2_TXT_IDEA_128_CBC_WITH_MD5		"IDEA-CBC-MD5"
-#define SSL2_TXT_DES_64_CBC_WITH_MD5		"DES-CBC-MD5"
-#define SSL2_TXT_DES_64_CBC_WITH_SHA		"DES-CBC-SHA"
-#define SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5	"DES-CBC3-MD5"
-#define SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA	"DES-CBC3-SHA"
-#define SSL2_TXT_RC4_64_WITH_MD5		"RC4-64-MD5"
+#define SSL2_CK_DES_64_CFB64_WITH_MD5_1     0x02ff0800 /* SSLeay */
+#define SSL2_CK_NULL                0x02ff0810 /* SSLeay */
 
-#define SSL2_TXT_NULL				"NULL"
+#define SSL2_TXT_DES_64_CFB64_WITH_MD5_1    "DES-CFB-M1"
+#define SSL2_TXT_NULL_WITH_MD5          "NULL-MD5"
+#define SSL2_TXT_RC4_128_WITH_MD5       "RC4-MD5"
+#define SSL2_TXT_RC4_128_EXPORT40_WITH_MD5  "EXP-RC4-MD5"
+#define SSL2_TXT_RC2_128_CBC_WITH_MD5       "RC2-CBC-MD5"
+#define SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5  "EXP-RC2-CBC-MD5"
+#define SSL2_TXT_IDEA_128_CBC_WITH_MD5      "IDEA-CBC-MD5"
+#define SSL2_TXT_DES_64_CBC_WITH_MD5        "DES-CBC-MD5"
+#define SSL2_TXT_DES_64_CBC_WITH_SHA        "DES-CBC-SHA"
+#define SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5  "DES-CBC3-MD5"
+#define SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA  "DES-CBC3-SHA"
+#define SSL2_TXT_RC4_64_WITH_MD5        "RC4-64-MD5"
+
+#define SSL2_TXT_NULL               "NULL"
 
 /* Flags for the SSL_CIPHER.algorithm2 field */
-#define SSL2_CF_5_BYTE_ENC			0x01
-#define SSL2_CF_8_BYTE_ENC			0x02
+#define SSL2_CF_5_BYTE_ENC          0x01
+#define SSL2_CF_8_BYTE_ENC          0x02
 
 /* Certificate Type Codes */
-#define SSL2_CT_X509_CERTIFICATE		0x01
+#define SSL2_CT_X509_CERTIFICATE        0x01
 
 /* Authentication Type Code */
-#define SSL2_AT_MD5_WITH_RSA_ENCRYPTION		0x01
+#define SSL2_AT_MD5_WITH_RSA_ENCRYPTION     0x01
 
-#define SSL2_MAX_SSL_SESSION_ID_LENGTH		32
+#define SSL2_MAX_SSL_SESSION_ID_LENGTH      32
 
 /* Upper/Lower Bounds */
-#define SSL2_MAX_MASTER_KEY_LENGTH_IN_BITS	256
+#define SSL2_MAX_MASTER_KEY_LENGTH_IN_BITS  256
 #ifdef OPENSSL_SYS_MPE
-#define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER	29998u
+#define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER    29998u
 #else
-#define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER	32767u  /* 2^15-1 */
+#define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER    32767u  /* 2^15-1 */
 #endif
-#define SSL2_MAX_RECORD_LENGTH_3_BYTE_HEADER	16383 /* 2^14-1 */
+#define SSL2_MAX_RECORD_LENGTH_3_BYTE_HEADER    16383 /* 2^14-1 */
 
-#define SSL2_CHALLENGE_LENGTH	16
-/*#define SSL2_CHALLENGE_LENGTH	32 */
-#define SSL2_MIN_CHALLENGE_LENGTH	16
-#define SSL2_MAX_CHALLENGE_LENGTH	32
-#define SSL2_CONNECTION_ID_LENGTH	16
-#define SSL2_MAX_CONNECTION_ID_LENGTH	16
-#define SSL2_SSL_SESSION_ID_LENGTH	16
-#define SSL2_MAX_CERT_CHALLENGE_LENGTH	32
-#define SSL2_MIN_CERT_CHALLENGE_LENGTH	16
-#define SSL2_MAX_KEY_MATERIAL_LENGTH	24
+#define SSL2_CHALLENGE_LENGTH   16
+/*#define SSL2_CHALLENGE_LENGTH 32 */
+#define SSL2_MIN_CHALLENGE_LENGTH   16
+#define SSL2_MAX_CHALLENGE_LENGTH   32
+#define SSL2_CONNECTION_ID_LENGTH   16
+#define SSL2_MAX_CONNECTION_ID_LENGTH   16
+#define SSL2_SSL_SESSION_ID_LENGTH  16
+#define SSL2_MAX_CERT_CHALLENGE_LENGTH  32
+#define SSL2_MIN_CERT_CHALLENGE_LENGTH  16
+#define SSL2_MAX_KEY_MATERIAL_LENGTH    24
 
 #ifndef HEADER_SSL_LOCL_H
-#define  CERT		char
+#define  CERT       char
 #endif
 
 typedef struct ssl2_state_st
-	{
-	int three_byte_header;
-	int clear_text;		/* clear text */
-	int escape;		/* not used in SSLv2 */
-	int ssl2_rollback;	/* used if SSLv23 rolled back to SSLv2 */
+    {
+    int three_byte_header;
+    int clear_text;     /* clear text */
+    int escape;     /* not used in SSLv2 */
+    int ssl2_rollback;  /* used if SSLv23 rolled back to SSLv2 */
 
-	/* non-blocking io info, used to make sure the same
-	 * args were passwd */
-	unsigned int wnum;	/* number of bytes sent so far */
-	int wpend_tot;
-	const unsigned char *wpend_buf;
+    /* non-blocking io info, used to make sure the same
+     * args were passwd */
+    unsigned int wnum;  /* number of bytes sent so far */
+    int wpend_tot;
+    const unsigned char *wpend_buf;
 
-	int wpend_off;	/* offset to data to write */
-	int wpend_len; 	/* number of bytes passwd to write */
-	int wpend_ret; 	/* number of bytes to return to caller */
+    int wpend_off;  /* offset to data to write */
+    int wpend_len;  /* number of bytes passwd to write */
+    int wpend_ret;  /* number of bytes to return to caller */
 
-	/* buffer raw data */
-	int rbuf_left;
-	int rbuf_offs;
-	unsigned char *rbuf;
-	unsigned char *wbuf;
+    /* buffer raw data */
+    int rbuf_left;
+    int rbuf_offs;
+    unsigned char *rbuf;
+    unsigned char *wbuf;
 
-	unsigned char *write_ptr;/* used to point to the start due to
-				  * 2/3 byte header. */
+    unsigned char *write_ptr;/* used to point to the start due to
+                  * 2/3 byte header. */
 
-	unsigned int padding;
-	unsigned int rlength; /* passed to ssl2_enc */
-	int ract_data_length; /* Set when things are encrypted. */
-	unsigned int wlength; /* passed to ssl2_enc */
-	int wact_data_length; /* Set when things are decrypted. */
-	unsigned char *ract_data;
-	unsigned char *wact_data;
-	unsigned char *mac_data;
+    unsigned int padding;
+    unsigned int rlength; /* passed to ssl2_enc */
+    int ract_data_length; /* Set when things are encrypted. */
+    unsigned int wlength; /* passed to ssl2_enc */
+    int wact_data_length; /* Set when things are decrypted. */
+    unsigned char *ract_data;
+    unsigned char *wact_data;
+    unsigned char *mac_data;
 
-	unsigned char *read_key;
-	unsigned char *write_key;
+    unsigned char *read_key;
+    unsigned char *write_key;
 
-		/* Stuff specifically to do with this SSL session */
-	unsigned int challenge_length;
-	unsigned char challenge[SSL2_MAX_CHALLENGE_LENGTH];
-	unsigned int conn_id_length;
-	unsigned char conn_id[SSL2_MAX_CONNECTION_ID_LENGTH];
-	unsigned int key_material_length;
-	unsigned char key_material[SSL2_MAX_KEY_MATERIAL_LENGTH*2];
+        /* Stuff specifically to do with this SSL session */
+    unsigned int challenge_length;
+    unsigned char challenge[SSL2_MAX_CHALLENGE_LENGTH];
+    unsigned int conn_id_length;
+    unsigned char conn_id[SSL2_MAX_CONNECTION_ID_LENGTH];
+    unsigned int key_material_length;
+    unsigned char key_material[SSL2_MAX_KEY_MATERIAL_LENGTH*2];
 
-	unsigned long read_sequence;
-	unsigned long write_sequence;
+    unsigned long read_sequence;
+    unsigned long write_sequence;
 
-	struct	{
-		unsigned int conn_id_length;
-		unsigned int cert_type;	
-		unsigned int cert_length;
-		unsigned int csl; 
-		unsigned int clear;
-		unsigned int enc; 
-		unsigned char ccl[SSL2_MAX_CERT_CHALLENGE_LENGTH];
-		unsigned int cipher_spec_length;
-		unsigned int session_id_length;
-		unsigned int clen;
-		unsigned int rlen;
-		} tmp;
-	} SSL2_STATE;
+    struct  {
+        unsigned int conn_id_length;
+        unsigned int cert_type;
+        unsigned int cert_length;
+        unsigned int csl;
+        unsigned int clear;
+        unsigned int enc;
+        unsigned char ccl[SSL2_MAX_CERT_CHALLENGE_LENGTH];
+        unsigned int cipher_spec_length;
+        unsigned int session_id_length;
+        unsigned int clen;
+        unsigned int rlen;
+        } tmp;
+    } SSL2_STATE;
 
 /* SSLv2 */
 /* client */
-#define SSL2_ST_SEND_CLIENT_HELLO_A		(0x10|SSL_ST_CONNECT)
-#define SSL2_ST_SEND_CLIENT_HELLO_B		(0x11|SSL_ST_CONNECT)
-#define SSL2_ST_GET_SERVER_HELLO_A		(0x20|SSL_ST_CONNECT)
-#define SSL2_ST_GET_SERVER_HELLO_B		(0x21|SSL_ST_CONNECT)
-#define SSL2_ST_SEND_CLIENT_MASTER_KEY_A	(0x30|SSL_ST_CONNECT)
-#define SSL2_ST_SEND_CLIENT_MASTER_KEY_B	(0x31|SSL_ST_CONNECT)
-#define SSL2_ST_SEND_CLIENT_FINISHED_A		(0x40|SSL_ST_CONNECT)
-#define SSL2_ST_SEND_CLIENT_FINISHED_B		(0x41|SSL_ST_CONNECT)
-#define SSL2_ST_SEND_CLIENT_CERTIFICATE_A	(0x50|SSL_ST_CONNECT)
-#define SSL2_ST_SEND_CLIENT_CERTIFICATE_B	(0x51|SSL_ST_CONNECT)
-#define SSL2_ST_SEND_CLIENT_CERTIFICATE_C	(0x52|SSL_ST_CONNECT)
-#define SSL2_ST_SEND_CLIENT_CERTIFICATE_D	(0x53|SSL_ST_CONNECT)
-#define SSL2_ST_GET_SERVER_VERIFY_A		(0x60|SSL_ST_CONNECT)
-#define SSL2_ST_GET_SERVER_VERIFY_B		(0x61|SSL_ST_CONNECT)
-#define SSL2_ST_GET_SERVER_FINISHED_A		(0x70|SSL_ST_CONNECT)
-#define SSL2_ST_GET_SERVER_FINISHED_B		(0x71|SSL_ST_CONNECT)
-#define SSL2_ST_CLIENT_START_ENCRYPTION		(0x80|SSL_ST_CONNECT)
-#define SSL2_ST_X509_GET_CLIENT_CERTIFICATE	(0x90|SSL_ST_CONNECT)
+#define SSL2_ST_SEND_CLIENT_HELLO_A     (0x10|SSL_ST_CONNECT)
+#define SSL2_ST_SEND_CLIENT_HELLO_B     (0x11|SSL_ST_CONNECT)
+#define SSL2_ST_GET_SERVER_HELLO_A      (0x20|SSL_ST_CONNECT)
+#define SSL2_ST_GET_SERVER_HELLO_B      (0x21|SSL_ST_CONNECT)
+#define SSL2_ST_SEND_CLIENT_MASTER_KEY_A    (0x30|SSL_ST_CONNECT)
+#define SSL2_ST_SEND_CLIENT_MASTER_KEY_B    (0x31|SSL_ST_CONNECT)
+#define SSL2_ST_SEND_CLIENT_FINISHED_A      (0x40|SSL_ST_CONNECT)
+#define SSL2_ST_SEND_CLIENT_FINISHED_B      (0x41|SSL_ST_CONNECT)
+#define SSL2_ST_SEND_CLIENT_CERTIFICATE_A   (0x50|SSL_ST_CONNECT)
+#define SSL2_ST_SEND_CLIENT_CERTIFICATE_B   (0x51|SSL_ST_CONNECT)
+#define SSL2_ST_SEND_CLIENT_CERTIFICATE_C   (0x52|SSL_ST_CONNECT)
+#define SSL2_ST_SEND_CLIENT_CERTIFICATE_D   (0x53|SSL_ST_CONNECT)
+#define SSL2_ST_GET_SERVER_VERIFY_A     (0x60|SSL_ST_CONNECT)
+#define SSL2_ST_GET_SERVER_VERIFY_B     (0x61|SSL_ST_CONNECT)
+#define SSL2_ST_GET_SERVER_FINISHED_A       (0x70|SSL_ST_CONNECT)
+#define SSL2_ST_GET_SERVER_FINISHED_B       (0x71|SSL_ST_CONNECT)
+#define SSL2_ST_CLIENT_START_ENCRYPTION     (0x80|SSL_ST_CONNECT)
+#define SSL2_ST_X509_GET_CLIENT_CERTIFICATE (0x90|SSL_ST_CONNECT)
 /* server */
-#define SSL2_ST_GET_CLIENT_HELLO_A		(0x10|SSL_ST_ACCEPT)
-#define SSL2_ST_GET_CLIENT_HELLO_B		(0x11|SSL_ST_ACCEPT)
-#define SSL2_ST_GET_CLIENT_HELLO_C		(0x12|SSL_ST_ACCEPT)
-#define SSL2_ST_SEND_SERVER_HELLO_A		(0x20|SSL_ST_ACCEPT)
-#define SSL2_ST_SEND_SERVER_HELLO_B		(0x21|SSL_ST_ACCEPT)
-#define SSL2_ST_GET_CLIENT_MASTER_KEY_A		(0x30|SSL_ST_ACCEPT)
-#define SSL2_ST_GET_CLIENT_MASTER_KEY_B		(0x31|SSL_ST_ACCEPT)
-#define SSL2_ST_SEND_SERVER_VERIFY_A		(0x40|SSL_ST_ACCEPT)
-#define SSL2_ST_SEND_SERVER_VERIFY_B		(0x41|SSL_ST_ACCEPT)
-#define SSL2_ST_SEND_SERVER_VERIFY_C		(0x42|SSL_ST_ACCEPT)
-#define SSL2_ST_GET_CLIENT_FINISHED_A		(0x50|SSL_ST_ACCEPT)
-#define SSL2_ST_GET_CLIENT_FINISHED_B		(0x51|SSL_ST_ACCEPT)
-#define SSL2_ST_SEND_SERVER_FINISHED_A		(0x60|SSL_ST_ACCEPT)
-#define SSL2_ST_SEND_SERVER_FINISHED_B		(0x61|SSL_ST_ACCEPT)
-#define SSL2_ST_SEND_REQUEST_CERTIFICATE_A	(0x70|SSL_ST_ACCEPT)
-#define SSL2_ST_SEND_REQUEST_CERTIFICATE_B	(0x71|SSL_ST_ACCEPT)
-#define SSL2_ST_SEND_REQUEST_CERTIFICATE_C	(0x72|SSL_ST_ACCEPT)
-#define SSL2_ST_SEND_REQUEST_CERTIFICATE_D	(0x73|SSL_ST_ACCEPT)
-#define SSL2_ST_SERVER_START_ENCRYPTION		(0x80|SSL_ST_ACCEPT)
-#define SSL2_ST_X509_GET_SERVER_CERTIFICATE	(0x90|SSL_ST_ACCEPT)
+#define SSL2_ST_GET_CLIENT_HELLO_A      (0x10|SSL_ST_ACCEPT)
+#define SSL2_ST_GET_CLIENT_HELLO_B      (0x11|SSL_ST_ACCEPT)
+#define SSL2_ST_GET_CLIENT_HELLO_C      (0x12|SSL_ST_ACCEPT)
+#define SSL2_ST_SEND_SERVER_HELLO_A     (0x20|SSL_ST_ACCEPT)
+#define SSL2_ST_SEND_SERVER_HELLO_B     (0x21|SSL_ST_ACCEPT)
+#define SSL2_ST_GET_CLIENT_MASTER_KEY_A     (0x30|SSL_ST_ACCEPT)
+#define SSL2_ST_GET_CLIENT_MASTER_KEY_B     (0x31|SSL_ST_ACCEPT)
+#define SSL2_ST_SEND_SERVER_VERIFY_A        (0x40|SSL_ST_ACCEPT)
+#define SSL2_ST_SEND_SERVER_VERIFY_B        (0x41|SSL_ST_ACCEPT)
+#define SSL2_ST_SEND_SERVER_VERIFY_C        (0x42|SSL_ST_ACCEPT)
+#define SSL2_ST_GET_CLIENT_FINISHED_A       (0x50|SSL_ST_ACCEPT)
+#define SSL2_ST_GET_CLIENT_FINISHED_B       (0x51|SSL_ST_ACCEPT)
+#define SSL2_ST_SEND_SERVER_FINISHED_A      (0x60|SSL_ST_ACCEPT)
+#define SSL2_ST_SEND_SERVER_FINISHED_B      (0x61|SSL_ST_ACCEPT)
+#define SSL2_ST_SEND_REQUEST_CERTIFICATE_A  (0x70|SSL_ST_ACCEPT)
+#define SSL2_ST_SEND_REQUEST_CERTIFICATE_B  (0x71|SSL_ST_ACCEPT)
+#define SSL2_ST_SEND_REQUEST_CERTIFICATE_C  (0x72|SSL_ST_ACCEPT)
+#define SSL2_ST_SEND_REQUEST_CERTIFICATE_D  (0x73|SSL_ST_ACCEPT)
+#define SSL2_ST_SERVER_START_ENCRYPTION     (0x80|SSL_ST_ACCEPT)
+#define SSL2_ST_X509_GET_SERVER_CERTIFICATE (0x90|SSL_ST_ACCEPT)
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/ssl23.h b/dep/include/openssl/ssl23.h
index d3228983c75..1374fe81b00 100644
--- a/dep/include/openssl/ssl23.h
+++ b/dep/include/openssl/ssl23.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,15 +49,15 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
  * [including the GNU Public Licence.]
  */
 
-#ifndef HEADER_SSL23_H 
-#define HEADER_SSL23_H 
+#ifndef HEADER_SSL23_H
+#define HEADER_SSL23_H
 
 #ifdef  __cplusplus
 extern "C" {
@@ -65,16 +65,16 @@ extern "C" {
 
 /*client */
 /* write to server */
-#define SSL23_ST_CW_CLNT_HELLO_A	(0x210|SSL_ST_CONNECT)
-#define SSL23_ST_CW_CLNT_HELLO_B	(0x211|SSL_ST_CONNECT)
+#define SSL23_ST_CW_CLNT_HELLO_A    (0x210|SSL_ST_CONNECT)
+#define SSL23_ST_CW_CLNT_HELLO_B    (0x211|SSL_ST_CONNECT)
 /* read from server */
-#define SSL23_ST_CR_SRVR_HELLO_A	(0x220|SSL_ST_CONNECT)
-#define SSL23_ST_CR_SRVR_HELLO_B	(0x221|SSL_ST_CONNECT)
+#define SSL23_ST_CR_SRVR_HELLO_A    (0x220|SSL_ST_CONNECT)
+#define SSL23_ST_CR_SRVR_HELLO_B    (0x221|SSL_ST_CONNECT)
 
 /* server */
 /* read from client */
-#define SSL23_ST_SR_CLNT_HELLO_A	(0x210|SSL_ST_ACCEPT)
-#define SSL23_ST_SR_CLNT_HELLO_B	(0x211|SSL_ST_ACCEPT)
+#define SSL23_ST_SR_CLNT_HELLO_A    (0x210|SSL_ST_ACCEPT)
+#define SSL23_ST_SR_CLNT_HELLO_B    (0x211|SSL_ST_ACCEPT)
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/ssl3.h b/dep/include/openssl/ssl3.h
index bacaff157e5..745db869e8f 100644
--- a/dep/include/openssl/ssl3.h
+++ b/dep/include/openssl/ssl3.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -63,7 +63,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -110,12 +110,12 @@
  */
 /* ====================================================================
  * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
- * ECC cipher suite support in OpenSSL originally developed by 
+ * ECC cipher suite support in OpenSSL originally developed by
  * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
  */
 
-#ifndef HEADER_SSL3_H 
-#define HEADER_SSL3_H 
+#ifndef HEADER_SSL3_H
+#define HEADER_SSL3_H
 
 #ifndef OPENSSL_NO_COMP
 #include 
@@ -129,424 +129,424 @@
 extern "C" {
 #endif
 
-#define SSL3_CK_RSA_NULL_MD5			0x03000001
-#define SSL3_CK_RSA_NULL_SHA			0x03000002
-#define SSL3_CK_RSA_RC4_40_MD5 			0x03000003
-#define SSL3_CK_RSA_RC4_128_MD5			0x03000004
-#define SSL3_CK_RSA_RC4_128_SHA			0x03000005
-#define SSL3_CK_RSA_RC2_40_MD5			0x03000006
-#define SSL3_CK_RSA_IDEA_128_SHA		0x03000007
-#define SSL3_CK_RSA_DES_40_CBC_SHA		0x03000008
-#define SSL3_CK_RSA_DES_64_CBC_SHA		0x03000009
-#define SSL3_CK_RSA_DES_192_CBC3_SHA		0x0300000A
+#define SSL3_CK_RSA_NULL_MD5            0x03000001
+#define SSL3_CK_RSA_NULL_SHA            0x03000002
+#define SSL3_CK_RSA_RC4_40_MD5          0x03000003
+#define SSL3_CK_RSA_RC4_128_MD5         0x03000004
+#define SSL3_CK_RSA_RC4_128_SHA         0x03000005
+#define SSL3_CK_RSA_RC2_40_MD5          0x03000006
+#define SSL3_CK_RSA_IDEA_128_SHA        0x03000007
+#define SSL3_CK_RSA_DES_40_CBC_SHA      0x03000008
+#define SSL3_CK_RSA_DES_64_CBC_SHA      0x03000009
+#define SSL3_CK_RSA_DES_192_CBC3_SHA        0x0300000A
 
-#define SSL3_CK_DH_DSS_DES_40_CBC_SHA		0x0300000B
-#define SSL3_CK_DH_DSS_DES_64_CBC_SHA		0x0300000C
-#define SSL3_CK_DH_DSS_DES_192_CBC3_SHA 	0x0300000D
-#define SSL3_CK_DH_RSA_DES_40_CBC_SHA		0x0300000E
-#define SSL3_CK_DH_RSA_DES_64_CBC_SHA		0x0300000F
-#define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 	0x03000010
+#define SSL3_CK_DH_DSS_DES_40_CBC_SHA       0x0300000B
+#define SSL3_CK_DH_DSS_DES_64_CBC_SHA       0x0300000C
+#define SSL3_CK_DH_DSS_DES_192_CBC3_SHA     0x0300000D
+#define SSL3_CK_DH_RSA_DES_40_CBC_SHA       0x0300000E
+#define SSL3_CK_DH_RSA_DES_64_CBC_SHA       0x0300000F
+#define SSL3_CK_DH_RSA_DES_192_CBC3_SHA     0x03000010
 
-#define SSL3_CK_EDH_DSS_DES_40_CBC_SHA		0x03000011
-#define SSL3_CK_EDH_DSS_DES_64_CBC_SHA		0x03000012
-#define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA	0x03000013
-#define SSL3_CK_EDH_RSA_DES_40_CBC_SHA		0x03000014
-#define SSL3_CK_EDH_RSA_DES_64_CBC_SHA		0x03000015
-#define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA	0x03000016
+#define SSL3_CK_EDH_DSS_DES_40_CBC_SHA      0x03000011
+#define SSL3_CK_EDH_DSS_DES_64_CBC_SHA      0x03000012
+#define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA    0x03000013
+#define SSL3_CK_EDH_RSA_DES_40_CBC_SHA      0x03000014
+#define SSL3_CK_EDH_RSA_DES_64_CBC_SHA      0x03000015
+#define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA    0x03000016
 
-#define SSL3_CK_ADH_RC4_40_MD5			0x03000017
-#define SSL3_CK_ADH_RC4_128_MD5			0x03000018
-#define SSL3_CK_ADH_DES_40_CBC_SHA		0x03000019
-#define SSL3_CK_ADH_DES_64_CBC_SHA		0x0300001A
-#define SSL3_CK_ADH_DES_192_CBC_SHA		0x0300001B
+#define SSL3_CK_ADH_RC4_40_MD5          0x03000017
+#define SSL3_CK_ADH_RC4_128_MD5         0x03000018
+#define SSL3_CK_ADH_DES_40_CBC_SHA      0x03000019
+#define SSL3_CK_ADH_DES_64_CBC_SHA      0x0300001A
+#define SSL3_CK_ADH_DES_192_CBC_SHA     0x0300001B
 
-#define SSL3_CK_FZA_DMS_NULL_SHA		0x0300001C
-#define SSL3_CK_FZA_DMS_FZA_SHA			0x0300001D
+#define SSL3_CK_FZA_DMS_NULL_SHA        0x0300001C
+#define SSL3_CK_FZA_DMS_FZA_SHA         0x0300001D
 #if 0 /* Because it clashes with KRB5, is never used any more, and is safe
-	 to remove according to David Hopwood 
-	 of the ietf-tls list */
-#define SSL3_CK_FZA_DMS_RC4_SHA			0x0300001E
+     to remove according to David Hopwood 
+     of the ietf-tls list */
+#define SSL3_CK_FZA_DMS_RC4_SHA         0x0300001E
 #endif
 
 /*    VRS Additional Kerberos5 entries
  */
-#define SSL3_CK_KRB5_DES_64_CBC_SHA		0x0300001E
-#define SSL3_CK_KRB5_DES_192_CBC3_SHA		0x0300001F
-#define SSL3_CK_KRB5_RC4_128_SHA		0x03000020
-#define SSL3_CK_KRB5_IDEA_128_CBC_SHA	       	0x03000021
-#define SSL3_CK_KRB5_DES_64_CBC_MD5       	0x03000022
-#define SSL3_CK_KRB5_DES_192_CBC3_MD5       	0x03000023
-#define SSL3_CK_KRB5_RC4_128_MD5	       	0x03000024
-#define SSL3_CK_KRB5_IDEA_128_CBC_MD5 		0x03000025
+#define SSL3_CK_KRB5_DES_64_CBC_SHA     0x0300001E
+#define SSL3_CK_KRB5_DES_192_CBC3_SHA       0x0300001F
+#define SSL3_CK_KRB5_RC4_128_SHA        0x03000020
+#define SSL3_CK_KRB5_IDEA_128_CBC_SHA           0x03000021
+#define SSL3_CK_KRB5_DES_64_CBC_MD5         0x03000022
+#define SSL3_CK_KRB5_DES_192_CBC3_MD5           0x03000023
+#define SSL3_CK_KRB5_RC4_128_MD5            0x03000024
+#define SSL3_CK_KRB5_IDEA_128_CBC_MD5       0x03000025
 
-#define SSL3_CK_KRB5_DES_40_CBC_SHA 		0x03000026
-#define SSL3_CK_KRB5_RC2_40_CBC_SHA 		0x03000027
-#define SSL3_CK_KRB5_RC4_40_SHA	 		0x03000028
-#define SSL3_CK_KRB5_DES_40_CBC_MD5 		0x03000029
-#define SSL3_CK_KRB5_RC2_40_CBC_MD5 		0x0300002A
-#define SSL3_CK_KRB5_RC4_40_MD5	 		0x0300002B
+#define SSL3_CK_KRB5_DES_40_CBC_SHA         0x03000026
+#define SSL3_CK_KRB5_RC2_40_CBC_SHA         0x03000027
+#define SSL3_CK_KRB5_RC4_40_SHA         0x03000028
+#define SSL3_CK_KRB5_DES_40_CBC_MD5         0x03000029
+#define SSL3_CK_KRB5_RC2_40_CBC_MD5         0x0300002A
+#define SSL3_CK_KRB5_RC4_40_MD5         0x0300002B
 
-#define SSL3_TXT_RSA_NULL_MD5			"NULL-MD5"
-#define SSL3_TXT_RSA_NULL_SHA			"NULL-SHA"
-#define SSL3_TXT_RSA_RC4_40_MD5 		"EXP-RC4-MD5"
-#define SSL3_TXT_RSA_RC4_128_MD5		"RC4-MD5"
-#define SSL3_TXT_RSA_RC4_128_SHA		"RC4-SHA"
-#define SSL3_TXT_RSA_RC2_40_MD5			"EXP-RC2-CBC-MD5"
-#define SSL3_TXT_RSA_IDEA_128_SHA		"IDEA-CBC-SHA"
-#define SSL3_TXT_RSA_DES_40_CBC_SHA		"EXP-DES-CBC-SHA"
-#define SSL3_TXT_RSA_DES_64_CBC_SHA		"DES-CBC-SHA"
-#define SSL3_TXT_RSA_DES_192_CBC3_SHA		"DES-CBC3-SHA"
+#define SSL3_TXT_RSA_NULL_MD5           "NULL-MD5"
+#define SSL3_TXT_RSA_NULL_SHA           "NULL-SHA"
+#define SSL3_TXT_RSA_RC4_40_MD5         "EXP-RC4-MD5"
+#define SSL3_TXT_RSA_RC4_128_MD5        "RC4-MD5"
+#define SSL3_TXT_RSA_RC4_128_SHA        "RC4-SHA"
+#define SSL3_TXT_RSA_RC2_40_MD5         "EXP-RC2-CBC-MD5"
+#define SSL3_TXT_RSA_IDEA_128_SHA       "IDEA-CBC-SHA"
+#define SSL3_TXT_RSA_DES_40_CBC_SHA     "EXP-DES-CBC-SHA"
+#define SSL3_TXT_RSA_DES_64_CBC_SHA     "DES-CBC-SHA"
+#define SSL3_TXT_RSA_DES_192_CBC3_SHA       "DES-CBC3-SHA"
 
-#define SSL3_TXT_DH_DSS_DES_40_CBC_SHA		"EXP-DH-DSS-DES-CBC-SHA"
-#define SSL3_TXT_DH_DSS_DES_64_CBC_SHA		"DH-DSS-DES-CBC-SHA"
-#define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA 	"DH-DSS-DES-CBC3-SHA"
-#define SSL3_TXT_DH_RSA_DES_40_CBC_SHA		"EXP-DH-RSA-DES-CBC-SHA"
-#define SSL3_TXT_DH_RSA_DES_64_CBC_SHA		"DH-RSA-DES-CBC-SHA"
-#define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA 	"DH-RSA-DES-CBC3-SHA"
+#define SSL3_TXT_DH_DSS_DES_40_CBC_SHA      "EXP-DH-DSS-DES-CBC-SHA"
+#define SSL3_TXT_DH_DSS_DES_64_CBC_SHA      "DH-DSS-DES-CBC-SHA"
+#define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA    "DH-DSS-DES-CBC3-SHA"
+#define SSL3_TXT_DH_RSA_DES_40_CBC_SHA      "EXP-DH-RSA-DES-CBC-SHA"
+#define SSL3_TXT_DH_RSA_DES_64_CBC_SHA      "DH-RSA-DES-CBC-SHA"
+#define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA    "DH-RSA-DES-CBC3-SHA"
 
-#define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA		"EXP-EDH-DSS-DES-CBC-SHA"
-#define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA		"EDH-DSS-DES-CBC-SHA"
-#define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA	"EDH-DSS-DES-CBC3-SHA"
-#define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA		"EXP-EDH-RSA-DES-CBC-SHA"
-#define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA		"EDH-RSA-DES-CBC-SHA"
-#define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA	"EDH-RSA-DES-CBC3-SHA"
+#define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA     "EXP-EDH-DSS-DES-CBC-SHA"
+#define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA     "EDH-DSS-DES-CBC-SHA"
+#define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA   "EDH-DSS-DES-CBC3-SHA"
+#define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA     "EXP-EDH-RSA-DES-CBC-SHA"
+#define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA     "EDH-RSA-DES-CBC-SHA"
+#define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA   "EDH-RSA-DES-CBC3-SHA"
 
-#define SSL3_TXT_ADH_RC4_40_MD5			"EXP-ADH-RC4-MD5"
-#define SSL3_TXT_ADH_RC4_128_MD5		"ADH-RC4-MD5"
-#define SSL3_TXT_ADH_DES_40_CBC_SHA		"EXP-ADH-DES-CBC-SHA"
-#define SSL3_TXT_ADH_DES_64_CBC_SHA		"ADH-DES-CBC-SHA"
-#define SSL3_TXT_ADH_DES_192_CBC_SHA		"ADH-DES-CBC3-SHA"
+#define SSL3_TXT_ADH_RC4_40_MD5         "EXP-ADH-RC4-MD5"
+#define SSL3_TXT_ADH_RC4_128_MD5        "ADH-RC4-MD5"
+#define SSL3_TXT_ADH_DES_40_CBC_SHA     "EXP-ADH-DES-CBC-SHA"
+#define SSL3_TXT_ADH_DES_64_CBC_SHA     "ADH-DES-CBC-SHA"
+#define SSL3_TXT_ADH_DES_192_CBC_SHA        "ADH-DES-CBC3-SHA"
 
-#define SSL3_TXT_FZA_DMS_NULL_SHA		"FZA-NULL-SHA"
-#define SSL3_TXT_FZA_DMS_FZA_SHA		"FZA-FZA-CBC-SHA"
-#define SSL3_TXT_FZA_DMS_RC4_SHA		"FZA-RC4-SHA"
+#define SSL3_TXT_FZA_DMS_NULL_SHA       "FZA-NULL-SHA"
+#define SSL3_TXT_FZA_DMS_FZA_SHA        "FZA-FZA-CBC-SHA"
+#define SSL3_TXT_FZA_DMS_RC4_SHA        "FZA-RC4-SHA"
 
-#define SSL3_TXT_KRB5_DES_64_CBC_SHA		"KRB5-DES-CBC-SHA"
-#define SSL3_TXT_KRB5_DES_192_CBC3_SHA		"KRB5-DES-CBC3-SHA"
-#define SSL3_TXT_KRB5_RC4_128_SHA		"KRB5-RC4-SHA"
-#define SSL3_TXT_KRB5_IDEA_128_CBC_SHA	       	"KRB5-IDEA-CBC-SHA"
-#define SSL3_TXT_KRB5_DES_64_CBC_MD5       	"KRB5-DES-CBC-MD5"
-#define SSL3_TXT_KRB5_DES_192_CBC3_MD5       	"KRB5-DES-CBC3-MD5"
-#define SSL3_TXT_KRB5_RC4_128_MD5		"KRB5-RC4-MD5"
-#define SSL3_TXT_KRB5_IDEA_128_CBC_MD5 		"KRB5-IDEA-CBC-MD5"
+#define SSL3_TXT_KRB5_DES_64_CBC_SHA        "KRB5-DES-CBC-SHA"
+#define SSL3_TXT_KRB5_DES_192_CBC3_SHA      "KRB5-DES-CBC3-SHA"
+#define SSL3_TXT_KRB5_RC4_128_SHA       "KRB5-RC4-SHA"
+#define SSL3_TXT_KRB5_IDEA_128_CBC_SHA          "KRB5-IDEA-CBC-SHA"
+#define SSL3_TXT_KRB5_DES_64_CBC_MD5        "KRB5-DES-CBC-MD5"
+#define SSL3_TXT_KRB5_DES_192_CBC3_MD5          "KRB5-DES-CBC3-MD5"
+#define SSL3_TXT_KRB5_RC4_128_MD5       "KRB5-RC4-MD5"
+#define SSL3_TXT_KRB5_IDEA_128_CBC_MD5      "KRB5-IDEA-CBC-MD5"
 
-#define SSL3_TXT_KRB5_DES_40_CBC_SHA 		"EXP-KRB5-DES-CBC-SHA"
-#define SSL3_TXT_KRB5_RC2_40_CBC_SHA 		"EXP-KRB5-RC2-CBC-SHA"
-#define SSL3_TXT_KRB5_RC4_40_SHA	 	"EXP-KRB5-RC4-SHA"
-#define SSL3_TXT_KRB5_DES_40_CBC_MD5 		"EXP-KRB5-DES-CBC-MD5"
-#define SSL3_TXT_KRB5_RC2_40_CBC_MD5 		"EXP-KRB5-RC2-CBC-MD5"
-#define SSL3_TXT_KRB5_RC4_40_MD5	 	"EXP-KRB5-RC4-MD5"
+#define SSL3_TXT_KRB5_DES_40_CBC_SHA        "EXP-KRB5-DES-CBC-SHA"
+#define SSL3_TXT_KRB5_RC2_40_CBC_SHA        "EXP-KRB5-RC2-CBC-SHA"
+#define SSL3_TXT_KRB5_RC4_40_SHA        "EXP-KRB5-RC4-SHA"
+#define SSL3_TXT_KRB5_DES_40_CBC_MD5        "EXP-KRB5-DES-CBC-MD5"
+#define SSL3_TXT_KRB5_RC2_40_CBC_MD5        "EXP-KRB5-RC2-CBC-MD5"
+#define SSL3_TXT_KRB5_RC4_40_MD5        "EXP-KRB5-RC4-MD5"
 
-#define SSL3_SSL_SESSION_ID_LENGTH		32
-#define SSL3_MAX_SSL_SESSION_ID_LENGTH		32
+#define SSL3_SSL_SESSION_ID_LENGTH      32
+#define SSL3_MAX_SSL_SESSION_ID_LENGTH      32
 
-#define SSL3_MASTER_SECRET_SIZE			48
-#define SSL3_RANDOM_SIZE			32
-#define SSL3_SESSION_ID_SIZE			32
-#define SSL3_RT_HEADER_LENGTH			5
+#define SSL3_MASTER_SECRET_SIZE         48
+#define SSL3_RANDOM_SIZE            32
+#define SSL3_SESSION_ID_SIZE            32
+#define SSL3_RT_HEADER_LENGTH           5
 
 /* Due to MS stuffing up, this can change.... */
 #if defined(OPENSSL_SYS_WIN16) || \
-	(defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32))
-#define SSL3_RT_MAX_EXTRA			(14000)
+    (defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32))
+#define SSL3_RT_MAX_EXTRA           (14000)
 #else
-#define SSL3_RT_MAX_EXTRA			(16384)
+#define SSL3_RT_MAX_EXTRA           (16384)
 #endif
 
-#define SSL3_RT_MAX_PLAIN_LENGTH		16384
+#define SSL3_RT_MAX_PLAIN_LENGTH        16384
 #ifdef OPENSSL_NO_COMP
-#define SSL3_RT_MAX_COMPRESSED_LENGTH	SSL3_RT_MAX_PLAIN_LENGTH
+#define SSL3_RT_MAX_COMPRESSED_LENGTH   SSL3_RT_MAX_PLAIN_LENGTH
 #else
-#define SSL3_RT_MAX_COMPRESSED_LENGTH	(1024+SSL3_RT_MAX_PLAIN_LENGTH)
+#define SSL3_RT_MAX_COMPRESSED_LENGTH   (1024+SSL3_RT_MAX_PLAIN_LENGTH)
 #endif
-#define SSL3_RT_MAX_ENCRYPTED_LENGTH	(1024+SSL3_RT_MAX_COMPRESSED_LENGTH)
-#define SSL3_RT_MAX_PACKET_SIZE		(SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEADER_LENGTH)
-#define SSL3_RT_MAX_DATA_SIZE			(1024*1024)
+#define SSL3_RT_MAX_ENCRYPTED_LENGTH    (1024+SSL3_RT_MAX_COMPRESSED_LENGTH)
+#define SSL3_RT_MAX_PACKET_SIZE     (SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEADER_LENGTH)
+#define SSL3_RT_MAX_DATA_SIZE           (1024*1024)
 
-#define SSL3_MD_CLIENT_FINISHED_CONST	"\x43\x4C\x4E\x54"
-#define SSL3_MD_SERVER_FINISHED_CONST	"\x53\x52\x56\x52"
+#define SSL3_MD_CLIENT_FINISHED_CONST   "\x43\x4C\x4E\x54"
+#define SSL3_MD_SERVER_FINISHED_CONST   "\x53\x52\x56\x52"
 
-#define SSL3_VERSION			0x0300
-#define SSL3_VERSION_MAJOR		0x03
-#define SSL3_VERSION_MINOR		0x00
+#define SSL3_VERSION            0x0300
+#define SSL3_VERSION_MAJOR      0x03
+#define SSL3_VERSION_MINOR      0x00
 
-#define SSL3_RT_CHANGE_CIPHER_SPEC	20
-#define SSL3_RT_ALERT			21
-#define SSL3_RT_HANDSHAKE		22
-#define SSL3_RT_APPLICATION_DATA	23
+#define SSL3_RT_CHANGE_CIPHER_SPEC  20
+#define SSL3_RT_ALERT           21
+#define SSL3_RT_HANDSHAKE       22
+#define SSL3_RT_APPLICATION_DATA    23
 
-#define SSL3_AL_WARNING			1
-#define SSL3_AL_FATAL			2
+#define SSL3_AL_WARNING         1
+#define SSL3_AL_FATAL           2
 
-#define SSL3_AD_CLOSE_NOTIFY		 0
-#define SSL3_AD_UNEXPECTED_MESSAGE	10	/* fatal */
-#define SSL3_AD_BAD_RECORD_MAC		20	/* fatal */
-#define SSL3_AD_DECOMPRESSION_FAILURE	30	/* fatal */
-#define SSL3_AD_HANDSHAKE_FAILURE	40	/* fatal */
-#define SSL3_AD_NO_CERTIFICATE		41
-#define SSL3_AD_BAD_CERTIFICATE		42
-#define SSL3_AD_UNSUPPORTED_CERTIFICATE	43
-#define SSL3_AD_CERTIFICATE_REVOKED	44
-#define SSL3_AD_CERTIFICATE_EXPIRED	45
-#define SSL3_AD_CERTIFICATE_UNKNOWN	46
-#define SSL3_AD_ILLEGAL_PARAMETER	47	/* fatal */
+#define SSL3_AD_CLOSE_NOTIFY         0
+#define SSL3_AD_UNEXPECTED_MESSAGE  10  /* fatal */
+#define SSL3_AD_BAD_RECORD_MAC      20  /* fatal */
+#define SSL3_AD_DECOMPRESSION_FAILURE   30  /* fatal */
+#define SSL3_AD_HANDSHAKE_FAILURE   40  /* fatal */
+#define SSL3_AD_NO_CERTIFICATE      41
+#define SSL3_AD_BAD_CERTIFICATE     42
+#define SSL3_AD_UNSUPPORTED_CERTIFICATE 43
+#define SSL3_AD_CERTIFICATE_REVOKED 44
+#define SSL3_AD_CERTIFICATE_EXPIRED 45
+#define SSL3_AD_CERTIFICATE_UNKNOWN 46
+#define SSL3_AD_ILLEGAL_PARAMETER   47  /* fatal */
 
 typedef struct ssl3_record_st
-	{
-/*r */	int type;               /* type of record */
-/*rw*/	unsigned int length;    /* How many bytes available */
-/*r */	unsigned int off;       /* read/write offset into 'buf' */
-/*rw*/	unsigned char *data;    /* pointer to the record data */
-/*rw*/	unsigned char *input;   /* where the decode bytes are */
-/*r */	unsigned char *comp;    /* only used with decompression - malloc()ed */
+    {
+/*r */  int type;               /* type of record */
+/*rw*/  unsigned int length;    /* How many bytes available */
+/*r */  unsigned int off;       /* read/write offset into 'buf' */
+/*rw*/  unsigned char *data;    /* pointer to the record data */
+/*rw*/  unsigned char *input;   /* where the decode bytes are */
+/*r */  unsigned char *comp;    /* only used with decompression - malloc()ed */
 /*r */  unsigned long epoch;    /* epoch number, needed by DTLS1 */
 /*r */  PQ_64BIT seq_num;       /* sequence number, needed by DTLS1 */
-	} SSL3_RECORD;
+    } SSL3_RECORD;
 
 typedef struct ssl3_buffer_st
-	{
-	unsigned char *buf;     /* at least SSL3_RT_MAX_PACKET_SIZE bytes,
-	                         * see ssl3_setup_buffers() */
-	size_t len;             /* buffer size */
-	int offset;             /* where to 'copy from' */
-	int left;               /* how many bytes left */
-	} SSL3_BUFFER;
+    {
+    unsigned char *buf;     /* at least SSL3_RT_MAX_PACKET_SIZE bytes,
+                             * see ssl3_setup_buffers() */
+    size_t len;             /* buffer size */
+    int offset;             /* where to 'copy from' */
+    int left;               /* how many bytes left */
+    } SSL3_BUFFER;
 
-#define SSL3_CT_RSA_SIGN			1
-#define SSL3_CT_DSS_SIGN			2
-#define SSL3_CT_RSA_FIXED_DH			3
-#define SSL3_CT_DSS_FIXED_DH			4
-#define SSL3_CT_RSA_EPHEMERAL_DH		5
-#define SSL3_CT_DSS_EPHEMERAL_DH		6
-#define SSL3_CT_FORTEZZA_DMS			20
+#define SSL3_CT_RSA_SIGN            1
+#define SSL3_CT_DSS_SIGN            2
+#define SSL3_CT_RSA_FIXED_DH            3
+#define SSL3_CT_DSS_FIXED_DH            4
+#define SSL3_CT_RSA_EPHEMERAL_DH        5
+#define SSL3_CT_DSS_EPHEMERAL_DH        6
+#define SSL3_CT_FORTEZZA_DMS            20
 /* SSL3_CT_NUMBER is used to size arrays and it must be large
  * enough to contain all of the cert types defined either for
  * SSLv3 and TLSv1.
  */
-#define SSL3_CT_NUMBER			7
+#define SSL3_CT_NUMBER          7
 
 
-#define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS	0x0001
-#define SSL3_FLAGS_DELAY_CLIENT_FINISHED	0x0002
-#define SSL3_FLAGS_POP_BUFFER			0x0004
-#define TLS1_FLAGS_TLS_PADDING_BUG		0x0008
+#define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS   0x0001
+#define SSL3_FLAGS_DELAY_CLIENT_FINISHED    0x0002
+#define SSL3_FLAGS_POP_BUFFER           0x0004
+#define TLS1_FLAGS_TLS_PADDING_BUG      0x0008
 
 typedef struct ssl3_state_st
-	{
-	long flags;
-	int delay_buf_pop_ret;
+    {
+    long flags;
+    int delay_buf_pop_ret;
 
-	unsigned char read_sequence[8];
-	unsigned char read_mac_secret[EVP_MAX_MD_SIZE];
-	unsigned char write_sequence[8];
-	unsigned char write_mac_secret[EVP_MAX_MD_SIZE];
+    unsigned char read_sequence[8];
+    unsigned char read_mac_secret[EVP_MAX_MD_SIZE];
+    unsigned char write_sequence[8];
+    unsigned char write_mac_secret[EVP_MAX_MD_SIZE];
 
-	unsigned char server_random[SSL3_RANDOM_SIZE];
-	unsigned char client_random[SSL3_RANDOM_SIZE];
+    unsigned char server_random[SSL3_RANDOM_SIZE];
+    unsigned char client_random[SSL3_RANDOM_SIZE];
 
-	/* flags for countermeasure against known-IV weakness */
-	int need_empty_fragments;
-	int empty_fragment_done;
+    /* flags for countermeasure against known-IV weakness */
+    int need_empty_fragments;
+    int empty_fragment_done;
 
-	SSL3_BUFFER rbuf;	/* read IO goes into here */
-	SSL3_BUFFER wbuf;	/* write IO goes into here */
+    SSL3_BUFFER rbuf;   /* read IO goes into here */
+    SSL3_BUFFER wbuf;   /* write IO goes into here */
 
-	SSL3_RECORD rrec;	/* each decoded record goes in here */
-	SSL3_RECORD wrec;	/* goes out from here */
+    SSL3_RECORD rrec;   /* each decoded record goes in here */
+    SSL3_RECORD wrec;   /* goes out from here */
 
-	/* storage for Alert/Handshake protocol data received but not
-	 * yet processed by ssl3_read_bytes: */
-	unsigned char alert_fragment[2];
-	unsigned int alert_fragment_len;
-	unsigned char handshake_fragment[4];
-	unsigned int handshake_fragment_len;
+    /* storage for Alert/Handshake protocol data received but not
+     * yet processed by ssl3_read_bytes: */
+    unsigned char alert_fragment[2];
+    unsigned int alert_fragment_len;
+    unsigned char handshake_fragment[4];
+    unsigned int handshake_fragment_len;
 
-	/* partial write - check the numbers match */
-	unsigned int wnum;	/* number of bytes sent so far */
-	int wpend_tot;		/* number bytes written */
-	int wpend_type;
-	int wpend_ret;		/* number of bytes submitted */
-	const unsigned char *wpend_buf;
+    /* partial write - check the numbers match */
+    unsigned int wnum;  /* number of bytes sent so far */
+    int wpend_tot;      /* number bytes written */
+    int wpend_type;
+    int wpend_ret;      /* number of bytes submitted */
+    const unsigned char *wpend_buf;
 
-	/* used during startup, digest all incoming/outgoing packets */
-	EVP_MD_CTX finish_dgst1;
-	EVP_MD_CTX finish_dgst2;
+    /* used during startup, digest all incoming/outgoing packets */
+    EVP_MD_CTX finish_dgst1;
+    EVP_MD_CTX finish_dgst2;
 
-	/* this is set whenerver we see a change_cipher_spec message
-	 * come in when we are not looking for one */
-	int change_cipher_spec;
+    /* this is set whenerver we see a change_cipher_spec message
+     * come in when we are not looking for one */
+    int change_cipher_spec;
 
-	int warn_alert;
-	int fatal_alert;
-	/* we allow one fatal and one warning alert to be outstanding,
-	 * send close alert via the warning alert */
-	int alert_dispatch;
-	unsigned char send_alert[2];
+    int warn_alert;
+    int fatal_alert;
+    /* we allow one fatal and one warning alert to be outstanding,
+     * send close alert via the warning alert */
+    int alert_dispatch;
+    unsigned char send_alert[2];
 
-	/* This flag is set when we should renegotiate ASAP, basically when
-	 * there is no more data in the read or write buffers */
-	int renegotiate;
-	int total_renegotiations;
-	int num_renegotiations;
+    /* This flag is set when we should renegotiate ASAP, basically when
+     * there is no more data in the read or write buffers */
+    int renegotiate;
+    int total_renegotiations;
+    int num_renegotiations;
 
-	int in_read_app_data;
+    int in_read_app_data;
 
-	struct	{
-		/* actually only needs to be 16+20 */
-		unsigned char cert_verify_md[EVP_MAX_MD_SIZE*2];
+    struct  {
+        /* actually only needs to be 16+20 */
+        unsigned char cert_verify_md[EVP_MAX_MD_SIZE*2];
 
-		/* actually only need to be 16+20 for SSLv3 and 12 for TLS */
-		unsigned char finish_md[EVP_MAX_MD_SIZE*2];
-		int finish_md_len;
-		unsigned char peer_finish_md[EVP_MAX_MD_SIZE*2];
-		int peer_finish_md_len;
-		
-		unsigned long message_size;
-		int message_type;
+        /* actually only need to be 16+20 for SSLv3 and 12 for TLS */
+        unsigned char finish_md[EVP_MAX_MD_SIZE*2];
+        int finish_md_len;
+        unsigned char peer_finish_md[EVP_MAX_MD_SIZE*2];
+        int peer_finish_md_len;
 
-		/* used to hold the new cipher we are going to use */
-		SSL_CIPHER *new_cipher;
+        unsigned long message_size;
+        int message_type;
+
+        /* used to hold the new cipher we are going to use */
+        SSL_CIPHER *new_cipher;
 #ifndef OPENSSL_NO_DH
-		DH *dh;
+        DH *dh;
 #endif
 
 #ifndef OPENSSL_NO_ECDH
-		EC_KEY *ecdh; /* holds short lived ECDH key */
+        EC_KEY *ecdh; /* holds short lived ECDH key */
 #endif
 
-		/* used when SSL_ST_FLUSH_DATA is entered */
-		int next_state;			
+        /* used when SSL_ST_FLUSH_DATA is entered */
+        int next_state;
 
-		int reuse_message;
+        int reuse_message;
 
-		/* used for certificate requests */
-		int cert_req;
-		int ctype_num;
-		char ctype[SSL3_CT_NUMBER];
-		STACK_OF(X509_NAME) *ca_names;
+        /* used for certificate requests */
+        int cert_req;
+        int ctype_num;
+        char ctype[SSL3_CT_NUMBER];
+        STACK_OF(X509_NAME) *ca_names;
 
-		int use_rsa_tmp;
+        int use_rsa_tmp;
 
-		int key_block_length;
-		unsigned char *key_block;
+        int key_block_length;
+        unsigned char *key_block;
 
-		const EVP_CIPHER *new_sym_enc;
-		const EVP_MD *new_hash;
+        const EVP_CIPHER *new_sym_enc;
+        const EVP_MD *new_hash;
 #ifndef OPENSSL_NO_COMP
-		const SSL_COMP *new_compression;
+        const SSL_COMP *new_compression;
 #else
-		char *new_compression;
+        char *new_compression;
 #endif
-		int cert_request;
-		} tmp;
+        int cert_request;
+        } tmp;
 
-	} SSL3_STATE;
+    } SSL3_STATE;
 
 
 /* SSLv3 */
 /*client */
 /* extra state */
-#define SSL3_ST_CW_FLUSH		(0x100|SSL_ST_CONNECT)
+#define SSL3_ST_CW_FLUSH        (0x100|SSL_ST_CONNECT)
 /* write to server */
-#define SSL3_ST_CW_CLNT_HELLO_A		(0x110|SSL_ST_CONNECT)
-#define SSL3_ST_CW_CLNT_HELLO_B		(0x111|SSL_ST_CONNECT)
+#define SSL3_ST_CW_CLNT_HELLO_A     (0x110|SSL_ST_CONNECT)
+#define SSL3_ST_CW_CLNT_HELLO_B     (0x111|SSL_ST_CONNECT)
 /* read from server */
-#define SSL3_ST_CR_SRVR_HELLO_A		(0x120|SSL_ST_CONNECT)
-#define SSL3_ST_CR_SRVR_HELLO_B		(0x121|SSL_ST_CONNECT)
+#define SSL3_ST_CR_SRVR_HELLO_A     (0x120|SSL_ST_CONNECT)
+#define SSL3_ST_CR_SRVR_HELLO_B     (0x121|SSL_ST_CONNECT)
 #define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A (0x126|SSL_ST_CONNECT)
 #define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B (0x127|SSL_ST_CONNECT)
-#define SSL3_ST_CR_CERT_A		(0x130|SSL_ST_CONNECT)
-#define SSL3_ST_CR_CERT_B		(0x131|SSL_ST_CONNECT)
-#define SSL3_ST_CR_KEY_EXCH_A		(0x140|SSL_ST_CONNECT)
-#define SSL3_ST_CR_KEY_EXCH_B		(0x141|SSL_ST_CONNECT)
-#define SSL3_ST_CR_CERT_REQ_A		(0x150|SSL_ST_CONNECT)
-#define SSL3_ST_CR_CERT_REQ_B		(0x151|SSL_ST_CONNECT)
-#define SSL3_ST_CR_SRVR_DONE_A		(0x160|SSL_ST_CONNECT)
-#define SSL3_ST_CR_SRVR_DONE_B		(0x161|SSL_ST_CONNECT)
+#define SSL3_ST_CR_CERT_A       (0x130|SSL_ST_CONNECT)
+#define SSL3_ST_CR_CERT_B       (0x131|SSL_ST_CONNECT)
+#define SSL3_ST_CR_KEY_EXCH_A       (0x140|SSL_ST_CONNECT)
+#define SSL3_ST_CR_KEY_EXCH_B       (0x141|SSL_ST_CONNECT)
+#define SSL3_ST_CR_CERT_REQ_A       (0x150|SSL_ST_CONNECT)
+#define SSL3_ST_CR_CERT_REQ_B       (0x151|SSL_ST_CONNECT)
+#define SSL3_ST_CR_SRVR_DONE_A      (0x160|SSL_ST_CONNECT)
+#define SSL3_ST_CR_SRVR_DONE_B      (0x161|SSL_ST_CONNECT)
 /* write to server */
-#define SSL3_ST_CW_CERT_A		(0x170|SSL_ST_CONNECT)
-#define SSL3_ST_CW_CERT_B		(0x171|SSL_ST_CONNECT)
-#define SSL3_ST_CW_CERT_C		(0x172|SSL_ST_CONNECT)
-#define SSL3_ST_CW_CERT_D		(0x173|SSL_ST_CONNECT)
-#define SSL3_ST_CW_KEY_EXCH_A		(0x180|SSL_ST_CONNECT)
-#define SSL3_ST_CW_KEY_EXCH_B		(0x181|SSL_ST_CONNECT)
-#define SSL3_ST_CW_CERT_VRFY_A		(0x190|SSL_ST_CONNECT)
-#define SSL3_ST_CW_CERT_VRFY_B		(0x191|SSL_ST_CONNECT)
-#define SSL3_ST_CW_CHANGE_A		(0x1A0|SSL_ST_CONNECT)
-#define SSL3_ST_CW_CHANGE_B		(0x1A1|SSL_ST_CONNECT)
-#define SSL3_ST_CW_FINISHED_A		(0x1B0|SSL_ST_CONNECT)
-#define SSL3_ST_CW_FINISHED_B		(0x1B1|SSL_ST_CONNECT)
+#define SSL3_ST_CW_CERT_A       (0x170|SSL_ST_CONNECT)
+#define SSL3_ST_CW_CERT_B       (0x171|SSL_ST_CONNECT)
+#define SSL3_ST_CW_CERT_C       (0x172|SSL_ST_CONNECT)
+#define SSL3_ST_CW_CERT_D       (0x173|SSL_ST_CONNECT)
+#define SSL3_ST_CW_KEY_EXCH_A       (0x180|SSL_ST_CONNECT)
+#define SSL3_ST_CW_KEY_EXCH_B       (0x181|SSL_ST_CONNECT)
+#define SSL3_ST_CW_CERT_VRFY_A      (0x190|SSL_ST_CONNECT)
+#define SSL3_ST_CW_CERT_VRFY_B      (0x191|SSL_ST_CONNECT)
+#define SSL3_ST_CW_CHANGE_A     (0x1A0|SSL_ST_CONNECT)
+#define SSL3_ST_CW_CHANGE_B     (0x1A1|SSL_ST_CONNECT)
+#define SSL3_ST_CW_FINISHED_A       (0x1B0|SSL_ST_CONNECT)
+#define SSL3_ST_CW_FINISHED_B       (0x1B1|SSL_ST_CONNECT)
 /* read from server */
-#define SSL3_ST_CR_CHANGE_A		(0x1C0|SSL_ST_CONNECT)
-#define SSL3_ST_CR_CHANGE_B		(0x1C1|SSL_ST_CONNECT)
-#define SSL3_ST_CR_FINISHED_A		(0x1D0|SSL_ST_CONNECT)
-#define SSL3_ST_CR_FINISHED_B		(0x1D1|SSL_ST_CONNECT)
+#define SSL3_ST_CR_CHANGE_A     (0x1C0|SSL_ST_CONNECT)
+#define SSL3_ST_CR_CHANGE_B     (0x1C1|SSL_ST_CONNECT)
+#define SSL3_ST_CR_FINISHED_A       (0x1D0|SSL_ST_CONNECT)
+#define SSL3_ST_CR_FINISHED_B       (0x1D1|SSL_ST_CONNECT)
 
 /* server */
 /* extra state */
-#define SSL3_ST_SW_FLUSH		(0x100|SSL_ST_ACCEPT)
+#define SSL3_ST_SW_FLUSH        (0x100|SSL_ST_ACCEPT)
 /* read from client */
 /* Do not change the number values, they do matter */
-#define SSL3_ST_SR_CLNT_HELLO_A		(0x110|SSL_ST_ACCEPT)
-#define SSL3_ST_SR_CLNT_HELLO_B		(0x111|SSL_ST_ACCEPT)
-#define SSL3_ST_SR_CLNT_HELLO_C		(0x112|SSL_ST_ACCEPT)
+#define SSL3_ST_SR_CLNT_HELLO_A     (0x110|SSL_ST_ACCEPT)
+#define SSL3_ST_SR_CLNT_HELLO_B     (0x111|SSL_ST_ACCEPT)
+#define SSL3_ST_SR_CLNT_HELLO_C     (0x112|SSL_ST_ACCEPT)
 /* write to client */
 #define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_A (0x113|SSL_ST_ACCEPT)
 #define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B (0x114|SSL_ST_ACCEPT)
-#define SSL3_ST_SW_HELLO_REQ_A		(0x120|SSL_ST_ACCEPT)
-#define SSL3_ST_SW_HELLO_REQ_B		(0x121|SSL_ST_ACCEPT)
-#define SSL3_ST_SW_HELLO_REQ_C		(0x122|SSL_ST_ACCEPT)
-#define SSL3_ST_SW_SRVR_HELLO_A		(0x130|SSL_ST_ACCEPT)
-#define SSL3_ST_SW_SRVR_HELLO_B		(0x131|SSL_ST_ACCEPT)
-#define SSL3_ST_SW_CERT_A		(0x140|SSL_ST_ACCEPT)
-#define SSL3_ST_SW_CERT_B		(0x141|SSL_ST_ACCEPT)
-#define SSL3_ST_SW_KEY_EXCH_A		(0x150|SSL_ST_ACCEPT)
-#define SSL3_ST_SW_KEY_EXCH_B		(0x151|SSL_ST_ACCEPT)
-#define SSL3_ST_SW_CERT_REQ_A		(0x160|SSL_ST_ACCEPT)
-#define SSL3_ST_SW_CERT_REQ_B		(0x161|SSL_ST_ACCEPT)
-#define SSL3_ST_SW_SRVR_DONE_A		(0x170|SSL_ST_ACCEPT)
-#define SSL3_ST_SW_SRVR_DONE_B		(0x171|SSL_ST_ACCEPT)
+#define SSL3_ST_SW_HELLO_REQ_A      (0x120|SSL_ST_ACCEPT)
+#define SSL3_ST_SW_HELLO_REQ_B      (0x121|SSL_ST_ACCEPT)
+#define SSL3_ST_SW_HELLO_REQ_C      (0x122|SSL_ST_ACCEPT)
+#define SSL3_ST_SW_SRVR_HELLO_A     (0x130|SSL_ST_ACCEPT)
+#define SSL3_ST_SW_SRVR_HELLO_B     (0x131|SSL_ST_ACCEPT)
+#define SSL3_ST_SW_CERT_A       (0x140|SSL_ST_ACCEPT)
+#define SSL3_ST_SW_CERT_B       (0x141|SSL_ST_ACCEPT)
+#define SSL3_ST_SW_KEY_EXCH_A       (0x150|SSL_ST_ACCEPT)
+#define SSL3_ST_SW_KEY_EXCH_B       (0x151|SSL_ST_ACCEPT)
+#define SSL3_ST_SW_CERT_REQ_A       (0x160|SSL_ST_ACCEPT)
+#define SSL3_ST_SW_CERT_REQ_B       (0x161|SSL_ST_ACCEPT)
+#define SSL3_ST_SW_SRVR_DONE_A      (0x170|SSL_ST_ACCEPT)
+#define SSL3_ST_SW_SRVR_DONE_B      (0x171|SSL_ST_ACCEPT)
 /* read from client */
-#define SSL3_ST_SR_CERT_A		(0x180|SSL_ST_ACCEPT)
-#define SSL3_ST_SR_CERT_B		(0x181|SSL_ST_ACCEPT)
-#define SSL3_ST_SR_KEY_EXCH_A		(0x190|SSL_ST_ACCEPT)
-#define SSL3_ST_SR_KEY_EXCH_B		(0x191|SSL_ST_ACCEPT)
-#define SSL3_ST_SR_CERT_VRFY_A		(0x1A0|SSL_ST_ACCEPT)
-#define SSL3_ST_SR_CERT_VRFY_B		(0x1A1|SSL_ST_ACCEPT)
-#define SSL3_ST_SR_CHANGE_A		(0x1B0|SSL_ST_ACCEPT)
-#define SSL3_ST_SR_CHANGE_B		(0x1B1|SSL_ST_ACCEPT)
-#define SSL3_ST_SR_FINISHED_A		(0x1C0|SSL_ST_ACCEPT)
-#define SSL3_ST_SR_FINISHED_B		(0x1C1|SSL_ST_ACCEPT)
+#define SSL3_ST_SR_CERT_A       (0x180|SSL_ST_ACCEPT)
+#define SSL3_ST_SR_CERT_B       (0x181|SSL_ST_ACCEPT)
+#define SSL3_ST_SR_KEY_EXCH_A       (0x190|SSL_ST_ACCEPT)
+#define SSL3_ST_SR_KEY_EXCH_B       (0x191|SSL_ST_ACCEPT)
+#define SSL3_ST_SR_CERT_VRFY_A      (0x1A0|SSL_ST_ACCEPT)
+#define SSL3_ST_SR_CERT_VRFY_B      (0x1A1|SSL_ST_ACCEPT)
+#define SSL3_ST_SR_CHANGE_A     (0x1B0|SSL_ST_ACCEPT)
+#define SSL3_ST_SR_CHANGE_B     (0x1B1|SSL_ST_ACCEPT)
+#define SSL3_ST_SR_FINISHED_A       (0x1C0|SSL_ST_ACCEPT)
+#define SSL3_ST_SR_FINISHED_B       (0x1C1|SSL_ST_ACCEPT)
 /* write to client */
-#define SSL3_ST_SW_CHANGE_A		(0x1D0|SSL_ST_ACCEPT)
-#define SSL3_ST_SW_CHANGE_B		(0x1D1|SSL_ST_ACCEPT)
-#define SSL3_ST_SW_FINISHED_A		(0x1E0|SSL_ST_ACCEPT)
-#define SSL3_ST_SW_FINISHED_B		(0x1E1|SSL_ST_ACCEPT)
+#define SSL3_ST_SW_CHANGE_A     (0x1D0|SSL_ST_ACCEPT)
+#define SSL3_ST_SW_CHANGE_B     (0x1D1|SSL_ST_ACCEPT)
+#define SSL3_ST_SW_FINISHED_A       (0x1E0|SSL_ST_ACCEPT)
+#define SSL3_ST_SW_FINISHED_B       (0x1E1|SSL_ST_ACCEPT)
 
-#define SSL3_MT_HELLO_REQUEST			0
-#define SSL3_MT_CLIENT_HELLO			1
-#define SSL3_MT_SERVER_HELLO			2
-#define SSL3_MT_CERTIFICATE			11
-#define SSL3_MT_SERVER_KEY_EXCHANGE		12
-#define SSL3_MT_CERTIFICATE_REQUEST		13
-#define SSL3_MT_SERVER_DONE			14
-#define SSL3_MT_CERTIFICATE_VERIFY		15
-#define SSL3_MT_CLIENT_KEY_EXCHANGE		16
-#define SSL3_MT_FINISHED			20
+#define SSL3_MT_HELLO_REQUEST           0
+#define SSL3_MT_CLIENT_HELLO            1
+#define SSL3_MT_SERVER_HELLO            2
+#define SSL3_MT_CERTIFICATE         11
+#define SSL3_MT_SERVER_KEY_EXCHANGE     12
+#define SSL3_MT_CERTIFICATE_REQUEST     13
+#define SSL3_MT_SERVER_DONE         14
+#define SSL3_MT_CERTIFICATE_VERIFY      15
+#define SSL3_MT_CLIENT_KEY_EXCHANGE     16
+#define SSL3_MT_FINISHED            20
 #define DTLS1_MT_HELLO_VERIFY_REQUEST    3
 
 
-#define SSL3_MT_CCS				1
+#define SSL3_MT_CCS             1
 
 /* These are used when changing over to a new cipher */
-#define SSL3_CC_READ		0x01
-#define SSL3_CC_WRITE		0x02
-#define SSL3_CC_CLIENT		0x10
-#define SSL3_CC_SERVER		0x20
-#define SSL3_CHANGE_CIPHER_CLIENT_WRITE	(SSL3_CC_CLIENT|SSL3_CC_WRITE)	
-#define SSL3_CHANGE_CIPHER_SERVER_READ	(SSL3_CC_SERVER|SSL3_CC_READ)
-#define SSL3_CHANGE_CIPHER_CLIENT_READ	(SSL3_CC_CLIENT|SSL3_CC_READ)
-#define SSL3_CHANGE_CIPHER_SERVER_WRITE	(SSL3_CC_SERVER|SSL3_CC_WRITE)
+#define SSL3_CC_READ        0x01
+#define SSL3_CC_WRITE       0x02
+#define SSL3_CC_CLIENT      0x10
+#define SSL3_CC_SERVER      0x20
+#define SSL3_CHANGE_CIPHER_CLIENT_WRITE (SSL3_CC_CLIENT|SSL3_CC_WRITE)
+#define SSL3_CHANGE_CIPHER_SERVER_READ  (SSL3_CC_SERVER|SSL3_CC_READ)
+#define SSL3_CHANGE_CIPHER_CLIENT_READ  (SSL3_CC_CLIENT|SSL3_CC_READ)
+#define SSL3_CHANGE_CIPHER_SERVER_WRITE (SSL3_CC_SERVER|SSL3_CC_WRITE)
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/stack.h b/dep/include/openssl/stack.h
index 5cbb116a8b2..d790c979ea2 100644
--- a/dep/include/openssl/stack.h
+++ b/dep/include/openssl/stack.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -64,17 +64,17 @@ extern "C" {
 #endif
 
 typedef struct stack_st
-	{
-	int num;
-	char **data;
-	int sorted;
+    {
+    int num;
+    char **data;
+    int sorted;
 
-	int num_alloc;
-	int (*comp)(const char * const *, const char * const *);
-	} STACK;
+    int num_alloc;
+    int (*comp)(const char * const *, const char * const *);
+    } STACK;
 
-#define M_sk_num(sk)		((sk) ? (sk)->num:-1)
-#define M_sk_value(sk,n)	((sk) ? (sk)->data[n] : NULL)
+#define M_sk_num(sk)        ((sk) ? (sk)->num:-1)
+#define M_sk_value(sk,n)    ((sk) ? (sk)->data[n] : NULL)
 
 int sk_num(const STACK *);
 char *sk_value(const STACK *, int);
@@ -96,8 +96,8 @@ char *sk_shift(STACK *st);
 char *sk_pop(STACK *st);
 void sk_zero(STACK *st);
 int (*sk_set_cmp_func(STACK *sk, int (*c)(const char * const *,
-			const char * const *)))
-			(const char * const *, const char * const *);
+            const char * const *)))
+            (const char * const *, const char * const *);
 STACK *sk_dup(STACK *st);
 void sk_sort(STACK *st);
 int sk_is_sorted(const STACK *st);
diff --git a/dep/include/openssl/store.h b/dep/include/openssl/store.h
index 64583377a94..2368faa83ab 100644
--- a/dep/include/openssl/store.h
+++ b/dep/include/openssl/store.h
@@ -10,7 +10,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -92,22 +92,22 @@ int STORE_ctrl(STORE *store, int cmd, long i, void *p, void (*f)(void));
 
 /* A control to set the directory with keys and certificates.  Used by the
    built-in directory level method. */
-#define STORE_CTRL_SET_DIRECTORY	0x0001
+#define STORE_CTRL_SET_DIRECTORY    0x0001
 /* A control to set a file to load.  Used by the built-in file level method. */
-#define STORE_CTRL_SET_FILE		0x0002
+#define STORE_CTRL_SET_FILE     0x0002
 /* A control to set a configuration file to load.  Can be used by any method
    that wishes to load a configuration file. */
-#define STORE_CTRL_SET_CONF_FILE	0x0003
+#define STORE_CTRL_SET_CONF_FILE    0x0003
 /* A control to set a the section of the loaded configuration file.  Can be
    used by any method that wishes to load a configuration file. */
-#define STORE_CTRL_SET_CONF_SECTION	0x0004
+#define STORE_CTRL_SET_CONF_SECTION 0x0004
 
 
 /* Some methods may use extra data */
-#define STORE_set_app_data(s,arg)	STORE_set_ex_data(s,0,arg)
-#define STORE_get_app_data(s)		STORE_get_ex_data(s,0)
+#define STORE_set_app_data(s,arg)   STORE_set_ex_data(s,0,arg)
+#define STORE_get_app_data(s)       STORE_get_ex_data(s,0)
 int STORE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
-	CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+    CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
 int STORE_set_ex_data(STORE *r,int idx,void *arg);
 void *STORE_get_ex_data(STORE *r, int idx);
 
@@ -133,16 +133,16 @@ const STORE_METHOD *STORE_File(void);
 /* Store functions take a type code for the type of data they should store
    or fetch */
 typedef enum STORE_object_types
-	{
-	STORE_OBJECT_TYPE_X509_CERTIFICATE=	0x01, /* X509 * */
-	STORE_OBJECT_TYPE_X509_CRL=		0x02, /* X509_CRL * */
-	STORE_OBJECT_TYPE_PRIVATE_KEY=		0x03, /* EVP_PKEY * */
-	STORE_OBJECT_TYPE_PUBLIC_KEY=		0x04, /* EVP_PKEY * */
-	STORE_OBJECT_TYPE_NUMBER=		0x05, /* BIGNUM * */
-	STORE_OBJECT_TYPE_ARBITRARY=		0x06, /* BUF_MEM * */
-	STORE_OBJECT_TYPE_NUM=			0x06  /* The amount of known
-							 object types */
-	} STORE_OBJECT_TYPES;
+    {
+    STORE_OBJECT_TYPE_X509_CERTIFICATE= 0x01, /* X509 * */
+    STORE_OBJECT_TYPE_X509_CRL=     0x02, /* X509_CRL * */
+    STORE_OBJECT_TYPE_PRIVATE_KEY=      0x03, /* EVP_PKEY * */
+    STORE_OBJECT_TYPE_PUBLIC_KEY=       0x04, /* EVP_PKEY * */
+    STORE_OBJECT_TYPE_NUMBER=       0x05, /* BIGNUM * */
+    STORE_OBJECT_TYPE_ARBITRARY=        0x06, /* BUF_MEM * */
+    STORE_OBJECT_TYPE_NUM=          0x06  /* The amount of known
+                             object types */
+    } STORE_OBJECT_TYPES;
 /* List of text strings corresponding to the object types. */
 extern const char * const STORE_object_type_string[STORE_OBJECT_TYPE_NUM+1];
 
@@ -150,16 +150,16 @@ extern const char * const STORE_object_type_string[STORE_OBJECT_TYPE_NUM+1];
    one of the following codes. The comments following the codes below indicate
    what type the value should be a pointer to. */
 typedef enum STORE_params
-	{
-	STORE_PARAM_EVP_TYPE=			0x01, /* int */
-	STORE_PARAM_BITS=			0x02, /* size_t */
-	STORE_PARAM_KEY_PARAMETERS=		0x03, /* ??? */
-	STORE_PARAM_KEY_NO_PARAMETERS=		0x04, /* N/A */
-	STORE_PARAM_AUTH_PASSPHRASE=		0x05, /* char * */
-	STORE_PARAM_AUTH_KRB5_TICKET=		0x06, /* void * */
-	STORE_PARAM_TYPE_NUM=			0x06  /* The amount of known
-							 parameter types */
-	} STORE_PARAM_TYPES;
+    {
+    STORE_PARAM_EVP_TYPE=           0x01, /* int */
+    STORE_PARAM_BITS=           0x02, /* size_t */
+    STORE_PARAM_KEY_PARAMETERS=     0x03, /* ??? */
+    STORE_PARAM_KEY_NO_PARAMETERS=      0x04, /* N/A */
+    STORE_PARAM_AUTH_PASSPHRASE=        0x05, /* char * */
+    STORE_PARAM_AUTH_KRB5_TICKET=       0x06, /* void * */
+    STORE_PARAM_TYPE_NUM=           0x06  /* The amount of known
+                             parameter types */
+    } STORE_PARAM_TYPES;
 /* Parameter value sizes.  -1 means unknown, anything else is the required size. */
 extern const int STORE_param_sizes[STORE_PARAM_TYPE_NUM+1];
 
@@ -167,36 +167,36 @@ extern const int STORE_param_sizes[STORE_PARAM_TYPE_NUM+1];
    The comments following the codes below indicate what type the value should
    be a pointer to. */
 typedef enum STORE_attribs
-	{
-	STORE_ATTR_END=				0x00,
-	STORE_ATTR_FRIENDLYNAME=		0x01, /* C string */
-	STORE_ATTR_KEYID=			0x02, /* 160 bit string (SHA1) */
-	STORE_ATTR_ISSUERKEYID=			0x03, /* 160 bit string (SHA1) */
-	STORE_ATTR_SUBJECTKEYID=		0x04, /* 160 bit string (SHA1) */
-	STORE_ATTR_ISSUERSERIALHASH=		0x05, /* 160 bit string (SHA1) */
-	STORE_ATTR_ISSUER=			0x06, /* X509_NAME * */
-	STORE_ATTR_SERIAL=			0x07, /* BIGNUM * */
-	STORE_ATTR_SUBJECT=			0x08, /* X509_NAME * */
-	STORE_ATTR_CERTHASH=			0x09, /* 160 bit string (SHA1) */
-	STORE_ATTR_EMAIL=			0x0a, /* C string */
-	STORE_ATTR_FILENAME=			0x0b, /* C string */
-	STORE_ATTR_TYPE_NUM=			0x0b, /* The amount of known
-							 attribute types */
-	STORE_ATTR_OR=				0xff  /* This is a special
-							 separator, which
-							 expresses the OR
-							 operation.  */
-	} STORE_ATTR_TYPES;
+    {
+    STORE_ATTR_END=             0x00,
+    STORE_ATTR_FRIENDLYNAME=        0x01, /* C string */
+    STORE_ATTR_KEYID=           0x02, /* 160 bit string (SHA1) */
+    STORE_ATTR_ISSUERKEYID=         0x03, /* 160 bit string (SHA1) */
+    STORE_ATTR_SUBJECTKEYID=        0x04, /* 160 bit string (SHA1) */
+    STORE_ATTR_ISSUERSERIALHASH=        0x05, /* 160 bit string (SHA1) */
+    STORE_ATTR_ISSUER=          0x06, /* X509_NAME * */
+    STORE_ATTR_SERIAL=          0x07, /* BIGNUM * */
+    STORE_ATTR_SUBJECT=         0x08, /* X509_NAME * */
+    STORE_ATTR_CERTHASH=            0x09, /* 160 bit string (SHA1) */
+    STORE_ATTR_EMAIL=           0x0a, /* C string */
+    STORE_ATTR_FILENAME=            0x0b, /* C string */
+    STORE_ATTR_TYPE_NUM=            0x0b, /* The amount of known
+                             attribute types */
+    STORE_ATTR_OR=              0xff  /* This is a special
+                             separator, which
+                             expresses the OR
+                             operation.  */
+    } STORE_ATTR_TYPES;
 /* Attribute value sizes.  -1 means unknown, anything else is the required size. */
 extern const int STORE_attr_sizes[STORE_ATTR_TYPE_NUM+1];
 
 typedef enum STORE_certificate_status
-	{
-	STORE_X509_VALID=			0x00,
-	STORE_X509_EXPIRED=			0x01,
-	STORE_X509_SUSPENDED=			0x02,
-	STORE_X509_REVOKED=			0x03
-	} STORE_CERTIFICATE_STATUS;
+    {
+    STORE_X509_VALID=           0x00,
+    STORE_X509_EXPIRED=         0x01,
+    STORE_X509_SUSPENDED=           0x02,
+    STORE_X509_REVOKED=         0x03
+    } STORE_CERTIFICATE_STATUS;
 
 /* Engine store functions will return a structure that contains all the necessary
  * information, including revokation status for certificates.  This is really not
@@ -204,21 +204,21 @@ typedef enum STORE_certificate_status
  * the OpenSSL-specific information when at all possible.  However, for engine
  * authors, it's crucial to know this structure.  */
 typedef struct STORE_OBJECT_st
-	{
-	STORE_OBJECT_TYPES type;
-	union
-		{
-		struct
-			{
-			STORE_CERTIFICATE_STATUS status;
-			X509 *certificate;
-			} x509;
-		X509_CRL *crl;
-		EVP_PKEY *key;
-		BIGNUM *number;
-		BUF_MEM *arbitrary;
-		} data;
-	} STORE_OBJECT;
+    {
+    STORE_OBJECT_TYPES type;
+    union
+        {
+        struct
+            {
+            STORE_CERTIFICATE_STATUS status;
+            X509 *certificate;
+            } x509;
+        X509_CRL *crl;
+        EVP_PKEY *key;
+        BIGNUM *number;
+        BUF_MEM *arbitrary;
+        } data;
+    } STORE_OBJECT;
 DECLARE_STACK_OF(STORE_OBJECT)
 STORE_OBJECT *STORE_OBJECT_new(void);
 void STORE_OBJECT_free(STORE_OBJECT *data);
@@ -228,89 +228,89 @@ void STORE_OBJECT_free(STORE_OBJECT *data);
 /* The following functions handle the storage. They return 0, a negative number
    or NULL on error, anything else on success. */
 X509 *STORE_get_certificate(STORE *e, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 int STORE_store_certificate(STORE *e, X509 *data, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 int STORE_modify_certificate(STORE *e, OPENSSL_ITEM search_attributes[],
-	OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[],
-	OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[],
+    OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
 int STORE_revoke_certificate(STORE *e, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 int STORE_delete_certificate(STORE *e, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 void *STORE_list_certificate_start(STORE *e, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 X509 *STORE_list_certificate_next(STORE *e, void *handle);
 int STORE_list_certificate_end(STORE *e, void *handle);
 int STORE_list_certificate_endp(STORE *e, void *handle);
 EVP_PKEY *STORE_generate_key(STORE *e, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 EVP_PKEY *STORE_get_private_key(STORE *e, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 int STORE_store_private_key(STORE *e, EVP_PKEY *data,
-	OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
 int STORE_modify_private_key(STORE *e, OPENSSL_ITEM search_attributes[],
-	OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
-	OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
+    OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
 int STORE_revoke_private_key(STORE *e, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 int STORE_delete_private_key(STORE *e, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 void *STORE_list_private_key_start(STORE *e, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 EVP_PKEY *STORE_list_private_key_next(STORE *e, void *handle);
 int STORE_list_private_key_end(STORE *e, void *handle);
 int STORE_list_private_key_endp(STORE *e, void *handle);
 EVP_PKEY *STORE_get_public_key(STORE *e, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 int STORE_store_public_key(STORE *e, EVP_PKEY *data, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 int STORE_modify_public_key(STORE *e, OPENSSL_ITEM search_attributes[],
-	OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
-	OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
+    OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
 int STORE_revoke_public_key(STORE *e, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 int STORE_delete_public_key(STORE *e, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 void *STORE_list_public_key_start(STORE *e, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 EVP_PKEY *STORE_list_public_key_next(STORE *e, void *handle);
 int STORE_list_public_key_end(STORE *e, void *handle);
 int STORE_list_public_key_endp(STORE *e, void *handle);
 X509_CRL *STORE_generate_crl(STORE *e, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 X509_CRL *STORE_get_crl(STORE *e, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 int STORE_store_crl(STORE *e, X509_CRL *data, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 int STORE_modify_crl(STORE *e, OPENSSL_ITEM search_attributes[],
-	OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
-	OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
+    OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
 int STORE_delete_crl(STORE *e, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 void *STORE_list_crl_start(STORE *e, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 X509_CRL *STORE_list_crl_next(STORE *e, void *handle);
 int STORE_list_crl_end(STORE *e, void *handle);
 int STORE_list_crl_endp(STORE *e, void *handle);
 int STORE_store_number(STORE *e, BIGNUM *data, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 int STORE_modify_number(STORE *e, OPENSSL_ITEM search_attributes[],
-	OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
-	OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
+    OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
 BIGNUM *STORE_get_number(STORE *e, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 int STORE_delete_number(STORE *e, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 int STORE_store_arbitrary(STORE *e, BUF_MEM *data, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 int STORE_modify_arbitrary(STORE *e, OPENSSL_ITEM search_attributes[],
-	OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
-	OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
+    OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
 BUF_MEM *STORE_get_arbitrary(STORE *e, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 int STORE_delete_arbitrary(STORE *e, OPENSSL_ITEM attributes[],
-	OPENSSL_ITEM parameters[]);
+    OPENSSL_ITEM parameters[]);
 
 
 /* Create and manipulate methods */
@@ -386,25 +386,25 @@ int STORE_ATTR_INFO_free(STORE_ATTR_INFO *attrs);
 /* Manipulators */
 char *STORE_ATTR_INFO_get0_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code);
 unsigned char *STORE_ATTR_INFO_get0_sha1str(STORE_ATTR_INFO *attrs,
-	STORE_ATTR_TYPES code);
+    STORE_ATTR_TYPES code);
 X509_NAME *STORE_ATTR_INFO_get0_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code);
 BIGNUM *STORE_ATTR_INFO_get0_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code);
 int STORE_ATTR_INFO_set_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
-	char *cstr, size_t cstr_size);
+    char *cstr, size_t cstr_size);
 int STORE_ATTR_INFO_set_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
-	unsigned char *sha1str, size_t sha1str_size);
+    unsigned char *sha1str, size_t sha1str_size);
 int STORE_ATTR_INFO_set_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
-	X509_NAME *dn);
+    X509_NAME *dn);
 int STORE_ATTR_INFO_set_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
-	BIGNUM *number);
+    BIGNUM *number);
 int STORE_ATTR_INFO_modify_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
-	char *cstr, size_t cstr_size);
+    char *cstr, size_t cstr_size);
 int STORE_ATTR_INFO_modify_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
-	unsigned char *sha1str, size_t sha1str_size);
+    unsigned char *sha1str, size_t sha1str_size);
 int STORE_ATTR_INFO_modify_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
-	X509_NAME *dn);
+    X509_NAME *dn);
 int STORE_ATTR_INFO_modify_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
-	BIGNUM *number);
+    BIGNUM *number);
 
 /* Compare on basis of a bit pattern formed by the STORE_ATTR_TYPES values
    in each contained attribute. */
@@ -427,126 +427,126 @@ void ERR_load_STORE_strings(void);
 /* Error codes for the STORE functions. */
 
 /* Function codes. */
-#define STORE_F_MEM_DELETE				 134
-#define STORE_F_MEM_GENERATE				 135
-#define STORE_F_MEM_LIST_END				 168
-#define STORE_F_MEM_LIST_NEXT				 136
-#define STORE_F_MEM_LIST_START				 137
-#define STORE_F_MEM_MODIFY				 169
-#define STORE_F_MEM_STORE				 138
-#define STORE_F_STORE_ATTR_INFO_GET0_CSTR		 139
-#define STORE_F_STORE_ATTR_INFO_GET0_DN			 140
-#define STORE_F_STORE_ATTR_INFO_GET0_NUMBER		 141
-#define STORE_F_STORE_ATTR_INFO_GET0_SHA1STR		 142
-#define STORE_F_STORE_ATTR_INFO_MODIFY_CSTR		 143
-#define STORE_F_STORE_ATTR_INFO_MODIFY_DN		 144
-#define STORE_F_STORE_ATTR_INFO_MODIFY_NUMBER		 145
-#define STORE_F_STORE_ATTR_INFO_MODIFY_SHA1STR		 146
-#define STORE_F_STORE_ATTR_INFO_SET_CSTR		 147
-#define STORE_F_STORE_ATTR_INFO_SET_DN			 148
-#define STORE_F_STORE_ATTR_INFO_SET_NUMBER		 149
-#define STORE_F_STORE_ATTR_INFO_SET_SHA1STR		 150
-#define STORE_F_STORE_CERTIFICATE			 170
-#define STORE_F_STORE_CTRL				 161
-#define STORE_F_STORE_DELETE_ARBITRARY			 158
-#define STORE_F_STORE_DELETE_CERTIFICATE		 102
-#define STORE_F_STORE_DELETE_CRL			 103
-#define STORE_F_STORE_DELETE_NUMBER			 104
-#define STORE_F_STORE_DELETE_PRIVATE_KEY		 105
-#define STORE_F_STORE_DELETE_PUBLIC_KEY			 106
-#define STORE_F_STORE_GENERATE_CRL			 107
-#define STORE_F_STORE_GENERATE_KEY			 108
-#define STORE_F_STORE_GET_ARBITRARY			 159
-#define STORE_F_STORE_GET_CERTIFICATE			 109
-#define STORE_F_STORE_GET_CRL				 110
-#define STORE_F_STORE_GET_NUMBER			 111
-#define STORE_F_STORE_GET_PRIVATE_KEY			 112
-#define STORE_F_STORE_GET_PUBLIC_KEY			 113
-#define STORE_F_STORE_LIST_CERTIFICATE_END		 114
-#define STORE_F_STORE_LIST_CERTIFICATE_ENDP		 153
-#define STORE_F_STORE_LIST_CERTIFICATE_NEXT		 115
-#define STORE_F_STORE_LIST_CERTIFICATE_START		 116
-#define STORE_F_STORE_LIST_CRL_END			 117
-#define STORE_F_STORE_LIST_CRL_ENDP			 154
-#define STORE_F_STORE_LIST_CRL_NEXT			 118
-#define STORE_F_STORE_LIST_CRL_START			 119
-#define STORE_F_STORE_LIST_PRIVATE_KEY_END		 120
-#define STORE_F_STORE_LIST_PRIVATE_KEY_ENDP		 155
-#define STORE_F_STORE_LIST_PRIVATE_KEY_NEXT		 121
-#define STORE_F_STORE_LIST_PRIVATE_KEY_START		 122
-#define STORE_F_STORE_LIST_PUBLIC_KEY_END		 123
-#define STORE_F_STORE_LIST_PUBLIC_KEY_ENDP		 156
-#define STORE_F_STORE_LIST_PUBLIC_KEY_NEXT		 124
-#define STORE_F_STORE_LIST_PUBLIC_KEY_START		 125
-#define STORE_F_STORE_MODIFY_ARBITRARY			 162
-#define STORE_F_STORE_MODIFY_CERTIFICATE		 163
-#define STORE_F_STORE_MODIFY_CRL			 164
-#define STORE_F_STORE_MODIFY_NUMBER			 165
-#define STORE_F_STORE_MODIFY_PRIVATE_KEY		 166
-#define STORE_F_STORE_MODIFY_PUBLIC_KEY			 167
-#define STORE_F_STORE_NEW_ENGINE			 133
-#define STORE_F_STORE_NEW_METHOD			 132
-#define STORE_F_STORE_PARSE_ATTRS_END			 151
-#define STORE_F_STORE_PARSE_ATTRS_ENDP			 172
-#define STORE_F_STORE_PARSE_ATTRS_NEXT			 152
-#define STORE_F_STORE_PARSE_ATTRS_START			 171
-#define STORE_F_STORE_REVOKE_CERTIFICATE		 129
-#define STORE_F_STORE_REVOKE_PRIVATE_KEY		 130
-#define STORE_F_STORE_REVOKE_PUBLIC_KEY			 131
-#define STORE_F_STORE_STORE_ARBITRARY			 157
-#define STORE_F_STORE_STORE_CERTIFICATE			 100
-#define STORE_F_STORE_STORE_CRL				 101
-#define STORE_F_STORE_STORE_NUMBER			 126
-#define STORE_F_STORE_STORE_PRIVATE_KEY			 127
-#define STORE_F_STORE_STORE_PUBLIC_KEY			 128
+#define STORE_F_MEM_DELETE               134
+#define STORE_F_MEM_GENERATE                 135
+#define STORE_F_MEM_LIST_END                 168
+#define STORE_F_MEM_LIST_NEXT                136
+#define STORE_F_MEM_LIST_START               137
+#define STORE_F_MEM_MODIFY               169
+#define STORE_F_MEM_STORE                138
+#define STORE_F_STORE_ATTR_INFO_GET0_CSTR        139
+#define STORE_F_STORE_ATTR_INFO_GET0_DN          140
+#define STORE_F_STORE_ATTR_INFO_GET0_NUMBER      141
+#define STORE_F_STORE_ATTR_INFO_GET0_SHA1STR         142
+#define STORE_F_STORE_ATTR_INFO_MODIFY_CSTR      143
+#define STORE_F_STORE_ATTR_INFO_MODIFY_DN        144
+#define STORE_F_STORE_ATTR_INFO_MODIFY_NUMBER        145
+#define STORE_F_STORE_ATTR_INFO_MODIFY_SHA1STR       146
+#define STORE_F_STORE_ATTR_INFO_SET_CSTR         147
+#define STORE_F_STORE_ATTR_INFO_SET_DN           148
+#define STORE_F_STORE_ATTR_INFO_SET_NUMBER       149
+#define STORE_F_STORE_ATTR_INFO_SET_SHA1STR      150
+#define STORE_F_STORE_CERTIFICATE            170
+#define STORE_F_STORE_CTRL               161
+#define STORE_F_STORE_DELETE_ARBITRARY           158
+#define STORE_F_STORE_DELETE_CERTIFICATE         102
+#define STORE_F_STORE_DELETE_CRL             103
+#define STORE_F_STORE_DELETE_NUMBER          104
+#define STORE_F_STORE_DELETE_PRIVATE_KEY         105
+#define STORE_F_STORE_DELETE_PUBLIC_KEY          106
+#define STORE_F_STORE_GENERATE_CRL           107
+#define STORE_F_STORE_GENERATE_KEY           108
+#define STORE_F_STORE_GET_ARBITRARY          159
+#define STORE_F_STORE_GET_CERTIFICATE            109
+#define STORE_F_STORE_GET_CRL                110
+#define STORE_F_STORE_GET_NUMBER             111
+#define STORE_F_STORE_GET_PRIVATE_KEY            112
+#define STORE_F_STORE_GET_PUBLIC_KEY             113
+#define STORE_F_STORE_LIST_CERTIFICATE_END       114
+#define STORE_F_STORE_LIST_CERTIFICATE_ENDP      153
+#define STORE_F_STORE_LIST_CERTIFICATE_NEXT      115
+#define STORE_F_STORE_LIST_CERTIFICATE_START         116
+#define STORE_F_STORE_LIST_CRL_END           117
+#define STORE_F_STORE_LIST_CRL_ENDP          154
+#define STORE_F_STORE_LIST_CRL_NEXT          118
+#define STORE_F_STORE_LIST_CRL_START             119
+#define STORE_F_STORE_LIST_PRIVATE_KEY_END       120
+#define STORE_F_STORE_LIST_PRIVATE_KEY_ENDP      155
+#define STORE_F_STORE_LIST_PRIVATE_KEY_NEXT      121
+#define STORE_F_STORE_LIST_PRIVATE_KEY_START         122
+#define STORE_F_STORE_LIST_PUBLIC_KEY_END        123
+#define STORE_F_STORE_LIST_PUBLIC_KEY_ENDP       156
+#define STORE_F_STORE_LIST_PUBLIC_KEY_NEXT       124
+#define STORE_F_STORE_LIST_PUBLIC_KEY_START      125
+#define STORE_F_STORE_MODIFY_ARBITRARY           162
+#define STORE_F_STORE_MODIFY_CERTIFICATE         163
+#define STORE_F_STORE_MODIFY_CRL             164
+#define STORE_F_STORE_MODIFY_NUMBER          165
+#define STORE_F_STORE_MODIFY_PRIVATE_KEY         166
+#define STORE_F_STORE_MODIFY_PUBLIC_KEY          167
+#define STORE_F_STORE_NEW_ENGINE             133
+#define STORE_F_STORE_NEW_METHOD             132
+#define STORE_F_STORE_PARSE_ATTRS_END            151
+#define STORE_F_STORE_PARSE_ATTRS_ENDP           172
+#define STORE_F_STORE_PARSE_ATTRS_NEXT           152
+#define STORE_F_STORE_PARSE_ATTRS_START          171
+#define STORE_F_STORE_REVOKE_CERTIFICATE         129
+#define STORE_F_STORE_REVOKE_PRIVATE_KEY         130
+#define STORE_F_STORE_REVOKE_PUBLIC_KEY          131
+#define STORE_F_STORE_STORE_ARBITRARY            157
+#define STORE_F_STORE_STORE_CERTIFICATE          100
+#define STORE_F_STORE_STORE_CRL              101
+#define STORE_F_STORE_STORE_NUMBER           126
+#define STORE_F_STORE_STORE_PRIVATE_KEY          127
+#define STORE_F_STORE_STORE_PUBLIC_KEY           128
 
 /* Reason codes. */
-#define STORE_R_ALREADY_HAS_A_VALUE			 127
-#define STORE_R_FAILED_DELETING_ARBITRARY		 132
-#define STORE_R_FAILED_DELETING_CERTIFICATE		 100
-#define STORE_R_FAILED_DELETING_KEY			 101
-#define STORE_R_FAILED_DELETING_NUMBER			 102
-#define STORE_R_FAILED_GENERATING_CRL			 103
-#define STORE_R_FAILED_GENERATING_KEY			 104
-#define STORE_R_FAILED_GETTING_ARBITRARY		 133
-#define STORE_R_FAILED_GETTING_CERTIFICATE		 105
-#define STORE_R_FAILED_GETTING_KEY			 106
-#define STORE_R_FAILED_GETTING_NUMBER			 107
-#define STORE_R_FAILED_LISTING_CERTIFICATES		 108
-#define STORE_R_FAILED_LISTING_KEYS			 109
-#define STORE_R_FAILED_MODIFYING_ARBITRARY		 138
-#define STORE_R_FAILED_MODIFYING_CERTIFICATE		 139
-#define STORE_R_FAILED_MODIFYING_CRL			 140
-#define STORE_R_FAILED_MODIFYING_NUMBER			 141
-#define STORE_R_FAILED_MODIFYING_PRIVATE_KEY		 142
-#define STORE_R_FAILED_MODIFYING_PUBLIC_KEY		 143
-#define STORE_R_FAILED_REVOKING_CERTIFICATE		 110
-#define STORE_R_FAILED_REVOKING_KEY			 111
-#define STORE_R_FAILED_STORING_ARBITRARY		 134
-#define STORE_R_FAILED_STORING_CERTIFICATE		 112
-#define STORE_R_FAILED_STORING_KEY			 113
-#define STORE_R_FAILED_STORING_NUMBER			 114
-#define STORE_R_NOT_IMPLEMENTED				 128
-#define STORE_R_NO_CONTROL_FUNCTION			 144
-#define STORE_R_NO_DELETE_ARBITRARY_FUNCTION		 135
-#define STORE_R_NO_DELETE_NUMBER_FUNCTION		 115
-#define STORE_R_NO_DELETE_OBJECT_FUNCTION		 116
-#define STORE_R_NO_GENERATE_CRL_FUNCTION		 117
-#define STORE_R_NO_GENERATE_OBJECT_FUNCTION		 118
-#define STORE_R_NO_GET_OBJECT_ARBITRARY_FUNCTION	 136
-#define STORE_R_NO_GET_OBJECT_FUNCTION			 119
-#define STORE_R_NO_GET_OBJECT_NUMBER_FUNCTION		 120
-#define STORE_R_NO_LIST_OBJECT_ENDP_FUNCTION		 131
-#define STORE_R_NO_LIST_OBJECT_END_FUNCTION		 121
-#define STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION		 122
-#define STORE_R_NO_LIST_OBJECT_START_FUNCTION		 123
-#define STORE_R_NO_MODIFY_OBJECT_FUNCTION		 145
-#define STORE_R_NO_REVOKE_OBJECT_FUNCTION		 124
-#define STORE_R_NO_STORE				 129
-#define STORE_R_NO_STORE_OBJECT_ARBITRARY_FUNCTION	 137
-#define STORE_R_NO_STORE_OBJECT_FUNCTION		 125
-#define STORE_R_NO_STORE_OBJECT_NUMBER_FUNCTION		 126
-#define STORE_R_NO_VALUE				 130
+#define STORE_R_ALREADY_HAS_A_VALUE          127
+#define STORE_R_FAILED_DELETING_ARBITRARY        132
+#define STORE_R_FAILED_DELETING_CERTIFICATE      100
+#define STORE_R_FAILED_DELETING_KEY          101
+#define STORE_R_FAILED_DELETING_NUMBER           102
+#define STORE_R_FAILED_GENERATING_CRL            103
+#define STORE_R_FAILED_GENERATING_KEY            104
+#define STORE_R_FAILED_GETTING_ARBITRARY         133
+#define STORE_R_FAILED_GETTING_CERTIFICATE       105
+#define STORE_R_FAILED_GETTING_KEY           106
+#define STORE_R_FAILED_GETTING_NUMBER            107
+#define STORE_R_FAILED_LISTING_CERTIFICATES      108
+#define STORE_R_FAILED_LISTING_KEYS          109
+#define STORE_R_FAILED_MODIFYING_ARBITRARY       138
+#define STORE_R_FAILED_MODIFYING_CERTIFICATE         139
+#define STORE_R_FAILED_MODIFYING_CRL             140
+#define STORE_R_FAILED_MODIFYING_NUMBER          141
+#define STORE_R_FAILED_MODIFYING_PRIVATE_KEY         142
+#define STORE_R_FAILED_MODIFYING_PUBLIC_KEY      143
+#define STORE_R_FAILED_REVOKING_CERTIFICATE      110
+#define STORE_R_FAILED_REVOKING_KEY          111
+#define STORE_R_FAILED_STORING_ARBITRARY         134
+#define STORE_R_FAILED_STORING_CERTIFICATE       112
+#define STORE_R_FAILED_STORING_KEY           113
+#define STORE_R_FAILED_STORING_NUMBER            114
+#define STORE_R_NOT_IMPLEMENTED              128
+#define STORE_R_NO_CONTROL_FUNCTION          144
+#define STORE_R_NO_DELETE_ARBITRARY_FUNCTION         135
+#define STORE_R_NO_DELETE_NUMBER_FUNCTION        115
+#define STORE_R_NO_DELETE_OBJECT_FUNCTION        116
+#define STORE_R_NO_GENERATE_CRL_FUNCTION         117
+#define STORE_R_NO_GENERATE_OBJECT_FUNCTION      118
+#define STORE_R_NO_GET_OBJECT_ARBITRARY_FUNCTION     136
+#define STORE_R_NO_GET_OBJECT_FUNCTION           119
+#define STORE_R_NO_GET_OBJECT_NUMBER_FUNCTION        120
+#define STORE_R_NO_LIST_OBJECT_ENDP_FUNCTION         131
+#define STORE_R_NO_LIST_OBJECT_END_FUNCTION      121
+#define STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION         122
+#define STORE_R_NO_LIST_OBJECT_START_FUNCTION        123
+#define STORE_R_NO_MODIFY_OBJECT_FUNCTION        145
+#define STORE_R_NO_REVOKE_OBJECT_FUNCTION        124
+#define STORE_R_NO_STORE                 129
+#define STORE_R_NO_STORE_OBJECT_ARBITRARY_FUNCTION   137
+#define STORE_R_NO_STORE_OBJECT_FUNCTION         125
+#define STORE_R_NO_STORE_OBJECT_NUMBER_FUNCTION      126
+#define STORE_R_NO_VALUE                 130
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/symhacks.h b/dep/include/openssl/symhacks.h
index 7e3602d2ea4..b4f1f8399ea 100644
--- a/dep/include/openssl/symhacks.h
+++ b/dep/include/openssl/symhacks.h
@@ -6,7 +6,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -64,75 +64,75 @@
 
 /* Hack a long name in crypto/ex_data.c */
 #undef CRYPTO_get_ex_data_implementation
-#define CRYPTO_get_ex_data_implementation	CRYPTO_get_ex_data_impl
+#define CRYPTO_get_ex_data_implementation   CRYPTO_get_ex_data_impl
 #undef CRYPTO_set_ex_data_implementation
-#define CRYPTO_set_ex_data_implementation	CRYPTO_set_ex_data_impl
+#define CRYPTO_set_ex_data_implementation   CRYPTO_set_ex_data_impl
 
 /* Hack a long name in crypto/asn1/a_mbstr.c */
 #undef ASN1_STRING_set_default_mask_asc
-#define ASN1_STRING_set_default_mask_asc	ASN1_STRING_set_def_mask_asc
+#define ASN1_STRING_set_default_mask_asc    ASN1_STRING_set_def_mask_asc
 
 #if 0 /* No longer needed, since safestack macro magic does the job */
 /* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO) */
 #undef i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO
-#define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO	i2d_ASN1_SET_OF_PKCS7_SIGINF
+#define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO   i2d_ASN1_SET_OF_PKCS7_SIGINF
 #undef d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO
-#define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO	d2i_ASN1_SET_OF_PKCS7_SIGINF
+#define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO   d2i_ASN1_SET_OF_PKCS7_SIGINF
 #endif
 
 #if 0 /* No longer needed, since safestack macro magic does the job */
 /* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO) */
 #undef i2d_ASN1_SET_OF_PKCS7_RECIP_INFO
-#define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO	i2d_ASN1_SET_OF_PKCS7_RECINF
+#define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO    i2d_ASN1_SET_OF_PKCS7_RECINF
 #undef d2i_ASN1_SET_OF_PKCS7_RECIP_INFO
-#define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO	d2i_ASN1_SET_OF_PKCS7_RECINF
+#define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO    d2i_ASN1_SET_OF_PKCS7_RECINF
 #endif
 
 #if 0 /* No longer needed, since safestack macro magic does the job */
 /* Hack the names created with DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION) */
 #undef i2d_ASN1_SET_OF_ACCESS_DESCRIPTION
-#define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION	i2d_ASN1_SET_OF_ACC_DESC
+#define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION  i2d_ASN1_SET_OF_ACC_DESC
 #undef d2i_ASN1_SET_OF_ACCESS_DESCRIPTION
-#define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION	d2i_ASN1_SET_OF_ACC_DESC
+#define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION  d2i_ASN1_SET_OF_ACC_DESC
 #endif
 
 /* Hack the names created with DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE) */
 #undef PEM_read_NETSCAPE_CERT_SEQUENCE
-#define PEM_read_NETSCAPE_CERT_SEQUENCE		PEM_read_NS_CERT_SEQ
+#define PEM_read_NETSCAPE_CERT_SEQUENCE     PEM_read_NS_CERT_SEQ
 #undef PEM_write_NETSCAPE_CERT_SEQUENCE
-#define PEM_write_NETSCAPE_CERT_SEQUENCE	PEM_write_NS_CERT_SEQ
+#define PEM_write_NETSCAPE_CERT_SEQUENCE    PEM_write_NS_CERT_SEQ
 #undef PEM_read_bio_NETSCAPE_CERT_SEQUENCE
-#define PEM_read_bio_NETSCAPE_CERT_SEQUENCE	PEM_read_bio_NS_CERT_SEQ
+#define PEM_read_bio_NETSCAPE_CERT_SEQUENCE PEM_read_bio_NS_CERT_SEQ
 #undef PEM_write_bio_NETSCAPE_CERT_SEQUENCE
-#define PEM_write_bio_NETSCAPE_CERT_SEQUENCE	PEM_write_bio_NS_CERT_SEQ
+#define PEM_write_bio_NETSCAPE_CERT_SEQUENCE    PEM_write_bio_NS_CERT_SEQ
 #undef PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE
-#define PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE	PEM_write_cb_bio_NS_CERT_SEQ
+#define PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE PEM_write_cb_bio_NS_CERT_SEQ
 
 /* Hack the names created with DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO) */
 #undef PEM_read_PKCS8_PRIV_KEY_INFO
-#define PEM_read_PKCS8_PRIV_KEY_INFO		PEM_read_P8_PRIV_KEY_INFO
+#define PEM_read_PKCS8_PRIV_KEY_INFO        PEM_read_P8_PRIV_KEY_INFO
 #undef PEM_write_PKCS8_PRIV_KEY_INFO
-#define PEM_write_PKCS8_PRIV_KEY_INFO		PEM_write_P8_PRIV_KEY_INFO
+#define PEM_write_PKCS8_PRIV_KEY_INFO       PEM_write_P8_PRIV_KEY_INFO
 #undef PEM_read_bio_PKCS8_PRIV_KEY_INFO
-#define PEM_read_bio_PKCS8_PRIV_KEY_INFO	PEM_read_bio_P8_PRIV_KEY_INFO
+#define PEM_read_bio_PKCS8_PRIV_KEY_INFO    PEM_read_bio_P8_PRIV_KEY_INFO
 #undef PEM_write_bio_PKCS8_PRIV_KEY_INFO
-#define PEM_write_bio_PKCS8_PRIV_KEY_INFO	PEM_write_bio_P8_PRIV_KEY_INFO
+#define PEM_write_bio_PKCS8_PRIV_KEY_INFO   PEM_write_bio_P8_PRIV_KEY_INFO
 #undef PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO
-#define PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO	PEM_wrt_cb_bio_P8_PRIV_KEY_INFO
+#define PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO    PEM_wrt_cb_bio_P8_PRIV_KEY_INFO
 
 /* Hack other PEM names */
 #undef PEM_write_bio_PKCS8PrivateKey_nid
-#define PEM_write_bio_PKCS8PrivateKey_nid	PEM_write_bio_PKCS8PrivKey_nid
+#define PEM_write_bio_PKCS8PrivateKey_nid   PEM_write_bio_PKCS8PrivKey_nid
 
 /* Hack some long X509 names */
 #undef X509_REVOKED_get_ext_by_critical
-#define X509_REVOKED_get_ext_by_critical	X509_REVOKED_get_ext_by_critic
+#define X509_REVOKED_get_ext_by_critical    X509_REVOKED_get_ext_by_critic
 #undef X509_policy_tree_get0_user_policies
-#define X509_policy_tree_get0_user_policies	X509_pcy_tree_get0_usr_policies
+#define X509_policy_tree_get0_user_policies X509_pcy_tree_get0_usr_policies
 #undef X509_policy_node_get0_qualifiers
-#define X509_policy_node_get0_qualifiers	X509_pcy_node_get0_qualifiers
+#define X509_policy_node_get0_qualifiers    X509_pcy_node_get0_qualifiers
 #undef X509_STORE_CTX_get_explicit_policy
-#define X509_STORE_CTX_get_explicit_policy	X509_STORE_CTX_get_expl_policy
+#define X509_STORE_CTX_get_explicit_policy  X509_STORE_CTX_get_expl_policy
 
 /* Hack some long CRYPTO names */
 #undef CRYPTO_set_dynlock_destroy_callback
@@ -168,13 +168,13 @@
 #undef SSL_CTX_set_default_passwd_cb_userdata
 #define SSL_CTX_set_default_passwd_cb_userdata  SSL_CTX_set_def_passwd_cb_ud
 #undef SSL_COMP_get_compression_methods
-#define SSL_COMP_get_compression_methods	SSL_COMP_get_compress_methods
+#define SSL_COMP_get_compression_methods    SSL_COMP_get_compress_methods
 
 /* Hack some long ENGINE names */
 #undef ENGINE_get_default_BN_mod_exp_crt
-#define ENGINE_get_default_BN_mod_exp_crt	ENGINE_get_def_BN_mod_exp_crt
+#define ENGINE_get_default_BN_mod_exp_crt   ENGINE_get_def_BN_mod_exp_crt
 #undef ENGINE_set_default_BN_mod_exp_crt
-#define ENGINE_set_default_BN_mod_exp_crt	ENGINE_set_def_BN_mod_exp_crt
+#define ENGINE_set_default_BN_mod_exp_crt   ENGINE_set_def_BN_mod_exp_crt
 #undef ENGINE_set_load_privkey_function
 #define ENGINE_set_load_privkey_function        ENGINE_set_load_privkey_fn
 #undef ENGINE_get_load_privkey_function
@@ -190,23 +190,23 @@
 
 /* Hack some long DES names */
 #undef _ossl_old_des_ede3_cfb64_encrypt
-#define _ossl_old_des_ede3_cfb64_encrypt	_ossl_odes_ede3_cfb64_encrypt
+#define _ossl_old_des_ede3_cfb64_encrypt    _ossl_odes_ede3_cfb64_encrypt
 #undef _ossl_old_des_ede3_ofb64_encrypt
-#define _ossl_old_des_ede3_ofb64_encrypt	_ossl_odes_ede3_ofb64_encrypt
+#define _ossl_old_des_ede3_ofb64_encrypt    _ossl_odes_ede3_ofb64_encrypt
 
 /* Hack some long EVP names */
 #undef OPENSSL_add_all_algorithms_noconf
-#define OPENSSL_add_all_algorithms_noconf	OPENSSL_add_all_algo_noconf
+#define OPENSSL_add_all_algorithms_noconf   OPENSSL_add_all_algo_noconf
 #undef OPENSSL_add_all_algorithms_conf
-#define OPENSSL_add_all_algorithms_conf		OPENSSL_add_all_algo_conf
+#define OPENSSL_add_all_algorithms_conf     OPENSSL_add_all_algo_conf
 
 /* Hack some long EC names */
 #undef EC_GROUP_set_point_conversion_form
-#define EC_GROUP_set_point_conversion_form	EC_GROUP_set_point_conv_form
+#define EC_GROUP_set_point_conversion_form  EC_GROUP_set_point_conv_form
 #undef EC_GROUP_get_point_conversion_form
-#define EC_GROUP_get_point_conversion_form	EC_GROUP_get_point_conv_form
+#define EC_GROUP_get_point_conversion_form  EC_GROUP_get_point_conv_form
 #undef EC_GROUP_clear_free_all_extra_data
-#define EC_GROUP_clear_free_all_extra_data	EC_GROUP_clr_free_all_xtra_data
+#define EC_GROUP_clear_free_all_extra_data  EC_GROUP_clr_free_all_xtra_data
 #undef EC_POINT_set_Jprojective_coordinates_GFp
 #define EC_POINT_set_Jprojective_coordinates_GFp \
                                                 EC_POINT_set_Jproj_coords_GFp
@@ -229,7 +229,7 @@
 #undef ec_GF2m_simple_group_clear_finish
 #define ec_GF2m_simple_group_clear_finish        ec_GF2m_simple_grp_clr_finish
 #undef ec_GF2m_simple_group_check_discriminant
-#define ec_GF2m_simple_group_check_discriminant	ec_GF2m_simple_grp_chk_discrim
+#define ec_GF2m_simple_group_check_discriminant ec_GF2m_simple_grp_chk_discrim
 #undef ec_GF2m_simple_point_clear_finish
 #define ec_GF2m_simple_point_clear_finish        ec_GF2m_simple_pt_clr_finish
 #undef ec_GF2m_simple_point_set_to_infinity
@@ -290,57 +290,57 @@
 #define ec_GFp_simple_set_compressed_coordinates \
                                                 ec_GFp_smp_set_compr_coords
 #undef ec_GFp_simple_group_check_discriminant
-#define ec_GFp_simple_group_check_discriminant	ec_GFp_simple_grp_chk_discrim
+#define ec_GFp_simple_group_check_discriminant  ec_GFp_simple_grp_chk_discrim
 
 /* Hack som long STORE names */
 #undef STORE_method_set_initialise_function
-#define STORE_method_set_initialise_function	STORE_meth_set_initialise_fn
+#define STORE_method_set_initialise_function    STORE_meth_set_initialise_fn
 #undef STORE_method_set_cleanup_function
-#define STORE_method_set_cleanup_function	STORE_meth_set_cleanup_fn
+#define STORE_method_set_cleanup_function   STORE_meth_set_cleanup_fn
 #undef STORE_method_set_generate_function
-#define STORE_method_set_generate_function	STORE_meth_set_generate_fn
+#define STORE_method_set_generate_function  STORE_meth_set_generate_fn
 #undef STORE_method_set_modify_function
-#define STORE_method_set_modify_function	STORE_meth_set_modify_fn
+#define STORE_method_set_modify_function    STORE_meth_set_modify_fn
 #undef STORE_method_set_revoke_function
-#define STORE_method_set_revoke_function	STORE_meth_set_revoke_fn
+#define STORE_method_set_revoke_function    STORE_meth_set_revoke_fn
 #undef STORE_method_set_delete_function
-#define STORE_method_set_delete_function	STORE_meth_set_delete_fn
+#define STORE_method_set_delete_function    STORE_meth_set_delete_fn
 #undef STORE_method_set_list_start_function
-#define STORE_method_set_list_start_function	STORE_meth_set_list_start_fn
+#define STORE_method_set_list_start_function    STORE_meth_set_list_start_fn
 #undef STORE_method_set_list_next_function
-#define STORE_method_set_list_next_function	STORE_meth_set_list_next_fn
+#define STORE_method_set_list_next_function STORE_meth_set_list_next_fn
 #undef STORE_method_set_list_end_function
-#define STORE_method_set_list_end_function	STORE_meth_set_list_end_fn
+#define STORE_method_set_list_end_function  STORE_meth_set_list_end_fn
 #undef STORE_method_set_update_store_function
-#define STORE_method_set_update_store_function	STORE_meth_set_update_store_fn
+#define STORE_method_set_update_store_function  STORE_meth_set_update_store_fn
 #undef STORE_method_set_lock_store_function
-#define STORE_method_set_lock_store_function	STORE_meth_set_lock_store_fn
+#define STORE_method_set_lock_store_function    STORE_meth_set_lock_store_fn
 #undef STORE_method_set_unlock_store_function
-#define STORE_method_set_unlock_store_function	STORE_meth_set_unlock_store_fn
+#define STORE_method_set_unlock_store_function  STORE_meth_set_unlock_store_fn
 #undef STORE_method_get_initialise_function
-#define STORE_method_get_initialise_function	STORE_meth_get_initialise_fn
+#define STORE_method_get_initialise_function    STORE_meth_get_initialise_fn
 #undef STORE_method_get_cleanup_function
-#define STORE_method_get_cleanup_function	STORE_meth_get_cleanup_fn
+#define STORE_method_get_cleanup_function   STORE_meth_get_cleanup_fn
 #undef STORE_method_get_generate_function
-#define STORE_method_get_generate_function	STORE_meth_get_generate_fn
+#define STORE_method_get_generate_function  STORE_meth_get_generate_fn
 #undef STORE_method_get_modify_function
-#define STORE_method_get_modify_function	STORE_meth_get_modify_fn
+#define STORE_method_get_modify_function    STORE_meth_get_modify_fn
 #undef STORE_method_get_revoke_function
-#define STORE_method_get_revoke_function	STORE_meth_get_revoke_fn
+#define STORE_method_get_revoke_function    STORE_meth_get_revoke_fn
 #undef STORE_method_get_delete_function
-#define STORE_method_get_delete_function	STORE_meth_get_delete_fn
+#define STORE_method_get_delete_function    STORE_meth_get_delete_fn
 #undef STORE_method_get_list_start_function
-#define STORE_method_get_list_start_function	STORE_meth_get_list_start_fn
+#define STORE_method_get_list_start_function    STORE_meth_get_list_start_fn
 #undef STORE_method_get_list_next_function
-#define STORE_method_get_list_next_function	STORE_meth_get_list_next_fn
+#define STORE_method_get_list_next_function STORE_meth_get_list_next_fn
 #undef STORE_method_get_list_end_function
-#define STORE_method_get_list_end_function	STORE_meth_get_list_end_fn
+#define STORE_method_get_list_end_function  STORE_meth_get_list_end_fn
 #undef STORE_method_get_update_store_function
-#define STORE_method_get_update_store_function	STORE_meth_get_update_store_fn
+#define STORE_method_get_update_store_function  STORE_meth_get_update_store_fn
 #undef STORE_method_get_lock_store_function
-#define STORE_method_get_lock_store_function	STORE_meth_get_lock_store_fn
+#define STORE_method_get_lock_store_function    STORE_meth_get_lock_store_fn
 #undef STORE_method_get_unlock_store_function
-#define STORE_method_get_unlock_store_function	STORE_meth_get_unlock_store_fn
+#define STORE_method_get_unlock_store_function  STORE_meth_get_unlock_store_fn
 
 #endif /* defined OPENSSL_SYS_VMS */
 
@@ -348,7 +348,7 @@
 /* Case insensiteve linking causes problems.... */
 #if defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2)
 #undef ERR_load_CRYPTO_strings
-#define ERR_load_CRYPTO_strings			ERR_load_CRYPTOlib_strings
+#define ERR_load_CRYPTO_strings         ERR_load_CRYPTOlib_strings
 #undef OCSP_crlID_new
 #define OCSP_crlID_new                          OCSP_crlID2_new
 
diff --git a/dep/include/openssl/tls1.h b/dep/include/openssl/tls1.h
index e5f9aa1ef6f..f7364ed5940 100644
--- a/dep/include/openssl/tls1.h
+++ b/dep/include/openssl/tls1.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -58,7 +58,7 @@
 /* ====================================================================
  * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
  *
- * Portions of the attached software ("Contribution") are developed by 
+ * Portions of the attached software ("Contribution") are developed by
  * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
  *
  * The Contribution is licensed pursuant to the OpenSSL open source
@@ -69,8 +69,8 @@
  *
  */
 
-#ifndef HEADER_TLS1_H 
-#define HEADER_TLS1_H 
+#ifndef HEADER_TLS1_H
+#define HEADER_TLS1_H
 
 #include 
 
@@ -78,67 +78,67 @@
 extern "C" {
 #endif
 
-#define TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES	0
+#define TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES    0
 
-#define TLS1_VERSION			0x0301
-#define TLS1_VERSION_MAJOR		0x03
-#define TLS1_VERSION_MINOR		0x01
+#define TLS1_VERSION            0x0301
+#define TLS1_VERSION_MAJOR      0x03
+#define TLS1_VERSION_MINOR      0x01
 
-#define TLS1_AD_DECRYPTION_FAILED	21
-#define TLS1_AD_RECORD_OVERFLOW		22
-#define TLS1_AD_UNKNOWN_CA		48	/* fatal */
-#define TLS1_AD_ACCESS_DENIED		49	/* fatal */
-#define TLS1_AD_DECODE_ERROR		50	/* fatal */
-#define TLS1_AD_DECRYPT_ERROR		51
-#define TLS1_AD_EXPORT_RESTRICTION	60	/* fatal */
-#define TLS1_AD_PROTOCOL_VERSION	70	/* fatal */
-#define TLS1_AD_INSUFFICIENT_SECURITY	71	/* fatal */
-#define TLS1_AD_INTERNAL_ERROR		80	/* fatal */
-#define TLS1_AD_USER_CANCELLED		90
-#define TLS1_AD_NO_RENEGOTIATION	100
+#define TLS1_AD_DECRYPTION_FAILED   21
+#define TLS1_AD_RECORD_OVERFLOW     22
+#define TLS1_AD_UNKNOWN_CA      48  /* fatal */
+#define TLS1_AD_ACCESS_DENIED       49  /* fatal */
+#define TLS1_AD_DECODE_ERROR        50  /* fatal */
+#define TLS1_AD_DECRYPT_ERROR       51
+#define TLS1_AD_EXPORT_RESTRICTION  60  /* fatal */
+#define TLS1_AD_PROTOCOL_VERSION    70  /* fatal */
+#define TLS1_AD_INSUFFICIENT_SECURITY   71  /* fatal */
+#define TLS1_AD_INTERNAL_ERROR      80  /* fatal */
+#define TLS1_AD_USER_CANCELLED      90
+#define TLS1_AD_NO_RENEGOTIATION    100
 
 /* Additional TLS ciphersuites from draft-ietf-tls-56-bit-ciphersuites-00.txt
  * (available if TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES is defined, see
  * s3_lib.c).  We actually treat them like SSL 3.0 ciphers, which we probably
  * shouldn't. */
-#define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_MD5		0x03000060
-#define TLS1_CK_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5	0x03000061
-#define TLS1_CK_RSA_EXPORT1024_WITH_DES_CBC_SHA		0x03000062
-#define TLS1_CK_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA	0x03000063
-#define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_SHA		0x03000064
-#define TLS1_CK_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA	0x03000065
-#define TLS1_CK_DHE_DSS_WITH_RC4_128_SHA		0x03000066
+#define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_MD5      0x03000060
+#define TLS1_CK_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5  0x03000061
+#define TLS1_CK_RSA_EXPORT1024_WITH_DES_CBC_SHA     0x03000062
+#define TLS1_CK_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA 0x03000063
+#define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_SHA      0x03000064
+#define TLS1_CK_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA  0x03000065
+#define TLS1_CK_DHE_DSS_WITH_RC4_128_SHA        0x03000066
 
 /* AES ciphersuites from RFC3268 */
 
-#define TLS1_CK_RSA_WITH_AES_128_SHA			0x0300002F
-#define TLS1_CK_DH_DSS_WITH_AES_128_SHA			0x03000030
-#define TLS1_CK_DH_RSA_WITH_AES_128_SHA			0x03000031
-#define TLS1_CK_DHE_DSS_WITH_AES_128_SHA		0x03000032
-#define TLS1_CK_DHE_RSA_WITH_AES_128_SHA		0x03000033
-#define TLS1_CK_ADH_WITH_AES_128_SHA			0x03000034
+#define TLS1_CK_RSA_WITH_AES_128_SHA            0x0300002F
+#define TLS1_CK_DH_DSS_WITH_AES_128_SHA         0x03000030
+#define TLS1_CK_DH_RSA_WITH_AES_128_SHA         0x03000031
+#define TLS1_CK_DHE_DSS_WITH_AES_128_SHA        0x03000032
+#define TLS1_CK_DHE_RSA_WITH_AES_128_SHA        0x03000033
+#define TLS1_CK_ADH_WITH_AES_128_SHA            0x03000034
 
-#define TLS1_CK_RSA_WITH_AES_256_SHA			0x03000035
-#define TLS1_CK_DH_DSS_WITH_AES_256_SHA			0x03000036
-#define TLS1_CK_DH_RSA_WITH_AES_256_SHA			0x03000037
-#define TLS1_CK_DHE_DSS_WITH_AES_256_SHA		0x03000038
-#define TLS1_CK_DHE_RSA_WITH_AES_256_SHA		0x03000039
-#define TLS1_CK_ADH_WITH_AES_256_SHA			0x0300003A
+#define TLS1_CK_RSA_WITH_AES_256_SHA            0x03000035
+#define TLS1_CK_DH_DSS_WITH_AES_256_SHA         0x03000036
+#define TLS1_CK_DH_RSA_WITH_AES_256_SHA         0x03000037
+#define TLS1_CK_DHE_DSS_WITH_AES_256_SHA        0x03000038
+#define TLS1_CK_DHE_RSA_WITH_AES_256_SHA        0x03000039
+#define TLS1_CK_ADH_WITH_AES_256_SHA            0x0300003A
 
 /* Camellia ciphersuites from RFC4132 */
-#define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA		0x03000041
-#define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA	0x03000042
-#define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA	0x03000043
-#define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA	0x03000044
-#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA	0x03000045
-#define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA		0x03000046
+#define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA       0x03000041
+#define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA    0x03000042
+#define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA    0x03000043
+#define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA   0x03000044
+#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA   0x03000045
+#define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA       0x03000046
 
-#define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA		0x03000084
-#define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA	0x03000085
-#define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA	0x03000086
-#define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA	0x03000087
-#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA	0x03000088
-#define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA		0x03000089
+#define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA       0x03000084
+#define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA    0x03000085
+#define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA    0x03000086
+#define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA   0x03000087
+#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA   0x03000088
+#define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA       0x03000089
 
 /* ECC ciphersuites from draft-ietf-tls-ecc-12.txt with changes soon to be in draft 13 */
 #define TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA                0x0300C001
@@ -178,28 +178,28 @@ extern "C" {
  * (The alias for the list of all such ciphers also is "EDH".)
  * The specifications speak of "EDH"; maybe we should allow both forms
  * for everything. */
-#define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_MD5		"EXP1024-RC4-MD5"
-#define TLS1_TXT_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5	"EXP1024-RC2-CBC-MD5"
-#define TLS1_TXT_RSA_EXPORT1024_WITH_DES_CBC_SHA	"EXP1024-DES-CBC-SHA"
-#define TLS1_TXT_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA	"EXP1024-DHE-DSS-DES-CBC-SHA"
-#define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_SHA		"EXP1024-RC4-SHA"
-#define TLS1_TXT_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA	"EXP1024-DHE-DSS-RC4-SHA"
-#define TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA		"DHE-DSS-RC4-SHA"
+#define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_MD5     "EXP1024-RC4-MD5"
+#define TLS1_TXT_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5 "EXP1024-RC2-CBC-MD5"
+#define TLS1_TXT_RSA_EXPORT1024_WITH_DES_CBC_SHA    "EXP1024-DES-CBC-SHA"
+#define TLS1_TXT_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA    "EXP1024-DHE-DSS-DES-CBC-SHA"
+#define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_SHA     "EXP1024-RC4-SHA"
+#define TLS1_TXT_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA "EXP1024-DHE-DSS-RC4-SHA"
+#define TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA       "DHE-DSS-RC4-SHA"
 
 /* AES ciphersuites from RFC3268 */
-#define TLS1_TXT_RSA_WITH_AES_128_SHA			"AES128-SHA"
-#define TLS1_TXT_DH_DSS_WITH_AES_128_SHA		"DH-DSS-AES128-SHA"
-#define TLS1_TXT_DH_RSA_WITH_AES_128_SHA		"DH-RSA-AES128-SHA"
-#define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA		"DHE-DSS-AES128-SHA"
-#define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA		"DHE-RSA-AES128-SHA"
-#define TLS1_TXT_ADH_WITH_AES_128_SHA			"ADH-AES128-SHA"
+#define TLS1_TXT_RSA_WITH_AES_128_SHA           "AES128-SHA"
+#define TLS1_TXT_DH_DSS_WITH_AES_128_SHA        "DH-DSS-AES128-SHA"
+#define TLS1_TXT_DH_RSA_WITH_AES_128_SHA        "DH-RSA-AES128-SHA"
+#define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA       "DHE-DSS-AES128-SHA"
+#define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA       "DHE-RSA-AES128-SHA"
+#define TLS1_TXT_ADH_WITH_AES_128_SHA           "ADH-AES128-SHA"
 
-#define TLS1_TXT_RSA_WITH_AES_256_SHA			"AES256-SHA"
-#define TLS1_TXT_DH_DSS_WITH_AES_256_SHA		"DH-DSS-AES256-SHA"
-#define TLS1_TXT_DH_RSA_WITH_AES_256_SHA		"DH-RSA-AES256-SHA"
-#define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA		"DHE-DSS-AES256-SHA"
-#define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA		"DHE-RSA-AES256-SHA"
-#define TLS1_TXT_ADH_WITH_AES_256_SHA			"ADH-AES256-SHA"
+#define TLS1_TXT_RSA_WITH_AES_256_SHA           "AES256-SHA"
+#define TLS1_TXT_DH_DSS_WITH_AES_256_SHA        "DH-DSS-AES256-SHA"
+#define TLS1_TXT_DH_RSA_WITH_AES_256_SHA        "DH-RSA-AES256-SHA"
+#define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA       "DHE-DSS-AES256-SHA"
+#define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA       "DHE-RSA-AES256-SHA"
+#define TLS1_TXT_ADH_WITH_AES_256_SHA           "ADH-AES256-SHA"
 
 /* ECC ciphersuites from draft-ietf-tls-ecc-01.txt (Mar 15, 2001) */
 #define TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA               "ECDH-ECDSA-NULL-SHA"
@@ -233,49 +233,49 @@ extern "C" {
 #define TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA         "AECDH-AES256-SHA"
 
 /* Camellia ciphersuites form RFC4132 */
-#define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA		"CAMELLIA128-SHA"
-#define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA	"DH-DSS-CAMELLIA128-SHA"
-#define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA	"DH-RSA-CAMELLIA128-SHA"
-#define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA	"DHE-DSS-CAMELLIA128-SHA"
-#define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA	"DHE-RSA-CAMELLIA128-SHA"
-#define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA		"ADH-CAMELLIA128-SHA"
+#define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA      "CAMELLIA128-SHA"
+#define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA   "DH-DSS-CAMELLIA128-SHA"
+#define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA   "DH-RSA-CAMELLIA128-SHA"
+#define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA  "DHE-DSS-CAMELLIA128-SHA"
+#define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA  "DHE-RSA-CAMELLIA128-SHA"
+#define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA      "ADH-CAMELLIA128-SHA"
 
-#define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA		"CAMELLIA256-SHA"
-#define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA	"DH-DSS-CAMELLIA256-SHA"
-#define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA	"DH-RSA-CAMELLIA256-SHA"
-#define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA	"DHE-DSS-CAMELLIA256-SHA"
-#define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA	"DHE-RSA-CAMELLIA256-SHA"
-#define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA		"ADH-CAMELLIA256-SHA"
+#define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA      "CAMELLIA256-SHA"
+#define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA   "DH-DSS-CAMELLIA256-SHA"
+#define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA   "DH-RSA-CAMELLIA256-SHA"
+#define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA  "DHE-DSS-CAMELLIA256-SHA"
+#define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA  "DHE-RSA-CAMELLIA256-SHA"
+#define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA      "ADH-CAMELLIA256-SHA"
 
 
-#define TLS_CT_RSA_SIGN			1
-#define TLS_CT_DSS_SIGN			2
-#define TLS_CT_RSA_FIXED_DH		3
-#define TLS_CT_DSS_FIXED_DH		4
-#define TLS_CT_ECDSA_SIGN		64
-#define TLS_CT_RSA_FIXED_ECDH		65
-#define TLS_CT_ECDSA_FIXED_ECDH 	66
-#define TLS_CT_NUMBER			7
+#define TLS_CT_RSA_SIGN         1
+#define TLS_CT_DSS_SIGN         2
+#define TLS_CT_RSA_FIXED_DH     3
+#define TLS_CT_DSS_FIXED_DH     4
+#define TLS_CT_ECDSA_SIGN       64
+#define TLS_CT_RSA_FIXED_ECDH       65
+#define TLS_CT_ECDSA_FIXED_ECDH     66
+#define TLS_CT_NUMBER           7
 
-#define TLS1_FINISH_MAC_LENGTH		12
+#define TLS1_FINISH_MAC_LENGTH      12
 
-#define TLS_MD_MAX_CONST_SIZE			20
-#define TLS_MD_CLIENT_FINISH_CONST		"client finished"
-#define TLS_MD_CLIENT_FINISH_CONST_SIZE		15
-#define TLS_MD_SERVER_FINISH_CONST		"server finished"
-#define TLS_MD_SERVER_FINISH_CONST_SIZE		15
-#define TLS_MD_SERVER_WRITE_KEY_CONST		"server write key"
-#define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE	16
-#define TLS_MD_KEY_EXPANSION_CONST		"key expansion"
-#define TLS_MD_KEY_EXPANSION_CONST_SIZE		13
-#define TLS_MD_CLIENT_WRITE_KEY_CONST		"client write key"
-#define TLS_MD_CLIENT_WRITE_KEY_CONST_SIZE	16
-#define TLS_MD_SERVER_WRITE_KEY_CONST		"server write key"
-#define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE	16
-#define TLS_MD_IV_BLOCK_CONST			"IV block"
-#define TLS_MD_IV_BLOCK_CONST_SIZE		8
-#define TLS_MD_MASTER_SECRET_CONST		"master secret"
-#define TLS_MD_MASTER_SECRET_CONST_SIZE		13
+#define TLS_MD_MAX_CONST_SIZE           20
+#define TLS_MD_CLIENT_FINISH_CONST      "client finished"
+#define TLS_MD_CLIENT_FINISH_CONST_SIZE     15
+#define TLS_MD_SERVER_FINISH_CONST      "server finished"
+#define TLS_MD_SERVER_FINISH_CONST_SIZE     15
+#define TLS_MD_SERVER_WRITE_KEY_CONST       "server write key"
+#define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE  16
+#define TLS_MD_KEY_EXPANSION_CONST      "key expansion"
+#define TLS_MD_KEY_EXPANSION_CONST_SIZE     13
+#define TLS_MD_CLIENT_WRITE_KEY_CONST       "client write key"
+#define TLS_MD_CLIENT_WRITE_KEY_CONST_SIZE  16
+#define TLS_MD_SERVER_WRITE_KEY_CONST       "server write key"
+#define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE  16
+#define TLS_MD_IV_BLOCK_CONST           "IV block"
+#define TLS_MD_IV_BLOCK_CONST_SIZE      8
+#define TLS_MD_MASTER_SECRET_CONST      "master secret"
+#define TLS_MD_MASTER_SECRET_CONST_SIZE     13
 
 #ifdef CHARSET_EBCDIC
 #undef TLS_MD_CLIENT_FINISH_CONST
diff --git a/dep/include/openssl/tmdiff.h b/dep/include/openssl/tmdiff.h
index af5c41c6499..1ddb28b5d49 100644
--- a/dep/include/openssl/tmdiff.h
+++ b/dep/include/openssl/tmdiff.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -60,7 +60,7 @@
  * Author - Eric Young
  */
 /* ... erm yeah, "dynamic hash tables" you say?
- * 
+ *
  * And what would dynamic hash tables have to do with any of this code *now*?
  * AFAICS, this code is only referenced by crypto/bn/exp.c which is an unused
  * file that I doubt compiles any more. speed.c is the only thing that could
diff --git a/dep/include/openssl/txt_db.h b/dep/include/openssl/txt_db.h
index 307e1ba23fc..3d57458114c 100644
--- a/dep/include/openssl/txt_db.h
+++ b/dep/include/openssl/txt_db.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -66,28 +66,28 @@
 #include 
 #include 
 
-#define DB_ERROR_OK			0
-#define DB_ERROR_MALLOC			1
-#define DB_ERROR_INDEX_CLASH    	2
-#define DB_ERROR_INDEX_OUT_OF_RANGE	3
-#define DB_ERROR_NO_INDEX		4
-#define DB_ERROR_INSERT_INDEX_CLASH    	5
+#define DB_ERROR_OK         0
+#define DB_ERROR_MALLOC         1
+#define DB_ERROR_INDEX_CLASH        2
+#define DB_ERROR_INDEX_OUT_OF_RANGE 3
+#define DB_ERROR_NO_INDEX       4
+#define DB_ERROR_INSERT_INDEX_CLASH     5
 
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
 typedef struct txt_db_st
-	{
-	int num_fields;
-	STACK /* char ** */ *data;
-	LHASH **index;
-	int (**qual)(char **);
-	long error;
-	long arg1;
-	long arg2;
-	char **arg_row;
-	} TXT_DB;
+    {
+    int num_fields;
+    STACK /* char ** */ *data;
+    LHASH **index;
+    int (**qual)(char **);
+    long error;
+    long arg1;
+    long arg2;
+    char **arg_row;
+    } TXT_DB;
 
 #ifndef OPENSSL_NO_BIO
 TXT_DB *TXT_DB_read(BIO *in, int num);
@@ -97,7 +97,7 @@ TXT_DB *TXT_DB_read(char *in, int num);
 long TXT_DB_write(char *out, TXT_DB *db);
 #endif
 int TXT_DB_create_index(TXT_DB *db,int field,int (*qual)(char **),
-		LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp);
+        LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp);
 void TXT_DB_free(TXT_DB *db);
 char **TXT_DB_get_by_index(TXT_DB *db, int idx, char **value);
 int TXT_DB_insert(TXT_DB *db,char **value);
diff --git a/dep/include/openssl/ui.h b/dep/include/openssl/ui.h
index 018296412b1..b8e083cbec8 100644
--- a/dep/include/openssl/ui.h
+++ b/dep/include/openssl/ui.h
@@ -10,7 +10,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -89,18 +89,18 @@ void UI_free(UI *ui);
    and UI_{add,dup}_input_boolean.
 
    UI_{add,dup}__string have the following meanings:
-	add	add a text or prompt string.  The pointers given to these
-		functions are used verbatim, no copying is done.
-	dup	make a copy of the text or prompt string, then add the copy
-		to the collection of strings in the user interface.
-	
-		The function is a name for the functionality that the given
-		string shall be used for.  It can be one of:
-			input	use the string as data prompt.
-			verify	use the string as verification prompt.  This
-				is used to verify a previous input.
-			info	use the string for informational output.
-			error	use the string for error output.
+    add add a text or prompt string.  The pointers given to these
+        functions are used verbatim, no copying is done.
+    dup make a copy of the text or prompt string, then add the copy
+        to the collection of strings in the user interface.
+    
+        The function is a name for the functionality that the given
+        string shall be used for.  It can be one of:
+            input   use the string as data prompt.
+            verify  use the string as verification prompt.  This
+                is used to verify a previous input.
+            info    use the string for informational output.
+            error   use the string for error output.
    Honestly, there's currently no difference between info and error for the
    moment.
 
@@ -128,19 +128,19 @@ void UI_free(UI *ui);
    On success, the all return an index of the added information.  That index
    is usefull when retrieving results with UI_get0_result(). */
 int UI_add_input_string(UI *ui, const char *prompt, int flags,
-	char *result_buf, int minsize, int maxsize);
+    char *result_buf, int minsize, int maxsize);
 int UI_dup_input_string(UI *ui, const char *prompt, int flags,
-	char *result_buf, int minsize, int maxsize);
+    char *result_buf, int minsize, int maxsize);
 int UI_add_verify_string(UI *ui, const char *prompt, int flags,
-	char *result_buf, int minsize, int maxsize, const char *test_buf);
+    char *result_buf, int minsize, int maxsize, const char *test_buf);
 int UI_dup_verify_string(UI *ui, const char *prompt, int flags,
-	char *result_buf, int minsize, int maxsize, const char *test_buf);
+    char *result_buf, int minsize, int maxsize, const char *test_buf);
 int UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc,
-	const char *ok_chars, const char *cancel_chars,
-	int flags, char *result_buf);
+    const char *ok_chars, const char *cancel_chars,
+    int flags, char *result_buf);
 int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc,
-	const char *ok_chars, const char *cancel_chars,
-	int flags, char *result_buf);
+    const char *ok_chars, const char *cancel_chars,
+    int flags, char *result_buf);
 int UI_add_info_string(UI *ui, const char *text);
 int UI_dup_info_string(UI *ui, const char *text);
 int UI_add_error_string(UI *ui, const char *text);
@@ -148,13 +148,13 @@ int UI_dup_error_string(UI *ui, const char *text);
 
 /* These are the possible flags.  They can be or'ed together. */
 /* Use to have echoing of input */
-#define UI_INPUT_FLAG_ECHO		0x01
+#define UI_INPUT_FLAG_ECHO      0x01
 /* Use a default password.  Where that password is found is completely
    up to the application, it might for example be in the user data set
    with UI_add_user_data().  It is not recommended to have more than
    one input in each UI being marked with this flag, or the application
    might get confused. */
-#define UI_INPUT_FLAG_DEFAULT_PWD	0x02
+#define UI_INPUT_FLAG_DEFAULT_PWD   0x02
 
 /* The user of these routines may want to define flags of their own.  The core
    UI won't look at those, but will pass them on to the method routines.  They
@@ -162,10 +162,10 @@ int UI_dup_error_string(UI *ui, const char *text);
    UI_INPUT_FLAG_USER_BASE tells which is the lowest bit to use.  A good
    example of use is this:
 
-	#define MY_UI_FLAG1	(0x01 << UI_INPUT_FLAG_USER_BASE)
+    #define MY_UI_FLAG1 (0x01 << UI_INPUT_FLAG_USER_BASE)
 
 */
-#define UI_INPUT_FLAG_USER_BASE	16
+#define UI_INPUT_FLAG_USER_BASE 16
 
 
 /* The following function helps construct a prompt.  object_desc is a
@@ -178,15 +178,15 @@ int UI_dup_error_string(UI *ui, const char *text);
    If the ui_method doesn't contain a pointer to a user-defined prompt
    constructor, a default string is built, looking like this:
 
-	"Enter {object_desc} for {object_name}:"
+    "Enter {object_desc} for {object_name}:"
 
    So, if object_desc has the value "pass phrase" and object_name has
    the value "foo.key", the resulting string is:
 
-	"Enter pass phrase for foo.key:"
+    "Enter pass phrase for foo.key:"
 */
 char *UI_construct_prompt(UI *ui_method,
-	const char *object_desc, const char *object_name);
+    const char *object_desc, const char *object_name);
 
 
 /* The following function is used to store a pointer to user-specific data.
@@ -217,18 +217,18 @@ int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)(void));
 /* Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the
    OpenSSL error stack before printing any info or added error messages and
    before any prompting. */
-#define UI_CTRL_PRINT_ERRORS		1
+#define UI_CTRL_PRINT_ERRORS        1
 /* Check if a UI_process() is possible to do again with the same instance of
    a user interface.  This makes UI_ctrl() return 1 if it is redoable, and 0
    if not. */
-#define UI_CTRL_IS_REDOABLE		2
+#define UI_CTRL_IS_REDOABLE     2
 
 
 /* Some methods may use extra data */
 #define UI_set_app_data(s,arg)         UI_set_ex_data(s,0,arg)
 #define UI_get_app_data(s)             UI_get_ex_data(s,0)
 int UI_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
-	CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+    CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
 int UI_set_ex_data(UI *r,int idx,void *arg);
 void *UI_get_ex_data(UI *r, int idx);
 
@@ -246,29 +246,29 @@ UI_METHOD *UI_OpenSSL(void);
 /* A method contains a number of functions that implement the low level
    of the User Interface.  The functions are:
 
-	an opener	This function starts a session, maybe by opening
-			a channel to a tty, or by opening a window.
-	a writer	This function is called to write a given string,
-			maybe to the tty, maybe as a field label in a
-			window.
-	a flusher	This function is called to flush everything that
-			has been output so far.  It can be used to actually
-			display a dialog box after it has been built.
-	a reader	This function is called to read a given prompt,
-			maybe from the tty, maybe from a field in a
-			window.  Note that it's called wth all string
-			structures, not only the prompt ones, so it must
-			check such things itself.
-	a closer	This function closes the session, maybe by closing
-			the channel to the tty, or closing the window.
+    an opener   This function starts a session, maybe by opening
+            a channel to a tty, or by opening a window.
+    a writer    This function is called to write a given string,
+            maybe to the tty, maybe as a field label in a
+            window.
+    a flusher   This function is called to flush everything that
+            has been output so far.  It can be used to actually
+            display a dialog box after it has been built.
+    a reader    This function is called to read a given prompt,
+            maybe from the tty, maybe from a field in a
+            window.  Note that it's called wth all string
+            structures, not only the prompt ones, so it must
+            check such things itself.
+    a closer    This function closes the session, maybe by closing
+            the channel to the tty, or closing the window.
 
    All these functions are expected to return:
 
-	0	on error.
-	1	on success.
-	-1	on out-of-band events, for example if some prompting has
-		been canceled (by pressing Ctrl-C, for example).  This is
-		only checked when returned by the flusher or the reader.
+    0   on error.
+    1   on success.
+    -1  on out-of-band events, for example if some prompting has
+        been canceled (by pressing Ctrl-C, for example).  This is
+        only checked when returned by the flusher or the reader.
 
    The way this is used, the opener is first called, then the writer for all
    strings, then the flusher, then the reader for all strings and finally the
@@ -293,14 +293,14 @@ typedef struct ui_string_st UI_STRING;
 /* The different types of strings that are currently supported.
    This is only needed by method authors. */
 enum UI_string_types
-	{
-	UIT_NONE=0,
-	UIT_PROMPT,		/* Prompt for a string */
-	UIT_VERIFY,		/* Prompt for a string and verify */
-	UIT_BOOLEAN,		/* Prompt for a yes/no response */
-	UIT_INFO,		/* Send info to the user */
-	UIT_ERROR		/* Send an error message to the user */
-	};
+    {
+    UIT_NONE=0,
+    UIT_PROMPT,     /* Prompt for a string */
+    UIT_VERIFY,     /* Prompt for a string and verify */
+    UIT_BOOLEAN,        /* Prompt for a yes/no response */
+    UIT_INFO,       /* Send info to the user */
+    UIT_ERROR       /* Send an error message to the user */
+    };
 
 /* Create and manipulate methods */
 UI_METHOD *UI_create_method(char *name);
@@ -353,27 +353,27 @@ void ERR_load_UI_strings(void);
 /* Error codes for the UI functions. */
 
 /* Function codes. */
-#define UI_F_GENERAL_ALLOCATE_BOOLEAN			 108
-#define UI_F_GENERAL_ALLOCATE_PROMPT			 109
-#define UI_F_GENERAL_ALLOCATE_STRING			 100
-#define UI_F_UI_CTRL					 111
-#define UI_F_UI_DUP_ERROR_STRING			 101
-#define UI_F_UI_DUP_INFO_STRING				 102
-#define UI_F_UI_DUP_INPUT_BOOLEAN			 110
-#define UI_F_UI_DUP_INPUT_STRING			 103
-#define UI_F_UI_DUP_VERIFY_STRING			 106
-#define UI_F_UI_GET0_RESULT				 107
-#define UI_F_UI_NEW_METHOD				 104
-#define UI_F_UI_SET_RESULT				 105
+#define UI_F_GENERAL_ALLOCATE_BOOLEAN            108
+#define UI_F_GENERAL_ALLOCATE_PROMPT             109
+#define UI_F_GENERAL_ALLOCATE_STRING             100
+#define UI_F_UI_CTRL                     111
+#define UI_F_UI_DUP_ERROR_STRING             101
+#define UI_F_UI_DUP_INFO_STRING              102
+#define UI_F_UI_DUP_INPUT_BOOLEAN            110
+#define UI_F_UI_DUP_INPUT_STRING             103
+#define UI_F_UI_DUP_VERIFY_STRING            106
+#define UI_F_UI_GET0_RESULT              107
+#define UI_F_UI_NEW_METHOD               104
+#define UI_F_UI_SET_RESULT               105
 
 /* Reason codes. */
-#define UI_R_COMMON_OK_AND_CANCEL_CHARACTERS		 104
-#define UI_R_INDEX_TOO_LARGE				 102
-#define UI_R_INDEX_TOO_SMALL				 103
-#define UI_R_NO_RESULT_BUFFER				 105
-#define UI_R_RESULT_TOO_LARGE				 100
-#define UI_R_RESULT_TOO_SMALL				 101
-#define UI_R_UNKNOWN_CONTROL_COMMAND			 106
+#define UI_R_COMMON_OK_AND_CANCEL_CHARACTERS         104
+#define UI_R_INDEX_TOO_LARGE                 102
+#define UI_R_INDEX_TOO_SMALL                 103
+#define UI_R_NO_RESULT_BUFFER                105
+#define UI_R_RESULT_TOO_LARGE                100
+#define UI_R_RESULT_TOO_SMALL                101
+#define UI_R_UNKNOWN_CONTROL_COMMAND             106
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/ui_compat.h b/dep/include/openssl/ui_compat.h
index b35c9bb7fd3..1b9e80b5fda 100644
--- a/dep/include/openssl/ui_compat.h
+++ b/dep/include/openssl/ui_compat.h
@@ -10,7 +10,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -70,9 +70,9 @@ extern "C" {
    and are provided here for backward compatibility reasons. */
 
 #define des_read_pw_string(b,l,p,v) \
-	_ossl_old_des_read_pw_string((b),(l),(p),(v))
+    _ossl_old_des_read_pw_string((b),(l),(p),(v))
 #define des_read_pw(b,bf,s,p,v) \
-	_ossl_old_des_read_pw((b),(bf),(s),(p),(v))
+    _ossl_old_des_read_pw((b),(bf),(s),(p),(v))
 
 int _ossl_old_des_read_pw_string(char *buf,int length,const char *prompt,int verify);
 int _ossl_old_des_read_pw(char *buf,char *buff,int size,const char *prompt,int verify);
diff --git a/dep/include/openssl/x509.h b/dep/include/openssl/x509.h
index 16a954f7099..ebc99d76643 100644
--- a/dep/include/openssl/x509.h
+++ b/dep/include/openssl/x509.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -57,7 +57,7 @@
  */
 /* ====================================================================
  * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
- * ECDH support in OpenSSL originally developed by 
+ * ECDH support in OpenSSL originally developed by
  * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
  */
 
@@ -118,141 +118,141 @@ extern "C" {
 #undef X509_CERT_PAIR
 #endif
 
-#define X509_FILETYPE_PEM	1
-#define X509_FILETYPE_ASN1	2
-#define X509_FILETYPE_DEFAULT	3
+#define X509_FILETYPE_PEM   1
+#define X509_FILETYPE_ASN1  2
+#define X509_FILETYPE_DEFAULT   3
 
-#define X509v3_KU_DIGITAL_SIGNATURE	0x0080
-#define X509v3_KU_NON_REPUDIATION	0x0040
-#define X509v3_KU_KEY_ENCIPHERMENT	0x0020
-#define X509v3_KU_DATA_ENCIPHERMENT	0x0010
-#define X509v3_KU_KEY_AGREEMENT		0x0008
-#define X509v3_KU_KEY_CERT_SIGN		0x0004
-#define X509v3_KU_CRL_SIGN		0x0002
-#define X509v3_KU_ENCIPHER_ONLY		0x0001
-#define X509v3_KU_DECIPHER_ONLY		0x8000
-#define X509v3_KU_UNDEF			0xffff
+#define X509v3_KU_DIGITAL_SIGNATURE 0x0080
+#define X509v3_KU_NON_REPUDIATION   0x0040
+#define X509v3_KU_KEY_ENCIPHERMENT  0x0020
+#define X509v3_KU_DATA_ENCIPHERMENT 0x0010
+#define X509v3_KU_KEY_AGREEMENT     0x0008
+#define X509v3_KU_KEY_CERT_SIGN     0x0004
+#define X509v3_KU_CRL_SIGN      0x0002
+#define X509v3_KU_ENCIPHER_ONLY     0x0001
+#define X509v3_KU_DECIPHER_ONLY     0x8000
+#define X509v3_KU_UNDEF         0xffff
 
 typedef struct X509_objects_st
-	{
-	int nid;
-	int (*a2i)(void);
-	int (*i2a)(void);
-	} X509_OBJECTS;
+    {
+    int nid;
+    int (*a2i)(void);
+    int (*i2a)(void);
+    } X509_OBJECTS;
 
 struct X509_algor_st
-	{
-	ASN1_OBJECT *algorithm;
-	ASN1_TYPE *parameter;
-	} /* X509_ALGOR */;
+    {
+    ASN1_OBJECT *algorithm;
+    ASN1_TYPE *parameter;
+    } /* X509_ALGOR */;
 
 DECLARE_STACK_OF(X509_ALGOR)
 DECLARE_ASN1_SET_OF(X509_ALGOR)
 
 typedef struct X509_val_st
-	{
-	ASN1_TIME *notBefore;
-	ASN1_TIME *notAfter;
-	} X509_VAL;
+    {
+    ASN1_TIME *notBefore;
+    ASN1_TIME *notAfter;
+    } X509_VAL;
 
 typedef struct X509_pubkey_st
-	{
-	X509_ALGOR *algor;
-	ASN1_BIT_STRING *public_key;
-	EVP_PKEY *pkey;
-	} X509_PUBKEY;
+    {
+    X509_ALGOR *algor;
+    ASN1_BIT_STRING *public_key;
+    EVP_PKEY *pkey;
+    } X509_PUBKEY;
 
 typedef struct X509_sig_st
-	{
-	X509_ALGOR *algor;
-	ASN1_OCTET_STRING *digest;
-	} X509_SIG;
+    {
+    X509_ALGOR *algor;
+    ASN1_OCTET_STRING *digest;
+    } X509_SIG;
 
 typedef struct X509_name_entry_st
-	{
-	ASN1_OBJECT *object;
-	ASN1_STRING *value;
-	int set;
-	int size; 	/* temp variable */
-	} X509_NAME_ENTRY;
+    {
+    ASN1_OBJECT *object;
+    ASN1_STRING *value;
+    int set;
+    int size;   /* temp variable */
+    } X509_NAME_ENTRY;
 
 DECLARE_STACK_OF(X509_NAME_ENTRY)
 DECLARE_ASN1_SET_OF(X509_NAME_ENTRY)
 
 /* we always keep X509_NAMEs in 2 forms. */
 struct X509_name_st
-	{
-	STACK_OF(X509_NAME_ENTRY) *entries;
-	int modified;	/* true if 'bytes' needs to be built */
+    {
+    STACK_OF(X509_NAME_ENTRY) *entries;
+    int modified;   /* true if 'bytes' needs to be built */
 #ifndef OPENSSL_NO_BUFFER
-	BUF_MEM *bytes;
+    BUF_MEM *bytes;
 #else
-	char *bytes;
+    char *bytes;
 #endif
-	unsigned long hash; /* Keep the hash around for lookups */
-	} /* X509_NAME */;
+    unsigned long hash; /* Keep the hash around for lookups */
+    } /* X509_NAME */;
 
 DECLARE_STACK_OF(X509_NAME)
 
-#define X509_EX_V_NETSCAPE_HACK		0x8000
-#define X509_EX_V_INIT			0x0001
+#define X509_EX_V_NETSCAPE_HACK     0x8000
+#define X509_EX_V_INIT          0x0001
 typedef struct X509_extension_st
-	{
-	ASN1_OBJECT *object;
-	ASN1_BOOLEAN critical;
-	ASN1_OCTET_STRING *value;
-	} X509_EXTENSION;
+    {
+    ASN1_OBJECT *object;
+    ASN1_BOOLEAN critical;
+    ASN1_OCTET_STRING *value;
+    } X509_EXTENSION;
 
 DECLARE_STACK_OF(X509_EXTENSION)
 DECLARE_ASN1_SET_OF(X509_EXTENSION)
 
 /* a sequence of these are used */
 typedef struct x509_attributes_st
-	{
-	ASN1_OBJECT *object;
-	int single; /* 0 for a set, 1 for a single item (which is wrong) */
-	union	{
-		char		*ptr;
-/* 0 */		STACK_OF(ASN1_TYPE) *set;
-/* 1 */		ASN1_TYPE	*single;
-		} value;
-	} X509_ATTRIBUTE;
+    {
+    ASN1_OBJECT *object;
+    int single; /* 0 for a set, 1 for a single item (which is wrong) */
+    union   {
+        char        *ptr;
+/* 0 */     STACK_OF(ASN1_TYPE) *set;
+/* 1 */     ASN1_TYPE   *single;
+        } value;
+    } X509_ATTRIBUTE;
 
 DECLARE_STACK_OF(X509_ATTRIBUTE)
 DECLARE_ASN1_SET_OF(X509_ATTRIBUTE)
 
 
 typedef struct X509_req_info_st
-	{
-	ASN1_ENCODING enc;
-	ASN1_INTEGER *version;
-	X509_NAME *subject;
-	X509_PUBKEY *pubkey;
-	/*  d=2 hl=2 l=  0 cons: cont: 00 */
-	STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */
-	} X509_REQ_INFO;
+    {
+    ASN1_ENCODING enc;
+    ASN1_INTEGER *version;
+    X509_NAME *subject;
+    X509_PUBKEY *pubkey;
+    /*  d=2 hl=2 l=  0 cons: cont: 00 */
+    STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */
+    } X509_REQ_INFO;
 
 typedef struct X509_req_st
-	{
-	X509_REQ_INFO *req_info;
-	X509_ALGOR *sig_alg;
-	ASN1_BIT_STRING *signature;
-	int references;
-	} X509_REQ;
+    {
+    X509_REQ_INFO *req_info;
+    X509_ALGOR *sig_alg;
+    ASN1_BIT_STRING *signature;
+    int references;
+    } X509_REQ;
 
 typedef struct x509_cinf_st
-	{
-	ASN1_INTEGER *version;		/* [ 0 ] default of v1 */
-	ASN1_INTEGER *serialNumber;
-	X509_ALGOR *signature;
-	X509_NAME *issuer;
-	X509_VAL *validity;
-	X509_NAME *subject;
-	X509_PUBKEY *key;
-	ASN1_BIT_STRING *issuerUID;		/* [ 1 ] optional in v2 */
-	ASN1_BIT_STRING *subjectUID;		/* [ 2 ] optional in v2 */
-	STACK_OF(X509_EXTENSION) *extensions;	/* [ 3 ] optional in v3 */
-	} X509_CINF;
+    {
+    ASN1_INTEGER *version;      /* [ 0 ] default of v1 */
+    ASN1_INTEGER *serialNumber;
+    X509_ALGOR *signature;
+    X509_NAME *issuer;
+    X509_VAL *validity;
+    X509_NAME *subject;
+    X509_PUBKEY *key;
+    ASN1_BIT_STRING *issuerUID;     /* [ 1 ] optional in v2 */
+    ASN1_BIT_STRING *subjectUID;        /* [ 2 ] optional in v2 */
+    STACK_OF(X509_EXTENSION) *extensions;   /* [ 3 ] optional in v3 */
+    } X509_CINF;
 
 /* This stuff is certificate "auxiliary info"
  * it contains details which are useful in certificate
@@ -261,42 +261,42 @@ typedef struct x509_cinf_st
  */
 
 typedef struct x509_cert_aux_st
-	{
-	STACK_OF(ASN1_OBJECT) *trust;		/* trusted uses */
-	STACK_OF(ASN1_OBJECT) *reject;		/* rejected uses */
-	ASN1_UTF8STRING *alias;			/* "friendly name" */
-	ASN1_OCTET_STRING *keyid;		/* key id of private key */
-	STACK_OF(X509_ALGOR) *other;		/* other unspecified info */
-	} X509_CERT_AUX;
+    {
+    STACK_OF(ASN1_OBJECT) *trust;       /* trusted uses */
+    STACK_OF(ASN1_OBJECT) *reject;      /* rejected uses */
+    ASN1_UTF8STRING *alias;         /* "friendly name" */
+    ASN1_OCTET_STRING *keyid;       /* key id of private key */
+    STACK_OF(X509_ALGOR) *other;        /* other unspecified info */
+    } X509_CERT_AUX;
 
 struct x509_st
-	{
-	X509_CINF *cert_info;
-	X509_ALGOR *sig_alg;
-	ASN1_BIT_STRING *signature;
-	int valid;
-	int references;
-	char *name;
-	CRYPTO_EX_DATA ex_data;
-	/* These contain copies of various extension values */
-	long ex_pathlen;
-	long ex_pcpathlen;
-	unsigned long ex_flags;
-	unsigned long ex_kusage;
-	unsigned long ex_xkusage;
-	unsigned long ex_nscert;
-	ASN1_OCTET_STRING *skid;
-	struct AUTHORITY_KEYID_st *akid;
-	X509_POLICY_CACHE *policy_cache;
+    {
+    X509_CINF *cert_info;
+    X509_ALGOR *sig_alg;
+    ASN1_BIT_STRING *signature;
+    int valid;
+    int references;
+    char *name;
+    CRYPTO_EX_DATA ex_data;
+    /* These contain copies of various extension values */
+    long ex_pathlen;
+    long ex_pcpathlen;
+    unsigned long ex_flags;
+    unsigned long ex_kusage;
+    unsigned long ex_xkusage;
+    unsigned long ex_nscert;
+    ASN1_OCTET_STRING *skid;
+    struct AUTHORITY_KEYID_st *akid;
+    X509_POLICY_CACHE *policy_cache;
 #ifndef OPENSSL_NO_RFC3779
-	STACK_OF(IPAddressFamily) *rfc3779_addr;
-	struct ASIdentifiers_st *rfc3779_asid;
+    STACK_OF(IPAddressFamily) *rfc3779_addr;
+    struct ASIdentifiers_st *rfc3779_asid;
 #endif
 #ifndef OPENSSL_NO_SHA
-	unsigned char sha1_hash[SHA_DIGEST_LENGTH];
+    unsigned char sha1_hash[SHA_DIGEST_LENGTH];
 #endif
-	X509_CERT_AUX *aux;
-	} /* X509 */;
+    X509_CERT_AUX *aux;
+    } /* X509 */;
 
 DECLARE_STACK_OF(X509)
 DECLARE_ASN1_SET_OF(X509)
@@ -304,88 +304,88 @@ DECLARE_ASN1_SET_OF(X509)
 /* This is used for a table of trust checking functions */
 
 typedef struct x509_trust_st {
-	int trust;
-	int flags;
-	int (*check_trust)(struct x509_trust_st *, X509 *, int);
-	char *name;
-	int arg1;
-	void *arg2;
+    int trust;
+    int flags;
+    int (*check_trust)(struct x509_trust_st *, X509 *, int);
+    char *name;
+    int arg1;
+    void *arg2;
 } X509_TRUST;
 
 DECLARE_STACK_OF(X509_TRUST)
 
 typedef struct x509_cert_pair_st {
-	X509 *forward;
-	X509 *reverse;
+    X509 *forward;
+    X509 *reverse;
 } X509_CERT_PAIR;
 
 /* standard trust ids */
 
-#define X509_TRUST_DEFAULT	-1	/* Only valid in purpose settings */
+#define X509_TRUST_DEFAULT  -1  /* Only valid in purpose settings */
 
-#define X509_TRUST_COMPAT	1
-#define X509_TRUST_SSL_CLIENT	2
-#define X509_TRUST_SSL_SERVER	3
-#define X509_TRUST_EMAIL	4
-#define X509_TRUST_OBJECT_SIGN	5
-#define X509_TRUST_OCSP_SIGN	6
-#define X509_TRUST_OCSP_REQUEST	7
+#define X509_TRUST_COMPAT   1
+#define X509_TRUST_SSL_CLIENT   2
+#define X509_TRUST_SSL_SERVER   3
+#define X509_TRUST_EMAIL    4
+#define X509_TRUST_OBJECT_SIGN  5
+#define X509_TRUST_OCSP_SIGN    6
+#define X509_TRUST_OCSP_REQUEST 7
 
 /* Keep these up to date! */
-#define X509_TRUST_MIN		1
-#define X509_TRUST_MAX		7
+#define X509_TRUST_MIN      1
+#define X509_TRUST_MAX      7
 
 
 /* trust_flags values */
-#define	X509_TRUST_DYNAMIC 	1
-#define	X509_TRUST_DYNAMIC_NAME	2
+#define X509_TRUST_DYNAMIC  1
+#define X509_TRUST_DYNAMIC_NAME 2
 
 /* check_trust return codes */
 
-#define X509_TRUST_TRUSTED	1
-#define X509_TRUST_REJECTED	2
-#define X509_TRUST_UNTRUSTED	3
+#define X509_TRUST_TRUSTED  1
+#define X509_TRUST_REJECTED 2
+#define X509_TRUST_UNTRUSTED    3
 
 /* Flags for X509_print_ex() */
 
-#define	X509_FLAG_COMPAT		0
-#define	X509_FLAG_NO_HEADER		1L
-#define	X509_FLAG_NO_VERSION		(1L << 1)
-#define	X509_FLAG_NO_SERIAL		(1L << 2)
-#define	X509_FLAG_NO_SIGNAME		(1L << 3)
-#define	X509_FLAG_NO_ISSUER		(1L << 4)
-#define	X509_FLAG_NO_VALIDITY		(1L << 5)
-#define	X509_FLAG_NO_SUBJECT		(1L << 6)
-#define	X509_FLAG_NO_PUBKEY		(1L << 7)
-#define	X509_FLAG_NO_EXTENSIONS		(1L << 8)
-#define	X509_FLAG_NO_SIGDUMP		(1L << 9)
-#define	X509_FLAG_NO_AUX		(1L << 10)
-#define	X509_FLAG_NO_ATTRIBUTES		(1L << 11)
+#define X509_FLAG_COMPAT        0
+#define X509_FLAG_NO_HEADER     1L
+#define X509_FLAG_NO_VERSION        (1L << 1)
+#define X509_FLAG_NO_SERIAL     (1L << 2)
+#define X509_FLAG_NO_SIGNAME        (1L << 3)
+#define X509_FLAG_NO_ISSUER     (1L << 4)
+#define X509_FLAG_NO_VALIDITY       (1L << 5)
+#define X509_FLAG_NO_SUBJECT        (1L << 6)
+#define X509_FLAG_NO_PUBKEY     (1L << 7)
+#define X509_FLAG_NO_EXTENSIONS     (1L << 8)
+#define X509_FLAG_NO_SIGDUMP        (1L << 9)
+#define X509_FLAG_NO_AUX        (1L << 10)
+#define X509_FLAG_NO_ATTRIBUTES     (1L << 11)
 
-/* Flags specific to X509_NAME_print_ex() */	
+/* Flags specific to X509_NAME_print_ex() */
 
 /* The field separator information */
 
-#define XN_FLAG_SEP_MASK	(0xf << 16)
+#define XN_FLAG_SEP_MASK    (0xf << 16)
 
-#define XN_FLAG_COMPAT		0		/* Traditional SSLeay: use old X509_NAME_print */
-#define XN_FLAG_SEP_COMMA_PLUS	(1 << 16)	/* RFC2253 ,+ */
-#define XN_FLAG_SEP_CPLUS_SPC	(2 << 16)	/* ,+ spaced: more readable */
-#define XN_FLAG_SEP_SPLUS_SPC	(3 << 16)	/* ;+ spaced */
-#define XN_FLAG_SEP_MULTILINE	(4 << 16)	/* One line per field */
+#define XN_FLAG_COMPAT      0       /* Traditional SSLeay: use old X509_NAME_print */
+#define XN_FLAG_SEP_COMMA_PLUS  (1 << 16)   /* RFC2253 ,+ */
+#define XN_FLAG_SEP_CPLUS_SPC   (2 << 16)   /* ,+ spaced: more readable */
+#define XN_FLAG_SEP_SPLUS_SPC   (3 << 16)   /* ;+ spaced */
+#define XN_FLAG_SEP_MULTILINE   (4 << 16)   /* One line per field */
 
-#define XN_FLAG_DN_REV		(1 << 20)	/* Reverse DN order */
+#define XN_FLAG_DN_REV      (1 << 20)   /* Reverse DN order */
 
 /* How the field name is shown */
 
-#define XN_FLAG_FN_MASK		(0x3 << 21)
+#define XN_FLAG_FN_MASK     (0x3 << 21)
 
-#define XN_FLAG_FN_SN		0		/* Object short name */
-#define XN_FLAG_FN_LN		(1 << 21)	/* Object long name */
-#define XN_FLAG_FN_OID		(2 << 21)	/* Always use OIDs */
-#define XN_FLAG_FN_NONE		(3 << 21)	/* No field names */
+#define XN_FLAG_FN_SN       0       /* Object short name */
+#define XN_FLAG_FN_LN       (1 << 21)   /* Object long name */
+#define XN_FLAG_FN_OID      (2 << 21)   /* Always use OIDs */
+#define XN_FLAG_FN_NONE     (3 << 21)   /* No field names */
 
-#define XN_FLAG_SPC_EQ		(1 << 23)	/* Put spaces round '=' */
+#define XN_FLAG_SPC_EQ      (1 << 23)   /* Put spaces round '=' */
 
 /* This determines if we dump fields we don't recognise:
  * RFC2253 requires this.
@@ -393,102 +393,102 @@ typedef struct x509_cert_pair_st {
 
 #define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24)
 
-#define XN_FLAG_FN_ALIGN	(1 << 25)	/* Align field names to 20 characters */
+#define XN_FLAG_FN_ALIGN    (1 << 25)   /* Align field names to 20 characters */
 
 /* Complete set of RFC2253 flags */
 
 #define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | \
-			XN_FLAG_SEP_COMMA_PLUS | \
-			XN_FLAG_DN_REV | \
-			XN_FLAG_FN_SN | \
-			XN_FLAG_DUMP_UNKNOWN_FIELDS)
+            XN_FLAG_SEP_COMMA_PLUS | \
+            XN_FLAG_DN_REV | \
+            XN_FLAG_FN_SN | \
+            XN_FLAG_DUMP_UNKNOWN_FIELDS)
 
 /* readable oneline form */
 
 #define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \
-			ASN1_STRFLGS_ESC_QUOTE | \
-			XN_FLAG_SEP_CPLUS_SPC | \
-			XN_FLAG_SPC_EQ | \
-			XN_FLAG_FN_SN)
+            ASN1_STRFLGS_ESC_QUOTE | \
+            XN_FLAG_SEP_CPLUS_SPC | \
+            XN_FLAG_SPC_EQ | \
+            XN_FLAG_FN_SN)
 
 /* readable multiline form */
 
 #define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | \
-			ASN1_STRFLGS_ESC_MSB | \
-			XN_FLAG_SEP_MULTILINE | \
-			XN_FLAG_SPC_EQ | \
-			XN_FLAG_FN_LN | \
-			XN_FLAG_FN_ALIGN)
+            ASN1_STRFLGS_ESC_MSB | \
+            XN_FLAG_SEP_MULTILINE | \
+            XN_FLAG_SPC_EQ | \
+            XN_FLAG_FN_LN | \
+            XN_FLAG_FN_ALIGN)
 
 typedef struct X509_revoked_st
-	{
-	ASN1_INTEGER *serialNumber;
-	ASN1_TIME *revocationDate;
-	STACK_OF(X509_EXTENSION) /* optional */ *extensions;
-	int sequence; /* load sequence */
-	} X509_REVOKED;
+    {
+    ASN1_INTEGER *serialNumber;
+    ASN1_TIME *revocationDate;
+    STACK_OF(X509_EXTENSION) /* optional */ *extensions;
+    int sequence; /* load sequence */
+    } X509_REVOKED;
 
 DECLARE_STACK_OF(X509_REVOKED)
 DECLARE_ASN1_SET_OF(X509_REVOKED)
 
 typedef struct X509_crl_info_st
-	{
-	ASN1_INTEGER *version;
-	X509_ALGOR *sig_alg;
-	X509_NAME *issuer;
-	ASN1_TIME *lastUpdate;
-	ASN1_TIME *nextUpdate;
-	STACK_OF(X509_REVOKED) *revoked;
-	STACK_OF(X509_EXTENSION) /* [0] */ *extensions;
-	ASN1_ENCODING enc;
-	} X509_CRL_INFO;
+    {
+    ASN1_INTEGER *version;
+    X509_ALGOR *sig_alg;
+    X509_NAME *issuer;
+    ASN1_TIME *lastUpdate;
+    ASN1_TIME *nextUpdate;
+    STACK_OF(X509_REVOKED) *revoked;
+    STACK_OF(X509_EXTENSION) /* [0] */ *extensions;
+    ASN1_ENCODING enc;
+    } X509_CRL_INFO;
 
 struct X509_crl_st
-	{
-	/* actual signature */
-	X509_CRL_INFO *crl;
-	X509_ALGOR *sig_alg;
-	ASN1_BIT_STRING *signature;
-	int references;
-	} /* X509_CRL */;
+    {
+    /* actual signature */
+    X509_CRL_INFO *crl;
+    X509_ALGOR *sig_alg;
+    ASN1_BIT_STRING *signature;
+    int references;
+    } /* X509_CRL */;
 
 DECLARE_STACK_OF(X509_CRL)
 DECLARE_ASN1_SET_OF(X509_CRL)
 
 typedef struct private_key_st
-	{
-	int version;
-	/* The PKCS#8 data types */
-	X509_ALGOR *enc_algor;
-	ASN1_OCTET_STRING *enc_pkey;	/* encrypted pub key */
+    {
+    int version;
+    /* The PKCS#8 data types */
+    X509_ALGOR *enc_algor;
+    ASN1_OCTET_STRING *enc_pkey;    /* encrypted pub key */
 
-	/* When decrypted, the following will not be NULL */
-	EVP_PKEY *dec_pkey;
+    /* When decrypted, the following will not be NULL */
+    EVP_PKEY *dec_pkey;
 
-	/* used to encrypt and decrypt */
-	int key_length;
-	char *key_data;
-	int key_free;	/* true if we should auto free key_data */
+    /* used to encrypt and decrypt */
+    int key_length;
+    char *key_data;
+    int key_free;   /* true if we should auto free key_data */
 
-	/* expanded version of 'enc_algor' */
-	EVP_CIPHER_INFO cipher;
+    /* expanded version of 'enc_algor' */
+    EVP_CIPHER_INFO cipher;
 
-	int references;
-	} X509_PKEY;
+    int references;
+    } X509_PKEY;
 
 #ifndef OPENSSL_NO_EVP
 typedef struct X509_info_st
-	{
-	X509 *x509;
-	X509_CRL *crl;
-	X509_PKEY *x_pkey;
+    {
+    X509 *x509;
+    X509_CRL *crl;
+    X509_PKEY *x_pkey;
 
-	EVP_CIPHER_INFO enc_cipher;
-	int enc_len;
-	char *enc_data;
+    EVP_CIPHER_INFO enc_cipher;
+    int enc_len;
+    char *enc_data;
 
-	int references;
-	} X509_INFO;
+    int references;
+    } X509_INFO;
 
 DECLARE_STACK_OF(X509_INFO)
 #endif
@@ -498,30 +498,30 @@ DECLARE_STACK_OF(X509_INFO)
  * Netscapes spki structures - useful if you are writing a CA web page
  */
 typedef struct Netscape_spkac_st
-	{
-	X509_PUBKEY *pubkey;
-	ASN1_IA5STRING *challenge;	/* challenge sent in atlas >= PR2 */
-	} NETSCAPE_SPKAC;
+    {
+    X509_PUBKEY *pubkey;
+    ASN1_IA5STRING *challenge;  /* challenge sent in atlas >= PR2 */
+    } NETSCAPE_SPKAC;
 
 typedef struct Netscape_spki_st
-	{
-	NETSCAPE_SPKAC *spkac;	/* signed public key and challenge */
-	X509_ALGOR *sig_algor;
-	ASN1_BIT_STRING *signature;
-	} NETSCAPE_SPKI;
+    {
+    NETSCAPE_SPKAC *spkac;  /* signed public key and challenge */
+    X509_ALGOR *sig_algor;
+    ASN1_BIT_STRING *signature;
+    } NETSCAPE_SPKI;
 
 /* Netscape certificate sequence structure */
 typedef struct Netscape_certificate_sequence
-	{
-	ASN1_OBJECT *type;
-	STACK_OF(X509) *certs;
-	} NETSCAPE_CERT_SEQUENCE;
+    {
+    ASN1_OBJECT *type;
+    STACK_OF(X509) *certs;
+    } NETSCAPE_CERT_SEQUENCE;
 
 /* Unused (and iv length is wrong)
 typedef struct CBCParameter_st
-	{
-	unsigned char iv[8];
-	} CBC_PARAM;
+    {
+    unsigned char iv[8];
+    } CBC_PARAM;
 */
 
 /* Password based encryption structure */
@@ -539,7 +539,7 @@ X509_ALGOR *encryption;
 } PBE2PARAM;
 
 typedef struct PBKDF2PARAM_st {
-ASN1_TYPE *salt;	/* Usually OCTET STRING but could be anything */
+ASN1_TYPE *salt;    /* Usually OCTET STRING but could be anything */
 ASN1_INTEGER *iter;
 ASN1_INTEGER *keylength;
 X509_ALGOR *prf;
@@ -551,10 +551,10 @@ X509_ALGOR *prf;
 typedef struct pkcs8_priv_key_info_st
         {
         int broken;     /* Flag for various broken formats */
-#define PKCS8_OK		0
-#define PKCS8_NO_OCTET		1
-#define PKCS8_EMBEDDED_PARAM	2
-#define PKCS8_NS_DB		3
+#define PKCS8_OK        0
+#define PKCS8_NO_OCTET      1
+#define PKCS8_EMBEDDED_PARAM    2
+#define PKCS8_NS_DB     3
         ASN1_INTEGER *version;
         X509_ALGOR *pkeyalg;
         ASN1_TYPE *pkey; /* Should be OCTET STRING but some are broken */
@@ -574,172 +574,172 @@ extern "C" {
 
 #ifdef SSLEAY_MACROS
 #define X509_verify(a,r) ASN1_verify((int (*)())i2d_X509_CINF,a->sig_alg,\
-	a->signature,(char *)a->cert_info,r)
+    a->signature,(char *)a->cert_info,r)
 #define X509_REQ_verify(a,r) ASN1_verify((int (*)())i2d_X509_REQ_INFO, \
-	a->sig_alg,a->signature,(char *)a->req_info,r)
+    a->sig_alg,a->signature,(char *)a->req_info,r)
 #define X509_CRL_verify(a,r) ASN1_verify((int (*)())i2d_X509_CRL_INFO, \
-	a->sig_alg, a->signature,(char *)a->crl,r)
+    a->sig_alg, a->signature,(char *)a->crl,r)
 
 #define X509_sign(x,pkey,md) \
-	ASN1_sign((int (*)())i2d_X509_CINF, x->cert_info->signature, \
-		x->sig_alg, x->signature, (char *)x->cert_info,pkey,md)
+    ASN1_sign((int (*)())i2d_X509_CINF, x->cert_info->signature, \
+        x->sig_alg, x->signature, (char *)x->cert_info,pkey,md)
 #define X509_REQ_sign(x,pkey,md) \
-	ASN1_sign((int (*)())i2d_X509_REQ_INFO,x->sig_alg, NULL, \
-		x->signature, (char *)x->req_info,pkey,md)
+    ASN1_sign((int (*)())i2d_X509_REQ_INFO,x->sig_alg, NULL, \
+        x->signature, (char *)x->req_info,pkey,md)
 #define X509_CRL_sign(x,pkey,md) \
-	ASN1_sign((int (*)())i2d_X509_CRL_INFO,x->crl->sig_alg,x->sig_alg, \
-		x->signature, (char *)x->crl,pkey,md)
+    ASN1_sign((int (*)())i2d_X509_CRL_INFO,x->crl->sig_alg,x->sig_alg, \
+        x->signature, (char *)x->crl,pkey,md)
 #define NETSCAPE_SPKI_sign(x,pkey,md) \
-	ASN1_sign((int (*)())i2d_NETSCAPE_SPKAC, x->sig_algor,NULL, \
-		x->signature, (char *)x->spkac,pkey,md)
+    ASN1_sign((int (*)())i2d_NETSCAPE_SPKAC, x->sig_algor,NULL, \
+        x->signature, (char *)x->spkac,pkey,md)
 
 #define X509_dup(x509) (X509 *)ASN1_dup((int (*)())i2d_X509, \
-		(char *(*)())d2i_X509,(char *)x509)
+        (char *(*)())d2i_X509,(char *)x509)
 #define X509_ATTRIBUTE_dup(xa) (X509_ATTRIBUTE *)ASN1_dup(\
-		(int (*)())i2d_X509_ATTRIBUTE, \
-		(char *(*)())d2i_X509_ATTRIBUTE,(char *)xa)
+        (int (*)())i2d_X509_ATTRIBUTE, \
+        (char *(*)())d2i_X509_ATTRIBUTE,(char *)xa)
 #define X509_EXTENSION_dup(ex) (X509_EXTENSION *)ASN1_dup( \
-		(int (*)())i2d_X509_EXTENSION, \
-		(char *(*)())d2i_X509_EXTENSION,(char *)ex)
+        (int (*)())i2d_X509_EXTENSION, \
+        (char *(*)())d2i_X509_EXTENSION,(char *)ex)
 #define d2i_X509_fp(fp,x509) (X509 *)ASN1_d2i_fp((char *(*)())X509_new, \
-		(char *(*)())d2i_X509, (fp),(unsigned char **)(x509))
+        (char *(*)())d2i_X509, (fp),(unsigned char **)(x509))
 #define i2d_X509_fp(fp,x509) ASN1_i2d_fp(i2d_X509,fp,(unsigned char *)x509)
 #define d2i_X509_bio(bp,x509) (X509 *)ASN1_d2i_bio((char *(*)())X509_new, \
-		(char *(*)())d2i_X509, (bp),(unsigned char **)(x509))
+        (char *(*)())d2i_X509, (bp),(unsigned char **)(x509))
 #define i2d_X509_bio(bp,x509) ASN1_i2d_bio(i2d_X509,bp,(unsigned char *)x509)
 
 #define X509_CRL_dup(crl) (X509_CRL *)ASN1_dup((int (*)())i2d_X509_CRL, \
-		(char *(*)())d2i_X509_CRL,(char *)crl)
+        (char *(*)())d2i_X509_CRL,(char *)crl)
 #define d2i_X509_CRL_fp(fp,crl) (X509_CRL *)ASN1_d2i_fp((char *(*)()) \
-		X509_CRL_new,(char *(*)())d2i_X509_CRL, (fp),\
-		(unsigned char **)(crl))
+        X509_CRL_new,(char *(*)())d2i_X509_CRL, (fp),\
+        (unsigned char **)(crl))
 #define i2d_X509_CRL_fp(fp,crl) ASN1_i2d_fp(i2d_X509_CRL,fp,\
-		(unsigned char *)crl)
+        (unsigned char *)crl)
 #define d2i_X509_CRL_bio(bp,crl) (X509_CRL *)ASN1_d2i_bio((char *(*)()) \
-		X509_CRL_new,(char *(*)())d2i_X509_CRL, (bp),\
-		(unsigned char **)(crl))
+        X509_CRL_new,(char *(*)())d2i_X509_CRL, (bp),\
+        (unsigned char **)(crl))
 #define i2d_X509_CRL_bio(bp,crl) ASN1_i2d_bio(i2d_X509_CRL,bp,\
-		(unsigned char *)crl)
+        (unsigned char *)crl)
 
 #define PKCS7_dup(p7) (PKCS7 *)ASN1_dup((int (*)())i2d_PKCS7, \
-		(char *(*)())d2i_PKCS7,(char *)p7)
+        (char *(*)())d2i_PKCS7,(char *)p7)
 #define d2i_PKCS7_fp(fp,p7) (PKCS7 *)ASN1_d2i_fp((char *(*)()) \
-		PKCS7_new,(char *(*)())d2i_PKCS7, (fp),\
-		(unsigned char **)(p7))
+        PKCS7_new,(char *(*)())d2i_PKCS7, (fp),\
+        (unsigned char **)(p7))
 #define i2d_PKCS7_fp(fp,p7) ASN1_i2d_fp(i2d_PKCS7,fp,\
-		(unsigned char *)p7)
+        (unsigned char *)p7)
 #define d2i_PKCS7_bio(bp,p7) (PKCS7 *)ASN1_d2i_bio((char *(*)()) \
-		PKCS7_new,(char *(*)())d2i_PKCS7, (bp),\
-		(unsigned char **)(p7))
+        PKCS7_new,(char *(*)())d2i_PKCS7, (bp),\
+        (unsigned char **)(p7))
 #define i2d_PKCS7_bio(bp,p7) ASN1_i2d_bio(i2d_PKCS7,bp,\
-		(unsigned char *)p7)
+        (unsigned char *)p7)
 
 #define X509_REQ_dup(req) (X509_REQ *)ASN1_dup((int (*)())i2d_X509_REQ, \
-		(char *(*)())d2i_X509_REQ,(char *)req)
+        (char *(*)())d2i_X509_REQ,(char *)req)
 #define d2i_X509_REQ_fp(fp,req) (X509_REQ *)ASN1_d2i_fp((char *(*)())\
-		X509_REQ_new, (char *(*)())d2i_X509_REQ, (fp),\
-		(unsigned char **)(req))
+        X509_REQ_new, (char *(*)())d2i_X509_REQ, (fp),\
+        (unsigned char **)(req))
 #define i2d_X509_REQ_fp(fp,req) ASN1_i2d_fp(i2d_X509_REQ,fp,\
-		(unsigned char *)req)
+        (unsigned char *)req)
 #define d2i_X509_REQ_bio(bp,req) (X509_REQ *)ASN1_d2i_bio((char *(*)())\
-		X509_REQ_new, (char *(*)())d2i_X509_REQ, (bp),\
-		(unsigned char **)(req))
+        X509_REQ_new, (char *(*)())d2i_X509_REQ, (bp),\
+        (unsigned char **)(req))
 #define i2d_X509_REQ_bio(bp,req) ASN1_i2d_bio(i2d_X509_REQ,bp,\
-		(unsigned char *)req)
+        (unsigned char *)req)
 
 #define RSAPublicKey_dup(rsa) (RSA *)ASN1_dup((int (*)())i2d_RSAPublicKey, \
-		(char *(*)())d2i_RSAPublicKey,(char *)rsa)
+        (char *(*)())d2i_RSAPublicKey,(char *)rsa)
 #define RSAPrivateKey_dup(rsa) (RSA *)ASN1_dup((int (*)())i2d_RSAPrivateKey, \
-		(char *(*)())d2i_RSAPrivateKey,(char *)rsa)
+        (char *(*)())d2i_RSAPrivateKey,(char *)rsa)
 
 #define d2i_RSAPrivateKey_fp(fp,rsa) (RSA *)ASN1_d2i_fp((char *(*)())\
-		RSA_new,(char *(*)())d2i_RSAPrivateKey, (fp), \
-		(unsigned char **)(rsa))
+        RSA_new,(char *(*)())d2i_RSAPrivateKey, (fp), \
+        (unsigned char **)(rsa))
 #define i2d_RSAPrivateKey_fp(fp,rsa) ASN1_i2d_fp(i2d_RSAPrivateKey,fp, \
-		(unsigned char *)rsa)
+        (unsigned char *)rsa)
 #define d2i_RSAPrivateKey_bio(bp,rsa) (RSA *)ASN1_d2i_bio((char *(*)())\
-		RSA_new,(char *(*)())d2i_RSAPrivateKey, (bp), \
-		(unsigned char **)(rsa))
+        RSA_new,(char *(*)())d2i_RSAPrivateKey, (bp), \
+        (unsigned char **)(rsa))
 #define i2d_RSAPrivateKey_bio(bp,rsa) ASN1_i2d_bio(i2d_RSAPrivateKey,bp, \
-		(unsigned char *)rsa)
+        (unsigned char *)rsa)
 
 #define d2i_RSAPublicKey_fp(fp,rsa) (RSA *)ASN1_d2i_fp((char *(*)())\
-		RSA_new,(char *(*)())d2i_RSAPublicKey, (fp), \
-		(unsigned char **)(rsa))
+        RSA_new,(char *(*)())d2i_RSAPublicKey, (fp), \
+        (unsigned char **)(rsa))
 #define i2d_RSAPublicKey_fp(fp,rsa) ASN1_i2d_fp(i2d_RSAPublicKey,fp, \
-		(unsigned char *)rsa)
+        (unsigned char *)rsa)
 #define d2i_RSAPublicKey_bio(bp,rsa) (RSA *)ASN1_d2i_bio((char *(*)())\
-		RSA_new,(char *(*)())d2i_RSAPublicKey, (bp), \
-		(unsigned char **)(rsa))
+        RSA_new,(char *(*)())d2i_RSAPublicKey, (bp), \
+        (unsigned char **)(rsa))
 #define i2d_RSAPublicKey_bio(bp,rsa) ASN1_i2d_bio(i2d_RSAPublicKey,bp, \
-		(unsigned char *)rsa)
+        (unsigned char *)rsa)
 
 #define d2i_DSAPrivateKey_fp(fp,dsa) (DSA *)ASN1_d2i_fp((char *(*)())\
-		DSA_new,(char *(*)())d2i_DSAPrivateKey, (fp), \
-		(unsigned char **)(dsa))
+        DSA_new,(char *(*)())d2i_DSAPrivateKey, (fp), \
+        (unsigned char **)(dsa))
 #define i2d_DSAPrivateKey_fp(fp,dsa) ASN1_i2d_fp(i2d_DSAPrivateKey,fp, \
-		(unsigned char *)dsa)
+        (unsigned char *)dsa)
 #define d2i_DSAPrivateKey_bio(bp,dsa) (DSA *)ASN1_d2i_bio((char *(*)())\
-		DSA_new,(char *(*)())d2i_DSAPrivateKey, (bp), \
-		(unsigned char **)(dsa))
+        DSA_new,(char *(*)())d2i_DSAPrivateKey, (bp), \
+        (unsigned char **)(dsa))
 #define i2d_DSAPrivateKey_bio(bp,dsa) ASN1_i2d_bio(i2d_DSAPrivateKey,bp, \
-		(unsigned char *)dsa)
+        (unsigned char *)dsa)
 
 #define d2i_ECPrivateKey_fp(fp,ecdsa) (EC_KEY *)ASN1_d2i_fp((char *(*)())\
-		EC_KEY_new,(char *(*)())d2i_ECPrivateKey, (fp), \
-		(unsigned char **)(ecdsa))
+        EC_KEY_new,(char *(*)())d2i_ECPrivateKey, (fp), \
+        (unsigned char **)(ecdsa))
 #define i2d_ECPrivateKey_fp(fp,ecdsa) ASN1_i2d_fp(i2d_ECPrivateKey,fp, \
-		(unsigned char *)ecdsa)
+        (unsigned char *)ecdsa)
 #define d2i_ECPrivateKey_bio(bp,ecdsa) (EC_KEY *)ASN1_d2i_bio((char *(*)())\
-		EC_KEY_new,(char *(*)())d2i_ECPrivateKey, (bp), \
-		(unsigned char **)(ecdsa))
+        EC_KEY_new,(char *(*)())d2i_ECPrivateKey, (bp), \
+        (unsigned char **)(ecdsa))
 #define i2d_ECPrivateKey_bio(bp,ecdsa) ASN1_i2d_bio(i2d_ECPrivateKey,bp, \
-		(unsigned char *)ecdsa)
+        (unsigned char *)ecdsa)
 
 #define X509_ALGOR_dup(xn) (X509_ALGOR *)ASN1_dup((int (*)())i2d_X509_ALGOR,\
-		(char *(*)())d2i_X509_ALGOR,(char *)xn)
+        (char *(*)())d2i_X509_ALGOR,(char *)xn)
 
 #define X509_NAME_dup(xn) (X509_NAME *)ASN1_dup((int (*)())i2d_X509_NAME, \
-		(char *(*)())d2i_X509_NAME,(char *)xn)
+        (char *(*)())d2i_X509_NAME,(char *)xn)
 #define X509_NAME_ENTRY_dup(ne) (X509_NAME_ENTRY *)ASN1_dup( \
-		(int (*)())i2d_X509_NAME_ENTRY, \
-		(char *(*)())d2i_X509_NAME_ENTRY,\
-		(char *)ne)
+        (int (*)())i2d_X509_NAME_ENTRY, \
+        (char *(*)())d2i_X509_NAME_ENTRY,\
+        (char *)ne)
 
 #define X509_digest(data,type,md,len) \
-	ASN1_digest((int (*)())i2d_X509,type,(char *)data,md,len)
+    ASN1_digest((int (*)())i2d_X509,type,(char *)data,md,len)
 #define X509_NAME_digest(data,type,md,len) \
-	ASN1_digest((int (*)())i2d_X509_NAME,type,(char *)data,md,len)
+    ASN1_digest((int (*)())i2d_X509_NAME,type,(char *)data,md,len)
 #ifndef PKCS7_ISSUER_AND_SERIAL_digest
 #define PKCS7_ISSUER_AND_SERIAL_digest(data,type,md,len) \
-	ASN1_digest((int (*)())i2d_PKCS7_ISSUER_AND_SERIAL,type,\
-		(char *)data,md,len)
+    ASN1_digest((int (*)())i2d_PKCS7_ISSUER_AND_SERIAL,type,\
+        (char *)data,md,len)
 #endif
 #endif
 
-#define X509_EXT_PACK_UNKNOWN	1
-#define X509_EXT_PACK_STRING	2
+#define X509_EXT_PACK_UNKNOWN   1
+#define X509_EXT_PACK_STRING    2
 
-#define		X509_get_version(x) ASN1_INTEGER_get((x)->cert_info->version)
-/* #define	X509_get_serialNumber(x) ((x)->cert_info->serialNumber) */
-#define		X509_get_notBefore(x) ((x)->cert_info->validity->notBefore)
-#define		X509_get_notAfter(x) ((x)->cert_info->validity->notAfter)
-#define		X509_extract_key(x)	X509_get_pubkey(x) /*****/
-#define		X509_REQ_get_version(x) ASN1_INTEGER_get((x)->req_info->version)
-#define		X509_REQ_get_subject_name(x) ((x)->req_info->subject)
-#define		X509_REQ_extract_key(a)	X509_REQ_get_pubkey(a)
-#define		X509_name_cmp(a,b)	X509_NAME_cmp((a),(b))
-#define		X509_get_signature_type(x) EVP_PKEY_type(OBJ_obj2nid((x)->sig_alg->algorithm))
+#define     X509_get_version(x) ASN1_INTEGER_get((x)->cert_info->version)
+/* #define  X509_get_serialNumber(x) ((x)->cert_info->serialNumber) */
+#define     X509_get_notBefore(x) ((x)->cert_info->validity->notBefore)
+#define     X509_get_notAfter(x) ((x)->cert_info->validity->notAfter)
+#define     X509_extract_key(x) X509_get_pubkey(x) /*****/
+#define     X509_REQ_get_version(x) ASN1_INTEGER_get((x)->req_info->version)
+#define     X509_REQ_get_subject_name(x) ((x)->req_info->subject)
+#define     X509_REQ_extract_key(a) X509_REQ_get_pubkey(a)
+#define     X509_name_cmp(a,b)  X509_NAME_cmp((a),(b))
+#define     X509_get_signature_type(x) EVP_PKEY_type(OBJ_obj2nid((x)->sig_alg->algorithm))
 
-#define		X509_CRL_get_version(x) ASN1_INTEGER_get((x)->crl->version)
-#define 	X509_CRL_get_lastUpdate(x) ((x)->crl->lastUpdate)
-#define 	X509_CRL_get_nextUpdate(x) ((x)->crl->nextUpdate)
-#define		X509_CRL_get_issuer(x) ((x)->crl->issuer)
-#define		X509_CRL_get_REVOKED(x) ((x)->crl->revoked)
+#define     X509_CRL_get_version(x) ASN1_INTEGER_get((x)->crl->version)
+#define     X509_CRL_get_lastUpdate(x) ((x)->crl->lastUpdate)
+#define     X509_CRL_get_nextUpdate(x) ((x)->crl->nextUpdate)
+#define     X509_CRL_get_issuer(x) ((x)->crl->issuer)
+#define     X509_CRL_get_REVOKED(x) ((x)->crl->revoked)
 
 /* This one is only used so that a binary form can output, as in
  * i2d_X509_NAME(X509_get_X509_PUBKEY(x),&buf) */
-#define 	X509_get_X509_PUBKEY(x) ((x)->cert_info->key)
+#define     X509_get_X509_PUBKEY(x) ((x)->cert_info->key)
 
 
 const char *X509_verify_cert_error_string(long n);
@@ -767,15 +767,15 @@ int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md);
 int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md);
 
 int X509_pubkey_digest(const X509 *data,const EVP_MD *type,
-		unsigned char *md, unsigned int *len);
+        unsigned char *md, unsigned int *len);
 int X509_digest(const X509 *data,const EVP_MD *type,
-		unsigned char *md, unsigned int *len);
+        unsigned char *md, unsigned int *len);
 int X509_CRL_digest(const X509_CRL *data,const EVP_MD *type,
-		unsigned char *md, unsigned int *len);
+        unsigned char *md, unsigned int *len);
 int X509_REQ_digest(const X509_REQ *data,const EVP_MD *type,
-		unsigned char *md, unsigned int *len);
+        unsigned char *md, unsigned int *len);
 int X509_NAME_digest(const X509_NAME *data,const EVP_MD *type,
-		unsigned char *md, unsigned int *len);
+        unsigned char *md, unsigned int *len);
 #endif
 
 #ifndef OPENSSL_NO_FP_API
@@ -808,7 +808,7 @@ int   i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey);
 X509_SIG *d2i_PKCS8_fp(FILE *fp,X509_SIG **p8);
 int i2d_PKCS8_fp(FILE *fp,X509_SIG *p8);
 PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,
-						PKCS8_PRIV_KEY_INFO **p8inf);
+                        PKCS8_PRIV_KEY_INFO **p8inf);
 int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,PKCS8_PRIV_KEY_INFO *p8inf);
 int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key);
 int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey);
@@ -847,7 +847,7 @@ int   i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey);
 X509_SIG *d2i_PKCS8_bio(BIO *bp,X509_SIG **p8);
 int i2d_PKCS8_bio(BIO *bp,X509_SIG *p8);
 PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,
-						PKCS8_PRIV_KEY_INFO **p8inf);
+                        PKCS8_PRIV_KEY_INFO **p8inf);
 int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,PKCS8_PRIV_KEY_INFO *p8inf);
 int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key);
 int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey);
@@ -867,47 +867,47 @@ X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne);
 
 #endif /* !SSLEAY_MACROS */
 
-int		X509_cmp_time(ASN1_TIME *s, time_t *t);
-int		X509_cmp_current_time(ASN1_TIME *s);
-ASN1_TIME *	X509_time_adj(ASN1_TIME *s, long adj, time_t *t);
-ASN1_TIME *	X509_gmtime_adj(ASN1_TIME *s, long adj);
+int     X509_cmp_time(ASN1_TIME *s, time_t *t);
+int     X509_cmp_current_time(ASN1_TIME *s);
+ASN1_TIME * X509_time_adj(ASN1_TIME *s, long adj, time_t *t);
+ASN1_TIME * X509_gmtime_adj(ASN1_TIME *s, long adj);
 
-const char *	X509_get_default_cert_area(void );
-const char *	X509_get_default_cert_dir(void );
-const char *	X509_get_default_cert_file(void );
-const char *	X509_get_default_cert_dir_env(void );
-const char *	X509_get_default_cert_file_env(void );
-const char *	X509_get_default_private_dir(void );
+const char *    X509_get_default_cert_area(void );
+const char *    X509_get_default_cert_dir(void );
+const char *    X509_get_default_cert_file(void );
+const char *    X509_get_default_cert_dir_env(void );
+const char *    X509_get_default_cert_file_env(void );
+const char *    X509_get_default_private_dir(void );
 
-X509_REQ *	X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
-X509 *		X509_REQ_to_X509(X509_REQ *r, int days,EVP_PKEY *pkey);
+X509_REQ *  X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
+X509 *      X509_REQ_to_X509(X509_REQ *r, int days,EVP_PKEY *pkey);
 
 DECLARE_ASN1_FUNCTIONS(X509_ALGOR)
 DECLARE_ASN1_FUNCTIONS(X509_VAL)
 
 DECLARE_ASN1_FUNCTIONS(X509_PUBKEY)
 
-int		X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey);
-EVP_PKEY *	X509_PUBKEY_get(X509_PUBKEY *key);
-int		X509_get_pubkey_parameters(EVP_PKEY *pkey,
-					   STACK_OF(X509) *chain);
-int		i2d_PUBKEY(EVP_PKEY *a,unsigned char **pp);
-EVP_PKEY *	d2i_PUBKEY(EVP_PKEY **a,const unsigned char **pp,
-			long length);
+int     X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey);
+EVP_PKEY *  X509_PUBKEY_get(X509_PUBKEY *key);
+int     X509_get_pubkey_parameters(EVP_PKEY *pkey,
+                       STACK_OF(X509) *chain);
+int     i2d_PUBKEY(EVP_PKEY *a,unsigned char **pp);
+EVP_PKEY *  d2i_PUBKEY(EVP_PKEY **a,const unsigned char **pp,
+            long length);
 #ifndef OPENSSL_NO_RSA
-int		i2d_RSA_PUBKEY(RSA *a,unsigned char **pp);
-RSA *		d2i_RSA_PUBKEY(RSA **a,const unsigned char **pp,
-			long length);
+int     i2d_RSA_PUBKEY(RSA *a,unsigned char **pp);
+RSA *       d2i_RSA_PUBKEY(RSA **a,const unsigned char **pp,
+            long length);
 #endif
 #ifndef OPENSSL_NO_DSA
-int		i2d_DSA_PUBKEY(DSA *a,unsigned char **pp);
-DSA *		d2i_DSA_PUBKEY(DSA **a,const unsigned char **pp,
-			long length);
+int     i2d_DSA_PUBKEY(DSA *a,unsigned char **pp);
+DSA *       d2i_DSA_PUBKEY(DSA **a,const unsigned char **pp,
+            long length);
 #endif
 #ifndef OPENSSL_NO_EC
-int		i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp);
-EC_KEY 		*d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp,
-			long length);
+int     i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp);
+EC_KEY      *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp,
+            long length);
 #endif
 
 DECLARE_ASN1_FUNCTIONS(X509_SIG)
@@ -923,7 +923,7 @@ DECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY)
 
 DECLARE_ASN1_FUNCTIONS(X509_NAME)
 
-int		X509_NAME_set(X509_NAME **xn, X509_NAME *name);
+int     X509_NAME_set(X509_NAME **xn, X509_NAME *name);
 
 DECLARE_ASN1_FUNCTIONS(X509_CINF)
 
@@ -933,11 +933,11 @@ DECLARE_ASN1_FUNCTIONS(X509_CERT_AUX)
 DECLARE_ASN1_FUNCTIONS(X509_CERT_PAIR)
 
 int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
-	     CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+         CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
 int X509_set_ex_data(X509 *r, int idx, void *arg);
 void *X509_get_ex_data(X509 *r, int idx);
-int		i2d_X509_AUX(X509 *a,unsigned char **pp);
-X509 *		d2i_X509_AUX(X509 **a,const unsigned char **pp,long length);
+int     i2d_X509_AUX(X509 *a,unsigned char **pp);
+X509 *      d2i_X509_AUX(X509 **a,const unsigned char **pp,long length);
 
 int X509_alias_set1(X509 *x, unsigned char *name, int len);
 int X509_keyid_set1(X509 *x, unsigned char *id, int len);
@@ -956,83 +956,83 @@ DECLARE_ASN1_FUNCTIONS(X509_CRL)
 
 int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);
 
-X509_PKEY *	X509_PKEY_new(void );
-void		X509_PKEY_free(X509_PKEY *a);
-int		i2d_X509_PKEY(X509_PKEY *a,unsigned char **pp);
-X509_PKEY *	d2i_X509_PKEY(X509_PKEY **a,const unsigned char **pp,long length);
+X509_PKEY * X509_PKEY_new(void );
+void        X509_PKEY_free(X509_PKEY *a);
+int     i2d_X509_PKEY(X509_PKEY *a,unsigned char **pp);
+X509_PKEY * d2i_X509_PKEY(X509_PKEY **a,const unsigned char **pp,long length);
 
 DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI)
 DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC)
 DECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE)
 
 #ifndef OPENSSL_NO_EVP
-X509_INFO *	X509_INFO_new(void);
-void		X509_INFO_free(X509_INFO *a);
-char *		X509_NAME_oneline(X509_NAME *a,char *buf,int size);
+X509_INFO * X509_INFO_new(void);
+void        X509_INFO_free(X509_INFO *a);
+char *      X509_NAME_oneline(X509_NAME *a,char *buf,int size);
 
 int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1,
-		ASN1_BIT_STRING *signature,char *data,EVP_PKEY *pkey);
+        ASN1_BIT_STRING *signature,char *data,EVP_PKEY *pkey);
 
 int ASN1_digest(i2d_of_void *i2d,const EVP_MD *type,char *data,
-		unsigned char *md,unsigned int *len);
+        unsigned char *md,unsigned int *len);
 
 int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1,
-	      X509_ALGOR *algor2, ASN1_BIT_STRING *signature,
-	      char *data,EVP_PKEY *pkey, const EVP_MD *type);
+          X509_ALGOR *algor2, ASN1_BIT_STRING *signature,
+          char *data,EVP_PKEY *pkey, const EVP_MD *type);
 
 int ASN1_item_digest(const ASN1_ITEM *it,const EVP_MD *type,void *data,
-	unsigned char *md,unsigned int *len);
+    unsigned char *md,unsigned int *len);
 
 int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1,
-	ASN1_BIT_STRING *signature,void *data,EVP_PKEY *pkey);
+    ASN1_BIT_STRING *signature,void *data,EVP_PKEY *pkey);
 
 int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
-	ASN1_BIT_STRING *signature,
-	void *data, EVP_PKEY *pkey, const EVP_MD *type);
+    ASN1_BIT_STRING *signature,
+    void *data, EVP_PKEY *pkey, const EVP_MD *type);
 #endif
 
-int 		X509_set_version(X509 *x,long version);
-int 		X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial);
-ASN1_INTEGER *	X509_get_serialNumber(X509 *x);
-int 		X509_set_issuer_name(X509 *x, X509_NAME *name);
-X509_NAME *	X509_get_issuer_name(X509 *a);
-int 		X509_set_subject_name(X509 *x, X509_NAME *name);
-X509_NAME *	X509_get_subject_name(X509 *a);
-int 		X509_set_notBefore(X509 *x, ASN1_TIME *tm);
-int 		X509_set_notAfter(X509 *x, ASN1_TIME *tm);
-int 		X509_set_pubkey(X509 *x, EVP_PKEY *pkey);
-EVP_PKEY *	X509_get_pubkey(X509 *x);
+int         X509_set_version(X509 *x,long version);
+int         X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial);
+ASN1_INTEGER *  X509_get_serialNumber(X509 *x);
+int         X509_set_issuer_name(X509 *x, X509_NAME *name);
+X509_NAME * X509_get_issuer_name(X509 *a);
+int         X509_set_subject_name(X509 *x, X509_NAME *name);
+X509_NAME * X509_get_subject_name(X509 *a);
+int         X509_set_notBefore(X509 *x, ASN1_TIME *tm);
+int         X509_set_notAfter(X509 *x, ASN1_TIME *tm);
+int         X509_set_pubkey(X509 *x, EVP_PKEY *pkey);
+EVP_PKEY *  X509_get_pubkey(X509 *x);
 ASN1_BIT_STRING * X509_get0_pubkey_bitstr(const X509 *x);
-int		X509_certificate_type(X509 *x,EVP_PKEY *pubkey /* optional */);
+int     X509_certificate_type(X509 *x,EVP_PKEY *pubkey /* optional */);
 
-int		X509_REQ_set_version(X509_REQ *x,long version);
-int		X509_REQ_set_subject_name(X509_REQ *req,X509_NAME *name);
-int		X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey);
-EVP_PKEY *	X509_REQ_get_pubkey(X509_REQ *req);
-int		X509_REQ_extension_nid(int nid);
-int *		X509_REQ_get_extension_nids(void);
-void		X509_REQ_set_extension_nids(int *nids);
+int     X509_REQ_set_version(X509_REQ *x,long version);
+int     X509_REQ_set_subject_name(X509_REQ *req,X509_NAME *name);
+int     X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey);
+EVP_PKEY *  X509_REQ_get_pubkey(X509_REQ *req);
+int     X509_REQ_extension_nid(int nid);
+int *       X509_REQ_get_extension_nids(void);
+void        X509_REQ_set_extension_nids(int *nids);
 STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req);
 int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts,
-				int nid);
+                int nid);
 int X509_REQ_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts);
 int X509_REQ_get_attr_count(const X509_REQ *req);
 int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid,
-			  int lastpos);
+              int lastpos);
 int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, ASN1_OBJECT *obj,
-			  int lastpos);
+              int lastpos);
 X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc);
 X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc);
 int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr);
 int X509_REQ_add1_attr_by_OBJ(X509_REQ *req,
-			const ASN1_OBJECT *obj, int type,
-			const unsigned char *bytes, int len);
+            const ASN1_OBJECT *obj, int type,
+            const unsigned char *bytes, int len);
 int X509_REQ_add1_attr_by_NID(X509_REQ *req,
-			int nid, int type,
-			const unsigned char *bytes, int len);
+            int nid, int type,
+            const unsigned char *bytes, int len);
 int X509_REQ_add1_attr_by_txt(X509_REQ *req,
-			const char *attrname, int type,
-			const unsigned char *bytes, int len);
+            const char *attrname, int type,
+            const unsigned char *bytes, int len);
 
 int X509_CRL_set_version(X509_CRL *x, long version);
 int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name);
@@ -1043,191 +1043,191 @@ int X509_CRL_sort(X509_CRL *crl);
 int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial);
 int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm);
 
-int		X509_REQ_check_private_key(X509_REQ *x509,EVP_PKEY *pkey);
+int     X509_REQ_check_private_key(X509_REQ *x509,EVP_PKEY *pkey);
 
-int		X509_check_private_key(X509 *x509,EVP_PKEY *pkey);
+int     X509_check_private_key(X509 *x509,EVP_PKEY *pkey);
 
-int		X509_issuer_and_serial_cmp(const X509 *a, const X509 *b);
-unsigned long	X509_issuer_and_serial_hash(X509 *a);
+int     X509_issuer_and_serial_cmp(const X509 *a, const X509 *b);
+unsigned long   X509_issuer_and_serial_hash(X509 *a);
 
-int		X509_issuer_name_cmp(const X509 *a, const X509 *b);
-unsigned long	X509_issuer_name_hash(X509 *a);
+int     X509_issuer_name_cmp(const X509 *a, const X509 *b);
+unsigned long   X509_issuer_name_hash(X509 *a);
 
-int		X509_subject_name_cmp(const X509 *a, const X509 *b);
-unsigned long	X509_subject_name_hash(X509 *x);
+int     X509_subject_name_cmp(const X509 *a, const X509 *b);
+unsigned long   X509_subject_name_hash(X509 *x);
 
-int		X509_cmp(const X509 *a, const X509 *b);
-int		X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b);
-unsigned long	X509_NAME_hash(X509_NAME *x);
+int     X509_cmp(const X509 *a, const X509 *b);
+int     X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b);
+unsigned long   X509_NAME_hash(X509_NAME *x);
 
-int		X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b);
+int     X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b);
 #ifndef OPENSSL_NO_FP_API
-int		X509_print_ex_fp(FILE *bp,X509 *x, unsigned long nmflag, unsigned long cflag);
-int		X509_print_fp(FILE *bp,X509 *x);
-int		X509_CRL_print_fp(FILE *bp,X509_CRL *x);
-int		X509_REQ_print_fp(FILE *bp,X509_REQ *req);
+int     X509_print_ex_fp(FILE *bp,X509 *x, unsigned long nmflag, unsigned long cflag);
+int     X509_print_fp(FILE *bp,X509 *x);
+int     X509_CRL_print_fp(FILE *bp,X509_CRL *x);
+int     X509_REQ_print_fp(FILE *bp,X509_REQ *req);
 int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long flags);
 #endif
 
 #ifndef OPENSSL_NO_BIO
-int		X509_NAME_print(BIO *bp, X509_NAME *name, int obase);
+int     X509_NAME_print(BIO *bp, X509_NAME *name, int obase);
 int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent, unsigned long flags);
-int		X509_print_ex(BIO *bp,X509 *x, unsigned long nmflag, unsigned long cflag);
-int		X509_print(BIO *bp,X509 *x);
-int		X509_ocspid_print(BIO *bp,X509 *x);
-int		X509_CERT_AUX_print(BIO *bp,X509_CERT_AUX *x, int indent);
-int		X509_CRL_print(BIO *bp,X509_CRL *x);
-int		X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag, unsigned long cflag);
-int		X509_REQ_print(BIO *bp,X509_REQ *req);
+int     X509_print_ex(BIO *bp,X509 *x, unsigned long nmflag, unsigned long cflag);
+int     X509_print(BIO *bp,X509 *x);
+int     X509_ocspid_print(BIO *bp,X509 *x);
+int     X509_CERT_AUX_print(BIO *bp,X509_CERT_AUX *x, int indent);
+int     X509_CRL_print(BIO *bp,X509_CRL *x);
+int     X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag, unsigned long cflag);
+int     X509_REQ_print(BIO *bp,X509_REQ *req);
 #endif
 
-int 		X509_NAME_entry_count(X509_NAME *name);
-int 		X509_NAME_get_text_by_NID(X509_NAME *name, int nid,
-			char *buf,int len);
-int		X509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj,
-			char *buf,int len);
+int         X509_NAME_entry_count(X509_NAME *name);
+int         X509_NAME_get_text_by_NID(X509_NAME *name, int nid,
+            char *buf,int len);
+int     X509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj,
+            char *buf,int len);
 
 /* NOTE: you should be passsing -1, not 0 as lastpos.  The functions that use
  * lastpos, search after that position on. */
-int 		X509_NAME_get_index_by_NID(X509_NAME *name,int nid,int lastpos);
-int 		X509_NAME_get_index_by_OBJ(X509_NAME *name,ASN1_OBJECT *obj,
-			int lastpos);
+int         X509_NAME_get_index_by_NID(X509_NAME *name,int nid,int lastpos);
+int         X509_NAME_get_index_by_OBJ(X509_NAME *name,ASN1_OBJECT *obj,
+            int lastpos);
 X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc);
 X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc);
-int 		X509_NAME_add_entry(X509_NAME *name,X509_NAME_ENTRY *ne,
-			int loc, int set);
+int         X509_NAME_add_entry(X509_NAME *name,X509_NAME_ENTRY *ne,
+            int loc, int set);
 int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type,
-			unsigned char *bytes, int len, int loc, int set);
+            unsigned char *bytes, int len, int loc, int set);
 int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type,
-			unsigned char *bytes, int len, int loc, int set);
+            unsigned char *bytes, int len, int loc, int set);
 X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne,
-		const char *field, int type, const unsigned char *bytes, int len);
+        const char *field, int type, const unsigned char *bytes, int len);
 X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid,
-			int type,unsigned char *bytes, int len);
+            int type,unsigned char *bytes, int len);
 int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type,
-			const unsigned char *bytes, int len, int loc, int set);
+            const unsigned char *bytes, int len, int loc, int set);
 X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne,
-			ASN1_OBJECT *obj, int type,const unsigned char *bytes,
-			int len);
-int 		X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne,
-			ASN1_OBJECT *obj);
-int 		X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type,
-			const unsigned char *bytes, int len);
-ASN1_OBJECT *	X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne);
-ASN1_STRING *	X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne);
+            ASN1_OBJECT *obj, int type,const unsigned char *bytes,
+            int len);
+int         X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne,
+            ASN1_OBJECT *obj);
+int         X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type,
+            const unsigned char *bytes, int len);
+ASN1_OBJECT *   X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne);
+ASN1_STRING *   X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne);
 
-int		X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x);
-int		X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x,
-				      int nid, int lastpos);
-int		X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x,
-				      ASN1_OBJECT *obj,int lastpos);
-int		X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x,
-					   int crit, int lastpos);
+int     X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x);
+int     X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x,
+                      int nid, int lastpos);
+int     X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x,
+                      ASN1_OBJECT *obj,int lastpos);
+int     X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x,
+                       int crit, int lastpos);
 X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc);
 X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc);
 STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x,
-					 X509_EXTENSION *ex, int loc);
+                     X509_EXTENSION *ex, int loc);
 
-int		X509_get_ext_count(X509 *x);
-int		X509_get_ext_by_NID(X509 *x, int nid, int lastpos);
-int		X509_get_ext_by_OBJ(X509 *x,ASN1_OBJECT *obj,int lastpos);
-int		X509_get_ext_by_critical(X509 *x, int crit, int lastpos);
+int     X509_get_ext_count(X509 *x);
+int     X509_get_ext_by_NID(X509 *x, int nid, int lastpos);
+int     X509_get_ext_by_OBJ(X509 *x,ASN1_OBJECT *obj,int lastpos);
+int     X509_get_ext_by_critical(X509 *x, int crit, int lastpos);
 X509_EXTENSION *X509_get_ext(X509 *x, int loc);
 X509_EXTENSION *X509_delete_ext(X509 *x, int loc);
-int		X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc);
-void	*	X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx);
-int		X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,
-							unsigned long flags);
+int     X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc);
+void    *   X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx);
+int     X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,
+                            unsigned long flags);
 
-int		X509_CRL_get_ext_count(X509_CRL *x);
-int		X509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos);
-int		X509_CRL_get_ext_by_OBJ(X509_CRL *x,ASN1_OBJECT *obj,int lastpos);
-int		X509_CRL_get_ext_by_critical(X509_CRL *x, int crit, int lastpos);
+int     X509_CRL_get_ext_count(X509_CRL *x);
+int     X509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos);
+int     X509_CRL_get_ext_by_OBJ(X509_CRL *x,ASN1_OBJECT *obj,int lastpos);
+int     X509_CRL_get_ext_by_critical(X509_CRL *x, int crit, int lastpos);
 X509_EXTENSION *X509_CRL_get_ext(X509_CRL *x, int loc);
 X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc);
-int		X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc);
-void	*	X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx);
-int		X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit,
-							unsigned long flags);
+int     X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc);
+void    *   X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx);
+int     X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit,
+                            unsigned long flags);
 
-int		X509_REVOKED_get_ext_count(X509_REVOKED *x);
-int		X509_REVOKED_get_ext_by_NID(X509_REVOKED *x, int nid, int lastpos);
-int		X509_REVOKED_get_ext_by_OBJ(X509_REVOKED *x,ASN1_OBJECT *obj,int lastpos);
-int		X509_REVOKED_get_ext_by_critical(X509_REVOKED *x, int crit, int lastpos);
+int     X509_REVOKED_get_ext_count(X509_REVOKED *x);
+int     X509_REVOKED_get_ext_by_NID(X509_REVOKED *x, int nid, int lastpos);
+int     X509_REVOKED_get_ext_by_OBJ(X509_REVOKED *x,ASN1_OBJECT *obj,int lastpos);
+int     X509_REVOKED_get_ext_by_critical(X509_REVOKED *x, int crit, int lastpos);
 X509_EXTENSION *X509_REVOKED_get_ext(X509_REVOKED *x, int loc);
 X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc);
-int		X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc);
-void	*	X509_REVOKED_get_ext_d2i(X509_REVOKED *x, int nid, int *crit, int *idx);
-int		X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit,
-							unsigned long flags);
+int     X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc);
+void    *   X509_REVOKED_get_ext_d2i(X509_REVOKED *x, int nid, int *crit, int *idx);
+int     X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit,
+                            unsigned long flags);
 
 X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex,
-			int nid, int crit, ASN1_OCTET_STRING *data);
+            int nid, int crit, ASN1_OCTET_STRING *data);
 X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex,
-			ASN1_OBJECT *obj,int crit,ASN1_OCTET_STRING *data);
-int		X509_EXTENSION_set_object(X509_EXTENSION *ex,ASN1_OBJECT *obj);
-int		X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit);
-int		X509_EXTENSION_set_data(X509_EXTENSION *ex,
-			ASN1_OCTET_STRING *data);
-ASN1_OBJECT *	X509_EXTENSION_get_object(X509_EXTENSION *ex);
+            ASN1_OBJECT *obj,int crit,ASN1_OCTET_STRING *data);
+int     X509_EXTENSION_set_object(X509_EXTENSION *ex,ASN1_OBJECT *obj);
+int     X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit);
+int     X509_EXTENSION_set_data(X509_EXTENSION *ex,
+            ASN1_OCTET_STRING *data);
+ASN1_OBJECT *   X509_EXTENSION_get_object(X509_EXTENSION *ex);
 ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne);
-int		X509_EXTENSION_get_critical(X509_EXTENSION *ex);
+int     X509_EXTENSION_get_critical(X509_EXTENSION *ex);
 
 int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x);
 int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid,
-			  int lastpos);
+              int lastpos);
 int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk, ASN1_OBJECT *obj,
-			  int lastpos);
+              int lastpos);
 X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc);
 X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc);
 STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x,
-					 X509_ATTRIBUTE *attr);
+                     X509_ATTRIBUTE *attr);
 STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) **x,
-			const ASN1_OBJECT *obj, int type,
-			const unsigned char *bytes, int len);
+            const ASN1_OBJECT *obj, int type,
+            const unsigned char *bytes, int len);
 STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) **x,
-			int nid, int type,
-			const unsigned char *bytes, int len);
+            int nid, int type,
+            const unsigned char *bytes, int len);
 STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) **x,
-			const char *attrname, int type,
-			const unsigned char *bytes, int len);
+            const char *attrname, int type,
+            const unsigned char *bytes, int len);
 X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid,
-	     int atrtype, const void *data, int len);
+         int atrtype, const void *data, int len);
 X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr,
-	     const ASN1_OBJECT *obj, int atrtype, const void *data, int len);
+         const ASN1_OBJECT *obj, int atrtype, const void *data, int len);
 X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr,
-		const char *atrname, int type, const unsigned char *bytes, int len);
+        const char *atrname, int type, const unsigned char *bytes, int len);
 int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj);
 int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *data, int len);
 void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx,
-					int atrtype, void *data);
+                    int atrtype, void *data);
 int X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr);
 ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr);
 ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx);
 
 int EVP_PKEY_get_attr_count(const EVP_PKEY *key);
 int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid,
-			  int lastpos);
+              int lastpos);
 int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, ASN1_OBJECT *obj,
-			  int lastpos);
+              int lastpos);
 X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc);
 X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc);
 int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr);
 int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key,
-			const ASN1_OBJECT *obj, int type,
-			const unsigned char *bytes, int len);
+            const ASN1_OBJECT *obj, int type,
+            const unsigned char *bytes, int len);
 int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key,
-			int nid, int type,
-			const unsigned char *bytes, int len);
+            int nid, int type,
+            const unsigned char *bytes, int len);
 int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key,
-			const char *attrname, int type,
-			const unsigned char *bytes, int len);
+            const char *attrname, int type,
+            const unsigned char *bytes, int len);
 
-int		X509_verify_cert(X509_STORE_CTX *ctx);
+int     X509_verify_cert(X509_STORE_CTX *ctx);
 
 /* lookup a cert from a X509 STACK */
 X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk,X509_NAME *name,
-				     ASN1_INTEGER *serial);
+                     ASN1_INTEGER *serial);
 X509 *X509_find_by_subject(STACK_OF(X509) *sk,X509_NAME *name);
 
 DECLARE_ASN1_FUNCTIONS(PBEPARAM)
@@ -1236,7 +1236,7 @@ DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM)
 
 X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt, int saltlen);
 X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
-					 unsigned char *salt, int saltlen);
+                     unsigned char *salt, int saltlen);
 
 /* PKCS#8 utilities */
 
@@ -1252,7 +1252,7 @@ int X509_TRUST_get_count(void);
 X509_TRUST * X509_TRUST_get0(int idx);
 int X509_TRUST_get_by_id(int id);
 int X509_TRUST_add(int id, int flags, int (*ck)(X509_TRUST *, X509 *, int),
-					char *name, int arg1, void *arg2);
+                    char *name, int arg1, void *arg2);
 void X509_TRUST_cleanup(void);
 int X509_TRUST_get_flags(X509_TRUST *xp);
 char *X509_TRUST_get0_name(X509_TRUST *xp);
@@ -1267,76 +1267,76 @@ void ERR_load_X509_strings(void);
 /* Error codes for the X509 functions. */
 
 /* Function codes. */
-#define X509_F_ADD_CERT_DIR				 100
-#define X509_F_BY_FILE_CTRL				 101
-#define X509_F_CHECK_POLICY				 145
-#define X509_F_DIR_CTRL					 102
-#define X509_F_GET_CERT_BY_SUBJECT			 103
-#define X509_F_NETSCAPE_SPKI_B64_DECODE			 129
-#define X509_F_NETSCAPE_SPKI_B64_ENCODE			 130
-#define X509_F_X509AT_ADD1_ATTR				 135
-#define X509_F_X509V3_ADD_EXT				 104
-#define X509_F_X509_ATTRIBUTE_CREATE_BY_NID		 136
-#define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ		 137
-#define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT		 140
-#define X509_F_X509_ATTRIBUTE_GET0_DATA			 139
-#define X509_F_X509_ATTRIBUTE_SET1_DATA			 138
-#define X509_F_X509_CHECK_PRIVATE_KEY			 128
-#define X509_F_X509_CRL_PRINT_FP			 147
-#define X509_F_X509_EXTENSION_CREATE_BY_NID		 108
-#define X509_F_X509_EXTENSION_CREATE_BY_OBJ		 109
-#define X509_F_X509_GET_PUBKEY_PARAMETERS		 110
-#define X509_F_X509_LOAD_CERT_CRL_FILE			 132
-#define X509_F_X509_LOAD_CERT_FILE			 111
-#define X509_F_X509_LOAD_CRL_FILE			 112
-#define X509_F_X509_NAME_ADD_ENTRY			 113
-#define X509_F_X509_NAME_ENTRY_CREATE_BY_NID		 114
-#define X509_F_X509_NAME_ENTRY_CREATE_BY_TXT		 131
-#define X509_F_X509_NAME_ENTRY_SET_OBJECT		 115
-#define X509_F_X509_NAME_ONELINE			 116
-#define X509_F_X509_NAME_PRINT				 117
-#define X509_F_X509_PRINT_EX_FP				 118
-#define X509_F_X509_PUBKEY_GET				 119
-#define X509_F_X509_PUBKEY_SET				 120
-#define X509_F_X509_REQ_CHECK_PRIVATE_KEY		 144
-#define X509_F_X509_REQ_PRINT_EX			 121
-#define X509_F_X509_REQ_PRINT_FP			 122
-#define X509_F_X509_REQ_TO_X509				 123
-#define X509_F_X509_STORE_ADD_CERT			 124
-#define X509_F_X509_STORE_ADD_CRL			 125
-#define X509_F_X509_STORE_CTX_GET1_ISSUER		 146
-#define X509_F_X509_STORE_CTX_INIT			 143
-#define X509_F_X509_STORE_CTX_NEW			 142
-#define X509_F_X509_STORE_CTX_PURPOSE_INHERIT		 134
-#define X509_F_X509_TO_X509_REQ				 126
-#define X509_F_X509_TRUST_ADD				 133
-#define X509_F_X509_TRUST_SET				 141
-#define X509_F_X509_VERIFY_CERT				 127
+#define X509_F_ADD_CERT_DIR              100
+#define X509_F_BY_FILE_CTRL              101
+#define X509_F_CHECK_POLICY              145
+#define X509_F_DIR_CTRL                  102
+#define X509_F_GET_CERT_BY_SUBJECT           103
+#define X509_F_NETSCAPE_SPKI_B64_DECODE          129
+#define X509_F_NETSCAPE_SPKI_B64_ENCODE          130
+#define X509_F_X509AT_ADD1_ATTR              135
+#define X509_F_X509V3_ADD_EXT                104
+#define X509_F_X509_ATTRIBUTE_CREATE_BY_NID      136
+#define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ      137
+#define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT      140
+#define X509_F_X509_ATTRIBUTE_GET0_DATA          139
+#define X509_F_X509_ATTRIBUTE_SET1_DATA          138
+#define X509_F_X509_CHECK_PRIVATE_KEY            128
+#define X509_F_X509_CRL_PRINT_FP             147
+#define X509_F_X509_EXTENSION_CREATE_BY_NID      108
+#define X509_F_X509_EXTENSION_CREATE_BY_OBJ      109
+#define X509_F_X509_GET_PUBKEY_PARAMETERS        110
+#define X509_F_X509_LOAD_CERT_CRL_FILE           132
+#define X509_F_X509_LOAD_CERT_FILE           111
+#define X509_F_X509_LOAD_CRL_FILE            112
+#define X509_F_X509_NAME_ADD_ENTRY           113
+#define X509_F_X509_NAME_ENTRY_CREATE_BY_NID         114
+#define X509_F_X509_NAME_ENTRY_CREATE_BY_TXT         131
+#define X509_F_X509_NAME_ENTRY_SET_OBJECT        115
+#define X509_F_X509_NAME_ONELINE             116
+#define X509_F_X509_NAME_PRINT               117
+#define X509_F_X509_PRINT_EX_FP              118
+#define X509_F_X509_PUBKEY_GET               119
+#define X509_F_X509_PUBKEY_SET               120
+#define X509_F_X509_REQ_CHECK_PRIVATE_KEY        144
+#define X509_F_X509_REQ_PRINT_EX             121
+#define X509_F_X509_REQ_PRINT_FP             122
+#define X509_F_X509_REQ_TO_X509              123
+#define X509_F_X509_STORE_ADD_CERT           124
+#define X509_F_X509_STORE_ADD_CRL            125
+#define X509_F_X509_STORE_CTX_GET1_ISSUER        146
+#define X509_F_X509_STORE_CTX_INIT           143
+#define X509_F_X509_STORE_CTX_NEW            142
+#define X509_F_X509_STORE_CTX_PURPOSE_INHERIT        134
+#define X509_F_X509_TO_X509_REQ              126
+#define X509_F_X509_TRUST_ADD                133
+#define X509_F_X509_TRUST_SET                141
+#define X509_F_X509_VERIFY_CERT              127
 
 /* Reason codes. */
-#define X509_R_BAD_X509_FILETYPE			 100
-#define X509_R_BASE64_DECODE_ERROR			 118
-#define X509_R_CANT_CHECK_DH_KEY			 114
-#define X509_R_CERT_ALREADY_IN_HASH_TABLE		 101
-#define X509_R_ERR_ASN1_LIB				 102
-#define X509_R_INVALID_DIRECTORY			 113
-#define X509_R_INVALID_FIELD_NAME			 119
-#define X509_R_INVALID_TRUST				 123
-#define X509_R_KEY_TYPE_MISMATCH			 115
-#define X509_R_KEY_VALUES_MISMATCH			 116
-#define X509_R_LOADING_CERT_DIR				 103
-#define X509_R_LOADING_DEFAULTS				 104
-#define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY		 105
-#define X509_R_SHOULD_RETRY				 106
-#define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN	 107
-#define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY		 108
-#define X509_R_UNKNOWN_KEY_TYPE				 117
-#define X509_R_UNKNOWN_NID				 109
-#define X509_R_UNKNOWN_PURPOSE_ID			 121
-#define X509_R_UNKNOWN_TRUST_ID				 120
-#define X509_R_UNSUPPORTED_ALGORITHM			 111
-#define X509_R_WRONG_LOOKUP_TYPE			 112
-#define X509_R_WRONG_TYPE				 122
+#define X509_R_BAD_X509_FILETYPE             100
+#define X509_R_BASE64_DECODE_ERROR           118
+#define X509_R_CANT_CHECK_DH_KEY             114
+#define X509_R_CERT_ALREADY_IN_HASH_TABLE        101
+#define X509_R_ERR_ASN1_LIB              102
+#define X509_R_INVALID_DIRECTORY             113
+#define X509_R_INVALID_FIELD_NAME            119
+#define X509_R_INVALID_TRUST                 123
+#define X509_R_KEY_TYPE_MISMATCH             115
+#define X509_R_KEY_VALUES_MISMATCH           116
+#define X509_R_LOADING_CERT_DIR              103
+#define X509_R_LOADING_DEFAULTS              104
+#define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY      105
+#define X509_R_SHOULD_RETRY              106
+#define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN    107
+#define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY        108
+#define X509_R_UNKNOWN_KEY_TYPE              117
+#define X509_R_UNKNOWN_NID               109
+#define X509_R_UNKNOWN_PURPOSE_ID            121
+#define X509_R_UNKNOWN_TRUST_ID              120
+#define X509_R_UNSUPPORTED_ALGORITHM             111
+#define X509_R_WRONG_LOOKUP_TYPE             112
+#define X509_R_WRONG_TYPE                122
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/x509_vfy.h b/dep/include/openssl/x509_vfy.h
index 76c76e17193..78b6227a4ee 100644
--- a/dep/include/openssl/x509_vfy.h
+++ b/dep/include/openssl/x509_vfy.h
@@ -5,21 +5,21 @@
  * This package is an SSL implementation written
  * by Eric Young (eay@cryptsoft.com).
  * The implementation was written so as to conform with Netscapes SSL.
- * 
+ *
  * This library is free for commercial and non-commercial use as long as
  * the following conditions are aheared to.  The following conditions
  * apply to all code found in this distribution, be it the RC4, RSA,
  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
  * included with this distribution is covered by the same copyright terms
  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
+ *
  * Copyright remains Eric Young's, and as such any Copyright notices in
  * the code are not to be removed.
  * If this package is used in a product, Eric Young should be given attribution
  * as the author of the parts of the library used.
  * This can be in the form of a textual message at program startup or
  * in documentation (online or textual) provided with the package.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -34,10 +34,10 @@
  *     Eric Young (eay@cryptsoft.com)"
  *    The word 'cryptographic' can be left out if the rouines from the library
  *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
+ * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
+ *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
@@ -79,31 +79,31 @@ extern "C" {
 
 /* Outer object */
 typedef struct x509_hash_dir_st
-	{
-	int num_dirs;
-	char **dirs;
-	int *dirs_type;
-	int num_dirs_alloced;
-	} X509_HASH_DIR_CTX;
+    {
+    int num_dirs;
+    char **dirs;
+    int *dirs_type;
+    int num_dirs_alloced;
+    } X509_HASH_DIR_CTX;
 
 typedef struct x509_file_st
-	{
-	int num_paths;	/* number of paths to files or directories */
-	int num_alloced;
-	char **paths;	/* the list of paths or directories */
-	int *path_type;
-	} X509_CERT_FILE_CTX;
+    {
+    int num_paths;  /* number of paths to files or directories */
+    int num_alloced;
+    char **paths;   /* the list of paths or directories */
+    int *path_type;
+    } X509_CERT_FILE_CTX;
 
 /*******************************/
 /*
-SSL_CTX -> X509_STORE    
-		-> X509_LOOKUP
-			->X509_LOOKUP_METHOD
-		-> X509_LOOKUP
-			->X509_LOOKUP_METHOD
- 
-SSL	-> X509_STORE_CTX
-		->X509_STORE    
+SSL_CTX -> X509_STORE
+        -> X509_LOOKUP
+            ->X509_LOOKUP_METHOD
+        -> X509_LOOKUP
+            ->X509_LOOKUP_METHOD
+
+SSL -> X509_STORE_CTX
+        ->X509_STORE
 
 The X509_STORE holds the tables etc for verification stuff.
 A X509_STORE_CTX is used while validating a single certificate.
@@ -112,23 +112,23 @@ The X509_STORE then calls a function to actually verify the
 certificate chain.
 */
 
-#define X509_LU_RETRY		-1
-#define X509_LU_FAIL		0
-#define X509_LU_X509		1
-#define X509_LU_CRL		2
-#define X509_LU_PKEY		3
+#define X509_LU_RETRY       -1
+#define X509_LU_FAIL        0
+#define X509_LU_X509        1
+#define X509_LU_CRL     2
+#define X509_LU_PKEY        3
 
 typedef struct x509_object_st
-	{
-	/* one of the above types */
-	int type;
-	union	{
-		char *ptr;
-		X509 *x509;
-		X509_CRL *crl;
-		EVP_PKEY *pkey;
-		} data;
-	} X509_OBJECT;
+    {
+    /* one of the above types */
+    int type;
+    union   {
+        char *ptr;
+        X509 *x509;
+        X509_CRL *crl;
+        EVP_PKEY *pkey;
+        } data;
+    } X509_OBJECT;
 
 typedef struct x509_lookup_st X509_LOOKUP;
 
@@ -137,24 +137,24 @@ DECLARE_STACK_OF(X509_OBJECT)
 
 /* This is a static that defines the function interface */
 typedef struct x509_lookup_method_st
-	{
-	const char *name;
-	int (*new_item)(X509_LOOKUP *ctx);
-	void (*free)(X509_LOOKUP *ctx);
-	int (*init)(X509_LOOKUP *ctx);
-	int (*shutdown)(X509_LOOKUP *ctx);
-	int (*ctrl)(X509_LOOKUP *ctx,int cmd,const char *argc,long argl,
-			char **ret);
-	int (*get_by_subject)(X509_LOOKUP *ctx,int type,X509_NAME *name,
-			      X509_OBJECT *ret);
-	int (*get_by_issuer_serial)(X509_LOOKUP *ctx,int type,X509_NAME *name,
-				    ASN1_INTEGER *serial,X509_OBJECT *ret);
-	int (*get_by_fingerprint)(X509_LOOKUP *ctx,int type,
-				  unsigned char *bytes,int len,
-				  X509_OBJECT *ret);
-	int (*get_by_alias)(X509_LOOKUP *ctx,int type,char *str,int len,
-			    X509_OBJECT *ret);
-	} X509_LOOKUP_METHOD;
+    {
+    const char *name;
+    int (*new_item)(X509_LOOKUP *ctx);
+    void (*free)(X509_LOOKUP *ctx);
+    int (*init)(X509_LOOKUP *ctx);
+    int (*shutdown)(X509_LOOKUP *ctx);
+    int (*ctrl)(X509_LOOKUP *ctx,int cmd,const char *argc,long argl,
+            char **ret);
+    int (*get_by_subject)(X509_LOOKUP *ctx,int type,X509_NAME *name,
+                  X509_OBJECT *ret);
+    int (*get_by_issuer_serial)(X509_LOOKUP *ctx,int type,X509_NAME *name,
+                    ASN1_INTEGER *serial,X509_OBJECT *ret);
+    int (*get_by_fingerprint)(X509_LOOKUP *ctx,int type,
+                  unsigned char *bytes,int len,
+                  X509_OBJECT *ret);
+    int (*get_by_alias)(X509_LOOKUP *ctx,int type,char *str,int len,
+                X509_OBJECT *ret);
+    } X509_LOOKUP_METHOD;
 
 /* This structure hold all parameters associated with a verify operation
  * by including an X509_VERIFY_PARAM structure in related structures the
@@ -162,16 +162,16 @@ typedef struct x509_lookup_method_st
  */
 
 typedef struct X509_VERIFY_PARAM_st
-	{
-	char *name;
-	time_t check_time;	/* Time to use */
-	unsigned long inh_flags; /* Inheritance flags */
-	unsigned long flags;	/* Various verify flags */
-	int purpose;		/* purpose to check untrusted certificates */
-	int trust;		/* trust setting to check */
-	int depth;		/* Verify depth */
-	STACK_OF(ASN1_OBJECT) *policies;	/* Permissible policies */
-	} X509_VERIFY_PARAM;
+    {
+    char *name;
+    time_t check_time;  /* Time to use */
+    unsigned long inh_flags; /* Inheritance flags */
+    unsigned long flags;    /* Various verify flags */
+    int purpose;        /* purpose to check untrusted certificates */
+    int trust;      /* trust setting to check */
+    int depth;      /* Verify depth */
+    STACK_OF(ASN1_OBJECT) *policies;    /* Permissible policies */
+    } X509_VERIFY_PARAM;
 
 DECLARE_STACK_OF(X509_VERIFY_PARAM)
 
@@ -179,204 +179,204 @@ DECLARE_STACK_OF(X509_VERIFY_PARAM)
  * validation.  Once we have a certificate chain, the 'verify'
  * function is then called to actually check the cert chain. */
 struct x509_store_st
-	{
-	/* The following is a cache of trusted certs */
-	int cache; 	/* if true, stash any hits */
-	STACK_OF(X509_OBJECT) *objs;	/* Cache of all objects */
+    {
+    /* The following is a cache of trusted certs */
+    int cache;  /* if true, stash any hits */
+    STACK_OF(X509_OBJECT) *objs;    /* Cache of all objects */
 
-	/* These are external lookup methods */
-	STACK_OF(X509_LOOKUP) *get_cert_methods;
+    /* These are external lookup methods */
+    STACK_OF(X509_LOOKUP) *get_cert_methods;
 
-	X509_VERIFY_PARAM *param;
+    X509_VERIFY_PARAM *param;
 
-	/* Callbacks for various operations */
-	int (*verify)(X509_STORE_CTX *ctx);	/* called to verify a certificate */
-	int (*verify_cb)(int ok,X509_STORE_CTX *ctx);	/* error callback */
-	int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);	/* get issuers cert from ctx */
-	int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */
-	int (*check_revocation)(X509_STORE_CTX *ctx); /* Check revocation status of chain */
-	int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */
-	int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */
-	int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */
-	int (*cleanup)(X509_STORE_CTX *ctx);
+    /* Callbacks for various operations */
+    int (*verify)(X509_STORE_CTX *ctx); /* called to verify a certificate */
+    int (*verify_cb)(int ok,X509_STORE_CTX *ctx);   /* error callback */
+    int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); /* get issuers cert from ctx */
+    int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */
+    int (*check_revocation)(X509_STORE_CTX *ctx); /* Check revocation status of chain */
+    int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */
+    int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */
+    int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */
+    int (*cleanup)(X509_STORE_CTX *ctx);
 
-	CRYPTO_EX_DATA ex_data;
-	int references;
-	} /* X509_STORE */;
+    CRYPTO_EX_DATA ex_data;
+    int references;
+    } /* X509_STORE */;
 
 int X509_STORE_set_depth(X509_STORE *store, int depth);
 
 #define X509_STORE_set_verify_cb_func(ctx,func) ((ctx)->verify_cb=(func))
-#define X509_STORE_set_verify_func(ctx,func)	((ctx)->verify=(func))
+#define X509_STORE_set_verify_func(ctx,func)    ((ctx)->verify=(func))
 
 /* This is the functions plus an instance of the local variables. */
 struct x509_lookup_st
-	{
-	int init;			/* have we been started */
-	int skip;			/* don't use us. */
-	X509_LOOKUP_METHOD *method;	/* the functions */
-	char *method_data;		/* method data */
+    {
+    int init;           /* have we been started */
+    int skip;           /* don't use us. */
+    X509_LOOKUP_METHOD *method; /* the functions */
+    char *method_data;      /* method data */
 
-	X509_STORE *store_ctx;	/* who owns us */
-	} /* X509_LOOKUP */;
+    X509_STORE *store_ctx;  /* who owns us */
+    } /* X509_LOOKUP */;
 
 /* This is a used when verifying cert chains.  Since the
  * gathering of the cert chain can take some time (and have to be
  * 'retried', this needs to be kept and passed around. */
 struct x509_store_ctx_st      /* X509_STORE_CTX */
-	{
-	X509_STORE *ctx;
-	int current_method;	/* used when looking up certs */
+    {
+    X509_STORE *ctx;
+    int current_method; /* used when looking up certs */
 
-	/* The following are set by the caller */
-	X509 *cert;		/* The cert to check */
-	STACK_OF(X509) *untrusted;	/* chain of X509s - untrusted - passed in */
-	STACK_OF(X509_CRL) *crls;	/* set of CRLs passed in */
+    /* The following are set by the caller */
+    X509 *cert;     /* The cert to check */
+    STACK_OF(X509) *untrusted;  /* chain of X509s - untrusted - passed in */
+    STACK_OF(X509_CRL) *crls;   /* set of CRLs passed in */
 
-	X509_VERIFY_PARAM *param;
-	void *other_ctx;	/* Other info for use with get_issuer() */
+    X509_VERIFY_PARAM *param;
+    void *other_ctx;    /* Other info for use with get_issuer() */
 
-	/* Callbacks for various operations */
-	int (*verify)(X509_STORE_CTX *ctx);	/* called to verify a certificate */
-	int (*verify_cb)(int ok,X509_STORE_CTX *ctx);		/* error callback */
-	int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);	/* get issuers cert from ctx */
-	int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */
-	int (*check_revocation)(X509_STORE_CTX *ctx); /* Check revocation status of chain */
-	int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */
-	int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */
-	int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */
-	int (*check_policy)(X509_STORE_CTX *ctx);
-	int (*cleanup)(X509_STORE_CTX *ctx);
+    /* Callbacks for various operations */
+    int (*verify)(X509_STORE_CTX *ctx); /* called to verify a certificate */
+    int (*verify_cb)(int ok,X509_STORE_CTX *ctx);       /* error callback */
+    int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); /* get issuers cert from ctx */
+    int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */
+    int (*check_revocation)(X509_STORE_CTX *ctx); /* Check revocation status of chain */
+    int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */
+    int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */
+    int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */
+    int (*check_policy)(X509_STORE_CTX *ctx);
+    int (*cleanup)(X509_STORE_CTX *ctx);
 
-	/* The following is built up */
-	int valid;		/* if 0, rebuild chain */
-	int last_untrusted;	/* index of last untrusted cert */
-	STACK_OF(X509) *chain; 		/* chain of X509s - built up and trusted */
-	X509_POLICY_TREE *tree;	/* Valid policy tree */
+    /* The following is built up */
+    int valid;      /* if 0, rebuild chain */
+    int last_untrusted; /* index of last untrusted cert */
+    STACK_OF(X509) *chain;      /* chain of X509s - built up and trusted */
+    X509_POLICY_TREE *tree; /* Valid policy tree */
 
-	int explicit_policy;	/* Require explicit policy value */
+    int explicit_policy;    /* Require explicit policy value */
 
-	/* When something goes wrong, this is why */
-	int error_depth;
-	int error;
-	X509 *current_cert;
-	X509 *current_issuer;	/* cert currently being tested as valid issuer */
-	X509_CRL *current_crl;	/* current CRL */
+    /* When something goes wrong, this is why */
+    int error_depth;
+    int error;
+    X509 *current_cert;
+    X509 *current_issuer;   /* cert currently being tested as valid issuer */
+    X509_CRL *current_crl;  /* current CRL */
 
-	CRYPTO_EX_DATA ex_data;
-	} /* X509_STORE_CTX */;
+    CRYPTO_EX_DATA ex_data;
+    } /* X509_STORE_CTX */;
 
 void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth);
 
 #define X509_STORE_CTX_set_app_data(ctx,data) \
-	X509_STORE_CTX_set_ex_data(ctx,0,data)
+    X509_STORE_CTX_set_ex_data(ctx,0,data)
 #define X509_STORE_CTX_get_app_data(ctx) \
-	X509_STORE_CTX_get_ex_data(ctx,0)
+    X509_STORE_CTX_get_ex_data(ctx,0)
 
-#define X509_L_FILE_LOAD	1
-#define X509_L_ADD_DIR		2
+#define X509_L_FILE_LOAD    1
+#define X509_L_ADD_DIR      2
 
 #define X509_LOOKUP_load_file(x,name,type) \
-		X509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL)
+        X509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL)
 
 #define X509_LOOKUP_add_dir(x,name,type) \
-		X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL)
+        X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL)
 
-#define		X509_V_OK					0
+#define     X509_V_OK                   0
 /* illegal error (for uninitialized values, to avoid X509_V_OK): 1 */
 
-#define		X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT		2
-#define		X509_V_ERR_UNABLE_TO_GET_CRL			3
-#define		X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE	4
-#define		X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE	5
-#define		X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY	6
-#define		X509_V_ERR_CERT_SIGNATURE_FAILURE		7
-#define		X509_V_ERR_CRL_SIGNATURE_FAILURE		8
-#define		X509_V_ERR_CERT_NOT_YET_VALID			9
-#define		X509_V_ERR_CERT_HAS_EXPIRED			10
-#define		X509_V_ERR_CRL_NOT_YET_VALID			11
-#define		X509_V_ERR_CRL_HAS_EXPIRED			12
-#define		X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD	13
-#define		X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD	14
-#define		X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD	15
-#define		X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD	16
-#define		X509_V_ERR_OUT_OF_MEM				17
-#define		X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT		18
-#define		X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN		19
-#define		X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY	20
-#define		X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE	21
-#define		X509_V_ERR_CERT_CHAIN_TOO_LONG			22
-#define		X509_V_ERR_CERT_REVOKED				23
-#define		X509_V_ERR_INVALID_CA				24
-#define		X509_V_ERR_PATH_LENGTH_EXCEEDED			25
-#define		X509_V_ERR_INVALID_PURPOSE			26
-#define		X509_V_ERR_CERT_UNTRUSTED			27
-#define		X509_V_ERR_CERT_REJECTED			28
+#define     X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT        2
+#define     X509_V_ERR_UNABLE_TO_GET_CRL            3
+#define     X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE 4
+#define     X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE  5
+#define     X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY   6
+#define     X509_V_ERR_CERT_SIGNATURE_FAILURE       7
+#define     X509_V_ERR_CRL_SIGNATURE_FAILURE        8
+#define     X509_V_ERR_CERT_NOT_YET_VALID           9
+#define     X509_V_ERR_CERT_HAS_EXPIRED         10
+#define     X509_V_ERR_CRL_NOT_YET_VALID            11
+#define     X509_V_ERR_CRL_HAS_EXPIRED          12
+#define     X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD   13
+#define     X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD    14
+#define     X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD   15
+#define     X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD   16
+#define     X509_V_ERR_OUT_OF_MEM               17
+#define     X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT      18
+#define     X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN        19
+#define     X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY    20
+#define     X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE  21
+#define     X509_V_ERR_CERT_CHAIN_TOO_LONG          22
+#define     X509_V_ERR_CERT_REVOKED             23
+#define     X509_V_ERR_INVALID_CA               24
+#define     X509_V_ERR_PATH_LENGTH_EXCEEDED         25
+#define     X509_V_ERR_INVALID_PURPOSE          26
+#define     X509_V_ERR_CERT_UNTRUSTED           27
+#define     X509_V_ERR_CERT_REJECTED            28
 /* These are 'informational' when looking for issuer cert */
-#define		X509_V_ERR_SUBJECT_ISSUER_MISMATCH		29
-#define		X509_V_ERR_AKID_SKID_MISMATCH			30
-#define		X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH		31
-#define		X509_V_ERR_KEYUSAGE_NO_CERTSIGN			32
+#define     X509_V_ERR_SUBJECT_ISSUER_MISMATCH      29
+#define     X509_V_ERR_AKID_SKID_MISMATCH           30
+#define     X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH      31
+#define     X509_V_ERR_KEYUSAGE_NO_CERTSIGN         32
 
-#define		X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER		33
-#define		X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION		34
-#define		X509_V_ERR_KEYUSAGE_NO_CRL_SIGN			35
-#define		X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION	36
-#define		X509_V_ERR_INVALID_NON_CA			37
-#define		X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED		38
-#define		X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE	39
-#define		X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED	40
+#define     X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER     33
+#define     X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION     34
+#define     X509_V_ERR_KEYUSAGE_NO_CRL_SIGN         35
+#define     X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36
+#define     X509_V_ERR_INVALID_NON_CA           37
+#define     X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED       38
+#define     X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE    39
+#define     X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED   40
 
-#define		X509_V_ERR_INVALID_EXTENSION			41
-#define		X509_V_ERR_INVALID_POLICY_EXTENSION		42
-#define		X509_V_ERR_NO_EXPLICIT_POLICY			43
+#define     X509_V_ERR_INVALID_EXTENSION            41
+#define     X509_V_ERR_INVALID_POLICY_EXTENSION     42
+#define     X509_V_ERR_NO_EXPLICIT_POLICY           43
 
-#define		X509_V_ERR_UNNESTED_RESOURCE			44
+#define     X509_V_ERR_UNNESTED_RESOURCE            44
 
 /* The application is not happy */
-#define		X509_V_ERR_APPLICATION_VERIFICATION		50
+#define     X509_V_ERR_APPLICATION_VERIFICATION     50
 
 /* Certificate verify flags */
 
 /* Send issuer+subject checks to verify_cb */
-#define	X509_V_FLAG_CB_ISSUER_CHECK		0x1
+#define X509_V_FLAG_CB_ISSUER_CHECK     0x1
 /* Use check time instead of current time */
-#define	X509_V_FLAG_USE_CHECK_TIME		0x2
+#define X509_V_FLAG_USE_CHECK_TIME      0x2
 /* Lookup CRLs */
-#define	X509_V_FLAG_CRL_CHECK			0x4
+#define X509_V_FLAG_CRL_CHECK           0x4
 /* Lookup CRLs for whole chain */
-#define	X509_V_FLAG_CRL_CHECK_ALL		0x8
+#define X509_V_FLAG_CRL_CHECK_ALL       0x8
 /* Ignore unhandled critical extensions */
-#define	X509_V_FLAG_IGNORE_CRITICAL		0x10
+#define X509_V_FLAG_IGNORE_CRITICAL     0x10
 /* Disable workarounds for broken certificates */
-#define	X509_V_FLAG_X509_STRICT			0x20
+#define X509_V_FLAG_X509_STRICT         0x20
 /* Enable proxy certificate validation */
-#define	X509_V_FLAG_ALLOW_PROXY_CERTS		0x40
+#define X509_V_FLAG_ALLOW_PROXY_CERTS       0x40
 /* Enable policy checking */
-#define X509_V_FLAG_POLICY_CHECK		0x80
+#define X509_V_FLAG_POLICY_CHECK        0x80
 /* Policy variable require-explicit-policy */
-#define X509_V_FLAG_EXPLICIT_POLICY		0x100
+#define X509_V_FLAG_EXPLICIT_POLICY     0x100
 /* Policy variable inhibit-any-policy */
-#define	X509_V_FLAG_INHIBIT_ANY			0x200
+#define X509_V_FLAG_INHIBIT_ANY         0x200
 /* Policy variable inhibit-policy-mapping */
-#define X509_V_FLAG_INHIBIT_MAP			0x400
+#define X509_V_FLAG_INHIBIT_MAP         0x400
 /* Notify callback that policy is OK */
-#define X509_V_FLAG_NOTIFY_POLICY		0x800
+#define X509_V_FLAG_NOTIFY_POLICY       0x800
 
-#define X509_VP_FLAG_DEFAULT			0x1
-#define X509_VP_FLAG_OVERWRITE			0x2
-#define X509_VP_FLAG_RESET_FLAGS		0x4
-#define X509_VP_FLAG_LOCKED			0x8
-#define X509_VP_FLAG_ONCE			0x10
+#define X509_VP_FLAG_DEFAULT            0x1
+#define X509_VP_FLAG_OVERWRITE          0x2
+#define X509_VP_FLAG_RESET_FLAGS        0x4
+#define X509_VP_FLAG_LOCKED         0x8
+#define X509_VP_FLAG_ONCE           0x10
 
 /* Internal use: mask of policy related options */
 #define X509_V_FLAG_POLICY_MASK (X509_V_FLAG_POLICY_CHECK \
-				| X509_V_FLAG_EXPLICIT_POLICY \
-				| X509_V_FLAG_INHIBIT_ANY \
-				| X509_V_FLAG_INHIBIT_MAP)
+                | X509_V_FLAG_EXPLICIT_POLICY \
+                | X509_V_FLAG_INHIBIT_ANY \
+                | X509_V_FLAG_INHIBIT_MAP)
 
 int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type,
-	     X509_NAME *name);
+         X509_NAME *name);
 X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,int type,X509_NAME *name);
 X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x);
 void X509_OBJECT_up_ref_count(X509_OBJECT *a);
@@ -395,7 +395,7 @@ int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);
 
 void X509_STORE_CTX_free(X509_STORE_CTX *ctx);
 int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store,
-			 X509 *x509, STACK_OF(X509) *chain);
+             X509 *x509, STACK_OF(X509) *chain);
 void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);
 void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx);
 
@@ -408,10 +408,10 @@ int X509_STORE_add_cert(X509_STORE *ctx, X509 *x);
 int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x);
 
 int X509_STORE_get_by_subject(X509_STORE_CTX *vs,int type,X509_NAME *name,
-	X509_OBJECT *ret);
+    X509_OBJECT *ret);
 
 int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc,
-	long argl, char **ret);
+    long argl, char **ret);
 
 #ifndef OPENSSL_NO_STDIO
 int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type);
@@ -424,44 +424,44 @@ X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method);
 void X509_LOOKUP_free(X509_LOOKUP *ctx);
 int X509_LOOKUP_init(X509_LOOKUP *ctx);
 int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name,
-	X509_OBJECT *ret);
+    X509_OBJECT *ret);
 int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name,
-	ASN1_INTEGER *serial, X509_OBJECT *ret);
+    ASN1_INTEGER *serial, X509_OBJECT *ret);
 int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type,
-	unsigned char *bytes, int len, X509_OBJECT *ret);
+    unsigned char *bytes, int len, X509_OBJECT *ret);
 int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, char *str,
-	int len, X509_OBJECT *ret);
+    int len, X509_OBJECT *ret);
 int X509_LOOKUP_shutdown(X509_LOOKUP *ctx);
 
 #ifndef OPENSSL_NO_STDIO
-int	X509_STORE_load_locations (X509_STORE *ctx,
-		const char *file, const char *dir);
-int	X509_STORE_set_default_paths(X509_STORE *ctx);
+int X509_STORE_load_locations (X509_STORE *ctx,
+        const char *file, const char *dir);
+int X509_STORE_set_default_paths(X509_STORE *ctx);
 #endif
 
 int X509_STORE_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
-	CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
-int	X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx,int idx,void *data);
-void *	X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx,int idx);
-int	X509_STORE_CTX_get_error(X509_STORE_CTX *ctx);
-void	X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s);
-int	X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx);
-X509 *	X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx);
+    CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx,int idx,void *data);
+void *  X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx,int idx);
+int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx);
+void    X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s);
+int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx);
+X509 *  X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx);
 STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx);
 STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx);
-void	X509_STORE_CTX_set_cert(X509_STORE_CTX *c,X509 *x);
-void	X509_STORE_CTX_set_chain(X509_STORE_CTX *c,STACK_OF(X509) *sk);
-void	X509_STORE_CTX_set0_crls(X509_STORE_CTX *c,STACK_OF(X509_CRL) *sk);
+void    X509_STORE_CTX_set_cert(X509_STORE_CTX *c,X509 *x);
+void    X509_STORE_CTX_set_chain(X509_STORE_CTX *c,STACK_OF(X509) *sk);
+void    X509_STORE_CTX_set0_crls(X509_STORE_CTX *c,STACK_OF(X509_CRL) *sk);
 int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose);
 int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust);
 int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose,
-				int purpose, int trust);
+                int purpose, int trust);
 void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags);
 void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags,
-								time_t t);
+                                time_t t);
 void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx,
-				  int (*verify_cb)(int, X509_STORE_CTX *));
-  
+                  int (*verify_cb)(int, X509_STORE_CTX *));
+
 X509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx);
 int X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX *ctx);
 
@@ -474,22 +474,22 @@ int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name);
 X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void);
 void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param);
 int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *to,
-						const X509_VERIFY_PARAM *from);
-int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, 
-						const X509_VERIFY_PARAM *from);
+                        const X509_VERIFY_PARAM *from);
+int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to,
+                        const X509_VERIFY_PARAM *from);
 int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name);
 int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags);
 int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param,
-							unsigned long flags);
+                            unsigned long flags);
 unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param);
 int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose);
 int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust);
 void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth);
 void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t);
 int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,
-						ASN1_OBJECT *policy);
-int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, 
-					STACK_OF(ASN1_OBJECT) *policies);
+                        ASN1_OBJECT *policy);
+int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param,
+                    STACK_OF(ASN1_OBJECT) *policies);
 int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param);
 
 int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param);
@@ -497,21 +497,21 @@ const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name);
 void X509_VERIFY_PARAM_table_cleanup(void);
 
 int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy,
-			STACK_OF(X509) *certs,
-			STACK_OF(ASN1_OBJECT) *policy_oids,
-			unsigned int flags);
+            STACK_OF(X509) *certs,
+            STACK_OF(ASN1_OBJECT) *policy_oids,
+            unsigned int flags);
 
 void X509_policy_tree_free(X509_POLICY_TREE *tree);
 
 int X509_policy_tree_level_count(const X509_POLICY_TREE *tree);
 X509_POLICY_LEVEL *
-	X509_policy_tree_get0_level(const X509_POLICY_TREE *tree, int i);
+    X509_policy_tree_get0_level(const X509_POLICY_TREE *tree, int i);
 
 STACK_OF(X509_POLICY_NODE) *
-	X509_policy_tree_get0_policies(const X509_POLICY_TREE *tree);
+    X509_policy_tree_get0_policies(const X509_POLICY_TREE *tree);
 
 STACK_OF(X509_POLICY_NODE) *
-	X509_policy_tree_get0_user_policies(const X509_POLICY_TREE *tree);
+    X509_policy_tree_get0_user_policies(const X509_POLICY_TREE *tree);
 
 int X509_policy_level_node_count(X509_POLICY_LEVEL *level);
 
@@ -520,9 +520,9 @@ X509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level, int i);
 const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node);
 
 STACK_OF(POLICYQUALINFO) *
-	X509_policy_node_get0_qualifiers(const X509_POLICY_NODE *node);
+    X509_policy_node_get0_qualifiers(const X509_POLICY_NODE *node);
 const X509_POLICY_NODE *
-	X509_policy_node_get0_parent(const X509_POLICY_NODE *node);
+    X509_policy_node_get0_parent(const X509_POLICY_NODE *node);
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/openssl/x509v3.h b/dep/include/openssl/x509v3.h
index 91d2fb5b8ba..255d1a7711a 100644
--- a/dep/include/openssl/x509v3.h
+++ b/dep/include/openssl/x509v3.h
@@ -10,7 +10,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -108,7 +108,7 @@ X509V3_EXT_V2I v2i;
 X509V3_EXT_I2R i2r;
 X509V3_EXT_R2I r2i;
 
-void *usr_data;	/* Any extension specific data */
+void *usr_data; /* Any extension specific data */
 };
 
 typedef struct X509V3_CONF_METHOD_st {
@@ -136,9 +136,9 @@ typedef struct v3_ext_method X509V3_EXT_METHOD;
 DECLARE_STACK_OF(X509V3_EXT_METHOD)
 
 /* ext_flags values */
-#define X509V3_EXT_DYNAMIC	0x1
-#define X509V3_EXT_CTX_DEP	0x2
-#define X509V3_EXT_MULTILINE	0x4
+#define X509V3_EXT_DYNAMIC  0x1
+#define X509V3_EXT_CTX_DEP  0x2
+#define X509V3_EXT_MULTILINE    0x4
 
 typedef BIT_STRING_BITNAME ENUMERATED_NAMES;
 
@@ -159,49 +159,49 @@ ASN1_TYPE *value;
 } OTHERNAME;
 
 typedef struct EDIPartyName_st {
-	ASN1_STRING *nameAssigner;
-	ASN1_STRING *partyName;
+    ASN1_STRING *nameAssigner;
+    ASN1_STRING *partyName;
 } EDIPARTYNAME;
 
 typedef struct GENERAL_NAME_st {
 
-#define GEN_OTHERNAME	0
-#define GEN_EMAIL	1
-#define GEN_DNS		2
-#define GEN_X400	3
-#define GEN_DIRNAME	4
-#define GEN_EDIPARTY	5
-#define GEN_URI		6
-#define GEN_IPADD	7
-#define GEN_RID		8
+#define GEN_OTHERNAME   0
+#define GEN_EMAIL   1
+#define GEN_DNS     2
+#define GEN_X400    3
+#define GEN_DIRNAME 4
+#define GEN_EDIPARTY    5
+#define GEN_URI     6
+#define GEN_IPADD   7
+#define GEN_RID     8
 
 int type;
 union {
-	char *ptr;
-	OTHERNAME *otherName; /* otherName */
-	ASN1_IA5STRING *rfc822Name;
-	ASN1_IA5STRING *dNSName;
-	ASN1_TYPE *x400Address;
-	X509_NAME *directoryName;
-	EDIPARTYNAME *ediPartyName;
-	ASN1_IA5STRING *uniformResourceIdentifier;
-	ASN1_OCTET_STRING *iPAddress;
-	ASN1_OBJECT *registeredID;
+    char *ptr;
+    OTHERNAME *otherName; /* otherName */
+    ASN1_IA5STRING *rfc822Name;
+    ASN1_IA5STRING *dNSName;
+    ASN1_TYPE *x400Address;
+    X509_NAME *directoryName;
+    EDIPARTYNAME *ediPartyName;
+    ASN1_IA5STRING *uniformResourceIdentifier;
+    ASN1_OCTET_STRING *iPAddress;
+    ASN1_OBJECT *registeredID;
 
-	/* Old names */
-	ASN1_OCTET_STRING *ip; /* iPAddress */
-	X509_NAME *dirn;		/* dirn */
-	ASN1_IA5STRING *ia5;/* rfc822Name, dNSName, uniformResourceIdentifier */
-	ASN1_OBJECT *rid; /* registeredID */
-	ASN1_TYPE *other; /* x400Address */
+    /* Old names */
+    ASN1_OCTET_STRING *ip; /* iPAddress */
+    X509_NAME *dirn;        /* dirn */
+    ASN1_IA5STRING *ia5;/* rfc822Name, dNSName, uniformResourceIdentifier */
+    ASN1_OBJECT *rid; /* registeredID */
+    ASN1_TYPE *other; /* x400Address */
 } d;
 } GENERAL_NAME;
 
 typedef STACK_OF(GENERAL_NAME) GENERAL_NAMES;
 
 typedef struct ACCESS_DESCRIPTION_st {
-	ASN1_OBJECT *method;
-	GENERAL_NAME *location;
+    ASN1_OBJECT *method;
+    GENERAL_NAME *location;
 } ACCESS_DESCRIPTION;
 
 typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS;
@@ -217,13 +217,13 @@ DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION)
 typedef struct DIST_POINT_NAME_st {
 int type;
 union {
-	GENERAL_NAMES *fullname;
-	STACK_OF(X509_NAME_ENTRY) *relativename;
+    GENERAL_NAMES *fullname;
+    STACK_OF(X509_NAME_ENTRY) *relativename;
 } name;
 } DIST_POINT_NAME;
 
 typedef struct DIST_POINT_st {
-DIST_POINT_NAME	*distpoint;
+DIST_POINT_NAME *distpoint;
 ASN1_BIT_STRING *reasons;
 GENERAL_NAMES *CRLissuer;
 } DIST_POINT;
@@ -242,43 +242,43 @@ ASN1_INTEGER *serial;
 /* Strong extranet structures */
 
 typedef struct SXNET_ID_st {
-	ASN1_INTEGER *zone;
-	ASN1_OCTET_STRING *user;
+    ASN1_INTEGER *zone;
+    ASN1_OCTET_STRING *user;
 } SXNETID;
 
 DECLARE_STACK_OF(SXNETID)
 DECLARE_ASN1_SET_OF(SXNETID)
 
 typedef struct SXNET_st {
-	ASN1_INTEGER *version;
-	STACK_OF(SXNETID) *ids;
+    ASN1_INTEGER *version;
+    STACK_OF(SXNETID) *ids;
 } SXNET;
 
 typedef struct NOTICEREF_st {
-	ASN1_STRING *organization;
-	STACK_OF(ASN1_INTEGER) *noticenos;
+    ASN1_STRING *organization;
+    STACK_OF(ASN1_INTEGER) *noticenos;
 } NOTICEREF;
 
 typedef struct USERNOTICE_st {
-	NOTICEREF *noticeref;
-	ASN1_STRING *exptext;
+    NOTICEREF *noticeref;
+    ASN1_STRING *exptext;
 } USERNOTICE;
 
 typedef struct POLICYQUALINFO_st {
-	ASN1_OBJECT *pqualid;
-	union {
-		ASN1_IA5STRING *cpsuri;
-		USERNOTICE *usernotice;
-		ASN1_TYPE *other;
-	} d;
+    ASN1_OBJECT *pqualid;
+    union {
+        ASN1_IA5STRING *cpsuri;
+        USERNOTICE *usernotice;
+        ASN1_TYPE *other;
+    } d;
 } POLICYQUALINFO;
 
 DECLARE_STACK_OF(POLICYQUALINFO)
 DECLARE_ASN1_SET_OF(POLICYQUALINFO)
 
 typedef struct POLICYINFO_st {
-	ASN1_OBJECT *policyid;
-	STACK_OF(POLICYQUALINFO) *qualifiers;
+    ASN1_OBJECT *policyid;
+    STACK_OF(POLICYQUALINFO) *qualifiers;
 } POLICYINFO;
 
 typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES;
@@ -287,8 +287,8 @@ DECLARE_STACK_OF(POLICYINFO)
 DECLARE_ASN1_SET_OF(POLICYINFO)
 
 typedef struct POLICY_MAPPING_st {
-	ASN1_OBJECT *issuerDomainPolicy;
-	ASN1_OBJECT *subjectDomainPolicy;
+    ASN1_OBJECT *issuerDomainPolicy;
+    ASN1_OBJECT *subjectDomainPolicy;
 } POLICY_MAPPING;
 
 DECLARE_STACK_OF(POLICY_MAPPING)
@@ -296,35 +296,35 @@ DECLARE_STACK_OF(POLICY_MAPPING)
 typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS;
 
 typedef struct GENERAL_SUBTREE_st {
-	GENERAL_NAME *base;
-	ASN1_INTEGER *minimum;
-	ASN1_INTEGER *maximum;
+    GENERAL_NAME *base;
+    ASN1_INTEGER *minimum;
+    ASN1_INTEGER *maximum;
 } GENERAL_SUBTREE;
 
 DECLARE_STACK_OF(GENERAL_SUBTREE)
 
 typedef struct NAME_CONSTRAINTS_st {
-	STACK_OF(GENERAL_SUBTREE) *permittedSubtrees;
-	STACK_OF(GENERAL_SUBTREE) *excludedSubtrees;
+    STACK_OF(GENERAL_SUBTREE) *permittedSubtrees;
+    STACK_OF(GENERAL_SUBTREE) *excludedSubtrees;
 } NAME_CONSTRAINTS;
 
 typedef struct POLICY_CONSTRAINTS_st {
-	ASN1_INTEGER *requireExplicitPolicy;
-	ASN1_INTEGER *inhibitPolicyMapping;
+    ASN1_INTEGER *requireExplicitPolicy;
+    ASN1_INTEGER *inhibitPolicyMapping;
 } POLICY_CONSTRAINTS;
 
 /* Proxy certificate structures, see RFC 3820 */
 typedef struct PROXY_POLICY_st
-	{
-	ASN1_OBJECT *policyLanguage;
-	ASN1_OCTET_STRING *policy;
-	} PROXY_POLICY;
+    {
+    ASN1_OBJECT *policyLanguage;
+    ASN1_OCTET_STRING *policy;
+    } PROXY_POLICY;
 
 typedef struct PROXY_CERT_INFO_EXTENSION_st
-	{
-	ASN1_INTEGER *pcPathLengthConstraint;
-	PROXY_POLICY *proxyPolicy;
-	} PROXY_CERT_INFO_EXTENSION;
+    {
+    ASN1_INTEGER *pcPathLengthConstraint;
+    PROXY_POLICY *proxyPolicy;
+    } PROXY_CERT_INFO_EXTENSION;
 
 DECLARE_ASN1_FUNCTIONS(PROXY_POLICY)
 DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION)
@@ -334,120 +334,120 @@ DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION)
 ",name:", val->name, ",value:", val->value);
 
 #define X509V3_set_ctx_test(ctx) \
-			X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST)
+            X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST)
 #define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL;
 
 #define EXT_BITSTRING(nid, table) { nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), \
-			0,0,0,0, \
-			0,0, \
-			(X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \
-			(X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \
-			NULL, NULL, \
-			table}
+            0,0,0,0, \
+            0,0, \
+            (X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \
+            (X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \
+            NULL, NULL, \
+            table}
 
 #define EXT_IA5STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), \
-			0,0,0,0, \
-			(X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \
-			(X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \
-			0,0,0,0, \
-			NULL}
+            0,0,0,0, \
+            (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \
+            (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \
+            0,0,0,0, \
+            NULL}
 
 #define EXT_END { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
 
 
 /* X509_PURPOSE stuff */
 
-#define EXFLAG_BCONS		0x1
-#define EXFLAG_KUSAGE		0x2
-#define EXFLAG_XKUSAGE		0x4
-#define EXFLAG_NSCERT		0x8
+#define EXFLAG_BCONS        0x1
+#define EXFLAG_KUSAGE       0x2
+#define EXFLAG_XKUSAGE      0x4
+#define EXFLAG_NSCERT       0x8
 
-#define EXFLAG_CA		0x10
-#define EXFLAG_SS		0x20
-#define EXFLAG_V1		0x40
-#define EXFLAG_INVALID		0x80
-#define EXFLAG_SET		0x100
-#define EXFLAG_CRITICAL		0x200
-#define EXFLAG_PROXY		0x400
+#define EXFLAG_CA       0x10
+#define EXFLAG_SS       0x20
+#define EXFLAG_V1       0x40
+#define EXFLAG_INVALID      0x80
+#define EXFLAG_SET      0x100
+#define EXFLAG_CRITICAL     0x200
+#define EXFLAG_PROXY        0x400
 
-#define EXFLAG_INVALID_POLICY	0x400
+#define EXFLAG_INVALID_POLICY   0x400
 
-#define KU_DIGITAL_SIGNATURE	0x0080
-#define KU_NON_REPUDIATION	0x0040
-#define KU_KEY_ENCIPHERMENT	0x0020
-#define KU_DATA_ENCIPHERMENT	0x0010
-#define KU_KEY_AGREEMENT	0x0008
-#define KU_KEY_CERT_SIGN	0x0004
-#define KU_CRL_SIGN		0x0002
-#define KU_ENCIPHER_ONLY	0x0001
-#define KU_DECIPHER_ONLY	0x8000
+#define KU_DIGITAL_SIGNATURE    0x0080
+#define KU_NON_REPUDIATION  0x0040
+#define KU_KEY_ENCIPHERMENT 0x0020
+#define KU_DATA_ENCIPHERMENT    0x0010
+#define KU_KEY_AGREEMENT    0x0008
+#define KU_KEY_CERT_SIGN    0x0004
+#define KU_CRL_SIGN     0x0002
+#define KU_ENCIPHER_ONLY    0x0001
+#define KU_DECIPHER_ONLY    0x8000
 
-#define NS_SSL_CLIENT		0x80
-#define NS_SSL_SERVER		0x40
-#define NS_SMIME		0x20
-#define NS_OBJSIGN		0x10
-#define NS_SSL_CA		0x04
-#define NS_SMIME_CA		0x02
-#define NS_OBJSIGN_CA		0x01
-#define NS_ANY_CA		(NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA)
+#define NS_SSL_CLIENT       0x80
+#define NS_SSL_SERVER       0x40
+#define NS_SMIME        0x20
+#define NS_OBJSIGN      0x10
+#define NS_SSL_CA       0x04
+#define NS_SMIME_CA     0x02
+#define NS_OBJSIGN_CA       0x01
+#define NS_ANY_CA       (NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA)
 
-#define XKU_SSL_SERVER		0x1	
-#define XKU_SSL_CLIENT		0x2
-#define XKU_SMIME		0x4
-#define XKU_CODE_SIGN		0x8
-#define XKU_SGC			0x10
-#define XKU_OCSP_SIGN		0x20
-#define XKU_TIMESTAMP		0x40
-#define XKU_DVCS		0x80
+#define XKU_SSL_SERVER      0x1
+#define XKU_SSL_CLIENT      0x2
+#define XKU_SMIME       0x4
+#define XKU_CODE_SIGN       0x8
+#define XKU_SGC         0x10
+#define XKU_OCSP_SIGN       0x20
+#define XKU_TIMESTAMP       0x40
+#define XKU_DVCS        0x80
 
-#define X509_PURPOSE_DYNAMIC	0x1
-#define X509_PURPOSE_DYNAMIC_NAME	0x2
+#define X509_PURPOSE_DYNAMIC    0x1
+#define X509_PURPOSE_DYNAMIC_NAME   0x2
 
 typedef struct x509_purpose_st {
-	int purpose;
-	int trust;		/* Default trust ID */
-	int flags;
-	int (*check_purpose)(const struct x509_purpose_st *,
-				const X509 *, int);
-	char *name;
-	char *sname;
-	void *usr_data;
+    int purpose;
+    int trust;      /* Default trust ID */
+    int flags;
+    int (*check_purpose)(const struct x509_purpose_st *,
+                const X509 *, int);
+    char *name;
+    char *sname;
+    void *usr_data;
 } X509_PURPOSE;
 
-#define X509_PURPOSE_SSL_CLIENT		1
-#define X509_PURPOSE_SSL_SERVER		2
-#define X509_PURPOSE_NS_SSL_SERVER	3
-#define X509_PURPOSE_SMIME_SIGN		4
-#define X509_PURPOSE_SMIME_ENCRYPT	5
-#define X509_PURPOSE_CRL_SIGN		6
-#define X509_PURPOSE_ANY		7
-#define X509_PURPOSE_OCSP_HELPER	8
+#define X509_PURPOSE_SSL_CLIENT     1
+#define X509_PURPOSE_SSL_SERVER     2
+#define X509_PURPOSE_NS_SSL_SERVER  3
+#define X509_PURPOSE_SMIME_SIGN     4
+#define X509_PURPOSE_SMIME_ENCRYPT  5
+#define X509_PURPOSE_CRL_SIGN       6
+#define X509_PURPOSE_ANY        7
+#define X509_PURPOSE_OCSP_HELPER    8
 
-#define X509_PURPOSE_MIN		1
-#define X509_PURPOSE_MAX		8
+#define X509_PURPOSE_MIN        1
+#define X509_PURPOSE_MAX        8
 
 /* Flags for X509V3_EXT_print() */
 
-#define X509V3_EXT_UNKNOWN_MASK		(0xfL << 16)
+#define X509V3_EXT_UNKNOWN_MASK     (0xfL << 16)
 /* Return error for unknown extensions */
-#define X509V3_EXT_DEFAULT		0
+#define X509V3_EXT_DEFAULT      0
 /* Print error for unknown extensions */
-#define X509V3_EXT_ERROR_UNKNOWN	(1L << 16)
+#define X509V3_EXT_ERROR_UNKNOWN    (1L << 16)
 /* ASN1 parse unknown extensions */
-#define X509V3_EXT_PARSE_UNKNOWN	(2L << 16)
+#define X509V3_EXT_PARSE_UNKNOWN    (2L << 16)
 /* BIO_dump unknown extensions */
-#define X509V3_EXT_DUMP_UNKNOWN		(3L << 16)
+#define X509V3_EXT_DUMP_UNKNOWN     (3L << 16)
 
 /* Flags for X509V3_add1_i2d */
 
-#define X509V3_ADD_OP_MASK		0xfL
-#define X509V3_ADD_DEFAULT		0L
-#define X509V3_ADD_APPEND		1L
-#define X509V3_ADD_REPLACE		2L
-#define X509V3_ADD_REPLACE_EXISTING	3L
-#define X509V3_ADD_KEEP_EXISTING	4L
-#define X509V3_ADD_DELETE		5L
-#define X509V3_ADD_SILENT		0x10
+#define X509V3_ADD_OP_MASK      0xfL
+#define X509V3_ADD_DEFAULT      0L
+#define X509V3_ADD_APPEND       1L
+#define X509V3_ADD_REPLACE      2L
+#define X509V3_ADD_REPLACE_EXISTING 3L
+#define X509V3_ADD_KEEP_EXISTING    4L
+#define X509V3_ADD_DELETE       5L
+#define X509V3_ADD_SILENT       0x10
 
 DECLARE_STACK_OF(X509_PURPOSE)
 
@@ -456,9 +456,9 @@ DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS)
 DECLARE_ASN1_FUNCTIONS(SXNET)
 DECLARE_ASN1_FUNCTIONS(SXNETID)
 
-int SXNET_add_id_asc(SXNET **psx, char *zone, char *user, int userlen); 
-int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, char *user, int userlen); 
-int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, char *user, int userlen); 
+int SXNET_add_id_asc(SXNET **psx, char *zone, char *user, int userlen);
+int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, char *user, int userlen);
+int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, char *user, int userlen);
 
 ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, char *zone);
 ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone);
@@ -472,10 +472,10 @@ DECLARE_ASN1_FUNCTIONS(GENERAL_NAME)
 
 
 ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,
-				X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
+                X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
 STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,
-				ASN1_BIT_STRING *bits,
-				STACK_OF(CONF_VALUE) *extlist);
+                ASN1_BIT_STRING *bits,
+                STACK_OF(CONF_VALUE) *extlist);
 
 STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, GENERAL_NAME *gen, STACK_OF(CONF_VALUE) *ret);
 int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen);
@@ -483,9 +483,9 @@ int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen);
 DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES)
 
 STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method,
-		GENERAL_NAMES *gen, STACK_OF(CONF_VALUE) *extlist);
+        GENERAL_NAMES *gen, STACK_OF(CONF_VALUE) *extlist);
 GENERAL_NAMES *v2i_GENERAL_NAMES(X509V3_EXT_METHOD *method,
-				X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
+                X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
 
 DECLARE_ASN1_FUNCTIONS(OTHERNAME)
 DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME)
@@ -524,9 +524,9 @@ DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS)
 
 #ifdef HEADER_CONF_H
 GENERAL_NAME *v2i_GENERAL_NAME(X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
-							CONF_VALUE *cnf);
+                            CONF_VALUE *cnf);
 GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, X509V3_EXT_METHOD *method,
-				X509V3_CTX *ctx, CONF_VALUE *cnf, int is_nc);
+                X509V3_CTX *ctx, CONF_VALUE *cnf, int is_nc);
 void X509V3_conf_free(CONF_VALUE *val);
 
 X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, char *value);
@@ -543,7 +543,7 @@ int X509V3_EXT_REQ_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X509_RE
 int X509V3_EXT_CRL_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X509_CRL *crl);
 
 int X509V3_add_value_bool_nf(char *name, int asn1_bool,
-						STACK_OF(CONF_VALUE) **extlist);
+                        STACK_OF(CONF_VALUE) **extlist);
 int X509V3_get_value_bool(CONF_VALUE *value, int *asn1_bool);
 int X509V3_get_value_int(CONF_VALUE *value, ASN1_INTEGER **aint);
 void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf);
@@ -555,16 +555,16 @@ STACK_OF(CONF_VALUE) * X509V3_get_section(X509V3_CTX *ctx, char *section);
 void X509V3_string_free(X509V3_CTX *ctx, char *str);
 void X509V3_section_free( X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section);
 void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject,
-				 X509_REQ *req, X509_CRL *crl, int flags);
+                 X509_REQ *req, X509_CRL *crl, int flags);
 
 int X509V3_add_value(const char *name, const char *value,
-						STACK_OF(CONF_VALUE) **extlist);
+                        STACK_OF(CONF_VALUE) **extlist);
 int X509V3_add_value_uchar(const char *name, const unsigned char *value,
-						STACK_OF(CONF_VALUE) **extlist);
+                        STACK_OF(CONF_VALUE) **extlist);
 int X509V3_add_value_bool(const char *name, int asn1_bool,
-						STACK_OF(CONF_VALUE) **extlist);
+                        STACK_OF(CONF_VALUE) **extlist);
 int X509V3_add_value_int(const char *name, ASN1_INTEGER *aint,
-						STACK_OF(CONF_VALUE) **extlist);
+                        STACK_OF(CONF_VALUE) **extlist);
 char * i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, ASN1_INTEGER *aint);
 ASN1_INTEGER * s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, char *value);
 char * i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, ASN1_ENUMERATED *aint);
@@ -590,7 +590,7 @@ unsigned char *string_to_hex(char *str, long *len);
 int name_cmp(const char *name, const char *cmp);
 
 void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent,
-								 int ml);
+                                 int ml);
 int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, int indent);
 int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent);
 
@@ -606,8 +606,8 @@ X509_PURPOSE * X509_PURPOSE_get0(int idx);
 int X509_PURPOSE_get_by_sname(char *sname);
 int X509_PURPOSE_get_by_id(int id);
 int X509_PURPOSE_add(int id, int trust, int flags,
-			int (*ck)(const X509_PURPOSE *, const X509 *, int),
-				char *name, char *sname, void *arg);
+            int (*ck)(const X509_PURPOSE *, const X509 *, int),
+                char *name, char *sname, void *arg);
 char *X509_PURPOSE_get0_name(X509_PURPOSE *xp);
 char *X509_PURPOSE_get0_sname(X509_PURPOSE *xp);
 int X509_PURPOSE_get_trust(X509_PURPOSE *xp);
@@ -622,7 +622,7 @@ ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc);
 ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc);
 int a2i_ipadd(unsigned char *ipout, const char *ipasc);
 int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE)*dn_sk,
-						unsigned long chtype);
+                        unsigned long chtype);
 
 void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent);
 
@@ -632,8 +632,8 @@ typedef struct ASRange_st {
   ASN1_INTEGER *min, *max;
 } ASRange;
 
-#define	ASIdOrRange_id		0
-#define	ASIdOrRange_range	1
+#define ASIdOrRange_id      0
+#define ASIdOrRange_range   1
 
 typedef struct ASIdOrRange_st {
   int type;
@@ -646,8 +646,8 @@ typedef struct ASIdOrRange_st {
 typedef STACK_OF(ASIdOrRange) ASIdOrRanges;
 DECLARE_STACK_OF(ASIdOrRange)
 
-#define	ASIdentifierChoice_inherit		0
-#define	ASIdentifierChoice_asIdsOrRanges	1
+#define ASIdentifierChoice_inherit      0
+#define ASIdentifierChoice_asIdsOrRanges    1
 
 typedef struct ASIdentifierChoice_st {
   int type;
@@ -668,37 +668,37 @@ DECLARE_ASN1_FUNCTIONS(ASIdentifiers)
 
 
 typedef struct IPAddressRange_st {
-  ASN1_BIT_STRING	*min, *max;
+  ASN1_BIT_STRING   *min, *max;
 } IPAddressRange;
 
-#define	IPAddressOrRange_addressPrefix	0
-#define	IPAddressOrRange_addressRange	1
+#define IPAddressOrRange_addressPrefix  0
+#define IPAddressOrRange_addressRange   1
 
 typedef struct IPAddressOrRange_st {
   int type;
   union {
-    ASN1_BIT_STRING	*addressPrefix;
-    IPAddressRange	*addressRange;
+    ASN1_BIT_STRING *addressPrefix;
+    IPAddressRange  *addressRange;
   } u;
 } IPAddressOrRange;
 
 typedef STACK_OF(IPAddressOrRange) IPAddressOrRanges;
 DECLARE_STACK_OF(IPAddressOrRange)
 
-#define	IPAddressChoice_inherit			0
-#define	IPAddressChoice_addressesOrRanges	1
+#define IPAddressChoice_inherit         0
+#define IPAddressChoice_addressesOrRanges   1
 
 typedef struct IPAddressChoice_st {
   int type;
   union {
-    ASN1_NULL		*inherit;
-    IPAddressOrRanges	*addressesOrRanges;
+    ASN1_NULL       *inherit;
+    IPAddressOrRanges   *addressesOrRanges;
   } u;
 } IPAddressChoice;
 
 typedef struct IPAddressFamily_st {
-  ASN1_OCTET_STRING	*addressFamily;
-  IPAddressChoice	*ipAddressChoice;
+  ASN1_OCTET_STRING *addressFamily;
+  IPAddressChoice   *ipAddressChoice;
 } IPAddressFamily;
 
 typedef STACK_OF(IPAddressFamily) IPAddrBlocks;
@@ -712,8 +712,8 @@ DECLARE_ASN1_FUNCTIONS(IPAddressFamily)
 /*
  * API tag for elements of the ASIdentifer SEQUENCE.
  */
-#define	V3_ASID_ASNUM	0
-#define	V3_ASID_RDI	1
+#define V3_ASID_ASNUM   0
+#define V3_ASID_RDI 1
 
 /*
  * AFI values, assigned by IANA.  It'd be nice to make the AFI
@@ -721,8 +721,8 @@ DECLARE_ASN1_FUNCTIONS(IPAddressFamily)
  * that would need to be defined for other address families for it to
  * be worth the trouble.
  */
-#define	IANA_AFI_IPV4	1
-#define	IANA_AFI_IPV6	2
+#define IANA_AFI_IPV4   1
+#define IANA_AFI_IPV6   2
 
 /*
  * Utilities to construct and extract values from RFC3779 extensions,
@@ -731,19 +731,19 @@ DECLARE_ASN1_FUNCTIONS(IPAddressFamily)
  */
 int v3_asid_add_inherit(ASIdentifiers *asid, int which);
 int v3_asid_add_id_or_range(ASIdentifiers *asid, int which,
-			    ASN1_INTEGER *min, ASN1_INTEGER *max);
+                ASN1_INTEGER *min, ASN1_INTEGER *max);
 int v3_addr_add_inherit(IPAddrBlocks *addr,
-			const unsigned afi, const unsigned *safi);
+            const unsigned afi, const unsigned *safi);
 int v3_addr_add_prefix(IPAddrBlocks *addr,
-		       const unsigned afi, const unsigned *safi,
-		       unsigned char *a, const int prefixlen);
+               const unsigned afi, const unsigned *safi,
+               unsigned char *a, const int prefixlen);
 int v3_addr_add_range(IPAddrBlocks *addr,
-		      const unsigned afi, const unsigned *safi,
-		      unsigned char *min, unsigned char *max);
+              const unsigned afi, const unsigned *safi,
+              unsigned char *min, unsigned char *max);
 unsigned v3_addr_get_afi(const IPAddressFamily *f);
 int v3_addr_get_range(IPAddressOrRange *aor, const unsigned afi,
-		      unsigned char *min, unsigned char *max,
-		      const int length);
+              unsigned char *min, unsigned char *max,
+              const int length);
 
 /*
  * Canonical forms.
@@ -767,11 +767,11 @@ int v3_addr_subset(IPAddrBlocks *a, IPAddrBlocks *b);
 int v3_asid_validate_path(X509_STORE_CTX *);
 int v3_addr_validate_path(X509_STORE_CTX *);
 int v3_asid_validate_resource_set(STACK_OF(X509) *chain,
-				  ASIdentifiers *ext,
-				  int allow_inheritance);
+                  ASIdentifiers *ext,
+                  int allow_inheritance);
 int v3_addr_validate_resource_set(STACK_OF(X509) *chain,
-				  IPAddrBlocks *ext,
-				  int allow_inheritance);
+                  IPAddrBlocks *ext,
+                  int allow_inheritance);
 
 #endif /* OPENSSL_NO_RFC3779 */
 
@@ -784,134 +784,134 @@ void ERR_load_X509V3_strings(void);
 /* Error codes for the X509V3 functions. */
 
 /* Function codes. */
-#define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE		 156
-#define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL	 157
-#define X509V3_F_COPY_EMAIL				 122
-#define X509V3_F_COPY_ISSUER				 123
-#define X509V3_F_DO_DIRNAME				 144
-#define X509V3_F_DO_EXT_CONF				 124
-#define X509V3_F_DO_EXT_I2D				 135
-#define X509V3_F_DO_EXT_NCONF				 151
-#define X509V3_F_DO_I2V_NAME_CONSTRAINTS		 148
-#define X509V3_F_HEX_TO_STRING				 111
-#define X509V3_F_I2S_ASN1_ENUMERATED			 121
-#define X509V3_F_I2S_ASN1_IA5STRING			 149
-#define X509V3_F_I2S_ASN1_INTEGER			 120
-#define X509V3_F_I2V_AUTHORITY_INFO_ACCESS		 138
-#define X509V3_F_NOTICE_SECTION				 132
-#define X509V3_F_NREF_NOS				 133
-#define X509V3_F_POLICY_SECTION				 131
-#define X509V3_F_PROCESS_PCI_VALUE			 150
-#define X509V3_F_R2I_CERTPOL				 130
-#define X509V3_F_R2I_PCI				 155
-#define X509V3_F_S2I_ASN1_IA5STRING			 100
-#define X509V3_F_S2I_ASN1_INTEGER			 108
-#define X509V3_F_S2I_ASN1_OCTET_STRING			 112
-#define X509V3_F_S2I_ASN1_SKEY_ID			 114
-#define X509V3_F_S2I_SKEY_ID				 115
-#define X509V3_F_STRING_TO_HEX				 113
-#define X509V3_F_SXNET_ADD_ID_ASC			 125
-#define X509V3_F_SXNET_ADD_ID_INTEGER			 126
-#define X509V3_F_SXNET_ADD_ID_ULONG			 127
-#define X509V3_F_SXNET_GET_ID_ASC			 128
-#define X509V3_F_SXNET_GET_ID_ULONG			 129
-#define X509V3_F_V2I_ASIDENTIFIERS			 158
-#define X509V3_F_V2I_ASN1_BIT_STRING			 101
-#define X509V3_F_V2I_AUTHORITY_INFO_ACCESS		 139
-#define X509V3_F_V2I_AUTHORITY_KEYID			 119
-#define X509V3_F_V2I_BASIC_CONSTRAINTS			 102
-#define X509V3_F_V2I_CRLD				 134
-#define X509V3_F_V2I_EXTENDED_KEY_USAGE			 103
-#define X509V3_F_V2I_GENERAL_NAMES			 118
-#define X509V3_F_V2I_GENERAL_NAME_EX			 117
-#define X509V3_F_V2I_IPADDRBLOCKS			 159
-#define X509V3_F_V2I_ISSUER_ALT				 153
-#define X509V3_F_V2I_NAME_CONSTRAINTS			 147
-#define X509V3_F_V2I_POLICY_CONSTRAINTS			 146
-#define X509V3_F_V2I_POLICY_MAPPINGS			 145
-#define X509V3_F_V2I_SUBJECT_ALT			 154
-#define X509V3_F_V3_ADDR_VALIDATE_PATH_INTERNAL		 160
-#define X509V3_F_V3_GENERIC_EXTENSION			 116
-#define X509V3_F_X509V3_ADD1_I2D			 140
-#define X509V3_F_X509V3_ADD_VALUE			 105
-#define X509V3_F_X509V3_EXT_ADD				 104
-#define X509V3_F_X509V3_EXT_ADD_ALIAS			 106
-#define X509V3_F_X509V3_EXT_CONF			 107
-#define X509V3_F_X509V3_EXT_I2D				 136
-#define X509V3_F_X509V3_EXT_NCONF			 152
-#define X509V3_F_X509V3_GET_SECTION			 142
-#define X509V3_F_X509V3_GET_STRING			 143
-#define X509V3_F_X509V3_GET_VALUE_BOOL			 110
-#define X509V3_F_X509V3_PARSE_LIST			 109
-#define X509V3_F_X509_PURPOSE_ADD			 137
-#define X509V3_F_X509_PURPOSE_SET			 141
+#define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE         156
+#define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL     157
+#define X509V3_F_COPY_EMAIL              122
+#define X509V3_F_COPY_ISSUER                 123
+#define X509V3_F_DO_DIRNAME              144
+#define X509V3_F_DO_EXT_CONF                 124
+#define X509V3_F_DO_EXT_I2D              135
+#define X509V3_F_DO_EXT_NCONF                151
+#define X509V3_F_DO_I2V_NAME_CONSTRAINTS         148
+#define X509V3_F_HEX_TO_STRING               111
+#define X509V3_F_I2S_ASN1_ENUMERATED             121
+#define X509V3_F_I2S_ASN1_IA5STRING          149
+#define X509V3_F_I2S_ASN1_INTEGER            120
+#define X509V3_F_I2V_AUTHORITY_INFO_ACCESS       138
+#define X509V3_F_NOTICE_SECTION              132
+#define X509V3_F_NREF_NOS                133
+#define X509V3_F_POLICY_SECTION              131
+#define X509V3_F_PROCESS_PCI_VALUE           150
+#define X509V3_F_R2I_CERTPOL                 130
+#define X509V3_F_R2I_PCI                 155
+#define X509V3_F_S2I_ASN1_IA5STRING          100
+#define X509V3_F_S2I_ASN1_INTEGER            108
+#define X509V3_F_S2I_ASN1_OCTET_STRING           112
+#define X509V3_F_S2I_ASN1_SKEY_ID            114
+#define X509V3_F_S2I_SKEY_ID                 115
+#define X509V3_F_STRING_TO_HEX               113
+#define X509V3_F_SXNET_ADD_ID_ASC            125
+#define X509V3_F_SXNET_ADD_ID_INTEGER            126
+#define X509V3_F_SXNET_ADD_ID_ULONG          127
+#define X509V3_F_SXNET_GET_ID_ASC            128
+#define X509V3_F_SXNET_GET_ID_ULONG          129
+#define X509V3_F_V2I_ASIDENTIFIERS           158
+#define X509V3_F_V2I_ASN1_BIT_STRING             101
+#define X509V3_F_V2I_AUTHORITY_INFO_ACCESS       139
+#define X509V3_F_V2I_AUTHORITY_KEYID             119
+#define X509V3_F_V2I_BASIC_CONSTRAINTS           102
+#define X509V3_F_V2I_CRLD                134
+#define X509V3_F_V2I_EXTENDED_KEY_USAGE          103
+#define X509V3_F_V2I_GENERAL_NAMES           118
+#define X509V3_F_V2I_GENERAL_NAME_EX             117
+#define X509V3_F_V2I_IPADDRBLOCKS            159
+#define X509V3_F_V2I_ISSUER_ALT              153
+#define X509V3_F_V2I_NAME_CONSTRAINTS            147
+#define X509V3_F_V2I_POLICY_CONSTRAINTS          146
+#define X509V3_F_V2I_POLICY_MAPPINGS             145
+#define X509V3_F_V2I_SUBJECT_ALT             154
+#define X509V3_F_V3_ADDR_VALIDATE_PATH_INTERNAL      160
+#define X509V3_F_V3_GENERIC_EXTENSION            116
+#define X509V3_F_X509V3_ADD1_I2D             140
+#define X509V3_F_X509V3_ADD_VALUE            105
+#define X509V3_F_X509V3_EXT_ADD              104
+#define X509V3_F_X509V3_EXT_ADD_ALIAS            106
+#define X509V3_F_X509V3_EXT_CONF             107
+#define X509V3_F_X509V3_EXT_I2D              136
+#define X509V3_F_X509V3_EXT_NCONF            152
+#define X509V3_F_X509V3_GET_SECTION          142
+#define X509V3_F_X509V3_GET_STRING           143
+#define X509V3_F_X509V3_GET_VALUE_BOOL           110
+#define X509V3_F_X509V3_PARSE_LIST           109
+#define X509V3_F_X509_PURPOSE_ADD            137
+#define X509V3_F_X509_PURPOSE_SET            141
 
 /* Reason codes. */
-#define X509V3_R_BAD_IP_ADDRESS				 118
-#define X509V3_R_BAD_OBJECT				 119
-#define X509V3_R_BN_DEC2BN_ERROR			 100
-#define X509V3_R_BN_TO_ASN1_INTEGER_ERROR		 101
-#define X509V3_R_DIRNAME_ERROR				 149
-#define X509V3_R_DUPLICATE_ZONE_ID			 133
-#define X509V3_R_ERROR_CONVERTING_ZONE			 131
-#define X509V3_R_ERROR_CREATING_EXTENSION		 144
-#define X509V3_R_ERROR_IN_EXTENSION			 128
-#define X509V3_R_EXPECTED_A_SECTION_NAME		 137
-#define X509V3_R_EXTENSION_EXISTS			 145
-#define X509V3_R_EXTENSION_NAME_ERROR			 115
-#define X509V3_R_EXTENSION_NOT_FOUND			 102
-#define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED	 103
-#define X509V3_R_EXTENSION_VALUE_ERROR			 116
-#define X509V3_R_ILLEGAL_EMPTY_EXTENSION		 151
-#define X509V3_R_ILLEGAL_HEX_DIGIT			 113
-#define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG		 152
-#define X509V3_R_INVALID_ASNUMBER			 160
-#define X509V3_R_INVALID_ASRANGE			 161
-#define X509V3_R_INVALID_BOOLEAN_STRING			 104
-#define X509V3_R_INVALID_EXTENSION_STRING		 105
-#define X509V3_R_INVALID_INHERITANCE			 162
-#define X509V3_R_INVALID_IPADDRESS			 163
-#define X509V3_R_INVALID_NAME				 106
-#define X509V3_R_INVALID_NULL_ARGUMENT			 107
-#define X509V3_R_INVALID_NULL_NAME			 108
-#define X509V3_R_INVALID_NULL_VALUE			 109
-#define X509V3_R_INVALID_NUMBER				 140
-#define X509V3_R_INVALID_NUMBERS			 141
-#define X509V3_R_INVALID_OBJECT_IDENTIFIER		 110
-#define X509V3_R_INVALID_OPTION				 138
-#define X509V3_R_INVALID_POLICY_IDENTIFIER		 134
-#define X509V3_R_INVALID_PROXY_POLICY_SETTING		 153
-#define X509V3_R_INVALID_PURPOSE			 146
-#define X509V3_R_INVALID_SAFI				 164
-#define X509V3_R_INVALID_SECTION			 135
-#define X509V3_R_INVALID_SYNTAX				 143
-#define X509V3_R_ISSUER_DECODE_ERROR			 126
-#define X509V3_R_MISSING_VALUE				 124
-#define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS		 142
-#define X509V3_R_NO_CONFIG_DATABASE			 136
-#define X509V3_R_NO_ISSUER_CERTIFICATE			 121
-#define X509V3_R_NO_ISSUER_DETAILS			 127
-#define X509V3_R_NO_POLICY_IDENTIFIER			 139
-#define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED	 154
-#define X509V3_R_NO_PUBLIC_KEY				 114
-#define X509V3_R_NO_SUBJECT_DETAILS			 125
-#define X509V3_R_ODD_NUMBER_OF_DIGITS			 112
-#define X509V3_R_OPERATION_NOT_DEFINED			 148
-#define X509V3_R_OTHERNAME_ERROR			 147
-#define X509V3_R_POLICY_LANGUAGE_ALREADTY_DEFINED	 155
-#define X509V3_R_POLICY_PATH_LENGTH			 156
-#define X509V3_R_POLICY_PATH_LENGTH_ALREADTY_DEFINED	 157
-#define X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED	 158
+#define X509V3_R_BAD_IP_ADDRESS              118
+#define X509V3_R_BAD_OBJECT              119
+#define X509V3_R_BN_DEC2BN_ERROR             100
+#define X509V3_R_BN_TO_ASN1_INTEGER_ERROR        101
+#define X509V3_R_DIRNAME_ERROR               149
+#define X509V3_R_DUPLICATE_ZONE_ID           133
+#define X509V3_R_ERROR_CONVERTING_ZONE           131
+#define X509V3_R_ERROR_CREATING_EXTENSION        144
+#define X509V3_R_ERROR_IN_EXTENSION          128
+#define X509V3_R_EXPECTED_A_SECTION_NAME         137
+#define X509V3_R_EXTENSION_EXISTS            145
+#define X509V3_R_EXTENSION_NAME_ERROR            115
+#define X509V3_R_EXTENSION_NOT_FOUND             102
+#define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED     103
+#define X509V3_R_EXTENSION_VALUE_ERROR           116
+#define X509V3_R_ILLEGAL_EMPTY_EXTENSION         151
+#define X509V3_R_ILLEGAL_HEX_DIGIT           113
+#define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG         152
+#define X509V3_R_INVALID_ASNUMBER            160
+#define X509V3_R_INVALID_ASRANGE             161
+#define X509V3_R_INVALID_BOOLEAN_STRING          104
+#define X509V3_R_INVALID_EXTENSION_STRING        105
+#define X509V3_R_INVALID_INHERITANCE             162
+#define X509V3_R_INVALID_IPADDRESS           163
+#define X509V3_R_INVALID_NAME                106
+#define X509V3_R_INVALID_NULL_ARGUMENT           107
+#define X509V3_R_INVALID_NULL_NAME           108
+#define X509V3_R_INVALID_NULL_VALUE          109
+#define X509V3_R_INVALID_NUMBER              140
+#define X509V3_R_INVALID_NUMBERS             141
+#define X509V3_R_INVALID_OBJECT_IDENTIFIER       110
+#define X509V3_R_INVALID_OPTION              138
+#define X509V3_R_INVALID_POLICY_IDENTIFIER       134
+#define X509V3_R_INVALID_PROXY_POLICY_SETTING        153
+#define X509V3_R_INVALID_PURPOSE             146
+#define X509V3_R_INVALID_SAFI                164
+#define X509V3_R_INVALID_SECTION             135
+#define X509V3_R_INVALID_SYNTAX              143
+#define X509V3_R_ISSUER_DECODE_ERROR             126
+#define X509V3_R_MISSING_VALUE               124
+#define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS       142
+#define X509V3_R_NO_CONFIG_DATABASE          136
+#define X509V3_R_NO_ISSUER_CERTIFICATE           121
+#define X509V3_R_NO_ISSUER_DETAILS           127
+#define X509V3_R_NO_POLICY_IDENTIFIER            139
+#define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED   154
+#define X509V3_R_NO_PUBLIC_KEY               114
+#define X509V3_R_NO_SUBJECT_DETAILS          125
+#define X509V3_R_ODD_NUMBER_OF_DIGITS            112
+#define X509V3_R_OPERATION_NOT_DEFINED           148
+#define X509V3_R_OTHERNAME_ERROR             147
+#define X509V3_R_POLICY_LANGUAGE_ALREADTY_DEFINED    155
+#define X509V3_R_POLICY_PATH_LENGTH          156
+#define X509V3_R_POLICY_PATH_LENGTH_ALREADTY_DEFINED     157
+#define X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED   158
 #define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159
-#define X509V3_R_SECTION_NOT_FOUND			 150
-#define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS		 122
-#define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID		 123
-#define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT		 111
-#define X509V3_R_UNKNOWN_EXTENSION			 129
-#define X509V3_R_UNKNOWN_EXTENSION_NAME			 130
-#define X509V3_R_UNKNOWN_OPTION				 120
-#define X509V3_R_UNSUPPORTED_OPTION			 117
-#define X509V3_R_USER_TOO_LONG				 132
+#define X509V3_R_SECTION_NOT_FOUND           150
+#define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS        122
+#define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID      123
+#define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT         111
+#define X509V3_R_UNKNOWN_EXTENSION           129
+#define X509V3_R_UNKNOWN_EXTENSION_NAME          130
+#define X509V3_R_UNKNOWN_OPTION              120
+#define X509V3_R_UNSUPPORTED_OPTION          117
+#define X509V3_R_USER_TOO_LONG               132
 
 #ifdef  __cplusplus
 }
diff --git a/dep/include/postgre/libpq-fe.h b/dep/include/postgre/libpq-fe.h
index f51c6b38acd..5da750a79aa 100644
--- a/dep/include/postgre/libpq-fe.h
+++ b/dep/include/postgre/libpq-fe.h
@@ -1,8 +1,8 @@
 /*-------------------------------------------------------------------------
  *
  * libpq-fe.h
- *	  This file contains definitions for structures and
- *	  externs for functions used by frontend postgres applications.
+ *    This file contains definitions for structures and
+ *    externs for functions used by frontend postgres applications.
  *
  * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
@@ -16,7 +16,7 @@
 #define LIBPQ_FE_H
 
 #ifdef __cplusplus
-extern		"C"
+extern      "C"
 {
 #endif
 
@@ -32,71 +32,71 @@ extern		"C"
 
 typedef enum
 {
-	/*
-	 * Although it is okay to add to this list, values which become unused
-	 * should never be removed, nor should constants be redefined - that would
-	 * break compatibility with existing code.
-	 */
-	CONNECTION_OK,
-	CONNECTION_BAD,
-	/* Non-blocking mode only below here */
+    /*
+     * Although it is okay to add to this list, values which become unused
+     * should never be removed, nor should constants be redefined - that would
+     * break compatibility with existing code.
+     */
+    CONNECTION_OK,
+    CONNECTION_BAD,
+    /* Non-blocking mode only below here */
 
-	/*
-	 * The existence of these should never be relied upon - they should only
-	 * be used for user feedback or similar purposes.
-	 */
-	CONNECTION_STARTED,			/* Waiting for connection to be made.  */
-	CONNECTION_MADE,			/* Connection OK; waiting to send.	   */
-	CONNECTION_AWAITING_RESPONSE,		/* Waiting for a response from the
-										 * postmaster.		  */
-	CONNECTION_AUTH_OK,			/* Received authentication; waiting for
-								 * backend startup. */
-	CONNECTION_SETENV,			/* Negotiating environment. */
-	CONNECTION_SSL_STARTUP,		/* Negotiating SSL. */
-	CONNECTION_NEEDED			/* Internal state: connect() needed */
+    /*
+     * The existence of these should never be relied upon - they should only
+     * be used for user feedback or similar purposes.
+     */
+    CONNECTION_STARTED,         /* Waiting for connection to be made.  */
+    CONNECTION_MADE,            /* Connection OK; waiting to send.     */
+    CONNECTION_AWAITING_RESPONSE,       /* Waiting for a response from the
+                                         * postmaster.        */
+    CONNECTION_AUTH_OK,         /* Received authentication; waiting for
+                                 * backend startup. */
+    CONNECTION_SETENV,          /* Negotiating environment. */
+    CONNECTION_SSL_STARTUP,     /* Negotiating SSL. */
+    CONNECTION_NEEDED           /* Internal state: connect() needed */
 } ConnStatusType;
 
 typedef enum
 {
-	PGRES_POLLING_FAILED = 0,
-	PGRES_POLLING_READING,		/* These two indicate that one may	  */
-	PGRES_POLLING_WRITING,		/* use select before polling again.   */
-	PGRES_POLLING_OK,
-	PGRES_POLLING_ACTIVE		/* unused; keep for awhile for backwards
-								 * compatibility */
+    PGRES_POLLING_FAILED = 0,
+    PGRES_POLLING_READING,      /* These two indicate that one may    */
+    PGRES_POLLING_WRITING,      /* use select before polling again.   */
+    PGRES_POLLING_OK,
+    PGRES_POLLING_ACTIVE        /* unused; keep for awhile for backwards
+                                 * compatibility */
 } PostgresPollingStatusType;
 
 typedef enum
 {
-	PGRES_EMPTY_QUERY = 0,		/* empty query string was executed */
-	PGRES_COMMAND_OK,			/* a query command that doesn't return
-								 * anything was executed properly by the
-								 * backend */
-	PGRES_TUPLES_OK,			/* a query command that returns tuples was
-								 * executed properly by the backend, PGresult
-								 * contains the result tuples */
-	PGRES_COPY_OUT,				/* Copy Out data transfer in progress */
-	PGRES_COPY_IN,				/* Copy In data transfer in progress */
-	PGRES_BAD_RESPONSE,			/* an unexpected response was recv'd from the
-								 * backend */
-	PGRES_NONFATAL_ERROR,		/* notice or warning message */
-	PGRES_FATAL_ERROR			/* query failed */
+    PGRES_EMPTY_QUERY = 0,      /* empty query string was executed */
+    PGRES_COMMAND_OK,           /* a query command that doesn't return
+                                 * anything was executed properly by the
+                                 * backend */
+    PGRES_TUPLES_OK,            /* a query command that returns tuples was
+                                 * executed properly by the backend, PGresult
+                                 * contains the result tuples */
+    PGRES_COPY_OUT,             /* Copy Out data transfer in progress */
+    PGRES_COPY_IN,              /* Copy In data transfer in progress */
+    PGRES_BAD_RESPONSE,         /* an unexpected response was recv'd from the
+                                 * backend */
+    PGRES_NONFATAL_ERROR,       /* notice or warning message */
+    PGRES_FATAL_ERROR           /* query failed */
 } ExecStatusType;
 
 typedef enum
 {
-	PQTRANS_IDLE,				/* connection idle */
-	PQTRANS_ACTIVE,				/* command in progress */
-	PQTRANS_INTRANS,			/* idle, within transaction block */
-	PQTRANS_INERROR,			/* idle, within failed transaction */
-	PQTRANS_UNKNOWN				/* cannot determine status */
+    PQTRANS_IDLE,               /* connection idle */
+    PQTRANS_ACTIVE,             /* command in progress */
+    PQTRANS_INTRANS,            /* idle, within transaction block */
+    PQTRANS_INERROR,            /* idle, within failed transaction */
+    PQTRANS_UNKNOWN             /* cannot determine status */
 } PGTransactionStatusType;
 
 typedef enum
 {
-	PQERRORS_TERSE,				/* single-line error messages */
-	PQERRORS_DEFAULT,			/* recommended style */
-	PQERRORS_VERBOSE			/* all the facts, ma'am */
+    PQERRORS_TERSE,             /* single-line error messages */
+    PQERRORS_DEFAULT,           /* recommended style */
+    PQERRORS_VERBOSE            /* all the facts, ma'am */
 } PGVerbosity;
 
 /* PGconn encapsulates a connection to the backend.
@@ -125,11 +125,11 @@ typedef struct pg_cancel PGcancel;
  */
 typedef struct pgNotify
 {
-	char	   *relname;		/* notification condition name */
-	int			be_pid;			/* process ID of notifying server process */
-	char	   *extra;			/* notification parameter */
-	/* Fields below here are private to libpq; apps should not use 'em */
-	struct pgNotify *next;		/* list link */
+    char       *relname;        /* notification condition name */
+    int         be_pid;         /* process ID of notifying server process */
+    char       *extra;          /* notification parameter */
+    /* Fields below here are private to libpq; apps should not use 'em */
+    struct pgNotify *next;      /* list link */
 } PGnotify;
 
 /* Function types for notice-handling callbacks */
@@ -141,17 +141,17 @@ typedef char pqbool;
 
 typedef struct _PQprintOpt
 {
-	pqbool		header;			/* print output field headings and row count */
-	pqbool		align;			/* fill align the fields */
-	pqbool		standard;		/* old brain dead format */
-	pqbool		html3;			/* output html tables */
-	pqbool		expanded;		/* expand tables */
-	pqbool		pager;			/* use pager for output if needed */
-	char	   *fieldSep;		/* field separator */
-	char	   *tableOpt;		/* insert to HTML  */
-	char	   *caption;		/* HTML 
*/ - char **fieldName; /* null terminated array of replacement field - * names */ + pqbool header; /* print output field headings and row count */ + pqbool align; /* fill align the fields */ + pqbool standard; /* old brain dead format */ + pqbool html3; /* output html tables */ + pqbool expanded; /* expand tables */ + pqbool pager; /* use pager for output if needed */ + char *fieldSep; /* field separator */ + char *tableOpt; /* insert to HTML */ + char *caption; /* HTML
*/ + char **fieldName; /* null terminated array of replacement field + * names */ } PQprintOpt; /* ---------------- @@ -164,17 +164,17 @@ typedef struct _PQprintOpt */ typedef struct _PQconninfoOption { - char *keyword; /* The keyword of the option */ - char *envvar; /* Fallback environment variable name */ - char *compiled; /* Fallback compiled in default value */ - char *val; /* Option's current value, or NULL */ - char *label; /* Label for field in connect dialog */ - char *dispchar; /* Character to display for this field in a - * connect dialog. Values are: "" Display - * entered value as is "*" Password field - - * hide value "D" Debug option - don't show - * by default */ - int dispsize; /* Field size in characters for dialog */ + char *keyword; /* The keyword of the option */ + char *envvar; /* Fallback environment variable name */ + char *compiled; /* Fallback compiled in default value */ + char *val; /* Option's current value, or NULL */ + char *label; /* Label for field in connect dialog */ + char *dispchar; /* Character to display for this field in a + * connect dialog. Values are: "" Display + * entered value as is "*" Password field - + * hide value "D" Debug option - don't show + * by default */ + int dispsize; /* Field size in characters for dialog */ } PQconninfoOption; /* ---------------- @@ -183,13 +183,13 @@ typedef struct _PQconninfoOption */ typedef struct { - int len; - int isint; - union - { - int *ptr; /* can't use void (dec compiler barfs) */ - int integer; - } u; + int len; + int isint; + union + { + int *ptr; /* can't use void (dec compiler barfs) */ + int integer; + } u; } PQArgBlock; /* ---------------- @@ -197,7 +197,7 @@ typedef struct * ---------------- */ -/* === in fe-connect.c === */ +/* === in fe-connect.c === */ /* make a new client connection to the backend */ /* Asynchronous (non-blocking) */ @@ -207,12 +207,12 @@ extern PostgresPollingStatusType PQconnectPoll(PGconn *conn); /* Synchronous (blocking) */ extern PGconn *PQconnectdb(const char *conninfo); extern PGconn *PQsetdbLogin(const char *pghost, const char *pgport, - const char *pgoptions, const char *pgtty, - const char *dbName, - const char *login, const char *pwd); + const char *pgoptions, const char *pgtty, + const char *dbName, + const char *login, const char *pwd); #define PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME) \ - PQsetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, NULL, NULL) + PQsetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, NULL, NULL) /* close the current connection and free the PGconn data structure */ extern void PQfinish(PGconn *conn); @@ -228,7 +228,7 @@ extern void PQconninfoFree(PQconninfoOption *connOptions); * parameters */ /* Asynchronous (non-blocking) */ -extern int PQresetStart(PGconn *conn); +extern int PQresetStart(PGconn *conn); extern PostgresPollingStatusType PQresetPoll(PGconn *conn); /* Synchronous (blocking) */ @@ -241,10 +241,10 @@ extern PGcancel *PQgetCancel(PGconn *conn); extern void PQfreeCancel(PGcancel *cancel); /* issue a cancel request */ -extern int PQcancel(PGcancel *cancel, char *errbuf, int errbufsize); +extern int PQcancel(PGcancel *cancel, char *errbuf, int errbufsize); /* backwards compatible version of PQcancel; not thread-safe */ -extern int PQrequestCancel(PGconn *conn); +extern int PQrequestCancel(PGconn *conn); /* Accessor functions for PGconn objects */ extern char *PQdb(const PGconn *conn); @@ -257,16 +257,16 @@ extern char *PQoptions(const PGconn *conn); extern ConnStatusType PQstatus(const PGconn *conn); extern PGTransactionStatusType PQtransactionStatus(const PGconn *conn); extern const char *PQparameterStatus(const PGconn *conn, - const char *paramName); -extern int PQprotocolVersion(const PGconn *conn); -extern int PQserverVersion(const PGconn *conn); + const char *paramName); +extern int PQprotocolVersion(const PGconn *conn); +extern int PQserverVersion(const PGconn *conn); extern char *PQerrorMessage(const PGconn *conn); -extern int PQsocket(const PGconn *conn); -extern int PQbackendPID(const PGconn *conn); -extern int PQconnectionNeedsPassword(const PGconn *conn); -extern int PQconnectionUsedPassword(const PGconn *conn); -extern int PQclientEncoding(const PGconn *conn); -extern int PQsetClientEncoding(PGconn *conn, const char *encoding); +extern int PQsocket(const PGconn *conn); +extern int PQbackendPID(const PGconn *conn); +extern int PQconnectionNeedsPassword(const PGconn *conn); +extern int PQconnectionUsedPassword(const PGconn *conn); +extern int PQclientEncoding(const PGconn *conn); +extern int PQsetClientEncoding(PGconn *conn, const char *encoding); /* Get the OpenSSL structure associated with a connection. Returns NULL for * unencrypted connections or if any other TLS library is in use. */ @@ -284,18 +284,18 @@ extern void PQuntrace(PGconn *conn); /* Override default notice handling routines */ extern PQnoticeReceiver PQsetNoticeReceiver(PGconn *conn, - PQnoticeReceiver proc, - void *arg); + PQnoticeReceiver proc, + void *arg); extern PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn, - PQnoticeProcessor proc, - void *arg); + PQnoticeProcessor proc, + void *arg); /* - * Used to set callback that prevents concurrent access to - * non-thread safe functions that libpq needs. - * The default implementation uses a libpq internal mutex. - * Only required for multithreaded apps that use kerberos - * both within their app and for postgresql connections. + * Used to set callback that prevents concurrent access to + * non-thread safe functions that libpq needs. + * The default implementation uses a libpq internal mutex. + * Only required for multithreaded apps that use kerberos + * both within their app and for postgresql connections. */ typedef void (*pgthreadlock_t) (int acquire); @@ -306,116 +306,116 @@ extern pgthreadlock_t PQregisterThreadLock(pgthreadlock_t newhandler); /* Simple synchronous query */ extern PGresult *PQexec(PGconn *conn, const char *query); extern PGresult *PQexecParams(PGconn *conn, - const char *command, - int nParams, - const Oid *paramTypes, - const char *const * paramValues, - const int *paramLengths, - const int *paramFormats, - int resultFormat); + const char *command, + int nParams, + const Oid *paramTypes, + const char *const * paramValues, + const int *paramLengths, + const int *paramFormats, + int resultFormat); extern PGresult *PQprepare(PGconn *conn, const char *stmtName, - const char *query, int nParams, - const Oid *paramTypes); + const char *query, int nParams, + const Oid *paramTypes); extern PGresult *PQexecPrepared(PGconn *conn, - const char *stmtName, - int nParams, - const char *const * paramValues, - const int *paramLengths, - const int *paramFormats, - int resultFormat); + const char *stmtName, + int nParams, + const char *const * paramValues, + const int *paramLengths, + const int *paramFormats, + int resultFormat); /* Interface for multiple-result or asynchronous queries */ -extern int PQsendQuery(PGconn *conn, const char *query); +extern int PQsendQuery(PGconn *conn, const char *query); extern int PQsendQueryParams(PGconn *conn, - const char *command, - int nParams, - const Oid *paramTypes, - const char *const * paramValues, - const int *paramLengths, - const int *paramFormats, - int resultFormat); + const char *command, + int nParams, + const Oid *paramTypes, + const char *const * paramValues, + const int *paramLengths, + const int *paramFormats, + int resultFormat); extern int PQsendPrepare(PGconn *conn, const char *stmtName, - const char *query, int nParams, - const Oid *paramTypes); + const char *query, int nParams, + const Oid *paramTypes); extern int PQsendQueryPrepared(PGconn *conn, - const char *stmtName, - int nParams, - const char *const * paramValues, - const int *paramLengths, - const int *paramFormats, - int resultFormat); + const char *stmtName, + int nParams, + const char *const * paramValues, + const int *paramLengths, + const int *paramFormats, + int resultFormat); extern PGresult *PQgetResult(PGconn *conn); /* Routines for managing an asynchronous query */ -extern int PQisBusy(PGconn *conn); -extern int PQconsumeInput(PGconn *conn); +extern int PQisBusy(PGconn *conn); +extern int PQconsumeInput(PGconn *conn); /* LISTEN/NOTIFY support */ extern PGnotify *PQnotifies(PGconn *conn); /* Routines for copy in/out */ -extern int PQputCopyData(PGconn *conn, const char *buffer, int nbytes); -extern int PQputCopyEnd(PGconn *conn, const char *errormsg); -extern int PQgetCopyData(PGconn *conn, char **buffer, int async); +extern int PQputCopyData(PGconn *conn, const char *buffer, int nbytes); +extern int PQputCopyEnd(PGconn *conn, const char *errormsg); +extern int PQgetCopyData(PGconn *conn, char **buffer, int async); /* Deprecated routines for copy in/out */ -extern int PQgetline(PGconn *conn, char *string, int length); -extern int PQputline(PGconn *conn, const char *string); -extern int PQgetlineAsync(PGconn *conn, char *buffer, int bufsize); -extern int PQputnbytes(PGconn *conn, const char *buffer, int nbytes); -extern int PQendcopy(PGconn *conn); +extern int PQgetline(PGconn *conn, char *string, int length); +extern int PQputline(PGconn *conn, const char *string); +extern int PQgetlineAsync(PGconn *conn, char *buffer, int bufsize); +extern int PQputnbytes(PGconn *conn, const char *buffer, int nbytes); +extern int PQendcopy(PGconn *conn); /* Set blocking/nonblocking connection to the backend */ -extern int PQsetnonblocking(PGconn *conn, int arg); -extern int PQisnonblocking(const PGconn *conn); -extern int PQisthreadsafe(void); +extern int PQsetnonblocking(PGconn *conn, int arg); +extern int PQisnonblocking(const PGconn *conn); +extern int PQisthreadsafe(void); /* Force the write buffer to be written (or at least try) */ -extern int PQflush(PGconn *conn); +extern int PQflush(PGconn *conn); /* * "Fast path" interface --- not really recommended for application * use */ extern PGresult *PQfn(PGconn *conn, - int fnid, - int *result_buf, - int *result_len, - int result_is_int, - const PQArgBlock *args, - int nargs); + int fnid, + int *result_buf, + int *result_len, + int result_is_int, + const PQArgBlock *args, + int nargs); /* Accessor functions for PGresult objects */ extern ExecStatusType PQresultStatus(const PGresult *res); extern char *PQresStatus(ExecStatusType status); extern char *PQresultErrorMessage(const PGresult *res); extern char *PQresultErrorField(const PGresult *res, int fieldcode); -extern int PQntuples(const PGresult *res); -extern int PQnfields(const PGresult *res); -extern int PQbinaryTuples(const PGresult *res); +extern int PQntuples(const PGresult *res); +extern int PQnfields(const PGresult *res); +extern int PQbinaryTuples(const PGresult *res); extern char *PQfname(const PGresult *res, int field_num); -extern int PQfnumber(const PGresult *res, const char *field_name); -extern Oid PQftable(const PGresult *res, int field_num); -extern int PQftablecol(const PGresult *res, int field_num); -extern int PQfformat(const PGresult *res, int field_num); -extern Oid PQftype(const PGresult *res, int field_num); -extern int PQfsize(const PGresult *res, int field_num); -extern int PQfmod(const PGresult *res, int field_num); +extern int PQfnumber(const PGresult *res, const char *field_name); +extern Oid PQftable(const PGresult *res, int field_num); +extern int PQftablecol(const PGresult *res, int field_num); +extern int PQfformat(const PGresult *res, int field_num); +extern Oid PQftype(const PGresult *res, int field_num); +extern int PQfsize(const PGresult *res, int field_num); +extern int PQfmod(const PGresult *res, int field_num); extern char *PQcmdStatus(PGresult *res); -extern char *PQoidStatus(const PGresult *res); /* old and ugly */ -extern Oid PQoidValue(const PGresult *res); /* new and improved */ +extern char *PQoidStatus(const PGresult *res); /* old and ugly */ +extern Oid PQoidValue(const PGresult *res); /* new and improved */ extern char *PQcmdTuples(PGresult *res); extern char *PQgetvalue(const PGresult *res, int tup_num, int field_num); -extern int PQgetlength(const PGresult *res, int tup_num, int field_num); -extern int PQgetisnull(const PGresult *res, int tup_num, int field_num); -extern int PQnparams(const PGresult *res); -extern Oid PQparamtype(const PGresult *res, int param_num); +extern int PQgetlength(const PGresult *res, int tup_num, int field_num); +extern int PQgetisnull(const PGresult *res, int tup_num, int field_num); +extern int PQnparams(const PGresult *res); +extern Oid PQparamtype(const PGresult *res, int param_num); /* Describe prepared statements and portals */ extern PGresult *PQdescribePrepared(PGconn *conn, const char *stmt); extern PGresult *PQdescribePortal(PGconn *conn, const char *portal); -extern int PQsendDescribePrepared(PGconn *conn, const char *stmt); -extern int PQsendDescribePortal(PGconn *conn, const char *portal); +extern int PQsendDescribePrepared(PGconn *conn, const char *stmt); +extern int PQsendDescribePortal(PGconn *conn, const char *portal); /* Delete a PGresult */ extern void PQclear(PGresult *res); @@ -428,7 +428,7 @@ extern void PQfreemem(void *ptr); /* Error when no password was given. */ /* Note: depending on this is deprecated; use PQconnectionNeedsPassword(). */ -#define PQnoPasswordSupplied "fe_sendauth: no password supplied\n" +#define PQnoPasswordSupplied "fe_sendauth: no password supplied\n" /* * Make an empty PGresult with given status (some apps find this @@ -440,73 +440,73 @@ extern PGresult *PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status); /* Quoting strings before inclusion in queries. */ extern size_t PQescapeStringConn(PGconn *conn, - char *to, const char *from, size_t length, - int *error); + char *to, const char *from, size_t length, + int *error); extern unsigned char *PQescapeByteaConn(PGconn *conn, - const unsigned char *from, size_t from_length, - size_t *to_length); + const unsigned char *from, size_t from_length, + size_t *to_length); extern unsigned char *PQunescapeBytea(const unsigned char *strtext, - size_t *retbuflen); + size_t *retbuflen); /* These forms are deprecated! */ extern size_t PQescapeString(char *to, const char *from, size_t length); extern unsigned char *PQescapeBytea(const unsigned char *from, size_t from_length, - size_t *to_length); + size_t *to_length); /* === in fe-print.c === */ extern void -PQprint(FILE *fout, /* output stream */ - const PGresult *res, - const PQprintOpt *ps); /* option structure */ +PQprint(FILE *fout, /* output stream */ + const PGresult *res, + const PQprintOpt *ps); /* option structure */ /* * really old printing routines */ extern void PQdisplayTuples(const PGresult *res, - FILE *fp, /* where to send the output */ - int fillAlign, /* pad the fields with spaces */ - const char *fieldSep, /* field separator */ - int printHeader, /* display headers? */ - int quiet); + FILE *fp, /* where to send the output */ + int fillAlign, /* pad the fields with spaces */ + const char *fieldSep, /* field separator */ + int printHeader, /* display headers? */ + int quiet); extern void PQprintTuples(const PGresult *res, - FILE *fout, /* output stream */ - int printAttName, /* print attribute names */ - int terseOutput, /* delimiter bars */ - int width); /* width of column, if 0, use variable width */ + FILE *fout, /* output stream */ + int printAttName, /* print attribute names */ + int terseOutput, /* delimiter bars */ + int width); /* width of column, if 0, use variable width */ /* === in fe-lobj.c === */ /* Large-object access routines */ -extern int lo_open(PGconn *conn, Oid lobjId, int mode); -extern int lo_close(PGconn *conn, int fd); -extern int lo_read(PGconn *conn, int fd, char *buf, size_t len); -extern int lo_write(PGconn *conn, int fd, const char *buf, size_t len); -extern int lo_lseek(PGconn *conn, int fd, int offset, int whence); -extern Oid lo_creat(PGconn *conn, int mode); -extern Oid lo_create(PGconn *conn, Oid lobjId); -extern int lo_tell(PGconn *conn, int fd); -extern int lo_truncate(PGconn *conn, int fd, size_t len); -extern int lo_unlink(PGconn *conn, Oid lobjId); -extern Oid lo_import(PGconn *conn, const char *filename); -extern int lo_export(PGconn *conn, Oid lobjId, const char *filename); +extern int lo_open(PGconn *conn, Oid lobjId, int mode); +extern int lo_close(PGconn *conn, int fd); +extern int lo_read(PGconn *conn, int fd, char *buf, size_t len); +extern int lo_write(PGconn *conn, int fd, const char *buf, size_t len); +extern int lo_lseek(PGconn *conn, int fd, int offset, int whence); +extern Oid lo_creat(PGconn *conn, int mode); +extern Oid lo_create(PGconn *conn, Oid lobjId); +extern int lo_tell(PGconn *conn, int fd); +extern int lo_truncate(PGconn *conn, int fd, size_t len); +extern int lo_unlink(PGconn *conn, Oid lobjId); +extern Oid lo_import(PGconn *conn, const char *filename); +extern int lo_export(PGconn *conn, Oid lobjId, const char *filename); /* === in fe-misc.c === */ /* Determine length of multibyte encoded char at *s */ -extern int PQmblen(const char *s, int encoding); +extern int PQmblen(const char *s, int encoding); /* Determine display length of multibyte encoded char at *s */ -extern int PQdsplen(const char *s, int encoding); +extern int PQdsplen(const char *s, int encoding); /* Get encoding id from environment variable PGCLIENTENCODING */ -extern int PQenv2encoding(void); +extern int PQenv2encoding(void); /* === in fe-auth.c === */ @@ -514,9 +514,9 @@ extern char *PQencryptPassword(const char *passwd, const char *user); /* === in encnames.c === */ -extern int pg_char_to_encoding(const char *name); +extern int pg_char_to_encoding(const char *name); extern const char *pg_encoding_to_char(int encoding); -extern int pg_valid_server_encoding_id(int encoding); +extern int pg_valid_server_encoding_id(int encoding); #ifdef __cplusplus } diff --git a/dep/include/postgre/pg_type.h b/dep/include/postgre/pg_type.h index 823656cb1ca..deac579a54f 100644 --- a/dep/include/postgre/pg_type.h +++ b/dep/include/postgre/pg_type.h @@ -1,8 +1,8 @@ /*------------------------------------------------------------------------- * * pg_type.h - * definition of the system "type" relation (pg_type) - * along with the relation's initial contents. + * definition of the system "type" relation (pg_type) + * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group @@ -11,8 +11,8 @@ * $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/pg_type.h,v 1.8 2008/01/01 19:45:59 momjian Exp $ * * NOTES - * the genbki.sh script reads this file and generates .bki - * information from the DATA() statements. + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. * *------------------------------------------------------------------------- */ @@ -20,54 +20,54 @@ #define PG_TYPE_H /* ---------------- - * initial contents of pg_type + * initial contents of pg_type * ---------------- */ /* keep the following ordered by OID so that later changes can be made easier*/ /* OIDS 1 - 99 */ -#define BOOLOID 16 -#define BYTEAOID 17 -#define CHAROID 18 -#define NAMEOID 19 -#define INT8OID 20 -#define INT2OID 21 -#define INT2VECTOROID 22 -#define INT4OID 23 -#define REGPROCOID 24 -#define TEXTOID 25 -#define OIDOID 26 -#define TIDOID 27 +#define BOOLOID 16 +#define BYTEAOID 17 +#define CHAROID 18 +#define NAMEOID 19 +#define INT8OID 20 +#define INT2OID 21 +#define INT2VECTOROID 22 +#define INT4OID 23 +#define REGPROCOID 24 +#define TEXTOID 25 +#define OIDOID 26 +#define TIDOID 27 #define XIDOID 28 #define CIDOID 29 -#define OIDVECTOROID 30 -#define POINTOID 600 -#define LSEGOID 601 -#define PATHOID 602 -#define BOXOID 603 -#define POLYGONOID 604 -#define LINEOID 628 +#define OIDVECTOROID 30 +#define POINTOID 600 +#define LSEGOID 601 +#define PATHOID 602 +#define BOXOID 603 +#define POLYGONOID 604 +#define LINEOID 628 #define FLOAT4OID 700 #define FLOAT8OID 701 -#define ABSTIMEOID 702 -#define RELTIMEOID 703 -#define TINTERVALOID 704 -#define UNKNOWNOID 705 -#define CIRCLEOID 718 +#define ABSTIMEOID 702 +#define RELTIMEOID 703 +#define TINTERVALOID 704 +#define UNKNOWNOID 705 +#define CIRCLEOID 718 #define CASHOID 790 #define INETOID 869 #define CIDROID 650 -#define BPCHAROID 1042 -#define VARCHAROID 1043 -#define DATEOID 1082 -#define TIMEOID 1083 -#define TIMESTAMPOID 1114 -#define TIMESTAMPTZOID 1184 -#define INTERVALOID 1186 -#define TIMETZOID 1266 -#define ZPBITOID 1560 -#define VARBITOID 1562 -#define NUMERICOID 1700 +#define BPCHAROID 1042 +#define VARCHAROID 1043 +#define DATEOID 1082 +#define TIMEOID 1083 +#define TIMESTAMPOID 1114 +#define TIMESTAMPTZOID 1184 +#define INTERVALOID 1186 +#define TIMETZOID 1266 +#define ZPBITOID 1560 +#define VARBITOID 1562 +#define NUMERICOID 1700 #endif /* PG_TYPE_H */ diff --git a/dep/include/postgre/postgres_ext.h b/dep/include/postgre/postgres_ext.h index 51a18b7dcc3..48a191de98c 100644 --- a/dep/include/postgre/postgres_ext.h +++ b/dep/include/postgre/postgres_ext.h @@ -2,18 +2,18 @@ * * postgres_ext.h * - * This file contains declarations of things that are visible everywhere - * in PostgreSQL *and* are visible to clients of frontend interface libraries. - * For example, the Oid type is part of the API of libpq and other libraries. + * This file contains declarations of things that are visible everywhere + * in PostgreSQL *and* are visible to clients of frontend interface libraries. + * For example, the Oid type is part of the API of libpq and other libraries. * - * Declarations which are specific to a particular interface should - * go in the header file for that interface (such as libpq-fe.h). This - * file is only for fundamental Postgres declarations. + * Declarations which are specific to a particular interface should + * go in the header file for that interface (such as libpq-fe.h). This + * file is only for fundamental Postgres declarations. * - * User-written C functions don't count as "external to Postgres." - * Those function much as local modifications to the backend itself, and - * use header files that are otherwise internal to Postgres to interface - * with the backend. + * User-written C functions don't count as "external to Postgres." + * Those function much as local modifications to the backend itself, and + * use header files that are otherwise internal to Postgres to interface + * with the backend. * * $PostgreSQL: pgsql/src/include/postgres_ext.h,v 1.17 2007/02/06 09:16:08 petere Exp $ * @@ -29,9 +29,9 @@ typedef unsigned int Oid; #ifdef __cplusplus -#define InvalidOid (Oid(0)) +#define InvalidOid (Oid(0)) #else -#define InvalidOid ((Oid) 0) +#define InvalidOid ((Oid) 0) #endif #define OID_MAX UINT_MAX @@ -43,17 +43,17 @@ typedef unsigned int Oid; * between frontend and backend, and also to export them to libpq * applications. */ -#define PG_DIAG_SEVERITY 'S' -#define PG_DIAG_SQLSTATE 'C' +#define PG_DIAG_SEVERITY 'S' +#define PG_DIAG_SQLSTATE 'C' #define PG_DIAG_MESSAGE_PRIMARY 'M' -#define PG_DIAG_MESSAGE_DETAIL 'D' -#define PG_DIAG_MESSAGE_HINT 'H' +#define PG_DIAG_MESSAGE_DETAIL 'D' +#define PG_DIAG_MESSAGE_HINT 'H' #define PG_DIAG_STATEMENT_POSITION 'P' #define PG_DIAG_INTERNAL_POSITION 'p' -#define PG_DIAG_INTERNAL_QUERY 'q' -#define PG_DIAG_CONTEXT 'W' -#define PG_DIAG_SOURCE_FILE 'F' -#define PG_DIAG_SOURCE_LINE 'L' +#define PG_DIAG_INTERNAL_QUERY 'q' +#define PG_DIAG_CONTEXT 'W' +#define PG_DIAG_SOURCE_FILE 'F' +#define PG_DIAG_SOURCE_LINE 'L' #define PG_DIAG_SOURCE_FUNCTION 'R' #endif diff --git a/dep/include/sockets/Base64.h b/dep/include/sockets/Base64.h index a632bbec730..0620cee6a30 100644 --- a/dep/include/sockets/Base64.h +++ b/dep/include/sockets/Base64.h @@ -1,6 +1,6 @@ /** \file Base64.h - ** \date 2004-02-13 - ** \author grymse@alhem.net + ** \date 2004-02-13 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -44,28 +44,28 @@ namespace SOCKETS_NAMESPACE { /** \defgroup util Utilities */ -/** Base64 encode/decode. - \ingroup util */ +/** Base64 encode/decode. + \ingroup util */ class Base64 { public: - Base64(); + Base64(); - void encode(FILE *, std::string& , bool add_crlf = true); - void encode(const std::string&, std::string& , bool add_crlf = true); - void encode(const char *, size_t, std::string& , bool add_crlf = true); - void encode(const unsigned char *, size_t, std::string& , bool add_crlf = true); + void encode(FILE *, std::string& , bool add_crlf = true); + void encode(const std::string&, std::string& , bool add_crlf = true); + void encode(const char *, size_t, std::string& , bool add_crlf = true); + void encode(const unsigned char *, size_t, std::string& , bool add_crlf = true); - void decode(const std::string&, std::string& ); - void decode(const std::string&, unsigned char *, size_t&); + void decode(const std::string&, std::string& ); + void decode(const std::string&, unsigned char *, size_t&); - size_t decode_length(const std::string& ); + size_t decode_length(const std::string& ); private: - Base64(const Base64& ) {} - Base64& operator=(const Base64& ) { return *this; } -static const char *bstr; -static const char rstr[128]; + Base64(const Base64& ) {} + Base64& operator=(const Base64& ) { return *this; } +static const char *bstr; +static const char rstr[128]; }; diff --git a/dep/include/sockets/Exception.h b/dep/include/sockets/Exception.h index 81ba7373d0d..8bfa9904d8b 100644 --- a/dep/include/sockets/Exception.h +++ b/dep/include/sockets/Exception.h @@ -1,7 +1,7 @@ /** - ** \file Exception.h - ** \date 2007-09-28 - ** \author grymse@alhem.net + ** \file Exception.h + ** \date 2007-09-28 + ** \author grymse@alhem.net **/ /* Copyright (C) 2007 Anders Hedstrom @@ -34,17 +34,17 @@ namespace SOCKETS_NAMESPACE { class Exception { public: - Exception(const std::string& description); - virtual ~Exception() {} + Exception(const std::string& description); + virtual ~Exception() {} - virtual const std::string ToString() const; + virtual const std::string ToString() const; - Exception(const Exception& ) {} // copy constructor + Exception(const Exception& ) {} // copy constructor - Exception& operator=(const Exception& ) { return *this; } // assignment operator + Exception& operator=(const Exception& ) { return *this; } // assignment operator private: - std::string m_description; + std::string m_description; }; diff --git a/dep/include/sockets/File.h b/dep/include/sockets/File.h index 58a1b71bb85..803930fc790 100644 --- a/dep/include/sockets/File.h +++ b/dep/include/sockets/File.h @@ -1,6 +1,6 @@ /** \file File.h - ** \date 2005-04-25 - ** \author grymse@alhem.net + ** \date 2005-04-25 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -39,38 +39,38 @@ namespace SOCKETS_NAMESPACE { #endif -/** IFile implementation of a disk file. - \ingroup file */ +/** IFile implementation of a disk file. + \ingroup file */ class File : public IFile { public: - File(); - ~File(); + File(); + ~File(); - bool fopen(const std::string&, const std::string&); - void fclose(); + bool fopen(const std::string&, const std::string&); + void fclose(); - size_t fread(char *, size_t, size_t) const; - size_t fwrite(const char *, size_t, size_t); + size_t fread(char *, size_t, size_t) const; + size_t fwrite(const char *, size_t, size_t); - char *fgets(char *, int) const; - void fprintf(const char *format, ...); + char *fgets(char *, int) const; + void fprintf(const char *format, ...); - off_t size() const; - bool eof() const; + off_t size() const; + bool eof() const; - void reset_read() const; - void reset_write(); + void reset_read() const; + void reset_write(); private: - File(const File& ) {} // copy constructor - File& operator=(const File& ) { return *this; } // assignment operator + File(const File& ) {} // copy constructor + File& operator=(const File& ) { return *this; } // assignment operator - std::string m_path; - std::string m_mode; - FILE *m_fil; - mutable long m_rptr; - long m_wptr; + std::string m_path; + std::string m_mode; + FILE *m_fil; + mutable long m_rptr; + long m_wptr; }; diff --git a/dep/include/sockets/IFile.h b/dep/include/sockets/IFile.h index aecc50f5997..f086d9ef1f1 100644 --- a/dep/include/sockets/IFile.h +++ b/dep/include/sockets/IFile.h @@ -1,6 +1,6 @@ /** \file IFile.h - ** \date 2005-04-25 - ** \author grymse@alhem.net + ** \date 2005-04-25 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -38,27 +38,27 @@ namespace SOCKETS_NAMESPACE { #endif /** \defgroup file File handling */ -/** Pure virtual file I/O interface. - \ingroup file */ +/** Pure virtual file I/O interface. + \ingroup file */ class IFile { public: - virtual ~IFile() {} + virtual ~IFile() {} - virtual bool fopen(const std::string&, const std::string&) = 0; - virtual void fclose() = 0; + virtual bool fopen(const std::string&, const std::string&) = 0; + virtual void fclose() = 0; - virtual size_t fread(char *, size_t, size_t) const = 0; - virtual size_t fwrite(const char *, size_t, size_t) = 0; + virtual size_t fread(char *, size_t, size_t) const = 0; + virtual size_t fwrite(const char *, size_t, size_t) = 0; - virtual char *fgets(char *, int) const = 0; - virtual void fprintf(const char *format, ...) = 0; + virtual char *fgets(char *, int) const = 0; + virtual void fprintf(const char *format, ...) = 0; - virtual off_t size() const = 0; - virtual bool eof() const = 0; + virtual off_t size() const = 0; + virtual bool eof() const = 0; - virtual void reset_read() const = 0; - virtual void reset_write() = 0; + virtual void reset_read() const = 0; + virtual void reset_write() = 0; }; diff --git a/dep/include/sockets/ISocketHandler.h b/dep/include/sockets/ISocketHandler.h index 2667e2d22ed..5c9d539b3a9 100644 --- a/dep/include/sockets/ISocketHandler.h +++ b/dep/include/sockets/ISocketHandler.h @@ -1,6 +1,6 @@ /** \file ISocketHandler.h - ** \date 2004-02-13 - ** \author grymse@alhem.net + ** \date 2004-02-13 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -42,183 +42,183 @@ namespace SOCKETS_NAMESPACE { #endif typedef enum { - LIST_CALLONCONNECT = 0, + LIST_CALLONCONNECT = 0, #ifdef ENABLE_DETACH - LIST_DETACH, + LIST_DETACH, #endif - LIST_TIMEOUT, - LIST_RETRY, - LIST_CLOSE + LIST_TIMEOUT, + LIST_RETRY, + LIST_CLOSE } list_t; class SocketAddress; class Mutex; -/** Socket container class, event generator. - \ingroup basic */ +/** Socket container class, event generator. + \ingroup basic */ class ISocketHandler { - friend class Socket; + friend class Socket; public: - /** Connection pool class for internal use by the ISocketHandler. - \ingroup internal */ + /** Connection pool class for internal use by the ISocketHandler. + \ingroup internal */ #ifdef ENABLE_POOL - class PoolSocket : public Socket - { - public: - PoolSocket(ISocketHandler& h,Socket *src) : Socket(h) { - CopyConnection( src ); - SetIsClient(); - } + class PoolSocket : public Socket + { + public: + PoolSocket(ISocketHandler& h,Socket *src) : Socket(h) { + CopyConnection( src ); + SetIsClient(); + } - void OnRead() { - Handler().LogError(this, "OnRead", 0, "data on hibernating socket", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - } - void OnOptions(int,int,int,SOCKET) {} + void OnRead() { + Handler().LogError(this, "OnRead", 0, "data on hibernating socket", LOG_LEVEL_FATAL); + SetCloseAndDelete(); + } + void OnOptions(int,int,int,SOCKET) {} - }; + }; #endif public: - virtual ~ISocketHandler() {} + virtual ~ISocketHandler() {} - /** Get mutex reference for threadsafe operations. */ - virtual Mutex& GetMutex() const = 0; + /** Get mutex reference for threadsafe operations. */ + virtual Mutex& GetMutex() const = 0; - /** Register StdLog object for error callback. - \param log Pointer to log class */ - virtual void RegStdLog(StdLog *log) = 0; + /** Register StdLog object for error callback. + \param log Pointer to log class */ + virtual void RegStdLog(StdLog *log) = 0; - /** Log error to log class for print out / storage. */ - virtual void LogError(Socket *p,const std::string& user_text,int err,const std::string& sys_err,loglevel_t t = LOG_LEVEL_WARNING) = 0; + /** Log error to log class for print out / storage. */ + virtual void LogError(Socket *p,const std::string& user_text,int err,const std::string& sys_err,loglevel_t t = LOG_LEVEL_WARNING) = 0; - // ------------------------------------------------------------------------- - // Socket stuff - // ------------------------------------------------------------------------- - /** Add socket instance to socket map. Removal is always automatic. */ - virtual void Add(Socket *) = 0; + // ------------------------------------------------------------------------- + // Socket stuff + // ------------------------------------------------------------------------- + /** Add socket instance to socket map. Removal is always automatic. */ + virtual void Add(Socket *) = 0; private: - /** Remove socket from socket map, used by Socket class. */ - virtual void Remove(Socket *) = 0; + /** Remove socket from socket map, used by Socket class. */ + virtual void Remove(Socket *) = 0; public: - /** Get status of read/write/exception file descriptor set for a socket. */ - virtual void Get(SOCKET s,bool& r,bool& w,bool& e) = 0; - /** Set read/write/exception file descriptor sets (fd_set). */ - virtual void Set(SOCKET s,bool bRead,bool bWrite,bool bException = true) = 0; + /** Get status of read/write/exception file descriptor set for a socket. */ + virtual void Get(SOCKET s,bool& r,bool& w,bool& e) = 0; + /** Set read/write/exception file descriptor sets (fd_set). */ + virtual void Set(SOCKET s,bool bRead,bool bWrite,bool bException = true) = 0; - /** Wait for events, generate callbacks. */ - virtual int Select(long sec,long usec) = 0; - /** This method will not return until an event has been detected. */ - virtual int Select() = 0; - /** Wait for events, generate callbacks. */ - virtual int Select(struct timeval *tsel) = 0; + /** Wait for events, generate callbacks. */ + virtual int Select(long sec,long usec) = 0; + /** This method will not return until an event has been detected. */ + virtual int Select() = 0; + /** Wait for events, generate callbacks. */ + virtual int Select(struct timeval *tsel) = 0; - /** Check that a socket really is handled by this socket handler. */ - virtual bool Valid(Socket *) = 0; - /** Return number of sockets handled by this handler. */ - virtual size_t GetCount() = 0; + /** Check that a socket really is handled by this socket handler. */ + virtual bool Valid(Socket *) = 0; + /** Return number of sockets handled by this handler. */ + virtual size_t GetCount() = 0; - /** Override and return false to deny all incoming connections. - \param p ListenSocket class pointer (use GetPort to identify which one) */ - virtual bool OkToAccept(Socket *p) = 0; + /** Override and return false to deny all incoming connections. + \param p ListenSocket class pointer (use GetPort to identify which one) */ + virtual bool OkToAccept(Socket *p) = 0; - /** Called by Socket when a socket changes state. */ - virtual void AddList(SOCKET s,list_t which_one,bool add) = 0; + /** Called by Socket when a socket changes state. */ + virtual void AddList(SOCKET s,list_t which_one,bool add) = 0; - // ------------------------------------------------------------------------- - // Connection pool - // ------------------------------------------------------------------------- + // ------------------------------------------------------------------------- + // Connection pool + // ------------------------------------------------------------------------- #ifdef ENABLE_POOL - /** Find available open connection (used by connection pool). */ - virtual ISocketHandler::PoolSocket *FindConnection(int type,const std::string& protocol,SocketAddress&) = 0; - /** Enable connection pool (by default disabled). */ - virtual void EnablePool(bool = true) = 0; - /** Check pool status. - \return true if connection pool is enabled */ - virtual bool PoolEnabled() = 0; + /** Find available open connection (used by connection pool). */ + virtual ISocketHandler::PoolSocket *FindConnection(int type,const std::string& protocol,SocketAddress&) = 0; + /** Enable connection pool (by default disabled). */ + virtual void EnablePool(bool = true) = 0; + /** Check pool status. + \return true if connection pool is enabled */ + virtual bool PoolEnabled() = 0; #endif // ENABLE_POOL - // ------------------------------------------------------------------------- - // Socks4 - // ------------------------------------------------------------------------- + // ------------------------------------------------------------------------- + // Socks4 + // ------------------------------------------------------------------------- #ifdef ENABLE_SOCKS4 - /** Set socks4 server ip that all new tcp sockets should use. */ - virtual void SetSocks4Host(ipaddr_t) = 0; - /** Set socks4 server hostname that all new tcp sockets should use. */ - virtual void SetSocks4Host(const std::string& ) = 0; - /** Set socks4 server port number that all new tcp sockets should use. */ - virtual void SetSocks4Port(port_t) = 0; - /** Set optional socks4 userid. */ - virtual void SetSocks4Userid(const std::string& ) = 0; - /** If connection to socks4 server fails, immediately try direct connection to final host. */ - virtual void SetSocks4TryDirect(bool = true) = 0; - /** Get socks4 server ip. - \return socks4 server ip */ - virtual ipaddr_t GetSocks4Host() = 0; - /** Get socks4 port number. - \return socks4 port number */ - virtual port_t GetSocks4Port() = 0; - /** Get socks4 userid (optional). - \return socks4 userid */ - virtual const std::string& GetSocks4Userid() = 0; - /** Check status of socks4 try direct flag. - \return true if direct connection should be tried if connection to socks4 server fails */ - virtual bool Socks4TryDirect() = 0; + /** Set socks4 server ip that all new tcp sockets should use. */ + virtual void SetSocks4Host(ipaddr_t) = 0; + /** Set socks4 server hostname that all new tcp sockets should use. */ + virtual void SetSocks4Host(const std::string& ) = 0; + /** Set socks4 server port number that all new tcp sockets should use. */ + virtual void SetSocks4Port(port_t) = 0; + /** Set optional socks4 userid. */ + virtual void SetSocks4Userid(const std::string& ) = 0; + /** If connection to socks4 server fails, immediately try direct connection to final host. */ + virtual void SetSocks4TryDirect(bool = true) = 0; + /** Get socks4 server ip. + \return socks4 server ip */ + virtual ipaddr_t GetSocks4Host() = 0; + /** Get socks4 port number. + \return socks4 port number */ + virtual port_t GetSocks4Port() = 0; + /** Get socks4 userid (optional). + \return socks4 userid */ + virtual const std::string& GetSocks4Userid() = 0; + /** Check status of socks4 try direct flag. + \return true if direct connection should be tried if connection to socks4 server fails */ + virtual bool Socks4TryDirect() = 0; #endif // ENABLE_SOCKS4 - // ------------------------------------------------------------------------- - // DNS resolve server - // ------------------------------------------------------------------------- + // ------------------------------------------------------------------------- + // DNS resolve server + // ------------------------------------------------------------------------- #ifdef ENABLE_RESOLVER - /** Enable asynchronous DNS. - \param port Listen port of asynchronous dns server */ - virtual void EnableResolver(port_t = 16667) = 0; - /** Check resolver status. - \return true if resolver is enabled */ - virtual bool ResolverEnabled() = 0; - /** Queue a dns request. - \param host Hostname to be resolved - \param port Port number will be echoed in Socket::OnResolved callback */ - virtual int Resolve(Socket *,const std::string& host,port_t port) = 0; + /** Enable asynchronous DNS. + \param port Listen port of asynchronous dns server */ + virtual void EnableResolver(port_t = 16667) = 0; + /** Check resolver status. + \return true if resolver is enabled */ + virtual bool ResolverEnabled() = 0; + /** Queue a dns request. + \param host Hostname to be resolved + \param port Port number will be echoed in Socket::OnResolved callback */ + virtual int Resolve(Socket *,const std::string& host,port_t port) = 0; #ifdef ENABLE_IPV6 - virtual int Resolve6(Socket *,const std::string& host,port_t port) = 0; + virtual int Resolve6(Socket *,const std::string& host,port_t port) = 0; #endif - /** Do a reverse dns lookup. */ - virtual int Resolve(Socket *,ipaddr_t a) = 0; + /** Do a reverse dns lookup. */ + virtual int Resolve(Socket *,ipaddr_t a) = 0; #ifdef ENABLE_IPV6 - virtual int Resolve(Socket *,in6_addr& a) = 0; + virtual int Resolve(Socket *,in6_addr& a) = 0; #endif - /** Get listen port of asynchronous dns server. */ - virtual port_t GetResolverPort() = 0; - /** Resolver thread ready for queries. */ - virtual bool ResolverReady() = 0; - /** Returns true if socket waiting for a resolve event. */ - virtual bool Resolving(Socket *) = 0; + /** Get listen port of asynchronous dns server. */ + virtual port_t GetResolverPort() = 0; + /** Resolver thread ready for queries. */ + virtual bool ResolverReady() = 0; + /** Returns true if socket waiting for a resolve event. */ + virtual bool Resolving(Socket *) = 0; #endif // ENABLE_RESOLVER #ifdef ENABLE_TRIGGERS - /** Fetch unique trigger id. */ - virtual int TriggerID(Socket *src) = 0; - /** Subscribe socket to trigger id. */ - virtual bool Subscribe(int id, Socket *dst) = 0; - /** Unsubscribe socket from trigger id. */ - virtual bool Unsubscribe(int id, Socket *dst) = 0; - /** Execute OnTrigger for subscribed sockets. - \param id Trigger ID - \param data Data passed from source to destination - \param erase Empty trigger id source and destination maps if 'true', - Leave them in place if 'false' - if a trigger should be called many times */ - virtual void Trigger(int id, Socket::TriggerData& data, bool erase = true) = 0; + /** Fetch unique trigger id. */ + virtual int TriggerID(Socket *src) = 0; + /** Subscribe socket to trigger id. */ + virtual bool Subscribe(int id, Socket *dst) = 0; + /** Unsubscribe socket from trigger id. */ + virtual bool Unsubscribe(int id, Socket *dst) = 0; + /** Execute OnTrigger for subscribed sockets. + \param id Trigger ID + \param data Data passed from source to destination + \param erase Empty trigger id source and destination maps if 'true', + Leave them in place if 'false' - if a trigger should be called many times */ + virtual void Trigger(int id, Socket::TriggerData& data, bool erase = true) = 0; #endif // ENABLE_TRIGGERS #ifdef ENABLE_DETACH - /** Indicates that the handler runs under SocketThread. */ - virtual void SetSlave(bool x = true) = 0; - /** Indicates that the handler runs under SocketThread. */ - virtual bool IsSlave() = 0; + /** Indicates that the handler runs under SocketThread. */ + virtual void SetSlave(bool x = true) = 0; + /** Indicates that the handler runs under SocketThread. */ + virtual bool IsSlave() = 0; #endif // ENABLE_DETACH }; diff --git a/dep/include/sockets/Ipv4Address.h b/dep/include/sockets/Ipv4Address.h index b58c2ce9425..2c43881a68a 100644 --- a/dep/include/sockets/Ipv4Address.h +++ b/dep/include/sockets/Ipv4Address.h @@ -1,7 +1,7 @@ /** - ** \file Ipv4Address.h - ** \date 2006-09-21 - ** \author grymse@alhem.net + ** \file Ipv4Address.h + ** \date 2006-09-21 + ** \author grymse@alhem.net **/ /* Copyright (C) 2007 Anders Hedstrom @@ -33,59 +33,59 @@ namespace SOCKETS_NAMESPACE { /* Ipv4 address implementation. - \ingroup basic */ + \ingroup basic */ class Ipv4Address : public SocketAddress { public: - /** Create empty Ipv4 address structure. - \param port Port number */ - Ipv4Address(port_t port = 0); - /** Create Ipv4 address structure. - \param a Socket address in network byte order (as returned by Utility::u2ip) - \param port Port number in host byte order */ - Ipv4Address(ipaddr_t a,port_t port); - /** Create Ipv4 address structure. - \param a Socket address in network byte order - \param port Port number in host byte order */ - Ipv4Address(struct in_addr& a,port_t port); - /** Create Ipv4 address structure. - \param host Hostname to be resolved - \param port Port number in host byte order */ - Ipv4Address(const std::string& host,port_t port); - Ipv4Address(struct sockaddr_in&); - ~Ipv4Address(); + /** Create empty Ipv4 address structure. + \param port Port number */ + Ipv4Address(port_t port = 0); + /** Create Ipv4 address structure. + \param a Socket address in network byte order (as returned by Utility::u2ip) + \param port Port number in host byte order */ + Ipv4Address(ipaddr_t a,port_t port); + /** Create Ipv4 address structure. + \param a Socket address in network byte order + \param port Port number in host byte order */ + Ipv4Address(struct in_addr& a,port_t port); + /** Create Ipv4 address structure. + \param host Hostname to be resolved + \param port Port number in host byte order */ + Ipv4Address(const std::string& host,port_t port); + Ipv4Address(struct sockaddr_in&); + ~Ipv4Address(); - // SocketAddress implementation + // SocketAddress implementation - operator struct sockaddr *(); - operator socklen_t(); - bool operator==(SocketAddress&); + operator struct sockaddr *(); + operator socklen_t(); + bool operator==(SocketAddress&); - void SetPort(port_t port); - port_t GetPort(); + void SetPort(port_t port); + port_t GetPort(); - void SetAddress(struct sockaddr *sa); - int GetFamily(); + void SetAddress(struct sockaddr *sa); + int GetFamily(); - bool IsValid(); - std::auto_ptr GetCopy(); + bool IsValid(); + std::auto_ptr GetCopy(); - /** Convert address struct to text. */ - std::string Convert(bool include_port = false); - std::string Reverse(); + /** Convert address struct to text. */ + std::string Convert(bool include_port = false); + std::string Reverse(); - /** Resolve hostname. */ -static bool Resolve(const std::string& hostname,struct in_addr& a); - /** Reverse resolve (IP to hostname). */ -static bool Reverse(struct in_addr& a,std::string& name); - /** Convert address struct to text. */ -static std::string Convert(struct in_addr& a); + /** Resolve hostname. */ +static bool Resolve(const std::string& hostname,struct in_addr& a); + /** Reverse resolve (IP to hostname). */ +static bool Reverse(struct in_addr& a,std::string& name); + /** Convert address struct to text. */ +static std::string Convert(struct in_addr& a); private: - Ipv4Address(const Ipv4Address& ) {} // copy constructor - Ipv4Address& operator=(const Ipv4Address& ) { return *this; } // assignment operator - struct sockaddr_in m_addr; - bool m_valid; + Ipv4Address(const Ipv4Address& ) {} // copy constructor + Ipv4Address& operator=(const Ipv4Address& ) { return *this; } // assignment operator + struct sockaddr_in m_addr; + bool m_valid; }; diff --git a/dep/include/sockets/Ipv6Address.h b/dep/include/sockets/Ipv6Address.h index a0711417956..a3b24b0b092 100644 --- a/dep/include/sockets/Ipv6Address.h +++ b/dep/include/sockets/Ipv6Address.h @@ -1,7 +1,7 @@ /** - ** \file Ipv6Address.h - ** \date 2006-09-21 - ** \author grymse@alhem.net + ** \file Ipv6Address.h + ** \date 2006-09-21 + ** \author grymse@alhem.net **/ /* Copyright (C) 2007 Anders Hedstrom @@ -37,62 +37,62 @@ namespace SOCKETS_NAMESPACE { /** Ipv6 address implementation. - \ingroup basic */ + \ingroup basic */ class Ipv6Address : public SocketAddress { public: - /** Create empty Ipv6 address structure. - \param port Port number */ - Ipv6Address(port_t port = 0); - /** Create Ipv6 address structure. - \param a Socket address in network byte order - \param port Port number in host byte order */ - Ipv6Address(struct in6_addr& a,port_t port); - /** Create Ipv6 address structure. - \param host Hostname to be resolved - \param port Port number in host byte order */ - Ipv6Address(const std::string& host,port_t port); - Ipv6Address(struct sockaddr_in6&); - ~Ipv6Address(); + /** Create empty Ipv6 address structure. + \param port Port number */ + Ipv6Address(port_t port = 0); + /** Create Ipv6 address structure. + \param a Socket address in network byte order + \param port Port number in host byte order */ + Ipv6Address(struct in6_addr& a,port_t port); + /** Create Ipv6 address structure. + \param host Hostname to be resolved + \param port Port number in host byte order */ + Ipv6Address(const std::string& host,port_t port); + Ipv6Address(struct sockaddr_in6&); + ~Ipv6Address(); - // SocketAddress implementation + // SocketAddress implementation - operator struct sockaddr *(); - operator socklen_t(); - bool operator==(SocketAddress&); + operator struct sockaddr *(); + operator socklen_t(); + bool operator==(SocketAddress&); - void SetPort(port_t port); - port_t GetPort(); + void SetPort(port_t port); + port_t GetPort(); - void SetAddress(struct sockaddr *sa); - int GetFamily(); + void SetAddress(struct sockaddr *sa); + int GetFamily(); - bool IsValid(); - std::auto_ptr GetCopy(); + bool IsValid(); + std::auto_ptr GetCopy(); - /** Convert address struct to text. */ - std::string Convert(bool include_port = false); - std::string Reverse(); + /** Convert address struct to text. */ + std::string Convert(bool include_port = false); + std::string Reverse(); - /** Resolve hostname. */ -static bool Resolve(const std::string& hostname,struct in6_addr& a); - /** Reverse resolve (IP to hostname). */ -static bool Reverse(struct in6_addr& a,std::string& name); - /** Convert address struct to text. */ -static std::string Convert(struct in6_addr& a,bool mixed = false); + /** Resolve hostname. */ +static bool Resolve(const std::string& hostname,struct in6_addr& a); + /** Reverse resolve (IP to hostname). */ +static bool Reverse(struct in6_addr& a,std::string& name); + /** Convert address struct to text. */ +static std::string Convert(struct in6_addr& a,bool mixed = false); - void SetFlowinfo(uint32_t); - uint32_t GetFlowinfo(); + void SetFlowinfo(uint32_t); + uint32_t GetFlowinfo(); #ifndef _WIN32 - void SetScopeId(uint32_t); - uint32_t GetScopeId(); + void SetScopeId(uint32_t); + uint32_t GetScopeId(); #endif private: - Ipv6Address(const Ipv6Address& ) {} // copy constructor - Ipv6Address& operator=(const Ipv6Address& ) { return *this; } // assignment operator - struct sockaddr_in6 m_addr; - bool m_valid; + Ipv6Address(const Ipv6Address& ) {} // copy constructor + Ipv6Address& operator=(const Ipv6Address& ) { return *this; } // assignment operator + struct sockaddr_in6 m_addr; + bool m_valid; }; diff --git a/dep/include/sockets/ListenSocket.h b/dep/include/sockets/ListenSocket.h index f4edc37d6c3..7dcee47d9ba 100644 --- a/dep/include/sockets/ListenSocket.h +++ b/dep/include/sockets/ListenSocket.h @@ -1,6 +1,6 @@ /** \file ListenSocket.h - ** \date 2004-02-13 - ** \author grymse@alhem.net + ** \date 2004-02-13 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -18,7 +18,7 @@ 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. -This program is distributed in the hope that it will be useful, +This program 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. @@ -52,344 +52,344 @@ namespace SOCKETS_NAMESPACE { #endif -/** Binds incoming port number to new Socket class X. - \ingroup basic */ +/** Binds incoming port number to new Socket class X. + \ingroup basic */ template class ListenSocket : public Socket { public: - /** Constructor. - \param h ISocketHandler reference - \param use_creator Optional use of creator (default true) */ - ListenSocket(ISocketHandler& h,bool use_creator = true) : Socket(h), m_depth(0), m_creator(NULL) - ,m_bHasCreate(false) - { - if (use_creator) - { - m_creator = new X(h); - Socket *tmp = m_creator -> Create(); - if (tmp && dynamic_cast(tmp)) - { - m_bHasCreate = true; - } - if (tmp) - { - delete tmp; - } - } - } - ~ListenSocket() { - if (m_creator) - { - delete m_creator; - } - } + /** Constructor. + \param h ISocketHandler reference + \param use_creator Optional use of creator (default true) */ + ListenSocket(ISocketHandler& h,bool use_creator = true) : Socket(h), m_depth(0), m_creator(NULL) + ,m_bHasCreate(false) + { + if (use_creator) + { + m_creator = new X(h); + Socket *tmp = m_creator -> Create(); + if (tmp && dynamic_cast(tmp)) + { + m_bHasCreate = true; + } + if (tmp) + { + delete tmp; + } + } + } + ~ListenSocket() { + if (m_creator) + { + delete m_creator; + } + } - /** Close file descriptor. */ - int Close() { - if (GetSocket() != INVALID_SOCKET) - { - closesocket(GetSocket()); - } - return 0; - } + /** Close file descriptor. */ + int Close() { + if (GetSocket() != INVALID_SOCKET) + { + closesocket(GetSocket()); + } + return 0; + } - /** Bind and listen to any interface. - \param port Port (0 is random) - \param depth Listen queue depth */ - int Bind(port_t port,int depth = 20) { + /** Bind and listen to any interface. + \param port Port (0 is random) + \param depth Listen queue depth */ + int Bind(port_t port,int depth = 20) { #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(port); - return Bind(ad, depth); - } - else + if (IsIpv6()) + { + Ipv6Address ad(port); + return Bind(ad, depth); + } + else #endif #endif - { - Ipv4Address ad(port); - return Bind(ad, depth); - } - } + { + Ipv4Address ad(port); + return Bind(ad, depth); + } + } - int Bind(SocketAddress& ad,int depth) { + int Bind(SocketAddress& ad,int depth) { #ifdef USE_SCTP - if (dynamic_cast(m_creator)) - { - return Bind(ad, "sctp", depth); - } + if (dynamic_cast(m_creator)) + { + return Bind(ad, "sctp", depth); + } #endif - return Bind(ad, "tcp", depth); - } + return Bind(ad, "tcp", depth); + } - /** Bind and listen to any interface, with optional protocol. - \param port Port (0 is random) - \param protocol Network protocol - \param depth Listen queue depth */ - int Bind(port_t port,const std::string& protocol,int depth = 20) { + /** Bind and listen to any interface, with optional protocol. + \param port Port (0 is random) + \param protocol Network protocol + \param depth Listen queue depth */ + int Bind(port_t port,const std::string& protocol,int depth = 20) { #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(port); - return Bind(ad, protocol, depth); - } - else + if (IsIpv6()) + { + Ipv6Address ad(port); + return Bind(ad, protocol, depth); + } + else #endif #endif - { - Ipv4Address ad(port); - return Bind(ad, protocol, depth); - } - } + { + Ipv4Address ad(port); + return Bind(ad, protocol, depth); + } + } - /** Bind and listen to specific interface. - \param intf Interface hostname - \param port Port (0 is random) - \param depth Listen queue depth */ - int Bind(const std::string& intf,port_t port,int depth = 20) { + /** Bind and listen to specific interface. + \param intf Interface hostname + \param port Port (0 is random) + \param depth Listen queue depth */ + int Bind(const std::string& intf,port_t port,int depth = 20) { #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(intf, port); - if (ad.IsValid()) - { - return Bind(ad, depth); - } - Handler().LogError(this, "Bind", 0, "name resolution of interface name failed", LOG_LEVEL_FATAL); - return -1; - } - else + if (IsIpv6()) + { + Ipv6Address ad(intf, port); + if (ad.IsValid()) + { + return Bind(ad, depth); + } + Handler().LogError(this, "Bind", 0, "name resolution of interface name failed", LOG_LEVEL_FATAL); + return -1; + } + else #endif #endif - { - Ipv4Address ad(intf, port); - if (ad.IsValid()) - { - return Bind(ad, depth); - } - Handler().LogError(this, "Bind", 0, "name resolution of interface name failed", LOG_LEVEL_FATAL); - return -1; - } - } + { + Ipv4Address ad(intf, port); + if (ad.IsValid()) + { + return Bind(ad, depth); + } + Handler().LogError(this, "Bind", 0, "name resolution of interface name failed", LOG_LEVEL_FATAL); + return -1; + } + } - /** Bind and listen to specific interface. - \param intf Interface hostname - \param port Port (0 is random) - \param protocol Network protocol - \param depth Listen queue depth */ - int Bind(const std::string& intf,port_t port,const std::string& protocol,int depth = 20) { + /** Bind and listen to specific interface. + \param intf Interface hostname + \param port Port (0 is random) + \param protocol Network protocol + \param depth Listen queue depth */ + int Bind(const std::string& intf,port_t port,const std::string& protocol,int depth = 20) { #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(intf, port); - if (ad.IsValid()) - { - return Bind(ad, protocol, depth); - } - Handler().LogError(this, "Bind", 0, "name resolution of interface name failed", LOG_LEVEL_FATAL); - return -1; - } - else + if (IsIpv6()) + { + Ipv6Address ad(intf, port); + if (ad.IsValid()) + { + return Bind(ad, protocol, depth); + } + Handler().LogError(this, "Bind", 0, "name resolution of interface name failed", LOG_LEVEL_FATAL); + return -1; + } + else #endif #endif - { - Ipv4Address ad(intf, port); - if (ad.IsValid()) - { - return Bind(ad, protocol, depth); - } - Handler().LogError(this, "Bind", 0, "name resolution of interface name failed", LOG_LEVEL_FATAL); - return -1; - } - } + { + Ipv4Address ad(intf, port); + if (ad.IsValid()) + { + return Bind(ad, protocol, depth); + } + Handler().LogError(this, "Bind", 0, "name resolution of interface name failed", LOG_LEVEL_FATAL); + return -1; + } + } - /** Bind and listen to ipv4 interface. - \param a Ipv4 interface address - \param port Port (0 is random) - \param depth Listen queue depth */ - int Bind(ipaddr_t a,port_t port,int depth = 20) { - Ipv4Address ad(a, port); + /** Bind and listen to ipv4 interface. + \param a Ipv4 interface address + \param port Port (0 is random) + \param depth Listen queue depth */ + int Bind(ipaddr_t a,port_t port,int depth = 20) { + Ipv4Address ad(a, port); #ifdef USE_SCTP - if (dynamic_cast(m_creator)) - { - return Bind(ad, "sctp", depth); - } + if (dynamic_cast(m_creator)) + { + return Bind(ad, "sctp", depth); + } #endif - return Bind(ad, "tcp", depth); - } - /** Bind and listen to ipv4 interface. - \param a Ipv4 interface address - \param port Port (0 is random) - \param protocol Network protocol - \param depth Listen queue depth */ - int Bind(ipaddr_t a,port_t port,const std::string& protocol,int depth) { - Ipv4Address ad(a, port); - return Bind(ad, protocol, depth); - } + return Bind(ad, "tcp", depth); + } + /** Bind and listen to ipv4 interface. + \param a Ipv4 interface address + \param port Port (0 is random) + \param protocol Network protocol + \param depth Listen queue depth */ + int Bind(ipaddr_t a,port_t port,const std::string& protocol,int depth) { + Ipv4Address ad(a, port); + return Bind(ad, protocol, depth); + } #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - /** Bind and listen to ipv6 interface. - \param a Ipv6 interface address - \param port Port (0 is random) - \param depth Listen queue depth */ - int Bind(in6_addr a,port_t port,int depth = 20) { - Ipv6Address ad(a, port); + /** Bind and listen to ipv6 interface. + \param a Ipv6 interface address + \param port Port (0 is random) + \param depth Listen queue depth */ + int Bind(in6_addr a,port_t port,int depth = 20) { + Ipv6Address ad(a, port); #ifdef USE_SCTP - if (dynamic_cast(m_creator)) - { - return Bind(ad, "sctp", depth); - } + if (dynamic_cast(m_creator)) + { + return Bind(ad, "sctp", depth); + } #endif - return Bind(ad, "tcp", depth); - } - /** Bind and listen to ipv6 interface. - \param a Ipv6 interface address - \param port Port (0 is random) - \param protocol Network protocol - \param depth Listen queue depth */ - int Bind(in6_addr a,port_t port,const std::string& protocol,int depth) { - Ipv6Address ad(a, port); - return Bind(ad, protocol, depth); - } + return Bind(ad, "tcp", depth); + } + /** Bind and listen to ipv6 interface. + \param a Ipv6 interface address + \param port Port (0 is random) + \param protocol Network protocol + \param depth Listen queue depth */ + int Bind(in6_addr a,port_t port,const std::string& protocol,int depth) { + Ipv6Address ad(a, port); + return Bind(ad, protocol, depth); + } #endif #endif - /** Bind and listen to network interface. - \param ad Interface address - \param protocol Network protocol - \param depth Listen queue depth */ - int Bind(SocketAddress& ad,const std::string& protocol,int depth) { - SOCKET s; - if ( (s = CreateSocket(ad.GetFamily(), SOCK_STREAM, protocol)) == INVALID_SOCKET) - { - return -1; - } - if (bind(s, ad, ad) == -1) - { - Handler().LogError(this, "bind", Errno, StrError(Errno), LOG_LEVEL_FATAL); - closesocket(s); + /** Bind and listen to network interface. + \param ad Interface address + \param protocol Network protocol + \param depth Listen queue depth */ + int Bind(SocketAddress& ad,const std::string& protocol,int depth) { + SOCKET s; + if ( (s = CreateSocket(ad.GetFamily(), SOCK_STREAM, protocol)) == INVALID_SOCKET) + { + return -1; + } + if (bind(s, ad, ad) == -1) + { + Handler().LogError(this, "bind", Errno, StrError(Errno), LOG_LEVEL_FATAL); + closesocket(s); #ifdef ENABLE_EXCEPTIONS - throw Exception("bind() failed for port " + Utility::l2string(ad.GetPort()) + ": " + StrError(Errno)); + throw Exception("bind() failed for port " + Utility::l2string(ad.GetPort()) + ": " + StrError(Errno)); #endif - return -1; - } - if (listen(s, depth) == -1) - { - Handler().LogError(this, "listen", Errno, StrError(Errno), LOG_LEVEL_FATAL); - closesocket(s); + return -1; + } + if (listen(s, depth) == -1) + { + Handler().LogError(this, "listen", Errno, StrError(Errno), LOG_LEVEL_FATAL); + closesocket(s); #ifdef ENABLE_EXCEPTIONS - throw Exception("listen() failed for port " + Utility::l2string(ad.GetPort()) + ": " + StrError(Errno)); + throw Exception("listen() failed for port " + Utility::l2string(ad.GetPort()) + ": " + StrError(Errno)); #endif - return -1; - } - m_depth = depth; - Attach(s); - return 0; - } + return -1; + } + m_depth = depth; + Attach(s); + return 0; + } - /** Return assigned port number. */ - port_t GetPort() - { - return GetSockPort(); - } + /** Return assigned port number. */ + port_t GetPort() + { + return GetSockPort(); + } - /** Return listen queue depth. */ - int GetDepth() - { - return m_depth; - } + /** Return listen queue depth. */ + int GetDepth() + { + return m_depth; + } - /** OnRead on a ListenSocket receives an incoming connection. */ - void OnRead() - { - struct sockaddr sa; - socklen_t sa_len = sizeof(struct sockaddr); - SOCKET a_s = accept(GetSocket(), &sa, &sa_len); + /** OnRead on a ListenSocket receives an incoming connection. */ + void OnRead() + { + struct sockaddr sa; + socklen_t sa_len = sizeof(struct sockaddr); + SOCKET a_s = accept(GetSocket(), &sa, &sa_len); - if (a_s == INVALID_SOCKET) - { - Handler().LogError(this, "accept", Errno, StrError(Errno), LOG_LEVEL_ERROR); - return; - } - if (!Handler().OkToAccept(this)) - { - Handler().LogError(this, "accept", -1, "Not OK to accept", LOG_LEVEL_WARNING); - closesocket(a_s); - return; - } - if (Handler().GetCount() >= FD_SETSIZE) - { - Handler().LogError(this, "accept", (int)Handler().GetCount(), "ISocketHandler fd_set limit reached", LOG_LEVEL_FATAL); - closesocket(a_s); - return; - } - Socket *tmp = m_bHasCreate ? m_creator -> Create() : new X(Handler()); + if (a_s == INVALID_SOCKET) + { + Handler().LogError(this, "accept", Errno, StrError(Errno), LOG_LEVEL_ERROR); + return; + } + if (!Handler().OkToAccept(this)) + { + Handler().LogError(this, "accept", -1, "Not OK to accept", LOG_LEVEL_WARNING); + closesocket(a_s); + return; + } + if (Handler().GetCount() >= FD_SETSIZE) + { + Handler().LogError(this, "accept", (int)Handler().GetCount(), "ISocketHandler fd_set limit reached", LOG_LEVEL_FATAL); + closesocket(a_s); + return; + } + Socket *tmp = m_bHasCreate ? m_creator -> Create() : new X(Handler()); #ifdef ENABLE_IPV6 - tmp -> SetIpv6( IsIpv6() ); + tmp -> SetIpv6( IsIpv6() ); #endif - tmp -> SetParent(this); - tmp -> Attach(a_s); - tmp -> SetNonblocking(true); - { + tmp -> SetParent(this); + tmp -> Attach(a_s); + tmp -> SetNonblocking(true); + { #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (sa_len == sizeof(struct sockaddr_in6)) - { - struct sockaddr_in6 *p = (struct sockaddr_in6 *)&sa; - if (p -> sin6_family == AF_INET6) - { - Ipv6Address ad(p -> sin6_addr,ntohs(p -> sin6_port)); - ad.SetFlowinfo(p -> sin6_flowinfo); + if (sa_len == sizeof(struct sockaddr_in6)) + { + struct sockaddr_in6 *p = (struct sockaddr_in6 *)&sa; + if (p -> sin6_family == AF_INET6) + { + Ipv6Address ad(p -> sin6_addr,ntohs(p -> sin6_port)); + ad.SetFlowinfo(p -> sin6_flowinfo); #ifndef _WIN32 - ad.SetScopeId(p -> sin6_scope_id); + ad.SetScopeId(p -> sin6_scope_id); #endif - tmp -> SetRemoteAddress(ad); - } - } + tmp -> SetRemoteAddress(ad); + } + } #endif #endif - if (sa_len == sizeof(struct sockaddr_in)) - { - struct sockaddr_in *p = (struct sockaddr_in *)&sa; - if (p -> sin_family == AF_INET) - { - Ipv4Address ad(p -> sin_addr,ntohs(p -> sin_port)); - tmp -> SetRemoteAddress(ad); - } - } - } - tmp -> SetConnected(true); - tmp -> Init(); - tmp -> SetDeleteByHandler(true); - Handler().Add(tmp); + if (sa_len == sizeof(struct sockaddr_in)) + { + struct sockaddr_in *p = (struct sockaddr_in *)&sa; + if (p -> sin_family == AF_INET) + { + Ipv4Address ad(p -> sin_addr,ntohs(p -> sin_port)); + tmp -> SetRemoteAddress(ad); + } + } + } + tmp -> SetConnected(true); + tmp -> Init(); + tmp -> SetDeleteByHandler(true); + Handler().Add(tmp); #ifdef HAVE_OPENSSL - if (tmp -> IsSSL()) // SSL Enabled socket - { - // %! OnSSLAccept calls SSLNegotiate that can finish in this one call. - // %! If that happens and negotiation fails, the 'tmp' instance is - // %! still added to the list of active sockets in the sockethandler. - // %! See bugfix for this in SocketHandler::Select - don't Set rwx - // %! flags if CloseAndDelete() flag is true. - // %! An even better fugbix (see TcpSocket::OnSSLAccept) now avoids - // %! the Add problem altogether, so ignore the above. - // %! (OnSSLAccept does no longer call SSLNegotiate().) - tmp -> OnSSLAccept(); - } - else + if (tmp -> IsSSL()) // SSL Enabled socket + { + // %! OnSSLAccept calls SSLNegotiate that can finish in this one call. + // %! If that happens and negotiation fails, the 'tmp' instance is + // %! still added to the list of active sockets in the sockethandler. + // %! See bugfix for this in SocketHandler::Select - don't Set rwx + // %! flags if CloseAndDelete() flag is true. + // %! An even better fugbix (see TcpSocket::OnSSLAccept) now avoids + // %! the Add problem altogether, so ignore the above. + // %! (OnSSLAccept does no longer call SSLNegotiate().) + tmp -> OnSSLAccept(); + } + else #endif - { - tmp -> OnAccept(); - } - } + { + tmp -> OnAccept(); + } + } - /** Please don't use this method. - "accept()" is handled automatically in the OnRead() method. */ + /** Please don't use this method. + "accept()" is handled automatically in the OnRead() method. */ virtual SOCKET Accept(SOCKET socket, struct sockaddr *saptr, socklen_t *lenptr) { return accept(socket, saptr, lenptr); @@ -397,17 +397,17 @@ public: bool HasCreator() { return m_bHasCreate; } - void OnOptions(int,int,int,SOCKET) { - SetSoReuseaddr(true); - } + void OnOptions(int,int,int,SOCKET) { + SetSoReuseaddr(true); + } protected: - ListenSocket(const ListenSocket& s) : Socket(s) {} + ListenSocket(const ListenSocket& s) : Socket(s) {} private: - ListenSocket& operator=(const ListenSocket& ) { return *this; } - int m_depth; - X *m_creator; - bool m_bHasCreate; + ListenSocket& operator=(const ListenSocket& ) { return *this; } + int m_depth; + X *m_creator; + bool m_bHasCreate; }; diff --git a/dep/include/sockets/Lock.h b/dep/include/sockets/Lock.h index 71fdd5e733d..7d67716a26a 100644 --- a/dep/include/sockets/Lock.h +++ b/dep/include/sockets/Lock.h @@ -1,6 +1,6 @@ /** \file Lock.h - ** \date 2005-08-22 - ** \author grymse@alhem.net + ** \date 2005-08-22 + ** \author grymse@alhem.net **/ /* Copyright (C) 2005,2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2005,2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -37,16 +37,16 @@ namespace SOCKETS_NAMESPACE { class Mutex; -/** Mutex encapsulation class. - \ingroup threading */ +/** Mutex encapsulation class. + \ingroup threading */ class Lock { public: - Lock(Mutex&); - ~Lock(); + Lock(Mutex&); + ~Lock(); private: - Mutex& m_mutex; + Mutex& m_mutex; }; diff --git a/dep/include/sockets/Mutex.h b/dep/include/sockets/Mutex.h index 1de27760a1c..35b753ca028 100644 --- a/dep/include/sockets/Mutex.h +++ b/dep/include/sockets/Mutex.h @@ -1,6 +1,6 @@ /** \file Mutex.h - ** \date 2004-10-30 - ** \author grymse@alhem.net + ** \date 2004-10-30 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -41,22 +41,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. namespace SOCKETS_NAMESPACE { #endif -/** Mutex container class, used by Lock. - \ingroup threading */ +/** Mutex container class, used by Lock. + \ingroup threading */ class Mutex { - friend class Lock; + friend class Lock; public: - Mutex(); - ~Mutex(); + Mutex(); + ~Mutex(); - void Lock(); - void Unlock(); + void Lock(); + void Unlock(); private: #ifdef _WIN32 - HANDLE m_mutex; + HANDLE m_mutex; #else - pthread_mutex_t m_mutex; + pthread_mutex_t m_mutex; #endif }; diff --git a/dep/include/sockets/Parse.h b/dep/include/sockets/Parse.h index 6961f3b1bc9..b5d15f00f5c 100644 --- a/dep/include/sockets/Parse.h +++ b/dep/include/sockets/Parse.h @@ -1,6 +1,6 @@ /** \file Parse.h - parse a string ** - ** Written: 1999-Feb-10 grymse@alhem.net + ** Written: 1999-Feb-10 grymse@alhem.net **/ /* @@ -9,7 +9,7 @@ Copyright (C) 1999-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -48,48 +48,48 @@ namespace SOCKETS_NAMESPACE { /* interface of class Parse */ /** Splits a string whatever way you want. - \ingroup util */ + \ingroup util */ class Parse { public: - Parse(); - Parse(const std::string&); - Parse(const std::string&,const std::string&); - Parse(const std::string&,const std::string&,short); - ~Parse(); - short issplit(const char); - void getsplit(); - void getsplit(std::string&); - std::string getword(); - void getword(std::string&); - void getword(std::string&,std::string&,int); - std::string getrest(); - void getrest(std::string&); - long getvalue(); - void setbreak(const char); - int getwordlen(); - int getrestlen(); - void enablebreak(const char c) { - pa_enable = c; - } - void disablebreak(const char c) { - pa_disable = c; - } - void getline(); - void getline(std::string&); - size_t getptr() { return pa_the_ptr; } - void EnableQuote(bool b) { pa_quote = b; } + Parse(); + Parse(const std::string&); + Parse(const std::string&,const std::string&); + Parse(const std::string&,const std::string&,short); + ~Parse(); + short issplit(const char); + void getsplit(); + void getsplit(std::string&); + std::string getword(); + void getword(std::string&); + void getword(std::string&,std::string&,int); + std::string getrest(); + void getrest(std::string&); + long getvalue(); + void setbreak(const char); + int getwordlen(); + int getrestlen(); + void enablebreak(const char c) { + pa_enable = c; + } + void disablebreak(const char c) { + pa_disable = c; + } + void getline(); + void getline(std::string&); + size_t getptr() { return pa_the_ptr; } + void EnableQuote(bool b) { pa_quote = b; } private: - std::string pa_the_str; - std::string pa_splits; - std::string pa_ord; - size_t pa_the_ptr; - char pa_breakchar; - char pa_enable; - char pa_disable; - short pa_nospace; - bool pa_quote; + std::string pa_the_str; + std::string pa_splits; + std::string pa_ord; + size_t pa_the_ptr; + char pa_breakchar; + char pa_enable; + char pa_disable; + short pa_nospace; + bool pa_quote; }; diff --git a/dep/include/sockets/ResolvServer.h b/dep/include/sockets/ResolvServer.h index f8f8f5aadbf..05dcfd58adf 100644 --- a/dep/include/sockets/ResolvServer.h +++ b/dep/include/sockets/ResolvServer.h @@ -1,6 +1,6 @@ /** \file ResolvServer.h - ** \date 2005-03-24 - ** \author grymse@alhem.net + ** \date 2005-03-24 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -39,26 +39,26 @@ namespace SOCKETS_NAMESPACE { #endif /** \defgroup async Asynchronous DNS */ -/** Async DNS resolver thread. - \ingroup async */ +/** Async DNS resolver thread. + \ingroup async */ class ResolvServer : public Thread { public: - ResolvServer(port_t); - ~ResolvServer(); + ResolvServer(port_t); + ~ResolvServer(); - void Run(); - void Quit(); + void Run(); + void Quit(); - bool Ready(); + bool Ready(); private: - ResolvServer(const ResolvServer& ) {} // copy constructor - ResolvServer& operator=(const ResolvServer& ) { return *this; } // assignment operator + ResolvServer(const ResolvServer& ) {} // copy constructor + ResolvServer& operator=(const ResolvServer& ) { return *this; } // assignment operator - bool m_quit; - port_t m_port; - bool m_ready; + bool m_quit; + port_t m_port; + bool m_ready; }; diff --git a/dep/include/sockets/ResolvSocket.h b/dep/include/sockets/ResolvSocket.h index ff4b1a5a982..2396af894de 100644 --- a/dep/include/sockets/ResolvSocket.h +++ b/dep/include/sockets/ResolvSocket.h @@ -1,6 +1,6 @@ /** \file ResolvSocket.h - ** \date 2005-03-24 - ** \author grymse@alhem.net + ** \date 2005-03-24 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -40,58 +40,58 @@ namespace SOCKETS_NAMESPACE { class Mutex; -/** Async DNS resolver socket. - \ingroup async */ +/** Async DNS resolver socket. + \ingroup async */ class ResolvSocket : public TcpSocket { - typedef std::map > cache_t; /* host, result */ - typedef std::map > timeout_t; /* host, time */ + typedef std::map > cache_t; /* host, result */ + typedef std::map > timeout_t; /* host, time */ public: - ResolvSocket(ISocketHandler&); - ResolvSocket(ISocketHandler&, Socket *parent, const std::string& host, port_t port, bool ipv6 = false); - ResolvSocket(ISocketHandler&, Socket *parent, ipaddr_t); + ResolvSocket(ISocketHandler&); + ResolvSocket(ISocketHandler&, Socket *parent, const std::string& host, port_t port, bool ipv6 = false); + ResolvSocket(ISocketHandler&, Socket *parent, ipaddr_t); #ifdef ENABLE_IPV6 - ResolvSocket(ISocketHandler&, Socket *parent, in6_addr&); + ResolvSocket(ISocketHandler&, Socket *parent, in6_addr&); #endif - ~ResolvSocket(); + ~ResolvSocket(); - void OnAccept() { m_bServer = true; } - void OnLine(const std::string& line); - void OnDetached(); - void OnDelete(); + void OnAccept() { m_bServer = true; } + void OnLine(const std::string& line); + void OnDetached(); + void OnDelete(); - void SetId(int x) { m_resolv_id = x; } - int GetId() { return m_resolv_id; } + void SetId(int x) { m_resolv_id = x; } + int GetId() { return m_resolv_id; } - void OnConnect(); + void OnConnect(); #ifdef ENABLE_IPV6 - void SetResolveIpv6(bool x = true) { m_resolve_ipv6 = x; } + void SetResolveIpv6(bool x = true) { m_resolve_ipv6 = x; } #endif private: - ResolvSocket(const ResolvSocket& s) : TcpSocket(s) {} // copy constructor - ResolvSocket& operator=(const ResolvSocket& ) { return *this; } // assignment operator + ResolvSocket(const ResolvSocket& s) : TcpSocket(s) {} // copy constructor + ResolvSocket& operator=(const ResolvSocket& ) { return *this; } // assignment operator - std::string m_query; - std::string m_data; - bool m_bServer; - Socket *m_parent; - int m_resolv_id; - std::string m_resolv_host; - port_t m_resolv_port; - ipaddr_t m_resolv_address; + std::string m_query; + std::string m_data; + bool m_bServer; + Socket *m_parent; + int m_resolv_id; + std::string m_resolv_host; + port_t m_resolv_port; + ipaddr_t m_resolv_address; #ifdef ENABLE_IPV6 - bool m_resolve_ipv6; - in6_addr m_resolv_address6; + bool m_resolve_ipv6; + in6_addr m_resolv_address6; #endif - static cache_t m_cache; - static timeout_t m_cache_to; - static Mutex m_cache_mutex; - bool m_cached; + static cache_t m_cache; + static timeout_t m_cache_to; + static Mutex m_cache_mutex; + bool m_cached; }; diff --git a/dep/include/sockets/SctpSocket.h b/dep/include/sockets/SctpSocket.h index d6d55f6be78..49a360b16da 100644 --- a/dep/include/sockets/SctpSocket.h +++ b/dep/include/sockets/SctpSocket.h @@ -1,7 +1,7 @@ /** - ** \file SctpSocket.h - ** \date 2006-09-04 - ** \author grymse@alhem.net + ** \file SctpSocket.h + ** \date 2006-09-04 + ** \author grymse@alhem.net **/ /* Copyright (C) 2007 Anders Hedstrom @@ -40,63 +40,63 @@ class SocketAddress; class SctpSocket : public StreamSocket { public: - /** SctpSocket constructor. - \param h Owner - \param type SCTP_STREAM or SCTP_SEQPACKET */ - SctpSocket(ISocketHandler& h,int type); - ~SctpSocket(); + /** SctpSocket constructor. + \param h Owner + \param type SCTP_STREAM or SCTP_SEQPACKET */ + SctpSocket(ISocketHandler& h,int type); + ~SctpSocket(); - /** bind() */ - int Bind(const std::string&,port_t); - int Bind(SocketAddress&); - /** sctp_bindx() */ - int AddAddress(const std::string&,port_t); - int AddAddress(SocketAddress&); - /** sctp_bindx() */ - int RemoveAddress(const std::string&,port_t); - int RemoveAddress(SocketAddress&); + /** bind() */ + int Bind(const std::string&,port_t); + int Bind(SocketAddress&); + /** sctp_bindx() */ + int AddAddress(const std::string&,port_t); + int AddAddress(SocketAddress&); + /** sctp_bindx() */ + int RemoveAddress(const std::string&,port_t); + int RemoveAddress(SocketAddress&); - /** connect() */ - int Open(const std::string&,port_t); - int Open(SocketAddress&); + /** connect() */ + int Open(const std::string&,port_t); + int Open(SocketAddress&); - /** Connect timeout callback. */ - void OnConnectTimeout(); + /** Connect timeout callback. */ + void OnConnectTimeout(); #ifdef _WIN32 - /** Connection failed reported as exception on win32 */ - void OnException(); + /** Connection failed reported as exception on win32 */ + void OnException(); #endif #ifndef SOLARIS - /** sctp_connectx() */ - int AddConnection(const std::string&,port_t); - int AddConnection(SocketAddress&); + /** sctp_connectx() */ + int AddConnection(const std::string&,port_t); + int AddConnection(SocketAddress&); #endif - /** Get peer addresses of an association. */ - int getpaddrs(sctp_assoc_t id,std::list&); - /** Get all bound addresses of an association. */ - int getladdrs(sctp_assoc_t id,std::list&); + /** Get peer addresses of an association. */ + int getpaddrs(sctp_assoc_t id,std::list&); + /** Get all bound addresses of an association. */ + int getladdrs(sctp_assoc_t id,std::list&); - /** sctp_peeloff */ - int PeelOff(sctp_assoc_t id); + /** sctp_peeloff */ + int PeelOff(sctp_assoc_t id); - /** recvmsg callback */ - virtual void OnReceiveMessage(const char *buf,size_t sz,struct sockaddr *sa,socklen_t sa_len,struct sctp_sndrcvinfo *sinfo,int msg_flags) = 0; + /** recvmsg callback */ + virtual void OnReceiveMessage(const char *buf,size_t sz,struct sockaddr *sa,socklen_t sa_len,struct sctp_sndrcvinfo *sinfo,int msg_flags) = 0; - void OnOptions(int,int,int,SOCKET) {} + void OnOptions(int,int,int,SOCKET) {} - virtual int Protocol(); + virtual int Protocol(); protected: - SctpSocket(const SctpSocket& s) : StreamSocket(s) {} - void OnRead(); - void OnWrite(); + SctpSocket(const SctpSocket& s) : StreamSocket(s) {} + void OnRead(); + void OnWrite(); private: - SctpSocket& operator=(const SctpSocket& s) { return *this; } - int m_type; ///< SCTP_STREAM or SCTP_SEQPACKET - char *m_buf; ///< Temporary receive buffer + SctpSocket& operator=(const SctpSocket& s) { return *this; } + int m_type; ///< SCTP_STREAM or SCTP_SEQPACKET + char *m_buf; ///< Temporary receive buffer }; diff --git a/dep/include/sockets/Socket.h b/dep/include/sockets/Socket.h index bdb5fc60392..0545ad7f849 100644 --- a/dep/include/sockets/Socket.h +++ b/dep/include/sockets/Socket.h @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This software is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -56,677 +56,677 @@ class IFile; /** \defgroup basic Basic sockets */ /** Socket base class. - \ingroup basic */ + \ingroup basic */ class Socket { - friend class ISocketHandler; + friend class ISocketHandler; #ifdef ENABLE_DETACH - /** Detached socket run thread. - \ingroup internal */ - class SocketThread : public Thread - { - public: - SocketThread(Socket *p); - ~SocketThread(); + /** Detached socket run thread. + \ingroup internal */ + class SocketThread : public Thread + { + public: + SocketThread(Socket *p); + ~SocketThread(); - void Run(); + void Run(); - private: - Socket *GetSocket() const { return m_socket; } - SocketThread(const SocketThread& s) : m_socket(s.GetSocket()) {} - SocketThread& operator=(const SocketThread& ) { return *this; } - Socket *m_socket; - }; + private: + Socket *GetSocket() const { return m_socket; } + SocketThread(const SocketThread& s) : m_socket(s.GetSocket()) {} + SocketThread& operator=(const SocketThread& ) { return *this; } + Socket *m_socket; + }; #endif // ENABLE_DETACH #ifdef ENABLE_TRIGGERS public: - /** Data pass class from source to destination. */ - class TriggerData - { - public: - TriggerData() : m_src(NULL) {} - virtual ~TriggerData() {} + /** Data pass class from source to destination. */ + class TriggerData + { + public: + TriggerData() : m_src(NULL) {} + virtual ~TriggerData() {} - Socket *GetSource() const { return m_src; } - void SetSource(Socket *x) { m_src = x; } + Socket *GetSource() const { return m_src; } + void SetSource(Socket *x) { m_src = x; } - private: - Socket *m_src; - }; + private: + Socket *m_src; + }; #endif // ENABLE_TRIGGERS - /** Socket mode flags. */ + /** Socket mode flags. */ /* - enum { - // Socket - SOCK_DEL = 0x01, ///< Delete by handler flag - SOCK_CLOSE = 0x02, ///< Close and delete flag - SOCK_DISABLE_READ = 0x04, ///< Disable checking for read events - SOCK_CONNECTED = 0x08, ///< Socket is connected (tcp/udp) + enum { + // Socket + SOCK_DEL = 0x01, ///< Delete by handler flag + SOCK_CLOSE = 0x02, ///< Close and delete flag + SOCK_DISABLE_READ = 0x04, ///< Disable checking for read events + SOCK_CONNECTED = 0x08, ///< Socket is connected (tcp/udp) - SOCK_ERASED_BY_HANDLER = 0x10, ///< Set by handler before delete - // HAVE_OPENSSL - SOCK_ENABLE_SSL = 0x20, ///< Enable SSL for this TcpSocket - SOCK_SSL = 0x40, ///< ssl negotiation mode (TcpSocket) - SOCK_SSL_SERVER = 0x80, ///< True if this is an incoming ssl TcpSocket connection + SOCK_ERASED_BY_HANDLER = 0x10, ///< Set by handler before delete + // HAVE_OPENSSL + SOCK_ENABLE_SSL = 0x20, ///< Enable SSL for this TcpSocket + SOCK_SSL = 0x40, ///< ssl negotiation mode (TcpSocket) + SOCK_SSL_SERVER = 0x80, ///< True if this is an incoming ssl TcpSocket connection - // ENABLE_IPV6 - SOCK_IPV6 = 0x0100, ///< This is an ipv6 socket if this one is true - // ENABLE_POOL - SOCK_CLIENT = 0x0200, ///< only client connections are pooled - SOCK_RETAIN = 0x0400, ///< keep connection on close - SOCK_LOST = 0x0800, ///< connection lost + // ENABLE_IPV6 + SOCK_IPV6 = 0x0100, ///< This is an ipv6 socket if this one is true + // ENABLE_POOL + SOCK_CLIENT = 0x0200, ///< only client connections are pooled + SOCK_RETAIN = 0x0400, ///< keep connection on close + SOCK_LOST = 0x0800, ///< connection lost - // ENABLE_SOCKS4 - SOCK_SOCKS4 = 0x1000, ///< socks4 negotiation mode (TcpSocket) - // ENABLE_DETACH - SOCK_DETACH = 0x2000, ///< Socket ordered to detach flag - SOCK_DETACHED = 0x4000, ///< Socket has been detached - // StreamSocket - STREAMSOCK_CONNECTING = 0x8000, ///< Flag indicating connection in progress + // ENABLE_SOCKS4 + SOCK_SOCKS4 = 0x1000, ///< socks4 negotiation mode (TcpSocket) + // ENABLE_DETACH + SOCK_DETACH = 0x2000, ///< Socket ordered to detach flag + SOCK_DETACHED = 0x4000, ///< Socket has been detached + // StreamSocket + STREAMSOCK_CONNECTING = 0x8000, ///< Flag indicating connection in progress - STREAMSOCK_FLUSH_BEFORE_CLOSE = 0x010000L, ///< Send all data before closing (default true) - STREAMSOCK_CALL_ON_CONNECT = 0x020000L, ///< OnConnect will be called next ISocketHandler cycle if true - STREAMSOCK_RETRY_CONNECT = 0x040000L, ///< Try another connection attempt next ISocketHandler cycle - STREAMSOCK_LINE_PROTOCOL = 0x080000L, ///< Line protocol mode flag + STREAMSOCK_FLUSH_BEFORE_CLOSE = 0x010000L, ///< Send all data before closing (default true) + STREAMSOCK_CALL_ON_CONNECT = 0x020000L, ///< OnConnect will be called next ISocketHandler cycle if true + STREAMSOCK_RETRY_CONNECT = 0x040000L, ///< Try another connection attempt next ISocketHandler cycle + STREAMSOCK_LINE_PROTOCOL = 0x080000L, ///< Line protocol mode flag - }; + }; */ public: - /** "Default" constructor */ - Socket(ISocketHandler&); + /** "Default" constructor */ + Socket(ISocketHandler&); - virtual ~Socket(); + virtual ~Socket(); - /** Socket class instantiation method. Used when a "non-standard" constructor - * needs to be used for the socket class. Note: the socket class still needs - * the "default" constructor with one ISocketHandler& as input parameter. - */ - virtual Socket *Create() { return NULL; } + /** Socket class instantiation method. Used when a "non-standard" constructor + * needs to be used for the socket class. Note: the socket class still needs + * the "default" constructor with one ISocketHandler& as input parameter. + */ + virtual Socket *Create() { return NULL; } - /** Returns reference to sockethandler that owns the socket. - If the socket is detached, this is a reference to the slave sockethandler. - */ - ISocketHandler& Handler() const; + /** Returns reference to sockethandler that owns the socket. + If the socket is detached, this is a reference to the slave sockethandler. + */ + ISocketHandler& Handler() const; - /** Returns reference to sockethandler that owns the socket. - This one always returns the reference to the original sockethandler, - even if the socket is detached. - */ - ISocketHandler& MasterHandler() const; + /** Returns reference to sockethandler that owns the socket. + This one always returns the reference to the original sockethandler, + even if the socket is detached. + */ + ISocketHandler& MasterHandler() const; - /** Called by ListenSocket after accept but before socket is added to handler. - * CTcpSocket uses this to create its ICrypt member variable. - * The ICrypt member variable is created by a virtual method, therefore - * it can't be called directly from the CTcpSocket constructor. - * Also used to determine if incoming HTTP connection is normal (port 80) - * or ssl (port 443). - */ - virtual void Init(); + /** Called by ListenSocket after accept but before socket is added to handler. + * CTcpSocket uses this to create its ICrypt member variable. + * The ICrypt member variable is created by a virtual method, therefore + * it can't be called directly from the CTcpSocket constructor. + * Also used to determine if incoming HTTP connection is normal (port 80) + * or ssl (port 443). + */ + virtual void Init(); - /** Create a socket file descriptor. - \param af Address family AF_INET / AF_INET6 / ... - \param type SOCK_STREAM / SOCK_DGRAM / ... - \param protocol "tcp" / "udp" / ... */ - SOCKET CreateSocket(int af,int type,const std::string& protocol = ""); + /** Create a socket file descriptor. + \param af Address family AF_INET / AF_INET6 / ... + \param type SOCK_STREAM / SOCK_DGRAM / ... + \param protocol "tcp" / "udp" / ... */ + SOCKET CreateSocket(int af,int type,const std::string& protocol = ""); - /** Assign this socket a file descriptor created - by a call to socket() or otherwise. */ - void Attach(SOCKET s); + /** Assign this socket a file descriptor created + by a call to socket() or otherwise. */ + void Attach(SOCKET s); - /** Return file descriptor assigned to this socket. */ - SOCKET GetSocket(); + /** Return file descriptor assigned to this socket. */ + SOCKET GetSocket(); - /** Close connection immediately - internal use. - \sa SetCloseAndDelete */ - virtual int Close(); + /** Close connection immediately - internal use. + \sa SetCloseAndDelete */ + virtual int Close(); - /** Add file descriptor to sockethandler fd_set's. */ - void Set(bool bRead,bool bWrite,bool bException = true); + /** Add file descriptor to sockethandler fd_set's. */ + void Set(bool bRead,bool bWrite,bool bException = true); - /** Returns true when socket file descriptor is valid - and socket is not about to be closed. */ - virtual bool Ready(); + /** Returns true when socket file descriptor is valid + and socket is not about to be closed. */ + virtual bool Ready(); - /** Returns pointer to ListenSocket that created this instance - * on an incoming connection. */ - Socket *GetParent(); + /** Returns pointer to ListenSocket that created this instance + * on an incoming connection. */ + Socket *GetParent(); - /** Used by ListenSocket to set parent pointer of newly created - * socket instance. */ - void SetParent(Socket *); + /** Used by ListenSocket to set parent pointer of newly created + * socket instance. */ + void SetParent(Socket *); - /** Get listening port from ListenSocket<>. */ - virtual port_t GetPort(); + /** Get listening port from ListenSocket<>. */ + virtual port_t GetPort(); - /** Set socket non-block operation. */ - bool SetNonblocking(bool); + /** Set socket non-block operation. */ + bool SetNonblocking(bool); - /** Set socket non-block operation. */ - bool SetNonblocking(bool, SOCKET); + /** Set socket non-block operation. */ + bool SetNonblocking(bool, SOCKET); - /** Total lifetime of instance. */ - time_t Uptime(); + /** Total lifetime of instance. */ + time_t Uptime(); - /** Set address/port of last connect() call. */ - void SetClientRemoteAddress(SocketAddress&); + /** Set address/port of last connect() call. */ + void SetClientRemoteAddress(SocketAddress&); - /** Get address/port of last connect() call. */ - std::auto_ptr GetClientRemoteAddress(); + /** Get address/port of last connect() call. */ + std::auto_ptr GetClientRemoteAddress(); - /** Common interface for SendBuf used by Tcp and Udp sockets. */ - virtual void SendBuf(const char *,size_t,int = 0); + /** Common interface for SendBuf used by Tcp and Udp sockets. */ + virtual void SendBuf(const char *,size_t,int = 0); - /** Common interface for Send used by Tcp and Udp sockets. */ - virtual void Send(const std::string&,int = 0); + /** Common interface for Send used by Tcp and Udp sockets. */ + virtual void Send(const std::string&,int = 0); - /** Outgoing traffic counter. */ - virtual uint64_t GetBytesSent(bool clear = false); + /** Outgoing traffic counter. */ + virtual uint64_t GetBytesSent(bool clear = false); - /** Incoming traffic counter. */ - virtual uint64_t GetBytesReceived(bool clear = false); + /** Incoming traffic counter. */ + virtual uint64_t GetBytesReceived(bool clear = false); - // LIST_TIMEOUT + // LIST_TIMEOUT - /** Enable timeout control. 0=disable timeout check. */ - void SetTimeout(time_t secs); + /** Enable timeout control. 0=disable timeout check. */ + void SetTimeout(time_t secs); - /** Check timeout. \return true if time limit reached */ - bool Timeout(time_t tnow); + /** Check timeout. \return true if time limit reached */ + bool Timeout(time_t tnow); - /** Used by ListenSocket. ipv4 and ipv6 */ - void SetRemoteAddress(SocketAddress&); + /** Used by ListenSocket. ipv4 and ipv6 */ + void SetRemoteAddress(SocketAddress&); - /** \name Event callbacks */ - //@{ + /** \name Event callbacks */ + //@{ - /** Called when there is something to be read from the file descriptor. */ - virtual void OnRead(); - /** Called when there is room for another write on the file descriptor. */ - virtual void OnWrite(); - /** Called on socket exception. */ - virtual void OnException(); - /** Called before a socket class is deleted by the ISocketHandler. */ - virtual void OnDelete(); - /** Called when a connection has completed. */ - virtual void OnConnect(); - /** Called when an incoming connection has been completed. */ - virtual void OnAccept(); - /** Called when a complete line has been read and the socket is in - * line protocol mode. */ - virtual void OnLine(const std::string& ); - /** Called on connect timeout (5s). */ - virtual void OnConnectFailed(); - /** Called when a client socket is created, to set socket options. - \param family AF_INET, AF_INET6, etc - \param type SOCK_STREAM, SOCK_DGRAM, etc - \param protocol Protocol number (tcp, udp, sctp, etc) - \param s Socket file descriptor - */ - virtual void OnOptions(int family,int type,int protocol,SOCKET s) = 0; - /** Connection retry callback - return false to abort connection attempts */ - virtual bool OnConnectRetry(); + /** Called when there is something to be read from the file descriptor. */ + virtual void OnRead(); + /** Called when there is room for another write on the file descriptor. */ + virtual void OnWrite(); + /** Called on socket exception. */ + virtual void OnException(); + /** Called before a socket class is deleted by the ISocketHandler. */ + virtual void OnDelete(); + /** Called when a connection has completed. */ + virtual void OnConnect(); + /** Called when an incoming connection has been completed. */ + virtual void OnAccept(); + /** Called when a complete line has been read and the socket is in + * line protocol mode. */ + virtual void OnLine(const std::string& ); + /** Called on connect timeout (5s). */ + virtual void OnConnectFailed(); + /** Called when a client socket is created, to set socket options. + \param family AF_INET, AF_INET6, etc + \param type SOCK_STREAM, SOCK_DGRAM, etc + \param protocol Protocol number (tcp, udp, sctp, etc) + \param s Socket file descriptor + */ + virtual void OnOptions(int family,int type,int protocol,SOCKET s) = 0; + /** Connection retry callback - return false to abort connection attempts */ + virtual bool OnConnectRetry(); #ifdef ENABLE_RECONNECT - /** a reconnect has been made */ - virtual void OnReconnect(); + /** a reconnect has been made */ + virtual void OnReconnect(); #endif - /** TcpSocket: When a disconnect has been detected (recv/SSL_read returns 0 bytes). */ - virtual void OnDisconnect(); - /** Timeout callback. */ - virtual void OnTimeout(); - /** Connection timeout. */ - virtual void OnConnectTimeout(); - //@} + /** TcpSocket: When a disconnect has been detected (recv/SSL_read returns 0 bytes). */ + virtual void OnDisconnect(); + /** Timeout callback. */ + virtual void OnTimeout(); + /** Connection timeout. */ + virtual void OnConnectTimeout(); + //@} - /** \name Socket mode flags, set/reset */ - //@{ - /** Set delete by handler true when you want the sockethandler to - delete the socket instance after use. */ - void SetDeleteByHandler(bool = true); - /** Check delete by handler flag. - \return true if this instance should be deleted by the sockethandler */ - bool DeleteByHandler(); + /** \name Socket mode flags, set/reset */ + //@{ + /** Set delete by handler true when you want the sockethandler to + delete the socket instance after use. */ + void SetDeleteByHandler(bool = true); + /** Check delete by handler flag. + \return true if this instance should be deleted by the sockethandler */ + bool DeleteByHandler(); - // LIST_CLOSE - conditional event queue + // LIST_CLOSE - conditional event queue - /** Set close and delete to terminate the connection. */ - void SetCloseAndDelete(bool = true); - /** Check close and delete flag. - \return true if this socket should be closed and the instance removed */ - bool CloseAndDelete(); + /** Set close and delete to terminate the connection. */ + void SetCloseAndDelete(bool = true); + /** Check close and delete flag. + \return true if this socket should be closed and the instance removed */ + bool CloseAndDelete(); - /** Return number of seconds since socket was ordered to close. \sa SetCloseAndDelete */ - time_t TimeSinceClose(); + /** Return number of seconds since socket was ordered to close. \sa SetCloseAndDelete */ + time_t TimeSinceClose(); - /** Ignore read events for an output only socket. */ - void DisableRead(bool x = true); - /** Check ignore read events flag. - \return true if read events should be ignored */ - bool IsDisableRead(); + /** Ignore read events for an output only socket. */ + void DisableRead(bool x = true); + /** Check ignore read events flag. + \return true if read events should be ignored */ + bool IsDisableRead(); - /** Set connected status. */ - void SetConnected(bool = true); - /** Check connected status. - \return true if connected */ - bool IsConnected(); + /** Set connected status. */ + void SetConnected(bool = true); + /** Check connected status. + \return true if connected */ + bool IsConnected(); - /** Connection lost - error while reading/writing from a socket - TcpSocket only. */ - void SetLost(); - /** Check connection lost status flag, used by TcpSocket only. - \return true if there was an error while r/w causing the socket to close */ - bool Lost(); + /** Connection lost - error while reading/writing from a socket - TcpSocket only. */ + void SetLost(); + /** Check connection lost status flag, used by TcpSocket only. + \return true if there was an error while r/w causing the socket to close */ + bool Lost(); - /** Set flag indicating the socket is being actively deleted by the sockethandler. */ - void SetErasedByHandler(bool x = true); - /** Get value of flag indicating socket is deleted by sockethandler. */ - bool ErasedByHandler(); + /** Set flag indicating the socket is being actively deleted by the sockethandler. */ + void SetErasedByHandler(bool x = true); + /** Get value of flag indicating socket is deleted by sockethandler. */ + bool ErasedByHandler(); - //@} + //@} - /** \name Information about remote connection */ - //@{ - /** Returns address of remote end. */ - std::auto_ptr GetRemoteSocketAddress(); - /** Returns address of remote end: ipv4. */ - ipaddr_t GetRemoteIP4(); + /** \name Information about remote connection */ + //@{ + /** Returns address of remote end. */ + std::auto_ptr GetRemoteSocketAddress(); + /** Returns address of remote end: ipv4. */ + ipaddr_t GetRemoteIP4(); #ifdef ENABLE_IPV6 - /** Returns address of remote end: ipv6. */ + /** Returns address of remote end: ipv6. */ #ifdef IPPROTO_IPV6 - struct in6_addr GetRemoteIP6(); + struct in6_addr GetRemoteIP6(); #endif #endif - /** Returns remote port number: ipv4 and ipv6. */ - port_t GetRemotePort(); - /** Returns remote ip as string? ipv4 and ipv6. */ - std::string GetRemoteAddress(); - /** ipv4 and ipv6(not implemented) */ - std::string GetRemoteHostname(); - //@} + /** Returns remote port number: ipv4 and ipv6. */ + port_t GetRemotePort(); + /** Returns remote ip as string? ipv4 and ipv6. */ + std::string GetRemoteAddress(); + /** ipv4 and ipv6(not implemented) */ + std::string GetRemoteHostname(); + //@} - /** Returns local port number for bound socket file descriptor. */ - port_t GetSockPort(); - /** Returns local ipv4 address for bound socket file descriptor. */ - ipaddr_t GetSockIP4(); - /** Returns local ipv4 address as text for bound socket file descriptor. */ - std::string GetSockAddress(); + /** Returns local port number for bound socket file descriptor. */ + port_t GetSockPort(); + /** Returns local ipv4 address for bound socket file descriptor. */ + ipaddr_t GetSockIP4(); + /** Returns local ipv4 address as text for bound socket file descriptor. */ + std::string GetSockAddress(); #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - /** Returns local ipv6 address for bound socket file descriptor. */ - struct in6_addr GetSockIP6(); - /** Returns local ipv6 address as text for bound socket file descriptor. */ - std::string GetSockAddress6(); + /** Returns local ipv6 address for bound socket file descriptor. */ + struct in6_addr GetSockIP6(); + /** Returns local ipv6 address as text for bound socket file descriptor. */ + std::string GetSockAddress6(); #endif #endif - // -------------------------------------------------------------------------- - /** @name IP options - When an ip or socket option is available on all of the operating systems - I'm testing on (linux 2.4.x, _win32, macosx, solaris9 intel) they are not - checked with an #ifdef below. - This might cause a compile error on other operating systems. */ - // -------------------------------------------------------------------------- + // -------------------------------------------------------------------------- + /** @name IP options + When an ip or socket option is available on all of the operating systems + I'm testing on (linux 2.4.x, _win32, macosx, solaris9 intel) they are not + checked with an #ifdef below. + This might cause a compile error on other operating systems. */ + // -------------------------------------------------------------------------- - // IP options - //@{ + // IP options + //@{ - bool SetIpOptions(const void *p, socklen_t len); - bool SetIpTOS(unsigned char tos); - unsigned char IpTOS(); - bool SetIpTTL(int ttl); - int IpTTL(); - bool SetIpHdrincl(bool x = true); - bool SetIpMulticastTTL(int); - int IpMulticastTTL(); - bool SetMulticastLoop(bool x = true); - bool IpAddMembership(struct ip_mreq&); - bool IpDropMembership(struct ip_mreq&); + bool SetIpOptions(const void *p, socklen_t len); + bool SetIpTOS(unsigned char tos); + unsigned char IpTOS(); + bool SetIpTTL(int ttl); + int IpTTL(); + bool SetIpHdrincl(bool x = true); + bool SetIpMulticastTTL(int); + int IpMulticastTTL(); + bool SetMulticastLoop(bool x = true); + bool IpAddMembership(struct ip_mreq&); + bool IpDropMembership(struct ip_mreq&); #ifdef IP_PKTINFO - bool SetIpPktinfo(bool x = true); + bool SetIpPktinfo(bool x = true); #endif #ifdef IP_RECVTOS - bool SetIpRecvTOS(bool x = true); + bool SetIpRecvTOS(bool x = true); #endif #ifdef IP_RECVTTL - bool SetIpRecvTTL(bool x = true); + bool SetIpRecvTTL(bool x = true); #endif #ifdef IP_RECVOPTS - bool SetIpRecvopts(bool x = true); + bool SetIpRecvopts(bool x = true); #endif #ifdef IP_RETOPTS - bool SetIpRetopts(bool x = true); + bool SetIpRetopts(bool x = true); #endif #ifdef IP_RECVERR - bool SetIpRecverr(bool x = true); + bool SetIpRecverr(bool x = true); #endif #ifdef IP_MTU_DISCOVER - bool SetIpMtudiscover(bool x = true); + bool SetIpMtudiscover(bool x = true); #endif #ifdef IP_MTU - int IpMtu(); + int IpMtu(); #endif #ifdef IP_ROUTER_ALERT - bool SetIpRouterAlert(bool x = true); + bool SetIpRouterAlert(bool x = true); #endif #ifdef LINUX - bool IpAddMembership(struct ip_mreqn&); + bool IpAddMembership(struct ip_mreqn&); #endif #ifdef LINUX - bool IpDropMembership(struct ip_mreqn&); + bool IpDropMembership(struct ip_mreqn&); #endif - //@} + //@} - // SOCKET options - /** @name Socket Options */ - //@{ + // SOCKET options + /** @name Socket Options */ + //@{ - bool SoAcceptconn(); - bool SetSoBroadcast(bool x = true); - bool SetSoDebug(bool x = true); - int SoError(); - bool SetSoDontroute(bool x = true); - bool SetSoLinger(int onoff, int linger); - bool SetSoOobinline(bool x = true); - bool SetSoRcvlowat(int); - bool SetSoSndlowat(int); - bool SetSoRcvtimeo(struct timeval&); - bool SetSoSndtimeo(struct timeval&); - bool SetSoRcvbuf(int); - int SoRcvbuf(); - bool SetSoSndbuf(int); - int SoSndbuf(); - int SoType(); - bool SetSoReuseaddr(bool x = true); - bool SetSoKeepalive(bool x = true); + bool SoAcceptconn(); + bool SetSoBroadcast(bool x = true); + bool SetSoDebug(bool x = true); + int SoError(); + bool SetSoDontroute(bool x = true); + bool SetSoLinger(int onoff, int linger); + bool SetSoOobinline(bool x = true); + bool SetSoRcvlowat(int); + bool SetSoSndlowat(int); + bool SetSoRcvtimeo(struct timeval&); + bool SetSoSndtimeo(struct timeval&); + bool SetSoRcvbuf(int); + int SoRcvbuf(); + bool SetSoSndbuf(int); + int SoSndbuf(); + int SoType(); + bool SetSoReuseaddr(bool x = true); + bool SetSoKeepalive(bool x = true); #ifdef SO_BSDCOMPAT - bool SetSoBsdcompat(bool x = true); + bool SetSoBsdcompat(bool x = true); #endif #ifdef SO_BINDTODEVICE - bool SetSoBindtodevice(const std::string& intf); + bool SetSoBindtodevice(const std::string& intf); #endif #ifdef SO_PASSCRED - bool SetSoPasscred(bool x = true); + bool SetSoPasscred(bool x = true); #endif #ifdef SO_PEERCRED - bool SoPeercred(struct ucred& ); + bool SoPeercred(struct ucred& ); #endif #ifdef SO_PRIORITY - bool SetSoPriority(int); + bool SetSoPriority(int); #endif #ifdef SO_RCVBUFFORCE - bool SetSoRcvbufforce(int); + bool SetSoRcvbufforce(int); #endif #ifdef SO_SNDBUFFORCE - bool SetSoSndbufforce(int); + bool SetSoSndbufforce(int); #endif #ifdef SO_TIMESTAMP - bool SetSoTimestamp(bool x = true); + bool SetSoTimestamp(bool x = true); #endif #ifdef SO_NOSIGPIPE - bool SetSoNosigpipe(bool x = true); + bool SetSoNosigpipe(bool x = true); #endif - //@} + //@} - // TCP options in TcpSocket.h/TcpSocket.cpp + // TCP options in TcpSocket.h/TcpSocket.cpp #ifdef HAVE_OPENSSL - /** @name SSL Support */ - //@{ - /** SSL client/server support - internal use. \sa TcpSocket */ - virtual void OnSSLConnect(); - /** SSL client/server support - internal use. \sa TcpSocket */ - virtual void OnSSLAccept(); - /** SSL negotiation failed for client connect. */ - virtual void OnSSLConnectFailed(); - /** SSL negotiation failed for server accept. */ - virtual void OnSSLAcceptFailed(); - /** new SSL support */ - virtual bool SSLNegotiate(); - /** Check if SSL is Enabled for this TcpSocket. - \return true if this is a TcpSocket with SSL enabled */ - bool IsSSL(); - /** Enable SSL operation for a TcpSocket. */ - void EnableSSL(bool x = true); - /** Still negotiating ssl connection. - \return true if ssl negotiating is still in progress */ - bool IsSSLNegotiate(); - /** Set flag indicating ssl handshaking still in progress. */ - void SetSSLNegotiate(bool x = true); - /** OnAccept called with SSL Enabled. - \return true if this is a TcpSocket with an incoming SSL connection */ - bool IsSSLServer(); - /** Set flag indicating that this is a TcpSocket with incoming SSL connection. */ - void SetSSLServer(bool x = true); - /** SSL; Get pointer to ssl context structure. */ - virtual SSL_CTX *GetSslContext() { return NULL; } - /** SSL; Get pointer to ssl structure. */ - virtual SSL *GetSsl() { return NULL; } - //@} + /** @name SSL Support */ + //@{ + /** SSL client/server support - internal use. \sa TcpSocket */ + virtual void OnSSLConnect(); + /** SSL client/server support - internal use. \sa TcpSocket */ + virtual void OnSSLAccept(); + /** SSL negotiation failed for client connect. */ + virtual void OnSSLConnectFailed(); + /** SSL negotiation failed for server accept. */ + virtual void OnSSLAcceptFailed(); + /** new SSL support */ + virtual bool SSLNegotiate(); + /** Check if SSL is Enabled for this TcpSocket. + \return true if this is a TcpSocket with SSL enabled */ + bool IsSSL(); + /** Enable SSL operation for a TcpSocket. */ + void EnableSSL(bool x = true); + /** Still negotiating ssl connection. + \return true if ssl negotiating is still in progress */ + bool IsSSLNegotiate(); + /** Set flag indicating ssl handshaking still in progress. */ + void SetSSLNegotiate(bool x = true); + /** OnAccept called with SSL Enabled. + \return true if this is a TcpSocket with an incoming SSL connection */ + bool IsSSLServer(); + /** Set flag indicating that this is a TcpSocket with incoming SSL connection. */ + void SetSSLServer(bool x = true); + /** SSL; Get pointer to ssl context structure. */ + virtual SSL_CTX *GetSslContext() { return NULL; } + /** SSL; Get pointer to ssl structure. */ + virtual SSL *GetSsl() { return NULL; } + //@} #endif // HAVE_OPENSSL #ifdef ENABLE_IPV6 - /** Enable ipv6 for this socket. */ - void SetIpv6(bool x = true); - /** Check ipv6 socket. - \return true if this is an ipv6 socket */ - bool IsIpv6(); + /** Enable ipv6 for this socket. */ + void SetIpv6(bool x = true); + /** Check ipv6 socket. + \return true if this is an ipv6 socket */ + bool IsIpv6(); #endif #ifdef ENABLE_POOL - /** @name Connection Pool */ - //@{ - /** Client = connecting TcpSocket. */ - void SetIsClient(); - /** Socket type from socket() call. */ - void SetSocketType(int x); - /** Socket type from socket() call. */ - int GetSocketType(); - /** Protocol type from socket() call. */ - void SetSocketProtocol(const std::string& x); - /** Protocol type from socket() call. */ - const std::string& GetSocketProtocol(); - /** Instruct a client socket to stay open in the connection pool after use. - If you have connected to a server using tcp, you can call SetRetain - to leave the connection open after your socket instance has been deleted. - The next connection you make to the same server will reuse the already - opened connection, if it is still available. - */ - void SetRetain(); - /** Check retain flag. - \return true if the socket should be moved to connection pool after use */ - bool Retain(); - /** Copy connection parameters from sock. */ - void CopyConnection(Socket *sock); - //@} + /** @name Connection Pool */ + //@{ + /** Client = connecting TcpSocket. */ + void SetIsClient(); + /** Socket type from socket() call. */ + void SetSocketType(int x); + /** Socket type from socket() call. */ + int GetSocketType(); + /** Protocol type from socket() call. */ + void SetSocketProtocol(const std::string& x); + /** Protocol type from socket() call. */ + const std::string& GetSocketProtocol(); + /** Instruct a client socket to stay open in the connection pool after use. + If you have connected to a server using tcp, you can call SetRetain + to leave the connection open after your socket instance has been deleted. + The next connection you make to the same server will reuse the already + opened connection, if it is still available. + */ + void SetRetain(); + /** Check retain flag. + \return true if the socket should be moved to connection pool after use */ + bool Retain(); + /** Copy connection parameters from sock. */ + void CopyConnection(Socket *sock); + //@} #endif // ENABLE_POOL #ifdef ENABLE_SOCKS4 - /** \name Socks4 support */ - //@{ - /** Socks4 client support internal use. \sa TcpSocket */ - virtual void OnSocks4Connect(); - /** Socks4 client support internal use. \sa TcpSocket */ - virtual void OnSocks4ConnectFailed(); - /** Socks4 client support internal use. \sa TcpSocket */ - virtual bool OnSocks4Read(); - /** Called when the last write caused the tcp output buffer to - * become empty. */ - /** socket still in socks4 negotiation mode */ - bool Socks4(); - /** Set flag indicating Socks4 handshaking in progress */ - void SetSocks4(bool x = true); + /** \name Socks4 support */ + //@{ + /** Socks4 client support internal use. \sa TcpSocket */ + virtual void OnSocks4Connect(); + /** Socks4 client support internal use. \sa TcpSocket */ + virtual void OnSocks4ConnectFailed(); + /** Socks4 client support internal use. \sa TcpSocket */ + virtual bool OnSocks4Read(); + /** Called when the last write caused the tcp output buffer to + * become empty. */ + /** socket still in socks4 negotiation mode */ + bool Socks4(); + /** Set flag indicating Socks4 handshaking in progress */ + void SetSocks4(bool x = true); - /** Set socks4 server host address to use */ - void SetSocks4Host(ipaddr_t a); - /** Set socks4 server hostname to use. */ - void SetSocks4Host(const std::string& ); - /** Socks4 server port to use. */ - void SetSocks4Port(port_t p); - /** Provide a socks4 userid if required by the socks4 server. */ - void SetSocks4Userid(const std::string& x); - /** Get the ip address of socks4 server to use. - \return socks4 server host address */ - ipaddr_t GetSocks4Host(); - /** Get the socks4 server port to use. - \return socks4 server port */ - port_t GetSocks4Port(); - /** Get socks4 userid. - \return Socks4 userid */ - const std::string& GetSocks4Userid(); - //@} + /** Set socks4 server host address to use */ + void SetSocks4Host(ipaddr_t a); + /** Set socks4 server hostname to use. */ + void SetSocks4Host(const std::string& ); + /** Socks4 server port to use. */ + void SetSocks4Port(port_t p); + /** Provide a socks4 userid if required by the socks4 server. */ + void SetSocks4Userid(const std::string& x); + /** Get the ip address of socks4 server to use. + \return socks4 server host address */ + ipaddr_t GetSocks4Host(); + /** Get the socks4 server port to use. + \return socks4 server port */ + port_t GetSocks4Port(); + /** Get socks4 userid. + \return Socks4 userid */ + const std::string& GetSocks4Userid(); + //@} #endif // ENABLE_SOCKS4 #ifdef ENABLE_RESOLVER - /** \name Asynchronous Resolver */ - //@{ - /** Request an asynchronous dns resolution. - \param host hostname to be resolved - \param port port number passed along for the ride - \return Resolve ID */ - int Resolve(const std::string& host,port_t port = 0); + /** \name Asynchronous Resolver */ + //@{ + /** Request an asynchronous dns resolution. + \param host hostname to be resolved + \param port port number passed along for the ride + \return Resolve ID */ + int Resolve(const std::string& host,port_t port = 0); #ifdef ENABLE_IPV6 - int Resolve6(const std::string& host, port_t port = 0); + int Resolve6(const std::string& host, port_t port = 0); #endif - /** Callback returning a resolved address. - \param id Resolve ID from Resolve call - \param a resolved ip address - \param port port number passed to Resolve */ - virtual void OnResolved(int id,ipaddr_t a,port_t port); + /** Callback returning a resolved address. + \param id Resolve ID from Resolve call + \param a resolved ip address + \param port port number passed to Resolve */ + virtual void OnResolved(int id,ipaddr_t a,port_t port); #ifdef ENABLE_IPV6 - virtual void OnResolved(int id,in6_addr& a,port_t port); + virtual void OnResolved(int id,in6_addr& a,port_t port); #endif - /** Request asynchronous reverse dns lookup. - \param a in_addr to be translated */ - int Resolve(ipaddr_t a); + /** Request asynchronous reverse dns lookup. + \param a in_addr to be translated */ + int Resolve(ipaddr_t a); #ifdef ENABLE_IPV6 - int Resolve(in6_addr& a); + int Resolve(in6_addr& a); #endif - /** Callback returning reverse resolve results. - \param id Resolve ID - \param name Resolved hostname */ - virtual void OnReverseResolved(int id,const std::string& name); - /** Callback indicating failed dns lookup. - \param id Resolve ID */ - virtual void OnResolveFailed(int id); - //@} + /** Callback returning reverse resolve results. + \param id Resolve ID + \param name Resolved hostname */ + virtual void OnReverseResolved(int id,const std::string& name); + /** Callback indicating failed dns lookup. + \param id Resolve ID */ + virtual void OnResolveFailed(int id); + //@} #endif // ENABLE_RESOLVER #ifdef ENABLE_DETACH - /** \name Thread Support */ - //@{ - /** Callback fires when a new socket thread has started and this - socket is ready for operation again. - \sa ResolvSocket */ - virtual void OnDetached(); + /** \name Thread Support */ + //@{ + /** Callback fires when a new socket thread has started and this + socket is ready for operation again. + \sa ResolvSocket */ + virtual void OnDetached(); - // LIST_DETACH + // LIST_DETACH - /** Internal use. */ - void SetDetach(bool x = true); - /** Check detach flag. - \return true if the socket should detach to its own thread */ - bool IsDetach(); + /** Internal use. */ + void SetDetach(bool x = true); + /** Check detach flag. + \return true if the socket should detach to its own thread */ + bool IsDetach(); - /** Internal use. */ - void SetDetached(bool x = true); - /** Check detached flag. - \return true if the socket runs in its own thread. */ - const bool IsDetached() const; - /** Order this socket to start its own thread and call OnDetached - when ready for operation. */ - bool Detach(); - /** Store the slave sockethandler pointer. */ - void SetSlaveHandler(ISocketHandler *); - /** Create new thread for this socket to run detached in. */ - void DetachSocket(); - //@} + /** Internal use. */ + void SetDetached(bool x = true); + /** Check detached flag. + \return true if the socket runs in its own thread. */ + const bool IsDetached() const; + /** Order this socket to start its own thread and call OnDetached + when ready for operation. */ + bool Detach(); + /** Store the slave sockethandler pointer. */ + void SetSlaveHandler(ISocketHandler *); + /** Create new thread for this socket to run detached in. */ + void DetachSocket(); + //@} #endif // ENABLE_DETACH - /** Write traffic to an IFile. Socket will not delete this object. */ - void SetTrafficMonitor(IFile *p) { m_traffic_monitor = p; } + /** Write traffic to an IFile. Socket will not delete this object. */ + void SetTrafficMonitor(IFile *p) { m_traffic_monitor = p; } #ifdef ENABLE_TRIGGERS - /** \name Triggers */ - //@{ - /** Subscribe to trigger id. */ - void Subscribe(int id); - /** Unsubscribe from trigger id. */ - void Unsubscribe(int id); - /** Trigger callback, with data passed from source to destination. */ - virtual void OnTrigger(int id, const TriggerData& data); - /** Trigger cancelled because source has been deleted (as in delete). */ - virtual void OnCancelled(int id); - //@} + /** \name Triggers */ + //@{ + /** Subscribe to trigger id. */ + void Subscribe(int id); + /** Unsubscribe from trigger id. */ + void Unsubscribe(int id); + /** Trigger callback, with data passed from source to destination. */ + virtual void OnTrigger(int id, const TriggerData& data); + /** Trigger cancelled because source has been deleted (as in delete). */ + virtual void OnCancelled(int id); + //@} #endif protected: - /** default constructor not available */ - Socket() : m_handler(m_handler) {} - /** copy constructor not available */ - Socket(const Socket& s) : m_handler(s.m_handler) {} + /** default constructor not available */ + Socket() : m_handler(m_handler) {} + /** copy constructor not available */ + Socket(const Socket& s) : m_handler(s.m_handler) {} - /** assignment operator not available. */ - Socket& operator=(const Socket& ) { return *this; } + /** assignment operator not available. */ + Socket& operator=(const Socket& ) { return *this; } - /** All traffic will be written to this IFile, if set. */ - IFile *GetTrafficMonitor() { return m_traffic_monitor; } + /** All traffic will be written to this IFile, if set. */ + IFile *GetTrafficMonitor() { return m_traffic_monitor; } -// unsigned long m_flags; ///< boolean flags, replacing old 'bool' members +// unsigned long m_flags; ///< boolean flags, replacing old 'bool' members private: - ISocketHandler& m_handler; ///< Reference of ISocketHandler in control of this socket - SOCKET m_socket; ///< File descriptor - bool m_bDel; ///< Delete by handler flag - bool m_bClose; ///< Close and delete flag - time_t m_tCreate; ///< Time in seconds when this socket was created - Socket *m_parent; ///< Pointer to ListenSocket class, valid for incoming sockets - bool m_b_disable_read; ///< Disable checking for read events - bool m_connected; ///< Socket is connected (tcp/udp) - bool m_b_erased_by_handler; ///< Set by handler before delete - time_t m_tClose; ///< Time in seconds when ordered to close - std::auto_ptr m_client_remote_address; ///< Address of last connect() - std::auto_ptr m_remote_address; ///< Remote end address - IFile *m_traffic_monitor; - time_t m_timeout_start; ///< Set by SetTimeout - time_t m_timeout_limit; ///< Defined by SetTimeout - bool m_bLost; ///< connection lost + ISocketHandler& m_handler; ///< Reference of ISocketHandler in control of this socket + SOCKET m_socket; ///< File descriptor + bool m_bDel; ///< Delete by handler flag + bool m_bClose; ///< Close and delete flag + time_t m_tCreate; ///< Time in seconds when this socket was created + Socket *m_parent; ///< Pointer to ListenSocket class, valid for incoming sockets + bool m_b_disable_read; ///< Disable checking for read events + bool m_connected; ///< Socket is connected (tcp/udp) + bool m_b_erased_by_handler; ///< Set by handler before delete + time_t m_tClose; ///< Time in seconds when ordered to close + std::auto_ptr m_client_remote_address; ///< Address of last connect() + std::auto_ptr m_remote_address; ///< Remote end address + IFile *m_traffic_monitor; + time_t m_timeout_start; ///< Set by SetTimeout + time_t m_timeout_limit; ///< Defined by SetTimeout + bool m_bLost; ///< connection lost #ifdef _WIN32 -static WSAInitializer m_winsock_init; ///< Winsock initialization singleton class +static WSAInitializer m_winsock_init; ///< Winsock initialization singleton class #endif #ifdef HAVE_OPENSSL - bool m_b_enable_ssl; ///< Enable SSL for this TcpSocket - bool m_b_ssl; ///< ssl negotiation mode (TcpSocket) - bool m_b_ssl_server; ///< True if this is an incoming ssl TcpSocket connection + bool m_b_enable_ssl; ///< Enable SSL for this TcpSocket + bool m_b_ssl; ///< ssl negotiation mode (TcpSocket) + bool m_b_ssl_server; ///< True if this is an incoming ssl TcpSocket connection #endif #ifdef ENABLE_IPV6 - bool m_ipv6; ///< This is an ipv6 socket if this one is true + bool m_ipv6; ///< This is an ipv6 socket if this one is true #endif #ifdef ENABLE_POOL - int m_socket_type; ///< Type of socket, from socket() call - std::string m_socket_protocol; ///< Protocol, from socket() call - bool m_bClient; ///< only client connections are pooled - bool m_bRetain; ///< keep connection on close + int m_socket_type; ///< Type of socket, from socket() call + std::string m_socket_protocol; ///< Protocol, from socket() call + bool m_bClient; ///< only client connections are pooled + bool m_bRetain; ///< keep connection on close #endif #ifdef ENABLE_SOCKS4 - bool m_bSocks4; ///< socks4 negotiation mode (TcpSocket) - ipaddr_t m_socks4_host; ///< socks4 server address - port_t m_socks4_port; ///< socks4 server port number - std::string m_socks4_userid; ///< socks4 server usedid + bool m_bSocks4; ///< socks4 negotiation mode (TcpSocket) + ipaddr_t m_socks4_host; ///< socks4 server address + port_t m_socks4_port; ///< socks4 server port number + std::string m_socks4_userid; ///< socks4 server usedid #endif #ifdef ENABLE_DETACH - bool m_detach; ///< Socket ordered to detach flag - bool m_detached; ///< Socket has been detached - SocketThread *m_pThread; ///< Detach socket thread class pointer - ISocketHandler *m_slave_handler; ///< Actual sockethandler while detached + bool m_detach; ///< Socket ordered to detach flag + bool m_detached; ///< Socket has been detached + SocketThread *m_pThread; ///< Detach socket thread class pointer + ISocketHandler *m_slave_handler; ///< Actual sockethandler while detached #endif }; diff --git a/dep/include/sockets/SocketAddress.h b/dep/include/sockets/SocketAddress.h index d5a56433ba7..c44ff450643 100644 --- a/dep/include/sockets/SocketAddress.h +++ b/dep/include/sockets/SocketAddress.h @@ -1,7 +1,7 @@ /** - ** \file SocketAddress.h - ** \date 2006-09-21 - ** \author grymse@alhem.net + ** \file SocketAddress.h + ** \date 2006-09-21 + ** \author grymse@alhem.net **/ /* Copyright (C) 2007 Anders Hedstrom @@ -46,43 +46,43 @@ namespace SOCKETS_NAMESPACE { class SocketAddress { public: - virtual ~SocketAddress() {} + virtual ~SocketAddress() {} - /** Get a pointer to the address struct. */ - virtual operator struct sockaddr *() = 0; + /** Get a pointer to the address struct. */ + virtual operator struct sockaddr *() = 0; - /** Get length of address struct. */ - virtual operator socklen_t() = 0; + /** Get length of address struct. */ + virtual operator socklen_t() = 0; - /** Compare two addresses. */ - virtual bool operator==(SocketAddress&) = 0; + /** Compare two addresses. */ + virtual bool operator==(SocketAddress&) = 0; - /** Set port number. - \param port Port number in host byte order */ - virtual void SetPort(port_t port) = 0; + /** Set port number. + \param port Port number in host byte order */ + virtual void SetPort(port_t port) = 0; - /** Get port number. - \return Port number in host byte order. */ - virtual port_t GetPort() = 0; + /** Get port number. + \return Port number in host byte order. */ + virtual port_t GetPort() = 0; - /** Set socket address. - \param sa Pointer to either 'struct sockaddr_in' or 'struct sockaddr_in6'. */ - virtual void SetAddress(struct sockaddr *sa) = 0; + /** Set socket address. + \param sa Pointer to either 'struct sockaddr_in' or 'struct sockaddr_in6'. */ + virtual void SetAddress(struct sockaddr *sa) = 0; - /** Convert address to text. */ - virtual std::string Convert(bool include_port) = 0; + /** Convert address to text. */ + virtual std::string Convert(bool include_port) = 0; - /** Reverse lookup of address. */ - virtual std::string Reverse() = 0; + /** Reverse lookup of address. */ + virtual std::string Reverse() = 0; - /** Get address family. */ - virtual int GetFamily() = 0; + /** Get address family. */ + virtual int GetFamily() = 0; - /** Address structure is valid. */ - virtual bool IsValid() = 0; + /** Address structure is valid. */ + virtual bool IsValid() = 0; - /** Get a copy of this SocketAddress object. */ - virtual std::auto_ptr GetCopy() = 0; + /** Get a copy of this SocketAddress object. */ + virtual std::auto_ptr GetCopy() = 0; }; diff --git a/dep/include/sockets/SocketHandler.h b/dep/include/sockets/SocketHandler.h index c7e20dfde82..a28d2b5311a 100644 --- a/dep/include/sockets/SocketHandler.h +++ b/dep/include/sockets/SocketHandler.h @@ -1,6 +1,6 @@ /** \file SocketHandler.h - ** \date 2004-02-13 - ** \author grymse@alhem.net + ** \date 2004-02-13 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -48,212 +48,212 @@ class ResolvServer; #endif class Mutex; -/** Socket container class, event generator. - \ingroup basic */ +/** Socket container class, event generator. + \ingroup basic */ class SocketHandler : public ISocketHandler { protected: - /** Map type for holding file descriptors/socket object pointers. */ - typedef std::map socket_m; + /** Map type for holding file descriptors/socket object pointers. */ + typedef std::map socket_m; public: - /** SocketHandler constructor. - \param log Optional log class pointer */ - SocketHandler(StdLog *log = NULL); + /** SocketHandler constructor. + \param log Optional log class pointer */ + SocketHandler(StdLog *log = NULL); - /** SocketHandler threadsafe constructor. - \param mutex Externally declared mutex variable - \param log Optional log class pointer */ - SocketHandler(Mutex& mutex,StdLog *log = NULL); + /** SocketHandler threadsafe constructor. + \param mutex Externally declared mutex variable + \param log Optional log class pointer */ + SocketHandler(Mutex& mutex,StdLog *log = NULL); - ~SocketHandler(); + ~SocketHandler(); - /** Get mutex reference for threadsafe operations. */ - Mutex& GetMutex() const; + /** Get mutex reference for threadsafe operations. */ + Mutex& GetMutex() const; - /** Register StdLog object for error callback. - \param log Pointer to log class */ - void RegStdLog(StdLog *log); + /** Register StdLog object for error callback. + \param log Pointer to log class */ + void RegStdLog(StdLog *log); - /** Log error to log class for print out / storage. */ - void LogError(Socket *p,const std::string& user_text,int err,const std::string& sys_err,loglevel_t t = LOG_LEVEL_WARNING); + /** Log error to log class for print out / storage. */ + void LogError(Socket *p,const std::string& user_text,int err,const std::string& sys_err,loglevel_t t = LOG_LEVEL_WARNING); - /** Add socket instance to socket map. Removal is always automatic. */ - void Add(Socket *); + /** Add socket instance to socket map. Removal is always automatic. */ + void Add(Socket *); - /** Get status of read/write/exception file descriptor set for a socket. */ - void Get(SOCKET s,bool& r,bool& w,bool& e); + /** Get status of read/write/exception file descriptor set for a socket. */ + void Get(SOCKET s,bool& r,bool& w,bool& e); - /** Set read/write/exception file descriptor sets (fd_set). */ - void Set(SOCKET s,bool bRead,bool bWrite,bool bException = true); + /** Set read/write/exception file descriptor sets (fd_set). */ + void Set(SOCKET s,bool bRead,bool bWrite,bool bException = true); - /** Wait for events, generate callbacks. */ - int Select(long sec,long usec); + /** Wait for events, generate callbacks. */ + int Select(long sec,long usec); - /** This method will not return until an event has been detected. */ - int Select(); + /** This method will not return until an event has been detected. */ + int Select(); - /** Wait for events, generate callbacks. */ - int Select(struct timeval *tsel); + /** Wait for events, generate callbacks. */ + int Select(struct timeval *tsel); - /** Check that a socket really is handled by this socket handler. */ - bool Valid(Socket *); + /** Check that a socket really is handled by this socket handler. */ + bool Valid(Socket *); - /** Return number of sockets handled by this handler. */ - size_t GetCount(); + /** Return number of sockets handled by this handler. */ + size_t GetCount(); - /** Override and return false to deny all incoming connections. - \param p ListenSocket class pointer (use GetPort to identify which one) */ - bool OkToAccept(Socket *p); + /** Override and return false to deny all incoming connections. + \param p ListenSocket class pointer (use GetPort to identify which one) */ + bool OkToAccept(Socket *p); - /** Called by Socket when a socket changes state. */ - void AddList(SOCKET s,list_t which_one,bool add); + /** Called by Socket when a socket changes state. */ + void AddList(SOCKET s,list_t which_one,bool add); - // Connection pool + // Connection pool #ifdef ENABLE_POOL - /** Find available open connection (used by connection pool). */ - ISocketHandler::PoolSocket *FindConnection(int type,const std::string& protocol,SocketAddress&); - /** Enable connection pool (by default disabled). */ - void EnablePool(bool x = true); - /** Check pool status. - \return true if connection pool is enabled */ - bool PoolEnabled(); + /** Find available open connection (used by connection pool). */ + ISocketHandler::PoolSocket *FindConnection(int type,const std::string& protocol,SocketAddress&); + /** Enable connection pool (by default disabled). */ + void EnablePool(bool x = true); + /** Check pool status. + \return true if connection pool is enabled */ + bool PoolEnabled(); #endif // ENABLE_POOL - // Socks4 + // Socks4 #ifdef ENABLE_SOCKS4 - /** Set socks4 server ip that all new tcp sockets should use. */ - void SetSocks4Host(ipaddr_t); - /** Set socks4 server hostname that all new tcp sockets should use. */ - void SetSocks4Host(const std::string& ); - /** Set socks4 server port number that all new tcp sockets should use. */ - void SetSocks4Port(port_t); - /** Set optional socks4 userid. */ - void SetSocks4Userid(const std::string& ); - /** If connection to socks4 server fails, immediately try direct connection to final host. */ - void SetSocks4TryDirect(bool x = true); - /** Get socks4 server ip. - \return socks4 server ip */ - ipaddr_t GetSocks4Host(); - /** Get socks4 port number. - \return socks4 port number */ - port_t GetSocks4Port(); - /** Get socks4 userid (optional). - \return socks4 userid */ - const std::string& GetSocks4Userid(); - /** Check status of socks4 try direct flag. - \return true if direct connection should be tried if connection to socks4 server fails */ - bool Socks4TryDirect(); + /** Set socks4 server ip that all new tcp sockets should use. */ + void SetSocks4Host(ipaddr_t); + /** Set socks4 server hostname that all new tcp sockets should use. */ + void SetSocks4Host(const std::string& ); + /** Set socks4 server port number that all new tcp sockets should use. */ + void SetSocks4Port(port_t); + /** Set optional socks4 userid. */ + void SetSocks4Userid(const std::string& ); + /** If connection to socks4 server fails, immediately try direct connection to final host. */ + void SetSocks4TryDirect(bool x = true); + /** Get socks4 server ip. + \return socks4 server ip */ + ipaddr_t GetSocks4Host(); + /** Get socks4 port number. + \return socks4 port number */ + port_t GetSocks4Port(); + /** Get socks4 userid (optional). + \return socks4 userid */ + const std::string& GetSocks4Userid(); + /** Check status of socks4 try direct flag. + \return true if direct connection should be tried if connection to socks4 server fails */ + bool Socks4TryDirect(); #endif // ENABLE_SOCKS4 - // DNS resolve server + // DNS resolve server #ifdef ENABLE_RESOLVER - /** Enable asynchronous DNS. - \param port Listen port of asynchronous dns server */ - void EnableResolver(port_t port = 16667); - /** Check resolver status. - \return true if resolver is enabled */ - bool ResolverEnabled(); - /** Queue a dns request. - \param host Hostname to be resolved - \param port Port number will be echoed in Socket::OnResolved callback */ - int Resolve(Socket *,const std::string& host,port_t port); + /** Enable asynchronous DNS. + \param port Listen port of asynchronous dns server */ + void EnableResolver(port_t port = 16667); + /** Check resolver status. + \return true if resolver is enabled */ + bool ResolverEnabled(); + /** Queue a dns request. + \param host Hostname to be resolved + \param port Port number will be echoed in Socket::OnResolved callback */ + int Resolve(Socket *,const std::string& host,port_t port); #ifdef ENABLE_IPV6 - int Resolve6(Socket *,const std::string& host,port_t port); + int Resolve6(Socket *,const std::string& host,port_t port); #endif - /** Do a reverse dns lookup. */ - int Resolve(Socket *,ipaddr_t a); + /** Do a reverse dns lookup. */ + int Resolve(Socket *,ipaddr_t a); #ifdef ENABLE_IPV6 - int Resolve(Socket *,in6_addr& a); + int Resolve(Socket *,in6_addr& a); #endif - /** Get listen port of asynchronous dns server. */ - port_t GetResolverPort(); - /** Resolver thread ready for queries. */ - bool ResolverReady(); - /** Returns true if the socket is waiting for a resolve event. */ - bool Resolving(Socket *); + /** Get listen port of asynchronous dns server. */ + port_t GetResolverPort(); + /** Resolver thread ready for queries. */ + bool ResolverReady(); + /** Returns true if the socket is waiting for a resolve event. */ + bool Resolving(Socket *); #endif // ENABLE_RESOLVER #ifdef ENABLE_TRIGGERS - /** Fetch unique trigger id. */ - int TriggerID(Socket *src); - /** Subscribe socket to trigger id. */ - bool Subscribe(int id, Socket *dst); - /** Unsubscribe socket from trigger id. */ - bool Unsubscribe(int id, Socket *dst); - /** Execute OnTrigger for subscribed sockets. - \param id Trigger ID - \param data Data passed from source to destination - \param erase Empty trigger id source and destination maps if 'true', - Leave them in place if 'false' - if a trigger should be called many times */ - void Trigger(int id, Socket::TriggerData& data, bool erase = true); + /** Fetch unique trigger id. */ + int TriggerID(Socket *src); + /** Subscribe socket to trigger id. */ + bool Subscribe(int id, Socket *dst); + /** Unsubscribe socket from trigger id. */ + bool Unsubscribe(int id, Socket *dst); + /** Execute OnTrigger for subscribed sockets. + \param id Trigger ID + \param data Data passed from source to destination + \param erase Empty trigger id source and destination maps if 'true', + Leave them in place if 'false' - if a trigger should be called many times */ + void Trigger(int id, Socket::TriggerData& data, bool erase = true); #endif // ENABLE_TRIGGERS #ifdef ENABLE_DETACH - /** Indicates that the handler runs under SocketThread. */ - void SetSlave(bool x = true); - /** Indicates that the handler runs under SocketThread. */ - bool IsSlave(); + /** Indicates that the handler runs under SocketThread. */ + void SetSlave(bool x = true); + /** Indicates that the handler runs under SocketThread. */ + bool IsSlave(); #endif - /** Sanity check of those accursed lists. */ - void CheckSanity(); + /** Sanity check of those accursed lists. */ + void CheckSanity(); protected: - socket_m m_sockets; ///< Active sockets map - socket_m m_add; ///< Sockets to be added to sockets map - std::list m_delete; ///< Sockets to be deleted (failed when Add) + socket_m m_sockets; ///< Active sockets map + socket_m m_add; ///< Sockets to be added to sockets map + std::list m_delete; ///< Sockets to be deleted (failed when Add) protected: - StdLog *m_stdlog; ///< Registered log class, or NULL - Mutex& m_mutex; ///< Thread safety mutex - bool m_b_use_mutex; ///< Mutex correctly initialized + StdLog *m_stdlog; ///< Registered log class, or NULL + Mutex& m_mutex; ///< Thread safety mutex + bool m_b_use_mutex; ///< Mutex correctly initialized private: - void CheckList(socket_v&,const std::string&); ///< Used by CheckSanity - /** Remove socket from socket map, used by Socket class. */ - void Remove(Socket *); - SOCKET m_maxsock; ///< Highest file descriptor + 1 in active sockets list - fd_set m_rfds; ///< file descriptor set monitored for read events - fd_set m_wfds; ///< file descriptor set monitored for write events - fd_set m_efds; ///< file descriptor set monitored for exceptions - int m_preverror; ///< debug select() error - int m_errcnt; ///< debug select() error - time_t m_tlast; ///< timeout control + void CheckList(socket_v&,const std::string&); ///< Used by CheckSanity + /** Remove socket from socket map, used by Socket class. */ + void Remove(Socket *); + SOCKET m_maxsock; ///< Highest file descriptor + 1 in active sockets list + fd_set m_rfds; ///< file descriptor set monitored for read events + fd_set m_wfds; ///< file descriptor set monitored for write events + fd_set m_efds; ///< file descriptor set monitored for exceptions + int m_preverror; ///< debug select() error + int m_errcnt; ///< debug select() error + time_t m_tlast; ///< timeout control - // state lists - socket_v m_fds; ///< Active file descriptor list - socket_v m_fds_erase; ///< File descriptors that are to be erased from m_sockets - socket_v m_fds_callonconnect; ///< checklist CallOnConnect + // state lists + socket_v m_fds; ///< Active file descriptor list + socket_v m_fds_erase; ///< File descriptors that are to be erased from m_sockets + socket_v m_fds_callonconnect; ///< checklist CallOnConnect #ifdef ENABLE_DETACH - socket_v m_fds_detach; ///< checklist Detach + socket_v m_fds_detach; ///< checklist Detach #endif - socket_v m_fds_timeout; ///< checklist timeout - socket_v m_fds_retry; ///< checklist retry client connect - socket_v m_fds_close; ///< checklist close and delete + socket_v m_fds_timeout; ///< checklist timeout + socket_v m_fds_retry; ///< checklist retry client connect + socket_v m_fds_close; ///< checklist close and delete #ifdef ENABLE_SOCKS4 - ipaddr_t m_socks4_host; ///< Socks4 server host ip - port_t m_socks4_port; ///< Socks4 server port number - std::string m_socks4_userid; ///< Socks4 userid - bool m_bTryDirect; ///< Try direct connection if socks4 server fails + ipaddr_t m_socks4_host; ///< Socks4 server host ip + port_t m_socks4_port; ///< Socks4 server port number + std::string m_socks4_userid; ///< Socks4 userid + bool m_bTryDirect; ///< Try direct connection if socks4 server fails #endif #ifdef ENABLE_RESOLVER - int m_resolv_id; ///< Resolver id counter - ResolvServer *m_resolver; ///< Resolver thread pointer - port_t m_resolver_port; ///< Resolver listen port - std::map m_resolve_q; ///< resolve queue + int m_resolv_id; ///< Resolver id counter + ResolvServer *m_resolver; ///< Resolver thread pointer + port_t m_resolver_port; ///< Resolver listen port + std::map m_resolve_q; ///< resolve queue #endif #ifdef ENABLE_POOL - bool m_b_enable_pool; ///< Connection pool enabled if true + bool m_b_enable_pool; ///< Connection pool enabled if true #endif #ifdef ENABLE_TRIGGERS - int m_next_trigger_id; ///< Unique trigger id counter - std::map m_trigger_src; ///< mapping trigger id to source socket - std::map > m_trigger_dst; ///< mapping trigger id to destination sockets + int m_next_trigger_id; ///< Unique trigger id counter + std::map m_trigger_src; ///< mapping trigger id to source socket + std::map > m_trigger_dst; ///< mapping trigger id to destination sockets #endif #ifdef ENABLE_DETACH - bool m_slave; ///< Indicates that this is a ISocketHandler run in SocketThread + bool m_slave; ///< Indicates that this is a ISocketHandler run in SocketThread #endif }; diff --git a/dep/include/sockets/StdLog.h b/dep/include/sockets/StdLog.h index c07037bbd4f..2d2a6705ce0 100644 --- a/dep/include/sockets/StdLog.h +++ b/dep/include/sockets/StdLog.h @@ -1,6 +1,6 @@ /** \file StdLog.h - ** \date 2004-06-01 - ** \author grymse@alhem.net + ** \date 2004-06-01 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -40,10 +40,10 @@ namespace SOCKETS_NAMESPACE { /** error level enum. */ typedef enum { - LOG_LEVEL_WARNING = 0, - LOG_LEVEL_ERROR, - LOG_LEVEL_FATAL, - LOG_LEVEL_INFO + LOG_LEVEL_WARNING = 0, + LOG_LEVEL_ERROR, + LOG_LEVEL_FATAL, + LOG_LEVEL_INFO } loglevel_t; @@ -51,18 +51,18 @@ class ISocketHandler; class Socket; /** \defgroup logging Log help classes */ -/** Log class interface. - \ingroup logging */ +/** Log class interface. + \ingroup logging */ class StdLog { public: - virtual ~StdLog() {} + virtual ~StdLog() {} - virtual void error(ISocketHandler *,Socket *, - const std::string& user_text, - int err, - const std::string& sys_err, - loglevel_t = LOG_LEVEL_WARNING) = 0; + virtual void error(ISocketHandler *,Socket *, + const std::string& user_text, + int err, + const std::string& sys_err, + loglevel_t = LOG_LEVEL_WARNING) = 0; }; diff --git a/dep/include/sockets/StdoutLog.h b/dep/include/sockets/StdoutLog.h index 5f96b340dc2..3222892e4bf 100644 --- a/dep/include/sockets/StdoutLog.h +++ b/dep/include/sockets/StdoutLog.h @@ -1,6 +1,6 @@ /** \file StdoutLog.h - ** \date 2004-06-01 - ** \author grymse@alhem.net + ** \date 2004-06-01 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -38,12 +38,12 @@ namespace SOCKETS_NAMESPACE { #endif -/** StdLog implementation, logs to stdout. - \ingroup logging */ +/** StdLog implementation, logs to stdout. + \ingroup logging */ class StdoutLog : public StdLog { public: - void error(ISocketHandler *,Socket *,const std::string& call,int err,const std::string& sys_err,loglevel_t); + void error(ISocketHandler *,Socket *,const std::string& call,int err,const std::string& sys_err,loglevel_t); }; diff --git a/dep/include/sockets/StreamSocket.h b/dep/include/sockets/StreamSocket.h index 3c248110b88..a22e2332bcb 100644 --- a/dep/include/sockets/StreamSocket.h +++ b/dep/include/sockets/StreamSocket.h @@ -10,111 +10,111 @@ namespace SOCKETS_NAMESPACE { /** SOCK_STREAM Socket base class. - \ingroup basic */ + \ingroup basic */ class StreamSocket : public Socket { public: - StreamSocket(ISocketHandler& ); - ~StreamSocket(); + StreamSocket(ISocketHandler& ); + ~StreamSocket(); - /** Socket should Check Connect on next write event from select(). */ - void SetConnecting(bool = true); + /** Socket should Check Connect on next write event from select(). */ + void SetConnecting(bool = true); - /** Check connecting flag. - \return true if the socket is still trying to connect */ - bool Connecting(); + /** Check connecting flag. + \return true if the socket is still trying to connect */ + bool Connecting(); - /** Returns true when socket file descriptor is valid, - socket connection is established, and socket is not about to - be closed. */ - bool Ready(); + /** Returns true when socket file descriptor is valid, + socket connection is established, and socket is not about to + be closed. */ + bool Ready(); - /** Set timeout to use for connection attempt. - \param x Timeout in seconds */ - void SetConnectTimeout(int x); + /** Set timeout to use for connection attempt. + \param x Timeout in seconds */ + void SetConnectTimeout(int x); - /** Return number of seconds to wait for a connection. - \return Connection timeout (seconds) */ - int GetConnectTimeout(); + /** Return number of seconds to wait for a connection. + \return Connection timeout (seconds) */ + int GetConnectTimeout(); - /** Set flush before close to make a tcp socket completely empty its - output buffer before closing the connection. */ - void SetFlushBeforeClose(bool = true); + /** Set flush before close to make a tcp socket completely empty its + output buffer before closing the connection. */ + void SetFlushBeforeClose(bool = true); - /** Check flush before status. - \return true if the socket should send all data before closing */ - bool GetFlushBeforeClose(); + /** Check flush before status. + \return true if the socket should send all data before closing */ + bool GetFlushBeforeClose(); - /** Define number of connection retries (tcp only). - n = 0 - no retry - n > 0 - number of retries - n = -1 - unlimited retries */ - void SetConnectionRetry(int n); + /** Define number of connection retries (tcp only). + n = 0 - no retry + n > 0 - number of retries + n = -1 - unlimited retries */ + void SetConnectionRetry(int n); - /** Get number of maximum connection retries (tcp only). */ - int GetConnectionRetry(); + /** Get number of maximum connection retries (tcp only). */ + int GetConnectionRetry(); - /** Increase number of actual connection retries (tcp only). */ - void IncreaseConnectionRetries(); + /** Increase number of actual connection retries (tcp only). */ + void IncreaseConnectionRetries(); - /** Get number of actual connection retries (tcp only). */ - int GetConnectionRetries(); + /** Get number of actual connection retries (tcp only). */ + int GetConnectionRetries(); - /** Reset actual connection retries (tcp only). */ - void ResetConnectionRetries(); + /** Reset actual connection retries (tcp only). */ + void ResetConnectionRetries(); - // LIST_CALLONCONNECT + // LIST_CALLONCONNECT - /** Instruct socket to call OnConnect callback next sockethandler cycle. */ - void SetCallOnConnect(bool x = true); + /** Instruct socket to call OnConnect callback next sockethandler cycle. */ + void SetCallOnConnect(bool x = true); - /** Check call on connect flag. - \return true if OnConnect() should be called a.s.a.p */ - bool CallOnConnect(); + /** Check call on connect flag. + \return true if OnConnect() should be called a.s.a.p */ + bool CallOnConnect(); - // LIST_RETRY + // LIST_RETRY - /** Set flag to initiate a connection attempt after a connection timeout. */ - void SetRetryClientConnect(bool x = true); + /** Set flag to initiate a connection attempt after a connection timeout. */ + void SetRetryClientConnect(bool x = true); - /** Check if a connection attempt should be made. - \return true when another attempt should be made */ - bool RetryClientConnect(); + /** Check if a connection attempt should be made. + \return true when another attempt should be made */ + bool RetryClientConnect(); - /** Called after OnRead if socket is in line protocol mode. - \sa SetLineProtocol */ - /** Enable the OnLine callback. Do not create your own OnRead - * callback when using this. */ - virtual void SetLineProtocol(bool = true); + /** Called after OnRead if socket is in line protocol mode. + \sa SetLineProtocol */ + /** Enable the OnLine callback. Do not create your own OnRead + * callback when using this. */ + virtual void SetLineProtocol(bool = true); - /** Check line protocol mode. - \return true if socket is in line protocol mode */ - bool LineProtocol(); + /** Check line protocol mode. + \return true if socket is in line protocol mode */ + bool LineProtocol(); - /** Set shutdown status. */ - void SetShutdown(int); + /** Set shutdown status. */ + void SetShutdown(int); - /** Get shutdown status. */ - int GetShutdown(); + /** Get shutdown status. */ + int GetShutdown(); - /** Returns IPPROTO_TCP or IPPROTO_SCTP */ - virtual int Protocol() = 0; + /** Returns IPPROTO_TCP or IPPROTO_SCTP */ + virtual int Protocol() = 0; protected: - StreamSocket(const StreamSocket& ) {} // copy constructor + StreamSocket(const StreamSocket& ) {} // copy constructor private: - StreamSocket& operator=(const StreamSocket& ) { return *this; } // assignment operator + StreamSocket& operator=(const StreamSocket& ) { return *this; } // assignment operator - bool m_bConnecting; ///< Flag indicating connection in progress - int m_connect_timeout; ///< Connection timeout (seconds) - bool m_flush_before_close; ///< Send all data before closing (default true) - int m_connection_retry; ///< Maximum connection retries (tcp) - int m_retries; ///< Actual number of connection retries (tcp) - bool m_call_on_connect; ///< OnConnect will be called next ISocketHandler cycle if true - bool m_b_retry_connect; ///< Try another connection attempt next ISocketHandler cycle - bool m_line_protocol; ///< Line protocol mode flag - int m_shutdown; ///< Shutdown status + bool m_bConnecting; ///< Flag indicating connection in progress + int m_connect_timeout; ///< Connection timeout (seconds) + bool m_flush_before_close; ///< Send all data before closing (default true) + int m_connection_retry; ///< Maximum connection retries (tcp) + int m_retries; ///< Actual number of connection retries (tcp) + bool m_call_on_connect; ///< OnConnect will be called next ISocketHandler cycle if true + bool m_b_retry_connect; ///< Try another connection attempt next ISocketHandler cycle + bool m_line_protocol; ///< Line protocol mode flag + int m_shutdown; ///< Shutdown status }; diff --git a/dep/include/sockets/TcpSocket.h b/dep/include/sockets/TcpSocket.h index 515f5aa6cc7..4a157db4df6 100644 --- a/dep/include/sockets/TcpSocket.h +++ b/dep/include/sockets/TcpSocket.h @@ -1,6 +1,6 @@ /** \file TcpSocket.h - ** \date 2004-02-13 - ** \author grymse@alhem.net + ** \date 2004-02-13 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -49,302 +49,302 @@ namespace SOCKETS_NAMESPACE { class SocketAddress; -/** Socket implementation for TCP. - \ingroup basic */ +/** Socket implementation for TCP. + \ingroup basic */ class TcpSocket : public StreamSocket { - /** \defgroup internal Internal utility */ + /** \defgroup internal Internal utility */ protected: - /** Buffer class containing one read/write circular buffer. - \ingroup internal */ - class CircularBuffer - { - public: - CircularBuffer(size_t size); - ~CircularBuffer(); + /** Buffer class containing one read/write circular buffer. + \ingroup internal */ + class CircularBuffer + { + public: + CircularBuffer(size_t size); + ~CircularBuffer(); - /** append l bytes from p to buffer */ - bool Write(const char *p,size_t l); - /** copy l bytes from buffer to dest */ - bool Read(char *dest,size_t l); + /** append l bytes from p to buffer */ + bool Write(const char *p,size_t l); + /** copy l bytes from buffer to dest */ + bool Read(char *dest,size_t l); /** copy l bytes from buffer to dest, dont touch buffer pointers */ bool SoftRead(char *dest, size_t l); - /** skip l bytes from buffer */ - bool Remove(size_t l); - /** read l bytes from buffer, returns as string. */ - std::string ReadString(size_t l); + /** skip l bytes from buffer */ + bool Remove(size_t l); + /** read l bytes from buffer, returns as string. */ + std::string ReadString(size_t l); - /** total buffer length */ - size_t GetLength(); - /** pointer to circular buffer beginning */ - const char *GetStart(); - /** return number of bytes from circular buffer beginning to buffer physical end */ - size_t GetL(); - /** return free space in buffer, number of bytes until buffer overrun */ - size_t Space(); + /** total buffer length */ + size_t GetLength(); + /** pointer to circular buffer beginning */ + const char *GetStart(); + /** return number of bytes from circular buffer beginning to buffer physical end */ + size_t GetL(); + /** return free space in buffer, number of bytes until buffer overrun */ + size_t Space(); - /** return total number of bytes written to this buffer, ever */ - unsigned long ByteCounter(bool clear = false); + /** return total number of bytes written to this buffer, ever */ + unsigned long ByteCounter(bool clear = false); - private: - CircularBuffer(const CircularBuffer& /*s*/) {} - CircularBuffer& operator=(const CircularBuffer& ) { return *this; } - char *buf; - size_t m_max; - size_t m_q; - size_t m_b; - size_t m_t; - unsigned long m_count; - }; - /** Output buffer struct. - \ingroup internal */ - struct OUTPUT { - OUTPUT() : _b(0), _t(0), _q(0) {} - OUTPUT(const char *buf, size_t len) : _b(0), _t(len), _q(len) { - memcpy(_buf, buf, len); - } - size_t Space() { - return TCP_OUTPUT_CAPACITY - _t; - } - void Add(const char *buf, size_t len) { - memcpy(_buf + _t, buf, len); - _t += len; - _q += len; - } - size_t Remove(size_t len) { - _b += len; - _q -= len; - return _q; - } - const char *Buf() { - return _buf + _b; - } - size_t Len() { - return _q; - } - size_t _b; - size_t _t; - size_t _q; - char _buf[TCP_OUTPUT_CAPACITY]; - }; - typedef std::list output_l; + private: + CircularBuffer(const CircularBuffer& /*s*/) {} + CircularBuffer& operator=(const CircularBuffer& ) { return *this; } + char *buf; + size_t m_max; + size_t m_q; + size_t m_b; + size_t m_t; + unsigned long m_count; + }; + /** Output buffer struct. + \ingroup internal */ + struct OUTPUT { + OUTPUT() : _b(0), _t(0), _q(0) {} + OUTPUT(const char *buf, size_t len) : _b(0), _t(len), _q(len) { + memcpy(_buf, buf, len); + } + size_t Space() { + return TCP_OUTPUT_CAPACITY - _t; + } + void Add(const char *buf, size_t len) { + memcpy(_buf + _t, buf, len); + _t += len; + _q += len; + } + size_t Remove(size_t len) { + _b += len; + _q -= len; + return _q; + } + const char *Buf() { + return _buf + _b; + } + size_t Len() { + return _q; + } + size_t _b; + size_t _t; + size_t _q; + char _buf[TCP_OUTPUT_CAPACITY]; + }; + typedef std::list output_l; public: - /** Constructor with standard values on input/output buffers. */ - TcpSocket(ISocketHandler& ); - /** Constructor with custom values for i/o buffer. - \param h ISocketHandler reference - \param isize Input buffer size - \param osize Output buffer size */ - TcpSocket(ISocketHandler& h,size_t isize,size_t osize); - ~TcpSocket(); + /** Constructor with standard values on input/output buffers. */ + TcpSocket(ISocketHandler& ); + /** Constructor with custom values for i/o buffer. + \param h ISocketHandler reference + \param isize Input buffer size + \param osize Output buffer size */ + TcpSocket(ISocketHandler& h,size_t isize,size_t osize); + ~TcpSocket(); - /** Open a connection to a remote server. - If you want your socket to connect to a server, - always call Open before Add'ing a socket to the sockethandler. - If not, the connection attempt will not be monitored by the - socket handler... - \param ip IP address - \param port Port number - \param skip_socks Do not use socks4 even if configured */ - bool Open(ipaddr_t ip,port_t port,bool skip_socks = false); + /** Open a connection to a remote server. + If you want your socket to connect to a server, + always call Open before Add'ing a socket to the sockethandler. + If not, the connection attempt will not be monitored by the + socket handler... + \param ip IP address + \param port Port number + \param skip_socks Do not use socks4 even if configured */ + bool Open(ipaddr_t ip,port_t port,bool skip_socks = false); #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - /** Open connection. - \param ip Ipv6 address - \param port Port number - \param skip_socks Do not use socks4 even if configured */ - bool Open(in6_addr ip,port_t port,bool skip_socks = false); + /** Open connection. + \param ip Ipv6 address + \param port Port number + \param skip_socks Do not use socks4 even if configured */ + bool Open(in6_addr ip,port_t port,bool skip_socks = false); #endif #endif - bool Open(SocketAddress&,bool skip_socks = false); - bool Open(SocketAddress&,SocketAddress& bind_address,bool skip_socks = false); - /** Open connection. - \param host Hostname - \param port Port number */ - bool Open(const std::string &host,port_t port); + bool Open(SocketAddress&,bool skip_socks = false); + bool Open(SocketAddress&,SocketAddress& bind_address,bool skip_socks = false); + /** Open connection. + \param host Hostname + \param port Port number */ + bool Open(const std::string &host,port_t port); - /** Connect timeout callback. */ - void OnConnectTimeout(); + /** Connect timeout callback. */ + void OnConnectTimeout(); #ifdef _WIN32 - /** Connection failed reported as exception on win32 */ - void OnException(); + /** Connection failed reported as exception on win32 */ + void OnException(); #endif - /** Close file descriptor - internal use only. - \sa SetCloseAndDelete */ - int Close(); + /** Close file descriptor - internal use only. + \sa SetCloseAndDelete */ + int Close(); - /** Send a string. - \param s String to send - \param f Dummy flags -- not used */ - void Send(const std::string &s,int f = 0); - /** Send string using printf formatting. */ - void Sendf(const char *format, ...); - /** Send buffer of bytes. - \param buf Buffer pointer - \param len Length of data - \param f Dummy flags -- not used */ - void SendBuf(const char *buf,size_t len,int f = 0); - /** This callback is executed after a successful read from the socket. - \param buf Pointer to the data - \param len Length of the data */ - virtual void OnRawData(const char *buf,size_t len); + /** Send a string. + \param s String to send + \param f Dummy flags -- not used */ + void Send(const std::string &s,int f = 0); + /** Send string using printf formatting. */ + void Sendf(const char *format, ...); + /** Send buffer of bytes. + \param buf Buffer pointer + \param len Length of data + \param f Dummy flags -- not used */ + void SendBuf(const char *buf,size_t len,int f = 0); + /** This callback is executed after a successful read from the socket. + \param buf Pointer to the data + \param len Length of the data */ + virtual void OnRawData(const char *buf,size_t len); - /** Called when output buffer has been sent. - Note: Will only be called IF the output buffer has been used. - Send's that was successful without needing the output buffer - will not generate a call to this method. */ - virtual void OnWriteComplete(); - /** Number of bytes in input buffer. */ - size_t GetInputLength(); - /** Number of bytes in output buffer. */ - size_t GetOutputLength(); + /** Called when output buffer has been sent. + Note: Will only be called IF the output buffer has been used. + Send's that was successful without needing the output buffer + will not generate a call to this method. */ + virtual void OnWriteComplete(); + /** Number of bytes in input buffer. */ + size_t GetInputLength(); + /** Number of bytes in output buffer. */ + size_t GetOutputLength(); - /** Callback fires when a socket in line protocol has read one full line. - \param line Line read */ - void OnLine(const std::string& line); - /** Get counter of number of bytes received. */ - uint64_t GetBytesReceived(bool clear = false); - /** Get counter of number of bytes sent. */ - uint64_t GetBytesSent(bool clear = false); + /** Callback fires when a socket in line protocol has read one full line. + \param line Line read */ + void OnLine(const std::string& line); + /** Get counter of number of bytes received. */ + uint64_t GetBytesReceived(bool clear = false); + /** Get counter of number of bytes sent. */ + uint64_t GetBytesSent(bool clear = false); - /** Socks4 specific callback. */ - void OnSocks4Connect(); - /** Socks4 specific callback. */ - void OnSocks4ConnectFailed(); - /** Socks4 specific callback. - \return 'need_more' */ - bool OnSocks4Read(); + /** Socks4 specific callback. */ + void OnSocks4Connect(); + /** Socks4 specific callback. */ + void OnSocks4ConnectFailed(); + /** Socks4 specific callback. + \return 'need_more' */ + bool OnSocks4Read(); #ifdef ENABLE_RESOLVER - /** Callback executed when resolver thread has finished a resolve request. */ - void OnResolved(int id,ipaddr_t a,port_t port); + /** Callback executed when resolver thread has finished a resolve request. */ + void OnResolved(int id,ipaddr_t a,port_t port); #ifdef ENABLE_IPV6 - void OnResolved(int id,in6_addr& a,port_t port); + void OnResolved(int id,in6_addr& a,port_t port); #endif #endif #ifdef HAVE_OPENSSL - /** Callback for 'New' ssl support - replaces SSLSocket. Internal use. */ - void OnSSLConnect(); - /** Callback for 'New' ssl support - replaces SSLSocket. Internal use. */ - void OnSSLAccept(); - /** This method must be implemented to initialize - the ssl context for an outgoing connection. */ - virtual void InitSSLClient(); - /** This method must be implemented to initialize - the ssl context for an incoming connection. */ - virtual void InitSSLServer(); + /** Callback for 'New' ssl support - replaces SSLSocket. Internal use. */ + void OnSSLConnect(); + /** Callback for 'New' ssl support - replaces SSLSocket. Internal use. */ + void OnSSLAccept(); + /** This method must be implemented to initialize + the ssl context for an outgoing connection. */ + virtual void InitSSLClient(); + /** This method must be implemented to initialize + the ssl context for an incoming connection. */ + virtual void InitSSLServer(); #endif #ifdef ENABLE_RECONNECT - /** Flag that says a broken connection will try to reconnect. */ - void SetReconnect(bool = true); - /** Check reconnect on lost connection flag status. */ - bool Reconnect(); - /** Flag to determine if a reconnect is in progress. */ - void SetIsReconnect(bool x = true); - /** Socket is reconnecting. */ - bool IsReconnect(); + /** Flag that says a broken connection will try to reconnect. */ + void SetReconnect(bool = true); + /** Check reconnect on lost connection flag status. */ + bool Reconnect(); + /** Flag to determine if a reconnect is in progress. */ + void SetIsReconnect(bool x = true); + /** Socket is reconnecting. */ + bool IsReconnect(); #endif - void DisableInputBuffer(bool = true); + void DisableInputBuffer(bool = true); - void OnOptions(int,int,int,SOCKET); + void OnOptions(int,int,int,SOCKET); - void SetLineProtocol(bool = true); + void SetLineProtocol(bool = true); - // TCP options - bool SetTcpNodelay(bool = true); + // TCP options + bool SetTcpNodelay(bool = true); - virtual int Protocol(); + virtual int Protocol(); - /** Trigger limit for callback OnTransferLimit. */ - void SetTransferLimit(size_t sz); - /** This callback fires when the output buffer drops below the value - set by SetTransferLimit. Default: 0 (disabled). */ - virtual void OnTransferLimit(); + /** Trigger limit for callback OnTransferLimit. */ + void SetTransferLimit(size_t sz); + /** This callback fires when the output buffer drops below the value + set by SetTransferLimit. Default: 0 (disabled). */ + virtual void OnTransferLimit(); protected: - TcpSocket(const TcpSocket& ); - void OnRead(); - void OnRead( char *buf, size_t n ); - void OnWrite(); + TcpSocket(const TcpSocket& ); + void OnRead(); + void OnRead( char *buf, size_t n ); + void OnWrite(); #ifdef HAVE_OPENSSL - /** SSL; Initialize ssl context for a client socket. - \param meth_in SSL method */ - void InitializeContext(const std::string& context, SSL_METHOD *meth_in = NULL); - /** SSL; Initialize ssl context for a server socket. - \param keyfile Combined private key/certificate file - \param password Password for private key - \param meth_in SSL method */ - void InitializeContext(const std::string& context, const std::string& keyfile, const std::string& password, SSL_METHOD *meth_in = NULL); - /** SSL; Initialize ssl context for a server socket. - \param certfile Separate certificate file - \param keyfile Combined private key/certificate file - \param password Password for private key - \param meth_in SSL method */ - void InitializeContext(const std::string& context, const std::string& certfile, const std::string& keyfile, const std::string& password, SSL_METHOD *meth_in = NULL); - /** SSL; Password callback method. */ -static int SSL_password_cb(char *buf,int num,int rwflag,void *userdata); - /** SSL; Get pointer to ssl context structure. */ - virtual SSL_CTX *GetSslContext(); - /** SSL; Get pointer to ssl structure. */ - virtual SSL *GetSsl(); - /** ssl; still negotiating connection. */ - bool SSLNegotiate(); - /** SSL; Get ssl password. */ - const std::string& GetPassword(); + /** SSL; Initialize ssl context for a client socket. + \param meth_in SSL method */ + void InitializeContext(const std::string& context, SSL_METHOD *meth_in = NULL); + /** SSL; Initialize ssl context for a server socket. + \param keyfile Combined private key/certificate file + \param password Password for private key + \param meth_in SSL method */ + void InitializeContext(const std::string& context, const std::string& keyfile, const std::string& password, SSL_METHOD *meth_in = NULL); + /** SSL; Initialize ssl context for a server socket. + \param certfile Separate certificate file + \param keyfile Combined private key/certificate file + \param password Password for private key + \param meth_in SSL method */ + void InitializeContext(const std::string& context, const std::string& certfile, const std::string& keyfile, const std::string& password, SSL_METHOD *meth_in = NULL); + /** SSL; Password callback method. */ +static int SSL_password_cb(char *buf,int num,int rwflag,void *userdata); + /** SSL; Get pointer to ssl context structure. */ + virtual SSL_CTX *GetSslContext(); + /** SSL; Get pointer to ssl structure. */ + virtual SSL *GetSsl(); + /** ssl; still negotiating connection. */ + bool SSLNegotiate(); + /** SSL; Get ssl password. */ + const std::string& GetPassword(); #endif - CircularBuffer ibuf; ///< Circular input buffer + CircularBuffer ibuf; ///< Circular input buffer private: - TcpSocket& operator=(const TcpSocket& ) { return *this; } + TcpSocket& operator=(const TcpSocket& ) { return *this; } - /** the actual send() */ - int TryWrite(const char *buf, size_t len); - /** add data to output buffer top */ - void Buffer(const char *buf, size_t len); + /** the actual send() */ + int TryWrite(const char *buf, size_t len); + /** add data to output buffer top */ + void Buffer(const char *buf, size_t len); - // - bool m_b_input_buffer_disabled; - uint64_t m_bytes_sent; - uint64_t m_bytes_received; - bool m_skip_c; ///< Skip second char of CRLF or LFCR sequence in OnRead - char m_c; ///< First char in CRLF or LFCR sequence - std::string m_line; ///< Current line in line protocol mode + // + bool m_b_input_buffer_disabled; + uint64_t m_bytes_sent; + uint64_t m_bytes_received; + bool m_skip_c; ///< Skip second char of CRLF or LFCR sequence in OnRead + char m_c; ///< First char in CRLF or LFCR sequence + std::string m_line; ///< Current line in line protocol mode #ifdef SOCKETS_DYNAMIC_TEMP - char *m_buf; ///< temporary read buffer + char *m_buf; ///< temporary read buffer #endif - output_l m_obuf; ///< output buffer - OUTPUT *m_obuf_top; ///< output buffer on top - size_t m_transfer_limit; - size_t m_output_length; + output_l m_obuf; ///< output buffer + OUTPUT *m_obuf_top; ///< output buffer on top + size_t m_transfer_limit; + size_t m_output_length; #ifdef HAVE_OPENSSL -static SSLInitializer m_ssl_init; - SSL_CTX *m_ssl_ctx; ///< ssl context - SSL *m_ssl; ///< ssl 'socket' - BIO *m_sbio; ///< ssl bio - std::string m_password; ///< ssl password +static SSLInitializer m_ssl_init; + SSL_CTX *m_ssl_ctx; ///< ssl context + SSL *m_ssl; ///< ssl 'socket' + BIO *m_sbio; ///< ssl bio + std::string m_password; ///< ssl password #endif #ifdef ENABLE_SOCKS4 - int m_socks4_state; ///< socks4 support - char m_socks4_vn; ///< socks4 support, temporary variable - char m_socks4_cd; ///< socks4 support, temporary variable - unsigned short m_socks4_dstport; ///< socks4 support - unsigned long m_socks4_dstip; ///< socks4 support + int m_socks4_state; ///< socks4 support + char m_socks4_vn; ///< socks4 support, temporary variable + char m_socks4_cd; ///< socks4 support, temporary variable + unsigned short m_socks4_dstport; ///< socks4 support + unsigned long m_socks4_dstip; ///< socks4 support #endif #ifdef ENABLE_RESOLVER - int m_resolver_id; ///< Resolver id (if any) for current Open call + int m_resolver_id; ///< Resolver id (if any) for current Open call #endif #ifdef ENABLE_RECONNECT - bool m_b_reconnect; ///< Reconnect on lost connection flag - bool m_b_is_reconnect; ///< Trying to reconnect + bool m_b_reconnect; ///< Reconnect on lost connection flag + bool m_b_is_reconnect; ///< Trying to reconnect #endif }; diff --git a/dep/include/sockets/Thread.h b/dep/include/sockets/Thread.h index d784a1594f6..4e99664d579 100644 --- a/dep/include/sockets/Thread.h +++ b/dep/include/sockets/Thread.h @@ -1,6 +1,6 @@ /** \file Thread.h - ** \date 2004-10-30 - ** \author grymse@alhem.net + ** \date 2004-10-30 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -52,43 +52,43 @@ typedef void * threadparam_t; #endif /** \defgroup threading Threading */ -/** Thread base class. -The Thread class is used by the resolver (ResolvServer) and running a detached socket (SocketThread). -When you know some processing will take a long time and will freeze up a socket, there is always the +/** Thread base class. +The Thread class is used by the resolver (ResolvServer) and running a detached socket (SocketThread). +When you know some processing will take a long time and will freeze up a socket, there is always the possibility to call Detach() on that socket before starting the processing. When the OnDetached() callback is later called the processing can continue, now in its own thread. - \ingroup threading */ + \ingroup threading */ class Thread { public: - Thread(bool release = true); - virtual ~Thread(); + Thread(bool release = true); + virtual ~Thread(); - static threadfunc_t STDPREFIX StartThread(threadparam_t); + static threadfunc_t STDPREFIX StartThread(threadparam_t); - virtual void Run() = 0; + virtual void Run() = 0; - bool IsRunning(); - void SetRunning(bool x); - bool IsReleased(); - void SetRelease(bool x); - bool DeleteOnExit(); - void SetDeleteOnExit(bool x = true); - bool IsDestructor(); + bool IsRunning(); + void SetRunning(bool x); + bool IsReleased(); + void SetRelease(bool x); + bool DeleteOnExit(); + void SetDeleteOnExit(bool x = true); + bool IsDestructor(); private: - Thread(const Thread& ) {} - Thread& operator=(const Thread& ) { return *this; } + Thread(const Thread& ) {} + Thread& operator=(const Thread& ) { return *this; } #ifdef _WIN32 - HANDLE m_thread; - unsigned m_dwThreadId; + HANDLE m_thread; + unsigned m_dwThreadId; #else - pthread_t m_thread; + pthread_t m_thread; #endif - bool m_running; - bool m_release; - bool m_b_delete_on_exit; - bool m_b_destructor; + bool m_running; + bool m_release; + bool m_b_delete_on_exit; + bool m_b_destructor; }; diff --git a/dep/include/sockets/UdpSocket.h b/dep/include/sockets/UdpSocket.h index d32aabf67aa..86f72e9ca16 100644 --- a/dep/include/sockets/UdpSocket.h +++ b/dep/include/sockets/UdpSocket.h @@ -1,6 +1,6 @@ /** \file UdpSocket.h - ** \date 2004-02-13 - ** \author grymse@alhem.net + ** \date 2004-02-13 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -38,172 +38,172 @@ namespace SOCKETS_NAMESPACE { #endif /** Socket implementation for UDP. - \ingroup basic */ + \ingroup basic */ class UdpSocket : public Socket { public: - /** Constructor. - \param h ISocketHandler reference - \param ibufsz Maximum size of receive message (extra bytes will be truncated) - \param ipv6 'true' if this is an ipv6 socket */ - UdpSocket(ISocketHandler& h,int ibufsz = 16384,bool ipv6 = false, int retries = 0); - ~UdpSocket(); + /** Constructor. + \param h ISocketHandler reference + \param ibufsz Maximum size of receive message (extra bytes will be truncated) + \param ipv6 'true' if this is an ipv6 socket */ + UdpSocket(ISocketHandler& h,int ibufsz = 16384,bool ipv6 = false, int retries = 0); + ~UdpSocket(); - /** Called when incoming data has been received. - \param buf Pointer to data - \param len Length of data - \param sa Pointer to sockaddr struct of sender - \param sa_len Length of sockaddr struct */ - virtual void OnRawData(const char *buf,size_t len,struct sockaddr *sa,socklen_t sa_len); + /** Called when incoming data has been received. + \param buf Pointer to data + \param len Length of data + \param sa Pointer to sockaddr struct of sender + \param sa_len Length of sockaddr struct */ + virtual void OnRawData(const char *buf,size_t len,struct sockaddr *sa,socklen_t sa_len); - /** Called when incoming data has been received and read timestamp is enabled. - \param buf Pointer to data - \param len Length of data - \param sa Pointer to sockaddr struct of sender - \param sa_len Length of sockaddr struct - \param ts Timestamp from message */ - virtual void OnRawData(const char *buf,size_t len,struct sockaddr *sa,socklen_t sa_len,struct timeval *ts); + /** Called when incoming data has been received and read timestamp is enabled. + \param buf Pointer to data + \param len Length of data + \param sa Pointer to sockaddr struct of sender + \param sa_len Length of sockaddr struct + \param ts Timestamp from message */ + virtual void OnRawData(const char *buf,size_t len,struct sockaddr *sa,socklen_t sa_len,struct timeval *ts); - /** To receive incoming data, call Bind to setup an incoming port. - \param port Incoming port number - \param range Port range to try if ports already in use - \return 0 if bind succeeded */ - int Bind(port_t& port,int range = 1); - /** To receive data on a specific interface:port, use this. - \param intf Interface ip/hostname - \param port Port number - \param range Port range - \return 0 if bind succeeded */ - int Bind(const std::string& intf,port_t& port,int range = 1); - /** To receive data on a specific interface:port, use this. - \param a Ip address - \param port Port number - \param range Port range - \return 0 if bind succeeded */ - int Bind(ipaddr_t a,port_t& port,int range = 1); + /** To receive incoming data, call Bind to setup an incoming port. + \param port Incoming port number + \param range Port range to try if ports already in use + \return 0 if bind succeeded */ + int Bind(port_t& port,int range = 1); + /** To receive data on a specific interface:port, use this. + \param intf Interface ip/hostname + \param port Port number + \param range Port range + \return 0 if bind succeeded */ + int Bind(const std::string& intf,port_t& port,int range = 1); + /** To receive data on a specific interface:port, use this. + \param a Ip address + \param port Port number + \param range Port range + \return 0 if bind succeeded */ + int Bind(ipaddr_t a,port_t& port,int range = 1); #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - /** To receive data on a specific interface:port, use this. - \param a Ipv6 address - \param port Port number - \param range Port range - \return 0 if bind succeeded */ - int Bind(in6_addr a,port_t& port,int range = 1); + /** To receive data on a specific interface:port, use this. + \param a Ipv6 address + \param port Port number + \param range Port range + \return 0 if bind succeeded */ + int Bind(in6_addr a,port_t& port,int range = 1); #endif #endif - /** To receive data on a specific interface:port, use this. - \param ad Socket address - \param range Port range - \return 0 if bind succeeded */ - int Bind(SocketAddress& ad,int range = 1); + /** To receive data on a specific interface:port, use this. + \param ad Socket address + \param range Port range + \return 0 if bind succeeded */ + int Bind(SocketAddress& ad,int range = 1); - /** Define remote host. - \param l Address of remote host - \param port Port of remote host - \return true if successful */ - bool Open(ipaddr_t l,port_t port); - /** Define remote host. - \param host Hostname - \param port Port number - \return true if successful */ - bool Open(const std::string& host,port_t port); + /** Define remote host. + \param l Address of remote host + \param port Port of remote host + \return true if successful */ + bool Open(ipaddr_t l,port_t port); + /** Define remote host. + \param host Hostname + \param port Port number + \return true if successful */ + bool Open(const std::string& host,port_t port); #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - /** Define remote host. - \param a Address of remote host, ipv6 - \param port Port of remote host - \return true if successful */ - bool Open(struct in6_addr& a,port_t port); + /** Define remote host. + \param a Address of remote host, ipv6 + \param port Port of remote host + \return true if successful */ + bool Open(struct in6_addr& a,port_t port); #endif #endif - /** Define remote host. - \param ad Socket address - \return true if successful */ - bool Open(SocketAddress& ad); + /** Define remote host. + \param ad Socket address + \return true if successful */ + bool Open(SocketAddress& ad); - /** Send to specified host */ - void SendToBuf(const std::string& ,port_t,const char *data,int len,int flags = 0); - /** Send to specified address */ - void SendToBuf(ipaddr_t,port_t,const char *data,int len,int flags = 0); + /** Send to specified host */ + void SendToBuf(const std::string& ,port_t,const char *data,int len,int flags = 0); + /** Send to specified address */ + void SendToBuf(ipaddr_t,port_t,const char *data,int len,int flags = 0); #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - /** Send to specified ipv6 address */ - void SendToBuf(in6_addr,port_t,const char *data,int len,int flags = 0); + /** Send to specified ipv6 address */ + void SendToBuf(in6_addr,port_t,const char *data,int len,int flags = 0); #endif #endif - /** Send to specified socket address */ - void SendToBuf(SocketAddress& ad,const char *data,int len,int flags = 0); + /** Send to specified socket address */ + void SendToBuf(SocketAddress& ad,const char *data,int len,int flags = 0); - /** Send string to specified host */ - void SendTo(const std::string&,port_t,const std::string&,int flags = 0); - /** Send string to specified address */ - void SendTo(ipaddr_t,port_t,const std::string&,int flags = 0); + /** Send string to specified host */ + void SendTo(const std::string&,port_t,const std::string&,int flags = 0); + /** Send string to specified address */ + void SendTo(ipaddr_t,port_t,const std::string&,int flags = 0); #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - /** Send string to specified ipv6 address */ - void SendTo(in6_addr,port_t,const std::string&,int flags = 0); + /** Send string to specified ipv6 address */ + void SendTo(in6_addr,port_t,const std::string&,int flags = 0); #endif #endif - /** Send string to specified socket address */ - void SendTo(SocketAddress& ad,const std::string&,int flags = 0); + /** Send string to specified socket address */ + void SendTo(SocketAddress& ad,const std::string&,int flags = 0); - /** Send to connected address */ - void SendBuf(const char *data,size_t,int flags = 0); - /** Send string to connected address. */ - void Send(const std::string& ,int flags = 0); + /** Send to connected address */ + void SendBuf(const char *data,size_t,int flags = 0); + /** Send string to connected address. */ + void Send(const std::string& ,int flags = 0); - /** Set broadcast */ - void SetBroadcast(bool b = true); - /** Check broadcast flag. - \return true broadcast is enabled. */ - bool IsBroadcast(); + /** Set broadcast */ + void SetBroadcast(bool b = true); + /** Check broadcast flag. + \return true broadcast is enabled. */ + bool IsBroadcast(); - /** multicast */ - void SetMulticastTTL(int ttl = 1); - int GetMulticastTTL(); - void SetMulticastLoop(bool = true); - bool IsMulticastLoop(); - void AddMulticastMembership(const std::string& group,const std::string& intf = "0.0.0.0",int if_index = 0); - void DropMulticastMembership(const std::string& group,const std::string& intf = "0.0.0.0",int if_index = 0); + /** multicast */ + void SetMulticastTTL(int ttl = 1); + int GetMulticastTTL(); + void SetMulticastLoop(bool = true); + bool IsMulticastLoop(); + void AddMulticastMembership(const std::string& group,const std::string& intf = "0.0.0.0",int if_index = 0); + void DropMulticastMembership(const std::string& group,const std::string& intf = "0.0.0.0",int if_index = 0); #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - /** multicast, ipv6 only */ - void SetMulticastHops(int = -1); - /** multicast, ipv6 only */ - int GetMulticastHops(); + /** multicast, ipv6 only */ + void SetMulticastHops(int = -1); + /** multicast, ipv6 only */ + int GetMulticastHops(); #endif #endif - /** Returns true if Bind succeeded. */ - bool IsBound(); - /** Return Bind port number */ - port_t GetPort(); + /** Returns true if Bind succeeded. */ + bool IsBound(); + /** Return Bind port number */ + port_t GetPort(); - void OnOptions(int,int,int,SOCKET) {} + void OnOptions(int,int,int,SOCKET) {} - int GetLastSizeWritten(); + int GetLastSizeWritten(); - /** Also read timestamp information from incoming message */ - void SetTimestamp(bool = true); + /** Also read timestamp information from incoming message */ + void SetTimestamp(bool = true); protected: - UdpSocket(const UdpSocket& s) : Socket(s) {} - void OnRead(); + UdpSocket(const UdpSocket& s) : Socket(s) {} + void OnRead(); #if defined(LINUX) || defined(MACOSX) - /** This method emulates socket recvfrom, but uses messages so we can get the timestamp */ - int ReadTS(char *ioBuf, int inBufSize, struct sockaddr *from, socklen_t fromlen, struct timeval *ts); + /** This method emulates socket recvfrom, but uses messages so we can get the timestamp */ + int ReadTS(char *ioBuf, int inBufSize, struct sockaddr *from, socklen_t fromlen, struct timeval *ts); #endif private: - UdpSocket& operator=(const UdpSocket& ) { return *this; } - /** create before using sendto methods */ - void CreateConnection(); - char *m_ibuf; ///< Input buffer - int m_ibufsz; ///< Size of input buffer - bool m_bind_ok; ///< Bind completed successfully - port_t m_port; ///< Bind port number - int m_last_size_written; - int m_retries; - bool m_b_read_ts; + UdpSocket& operator=(const UdpSocket& ) { return *this; } + /** create before using sendto methods */ + void CreateConnection(); + char *m_ibuf; ///< Input buffer + int m_ibufsz; ///< Size of input buffer + bool m_bind_ok; ///< Bind completed successfully + port_t m_port; ///< Bind port number + int m_last_size_written; + int m_retries; + bool m_b_read_ts; }; diff --git a/dep/include/sockets/Utility.h b/dep/include/sockets/Utility.h index 0fbccd3dfa3..f940221e5ca 100644 --- a/dep/include/sockets/Utility.h +++ b/dep/include/sockets/Utility.h @@ -1,6 +1,6 @@ /** \file Utility.h - ** \date 2004-02-13 - ** \author grymse@alhem.net + ** \date 2004-02-13 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -46,135 +46,135 @@ namespace SOCKETS_NAMESPACE { class SocketAddress; -/** Conversion utilities. - \ingroup util */ +/** Conversion utilities. + \ingroup util */ class Utility { - /** - The Mersenne Twister - http://www.math.keio.ac.jp/~matumoto/emt.html - */ - class Rng { - public: - Rng(unsigned long seed); + /** + The Mersenne Twister + http://www.math.keio.ac.jp/~matumoto/emt.html + */ + class Rng { + public: + Rng(unsigned long seed); - unsigned long Get(); + unsigned long Get(); - private: - int m_value; - unsigned long m_tmp[TWIST_LEN]; - }; - class ncmap_compare { - public: - bool operator()(const std::string& x, const std::string& y) const { - return strcasecmp(x.c_str(), y.c_str()) < 0; - } - }; + private: + int m_value; + unsigned long m_tmp[TWIST_LEN]; + }; + class ncmap_compare { + public: + bool operator()(const std::string& x, const std::string& y) const { + return strcasecmp(x.c_str(), y.c_str()) < 0; + } + }; public: - template class ncmap : public std::map { - public: - ncmap() {} - }; + template class ncmap : public std::map { + public: + ncmap() {} + }; public: - static std::string base64(const std::string& str_in); - static std::string base64d(const std::string& str_in); - static std::string l2string(long l); - static std::string bigint2string(uint64_t l); - static uint64_t atoi64(const std::string& str); - static unsigned int hex2unsigned(const std::string& str); - static std::string rfc1738_encode(const std::string& src); - static std::string rfc1738_decode(const std::string& src); + static std::string base64(const std::string& str_in); + static std::string base64d(const std::string& str_in); + static std::string l2string(long l); + static std::string bigint2string(uint64_t l); + static uint64_t atoi64(const std::string& str); + static unsigned int hex2unsigned(const std::string& str); + static std::string rfc1738_encode(const std::string& src); + static std::string rfc1738_decode(const std::string& src); - /** Checks whether a string is a valid ipv4/ipv6 ip number. */ - static bool isipv4(const std::string&); - /** Checks whether a string is a valid ipv4/ipv6 ip number. */ - static bool isipv6(const std::string&); + /** Checks whether a string is a valid ipv4/ipv6 ip number. */ + static bool isipv4(const std::string&); + /** Checks whether a string is a valid ipv4/ipv6 ip number. */ + static bool isipv6(const std::string&); - /** Hostname to ip resolution ipv4, not asynchronous. */ - static bool u2ip(const std::string&, ipaddr_t&); - static bool u2ip(const std::string&, struct sockaddr_in& sa, int ai_flags = 0); + /** Hostname to ip resolution ipv4, not asynchronous. */ + static bool u2ip(const std::string&, ipaddr_t&); + static bool u2ip(const std::string&, struct sockaddr_in& sa, int ai_flags = 0); #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - /** Hostname to ip resolution ipv6, not asynchronous. */ - static bool u2ip(const std::string&, struct in6_addr&); - static bool u2ip(const std::string&, struct sockaddr_in6& sa, int ai_flags = 0); + /** Hostname to ip resolution ipv6, not asynchronous. */ + static bool u2ip(const std::string&, struct in6_addr&); + static bool u2ip(const std::string&, struct sockaddr_in6& sa, int ai_flags = 0); #endif #endif - /** Reverse lookup of address to hostname */ - static bool reverse(struct sockaddr *sa, socklen_t sa_len, std::string&, int flags = 0); - static bool reverse(struct sockaddr *sa, socklen_t sa_len, std::string& hostname, std::string& service, int flags = 0); + /** Reverse lookup of address to hostname */ + static bool reverse(struct sockaddr *sa, socklen_t sa_len, std::string&, int flags = 0); + static bool reverse(struct sockaddr *sa, socklen_t sa_len, std::string& hostname, std::string& service, int flags = 0); - static bool u2service(const std::string& name, int& service, int ai_flags = 0); + static bool u2service(const std::string& name, int& service, int ai_flags = 0); - /** Convert binary ip address to string: ipv4. */ - static void l2ip(const ipaddr_t,std::string& ); - static void l2ip(const in_addr&,std::string& ); + /** Convert binary ip address to string: ipv4. */ + static void l2ip(const ipaddr_t,std::string& ); + static void l2ip(const in_addr&,std::string& ); #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - /** Convert binary ip address to string: ipv6. */ - static void l2ip(const struct in6_addr&,std::string& ,bool mixed = false); + /** Convert binary ip address to string: ipv6. */ + static void l2ip(const struct in6_addr&,std::string& ,bool mixed = false); - /** ipv6 address compare. */ - static int in6_addr_compare(in6_addr,in6_addr); + /** ipv6 address compare. */ + static int in6_addr_compare(in6_addr,in6_addr); #endif #endif - /** ResolveLocal (hostname) - call once before calling any GetLocal method. */ - static void ResolveLocal(); - /** Returns local hostname, ResolveLocal must be called once before using. - \sa ResolveLocal */ - static const std::string& GetLocalHostname(); - /** Returns local ip, ResolveLocal must be called once before using. - \sa ResolveLocal */ - static ipaddr_t GetLocalIP(); - /** Returns local ip number as string. - \sa ResolveLocal */ - static const std::string& GetLocalAddress(); + /** ResolveLocal (hostname) - call once before calling any GetLocal method. */ + static void ResolveLocal(); + /** Returns local hostname, ResolveLocal must be called once before using. + \sa ResolveLocal */ + static const std::string& GetLocalHostname(); + /** Returns local ip, ResolveLocal must be called once before using. + \sa ResolveLocal */ + static ipaddr_t GetLocalIP(); + /** Returns local ip number as string. + \sa ResolveLocal */ + static const std::string& GetLocalAddress(); #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - /** Returns local ipv6 ip. - \sa ResolveLocal */ - static const struct in6_addr& GetLocalIP6(); - /** Returns local ipv6 address. - \sa ResolveLocal */ - static const std::string& GetLocalAddress6(); + /** Returns local ipv6 ip. + \sa ResolveLocal */ + static const struct in6_addr& GetLocalIP6(); + /** Returns local ipv6 address. + \sa ResolveLocal */ + static const std::string& GetLocalAddress6(); #endif #endif - /** Set environment variable. - \param var Name of variable to set - \param value Value */ - static void SetEnv(const std::string& var,const std::string& value); - /** Convert sockaddr struct to human readable string. - \param sa Ptr to sockaddr struct */ - static std::string Sa2String(struct sockaddr *sa); + /** Set environment variable. + \param var Name of variable to set + \param value Value */ + static void SetEnv(const std::string& var,const std::string& value); + /** Convert sockaddr struct to human readable string. + \param sa Ptr to sockaddr struct */ + static std::string Sa2String(struct sockaddr *sa); - /** Get current time in sec/microseconds. */ - static void GetTime(struct timeval *); + /** Get current time in sec/microseconds. */ + static void GetTime(struct timeval *); - static std::auto_ptr CreateAddress(struct sockaddr *,socklen_t); + static std::auto_ptr CreateAddress(struct sockaddr *,socklen_t); - static unsigned long ThreadID(); + static unsigned long ThreadID(); - static std::string ToLower(const std::string& str); - static std::string ToUpper(const std::string& str); + static std::string ToLower(const std::string& str); + static std::string ToUpper(const std::string& str); - static std::string ToString(double d); + static std::string ToString(double d); - /** Returns a random 32-bit integer */ - static unsigned long Rnd(); + /** Returns a random 32-bit integer */ + static unsigned long Rnd(); private: - static std::string m_host; ///< local hostname - static ipaddr_t m_ip; ///< local ip address - static std::string m_addr; ///< local ip address in string format + static std::string m_host; ///< local hostname + static ipaddr_t m_ip; ///< local ip address + static std::string m_addr; ///< local ip address in string format #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - static struct in6_addr m_local_ip6; ///< local ipv6 address + static struct in6_addr m_local_ip6; ///< local ipv6 address #endif - static std::string m_local_addr6; ///< local ipv6 address in string format + static std::string m_local_addr6; ///< local ipv6 address in string format #endif - static bool m_local_resolved; ///< ResolveLocal has been called if true + static bool m_local_resolved; ///< ResolveLocal has been called if true }; diff --git a/dep/include/sockets/socket_include.h b/dep/include/sockets/socket_include.h index 34e7a8ca5d1..1edac03be3a 100644 --- a/dep/include/sockets/socket_include.h +++ b/dep/include/sockets/socket_include.h @@ -1,6 +1,6 @@ /** \file socket_include.h - ** \date 2005-04-12 - ** \author grymse@alhem.net + ** \date 2005-04-12 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -60,7 +60,7 @@ typedef unsigned __int64 uint64_t; #endif #endif -#ifndef _WIN32 +#ifndef _WIN32 // ---------------------------------------- // common unix includes / defines #include @@ -108,7 +108,7 @@ namespace SOCKETS_NAMESPACE { // ---------------------------------------- // OS specific adaptions -#ifdef SOLARIS +#ifdef SOLARIS // ---------------------------------------- // Solaris typedef unsigned short port_t; @@ -133,8 +133,8 @@ namespace SOCKETS_NAMESPACE { # define MSG_NOSIGNAL 0 # endif # include -typedef in_addr_t ipaddr_t; -typedef in_port_t port_t; +typedef in_addr_t ipaddr_t; +typedef in_port_t port_t; #ifdef SOCKETS_NAMESPACE namespace SOCKETS_NAMESPACE { #endif @@ -150,14 +150,14 @@ namespace SOCKETS_NAMESPACE { # error FreeBSD versions prior to 400014 does not support ipv6 # endif -#elif defined __NetBSD__ -# if !defined(MSG_NOSIGNAL) -# define MSG_NOSIGNAL 0 -# endif -# include -typedef in_addr_t ipaddr_t; -typedef in_port_t port_t; -#elif defined MACOSX +#elif defined __NetBSD__ +# if !defined(MSG_NOSIGNAL) +# define MSG_NOSIGNAL 0 +# endif +# include +typedef in_addr_t ipaddr_t; +typedef in_port_t port_t; +#elif defined MACOSX // ---------------------------------------- // Mac OS X #include @@ -181,7 +181,7 @@ namespace SOCKETS_NAMESPACE { #define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP #define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP -#elif defined _WIN32 +#elif defined _WIN32 // ---------------------------------------- // Win32 #ifdef _MSC_VER @@ -238,26 +238,26 @@ namespace SOCKETS_NAMESPACE { class WSAInitializer // Winsock Initializer { public: - WSAInitializer() { - if (WSAStartup(0x101,&m_wsadata)) - { - exit(-1); - } - } - ~WSAInitializer() { - WSACleanup(); - } + WSAInitializer() { + if (WSAStartup(0x101,&m_wsadata)) + { + exit(-1); + } + } + ~WSAInitializer() { + WSACleanup(); + } private: - WSADATA m_wsadata; + WSADATA m_wsadata; }; #ifdef SOCKETS_NAMESPACE } #endif -#else +#else // ---------------------------------------- -// LINUX +// LINUX typedef unsigned long ipaddr_t; typedef unsigned short port_t; #ifdef SOCKETS_NAMESPACE @@ -275,8 +275,8 @@ namespace SOCKETS_NAMESPACE { #ifdef SOCKETS_NAMESPACE namespace SOCKETS_NAMESPACE { #endif - /** List type containing file descriptors. */ - typedef std::list socket_v; + /** List type containing file descriptors. */ + typedef std::list socket_v; #ifdef SOCKETS_NAMESPACE diff --git a/dep/include/sockets/sockets-config.h b/dep/include/sockets/sockets-config.h index fffc2bbe7f1..5b1ba2cbcb4 100644 --- a/dep/include/sockets/sockets-config.h +++ b/dep/include/sockets/sockets-config.h @@ -1,7 +1,7 @@ /** - ** \file sockets-config.h - ** \date 2007-04-14 - ** \author grymse@alhem.net + ** \file sockets-config.h + ** \date 2007-04-14 + ** \author grymse@alhem.net **/ /* Copyright (C) 2007 Anders Hedstrom @@ -73,8 +73,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /* Enable TCP reconnect on lost connection. - Socket::OnReconnect - Socket::OnDisconnect + Socket::OnReconnect + Socket::OnDisconnect */ #define ENABLE_RECONNECT diff --git a/dep/include/sqlite/sqlite.h b/dep/include/sqlite/sqlite.h index f9690d0583f..f5a9328886b 100644 --- a/dep/include/sqlite/sqlite.h +++ b/dep/include/sqlite/sqlite.h @@ -59,15 +59,15 @@ extern const char sqlite_encoding[]; typedef struct sqlite sqlite; /* -** A function to open a new sqlite database. +** A function to open a new sqlite database. ** ** If the database does not exist and mode indicates write ** permission, then a new database is created. If the database ** does not exist and mode does not indicate write permission, ** then the open fails, an error message generated (if errmsg!=0) ** and the function returns 0. -** -** If mode does not indicates user write permission, then the +** +** If mode does not indicates user write permission, then the ** database is opened read-only. ** ** The Truth: As currently implemented, all databases are opened @@ -123,7 +123,7 @@ typedef int (*sqlite_callback)(void*,int,char**, char**); ** ** The return value is is SQLITE_OK if there are no errors and ** some other return code if there is an error. The particular -** return value depends on the type of error. +** return value depends on the type of error. ** ** If the query could not be executed because a database file is ** locked or busy, then this function returns SQLITE_BUSY. (This @@ -270,18 +270,18 @@ int sqlite_complete(const char *sql); ** ** The default busy callback is NULL. ** -** Sqlite is re-entrant, so the busy handler may start a new query. +** Sqlite is re-entrant, so the busy handler may start a new query. ** (It is not clear why anyone would every want to do this, but it ** is allowed, in theory.) But the busy handler may not close the -** database. Closing the database from a busy handler will delete -** data structures out from under the executing query and will +** database. Closing the database from a busy handler will delete +** data structures out from under the executing query and will ** probably result in a coredump. */ void sqlite_busy_handler(sqlite*, int(*)(void*,const char*,int), void*); /* ** This routine sets a busy handler that sleeps for a while when a -** table is locked. The handler will sleep multiple times until +** table is locked. The handler will sleep multiple times until ** at least "ms" milleseconds of sleeping have been done. After ** "ms" milleseconds of sleeping, the handler returns 0 which ** causes sqlite_exec() to return SQLITE_BUSY. @@ -296,7 +296,7 @@ void sqlite_busy_timeout(sqlite*, int ms); ** Instead of invoking a user-supplied callback for each row of the ** result, this routine remembers each row of the result in memory ** obtained from malloc(), then returns all of the result after the -** query has finished. +** query has finished. ** ** As an example, suppose the query result where this table: ** @@ -323,11 +323,11 @@ void sqlite_busy_timeout(sqlite*, int ms); ** set to 2. In general, the number of values inserted into azResult ** will be ((*nrow) + 1)*(*ncolumn). ** -** After the calling function has finished using the result, it should -** pass the result data pointer to sqlite_free_table() in order to -** release the memory that was malloc-ed. Because of the way the -** malloc() happens, the calling function must not try to call -** malloc() directly. Only sqlite_free_table() is able to release +** After the calling function has finished using the result, it should +** pass the result data pointer to sqlite_free_table() in order to +** release the memory that was malloc-ed. Because of the way the +** malloc() happens, the calling function must not try to call +** malloc() directly. Only sqlite_free_table() is able to release ** the memory properly and safely. ** ** The return value of this routine is the same as from sqlite_exec(). @@ -349,7 +349,7 @@ void sqlite_free_table(char **result); /* ** The following routines are wrappers around sqlite_exec() and ** sqlite_get_table(). The only difference between the routines that -** follow and the originals is that the second argument to the +** follow and the originals is that the second argument to the ** routines that follow is really a printf()-style format ** string describing the SQL to be executed. Arguments to the format ** string appear at the end of the argument list. @@ -381,7 +381,7 @@ void sqlite_free_table(char **result); ** INSERT INTO table1 VALUES('It's a happy day!'); ** ** This second example is an SQL syntax error. As a general rule you -** should always use %q instead of %s when inserting text into a string +** should always use %q instead of %s when inserting text into a string ** literal. */ int sqlite_exec_printf( @@ -553,7 +553,7 @@ int sqlite_set_authorizer( ** codes is used as the second parameter. The 5th parameter is the name ** of the database ("main", "temp", etc.) if applicable. The 6th parameter ** is the name of the inner-most trigger or view that is responsible for -** the access attempt or NULL if this access attempt is directly from +** the access attempt or NULL if this access attempt is directly from ** input SQL code. ** ** Arg-3 Arg-4 @@ -602,7 +602,7 @@ int sqlite_set_authorizer( void *sqlite_trace(sqlite*, void(*xTrace)(void*,const char*), void*); /*** The Callback-Free API -** +** ** The following routines implement a new way to access SQLite that does not ** involve the use of callbacks. ** @@ -767,18 +767,18 @@ int sqlite_bind(sqlite_vm*, int idx, const char *value, int len, int copy); ** argument to this function is a void pointer passed to the progress callback ** function each time it is invoked. ** -** If a call to sqlite_exec(), sqlite_step() or sqlite_get_table() results +** If a call to sqlite_exec(), sqlite_step() or sqlite_get_table() results ** in less than N opcodes being executed, then the progress callback is not ** invoked. -** +** ** Calling this routine overwrites any previously installed progress callback. ** To remove the progress callback altogether, pass NULL as the third ** argument to this function. ** -** If the progress callback returns a result other than 0, then the current +** If the progress callback returns a result other than 0, then the current ** query is immediately terminated and any database changes rolled back. If the ** query was part of a larger transaction, then the transaction is not rolled -** back and remains active. The sqlite_exec() call returns SQLITE_ABORT. +** back and remains active. The sqlite_exec() call returns SQLITE_ABORT. ** ******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ****** */ diff --git a/dep/include/utf8cpp/utf8/checked.h b/dep/include/utf8cpp/utf8/checked.h index 5670c196d5e..2807aac0559 100644 --- a/dep/include/utf8cpp/utf8/checked.h +++ b/dep/include/utf8cpp/utf8/checked.h @@ -64,7 +64,7 @@ namespace utf8 }; /// The library API - functions intended to be called by the users - + template output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out, uint32_t replacement) { @@ -92,7 +92,7 @@ namespace utf8 ++start; break; } - } + } return out; } @@ -106,11 +106,11 @@ namespace utf8 template octet_iterator append(uint32_t cp, octet_iterator result) { - if (!internal::is_code_point_valid(cp)) + if (!internal::is_code_point_valid(cp)) throw invalid_code_point(cp); if (cp < 0x80) // one octet - *(result++) = static_cast(cp); + *(result++) = static_cast(cp); else if (cp < 0x800) { // two octets *(result++) = static_cast((cp >> 6) | 0xc0); *(result++) = static_cast((cp & 0x3f) | 0x80); @@ -149,7 +149,7 @@ namespace utf8 case internal::INVALID_CODE_POINT : throw invalid_code_point(cp); } - return cp; + return cp; } template @@ -162,7 +162,7 @@ namespace utf8 uint32_t prior(octet_iterator& it, octet_iterator start) { octet_iterator end = it; - while (internal::is_trail(*(--it))) + while (internal::is_trail(*(--it))) if (it < start) throw invalid_utf8(*it); // error - no lead byte in the sequence octet_iterator temp = it; @@ -174,7 +174,7 @@ namespace utf8 uint32_t previous(octet_iterator& it, octet_iterator pass_start) { octet_iterator end = it; - while (internal::is_trail(*(--it))) + while (internal::is_trail(*(--it))) if (it == pass_start) throw invalid_utf8(*it); // error - no lead byte in the sequence octet_iterator temp = it; @@ -193,14 +193,14 @@ namespace utf8 distance (octet_iterator first, octet_iterator last) { typename std::iterator_traits::difference_type dist; - for (dist = 0; first < last; ++dist) + for (dist = 0; first < last; ++dist) next(first, last); return dist; } template octet_iterator utf16to8 (u16bit_iterator start, u16bit_iterator end, octet_iterator result) - { + { while (start != end) { uint32_t cp = internal::mask16(*start++); // Take care of surrogate pairs first @@ -208,17 +208,17 @@ namespace utf8 if (start != end) { uint32_t trail_surrogate = internal::mask16(*start++); if (trail_surrogate >= internal::TRAIL_SURROGATE_MIN && trail_surrogate <= internal::TRAIL_SURROGATE_MAX) - cp = (cp << 10) + trail_surrogate + internal::SURROGATE_OFFSET; - else + cp = (cp << 10) + trail_surrogate + internal::SURROGATE_OFFSET; + else throw invalid_utf16(static_cast(trail_surrogate)); } - else + else throw invalid_utf16(static_cast(*start)); - + } result = append(cp, result); } - return result; + return result; } template @@ -256,13 +256,13 @@ namespace utf8 // The iterator class template - class iterator : public std::iterator { + class iterator : public std::iterator { octet_iterator it; octet_iterator range_start; octet_iterator range_end; public: iterator () {}; - explicit iterator (const octet_iterator& octet_it, + explicit iterator (const octet_iterator& octet_it, const octet_iterator& range_start, const octet_iterator& range_end) : it(octet_it), range_start(range_start), range_end(range_end) @@ -277,8 +277,8 @@ namespace utf8 octet_iterator temp = it; return next(temp, range_end); } - bool operator == (const iterator& rhs) const - { + bool operator == (const iterator& rhs) const + { if (range_start != rhs.range_start || range_end != rhs.range_end) throw std::logic_error("Comparing utf-8 iterators defined with different ranges"); return (it == rhs.it); @@ -287,7 +287,7 @@ namespace utf8 { return !(operator == (rhs)); } - iterator& operator ++ () + iterator& operator ++ () { next(it, range_end); return *this; @@ -297,7 +297,7 @@ namespace utf8 iterator temp = *this; next(it, range_end); return temp; - } + } iterator& operator -- () { prior(it, range_start); diff --git a/dep/include/utf8cpp/utf8/core.h b/dep/include/utf8cpp/utf8/core.h index 669183fd111..6180155d4b8 100644 --- a/dep/include/utf8cpp/utf8/core.h +++ b/dep/include/utf8cpp/utf8/core.h @@ -36,7 +36,7 @@ DEALINGS IN THE SOFTWARE. namespace utf8 { // The typedefs for 8-bit, 16-bit and 32-bit unsigned integers - // You may need to change them to match your system. + // You may need to change them to match your system. // These typedefs have the same names as ones from cstdint, or boost/cstdint /* use Trinity alternatives @@ -50,7 +50,7 @@ namespace utf8 // Helper code - not intended to be directly called by the library users. May be changed at any time namespace internal -{ +{ // Unicode constants // Leading (high) surrogates: 0xd800 - 0xdbff // Trailing (low) surrogates: 0xdc00 - 0xdfff @@ -90,14 +90,14 @@ namespace internal inline bool is_code_point_valid(u32 cp) { return (cp <= CODE_POINT_MAX && !is_surrogate(cp) && cp != 0xfffe && cp != 0xffff); - } + } template inline typename std::iterator_traits::difference_type sequence_length(octet_iterator lead_it) { uint8_t lead = mask8(*lead_it); - if (lead < 0x80) + if (lead < 0x80) return 1; else if ((lead >> 5) == 0x6) return 2; @@ -105,7 +105,7 @@ namespace internal return 3; else if ((lead >> 3) == 0x1e) return 4; - else + else return 0; } @@ -131,17 +131,17 @@ namespace internal return NOT_ENOUGH_ROOM; } - // Do we have enough memory? + // Do we have enough memory? if (std::distance(it, end) < length) return NOT_ENOUGH_ROOM; - + // Check trail octets and calculate the code point switch (length) { case 0: return INVALID_LEAD; break; case 2: - if (is_trail(*(++it))) { + if (is_trail(*(++it))) { cp = ((cp << 6) & 0x7ff) + ((*it) & 0x3f); } else { @@ -167,11 +167,11 @@ namespace internal break; case 4: if (is_trail(*(++it))) { - cp = ((cp << 18) & 0x1fffff) + ((mask8(*it) << 12) & 0x3ffff); + cp = ((cp << 18) & 0x1fffff) + ((mask8(*it) << 12) & 0x3ffff); if (is_trail(*(++it))) { cp += (mask8(*it) << 6) & 0xfff; if (is_trail(*(++it))) { - cp += (*it) & 0x3f; + cp += (*it) & 0x3f; } else { std::advance(it, -3); @@ -191,14 +191,14 @@ namespace internal } // Is the code point valid? if (!is_code_point_valid(cp)) { - for (octet_difference_type i = 0; i < length - 1; ++i) + for (octet_difference_type i = 0; i < length - 1; ++i) --it; return INVALID_CODE_POINT; } - + if (code_point) *code_point = cp; - + if (cp < 0x80) { if (length != 1) { std::advance(it, -(length-1)); @@ -217,9 +217,9 @@ namespace internal return OVERLONG_SEQUENCE; } } - + ++it; - return OK; + return OK; } template @@ -227,12 +227,12 @@ namespace internal return validate_next(it, end, 0); } -} // namespace internal +} // namespace internal /// The library API - functions intended to be called by the users // Byte order mark - const uint8_t bom[] = {0xef, 0xbb, 0xbf}; + const uint8_t bom[] = {0xef, 0xbb, 0xbf}; template octet_iterator find_invalid(octet_iterator start, octet_iterator end) diff --git a/dep/include/utf8cpp/utf8/unchecked.h b/dep/include/utf8cpp/utf8/unchecked.h index 4009cebe6e4..3aa1a5dbd8d 100644 --- a/dep/include/utf8cpp/utf8/unchecked.h +++ b/dep/include/utf8cpp/utf8/unchecked.h @@ -32,13 +32,13 @@ DEALINGS IN THE SOFTWARE. namespace utf8 { - namespace unchecked + namespace unchecked { template octet_iterator append(uint32_t cp, octet_iterator result) { if (cp < 0x80) // one octet - *(result++) = static_cast(cp); + *(result++) = static_cast(cp); else if (cp < 0x800) { // two octets *(result++) = static_cast((cp >> 6) | 0xc0); *(result++) = static_cast((cp & 0x3f) | 0x80); @@ -70,28 +70,28 @@ namespace utf8 cp = ((cp << 6) & 0x7ff) + ((*it) & 0x3f); break; case 3: - ++it; + ++it; cp = ((cp << 12) & 0xffff) + ((internal::mask8(*it) << 6) & 0xfff); ++it; cp += (*it) & 0x3f; break; case 4: ++it; - cp = ((cp << 18) & 0x1fffff) + ((internal::mask8(*it) << 12) & 0x3ffff); + cp = ((cp << 18) & 0x1fffff) + ((internal::mask8(*it) << 12) & 0x3ffff); ++it; cp += (internal::mask8(*it) << 6) & 0xfff; ++it; - cp += (*it) & 0x3f; + cp += (*it) & 0x3f; break; } ++it; - return cp; + return cp; } template uint32_t peek_next(octet_iterator it) { - return next(it); + return next(it); } template @@ -121,14 +121,14 @@ namespace utf8 distance (octet_iterator first, octet_iterator last) { typename std::iterator_traits::difference_type dist; - for (dist = 0; first < last; ++dist) + for (dist = 0; first < last; ++dist) next(first); return dist; } template octet_iterator utf16to8 (u16bit_iterator start, u16bit_iterator end, octet_iterator result) - { + { while (start != end) { uint32_t cp = internal::mask16(*start++); // Take care of surrogate pairs first @@ -138,7 +138,7 @@ namespace utf8 } result = append(cp, result); } - return result; + return result; } template @@ -176,7 +176,7 @@ namespace utf8 // The iterator class template - class iterator : public std::iterator { + class iterator : public std::iterator { octet_iterator it; public: iterator () {}; @@ -188,15 +188,15 @@ namespace utf8 octet_iterator temp = it; return next(temp); } - bool operator == (const iterator& rhs) const - { + bool operator == (const iterator& rhs) const + { return (it == rhs.it); } bool operator != (const iterator& rhs) const { return !(operator == (rhs)); } - iterator& operator ++ () + iterator& operator ++ () { std::advance(it, internal::sequence_length(it)); return *this; @@ -206,7 +206,7 @@ namespace utf8 iterator temp = *this; std::advance(it, internal::sequence_length(it)); return temp; - } + } iterator& operator -- () { prior(it); @@ -221,7 +221,7 @@ namespace utf8 }; // class iterator } // namespace utf8::unchecked -} // namespace utf8 +} // namespace utf8 #endif // header guard diff --git a/dep/include/zthread/AtomicCount.h b/dep/include/zthread/AtomicCount.h index ea042a7feb2..38e67dc0d0b 100644 --- a/dep/include/zthread/AtomicCount.h +++ b/dep/include/zthread/AtomicCount.h @@ -33,7 +33,7 @@ namespace ZThread { /** * @class AtomicCount * @author Eric Crahen - * @date <2003-07-16T09:41:55-0400> + * @date <2003-07-16T09:41:55-0400> * @version 2.3.0 * * This class provides an interface to a small integer whose value can be @@ -42,33 +42,33 @@ namespace ZThread { * counts. */ class ZTHREAD_API AtomicCount : public NonCopyable { - + void* _value; - + public: - + //! Create a new AtomicCount, initialized to a value of 1 AtomicCount(); //! Destroy a new AtomicCount ~AtomicCount(); - + //! Postfix decrement and return the current value size_t operator--(int); - + //! Postfix increment and return the current value - size_t operator++(int); + size_t operator++(int); //! Prefix decrement and return the current value size_t operator--(); - + //! Prefix increment and return the current value - size_t operator++(); + size_t operator++(); }; /* AtomicCount */ - + } // namespace ZThread #endif // __ZTATOMICCOUNT_H__ diff --git a/dep/include/zthread/Barrier.h b/dep/include/zthread/Barrier.h index 6aaafa93678..ec0d9fc8bb8 100644 --- a/dep/include/zthread/Barrier.h +++ b/dep/include/zthread/Barrier.h @@ -33,25 +33,25 @@ namespace ZThread { /** * @class Barrier * @author Eric Crahen - * @date <2003-07-16T09:54:01-0400> + * @date <2003-07-16T09:54:01-0400> * @version 2.2.1 * - * A Barrier is a Waitable object that serves as synchronization points for + * A Barrier is a Waitable object that serves as synchronization points for * a set of threads. A Barrier is constructed for a fixed number (N) of threads. * Threads attempting to wait() on a Barrier ( 1 - N) will block until the Nth * thread arrives. The Nth thread will awaken all the the others. - * + * * An optional Runnable command may be associated with the Barrier. This will be run() * when the Nth thread arrives and Barrier is not broken. * * Error Checking * - * A Barrier uses an all-or-nothing. All threads involved must successfully - * meet at Barrier. If any one of those threads leaves before all the threads - * have (as the result of an error or exception) then all threads present at + * A Barrier uses an all-or-nothing. All threads involved must successfully + * meet at Barrier. If any one of those threads leaves before all the threads + * have (as the result of an error or exception) then all threads present at * the Barrier will throw BrokenBarrier_Exception. * - * A broken Barrier will cause all threads attempting to wait() on it to + * A broken Barrier will cause all threads attempting to wait() on it to * throw a BrokenBarrier_Exception. * * A Barrier will remain 'broken', until it is manually reset(). @@ -77,7 +77,7 @@ namespace ZThread { public: //! Create a Barrier - Barrier() + Barrier() : _broken(false), _haveTask(false), _count(Count), _generation(0), _arrived(_lock), _task(0) { } /** @@ -86,8 +86,8 @@ namespace ZThread { * * @param task Task to associate with this Barrier */ - Barrier(const Task& task) - : _broken(false), _haveTask(true), _count(Count), _generation(0), _arrived(_lock), + Barrier(const Task& task) + : _broken(false), _haveTask(true), _count(Count), _generation(0), _arrived(_lock), _task(task) { } //! Destroy this Barrier @@ -97,7 +97,7 @@ namespace ZThread { * Enter barrier and wait for the other threads to arrive. This can block for an indefinite * amount of time. * - * @exception BrokenBarrier_Exception thrown when any thread has left a wait on this + * @exception BrokenBarrier_Exception thrown when any thread has left a wait on this * Barrier as a result of an error. * @exception Interrupted_Exception thrown when the calling thread is interrupted. * A thread may be interrupted at any time, prematurely ending a wait @@ -111,13 +111,13 @@ namespace ZThread { virtual void wait() { Guard g(_lock); - - if(_broken) + + if(_broken) throw BrokenBarrier_Exception(); // Break the barrier if an arriving thread is interrupted if(Thread::interrupted()) { - + // Release the other waiter, propagate the exception _arrived.broadcast(); _broken = true; @@ -125,14 +125,14 @@ namespace ZThread { throw Interrupted_Exception(); } - + if(--_count == 0) { - - // Wake the other threads if this was the last + + // Wake the other threads if this was the last // arriving thread _arrived.broadcast(); - - // Try to run the associated task, if it throws then + + // Try to run the associated task, if it throws then // break the barrier and propagate the exception try { @@ -159,8 +159,8 @@ namespace ZThread { } catch(Interrupted_Exception&) { - // Its possible for a thread to be interrupted before the - // last thread arrives. If the interrupted thread hasn't + // Its possible for a thread to be interrupted before the + // last thread arrives. If the interrupted thread hasn't // resumed, then just propagate the interruption if(myGeneration != _generation) @@ -175,13 +175,13 @@ namespace ZThread { throw; } - + // If the thread woke because it was notified by the thread // that broke the barrier, throw. - if(_broken) + if(_broken) throw BrokenBarrier_Exception(); - - } + + } } @@ -190,14 +190,14 @@ namespace ZThread { * amount of time specified with the timeout parameter. The barrier will not break * if a thread leaves this function due to a timeout. * - * @param timeout maximum amount of time, in milliseconds, to wait before + * @param timeout maximum amount of time, in milliseconds, to wait before * - * @return - * - true if the set of tasks being wait for complete before + * @return + * - true if the set of tasks being wait for complete before * timeout milliseconds elapse. * - false otherwise. * - * @exception BrokenBarrier_Exception thrown when any thread has left a wait on this + * @exception BrokenBarrier_Exception thrown when any thread has left a wait on this * Barrier as a result of an error. * @exception Interrupted_Exception thrown when the calling thread is interrupted. * A thread may be interrupted at any time, prematurely ending a wait @@ -211,13 +211,13 @@ namespace ZThread { virtual bool wait(unsigned long timeout) { Guard g(_lock); - - if(_broken) + + if(_broken) throw BrokenBarrier_Exception(); // Break the barrier if an arriving thread is interrupted if(Thread::interrupted()) { - + // Release the other waiter, propagate the exception _arrived.broadcast(); _broken = true; @@ -226,14 +226,14 @@ namespace ZThread { } - + if(--_count == 0) { - - // Wake the other threads if this was the last + + // Wake the other threads if this was the last // arriving thread _arrived.broadcast(); - - // Try to run the associated task, if it throws then + + // Try to run the associated task, if it throws then // break the barrier and propagate the exception try { @@ -261,8 +261,8 @@ namespace ZThread { } catch(Interrupted_Exception&) { - // Its possible for a thread to be interrupted before the - // last thread arrives. If the interrupted thread hasn't + // Its possible for a thread to be interrupted before the + // last thread arrives. If the interrupted thread hasn't // resumed, then just propagate the interruption if(myGeneration != _generation) @@ -277,13 +277,13 @@ namespace ZThread { throw; } - + // If the thread woke because it was notified by the thread // that broke the barrier, throw. - if(_broken) + if(_broken) throw BrokenBarrier_Exception(); - - } + + } return true; @@ -293,12 +293,12 @@ namespace ZThread { * Break the Barrier ending the wait for any threads that were waiting on * the barrier. * - * @post the Barrier is broken, all waiting threads will throw the + * @post the Barrier is broken, all waiting threads will throw the * BrokenBarrier_Exception */ void shatter() { - - Guard g(_lock); + + Guard g(_lock); _broken = true; _arrived.broadcast(); @@ -306,23 +306,23 @@ namespace ZThread { } /** - * Reset the Barrier. + * Reset the Barrier. * * @post the Barrier is no longer Broken and can be used again. */ void reset() { - - Guard g(_lock); + + Guard g(_lock); _broken = false; _generation++; _count = Count; - + } }; - + } // namespace ZThread #endif // __ZTBARRIER_H__ diff --git a/dep/include/zthread/BiasedReadWriteLock.h b/dep/include/zthread/BiasedReadWriteLock.h index b1de74292cf..1fcff74e032 100644 --- a/dep/include/zthread/BiasedReadWriteLock.h +++ b/dep/include/zthread/BiasedReadWriteLock.h @@ -36,21 +36,21 @@ namespace ZThread { * @author Eric Crahen * @date <2003-07-16T10:22:34-0400> * @version 2.2.7 - * - * A BiasedReadWriteLock has a bias toward writers. It will prefer read-write access over + * + * A BiasedReadWriteLock has a bias toward writers. It will prefer read-write access over * read-only access when many threads are contending for access to either Lockable this * ReadWriteLock provides. * - * @see ReadWriteLock + * @see ReadWriteLock */ class BiasedReadWriteLock : public ReadWriteLock { FastMutex _lock; Condition _condRead; Condition _condWrite; - + volatile int _activeWriters; - volatile int _activeReaders; + volatile int _activeReaders; volatile int _waitingReaders; volatile int _waitingWriters; @@ -70,7 +70,7 @@ namespace ZThread { _rwlock.beforeRead(); } - virtual bool tryAcquire(unsigned long timeout) { + virtual bool tryAcquire(unsigned long timeout) { return _rwlock.beforeReadAttempt(timeout); } @@ -96,7 +96,7 @@ namespace ZThread { _rwlock.beforeWrite(); } - virtual bool tryAcquire(unsigned long timeout) { + virtual bool tryAcquire(unsigned long timeout) { return _rwlock.beforeWriteAttempt(timeout); } @@ -113,18 +113,18 @@ namespace ZThread { WriteLock _wlock; public: - + /** * Create a BiasedReadWriteLock * - * @exception Initialization_Exception thrown if resources could not be + * @exception Initialization_Exception thrown if resources could not be * allocated for this object. */ BiasedReadWriteLock() : _condRead(_lock), _condWrite(_lock), _rlock(*this), _wlock(*this) { _activeWriters = 0; _activeReaders = 0; - + _waitingReaders = 0; _waitingWriters = 0; @@ -143,64 +143,64 @@ namespace ZThread { */ virtual Lockable& getWriteLock() { return _wlock; } - + protected: void beforeRead() { - - Guard guard(_lock); - - ++_waitingReaders; - + + Guard guard(_lock); + + ++_waitingReaders; + while(!allowReader()) { - + try { - + // wait _condRead.wait(); - + } catch(...) { - - --_waitingReaders; + + --_waitingReaders; throw; } - + } - + --_waitingReaders; ++_activeReaders; - + } bool beforeReadAttempt(unsigned long timeout) { - - Guard guard(_lock); + + Guard guard(_lock); bool result = false; - ++_waitingReaders; + ++_waitingReaders; while(!allowReader()) { - + try { - + result = _condRead.wait(timeout); - + } catch(...) { - - --_waitingReaders; + + --_waitingReaders; throw; } } - + --_waitingReaders; ++_activeReaders; return result; - } - + } + void afterRead() { @@ -210,7 +210,7 @@ namespace ZThread { { Guard guard(_lock); - + --_activeReaders; wakeReader = (_waitingReaders > 0); @@ -220,62 +220,62 @@ namespace ZThread { if(wakeWriter) _condWrite.signal(); - + else if(wakeReader) _condRead.signal(); } void beforeWrite() { - + Guard guard(_lock); - + ++_waitingWriters; while(!allowWriter()) { - + try { _condWrite.wait(); - + } catch(...) { --_waitingWriters; throw; } - + } - + --_waitingWriters; - ++_activeWriters; + ++_activeWriters; } bool beforeWriteAttempt(unsigned long timeout) { - + Guard guard(_lock); bool result = false; ++_waitingWriters; while(!allowWriter()) { - + try { result = _condWrite.wait(timeout); - + } catch(...) { --_waitingWriters; throw; } - + } - + --_waitingWriters; ++_activeWriters; - + return result; } @@ -288,9 +288,9 @@ namespace ZThread { { Guard guard(_lock); - + --_activeWriters; - + wakeReader = (_waitingReaders > 0); wakeWriter = (_waitingWriters > 0); @@ -298,14 +298,14 @@ namespace ZThread { if(wakeWriter) _condWrite.signal(); - + else if(wakeReader) _condRead.signal(); - + } bool allowReader() { - return (_activeWriters == 0); + return (_activeWriters == 0); } bool allowWriter() { diff --git a/dep/include/zthread/BlockingQueue.h b/dep/include/zthread/BlockingQueue.h index ac17347d1cc..da0b701a825 100644 --- a/dep/include/zthread/BlockingQueue.h +++ b/dep/include/zthread/BlockingQueue.h @@ -30,14 +30,14 @@ #include namespace ZThread { - + /** * @class BlockingQueue * @author Eric Crahen * @date <2003-07-16T12:01:43-0400> * @version 2.3.0 * - * Like a LockedQueue, a BlockingQueue is a Queue implementation that provides + * Like a LockedQueue, a BlockingQueue is a Queue implementation that provides * serialized access to the items added to it. It differs by causing threads * accessing the next() methods to block until a value becomes available. */ @@ -70,12 +70,12 @@ namespace ZThread { virtual void add(const T& item) { Guard g(_lock); - + if(_canceled) throw Cancellation_Exception(); - + _queue.push_back(item); - + _notEmpty.signal(); } @@ -88,17 +88,17 @@ namespace ZThread { try { Guard g(_lock, timeout); - + if(_canceled) throw Cancellation_Exception(); - + _queue.push_back(item); _notEmpty.signal(); } catch(Timeout_Exception&) { return false; } - - return true; + + return true; } @@ -106,7 +106,7 @@ namespace ZThread { * Get a value from this Queue. The calling thread may block indefinitely. * * @return T next available value - * + * * @exception Cancellation_Exception thrown if this Queue has been canceled. * * @exception Interrupted_Exception thrown if the calling thread is interrupted @@ -126,10 +126,10 @@ namespace ZThread { if( _queue.empty() ) throw Cancellation_Exception(); - + T item = _queue.front(); _queue.pop_front(); - + return item; } @@ -142,7 +142,7 @@ namespace ZThread { * the calling thread. * * @return T next available value - * + * * @exception Cancellation_Exception thrown if this Queue has been canceled. * @exception Timeout_Exception thrown if the timeout expires before a value * can be retrieved. @@ -165,10 +165,10 @@ namespace ZThread { if(_queue.empty() ) throw Cancellation_Exception(); - + T item = _queue.front(); _queue.pop_front(); - + return item; } @@ -177,7 +177,7 @@ namespace ZThread { /** * @see Queue::cancel() * - * @post If threads are blocked on one of the next() functions then + * @post If threads are blocked on one of the next() functions then * they will be awakened with a Cancellation_Exception. */ virtual void cancel() { @@ -197,7 +197,7 @@ namespace ZThread { // Faster check since the queue will not become un-canceled if(_canceled) return true; - + Guard g(_lock); return _canceled; diff --git a/dep/include/zthread/BoundedQueue.h b/dep/include/zthread/BoundedQueue.h index 2b3a616f1fb..528e6d869d0 100644 --- a/dep/include/zthread/BoundedQueue.h +++ b/dep/include/zthread/BoundedQueue.h @@ -41,10 +41,10 @@ namespace ZThread { * A BoundedQueue provides serialized access to a set of values. It differs from other * Queues by adding a maximum capacity, giving it the following properties: * - * - Threads calling the empty() methods will be blocked until the BoundedQueue becomes empty. + * - Threads calling the empty() methods will be blocked until the BoundedQueue becomes empty. * - Threads calling the next() methods will be blocked until the BoundedQueue has a value to - * return. - * - Threads calling the add() methods will be blocked until the number of values in the + * return. + * - Threads calling the add() methods will be blocked until the number of values in the * Queue drops below the maximum capacity. * * @see Queue @@ -76,36 +76,36 @@ namespace ZThread { public: /** - * Create a BoundedQueue with the given capacity. - * + * Create a BoundedQueue with the given capacity. + * * @param capacity maximum number of values to allow in the Queue at * at any time */ BoundedQueue(size_t capacity) - : _notFull(_lock), _notEmpty(_lock), _isEmpty(_lock), + : _notFull(_lock), _notEmpty(_lock), _isEmpty(_lock), _capacity(capacity), _canceled(false) {} - + //! Destroy this Queue virtual ~BoundedQueue() { } - + /** - * Get the maximum capacity of this Queue. + * Get the maximum capacity of this Queue. * * @return size_t maximum capacity */ - size_t capacity() { - return _capacity; + size_t capacity() { + return _capacity; } /** - * Add a value to this Queue. + * Add a value to this Queue. * - * If the number of values in the queue matches the value returned by capacity() - * then the calling thread will be blocked until at least one value is removed from + * If the number of values in the queue matches the value returned by capacity() + * then the calling thread will be blocked until at least one value is removed from * the Queue. * * @param item value to be added to the Queue - * + * * @exception Cancellation_Exception thrown if this Queue has been canceled. * @exception Interrupted_Exception thrown if the thread was interrupted while waiting * to add a value @@ -116,35 +116,35 @@ namespace ZThread { * @see Queue::add(const T& item) */ virtual void add(const T& item) { - + Guard g(_lock); - - // Wait for the capacity of the Queue to drop + + // Wait for the capacity of the Queue to drop while ((_queue.size() == _capacity) && !_canceled) _notFull.wait(); - + if(_canceled) throw Cancellation_Exception(); _queue.push_back(item); _notEmpty.signal(); // Wake any waiters - - + + } - + /** - * Add a value to this Queue. + * Add a value to this Queue. * - * If the number of values in the queue matches the value returned by capacity() - * then the calling thread will be blocked until at least one value is removed from + * If the number of values in the queue matches the value returned by capacity() + * then the calling thread will be blocked until at least one value is removed from * the Queue. * * @param item value to be added to the Queue * @param timeout maximum amount of time (milliseconds) this method may block * the calling thread. * - * @return - * - true if a copy of item can be added before timeout + * @return + * - true if a copy of item can be added before timeout * milliseconds elapse. * - false otherwise. * @@ -158,24 +158,24 @@ namespace ZThread { * @see Queue::add(const T& item, unsigned long timeout) */ virtual bool add(const T& item, unsigned long timeout) { - + try { Guard g(_lock, timeout); - - // Wait for the capacity of the Queue to drop + + // Wait for the capacity of the Queue to drop while ((_queue.size() == _capacity) && !_canceled) if(!_notFull.wait(timeout)) return false; - + if(_canceled) throw Cancellation_Exception(); - + _queue.push_back(item); _notEmpty.signal(); // Wake any waiters - + } catch(Timeout_Exception&) { return false; } - + return true; } @@ -183,11 +183,11 @@ namespace ZThread { /** * Retrieve and remove a value from this Queue. * - * If invoked when there are no values present to return then the calling thread + * If invoked when there are no values present to return then the calling thread * will be blocked until a value arrives in the Queue. * * @return T next available value - * + * * @exception Cancellation_Exception thrown if this Queue has been canceled. * @exception Interrupted_Exception thrown if the thread was interrupted while waiting * to retrieve a value @@ -196,18 +196,18 @@ namespace ZThread { * @post The value returned will have been removed from the Queue. */ virtual T next() { - + Guard g(_lock); - + while ( _queue.empty() && !_canceled) _notEmpty.wait(); - + if( _queue.empty()) // Queue canceled - throw Cancellation_Exception(); + throw Cancellation_Exception(); T item = _queue.front(); _queue.pop_front(); - + _notFull.signal(); // Wake any thread trying to add if(_queue.empty()) // Wake empty waiters @@ -220,14 +220,14 @@ namespace ZThread { /** * Retrieve and remove a value from this Queue. * - * If invoked when there are no values present to return then the calling thread + * If invoked when there are no values present to return then the calling thread * will be blocked until a value arrives in the Queue. * * @param timeout maximum amount of time (milliseconds) this method may block * the calling thread. * * @return T next available value - * + * * @exception Cancellation_Exception thrown if this Queue has been canceled. * @exception Timeout_Exception thrown if the timeout expires before a value * can be retrieved. @@ -236,9 +236,9 @@ namespace ZThread { * @post The value returned will have been removed from the Queue. */ virtual T next(unsigned long timeout) { - + Guard g(_lock, timeout); - + // Wait for items to be added while (_queue.empty() && !_canceled) { if(!_notEmpty.wait(timeout)) @@ -246,7 +246,7 @@ namespace ZThread { } if(_queue.empty()) // Queue canceled - throw Cancellation_Exception(); + throw Cancellation_Exception(); T item = _queue.front(); _queue.pop_front(); @@ -255,21 +255,21 @@ namespace ZThread { if(_queue.empty()) // Wake empty() waiters _isEmpty.broadcast(); - + return item; - + } /** - * Cancel this queue. - * + * Cancel this queue. + * * @post Any threads blocked by an add() function will throw a Cancellation_Exception. * @post Any threads blocked by a next() function will throw a Cancellation_Exception. - * + * * @see Queue::cancel() */ virtual void cancel() { - + Guard g(_lock); _canceled = true; @@ -285,7 +285,7 @@ namespace ZThread { // Faster check since the Queue will not become un-canceled if(_canceled) return true; - + Guard g(_lock); return _canceled; @@ -296,7 +296,7 @@ namespace ZThread { * @see Queue::size() */ virtual size_t size() { - + Guard g(_lock); return _queue.size(); @@ -315,10 +315,10 @@ namespace ZThread { /** * Test whether any values are available in this Queue. * - * The calling thread is blocked until there are no values present + * The calling thread is blocked until there are no values present * in the Queue. - * - * @return + * + * @return * - true if there are no values available. * - false if there are values available. * @@ -330,7 +330,7 @@ namespace ZThread { while(!_queue.empty()) // Wait for an empty signal _isEmpty.wait(); - + return true; @@ -340,13 +340,13 @@ namespace ZThread { /** * Test whether any values are available in this Queue. * - * The calling thread is blocked until there are no values present + * The calling thread is blocked until there are no values present * in the Queue. - * + * * @param timeout maximum amount of time (milliseconds) this method may block * the calling thread. * - * @return + * @return * - true if there are no values available. * - false if there are values available. * @@ -361,7 +361,7 @@ namespace ZThread { while(!_queue.empty()) // Wait for an empty signal _isEmpty.wait(timeout); - + return true; } diff --git a/dep/include/zthread/Cancelable.h b/dep/include/zthread/Cancelable.h index 9151ec8dd03..8d1cae526c3 100644 --- a/dep/include/zthread/Cancelable.h +++ b/dep/include/zthread/Cancelable.h @@ -36,20 +36,20 @@ namespace ZThread { * * The Cancelable interface defines a common method of adding general disable-and-exit * semantics to some object. By cancel()ing a Cancelable object, a request is - * made to disable that object. + * made to disable that object. * * Disabling * * A cancel()ed object may not necessarily abort it work immediately. Often, it much more - * elegant for a cancel()ed object to complete handling whatever responsibilities have - * been assigned to it, but it will not take on any new responsibility. + * elegant for a cancel()ed object to complete handling whatever responsibilities have + * been assigned to it, but it will not take on any new responsibility. * * Exiting * * A cancel()ed should complete its responsibilities as soon as possible. * Canceling is not only a request to stop taking on new responsibility, and to - * complete its current responsibility. Its also a request to complete dealing with its - * current responsibilities, quickly when possible. + * complete its current responsibility. Its also a request to complete dealing with its + * current responsibilities, quickly when possible. */ class Cancelable { public: @@ -58,21 +58,21 @@ namespace ZThread { virtual ~Cancelable() {} /** - * Canceling a Cancelable object makes a request to disable that object. - * This entails refusing to take on any new responsibility, and completing + * Canceling a Cancelable object makes a request to disable that object. + * This entails refusing to take on any new responsibility, and completing * its current responsibilities quickly. * * Canceling an object more than once has no effect. - * - * @post The Cancelable object will have permanently transitioned to a - * disabled state; it will now refuse to accept new responsibility. + * + * @post The Cancelable object will have permanently transitioned to a + * disabled state; it will now refuse to accept new responsibility. */ virtual void cancel() = 0; /** * Determine if a Cancelable object has been canceled. * - * @return + * @return * - true if cancel() was called prior to this function. * - false otherwise. */ diff --git a/dep/include/zthread/ClassLockable.h b/dep/include/zthread/ClassLockable.h index a10fb4932a2..7c1eb0b5059 100644 --- a/dep/include/zthread/ClassLockable.h +++ b/dep/include/zthread/ClassLockable.h @@ -26,7 +26,7 @@ #include "zthread/CountedPtr.h" #include "zthread/Mutex.h" -namespace ZThread { +namespace ZThread { /** * @class ClassLockable @@ -43,25 +43,25 @@ namespace ZThread { static CountedPtr _instance; CountedPtr _lock; - public: - + public: + //! Create a ClassLockable - ClassLockable() - : _lock(_instance) {} - + ClassLockable() + : _lock(_instance) {} + //! acquire() the ClassLockable - virtual void acquire() { - _lock->acquire(); + virtual void acquire() { + _lock->acquire(); } //! tryAcquire() the ClassLockable virtual bool tryAcquire(unsigned long timeout) { - return _lock->tryAcquire(timeout); + return _lock->tryAcquire(timeout); } //! release() the ClassLockable virtual void release() { - _lock->release(); + _lock->release(); } }; diff --git a/dep/include/zthread/ConcurrentExecutor.h b/dep/include/zthread/ConcurrentExecutor.h index 199fe306e08..ccfd4a7ab67 100644 --- a/dep/include/zthread/ConcurrentExecutor.h +++ b/dep/include/zthread/ConcurrentExecutor.h @@ -35,7 +35,7 @@ namespace ZThread { * @version 2.3.0 * * A ConcurrentExecutor spawns a single thread to service a series of Tasks. - * + * * @see PoolExecutor. */ class ConcurrentExecutor : public Executor { @@ -43,20 +43,20 @@ namespace ZThread { PoolExecutor _executor; public: - + //! Create a ConcurrentExecutor - ConcurrentExecutor(); + ConcurrentExecutor(); /** * Interrupting a ConcurrentExecutor will cause the thread running the tasks to be - * be interrupted once during the execution of each task that has been submitted + * be interrupted once during the execution of each task that has been submitted * at the time this function is called. - * - * Tasks that are submitted after this function is called will + * + * Tasks that are submitted after this function is called will * not be interrupt()ed; unless this function is invoked again(). * * @code - * + * * void aFunction() { * * ConcurrentExecutor executor; @@ -65,60 +65,60 @@ namespace ZThread { * for(size_t n = 0; n < p; n++) * executor.execute(new aRunnable); * - * // Tasks [m, p) may be interrupted, where m is the first task that has - * // not completed at the time the interrupt() is invoked. + * // Tasks [m, p) may be interrupted, where m is the first task that has + * // not completed at the time the interrupt() is invoked. * executor.interrupt(); * * // Submit (q - p) Tasks * for(size_t n = p; n < q; n++) * executor.execute(new Chore); - * - * // Tasks [p, q) are not interrupted + * + * // Tasks [p, q) are not interrupted * * } * * @endcode */ virtual void interrupt(); - + /** - * Submit a Task to this Executor. This will not block the current thread - * for very long. The task will be enqueued internally and eventually run - * in the context of the single thread driving all the Tasks submitted to this + * Submit a Task to this Executor. This will not block the current thread + * for very long. The task will be enqueued internally and eventually run + * in the context of the single thread driving all the Tasks submitted to this * Executor. - * + * * @exception Cancellation_Exception thrown if this Executor has been canceled. * The Task being submitted will not be executed by this Executor. * - * @exception Synchronization_Exception thrown only in the event of an error + * @exception Synchronization_Exception thrown only in the event of an error * in the implementation of the library. * * @see Executor::execute(const Task&) */ virtual void execute(const Task&); - + /** * @see Cancelable::cancel() */ virtual void cancel(); - + /** * @see Cancelable::isCanceled() */ virtual bool isCanceled(); - + /** * @see PoolExecutor::wait() */ virtual void wait(); - + /** * @see PoolExecutor::wait(unsigned long timeout) */ virtual bool wait(unsigned long timeout); - + }; /* ConcurrentExecutor */ - + } // namespace ZThread #endif // __ZTCONCURRENTEXECUTOR_H__ diff --git a/dep/include/zthread/Condition.h b/dep/include/zthread/Condition.h index eba93619bfe..60f4b544ea9 100644 --- a/dep/include/zthread/Condition.h +++ b/dep/include/zthread/Condition.h @@ -28,7 +28,7 @@ #include "zthread/Waitable.h" namespace ZThread { - + class FifoConditionImpl; /** @@ -37,13 +37,13 @@ namespace ZThread { * @date <2003-07-16T14:38:59-0400> * @version 2.2.1 * - * A Condition is a Waitable object used to block a thread until a particular - * condition is met. A Condition object is always used in conjunction with Lockable + * A Condition is a Waitable object used to block a thread until a particular + * condition is met. A Condition object is always used in conjunction with Lockable * object. This object should be a FastMutex, Mutex, PriorityMutex or PriorityInheritanceMutex. * - * Condition objects are reminiscent of POSIX condition variables in several ways but - * are slightly different. - * + * Condition objects are reminiscent of POSIX condition variables in several ways but + * are slightly different. + * * A Condition is not subject to spurious wakeup. * * Like all Waitable objects, Conditions are sensitive to Thread::interupt() which can @@ -52,10 +52,10 @@ namespace ZThread { * @see Thread::interupt() * * Before a wait() is performed on a Condition, the associated Lockable object should - * have been acquire()ed. When the wait() begins, that Lockable object is release()d - * (wait() will atomically begin the wait and unlock the Lockable). + * have been acquire()ed. When the wait() begins, that Lockable object is release()d + * (wait() will atomically begin the wait and unlock the Lockable). * - * A thread blocked by wait() will remain so until an exception occurs, or until + * A thread blocked by wait() will remain so until an exception occurs, or until * the thread awakened by a signal() or broadcast(). When the thread resumes execution, * the associated Lockable is acquire()d before wait() returns. * @@ -66,33 +66,33 @@ namespace ZThread { class ZTHREAD_API Condition : public Waitable, private NonCopyable { FifoConditionImpl* _impl; - + public: - + /** * Create a Condition associated with the given Lockable object. * * @param l Lockable object to associate with this Condition object. */ - Condition(Lockable& l); + Condition(Lockable& l); //! Destroy Condition object virtual ~Condition(); - + /** * Wake one thread waiting on this Condition. * - * The associated Lockable need not have been acquire when this function is + * The associated Lockable need not have been acquire when this function is * invoked. * * @post a waiting thread, if any exists, will be awakened. */ - void signal(); + void signal(); /** * Wake all threads wait()ing on this Condition. * - * The associated Lockable need not have been acquire when this function is + * The associated Lockable need not have been acquire when this function is * invoked. * * @post all wait()ing threads, if any exist, will be awakened. @@ -108,16 +108,16 @@ namespace ZThread { * @exception Interrupted_Exception thrown when the calling thread is interrupted. * A thread may be interrupted at any time, prematurely ending any wait. * - * @pre The thread calling this method must have first acquired the associated - * Lockable object. + * @pre The thread calling this method must have first acquired the associated + * Lockable object. * - * @post A thread that has resumed execution without exception (because of a signal(), - * broadcast() or exception) will have acquire()d the associated Lockable object + * @post A thread that has resumed execution without exception (because of a signal(), + * broadcast() or exception) will have acquire()d the associated Lockable object * before returning from a wait(). * * @see Waitable::wait() */ - virtual void wait(); + virtual void wait(); /** * Wait for this Condition, blocking the calling thread until a signal or broadcast @@ -127,28 +127,28 @@ namespace ZThread { * * @param timeout maximum amount of time (milliseconds) this method could block * - * @return - * - true if the Condition receives a signal or broadcast before + * @return + * - true if the Condition receives a signal or broadcast before * timeout milliseconds elapse. * - false otherwise. - * + * * @exception Interrupted_Exception thrown when the calling thread is interrupted. * A thread may be interrupted at any time, prematurely ending any wait. * - * @pre The thread calling this method must have first acquired the associated - * Lockable object. + * @pre The thread calling this method must have first acquired the associated + * Lockable object. * - * @post A thread that has resumed execution without exception (because of a signal(), - * broadcast() or exception) will have acquire()d the associated Lockable object + * @post A thread that has resumed execution without exception (because of a signal(), + * broadcast() or exception) will have acquire()d the associated Lockable object * before returning from a wait(). * * @see Waitable::wait(unsigned long timeout) */ virtual bool wait(unsigned long timeout); - + }; - + } // namespace ZThread #endif // __ZTCONDITION_H__ diff --git a/dep/include/zthread/Config.h b/dep/include/zthread/Config.h index 21e08bf8461..ee03c831dc4 100644 --- a/dep/include/zthread/Config.h +++ b/dep/include/zthread/Config.h @@ -25,7 +25,7 @@ // ===================================================================================== // The following section describes the symbols the configure program will define. -// If you are not using configure (autoconf), then you make want to set these by +// If you are not using configure (autoconf), then you make want to set these by // uncommenting them here, or whatever other means you'd like. // ===================================================================================== @@ -75,7 +75,7 @@ // Uncomment to select the vannila dual mutex implementation of FastRecursiveLock // #define ZTHREAD_DUAL_LOCKS 1 -// Uncomment to select a POSIX implementation of FastRecursiveLock that does not +// Uncomment to select a POSIX implementation of FastRecursiveLock that does not // spin, but instead sleeps on a condition variable. // #define ZTHREAD_CONDITION_LOCKS 1 @@ -92,7 +92,7 @@ // The following section will attempt to guess the best configuration for your system // =================================================================================== -// Select an implementation by checking out the environment, first looking for +// Select an implementation by checking out the environment, first looking for // compilers, then by looking for other definitions that could be present #if !defined(ZT_POSIX) && !defined(ZT_WIN9X) && !defined(ZT_WIN32) && !defined(ZT_MACOS) @@ -116,7 +116,7 @@ # define ZT_POSIX // Check for definitions from well known headers -#elif defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) +#elif defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) # define ZT_POSIX @@ -148,8 +148,8 @@ #endif -// Windows users will get a static build by default, unless they -// define either ZTHREAD_IMPORTS or ZTHREAD_EXPORTS. Client code +// Windows users will get a static build by default, unless they +// define either ZTHREAD_IMPORTS or ZTHREAD_EXPORTS. Client code // of a dll version of this library should define the first flag; // To build the dll version of this library, define the second. @@ -157,29 +157,29 @@ # error "Import and export declarations are not valid" #else -# if defined(ZTHREAD_IMPORTS) +# if defined(ZTHREAD_IMPORTS) # define ZTHREAD_API __declspec(dllimport) -# elif defined(ZTHREAD_EXPORTS) +# elif defined(ZTHREAD_EXPORTS) # define ZTHREAD_API __declspec(dllexport) # else -# define ZTHREAD_API +# define ZTHREAD_API # endif #endif -// Once the API decorator is configured, create a macro for -// explicit template instantiation (whose need can hopefully +// Once the API decorator is configured, create a macro for +// explicit template instantiation (whose need can hopefully // be removed from the library) #if defined(ZTHREAD_EXPORTS) -# define EXPLICIT_TEMPLATE(X) template class __declspec( dllexport ) X; +# define EXPLICIT_TEMPLATE(X) template class __declspec( dllexport ) X; #elif defined(ZTHREAD_IMPORTS) -# define EXPLICIT_TEMPLATE(X) template class __declspec( dllimport ) X; +# define EXPLICIT_TEMPLATE(X) template class __declspec( dllimport ) X; #else # define EXPLICIT_TEMPLATE(X) #endif -// Give libc a hint, should be defined by the user - but people tend +// Give libc a hint, should be defined by the user - but people tend // to forget. #if !defined(REENTRANT) @@ -192,7 +192,7 @@ #if defined(_MSC_VER) # pragma warning(disable:4275) -# pragma warning(disable:4290) +# pragma warning(disable:4290) # pragma warning(disable:4786) # pragma warning(disable:4251) # pragma warning(disable:4355) @@ -202,16 +202,16 @@ #if \ (defined(ZT_POSIX) && defined(ZT_WIN32)) \ || (defined(ZT_POSIX) && defined(ZT_WIN9X)) \ - || (defined(ZT_WIN32) && defined(ZT_WIN9X)) + || (defined(ZT_WIN32) && defined(ZT_WIN9X)) # error "Only one implementation should be selected!" #endif #if defined(ZTHREAD_NOINLINE) -# define ZTHREAD_INLINE +# define ZTHREAD_INLINE #else -# define ZTHREAD_INLINE inline +# define ZTHREAD_INLINE inline #endif #endif // __ZTCONFIG_H__ diff --git a/dep/include/zthread/CountedPtr.h b/dep/include/zthread/CountedPtr.h index a4dcc6ef248..095b61c7ab5 100644 --- a/dep/include/zthread/CountedPtr.h +++ b/dep/include/zthread/CountedPtr.h @@ -36,7 +36,7 @@ #endif namespace ZThread { - + /** * @class CountedPtr * @@ -100,41 +100,41 @@ namespace ZThread { ~CountedPtr() { if(_count && --(*_count) == 0) { - - if(_instance) + + if(_instance) delete _instance; delete _count; - + } } - + #if !defined(__MWERKS__) #if !defined(_MSC_VER) || (_MSC_VER > 1200) const CountedPtr& operator=(const CountedPtr& ptr) { - + typedef CountedPtr ThisT; ThisT(ptr).swap(*this); return *this; - } + } #endif #endif template const CountedPtr& operator=(const CountedPtr& ptr) { - + typedef CountedPtr ThisT; ThisT(ptr).swap(*this); return *this; - } + } void reset() { @@ -155,7 +155,7 @@ namespace ZThread { #endif #endif - + template void swap(CountedPtr& ptr) { @@ -221,7 +221,7 @@ namespace ZThread { assert(_instance != 0); return _instance; } - + bool operator!() const { return _instance == 0; } @@ -229,25 +229,25 @@ namespace ZThread { operator bool() const { return _instance != 0; } - + }; /* CountedPtr */ - template + template inline bool operator<(CountedPtr const &lhs, CountedPtr const &rhs) { return lhs.less(rhs); } - template + template inline bool operator==(CountedPtr const &lhs, CountedPtr const &rhs) { return lhs.equal(rhs.get); } - template + template inline bool operator!=(CountedPtr const &lhs, CountedPtr const &rhs) { return !(lhs.equal(rhs.get)); } - template + template inline void swap(CountedPtr const &lhs, CountedPtr const &rhs) { lhs.swap(rhs); } @@ -260,17 +260,17 @@ namespace ZThread { return lhs.less(rhs); } - template + template inline bool operator==(CountedPtr const &lhs, CountedPtr const &rhs) { return lhs.equal(rhs.get); } - template + template inline bool operator!=(CountedPtr const &lhs, CountedPtr const &rhs) { return !(lhs.equal(rhs.get)); } - template + template inline void swap(CountedPtr const &lhs, CountedPtr const &rhs) { lhs.swap(rhs); } @@ -283,7 +283,7 @@ namespace ZThread { #ifdef _MSC_VER # pragma warning(pop) # pragma warning(pop) -#endif +#endif #endif // __ZTCOUNTEDPTR_H__ diff --git a/dep/include/zthread/CountingSemaphore.h b/dep/include/zthread/CountingSemaphore.h index f580a65f726..ea23300c2a7 100644 --- a/dep/include/zthread/CountingSemaphore.h +++ b/dep/include/zthread/CountingSemaphore.h @@ -27,17 +27,17 @@ #include "zthread/NonCopyable.h" namespace ZThread { - + class FifoSemaphoreImpl; - + /** * @class CountingSemaphore * @author Eric Crahen * @date <2003-07-16T15:26:18-0400> * @version 2.2.1 * - * A CountingSemaphore is an owner-less Lockable object. - * + * A CountingSemaphore is an owner-less Lockable object. + * * It differs from a normal Semaphore in that there is no upper bound on the count * and it will not throw an exception because a maximum value has been exceeded. * @@ -46,17 +46,17 @@ namespace ZThread { * Threads blocked on a CountingSemaphore are resumed in FIFO order. */ class ZTHREAD_API CountingSemaphore : public Lockable, private NonCopyable { - - FifoSemaphoreImpl* _impl; + + FifoSemaphoreImpl* _impl; public: /** - * Create a new CountingSemaphore. + * Create a new CountingSemaphore. * * @param count - initial count */ - CountingSemaphore(int initialCount = 0); + CountingSemaphore(int initialCount = 0); //! Destroy the CountingSemaphore virtual ~CountingSemaphore(); @@ -65,8 +65,8 @@ namespace ZThread { * Provided to reflect the traditional Semaphore semantics * * @see acquire() - */ - void wait(); + */ + void wait(); /** @@ -74,51 +74,51 @@ namespace ZThread { * * @see tryAcquire(unsigned long timeout) */ - bool tryWait(unsigned long timeout); + bool tryWait(unsigned long timeout); /** * Provided to reflect the traditional Semaphore semantics * * @see release() */ - void post(); + void post(); + - /** - * Get the current count of the semaphore. + * Get the current count of the semaphore. * * This value may change immediately after this function returns to the calling thread. * * @return int count */ - virtual int count(); - + virtual int count(); + /** - * Decrement the count, blocking that calling thread if the count becomes 0 or - * less than 0. The calling thread will remain blocked until the count is + * Decrement the count, blocking that calling thread if the count becomes 0 or + * less than 0. The calling thread will remain blocked until the count is * raised above 0, an exception is thrown or the given amount of time expires. - * + * * @param timeout maximum amount of time (milliseconds) this method could block - * - * @return + * + * @return * - true if the Semaphore was acquired before timeout milliseconds elapse. * - false otherwise. * * @exception Interrupted_Exception thrown when the calling thread is interrupted. * A thread may be interrupted at any time, prematurely ending any wait. - * + * * @see Lockable::tryAcquire(unsigned long timeout) */ virtual bool tryAcquire(unsigned long timeout); /** - * Decrement the count, blocking that calling thread if the count becomes 0 or - * less than 0. The calling thread will remain blocked until the count is + * Decrement the count, blocking that calling thread if the count becomes 0 or + * less than 0. The calling thread will remain blocked until the count is * raised above 0 or if an exception is thrown. - * + * * @exception Interrupted_Exception thrown when the calling thread is interrupted. * A thread may be interrupted at any time, prematurely ending any wait. - * + * * @see Lockable::acquire() */ virtual void acquire(); @@ -129,8 +129,8 @@ namespace ZThread { * @see Lockable::release() */ virtual void release(); - - }; + + }; } // namespace ZThread diff --git a/dep/include/zthread/Exceptions.h b/dep/include/zthread/Exceptions.h index b7207932af4..7a387feb5a4 100644 --- a/dep/include/zthread/Exceptions.h +++ b/dep/include/zthread/Exceptions.h @@ -27,8 +27,8 @@ #include "zthread/Config.h" #include -namespace ZThread { - +namespace ZThread { + /** * @class Synchronization_Exception * @@ -43,11 +43,11 @@ class Synchronization_Exception { static void * operator new[](size_t size); std::string _msg; - + public: - + /** - * Create a new exception with a default error message 'Synchronization + * Create a new exception with a default error message 'Synchronization * Exception' */ Synchronization_Exception() : _msg("Synchronization exception") { } @@ -67,9 +67,9 @@ public: const char* what() const { return _msg.c_str(); } - + }; - + /** * @class Interrupted_Exception @@ -88,9 +88,9 @@ class Interrupted_Exception : public Synchronization_Exception { Interrupted_Exception(const char* msg) : Synchronization_Exception(msg) { } }; - - - + + + /** * @class Deadlock_Exception * @@ -106,8 +106,8 @@ class Deadlock_Exception : public Synchronization_Exception { Deadlock_Exception(const char* msg) : Synchronization_Exception(msg) { } }; - - + + /** * @class InvalidOp_Exception * @@ -123,16 +123,16 @@ class InvalidOp_Exception : public Synchronization_Exception { }; - - + + /** * @class Initialization_Exception * - * Thrown when the system has no more resources to create new + * Thrown when the system has no more resources to create new * synchronization controls */ class Initialization_Exception : public Synchronization_Exception { - + public: //! Create a new exception @@ -141,24 +141,24 @@ class Initialization_Exception : public Synchronization_Exception { Initialization_Exception(const char*msg) : Synchronization_Exception(msg) { } }; - + /** * @class Cancellation_Exception * - * Cancellation_Exceptions are thrown by 'Canceled' objects. + * Cancellation_Exceptions are thrown by 'Canceled' objects. * @see Cancelable */ class Cancellation_Exception : public Synchronization_Exception { public: - + //! Create a new Cancelltion_Exception Cancellation_Exception() : Synchronization_Exception("Canceled") { } //! Create a new Cancelltion_Exception Cancellation_Exception(const char*msg) : Synchronization_Exception(msg) { } - + }; - + /** * @class Timeout_Exception @@ -171,20 +171,20 @@ class Timeout_Exception : public Synchronization_Exception { //! Create a new Timeout_Exception Timeout_Exception() : Synchronization_Exception("Timeout") { } - //! Create a new + //! Create a new Timeout_Exception(const char*msg) : Synchronization_Exception(msg) { } - + }; /** * @class NoSuchElement_Exception - * - * The last operation that was attempted on a Queue could not find + * + * The last operation that was attempted on a Queue could not find * the item that was indicated (during that last Queue method invocation) */ class NoSuchElement_Exception { public: - + //! Create a new exception NoSuchElement_Exception() {} @@ -193,7 +193,7 @@ class NoSuchElement_Exception { /** * @class InvalidTask_Exception * - * Thrown when a task is not valid (e.g. null or start()ing a thread with + * Thrown when a task is not valid (e.g. null or start()ing a thread with * no overriden run() method) */ class InvalidTask_Exception : public InvalidOp_Exception { @@ -201,7 +201,7 @@ class InvalidTask_Exception : public InvalidOp_Exception { //! Create a new exception InvalidTask_Exception() : InvalidOp_Exception("Invalid task") {} - + }; /** @@ -221,7 +221,7 @@ class BrokenBarrier_Exception : public Synchronization_Exception { BrokenBarrier_Exception(const char* msg) : Synchronization_Exception(msg) { } }; - + /** * @class Future_Exception * diff --git a/dep/include/zthread/Executor.h b/dep/include/zthread/Executor.h index 833d0d4c3d1..1c6a81a72eb 100644 --- a/dep/include/zthread/Executor.h +++ b/dep/include/zthread/Executor.h @@ -28,7 +28,7 @@ namespace ZThread { - + /** * @class Executor * @@ -41,27 +41,27 @@ namespace ZThread { * be found in the proceedings of the 2002 VikingPLOP conference. * * Executing - * + * * - execute()ing task with an Executor will submit the task, scheduling * it for execution at some future time depending on the Executor being used. * * Disabling * - * - cancel()ing an Executor will cause it to stop accepting - * new tasks. + * - cancel()ing an Executor will cause it to stop accepting + * new tasks. * * Interrupting * - * - interrupt()ing an Executor will cause the any thread running - * a task which was submitted prior to the invocation of this function to + * - interrupt()ing an Executor will cause the any thread running + * a task which was submitted prior to the invocation of this function to * be interrupted during the execution of that task. * * Waiting * - * - wait()ing on a PoolExecutor will block the calling thread + * - wait()ing on a PoolExecutor will block the calling thread * until all tasks that were submitted prior to the invocation of this function * have completed. - * + * * @see Cancelable * @see Waitable */ @@ -69,15 +69,15 @@ namespace ZThread { public: /** - * If supported by the Executor, interrupt all tasks submitted prior to + * If supported by the Executor, interrupt all tasks submitted prior to * the invocation of this function. - */ + */ virtual void interrupt() = 0; /** - * Submit a task to this Executor. + * Submit a task to this Executor. * - * @param task Task to be run by a thread managed by this executor + * @param task Task to be run by a thread managed by this executor * * @pre The Executor should have been canceled prior to this invocation. * @post The submitted task will be run at some point in the future by this Executor. @@ -86,7 +86,7 @@ namespace ZThread { * the invocation of this function. */ virtual void execute(const Task& task) = 0; - + }; } // namespace ZThread diff --git a/dep/include/zthread/FairReadWriteLock.h b/dep/include/zthread/FairReadWriteLock.h index 8f183b62839..908f663a508 100644 --- a/dep/include/zthread/FairReadWriteLock.h +++ b/dep/include/zthread/FairReadWriteLock.h @@ -36,18 +36,18 @@ namespace ZThread { * @author Eric Crahen * @date <2003-07-16T10:26:25-0400> * @version 2.2.7 - * - * A FairReadWriteLock maintains a balance between the order read-only access + * + * A FairReadWriteLock maintains a balance between the order read-only access * and read-write access is allowed. Threads contending for the pair of Lockable * objects this ReadWriteLock provides will gain access to the locks in FIFO order. * - * @see ReadWriteLock + * @see ReadWriteLock */ class FairReadWriteLock : public ReadWriteLock { Mutex _lock; Condition _cond; - + volatile int _readers; //! @class ReadLock @@ -64,16 +64,16 @@ namespace ZThread { virtual void acquire() { Guard g(_rwlock._lock); - ++_rwlock._readers; + ++_rwlock._readers; } virtual bool tryAcquire(unsigned long timeout) { - + if(!_rwlock._lock.tryAcquire(timeout)) return false; - ++_rwlock._readers; + ++_rwlock._readers; _rwlock._lock.release(); return true; @@ -82,7 +82,7 @@ namespace ZThread { virtual void release() { Guard g(_rwlock._lock); - --_rwlock._readers; + --_rwlock._readers; if(_rwlock._readers == 0) _rwlock._cond.signal(); @@ -121,7 +121,7 @@ namespace ZThread { } virtual bool tryAcquire(unsigned long timeout) { - + if(!_rwlock._lock.tryAcquire(timeout)) return false; @@ -154,11 +154,11 @@ namespace ZThread { WriteLock _wlock; public: - + /** * Create a BiasedReadWriteLock * - * @exception Initialization_Exception thrown if resources could not be + * @exception Initialization_Exception thrown if resources could not be * allocated for this object. */ FairReadWriteLock() : _cond(_lock), _readers(0), _rlock(*this), _wlock(*this) {} @@ -175,7 +175,7 @@ namespace ZThread { * @see ReadWriteLock::getWriteLock() */ virtual Lockable& getWriteLock() { return _wlock; } - + }; }; // __ZTFAIRREADWRITELOCK_H__ diff --git a/dep/include/zthread/FastMutex.h b/dep/include/zthread/FastMutex.h index 1812c3e55a5..819108b377a 100644 --- a/dep/include/zthread/FastMutex.h +++ b/dep/include/zthread/FastMutex.h @@ -38,10 +38,10 @@ namespace ZThread { * * A FastMutex is a small fast implementation of a non-recursive, mutually exclusive * Lockable object. This implementation is a bit faster than the other Mutex classes - * as it involved the least overhead. However, this slight increase in speed is - * gained by sacrificing the robustness provided by the other classes. + * as it involved the least overhead. However, this slight increase in speed is + * gained by sacrificing the robustness provided by the other classes. * - * A FastMutex has the useful property of not being interruptable; that is to say + * A FastMutex has the useful property of not being interruptable; that is to say * that acquire() and tryAcquire() will not throw Interrupted_Exceptions. * * @see Mutex @@ -53,49 +53,49 @@ namespace ZThread { * Error Checking * * No error checking is performed, this means there is the potential for deadlock. - */ + */ class ZTHREAD_API FastMutex : public Lockable, private NonCopyable { - + FastLock* _lock; public: - + //! Create a FastMutex FastMutex(); - + //! Destroy a FastMutex virtual ~FastMutex(); - + /** - * Acquire exclusive access to the mutex. The calling thread will block until the + * Acquire exclusive access to the mutex. The calling thread will block until the * lock can be acquired. No safety or state checks are performed. - * + * * @pre The calling thread should not have previously acquired this lock. - * Deadlock will result if the same thread attempts to acquire the mutex more - * than once. + * Deadlock will result if the same thread attempts to acquire the mutex more + * than once. * * @post The calling thread obtains the lock successfully if no exception is thrown. * @exception Interrupted_Exception never thrown */ virtual void acquire(); - + /** * Release exclusive access. No safety or state checks are performed. - * + * * @pre the caller should have previously acquired this lock */ virtual void release(); - + /** - * Try to acquire exclusive access to the mutex. The calling thread will block until the + * Try to acquire exclusive access to the mutex. The calling thread will block until the * lock can be acquired. No safety or state checks are performed. - * + * * @pre The calling thread should not have previously acquired this lock. - * Deadlock will result if the same thread attempts to acquire the mutex more - * than once. + * Deadlock will result if the same thread attempts to acquire the mutex more + * than once. * * @param timeout unused - * @return + * @return * - true if the lock was acquired * - false if the lock was acquired * @@ -103,7 +103,7 @@ namespace ZThread { * @exception Interrupted_Exception never thrown */ virtual bool tryAcquire(unsigned long timeout); - + }; /* FastMutex */ }; diff --git a/dep/include/zthread/FastRecursiveMutex.h b/dep/include/zthread/FastRecursiveMutex.h index a30f4b53aa7..5a3322e3c65 100644 --- a/dep/include/zthread/FastRecursiveMutex.h +++ b/dep/include/zthread/FastRecursiveMutex.h @@ -39,10 +39,10 @@ namespace ZThread { * * A FastRecursiveMutex is a small fast implementation of a recursive, mutally exclusive * Lockable object. This implementation is a bit faster than the other Mutex classes - * as it involved the least overhead. However, this slight increase in speed is - * gained by sacrificing the robustness provided by the other classes. + * as it involved the least overhead. However, this slight increase in speed is + * gained by sacrificing the robustness provided by the other classes. * - * A FastRecursiveMutex has the useful property of not being interruptable; that is to say + * A FastRecursiveMutex has the useful property of not being interruptable; that is to say * that acquire() and tryAcquire() will not throw Interrupted_Exceptions. * * @see RecursiveMutex @@ -54,13 +54,13 @@ namespace ZThread { * Error Checking * * No error checking is performed, this means there is the potential for deadlock. - */ + */ class ZTHREAD_API FastRecursiveMutex : public Lockable, private NonCopyable { - + FastRecursiveLock* _lock; public: - + //! Create a new FastRecursiveMutex FastRecursiveMutex(); @@ -68,7 +68,7 @@ namespace ZThread { virtual ~FastRecursiveMutex(); /** - * Acquire exclusive access to the mutex. The calling thread will block until the + * Acquire exclusive access to the mutex. The calling thread will block until the * lock can be acquired. No safety or state checks are performed. The calling thread * may acquire the mutex nore than once. * @@ -76,21 +76,21 @@ namespace ZThread { * @exception Interrupted_Exception never thrown */ virtual void acquire(); - + /** * Release access. No safety or state checks are performed. - * + * * @pre the caller should have previously acquired this lock at least once. */ virtual void release(); - + /** - * Try to acquire exclusive access to the mutex. The calling thread will block until the + * Try to acquire exclusive access to the mutex. The calling thread will block until the * lock can be acquired. No safety or state checks are performed. The calling thread * may acquire the mutex more than once. * * @param timeout unused - * @return + * @return * - true if the lock was acquired * - false if the lock was acquired * @@ -98,8 +98,8 @@ namespace ZThread { * @exception Interrupted_Exception never thrown */ virtual bool tryAcquire(unsigned long timeout); - - }; + + }; } // namespace ZThread diff --git a/dep/include/zthread/Guard.h b/dep/include/zthread/Guard.h index 988c3cfa3c2..d1befccd85a 100644 --- a/dep/include/zthread/Guard.h +++ b/dep/include/zthread/Guard.h @@ -26,15 +26,15 @@ #include "zthread/NonCopyable.h" #include "zthread/Exceptions.h" -namespace ZThread { +namespace ZThread { -// -// GuardLockingPolicyContract { // -// createScope(lock_type&) -// bool createScope(lock_type&, unsigned long) -// destroyScope(lock_type&) -// +// GuardLockingPolicyContract { +// +// createScope(lock_type&) +// bool createScope(lock_type&, unsigned long) +// destroyScope(lock_type&) +// // } // @@ -59,12 +59,12 @@ class LockHolder { template LockHolder(T& t) : _lock(extract(t)._lock), _enabled(true) { } - + LockHolder(LockHolder& holder) : _lock(holder._lock), _enabled(true) { } LockHolder(LockType& lock) : _lock(lock), _enabled(true) { } - void disable() { + void disable() { _enabled = false; } @@ -78,7 +78,7 @@ class LockHolder { protected: - template + template static LockHolder& extract(T& t) { // Design and Evolution of C++, page 328 return (LockHolder&)(t); @@ -117,7 +117,7 @@ class CompoundScope { return false; } - + return true; } @@ -154,7 +154,7 @@ class LockedScope { * @param lock2 LockType1& is the LockHolder that wants to share template static void shareScope(LockHolder& l1, LockHolder& l2) { - + l2.getLock().acquire(); } @@ -207,7 +207,7 @@ class LockedScope { * * Locking policy for Lockable objects. This policy release()s a Lockable * when the protection scope is created, and it acquire()s a Lockable - * when the scope is destroyed. + * when the scope is destroyed. */ class UnlockedScope { public: @@ -251,7 +251,7 @@ class UnlockedScope { } }; - + /** @@ -277,7 +277,7 @@ class TimedLockedScope { if(!l2.getLock().tryAcquire(TimeOut)) throw Timeout_Exception(); - + } template @@ -338,29 +338,29 @@ class OverlappedScope { * @version 2.2.0 * * Scoped locking utility. This template class can be given a Lockable - * synchronization object and can 'Guard' or serialize access to + * synchronization object and can 'Guard' or serialize access to * that method. - * - * For instance, consider a case in which a class or program have a - * Mutex object associated with it. Access can be serialized with a + * + * For instance, consider a case in which a class or program have a + * Mutex object associated with it. Access can be serialized with a * Guard as shown below. * * @code * * Mutex _mtx; * void guarded() { - * + * * Guard g(_mtx); * * } * * @endcode * - * The Guard will lock the synchronization object when it is created and - * automatically unlock it when it goes out of scope. This eliminates + * The Guard will lock the synchronization object when it is created and + * automatically unlock it when it goes out of scope. This eliminates * common mistakes like forgetting to unlock your mutex. * - * An alternative to the above example would be + * An alternative to the above example would be * * @code * @@ -385,15 +385,15 @@ class Guard : private LockHolder, private NonCopyable { friend class LockHolder; public: - + /** * Create a Guard that enforces a the effective protection scope - * throughout the lifetime of the Guard object or until the protection + * throughout the lifetime of the Guard object or until the protection * scope is modified by another Guard. * - * @param lock LockType the lock this Guard will use to enforce its + * @param lock LockType the lock this Guard will use to enforce its * protection scope. - * @post the protection scope may be ended prematurely + * @post the protection scope may be ended prematurely */ Guard(LockType& lock) : LockHolder(lock) { @@ -403,12 +403,12 @@ public: /** * Create a Guard that enforces a the effective protection scope - * throughout the lifetime of the Guard object or until the protection + * throughout the lifetime of the Guard object or until the protection * scope is modified by another Guard. * - * @param lock LockType the lock this Guard will use to enforce its + * @param lock LockType the lock this Guard will use to enforce its * protection scope. - * @post the protection scope may be ended prematurely + * @post the protection scope may be ended prematurely */ Guard(LockType& lock, unsigned long timeout) : LockHolder(lock) { @@ -419,31 +419,31 @@ public: /** * Create a Guard that shares the effective protection scope - * from the given Guard to this Guard. + * from the given Guard to this Guard. * - * @param g Guard guard that is currently enabled - * @param lock LockType the lock this Guard will use to enforce its + * @param g Guard guard that is currently enabled + * @param lock LockType the lock this Guard will use to enforce its * protection scope. */ template Guard(Guard& g) : LockHolder(g) { LockingPolicy::shareScope(*this, extract(g)); - + } /** * Create a Guard that shares the effective protection scope - * from the given Guard to this Guard. + * from the given Guard to this Guard. * - * @param g Guard guard that is currently enabled - * @param lock LockType the lock this Guard will use to enforce its + * @param g Guard guard that is currently enabled + * @param lock LockType the lock this Guard will use to enforce its * protection scope. */ Guard(Guard& g) : LockHolder(g) { LockingPolicy::shareScope(*this, g); - + } @@ -451,8 +451,8 @@ public: * Create a Guard that transfers the effective protection scope * from the given Guard to this Guard. * - * @param g Guard guard that is currently enabled - * @param lock LockType the lock this Guard will use to enforce its + * @param g Guard guard that is currently enabled + * @param lock LockType the lock this Guard will use to enforce its * protection scope. */ template @@ -467,8 +467,8 @@ public: * Create a Guard that transfers the effective protection scope * from the given Guard to this Guard. * - * @param g Guard guard that is currently enabled - * @param lock LockType the lock this Guard will use to enforce its + * @param g Guard guard that is currently enabled + * @param lock LockType the lock this Guard will use to enforce its * protection scope. */ Guard(Guard& g, LockType& lock) : LockHolder(lock) { @@ -476,7 +476,7 @@ public: LockingPolicy::transferScope(*this, g); } - + /** * Unlock a given Lockable object with the destruction of this Guard @@ -488,14 +488,14 @@ public: template Guard::~Guard() throw() { - + try { - + if(!this->isDisabled()) LockingPolicy::destroyScope(*this); - - } catch (...) { /* ignore */ } - + + } catch (...) { /* ignore */ } + } diff --git a/dep/include/zthread/GuardedClass.h b/dep/include/zthread/GuardedClass.h index 4ef3879cb08..1a8ac1904df 100644 --- a/dep/include/zthread/GuardedClass.h +++ b/dep/include/zthread/GuardedClass.h @@ -34,25 +34,25 @@ namespace ZThread { * @date <2003-07-20T20:17:34-0400> * @version 2.3.0 * - * A simple wrapper template that uses Guard's to provide + * A simple wrapper template that uses Guard's to provide * serialized access to an objects member functions. */ template class GuardedClass { - + LockType _lock; T* _ptr; - + class TransferedScope { public: - + template static void shareScope(LockHolder& l1, LockHolder& l2) { l1.disable(); l2.getLock().acquire(); } - + template static void createScope(LockHolder& l) { // Don't acquire the lock when scope the Guard is created @@ -82,9 +82,9 @@ namespace ZThread { GuardedClass(); GuardedClass& operator=(const GuardedClass&); - + public: - + GuardedClass(T* ptr) : _ptr(ptr) {} ~GuardedClass() { if(_ptr) @@ -95,9 +95,9 @@ namespace ZThread { Proxy p(_lock, _ptr); return p; } - + }; - + } // namespace ZThread #endif // __ZTGUARDEDCLASS_H__ diff --git a/dep/include/zthread/Lockable.h b/dep/include/zthread/Lockable.h index 32f7eeda97b..a663498bc2c 100644 --- a/dep/include/zthread/Lockable.h +++ b/dep/include/zthread/Lockable.h @@ -25,7 +25,7 @@ #include "zthread/Exceptions.h" -namespace ZThread { +namespace ZThread { /** * @class Lockable @@ -33,18 +33,18 @@ namespace ZThread { * @date <2003-07-16T10:33:32-0400> * @version 2.3.0 * - * The Lockable interface defines a common method of adding general acquire-release - * semantics to an object. An acquire-release protocol does not necessarily imply - * exclusive access. + * The Lockable interface defines a common method of adding general acquire-release + * semantics to an object. An acquire-release protocol does not necessarily imply + * exclusive access. */ class Lockable { - public: - + public: + //! Destroy a Lockable object. virtual ~Lockable() {} - /** - * Acquire the Lockable object. + /** + * Acquire the Lockable object. * * This method may or may not block the caller for an indefinite amount * of time. Those details are defined by specializations of this class. @@ -52,40 +52,40 @@ namespace ZThread { * @exception Interrupted_Exception thrown if the calling thread is interrupted before * the operation completes. * - * @post The Lockable is acquired only if no exception was thrown. + * @post The Lockable is acquired only if no exception was thrown. */ virtual void acquire() = 0; - /** - * Attempt to acquire the Lockable object. + /** + * Attempt to acquire the Lockable object. * * This method may or may not block the caller for a definite amount * of time. Those details are defined by specializations of this class; - * however, this method includes a timeout value that can be used to - * limit the maximum amount of time that a specialization could block. + * however, this method includes a timeout value that can be used to + * limit the maximum amount of time that a specialization could block. * * @param timeout - maximum amount of time (milliseconds) this method could block * - * @return - * - true if the operation completes and the Lockable is acquired before - * the timeout expires. + * @return + * - true if the operation completes and the Lockable is acquired before + * the timeout expires. * - false if the operation times out before the Lockable can be acquired. - * + * * @exception Interrupted_Exception thrown if the calling thread is interrupted before * the operation completes. * - * @post The Lockable is acquired only if no exception was thrown. + * @post The Lockable is acquired only if no exception was thrown. */ virtual bool tryAcquire(unsigned long timeout) = 0; - - /** + + /** * Release the Lockable object. * * This method may or may not block the caller for an indefinite amount * of time. Those details are defined by specializations of this class. * - * @post The Lockable is released only if no exception was thrown. - */ + * @post The Lockable is released only if no exception was thrown. + */ virtual void release() = 0; }; diff --git a/dep/include/zthread/LockedQueue.h b/dep/include/zthread/LockedQueue.h index a1f0df26431..5aae3278406 100644 --- a/dep/include/zthread/LockedQueue.h +++ b/dep/include/zthread/LockedQueue.h @@ -36,7 +36,7 @@ namespace ZThread { * @date <2003-07-16T11:42:33-0400> * @version 2.3.0 * - * A LockedQueue is the simple Queue implementation that provides + * A LockedQueue is the simple Queue implementation that provides * serialized access to the values added to it. */ template > @@ -65,7 +65,7 @@ namespace ZThread { virtual void add(const T& item) { Guard g(_lock); - + if(_canceled) throw Cancellation_Exception(); @@ -77,18 +77,18 @@ namespace ZThread { * @see Queue::add(const T& item, unsigned long timeout) */ virtual bool add(const T& item, unsigned long timeout) { - + try { Guard g(_lock, timeout); - + if(_canceled) throw Cancellation_Exception(); - + _queue.push_back(item); } catch(Timeout_Exception&) { return false; } - + return true; } @@ -97,23 +97,23 @@ namespace ZThread { * @see Queue::next() */ virtual T next() { - + Guard g(_lock); if(_queue.empty() && _canceled) throw Cancellation_Exception(); - + if(_queue.empty()) throw NoSuchElement_Exception(); T item = _queue.front(); _queue.pop_front(); - + return item; } - + /** * @see Queue::next(unsigned long timeout) */ @@ -123,15 +123,15 @@ namespace ZThread { if(_queue.empty() && _canceled) throw Cancellation_Exception(); - + if(_queue.empty()) throw NoSuchElement_Exception(); T item = _queue.front(); _queue.pop_front(); - + return item; - + } virtual T front() @@ -148,7 +148,7 @@ namespace ZThread { * @see Queue::cancel() */ virtual void cancel() { - + Guard g(_lock); _canceled = true; @@ -159,11 +159,11 @@ namespace ZThread { * @see Queue::isCanceled() */ virtual bool isCanceled() { - + // Faster check since the queue will not become un-canceled if(_canceled) return true; - + Guard g(_lock); return _canceled; diff --git a/dep/include/zthread/MonitoredQueue.h b/dep/include/zthread/MonitoredQueue.h index 8578fe62b96..2122b7f7a28 100644 --- a/dep/include/zthread/MonitoredQueue.h +++ b/dep/include/zthread/MonitoredQueue.h @@ -37,12 +37,12 @@ namespace ZThread { * @date <2003-07-16T20:23:28-0400> * @version 2.3.0 * - * A MonitoredQueue is a Queue implementation that provides serialized access to the - * items added to it. + * A MonitoredQueue is a Queue implementation that provides serialized access to the + * items added to it. * - * - Threads calling the empty() methods will be blocked until the BoundedQueue becomes empty. + * - Threads calling the empty() methods will be blocked until the BoundedQueue becomes empty. * - Threads calling the next() methods will be blocked until the BoundedQueue has a value to - * return. + * return. * * @see Queue */ @@ -67,17 +67,17 @@ namespace ZThread { public: //! Create a new MonitoredQueue - MonitoredQueue() + MonitoredQueue() : _notEmpty(_lock), _isEmpty(_lock), _canceled(false) {} //! Destroy a MonitoredQueue, delete remaining items virtual ~MonitoredQueue() { } /** - * Add a value to this Queue. + * Add a value to this Queue. * * @param item value to be added to the Queue - * + * * @exception Cancellation_Exception thrown if this Queue has been canceled. * @exception Interrupted_Exception thrown if the thread was interrupted while waiting * to add a value @@ -90,7 +90,7 @@ namespace ZThread { virtual void add(const T& item) { Guard g(_lock); - + // Allow no further additions in the canceled state if(_canceled) throw Cancellation_Exception(); @@ -102,14 +102,14 @@ namespace ZThread { } /** - * Add a value to this Queue. + * Add a value to this Queue. * * @param item value to be added to the Queue * @param timeout maximum amount of time (milliseconds) this method may block * the calling thread. * - * @return - * - true if a copy of item can be added before timeout + * @return + * - true if a copy of item can be added before timeout * milliseconds elapse. * - false otherwise. * @@ -123,32 +123,32 @@ namespace ZThread { * @see Queue::add(const T& item, unsigned long timeout) */ virtual bool add(const T& item, unsigned long timeout) { - + try { Guard g(_lock, timeout); - + if(_canceled) throw Cancellation_Exception(); - + _queue.push_back(item); _notEmpty.signal(); } catch(Timeout_Exception&) { return false; } - - return true; + + return true; } /** * Retrieve and remove a value from this Queue. * - * If invoked when there are no values present to return then the calling thread + * If invoked when there are no values present to return then the calling thread * will be blocked until a value arrives in the Queue. * * @return T next available value - * + * * @exception Cancellation_Exception thrown if this Queue has been canceled. * @exception Interrupted_Exception thrown if the thread was interrupted while waiting * to retrieve a value @@ -157,15 +157,15 @@ namespace ZThread { * @post The value returned will have been removed from the Queue. */ virtual T next() { - + Guard g(_lock); - - while (_queue.empty() && !_canceled) + + while (_queue.empty() && !_canceled) _notEmpty.wait(); - + if(_queue.empty()) // Queue canceled - throw Cancellation_Exception(); - + throw Cancellation_Exception(); + T item = _queue.front(); _queue.pop_front(); @@ -179,14 +179,14 @@ namespace ZThread { /** * Retrieve and remove a value from this Queue. * - * If invoked when there are no values present to return then the calling thread + * If invoked when there are no values present to return then the calling thread * will be blocked until a value arrives in the Queue. * * @param timeout maximum amount of time (milliseconds) this method may block * the calling thread. * * @return T next available value - * + * * @exception Cancellation_Exception thrown if this Queue has been canceled. * @exception Timeout_Exception thrown if the timeout expires before a value * can be retrieved. @@ -195,16 +195,16 @@ namespace ZThread { * @post The value returned will have been removed from the Queue. */ virtual T next(unsigned long timeout) { - + Guard g(_lock, timeout); - + while(_queue.empty() && !_canceled) { if(!_notEmpty.wait(timeout)) throw Timeout_Exception(); } if( _queue.empty()) // Queue canceled - throw Cancellation_Exception(); + throw Cancellation_Exception(); T item = _queue.front(); _queue.pop_front(); @@ -218,10 +218,10 @@ namespace ZThread { /** - * Cancel this queue. - * + * Cancel this queue. + * * @post Any threads blocked by a next() function will throw a Cancellation_Exception. - * + * * @see Queue::cancel() */ virtual void cancel() { @@ -237,11 +237,11 @@ namespace ZThread { * @see Queue::isCanceled() */ virtual bool isCanceled() { - + // Faster check since the queue will not become un-canceled if(_canceled) return true; - + Guard g(_lock); return _canceled; @@ -272,10 +272,10 @@ namespace ZThread { /** * Test whether any values are available in this Queue. * - * The calling thread is blocked until there are no values present + * The calling thread is blocked until there are no values present * in the Queue. - * - * @return + * + * @return * - true if there are no values available. * - false if there are values available. * @@ -287,7 +287,7 @@ namespace ZThread { while(!_queue.empty()) // Wait for an empty signal _isEmpty.wait(); - + return true; } @@ -295,13 +295,13 @@ namespace ZThread { /** * Test whether any values are available in this Queue. * - * The calling thread is blocked until there are no values present + * The calling thread is blocked until there are no values present * in the Queue. - * + * * @param timeout maximum amount of time (milliseconds) this method may block * the calling thread. * - * @return + * @return * - true if there are no values available. * - false if there are values available. * @@ -311,12 +311,12 @@ namespace ZThread { * @see Queue::empty() */ virtual bool empty(unsigned long timeout) { - + Guard g(_lock, timeout); while(!_queue.empty()) // Wait for an empty signal _isEmpty.wait(timeout); - + return true; } diff --git a/dep/include/zthread/Mutex.h b/dep/include/zthread/Mutex.h index 1b521b1598d..6c2c6bd2d3e 100644 --- a/dep/include/zthread/Mutex.h +++ b/dep/include/zthread/Mutex.h @@ -26,8 +26,8 @@ #include "zthread/Lockable.h" #include "zthread/NonCopyable.h" -namespace ZThread { - +namespace ZThread { + class FifoMutexImpl; /** @@ -39,7 +39,7 @@ namespace ZThread { * A Mutex is used to provide serialized (one thread at a time) access to some portion * of code. This is accomplished by attempting to acquire the Mutex before entering that * piece of code, and by releasing the Mutex when leaving that region. It is a non-reentrant, - * MUTual EXclusion Lockable object. + * MUTual EXclusion Lockable object. * * @see Guard * @@ -49,26 +49,26 @@ namespace ZThread { * * Error Checking * - * A Mutex will throw a Deadlock_Exception if an attempt to acquire a Mutex more + * A Mutex will throw a Deadlock_Exception if an attempt to acquire a Mutex more * than once is made from the context of the same thread. * - * A Mutex will throw an InvalidOp_Exception if an attempt to release a Mutex is + * A Mutex will throw an InvalidOp_Exception if an attempt to release a Mutex is * made from the context of a thread that does not currently own that Mutex. */ class ZTHREAD_API Mutex : public Lockable, private NonCopyable { - + FifoMutexImpl* _impl; - + public: //! Create a new Mutex. - Mutex(); + Mutex(); //! Destroy this Mutex. virtual ~Mutex(); - + /** - * Acquire a Mutex, possibly blocking until either the current owner of the + * Acquire a Mutex, possibly blocking until either the current owner of the * Mutex releases it or until an exception is thrown. * * Only one thread may acquire() the Mutex at any given time. @@ -88,14 +88,14 @@ namespace ZThread { virtual void acquire(); /** - * Acquire a Mutex, possibly blocking until the current owner of the + * Acquire a Mutex, possibly blocking until the current owner of the * Mutex releases it, until an exception is thrown or until the given amount * of time expires. * * Only one thread may acquire the Mutex at any given time. * * @param timeout maximum amount of time (milliseconds) this method could block - * @return + * @return * - true if the lock was acquired * - false if the lock was acquired * @@ -112,7 +112,7 @@ namespace ZThread { * @see Lockable::tryAcquire(unsigned long timeout) */ virtual bool tryAcquire(unsigned long timeout); - + /** * Release a Mutex allowing another thread to acquire it. * @@ -126,7 +126,7 @@ namespace ZThread { * @see Lockable::release() */ virtual void release(); - + }; diff --git a/dep/include/zthread/PoolExecutor.h b/dep/include/zthread/PoolExecutor.h index 82f5c4f05ba..03df37d9f77 100644 --- a/dep/include/zthread/PoolExecutor.h +++ b/dep/include/zthread/PoolExecutor.h @@ -28,7 +28,7 @@ #include "zthread/Thread.h" namespace ZThread { - + namespace { class ExecutorImpl; } /** @@ -38,33 +38,33 @@ namespace ZThread { * @date <2003-07-16T22:41:07-0400> * @version 2.3.0 * - * A PoolExecutor spawns a set of threads that are used to run tasks + * A PoolExecutor spawns a set of threads that are used to run tasks * that are submitted in parallel. A PoolExecutor supports the following * optional operations, * - * - cancel()ing a PoolExecutor will cause it to stop accepting - * new tasks. + * - cancel()ing a PoolExecutor will cause it to stop accepting + * new tasks. * - * - interrupt()ing a PoolExecutor will cause the any thread running - * a task which was submitted prior to the invocation of this function to + * - interrupt()ing a PoolExecutor will cause the any thread running + * a task which was submitted prior to the invocation of this function to * be interrupted during the execution of that task. * - * - wait()ing on a PoolExecutor will block the calling thread + * - wait()ing on a PoolExecutor will block the calling thread * until all tasks that were submitted prior to the invocation of this function * have completed. - * + * * @see Executor. */ class PoolExecutor : public Executor { - //! Reference to the internal implementation + //! Reference to the internal implementation CountedPtr< ExecutorImpl > _impl; - + //! Cancellation task Task _shutdown; public: - + /** * Create a PoolExecutor * @@ -77,19 +77,19 @@ namespace ZThread { /** * Invoking this function causes each task that had been submitted prior to - * this function to be interrupted. Tasks submitted after the invocation of + * this function to be interrupted. Tasks submitted after the invocation of * this function are unaffected. * * @post Any task submitted prior to the invocation of this function will be - * run in the context of an interrupted thread. - * @post Any thread already executing a task which was submitted prior to the - * invocation of this function will be interrupted. + * run in the context of an interrupted thread. + * @post Any thread already executing a task which was submitted prior to the + * invocation of this function will be interrupted. */ virtual void interrupt(); /** * Alter the number of threads being used to execute submitted tasks. - * + * * @param n number of worker threads. * * @pre n must be greater than 0. @@ -99,21 +99,21 @@ namespace ZThread { * n is less than 1. */ void size(size_t n); - + /** * Get the current number of threads being used to execute submitted tasks. * * @return n number of worker threads. */ size_t size(); - + /** - * Submit a task to this Executor. + * Submit a task to this Executor. * * This will not block the calling thread very long. The submitted task will * be executed at some later point by another thread. - * - * @param task Task to be run by a thread managed by this executor + * + * @param task Task to be run by a thread managed by this executor * * @pre The Executor should have been canceled prior to this invocation. * @post The submitted task will be run at some point in the future by this Executor. @@ -135,7 +135,7 @@ namespace ZThread { * @see Cancelable::isCanceled() */ virtual bool isCanceled(); - + /** * Block the calling thread until all tasks submitted prior to this invocation * complete. @@ -151,21 +151,21 @@ namespace ZThread { * Block the calling thread until all tasks submitted prior to this invocation * complete or until the calling thread is interrupted. * - * @param timeout maximum amount of time, in milliseconds, to wait for the + * @param timeout maximum amount of time, in milliseconds, to wait for the * currently submitted set of Tasks to complete. * * @exception Interrupted_Exception thrown if the calling thread is interrupted * before the set of tasks being wait for can complete. * - * @return - * - true if the set of tasks being wait for complete before + * @return + * - true if the set of tasks being wait for complete before * timeout milliseconds elapse. * - false otherwise. * * @see Waitable::wait(unsigned long timeout) */ virtual bool wait(unsigned long timeout); - + }; /* PoolExecutor */ diff --git a/dep/include/zthread/PriorityCondition.h b/dep/include/zthread/PriorityCondition.h index 1fd86c41c11..a85a000e941 100644 --- a/dep/include/zthread/PriorityCondition.h +++ b/dep/include/zthread/PriorityCondition.h @@ -28,7 +28,7 @@ #include "zthread/Waitable.h" namespace ZThread { - + class PriorityConditionImpl; /** @@ -49,9 +49,9 @@ namespace ZThread { class ZTHREAD_API PriorityCondition : public Waitable, private NonCopyable { PriorityConditionImpl* _impl; - + public: - + /** * @see Condition::Condition(Lockable& l) */ @@ -61,7 +61,7 @@ namespace ZThread { * @see Condition::~Condition() */ ~PriorityCondition(); - + /** * @see Condition::signal() */ @@ -81,9 +81,9 @@ namespace ZThread { * @see Condition::wait(unsigned long timeout) */ virtual bool wait(unsigned long timeout); - + }; - + } // namespace ZThread #endif // __ZTPRIORITYCONDITION_H__ diff --git a/dep/include/zthread/PriorityInheritanceMutex.h b/dep/include/zthread/PriorityInheritanceMutex.h index 1a5f5bfd300..81c6109b318 100644 --- a/dep/include/zthread/PriorityInheritanceMutex.h +++ b/dep/include/zthread/PriorityInheritanceMutex.h @@ -26,8 +26,8 @@ #include "zthread/Lockable.h" #include "zthread/NonCopyable.h" -namespace ZThread { - +namespace ZThread { + class PriorityInheritanceMutexImpl; /** @@ -37,27 +37,27 @@ namespace ZThread { * @date <2003-07-16T19:37:36-0400> * @version 2.2.1 * - * A PriorityInheritanceMutex is similar to a PriorityMutex, it is a non-reentrant, - * priority sensitive MUTual EXclusion Lockable object. It differs only in its + * A PriorityInheritanceMutex is similar to a PriorityMutex, it is a non-reentrant, + * priority sensitive MUTual EXclusion Lockable object. It differs only in its * scheduling policy. * * @see PriorityMutex * * Scheduling * - * Threads competing to acquire() a PriorityInheritanceMutex are granted access in + * Threads competing to acquire() a PriorityInheritanceMutex are granted access in * order of priority. Threads with a higher priority will be given access first. * - * When a higher priority thread tries to acquire() a PriorityInheritanceMutex and is + * When a higher priority thread tries to acquire() a PriorityInheritanceMutex and is * about to be blocked by a lower priority thread that has already acquire()d it, the - * lower priority thread will temporarily have its effective priority raised to that - * of the higher priority thread until it release()s the mutex; at which point its - * previous priority will be restored. + * lower priority thread will temporarily have its effective priority raised to that + * of the higher priority thread until it release()s the mutex; at which point its + * previous priority will be restored. */ class ZTHREAD_API PriorityInheritanceMutex : public Lockable, private NonCopyable { - + PriorityInheritanceMutexImpl* _impl; - + public: /** @@ -69,23 +69,23 @@ namespace ZThread { * @see Mutex::~Mutex() */ virtual ~PriorityInheritanceMutex(); - + /** * @see Mutex::acquire() */ - virtual void acquire(); + virtual void acquire(); /** * @see Mutex::tryAcquire(unsigned long timeout) */ - virtual bool tryAcquire(unsigned long timeout); - + virtual bool tryAcquire(unsigned long timeout); + /** * @see Mutex::release() */ virtual void release(); - - }; + + }; } // namespace ZThread diff --git a/dep/include/zthread/PriorityMutex.h b/dep/include/zthread/PriorityMutex.h index 477c8d9fd4d..b1279764eea 100644 --- a/dep/include/zthread/PriorityMutex.h +++ b/dep/include/zthread/PriorityMutex.h @@ -26,8 +26,8 @@ #include "zthread/Lockable.h" #include "zthread/NonCopyable.h" -namespace ZThread { - +namespace ZThread { + class PriorityMutexImpl; /** @@ -36,9 +36,9 @@ namespace ZThread { * @date <2003-07-16T17:35:46-0400> * @version 2.2.1 * - * A PriorityMutex is similar to a Mutex, with exception that a PriorityMutex - * has a difference scheduling policy. It is a non-reentrant, priority sensitive - * MUTual EXclusion Lockable object. + * A PriorityMutex is similar to a Mutex, with exception that a PriorityMutex + * has a difference scheduling policy. It is a non-reentrant, priority sensitive + * MUTual EXclusion Lockable object. * * @see Mutex * @@ -48,9 +48,9 @@ namespace ZThread { * with a higher priority will be given access first. */ class ZTHREAD_API PriorityMutex : public Lockable, private NonCopyable { - + PriorityMutexImpl* _impl; - + public: /** @@ -62,23 +62,23 @@ namespace ZThread { * @see Mutex::~Mutex() */ virtual ~PriorityMutex(); - + /** * @see Mutex::acquire() */ - virtual void acquire(); + virtual void acquire(); /** * @see Mutex::tryAcquire(unsigned long timeout) */ - virtual bool tryAcquire(unsigned long timeout); - + virtual bool tryAcquire(unsigned long timeout); + /** * @see Mutex::release() */ virtual void release(); - - }; + + }; } // namespace ZThread diff --git a/dep/include/zthread/PrioritySemaphore.h b/dep/include/zthread/PrioritySemaphore.h index 54ef2c48c52..887691f72df 100644 --- a/dep/include/zthread/PrioritySemaphore.h +++ b/dep/include/zthread/PrioritySemaphore.h @@ -28,16 +28,16 @@ #include "zthread/NonCopyable.h" namespace ZThread { - + class PrioritySemaphoreImpl; - + /** * @class PrioritySemaphore * @author Eric Crahen * @date <2003-07-16T15:36:07-0400> * @version 2.2.1 * - * A PrioritySemaphore operates in the same way as a Semaphore. Its an owner-less + * A PrioritySemaphore operates in the same way as a Semaphore. Its an owner-less * Lockable object that is sensitive to priority. * * Scheduling @@ -47,17 +47,17 @@ namespace ZThread { * * Error Checking * - * An attempt to increase a PrioritySemaphore beyond its maximum value will result in + * An attempt to increase a PrioritySemaphore beyond its maximum value will result in * an InvalidOp_Exception. * * @see Semaphore */ class ZTHREAD_API PrioritySemaphore : public Lockable, private NonCopyable { - + PrioritySemaphoreImpl* _impl; - + public: - + /** * @see Semaphore::Semaphore(int count, unsigned int maxCount) */ @@ -70,19 +70,19 @@ namespace ZThread { /** * @see Semaphore::wait() - */ + */ void wait(); /** * @see Semaphore::tryWait(unsigned long) - */ + */ bool tryWait(unsigned long); /** * @see Semaphore::post() */ void post(); - + /** * @see Semaphore::count() */ @@ -102,8 +102,8 @@ namespace ZThread { * @see Semaphore::release() */ virtual void release(); - - }; + + }; } // namespace ZThread diff --git a/dep/include/zthread/Queue.h b/dep/include/zthread/Queue.h index 98b83a10c63..11a84330b23 100644 --- a/dep/include/zthread/Queue.h +++ b/dep/include/zthread/Queue.h @@ -35,7 +35,7 @@ namespace ZThread { * @version 2.3.0 * * A Queue defines an interface for a value-oriented collection objects (similar to - * STL collections). + * STL collections). */ template class Queue : public Cancelable, private NonCopyable { @@ -48,7 +48,7 @@ namespace ZThread { * Add an object to this Queue. * * @param item value to be added to the Queue - * + * * @exception Cancellation_Exception thrown if this Queue has been canceled. * * @pre The Queue should not have been canceled prior to the invocation of this function. @@ -63,8 +63,8 @@ namespace ZThread { * @param timeout maximum amount of time (milliseconds) this method may block * the calling thread. * - * @return - * - true if a copy of item can be added before timeout + * @return + * - true if a copy of item can be added before timeout * milliseconds elapse. * - false otherwise. * @@ -79,7 +79,7 @@ namespace ZThread { * Retrieve and remove a value from this Queue. * * @return T next available value - * + * * @exception Cancellation_Exception thrown if this Queue has been canceled. * * @pre The Queue should not have been canceled prior to the invocation of this function. @@ -94,7 +94,7 @@ namespace ZThread { * the calling thread. * * @return T next available value - * + * * @exception Cancellation_Exception thrown if this Queue has been canceled. * @exception Timeout_Exception thrown if the timeout expires before a value * can be retrieved. @@ -110,28 +110,28 @@ namespace ZThread { * the next() methods. * * Canceling a Queue more than once has no effect. - * - * @post The next() methods will continue to return objects until - * the Queue has been emptied. + * + * @post The next() methods will continue to return objects until + * the Queue has been emptied. * @post Once emptied, the next() methods will throw a Cancellation_Exception. * @post The add() methods will throw a Cancellation_Exceptions from this point on. */ virtual void cancel() = 0; /** - * Count the values present in this Queue. + * Count the values present in this Queue. * - * @return size_t number of elements available in the Queue. + * @return size_t number of elements available in the Queue. */ virtual size_t size() = 0; /** - * Count the values present in this Queue. + * Count the values present in this Queue. * * @param timeout maximum amount of time (milliseconds) this method may block * the calling thread. * - * @return size_t number of elements available in the Queue. + * @return size_t number of elements available in the Queue. * * @exception Timeout_Exception thrown if timeout milliseconds * expire before a value becomes available @@ -141,7 +141,7 @@ namespace ZThread { /** * Test whether any values are available in this Queue. * - * @return + * @return * - true if there are no values available. * - false if there are values available. */ @@ -163,7 +163,7 @@ namespace ZThread { * @param timeout maximum amount of time (milliseconds) this method may block * the calling thread. * - * @return + * @return * - true if there are no values available. * - false if there are values available. * diff --git a/dep/include/zthread/ReadWriteLock.h b/dep/include/zthread/ReadWriteLock.h index e01643f1993..38b429b699b 100644 --- a/dep/include/zthread/ReadWriteLock.h +++ b/dep/include/zthread/ReadWriteLock.h @@ -27,10 +27,10 @@ #include "zthread/NonCopyable.h" namespace ZThread { - + /** * @class ReadWriteLock - * + * * @author Eric Crahen * @date <2003-07-16T10:17:31-0400> * @version 2.2.7 @@ -40,21 +40,21 @@ namespace ZThread { * * @see BiasedReadWriteLock * @see FairReadWriteLock - */ + */ class ReadWriteLock : public NonCopyable { public: /** * Create a ReadWriteLock * - * @exception Initialization_Exception thrown if resources could not be + * @exception Initialization_Exception thrown if resources could not be * allocated for this object. */ ReadWriteLock() {} - + //! Destroy this ReadWriteLock - virtual ~ReadWriteLock() {} - + virtual ~ReadWriteLock() {} + /** * Get a reference to the read-only Lockable. * @@ -71,7 +71,7 @@ namespace ZThread { */ virtual Lockable& getWriteLock() = 0; - + }; /* ReadWriteLock */ diff --git a/dep/include/zthread/RecursiveMutex.h b/dep/include/zthread/RecursiveMutex.h index 7dda9c5119b..25df4484b6b 100644 --- a/dep/include/zthread/RecursiveMutex.h +++ b/dep/include/zthread/RecursiveMutex.h @@ -26,8 +26,8 @@ #include "zthread/Lockable.h" #include "zthread/NonCopyable.h" -namespace ZThread { - +namespace ZThread { + class RecursiveMutexImpl; /** @@ -37,9 +37,9 @@ namespace ZThread { * @date <2003-07-16T17:51:33-0400> * @version 2.2.1 * - * A RecursiveMutex is a recursive, MUTual EXclusion Lockable object. It is - * recursive because it can be acquire()d and release()d more than once - * by the same thread, instead of causing a Deadlock_Exception. + * A RecursiveMutex is a recursive, MUTual EXclusion Lockable object. It is + * recursive because it can be acquire()d and release()d more than once + * by the same thread, instead of causing a Deadlock_Exception. * * @see Mutex * @see Guard @@ -50,15 +50,15 @@ namespace ZThread { * * Error Checking * - * A Mutex will throw an InvalidOp_Exception if an attempt to release() a Mutex is + * A Mutex will throw an InvalidOp_Exception if an attempt to release() a Mutex is * made from the context of a thread that does not currently own that Mutex. */ class ZTHREAD_API RecursiveMutex : public Lockable, private NonCopyable { - + RecursiveMutexImpl* _impl; - + public: - + //! Create a new RecursiveMutex. RecursiveMutex(); @@ -66,10 +66,10 @@ namespace ZThread { virtual ~RecursiveMutex(); /** - * Acquire a RecursiveMutex, possibly blocking until the the current owner of the + * Acquire a RecursiveMutex, possibly blocking until the the current owner of the * releases it or until an exception is thrown. * - * Only one thread may acquire the RecursiveMutex at any given time. + * Only one thread may acquire the RecursiveMutex at any given time. * The same thread may acquire a RecursiveMutex multiple times. * * @exception Interrupted_Exception thrown when the calling thread is interrupted. @@ -80,18 +80,18 @@ namespace ZThread { * * @see Lockable::acquire() */ - virtual void acquire(); + virtual void acquire(); /** - * Acquire a RecursiveMutex, possibly blocking until the the current owner + * Acquire a RecursiveMutex, possibly blocking until the the current owner * releases it, until an exception is thrown or until the given amount * of time expires. * - * Only one thread may acquire the RecursiveMutex at any given time. + * Only one thread may acquire the RecursiveMutex at any given time. * The same thread may acquire a RecursiveMutex multiple times. * * @param timeout maximum amount of time (milliseconds) this method could block - * @return + * @return * - true if the lock was acquired * - false if the lock was acquired * @@ -108,16 +108,16 @@ namespace ZThread { /** * Release exclusive access. No safety or state checks are performed. - * - * @pre This should not be called more times than the acquire() method was + * + * @pre This should not be called more times than the acquire() method was * called. * * @see Lockable::release() */ virtual void release(); - - }; - + + }; + } // namespace ZThread #endif // __ZTRECURSIVEMUTEX_H__ diff --git a/dep/include/zthread/Runnable.h b/dep/include/zthread/Runnable.h index 98628530a14..bfe8d03a58f 100644 --- a/dep/include/zthread/Runnable.h +++ b/dep/include/zthread/Runnable.h @@ -30,7 +30,7 @@ namespace ZThread { /** * @class Runnable - * + * * @author Eric Crahen * @date <2003-07-16T17:45:35-0400> * @version 2.2.11 @@ -51,7 +51,7 @@ namespace ZThread { virtual void run() = 0; }; - + } diff --git a/dep/include/zthread/Semaphore.h b/dep/include/zthread/Semaphore.h index 2a9e4d02d03..b01c77804ba 100644 --- a/dep/include/zthread/Semaphore.h +++ b/dep/include/zthread/Semaphore.h @@ -27,16 +27,16 @@ #include "zthread/NonCopyable.h" namespace ZThread { - + class FifoSemaphoreImpl; - + /** * @class Semaphore * @author Eric Crahen * @date <2003-07-16T15:28:01-0400> * @version 2.2.1 * - * A Semaphore is an owner-less Lockable object. Its probably best described as + * A Semaphore is an owner-less Lockable object. Its probably best described as * a set of 'permits'. A Semaphore is initialized with an initial count and * a maximum count, these would correspond to the number of 'permits' currently * available and the number of' permits' in total. @@ -44,28 +44,28 @@ namespace ZThread { * - Acquiring the Semaphore means taking a permit, but if there are none * (the count is 0) the Semaphore will block the calling thread. * - * - Releasing the Semaphore means returning a permit, unblocking a thread + * - Releasing the Semaphore means returning a permit, unblocking a thread * waiting for one. * - * A Semaphore with an initial value of 1 and maximum value of 1 will act as + * A Semaphore with an initial value of 1 and maximum value of 1 will act as * a Mutex. * * Threads blocked on a Semaphore are resumed in FIFO order. * */ class ZTHREAD_API Semaphore : public Lockable, private NonCopyable { - + FifoSemaphoreImpl* _impl; - + public: - + /** - * Create a new Semaphore. + * Create a new Semaphore. * * @param count initial count * @param maxCount maximum count */ - Semaphore(int count = 1, unsigned int maxCount = 1); + Semaphore(int count = 1, unsigned int maxCount = 1); //! Destroy the Semaphore virtual ~Semaphore(); @@ -74,8 +74,8 @@ namespace ZThread { * Provided to reflect the traditional Semaphore semantics * * @see acquire() - */ - void wait(); + */ + void wait(); /** @@ -83,52 +83,52 @@ namespace ZThread { * * @see tryAcquire(unsigned long timeout) */ - bool tryWait(unsigned long timeout); + bool tryWait(unsigned long timeout); /** * Provided to reflect the traditional Semaphore semantics * * @see release() */ - void post(); + void post(); + - /** - * Get the current count of the semaphore. + * Get the current count of the semaphore. * * This value may change immediately after this function returns to the calling thread. * * @return int count */ - virtual int count(); + virtual int count(); /** - * Decrement the count, blocking that calling thread if the count becomes 0 or - * less than 0. The calling thread will remain blocked until the count is + * Decrement the count, blocking that calling thread if the count becomes 0 or + * less than 0. The calling thread will remain blocked until the count is * raised above 0, an exception is thrown or the given amount of time expires. - * + * * @param timeout maximum amount of time (milliseconds) this method could block - * - * @return + * + * @return * - true if the Semaphore was acquired before timeout milliseconds elapse. * - false otherwise. * * @exception Interrupted_Exception thrown when the calling thread is interrupted. * A thread may be interrupted at any time, prematurely ending any wait. - * + * * @see Lockable::tryAcquire(unsigned long timeout) */ - virtual bool tryAcquire(unsigned long timeout); - + virtual bool tryAcquire(unsigned long timeout); + /** - * Decrement the count, blocking that calling thread if the count becomes 0 or - * less than 0. The calling thread will remain blocked until the count is + * Decrement the count, blocking that calling thread if the count becomes 0 or + * less than 0. The calling thread will remain blocked until the count is * raised above 0 or if an exception is thrown. - * + * * @exception Interrupted_Exception thrown when the calling thread is interrupted. * A thread may be interrupted at any time, prematurely ending any wait. - * + * * @see Lockable::acquire() */ virtual void acquire(); @@ -137,12 +137,12 @@ namespace ZThread { * Increment the count, unblocking one thread if count is positive. * * @exception InvalidOp_Exception thrown if the maximum count would be exceeded. - * + * * @see Lockable::release() */ virtual void release(); - - }; + + }; } // namespace ZThread diff --git a/dep/include/zthread/Singleton.h b/dep/include/zthread/Singleton.h index b66c9d0898a..b8f0d1ea842 100644 --- a/dep/include/zthread/Singleton.h +++ b/dep/include/zthread/Singleton.h @@ -32,7 +32,7 @@ namespace ZThread { // // This policy controls how an object is instantiated // as well as how and when its destroyed. Phoenix-style -// singletons are not supported easily with type of policy, +// singletons are not supported easily with type of policy, // this is intentional since I do not believe that is in // the true spirit of a singleton. // @@ -46,9 +46,9 @@ namespace ZThread { * @class LocalStaticInstantiation * @author Eric Crahen * @date <2003-07-16T17:57:45-0400> - * @version 2.2.0 + * @version 2.2.0 * - * The LocalStaticInstantiation policy allows the creation + * The LocalStaticInstantiation policy allows the creation * and lifetime of an instance of a particular type * to be managed using static local values. This will * abide by the standard C++ rules for static objects @@ -61,12 +61,12 @@ protected: * Create an instance of an object, using a local static. The * object will be destroyed by the system. * - * @param ptr reference to location to receive the address + * @param ptr reference to location to receive the address * of the allocated object */ template static void create(T*& ptr) { - + static T instance; ptr = &instance; @@ -91,9 +91,9 @@ class StaticInstantiationHelper { * @class StaticInstantiation * @author Eric Crahen * @date <2003-07-16T17:57:45-0400> - * @version 2.2.0 + * @version 2.2.0 * - * The StaticInstantiation policy allows the creation + * The StaticInstantiation policy allows the creation * and lifetime of an instance of a particular type * to be managed using static instantiation. This will * abide by the standard C++ rules for static objects @@ -105,7 +105,7 @@ protected: /** * Create an instance of an object using by simply allocating it statically. * - * @param ptr reference to location to receive the address + * @param ptr reference to location to receive the address * of the allocated object */ template @@ -118,32 +118,32 @@ protected: //! SingletonDestroyer template class Destroyer { - + T* doomed; - + public: - + Destroyer(T* q) : doomed(q) { assert(doomed); } - + ~Destroyer(); }; template Destroyer::~Destroyer() { - + try { - + if(doomed) delete doomed; - + } catch(...) { } - + doomed = 0; - -} + +} /** @@ -152,10 +152,10 @@ Destroyer::~Destroyer() { * @date <2003-07-16T17:57:45-0400> * @version 2.2.0 * - * The LazyInstantiation policy allows the creation + * The LazyInstantiation policy allows the creation * and lifetime of an instance of a particular type * to be managed using dynamic allocation and a singleton - * destroyer. This will abide by the standard C++ rules + * destroyer. This will abide by the standard C++ rules * for static objects lifetimes. */ class LazyInstantiation { @@ -166,33 +166,33 @@ protected: * destroyed when an associated Destroyer object (allocated * statically) goes out of scope. * - * @param ptr reference to location to receive the address + * @param ptr reference to location to receive the address * of the allocated object */ template static void create(T*& ptr) { - + ptr = new T; static Destroyer destroyer(ptr); - + } }; - + /** * @class Singleton * @author Eric Crahen * @date <2003-07-16T17:57:45-0400> - * @version 2.2.0 + * @version 2.2.0 * * Based on the work of John Vlissidles in his book 'Pattern Hatching' * an article by Douglas Schmidtt on double-checked locking and policy * templates described by Andrei Alexandrescu. * - * This is a thread safe wrapper for creating Singleton classes. The + * This is a thread safe wrapper for creating Singleton classes. The * synchronization method and instantiation methods can be changed - * easily by specifying different policy implementations as the + * easily by specifying different policy implementations as the * templates parameters. * * @code @@ -200,7 +200,7 @@ protected: * // Most common Singleton * Singletion * - * // Singleton that uses static storage + * // Singleton that uses static storage * Singletion * * // Single-threaded singleton that uses static storage (Meyers-like) @@ -213,9 +213,9 @@ class Singleton : private InstantiationPolicy, private NonCopyable { public: /** - * Provide access to the single instance through double-checked locking + * Provide access to the single instance through double-checked locking * - * @return T* single instance + * @return T* single instance */ static T* instance(); @@ -226,19 +226,19 @@ T* Singleton::instance() { // Uses local static storage to avoid static construction // sequence issues. (regaring when the lock is created) - static T* ptr = 0; + static T* ptr = 0; static LockType lock; if(!ptr) { Guard g(lock); - if(!ptr) + if(!ptr) InstantiationPolicy::create(ptr); } - + return const_cast(ptr); - + } diff --git a/dep/include/zthread/SynchronousExecutor.h b/dep/include/zthread/SynchronousExecutor.h index b6dbbef6af6..bc9de273c4c 100644 --- a/dep/include/zthread/SynchronousExecutor.h +++ b/dep/include/zthread/SynchronousExecutor.h @@ -37,14 +37,14 @@ namespace ZThread { * @date <2003-07-16T22:33:51-0400> * @version 2.3.0 * - * A SynchronousExecutor is an Executor which runs tasks using the thread that + * A SynchronousExecutor is an Executor which runs tasks using the thread that * submits the task. It runs tasks serially, one at a time, in the order they * were submitted to the executor. * * @see Executor. */ class SynchronousExecutor : public Executor { - + //! Serialize access Mutex _lock; @@ -65,10 +65,10 @@ namespace ZThread { virtual void interrupt(); /** - * Submit a task to this Executor, blocking the calling thread until the - * task is executed. + * Submit a task to this Executor, blocking the calling thread until the + * task is executed. * - * @param task Task to be run by a thread managed by this executor + * @param task Task to be run by a thread managed by this executor * * @pre The Executor should have been canceled prior to this invocation. * @post The submitted task will be run at some point in the future by this Executor. @@ -84,12 +84,12 @@ namespace ZThread { * @see Cancelable::cancel() */ virtual void cancel(); - + /** * @see Cancelable::cancel() */ virtual bool isCanceled(); - + /** * Block the calling thread until all tasks submitted prior to this invocation * complete. @@ -105,14 +105,14 @@ namespace ZThread { * Block the calling thread until all tasks submitted prior to this invocation * complete or until the calling thread is interrupted. * - * @param timeout - maximum amount of time, in milliseconds, to wait for the + * @param timeout - maximum amount of time, in milliseconds, to wait for the * currently submitted set of Tasks to complete. * * @exception Interrupted_Exception thrown if the calling thread is interrupted * before the set of tasks being wait for can complete. * - * @return - * - true if the set of tasks being wait for complete before + * @return + * - true if the set of tasks being wait for complete before * timeout milliseconds elapse. * - false othewise. */ diff --git a/dep/include/zthread/Task.h b/dep/include/zthread/Task.h index 6503be66f33..850ab98c043 100644 --- a/dep/include/zthread/Task.h +++ b/dep/include/zthread/Task.h @@ -27,9 +27,9 @@ #include "zthread/Runnable.h" namespace ZThread { - + class ThreadImpl; - + /** * @class Task * @@ -37,9 +37,9 @@ namespace ZThread { * @date <2003-07-20T05:22:38-0400> * @version 2.3.0 * - * A Task provides a CountedPtr wrapper for Runnable objects. - * This wrapper enables an implicit conversion from a - * Runnable* to a Task adding some syntactic sugar + * A Task provides a CountedPtr wrapper for Runnable objects. + * This wrapper enables an implicit conversion from a + * Runnable* to a Task adding some syntactic sugar * to the interface. */ class ZTHREAD_API Task : public CountedPtr { @@ -47,29 +47,29 @@ namespace ZThread { #if !defined(_MSC_VER) || (_MSC_VER > 1200) - + Task(Runnable* raw) - : CountedPtr(raw) { } + : CountedPtr(raw) { } #endif - + template Task(U* raw) - : CountedPtr(raw) { } - - Task(const CountedPtr& ptr) - : CountedPtr(ptr) { } - + : CountedPtr(raw) { } + + Task(const CountedPtr& ptr) + : CountedPtr(ptr) { } + template - Task(const CountedPtr& ptr) - : CountedPtr(ptr) { } - + Task(const CountedPtr& ptr) + : CountedPtr(ptr) { } + void operator()() { (*this)->run(); } - + }; /* Task */ - + } // namespace ZThread #endif // __ZTTASK_H__ diff --git a/dep/include/zthread/Thread.h b/dep/include/zthread/Thread.h index e1700c737fa..23ecd1af4bf 100644 --- a/dep/include/zthread/Thread.h +++ b/dep/include/zthread/Thread.h @@ -30,9 +30,9 @@ #include "zthread/Waitable.h" namespace ZThread { - + class ThreadImpl; - + /** * @class Thread * @author Eric Crahen @@ -50,8 +50,8 @@ namespace ZThread { * *

Launching a task

* - * A thread is started simply by constructing a thread object and giving - * it a task to perform. The thread will continue to run its task, even + * A thread is started simply by constructing a thread object and giving + * it a task to perform. The thread will continue to run its task, even * after the Thread object used to launch the thread has gone out of scope. * * @code @@ -74,12 +74,12 @@ namespace ZThread { * int main() { * * try { - * + * * // Implictly constructs a Task * Thread t(new aRunnable); * - * } catch(Synchronization_Exception& e) { - * std::cerr << e.what() << std::endl; + * } catch(Synchronization_Exception& e) { + * std::cerr << e.what() << std::endl; * } * * std::cout << "Hello from the main thread" << std::endl; @@ -121,13 +121,13 @@ namespace ZThread { * int main() { * * try { - * + * * // Implictly constructs a Task * Thread t(new aRunnable); * t.wait(); * - * } catch(Synchronization_Exception& e) { - * std::cerr << e.what() << std::endl; + * } catch(Synchronization_Exception& e) { + * std::cerr << e.what() << std::endl; * } * * std::cout << "Hello from the main thread" << std::endl; @@ -169,7 +169,7 @@ namespace ZThread { * int main() { * * try { - * + * * // Explictly constructs a Task * Task task(new aRunnable); * @@ -177,8 +177,8 @@ namespace ZThread { * Thread t1(task); * Thread t2(task); * - * } catch(Synchronization_Exception& e) { - * std::cerr << e.what() << std::endl; + * } catch(Synchronization_Exception& e) { + * std::cerr << e.what() << std::endl; * } * * std::cout << "Hello from the main thread" << std::endl; @@ -195,7 +195,7 @@ namespace ZThread { * * @endcode */ - class ZTHREAD_API Thread + class ZTHREAD_API Thread : public Cancelable, public Waitable, public NonCopyable { //! Delegate @@ -212,7 +212,7 @@ namespace ZThread { /** * Create a Thread that spawns a new thread to run the given task. * - * @param task Task to be run by a thread managed by this executor + * @param task Task to be run by a thread managed by this executor * @param autoCancel flag to requestion automatic cancellation * * @post if the autoCancel flag was true, this thread will @@ -241,17 +241,17 @@ namespace ZThread { * @exception Interrupted_Exception thrown if the joining thread has been interrupt()ed */ void wait(); - + /** * Wait for the thread represented by this object to complete its task. * The calling thread is blocked until the thread represented by this * object exits, or until the timeout expires. * - * @param timeout maximum amount of time (milliseconds) this method + * @param timeout maximum amount of time (milliseconds) this method * could block the calling thread. * - * @return - * - true if the thread task complete before timeout + * @return + * - true if the thread task complete before timeout * milliseconds elapse. * - false othewise. * @@ -260,10 +260,10 @@ namespace ZThread { * @exception Interrupted_Exception thrown if the joining thread has been interrupt()ed */ bool wait(unsigned long timeout); - + /** * Change the priority of this Thread. This will change the actual - * priority of the thread when the OS supports it. + * priority of the thread when the OS supports it. * * If there is no real priority support, it's simulated. * @@ -280,18 +280,18 @@ namespace ZThread { /** * Interrupts this thread, setting the interrupted status of the thread. - * This status is cleared by one of three methods. + * This status is cleared by one of three methods. * * If this thread is blocked when this method is called, the thread will * abort that blocking operation with an Interrupted_Exception. * * - The first is by attempting an operation on a synchronization object that - * would normally block the calling thread; Instead of blocking the calling + * would normally block the calling thread; Instead of blocking the calling * the calling thread, the function that would normally block will thrown an * Interrupted_Exception and clear the interrupted status of the thread. * * - The second is by calling Thread::interrupted(). - * + * * - The third is by calling Thread::canceled(). * * Threads already blocked by an operation on a synchronization object will abort @@ -300,7 +300,7 @@ namespace ZThread { * * Interrupting a thread that is no longer running will have no effect. * - * @return + * @return * - true if the thread was interrupted while not blocked by a wait * on a synchronization object. * - false othewise. @@ -311,11 +311,11 @@ namespace ZThread { * Tests whether the current Thread has been interrupt()ed, clearing * its interruption status. * - * @return + * @return * - true if the Thread was interrupted. * - false otherwise. * - * @post The interrupted status of the current thread will be cleared, + * @post The interrupted status of the current thread will be cleared, * allowing it to perform a blocking operation on a synchronization * object without throwing an exception. */ @@ -333,16 +333,16 @@ namespace ZThread { * Tests whether this thread has been canceled. If called from the context * of this thread, the interrupted status is cleared. * - * @return + * @return * - true if the Thread was canceled. * - false otherwise. - * + * * @see Cancelable::isCanceled() */ virtual bool isCanceled(); /** - * Interrupt and cancel this thread in a single operation. The thread will + * Interrupt and cancel this thread in a single operation. The thread will * return true whenever its cancelation status is tested in the future. * * @exception InvalidOp_Exception thrown if a thread attempts to cancel itself diff --git a/dep/include/zthread/ThreadLocal.h b/dep/include/zthread/ThreadLocal.h index bb83a0fe3ef..7cccab4ca69 100644 --- a/dep/include/zthread/ThreadLocal.h +++ b/dep/include/zthread/ThreadLocal.h @@ -34,30 +34,30 @@ namespace ZThread { * @date <2003-07-27T11:18:21-0400> * @version 2.3.0 * - * Provides access to store and retrieve value types to and from a thread local + * Provides access to store and retrieve value types to and from a thread local * storage context. A thread local storage context consists of the calling thread * a specific ThreadLocal object. Since this context is specific to each thread - * whenever a value is stored in a ThreadLocal that is accessible from multiple - * threads, it can only be retrieved by the thread that stored it. + * whenever a value is stored in a ThreadLocal that is accessible from multiple + * threads, it can only be retrieved by the thread that stored it. * * The first time a thread accesses the value associated with a thread local storage - * context, a value is created. That value is either an initial value (determined by + * context, a value is created. That value is either an initial value (determined by * InitialValueT) or an inherited value (determined by ChildValueT). * * - If a threads parent had no value associated with a ThreadLocal when the thread was created, * then the InitialValueT functor is used to create an initial value. * - * - If a threads parent did have a value associated with a ThreadLocal when the thread was + * - If a threads parent did have a value associated with a ThreadLocal when the thread was * created, then the childValueT functor is used to create an initial value. * * Not all ThreadLocal's support the inheritance of values from parent threads. The default * behavoir is to create values through the InitialValueT functor for all thread when - * they first access a thread local storage context. - * + * they first access a thread local storage context. + * * - Inheritance is enabled automatically when a user supplies a ChildValueT functor other * than the default one supplied. * - * - Inheritance can be controlled explicitly by the user through a third functor, + * - Inheritance can be controlled explicitly by the user through a third functor, * InheritableValueT. * *

Examples

@@ -68,9 +68,9 @@ namespace ZThread { * *

Default initial value

* A ThreadLocal that does not inherit, and uses the default value - * for an int as its initial value. + * for an int as its initial value. * - * @code + * @code * * #include "zthread/ThreadLocal.h" * #include "zthread/Thread.h" @@ -82,7 +82,7 @@ namespace ZThread { * ThreadLocal localValue; * public: * void run() { - * std::cout << localValue.get() << std::endl; + * std::cout << localValue.get() << std::endl; * } * }; * @@ -110,7 +110,7 @@ namespace ZThread { *

User-specified initial value

* A ThreadLocal that does not inherit, and uses a custom initial value. * - * @code + * @code * * #include "zthread/ThreadLocal.h" * #include "zthread/Thread.h" @@ -119,10 +119,10 @@ namespace ZThread { * using namespace ZThread; * * struct anInitialValueFn { - * int operator()() { + * int operator()() { * static int next = 100; * int val = next; next += 100; - * return val; + * return val; * } * }; * @@ -130,7 +130,7 @@ namespace ZThread { * ThreadLocal localValue; * public: * void run() { - * std::cout << localValue.get() << std::endl; + * std::cout << localValue.get() << std::endl; * } * }; * @@ -156,10 +156,10 @@ namespace ZThread { * @endcode * *

User-specified inherited value

- * A ThreadLocal that does inherit and modify child values. + * A ThreadLocal that does inherit and modify child values. * (The default initial value functor is used) * - * @code + * @code * * #include "zthread/ThreadLocal.h" * #include "zthread/Thread.h" @@ -168,18 +168,18 @@ namespace ZThread { * using namespace ZThread; * * struct anInheritedValueFn { - * int operator()(int val) { - * return val + 100; + * int operator()(int val) { + * return val + 100; * } * }; * - * // This Runnable associates no ThreadLocal value in the main thread; so + * // This Runnable associates no ThreadLocal value in the main thread; so * // none of the child threads have anything to inherit. * class aRunnable : public Runnable { * ThreadLocal, anInheritedValueFn> localValue; * public: * void run() { - * std::cout << localValue.get() << std::endl; + * std::cout << localValue.get() << std::endl; * } * }; * @@ -188,11 +188,11 @@ namespace ZThread { * class anotherRunnable : public Runnable { * ThreadLocal, anInheritedValueFn> localValue; * public: - * anotherRunnable() { + * anotherRunnable() { * localValue.set(100); * } * void run() { - * std::cout << localValue.get() << std::endl; + * std::cout << localValue.get() << std::endl; * } * }; * @@ -238,7 +238,7 @@ namespace ZThread { * * * // required operator - * T operator() + * T operator() * * // supported expression * InitialValueT()() @@ -249,12 +249,12 @@ namespace ZThread { * * This template parameter should indicate the functor used to set * the value that will be inherited by thread whose parent have associated - * a value with the ThreadLocal's context at the time they are created. + * a value with the ThreadLocal's context at the time they are created. * It should support the following operator: * * * // required operator - * T operator(const T& parentValue) + * T operator(const T& parentValue) * * // supported expression * ChildValueT()(parentValue) @@ -270,7 +270,7 @@ namespace ZThread { * * * // required operator - * bool operator(const T& childValueFunctor) + * bool operator(const T& childValueFunctor) * * // supported expression * InheritableValueT()( ChildValueT() ) @@ -278,9 +278,9 @@ namespace ZThread { * */ template < - typename T, + typename T, typename InitialValueT = ThreadLocalImpl::InitialValueFn, - typename ChildValueT = ThreadLocalImpl::UniqueChildValueFn, + typename ChildValueT = ThreadLocalImpl::UniqueChildValueFn, typename InheritableValueT = ThreadLocalImpl::InheritableValueFn > class ThreadLocal : private ThreadLocalImpl { @@ -288,39 +288,39 @@ namespace ZThread { typedef ThreadLocalImpl::ValuePtr ValuePtr; class Value : public ThreadLocalImpl::Value { - + T value; - + public: - + Value() : value( InitialValueT()() ) { } - + Value(const Value& v) : value( ChildValueT()(v.value) ) { } - - virtual ~Value() { } - + + virtual ~Value() { } + operator T() { return value; } - + const Value& operator=(const T& v) { value = v; } - + virtual bool isInheritable() const { return InheritableValueT()( ChildValueT() ); } - + virtual ValuePtr clone() const { return ValuePtr( new Value(*this) ); } - + }; - + static ValuePtr createValue() { return ValuePtr( new Value ); } - + public: /** - * Get the value associated with the context (this ThreadLocal and + * Get the value associated with the context (this ThreadLocal and * the calling thread) of the invoker. If no value is currently * associated, then an intial value is created and associated; that value * is returned. @@ -329,14 +329,14 @@ namespace ZThread { * * @post If no value has been associated with the invoking context * then an inital value will be associated. That value is - * created by the InitialValueT functor. + * created by the InitialValueT functor. */ - T get() const { + T get() const { return (T)reinterpret_cast( *value(&createValue) ); } - + /** - * Replace the value associated with the context (this ThreadLocal and + * Replace the value associated with the context (this ThreadLocal and * the calling thread) of the invoker. If no value is currently * associated, then an intial value is first created and subsequently * replaced by the new value. @@ -345,18 +345,18 @@ namespace ZThread { * * @post If no value has been associated with the invoking context * then an inital value will first be associated. That value is - * created by the InitialValueT functor and then - * replaced with the new value. + * created by the InitialValueT functor and then + * replaced with the new value. */ void set(T v) const { reinterpret_cast( *value(&createValue) ) = v; } /** - * Remove any value current associated with this ThreadLocal. - * - * @post Upon thier next invocation the get() and set() functions will behave as - * if no value has been associated with this ThreadLocal and an + * Remove any value current associated with this ThreadLocal. + * + * @post Upon thier next invocation the get() and set() functions will behave as + * if no value has been associated with this ThreadLocal and an * initial value will be generated. */ void clear() const { @@ -364,10 +364,10 @@ namespace ZThread { } /** - * Remove any value current associated with any ThreadLocal. - * - * @post Upon thier next invocation the get() and set() functions will behave as - * if no value has been associated with any ThreadLocal and new + * Remove any value current associated with any ThreadLocal. + * + * @post Upon thier next invocation the get() and set() functions will behave as + * if no value has been associated with any ThreadLocal and new * initial values will be generated. */ static void clearAll() { diff --git a/dep/include/zthread/ThreadLocalImpl.h b/dep/include/zthread/ThreadLocalImpl.h index 3b4046f8f58..be000dfa695 100644 --- a/dep/include/zthread/ThreadLocalImpl.h +++ b/dep/include/zthread/ThreadLocalImpl.h @@ -35,7 +35,7 @@ namespace ZThread { * * @see ThreadLocal */ - class ZTHREAD_API ThreadLocalImpl : private NonCopyable { + class ZTHREAD_API ThreadLocalImpl : private NonCopyable { public: class Value; @@ -52,17 +52,17 @@ namespace ZThread { //! Create a ThreadLocalImpl ThreadLocalImpl(); - + //! Destroy a ThreadLocalImpl ~ThreadLocalImpl(); - + /** * @class InitialValueFn */ template - struct InitialValueFn { + struct InitialValueFn { T operator()() { return T(); } - }; + }; /** * @class ChildValueFn @@ -71,18 +71,18 @@ namespace ZThread { template T operator()(const T& value) { return T(value); } }; - + /** * @class UniqueChildValueFn */ struct UniqueChildValueFn : public ChildValueFn { }; - + /** * @class InheritableValueFn */ struct InheritableValueFn { - template + template bool operator()(const T&) { return true; } bool operator()(const UniqueChildValueFn&) { return false; } diff --git a/dep/include/zthread/ThreadedExecutor.h b/dep/include/zthread/ThreadedExecutor.h index 9bc29b3c497..469a112f6bc 100644 --- a/dep/include/zthread/ThreadedExecutor.h +++ b/dep/include/zthread/ThreadedExecutor.h @@ -40,21 +40,21 @@ namespace ZThread { * A ThreadedExecutor spawns a new thread to execute each task submitted. * A ThreadedExecutor supports the following optional operations, * - * - cancel()ing a ThreadedExecutor will cause it to stop accepting - * new tasks. + * - cancel()ing a ThreadedExecutor will cause it to stop accepting + * new tasks. * - * - interrupt()ing a ThreadedExecutor will cause the any thread running - * a task which was submitted prior to the invocation of this function to + * - interrupt()ing a ThreadedExecutor will cause the any thread running + * a task which was submitted prior to the invocation of this function to * be interrupted during the execution of that task. * - * - wait()ing on a ThreadedExecutor will block the calling thread + * - wait()ing on a ThreadedExecutor will block the calling thread * until all tasks that were submitted prior to the invocation of this function * have completed. - * + * * @see Executor. */ class ThreadedExecutor : public Executor { - + CountedPtr< ExecutorImpl > _impl; public: @@ -68,16 +68,16 @@ namespace ZThread { /** * Interrupting a ThreadedExecutor will cause an interrupt() to be sent * to every Task that has been submitted at the time this function is - * called. Tasks that are submitted after this function is called will + * called. Tasks that are submitted after this function is called will * not be interrupt()ed; unless this function is invoked again(). */ virtual void interrupt(); - + /** - * Submit a task to this Executor. This will not block the current thread + * Submit a task to this Executor. This will not block the current thread * for very long. A new thread will be created and the task will be run() * within the context of that new thread. - * + * * @exception Cancellation_Exception thrown if this Executor has been canceled. * The Task being submitted will not be executed by this Executor. * @@ -89,12 +89,12 @@ namespace ZThread { * @see Cancelable::cancel() */ virtual void cancel(); - + /** * @see Cancelable::isCanceled() */ virtual bool isCanceled(); - + /** * Waiting on a ThreadedExecutor will block the current thread until all * tasks submitted to the Executor up until the time this function was called @@ -112,15 +112,15 @@ namespace ZThread { virtual void wait(); /** - * Operates the same as ThreadedExecutor::wait() but with a timeout. + * Operates the same as ThreadedExecutor::wait() but with a timeout. * - * @param timeout maximum amount of time, in milliseconds, to wait for the + * @param timeout maximum amount of time, in milliseconds, to wait for the * currently submitted set of Tasks to complete. * * @exception Interrupted_Exception thrown if the calling thread is interrupt()ed * while waiting for the current set of Tasks to complete. * - * @return + * @return * - true if the set of tasks running at the time this function is invoked complete * before timeout milliseconds elapse. * - false othewise. diff --git a/dep/include/zthread/Waitable.h b/dep/include/zthread/Waitable.h index 3d925f2a691..17260370316 100644 --- a/dep/include/zthread/Waitable.h +++ b/dep/include/zthread/Waitable.h @@ -25,7 +25,7 @@ #include "zthread/Exceptions.h" -namespace ZThread { +namespace ZThread { /** * @class Waitable @@ -35,21 +35,21 @@ namespace ZThread { * @version 2.3.0 * * The Waitable interface defines a common method of adding generic wait semantics - * to a class. + * to a class. * * Waiting * * An object implementing the Waitable interface externalizes a mechanism for testing - * some internal condition. Another object may wait()s for a Waitable object; - * in doing so, it wait()s for that condition to become true by blocking the caller + * some internal condition. Another object may wait()s for a Waitable object; + * in doing so, it wait()s for that condition to become true by blocking the caller * while the condition is false. * * For example, a Condition is Waitable object that extends wait semantics - * so that wait()ing means a thread is blocked until some external stimulus - * specifically performs an operation on the Condition to make its internal condition true. + * so that wait()ing means a thread is blocked until some external stimulus + * specifically performs an operation on the Condition to make its internal condition true. * (serialization aside) * - * A Barrier extends wait semantics so that wait()ing mean waiting for other + * A Barrier extends wait semantics so that wait()ing mean waiting for other * waiters, and may include automatically resetting the condition once a wait is complete. * * @see Condition @@ -57,9 +57,9 @@ namespace ZThread { * @see Executor */ class Waitable { - public: - - //! Destroy a Waitable object. + public: + + //! Destroy a Waitable object. virtual ~Waitable() {} /** @@ -78,14 +78,14 @@ namespace ZThread { * * @param timeout maximum amount of time, in milliseconds, to spend waiting. * - * @return - * - true if the set of tasks being wait for complete before + * @return + * - true if the set of tasks being wait for complete before * timeout milliseconds elapse. * - false othewise. */ virtual bool wait(unsigned long timeout) = 0; - + }; /* Waitable */ diff --git a/dep/src/g3dlite/AABox.cpp b/dep/src/g3dlite/AABox.cpp index d147a1080e8..0baa1a07419 100644 --- a/dep/src/g3dlite/AABox.cpp +++ b/dep/src/g3dlite/AABox.cpp @@ -59,22 +59,22 @@ Vector3 AABox::randomSurfacePoint() const { // The probability of choosing a given face is proportional to // its area. if (r < aXY) { - return - lo + + return + lo + Vector3( (float)random(0, extent.x), (float)random(0, extent.y), d * extent.z); } else if (r < aYZ) { - return - lo + + return + lo + Vector3( d * extent.x, (float)random(0, extent.y), (float)random(0, extent.z)); } else { - return - lo + + return + lo + Vector3( (float)random(0, extent.x), d * extent.y, @@ -85,8 +85,8 @@ Vector3 AABox::randomSurfacePoint() const { Vector3 AABox::randomInteriorPoint() const { return Vector3( - (float)random(lo.x, hi.x), - (float)random(lo.y, hi.y), + (float)random(lo.x, hi.x), + (float)random(lo.y, hi.y), (float)random(lo.z, hi.z)); } #endif @@ -112,21 +112,21 @@ bool AABox::intersects(const AABox& other) const { bool AABox::culledBy( - const Array& plane, - int& cullingPlaneIndex, - const uint32 inMask, - uint32& outMask) const { + const Array& plane, + int& cullingPlaneIndex, + const uint32 inMask, + uint32& outMask) const { - return culledBy(plane.getCArray(), plane.size(), cullingPlaneIndex, inMask, outMask); + return culledBy(plane.getCArray(), plane.size(), cullingPlaneIndex, inMask, outMask); } bool AABox::culledBy( - const Array& plane, - int& cullingPlaneIndex, - const uint32 inMask) const { + const Array& plane, + int& cullingPlaneIndex, + const uint32 inMask) const { - return culledBy(plane.getCArray(), plane.size(), cullingPlaneIndex, inMask); + return culledBy(plane.getCArray(), plane.size(), cullingPlaneIndex, inMask); } @@ -136,16 +136,16 @@ int AABox::dummy = 0; bool AABox::culledBy( const class Plane* plane, int numPlanes, - int& cullingPlane, - const uint32 _inMask, + int& cullingPlane, + const uint32 _inMask, uint32& childMask) const { - uint32 inMask = _inMask; - assert(numPlanes < 31); + uint32 inMask = _inMask; + assert(numPlanes < 31); childMask = 0; - const bool finite = + const bool finite = (abs(lo.x) < G3D::inf()) && (abs(hi.x) < G3D::inf()) && (abs(lo.y) < G3D::inf()) && @@ -154,13 +154,13 @@ bool AABox::culledBy( (abs(hi.z) < G3D::inf()); // See if there is one plane for which all of the - // vertices are in the negative half space. + // vertices are in the negative half space. for (int p = 0; p < numPlanes; p++) { - // Only test planes that are not masked - if ((inMask & 1) != 0) { - - Vector3 corner; + // Only test planes that are not masked + if ((inMask & 1) != 0) { + + Vector3 corner; int numContained = 0; int v = 0; @@ -168,13 +168,13 @@ bool AABox::culledBy( // We can early-out only if we have found one point on each // side of the plane (i.e. if we are straddling). That // occurs when (numContained < v) && (numContained > 0) - for (v = 0; (v < 8) && ((numContained == v) || (numContained == 0)); ++v) { + for (v = 0; (v < 8) && ((numContained == v) || (numContained == 0)); ++v) { // Unrolling these 3 if's into a switch decreases performance // by about 2x - corner.x = (v & 1) ? hi.x : lo.x; - corner.y = (v & 2) ? hi.y : lo.y; - corner.z = (v & 4) ? hi.z : lo.z; - + corner.x = (v & 1) ? hi.x : lo.x; + corner.y = (v & 2) ? hi.y : lo.y; + corner.z = (v & 4) ? hi.z : lo.z; + if (finite) { // this branch is highly predictable if (plane[p].halfSpaceContainsFinite(corner)) { ++numContained; @@ -184,32 +184,32 @@ bool AABox::culledBy( ++numContained; } } - } + } - if (numContained == 0) { - // Plane p culled the box - cullingPlane = p; + if (numContained == 0) { + // Plane p culled the box + cullingPlane = p; // The caller should not recurse into the children, // since the parent is culled. If they do recurse, // make them only test against this one plane, which // will immediately cull the volume. childMask = 1 << p; - return true; + return true; } else if (numContained < v) { // The bounding volume straddled the plane; we have // to keep testing against this plane childMask |= (1 << p); } - } + } // Move on to the next bit. - inMask = inMask >> 1; + inMask = inMask >> 1; } // None of the planes could cull this box - cullingPlane = -1; + cullingPlane = -1; return false; } @@ -217,13 +217,13 @@ bool AABox::culledBy( bool AABox::culledBy( const class Plane* plane, int numPlanes, - int& cullingPlane, - const uint32 _inMask) const { + int& cullingPlane, + const uint32 _inMask) const { - uint32 inMask = _inMask; - assert(numPlanes < 31); - - const bool finite = + uint32 inMask = _inMask; + assert(numPlanes < 31); + + const bool finite = (abs(lo.x) < G3D::inf()) && (abs(hi.x) < G3D::inf()) && (abs(lo.y) < G3D::inf()) && @@ -232,55 +232,55 @@ bool AABox::culledBy( (abs(hi.z) < G3D::inf()); // See if there is one plane for which all of the - // vertices are in the negative half space. + // vertices are in the negative half space. for (int p = 0; p < numPlanes; p++) { - // Only test planes that are not masked - if ((inMask & 1) != 0) { - - bool culled = true; - Vector3 corner; + // Only test planes that are not masked + if ((inMask & 1) != 0) { + + bool culled = true; + Vector3 corner; int v; - // Assume this plane culls all points. See if there is a point - // not culled by the plane... early out when at least one point + // Assume this plane culls all points. See if there is a point + // not culled by the plane... early out when at least one point // is in the positive half space. - for (v = 0; (v < 8) && culled; ++v) { + for (v = 0; (v < 8) && culled; ++v) { // Unrolling these 3 if's into a switch decreases performance // by about 2x - corner.x = (v & 1) ? hi.x : lo.x; - corner.y = (v & 2) ? hi.y : lo.y; - corner.z = (v & 4) ? hi.z : lo.z; - + corner.x = (v & 1) ? hi.x : lo.x; + corner.y = (v & 2) ? hi.y : lo.y; + corner.z = (v & 4) ? hi.z : lo.z; + if (finite) { // this branch is highly predictable culled = ! plane[p].halfSpaceContainsFinite(corner); } else { culled = ! plane[p].halfSpaceContains(corner); } - } - - if (culled) { - // Plane p culled the box - cullingPlane = p; - - return true; } - } + + if (culled) { + // Plane p culled the box + cullingPlane = p; + + return true; + } + } // Move on to the next bit. - inMask = inMask >> 1; + inMask = inMask >> 1; } // None of the planes could cull this box - cullingPlane = -1; + cullingPlane = -1; return false; } bool AABox::intersects(const class Sphere& sphere) const { - double d = 0; + double d = 0; //find the square of the distance //from the sphere to the box diff --git a/dep/src/g3dlite/Crypto.cpp b/dep/src/g3dlite/Crypto.cpp index c07e5da3c70..763c2fefd4b 100644 --- a/dep/src/g3dlite/Crypto.cpp +++ b/dep/src/g3dlite/Crypto.cpp @@ -13,7 +13,7 @@ #include "G3D/g3dmath.h" namespace G3D { - + int Crypto::smallPrime(int n) { debugAssert(n < numSmallPrimes() && n >= 0); @@ -22,36 +22,36 @@ int Crypto::smallPrime(int n) { // http://primes.utm.edu/lists/small/1000.txt static const int table[] = { - 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, - 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, - 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, - 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, - 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, - 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, - 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, - 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, - 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, - 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, - 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, - 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, - 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, - 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, - 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, - 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, - 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, - 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, - 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, - 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, - 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, - 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, - 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, - 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, - 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, - 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, - 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, + 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, + 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, + 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, + 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, + 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, + 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, + 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, + 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, + 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, + 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, + 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, + 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, + 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, + 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, + 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, + 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, + 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, + 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, + 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, + 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, + 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, + 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, + 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, + 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, + 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, + 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, + 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, - 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, - 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, + 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, + 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999}; return table[n]; @@ -64,73 +64,73 @@ int Crypto::numSmallPrimes() { uint32 Crypto::crc32(const void* byte, size_t numBytes) { static const uint32 crc32Table[256] = { - 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, - 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, - 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, - 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, - 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, - 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, - 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, - 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, - 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, - 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, - 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, - 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, - 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, - 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, - 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, - 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, + 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, + 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, + 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, + 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, + 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, + 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, + 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, + 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, + 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, + 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, + 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, + 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, + 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, + 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, + 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, + 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, - 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, - 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, - 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, - 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, - 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, - 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, - 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, - 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, - 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, - 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, - 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, - 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, - 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, - 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, - 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, - 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, + 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, + 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, + 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, + 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, + 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, + 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, + 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, + 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, + 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, + 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, + 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, + 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, + 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, + 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, + 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, + 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, - 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, - 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, - 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, - 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, - 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, - 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, - 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, - 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, - 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, - 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, - 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, - 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, - 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, - 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, - 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, - 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, + 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, + 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, + 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, + 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, + 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, + 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, + 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, + 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, + 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, + 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, + 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, + 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, + 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, + 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, + 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, + 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, - 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, - 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, - 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, - 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, - 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, - 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, - 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, - 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, - 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, - 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, - 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, - 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, - 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, - 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, - 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, - 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D, + 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, + 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, + 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, + 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, + 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, + 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, + 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, + 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, + 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, + 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, + 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, + 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, + 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, + 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, + 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, + 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D, }; // By definition, initialize to all binary 1's diff --git a/dep/src/g3dlite/Matrix3.cpp b/dep/src/g3dlite/Matrix3.cpp index 1d6df3ff7d7..c6fc9729b34 100644 --- a/dep/src/g3dlite/Matrix3.cpp +++ b/dep/src/g3dlite/Matrix3.cpp @@ -55,7 +55,7 @@ bool Matrix3::isOrthonormal() const { Vector3 Y = getColumn(1); Vector3 Z = getColumn(2); - return + return (G3D::fuzzyEq(X.dot(Y), 0.0f) && G3D::fuzzyEq(Y.dot(Z), 0.0f) && G3D::fuzzyEq(X.dot(Z), 0.0f) && @@ -67,7 +67,7 @@ bool Matrix3::isOrthonormal() const { //---------------------------------------------------------------------------- Matrix3::Matrix3(const Quat& _q) { // Implementation from Watt and Watt, pg 362 - // See also http://www.flipcode.com/documents/matrfaq.html#Q54 + // See also http://www.flipcode.com/documents/matrfaq.html#Q54 Quat q = _q.unitize(); float xx = 2.0f * q.x * q.x; float xy = 2.0f * q.x * q.y; @@ -109,7 +109,7 @@ Matrix3::Matrix3( void Matrix3::set( float fEntry00, float fEntry01, float fEntry02, - float fEntry10, float fEntry11, float fEntry12, + float fEntry10, float fEntry11, float fEntry12, float fEntry20, float fEntry21, float fEntry22) { elt[0][0] = fEntry00; @@ -1340,10 +1340,10 @@ Matrix3 Matrix3::fromEulerAnglesXZY (float fYAngle, float fPAngle, //---------------------------------------------------------------------------- Matrix3 Matrix3::fromEulerAnglesYXZ( - float fYAngle, + float fYAngle, float fPAngle, float fRAngle) { - + float fCos, fSin; fCos = cos(fYAngle); @@ -1363,7 +1363,7 @@ Matrix3 Matrix3::fromEulerAnglesYXZ( //---------------------------------------------------------------------------- Matrix3 Matrix3::fromEulerAnglesYZX( - float fYAngle, + float fYAngle, float fPAngle, float fRAngle) { @@ -1605,9 +1605,9 @@ void Matrix3::tensorProduct (const Vector3& rkU, const Vector3& rkV, // Runs in 52 cycles on AMD, 76 cycles on Intel Centrino // -// The loop unrolling is necessary for performance. +// The loop unrolling is necessary for performance. // I was unable to improve performance further by flattening the matrices -// into float*'s instead of 2D arrays. +// into float*'s instead of 2D arrays. // // -morgan void Matrix3::_mul(const Matrix3& A, const Matrix3& B, Matrix3& out) { @@ -1674,10 +1674,10 @@ void Matrix3::_transpose(const Matrix3& A, Matrix3& out) { //----------------------------------------------------------------------------- std::string Matrix3::toString() const { - return G3D::format("[%g, %g, %g; %g, %g, %g; %g, %g, %g]", - elt[0][0], elt[0][1], elt[0][2], - elt[1][0], elt[1][1], elt[1][2], - elt[2][0], elt[2][1], elt[2][2]); + return G3D::format("[%g, %g, %g; %g, %g, %g; %g, %g, %g]", + elt[0][0], elt[0][1], elt[0][2], + elt[1][0], elt[1][1], elt[1][2], + elt[2][0], elt[2][1], elt[2][2]); } diff --git a/dep/src/g3dlite/Plane.cpp b/dep/src/g3dlite/Plane.cpp index c958a10a710..5265ef8f670 100644 --- a/dep/src/g3dlite/Plane.cpp +++ b/dep/src/g3dlite/Plane.cpp @@ -1,8 +1,8 @@ /** @file Plane.cpp - + @maintainer Morgan McGuire, matrix@graphics3d.com - + @created 2003-02-06 @edited 2006-01-29 */ @@ -20,14 +20,14 @@ Plane::Plane( Vector4 point2) { debugAssertM( - point0.w != 0 || - point1.w != 0 || + point0.w != 0 || + point1.w != 0 || point2.w != 0, "At least one point must be finite."); // Rotate the points around so that the finite points come first. - while ((point0.w == 0) && + while ((point0.w == 0) && ((point1.w == 0) || (point2.w != 0))) { Vector4 temp = point0; point0 = point1; diff --git a/dep/src/g3dlite/System.cpp b/dep/src/g3dlite/System.cpp index 06be7cd25e0..f28c9d62a9a 100644 --- a/dep/src/g3dlite/System.cpp +++ b/dep/src/g3dlite/System.cpp @@ -1,6 +1,6 @@ -/** +/** @file System.cpp - + @maintainer Morgan McGuire, matrix@graphics3d.com Note: every routine must call init() first. @@ -29,7 +29,7 @@ #include #include "G3D/RegistryUtil.h" -#elif defined(G3D_LINUX) +#elif defined(G3D_LINUX) #include #include @@ -125,7 +125,7 @@ public: */ enum {tinyBufferSize = 128, smallBufferSize = 1024, medBufferSize = 4096}; - /** + /** Most buffers we're allowed to store. 64000 * 128 = 8 MB (preallocated) 1024 * 1024 = 1 MB (allocated on demand) @@ -183,7 +183,7 @@ private: # endif } - /** + /** Malloc out of the tiny heap. */ inline void* tinyMalloc(size_t bytes) { @@ -205,7 +205,7 @@ private: /** Returns true if this is a pointer into the tiny heap. */ bool inTinyHeap(void* ptr) { - return (ptr >= tinyHeap) && + return (ptr >= tinyHeap) && (ptr < (uint8*)tinyHeap + maxTinyBuffers * tinyBufferSize); } @@ -228,9 +228,9 @@ private: } - /** Allocate out of a specific pool-> Return NULL if no suitable - memory was found. - + /** Allocate out of a specific pool-> Return NULL if no suitable + memory was found. + */ void* malloc(MemBlock* pool, int& poolSize, size_t bytes) { @@ -264,7 +264,7 @@ public: int mallocsFromSmallPool; int mallocsFromMedPool; - /** Amount of memory currently allocated (according to the application). + /** Amount of memory currently allocated (according to the application). This does not count the memory still remaining in the buffer pool, but does count extra memory required for rounding off to the size of a buffer. @@ -314,7 +314,7 @@ public: # endif } - + void* realloc(void* ptr, size_t bytes) { if (ptr == NULL) { return malloc(bytes); @@ -326,7 +326,7 @@ public: return ptr; } else { // Free the old pointer and malloc - + void* newPtr = malloc(bytes); System::memcpy(newPtr, ptr, tinyBufferSize); tinyFree(ptr); @@ -366,12 +366,12 @@ public: return ptr; } - } - + } + // Failure to allocate a tiny buffer is allowed to flow // through to a small buffer if (bytes <= smallBufferSize) { - + void* ptr = malloc(smallPool, smallPoolSize, bytes); if (ptr) { @@ -476,7 +476,7 @@ public: std::string performance() const { if (totalMallocs > 0) { int pooled = mallocsFromTinyPool + - mallocsFromSmallPool + + mallocsFromSmallPool + mallocsFromMedPool; int total = totalMallocs; @@ -503,23 +503,23 @@ public: }; // Dynamically allocated because we need to ensure that -// the buffer pool is still around when the last global variable +// the buffer pool is still around when the last global variable // is deallocated. static BufferPool* bufferpool = NULL; -std::string System::mallocPerformance() { +std::string System::mallocPerformance() { #ifndef NO_BUFFERPOOL return bufferpool->performance(); #else - return "NO_BUFFERPOOL"; + return "NO_BUFFERPOOL"; #endif } -std::string System::mallocStatus() { +std::string System::mallocStatus() { #ifndef NO_BUFFERPOOL return bufferpool->status(); #else - return "NO_BUFFERPOOL"; + return "NO_BUFFERPOOL"; #endif } @@ -572,7 +572,7 @@ void* System::realloc(void* block, size_t bytes) { initMem(); return bufferpool->realloc(block, bytes); #else - return ::realloc(block, bytes); + return ::realloc(block, bytes); #endif } @@ -581,7 +581,7 @@ void System::free(void* p) { #ifndef NO_BUFFERPOOL bufferpool->free(p); #else - return ::free(p); + return ::free(p); #endif } @@ -606,7 +606,7 @@ void* System::alignedMalloc(size_t bytes, size_t alignment) { debugAssert(isValidHeapPointer(truePtr)); #ifdef G3D_WIN32 // The blocks we return will not be valid Win32 debug heap - // pointers because they are offset + // pointers because they are offset // debugAssert(_CrtIsValidPointer(truePtr, totalBytes, TRUE) ); #endif diff --git a/dep/src/g3dlite/Triangle.cpp b/dep/src/g3dlite/Triangle.cpp index adb815e1602..d3fa835c7c8 100644 --- a/dep/src/g3dlite/Triangle.cpp +++ b/dep/src/g3dlite/Triangle.cpp @@ -1,8 +1,8 @@ /** @file Triangle.cpp - + @maintainer Morgan McGuire, graphics3d.com - + @created 2001-04-06 @edited 2006-01-20 @@ -17,7 +17,7 @@ namespace G3D { - + void Triangle::init(const Vector3& v0, const Vector3& v1, const Vector3& v2) { _plane = Plane(v0, v1, v2); @@ -50,13 +50,13 @@ void Triangle::init(const Vector3& v0, const Vector3& v1, const Vector3& v2) { Triangle::Triangle() { init(Vector3::zero(), Vector3::zero(), Vector3::zero()); } - + Triangle::Triangle(const Vector3& v0, const Vector3& v1, const Vector3& v2) { init(v0, v1, v2); } - + Triangle::~Triangle() { } diff --git a/dep/src/g3dlite/Vector3.cpp b/dep/src/g3dlite/Vector3.cpp index 57ee76d1eb1..274769a1e0b 100644 --- a/dep/src/g3dlite/Vector3.cpp +++ b/dep/src/g3dlite/Vector3.cpp @@ -1,12 +1,12 @@ /** @file Vector3.cpp - + 3D vector class - + @maintainer Morgan McGuire, matrix@graphics3d.com - + @cite Portions based on Dave Eberly's Magic Software Library at http://www.magic-software.com - + @created 2001-06-02 @edited 2006-01-30 */ @@ -20,7 +20,7 @@ #include "G3D/Vector3int16.h" #include "G3D/Matrix3.h" #include "G3D/Vector2.h" - + namespace G3D { Vector3 Vector3::dummy; @@ -38,7 +38,7 @@ Vector3::Vector3(const class Vector2& v, float _z) : x(v.x), y(v.y), z(_z) { } Vector3::Axis Vector3::primaryAxis() const { - + Axis a = X_AXIS; double nx = abs(x); @@ -94,7 +94,7 @@ Vector3 Vector3::random() { Vector3 result; do { - result = Vector3(uniformRandom(-1.0, 1.0), + result = Vector3(uniformRandom(-1.0, 1.0), uniformRandom(-1.0, 1.0), uniformRandom(-1.0, 1.0)); } while (result.squaredMagnitude() >= 1.0f); @@ -109,7 +109,7 @@ Vector3 Vector3::operator/ (float fScalar) const { Vector3 kQuot; if ( fScalar != 0.0 ) { - float fInvScalar = 1.0f / fScalar; + float fInvScalar = 1.0f / fScalar; kQuot.x = fInvScalar * x; kQuot.y = fInvScalar * y; kQuot.z = fInvScalar * z; @@ -122,7 +122,7 @@ Vector3 Vector3::operator/ (float fScalar) const { //---------------------------------------------------------------------------- Vector3& Vector3::operator/= (float fScalar) { if (fScalar != 0.0) { - float fInvScalar = 1.0f / fScalar; + float fInvScalar = 1.0f / fScalar; x *= fInvScalar; y *= fInvScalar; z *= fInvScalar; @@ -137,10 +137,10 @@ Vector3& Vector3::operator/= (float fScalar) { //---------------------------------------------------------------------------- float Vector3::unitize (float fTolerance) { - float fMagnitude = magnitude(); + float fMagnitude = magnitude(); if (fMagnitude > fTolerance) { - float fInvMagnitude = 1.0f / fMagnitude; + float fInvMagnitude = 1.0f / fMagnitude; x *= fInvMagnitude; y *= fInvMagnitude; z *= fInvMagnitude; @@ -260,12 +260,12 @@ void Vector3::orthonormalize (Vector3 akVector[3]) { akVector[0].unitize(); // compute u1 - float fDot0 = akVector[0].dot(akVector[1]); + float fDot0 = akVector[0].dot(akVector[1]); akVector[1] -= akVector[0] * fDot0; akVector[1].unitize(); // compute u2 - float fDot1 = akVector[1].dot(akVector[2]); + float fDot1 = akVector[1].dot(akVector[2]); fDot0 = akVector[0].dot(akVector[2]); akVector[2] -= akVector[0] * fDot0 + akVector[1] * fDot1; akVector[2].unitize(); diff --git a/dep/src/g3dlite/Vector4.cpp b/dep/src/g3dlite/Vector4.cpp index bfea20202c4..2a597df65ed 100644 --- a/dep/src/g3dlite/Vector4.cpp +++ b/dep/src/g3dlite/Vector4.cpp @@ -1,8 +1,8 @@ /** @file Vector4.cpp - + @maintainer Morgan McGuire, matrix@graphics3d.com - + @created 2001-07-09 @edited 2003-09-29 */ @@ -57,7 +57,7 @@ Vector4 Vector4::operator/ (float fScalar) const { Vector4 kQuot; if ( fScalar != 0.0 ) { - float fInvScalar = 1.0f / fScalar; + float fInvScalar = 1.0f / fScalar; kQuot.x = fInvScalar * x; kQuot.y = fInvScalar * y; kQuot.z = fInvScalar * z; @@ -71,13 +71,13 @@ Vector4 Vector4::operator/ (float fScalar) const { //---------------------------------------------------------------------------- Vector4& Vector4::operator/= (float fScalar) { if (fScalar != 0.0f) { - float fInvScalar = 1.0f / fScalar; + float fInvScalar = 1.0f / fScalar; x *= fInvScalar; y *= fInvScalar; z *= fInvScalar; w *= fInvScalar; } else { - *this = Vector4::inf(); + *this = Vector4::inf(); } return *this; diff --git a/dep/src/g3dlite/format.cpp b/dep/src/g3dlite/format.cpp index 6def987c21b..8737128a0f8 100644 --- a/dep/src/g3dlite/format.cpp +++ b/dep/src/g3dlite/format.cpp @@ -52,7 +52,7 @@ std::string vformat(const char *fmt, va_list argPtr) { // allocate it on the stack because this saves // the malloc/free time. const int bufSize = 161; - char stackBuffer[bufSize]; + char stackBuffer[bufSize]; int actualSize = _vscprintf(fmt, argPtr) + 1; @@ -68,7 +68,7 @@ std::string vformat(const char *fmt, va_list argPtr) { heapBuffer[maxSize] = '\0'; } else { heapBuffer = (char*)System::malloc(actualSize); - vsprintf(heapBuffer, fmt, argPtr); + vsprintf(heapBuffer, fmt, argPtr); } std::string formattedString(heapBuffer); @@ -91,7 +91,7 @@ std::string vformat(const char *fmt, va_list argPtr) { // allocate it on the stack because this saves // the malloc/free time. const int bufSize = 161; - char stackBuffer[bufSize]; + char stackBuffer[bufSize]; int actualWritten = vsnprintf(stackBuffer, bufSize, fmt, argPtr); @@ -101,7 +101,7 @@ std::string vformat(const char *fmt, va_list argPtr) { int heapSize = 512; double powSize = 1.0; char* heapBuffer = (char*)System::malloc(heapSize); - + while ((vsnprintf(heapBuffer, heapSize, fmt, argPtr) == -1) && (heapSize < maxSize)) { @@ -144,7 +144,7 @@ std::string vformat(const char* fmt, va_list argPtr) { assert(numChars2 == numChars); std::string result(heapBuffer); - + System::free(heapBuffer); return result; diff --git a/dep/src/sockets/Base64.cpp b/dep/src/sockets/Base64.cpp index b8cf1237175..95b91555beb 100644 --- a/dep/src/sockets/Base64.cpp +++ b/dep/src/sockets/Base64.cpp @@ -1,6 +1,6 @@ /** \file Base64.cpp - ** \date 2004-02-13 - ** \author grymse@alhem.net + ** \date 2004-02-13 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -35,20 +35,20 @@ namespace SOCKETS_NAMESPACE { const char *Base64::bstr = - "ABCDEFGHIJKLMNOPQ" - "RSTUVWXYZabcdefgh" - "ijklmnopqrstuvwxy" - "z0123456789+/"; + "ABCDEFGHIJKLMNOPQ" + "RSTUVWXYZabcdefgh" + "ijklmnopqrstuvwxy" + "z0123456789+/"; const char Base64::rstr[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 0, - 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0}; + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 0, + 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0}; Base64::Base64() @@ -58,210 +58,210 @@ Base64::Base64() void Base64::encode(FILE *fil, std::string& output, bool add_crlf) { - size_t remain; - size_t i = 0; - size_t o = 0; - char input[4]; + size_t remain; + size_t i = 0; + size_t o = 0; + char input[4]; - output = ""; - remain = fread(input,1,3,fil); - while (remain > 0) - { - if (add_crlf && o && o % 76 == 0) - output += "\n"; - switch (remain) - { - case 1: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) ]; - output += "=="; - break; - case 2: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; - output += bstr[ ((input[i + 1] << 2) & 0x3c) ]; - output += "="; - break; - default: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; - output += bstr[ ((input[i + 1] << 2) & 0x3c) + ((input[i + 2] >> 6) & 0x03) ]; - output += bstr[ (input[i + 2] & 0x3f) ]; - } - o += 4; - // - remain = fread(input,1,3,fil); - } + output = ""; + remain = fread(input,1,3,fil); + while (remain > 0) + { + if (add_crlf && o && o % 76 == 0) + output += "\n"; + switch (remain) + { + case 1: + output += bstr[ ((input[i] >> 2) & 0x3f) ]; + output += bstr[ ((input[i] << 4) & 0x30) ]; + output += "=="; + break; + case 2: + output += bstr[ ((input[i] >> 2) & 0x3f) ]; + output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; + output += bstr[ ((input[i + 1] << 2) & 0x3c) ]; + output += "="; + break; + default: + output += bstr[ ((input[i] >> 2) & 0x3f) ]; + output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; + output += bstr[ ((input[i + 1] << 2) & 0x3c) + ((input[i + 2] >> 6) & 0x03) ]; + output += bstr[ (input[i + 2] & 0x3f) ]; + } + o += 4; + // + remain = fread(input,1,3,fil); + } } void Base64::encode(const std::string& str_in, std::string& str_out, bool add_crlf) { - encode(str_in.c_str(), str_in.size(), str_out, add_crlf); + encode(str_in.c_str(), str_in.size(), str_out, add_crlf); } void Base64::encode(const char* input,size_t l,std::string& output, bool add_crlf) { - size_t i = 0; - size_t o = 0; - - output = ""; - while (i < l) - { - size_t remain = l - i; - if (add_crlf && o && o % 76 == 0) - output += "\n"; - switch (remain) - { - case 1: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) ]; - output += "=="; - break; - case 2: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; - output += bstr[ ((input[i + 1] << 2) & 0x3c) ]; - output += "="; - break; - default: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; - output += bstr[ ((input[i + 1] << 2) & 0x3c) + ((input[i + 2] >> 6) & 0x03) ]; - output += bstr[ (input[i + 2] & 0x3f) ]; - } - o += 4; - i += 3; - } + size_t i = 0; + size_t o = 0; + + output = ""; + while (i < l) + { + size_t remain = l - i; + if (add_crlf && o && o % 76 == 0) + output += "\n"; + switch (remain) + { + case 1: + output += bstr[ ((input[i] >> 2) & 0x3f) ]; + output += bstr[ ((input[i] << 4) & 0x30) ]; + output += "=="; + break; + case 2: + output += bstr[ ((input[i] >> 2) & 0x3f) ]; + output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; + output += bstr[ ((input[i + 1] << 2) & 0x3c) ]; + output += "="; + break; + default: + output += bstr[ ((input[i] >> 2) & 0x3f) ]; + output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; + output += bstr[ ((input[i + 1] << 2) & 0x3c) + ((input[i + 2] >> 6) & 0x03) ]; + output += bstr[ (input[i + 2] & 0x3f) ]; + } + o += 4; + i += 3; + } } void Base64::encode(const unsigned char* input,size_t l,std::string& output,bool add_crlf) { - size_t i = 0; - size_t o = 0; - - output = ""; - while (i < l) - { - size_t remain = l - i; - if (add_crlf && o && o % 76 == 0) - output += "\n"; - switch (remain) - { - case 1: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) ]; - output += "=="; - break; - case 2: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; - output += bstr[ ((input[i + 1] << 2) & 0x3c) ]; - output += "="; - break; - default: - output += bstr[ ((input[i] >> 2) & 0x3f) ]; - output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; - output += bstr[ ((input[i + 1] << 2) & 0x3c) + ((input[i + 2] >> 6) & 0x03) ]; - output += bstr[ (input[i + 2] & 0x3f) ]; - } - o += 4; - i += 3; - } + size_t i = 0; + size_t o = 0; + + output = ""; + while (i < l) + { + size_t remain = l - i; + if (add_crlf && o && o % 76 == 0) + output += "\n"; + switch (remain) + { + case 1: + output += bstr[ ((input[i] >> 2) & 0x3f) ]; + output += bstr[ ((input[i] << 4) & 0x30) ]; + output += "=="; + break; + case 2: + output += bstr[ ((input[i] >> 2) & 0x3f) ]; + output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; + output += bstr[ ((input[i + 1] << 2) & 0x3c) ]; + output += "="; + break; + default: + output += bstr[ ((input[i] >> 2) & 0x3f) ]; + output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; + output += bstr[ ((input[i + 1] << 2) & 0x3c) + ((input[i + 2] >> 6) & 0x03) ]; + output += bstr[ (input[i + 2] & 0x3f) ]; + } + o += 4; + i += 3; + } } void Base64::decode(const std::string& input,std::string& output) { - size_t i = 0; - size_t l = input.size(); - - output = ""; - while (i < l) - { - while (i < l && (input[i] == 13 || input[i] == 10)) - i++; - if (i < l) - { - char b1 = (char)((rstr[(int)input[i]] << 2 & 0xfc) + - (rstr[(int)input[i + 1]] >> 4 & 0x03)); - output += b1; - if (input[i + 2] != '=') - { - char b2 = (char)((rstr[(int)input[i + 1]] << 4 & 0xf0) + - (rstr[(int)input[i + 2]] >> 2 & 0x0f)); - output += b2; - } - if (input[i + 3] != '=') - { - char b3 = (char)((rstr[(int)input[i + 2]] << 6 & 0xc0) + - rstr[(int)input[i + 3]]); - output += b3; - } - i += 4; - } - } + size_t i = 0; + size_t l = input.size(); + + output = ""; + while (i < l) + { + while (i < l && (input[i] == 13 || input[i] == 10)) + i++; + if (i < l) + { + char b1 = (char)((rstr[(int)input[i]] << 2 & 0xfc) + + (rstr[(int)input[i + 1]] >> 4 & 0x03)); + output += b1; + if (input[i + 2] != '=') + { + char b2 = (char)((rstr[(int)input[i + 1]] << 4 & 0xf0) + + (rstr[(int)input[i + 2]] >> 2 & 0x0f)); + output += b2; + } + if (input[i + 3] != '=') + { + char b3 = (char)((rstr[(int)input[i + 2]] << 6 & 0xc0) + + rstr[(int)input[i + 3]]); + output += b3; + } + i += 4; + } + } } void Base64::decode(const std::string& input, unsigned char *output, size_t& sz) { - size_t i = 0; - size_t l = input.size(); - size_t j = 0; - - while (i < l) - { - while (i < l && (input[i] == 13 || input[i] == 10)) - i++; - if (i < l) - { - unsigned char b1 = (unsigned char)((rstr[(int)input[i]] << 2 & 0xfc) + - (rstr[(int)input[i + 1]] >> 4 & 0x03)); - if (output) - { - output[j] = b1; - } - j++; - if (input[i + 2] != '=') - { - unsigned char b2 = (unsigned char)((rstr[(int)input[i + 1]] << 4 & 0xf0) + - (rstr[(int)input[i + 2]] >> 2 & 0x0f)); - if (output) - { - output[j] = b2; - } - j++; - } - if (input[i + 3] != '=') - { - unsigned char b3 = (unsigned char)((rstr[(int)input[i + 2]] << 6 & 0xc0) + - rstr[(int)input[i + 3]]); - if (output) - { - output[j] = b3; - } - j++; - } - i += 4; - } - } - sz = j; + size_t i = 0; + size_t l = input.size(); + size_t j = 0; + + while (i < l) + { + while (i < l && (input[i] == 13 || input[i] == 10)) + i++; + if (i < l) + { + unsigned char b1 = (unsigned char)((rstr[(int)input[i]] << 2 & 0xfc) + + (rstr[(int)input[i + 1]] >> 4 & 0x03)); + if (output) + { + output[j] = b1; + } + j++; + if (input[i + 2] != '=') + { + unsigned char b2 = (unsigned char)((rstr[(int)input[i + 1]] << 4 & 0xf0) + + (rstr[(int)input[i + 2]] >> 2 & 0x0f)); + if (output) + { + output[j] = b2; + } + j++; + } + if (input[i + 3] != '=') + { + unsigned char b3 = (unsigned char)((rstr[(int)input[i + 2]] << 6 & 0xc0) + + rstr[(int)input[i + 3]]); + if (output) + { + output[j] = b3; + } + j++; + } + i += 4; + } + } + sz = j; } size_t Base64::decode_length(const std::string& str64) { - if (str64.empty() || str64.size() % 4) - return 0; - size_t l = 3 * (str64.size() / 4 - 1) + 1; - if (str64[str64.size() - 2] != '=') - l++; - if (str64[str64.size() - 1] != '=') - l++; - return l; + if (str64.empty() || str64.size() % 4) + return 0; + size_t l = 3 * (str64.size() / 4 - 1) + 1; + if (str64[str64.size() - 2] != '=') + l++; + if (str64[str64.size() - 1] != '=') + l++; + return l; } diff --git a/dep/src/sockets/Exception.cpp b/dep/src/sockets/Exception.cpp index a005669e4c9..b3844982c0f 100644 --- a/dep/src/sockets/Exception.cpp +++ b/dep/src/sockets/Exception.cpp @@ -1,7 +1,7 @@ /** - ** \file Exception.cpp - ** \date 2007-09-28 - ** \author grymse@alhem.net + ** \file Exception.cpp + ** \date 2007-09-28 + ** \author grymse@alhem.net **/ /* Copyright (C) 2007 Anders Hedstrom @@ -38,7 +38,7 @@ Exception::Exception(const std::string& description) : m_description(description const std::string Exception::ToString() const { - return m_description; + return m_description; } diff --git a/dep/src/sockets/Ipv4Address.cpp b/dep/src/sockets/Ipv4Address.cpp index 58f25e53b83..88a7d33fb63 100644 --- a/dep/src/sockets/Ipv4Address.cpp +++ b/dep/src/sockets/Ipv4Address.cpp @@ -1,7 +1,7 @@ /** - ** \file Ipv4Address.cpp - ** \date 2006-09-21 - ** \author grymse@alhem.net + ** \file Ipv4Address.cpp + ** \date 2006-09-21 + ** \author grymse@alhem.net **/ /* Copyright (C) 2007 Anders Hedstrom @@ -36,50 +36,50 @@ namespace SOCKETS_NAMESPACE { Ipv4Address::Ipv4Address(port_t port) : m_valid(true) { - memset(&m_addr, 0, sizeof(m_addr)); - m_addr.sin_family = AF_INET; - m_addr.sin_port = htons( port ); + memset(&m_addr, 0, sizeof(m_addr)); + m_addr.sin_family = AF_INET; + m_addr.sin_port = htons( port ); } Ipv4Address::Ipv4Address(ipaddr_t a,port_t port) : m_valid(true) { - memset(&m_addr, 0, sizeof(m_addr)); - m_addr.sin_family = AF_INET; - m_addr.sin_port = htons( port ); - memcpy(&m_addr.sin_addr, &a, sizeof(struct in_addr)); + memset(&m_addr, 0, sizeof(m_addr)); + m_addr.sin_family = AF_INET; + m_addr.sin_port = htons( port ); + memcpy(&m_addr.sin_addr, &a, sizeof(struct in_addr)); } Ipv4Address::Ipv4Address(struct in_addr& a,port_t port) : m_valid(true) { - memset(&m_addr, 0, sizeof(m_addr)); - m_addr.sin_family = AF_INET; - m_addr.sin_port = htons( port ); - m_addr.sin_addr = a; + memset(&m_addr, 0, sizeof(m_addr)); + m_addr.sin_family = AF_INET; + m_addr.sin_port = htons( port ); + m_addr.sin_addr = a; } Ipv4Address::Ipv4Address(const std::string& host,port_t port) : m_valid(false) { - memset(&m_addr, 0, sizeof(m_addr)); - m_addr.sin_family = AF_INET; - m_addr.sin_port = htons( port ); - { - ipaddr_t a; - if (Utility::u2ip(host, a)) - { - memcpy(&m_addr.sin_addr, &a, sizeof(struct in_addr)); - m_valid = true; - } - } + memset(&m_addr, 0, sizeof(m_addr)); + m_addr.sin_family = AF_INET; + m_addr.sin_port = htons( port ); + { + ipaddr_t a; + if (Utility::u2ip(host, a)) + { + memcpy(&m_addr.sin_addr, &a, sizeof(struct in_addr)); + m_valid = true; + } + } } Ipv4Address::Ipv4Address(struct sockaddr_in& sa) { - m_addr = sa; - m_valid = sa.sin_family == AF_INET; + m_addr = sa; + m_valid = sa.sin_family == AF_INET; } @@ -90,121 +90,121 @@ Ipv4Address::~Ipv4Address() Ipv4Address::operator struct sockaddr *() { - return (struct sockaddr *)&m_addr; + return (struct sockaddr *)&m_addr; } Ipv4Address::operator socklen_t() { - return sizeof(struct sockaddr_in); + return sizeof(struct sockaddr_in); } void Ipv4Address::SetPort(port_t port) { - m_addr.sin_port = htons( port ); + m_addr.sin_port = htons( port ); } port_t Ipv4Address::GetPort() { - return ntohs( m_addr.sin_port ); + return ntohs( m_addr.sin_port ); } bool Ipv4Address::Resolve(const std::string& hostname,struct in_addr& a) { - struct sockaddr_in sa; - memset(&a, 0, sizeof(a)); - if (Utility::isipv4(hostname)) - { - if (!Utility::u2ip(hostname, sa, AI_NUMERICHOST)) - return false; - a = sa.sin_addr; - return true; - } - if (!Utility::u2ip(hostname, sa)) - return false; - a = sa.sin_addr; - return true; + struct sockaddr_in sa; + memset(&a, 0, sizeof(a)); + if (Utility::isipv4(hostname)) + { + if (!Utility::u2ip(hostname, sa, AI_NUMERICHOST)) + return false; + a = sa.sin_addr; + return true; + } + if (!Utility::u2ip(hostname, sa)) + return false; + a = sa.sin_addr; + return true; } bool Ipv4Address::Reverse(struct in_addr& a,std::string& name) { - struct sockaddr_in sa; - memset(&sa, 0, sizeof(sa)); - sa.sin_family = AF_INET; - sa.sin_addr = a; - return Utility::reverse((struct sockaddr *)&sa, sizeof(sa), name); + struct sockaddr_in sa; + memset(&sa, 0, sizeof(sa)); + sa.sin_family = AF_INET; + sa.sin_addr = a; + return Utility::reverse((struct sockaddr *)&sa, sizeof(sa), name); } std::string Ipv4Address::Convert(bool include_port) { - if (include_port) - return Convert(m_addr.sin_addr) + ":" + Utility::l2string(GetPort()); - return Convert(m_addr.sin_addr); + if (include_port) + return Convert(m_addr.sin_addr) + ":" + Utility::l2string(GetPort()); + return Convert(m_addr.sin_addr); } std::string Ipv4Address::Convert(struct in_addr& a) { - struct sockaddr_in sa; - memset(&sa, 0, sizeof(sa)); - sa.sin_family = AF_INET; - sa.sin_addr = a; - std::string name; - Utility::reverse((struct sockaddr *)&sa, sizeof(sa), name, NI_NUMERICHOST); - return name; + struct sockaddr_in sa; + memset(&sa, 0, sizeof(sa)); + sa.sin_family = AF_INET; + sa.sin_addr = a; + std::string name; + Utility::reverse((struct sockaddr *)&sa, sizeof(sa), name, NI_NUMERICHOST); + return name; } void Ipv4Address::SetAddress(struct sockaddr *sa) { - memcpy(&m_addr, sa, sizeof(struct sockaddr_in)); + memcpy(&m_addr, sa, sizeof(struct sockaddr_in)); } int Ipv4Address::GetFamily() { - return m_addr.sin_family; + return m_addr.sin_family; } bool Ipv4Address::IsValid() { - return m_valid; + return m_valid; } bool Ipv4Address::operator==(SocketAddress& a) { - if (a.GetFamily() != GetFamily()) - return false; - if ((socklen_t)a != sizeof(m_addr)) - return false; - struct sockaddr *sa = a; - struct sockaddr_in *p = (struct sockaddr_in *)sa; - if (p -> sin_port != m_addr.sin_port) - return false; - if (memcmp(&p -> sin_addr, &m_addr.sin_addr, 4)) - return false; - return true; + if (a.GetFamily() != GetFamily()) + return false; + if ((socklen_t)a != sizeof(m_addr)) + return false; + struct sockaddr *sa = a; + struct sockaddr_in *p = (struct sockaddr_in *)sa; + if (p -> sin_port != m_addr.sin_port) + return false; + if (memcmp(&p -> sin_addr, &m_addr.sin_addr, 4)) + return false; + return true; } std::auto_ptr Ipv4Address::GetCopy() { - return std::auto_ptr(new Ipv4Address(m_addr)); + return std::auto_ptr(new Ipv4Address(m_addr)); } std::string Ipv4Address::Reverse() { - std::string tmp; - Reverse(m_addr.sin_addr, tmp); - return tmp; + std::string tmp; + Reverse(m_addr.sin_addr, tmp); + return tmp; } diff --git a/dep/src/sockets/Ipv6Address.cpp b/dep/src/sockets/Ipv6Address.cpp index 2e0f1e9acf3..c6f1443af2e 100644 --- a/dep/src/sockets/Ipv6Address.cpp +++ b/dep/src/sockets/Ipv6Address.cpp @@ -1,7 +1,7 @@ /** - ** \file Ipv6Address.cpp - ** \date 2006-09-21 - ** \author grymse@alhem.net + ** \file Ipv6Address.cpp + ** \date 2006-09-21 + ** \author grymse@alhem.net **/ /* Copyright (C) 2007 Anders Hedstrom @@ -37,41 +37,41 @@ namespace SOCKETS_NAMESPACE { Ipv6Address::Ipv6Address(port_t port) : m_valid(true) { - memset(&m_addr, 0, sizeof(m_addr)); - m_addr.sin6_family = AF_INET6; - m_addr.sin6_port = htons( port ); + memset(&m_addr, 0, sizeof(m_addr)); + m_addr.sin6_family = AF_INET6; + m_addr.sin6_port = htons( port ); } Ipv6Address::Ipv6Address(struct in6_addr& a,port_t port) : m_valid(true) { - memset(&m_addr, 0, sizeof(m_addr)); - m_addr.sin6_family = AF_INET6; - m_addr.sin6_port = htons( port ); - m_addr.sin6_addr = a; + memset(&m_addr, 0, sizeof(m_addr)); + m_addr.sin6_family = AF_INET6; + m_addr.sin6_port = htons( port ); + m_addr.sin6_addr = a; } Ipv6Address::Ipv6Address(const std::string& host,port_t port) : m_valid(false) { - memset(&m_addr, 0, sizeof(m_addr)); - m_addr.sin6_family = AF_INET6; - m_addr.sin6_port = htons( port ); - { - struct in6_addr a; - if (Utility::u2ip(host, a)) - { - m_addr.sin6_addr = a; - m_valid = true; - } - } + memset(&m_addr, 0, sizeof(m_addr)); + m_addr.sin6_family = AF_INET6; + m_addr.sin6_port = htons( port ); + { + struct in6_addr a; + if (Utility::u2ip(host, a)) + { + m_addr.sin6_addr = a; + m_valid = true; + } + } } Ipv6Address::Ipv6Address(struct sockaddr_in6& sa) { - m_addr = sa; - m_valid = sa.sin6_family == AF_INET6; + m_addr = sa; + m_valid = sa.sin6_family == AF_INET6; } @@ -82,183 +82,183 @@ Ipv6Address::~Ipv6Address() Ipv6Address::operator struct sockaddr *() { - return (struct sockaddr *)&m_addr; + return (struct sockaddr *)&m_addr; } Ipv6Address::operator socklen_t() { - return sizeof(struct sockaddr_in6); + return sizeof(struct sockaddr_in6); } void Ipv6Address::SetPort(port_t port) { - m_addr.sin6_port = htons( port ); + m_addr.sin6_port = htons( port ); } port_t Ipv6Address::GetPort() { - return ntohs( m_addr.sin6_port ); + return ntohs( m_addr.sin6_port ); } bool Ipv6Address::Resolve(const std::string& hostname,struct in6_addr& a) { - struct sockaddr_in6 sa; - memset(&a, 0, sizeof(a)); - if (Utility::isipv6(hostname)) - { - if (!Utility::u2ip(hostname, sa, AI_NUMERICHOST)) - return false; - a = sa.sin6_addr; - return true; - } - if (!Utility::u2ip(hostname, sa)) - return false; - a = sa.sin6_addr; - return true; + struct sockaddr_in6 sa; + memset(&a, 0, sizeof(a)); + if (Utility::isipv6(hostname)) + { + if (!Utility::u2ip(hostname, sa, AI_NUMERICHOST)) + return false; + a = sa.sin6_addr; + return true; + } + if (!Utility::u2ip(hostname, sa)) + return false; + a = sa.sin6_addr; + return true; } bool Ipv6Address::Reverse(struct in6_addr& a,std::string& name) { - struct sockaddr_in6 sa; - memset(&sa, 0, sizeof(sa)); - sa.sin6_family = AF_INET6; - sa.sin6_addr = a; - return Utility::reverse((struct sockaddr *)&sa, sizeof(sa), name); + struct sockaddr_in6 sa; + memset(&sa, 0, sizeof(sa)); + sa.sin6_family = AF_INET6; + sa.sin6_addr = a; + return Utility::reverse((struct sockaddr *)&sa, sizeof(sa), name); } std::string Ipv6Address::Convert(bool include_port) { - if (include_port) - return Convert(m_addr.sin6_addr) + ":" + Utility::l2string(GetPort()); - return Convert(m_addr.sin6_addr); + if (include_port) + return Convert(m_addr.sin6_addr) + ":" + Utility::l2string(GetPort()); + return Convert(m_addr.sin6_addr); } std::string Ipv6Address::Convert(struct in6_addr& a,bool mixed) { - char slask[100]; // l2ip temporary - *slask = 0; - unsigned int prev = 0; - bool skipped = false; - bool ok_to_skip = true; - if (mixed) - { - unsigned short x; - unsigned short addr16[8]; - memcpy(addr16, &a, sizeof(addr16)); - for (size_t i = 0; i < 6; i++) - { - x = ntohs(addr16[i]); - if (*slask && (x || !ok_to_skip || prev)) - strcat(slask,":"); - if (x || !ok_to_skip) - { - sprintf(slask + strlen(slask),"%x", x); - if (x && skipped) - ok_to_skip = false; - } - else - { - skipped = true; - } - prev = x; - } - x = ntohs(addr16[6]); - sprintf(slask + strlen(slask),":%u.%u",x / 256,x & 255); - x = ntohs(addr16[7]); - sprintf(slask + strlen(slask),".%u.%u",x / 256,x & 255); - } - else - { - struct sockaddr_in6 sa; - memset(&sa, 0, sizeof(sa)); - sa.sin6_family = AF_INET6; - sa.sin6_addr = a; - std::string name; - Utility::reverse((struct sockaddr *)&sa, sizeof(sa), name, NI_NUMERICHOST); - return name; - } - return slask; + char slask[100]; // l2ip temporary + *slask = 0; + unsigned int prev = 0; + bool skipped = false; + bool ok_to_skip = true; + if (mixed) + { + unsigned short x; + unsigned short addr16[8]; + memcpy(addr16, &a, sizeof(addr16)); + for (size_t i = 0; i < 6; i++) + { + x = ntohs(addr16[i]); + if (*slask && (x || !ok_to_skip || prev)) + strcat(slask,":"); + if (x || !ok_to_skip) + { + sprintf(slask + strlen(slask),"%x", x); + if (x && skipped) + ok_to_skip = false; + } + else + { + skipped = true; + } + prev = x; + } + x = ntohs(addr16[6]); + sprintf(slask + strlen(slask),":%u.%u",x / 256,x & 255); + x = ntohs(addr16[7]); + sprintf(slask + strlen(slask),".%u.%u",x / 256,x & 255); + } + else + { + struct sockaddr_in6 sa; + memset(&sa, 0, sizeof(sa)); + sa.sin6_family = AF_INET6; + sa.sin6_addr = a; + std::string name; + Utility::reverse((struct sockaddr *)&sa, sizeof(sa), name, NI_NUMERICHOST); + return name; + } + return slask; } void Ipv6Address::SetAddress(struct sockaddr *sa) { - memcpy(&m_addr, sa, sizeof(struct sockaddr_in6)); + memcpy(&m_addr, sa, sizeof(struct sockaddr_in6)); } int Ipv6Address::GetFamily() { - return m_addr.sin6_family; + return m_addr.sin6_family; } void Ipv6Address::SetFlowinfo(uint32_t x) { - m_addr.sin6_flowinfo = x; + m_addr.sin6_flowinfo = x; } uint32_t Ipv6Address::GetFlowinfo() { - return m_addr.sin6_flowinfo; + return m_addr.sin6_flowinfo; } #ifndef _WIN32 void Ipv6Address::SetScopeId(uint32_t x) { - m_addr.sin6_scope_id = x; + m_addr.sin6_scope_id = x; } uint32_t Ipv6Address::GetScopeId() { - return m_addr.sin6_scope_id; + return m_addr.sin6_scope_id; } #endif bool Ipv6Address::IsValid() { - return m_valid; + return m_valid; } bool Ipv6Address::operator==(SocketAddress& a) { - if (a.GetFamily() != GetFamily()) - return false; - if ((socklen_t)a != sizeof(m_addr)) - return false; - struct sockaddr *sa = a; - struct sockaddr_in6 *p = (struct sockaddr_in6 *)sa; - if (p -> sin6_port != m_addr.sin6_port) - return false; - if (memcmp(&p -> sin6_addr, &m_addr.sin6_addr, sizeof(struct in6_addr))) - return false; - return true; + if (a.GetFamily() != GetFamily()) + return false; + if ((socklen_t)a != sizeof(m_addr)) + return false; + struct sockaddr *sa = a; + struct sockaddr_in6 *p = (struct sockaddr_in6 *)sa; + if (p -> sin6_port != m_addr.sin6_port) + return false; + if (memcmp(&p -> sin6_addr, &m_addr.sin6_addr, sizeof(struct in6_addr))) + return false; + return true; } std::auto_ptr Ipv6Address::GetCopy() { - return std::auto_ptr(new Ipv6Address(m_addr)); + return std::auto_ptr(new Ipv6Address(m_addr)); } std::string Ipv6Address::Reverse() { - std::string tmp; - Reverse(m_addr.sin6_addr, tmp); - return tmp; + std::string tmp; + Reverse(m_addr.sin6_addr, tmp); + return tmp; } diff --git a/dep/src/sockets/Lock.cpp b/dep/src/sockets/Lock.cpp index 3f7902e232b..3f7ad87b2ba 100644 --- a/dep/src/sockets/Lock.cpp +++ b/dep/src/sockets/Lock.cpp @@ -1,6 +1,6 @@ /** \file Lock.cpp - ** \date 2005-08-22 - ** \author grymse@alhem.net + ** \date 2005-08-22 + ** \author grymse@alhem.net **/ /* Copyright (C) 2005,2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2005,2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -37,13 +37,13 @@ namespace SOCKETS_NAMESPACE { Lock::Lock(Mutex& m) : m_mutex(m) { - m_mutex.Lock(); + m_mutex.Lock(); } Lock::~Lock() { - m_mutex.Unlock(); + m_mutex.Unlock(); } diff --git a/dep/src/sockets/Mutex.cpp b/dep/src/sockets/Mutex.cpp index f7a03c7d990..8284fefacd8 100644 --- a/dep/src/sockets/Mutex.cpp +++ b/dep/src/sockets/Mutex.cpp @@ -1,6 +1,6 @@ /** \file Mutex.cpp - ** \date 2004-10-30 - ** \author grymse@alhem.net + ** \date 2004-10-30 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -37,9 +37,9 @@ namespace SOCKETS_NAMESPACE { Mutex::Mutex() { #ifdef _WIN32 - m_mutex = ::CreateMutex(NULL, FALSE, NULL); + m_mutex = ::CreateMutex(NULL, FALSE, NULL); #else - pthread_mutex_init(&m_mutex, NULL); + pthread_mutex_init(&m_mutex, NULL); #endif } @@ -47,9 +47,9 @@ Mutex::Mutex() Mutex::~Mutex() { #ifdef _WIN32 - ::CloseHandle(m_mutex); + ::CloseHandle(m_mutex); #else - pthread_mutex_destroy(&m_mutex); + pthread_mutex_destroy(&m_mutex); #endif } @@ -57,10 +57,10 @@ Mutex::~Mutex() void Mutex::Lock() { #ifdef _WIN32 - /*DWORD d =*/ WaitForSingleObject(m_mutex, INFINITE); - /// \todo check 'd' for result + /*DWORD d =*/ WaitForSingleObject(m_mutex, INFINITE); + /// \todo check 'd' for result #else - pthread_mutex_lock(&m_mutex); + pthread_mutex_lock(&m_mutex); #endif } @@ -68,9 +68,9 @@ void Mutex::Lock() void Mutex::Unlock() { #ifdef _WIN32 - ::ReleaseMutex(m_mutex); + ::ReleaseMutex(m_mutex); #else - pthread_mutex_unlock(&m_mutex); + pthread_mutex_unlock(&m_mutex); #endif } diff --git a/dep/src/sockets/Parse.cpp b/dep/src/sockets/Parse.cpp index 58122c0c96e..4d4dd99cd98 100644 --- a/dep/src/sockets/Parse.cpp +++ b/dep/src/sockets/Parse.cpp @@ -1,6 +1,6 @@ /** \file Parse.cpp - parse a string ** - ** Written: 1999-Feb-10 grymse@alhem.net + ** Written: 1999-Feb-10 grymse@alhem.net **/ /* @@ -9,7 +9,7 @@ Copyright (C) 1999-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -102,214 +102,214 @@ Parse::~Parse() short Parse::issplit(const char c) { - for (size_t i = 0; i < pa_splits.size(); i++) - if (pa_splits[i] == c) - return 1; - return 0; + for (size_t i = 0; i < pa_splits.size(); i++) + if (pa_splits[i] == c) + return 1; + return 0; } void Parse::getsplit() { - size_t x; + size_t x; - if (C == '=') - { - x = pa_the_ptr++; - } else - { - while (C && (issplit(C))) - pa_the_ptr++; - x = pa_the_ptr; - while (C && !issplit(C) && C != '=') - pa_the_ptr++; - } - if (x == pa_the_ptr && C == '=') - pa_the_ptr++; - pa_ord = (x < pa_the_str.size()) ? pa_the_str.substr(x,pa_the_ptr - x) : ""; + if (C == '=') + { + x = pa_the_ptr++; + } else + { + while (C && (issplit(C))) + pa_the_ptr++; + x = pa_the_ptr; + while (C && !issplit(C) && C != '=') + pa_the_ptr++; + } + if (x == pa_the_ptr && C == '=') + pa_the_ptr++; + pa_ord = (x < pa_the_str.size()) ? pa_the_str.substr(x,pa_the_ptr - x) : ""; } std::string Parse::getword() { - size_t x; - int disabled = 0; - int quote = 0; - int rem = 0; + size_t x; + int disabled = 0; + int quote = 0; + int rem = 0; - if (pa_nospace) - { - while (C && issplit(C)) - pa_the_ptr++; - x = pa_the_ptr; - while (C && !issplit(C) && (C != pa_breakchar || !pa_breakchar || disabled)) - { - if (pa_breakchar && C == pa_disable) - disabled = 1; - if (pa_breakchar && C == pa_enable) - disabled = 0; - if (pa_quote && C == '"') - quote = 1; - pa_the_ptr++; - while (quote && C && C != '"') - { - pa_the_ptr++; - } - if (pa_quote && C == '"') - { - pa_the_ptr++; - } - quote = 0; - } - } else - { - if (C == pa_breakchar && pa_breakchar) - { - x = pa_the_ptr++; - rem = 1; - } else - { - while (C && (C == ' ' || C == 9 || C == 13 || C == 10 || issplit(C))) - pa_the_ptr++; - x = pa_the_ptr; - while (C && C != ' ' && C != 9 && C != 13 && C != 10 && !issplit(C) && - (C != pa_breakchar || !pa_breakchar || disabled)) - { - if (pa_breakchar && C == pa_disable) - disabled = 1; - if (pa_breakchar && C == pa_enable) - disabled = 0; - if (pa_quote && C == '"') - { - quote = 1; - pa_the_ptr++; - while (quote && C && C != '"') - { - pa_the_ptr++; - } - if (pa_quote && C == '"') - { - pa_the_ptr++; - } - } - else - pa_the_ptr++; - quote = 0; - } - pa_the_ptr++; - rem = 1; - } - if (x == pa_the_ptr && C == pa_breakchar && pa_breakchar) - pa_the_ptr++; - } - if (x < pa_the_str.size()) - { - pa_ord = pa_the_str.substr(x,pa_the_ptr - x - rem); - } - else - { - pa_ord = ""; - } - return pa_ord; + if (pa_nospace) + { + while (C && issplit(C)) + pa_the_ptr++; + x = pa_the_ptr; + while (C && !issplit(C) && (C != pa_breakchar || !pa_breakchar || disabled)) + { + if (pa_breakchar && C == pa_disable) + disabled = 1; + if (pa_breakchar && C == pa_enable) + disabled = 0; + if (pa_quote && C == '"') + quote = 1; + pa_the_ptr++; + while (quote && C && C != '"') + { + pa_the_ptr++; + } + if (pa_quote && C == '"') + { + pa_the_ptr++; + } + quote = 0; + } + } else + { + if (C == pa_breakchar && pa_breakchar) + { + x = pa_the_ptr++; + rem = 1; + } else + { + while (C && (C == ' ' || C == 9 || C == 13 || C == 10 || issplit(C))) + pa_the_ptr++; + x = pa_the_ptr; + while (C && C != ' ' && C != 9 && C != 13 && C != 10 && !issplit(C) && + (C != pa_breakchar || !pa_breakchar || disabled)) + { + if (pa_breakchar && C == pa_disable) + disabled = 1; + if (pa_breakchar && C == pa_enable) + disabled = 0; + if (pa_quote && C == '"') + { + quote = 1; + pa_the_ptr++; + while (quote && C && C != '"') + { + pa_the_ptr++; + } + if (pa_quote && C == '"') + { + pa_the_ptr++; + } + } + else + pa_the_ptr++; + quote = 0; + } + pa_the_ptr++; + rem = 1; + } + if (x == pa_the_ptr && C == pa_breakchar && pa_breakchar) + pa_the_ptr++; + } + if (x < pa_the_str.size()) + { + pa_ord = pa_the_str.substr(x,pa_the_ptr - x - rem); + } + else + { + pa_ord = ""; + } + return pa_ord; } void Parse::getword(std::string&s) { - s = Parse::getword(); + s = Parse::getword(); } void Parse::getsplit(std::string&s) { - Parse::getsplit(); - s = pa_ord; + Parse::getsplit(); + s = pa_ord; } void Parse::getword(std::string&s,std::string&fill,int l) { - Parse::getword(); - s = ""; - while (s.size() + pa_ord.size() < (size_t)l) - s += fill; - s += pa_ord; + Parse::getword(); + s = ""; + while (s.size() + pa_ord.size() < (size_t)l) + s += fill; + s += pa_ord; } std::string Parse::getrest() { - std::string s; - while (C && (C == ' ' || C == 9 || issplit(C))) - pa_the_ptr++; - s = (pa_the_ptr < pa_the_str.size()) ? pa_the_str.substr(pa_the_ptr) : ""; - return s; + std::string s; + while (C && (C == ' ' || C == 9 || issplit(C))) + pa_the_ptr++; + s = (pa_the_ptr < pa_the_str.size()) ? pa_the_str.substr(pa_the_ptr) : ""; + return s; } void Parse::getrest(std::string&s) { - while (C && (C == ' ' || C == 9 || issplit(C))) - pa_the_ptr++; - s = (pa_the_ptr < pa_the_str.size()) ? pa_the_str.substr(pa_the_ptr) : ""; + while (C && (C == ' ' || C == 9 || issplit(C))) + pa_the_ptr++; + s = (pa_the_ptr < pa_the_str.size()) ? pa_the_str.substr(pa_the_ptr) : ""; } long Parse::getvalue() { - Parse::getword(); - return atol(pa_ord.c_str()); + Parse::getword(); + return atol(pa_ord.c_str()); } void Parse::setbreak(const char c) { - pa_breakchar = c; + pa_breakchar = c; } int Parse::getwordlen() { - size_t x,y = pa_the_ptr,len; + size_t x,y = pa_the_ptr,len; - if (C == pa_breakchar && pa_breakchar) - { - x = pa_the_ptr++; - } else - { - while (C && (C == ' ' || C == 9 || C == 13 || C == 10 || issplit(C))) - pa_the_ptr++; - x = pa_the_ptr; - while (C && C != ' ' && C != 9 && C != 13 && C != 10 && !issplit(C) && (C != pa_breakchar || !pa_breakchar)) - pa_the_ptr++; - } - if (x == pa_the_ptr && C == pa_breakchar && pa_breakchar) - pa_the_ptr++; - len = pa_the_ptr - x; - pa_the_ptr = y; - return (int)len; + if (C == pa_breakchar && pa_breakchar) + { + x = pa_the_ptr++; + } else + { + while (C && (C == ' ' || C == 9 || C == 13 || C == 10 || issplit(C))) + pa_the_ptr++; + x = pa_the_ptr; + while (C && C != ' ' && C != 9 && C != 13 && C != 10 && !issplit(C) && (C != pa_breakchar || !pa_breakchar)) + pa_the_ptr++; + } + if (x == pa_the_ptr && C == pa_breakchar && pa_breakchar) + pa_the_ptr++; + len = pa_the_ptr - x; + pa_the_ptr = y; + return (int)len; } int Parse::getrestlen() { - size_t y = pa_the_ptr; - size_t len; + size_t y = pa_the_ptr; + size_t len; - while (C && (C == ' ' || C == 9 || issplit(C))) - pa_the_ptr++; - len = strlen(pa_the_str.c_str() + pa_the_ptr); - pa_the_ptr = y; - return (int)len; + while (C && (C == ' ' || C == 9 || issplit(C))) + pa_the_ptr++; + len = strlen(pa_the_str.c_str() + pa_the_ptr); + pa_the_ptr = y; + return (int)len; } void Parse::getline() { - size_t x; + size_t x; - x = pa_the_ptr; - while (C && C != 13 && C != 10) - pa_the_ptr++; - pa_ord = (x < pa_the_str.size()) ? pa_the_str.substr(x,pa_the_ptr - x) : ""; - if (C == 13) - pa_the_ptr++; - if (C == 10) - pa_the_ptr++; + x = pa_the_ptr; + while (C && C != 13 && C != 10) + pa_the_ptr++; + pa_ord = (x < pa_the_str.size()) ? pa_the_str.substr(x,pa_the_ptr - x) : ""; + if (C == 13) + pa_the_ptr++; + if (C == 10) + pa_the_ptr++; } void Parse::getline(std::string&s) { - getline(); - s = pa_ord; + getline(); + s = pa_ord; } /* end of implementation of class Parse */ diff --git a/dep/src/sockets/ResolvServer.cpp b/dep/src/sockets/ResolvServer.cpp index 83f842b5343..3923df33079 100644 --- a/dep/src/sockets/ResolvServer.cpp +++ b/dep/src/sockets/ResolvServer.cpp @@ -1,6 +1,6 @@ /** \file ResolvServer.cpp - ** \date 2005-03-24 - ** \author grymse@alhem.net + ** \date 2005-03-24 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -58,34 +58,34 @@ ResolvServer::~ResolvServer() void ResolvServer::Run() { -// StdoutLog log; - SocketHandler h; - ListenSocket l(h); +// StdoutLog log; + SocketHandler h; + ListenSocket l(h); - if (l.Bind("127.0.0.1", m_port)) - { - return; - } - h.Add(&l); + if (l.Bind("127.0.0.1", m_port)) + { + return; + } + h.Add(&l); - m_ready = true; - while (!m_quit && IsRunning() ) - { - h.Select(0, 500000); - } - SetRunning(false); + m_ready = true; + while (!m_quit && IsRunning() ) + { + h.Select(0, 500000); + } + SetRunning(false); } void ResolvServer::Quit() { - m_quit = true; + m_quit = true; } bool ResolvServer::Ready() { - return m_ready; + return m_ready; } diff --git a/dep/src/sockets/ResolvSocket.cpp b/dep/src/sockets/ResolvSocket.cpp index 2d9d31d5a4f..6096dc89e37 100644 --- a/dep/src/sockets/ResolvSocket.cpp +++ b/dep/src/sockets/ResolvSocket.cpp @@ -1,6 +1,6 @@ /** \file ResolvSocket.cpp - ** \date 2005-03-24 - ** \author grymse@alhem.net + ** \date 2005-03-24 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -69,7 +69,7 @@ ResolvSocket::ResolvSocket(ISocketHandler& h) #endif ,m_cached(false) { - SetLineProtocol(); + SetLineProtocol(); } @@ -84,7 +84,7 @@ ResolvSocket::ResolvSocket(ISocketHandler& h, Socket *parent, const std::string& #endif ,m_cached(false) { - SetLineProtocol(); + SetLineProtocol(); } @@ -99,7 +99,7 @@ ResolvSocket::ResolvSocket(ISocketHandler& h, Socket *parent, ipaddr_t a) #endif ,m_cached(false) { - SetLineProtocol(); + SetLineProtocol(); } @@ -113,7 +113,7 @@ ResolvSocket::ResolvSocket(ISocketHandler& h, Socket *parent, in6_addr& a) ,m_resolv_address6(a) ,m_cached(false) { - SetLineProtocol(); + SetLineProtocol(); } #endif @@ -125,145 +125,145 @@ ResolvSocket::~ResolvSocket() void ResolvSocket::OnLine(const std::string& line) { - Parse pa(line, ":"); - if (m_bServer) - { - m_query = pa.getword(); - m_data = pa.getrest(); -DEB( fprintf(stderr, " *** ResolvSocket server; query=%s, data=%s\n", m_query.c_str(), m_data.c_str());) - // %! check cache - { - Lock lock(m_cache_mutex); - if (m_cache[m_query].find(m_data) != m_cache[m_query].end()) - { - if (time(NULL) - m_cache_to[m_query][m_data] < 3600) // ttl - { - std::string result = m_cache[m_query][m_data]; + Parse pa(line, ":"); + if (m_bServer) + { + m_query = pa.getword(); + m_data = pa.getrest(); +DEB( fprintf(stderr, " *** ResolvSocket server; query=%s, data=%s\n", m_query.c_str(), m_data.c_str());) + // %! check cache + { + Lock lock(m_cache_mutex); + if (m_cache[m_query].find(m_data) != m_cache[m_query].end()) + { + if (time(NULL) - m_cache_to[m_query][m_data] < 3600) // ttl + { + std::string result = m_cache[m_query][m_data]; DEB(fprintf(stderr, " *** Returning cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), result.c_str());) - Send("Cached\n"); - if (!result.size()) /* failed */ - { - Send("Failed\n\n"); - SetCloseAndDelete(); - return; - } - else - if (m_query == "gethostbyname") - { - Send("A: " + result + "\n\n"); - SetCloseAndDelete(); - return; - } - else + Send("Cached\n"); + if (!result.size()) /* failed */ + { + Send("Failed\n\n"); + SetCloseAndDelete(); + return; + } + else + if (m_query == "gethostbyname") + { + Send("A: " + result + "\n\n"); + SetCloseAndDelete(); + return; + } + else #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (m_query == "gethostbyname2") - { - Send("AAAA: " + result + "\n\n"); - SetCloseAndDelete(); - return; - } - else + if (m_query == "gethostbyname2") + { + Send("AAAA: " + result + "\n\n"); + SetCloseAndDelete(); + return; + } + else #endif #endif - if (m_query == "gethostbyaddr") - { - Send("Name: " + result + "\n\n"); - SetCloseAndDelete(); - return; - } - } - } - } - if (!Detach()) // detach failed? - { - SetCloseAndDelete(); - } - return; - } - std::string key = pa.getword(); - std::string value = pa.getrest(); -DEB( fprintf(stderr, " *** ResolvSocket response; %s: %s\n", key.c_str(), value.c_str());) + if (m_query == "gethostbyaddr") + { + Send("Name: " + result + "\n\n"); + SetCloseAndDelete(); + return; + } + } + } + } + if (!Detach()) // detach failed? + { + SetCloseAndDelete(); + } + return; + } + std::string key = pa.getword(); + std::string value = pa.getrest(); +DEB( fprintf(stderr, " *** ResolvSocket response; %s: %s\n", key.c_str(), value.c_str());) - if (key == "Cached") - { - m_cached = true; - } - else - if (key == "Failed" && m_parent) - { -DEB( fprintf(stderr, " ************ Resolve failed\n");) - if (Handler().Resolving(m_parent) || Handler().Valid(m_parent)) - { - m_parent -> OnResolveFailed(m_resolv_id); - } - // update cache - if (!m_cached) - { - Lock lock(m_cache_mutex); + if (key == "Cached") + { + m_cached = true; + } + else + if (key == "Failed" && m_parent) + { +DEB( fprintf(stderr, " ************ Resolve failed\n");) + if (Handler().Resolving(m_parent) || Handler().Valid(m_parent)) + { + m_parent -> OnResolveFailed(m_resolv_id); + } + // update cache + if (!m_cached) + { + Lock lock(m_cache_mutex); DEB(fprintf(stderr, " *** Update cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), value.c_str());) - m_cache[m_query][m_data] = value; - m_cache_to[m_query][m_data] = time(NULL); - } - m_parent = NULL; - } - else - if (key == "Name" && !m_resolv_host.size() && m_parent) - { - if (Handler().Resolving(m_parent) || Handler().Valid(m_parent)) - { - m_parent -> OnReverseResolved(m_resolv_id, value); - } - // update cache - if (!m_cached) - { - Lock lock(m_cache_mutex); + m_cache[m_query][m_data] = value; + m_cache_to[m_query][m_data] = time(NULL); + } + m_parent = NULL; + } + else + if (key == "Name" && !m_resolv_host.size() && m_parent) + { + if (Handler().Resolving(m_parent) || Handler().Valid(m_parent)) + { + m_parent -> OnReverseResolved(m_resolv_id, value); + } + // update cache + if (!m_cached) + { + Lock lock(m_cache_mutex); DEB(fprintf(stderr, " *** Update cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), value.c_str());) - m_cache[m_query][m_data] = value; - m_cache_to[m_query][m_data] = time(NULL); - } - m_parent = NULL; - } - else - if (key == "A" && m_parent) - { - if (Handler().Resolving(m_parent) || Handler().Valid(m_parent)) - { - ipaddr_t l; - Utility::u2ip(value, l); // ip2ipaddr_t - m_parent -> OnResolved(m_resolv_id, l, m_resolv_port); - } - // update cache - if (!m_cached) - { - Lock lock(m_cache_mutex); + m_cache[m_query][m_data] = value; + m_cache_to[m_query][m_data] = time(NULL); + } + m_parent = NULL; + } + else + if (key == "A" && m_parent) + { + if (Handler().Resolving(m_parent) || Handler().Valid(m_parent)) + { + ipaddr_t l; + Utility::u2ip(value, l); // ip2ipaddr_t + m_parent -> OnResolved(m_resolv_id, l, m_resolv_port); + } + // update cache + if (!m_cached) + { + Lock lock(m_cache_mutex); DEB(fprintf(stderr, " *** Update cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), value.c_str());) - m_cache[m_query][m_data] = value; - m_cache_to[m_query][m_data] = time(NULL); - } - m_parent = NULL; // always use first ip in case there are several - } + m_cache[m_query][m_data] = value; + m_cache_to[m_query][m_data] = time(NULL); + } + m_parent = NULL; // always use first ip in case there are several + } #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - else - if (key == "AAAA" && m_parent) - { - if (Handler().Resolving(m_parent) || Handler().Valid(m_parent)) - { - in6_addr a; - Utility::u2ip(value, a); - m_parent -> OnResolved(m_resolv_id, a, m_resolv_port); - } - // update cache - if (!m_cached) - { - Lock lock(m_cache_mutex); + else + if (key == "AAAA" && m_parent) + { + if (Handler().Resolving(m_parent) || Handler().Valid(m_parent)) + { + in6_addr a; + Utility::u2ip(value, a); + m_parent -> OnResolved(m_resolv_id, a, m_resolv_port); + } + // update cache + if (!m_cached) + { + Lock lock(m_cache_mutex); DEB(fprintf(stderr, " *** Update cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), value.c_str());) - m_cache[m_query][m_data] = value; - m_cache_to[m_query][m_data] = time(NULL); - } - m_parent = NULL; - } + m_cache[m_query][m_data] = value; + m_cache_to[m_query][m_data] = time(NULL); + } + m_parent = NULL; + } #endif #endif } @@ -271,160 +271,160 @@ DEB(fprintf(stderr, " *** Update cache for [%s][%s] = '%s'\n", m_query.c_str(), void ResolvSocket::OnDetached() { -DEB( fprintf(stderr, " *** ResolvSocket::OnDetached(); query=%s, data=%s\n", m_query.c_str(), m_data.c_str());) - if (m_query == "gethostbyname") - { - struct sockaddr_in sa; - if (Utility::u2ip(m_data, sa)) - { - std::string ip; - Utility::l2ip(sa.sin_addr, ip); - Send("A: " + ip + "\n"); - } - else - { - Send("Failed\n"); - } - Send("\n"); - } - else +DEB( fprintf(stderr, " *** ResolvSocket::OnDetached(); query=%s, data=%s\n", m_query.c_str(), m_data.c_str());) + if (m_query == "gethostbyname") + { + struct sockaddr_in sa; + if (Utility::u2ip(m_data, sa)) + { + std::string ip; + Utility::l2ip(sa.sin_addr, ip); + Send("A: " + ip + "\n"); + } + else + { + Send("Failed\n"); + } + Send("\n"); + } + else #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (m_query == "gethostbyname2") - { - struct sockaddr_in6 sa; - if (Utility::u2ip(m_data, sa)) - { - std::string ip; - Utility::l2ip(sa.sin6_addr, ip); - Send("AAAA: " + ip + "\n"); - } - else - { - Send("Failed\n"); - } - Send("\n"); - } - else + if (m_query == "gethostbyname2") + { + struct sockaddr_in6 sa; + if (Utility::u2ip(m_data, sa)) + { + std::string ip; + Utility::l2ip(sa.sin6_addr, ip); + Send("AAAA: " + ip + "\n"); + } + else + { + Send("Failed\n"); + } + Send("\n"); + } + else #endif #endif - if (m_query == "gethostbyaddr") - { - if (Utility::isipv4( m_data )) - { - struct sockaddr_in sa; - if (!Utility::u2ip(m_data, sa, AI_NUMERICHOST)) - { - Send("Failed: convert to sockaddr_in failed\n"); - } - else - { - std::string name; - if (!Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), name)) - { - Send("Failed: ipv4 reverse lookup of " + m_data + "\n"); - } - else - { - Send("Name: " + name + "\n"); - } - } - } - else + if (m_query == "gethostbyaddr") + { + if (Utility::isipv4( m_data )) + { + struct sockaddr_in sa; + if (!Utility::u2ip(m_data, sa, AI_NUMERICHOST)) + { + Send("Failed: convert to sockaddr_in failed\n"); + } + else + { + std::string name; + if (!Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), name)) + { + Send("Failed: ipv4 reverse lookup of " + m_data + "\n"); + } + else + { + Send("Name: " + name + "\n"); + } + } + } + else #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (Utility::isipv6( m_data )) - { - struct sockaddr_in6 sa; - if (!Utility::u2ip(m_data, sa, AI_NUMERICHOST)) - { - Send("Failed: convert to sockaddr_in6 failed\n"); - } - else - { - std::string name; - if (!Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), name)) - { - Send("Failed: ipv6 reverse lookup of " + m_data + "\n"); - } - else - { - Send("Name: " + name + "\n"); - } - } - } - else + if (Utility::isipv6( m_data )) + { + struct sockaddr_in6 sa; + if (!Utility::u2ip(m_data, sa, AI_NUMERICHOST)) + { + Send("Failed: convert to sockaddr_in6 failed\n"); + } + else + { + std::string name; + if (!Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), name)) + { + Send("Failed: ipv6 reverse lookup of " + m_data + "\n"); + } + else + { + Send("Name: " + name + "\n"); + } + } + } + else #endif #endif - { - Send("Failed: malformed address\n"); - } - Send("\n"); - } - else - { - std::string msg = "Unknown query type: " + m_query; - Handler().LogError(this, "OnDetached", 0, msg); - Send("Unknown\n\n"); - } - SetCloseAndDelete(); + { + Send("Failed: malformed address\n"); + } + Send("\n"); + } + else + { + std::string msg = "Unknown query type: " + m_query; + Handler().LogError(this, "OnDetached", 0, msg); + Send("Unknown\n\n"); + } + SetCloseAndDelete(); } void ResolvSocket::OnConnect() { - if (!m_resolv_host.empty()) - { + if (!m_resolv_host.empty()) + { #ifdef ENABLE_IPV6 - std::string msg = (m_resolve_ipv6 ? "gethostbyname2 " : "gethostbyname ") + m_resolv_host + "\n"; - m_query = m_resolve_ipv6 ? "gethostbyname2" : "gethostbyname"; + std::string msg = (m_resolve_ipv6 ? "gethostbyname2 " : "gethostbyname ") + m_resolv_host + "\n"; + m_query = m_resolve_ipv6 ? "gethostbyname2" : "gethostbyname"; #else - std::string msg = "gethostbyname " + m_resolv_host + "\n"; - m_query = "gethostbyname"; + std::string msg = "gethostbyname " + m_resolv_host + "\n"; + m_query = "gethostbyname"; #endif - m_data = m_resolv_host; - Send( msg ); - return; - } + m_data = m_resolv_host; + Send( msg ); + return; + } #ifdef ENABLE_IPV6 - if (m_resolve_ipv6) - { - std::string tmp; - Utility::l2ip(m_resolv_address6, tmp); - m_query = "gethostbyaddr"; - m_data = tmp; - std::string msg = "gethostbyaddr " + tmp + "\n"; - Send( msg ); - } + if (m_resolve_ipv6) + { + std::string tmp; + Utility::l2ip(m_resolv_address6, tmp); + m_query = "gethostbyaddr"; + m_data = tmp; + std::string msg = "gethostbyaddr " + tmp + "\n"; + Send( msg ); + } #endif - std::string tmp; - Utility::l2ip(m_resolv_address, tmp); - m_query = "gethostbyaddr"; - m_data = tmp; - std::string msg = "gethostbyaddr " + tmp + "\n"; - Send( msg ); + std::string tmp; + Utility::l2ip(m_resolv_address, tmp); + m_query = "gethostbyaddr"; + m_data = tmp; + std::string msg = "gethostbyaddr " + tmp + "\n"; + Send( msg ); } void ResolvSocket::OnDelete() { - if (m_parent) - { - if (Handler().Resolving(m_parent) || Handler().Valid(m_parent)) - { - m_parent -> OnResolveFailed(m_resolv_id); - } - // update cache - if (!m_cached) - { - Lock lock(m_cache_mutex); - std::string value; + if (m_parent) + { + if (Handler().Resolving(m_parent) || Handler().Valid(m_parent)) + { + m_parent -> OnResolveFailed(m_resolv_id); + } + // update cache + if (!m_cached) + { + Lock lock(m_cache_mutex); + std::string value; DEB(fprintf(stderr, " *** Update cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), value.c_str());) - m_cache[m_query][m_data] = value; - m_cache_to[m_query][m_data] = time(NULL); - } - m_parent = NULL; - } + m_cache[m_query][m_data] = value; + m_cache_to[m_query][m_data] = time(NULL); + } + m_parent = NULL; + } } diff --git a/dep/src/sockets/Socket.cpp b/dep/src/sockets/Socket.cpp index 883363eb1dd..5e739ec0c71 100644 --- a/dep/src/sockets/Socket.cpp +++ b/dep/src/sockets/Socket.cpp @@ -1,6 +1,6 @@ /** \file Socket.cpp - ** \date 2004-02-13 - ** \author grymse@alhem.net + ** \date 2004-02-13 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -114,15 +114,15 @@ Socket::Socket(ISocketHandler& h) Socket::~Socket() { - Handler().Remove(this); - if (m_socket != INVALID_SOCKET + Handler().Remove(this); + if (m_socket != INVALID_SOCKET #ifdef ENABLE_POOL - && !m_bRetain + && !m_bRetain #endif - ) - { - Close(); - } + ) + { + Close(); + } } @@ -143,11 +143,11 @@ void Socket::OnWrite() void Socket::OnException() { - // %! exception doesn't always mean something bad happened, this code should be reworked - // errno valid here? - int err = SoError(); - Handler().LogError(this, "exception on select", err, StrError(err), LOG_LEVEL_FATAL); - SetCloseAndDelete(); + // %! exception doesn't always mean something bad happened, this code should be reworked + // errno valid here? + int err = SoError(); + Handler().LogError(this, "exception on select", err, StrError(err), LOG_LEVEL_FATAL); + SetCloseAndDelete(); } @@ -168,159 +168,159 @@ void Socket::OnAccept() int Socket::Close() { - if (m_socket == INVALID_SOCKET) // this could happen - { - Handler().LogError(this, "Socket::Close", 0, "file descriptor invalid", LOG_LEVEL_WARNING); - return 0; - } - int n; - if ((n = closesocket(m_socket)) == -1) - { - // failed... - Handler().LogError(this, "close", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } - Handler().Set(m_socket, false, false, false); // remove from fd_set's - Handler().AddList(m_socket, LIST_CALLONCONNECT, false); + if (m_socket == INVALID_SOCKET) // this could happen + { + Handler().LogError(this, "Socket::Close", 0, "file descriptor invalid", LOG_LEVEL_WARNING); + return 0; + } + int n; + if ((n = closesocket(m_socket)) == -1) + { + // failed... + Handler().LogError(this, "close", Errno, StrError(Errno), LOG_LEVEL_ERROR); + } + Handler().Set(m_socket, false, false, false); // remove from fd_set's + Handler().AddList(m_socket, LIST_CALLONCONNECT, false); #ifdef ENABLE_DETACH - Handler().AddList(m_socket, LIST_DETACH, false); + Handler().AddList(m_socket, LIST_DETACH, false); #endif - Handler().AddList(m_socket, LIST_TIMEOUT, false); - Handler().AddList(m_socket, LIST_RETRY, false); - Handler().AddList(m_socket, LIST_CLOSE, false); - m_socket = INVALID_SOCKET; - return n; + Handler().AddList(m_socket, LIST_TIMEOUT, false); + Handler().AddList(m_socket, LIST_RETRY, false); + Handler().AddList(m_socket, LIST_CLOSE, false); + m_socket = INVALID_SOCKET; + return n; } SOCKET Socket::CreateSocket(int af,int type, const std::string& protocol) { - struct protoent *p = NULL; - SOCKET s; + struct protoent *p = NULL; + SOCKET s; #ifdef ENABLE_POOL - m_socket_type = type; - m_socket_protocol = protocol; + m_socket_type = type; + m_socket_protocol = protocol; #endif - if (!protocol.empty()) - { - p = getprotobyname( protocol.c_str() ); - if (!p) - { - Handler().LogError(this, "getprotobyname", Errno, StrError(Errno), LOG_LEVEL_FATAL); - SetCloseAndDelete(); + if (!protocol.empty()) + { + p = getprotobyname( protocol.c_str() ); + if (!p) + { + Handler().LogError(this, "getprotobyname", Errno, StrError(Errno), LOG_LEVEL_FATAL); + SetCloseAndDelete(); #ifdef ENABLE_EXCEPTIONS - throw Exception(std::string("getprotobyname() failed: ") + StrError(Errno)); + throw Exception(std::string("getprotobyname() failed: ") + StrError(Errno)); #endif - return INVALID_SOCKET; - } - } - int protno = p ? p -> p_proto : 0; + return INVALID_SOCKET; + } + } + int protno = p ? p -> p_proto : 0; - s = socket(af, type, protno); - if (s == INVALID_SOCKET) - { - Handler().LogError(this, "socket", Errno, StrError(Errno), LOG_LEVEL_FATAL); - SetCloseAndDelete(); + s = socket(af, type, protno); + if (s == INVALID_SOCKET) + { + Handler().LogError(this, "socket", Errno, StrError(Errno), LOG_LEVEL_FATAL); + SetCloseAndDelete(); #ifdef ENABLE_EXCEPTIONS - throw Exception(std::string("socket() failed: ") + StrError(Errno)); + throw Exception(std::string("socket() failed: ") + StrError(Errno)); #endif - return INVALID_SOCKET; - } - Attach(s); - OnOptions(af, type, protno, s); - Attach(INVALID_SOCKET); - return s; + return INVALID_SOCKET; + } + Attach(s); + OnOptions(af, type, protno, s); + Attach(INVALID_SOCKET); + return s; } void Socket::Attach(SOCKET s) { - m_socket = s; + m_socket = s; } SOCKET Socket::GetSocket() { - return m_socket; + return m_socket; } void Socket::SetDeleteByHandler(bool x) { - m_bDel = x; + m_bDel = x; } bool Socket::DeleteByHandler() { - return m_bDel; + return m_bDel; } void Socket::SetCloseAndDelete(bool x) { - if (x != m_bClose) - { - Handler().AddList(m_socket, LIST_CLOSE, x); - m_bClose = x; - if (x) - { - m_tClose = time(NULL); - } - } + if (x != m_bClose) + { + Handler().AddList(m_socket, LIST_CLOSE, x); + m_bClose = x; + if (x) + { + m_tClose = time(NULL); + } + } } bool Socket::CloseAndDelete() { - return m_bClose; + return m_bClose; } void Socket::SetRemoteAddress(SocketAddress& ad) //struct sockaddr* sa, socklen_t l) { - m_remote_address = ad.GetCopy(); + m_remote_address = ad.GetCopy(); } std::auto_ptr Socket::GetRemoteSocketAddress() { - return m_remote_address -> GetCopy(); + return m_remote_address -> GetCopy(); } ISocketHandler& Socket::Handler() const { #ifdef ENABLE_DETACH - if (IsDetached()) - return *m_slave_handler; + if (IsDetached()) + return *m_slave_handler; #endif - return m_handler; + return m_handler; } ISocketHandler& Socket::MasterHandler() const { - return m_handler; + return m_handler; } ipaddr_t Socket::GetRemoteIP4() { - ipaddr_t l = 0; + ipaddr_t l = 0; #ifdef ENABLE_IPV6 - if (m_ipv6) - { - Handler().LogError(this, "GetRemoteIP4", 0, "get ipv4 address for ipv6 socket", LOG_LEVEL_WARNING); - } + if (m_ipv6) + { + Handler().LogError(this, "GetRemoteIP4", 0, "get ipv4 address for ipv6 socket", LOG_LEVEL_WARNING); + } #endif - if (m_remote_address.get() != NULL) - { - struct sockaddr *p = *m_remote_address; - struct sockaddr_in *sa = (struct sockaddr_in *)p; - memcpy(&l, &sa -> sin_addr, sizeof(struct in_addr)); - } - return l; + if (m_remote_address.get() != NULL) + { + struct sockaddr *p = *m_remote_address; + struct sockaddr_in *sa = (struct sockaddr_in *)p; + memcpy(&l, &sa -> sin_addr, sizeof(struct in_addr)); + } + return l; } @@ -328,21 +328,21 @@ ipaddr_t Socket::GetRemoteIP4() #ifdef IPPROTO_IPV6 struct in6_addr Socket::GetRemoteIP6() { - if (!m_ipv6) - { - Handler().LogError(this, "GetRemoteIP6", 0, "get ipv6 address for ipv4 socket", LOG_LEVEL_WARNING); - } - struct sockaddr_in6 fail; - if (m_remote_address.get() != NULL) - { - struct sockaddr *p = *m_remote_address; - memcpy(&fail, p, sizeof(struct sockaddr_in6)); - } - else - { - memset(&fail, 0, sizeof(struct sockaddr_in6)); - } - return fail.sin6_addr; + if (!m_ipv6) + { + Handler().LogError(this, "GetRemoteIP6", 0, "get ipv6 address for ipv4 socket", LOG_LEVEL_WARNING); + } + struct sockaddr_in6 fail; + if (m_remote_address.get() != NULL) + { + struct sockaddr *p = *m_remote_address; + memcpy(&fail, p, sizeof(struct sockaddr_in6)); + } + else + { + memset(&fail, 0, sizeof(struct sockaddr_in6)); + } + return fail.sin6_addr; } #endif #endif @@ -350,63 +350,63 @@ struct in6_addr Socket::GetRemoteIP6() port_t Socket::GetRemotePort() { - if (!m_remote_address.get()) - { - return 0; - } - return m_remote_address -> GetPort(); + if (!m_remote_address.get()) + { + return 0; + } + return m_remote_address -> GetPort(); } std::string Socket::GetRemoteAddress() { - if (!m_remote_address.get()) - { - return ""; - } - return m_remote_address -> Convert(false); + if (!m_remote_address.get()) + { + return ""; + } + return m_remote_address -> Convert(false); } std::string Socket::GetRemoteHostname() { - if (!m_remote_address.get()) - { - return ""; - } - return m_remote_address -> Reverse(); + if (!m_remote_address.get()) + { + return ""; + } + return m_remote_address -> Reverse(); } bool Socket::SetNonblocking(bool bNb) { #ifdef _WIN32 - unsigned long l = bNb ? 1 : 0; - int n = ioctlsocket(m_socket, FIONBIO, &l); - if (n != 0) - { - Handler().LogError(this, "ioctlsocket(FIONBIO)", Errno, ""); - return false; - } - return true; + unsigned long l = bNb ? 1 : 0; + int n = ioctlsocket(m_socket, FIONBIO, &l); + if (n != 0) + { + Handler().LogError(this, "ioctlsocket(FIONBIO)", Errno, ""); + return false; + } + return true; #else - if (bNb) - { - if (fcntl(m_socket, F_SETFL, O_NONBLOCK) == -1) - { - Handler().LogError(this, "fcntl(F_SETFL, O_NONBLOCK)", Errno, StrError(Errno), LOG_LEVEL_ERROR); - return false; - } - } - else - { - if (fcntl(m_socket, F_SETFL, 0) == -1) - { - Handler().LogError(this, "fcntl(F_SETFL, 0)", Errno, StrError(Errno), LOG_LEVEL_ERROR); - return false; - } - } - return true; + if (bNb) + { + if (fcntl(m_socket, F_SETFL, O_NONBLOCK) == -1) + { + Handler().LogError(this, "fcntl(F_SETFL, O_NONBLOCK)", Errno, StrError(Errno), LOG_LEVEL_ERROR); + return false; + } + } + else + { + if (fcntl(m_socket, F_SETFL, 0) == -1) + { + Handler().LogError(this, "fcntl(F_SETFL, 0)", Errno, StrError(Errno), LOG_LEVEL_ERROR); + return false; + } + } + return true; #endif } @@ -414,47 +414,47 @@ bool Socket::SetNonblocking(bool bNb) bool Socket::SetNonblocking(bool bNb, SOCKET s) { #ifdef _WIN32 - unsigned long l = bNb ? 1 : 0; - int n = ioctlsocket(s, FIONBIO, &l); - if (n != 0) - { - Handler().LogError(this, "ioctlsocket(FIONBIO)", Errno, ""); - return false; - } - return true; + unsigned long l = bNb ? 1 : 0; + int n = ioctlsocket(s, FIONBIO, &l); + if (n != 0) + { + Handler().LogError(this, "ioctlsocket(FIONBIO)", Errno, ""); + return false; + } + return true; #else - if (bNb) - { - if (fcntl(s, F_SETFL, O_NONBLOCK) == -1) - { - Handler().LogError(this, "fcntl(F_SETFL, O_NONBLOCK)", Errno, StrError(Errno), LOG_LEVEL_ERROR); - return false; - } - } - else - { - if (fcntl(s, F_SETFL, 0) == -1) - { - Handler().LogError(this, "fcntl(F_SETFL, 0)", Errno, StrError(Errno), LOG_LEVEL_ERROR); - return false; - } - } - return true; + if (bNb) + { + if (fcntl(s, F_SETFL, O_NONBLOCK) == -1) + { + Handler().LogError(this, "fcntl(F_SETFL, O_NONBLOCK)", Errno, StrError(Errno), LOG_LEVEL_ERROR); + return false; + } + } + else + { + if (fcntl(s, F_SETFL, 0) == -1) + { + Handler().LogError(this, "fcntl(F_SETFL, 0)", Errno, StrError(Errno), LOG_LEVEL_ERROR); + return false; + } + } + return true; #endif } void Socket::Set(bool bRead, bool bWrite, bool bException) { - Handler().Set(m_socket, bRead, bWrite, bException); + Handler().Set(m_socket, bRead, bWrite, bException); } bool Socket::Ready() { - if (m_socket != INVALID_SOCKET && !CloseAndDelete()) - return true; - return false; + if (m_socket != INVALID_SOCKET && !CloseAndDelete()) + return true; + return false; } @@ -470,26 +470,26 @@ void Socket::OnConnectFailed() Socket *Socket::GetParent() { - return m_parent; + return m_parent; } void Socket::SetParent(Socket *x) { - m_parent = x; + m_parent = x; } port_t Socket::GetPort() { - Handler().LogError(this, "GetPort", 0, "GetPort only implemented for ListenSocket", LOG_LEVEL_WARNING); - return 0; + Handler().LogError(this, "GetPort", 0, "GetPort only implemented for ListenSocket", LOG_LEVEL_WARNING); + return 0; } bool Socket::OnConnectRetry() { - return true; + return true; } @@ -502,33 +502,33 @@ void Socket::OnReconnect() time_t Socket::Uptime() { - return time(NULL) - m_tCreate; + return time(NULL) - m_tCreate; } #ifdef ENABLE_IPV6 void Socket::SetIpv6(bool x) { - m_ipv6 = x; + m_ipv6 = x; } bool Socket::IsIpv6() { - return m_ipv6; + return m_ipv6; } #endif void Socket::DisableRead(bool x) { - m_b_disable_read = x; + m_b_disable_read = x; } bool Socket::IsDisableRead() { - return m_b_disable_read; + return m_b_disable_read; } @@ -544,13 +544,13 @@ void Socket::Send(const std::string&,int) void Socket::SetConnected(bool x) { - m_connected = x; + m_connected = x; } bool Socket::IsConnected() { - return m_connected; + return m_connected; } @@ -561,63 +561,63 @@ void Socket::OnDisconnect() void Socket::SetLost() { - m_bLost = true; + m_bLost = true; } bool Socket::Lost() { - return m_bLost; + return m_bLost; } void Socket::SetErasedByHandler(bool x) { - m_b_erased_by_handler = x; + m_b_erased_by_handler = x; } bool Socket::ErasedByHandler() { - return m_b_erased_by_handler; + return m_b_erased_by_handler; } time_t Socket::TimeSinceClose() { - return time(NULL) - m_tClose; + return time(NULL) - m_tClose; } void Socket::SetClientRemoteAddress(SocketAddress& ad) { - if (!ad.IsValid()) - { - Handler().LogError(this, "SetClientRemoteAddress", 0, "remote address not valid", LOG_LEVEL_ERROR); - } - m_client_remote_address = ad.GetCopy(); + if (!ad.IsValid()) + { + Handler().LogError(this, "SetClientRemoteAddress", 0, "remote address not valid", LOG_LEVEL_ERROR); + } + m_client_remote_address = ad.GetCopy(); } std::auto_ptr Socket::GetClientRemoteAddress() { - if (!m_client_remote_address.get()) - { - Handler().LogError(this, "GetClientRemoteAddress", 0, "remote address not yet set", LOG_LEVEL_ERROR); - } - return m_client_remote_address -> GetCopy(); + if (!m_client_remote_address.get()) + { + Handler().LogError(this, "GetClientRemoteAddress", 0, "remote address not yet set", LOG_LEVEL_ERROR); + } + return m_client_remote_address -> GetCopy(); } uint64_t Socket::GetBytesSent(bool) { - return 0; + return 0; } uint64_t Socket::GetBytesReceived(bool) { - return 0; + return 0; } @@ -634,43 +634,43 @@ void Socket::OnSSLAccept() bool Socket::SSLNegotiate() { - return false; + return false; } bool Socket::IsSSL() { - return m_b_enable_ssl; + return m_b_enable_ssl; } void Socket::EnableSSL(bool x) { - m_b_enable_ssl = x; + m_b_enable_ssl = x; } bool Socket::IsSSLNegotiate() { - return m_b_ssl; + return m_b_ssl; } void Socket::SetSSLNegotiate(bool x) { - m_b_ssl = x; + m_b_ssl = x; } bool Socket::IsSSLServer() { - return m_b_ssl_server; + return m_b_ssl_server; } void Socket::SetSSLServer(bool x) { - m_b_ssl_server = x; + m_b_ssl_server = x; } @@ -688,57 +688,57 @@ void Socket::OnSSLAcceptFailed() #ifdef ENABLE_POOL void Socket::CopyConnection(Socket *sock) { - Attach( sock -> GetSocket() ); + Attach( sock -> GetSocket() ); #ifdef ENABLE_IPV6 - SetIpv6( sock -> IsIpv6() ); + SetIpv6( sock -> IsIpv6() ); #endif - SetSocketType( sock -> GetSocketType() ); - SetSocketProtocol( sock -> GetSocketProtocol() ); + SetSocketType( sock -> GetSocketType() ); + SetSocketProtocol( sock -> GetSocketProtocol() ); - SetClientRemoteAddress( *sock -> GetClientRemoteAddress() ); - SetRemoteAddress( *sock -> GetRemoteSocketAddress() ); + SetClientRemoteAddress( *sock -> GetClientRemoteAddress() ); + SetRemoteAddress( *sock -> GetRemoteSocketAddress() ); } void Socket::SetIsClient() { - m_bClient = true; + m_bClient = true; } void Socket::SetSocketType(int x) { - m_socket_type = x; + m_socket_type = x; } int Socket::GetSocketType() { - return m_socket_type; + return m_socket_type; } void Socket::SetSocketProtocol(const std::string& x) { - m_socket_protocol = x; + m_socket_protocol = x; } const std::string& Socket::GetSocketProtocol() { - return m_socket_protocol; + return m_socket_protocol; } void Socket::SetRetain() { - if (m_bClient) m_bRetain = true; + if (m_bClient) m_bRetain = true; } bool Socket::Retain() { - return m_bRetain; + return m_bRetain; } @@ -748,74 +748,74 @@ bool Socket::Retain() #ifdef ENABLE_SOCKS4 void Socket::OnSocks4Connect() { - Handler().LogError(this, "OnSocks4Connect", 0, "Use with TcpSocket only"); + Handler().LogError(this, "OnSocks4Connect", 0, "Use with TcpSocket only"); } void Socket::OnSocks4ConnectFailed() { - Handler().LogError(this, "OnSocks4ConnectFailed", 0, "Use with TcpSocket only"); + Handler().LogError(this, "OnSocks4ConnectFailed", 0, "Use with TcpSocket only"); } bool Socket::OnSocks4Read() { - Handler().LogError(this, "OnSocks4Read", 0, "Use with TcpSocket only"); - return true; + Handler().LogError(this, "OnSocks4Read", 0, "Use with TcpSocket only"); + return true; } void Socket::SetSocks4Host(const std::string& host) { - Utility::u2ip(host, m_socks4_host); + Utility::u2ip(host, m_socks4_host); } bool Socket::Socks4() { - return m_bSocks4; + return m_bSocks4; } void Socket::SetSocks4(bool x) { - m_bSocks4 = x; + m_bSocks4 = x; } void Socket::SetSocks4Host(ipaddr_t a) { - m_socks4_host = a; + m_socks4_host = a; } void Socket::SetSocks4Port(port_t p) { - m_socks4_port = p; + m_socks4_port = p; } void Socket::SetSocks4Userid(const std::string& x) { - m_socks4_userid = x; + m_socks4_userid = x; } ipaddr_t Socket::GetSocks4Host() { - return m_socks4_host; + return m_socks4_host; } port_t Socket::GetSocks4Port() { - return m_socks4_port; + return m_socks4_port; } const std::string& Socket::GetSocks4Userid() { - return m_socks4_userid; + return m_socks4_userid; } #endif // ENABLE_SOCKS4 @@ -823,22 +823,22 @@ const std::string& Socket::GetSocks4Userid() #ifdef ENABLE_DETACH bool Socket::Detach() { - if (!DeleteByHandler()) - return false; - if (m_pThread) - return false; - if (m_detached) - return false; - SetDetach(); - return true; + if (!DeleteByHandler()) + return false; + if (m_pThread) + return false; + if (m_detached) + return false; + SetDetach(); + return true; } void Socket::DetachSocket() { - SetDetached(); - m_pThread = new SocketThread(this); - m_pThread -> SetRelease(true); + SetDetached(); + m_pThread = new SocketThread(this); + m_pThread -> SetRelease(true); } @@ -849,32 +849,32 @@ void Socket::OnDetached() void Socket::SetDetach(bool x) { - Handler().AddList(m_socket, LIST_DETACH, x); - m_detach = x; + Handler().AddList(m_socket, LIST_DETACH, x); + m_detach = x; } bool Socket::IsDetach() { - return m_detach; + return m_detach; } void Socket::SetDetached(bool x) { - m_detached = x; + m_detached = x; } const bool Socket::IsDetached() const { - return m_detached; + return m_detached; } void Socket::SetSlaveHandler(ISocketHandler *p) { - m_slave_handler = p; + m_slave_handler = p; } @@ -882,40 +882,40 @@ Socket::SocketThread::SocketThread(Socket *p) :Thread(false) ,m_socket(p) { - // Creator will release + // Creator will release } Socket::SocketThread::~SocketThread() { - if (IsRunning()) - { - SetRelease(true); - SetRunning(false); + if (IsRunning()) + { + SetRelease(true); + SetRunning(false); #ifdef _WIN32 - Sleep(1000); + Sleep(1000); #else - sleep(1); + sleep(1); #endif - } + } } void Socket::SocketThread::Run() { - SocketHandler h; - h.SetSlave(); - h.Add(m_socket); - m_socket -> SetSlaveHandler(&h); - m_socket -> OnDetached(); - while (h.GetCount() && IsRunning()) - { - h.Select(0, 500000); - } - // m_socket now deleted oops - // yeah oops m_socket delete its socket thread, that means this - // so Socket will no longer delete its socket thread, instead we do this: - SetDeleteOnExit(); + SocketHandler h; + h.SetSlave(); + h.Add(m_socket); + m_socket -> SetSlaveHandler(&h); + m_socket -> OnDetached(); + while (h.GetCount() && IsRunning()) + { + h.Select(0, 500000); + } + // m_socket now deleted oops + // yeah oops m_socket delete its socket thread, that means this + // so Socket will no longer delete its socket thread, instead we do this: + SetDeleteOnExit(); } #endif // ENABLE_DETACH @@ -923,28 +923,28 @@ void Socket::SocketThread::Run() #ifdef ENABLE_RESOLVER int Socket::Resolve(const std::string& host,port_t port) { - return Handler().Resolve(this, host, port); + return Handler().Resolve(this, host, port); } #ifdef ENABLE_IPV6 int Socket::Resolve6(const std::string& host,port_t port) { - return Handler().Resolve6(this, host, port); + return Handler().Resolve6(this, host, port); } #endif int Socket::Resolve(ipaddr_t a) { - return Handler().Resolve(this, a); + return Handler().Resolve(this, a); } #ifdef ENABLE_IPV6 int Socket::Resolve(in6_addr& a) { - return Handler().Resolve(this, a); + return Handler().Resolve(this, a); } #endif @@ -978,15 +978,15 @@ void Socket::OnResolveFailed(int) bool Socket::SetIpOptions(const void *p, socklen_t len) { #ifdef IP_OPTIONS - if (setsockopt(GetSocket(), IPPROTO_IP, IP_OPTIONS, (char *)p, len) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_OPTIONS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_OPTIONS, (char *)p, len) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_OPTIONS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "ip option not available", 0, "IP_OPTIONS", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "ip option not available", 0, "IP_OPTIONS", LOG_LEVEL_INFO); + return false; #endif } @@ -994,13 +994,13 @@ bool Socket::SetIpOptions(const void *p, socklen_t len) #ifdef IP_PKTINFO bool Socket::SetIpPktinfo(bool x) { - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_PKTINFO, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_PKTINFO)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_PKTINFO, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_PKTINFO)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; } #endif @@ -1008,13 +1008,13 @@ bool Socket::SetIpPktinfo(bool x) #ifdef IP_RECVTOS bool Socket::SetIpRecvTOS(bool x) { - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_RECVTOS, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RECVTOS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_RECVTOS, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RECVTOS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; } #endif @@ -1022,13 +1022,13 @@ bool Socket::SetIpRecvTOS(bool x) #ifdef IP_RECVTTL bool Socket::SetIpRecvTTL(bool x) { - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_RECVTTL, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RECVTTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_RECVTTL, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RECVTTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; } #endif @@ -1036,13 +1036,13 @@ bool Socket::SetIpRecvTTL(bool x) #ifdef IP_RECVOPTS bool Socket::SetIpRecvopts(bool x) { - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_RECVOPTS, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RECVOPTS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_RECVOPTS, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RECVOPTS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; } #endif @@ -1050,13 +1050,13 @@ bool Socket::SetIpRecvopts(bool x) #ifdef IP_RETOPTS bool Socket::SetIpRetopts(bool x) { - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_RETOPTS, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RETOPTS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_RETOPTS, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RETOPTS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; } #endif @@ -1064,80 +1064,80 @@ bool Socket::SetIpRetopts(bool x) bool Socket::SetIpTOS(unsigned char tos) { #ifdef IP_TOS - if (setsockopt(GetSocket(), IPPROTO_IP, IP_TOS, (char *)&tos, sizeof(tos)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_TOS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_TOS, (char *)&tos, sizeof(tos)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_TOS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "ip option not available", 0, "IP_TOS", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "ip option not available", 0, "IP_TOS", LOG_LEVEL_INFO); + return false; #endif } unsigned char Socket::IpTOS() { - unsigned char tos = 0; + unsigned char tos = 0; #ifdef IP_TOS - socklen_t len = sizeof(tos); - if (getsockopt(GetSocket(), IPPROTO_IP, IP_TOS, (char *)&tos, &len) == -1) - { - Handler().LogError(this, "getsockopt(IPPROTO_IP, IP_TOS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } + socklen_t len = sizeof(tos); + if (getsockopt(GetSocket(), IPPROTO_IP, IP_TOS, (char *)&tos, &len) == -1) + { + Handler().LogError(this, "getsockopt(IPPROTO_IP, IP_TOS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + } #else - Handler().LogError(this, "ip option not available", 0, "IP_TOS", LOG_LEVEL_INFO); + Handler().LogError(this, "ip option not available", 0, "IP_TOS", LOG_LEVEL_INFO); #endif - return tos; + return tos; } bool Socket::SetIpTTL(int ttl) { #ifdef IP_TTL - if (setsockopt(GetSocket(), IPPROTO_IP, IP_TTL, (char *)&ttl, sizeof(ttl)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_TTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_TTL, (char *)&ttl, sizeof(ttl)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_TTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "ip option not available", 0, "IP_TTL", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "ip option not available", 0, "IP_TTL", LOG_LEVEL_INFO); + return false; #endif } int Socket::IpTTL() { - int ttl = 0; + int ttl = 0; #ifdef IP_TTL - socklen_t len = sizeof(ttl); - if (getsockopt(GetSocket(), IPPROTO_IP, IP_TTL, (char *)&ttl, &len) == -1) - { - Handler().LogError(this, "getsockopt(IPPROTO_IP, IP_TTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } + socklen_t len = sizeof(ttl); + if (getsockopt(GetSocket(), IPPROTO_IP, IP_TTL, (char *)&ttl, &len) == -1) + { + Handler().LogError(this, "getsockopt(IPPROTO_IP, IP_TTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + } #else - Handler().LogError(this, "ip option not available", 0, "IP_TTL", LOG_LEVEL_INFO); + Handler().LogError(this, "ip option not available", 0, "IP_TTL", LOG_LEVEL_INFO); #endif - return ttl; + return ttl; } bool Socket::SetIpHdrincl(bool x) { #ifdef IP_HDRINCL - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_HDRINCL, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_HDRINCL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_HDRINCL, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_HDRINCL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "ip option not available", 0, "IP_HDRINCL", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "ip option not available", 0, "IP_HDRINCL", LOG_LEVEL_INFO); + return false; #endif } @@ -1145,13 +1145,13 @@ bool Socket::SetIpHdrincl(bool x) #ifdef IP_RECVERR bool Socket::SetIpRecverr(bool x) { - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_RECVERR, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RECVERR)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_RECVERR, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RECVERR)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; } #endif @@ -1159,13 +1159,13 @@ bool Socket::SetIpRecverr(bool x) #ifdef IP_MTU_DISCOVER bool Socket::SetIpMtudiscover(bool x) { - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_MTU_DISCOVER, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_MTU_DISCOVER)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_MTU_DISCOVER, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_MTU_DISCOVER)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; } #endif @@ -1173,13 +1173,13 @@ bool Socket::SetIpMtudiscover(bool x) #ifdef IP_MTU int Socket::IpMtu() { - int mtu = 0; - socklen_t len = sizeof(mtu); - if (getsockopt(GetSocket(), IPPROTO_IP, IP_MTU, (char *)&mtu, &len) == -1) - { - Handler().LogError(this, "getsockopt(IPPROTO_IP, IP_MTU)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } - return mtu; + int mtu = 0; + socklen_t len = sizeof(mtu); + if (getsockopt(GetSocket(), IPPROTO_IP, IP_MTU, (char *)&mtu, &len) == -1) + { + Handler().LogError(this, "getsockopt(IPPROTO_IP, IP_MTU)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + } + return mtu; } #endif @@ -1187,13 +1187,13 @@ int Socket::IpMtu() #ifdef IP_ROUTER_ALERT bool Socket::SetIpRouterAlert(bool x) { - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_ROUTER_ALERT, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_ROUTER_ALERT)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_ROUTER_ALERT, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_ROUTER_ALERT)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; } #endif @@ -1201,48 +1201,48 @@ bool Socket::SetIpRouterAlert(bool x) bool Socket::SetIpMulticastTTL(int ttl) { #ifdef IP_MULTICAST_TTL - if (setsockopt(GetSocket(), IPPROTO_IP, IP_MULTICAST_TTL, (char *)&ttl, sizeof(ttl)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_MULTICAST_TTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_MULTICAST_TTL, (char *)&ttl, sizeof(ttl)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_MULTICAST_TTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "ip option not available", 0, "IP_MULTICAST_TTL", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "ip option not available", 0, "IP_MULTICAST_TTL", LOG_LEVEL_INFO); + return false; #endif } int Socket::IpMulticastTTL() { - int ttl = 0; + int ttl = 0; #ifdef IP_MULTICAST_TTL - socklen_t len = sizeof(ttl); - if (getsockopt(GetSocket(), IPPROTO_IP, IP_MULTICAST_TTL, (char *)&ttl, &len) == -1) - { - Handler().LogError(this, "getsockopt(IPPROTO_IP, IP_MULTICAST_TTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } + socklen_t len = sizeof(ttl); + if (getsockopt(GetSocket(), IPPROTO_IP, IP_MULTICAST_TTL, (char *)&ttl, &len) == -1) + { + Handler().LogError(this, "getsockopt(IPPROTO_IP, IP_MULTICAST_TTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + } #else - Handler().LogError(this, "ip option not available", 0, "IP_MULTICAST_TTL", LOG_LEVEL_INFO); + Handler().LogError(this, "ip option not available", 0, "IP_MULTICAST_TTL", LOG_LEVEL_INFO); #endif - return ttl; + return ttl; } bool Socket::SetMulticastLoop(bool x) { #ifdef IP_MULTICAST_LOOP - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IP, IP_MULTICAST_LOOP, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_MULTICAST_LOOP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_MULTICAST_LOOP, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_MULTICAST_LOOP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "ip option not available", 0, "IP_MULTICAST_LOOP", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "ip option not available", 0, "IP_MULTICAST_LOOP", LOG_LEVEL_INFO); + return false; #endif } @@ -1251,15 +1251,15 @@ bool Socket::SetMulticastLoop(bool x) bool Socket::IpAddMembership(struct ip_mreqn& ref) { #ifdef IP_ADD_MEMBERSHIP - if (setsockopt(GetSocket(), IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&ref, sizeof(struct ip_mreqn)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_ADD_MEMBERSHIP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&ref, sizeof(struct ip_mreqn)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_ADD_MEMBERSHIP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "ip option not available", 0, "IP_ADD_MEMBERSHIP", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "ip option not available", 0, "IP_ADD_MEMBERSHIP", LOG_LEVEL_INFO); + return false; #endif } #endif @@ -1268,15 +1268,15 @@ bool Socket::IpAddMembership(struct ip_mreqn& ref) bool Socket::IpAddMembership(struct ip_mreq& ref) { #ifdef IP_ADD_MEMBERSHIP - if (setsockopt(GetSocket(), IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&ref, sizeof(struct ip_mreq)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_ADD_MEMBERSHIP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&ref, sizeof(struct ip_mreq)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_ADD_MEMBERSHIP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "ip option not available", 0, "IP_ADD_MEMBERSHIP", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "ip option not available", 0, "IP_ADD_MEMBERSHIP", LOG_LEVEL_INFO); + return false; #endif } @@ -1285,15 +1285,15 @@ bool Socket::IpAddMembership(struct ip_mreq& ref) bool Socket::IpDropMembership(struct ip_mreqn& ref) { #ifdef IP_DROP_MEMBERSHIP - if (setsockopt(GetSocket(), IPPROTO_IP, IP_DROP_MEMBERSHIP, (char *)&ref, sizeof(struct ip_mreqn)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_DROP_MEMBERSHIP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_DROP_MEMBERSHIP, (char *)&ref, sizeof(struct ip_mreqn)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_DROP_MEMBERSHIP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "ip option not available", 0, "IP_DROP_MEMBERSHIP", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "ip option not available", 0, "IP_DROP_MEMBERSHIP", LOG_LEVEL_INFO); + return false; #endif } #endif @@ -1302,15 +1302,15 @@ bool Socket::IpDropMembership(struct ip_mreqn& ref) bool Socket::IpDropMembership(struct ip_mreq& ref) { #ifdef IP_DROP_MEMBERSHIP - if (setsockopt(GetSocket(), IPPROTO_IP, IP_DROP_MEMBERSHIP, (char *)&ref, sizeof(struct ip_mreq)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_DROP_MEMBERSHIP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_DROP_MEMBERSHIP, (char *)&ref, sizeof(struct ip_mreq)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_DROP_MEMBERSHIP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "ip option not available", 0, "IP_DROP_MEMBERSHIP", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "ip option not available", 0, "IP_DROP_MEMBERSHIP", LOG_LEVEL_INFO); + return false; #endif } @@ -1321,16 +1321,16 @@ bool Socket::IpDropMembership(struct ip_mreq& ref) bool Socket::SetSoReuseaddr(bool x) { #ifdef SO_REUSEADDR - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_REUSEADDR, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_REUSEADDR)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_REUSEADDR, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_REUSEADDR)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "socket option not available", 0, "SO_REUSEADDR", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "socket option not available", 0, "SO_REUSEADDR", LOG_LEVEL_INFO); + return false; #endif } @@ -1338,16 +1338,16 @@ bool Socket::SetSoReuseaddr(bool x) bool Socket::SetSoKeepalive(bool x) { #ifdef SO_KEEPALIVE - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_KEEPALIVE, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_KEEPALIVE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_KEEPALIVE, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_KEEPALIVE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "socket option not available", 0, "SO_KEEPALIVE", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "socket option not available", 0, "SO_KEEPALIVE", LOG_LEVEL_INFO); + return false; #endif } @@ -1355,43 +1355,43 @@ bool Socket::SetSoKeepalive(bool x) #ifdef SO_NOSIGPIPE bool Socket::SetSoNosigpipe(bool x) { - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_NOSIGPIPE, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_NOSIGPIPE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_NOSIGPIPE, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_NOSIGPIPE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; } #endif bool Socket::SoAcceptconn() { - int value = 0; + int value = 0; #ifdef SO_ACCEPTCONN - socklen_t len = sizeof(value); - if (getsockopt(GetSocket(), SOL_SOCKET, SO_ACCEPTCONN, (char *)&value, &len) == -1) - { - Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_ACCEPTCONN)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } + socklen_t len = sizeof(value); + if (getsockopt(GetSocket(), SOL_SOCKET, SO_ACCEPTCONN, (char *)&value, &len) == -1) + { + Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_ACCEPTCONN)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + } #else - Handler().LogError(this, "socket option not available", 0, "SO_ACCEPTCONN", LOG_LEVEL_INFO); + Handler().LogError(this, "socket option not available", 0, "SO_ACCEPTCONN", LOG_LEVEL_INFO); #endif - return value ? true : false; + return value ? true : false; } #ifdef SO_BSDCOMPAT bool Socket::SetSoBsdcompat(bool x) { - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_BSDCOMPAT, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_BSDCOMPAT)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_BSDCOMPAT, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_BSDCOMPAT)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; } #endif @@ -1399,12 +1399,12 @@ bool Socket::SetSoBsdcompat(bool x) #ifdef SO_BINDTODEVICE bool Socket::SetSoBindtodevice(const std::string& intf) { - if (setsockopt(GetSocket(), SOL_SOCKET, SO_BINDTODEVICE, (char *)intf.c_str(), intf.size()) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_BINDTODEVICE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_BINDTODEVICE, (char *)intf.c_str(), intf.size()) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_BINDTODEVICE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; } #endif @@ -1412,16 +1412,16 @@ bool Socket::SetSoBindtodevice(const std::string& intf) bool Socket::SetSoBroadcast(bool x) { #ifdef SO_BROADCAST - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_BROADCAST)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_BROADCAST)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "socket option not available", 0, "SO_BROADCAST", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "socket option not available", 0, "SO_BROADCAST", LOG_LEVEL_INFO); + return false; #endif } @@ -1429,49 +1429,49 @@ bool Socket::SetSoBroadcast(bool x) bool Socket::SetSoDebug(bool x) { #ifdef SO_DEBUG - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_DEBUG, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_DEBUG)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_DEBUG, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_DEBUG)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "socket option not available", 0, "SO_DEBUG", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "socket option not available", 0, "SO_DEBUG", LOG_LEVEL_INFO); + return false; #endif } int Socket::SoError() { - int value = 0; + int value = 0; #ifdef SO_ERROR - socklen_t len = sizeof(value); - if (getsockopt(GetSocket(), SOL_SOCKET, SO_ERROR, (char *)&value, &len) == -1) - { - Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_ERROR)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } + socklen_t len = sizeof(value); + if (getsockopt(GetSocket(), SOL_SOCKET, SO_ERROR, (char *)&value, &len) == -1) + { + Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_ERROR)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + } #else - Handler().LogError(this, "socket option not available", 0, "SO_ERROR", LOG_LEVEL_INFO); + Handler().LogError(this, "socket option not available", 0, "SO_ERROR", LOG_LEVEL_INFO); #endif - return value; + return value; } bool Socket::SetSoDontroute(bool x) { #ifdef SO_DONTROUTE - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_DONTROUTE, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_DONTROUTE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_DONTROUTE, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_DONTROUTE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "socket option not available", 0, "SO_DONTROUTE", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "socket option not available", 0, "SO_DONTROUTE", LOG_LEVEL_INFO); + return false; #endif } @@ -1479,18 +1479,18 @@ bool Socket::SetSoDontroute(bool x) bool Socket::SetSoLinger(int onoff, int linger) { #ifdef SO_LINGER - struct linger stl; - stl.l_onoff = onoff; - stl.l_linger = linger; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_LINGER, (char *)&stl, sizeof(stl)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_LINGER)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + struct linger stl; + stl.l_onoff = onoff; + stl.l_linger = linger; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_LINGER, (char *)&stl, sizeof(stl)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_LINGER)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "socket option not available", 0, "SO_LINGER", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "socket option not available", 0, "SO_LINGER", LOG_LEVEL_INFO); + return false; #endif } @@ -1498,16 +1498,16 @@ bool Socket::SetSoLinger(int onoff, int linger) bool Socket::SetSoOobinline(bool x) { #ifdef SO_OOBINLINE - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_OOBINLINE, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_OOBINLINE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_OOBINLINE, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_OOBINLINE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "socket option not available", 0, "SO_OOBINLINE", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "socket option not available", 0, "SO_OOBINLINE", LOG_LEVEL_INFO); + return false; #endif } @@ -1515,13 +1515,13 @@ bool Socket::SetSoOobinline(bool x) #ifdef SO_PASSCRED bool Socket::SetSoPasscred(bool x) { - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_PASSCRED, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_PASSCRED)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_PASSCRED, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_PASSCRED)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; } #endif @@ -1529,12 +1529,12 @@ bool Socket::SetSoPasscred(bool x) #ifdef SO_PEERCRED bool Socket::SoPeercred(struct ucred& ucr) { - if (setsockopt(GetSocket(), SOL_SOCKET, SO_PEERCRED, (char *)&ucr, sizeof(ucr)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_PEERCRED)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_PEERCRED, (char *)&ucr, sizeof(ucr)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_PEERCRED)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; } #endif @@ -1542,12 +1542,12 @@ bool Socket::SoPeercred(struct ucred& ucr) #ifdef SO_PRIORITY bool Socket::SetSoPriority(int x) { - if (setsockopt(GetSocket(), SOL_SOCKET, SO_PRIORITY, (char *)&x, sizeof(x)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_PRIORITY)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_PRIORITY, (char *)&x, sizeof(x)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_PRIORITY)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; } #endif @@ -1555,15 +1555,15 @@ bool Socket::SetSoPriority(int x) bool Socket::SetSoRcvlowat(int x) { #ifdef SO_RCVLOWAT - if (setsockopt(GetSocket(), SOL_SOCKET, SO_RCVLOWAT, (char *)&x, sizeof(x)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_RCVLOWAT)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_RCVLOWAT, (char *)&x, sizeof(x)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_RCVLOWAT)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "socket option not available", 0, "SO_RCVLOWAT", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "socket option not available", 0, "SO_RCVLOWAT", LOG_LEVEL_INFO); + return false; #endif } @@ -1571,15 +1571,15 @@ bool Socket::SetSoRcvlowat(int x) bool Socket::SetSoSndlowat(int x) { #ifdef SO_SNDLOWAT - if (setsockopt(GetSocket(), SOL_SOCKET, SO_SNDLOWAT, (char *)&x, sizeof(x)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_SNDLOWAT)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_SNDLOWAT, (char *)&x, sizeof(x)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_SNDLOWAT)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "socket option not available", 0, "SO_SNDLOWAT", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "socket option not available", 0, "SO_SNDLOWAT", LOG_LEVEL_INFO); + return false; #endif } @@ -1587,15 +1587,15 @@ bool Socket::SetSoSndlowat(int x) bool Socket::SetSoRcvtimeo(struct timeval& tv) { #ifdef SO_RCVTIMEO - if (setsockopt(GetSocket(), SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_RCVTIMEO)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_RCVTIMEO)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "socket option not available", 0, "SO_RCVTIMEO", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "socket option not available", 0, "SO_RCVTIMEO", LOG_LEVEL_INFO); + return false; #endif } @@ -1603,15 +1603,15 @@ bool Socket::SetSoRcvtimeo(struct timeval& tv) bool Socket::SetSoSndtimeo(struct timeval& tv) { #ifdef SO_SNDTIMEO - if (setsockopt(GetSocket(), SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(tv)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_SNDTIMEO)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(tv)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_SNDTIMEO)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "socket option not available", 0, "SO_SNDTIMEO", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "socket option not available", 0, "SO_SNDTIMEO", LOG_LEVEL_INFO); + return false; #endif } @@ -1619,44 +1619,44 @@ bool Socket::SetSoSndtimeo(struct timeval& tv) bool Socket::SetSoRcvbuf(int x) { #ifdef SO_RCVBUF - if (setsockopt(GetSocket(), SOL_SOCKET, SO_RCVBUF, (char *)&x, sizeof(x)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_RCVBUF)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_RCVBUF, (char *)&x, sizeof(x)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_RCVBUF)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "socket option not available", 0, "SO_RCVBUF", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "socket option not available", 0, "SO_RCVBUF", LOG_LEVEL_INFO); + return false; #endif } int Socket::SoRcvbuf() { - int value = 0; + int value = 0; #ifdef SO_RCVBUF - socklen_t len = sizeof(value); - if (getsockopt(GetSocket(), SOL_SOCKET, SO_RCVBUF, (char *)&value, &len) == -1) - { - Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_RCVBUF)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } + socklen_t len = sizeof(value); + if (getsockopt(GetSocket(), SOL_SOCKET, SO_RCVBUF, (char *)&value, &len) == -1) + { + Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_RCVBUF)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + } #else - Handler().LogError(this, "socket option not available", 0, "SO_RCVBUF", LOG_LEVEL_INFO); + Handler().LogError(this, "socket option not available", 0, "SO_RCVBUF", LOG_LEVEL_INFO); #endif - return value; + return value; } #ifdef SO_RCVBUFFORCE bool Socket::SetSoRcvbufforce(int x) { - if (setsockopt(GetSocket(), SOL_SOCKET, SO_RCVBUFFORCE, (char *)&x, sizeof(x)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_RCVBUFFORCE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_RCVBUFFORCE, (char *)&x, sizeof(x)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_RCVBUFFORCE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; } #endif @@ -1664,44 +1664,44 @@ bool Socket::SetSoRcvbufforce(int x) bool Socket::SetSoSndbuf(int x) { #ifdef SO_SNDBUF - if (setsockopt(GetSocket(), SOL_SOCKET, SO_SNDBUF, (char *)&x, sizeof(x)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_SNDBUF)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_SNDBUF, (char *)&x, sizeof(x)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_SNDBUF)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "socket option not available", 0, "SO_SNDBUF", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "socket option not available", 0, "SO_SNDBUF", LOG_LEVEL_INFO); + return false; #endif } int Socket::SoSndbuf() { - int value = 0; + int value = 0; #ifdef SO_SNDBUF - socklen_t len = sizeof(value); - if (getsockopt(GetSocket(), SOL_SOCKET, SO_SNDBUF, (char *)&value, &len) == -1) - { - Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_SNDBUF)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } + socklen_t len = sizeof(value); + if (getsockopt(GetSocket(), SOL_SOCKET, SO_SNDBUF, (char *)&value, &len) == -1) + { + Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_SNDBUF)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + } #else - Handler().LogError(this, "socket option not available", 0, "SO_SNDBUF", LOG_LEVEL_INFO); + Handler().LogError(this, "socket option not available", 0, "SO_SNDBUF", LOG_LEVEL_INFO); #endif - return value; + return value; } #ifdef SO_SNDBUFFORCE bool Socket::SetSoSndbufforce(int x) { - if (setsockopt(GetSocket(), SOL_SOCKET, SO_SNDBUFFORCE, (char *)&x, sizeof(x)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_SNDBUFFORCE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_SNDBUFFORCE, (char *)&x, sizeof(x)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_SNDBUFFORCE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; } #endif @@ -1709,43 +1709,43 @@ bool Socket::SetSoSndbufforce(int x) #ifdef SO_TIMESTAMP bool Socket::SetSoTimestamp(bool x) { - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_SOCKET, SO_TIMESTAMP, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_TIMESTAMP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_TIMESTAMP, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_TIMESTAMP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; } #endif int Socket::SoType() { - int value = 0; + int value = 0; #ifdef SO_TYPE - socklen_t len = sizeof(value); - if (getsockopt(GetSocket(), SOL_SOCKET, SO_TYPE, (char *)&value, &len) == -1) - { - Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_TYPE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - } + socklen_t len = sizeof(value); + if (getsockopt(GetSocket(), SOL_SOCKET, SO_TYPE, (char *)&value, &len) == -1) + { + Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_TYPE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + } #else - Handler().LogError(this, "socket option not available", 0, "SO_TYPE", LOG_LEVEL_INFO); + Handler().LogError(this, "socket option not available", 0, "SO_TYPE", LOG_LEVEL_INFO); #endif - return value; + return value; } #ifdef ENABLE_TRIGGERS void Socket::Subscribe(int id) { - Handler().Subscribe(id, this); + Handler().Subscribe(id, this); } void Socket::Unsubscribe(int id) { - Handler().Unsubscribe(id, this); + Handler().Unsubscribe(id, this); } @@ -1762,14 +1762,14 @@ void Socket::OnCancelled(int) void Socket::SetTimeout(time_t secs) { - if (!secs) - { - Handler().AddList(m_socket, LIST_TIMEOUT, false); - return; - } - Handler().AddList(m_socket, LIST_TIMEOUT, true); - m_timeout_start = time(NULL); - m_timeout_limit = secs; + if (!secs) + { + Handler().AddList(m_socket, LIST_TIMEOUT, false); + return; + } + Handler().AddList(m_socket, LIST_TIMEOUT, true); + m_timeout_start = time(NULL); + m_timeout_limit = secs; } @@ -1785,9 +1785,9 @@ void Socket::OnConnectTimeout() bool Socket::Timeout(time_t tnow) { - if (tnow - m_timeout_start > m_timeout_limit) - return true; - return false; + if (tnow - m_timeout_start > m_timeout_limit) + return true; + return false; } @@ -1796,21 +1796,21 @@ port_t Socket::GetSockPort() { #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - struct sockaddr_in6 sa; - socklen_t sockaddr_length = sizeof(struct sockaddr_in6); - if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) - memset(&sa, 0, sizeof(sa)); - return ntohs(sa.sin6_port); - } + if (IsIpv6()) + { + struct sockaddr_in6 sa; + socklen_t sockaddr_length = sizeof(struct sockaddr_in6); + if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) + memset(&sa, 0, sizeof(sa)); + return ntohs(sa.sin6_port); + } #endif #endif - struct sockaddr_in sa; - socklen_t sockaddr_length = sizeof(struct sockaddr_in); - if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) - memset(&sa, 0, sizeof(sa)); - return ntohs(sa.sin_port); + struct sockaddr_in sa; + socklen_t sockaddr_length = sizeof(struct sockaddr_in); + if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) + memset(&sa, 0, sizeof(sa)); + return ntohs(sa.sin_port); } @@ -1819,19 +1819,19 @@ ipaddr_t Socket::GetSockIP4() { #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - return 0; - } + if (IsIpv6()) + { + return 0; + } #endif #endif - struct sockaddr_in sa; - socklen_t sockaddr_length = sizeof(struct sockaddr_in); - if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) - memset(&sa, 0, sizeof(sa)); - ipaddr_t a; - memcpy(&a, &sa.sin_addr, 4); - return a; + struct sockaddr_in sa; + socklen_t sockaddr_length = sizeof(struct sockaddr_in); + if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) + memset(&sa, 0, sizeof(sa)); + ipaddr_t a; + memcpy(&a, &sa.sin_addr, 4); + return a; } @@ -1840,18 +1840,18 @@ std::string Socket::GetSockAddress() { #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - return ""; - } + if (IsIpv6()) + { + return ""; + } #endif #endif - struct sockaddr_in sa; - socklen_t sockaddr_length = sizeof(struct sockaddr_in); - if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) - memset(&sa, 0, sizeof(sa)); - Ipv4Address addr( sa ); - return addr.Convert(); + struct sockaddr_in sa; + socklen_t sockaddr_length = sizeof(struct sockaddr_in); + if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) + memset(&sa, 0, sizeof(sa)); + Ipv4Address addr( sa ); + return addr.Convert(); } @@ -1860,33 +1860,33 @@ std::string Socket::GetSockAddress() /** Returns local ipv6 address for bound socket file descriptor. */ struct in6_addr Socket::GetSockIP6() { - if (IsIpv6()) - { - struct sockaddr_in6 sa; - socklen_t sockaddr_length = sizeof(struct sockaddr_in6); - if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) - memset(&sa, 0, sizeof(sa)); - return sa.sin6_addr; - } - struct in6_addr a; - memset(&a, 0, sizeof(a)); - return a; + if (IsIpv6()) + { + struct sockaddr_in6 sa; + socklen_t sockaddr_length = sizeof(struct sockaddr_in6); + if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) + memset(&sa, 0, sizeof(sa)); + return sa.sin6_addr; + } + struct in6_addr a; + memset(&a, 0, sizeof(a)); + return a; } /** Returns local ipv6 address as text for bound socket file descriptor. */ std::string Socket::GetSockAddress6() { - if (IsIpv6()) - { - struct sockaddr_in6 sa; - socklen_t sockaddr_length = sizeof(struct sockaddr_in6); - if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) - memset(&sa, 0, sizeof(sa)); - Ipv6Address addr( sa ); - return addr.Convert(); - } - return ""; + if (IsIpv6()) + { + struct sockaddr_in6 sa; + socklen_t sockaddr_length = sizeof(struct sockaddr_in6); + if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) + memset(&sa, 0, sizeof(sa)); + Ipv6Address addr( sa ); + return addr.Convert(); + } + return ""; } #endif #endif diff --git a/dep/src/sockets/SocketHandler.cpp b/dep/src/sockets/SocketHandler.cpp index 9ec5412af38..8a7307f4192 100644 --- a/dep/src/sockets/SocketHandler.cpp +++ b/dep/src/sockets/SocketHandler.cpp @@ -1,6 +1,6 @@ /** \file SocketHandler.cpp - ** \date 2004-02-13 - ** \author grymse@alhem.net + ** \date 2004-02-13 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -52,7 +52,7 @@ namespace SOCKETS_NAMESPACE { //#ifdef _DEBUG //#define DEB(x) x; fflush(stderr); //#else -#define DEB(x) +#define DEB(x) //#endif @@ -83,9 +83,9 @@ SocketHandler::SocketHandler(StdLog *p) ,m_slave(false) #endif { - FD_ZERO(&m_rfds); - FD_ZERO(&m_wfds); - FD_ZERO(&m_efds); + FD_ZERO(&m_rfds); + FD_ZERO(&m_wfds); + FD_ZERO(&m_efds); } @@ -116,878 +116,878 @@ SocketHandler::SocketHandler(Mutex& mutex,StdLog *p) ,m_slave(false) #endif { - m_mutex.Lock(); - FD_ZERO(&m_rfds); - FD_ZERO(&m_wfds); - FD_ZERO(&m_efds); + m_mutex.Lock(); + FD_ZERO(&m_rfds); + FD_ZERO(&m_wfds); + FD_ZERO(&m_efds); } SocketHandler::~SocketHandler() { #ifdef ENABLE_RESOLVER - if (m_resolver) - { - m_resolver -> Quit(); - } + if (m_resolver) + { + m_resolver -> Quit(); + } #endif - { - while (m_sockets.size()) - { -DEB( fprintf(stderr, "Emptying sockets list in SocketHandler destructor, %d instances\n", (int)m_sockets.size());) - socket_m::iterator it = m_sockets.begin(); - Socket *p = it -> second; - if (p) - { -DEB( fprintf(stderr, " fd %d\n", p -> GetSocket());) - p -> Close(); -DEB( fprintf(stderr, " fd closed %d\n", p -> GetSocket());) -// p -> OnDelete(); // hey, I turn this back on. what's the worst that could happen??!! - // MinionSocket breaks, calling MinderHandler methods in OnDelete - - // MinderHandler is already gone when that happens... + { + while (m_sockets.size()) + { +DEB( fprintf(stderr, "Emptying sockets list in SocketHandler destructor, %d instances\n", (int)m_sockets.size());) + socket_m::iterator it = m_sockets.begin(); + Socket *p = it -> second; + if (p) + { +DEB( fprintf(stderr, " fd %d\n", p -> GetSocket());) + p -> Close(); +DEB( fprintf(stderr, " fd closed %d\n", p -> GetSocket());) +// p -> OnDelete(); // hey, I turn this back on. what's the worst that could happen??!! + // MinionSocket breaks, calling MinderHandler methods in OnDelete - + // MinderHandler is already gone when that happens... - // only delete socket when controlled - // ie master sockethandler can delete non-detached sockets - // and a slave sockethandler can only delete a detach socket - if (p -> DeleteByHandler() + // only delete socket when controlled + // ie master sockethandler can delete non-detached sockets + // and a slave sockethandler can only delete a detach socket + if (p -> DeleteByHandler() #ifdef ENABLE_DETACH - && !(m_slave ^ p -> IsDetached()) + && !(m_slave ^ p -> IsDetached()) #endif - ) - { - p -> SetErasedByHandler(); - delete p; - } - m_sockets.erase(it); - } - else - { - m_sockets.erase(it); - } -DEB( fprintf(stderr, "next\n");) - } -DEB( fprintf(stderr, "/Emptying sockets list in SocketHandler destructor, %d instances\n", (int)m_sockets.size());) - } + ) + { + p -> SetErasedByHandler(); + delete p; + } + m_sockets.erase(it); + } + else + { + m_sockets.erase(it); + } +DEB( fprintf(stderr, "next\n");) + } +DEB( fprintf(stderr, "/Emptying sockets list in SocketHandler destructor, %d instances\n", (int)m_sockets.size());) + } #ifdef ENABLE_RESOLVER - if (m_resolver) - { - delete m_resolver; - } + if (m_resolver) + { + delete m_resolver; + } #endif - if (m_b_use_mutex) - { - m_mutex.Unlock(); - } + if (m_b_use_mutex) + { + m_mutex.Unlock(); + } } Mutex& SocketHandler::GetMutex() const { - return m_mutex; + return m_mutex; } #ifdef ENABLE_DETACH void SocketHandler::SetSlave(bool x) { - m_slave = x; + m_slave = x; } bool SocketHandler::IsSlave() { - return m_slave; + return m_slave; } #endif void SocketHandler::RegStdLog(StdLog *log) { - m_stdlog = log; + m_stdlog = log; } void SocketHandler::LogError(Socket *p,const std::string& user_text,int err,const std::string& sys_err,loglevel_t t) { - if (m_stdlog) - { - m_stdlog -> error(this, p, user_text, err, sys_err, t); - } + if (m_stdlog) + { + m_stdlog -> error(this, p, user_text, err, sys_err, t); + } } void SocketHandler::Add(Socket *p) { - if (p -> GetSocket() == INVALID_SOCKET) - { - LogError(p, "Add", -1, "Invalid socket", LOG_LEVEL_WARNING); - if (p -> CloseAndDelete()) - { - m_delete.push_back(p); - } - return; - } - if (m_add.find(p -> GetSocket()) != m_add.end()) - { - LogError(p, "Add", (int)p -> GetSocket(), "Attempt to add socket already in add queue", LOG_LEVEL_FATAL); - m_delete.push_back(p); - return; - } - m_add[p -> GetSocket()] = p; + if (p -> GetSocket() == INVALID_SOCKET) + { + LogError(p, "Add", -1, "Invalid socket", LOG_LEVEL_WARNING); + if (p -> CloseAndDelete()) + { + m_delete.push_back(p); + } + return; + } + if (m_add.find(p -> GetSocket()) != m_add.end()) + { + LogError(p, "Add", (int)p -> GetSocket(), "Attempt to add socket already in add queue", LOG_LEVEL_FATAL); + m_delete.push_back(p); + return; + } + m_add[p -> GetSocket()] = p; } void SocketHandler::Get(SOCKET s,bool& r,bool& w,bool& e) { - if (s >= 0) - { - r = FD_ISSET(s, &m_rfds) ? true : false; - w = FD_ISSET(s, &m_wfds) ? true : false; - e = FD_ISSET(s, &m_efds) ? true : false; - } + if (s >= 0) + { + r = FD_ISSET(s, &m_rfds) ? true : false; + w = FD_ISSET(s, &m_wfds) ? true : false; + e = FD_ISSET(s, &m_efds) ? true : false; + } } void SocketHandler::Set(SOCKET s,bool bRead,bool bWrite,bool bException) { -DEB( fprintf(stderr, "Set(%d, %s, %s, %s)\n", s, bRead ? "true" : "false", bWrite ? "true" : "false", bException ? "true" : "false");) - if (s >= 0) - { - if (bRead) - { - if (!FD_ISSET(s, &m_rfds)) - { - FD_SET(s, &m_rfds); - } - } - else - { - FD_CLR(s, &m_rfds); - } - if (bWrite) - { - if (!FD_ISSET(s, &m_wfds)) - { - FD_SET(s, &m_wfds); - } - } - else - { - FD_CLR(s, &m_wfds); - } - if (bException) - { - if (!FD_ISSET(s, &m_efds)) - { - FD_SET(s, &m_efds); - } - } - else - { - FD_CLR(s, &m_efds); - } - } +DEB( fprintf(stderr, "Set(%d, %s, %s, %s)\n", s, bRead ? "true" : "false", bWrite ? "true" : "false", bException ? "true" : "false");) + if (s >= 0) + { + if (bRead) + { + if (!FD_ISSET(s, &m_rfds)) + { + FD_SET(s, &m_rfds); + } + } + else + { + FD_CLR(s, &m_rfds); + } + if (bWrite) + { + if (!FD_ISSET(s, &m_wfds)) + { + FD_SET(s, &m_wfds); + } + } + else + { + FD_CLR(s, &m_wfds); + } + if (bException) + { + if (!FD_ISSET(s, &m_efds)) + { + FD_SET(s, &m_efds); + } + } + else + { + FD_CLR(s, &m_efds); + } + } } int SocketHandler::Select(long sec,long usec) { - struct timeval tv; - tv.tv_sec = sec; - tv.tv_usec = usec; - return Select(&tv); + struct timeval tv; + tv.tv_sec = sec; + tv.tv_usec = usec; + return Select(&tv); } int SocketHandler::Select() { - if (!m_fds_callonconnect.empty() || + if (!m_fds_callonconnect.empty() || #ifdef ENABLE_DETACH - (!m_slave && !m_fds_detach.empty()) || + (!m_slave && !m_fds_detach.empty()) || #endif - !m_fds_timeout.empty() || - !m_fds_retry.empty() || - !m_fds_close.empty() || - !m_fds_erase.empty()) - { - return Select(0, 200000); - } - return Select(NULL); + !m_fds_timeout.empty() || + !m_fds_retry.empty() || + !m_fds_close.empty() || + !m_fds_erase.empty()) + { + return Select(0, 200000); + } + return Select(NULL); } int SocketHandler::Select(struct timeval *tsel) { - size_t ignore = 0; - while (m_add.size() > ignore) - { - if (m_sockets.size() >= FD_SETSIZE) - { - LogError(NULL, "Select", (int)m_sockets.size(), "FD_SETSIZE reached", LOG_LEVEL_WARNING); - break; - } - socket_m::iterator it = m_add.begin(); - SOCKET s = it -> first; - Socket *p = it -> second; -DEB( fprintf(stderr, "Trying to add fd %d, m_add.size() %d, ignore %d\n", (int)s, (int)m_add.size(), (int)ignore);) - // - if (m_sockets.find(p -> GetSocket()) != m_sockets.end()) - { - LogError(p, "Add", (int)p -> GetSocket(), "Attempt to add socket already in controlled queue", LOG_LEVEL_FATAL); - // %! it's a dup, don't add to delete queue, just ignore it - m_delete.push_back(p); - m_add.erase(it); -// ignore++; - continue; - } - if (!p -> CloseAndDelete()) - { - StreamSocket *scp = dynamic_cast(p); - if (scp && scp -> Connecting()) // 'Open' called before adding socket - { - Set(s,false,true); - } - else - { - TcpSocket *tcp = dynamic_cast(p); - bool bWrite = tcp ? tcp -> GetOutputLength() != 0 : false; - if (p -> IsDisableRead()) - { - Set(s, false, bWrite); - } - else - { - Set(s, true, bWrite); - } - } - m_maxsock = (s > m_maxsock) ? s : m_maxsock; - } - else - { - LogError(p, "Add", (int)p -> GetSocket(), "Trying to add socket with SetCloseAndDelete() true", LOG_LEVEL_WARNING); - } - // only add to m_fds (process fd_set events) if - // slave handler and detached/detaching socket - // master handler and non-detached socket + size_t ignore = 0; + while (m_add.size() > ignore) + { + if (m_sockets.size() >= FD_SETSIZE) + { + LogError(NULL, "Select", (int)m_sockets.size(), "FD_SETSIZE reached", LOG_LEVEL_WARNING); + break; + } + socket_m::iterator it = m_add.begin(); + SOCKET s = it -> first; + Socket *p = it -> second; +DEB( fprintf(stderr, "Trying to add fd %d, m_add.size() %d, ignore %d\n", (int)s, (int)m_add.size(), (int)ignore);) + // + if (m_sockets.find(p -> GetSocket()) != m_sockets.end()) + { + LogError(p, "Add", (int)p -> GetSocket(), "Attempt to add socket already in controlled queue", LOG_LEVEL_FATAL); + // %! it's a dup, don't add to delete queue, just ignore it + m_delete.push_back(p); + m_add.erase(it); +// ignore++; + continue; + } + if (!p -> CloseAndDelete()) + { + StreamSocket *scp = dynamic_cast(p); + if (scp && scp -> Connecting()) // 'Open' called before adding socket + { + Set(s,false,true); + } + else + { + TcpSocket *tcp = dynamic_cast(p); + bool bWrite = tcp ? tcp -> GetOutputLength() != 0 : false; + if (p -> IsDisableRead()) + { + Set(s, false, bWrite); + } + else + { + Set(s, true, bWrite); + } + } + m_maxsock = (s > m_maxsock) ? s : m_maxsock; + } + else + { + LogError(p, "Add", (int)p -> GetSocket(), "Trying to add socket with SetCloseAndDelete() true", LOG_LEVEL_WARNING); + } + // only add to m_fds (process fd_set events) if + // slave handler and detached/detaching socket + // master handler and non-detached socket #ifdef ENABLE_DETACH - if (!(m_slave ^ p -> IsDetach())) + if (!(m_slave ^ p -> IsDetach())) #endif - { - m_fds.push_back(s); - } - m_sockets[s] = p; - // - m_add.erase(it); - } + { + m_fds.push_back(s); + } + m_sockets[s] = p; + // + m_add.erase(it); + } #ifdef MACOSX - fd_set rfds; - fd_set wfds; - fd_set efds; - FD_COPY(&m_rfds, &rfds); - FD_COPY(&m_wfds, &wfds); - FD_COPY(&m_efds, &efds); + fd_set rfds; + fd_set wfds; + fd_set efds; + FD_COPY(&m_rfds, &rfds); + FD_COPY(&m_wfds, &wfds); + FD_COPY(&m_efds, &efds); #else - fd_set rfds = m_rfds; - fd_set wfds = m_wfds; - fd_set efds = m_efds; + fd_set rfds = m_rfds; + fd_set wfds = m_wfds; + fd_set efds = m_efds; #endif - int n; - if (m_b_use_mutex) - { - m_mutex.Unlock(); - n = select( (int)(m_maxsock + 1),&rfds,&wfds,&efds,tsel); - m_mutex.Lock(); - } - else - { - n = select( (int)(m_maxsock + 1),&rfds,&wfds,&efds,tsel); - } - if (n == -1) - { - /* - EBADF An invalid file descriptor was given in one of the sets. - EINTR A non blocked signal was caught. - EINVAL n is negative. Or struct timeval contains bad time values (<0). - ENOMEM select was unable to allocate memory for internal tables. - */ - if (Errno != m_preverror || m_errcnt++ % 10000 == 0) - { - LogError(NULL, "select", Errno, StrError(Errno)); -DEB( fprintf(stderr, "m_maxsock: %d\n", m_maxsock); - fprintf(stderr, "%s\n", Errno == EINVAL ? "EINVAL" : - Errno == EINTR ? "EINTR" : - Errno == EBADF ? "EBADF" : - Errno == ENOMEM ? "ENOMEM" : ""); - // test bad fd - for (SOCKET i = 0; i <= m_maxsock; i++) - { - bool t = false; - FD_ZERO(&rfds); - FD_ZERO(&wfds); - FD_ZERO(&efds); - if (FD_ISSET(i, &m_rfds)) - { - FD_SET(i, &rfds); - t = true; - } - if (FD_ISSET(i, &m_wfds)) - { - FD_SET(i, &wfds); - t = true; - } - if (FD_ISSET(i, &m_efds)) - { - FD_SET(i, &efds); - t = true; - } - if (t && m_sockets.find(i) == m_sockets.end()) - { - fprintf(stderr, "Bad fd in fd_set: %d\n", i); - } - } + int n; + if (m_b_use_mutex) + { + m_mutex.Unlock(); + n = select( (int)(m_maxsock + 1),&rfds,&wfds,&efds,tsel); + m_mutex.Lock(); + } + else + { + n = select( (int)(m_maxsock + 1),&rfds,&wfds,&efds,tsel); + } + if (n == -1) + { + /* + EBADF An invalid file descriptor was given in one of the sets. + EINTR A non blocked signal was caught. + EINVAL n is negative. Or struct timeval contains bad time values (<0). + ENOMEM select was unable to allocate memory for internal tables. + */ + if (Errno != m_preverror || m_errcnt++ % 10000 == 0) + { + LogError(NULL, "select", Errno, StrError(Errno)); +DEB( fprintf(stderr, "m_maxsock: %d\n", m_maxsock); + fprintf(stderr, "%s\n", Errno == EINVAL ? "EINVAL" : + Errno == EINTR ? "EINTR" : + Errno == EBADF ? "EBADF" : + Errno == ENOMEM ? "ENOMEM" : ""); + // test bad fd + for (SOCKET i = 0; i <= m_maxsock; i++) + { + bool t = false; + FD_ZERO(&rfds); + FD_ZERO(&wfds); + FD_ZERO(&efds); + if (FD_ISSET(i, &m_rfds)) + { + FD_SET(i, &rfds); + t = true; + } + if (FD_ISSET(i, &m_wfds)) + { + FD_SET(i, &wfds); + t = true; + } + if (FD_ISSET(i, &m_efds)) + { + FD_SET(i, &efds); + t = true; + } + if (t && m_sockets.find(i) == m_sockets.end()) + { + fprintf(stderr, "Bad fd in fd_set: %d\n", i); + } + } ) // DEB - m_preverror = Errno; - } - /// \todo rebuild fd_set's from active sockets list (m_sockets) here - } - else - if (!n) - { - m_preverror = -1; - } - else - if (n > 0) - { - for (socket_v::iterator it2 = m_fds.begin(); it2 != m_fds.end() && n; it2++) - { - SOCKET i = *it2; - if (FD_ISSET(i, &rfds)) - { - socket_m::iterator itmp = m_sockets.find(i); - if (itmp != m_sockets.end()) // found - { - Socket *p = itmp -> second; - // new SSL negotiate method + m_preverror = Errno; + } + /// \todo rebuild fd_set's from active sockets list (m_sockets) here + } + else + if (!n) + { + m_preverror = -1; + } + else + if (n > 0) + { + for (socket_v::iterator it2 = m_fds.begin(); it2 != m_fds.end() && n; it2++) + { + SOCKET i = *it2; + if (FD_ISSET(i, &rfds)) + { + socket_m::iterator itmp = m_sockets.find(i); + if (itmp != m_sockets.end()) // found + { + Socket *p = itmp -> second; + // new SSL negotiate method #ifdef HAVE_OPENSSL - if (p -> IsSSLNegotiate()) - { - p -> SSLNegotiate(); - } - else + if (p -> IsSSLNegotiate()) + { + p -> SSLNegotiate(); + } + else #endif - { - p -> OnRead(); - } - } - else - { - LogError(NULL, "GetSocket/handler/1", (int)i, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); - } - n--; - } - if (FD_ISSET(i, &wfds)) - { - socket_m::iterator itmp = m_sockets.find(i); - if (itmp != m_sockets.end()) // found - { - Socket *p = itmp -> second; - // new SSL negotiate method + { + p -> OnRead(); + } + } + else + { + LogError(NULL, "GetSocket/handler/1", (int)i, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); + } + n--; + } + if (FD_ISSET(i, &wfds)) + { + socket_m::iterator itmp = m_sockets.find(i); + if (itmp != m_sockets.end()) // found + { + Socket *p = itmp -> second; + // new SSL negotiate method #ifdef HAVE_OPENSSL - if (p -> IsSSLNegotiate()) - { - p -> SSLNegotiate(); - } - else + if (p -> IsSSLNegotiate()) + { + p -> SSLNegotiate(); + } + else #endif - { - p -> OnWrite(); - } - } - else - { - LogError(NULL, "GetSocket/handler/2", (int)i, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); - } - n--; - } - if (FD_ISSET(i, &efds)) - { - socket_m::iterator itmp = m_sockets.find(i); - if (itmp != m_sockets.end()) // found - { - Socket *p = itmp -> second; - p -> OnException(); - } - else - { - LogError(NULL, "GetSocket/handler/3", (int)i, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); - } - n--; - } - } // m_fds loop - m_preverror = -1; - } // if (n > 0) + { + p -> OnWrite(); + } + } + else + { + LogError(NULL, "GetSocket/handler/2", (int)i, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); + } + n--; + } + if (FD_ISSET(i, &efds)) + { + socket_m::iterator itmp = m_sockets.find(i); + if (itmp != m_sockets.end()) // found + { + Socket *p = itmp -> second; + p -> OnException(); + } + else + { + LogError(NULL, "GetSocket/handler/3", (int)i, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); + } + n--; + } + } // m_fds loop + m_preverror = -1; + } // if (n > 0) - // check CallOnConnect - EVENT - if (!m_fds_callonconnect.empty()) - { - socket_v tmp = m_fds_callonconnect; - for (socket_v::iterator it = tmp.begin(); it != tmp.end(); it++) - { - Socket *p = NULL; - { - socket_m::iterator itmp = m_sockets.find(*it); - if (itmp != m_sockets.end()) // found - { - p = itmp -> second; - } - else - { - LogError(NULL, "GetSocket/handler/4", (int)*it, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); - } - } - if (p) - { -// if (p -> CallOnConnect() && p -> Ready() ) - { - p -> SetConnected(); // moved here from inside if (tcp) check below + // check CallOnConnect - EVENT + if (!m_fds_callonconnect.empty()) + { + socket_v tmp = m_fds_callonconnect; + for (socket_v::iterator it = tmp.begin(); it != tmp.end(); it++) + { + Socket *p = NULL; + { + socket_m::iterator itmp = m_sockets.find(*it); + if (itmp != m_sockets.end()) // found + { + p = itmp -> second; + } + else + { + LogError(NULL, "GetSocket/handler/4", (int)*it, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); + } + } + if (p) + { +// if (p -> CallOnConnect() && p -> Ready() ) + { + p -> SetConnected(); // moved here from inside if (tcp) check below #ifdef HAVE_OPENSSL - if (p -> IsSSL()) // SSL Enabled socket - p -> OnSSLConnect(); - else + if (p -> IsSSL()) // SSL Enabled socket + p -> OnSSLConnect(); + else #endif #ifdef ENABLE_SOCKS4 - if (p -> Socks4()) - p -> OnSocks4Connect(); - else + if (p -> Socks4()) + p -> OnSocks4Connect(); + else #endif - { - TcpSocket *tcp = dynamic_cast(p); - if (tcp) - { - if (tcp -> GetOutputLength()) - { - p -> OnWrite(); - } - } + { + TcpSocket *tcp = dynamic_cast(p); + if (tcp) + { + if (tcp -> GetOutputLength()) + { + p -> OnWrite(); + } + } #ifdef ENABLE_RECONNECT - if (tcp && tcp -> IsReconnect()) - p -> OnReconnect(); - else + if (tcp && tcp -> IsReconnect()) + p -> OnReconnect(); + else #endif - { -// LogError(p, "Calling OnConnect", 0, "Because CallOnConnect", LOG_LEVEL_INFO); - p -> OnConnect(); - } - } -// p -> SetCallOnConnect( false ); - AddList(p -> GetSocket(), LIST_CALLONCONNECT, false); - } - } - } - } + { +// LogError(p, "Calling OnConnect", 0, "Because CallOnConnect", LOG_LEVEL_INFO); + p -> OnConnect(); + } + } +// p -> SetCallOnConnect( false ); + AddList(p -> GetSocket(), LIST_CALLONCONNECT, false); + } + } + } + } #ifdef ENABLE_DETACH - // check detach of socket if master handler - EVENT - if (!m_slave && !m_fds_detach.empty()) - { - // %! why not using tmp list here??!? - for (socket_v::iterator it = m_fds_detach.begin(); it != m_fds_detach.end(); it++) - { - Socket *p = NULL; - { - socket_m::iterator itmp = m_sockets.find(*it); - if (itmp != m_sockets.end()) // found - { - p = itmp -> second; - } - else - { - LogError(NULL, "GetSocket/handler/5", (int)*it, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); - } - } - if (p) - { -// if (p -> IsDetach()) - { - Set(p -> GetSocket(), false, false, false); - // After DetachSocket(), all calls to Handler() will return a reference - // to the new slave SocketHandler running in the new thread. - p -> DetachSocket(); - // Adding the file descriptor to m_fds_erase will now also remove the - // socket from the detach queue - tnx knightmad - m_fds_erase.push_back(p -> GetSocket()); - } - } - } - } + // check detach of socket if master handler - EVENT + if (!m_slave && !m_fds_detach.empty()) + { + // %! why not using tmp list here??!? + for (socket_v::iterator it = m_fds_detach.begin(); it != m_fds_detach.end(); it++) + { + Socket *p = NULL; + { + socket_m::iterator itmp = m_sockets.find(*it); + if (itmp != m_sockets.end()) // found + { + p = itmp -> second; + } + else + { + LogError(NULL, "GetSocket/handler/5", (int)*it, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); + } + } + if (p) + { +// if (p -> IsDetach()) + { + Set(p -> GetSocket(), false, false, false); + // After DetachSocket(), all calls to Handler() will return a reference + // to the new slave SocketHandler running in the new thread. + p -> DetachSocket(); + // Adding the file descriptor to m_fds_erase will now also remove the + // socket from the detach queue - tnx knightmad + m_fds_erase.push_back(p -> GetSocket()); + } + } + } + } #endif - // check Connecting - connection timeout - conditional event - if (m_fds_timeout.size()) - { - time_t tnow = time(NULL); - if (tnow != m_tlast) - { - socket_v tmp = m_fds_timeout; -DEB( fprintf(stderr, "Checking %d socket(s) for timeout\n", tmp.size());) - for (socket_v::iterator it = tmp.begin(); it != tmp.end(); it++) - { - Socket *p = NULL; - { - socket_m::iterator itmp = m_sockets.find(*it); - if (itmp != m_sockets.end()) // found - { - p = itmp -> second; - } - else - { - itmp = m_add.find(*it); - if (itmp != m_add.end()) - { - p = itmp -> second; - } - else - { - LogError(NULL, "GetSocket/handler/6", (int)*it, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); - } - } - } - if (p) - { - if (p -> Timeout(tnow)) - { - StreamSocket *scp = dynamic_cast(p); - if (scp && scp -> Connecting()) - p -> OnConnectTimeout(); - else - p -> OnTimeout(); - p -> SetTimeout(0); - } - } - } - m_tlast = tnow; - } // tnow != tlast - } - // check retry client connect - EVENT - if (!m_fds_retry.empty()) - { - socket_v tmp = m_fds_retry; - for (socket_v::iterator it = tmp.begin(); it != tmp.end(); it++) - { - Socket *p = NULL; - { - socket_m::iterator itmp = m_sockets.find(*it); - if (itmp != m_sockets.end()) // found - { - p = itmp -> second; - } - else - { - LogError(NULL, "GetSocket/handler/7", (int)*it, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); - } - } - if (p) - { -// if (p -> RetryClientConnect()) - { - TcpSocket *tcp = dynamic_cast(p); - SOCKET nn = *it; //(*it3).first; - tcp -> SetRetryClientConnect(false); -DEB( fprintf(stderr, "Close() before retry client connect\n");) - p -> Close(); // removes from m_fds_retry - std::auto_ptr ad = p -> GetClientRemoteAddress(); - if (ad.get()) - { - tcp -> Open(*ad); - } - else - { - LogError(p, "RetryClientConnect", 0, "no address", LOG_LEVEL_ERROR); - } - Add(p); - m_fds_erase.push_back(nn); - } - } - } - } - // check close and delete - conditional event - if (!m_fds_close.empty()) - { - socket_v tmp = m_fds_close; -DEB( fprintf(stderr, "m_fds_close.size() == %d\n", (int)m_fds_close.size());) - for (socket_v::iterator it = tmp.begin(); it != tmp.end(); it++) - { - Socket *p = NULL; - { - socket_m::iterator itmp = m_sockets.find(*it); - if (itmp != m_sockets.end()) // found - { - p = itmp -> second; - } - else - { - itmp = m_add.find(*it); - if (itmp != m_add.end()) - { - p = itmp -> second; - } - else - { - LogError(NULL, "GetSocket/handler/8", (int)*it, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); - } - } - } - if (p) - { -// if (p -> CloseAndDelete() ) - { - TcpSocket *tcp = dynamic_cast(p); - // new graceful tcp - flush and close timeout 5s - if (tcp && p -> IsConnected() && tcp -> GetFlushBeforeClose() && + // check Connecting - connection timeout - conditional event + if (m_fds_timeout.size()) + { + time_t tnow = time(NULL); + if (tnow != m_tlast) + { + socket_v tmp = m_fds_timeout; +DEB( fprintf(stderr, "Checking %d socket(s) for timeout\n", tmp.size());) + for (socket_v::iterator it = tmp.begin(); it != tmp.end(); it++) + { + Socket *p = NULL; + { + socket_m::iterator itmp = m_sockets.find(*it); + if (itmp != m_sockets.end()) // found + { + p = itmp -> second; + } + else + { + itmp = m_add.find(*it); + if (itmp != m_add.end()) + { + p = itmp -> second; + } + else + { + LogError(NULL, "GetSocket/handler/6", (int)*it, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); + } + } + } + if (p) + { + if (p -> Timeout(tnow)) + { + StreamSocket *scp = dynamic_cast(p); + if (scp && scp -> Connecting()) + p -> OnConnectTimeout(); + else + p -> OnTimeout(); + p -> SetTimeout(0); + } + } + } + m_tlast = tnow; + } // tnow != tlast + } + // check retry client connect - EVENT + if (!m_fds_retry.empty()) + { + socket_v tmp = m_fds_retry; + for (socket_v::iterator it = tmp.begin(); it != tmp.end(); it++) + { + Socket *p = NULL; + { + socket_m::iterator itmp = m_sockets.find(*it); + if (itmp != m_sockets.end()) // found + { + p = itmp -> second; + } + else + { + LogError(NULL, "GetSocket/handler/7", (int)*it, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); + } + } + if (p) + { +// if (p -> RetryClientConnect()) + { + TcpSocket *tcp = dynamic_cast(p); + SOCKET nn = *it; //(*it3).first; + tcp -> SetRetryClientConnect(false); +DEB( fprintf(stderr, "Close() before retry client connect\n");) + p -> Close(); // removes from m_fds_retry + std::auto_ptr ad = p -> GetClientRemoteAddress(); + if (ad.get()) + { + tcp -> Open(*ad); + } + else + { + LogError(p, "RetryClientConnect", 0, "no address", LOG_LEVEL_ERROR); + } + Add(p); + m_fds_erase.push_back(nn); + } + } + } + } + // check close and delete - conditional event + if (!m_fds_close.empty()) + { + socket_v tmp = m_fds_close; +DEB( fprintf(stderr, "m_fds_close.size() == %d\n", (int)m_fds_close.size());) + for (socket_v::iterator it = tmp.begin(); it != tmp.end(); it++) + { + Socket *p = NULL; + { + socket_m::iterator itmp = m_sockets.find(*it); + if (itmp != m_sockets.end()) // found + { + p = itmp -> second; + } + else + { + itmp = m_add.find(*it); + if (itmp != m_add.end()) + { + p = itmp -> second; + } + else + { + LogError(NULL, "GetSocket/handler/8", (int)*it, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); + } + } + } + if (p) + { +// if (p -> CloseAndDelete() ) + { + TcpSocket *tcp = dynamic_cast(p); + // new graceful tcp - flush and close timeout 5s + if (tcp && p -> IsConnected() && tcp -> GetFlushBeforeClose() && #ifdef HAVE_OPENSSL - !tcp -> IsSSL() && + !tcp -> IsSSL() && #endif - p -> TimeSinceClose() < 5) - { -DEB( fprintf(stderr, " close(1)\n");) - if (tcp -> GetOutputLength()) - { - LogError(p, "Closing", (int)tcp -> GetOutputLength(), "Sending all data before closing", LOG_LEVEL_INFO); - } - else // shutdown write when output buffer is empty - if (!(tcp -> GetShutdown() & SHUT_WR)) - { - SOCKET nn = *it; - if (nn != INVALID_SOCKET && shutdown(nn, SHUT_WR) == -1) - { - LogError(p, "graceful shutdown", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } - tcp -> SetShutdown(SHUT_WR); - } - } - else + p -> TimeSinceClose() < 5) + { +DEB( fprintf(stderr, " close(1)\n");) + if (tcp -> GetOutputLength()) + { + LogError(p, "Closing", (int)tcp -> GetOutputLength(), "Sending all data before closing", LOG_LEVEL_INFO); + } + else // shutdown write when output buffer is empty + if (!(tcp -> GetShutdown() & SHUT_WR)) + { + SOCKET nn = *it; + if (nn != INVALID_SOCKET && shutdown(nn, SHUT_WR) == -1) + { + LogError(p, "graceful shutdown", Errno, StrError(Errno), LOG_LEVEL_ERROR); + } + tcp -> SetShutdown(SHUT_WR); + } + } + else #ifdef ENABLE_RECONNECT - if (tcp && p -> IsConnected() && tcp -> Reconnect()) - { - SOCKET nn = *it; //(*it3).first; -DEB( fprintf(stderr, " close(2) fd %d\n", nn);) - p -> SetCloseAndDelete(false); - tcp -> SetIsReconnect(); - p -> SetConnected(false); -DEB( fprintf(stderr, "Close() before reconnect\n");) - p -> Close(); // dispose of old file descriptor (Open creates a new) - p -> OnDisconnect(); - std::auto_ptr ad = p -> GetClientRemoteAddress(); - if (ad.get()) - { - tcp -> Open(*ad); - } - else - { - LogError(p, "Reconnect", 0, "no address", LOG_LEVEL_ERROR); - } - tcp -> ResetConnectionRetries(); - Add(p); - m_fds_erase.push_back(nn); - } - else + if (tcp && p -> IsConnected() && tcp -> Reconnect()) + { + SOCKET nn = *it; //(*it3).first; +DEB( fprintf(stderr, " close(2) fd %d\n", nn);) + p -> SetCloseAndDelete(false); + tcp -> SetIsReconnect(); + p -> SetConnected(false); +DEB( fprintf(stderr, "Close() before reconnect\n");) + p -> Close(); // dispose of old file descriptor (Open creates a new) + p -> OnDisconnect(); + std::auto_ptr ad = p -> GetClientRemoteAddress(); + if (ad.get()) + { + tcp -> Open(*ad); + } + else + { + LogError(p, "Reconnect", 0, "no address", LOG_LEVEL_ERROR); + } + tcp -> ResetConnectionRetries(); + Add(p); + m_fds_erase.push_back(nn); + } + else #endif - { - SOCKET nn = *it; //(*it3).first; -DEB( fprintf(stderr, " close(3) fd %d GetSocket() %d\n", nn, p -> GetSocket());) - if (tcp && p -> IsConnected() && tcp -> GetOutputLength()) - { - LogError(p, "Closing", (int)tcp -> GetOutputLength(), "Closing socket while data still left to send", LOG_LEVEL_WARNING); - } + { + SOCKET nn = *it; //(*it3).first; +DEB( fprintf(stderr, " close(3) fd %d GetSocket() %d\n", nn, p -> GetSocket());) + if (tcp && p -> IsConnected() && tcp -> GetOutputLength()) + { + LogError(p, "Closing", (int)tcp -> GetOutputLength(), "Closing socket while data still left to send", LOG_LEVEL_WARNING); + } #ifdef ENABLE_POOL - if (p -> Retain() && !p -> Lost()) - { - PoolSocket *p2 = new PoolSocket(*this, p); - p2 -> SetDeleteByHandler(); - Add(p2); - // - p -> SetCloseAndDelete(false); // added - remove from m_fds_close - } - else + if (p -> Retain() && !p -> Lost()) + { + PoolSocket *p2 = new PoolSocket(*this, p); + p2 -> SetDeleteByHandler(); + Add(p2); + // + p -> SetCloseAndDelete(false); // added - remove from m_fds_close + } + else #endif // ENABLE_POOL - { - Set(p -> GetSocket(),false,false,false); -DEB( fprintf(stderr, "Close() before OnDelete\n");) - p -> Close(); - } - p -> OnDelete(); - if (p -> DeleteByHandler()) - { - p -> SetErasedByHandler(); - } - m_fds_erase.push_back(nn); - } - } - } - } - } + { + Set(p -> GetSocket(),false,false,false); +DEB( fprintf(stderr, "Close() before OnDelete\n");) + p -> Close(); + } + p -> OnDelete(); + if (p -> DeleteByHandler()) + { + p -> SetErasedByHandler(); + } + m_fds_erase.push_back(nn); + } + } + } + } + } - // check erased sockets - bool check_max_fd = false; - while (!m_fds_erase.empty()) - { - socket_v::iterator it = m_fds_erase.begin(); - SOCKET nn = *it; + // check erased sockets + bool check_max_fd = false; + while (!m_fds_erase.empty()) + { + socket_v::iterator it = m_fds_erase.begin(); + SOCKET nn = *it; #ifdef ENABLE_DETACH - { - for (socket_v::iterator it = m_fds_detach.begin(); it != m_fds_detach.end(); it++) - { - if (*it == nn) - { - m_fds_detach.erase(it); - break; - } - } - } + { + for (socket_v::iterator it = m_fds_detach.begin(); it != m_fds_detach.end(); it++) + { + if (*it == nn) + { + m_fds_detach.erase(it); + break; + } + } + } #endif - { - for (socket_v::iterator it = m_fds.begin(); it != m_fds.end(); it++) - { - if (*it == nn) - { - m_fds.erase(it); - break; - } - } - } - { - socket_m::iterator it = m_sockets.find(nn); - if (it != m_sockets.end()) - { - Socket *p = it -> second; - /* Sometimes a SocketThread class can finish its run before the master - sockethandler gets here. In that case, the SocketThread has set the - 'ErasedByHandler' flag on the socket which will make us end up with a - double delete on the socket instance. - The fix is to make sure that the master sockethandler only can delete - non-detached sockets, and a slave sockethandler only can delete - detach sockets. */ - if (p -> ErasedByHandler() + { + for (socket_v::iterator it = m_fds.begin(); it != m_fds.end(); it++) + { + if (*it == nn) + { + m_fds.erase(it); + break; + } + } + } + { + socket_m::iterator it = m_sockets.find(nn); + if (it != m_sockets.end()) + { + Socket *p = it -> second; + /* Sometimes a SocketThread class can finish its run before the master + sockethandler gets here. In that case, the SocketThread has set the + 'ErasedByHandler' flag on the socket which will make us end up with a + double delete on the socket instance. + The fix is to make sure that the master sockethandler only can delete + non-detached sockets, and a slave sockethandler only can delete + detach sockets. */ + if (p -> ErasedByHandler() #ifdef ENABLE_DETACH - && !(m_slave ^ p -> IsDetached()) + && !(m_slave ^ p -> IsDetached()) #endif - ) - { + ) + { #ifdef ENABLE_TRIGGERS - bool again = false; - do - { - again = false; - for (std::map::iterator it = m_trigger_src.begin(); it != m_trigger_src.end(); it++) - { - int id = it -> first; - Socket *src = it -> second; - if (src == p) - { - for (std::map::iterator it = m_trigger_dst[id].begin(); it != m_trigger_dst[id].end(); it++) - { - Socket *dst = it -> first; - if (Valid(dst)) - { - dst -> OnCancelled(id); - } - } - m_trigger_src.erase(m_trigger_src.find(id)); - m_trigger_dst.erase(m_trigger_dst.find(id)); - again = true; - break; - } - } - } while (again); + bool again = false; + do + { + again = false; + for (std::map::iterator it = m_trigger_src.begin(); it != m_trigger_src.end(); it++) + { + int id = it -> first; + Socket *src = it -> second; + if (src == p) + { + for (std::map::iterator it = m_trigger_dst[id].begin(); it != m_trigger_dst[id].end(); it++) + { + Socket *dst = it -> first; + if (Valid(dst)) + { + dst -> OnCancelled(id); + } + } + m_trigger_src.erase(m_trigger_src.find(id)); + m_trigger_dst.erase(m_trigger_dst.find(id)); + again = true; + break; + } + } + } while (again); #endif - delete p; - } - m_sockets.erase(it); - } - } - m_fds_erase.erase(it); - check_max_fd = true; - } - // calculate max file descriptor for select() call - if (check_max_fd) - { - m_maxsock = 0; - for (socket_v::iterator it = m_fds.begin(); it != m_fds.end(); it++) - { - SOCKET s = *it; - m_maxsock = s > m_maxsock ? s : m_maxsock; - } - } - // remove Add's that fizzed - while (!m_delete.empty()) - { - std::list::iterator it = m_delete.begin(); - Socket *p = *it; - p -> OnDelete(); - m_delete.erase(it); - if (p -> DeleteByHandler() + delete p; + } + m_sockets.erase(it); + } + } + m_fds_erase.erase(it); + check_max_fd = true; + } + // calculate max file descriptor for select() call + if (check_max_fd) + { + m_maxsock = 0; + for (socket_v::iterator it = m_fds.begin(); it != m_fds.end(); it++) + { + SOCKET s = *it; + m_maxsock = s > m_maxsock ? s : m_maxsock; + } + } + // remove Add's that fizzed + while (!m_delete.empty()) + { + std::list::iterator it = m_delete.begin(); + Socket *p = *it; + p -> OnDelete(); + m_delete.erase(it); + if (p -> DeleteByHandler() #ifdef ENABLE_DETACH - && !(m_slave ^ p -> IsDetached()) + && !(m_slave ^ p -> IsDetached()) #endif - ) - { - p -> SetErasedByHandler(); + ) + { + p -> SetErasedByHandler(); #ifdef ENABLE_TRIGGERS - bool again = false; - do - { - again = false; - for (std::map::iterator it = m_trigger_src.begin(); it != m_trigger_src.end(); it++) - { - int id = it -> first; - Socket *src = it -> second; - if (src == p) - { - for (std::map::iterator it = m_trigger_dst[id].begin(); it != m_trigger_dst[id].end(); it++) - { - Socket *dst = it -> first; - if (Valid(dst)) - { - dst -> OnCancelled(id); - } - } - m_trigger_src.erase(m_trigger_src.find(id)); - m_trigger_dst.erase(m_trigger_dst.find(id)); - again = true; - break; - } - } - } while (again); + bool again = false; + do + { + again = false; + for (std::map::iterator it = m_trigger_src.begin(); it != m_trigger_src.end(); it++) + { + int id = it -> first; + Socket *src = it -> second; + if (src == p) + { + for (std::map::iterator it = m_trigger_dst[id].begin(); it != m_trigger_dst[id].end(); it++) + { + Socket *dst = it -> first; + if (Valid(dst)) + { + dst -> OnCancelled(id); + } + } + m_trigger_src.erase(m_trigger_src.find(id)); + m_trigger_dst.erase(m_trigger_dst.find(id)); + again = true; + break; + } + } + } while (again); #endif - delete p; - } - } - return n; + delete p; + } + } + return n; } #ifdef ENABLE_RESOLVER bool SocketHandler::Resolving(Socket *p0) { - std::map::iterator it = m_resolve_q.find(p0); - return it != m_resolve_q.end(); + std::map::iterator it = m_resolve_q.find(p0); + return it != m_resolve_q.end(); } #endif bool SocketHandler::Valid(Socket *p0) { - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++) - { - Socket *p = it -> second; - if (p0 == p) - return true; - } - return false; + for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++) + { + Socket *p = it -> second; + if (p0 == p) + return true; + } + return false; } bool SocketHandler::OkToAccept(Socket *) { - return true; + return true; } @@ -998,32 +998,32 @@ printf(" m_sockets : %d\n", m_sockets.size()); printf(" m_add : %d\n", m_add.size()); printf(" m_delete : %d\n", m_delete.size()); */ - return m_sockets.size() + m_add.size() + m_delete.size(); + return m_sockets.size() + m_add.size() + m_delete.size(); } #ifdef ENABLE_SOCKS4 void SocketHandler::SetSocks4Host(ipaddr_t a) { - m_socks4_host = a; + m_socks4_host = a; } void SocketHandler::SetSocks4Host(const std::string& host) { - Utility::u2ip(host, m_socks4_host); + Utility::u2ip(host, m_socks4_host); } void SocketHandler::SetSocks4Port(port_t port) { - m_socks4_port = port; + m_socks4_port = port; } void SocketHandler::SetSocks4Userid(const std::string& id) { - m_socks4_userid = id; + m_socks4_userid = id; } #endif @@ -1031,94 +1031,94 @@ void SocketHandler::SetSocks4Userid(const std::string& id) #ifdef ENABLE_RESOLVER int SocketHandler::Resolve(Socket *p,const std::string& host,port_t port) { - // check cache - ResolvSocket *resolv = new ResolvSocket(*this, p, host, port); - resolv -> SetId(++m_resolv_id); - resolv -> SetDeleteByHandler(); - ipaddr_t local; - Utility::u2ip("127.0.0.1", local); - if (!resolv -> Open(local, m_resolver_port)) - { - LogError(resolv, "Resolve", -1, "Can't connect to local resolve server", LOG_LEVEL_FATAL); - } - Add(resolv); - m_resolve_q[p] = true; -DEB( fprintf(stderr, " *** Resolve '%s:%d' id#%d m_resolve_q size: %d p: %p\n", host.c_str(), port, resolv -> GetId(), m_resolve_q.size(), p);) - return resolv -> GetId(); + // check cache + ResolvSocket *resolv = new ResolvSocket(*this, p, host, port); + resolv -> SetId(++m_resolv_id); + resolv -> SetDeleteByHandler(); + ipaddr_t local; + Utility::u2ip("127.0.0.1", local); + if (!resolv -> Open(local, m_resolver_port)) + { + LogError(resolv, "Resolve", -1, "Can't connect to local resolve server", LOG_LEVEL_FATAL); + } + Add(resolv); + m_resolve_q[p] = true; +DEB( fprintf(stderr, " *** Resolve '%s:%d' id#%d m_resolve_q size: %d p: %p\n", host.c_str(), port, resolv -> GetId(), m_resolve_q.size(), p);) + return resolv -> GetId(); } #ifdef ENABLE_IPV6 int SocketHandler::Resolve6(Socket *p,const std::string& host,port_t port) { - // check cache - ResolvSocket *resolv = new ResolvSocket(*this, p, host, port, true); - resolv -> SetId(++m_resolv_id); - resolv -> SetDeleteByHandler(); - ipaddr_t local; - Utility::u2ip("127.0.0.1", local); - if (!resolv -> Open(local, m_resolver_port)) - { - LogError(resolv, "Resolve", -1, "Can't connect to local resolve server", LOG_LEVEL_FATAL); - } - Add(resolv); - m_resolve_q[p] = true; - return resolv -> GetId(); + // check cache + ResolvSocket *resolv = new ResolvSocket(*this, p, host, port, true); + resolv -> SetId(++m_resolv_id); + resolv -> SetDeleteByHandler(); + ipaddr_t local; + Utility::u2ip("127.0.0.1", local); + if (!resolv -> Open(local, m_resolver_port)) + { + LogError(resolv, "Resolve", -1, "Can't connect to local resolve server", LOG_LEVEL_FATAL); + } + Add(resolv); + m_resolve_q[p] = true; + return resolv -> GetId(); } #endif int SocketHandler::Resolve(Socket *p,ipaddr_t a) { - // check cache - ResolvSocket *resolv = new ResolvSocket(*this, p, a); - resolv -> SetId(++m_resolv_id); - resolv -> SetDeleteByHandler(); - ipaddr_t local; - Utility::u2ip("127.0.0.1", local); - if (!resolv -> Open(local, m_resolver_port)) - { - LogError(resolv, "Resolve", -1, "Can't connect to local resolve server", LOG_LEVEL_FATAL); - } - Add(resolv); - m_resolve_q[p] = true; - return resolv -> GetId(); + // check cache + ResolvSocket *resolv = new ResolvSocket(*this, p, a); + resolv -> SetId(++m_resolv_id); + resolv -> SetDeleteByHandler(); + ipaddr_t local; + Utility::u2ip("127.0.0.1", local); + if (!resolv -> Open(local, m_resolver_port)) + { + LogError(resolv, "Resolve", -1, "Can't connect to local resolve server", LOG_LEVEL_FATAL); + } + Add(resolv); + m_resolve_q[p] = true; + return resolv -> GetId(); } #ifdef ENABLE_IPV6 int SocketHandler::Resolve(Socket *p,in6_addr& a) { - // check cache - ResolvSocket *resolv = new ResolvSocket(*this, p, a); - resolv -> SetId(++m_resolv_id); - resolv -> SetDeleteByHandler(); - ipaddr_t local; - Utility::u2ip("127.0.0.1", local); - if (!resolv -> Open(local, m_resolver_port)) - { - LogError(resolv, "Resolve", -1, "Can't connect to local resolve server", LOG_LEVEL_FATAL); - } - Add(resolv); - m_resolve_q[p] = true; - return resolv -> GetId(); + // check cache + ResolvSocket *resolv = new ResolvSocket(*this, p, a); + resolv -> SetId(++m_resolv_id); + resolv -> SetDeleteByHandler(); + ipaddr_t local; + Utility::u2ip("127.0.0.1", local); + if (!resolv -> Open(local, m_resolver_port)) + { + LogError(resolv, "Resolve", -1, "Can't connect to local resolve server", LOG_LEVEL_FATAL); + } + Add(resolv); + m_resolve_q[p] = true; + return resolv -> GetId(); } #endif void SocketHandler::EnableResolver(port_t port) { - if (!m_resolver) - { - m_resolver_port = port; - m_resolver = new ResolvServer(port); - } + if (!m_resolver) + { + m_resolver_port = port; + m_resolver = new ResolvServer(port); + } } bool SocketHandler::ResolverReady() { - return m_resolver ? m_resolver -> Ready() : false; + return m_resolver ? m_resolver -> Ready() : false; } #endif // ENABLE_RESOLVER @@ -1126,45 +1126,45 @@ bool SocketHandler::ResolverReady() #ifdef ENABLE_SOCKS4 void SocketHandler::SetSocks4TryDirect(bool x) { - m_bTryDirect = x; + m_bTryDirect = x; } ipaddr_t SocketHandler::GetSocks4Host() { - return m_socks4_host; + return m_socks4_host; } port_t SocketHandler::GetSocks4Port() { - return m_socks4_port; + return m_socks4_port; } const std::string& SocketHandler::GetSocks4Userid() { - return m_socks4_userid; + return m_socks4_userid; } bool SocketHandler::Socks4TryDirect() { - return m_bTryDirect; + return m_bTryDirect; } #endif #ifdef ENABLE_RESOLVER -bool SocketHandler::ResolverEnabled() -{ - return m_resolver ? true : false; +bool SocketHandler::ResolverEnabled() +{ + return m_resolver ? true : false; } -port_t SocketHandler::GetResolverPort() -{ - return m_resolver_port; +port_t SocketHandler::GetResolverPort() +{ + return m_resolver_port; } #endif // ENABLE_RESOLVER @@ -1172,35 +1172,35 @@ port_t SocketHandler::GetResolverPort() #ifdef ENABLE_POOL ISocketHandler::PoolSocket *SocketHandler::FindConnection(int type,const std::string& protocol,SocketAddress& ad) { - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end() && !m_sockets.empty(); it++) - { - PoolSocket *pools = dynamic_cast(it -> second); - if (pools) - { - if (pools -> GetSocketType() == type && - pools -> GetSocketProtocol() == protocol && -// %! pools -> GetClientRemoteAddress() && - *pools -> GetClientRemoteAddress() == ad) - { - m_sockets.erase(it); - pools -> SetRetain(); // avoid Close in Socket destructor - return pools; // Caller is responsible that this socket is deleted - } - } - } - return NULL; + for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end() && !m_sockets.empty(); it++) + { + PoolSocket *pools = dynamic_cast(it -> second); + if (pools) + { + if (pools -> GetSocketType() == type && + pools -> GetSocketProtocol() == protocol && +// %! pools -> GetClientRemoteAddress() && + *pools -> GetClientRemoteAddress() == ad) + { + m_sockets.erase(it); + pools -> SetRetain(); // avoid Close in Socket destructor + return pools; // Caller is responsible that this socket is deleted + } + } + } + return NULL; } void SocketHandler::EnablePool(bool x) { - m_b_enable_pool = x; + m_b_enable_pool = x; } -bool SocketHandler::PoolEnabled() -{ - return m_b_enable_pool; +bool SocketHandler::PoolEnabled() +{ + return m_b_enable_pool; } #endif @@ -1208,210 +1208,210 @@ bool SocketHandler::PoolEnabled() void SocketHandler::Remove(Socket *p) { #ifdef ENABLE_RESOLVER - std::map::iterator it4 = m_resolve_q.find(p); - if (it4 != m_resolve_q.end()) - m_resolve_q.erase(it4); + std::map::iterator it4 = m_resolve_q.find(p); + if (it4 != m_resolve_q.end()) + m_resolve_q.erase(it4); #endif - if (p -> ErasedByHandler()) - { - return; - } - for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++) - { - if (it -> second == p) - { - LogError(p, "Remove", -1, "Socket destructor called while still in use", LOG_LEVEL_WARNING); - m_sockets.erase(it); - return; - } - } - for (socket_m::iterator it2 = m_add.begin(); it2 != m_add.end(); it2++) - { - if ((*it2).second == p) - { - LogError(p, "Remove", -2, "Socket destructor called while still in use", LOG_LEVEL_WARNING); - m_add.erase(it2); - return; - } - } - for (std::list::iterator it3 = m_delete.begin(); it3 != m_delete.end(); it3++) - { - if (*it3 == p) - { - LogError(p, "Remove", -3, "Socket destructor called while still in use", LOG_LEVEL_WARNING); - m_delete.erase(it3); - return; - } - } + if (p -> ErasedByHandler()) + { + return; + } + for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++) + { + if (it -> second == p) + { + LogError(p, "Remove", -1, "Socket destructor called while still in use", LOG_LEVEL_WARNING); + m_sockets.erase(it); + return; + } + } + for (socket_m::iterator it2 = m_add.begin(); it2 != m_add.end(); it2++) + { + if ((*it2).second == p) + { + LogError(p, "Remove", -2, "Socket destructor called while still in use", LOG_LEVEL_WARNING); + m_add.erase(it2); + return; + } + } + for (std::list::iterator it3 = m_delete.begin(); it3 != m_delete.end(); it3++) + { + if (*it3 == p) + { + LogError(p, "Remove", -3, "Socket destructor called while still in use", LOG_LEVEL_WARNING); + m_delete.erase(it3); + return; + } + } } void SocketHandler::CheckSanity() { - CheckList(m_fds, "active sockets"); // active sockets - CheckList(m_fds_erase, "sockets to be erased"); // should always be empty anyway - CheckList(m_fds_callonconnect, "checklist CallOnConnect"); + CheckList(m_fds, "active sockets"); // active sockets + CheckList(m_fds_erase, "sockets to be erased"); // should always be empty anyway + CheckList(m_fds_callonconnect, "checklist CallOnConnect"); #ifdef ENABLE_DETACH - CheckList(m_fds_detach, "checklist Detach"); + CheckList(m_fds_detach, "checklist Detach"); #endif - CheckList(m_fds_timeout, "checklist Timeout"); - CheckList(m_fds_retry, "checklist retry client connect"); - CheckList(m_fds_close, "checklist close and delete"); + CheckList(m_fds_timeout, "checklist Timeout"); + CheckList(m_fds_retry, "checklist retry client connect"); + CheckList(m_fds_close, "checklist close and delete"); } void SocketHandler::CheckList(socket_v& ref,const std::string& listname) { - for (socket_v::iterator it = ref.begin(); it != ref.end(); it++) - { - SOCKET s = *it; - if (m_sockets.find(s) != m_sockets.end()) - continue; - if (m_add.find(s) != m_add.end()) - continue; - bool found = false; - for (std::list::iterator it = m_delete.begin(); it != m_delete.end(); it++) - { - Socket *p = *it; - if (p -> GetSocket() == s) - { - found = true; - break; - } - } - if (!found) - { - fprintf(stderr, "CheckList failed for \"%s\": fd %d\n", listname.c_str(), s); - } - } + for (socket_v::iterator it = ref.begin(); it != ref.end(); it++) + { + SOCKET s = *it; + if (m_sockets.find(s) != m_sockets.end()) + continue; + if (m_add.find(s) != m_add.end()) + continue; + bool found = false; + for (std::list::iterator it = m_delete.begin(); it != m_delete.end(); it++) + { + Socket *p = *it; + if (p -> GetSocket() == s) + { + found = true; + break; + } + } + if (!found) + { + fprintf(stderr, "CheckList failed for \"%s\": fd %d\n", listname.c_str(), s); + } + } } void SocketHandler::AddList(SOCKET s,list_t which_one,bool add) { - if (s == INVALID_SOCKET) - { -DEB( fprintf(stderr, "AddList: invalid_socket\n");) - return; - } - socket_v& ref = - (which_one == LIST_CALLONCONNECT) ? m_fds_callonconnect : + if (s == INVALID_SOCKET) + { +DEB( fprintf(stderr, "AddList: invalid_socket\n");) + return; + } + socket_v& ref = + (which_one == LIST_CALLONCONNECT) ? m_fds_callonconnect : #ifdef ENABLE_DETACH - (which_one == LIST_DETACH) ? m_fds_detach : + (which_one == LIST_DETACH) ? m_fds_detach : #endif - (which_one == LIST_TIMEOUT) ? m_fds_timeout : - (which_one == LIST_RETRY) ? m_fds_retry : - (which_one == LIST_CLOSE) ? m_fds_close : m_fds_close; - if (add) - { + (which_one == LIST_TIMEOUT) ? m_fds_timeout : + (which_one == LIST_RETRY) ? m_fds_retry : + (which_one == LIST_CLOSE) ? m_fds_close : m_fds_close; + if (add) + { #ifdef ENABLE_DETACH -DEB( fprintf(stderr, "AddList; %5d: %s: %s\n", s, (which_one == LIST_CALLONCONNECT) ? "CallOnConnect" : - (which_one == LIST_DETACH) ? "Detach" : - (which_one == LIST_TIMEOUT) ? "Timeout" : - (which_one == LIST_RETRY) ? "Retry" : - (which_one == LIST_CLOSE) ? "Close" : "", - add ? "Add" : "Remove");) +DEB( fprintf(stderr, "AddList; %5d: %s: %s\n", s, (which_one == LIST_CALLONCONNECT) ? "CallOnConnect" : + (which_one == LIST_DETACH) ? "Detach" : + (which_one == LIST_TIMEOUT) ? "Timeout" : + (which_one == LIST_RETRY) ? "Retry" : + (which_one == LIST_CLOSE) ? "Close" : "", + add ? "Add" : "Remove");) #else -DEB( fprintf(stderr, "AddList; %5d: %s: %s\n", s, (which_one == LIST_CALLONCONNECT) ? "CallOnConnect" : - (which_one == LIST_TIMEOUT) ? "Timeout" : - (which_one == LIST_RETRY) ? "Retry" : - (which_one == LIST_CLOSE) ? "Close" : "", - add ? "Add" : "Remove");) +DEB( fprintf(stderr, "AddList; %5d: %s: %s\n", s, (which_one == LIST_CALLONCONNECT) ? "CallOnConnect" : + (which_one == LIST_TIMEOUT) ? "Timeout" : + (which_one == LIST_RETRY) ? "Retry" : + (which_one == LIST_CLOSE) ? "Close" : "", + add ? "Add" : "Remove");) #endif - } - if (add) - { - for (socket_v::iterator it = ref.begin(); it != ref.end(); it++) - { - if (*it == s) // already there - { - return; - } - } - ref.push_back(s); - return; - } - // remove - for (socket_v::iterator it = ref.begin(); it != ref.end(); it++) - { - if (*it == s) - { - ref.erase(it); - break; - } - } -//DEB( fprintf(stderr, "/AddList\n");) + } + if (add) + { + for (socket_v::iterator it = ref.begin(); it != ref.end(); it++) + { + if (*it == s) // already there + { + return; + } + } + ref.push_back(s); + return; + } + // remove + for (socket_v::iterator it = ref.begin(); it != ref.end(); it++) + { + if (*it == s) + { + ref.erase(it); + break; + } + } +//DEB( fprintf(stderr, "/AddList\n");) } #ifdef ENABLE_TRIGGERS int SocketHandler::TriggerID(Socket *src) { - int id = m_next_trigger_id++; - m_trigger_src[id] = src; - return id; + int id = m_next_trigger_id++; + m_trigger_src[id] = src; + return id; } bool SocketHandler::Subscribe(int id, Socket *dst) { - if (m_trigger_src.find(id) != m_trigger_src.end()) - { - std::map::iterator it = m_trigger_dst[id].find(dst); - if (it != m_trigger_dst[id].end()) - { - m_trigger_dst[id][dst] = true; - return true; - } - LogError(dst, "Subscribe", id, "Already subscribed", LOG_LEVEL_INFO); - return false; - } - LogError(dst, "Subscribe", id, "Trigger id not found", LOG_LEVEL_INFO); - return false; + if (m_trigger_src.find(id) != m_trigger_src.end()) + { + std::map::iterator it = m_trigger_dst[id].find(dst); + if (it != m_trigger_dst[id].end()) + { + m_trigger_dst[id][dst] = true; + return true; + } + LogError(dst, "Subscribe", id, "Already subscribed", LOG_LEVEL_INFO); + return false; + } + LogError(dst, "Subscribe", id, "Trigger id not found", LOG_LEVEL_INFO); + return false; } bool SocketHandler::Unsubscribe(int id, Socket *dst) { - if (m_trigger_src.find(id) != m_trigger_src.end()) - { - std::map::iterator it = m_trigger_dst[id].find(dst); - if (it != m_trigger_dst[id].end()) - { - m_trigger_dst[id].erase(it); - return true; - } - LogError(dst, "Unsubscribe", id, "Not subscribed", LOG_LEVEL_INFO); - return false; - } - LogError(dst, "Unsubscribe", id, "Trigger id not found", LOG_LEVEL_INFO); - return false; + if (m_trigger_src.find(id) != m_trigger_src.end()) + { + std::map::iterator it = m_trigger_dst[id].find(dst); + if (it != m_trigger_dst[id].end()) + { + m_trigger_dst[id].erase(it); + return true; + } + LogError(dst, "Unsubscribe", id, "Not subscribed", LOG_LEVEL_INFO); + return false; + } + LogError(dst, "Unsubscribe", id, "Trigger id not found", LOG_LEVEL_INFO); + return false; } void SocketHandler::Trigger(int id, Socket::TriggerData& data, bool erase) { - if (m_trigger_src.find(id) != m_trigger_src.end()) - { - data.SetSource( m_trigger_src[id] ); - for (std::map::iterator it = m_trigger_dst[id].begin(); it != m_trigger_dst[id].end(); it++) - { - Socket *dst = it -> first; - if (Valid(dst)) - { - dst -> OnTrigger(id, data); - } - } - if (erase) - { - m_trigger_src.erase(m_trigger_src.find(id)); - m_trigger_dst.erase(m_trigger_dst.find(id)); - } - } - else - { - LogError(NULL, "Trigger", id, "Trigger id not found", LOG_LEVEL_INFO); - } + if (m_trigger_src.find(id) != m_trigger_src.end()) + { + data.SetSource( m_trigger_src[id] ); + for (std::map::iterator it = m_trigger_dst[id].begin(); it != m_trigger_dst[id].end(); it++) + { + Socket *dst = it -> first; + if (Valid(dst)) + { + dst -> OnTrigger(id, data); + } + } + if (erase) + { + m_trigger_src.erase(m_trigger_src.find(id)); + m_trigger_dst.erase(m_trigger_dst.find(id)); + } + } + else + { + LogError(NULL, "Trigger", id, "Trigger id not found", LOG_LEVEL_INFO); + } } #endif // ENABLE_TRIGGERS diff --git a/dep/src/sockets/StdoutLog.cpp b/dep/src/sockets/StdoutLog.cpp index c01d8b8c215..93ae535e6d3 100644 --- a/dep/src/sockets/StdoutLog.cpp +++ b/dep/src/sockets/StdoutLog.cpp @@ -1,6 +1,6 @@ /** \file StdoutLog.cpp - ** \date 2004-06-01 - ** \author grymse@alhem.net + ** \date 2004-06-01 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -43,49 +43,49 @@ namespace SOCKETS_NAMESPACE { void StdoutLog::error(ISocketHandler *,Socket *sock,const std::string& call,int err,const std::string& sys_err,loglevel_t lvl) { - time_t t = time(NULL); - struct tm tp; + time_t t = time(NULL); + struct tm tp; #ifdef _WIN32 - memcpy(&tp, localtime(&t), sizeof(tp)); + memcpy(&tp, localtime(&t), sizeof(tp)); #else - localtime_r(&t, &tp); + localtime_r(&t, &tp); #endif - std::string level; - - switch (lvl) - { - case LOG_LEVEL_WARNING: - level = "Warning"; - break; - case LOG_LEVEL_ERROR: - level = "Error"; - break; - case LOG_LEVEL_FATAL: - level = "Fatal"; - break; - case LOG_LEVEL_INFO: - level = "Info"; - break; - } - if (sock) - { - printf("%d-%02d-%02d %02d:%02d:%02d :: fd %d :: %s: %d %s (%s)\n", - tp.tm_year + 1900, - tp.tm_mon + 1, - tp.tm_mday, - tp.tm_hour,tp.tm_min,tp.tm_sec, - sock -> GetSocket(), - call.c_str(),err,sys_err.c_str(),level.c_str()); - } - else - { - printf("%d-%02d-%02d %02d:%02d:%02d :: %s: %d %s (%s)\n", - tp.tm_year + 1900, - tp.tm_mon + 1, - tp.tm_mday, - tp.tm_hour,tp.tm_min,tp.tm_sec, - call.c_str(),err,sys_err.c_str(),level.c_str()); - } + std::string level; + + switch (lvl) + { + case LOG_LEVEL_WARNING: + level = "Warning"; + break; + case LOG_LEVEL_ERROR: + level = "Error"; + break; + case LOG_LEVEL_FATAL: + level = "Fatal"; + break; + case LOG_LEVEL_INFO: + level = "Info"; + break; + } + if (sock) + { + printf("%d-%02d-%02d %02d:%02d:%02d :: fd %d :: %s: %d %s (%s)\n", + tp.tm_year + 1900, + tp.tm_mon + 1, + tp.tm_mday, + tp.tm_hour,tp.tm_min,tp.tm_sec, + sock -> GetSocket(), + call.c_str(),err,sys_err.c_str(),level.c_str()); + } + else + { + printf("%d-%02d-%02d %02d:%02d:%02d :: %s: %d %s (%s)\n", + tp.tm_year + 1900, + tp.tm_mon + 1, + tp.tm_mday, + tp.tm_hour,tp.tm_min,tp.tm_sec, + call.c_str(),err,sys_err.c_str(),level.c_str()); + } } diff --git a/dep/src/sockets/StreamSocket.cpp b/dep/src/sockets/StreamSocket.cpp index 5c5780e3085..4412d498536 100644 --- a/dep/src/sockets/StreamSocket.cpp +++ b/dep/src/sockets/StreamSocket.cpp @@ -28,136 +28,136 @@ StreamSocket::~StreamSocket() void StreamSocket::SetConnecting(bool x) { - if (x != m_bConnecting) - { - m_bConnecting = x; - if (x) - { - SetTimeout( GetConnectTimeout() ); - } - else - { - SetTimeout( 0 ); - } - } + if (x != m_bConnecting) + { + m_bConnecting = x; + if (x) + { + SetTimeout( GetConnectTimeout() ); + } + else + { + SetTimeout( 0 ); + } + } } bool StreamSocket::Connecting() { - return m_bConnecting; + return m_bConnecting; } bool StreamSocket::Ready() { - if (GetSocket() != INVALID_SOCKET && !Connecting() && !CloseAndDelete()) - return true; - return false; + if (GetSocket() != INVALID_SOCKET && !Connecting() && !CloseAndDelete()) + return true; + return false; } void StreamSocket::SetConnectTimeout(int x) { - m_connect_timeout = x; + m_connect_timeout = x; } int StreamSocket::GetConnectTimeout() { - return m_connect_timeout; + return m_connect_timeout; } void StreamSocket::SetFlushBeforeClose(bool x) { - m_flush_before_close = x; + m_flush_before_close = x; } bool StreamSocket::GetFlushBeforeClose() { - return m_flush_before_close; + return m_flush_before_close; } int StreamSocket::GetConnectionRetry() { - return m_connection_retry; + return m_connection_retry; } void StreamSocket::SetConnectionRetry(int x) { - m_connection_retry = x; + m_connection_retry = x; } int StreamSocket::GetConnectionRetries() { - return m_retries; + return m_retries; } void StreamSocket::IncreaseConnectionRetries() { - m_retries++; + m_retries++; } void StreamSocket::ResetConnectionRetries() { - m_retries = 0; + m_retries = 0; } void StreamSocket::SetCallOnConnect(bool x) { - Handler().AddList(GetSocket(), LIST_CALLONCONNECT, x); - m_call_on_connect = x; + Handler().AddList(GetSocket(), LIST_CALLONCONNECT, x); + m_call_on_connect = x; } bool StreamSocket::CallOnConnect() { - return m_call_on_connect; + return m_call_on_connect; } void StreamSocket::SetRetryClientConnect(bool x) { - Handler().AddList(GetSocket(), LIST_RETRY, x); - m_b_retry_connect = x; + Handler().AddList(GetSocket(), LIST_RETRY, x); + m_b_retry_connect = x; } bool StreamSocket::RetryClientConnect() { - return m_b_retry_connect; + return m_b_retry_connect; } void StreamSocket::SetLineProtocol(bool x) { - m_line_protocol = x; + m_line_protocol = x; } bool StreamSocket::LineProtocol() { - return m_line_protocol; + return m_line_protocol; } void StreamSocket::SetShutdown(int x) { - m_shutdown = x; + m_shutdown = x; } int StreamSocket::GetShutdown() { - return m_shutdown; + return m_shutdown; } diff --git a/dep/src/sockets/TcpSocket.cpp b/dep/src/sockets/TcpSocket.cpp index 36df37d5832..1dc54dd3fac 100644 --- a/dep/src/sockets/TcpSocket.cpp +++ b/dep/src/sockets/TcpSocket.cpp @@ -1,6 +1,6 @@ /** \file TcpSocket.cpp - ** \date 2004-02-13 - ** \author grymse@alhem.net + ** \date 2004-02-13 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -60,7 +60,7 @@ namespace SOCKETS_NAMESPACE { //#ifdef _DEBUG //#define DEB(x) x //#else -#define DEB(x) +#define DEB(x) //#endif @@ -148,30 +148,30 @@ TcpSocket::TcpSocket(ISocketHandler& h,size_t isize,size_t osize) : StreamSocket TcpSocket::~TcpSocket() { #ifdef SOCKETS_DYNAMIC_TEMP - delete[] m_buf; + delete[] m_buf; #endif - // %! empty m_obuf - while (m_obuf.size()) - { - output_l::iterator it = m_obuf.begin(); - OUTPUT *p = *it; - delete p; - m_obuf.erase(it); - } + // %! empty m_obuf + while (m_obuf.size()) + { + output_l::iterator it = m_obuf.begin(); + OUTPUT *p = *it; + delete p; + m_obuf.erase(it); + } #ifdef HAVE_OPENSSL - if (m_ssl) - { - SSL_free(m_ssl); - } + if (m_ssl) + { + SSL_free(m_ssl); + } #endif } bool TcpSocket::Open(ipaddr_t ip,port_t port,bool skip_socks) { - Ipv4Address ad(ip, port); - Ipv4Address local; - return Open(ad, local, skip_socks); + Ipv4Address ad(ip, port); + Ipv4Address local; + return Open(ad, local, skip_socks); } @@ -179,8 +179,8 @@ bool TcpSocket::Open(ipaddr_t ip,port_t port,bool skip_socks) #ifdef IPPROTO_IPV6 bool TcpSocket::Open(in6_addr ip,port_t port,bool skip_socks) { - Ipv6Address ad(ip, port); - return Open(ad, skip_socks); + Ipv6Address ad(ip, port); + return Open(ad, skip_socks); } #endif #endif @@ -188,134 +188,134 @@ bool TcpSocket::Open(in6_addr ip,port_t port,bool skip_socks) bool TcpSocket::Open(SocketAddress& ad,bool skip_socks) { - Ipv4Address bind_ad("0.0.0.0", 0); - return Open(ad, bind_ad, skip_socks); + Ipv4Address bind_ad("0.0.0.0", 0); + return Open(ad, bind_ad, skip_socks); } bool TcpSocket::Open(SocketAddress& ad,SocketAddress& bind_ad,bool skip_socks) { - if (!ad.IsValid()) - { - Handler().LogError(this, "Open", 0, "Invalid SocketAddress", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - return false; - } - if (Handler().GetCount() >= FD_SETSIZE) - { - Handler().LogError(this, "Open", 0, "no space left in fd_set", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - return false; - } - SetConnecting(false); + if (!ad.IsValid()) + { + Handler().LogError(this, "Open", 0, "Invalid SocketAddress", LOG_LEVEL_FATAL); + SetCloseAndDelete(); + return false; + } + if (Handler().GetCount() >= FD_SETSIZE) + { + Handler().LogError(this, "Open", 0, "no space left in fd_set", LOG_LEVEL_FATAL); + SetCloseAndDelete(); + return false; + } + SetConnecting(false); #ifdef ENABLE_SOCKS4 - SetSocks4(false); + SetSocks4(false); #endif - // check for pooling + // check for pooling #ifdef ENABLE_POOL - if (Handler().PoolEnabled()) - { - ISocketHandler::PoolSocket *pools = Handler().FindConnection(SOCK_STREAM, "tcp", ad); - if (pools) - { - CopyConnection( pools ); - delete pools; + if (Handler().PoolEnabled()) + { + ISocketHandler::PoolSocket *pools = Handler().FindConnection(SOCK_STREAM, "tcp", ad); + if (pools) + { + CopyConnection( pools ); + delete pools; - SetIsClient(); - SetCallOnConnect(); // ISocketHandler must call OnConnect - Handler().LogError(this, "SetCallOnConnect", 0, "Found pooled connection", LOG_LEVEL_INFO); - return true; - } - } + SetIsClient(); + SetCallOnConnect(); // ISocketHandler must call OnConnect + Handler().LogError(this, "SetCallOnConnect", 0, "Found pooled connection", LOG_LEVEL_INFO); + return true; + } + } #endif - // if not, create new connection - SOCKET s = CreateSocket(ad.GetFamily(), SOCK_STREAM, "tcp"); - if (s == INVALID_SOCKET) - { - return false; - } - // socket must be nonblocking for async connect - if (!SetNonblocking(true, s)) - { - SetCloseAndDelete(); - closesocket(s); - return false; - } + // if not, create new connection + SOCKET s = CreateSocket(ad.GetFamily(), SOCK_STREAM, "tcp"); + if (s == INVALID_SOCKET) + { + return false; + } + // socket must be nonblocking for async connect + if (!SetNonblocking(true, s)) + { + SetCloseAndDelete(); + closesocket(s); + return false; + } #ifdef ENABLE_POOL - SetIsClient(); // client because we connect + SetIsClient(); // client because we connect #endif - SetClientRemoteAddress(ad); - int n = 0; - if (bind_ad.GetPort() != 0) - { - bind(s, bind_ad, bind_ad); - } + SetClientRemoteAddress(ad); + int n = 0; + if (bind_ad.GetPort() != 0) + { + bind(s, bind_ad, bind_ad); + } #ifdef ENABLE_SOCKS4 - if (!skip_socks && GetSocks4Host() && GetSocks4Port()) - { - Ipv4Address sa(GetSocks4Host(), GetSocks4Port()); - { - std::string sockshost; - Utility::l2ip(GetSocks4Host(), sockshost); - Handler().LogError(this, "Open", 0, "Connecting to socks4 server @ " + sockshost + ":" + - Utility::l2string(GetSocks4Port()), LOG_LEVEL_INFO); - } - SetSocks4(); - n = connect(s, sa, sa); - SetRemoteAddress(sa); - } - else + if (!skip_socks && GetSocks4Host() && GetSocks4Port()) + { + Ipv4Address sa(GetSocks4Host(), GetSocks4Port()); + { + std::string sockshost; + Utility::l2ip(GetSocks4Host(), sockshost); + Handler().LogError(this, "Open", 0, "Connecting to socks4 server @ " + sockshost + ":" + + Utility::l2string(GetSocks4Port()), LOG_LEVEL_INFO); + } + SetSocks4(); + n = connect(s, sa, sa); + SetRemoteAddress(sa); + } + else #endif - { - n = connect(s, ad, ad); - SetRemoteAddress(ad); - } - if (n == -1) - { - // check error code that means a connect is in progress + { + n = connect(s, ad, ad); + SetRemoteAddress(ad); + } + if (n == -1) + { + // check error code that means a connect is in progress #ifdef _WIN32 - if (Errno == WSAEWOULDBLOCK) + if (Errno == WSAEWOULDBLOCK) #else - if (Errno == EINPROGRESS) + if (Errno == EINPROGRESS) #endif - { - Attach(s); - SetConnecting( true ); // this flag will control fd_set's - } - else + { + Attach(s); + SetConnecting( true ); // this flag will control fd_set's + } + else #ifdef ENABLE_SOCKS4 - if (Socks4() && Handler().Socks4TryDirect() ) // retry - { - closesocket(s); - return Open(ad, true); - } - else + if (Socks4() && Handler().Socks4TryDirect() ) // retry + { + closesocket(s); + return Open(ad, true); + } + else #endif #ifdef ENABLE_RECONNECT - if (Reconnect()) - { - Handler().LogError(this, "connect: failed, reconnect pending", Errno, StrError(Errno), LOG_LEVEL_INFO); - Attach(s); - SetConnecting( true ); // this flag will control fd_set's - } - else + if (Reconnect()) + { + Handler().LogError(this, "connect: failed, reconnect pending", Errno, StrError(Errno), LOG_LEVEL_INFO); + Attach(s); + SetConnecting( true ); // this flag will control fd_set's + } + else #endif - { - Handler().LogError(this, "connect: failed", Errno, StrError(Errno), LOG_LEVEL_FATAL); - SetCloseAndDelete(); - closesocket(s); - return false; - } - } - else - { - Attach(s); - SetCallOnConnect(); // ISocketHandler must call OnConnect - } + { + Handler().LogError(this, "connect: failed", Errno, StrError(Errno), LOG_LEVEL_FATAL); + SetCloseAndDelete(); + closesocket(s); + return false; + } + } + else + { + Attach(s); + SetCallOnConnect(); // ISocketHandler must call OnConnect + } - // 'true' means connected or connecting(not yet connected) - // 'false' means something failed - return true; //!Connecting(); + // 'true' means connected or connecting(not yet connected) + // 'false' means something failed + return true; //!Connecting(); } @@ -323,47 +323,47 @@ bool TcpSocket::Open(const std::string &host,port_t port) { #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (IsIpv6()) - { + if (IsIpv6()) + { #ifdef ENABLE_RESOLVER - if (!Handler().ResolverEnabled() || Utility::isipv6(host) ) - { + if (!Handler().ResolverEnabled() || Utility::isipv6(host) ) + { #endif - in6_addr a; - if (!Utility::u2ip(host, a)) - { - SetCloseAndDelete(); - return false; - } - Ipv6Address ad(a, port); - Ipv6Address local; - return Open(ad, local); + in6_addr a; + if (!Utility::u2ip(host, a)) + { + SetCloseAndDelete(); + return false; + } + Ipv6Address ad(a, port); + Ipv6Address local; + return Open(ad, local); #ifdef ENABLE_RESOLVER - } - m_resolver_id = Resolve6(host, port); - return true; + } + m_resolver_id = Resolve6(host, port); + return true; #endif - } + } #endif #endif #ifdef ENABLE_RESOLVER - if (!Handler().ResolverEnabled() || Utility::isipv4(host) ) - { + if (!Handler().ResolverEnabled() || Utility::isipv4(host) ) + { #endif - ipaddr_t l; - if (!Utility::u2ip(host,l)) - { - SetCloseAndDelete(); - return false; - } - Ipv4Address ad(l, port); - Ipv4Address local; - return Open(ad, local); + ipaddr_t l; + if (!Utility::u2ip(host,l)) + { + SetCloseAndDelete(); + return false; + } + Ipv4Address ad(l, port); + Ipv4Address local; + return Open(ad, local); #ifdef ENABLE_RESOLVER - } - // resolve using async resolver thread - m_resolver_id = Resolve(host, port); - return true; + } + // resolve using async resolver thread + m_resolver_id = Resolve(host, port); + return true; #endif } @@ -371,58 +371,58 @@ bool TcpSocket::Open(const std::string &host,port_t port) #ifdef ENABLE_RESOLVER void TcpSocket::OnResolved(int id,ipaddr_t a,port_t port) { -DEB( fprintf(stderr, "TcpSocket::OnResolved id %d addr %x port %d\n", id, a, port);) - if (id == m_resolver_id) - { - if (a && port) - { - Ipv4Address ad(a, port); - Ipv4Address local; - if (Open(ad, local)) - { - if (!Handler().Valid(this)) - { - Handler().Add(this); - } - } - } - else - { - Handler().LogError(this, "OnResolved", 0, "Resolver failed", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - } - } - else - { - Handler().LogError(this, "OnResolved", id, "Resolver returned wrong job id", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - } +DEB( fprintf(stderr, "TcpSocket::OnResolved id %d addr %x port %d\n", id, a, port);) + if (id == m_resolver_id) + { + if (a && port) + { + Ipv4Address ad(a, port); + Ipv4Address local; + if (Open(ad, local)) + { + if (!Handler().Valid(this)) + { + Handler().Add(this); + } + } + } + else + { + Handler().LogError(this, "OnResolved", 0, "Resolver failed", LOG_LEVEL_FATAL); + SetCloseAndDelete(); + } + } + else + { + Handler().LogError(this, "OnResolved", id, "Resolver returned wrong job id", LOG_LEVEL_FATAL); + SetCloseAndDelete(); + } } #ifdef ENABLE_IPV6 void TcpSocket::OnResolved(int id,in6_addr& a,port_t port) { - if (id == m_resolver_id) - { - Ipv6Address ad(a, port); - if (ad.IsValid()) - { - Ipv6Address local; - if (Open(ad, local)) - { - if (!Handler().Valid(this)) - { - Handler().Add(this); - } - } - } - } - else - { - Handler().LogError(this, "OnResolved", id, "Resolver returned wrong job id", LOG_LEVEL_FATAL); - SetCloseAndDelete(); - } + if (id == m_resolver_id) + { + Ipv6Address ad(a, port); + if (ad.IsValid()) + { + Ipv6Address local; + if (Open(ad, local)) + { + if (!Handler().Valid(this)) + { + Handler().Add(this); + } + } + } + } + else + { + Handler().LogError(this, "OnResolved", id, "Resolver returned wrong job id", LOG_LEVEL_FATAL); + SetCloseAndDelete(); + } } #endif #endif @@ -430,191 +430,191 @@ void TcpSocket::OnResolved(int id,in6_addr& a,port_t port) void TcpSocket::OnRead() { - int n = 0; + int n = 0; #ifdef SOCKETS_DYNAMIC_TEMP - char *buf = m_buf; + char *buf = m_buf; #else - char buf[TCP_BUFSIZE_READ]; + char buf[TCP_BUFSIZE_READ]; #endif #ifdef HAVE_OPENSSL - if (IsSSL()) - { - if (!Ready()) - return; - n = SSL_read(m_ssl, buf, TCP_BUFSIZE_READ); - if (n == -1) - { - n = SSL_get_error(m_ssl, n); - switch (n) - { - case SSL_ERROR_NONE: - case SSL_ERROR_WANT_READ: - case SSL_ERROR_WANT_WRITE: - break; - case SSL_ERROR_ZERO_RETURN: -DEB( fprintf(stderr, "SSL_read() returns zero - closing socket\n");) - OnDisconnect(); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); - break; - default: -DEB( fprintf(stderr, "SSL read problem, errcode = %d\n",n);) - OnDisconnect(); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); - } - return; - } - else - if (!n) - { - OnDisconnect(); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); - SetShutdown(SHUT_WR); - return; - } - else - if (n > 0 && n <= TCP_BUFSIZE_READ) - { - m_bytes_received += n; - if (GetTrafficMonitor()) - { - GetTrafficMonitor() -> fwrite(buf, 1, n); - } - if (!m_b_input_buffer_disabled && !ibuf.Write(buf,n)) - { - Handler().LogError(this, "OnRead(ssl)", 0, "ibuf overflow", LOG_LEVEL_WARNING); - } - } - else - { - Handler().LogError(this, "OnRead(ssl)", n, "abnormal value from SSL_read", LOG_LEVEL_ERROR); - } - } - else + if (IsSSL()) + { + if (!Ready()) + return; + n = SSL_read(m_ssl, buf, TCP_BUFSIZE_READ); + if (n == -1) + { + n = SSL_get_error(m_ssl, n); + switch (n) + { + case SSL_ERROR_NONE: + case SSL_ERROR_WANT_READ: + case SSL_ERROR_WANT_WRITE: + break; + case SSL_ERROR_ZERO_RETURN: +DEB( fprintf(stderr, "SSL_read() returns zero - closing socket\n");) + OnDisconnect(); + SetCloseAndDelete(true); + SetFlushBeforeClose(false); + SetLost(); + break; + default: +DEB( fprintf(stderr, "SSL read problem, errcode = %d\n",n);) + OnDisconnect(); + SetCloseAndDelete(true); + SetFlushBeforeClose(false); + SetLost(); + } + return; + } + else + if (!n) + { + OnDisconnect(); + SetCloseAndDelete(true); + SetFlushBeforeClose(false); + SetLost(); + SetShutdown(SHUT_WR); + return; + } + else + if (n > 0 && n <= TCP_BUFSIZE_READ) + { + m_bytes_received += n; + if (GetTrafficMonitor()) + { + GetTrafficMonitor() -> fwrite(buf, 1, n); + } + if (!m_b_input_buffer_disabled && !ibuf.Write(buf,n)) + { + Handler().LogError(this, "OnRead(ssl)", 0, "ibuf overflow", LOG_LEVEL_WARNING); + } + } + else + { + Handler().LogError(this, "OnRead(ssl)", n, "abnormal value from SSL_read", LOG_LEVEL_ERROR); + } + } + else #endif // HAVE_OPENSSL - { - n = recv(GetSocket(), buf, TCP_BUFSIZE_READ, MSG_NOSIGNAL); - if (n == -1) - { - Handler().LogError(this, "read", Errno, StrError(Errno), LOG_LEVEL_FATAL); - OnDisconnect(); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); - return; - } - else - if (!n) - { - OnDisconnect(); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); - SetShutdown(SHUT_WR); - return; - } - else - if (n > 0 && n <= TCP_BUFSIZE_READ) - { - m_bytes_received += n; - if (GetTrafficMonitor()) - { - GetTrafficMonitor() -> fwrite(buf, 1, n); - } - if (!m_b_input_buffer_disabled && !ibuf.Write(buf,n)) - { - Handler().LogError(this, "OnRead", 0, "ibuf overflow", LOG_LEVEL_WARNING); - } - } - else - { - Handler().LogError(this, "OnRead", n, "abnormal value from recv", LOG_LEVEL_ERROR); - } - } - // - OnRead( buf, n ); + { + n = recv(GetSocket(), buf, TCP_BUFSIZE_READ, MSG_NOSIGNAL); + if (n == -1) + { + Handler().LogError(this, "read", Errno, StrError(Errno), LOG_LEVEL_FATAL); + OnDisconnect(); + SetCloseAndDelete(true); + SetFlushBeforeClose(false); + SetLost(); + return; + } + else + if (!n) + { + OnDisconnect(); + SetCloseAndDelete(true); + SetFlushBeforeClose(false); + SetLost(); + SetShutdown(SHUT_WR); + return; + } + else + if (n > 0 && n <= TCP_BUFSIZE_READ) + { + m_bytes_received += n; + if (GetTrafficMonitor()) + { + GetTrafficMonitor() -> fwrite(buf, 1, n); + } + if (!m_b_input_buffer_disabled && !ibuf.Write(buf,n)) + { + Handler().LogError(this, "OnRead", 0, "ibuf overflow", LOG_LEVEL_WARNING); + } + } + else + { + Handler().LogError(this, "OnRead", n, "abnormal value from recv", LOG_LEVEL_ERROR); + } + } + // + OnRead( buf, n ); } void TcpSocket::OnRead( char *buf, size_t n ) { - // unbuffered - if (n > 0 && n <= TCP_BUFSIZE_READ) - { - if (LineProtocol()) - { - buf[n] = 0; - size_t i = 0; - if (m_skip_c && (buf[i] == 13 || buf[i] == 10) && buf[i] != m_c) - { - m_skip_c = false; - i++; - } - size_t x = i; - for (; i < n && LineProtocol(); i++) - { - while ((buf[i] == 13 || buf[i] == 10) && LineProtocol()) - { - char c = buf[i]; - buf[i] = 0; - if (buf[x]) - { - m_line += (buf + x); - } - OnLine( m_line ); - i++; - m_skip_c = true; - m_c = c; - if (i < n && (buf[i] == 13 || buf[i] == 10) && buf[i] != c) - { - m_skip_c = false; - i++; - } - x = i; - m_line = ""; - } - if (!LineProtocol()) - { - break; - } - } - if (!LineProtocol()) - { - if (i < n) - { - OnRawData(buf + i, n - i); - } - } - else - if (buf[x]) - { - m_line += (buf + x); - } - } - else - { - OnRawData(buf, n); - } - } - if (m_b_input_buffer_disabled) - { - return; - } - // further processing: socks4 + // unbuffered + if (n > 0 && n <= TCP_BUFSIZE_READ) + { + if (LineProtocol()) + { + buf[n] = 0; + size_t i = 0; + if (m_skip_c && (buf[i] == 13 || buf[i] == 10) && buf[i] != m_c) + { + m_skip_c = false; + i++; + } + size_t x = i; + for (; i < n && LineProtocol(); i++) + { + while ((buf[i] == 13 || buf[i] == 10) && LineProtocol()) + { + char c = buf[i]; + buf[i] = 0; + if (buf[x]) + { + m_line += (buf + x); + } + OnLine( m_line ); + i++; + m_skip_c = true; + m_c = c; + if (i < n && (buf[i] == 13 || buf[i] == 10) && buf[i] != c) + { + m_skip_c = false; + i++; + } + x = i; + m_line = ""; + } + if (!LineProtocol()) + { + break; + } + } + if (!LineProtocol()) + { + if (i < n) + { + OnRawData(buf + i, n - i); + } + } + else + if (buf[x]) + { + m_line += (buf + x); + } + } + else + { + OnRawData(buf, n); + } + } + if (m_b_input_buffer_disabled) + { + return; + } + // further processing: socks4 #ifdef ENABLE_SOCKS4 - if (Socks4()) - { - bool need_more = false; - while (GetInputLength() && !need_more && !CloseAndDelete()) - { - need_more = OnSocks4Read(); - } - } + if (Socks4()) + { + bool need_more = false; + while (GetInputLength() && !need_more && !CloseAndDelete()) + { + need_more = OnSocks4Read(); + } + } #endif } @@ -626,252 +626,252 @@ void TcpSocket::OnWriteComplete() void TcpSocket::OnWrite() { - if (Connecting()) - { - int err = SoError(); + if (Connecting()) + { + int err = SoError(); - // don't reset connecting flag on error here, we want the OnConnectFailed timeout later on - if (!err) // ok - { - Set(!IsDisableRead(), false); - SetConnecting(false); - SetCallOnConnect(); - return; - } - Handler().LogError(this, "tcp: connect failed", err, StrError(err), LOG_LEVEL_FATAL); - Set(false, false); // no more monitoring because connection failed + // don't reset connecting flag on error here, we want the OnConnectFailed timeout later on + if (!err) // ok + { + Set(!IsDisableRead(), false); + SetConnecting(false); + SetCallOnConnect(); + return; + } + Handler().LogError(this, "tcp: connect failed", err, StrError(err), LOG_LEVEL_FATAL); + Set(false, false); // no more monitoring because connection failed - // failed + // failed #ifdef ENABLE_SOCKS4 - if (Socks4()) - { - // %! leave 'Connecting' flag set? - OnSocks4ConnectFailed(); - return; - } + if (Socks4()) + { + // %! leave 'Connecting' flag set? + OnSocks4ConnectFailed(); + return; + } #endif - if (GetConnectionRetry() == -1 || - (GetConnectionRetry() && GetConnectionRetries() < GetConnectionRetry()) ) - { - // even though the connection failed at once, only retry after - // the connection timeout. - // should we even try to connect again, when CheckConnect returns - // false it's because of a connection error - not a timeout... - return; - } - SetConnecting(false); - SetCloseAndDelete( true ); - /// \todo state reason why connect failed - OnConnectFailed(); - return; - } - // try send next block in buffer - // if full block is sent, repeat - // if all blocks are sent, reset m_wfds + if (GetConnectionRetry() == -1 || + (GetConnectionRetry() && GetConnectionRetries() < GetConnectionRetry()) ) + { + // even though the connection failed at once, only retry after + // the connection timeout. + // should we even try to connect again, when CheckConnect returns + // false it's because of a connection error - not a timeout... + return; + } + SetConnecting(false); + SetCloseAndDelete( true ); + /// \todo state reason why connect failed + OnConnectFailed(); + return; + } + // try send next block in buffer + // if full block is sent, repeat + // if all blocks are sent, reset m_wfds - bool repeat = false; - size_t sz = m_transfer_limit ? GetOutputLength() : 0; - do - { - output_l::iterator it = m_obuf.begin(); - OUTPUT *p = *it; - repeat = false; - int n = TryWrite(p -> Buf(), p -> Len()); - if (n > 0) - { - size_t left = p -> Remove(n); - m_output_length -= n; - if (!left) - { - delete p; - m_obuf.erase(it); - if (!m_obuf.size()) - { - m_obuf_top = NULL; - OnWriteComplete(); - } - else - { - repeat = true; - } - } - } - } while (repeat); + bool repeat = false; + size_t sz = m_transfer_limit ? GetOutputLength() : 0; + do + { + output_l::iterator it = m_obuf.begin(); + OUTPUT *p = *it; + repeat = false; + int n = TryWrite(p -> Buf(), p -> Len()); + if (n > 0) + { + size_t left = p -> Remove(n); + m_output_length -= n; + if (!left) + { + delete p; + m_obuf.erase(it); + if (!m_obuf.size()) + { + m_obuf_top = NULL; + OnWriteComplete(); + } + else + { + repeat = true; + } + } + } + } while (repeat); - if (m_transfer_limit && sz > m_transfer_limit && GetOutputLength() < m_transfer_limit) - { - OnTransferLimit(); - } + if (m_transfer_limit && sz > m_transfer_limit && GetOutputLength() < m_transfer_limit) + { + OnTransferLimit(); + } - // check output buffer set, set/reset m_wfds accordingly - { - bool br; - bool bw; - bool bx; - Handler().Get(GetSocket(), br, bw, bx); - if (m_obuf.size()) - Set(br, true); - else - Set(br, false); - } + // check output buffer set, set/reset m_wfds accordingly + { + bool br; + bool bw; + bool bx; + Handler().Get(GetSocket(), br, bw, bx); + if (m_obuf.size()) + Set(br, true); + else + Set(br, false); + } } int TcpSocket::TryWrite(const char *buf, size_t len) { - int n = 0; + int n = 0; #ifdef HAVE_OPENSSL - if (IsSSL()) - { - n = SSL_write(m_ssl, buf, (int)len); - if (n == -1) - { - int errnr = SSL_get_error(m_ssl, n); - if ( errnr != SSL_ERROR_WANT_READ && errnr != SSL_ERROR_WANT_WRITE ) - { - OnDisconnect(); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); - const char *errbuf = ERR_error_string(errnr, NULL); - Handler().LogError(this, "OnWrite/SSL_write", errnr, errbuf, LOG_LEVEL_FATAL); - } - return 0; - } - else - if (!n) - { - OnDisconnect(); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); -DEB( int errnr = SSL_get_error(m_ssl, n); - const char *errbuf = ERR_error_string(errnr, NULL); - fprintf(stderr, "SSL_write() returns 0: %d : %s\n",errnr, errbuf);) - } - } - else + if (IsSSL()) + { + n = SSL_write(m_ssl, buf, (int)len); + if (n == -1) + { + int errnr = SSL_get_error(m_ssl, n); + if ( errnr != SSL_ERROR_WANT_READ && errnr != SSL_ERROR_WANT_WRITE ) + { + OnDisconnect(); + SetCloseAndDelete(true); + SetFlushBeforeClose(false); + SetLost(); + const char *errbuf = ERR_error_string(errnr, NULL); + Handler().LogError(this, "OnWrite/SSL_write", errnr, errbuf, LOG_LEVEL_FATAL); + } + return 0; + } + else + if (!n) + { + OnDisconnect(); + SetCloseAndDelete(true); + SetFlushBeforeClose(false); + SetLost(); +DEB( int errnr = SSL_get_error(m_ssl, n); + const char *errbuf = ERR_error_string(errnr, NULL); + fprintf(stderr, "SSL_write() returns 0: %d : %s\n",errnr, errbuf);) + } + } + else #endif // HAVE_OPENSSL - { - n = send(GetSocket(), buf, (int)len, MSG_NOSIGNAL); - if (n == -1) - { - // normal error codes: - // WSAEWOULDBLOCK - // EAGAIN or EWOULDBLOCK + { + n = send(GetSocket(), buf, (int)len, MSG_NOSIGNAL); + if (n == -1) + { + // normal error codes: + // WSAEWOULDBLOCK + // EAGAIN or EWOULDBLOCK #ifdef _WIN32 - if (Errno != WSAEWOULDBLOCK) + if (Errno != WSAEWOULDBLOCK) #else - if (Errno != EWOULDBLOCK) + if (Errno != EWOULDBLOCK) #endif - { - Handler().LogError(this, "send", Errno, StrError(Errno), LOG_LEVEL_FATAL); - OnDisconnect(); - SetCloseAndDelete(true); - SetFlushBeforeClose(false); - SetLost(); - } - return 0; - } - } - if (n > 0) - { - m_bytes_sent += n; - if (GetTrafficMonitor()) - { - GetTrafficMonitor() -> fwrite(buf, 1, n); - } - } - return n; + { + Handler().LogError(this, "send", Errno, StrError(Errno), LOG_LEVEL_FATAL); + OnDisconnect(); + SetCloseAndDelete(true); + SetFlushBeforeClose(false); + SetLost(); + } + return 0; + } + } + if (n > 0) + { + m_bytes_sent += n; + if (GetTrafficMonitor()) + { + GetTrafficMonitor() -> fwrite(buf, 1, n); + } + } + return n; } void TcpSocket::Buffer(const char *buf, size_t len) { - size_t ptr = 0; - m_output_length += len; - while (ptr < len) - { - // buf/len => pbuf/sz - size_t space = 0; - if (m_obuf_top && (space = m_obuf_top -> Space()) > 0) - { - const char *pbuf = buf + ptr; - size_t sz = len - ptr; - if (space >= sz) - { - m_obuf_top -> Add(pbuf, sz); - ptr += sz; - } - else - { - m_obuf_top -> Add(pbuf, space); - ptr += space; - } - } - else - { - m_obuf_top = new OUTPUT; - m_obuf.push_back( m_obuf_top ); - } - } + size_t ptr = 0; + m_output_length += len; + while (ptr < len) + { + // buf/len => pbuf/sz + size_t space = 0; + if (m_obuf_top && (space = m_obuf_top -> Space()) > 0) + { + const char *pbuf = buf + ptr; + size_t sz = len - ptr; + if (space >= sz) + { + m_obuf_top -> Add(pbuf, sz); + ptr += sz; + } + else + { + m_obuf_top -> Add(pbuf, space); + ptr += space; + } + } + else + { + m_obuf_top = new OUTPUT; + m_obuf.push_back( m_obuf_top ); + } + } } void TcpSocket::Send(const std::string &str,int i) { - SendBuf(str.c_str(),str.size(),i); + SendBuf(str.c_str(),str.size(),i); } void TcpSocket::SendBuf(const char *buf,size_t len,int) { - if (!Ready() && !Connecting()) - { - Handler().LogError(this, "SendBuf", -1, "Attempt to write to a non-ready socket" ); // warning - if (GetSocket() == INVALID_SOCKET) - Handler().LogError(this, "SendBuf", 0, " * GetSocket() == INVALID_SOCKET", LOG_LEVEL_INFO); - if (Connecting()) - Handler().LogError(this, "SendBuf", 0, " * Connecting()", LOG_LEVEL_INFO); - if (CloseAndDelete()) - Handler().LogError(this, "SendBuf", 0, " * CloseAndDelete()", LOG_LEVEL_INFO); - return; - } - if (!IsConnected()) - { - Handler().LogError(this, "SendBuf", -1, "Attempt to write to a non-connected socket, will be sent on connect" ); // warning - Buffer(buf, len); - return; - } - if (m_obuf_top) - { - Buffer(buf, len); - return; - } - int n = TryWrite(buf, len); - if (n >= 0 && n < (int)len) - { - Buffer(buf + n, len - n); - } - // if ( data in buffer || !IsConnected ) - // { - // add to buffer - // } - // else - // try_send - // if any data is unsent, buffer it and set m_wfds + if (!Ready() && !Connecting()) + { + Handler().LogError(this, "SendBuf", -1, "Attempt to write to a non-ready socket" ); // warning + if (GetSocket() == INVALID_SOCKET) + Handler().LogError(this, "SendBuf", 0, " * GetSocket() == INVALID_SOCKET", LOG_LEVEL_INFO); + if (Connecting()) + Handler().LogError(this, "SendBuf", 0, " * Connecting()", LOG_LEVEL_INFO); + if (CloseAndDelete()) + Handler().LogError(this, "SendBuf", 0, " * CloseAndDelete()", LOG_LEVEL_INFO); + return; + } + if (!IsConnected()) + { + Handler().LogError(this, "SendBuf", -1, "Attempt to write to a non-connected socket, will be sent on connect" ); // warning + Buffer(buf, len); + return; + } + if (m_obuf_top) + { + Buffer(buf, len); + return; + } + int n = TryWrite(buf, len); + if (n >= 0 && n < (int)len) + { + Buffer(buf + n, len - n); + } + // if ( data in buffer || !IsConnected ) + // { + // add to buffer + // } + // else + // try_send + // if any data is unsent, buffer it and set m_wfds - // check output buffer set, set/reset m_wfds accordingly - { - bool br; - bool bw; - bool bx; - Handler().Get(GetSocket(), br, bw, bx); - if (m_obuf.size()) - Set(br, true); - else - Set(br, false); - } + // check output buffer set, set/reset m_wfds accordingly + { + bool br; + bool bw; + bool bx; + Handler().Get(GetSocket(), br, bw, bx); + if (m_obuf.size()) + Set(br, true); + else + Set(br, false); + } } @@ -896,478 +896,478 @@ TcpSocket::TcpSocket(const TcpSocket& s) #ifdef ENABLE_SOCKS4 void TcpSocket::OnSocks4Connect() { - char request[1000]; - memset(request, 0, sizeof(request)); - request[0] = 4; // socks v4 - request[1] = 1; // command code: CONNECT - { - std::auto_ptr ad = GetClientRemoteAddress(); - if (ad.get()) - { - struct sockaddr *p0 = (struct sockaddr *)*ad; - struct sockaddr_in *p = (struct sockaddr_in *)p0; - if (p -> sin_family == AF_INET) - { - memcpy(request + 2, &p -> sin_port, 2); // nwbo is ok here - memcpy(request + 4, &p -> sin_addr, sizeof(struct in_addr)); - } - else - { - /// \todo warn - } - } - else - { - /// \todo warn - } - } - strcpy(request + 8, GetSocks4Userid().c_str()); - size_t length = GetSocks4Userid().size() + 8 + 1; - SendBuf(request, length); - m_socks4_state = 0; + char request[1000]; + memset(request, 0, sizeof(request)); + request[0] = 4; // socks v4 + request[1] = 1; // command code: CONNECT + { + std::auto_ptr ad = GetClientRemoteAddress(); + if (ad.get()) + { + struct sockaddr *p0 = (struct sockaddr *)*ad; + struct sockaddr_in *p = (struct sockaddr_in *)p0; + if (p -> sin_family == AF_INET) + { + memcpy(request + 2, &p -> sin_port, 2); // nwbo is ok here + memcpy(request + 4, &p -> sin_addr, sizeof(struct in_addr)); + } + else + { + /// \todo warn + } + } + else + { + /// \todo warn + } + } + strcpy(request + 8, GetSocks4Userid().c_str()); + size_t length = GetSocks4Userid().size() + 8 + 1; + SendBuf(request, length); + m_socks4_state = 0; } void TcpSocket::OnSocks4ConnectFailed() { - Handler().LogError(this,"OnSocks4ConnectFailed",0,"connection to socks4 server failed, trying direct connection",LOG_LEVEL_WARNING); - if (!Handler().Socks4TryDirect()) - { - SetConnecting(false); - SetCloseAndDelete(); - OnConnectFailed(); // just in case - } - else - { - SetRetryClientConnect(); - } + Handler().LogError(this,"OnSocks4ConnectFailed",0,"connection to socks4 server failed, trying direct connection",LOG_LEVEL_WARNING); + if (!Handler().Socks4TryDirect()) + { + SetConnecting(false); + SetCloseAndDelete(); + OnConnectFailed(); // just in case + } + else + { + SetRetryClientConnect(); + } } bool TcpSocket::OnSocks4Read() { - switch (m_socks4_state) - { - case 0: - ibuf.Read(&m_socks4_vn, 1); - m_socks4_state = 1; - break; - case 1: - ibuf.Read(&m_socks4_cd, 1); - m_socks4_state = 2; - break; - case 2: - if (GetInputLength() > 1) - { - ibuf.Read( (char *)&m_socks4_dstport, 2); - m_socks4_state = 3; - } - else - { - return true; - } - break; - case 3: - if (GetInputLength() > 3) - { - ibuf.Read( (char *)&m_socks4_dstip, 4); - SetSocks4(false); - - switch (m_socks4_cd) - { - case 90: - OnConnect(); - Handler().LogError(this, "OnSocks4Read", 0, "Connection established", LOG_LEVEL_INFO); - break; - case 91: - case 92: - case 93: - Handler().LogError(this,"OnSocks4Read",m_socks4_cd,"socks4 server reports connect failed",LOG_LEVEL_FATAL); - SetConnecting(false); - SetCloseAndDelete(); - OnConnectFailed(); - break; - default: - Handler().LogError(this,"OnSocks4Read",m_socks4_cd,"socks4 server unrecognized response",LOG_LEVEL_FATAL); - SetCloseAndDelete(); - break; - } - } - else - { - return true; - } - break; - } - return false; + switch (m_socks4_state) + { + case 0: + ibuf.Read(&m_socks4_vn, 1); + m_socks4_state = 1; + break; + case 1: + ibuf.Read(&m_socks4_cd, 1); + m_socks4_state = 2; + break; + case 2: + if (GetInputLength() > 1) + { + ibuf.Read( (char *)&m_socks4_dstport, 2); + m_socks4_state = 3; + } + else + { + return true; + } + break; + case 3: + if (GetInputLength() > 3) + { + ibuf.Read( (char *)&m_socks4_dstip, 4); + SetSocks4(false); + + switch (m_socks4_cd) + { + case 90: + OnConnect(); + Handler().LogError(this, "OnSocks4Read", 0, "Connection established", LOG_LEVEL_INFO); + break; + case 91: + case 92: + case 93: + Handler().LogError(this,"OnSocks4Read",m_socks4_cd,"socks4 server reports connect failed",LOG_LEVEL_FATAL); + SetConnecting(false); + SetCloseAndDelete(); + OnConnectFailed(); + break; + default: + Handler().LogError(this,"OnSocks4Read",m_socks4_cd,"socks4 server unrecognized response",LOG_LEVEL_FATAL); + SetCloseAndDelete(); + break; + } + } + else + { + return true; + } + break; + } + return false; } #endif void TcpSocket::Sendf(const char *format, ...) { - va_list ap; - va_start(ap, format); - char slask[5000]; // vsprintf / vsnprintf temporary + va_list ap; + va_start(ap, format); + char slask[5000]; // vsprintf / vsnprintf temporary #ifdef _WIN32 - vsprintf(slask, format, ap); + vsprintf(slask, format, ap); #else - vsnprintf(slask, 5000, format, ap); + vsnprintf(slask, 5000, format, ap); #endif - va_end(ap); - Send( slask ); + va_end(ap); + Send( slask ); } #ifdef HAVE_OPENSSL void TcpSocket::OnSSLConnect() { - SetNonblocking(true); - { - if (m_ssl_ctx) - { -DEB( fprintf(stderr, "SSL Context already initialized - closing socket\n");) - SetCloseAndDelete(true); - return; - } - InitSSLClient(); - } - if (m_ssl_ctx) - { - /* Connect the SSL socket */ - m_ssl = SSL_new(m_ssl_ctx); - if (!m_ssl) - { -DEB( fprintf(stderr, " m_ssl is NULL\n");) - SetCloseAndDelete(true); - return; - } - SSL_set_mode(m_ssl, SSL_MODE_AUTO_RETRY); - m_sbio = BIO_new_socket((int)GetSocket(), BIO_NOCLOSE); - if (!m_sbio) - { -DEB( fprintf(stderr, " m_sbio is NULL\n");) - SetCloseAndDelete(true); - return; - } - SSL_set_bio(m_ssl, m_sbio, m_sbio); - if (!SSLNegotiate()) - { - SetSSLNegotiate(); - } - } - else - { - SetCloseAndDelete(); - } + SetNonblocking(true); + { + if (m_ssl_ctx) + { +DEB( fprintf(stderr, "SSL Context already initialized - closing socket\n");) + SetCloseAndDelete(true); + return; + } + InitSSLClient(); + } + if (m_ssl_ctx) + { + /* Connect the SSL socket */ + m_ssl = SSL_new(m_ssl_ctx); + if (!m_ssl) + { +DEB( fprintf(stderr, " m_ssl is NULL\n");) + SetCloseAndDelete(true); + return; + } + SSL_set_mode(m_ssl, SSL_MODE_AUTO_RETRY); + m_sbio = BIO_new_socket((int)GetSocket(), BIO_NOCLOSE); + if (!m_sbio) + { +DEB( fprintf(stderr, " m_sbio is NULL\n");) + SetCloseAndDelete(true); + return; + } + SSL_set_bio(m_ssl, m_sbio, m_sbio); + if (!SSLNegotiate()) + { + SetSSLNegotiate(); + } + } + else + { + SetCloseAndDelete(); + } } void TcpSocket::OnSSLAccept() { - SetNonblocking(true); - { - if (m_ssl_ctx) - { -DEB( fprintf(stderr, "SSL Context already initialized - closing socket\n");) - SetCloseAndDelete(true); - return; - } - InitSSLServer(); - SetSSLServer(); - } - if (m_ssl_ctx) - { - m_ssl = SSL_new(m_ssl_ctx); - if (!m_ssl) - { -DEB( fprintf(stderr, " m_ssl is NULL\n");) - SetCloseAndDelete(true); - return; - } - SSL_set_mode(m_ssl, SSL_MODE_AUTO_RETRY); - m_sbio = BIO_new_socket((int)GetSocket(), BIO_NOCLOSE); - if (!m_sbio) - { -DEB( fprintf(stderr, " m_sbio is NULL\n");) - SetCloseAndDelete(true); - return; - } - SSL_set_bio(m_ssl, m_sbio, m_sbio); -// if (!SSLNegotiate()) - { - SetSSLNegotiate(); - } - } + SetNonblocking(true); + { + if (m_ssl_ctx) + { +DEB( fprintf(stderr, "SSL Context already initialized - closing socket\n");) + SetCloseAndDelete(true); + return; + } + InitSSLServer(); + SetSSLServer(); + } + if (m_ssl_ctx) + { + m_ssl = SSL_new(m_ssl_ctx); + if (!m_ssl) + { +DEB( fprintf(stderr, " m_ssl is NULL\n");) + SetCloseAndDelete(true); + return; + } + SSL_set_mode(m_ssl, SSL_MODE_AUTO_RETRY); + m_sbio = BIO_new_socket((int)GetSocket(), BIO_NOCLOSE); + if (!m_sbio) + { +DEB( fprintf(stderr, " m_sbio is NULL\n");) + SetCloseAndDelete(true); + return; + } + SSL_set_bio(m_ssl, m_sbio, m_sbio); +// if (!SSLNegotiate()) + { + SetSSLNegotiate(); + } + } } bool TcpSocket::SSLNegotiate() { - if (!IsSSLServer()) // client - { - int r = SSL_connect(m_ssl); - if (r > 0) - { - SetSSLNegotiate(false); - /// \todo: resurrect certificate check... client -// CheckCertificateChain( "");//ServerHOST); - SetNonblocking(false); - // - { - SetConnected(); - if (GetOutputLength()) - { - OnWrite(); - } - } + if (!IsSSLServer()) // client + { + int r = SSL_connect(m_ssl); + if (r > 0) + { + SetSSLNegotiate(false); + /// \todo: resurrect certificate check... client +// CheckCertificateChain( "");//ServerHOST); + SetNonblocking(false); + // + { + SetConnected(); + if (GetOutputLength()) + { + OnWrite(); + } + } #ifdef ENABLE_RECONNECT - if (IsReconnect()) - OnReconnect(); - else + if (IsReconnect()) + OnReconnect(); + else #endif - { - OnConnect(); - } - Handler().LogError(this, "SSLNegotiate/SSL_connect", 0, "Connection established", LOG_LEVEL_INFO); - return true; - } - else - if (!r) - { - Handler().LogError(this, "SSLNegotiate/SSL_connect", 0, "Connection failed", LOG_LEVEL_INFO); - SetSSLNegotiate(false); - SetCloseAndDelete(); - OnSSLConnectFailed(); - } - else - { - r = SSL_get_error(m_ssl, r); - if (r != SSL_ERROR_WANT_READ && r != SSL_ERROR_WANT_WRITE) - { - Handler().LogError(this, "SSLNegotiate/SSL_connect", -1, "Connection failed", LOG_LEVEL_INFO); -DEB( fprintf(stderr, "SSL_connect() failed - closing socket, return code: %d\n",r);) - SetSSLNegotiate(false); - SetCloseAndDelete(true); - OnSSLConnectFailed(); - } - } - } - else // server - { - int r = SSL_accept(m_ssl); - if (r > 0) - { - SetSSLNegotiate(false); - /// \todo: resurrect certificate check... server -// CheckCertificateChain( "");//ClientHOST); - SetNonblocking(false); - // - { - SetConnected(); - if (GetOutputLength()) - { - OnWrite(); - } - } - OnAccept(); - Handler().LogError(this, "SSLNegotiate/SSL_accept", 0, "Connection established", LOG_LEVEL_INFO); - return true; - } - else - if (!r) - { - Handler().LogError(this, "SSLNegotiate/SSL_accept", 0, "Connection failed", LOG_LEVEL_INFO); - SetSSLNegotiate(false); - SetCloseAndDelete(); - OnSSLAcceptFailed(); - } - else - { - r = SSL_get_error(m_ssl, r); - if (r != SSL_ERROR_WANT_READ && r != SSL_ERROR_WANT_WRITE) - { - Handler().LogError(this, "SSLNegotiate/SSL_accept", -1, "Connection failed", LOG_LEVEL_INFO); -DEB( fprintf(stderr, "SSL_accept() failed - closing socket, return code: %d\n",r);) - SetSSLNegotiate(false); - SetCloseAndDelete(true); - OnSSLAcceptFailed(); - } - } - } - return false; + { + OnConnect(); + } + Handler().LogError(this, "SSLNegotiate/SSL_connect", 0, "Connection established", LOG_LEVEL_INFO); + return true; + } + else + if (!r) + { + Handler().LogError(this, "SSLNegotiate/SSL_connect", 0, "Connection failed", LOG_LEVEL_INFO); + SetSSLNegotiate(false); + SetCloseAndDelete(); + OnSSLConnectFailed(); + } + else + { + r = SSL_get_error(m_ssl, r); + if (r != SSL_ERROR_WANT_READ && r != SSL_ERROR_WANT_WRITE) + { + Handler().LogError(this, "SSLNegotiate/SSL_connect", -1, "Connection failed", LOG_LEVEL_INFO); +DEB( fprintf(stderr, "SSL_connect() failed - closing socket, return code: %d\n",r);) + SetSSLNegotiate(false); + SetCloseAndDelete(true); + OnSSLConnectFailed(); + } + } + } + else // server + { + int r = SSL_accept(m_ssl); + if (r > 0) + { + SetSSLNegotiate(false); + /// \todo: resurrect certificate check... server +// CheckCertificateChain( "");//ClientHOST); + SetNonblocking(false); + // + { + SetConnected(); + if (GetOutputLength()) + { + OnWrite(); + } + } + OnAccept(); + Handler().LogError(this, "SSLNegotiate/SSL_accept", 0, "Connection established", LOG_LEVEL_INFO); + return true; + } + else + if (!r) + { + Handler().LogError(this, "SSLNegotiate/SSL_accept", 0, "Connection failed", LOG_LEVEL_INFO); + SetSSLNegotiate(false); + SetCloseAndDelete(); + OnSSLAcceptFailed(); + } + else + { + r = SSL_get_error(m_ssl, r); + if (r != SSL_ERROR_WANT_READ && r != SSL_ERROR_WANT_WRITE) + { + Handler().LogError(this, "SSLNegotiate/SSL_accept", -1, "Connection failed", LOG_LEVEL_INFO); +DEB( fprintf(stderr, "SSL_accept() failed - closing socket, return code: %d\n",r);) + SetSSLNegotiate(false); + SetCloseAndDelete(true); + OnSSLAcceptFailed(); + } + } + } + return false; } void TcpSocket::InitSSLClient() { - InitializeContext("", SSLv23_method()); + InitializeContext("", SSLv23_method()); } void TcpSocket::InitSSLServer() { - Handler().LogError(this, "InitSSLServer", 0, "You MUST implement your own InitSSLServer method", LOG_LEVEL_FATAL); - SetCloseAndDelete(); + Handler().LogError(this, "InitSSLServer", 0, "You MUST implement your own InitSSLServer method", LOG_LEVEL_FATAL); + SetCloseAndDelete(); } void TcpSocket::InitializeContext(const std::string& context, SSL_METHOD *meth_in) { - /* Create our context*/ - static std::map client_contexts; - if (client_contexts.find(context) == client_contexts.end()) - { - SSL_METHOD *meth = meth_in ? meth_in : SSLv3_method(); - m_ssl_ctx = client_contexts[context] = SSL_CTX_new(meth); - SSL_CTX_set_mode(m_ssl_ctx, SSL_MODE_AUTO_RETRY); - } - else - { - m_ssl_ctx = client_contexts[context]; - } + /* Create our context*/ + static std::map client_contexts; + if (client_contexts.find(context) == client_contexts.end()) + { + SSL_METHOD *meth = meth_in ? meth_in : SSLv3_method(); + m_ssl_ctx = client_contexts[context] = SSL_CTX_new(meth); + SSL_CTX_set_mode(m_ssl_ctx, SSL_MODE_AUTO_RETRY); + } + else + { + m_ssl_ctx = client_contexts[context]; + } } void TcpSocket::InitializeContext(const std::string& context,const std::string& keyfile,const std::string& password,SSL_METHOD *meth_in) { - /* Create our context*/ - static std::map server_contexts; - if (server_contexts.find(context) == server_contexts.end()) - { - SSL_METHOD *meth = meth_in ? meth_in : SSLv3_method(); - m_ssl_ctx = server_contexts[context] = SSL_CTX_new(meth); - SSL_CTX_set_mode(m_ssl_ctx, SSL_MODE_AUTO_RETRY); - // session id - if (!context.empty()) - SSL_CTX_set_session_id_context(m_ssl_ctx, (const unsigned char *)context.c_str(), (unsigned int)context.size()); - else - SSL_CTX_set_session_id_context(m_ssl_ctx, (const unsigned char *)"--empty--", 9); - } - else - { - m_ssl_ctx = server_contexts[context]; - } + /* Create our context*/ + static std::map server_contexts; + if (server_contexts.find(context) == server_contexts.end()) + { + SSL_METHOD *meth = meth_in ? meth_in : SSLv3_method(); + m_ssl_ctx = server_contexts[context] = SSL_CTX_new(meth); + SSL_CTX_set_mode(m_ssl_ctx, SSL_MODE_AUTO_RETRY); + // session id + if (!context.empty()) + SSL_CTX_set_session_id_context(m_ssl_ctx, (const unsigned char *)context.c_str(), (unsigned int)context.size()); + else + SSL_CTX_set_session_id_context(m_ssl_ctx, (const unsigned char *)"--empty--", 9); + } + else + { + m_ssl_ctx = server_contexts[context]; + } - /* Load our keys and certificates*/ - if (!(SSL_CTX_use_certificate_file(m_ssl_ctx, keyfile.c_str(), SSL_FILETYPE_PEM))) - { - Handler().LogError(this, "TcpSocket InitializeContext", 0, "Couldn't read certificate file " + keyfile, LOG_LEVEL_FATAL); - } + /* Load our keys and certificates*/ + if (!(SSL_CTX_use_certificate_file(m_ssl_ctx, keyfile.c_str(), SSL_FILETYPE_PEM))) + { + Handler().LogError(this, "TcpSocket InitializeContext", 0, "Couldn't read certificate file " + keyfile, LOG_LEVEL_FATAL); + } - m_password = password; - SSL_CTX_set_default_passwd_cb(m_ssl_ctx, SSL_password_cb); - SSL_CTX_set_default_passwd_cb_userdata(m_ssl_ctx, this); - if (!(SSL_CTX_use_PrivateKey_file(m_ssl_ctx, keyfile.c_str(), SSL_FILETYPE_PEM))) - { - Handler().LogError(this, "TcpSocket InitializeContext", 0, "Couldn't read private key file " + keyfile, LOG_LEVEL_FATAL); - } + m_password = password; + SSL_CTX_set_default_passwd_cb(m_ssl_ctx, SSL_password_cb); + SSL_CTX_set_default_passwd_cb_userdata(m_ssl_ctx, this); + if (!(SSL_CTX_use_PrivateKey_file(m_ssl_ctx, keyfile.c_str(), SSL_FILETYPE_PEM))) + { + Handler().LogError(this, "TcpSocket InitializeContext", 0, "Couldn't read private key file " + keyfile, LOG_LEVEL_FATAL); + } } void TcpSocket::InitializeContext(const std::string& context,const std::string& certfile,const std::string& keyfile,const std::string& password,SSL_METHOD *meth_in) { - /* Create our context*/ - static std::map server_contexts; - if (server_contexts.find(context) == server_contexts.end()) - { - SSL_METHOD *meth = meth_in ? meth_in : SSLv3_method(); - m_ssl_ctx = server_contexts[context] = SSL_CTX_new(meth); - SSL_CTX_set_mode(m_ssl_ctx, SSL_MODE_AUTO_RETRY); - // session id - if (context.size()) - SSL_CTX_set_session_id_context(m_ssl_ctx, (const unsigned char *)context.c_str(), (unsigned int)context.size()); - else - SSL_CTX_set_session_id_context(m_ssl_ctx, (const unsigned char *)"--empty--", 9); - } - else - { - m_ssl_ctx = server_contexts[context]; - } + /* Create our context*/ + static std::map server_contexts; + if (server_contexts.find(context) == server_contexts.end()) + { + SSL_METHOD *meth = meth_in ? meth_in : SSLv3_method(); + m_ssl_ctx = server_contexts[context] = SSL_CTX_new(meth); + SSL_CTX_set_mode(m_ssl_ctx, SSL_MODE_AUTO_RETRY); + // session id + if (context.size()) + SSL_CTX_set_session_id_context(m_ssl_ctx, (const unsigned char *)context.c_str(), (unsigned int)context.size()); + else + SSL_CTX_set_session_id_context(m_ssl_ctx, (const unsigned char *)"--empty--", 9); + } + else + { + m_ssl_ctx = server_contexts[context]; + } - /* Load our keys and certificates*/ - if (!(SSL_CTX_use_certificate_file(m_ssl_ctx, certfile.c_str(), SSL_FILETYPE_PEM))) - { - Handler().LogError(this, "TcpSocket InitializeContext", 0, "Couldn't read certificate file " + keyfile, LOG_LEVEL_FATAL); - } + /* Load our keys and certificates*/ + if (!(SSL_CTX_use_certificate_file(m_ssl_ctx, certfile.c_str(), SSL_FILETYPE_PEM))) + { + Handler().LogError(this, "TcpSocket InitializeContext", 0, "Couldn't read certificate file " + keyfile, LOG_LEVEL_FATAL); + } - m_password = password; - SSL_CTX_set_default_passwd_cb(m_ssl_ctx, SSL_password_cb); - SSL_CTX_set_default_passwd_cb_userdata(m_ssl_ctx, this); - if (!(SSL_CTX_use_PrivateKey_file(m_ssl_ctx, keyfile.c_str(), SSL_FILETYPE_PEM))) - { - Handler().LogError(this, "TcpSocket InitializeContext", 0, "Couldn't read private key file " + keyfile, LOG_LEVEL_FATAL); - } + m_password = password; + SSL_CTX_set_default_passwd_cb(m_ssl_ctx, SSL_password_cb); + SSL_CTX_set_default_passwd_cb_userdata(m_ssl_ctx, this); + if (!(SSL_CTX_use_PrivateKey_file(m_ssl_ctx, keyfile.c_str(), SSL_FILETYPE_PEM))) + { + Handler().LogError(this, "TcpSocket InitializeContext", 0, "Couldn't read private key file " + keyfile, LOG_LEVEL_FATAL); + } } int TcpSocket::SSL_password_cb(char *buf,int num,int rwflag,void *userdata) { - Socket *p0 = static_cast(userdata); - TcpSocket *p = dynamic_cast(p0); - std::string pw = p ? p -> GetPassword() : ""; - if ( (size_t)num < pw.size() + 1) - { - return 0; - } - strcpy(buf,pw.c_str()); - return (int)pw.size(); + Socket *p0 = static_cast(userdata); + TcpSocket *p = dynamic_cast(p0); + std::string pw = p ? p -> GetPassword() : ""; + if ( (size_t)num < pw.size() + 1) + { + return 0; + } + strcpy(buf,pw.c_str()); + return (int)pw.size(); } #endif // HAVE_OPENSSL int TcpSocket::Close() { - if (GetSocket() == INVALID_SOCKET) // this could happen - { - Handler().LogError(this, "Socket::Close", 0, "file descriptor invalid", LOG_LEVEL_WARNING); - return 0; - } - int n; - SetNonblocking(true); - if (!Lost() && IsConnected() && !(GetShutdown() & SHUT_WR)) - { - if (shutdown(GetSocket(), SHUT_WR) == -1) - { - // failed... - Handler().LogError(this, "shutdown", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } - } - // - char tmp[1000]; - if (!Lost() && (n = recv(GetSocket(),tmp,1000,0)) >= 0) - { - if (n) - { - Handler().LogError(this, "read() after shutdown", n, "bytes read", LOG_LEVEL_WARNING); - } - } + if (GetSocket() == INVALID_SOCKET) // this could happen + { + Handler().LogError(this, "Socket::Close", 0, "file descriptor invalid", LOG_LEVEL_WARNING); + return 0; + } + int n; + SetNonblocking(true); + if (!Lost() && IsConnected() && !(GetShutdown() & SHUT_WR)) + { + if (shutdown(GetSocket(), SHUT_WR) == -1) + { + // failed... + Handler().LogError(this, "shutdown", Errno, StrError(Errno), LOG_LEVEL_ERROR); + } + } + // + char tmp[1000]; + if (!Lost() && (n = recv(GetSocket(),tmp,1000,0)) >= 0) + { + if (n) + { + Handler().LogError(this, "read() after shutdown", n, "bytes read", LOG_LEVEL_WARNING); + } + } #ifdef HAVE_OPENSSL - if (IsSSL() && m_ssl) - SSL_shutdown(m_ssl); - if (m_ssl) - { - SSL_free(m_ssl); - m_ssl = NULL; - } + if (IsSSL() && m_ssl) + SSL_shutdown(m_ssl); + if (m_ssl) + { + SSL_free(m_ssl); + m_ssl = NULL; + } #endif - return Socket::Close(); + return Socket::Close(); } #ifdef HAVE_OPENSSL SSL_CTX *TcpSocket::GetSslContext() { - if (!m_ssl_ctx) - Handler().LogError(this, "GetSslContext", 0, "SSL Context is NULL; check InitSSLServer/InitSSLClient", LOG_LEVEL_WARNING); - return m_ssl_ctx; + if (!m_ssl_ctx) + Handler().LogError(this, "GetSslContext", 0, "SSL Context is NULL; check InitSSLServer/InitSSLClient", LOG_LEVEL_WARNING); + return m_ssl_ctx; } SSL *TcpSocket::GetSsl() { - if (!m_ssl) - Handler().LogError(this, "GetSsl", 0, "SSL is NULL; check InitSSLServer/InitSSLClient", LOG_LEVEL_WARNING); - return m_ssl; + if (!m_ssl) + Handler().LogError(this, "GetSsl", 0, "SSL is NULL; check InitSSLServer/InitSSLClient", LOG_LEVEL_WARNING); + return m_ssl; } #endif @@ -1375,7 +1375,7 @@ SSL *TcpSocket::GetSsl() #ifdef ENABLE_RECONNECT void TcpSocket::SetReconnect(bool x) { - m_b_reconnect = x; + m_b_reconnect = x; } #endif @@ -1387,50 +1387,50 @@ void TcpSocket::OnRawData(const char *buf_in,size_t len) size_t TcpSocket::GetInputLength() { - return ibuf.GetLength(); + return ibuf.GetLength(); } size_t TcpSocket::GetOutputLength() { - return m_output_length; + return m_output_length; } uint64_t TcpSocket::GetBytesReceived(bool clear) { - uint64_t z = m_bytes_received; - if (clear) - m_bytes_received = 0; - return z; + uint64_t z = m_bytes_received; + if (clear) + m_bytes_received = 0; + return z; } uint64_t TcpSocket::GetBytesSent(bool clear) { - uint64_t z = m_bytes_sent; - if (clear) - m_bytes_sent = 0; - return z; + uint64_t z = m_bytes_sent; + if (clear) + m_bytes_sent = 0; + return z; } #ifdef ENABLE_RECONNECT bool TcpSocket::Reconnect() { - return m_b_reconnect; + return m_b_reconnect; } void TcpSocket::SetIsReconnect(bool x) { - m_b_is_reconnect = x; + m_b_is_reconnect = x; } bool TcpSocket::IsReconnect() { - return m_b_is_reconnect; + return m_b_is_reconnect; } #endif @@ -1438,48 +1438,48 @@ bool TcpSocket::IsReconnect() #ifdef HAVE_OPENSSL const std::string& TcpSocket::GetPassword() { - return m_password; + return m_password; } #endif void TcpSocket::DisableInputBuffer(bool x) { - m_b_input_buffer_disabled = x; + m_b_input_buffer_disabled = x; } void TcpSocket::OnOptions(int family,int type,int protocol,SOCKET s) { -DEB( fprintf(stderr, "Socket::OnOptions()\n");) +DEB( fprintf(stderr, "Socket::OnOptions()\n");) #ifdef SO_NOSIGPIPE - SetSoNosigpipe(true); + SetSoNosigpipe(true); #endif - SetSoReuseaddr(true); - SetSoKeepalive(true); + SetSoReuseaddr(true); + SetSoKeepalive(true); } void TcpSocket::SetLineProtocol(bool x) { - StreamSocket::SetLineProtocol(x); - DisableInputBuffer(x); + StreamSocket::SetLineProtocol(x); + DisableInputBuffer(x); } bool TcpSocket::SetTcpNodelay(bool x) { #ifdef TCP_NODELAY - int optval = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_TCP, TCP_NODELAY, (char *)&optval, sizeof(optval)) == -1) - { - Handler().LogError(this, "setsockopt(IPPROTO_TCP, TCP_NODELAY)", Errno, StrError(Errno), LOG_LEVEL_FATAL); - return false; - } - return true; + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_TCP, TCP_NODELAY, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_TCP, TCP_NODELAY)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; #else - Handler().LogError(this, "socket option not available", 0, "TCP_NODELAY", LOG_LEVEL_INFO); - return false; + Handler().LogError(this, "socket option not available", 0, "TCP_NODELAY", LOG_LEVEL_INFO); + return false; #endif } @@ -1497,73 +1497,73 @@ TcpSocket::CircularBuffer::CircularBuffer(size_t size) TcpSocket::CircularBuffer::~CircularBuffer() { - delete[] buf; + delete[] buf; } bool TcpSocket::CircularBuffer::Write(const char *s,size_t l) { - if (m_q + l > m_max) - { - return false; // overflow - } - m_count += (unsigned long)l; - if (m_t + l > m_max) // block crosses circular border - { - size_t l1 = m_max - m_t; // size left until circular border crossing - // always copy full block to buffer(buf) + top pointer(m_t) - // because we have doubled the buffer size for performance reasons - memcpy(buf + m_t, s, l); - memcpy(buf, s + l1, l - l1); - m_t = l - l1; - m_q += l; - } - else - { - memcpy(buf + m_t, s, l); - memcpy(buf + m_max + m_t, s, l); - m_t += l; - if (m_t >= m_max) - m_t -= m_max; - m_q += l; - } - return true; + if (m_q + l > m_max) + { + return false; // overflow + } + m_count += (unsigned long)l; + if (m_t + l > m_max) // block crosses circular border + { + size_t l1 = m_max - m_t; // size left until circular border crossing + // always copy full block to buffer(buf) + top pointer(m_t) + // because we have doubled the buffer size for performance reasons + memcpy(buf + m_t, s, l); + memcpy(buf, s + l1, l - l1); + m_t = l - l1; + m_q += l; + } + else + { + memcpy(buf + m_t, s, l); + memcpy(buf + m_max + m_t, s, l); + m_t += l; + if (m_t >= m_max) + m_t -= m_max; + m_q += l; + } + return true; } bool TcpSocket::CircularBuffer::Read(char *s,size_t l) { - if (l > m_q) - { - return false; // not enough chars - } - if (m_b + l > m_max) // block crosses circular border - { - size_t l1 = m_max - m_b; - if (s) - { - memcpy(s, buf + m_b, l1); - memcpy(s + l1, buf, l - l1); - } - m_b = l - l1; - m_q -= l; - } - else - { - if (s) - { - memcpy(s, buf + m_b, l); - } - m_b += l; - if (m_b >= m_max) - m_b -= m_max; - m_q -= l; - } - if (!m_q) - { - m_b = m_t = 0; - } - return true; + if (l > m_q) + { + return false; // not enough chars + } + if (m_b + l > m_max) // block crosses circular border + { + size_t l1 = m_max - m_b; + if (s) + { + memcpy(s, buf + m_b, l1); + memcpy(s + l1, buf, l - l1); + } + m_b = l - l1; + m_q -= l; + } + else + { + if (s) + { + memcpy(s, buf + m_b, l); + } + m_b += l; + if (m_b >= m_max) + m_b -= m_max; + m_q -= l; + } + if (!m_q) + { + m_b = m_t = 0; + } + return true; } bool TcpSocket::CircularBuffer::SoftRead(char *s, size_t l) @@ -1593,144 +1593,144 @@ bool TcpSocket::CircularBuffer::SoftRead(char *s, size_t l) bool TcpSocket::CircularBuffer::Remove(size_t l) { - return Read(NULL, l); + return Read(NULL, l); } size_t TcpSocket::CircularBuffer::GetLength() { - return m_q; + return m_q; } const char *TcpSocket::CircularBuffer::GetStart() { - return buf + m_b; + return buf + m_b; } size_t TcpSocket::CircularBuffer::GetL() { - return (m_b + m_q > m_max) ? m_max - m_b : m_q; + return (m_b + m_q > m_max) ? m_max - m_b : m_q; } size_t TcpSocket::CircularBuffer::Space() { - return m_max - m_q; + return m_max - m_q; } unsigned long TcpSocket::CircularBuffer::ByteCounter(bool clear) { - if (clear) - { - unsigned long x = m_count; - m_count = 0; - return x; - } - return m_count; + if (clear) + { + unsigned long x = m_count; + m_count = 0; + return x; + } + return m_count; } std::string TcpSocket::CircularBuffer::ReadString(size_t l) { - char *sz = new char[l + 1]; - if (!Read(sz, l)) // failed, debug printout in Read() method - { - delete[] sz; - return ""; - } - sz[l] = 0; - std::string tmp = sz; - delete[] sz; - return tmp; + char *sz = new char[l + 1]; + if (!Read(sz, l)) // failed, debug printout in Read() method + { + delete[] sz; + return ""; + } + sz[l] = 0; + std::string tmp = sz; + delete[] sz; + return tmp; } void TcpSocket::OnConnectTimeout() { - Handler().LogError(this, "connect", -1, "connect timeout", LOG_LEVEL_FATAL); + Handler().LogError(this, "connect", -1, "connect timeout", LOG_LEVEL_FATAL); #ifdef ENABLE_SOCKS4 - if (Socks4()) - { - OnSocks4ConnectFailed(); - // retry direct connection - } - else + if (Socks4()) + { + OnSocks4ConnectFailed(); + // retry direct connection + } + else #endif - if (GetConnectionRetry() == -1 || - (GetConnectionRetry() && GetConnectionRetries() < GetConnectionRetry()) ) - { - IncreaseConnectionRetries(); - // ask socket via OnConnectRetry callback if we should continue trying - if (OnConnectRetry()) - { - SetRetryClientConnect(); - } - else - { - SetCloseAndDelete( true ); - /// \todo state reason why connect failed - OnConnectFailed(); - } - } - else - { - SetCloseAndDelete(true); - /// \todo state reason why connect failed - OnConnectFailed(); - } - // - SetConnecting(false); + if (GetConnectionRetry() == -1 || + (GetConnectionRetry() && GetConnectionRetries() < GetConnectionRetry()) ) + { + IncreaseConnectionRetries(); + // ask socket via OnConnectRetry callback if we should continue trying + if (OnConnectRetry()) + { + SetRetryClientConnect(); + } + else + { + SetCloseAndDelete( true ); + /// \todo state reason why connect failed + OnConnectFailed(); + } + } + else + { + SetCloseAndDelete(true); + /// \todo state reason why connect failed + OnConnectFailed(); + } + // + SetConnecting(false); } #ifdef _WIN32 void TcpSocket::OnException() { - if (Connecting()) - { + if (Connecting()) + { #ifdef ENABLE_SOCKS4 - if (Socks4()) - OnSocks4ConnectFailed(); - else + if (Socks4()) + OnSocks4ConnectFailed(); + else #endif - if (GetConnectionRetry() == -1 || - (GetConnectionRetry() && - GetConnectionRetries() < GetConnectionRetry() )) - { - // even though the connection failed at once, only retry after - // the connection timeout - // should we even try to connect again, when CheckConnect returns - // false it's because of a connection error - not a timeout... - } - else - { - SetConnecting(false); // tnx snibbe - SetCloseAndDelete(); - OnConnectFailed(); - } - return; - } - // %! exception doesn't always mean something bad happened, this code should be reworked - // errno valid here? - int err = SoError(); - Handler().LogError(this, "exception on select", err, StrError(err), LOG_LEVEL_FATAL); - SetCloseAndDelete(); + if (GetConnectionRetry() == -1 || + (GetConnectionRetry() && + GetConnectionRetries() < GetConnectionRetry() )) + { + // even though the connection failed at once, only retry after + // the connection timeout + // should we even try to connect again, when CheckConnect returns + // false it's because of a connection error - not a timeout... + } + else + { + SetConnecting(false); // tnx snibbe + SetCloseAndDelete(); + OnConnectFailed(); + } + return; + } + // %! exception doesn't always mean something bad happened, this code should be reworked + // errno valid here? + int err = SoError(); + Handler().LogError(this, "exception on select", err, StrError(err), LOG_LEVEL_FATAL); + SetCloseAndDelete(); } #endif // _WIN32 int TcpSocket::Protocol() { - return IPPROTO_TCP; + return IPPROTO_TCP; } void TcpSocket::SetTransferLimit(size_t sz) { - m_transfer_limit = sz; + m_transfer_limit = sz; } diff --git a/dep/src/sockets/Thread.cpp b/dep/src/sockets/Thread.cpp index 2717e32d016..e1834ab4a87 100644 --- a/dep/src/sockets/Thread.cpp +++ b/dep/src/sockets/Thread.cpp @@ -1,6 +1,6 @@ /** \file Thread.cpp - ** \date 2004-10-30 - ** \author grymse@alhem.net + ** \date 2004-10-30 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -51,111 +51,111 @@ Thread::Thread(bool release) ,m_b_destructor(false) { #ifdef _WIN32 -// m_thread = ::CreateThread(NULL, 0, StartThread, this, 0, &m_dwThreadId); - m_thread = (HANDLE)_beginthreadex(NULL, 0, &StartThread, this, 0, &m_dwThreadId); +// m_thread = ::CreateThread(NULL, 0, StartThread, this, 0, &m_dwThreadId); + m_thread = (HANDLE)_beginthreadex(NULL, 0, &StartThread, this, 0, &m_dwThreadId); #else - pthread_attr_t attr; + pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED); - if (pthread_create(&m_thread,&attr, StartThread,this) == -1) - { - perror("Thread: create failed"); - SetRunning(false); - } -// pthread_attr_destroy(&attr); + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED); + if (pthread_create(&m_thread,&attr, StartThread,this) == -1) + { + perror("Thread: create failed"); + SetRunning(false); + } +// pthread_attr_destroy(&attr); #endif - m_release = release; + m_release = release; } Thread::~Thread() { - m_b_destructor = true; - if (m_running) - { - SetRelease(true); - SetRunning(false); + m_b_destructor = true; + if (m_running) + { + SetRelease(true); + SetRunning(false); #ifdef _WIN32 - Sleep(1000); + Sleep(1000); #else - sleep(1); + sleep(1); #endif - } + } #ifdef _WIN32 - if (m_thread) - ::CloseHandle(m_thread); + if (m_thread) + ::CloseHandle(m_thread); #endif } threadfunc_t STDPREFIX Thread::StartThread(threadparam_t zz) { - Thread *p = (Thread *)zz; + Thread *p = (Thread *)zz; - while (p -> m_running && !p -> m_release) - { + while (p -> m_running && !p -> m_release) + { #ifdef _WIN32 - Sleep(1000); + Sleep(1000); #else - sleep(1); + sleep(1); #endif - } - if (p -> m_running) - { - p -> Run(); - } - p -> SetRunning(false); // if return - if (p -> DeleteOnExit() && !p -> IsDestructor()) - { - delete p; - } + } + if (p -> m_running) + { + p -> Run(); + } + p -> SetRunning(false); // if return + if (p -> DeleteOnExit() && !p -> IsDestructor()) + { + delete p; + } #ifdef _WIN32 - _endthreadex(0); + _endthreadex(0); #endif - return (threadfunc_t)NULL; + return (threadfunc_t)NULL; } bool Thread::IsRunning() { - return m_running; + return m_running; } void Thread::SetRunning(bool x) { - m_running = x; + m_running = x; } bool Thread::IsReleased() { - return m_release; + return m_release; } void Thread::SetRelease(bool x) { - m_release = x; + m_release = x; } bool Thread::DeleteOnExit() { - return m_b_delete_on_exit; + return m_b_delete_on_exit; } void Thread::SetDeleteOnExit(bool x) { - m_b_delete_on_exit = x; + m_b_delete_on_exit = x; } bool Thread::IsDestructor() { - return m_b_destructor; + return m_b_destructor; } diff --git a/dep/src/sockets/UdpSocket.cpp b/dep/src/sockets/UdpSocket.cpp index 5d949496b25..229a26414e5 100644 --- a/dep/src/sockets/UdpSocket.cpp +++ b/dep/src/sockets/UdpSocket.cpp @@ -1,6 +1,6 @@ /** \file UdpSocket.cpp - ** \date 2004-02-13 - ** \author grymse@alhem.net + ** \date 2004-02-13 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -64,7 +64,7 @@ UdpSocket::UdpSocket(ISocketHandler& h, int ibufsz, bool ipv6, int retries) : So { #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - SetIpv6(ipv6); + SetIpv6(ipv6); #endif #endif } @@ -72,8 +72,8 @@ UdpSocket::UdpSocket(ISocketHandler& h, int ibufsz, bool ipv6, int retries) : So UdpSocket::~UdpSocket() { - Close(); - delete[] m_ibuf; + Close(); + delete[] m_ibuf; } @@ -81,15 +81,15 @@ int UdpSocket::Bind(port_t &port, int range) { #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(port); - return Bind(ad, range); - } + if (IsIpv6()) + { + Ipv6Address ad(port); + return Bind(ad, range); + } #endif #endif - Ipv4Address ad(port); - return Bind(ad, range); + Ipv4Address ad(port); + return Bind(ad, range); } @@ -97,32 +97,32 @@ int UdpSocket::Bind(const std::string& intf, port_t &port, int range) { #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(intf, port); - if (ad.IsValid()) - { - return Bind(ad, range); - } - SetCloseAndDelete(); - return -1; - } + if (IsIpv6()) + { + Ipv6Address ad(intf, port); + if (ad.IsValid()) + { + return Bind(ad, range); + } + SetCloseAndDelete(); + return -1; + } #endif #endif - Ipv4Address ad(intf, port); - if (ad.IsValid()) - { - return Bind(ad, range); - } - SetCloseAndDelete(); - return -1; + Ipv4Address ad(intf, port); + if (ad.IsValid()) + { + return Bind(ad, range); + } + SetCloseAndDelete(); + return -1; } int UdpSocket::Bind(ipaddr_t a, port_t &port, int range) { - Ipv4Address ad(a, port); - return Bind(ad, range); + Ipv4Address ad(a, port); + return Bind(ad, range); } @@ -130,8 +130,8 @@ int UdpSocket::Bind(ipaddr_t a, port_t &port, int range) #ifdef IPPROTO_IPV6 int UdpSocket::Bind(in6_addr a, port_t &port, int range) { - Ipv6Address ad(a, port); - return Bind(ad, range); + Ipv6Address ad(a, port); + return Bind(ad, range); } #endif #endif @@ -139,42 +139,42 @@ int UdpSocket::Bind(in6_addr a, port_t &port, int range) int UdpSocket::Bind(SocketAddress& ad, int range) { - if (GetSocket() == INVALID_SOCKET) - { - Attach(CreateSocket(ad.GetFamily(), SOCK_DGRAM, "udp")); - } - if (GetSocket() != INVALID_SOCKET) - { - SetNonblocking(true); - int n = bind(GetSocket(), ad, ad); - int tries = range; - while (n == -1 && tries--) - { - ad.SetPort(ad.GetPort() + 1); - n = bind(GetSocket(), ad, ad); - } - if (n == -1) - { - Handler().LogError(this, "bind", Errno, StrError(Errno), LOG_LEVEL_FATAL); - SetCloseAndDelete(); + if (GetSocket() == INVALID_SOCKET) + { + Attach(CreateSocket(ad.GetFamily(), SOCK_DGRAM, "udp")); + } + if (GetSocket() != INVALID_SOCKET) + { + SetNonblocking(true); + int n = bind(GetSocket(), ad, ad); + int tries = range; + while (n == -1 && tries--) + { + ad.SetPort(ad.GetPort() + 1); + n = bind(GetSocket(), ad, ad); + } + if (n == -1) + { + Handler().LogError(this, "bind", Errno, StrError(Errno), LOG_LEVEL_FATAL); + SetCloseAndDelete(); #ifdef ENABLE_EXCEPTIONS - throw Exception("bind() failed for UdpSocket, port:range: " + Utility::l2string(ad.GetPort()) + ":" + Utility::l2string(range)); + throw Exception("bind() failed for UdpSocket, port:range: " + Utility::l2string(ad.GetPort()) + ":" + Utility::l2string(range)); #endif - return -1; - } - m_bind_ok = true; - m_port = ad.GetPort(); - return 0; - } - return -1; + return -1; + } + m_bind_ok = true; + m_port = ad.GetPort(); + return 0; + } + return -1; } /** if you wish to use Send, first Open a connection */ bool UdpSocket::Open(ipaddr_t l, port_t port) { - Ipv4Address ad(l, port); - return Open(ad); + Ipv4Address ad(l, port); + return Open(ad); } @@ -182,23 +182,23 @@ bool UdpSocket::Open(const std::string& host, port_t port) { #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(host, port); - if (ad.IsValid()) - { - return Open(ad); - } - return false; - } + if (IsIpv6()) + { + Ipv6Address ad(host, port); + if (ad.IsValid()) + { + return Open(ad); + } + return false; + } #endif #endif - Ipv4Address ad(host, port); - if (ad.IsValid()) - { - return Open(ad); - } - return false; + Ipv4Address ad(host, port); + if (ad.IsValid()) + { + return Open(ad); + } + return false; } @@ -206,8 +206,8 @@ bool UdpSocket::Open(const std::string& host, port_t port) #ifdef IPPROTO_IPV6 bool UdpSocket::Open(struct in6_addr& a, port_t port) { - Ipv6Address ad(a, port); - return Open(ad); + Ipv6Address ad(a, port); + return Open(ad); } #endif #endif @@ -215,23 +215,23 @@ bool UdpSocket::Open(struct in6_addr& a, port_t port) bool UdpSocket::Open(SocketAddress& ad) { - if (GetSocket() == INVALID_SOCKET) - { - Attach(CreateSocket(ad.GetFamily(), SOCK_DGRAM, "udp")); - } - if (GetSocket() != INVALID_SOCKET) - { - SetNonblocking(true); - if (connect(GetSocket(), ad, ad) == -1) - { - Handler().LogError(this, "connect", Errno, StrError(Errno), LOG_LEVEL_FATAL); - SetCloseAndDelete(); - return false; - } - SetConnected(); - return true; - } - return false; + if (GetSocket() == INVALID_SOCKET) + { + Attach(CreateSocket(ad.GetFamily(), SOCK_DGRAM, "udp")); + } + if (GetSocket() != INVALID_SOCKET) + { + SetNonblocking(true); + if (connect(GetSocket(), ad, ad) == -1) + { + Handler().LogError(this, "connect", Errno, StrError(Errno), LOG_LEVEL_FATAL); + SetCloseAndDelete(); + return false; + } + SetConnected(); + return true; + } + return false; } @@ -239,32 +239,32 @@ void UdpSocket::CreateConnection() { #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - if (GetSocket() == INVALID_SOCKET) - { - SOCKET s = CreateSocket(AF_INET6, SOCK_DGRAM, "udp"); - if (s == INVALID_SOCKET) - { - return; - } - SetNonblocking(true, s); - Attach(s); - } - return; - } + if (IsIpv6()) + { + if (GetSocket() == INVALID_SOCKET) + { + SOCKET s = CreateSocket(AF_INET6, SOCK_DGRAM, "udp"); + if (s == INVALID_SOCKET) + { + return; + } + SetNonblocking(true, s); + Attach(s); + } + return; + } #endif #endif - if (GetSocket() == INVALID_SOCKET) - { - SOCKET s = CreateSocket(AF_INET, SOCK_DGRAM, "udp"); - if (s == INVALID_SOCKET) - { - return; - } - SetNonblocking(true, s); - Attach(s); - } + if (GetSocket() == INVALID_SOCKET) + { + SOCKET s = CreateSocket(AF_INET, SOCK_DGRAM, "udp"); + if (s == INVALID_SOCKET) + { + return; + } + SetNonblocking(true, s); + Attach(s); + } } @@ -273,30 +273,30 @@ void UdpSocket::SendToBuf(const std::string& h, port_t p, const char *data, int { #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - Ipv6Address ad(h, p); - if (ad.IsValid()) - { - SendToBuf(ad, data, len, flags); - } - return; - } + if (IsIpv6()) + { + Ipv6Address ad(h, p); + if (ad.IsValid()) + { + SendToBuf(ad, data, len, flags); + } + return; + } #endif #endif - Ipv4Address ad(h, p); - if (ad.IsValid()) - { - SendToBuf(ad, data, len, flags); - } + Ipv4Address ad(h, p); + if (ad.IsValid()) + { + SendToBuf(ad, data, len, flags); + } } /** send to specified address */ void UdpSocket::SendToBuf(ipaddr_t a, port_t p, const char *data, int len, int flags) { - Ipv4Address ad(a, p); - SendToBuf(ad, data, len, flags); + Ipv4Address ad(a, p); + SendToBuf(ad, data, len, flags); } @@ -304,8 +304,8 @@ void UdpSocket::SendToBuf(ipaddr_t a, port_t p, const char *data, int len, int f #ifdef IPPROTO_IPV6 void UdpSocket::SendToBuf(in6_addr a, port_t p, const char *data, int len, int flags) { - Ipv6Address ad(a, p); - SendToBuf(ad, data, len, flags); + Ipv6Address ad(a, p); + SendToBuf(ad, data, len, flags); } #endif #endif @@ -313,30 +313,30 @@ void UdpSocket::SendToBuf(in6_addr a, port_t p, const char *data, int len, int f void UdpSocket::SendToBuf(SocketAddress& ad, const char *data, int len, int flags) { - if (GetSocket() == INVALID_SOCKET) - { - Attach(CreateSocket(ad.GetFamily(), SOCK_DGRAM, "udp")); - } - if (GetSocket() != INVALID_SOCKET) - { - SetNonblocking(true); - if ((m_last_size_written = sendto(GetSocket(), data, len, flags, ad, ad)) == -1) - { - Handler().LogError(this, "sendto", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } - } + if (GetSocket() == INVALID_SOCKET) + { + Attach(CreateSocket(ad.GetFamily(), SOCK_DGRAM, "udp")); + } + if (GetSocket() != INVALID_SOCKET) + { + SetNonblocking(true); + if ((m_last_size_written = sendto(GetSocket(), data, len, flags, ad, ad)) == -1) + { + Handler().LogError(this, "sendto", Errno, StrError(Errno), LOG_LEVEL_ERROR); + } + } } void UdpSocket::SendTo(const std::string& a, port_t p, const std::string& str, int flags) { - SendToBuf(a, p, str.c_str(), (int)str.size(), flags); + SendToBuf(a, p, str.c_str(), (int)str.size(), flags); } void UdpSocket::SendTo(ipaddr_t a, port_t p, const std::string& str, int flags) { - SendToBuf(a, p, str.c_str(), (int)str.size(), flags); + SendToBuf(a, p, str.c_str(), (int)str.size(), flags); } @@ -344,7 +344,7 @@ void UdpSocket::SendTo(ipaddr_t a, port_t p, const std::string& str, int flags) #ifdef IPPROTO_IPV6 void UdpSocket::SendTo(in6_addr a, port_t p, const std::string& str, int flags) { - SendToBuf(a, p, str.c_str(), (int)str.size(), flags); + SendToBuf(a, p, str.c_str(), (int)str.size(), flags); } #endif #endif @@ -352,93 +352,93 @@ void UdpSocket::SendTo(in6_addr a, port_t p, const std::string& str, int flags) void UdpSocket::SendTo(SocketAddress& ad, const std::string& str, int flags) { - SendToBuf(ad, str.c_str(), (int)str.size(), flags); + SendToBuf(ad, str.c_str(), (int)str.size(), flags); } /** send to connected address */ void UdpSocket::SendBuf(const char *data, size_t len, int flags) { - if (!IsConnected()) - { - Handler().LogError(this, "SendBuf", 0, "not connected", LOG_LEVEL_ERROR); - return; - } - if ((m_last_size_written = send(GetSocket(), data, (int)len, flags)) == -1) - { - Handler().LogError(this, "send", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } + if (!IsConnected()) + { + Handler().LogError(this, "SendBuf", 0, "not connected", LOG_LEVEL_ERROR); + return; + } + if ((m_last_size_written = send(GetSocket(), data, (int)len, flags)) == -1) + { + Handler().LogError(this, "send", Errno, StrError(Errno), LOG_LEVEL_ERROR); + } } void UdpSocket::Send(const std::string& str, int flags) { - SendBuf(str.c_str(), (int)str.size(), flags); + SendBuf(str.c_str(), (int)str.size(), flags); } #if defined(LINUX) || defined(MACOSX) int UdpSocket::ReadTS(char *ioBuf, int inBufSize, struct sockaddr *from, socklen_t fromlen, struct timeval *ts) { - struct msghdr msg; - struct iovec vec[1]; - union { - struct cmsghdr cm; + struct msghdr msg; + struct iovec vec[1]; + union { + struct cmsghdr cm; #ifdef MACOSX #ifdef __DARWIN_UNIX03 #define ALIGNBYTES __DARWIN_ALIGNBYTES #endif #define myALIGN(p) (((unsigned int)(p) + ALIGNBYTES) &~ ALIGNBYTES) #define myCMSG_SPACE(l) (myALIGN(sizeof(struct cmsghdr)) + myALIGN(l)) - char data[ myCMSG_SPACE(sizeof(struct timeval)) ]; + char data[ myCMSG_SPACE(sizeof(struct timeval)) ]; #else - char data[ CMSG_SPACE(sizeof(struct timeval)) ]; + char data[ CMSG_SPACE(sizeof(struct timeval)) ]; #endif - } cmsg_un; - struct cmsghdr *cmsg; - struct timeval *tv; + } cmsg_un; + struct cmsghdr *cmsg; + struct timeval *tv; - vec[0].iov_base = ioBuf; - vec[0].iov_len = inBufSize; + vec[0].iov_base = ioBuf; + vec[0].iov_len = inBufSize; - memset(&msg, 0, sizeof(msg)); - memset(from, 0, fromlen); - memset(ioBuf, 0, inBufSize); - memset(&cmsg_un, 0, sizeof(cmsg_un)); + memset(&msg, 0, sizeof(msg)); + memset(from, 0, fromlen); + memset(ioBuf, 0, inBufSize); + memset(&cmsg_un, 0, sizeof(cmsg_un)); - msg.msg_name = (caddr_t)from; - msg.msg_namelen = fromlen; - msg.msg_iov = vec; - msg.msg_iovlen = 1; - msg.msg_control = cmsg_un.data; - msg.msg_controllen = sizeof(cmsg_un.data); - msg.msg_flags = 0; + msg.msg_name = (caddr_t)from; + msg.msg_namelen = fromlen; + msg.msg_iov = vec; + msg.msg_iovlen = 1; + msg.msg_control = cmsg_un.data; + msg.msg_controllen = sizeof(cmsg_un.data); + msg.msg_flags = 0; - // Original version - for reference only - //int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); + // Original version - for reference only + //int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); - int n = recvmsg(GetSocket(), &msg, MSG_DONTWAIT); + int n = recvmsg(GetSocket(), &msg, MSG_DONTWAIT); - // now ioBuf will contain the data, as if we used recvfrom + // now ioBuf will contain the data, as if we used recvfrom - // Now get the time - if(n != -1 && msg.msg_controllen >= sizeof(struct cmsghdr) && !(msg.msg_flags & MSG_CTRUNC)) - { - tv = 0; - for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) - { - if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_TIMESTAMP) - { - tv = (struct timeval *)CMSG_DATA(cmsg); - } - } - if (tv) - { - memcpy(ts, tv, sizeof(struct timeval)); - } - } - // The address is in network order, but that's OK right now - return n; + // Now get the time + if(n != -1 && msg.msg_controllen >= sizeof(struct cmsghdr) && !(msg.msg_flags & MSG_CTRUNC)) + { + tv = 0; + for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) + { + if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_TIMESTAMP) + { + tv = (struct timeval *)CMSG_DATA(cmsg); + } + } + if (tv) + { + memcpy(ts, tv, sizeof(struct timeval)); + } + } + // The address is in network order, but that's OK right now + return n; } #endif @@ -447,324 +447,324 @@ void UdpSocket::OnRead() { #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - struct sockaddr_in6 sa; - socklen_t sa_len = sizeof(sa); - if (m_b_read_ts) - { - struct timeval ts; - Utility::GetTime(&ts); + if (IsIpv6()) + { + struct sockaddr_in6 sa; + socklen_t sa_len = sizeof(sa); + if (m_b_read_ts) + { + struct timeval ts; + Utility::GetTime(&ts); #if !defined(LINUX) && !defined(MACOSX) - int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); + int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); #else - int n = ReadTS(m_ibuf, m_ibufsz, (struct sockaddr *)&sa, sa_len, &ts); + int n = ReadTS(m_ibuf, m_ibufsz, (struct sockaddr *)&sa, sa_len, &ts); #endif - if (n > 0) - { - this -> OnRawData(m_ibuf, n, (struct sockaddr *)&sa, sa_len, &ts); - } - else - if (n == -1) - { + if (n > 0) + { + this -> OnRawData(m_ibuf, n, (struct sockaddr *)&sa, sa_len, &ts); + } + else + if (n == -1) + { #ifdef _WIN32 - if (Errno != WSAEWOULDBLOCK) + if (Errno != WSAEWOULDBLOCK) #else - if (Errno != EWOULDBLOCK) + if (Errno != EWOULDBLOCK) #endif - Handler().LogError(this, "recvfrom", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } - return; - } - int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); - int q = m_retries; // receive max 10 at one cycle - while (n > 0) - { - if (sa_len != sizeof(sa)) - { - Handler().LogError(this, "recvfrom", 0, "unexpected address struct size", LOG_LEVEL_WARNING); - } - this -> OnRawData(m_ibuf, n, (struct sockaddr *)&sa, sa_len); - if (!q--) - break; - // - n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); - } - if (n == -1) - { + Handler().LogError(this, "recvfrom", Errno, StrError(Errno), LOG_LEVEL_ERROR); + } + return; + } + int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); + int q = m_retries; // receive max 10 at one cycle + while (n > 0) + { + if (sa_len != sizeof(sa)) + { + Handler().LogError(this, "recvfrom", 0, "unexpected address struct size", LOG_LEVEL_WARNING); + } + this -> OnRawData(m_ibuf, n, (struct sockaddr *)&sa, sa_len); + if (!q--) + break; + // + n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); + } + if (n == -1) + { #ifdef _WIN32 - if (Errno != WSAEWOULDBLOCK) + if (Errno != WSAEWOULDBLOCK) #else - if (Errno != EWOULDBLOCK) + if (Errno != EWOULDBLOCK) #endif - Handler().LogError(this, "recvfrom", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } - return; - } + Handler().LogError(this, "recvfrom", Errno, StrError(Errno), LOG_LEVEL_ERROR); + } + return; + } #endif #endif - struct sockaddr_in sa; - socklen_t sa_len = sizeof(sa); - if (m_b_read_ts) - { - struct timeval ts; - Utility::GetTime(&ts); + struct sockaddr_in sa; + socklen_t sa_len = sizeof(sa); + if (m_b_read_ts) + { + struct timeval ts; + Utility::GetTime(&ts); #if !defined(LINUX) && !defined(MACOSX) - int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); + int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); #else - int n = ReadTS(m_ibuf, m_ibufsz, (struct sockaddr *)&sa, sa_len, &ts); + int n = ReadTS(m_ibuf, m_ibufsz, (struct sockaddr *)&sa, sa_len, &ts); #endif - if (n > 0) - { - this -> OnRawData(m_ibuf, n, (struct sockaddr *)&sa, sa_len, &ts); - } - else - if (n == -1) - { + if (n > 0) + { + this -> OnRawData(m_ibuf, n, (struct sockaddr *)&sa, sa_len, &ts); + } + else + if (n == -1) + { #ifdef _WIN32 - if (Errno != WSAEWOULDBLOCK) + if (Errno != WSAEWOULDBLOCK) #else - if (Errno != EWOULDBLOCK) + if (Errno != EWOULDBLOCK) #endif - Handler().LogError(this, "recvfrom", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } - return; - } - int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); - int q = m_retries; - while (n > 0) - { - if (sa_len != sizeof(sa)) - { - Handler().LogError(this, "recvfrom", 0, "unexpected address struct size", LOG_LEVEL_WARNING); - } - this -> OnRawData(m_ibuf, n, (struct sockaddr *)&sa, sa_len); - if (!q--) - break; - // - n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); - } - if (n == -1) - { + Handler().LogError(this, "recvfrom", Errno, StrError(Errno), LOG_LEVEL_ERROR); + } + return; + } + int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); + int q = m_retries; + while (n > 0) + { + if (sa_len != sizeof(sa)) + { + Handler().LogError(this, "recvfrom", 0, "unexpected address struct size", LOG_LEVEL_WARNING); + } + this -> OnRawData(m_ibuf, n, (struct sockaddr *)&sa, sa_len); + if (!q--) + break; + // + n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); + } + if (n == -1) + { #ifdef _WIN32 - if (Errno != WSAEWOULDBLOCK) + if (Errno != WSAEWOULDBLOCK) #else - if (Errno != EWOULDBLOCK) + if (Errno != EWOULDBLOCK) #endif - Handler().LogError(this, "recvfrom", Errno, StrError(Errno), LOG_LEVEL_ERROR); - } + Handler().LogError(this, "recvfrom", Errno, StrError(Errno), LOG_LEVEL_ERROR); + } } void UdpSocket::SetBroadcast(bool b) { - int one = 1; - int zero = 0; + int one = 1; + int zero = 0; - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } - if (b) - { - if (setsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *) &one, sizeof(one)) == -1) - { - Handler().LogError(this, "SetBroadcast", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - } - else - { - if (setsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *) &zero, sizeof(zero)) == -1) - { - Handler().LogError(this, "SetBroadcast", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - } + if (GetSocket() == INVALID_SOCKET) + { + CreateConnection(); + } + if (b) + { + if (setsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *) &one, sizeof(one)) == -1) + { + Handler().LogError(this, "SetBroadcast", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + } + else + { + if (setsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *) &zero, sizeof(zero)) == -1) + { + Handler().LogError(this, "SetBroadcast", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + } } bool UdpSocket::IsBroadcast() { - int is_broadcast = 0; - socklen_t size; + int is_broadcast = 0; + socklen_t size; - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } - if (getsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *)&is_broadcast, &size) == -1) - { - Handler().LogError(this, "IsBroadcast", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - return is_broadcast != 0; + if (GetSocket() == INVALID_SOCKET) + { + CreateConnection(); + } + if (getsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *)&is_broadcast, &size) == -1) + { + Handler().LogError(this, "IsBroadcast", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + return is_broadcast != 0; } void UdpSocket::SetMulticastTTL(int ttl) { - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } - if (setsockopt(GetSocket(), SOL_IP, IP_MULTICAST_TTL, (char *)&ttl, sizeof(int)) == -1) - { - Handler().LogError(this, "SetMulticastTTL", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } + if (GetSocket() == INVALID_SOCKET) + { + CreateConnection(); + } + if (setsockopt(GetSocket(), SOL_IP, IP_MULTICAST_TTL, (char *)&ttl, sizeof(int)) == -1) + { + Handler().LogError(this, "SetMulticastTTL", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } } int UdpSocket::GetMulticastTTL() { - int ttl = 0; - socklen_t size = sizeof(int); + int ttl = 0; + socklen_t size = sizeof(int); - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } - if (getsockopt(GetSocket(), SOL_IP, IP_MULTICAST_TTL, (char *)&ttl, &size) == -1) - { - Handler().LogError(this, "GetMulticastTTL", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - return ttl; + if (GetSocket() == INVALID_SOCKET) + { + CreateConnection(); + } + if (getsockopt(GetSocket(), SOL_IP, IP_MULTICAST_TTL, (char *)&ttl, &size) == -1) + { + Handler().LogError(this, "GetMulticastTTL", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + return ttl; } void UdpSocket::SetMulticastLoop(bool x) { - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } + if (GetSocket() == INVALID_SOCKET) + { + CreateConnection(); + } #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - int val = x ? 1 : 0; - if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (char *)&val, sizeof(int)) == -1) - { - Handler().LogError(this, "SetMulticastLoop", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - return; - } + if (IsIpv6()) + { + int val = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (char *)&val, sizeof(int)) == -1) + { + Handler().LogError(this, "SetMulticastLoop", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + return; + } #endif #endif - int val = x ? 1 : 0; - if (setsockopt(GetSocket(), SOL_IP, IP_MULTICAST_LOOP, (char *)&val, sizeof(int)) == -1) - { - Handler().LogError(this, "SetMulticastLoop", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } + int val = x ? 1 : 0; + if (setsockopt(GetSocket(), SOL_IP, IP_MULTICAST_LOOP, (char *)&val, sizeof(int)) == -1) + { + Handler().LogError(this, "SetMulticastLoop", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } } bool UdpSocket::IsMulticastLoop() { - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } + if (GetSocket() == INVALID_SOCKET) + { + CreateConnection(); + } #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - int is_loop = 0; - socklen_t size = sizeof(int); - if (getsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (char *)&is_loop, &size) == -1) - { - Handler().LogError(this, "IsMulticastLoop", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - return is_loop ? true : false; - } + if (IsIpv6()) + { + int is_loop = 0; + socklen_t size = sizeof(int); + if (getsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (char *)&is_loop, &size) == -1) + { + Handler().LogError(this, "IsMulticastLoop", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + return is_loop ? true : false; + } #endif #endif - int is_loop = 0; - socklen_t size = sizeof(int); - if (getsockopt(GetSocket(), SOL_IP, IP_MULTICAST_LOOP, (char *)&is_loop, &size) == -1) - { - Handler().LogError(this, "IsMulticastLoop", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - return is_loop ? true : false; + int is_loop = 0; + socklen_t size = sizeof(int); + if (getsockopt(GetSocket(), SOL_IP, IP_MULTICAST_LOOP, (char *)&is_loop, &size) == -1) + { + Handler().LogError(this, "IsMulticastLoop", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + return is_loop ? true : false; } void UdpSocket::AddMulticastMembership(const std::string& group, const std::string& local_if, int if_index) { - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } + if (GetSocket() == INVALID_SOCKET) + { + CreateConnection(); + } #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - struct ipv6_mreq x; - struct in6_addr addr; - if (Utility::u2ip( group, addr )) - { - x.ipv6mr_multiaddr = addr; - x.ipv6mr_interface = if_index; - if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, (char *)&x, sizeof(struct ipv6_mreq)) == -1) - { - Handler().LogError(this, "AddMulticastMembership", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - } - return; - } + if (IsIpv6()) + { + struct ipv6_mreq x; + struct in6_addr addr; + if (Utility::u2ip( group, addr )) + { + x.ipv6mr_multiaddr = addr; + x.ipv6mr_interface = if_index; + if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, (char *)&x, sizeof(struct ipv6_mreq)) == -1) + { + Handler().LogError(this, "AddMulticastMembership", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + } + return; + } #endif #endif - struct ip_mreq x; // ip_mreqn - ipaddr_t addr; - if (Utility::u2ip( group, addr )) - { - memcpy(&x.imr_multiaddr.s_addr, &addr, sizeof(addr)); - Utility::u2ip( local_if, addr); - memcpy(&x.imr_interface.s_addr, &addr, sizeof(addr)); -// x.imr_ifindex = if_index; - if (setsockopt(GetSocket(), SOL_IP, IP_ADD_MEMBERSHIP, (char *)&x, sizeof(struct ip_mreq)) == -1) - { - Handler().LogError(this, "AddMulticastMembership", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - } + struct ip_mreq x; // ip_mreqn + ipaddr_t addr; + if (Utility::u2ip( group, addr )) + { + memcpy(&x.imr_multiaddr.s_addr, &addr, sizeof(addr)); + Utility::u2ip( local_if, addr); + memcpy(&x.imr_interface.s_addr, &addr, sizeof(addr)); +// x.imr_ifindex = if_index; + if (setsockopt(GetSocket(), SOL_IP, IP_ADD_MEMBERSHIP, (char *)&x, sizeof(struct ip_mreq)) == -1) + { + Handler().LogError(this, "AddMulticastMembership", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + } } void UdpSocket::DropMulticastMembership(const std::string& group, const std::string& local_if, int if_index) { - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } + if (GetSocket() == INVALID_SOCKET) + { + CreateConnection(); + } #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (IsIpv6()) - { - struct ipv6_mreq x; - struct in6_addr addr; - if (Utility::u2ip( group, addr )) - { - x.ipv6mr_multiaddr = addr; - x.ipv6mr_interface = if_index; - if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, (char *)&x, sizeof(struct ipv6_mreq)) == -1) - { - Handler().LogError(this, "DropMulticastMembership", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - } - return; - } + if (IsIpv6()) + { + struct ipv6_mreq x; + struct in6_addr addr; + if (Utility::u2ip( group, addr )) + { + x.ipv6mr_multiaddr = addr; + x.ipv6mr_interface = if_index; + if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, (char *)&x, sizeof(struct ipv6_mreq)) == -1) + { + Handler().LogError(this, "DropMulticastMembership", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + } + return; + } #endif #endif - struct ip_mreq x; // ip_mreqn - ipaddr_t addr; - if (Utility::u2ip( group, addr )) - { - memcpy(&x.imr_multiaddr.s_addr, &addr, sizeof(addr)); - Utility::u2ip( local_if, addr); - memcpy(&x.imr_interface.s_addr, &addr, sizeof(addr)); -// x.imr_ifindex = if_index; - if (setsockopt(GetSocket(), SOL_IP, IP_DROP_MEMBERSHIP, (char *)&x, sizeof(struct ip_mreq)) == -1) - { - Handler().LogError(this, "DropMulticastMembership", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - } + struct ip_mreq x; // ip_mreqn + ipaddr_t addr; + if (Utility::u2ip( group, addr )) + { + memcpy(&x.imr_multiaddr.s_addr, &addr, sizeof(addr)); + Utility::u2ip( local_if, addr); + memcpy(&x.imr_interface.s_addr, &addr, sizeof(addr)); +// x.imr_ifindex = if_index; + if (setsockopt(GetSocket(), SOL_IP, IP_DROP_MEMBERSHIP, (char *)&x, sizeof(struct ip_mreq)) == -1) + { + Handler().LogError(this, "DropMulticastMembership", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + } } @@ -772,40 +772,40 @@ void UdpSocket::DropMulticastMembership(const std::string& group, const std::str #ifdef IPPROTO_IPV6 void UdpSocket::SetMulticastHops(int hops) { - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } - if (!IsIpv6()) - { - Handler().LogError(this, "SetMulticastHops", 0, "Ipv6 only", LOG_LEVEL_ERROR); - return; - } - if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (char *)&hops, sizeof(int)) == -1) - { - Handler().LogError(this, "SetMulticastHops", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } + if (GetSocket() == INVALID_SOCKET) + { + CreateConnection(); + } + if (!IsIpv6()) + { + Handler().LogError(this, "SetMulticastHops", 0, "Ipv6 only", LOG_LEVEL_ERROR); + return; + } + if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (char *)&hops, sizeof(int)) == -1) + { + Handler().LogError(this, "SetMulticastHops", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } } int UdpSocket::GetMulticastHops() { - if (GetSocket() == INVALID_SOCKET) - { - CreateConnection(); - } - if (!IsIpv6()) - { - Handler().LogError(this, "SetMulticastHops", 0, "Ipv6 only", LOG_LEVEL_ERROR); - return -1; - } - int hops = 0; - socklen_t size = sizeof(int); - if (getsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (char *)&hops, &size) == -1) - { - Handler().LogError(this, "GetMulticastHops", Errno, StrError(Errno), LOG_LEVEL_WARNING); - } - return hops; + if (GetSocket() == INVALID_SOCKET) + { + CreateConnection(); + } + if (!IsIpv6()) + { + Handler().LogError(this, "SetMulticastHops", 0, "Ipv6 only", LOG_LEVEL_ERROR); + return -1; + } + int hops = 0; + socklen_t size = sizeof(int); + if (getsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (char *)&hops, &size) == -1) + { + Handler().LogError(this, "GetMulticastHops", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + return hops; } #endif // IPPROTO_IPV6 #endif @@ -813,7 +813,7 @@ int UdpSocket::GetMulticastHops() bool UdpSocket::IsBound() { - return m_bind_ok; + return m_bind_ok; } @@ -829,19 +829,19 @@ void UdpSocket::OnRawData(const char *buf, size_t len, struct sockaddr *sa, sock port_t UdpSocket::GetPort() { - return m_port; + return m_port; } int UdpSocket::GetLastSizeWritten() { - return m_last_size_written; + return m_last_size_written; } void UdpSocket::SetTimestamp(bool x) { - m_b_read_ts = x; + m_b_read_ts = x; } diff --git a/dep/src/sockets/Utility.cpp b/dep/src/sockets/Utility.cpp index c1327035d7a..e552da3b6e7 100644 --- a/dep/src/sockets/Utility.cpp +++ b/dep/src/sockets/Utility.cpp @@ -1,6 +1,6 @@ /** \file Utility.cpp - ** \date 2004-02-13 - ** \author grymse@alhem.net + ** \date 2004-02-13 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -71,69 +71,69 @@ std::string Utility::m_local_addr6; std::string Utility::base64(const std::string& str_in) { - std::string str; - Base64 m_b; - m_b.encode(str_in, str, false); // , false == do not add cr/lf - return str; + std::string str; + Base64 m_b; + m_b.encode(str_in, str, false); // , false == do not add cr/lf + return str; } std::string Utility::base64d(const std::string& str_in) { - std::string str; - Base64 m_b; - m_b.decode(str_in, str); - return str; + std::string str; + Base64 m_b; + m_b.decode(str_in, str); + return str; } std::string Utility::l2string(long l) { - std::string str; - char tmp[100]; - sprintf(tmp,"%ld",l); - str = tmp; - return str; + std::string str; + char tmp[100]; + sprintf(tmp,"%ld",l); + str = tmp; + return str; } std::string Utility::bigint2string(uint64_t l) { - std::string str; - uint64_t tmp = l; - while (tmp) - { - uint64_t a = tmp % 10; - str = (char)(a + 48) + str; - tmp /= 10; - } - if (str.empty()) - { - str = "0"; - } - return str; + std::string str; + uint64_t tmp = l; + while (tmp) + { + uint64_t a = tmp % 10; + str = (char)(a + 48) + str; + tmp /= 10; + } + if (str.empty()) + { + str = "0"; + } + return str; } -uint64_t Utility::atoi64(const std::string& str) +uint64_t Utility::atoi64(const std::string& str) { - uint64_t l = 0; - for (size_t i = 0; i < str.size(); i++) - { - l = l * 10 + str[i] - 48; - } - return l; + uint64_t l = 0; + for (size_t i = 0; i < str.size(); i++) + { + l = l * 10 + str[i] - 48; + } + return l; } unsigned int Utility::hex2unsigned(const std::string& str) { - unsigned int r = 0; - for (size_t i = 0; i < str.size(); i++) - { - r = r * 16 + str[i] - 48 - ((str[i] >= 'A') ? 7 : 0) - ((str[i] >= 'a') ? 32 : 0); - } - return r; + unsigned int r = 0; + for (size_t i = 0; i < str.size(); i++) + { + r = r * 16 + str[i] - 48 - ((str[i] >= 'A') ? 7 : 0) - ((str[i] >= 'a') ? 32 : 0); + } + return r; } @@ -143,28 +143,28 @@ unsigned int Utility::hex2unsigned(const std::string& str) */ std::string Utility::rfc1738_encode(const std::string& src) { -static char hex[] = "0123456789ABCDEF"; - std::string dst; - for (size_t i = 0; i < src.size(); i++) - { - if (isalnum(src[i])) - { - dst += src[i]; - } - else - if (src[i] == ' ') - { - dst += '+'; - } - else - { - unsigned char c = static_cast(src[i]); - dst += '%'; - dst += hex[c / 16]; - dst += hex[c % 16]; - } - } - return dst; +static char hex[] = "0123456789ABCDEF"; + std::string dst; + for (size_t i = 0; i < src.size(); i++) + { + if (isalnum(src[i])) + { + dst += src[i]; + } + else + if (src[i] == ' ') + { + dst += '+'; + } + else + { + unsigned char c = static_cast(src[i]); + dst += '%'; + dst += hex[c / 16]; + dst += hex[c % 16]; + } + } + return dst; } // rfc1738_encode @@ -174,95 +174,95 @@ static char hex[] = "0123456789ABCDEF"; */ std::string Utility::rfc1738_decode(const std::string& src) { - std::string dst; - for (size_t i = 0; i < src.size(); i++) - { - if (src[i] == '%' && isxdigit(src[i + 1]) && isxdigit(src[i + 2])) - { - char c1 = src[++i]; - char c2 = src[++i]; - c1 = c1 - 48 - ((c1 >= 'A') ? 7 : 0) - ((c1 >= 'a') ? 32 : 0); - c2 = c2 - 48 - ((c2 >= 'A') ? 7 : 0) - ((c2 >= 'a') ? 32 : 0); - dst += (char)(c1 * 16 + c2); - } - else - if (src[i] == '+') - { - dst += ' '; - } - else - { - dst += src[i]; - } - } - return dst; + std::string dst; + for (size_t i = 0; i < src.size(); i++) + { + if (src[i] == '%' && isxdigit(src[i + 1]) && isxdigit(src[i + 2])) + { + char c1 = src[++i]; + char c2 = src[++i]; + c1 = c1 - 48 - ((c1 >= 'A') ? 7 : 0) - ((c1 >= 'a') ? 32 : 0); + c2 = c2 - 48 - ((c2 >= 'A') ? 7 : 0) - ((c2 >= 'a') ? 32 : 0); + dst += (char)(c1 * 16 + c2); + } + else + if (src[i] == '+') + { + dst += ' '; + } + else + { + dst += src[i]; + } + } + return dst; } // rfc1738_decode bool Utility::isipv4(const std::string& str) { - int dots = 0; - // %! ignore :port? - for (size_t i = 0; i < str.size(); i++) - { - if (str[i] == '.') - dots++; - else - if (!isdigit(str[i])) - return false; - } - if (dots != 3) - return false; - return true; + int dots = 0; + // %! ignore :port? + for (size_t i = 0; i < str.size(); i++) + { + if (str[i] == '.') + dots++; + else + if (!isdigit(str[i])) + return false; + } + if (dots != 3) + return false; + return true; } bool Utility::isipv6(const std::string& str) { - size_t qc = 0; - size_t qd = 0; - for (size_t i = 0; i < str.size(); i++) - { - qc += (str[i] == ':') ? 1 : 0; - qd += (str[i] == '.') ? 1 : 0; - } - if (qc > 7) - { - return false; - } - if (qd && qd != 3) - { - return false; - } - Parse pa(str,":."); - std::string tmp = pa.getword(); - while (!tmp.empty()) - { - if (tmp.size() > 4) - { - return false; - } - for (size_t i = 0; i < tmp.size(); i++) - { - if (tmp[i] < '0' || (tmp[i] > '9' && tmp[i] < 'A') || - (tmp[i] > 'F' && tmp[i] < 'a') || tmp[i] > 'f') - { - return false; - } - } - // - tmp = pa.getword(); - } - return true; + size_t qc = 0; + size_t qd = 0; + for (size_t i = 0; i < str.size(); i++) + { + qc += (str[i] == ':') ? 1 : 0; + qd += (str[i] == '.') ? 1 : 0; + } + if (qc > 7) + { + return false; + } + if (qd && qd != 3) + { + return false; + } + Parse pa(str,":."); + std::string tmp = pa.getword(); + while (!tmp.empty()) + { + if (tmp.size() > 4) + { + return false; + } + for (size_t i = 0; i < tmp.size(); i++) + { + if (tmp[i] < '0' || (tmp[i] > '9' && tmp[i] < 'A') || + (tmp[i] > 'F' && tmp[i] < 'a') || tmp[i] > 'f') + { + return false; + } + } + // + tmp = pa.getword(); + } + return true; } bool Utility::u2ip(const std::string& str, ipaddr_t& l) { - struct sockaddr_in sa; - bool r = Utility::u2ip(str, sa); - memcpy(&l, &sa.sin_addr, sizeof(l)); - return r; + struct sockaddr_in sa; + bool r = Utility::u2ip(str, sa); + memcpy(&l, &sa.sin_addr, sizeof(l)); + return r; } @@ -270,10 +270,10 @@ bool Utility::u2ip(const std::string& str, ipaddr_t& l) #ifdef IPPROTO_IPV6 bool Utility::u2ip(const std::string& str, struct in6_addr& l) { - struct sockaddr_in6 sa; - bool r = Utility::u2ip(str, sa); - l = sa.sin6_addr; - return r; + struct sockaddr_in6 sa; + bool r = Utility::u2ip(str, sa); + l = sa.sin6_addr; + return r; } #endif #endif @@ -281,21 +281,21 @@ bool Utility::u2ip(const std::string& str, struct in6_addr& l) void Utility::l2ip(const ipaddr_t ip, std::string& str) { - struct sockaddr_in sa; - memset(&sa, 0, sizeof(sa)); - sa.sin_family = AF_INET; - memcpy(&sa.sin_addr, &ip, sizeof(sa.sin_addr)); - Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), str, NI_NUMERICHOST); + struct sockaddr_in sa; + memset(&sa, 0, sizeof(sa)); + sa.sin_family = AF_INET; + memcpy(&sa.sin_addr, &ip, sizeof(sa.sin_addr)); + Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), str, NI_NUMERICHOST); } void Utility::l2ip(const in_addr& ip, std::string& str) { - struct sockaddr_in sa; - memset(&sa, 0, sizeof(sa)); - sa.sin_family = AF_INET; - sa.sin_addr = ip; - Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), str, NI_NUMERICHOST); + struct sockaddr_in sa; + memset(&sa, 0, sizeof(sa)); + sa.sin_family = AF_INET; + sa.sin_addr = ip; + Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), str, NI_NUMERICHOST); } @@ -303,61 +303,61 @@ void Utility::l2ip(const in_addr& ip, std::string& str) #ifdef IPPROTO_IPV6 void Utility::l2ip(const struct in6_addr& ip, std::string& str,bool mixed) { - char slask[100]; // l2ip temporary - *slask = 0; - unsigned int prev = 0; - bool skipped = false; - bool ok_to_skip = true; - if (mixed) - { - unsigned short x; - unsigned short addr16[8]; - memcpy(addr16, &ip, sizeof(addr16)); - for (size_t i = 0; i < 6; i++) - { - x = ntohs(addr16[i]); - if (*slask && (x || !ok_to_skip || prev)) - strcat(slask,":"); - if (x || !ok_to_skip) - { - sprintf(slask + strlen(slask),"%x", x); - if (x && skipped) - ok_to_skip = false; - } - else - { - skipped = true; - } - prev = x; - } - x = ntohs(addr16[6]); - sprintf(slask + strlen(slask),":%u.%u",x / 256,x & 255); - x = ntohs(addr16[7]); - sprintf(slask + strlen(slask),".%u.%u",x / 256,x & 255); - } - else - { - struct sockaddr_in6 sa; - memset(&sa, 0, sizeof(sa)); - sa.sin6_family = AF_INET6; - sa.sin6_addr = ip; - Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), str, NI_NUMERICHOST); - return; - } - str = slask; + char slask[100]; // l2ip temporary + *slask = 0; + unsigned int prev = 0; + bool skipped = false; + bool ok_to_skip = true; + if (mixed) + { + unsigned short x; + unsigned short addr16[8]; + memcpy(addr16, &ip, sizeof(addr16)); + for (size_t i = 0; i < 6; i++) + { + x = ntohs(addr16[i]); + if (*slask && (x || !ok_to_skip || prev)) + strcat(slask,":"); + if (x || !ok_to_skip) + { + sprintf(slask + strlen(slask),"%x", x); + if (x && skipped) + ok_to_skip = false; + } + else + { + skipped = true; + } + prev = x; + } + x = ntohs(addr16[6]); + sprintf(slask + strlen(slask),":%u.%u",x / 256,x & 255); + x = ntohs(addr16[7]); + sprintf(slask + strlen(slask),".%u.%u",x / 256,x & 255); + } + else + { + struct sockaddr_in6 sa; + memset(&sa, 0, sizeof(sa)); + sa.sin6_family = AF_INET6; + sa.sin6_addr = ip; + Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), str, NI_NUMERICHOST); + return; + } + str = slask; } int Utility::in6_addr_compare(in6_addr a,in6_addr b) { - for (size_t i = 0; i < 16; i++) - { - if (a.s6_addr[i] < b.s6_addr[i]) - return -1; - if (a.s6_addr[i] > b.s6_addr[i]) - return 1; - } - return 0; + for (size_t i = 0; i < 16; i++) + { + if (a.s6_addr[i] < b.s6_addr[i]) + return -1; + if (a.s6_addr[i] > b.s6_addr[i]) + return 1; + } + return 0; } #endif #endif @@ -365,60 +365,60 @@ int Utility::in6_addr_compare(in6_addr a,in6_addr b) void Utility::ResolveLocal() { - char h[256]; + char h[256]; - // get local hostname and translate into ip-address - *h = 0; - gethostname(h,255); - { - if (Utility::u2ip(h, m_ip)) - { - Utility::l2ip(m_ip, m_addr); - } - } + // get local hostname and translate into ip-address + *h = 0; + gethostname(h,255); + { + if (Utility::u2ip(h, m_ip)) + { + Utility::l2ip(m_ip, m_addr); + } + } #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - memset(&m_local_ip6, 0, sizeof(m_local_ip6)); - { - if (Utility::u2ip(h, m_local_ip6)) - { - Utility::l2ip(m_local_ip6, m_local_addr6); - } - } + memset(&m_local_ip6, 0, sizeof(m_local_ip6)); + { + if (Utility::u2ip(h, m_local_ip6)) + { + Utility::l2ip(m_local_ip6, m_local_addr6); + } + } #endif #endif - m_host = h; - m_local_resolved = true; + m_host = h; + m_local_resolved = true; } const std::string& Utility::GetLocalHostname() { - if (!m_local_resolved) - { - ResolveLocal(); - } - return m_host; + if (!m_local_resolved) + { + ResolveLocal(); + } + return m_host; } ipaddr_t Utility::GetLocalIP() { - if (!m_local_resolved) - { - ResolveLocal(); - } - return m_ip; + if (!m_local_resolved) + { + ResolveLocal(); + } + return m_ip; } const std::string& Utility::GetLocalAddress() { - if (!m_local_resolved) - { - ResolveLocal(); - } - return m_addr; + if (!m_local_resolved) + { + ResolveLocal(); + } + return m_addr; } @@ -426,21 +426,21 @@ const std::string& Utility::GetLocalAddress() #ifdef IPPROTO_IPV6 const struct in6_addr& Utility::GetLocalIP6() { - if (!m_local_resolved) - { - ResolveLocal(); - } - return m_local_ip6; + if (!m_local_resolved) + { + ResolveLocal(); + } + return m_local_ip6; } const std::string& Utility::GetLocalAddress6() { - if (!m_local_resolved) - { - ResolveLocal(); - } - return m_local_addr6; + if (!m_local_resolved) + { + ResolveLocal(); + } + return m_local_addr6; } #endif #endif @@ -449,23 +449,23 @@ const std::string& Utility::GetLocalAddress6() void Utility::SetEnv(const std::string& var,const std::string& value) { #if (defined(SOLARIS8) || defined(SOLARIS)) - { - static std::map vmap; - if (vmap.find(var) != vmap.end()) - { - delete[] vmap[var]; - } - vmap[var] = new char[var.size() + 1 + value.size() + 1]; - sprintf(vmap[var], "%s=%s", var.c_str(), value.c_str()); - putenv( vmap[var] ); - } + { + static std::map vmap; + if (vmap.find(var) != vmap.end()) + { + delete[] vmap[var]; + } + vmap[var] = new char[var.size() + 1 + value.size() + 1]; + sprintf(vmap[var], "%s=%s", var.c_str(), value.c_str()); + putenv( vmap[var] ); + } #elif defined _WIN32 - { - std::string slask = var + "=" + value; - _putenv( (char *)slask.c_str()); - } + { + std::string slask = var + "=" + value; + _putenv( (char *)slask.c_str()); + } #else - setenv(var.c_str(), value.c_str(), 1); + setenv(var.c_str(), value.c_str(), 1); #endif } @@ -474,160 +474,160 @@ std::string Utility::Sa2String(struct sockaddr *sa) { #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - if (sa -> sa_family == AF_INET6) - { - struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)sa; - std::string tmp; - Utility::l2ip(sa6 -> sin6_addr, tmp); - return tmp + ":" + Utility::l2string(ntohs(sa6 -> sin6_port)); - } + if (sa -> sa_family == AF_INET6) + { + struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)sa; + std::string tmp; + Utility::l2ip(sa6 -> sin6_addr, tmp); + return tmp + ":" + Utility::l2string(ntohs(sa6 -> sin6_port)); + } #endif #endif - if (sa -> sa_family == AF_INET) - { - struct sockaddr_in *sa4 = (struct sockaddr_in *)sa; - ipaddr_t a; - memcpy(&a, &sa4 -> sin_addr, 4); - std::string tmp; - Utility::l2ip(a, tmp); - return tmp + ":" + Utility::l2string(ntohs(sa4 -> sin_port)); - } - return ""; + if (sa -> sa_family == AF_INET) + { + struct sockaddr_in *sa4 = (struct sockaddr_in *)sa; + ipaddr_t a; + memcpy(&a, &sa4 -> sin_addr, 4); + std::string tmp; + Utility::l2ip(a, tmp); + return tmp + ":" + Utility::l2string(ntohs(sa4 -> sin_port)); + } + return ""; } void Utility::GetTime(struct timeval *p) { #ifdef _WIN32 - FILETIME ft; // Contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC). - GetSystemTimeAsFileTime(&ft); - uint64_t tt; - memcpy(&tt, &ft, sizeof(tt)); - tt /= 10; // make it usecs - p->tv_sec = (long)tt / 1000000; - p->tv_usec = (long)tt % 1000000; + FILETIME ft; // Contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC). + GetSystemTimeAsFileTime(&ft); + uint64_t tt; + memcpy(&tt, &ft, sizeof(tt)); + tt /= 10; // make it usecs + p->tv_sec = (long)tt / 1000000; + p->tv_usec = (long)tt % 1000000; #else - gettimeofday(p, NULL); + gettimeofday(p, NULL); #endif } std::auto_ptr Utility::CreateAddress(struct sockaddr *sa,socklen_t sa_len) { - switch (sa -> sa_family) - { - case AF_INET: - if (sa_len == sizeof(struct sockaddr_in)) - { - struct sockaddr_in *p = (struct sockaddr_in *)sa; - return std::auto_ptr(new Ipv4Address(*p)); - } - break; + switch (sa -> sa_family) + { + case AF_INET: + if (sa_len == sizeof(struct sockaddr_in)) + { + struct sockaddr_in *p = (struct sockaddr_in *)sa; + return std::auto_ptr(new Ipv4Address(*p)); + } + break; #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 - case AF_INET6: - if (sa_len == sizeof(struct sockaddr_in6)) - { - struct sockaddr_in6 *p = (struct sockaddr_in6 *)sa; - return std::auto_ptr(new Ipv6Address(*p)); - } - break; + case AF_INET6: + if (sa_len == sizeof(struct sockaddr_in6)) + { + struct sockaddr_in6 *p = (struct sockaddr_in6 *)sa; + return std::auto_ptr(new Ipv6Address(*p)); + } + break; #endif #endif - } - return std::auto_ptr(NULL); + } + return std::auto_ptr(NULL); } bool Utility::u2ip(const std::string& host, struct sockaddr_in& sa, int ai_flags) { - memset(&sa, 0, sizeof(sa)); - sa.sin_family = AF_INET; + memset(&sa, 0, sizeof(sa)); + sa.sin_family = AF_INET; #ifdef NO_GETADDRINFO - if ((ai_flags & AI_NUMERICHOST) != 0 || isipv4(host)) - { - Parse pa((char *)host.c_str(), "."); - union { - struct { - unsigned char b1; - unsigned char b2; - unsigned char b3; - unsigned char b4; - } a; - ipaddr_t l; - } u; - u.a.b1 = static_cast(pa.getvalue()); - u.a.b2 = static_cast(pa.getvalue()); - u.a.b3 = static_cast(pa.getvalue()); - u.a.b4 = static_cast(pa.getvalue()); - memcpy(&sa.sin_addr, &u.l, sizeof(sa.sin_addr)); - return true; - } + if ((ai_flags & AI_NUMERICHOST) != 0 || isipv4(host)) + { + Parse pa((char *)host.c_str(), "."); + union { + struct { + unsigned char b1; + unsigned char b2; + unsigned char b3; + unsigned char b4; + } a; + ipaddr_t l; + } u; + u.a.b1 = static_cast(pa.getvalue()); + u.a.b2 = static_cast(pa.getvalue()); + u.a.b3 = static_cast(pa.getvalue()); + u.a.b4 = static_cast(pa.getvalue()); + memcpy(&sa.sin_addr, &u.l, sizeof(sa.sin_addr)); + return true; + } #ifndef LINUX - struct hostent *he = gethostbyname( host.c_str() ); - if (!he) - { - return false; - } - memcpy(&sa.sin_addr, he -> h_addr, sizeof(sa.sin_addr)); + struct hostent *he = gethostbyname( host.c_str() ); + if (!he) + { + return false; + } + memcpy(&sa.sin_addr, he -> h_addr, sizeof(sa.sin_addr)); #else - struct hostent he; - struct hostent *result = NULL; - int myerrno = 0; - char buf[2000]; - int n = gethostbyname_r(host.c_str(), &he, buf, sizeof(buf), &result, &myerrno); - if (n || !result) - { - return false; - } - if (he.h_addr_list && he.h_addr_list[0]) - memcpy(&sa.sin_addr, he.h_addr, 4); - else - return false; + struct hostent he; + struct hostent *result = NULL; + int myerrno = 0; + char buf[2000]; + int n = gethostbyname_r(host.c_str(), &he, buf, sizeof(buf), &result, &myerrno); + if (n || !result) + { + return false; + } + if (he.h_addr_list && he.h_addr_list[0]) + memcpy(&sa.sin_addr, he.h_addr, 4); + else + return false; #endif - return true; + return true; #else - struct addrinfo hints; - memset(&hints, 0, sizeof(hints)); - // AI_NUMERICHOST - // AI_CANONNAME - // AI_PASSIVE - server - // AI_ADDRCONFIG - // AI_V4MAPPED - // AI_ALL - // AI_NUMERICSERV - hints.ai_flags = ai_flags; - hints.ai_family = AF_INET; - hints.ai_socktype = 0; - hints.ai_protocol = 0; - struct addrinfo *res; - if (Utility::isipv4(host)) - hints.ai_flags |= AI_NUMERICHOST; - int n = getaddrinfo(host.c_str(), NULL, &hints, &res); - if (!n) - { - std::vector vec; - struct addrinfo *ai = res; - while (ai) - { - if (ai -> ai_addrlen == sizeof(sa)) - vec.push_back( ai ); - ai = ai -> ai_next; - } - if (vec.empty()) - return false; - ai = vec[Utility::Rnd() % vec.size()]; - { - memcpy(&sa, ai -> ai_addr, ai -> ai_addrlen); - } - freeaddrinfo(res); - return true; - } - std::string error = "Error: "; + struct addrinfo hints; + memset(&hints, 0, sizeof(hints)); + // AI_NUMERICHOST + // AI_CANONNAME + // AI_PASSIVE - server + // AI_ADDRCONFIG + // AI_V4MAPPED + // AI_ALL + // AI_NUMERICSERV + hints.ai_flags = ai_flags; + hints.ai_family = AF_INET; + hints.ai_socktype = 0; + hints.ai_protocol = 0; + struct addrinfo *res; + if (Utility::isipv4(host)) + hints.ai_flags |= AI_NUMERICHOST; + int n = getaddrinfo(host.c_str(), NULL, &hints, &res); + if (!n) + { + std::vector vec; + struct addrinfo *ai = res; + while (ai) + { + if (ai -> ai_addrlen == sizeof(sa)) + vec.push_back( ai ); + ai = ai -> ai_next; + } + if (vec.empty()) + return false; + ai = vec[Utility::Rnd() % vec.size()]; + { + memcpy(&sa, ai -> ai_addr, ai -> ai_addrlen); + } + freeaddrinfo(res); + return true; + } + std::string error = "Error: "; #ifndef __CYGWIN__ - error += gai_strerror(n); + error += gai_strerror(n); #endif - return false; + return false; #endif // NO_GETADDRINFO } @@ -636,112 +636,112 @@ bool Utility::u2ip(const std::string& host, struct sockaddr_in& sa, int ai_flags #ifdef IPPROTO_IPV6 bool Utility::u2ip(const std::string& host, struct sockaddr_in6& sa, int ai_flags) { - memset(&sa, 0, sizeof(sa)); - sa.sin6_family = AF_INET6; + memset(&sa, 0, sizeof(sa)); + sa.sin6_family = AF_INET6; #ifdef NO_GETADDRINFO - if ((ai_flags & AI_NUMERICHOST) != 0 || isipv6(host)) - { - std::list vec; - size_t x = 0; - for (size_t i = 0; i <= host.size(); i++) - { - if (i == host.size() || host[i] == ':') - { - std::string s = host.substr(x, i - x); - // - if (strstr(s.c_str(),".")) // x.x.x.x - { - Parse pa(s,"."); - char slask[100]; // u2ip temporary hex2string conversion - unsigned long b0 = static_cast(pa.getvalue()); - unsigned long b1 = static_cast(pa.getvalue()); - unsigned long b2 = static_cast(pa.getvalue()); - unsigned long b3 = static_cast(pa.getvalue()); - sprintf(slask,"%lx",b0 * 256 + b1); - vec.push_back(slask); - sprintf(slask,"%lx",b2 * 256 + b3); - vec.push_back(slask); - } - else - { - vec.push_back(s); - } - // - x = i + 1; - } - } - size_t sz = vec.size(); // number of byte pairs - size_t i = 0; // index in in6_addr.in6_u.u6_addr16[] ( 0 .. 7 ) - unsigned short addr16[8]; - for (std::list::iterator it = vec.begin(); it != vec.end(); it++) - { - std::string bytepair = *it; - if (!bytepair.empty()) - { - addr16[i++] = htons(Utility::hex2unsigned(bytepair)); - } - else - { - addr16[i++] = 0; - while (sz++ < 8) - { - addr16[i++] = 0; - } - } - } - memcpy(&sa.sin6_addr, addr16, sizeof(addr16)); - return true; - } + if ((ai_flags & AI_NUMERICHOST) != 0 || isipv6(host)) + { + std::list vec; + size_t x = 0; + for (size_t i = 0; i <= host.size(); i++) + { + if (i == host.size() || host[i] == ':') + { + std::string s = host.substr(x, i - x); + // + if (strstr(s.c_str(),".")) // x.x.x.x + { + Parse pa(s,"."); + char slask[100]; // u2ip temporary hex2string conversion + unsigned long b0 = static_cast(pa.getvalue()); + unsigned long b1 = static_cast(pa.getvalue()); + unsigned long b2 = static_cast(pa.getvalue()); + unsigned long b3 = static_cast(pa.getvalue()); + sprintf(slask,"%lx",b0 * 256 + b1); + vec.push_back(slask); + sprintf(slask,"%lx",b2 * 256 + b3); + vec.push_back(slask); + } + else + { + vec.push_back(s); + } + // + x = i + 1; + } + } + size_t sz = vec.size(); // number of byte pairs + size_t i = 0; // index in in6_addr.in6_u.u6_addr16[] ( 0 .. 7 ) + unsigned short addr16[8]; + for (std::list::iterator it = vec.begin(); it != vec.end(); it++) + { + std::string bytepair = *it; + if (!bytepair.empty()) + { + addr16[i++] = htons(Utility::hex2unsigned(bytepair)); + } + else + { + addr16[i++] = 0; + while (sz++ < 8) + { + addr16[i++] = 0; + } + } + } + memcpy(&sa.sin6_addr, addr16, sizeof(addr16)); + return true; + } #ifdef SOLARIS - int errnum = 0; - struct hostent *he = getipnodebyname( host.c_str(), AF_INET6, 0, &errnum ); + int errnum = 0; + struct hostent *he = getipnodebyname( host.c_str(), AF_INET6, 0, &errnum ); #else - struct hostent *he = gethostbyname2( host.c_str(), AF_INET6 ); + struct hostent *he = gethostbyname2( host.c_str(), AF_INET6 ); #endif - if (!he) - { - return false; - } - memcpy(&sa.sin6_addr,he -> h_addr_list[0],he -> h_length); + if (!he) + { + return false; + } + memcpy(&sa.sin6_addr,he -> h_addr_list[0],he -> h_length); #ifdef SOLARIS - free(he); + free(he); #endif - return true; + return true; #else - struct addrinfo hints; - memset(&hints, 0, sizeof(hints)); - hints.ai_flags = ai_flags; - hints.ai_family = AF_INET6; - hints.ai_socktype = 0; - hints.ai_protocol = 0; - struct addrinfo *res; - if (Utility::isipv6(host)) - hints.ai_flags |= AI_NUMERICHOST; - int n = getaddrinfo(host.c_str(), NULL, &hints, &res); - if (!n) - { - std::vector vec; - struct addrinfo *ai = res; - while (ai) - { - if (ai -> ai_addrlen == sizeof(sa)) - vec.push_back( ai ); - ai = ai -> ai_next; - } - if (vec.empty()) - return false; - ai = vec[Utility::Rnd() % vec.size()]; - { - memcpy(&sa, ai -> ai_addr, ai -> ai_addrlen); - } - freeaddrinfo(res); - return true; - } - std::string error = "Error: "; + struct addrinfo hints; + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = ai_flags; + hints.ai_family = AF_INET6; + hints.ai_socktype = 0; + hints.ai_protocol = 0; + struct addrinfo *res; + if (Utility::isipv6(host)) + hints.ai_flags |= AI_NUMERICHOST; + int n = getaddrinfo(host.c_str(), NULL, &hints, &res); + if (!n) + { + std::vector vec; + struct addrinfo *ai = res; + while (ai) + { + if (ai -> ai_addrlen == sizeof(sa)) + vec.push_back( ai ); + ai = ai -> ai_next; + } + if (vec.empty()) + return false; + ai = vec[Utility::Rnd() % vec.size()]; + { + memcpy(&sa, ai -> ai_addr, ai -> ai_addrlen); + } + freeaddrinfo(res); + return true; + } + std::string error = "Error: "; #ifndef __CYGWIN__ - error += gai_strerror(n); + error += gai_strerror(n); #endif - return false; + return false; #endif // NO_GETADDRINFO } #endif // IPPROTO_IPV6 @@ -750,123 +750,123 @@ bool Utility::u2ip(const std::string& host, struct sockaddr_in6& sa, int ai_flag bool Utility::reverse(struct sockaddr *sa, socklen_t sa_len, std::string& hostname, int flags) { - std::string service; - return Utility::reverse(sa, sa_len, hostname, service, flags); + std::string service; + return Utility::reverse(sa, sa_len, hostname, service, flags); } bool Utility::reverse(struct sockaddr *sa, socklen_t sa_len, std::string& hostname, std::string& service, int flags) { - hostname = ""; - service = ""; + hostname = ""; + service = ""; #ifdef NO_GETADDRINFO - switch (sa -> sa_family) - { - case AF_INET: - if (flags & NI_NUMERICHOST) - { - union { - struct { - unsigned char b1; - unsigned char b2; - unsigned char b3; - unsigned char b4; - } a; - ipaddr_t l; - } u; - struct sockaddr_in *sa_in = (struct sockaddr_in *)sa; - memcpy(&u.l, &sa_in -> sin_addr, sizeof(u.l)); - char tmp[100]; - sprintf(tmp, "%u.%u.%u.%u", u.a.b1, u.a.b2, u.a.b3, u.a.b4); - hostname = tmp; - return true; - } - else - { - struct sockaddr_in *sa_in = (struct sockaddr_in *)sa; - struct hostent *h = gethostbyaddr( (const char *)&sa_in -> sin_addr, sizeof(sa_in -> sin_addr), AF_INET); - if (h) - { - hostname = h -> h_name; - return true; - } - } - break; + switch (sa -> sa_family) + { + case AF_INET: + if (flags & NI_NUMERICHOST) + { + union { + struct { + unsigned char b1; + unsigned char b2; + unsigned char b3; + unsigned char b4; + } a; + ipaddr_t l; + } u; + struct sockaddr_in *sa_in = (struct sockaddr_in *)sa; + memcpy(&u.l, &sa_in -> sin_addr, sizeof(u.l)); + char tmp[100]; + sprintf(tmp, "%u.%u.%u.%u", u.a.b1, u.a.b2, u.a.b3, u.a.b4); + hostname = tmp; + return true; + } + else + { + struct sockaddr_in *sa_in = (struct sockaddr_in *)sa; + struct hostent *h = gethostbyaddr( (const char *)&sa_in -> sin_addr, sizeof(sa_in -> sin_addr), AF_INET); + if (h) + { + hostname = h -> h_name; + return true; + } + } + break; #ifdef ENABLE_IPV6 - case AF_INET6: - if (flags & NI_NUMERICHOST) - { - char slask[100]; // l2ip temporary - *slask = 0; - unsigned int prev = 0; - bool skipped = false; - bool ok_to_skip = true; - { - unsigned short addr16[8]; - struct sockaddr_in6 *sa_in6 = (struct sockaddr_in6 *)sa; - memcpy(addr16, &sa_in6 -> sin6_addr, sizeof(addr16)); - for (size_t i = 0; i < 8; i++) - { - unsigned short x = ntohs(addr16[i]); - if (*slask && (x || !ok_to_skip || prev)) - strcat(slask,":"); - if (x || !ok_to_skip) - { - sprintf(slask + strlen(slask),"%x", x); - if (x && skipped) - ok_to_skip = false; - } - else - { - skipped = true; - } - prev = x; - } - } - if (!*slask) - strcpy(slask, "::"); - hostname = slask; - return true; - } - else - { - // %! TODO: ipv6 reverse lookup - struct sockaddr_in6 *sa_in = (struct sockaddr_in6 *)sa; - struct hostent *h = gethostbyaddr( (const char *)&sa_in -> sin6_addr, sizeof(sa_in -> sin6_addr), AF_INET6); - if (h) - { - hostname = h -> h_name; - return true; - } - } - break; + case AF_INET6: + if (flags & NI_NUMERICHOST) + { + char slask[100]; // l2ip temporary + *slask = 0; + unsigned int prev = 0; + bool skipped = false; + bool ok_to_skip = true; + { + unsigned short addr16[8]; + struct sockaddr_in6 *sa_in6 = (struct sockaddr_in6 *)sa; + memcpy(addr16, &sa_in6 -> sin6_addr, sizeof(addr16)); + for (size_t i = 0; i < 8; i++) + { + unsigned short x = ntohs(addr16[i]); + if (*slask && (x || !ok_to_skip || prev)) + strcat(slask,":"); + if (x || !ok_to_skip) + { + sprintf(slask + strlen(slask),"%x", x); + if (x && skipped) + ok_to_skip = false; + } + else + { + skipped = true; + } + prev = x; + } + } + if (!*slask) + strcpy(slask, "::"); + hostname = slask; + return true; + } + else + { + // %! TODO: ipv6 reverse lookup + struct sockaddr_in6 *sa_in = (struct sockaddr_in6 *)sa; + struct hostent *h = gethostbyaddr( (const char *)&sa_in -> sin6_addr, sizeof(sa_in -> sin6_addr), AF_INET6); + if (h) + { + hostname = h -> h_name; + return true; + } + } + break; #endif - } - return false; + } + return false; #else - char host[NI_MAXHOST]; - char serv[NI_MAXSERV]; - // NI_NOFQDN - // NI_NUMERICHOST - // NI_NAMEREQD - // NI_NUMERICSERV - // NI_DGRAM - int n = getnameinfo(sa, sa_len, host, sizeof(host), serv, sizeof(serv), flags); - if (n) - { - // EAI_AGAIN - // EAI_BADFLAGS - // EAI_FAIL - // EAI_FAMILY - // EAI_MEMORY - // EAI_NONAME - // EAI_OVERFLOW - // EAI_SYSTEM - return false; - } - hostname = host; - service = serv; - return true; + char host[NI_MAXHOST]; + char serv[NI_MAXSERV]; + // NI_NOFQDN + // NI_NUMERICHOST + // NI_NAMEREQD + // NI_NUMERICSERV + // NI_DGRAM + int n = getnameinfo(sa, sa_len, host, sizeof(host), serv, sizeof(serv), flags); + if (n) + { + // EAI_AGAIN + // EAI_BADFLAGS + // EAI_FAIL + // EAI_FAMILY + // EAI_MEMORY + // EAI_NONAME + // EAI_OVERFLOW + // EAI_SYSTEM + return false; + } + hostname = host; + service = serv; + return true; #endif // NO_GETADDRINFO } @@ -874,32 +874,32 @@ bool Utility::reverse(struct sockaddr *sa, socklen_t sa_len, std::string& hostna bool Utility::u2service(const std::string& name, int& service, int ai_flags) { #ifdef NO_GETADDRINFO - // %! - return false; + // %! + return false; #else - struct addrinfo hints; - service = 0; - memset(&hints, 0, sizeof(hints)); - // AI_NUMERICHOST - // AI_CANONNAME - // AI_PASSIVE - server - // AI_ADDRCONFIG - // AI_V4MAPPED - // AI_ALL - // AI_NUMERICSERV - hints.ai_flags = ai_flags; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = 0; - hints.ai_protocol = 0; - struct addrinfo *res; - int n = getaddrinfo(NULL, name.c_str(), &hints, &res); - if (!n) - { - service = res -> ai_protocol; - freeaddrinfo(res); - return true; - } - return false; + struct addrinfo hints; + service = 0; + memset(&hints, 0, sizeof(hints)); + // AI_NUMERICHOST + // AI_CANONNAME + // AI_PASSIVE - server + // AI_ADDRCONFIG + // AI_V4MAPPED + // AI_ALL + // AI_NUMERICSERV + hints.ai_flags = ai_flags; + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = 0; + hints.ai_protocol = 0; + struct addrinfo *res; + int n = getaddrinfo(NULL, name.c_str(), &hints, &res); + if (!n) + { + service = res -> ai_protocol; + freeaddrinfo(res); + return true; + } + return false; #endif // NO_GETADDRINFO } @@ -907,90 +907,90 @@ bool Utility::u2service(const std::string& name, int& service, int ai_flags) unsigned long Utility::ThreadID() { #ifdef _WIN32 - return GetCurrentThreadId(); + return GetCurrentThreadId(); #else - return (unsigned long)pthread_self(); + return (unsigned long)pthread_self(); #endif } std::string Utility::ToLower(const std::string& str) { - std::string r; - for (size_t i = 0; i < str.size(); i++) - { - if (str[i] >= 'A' && str[i] <= 'Z') - r += str[i] | 32; - else - r += str[i]; - } - return r; + std::string r; + for (size_t i = 0; i < str.size(); i++) + { + if (str[i] >= 'A' && str[i] <= 'Z') + r += str[i] | 32; + else + r += str[i]; + } + return r; } std::string Utility::ToUpper(const std::string& str) { - std::string r; - for (size_t i = 0; i < str.size(); i++) - { - if (str[i] >= 'a' && str[i] <= 'z') - r += (char)(str[i] - 32); - else - r += str[i]; - } - return r; + std::string r; + for (size_t i = 0; i < str.size(); i++) + { + if (str[i] >= 'a' && str[i] <= 'z') + r += (char)(str[i] - 32); + else + r += str[i]; + } + return r; } std::string Utility::ToString(double d) { - char tmp[100]; - sprintf(tmp, "%f", d); - return tmp; + char tmp[100]; + sprintf(tmp, "%f", d); + return tmp; } unsigned long Utility::Rnd() { -static Utility::Rng generator( (unsigned long)time(NULL) ); - return generator.Get(); +static Utility::Rng generator( (unsigned long)time(NULL) ); + return generator.Get(); } Utility::Rng::Rng(unsigned long seed) : m_value( 0 ) { - m_tmp[0]= seed & 0xffffffffUL; - for (int i = 1; i < TWIST_LEN; i++) - { - m_tmp[i] = (1812433253UL * (m_tmp[i - 1] ^ (m_tmp[i - 1] >> 30)) + i); - } + m_tmp[0]= seed & 0xffffffffUL; + for (int i = 1; i < TWIST_LEN; i++) + { + m_tmp[i] = (1812433253UL * (m_tmp[i - 1] ^ (m_tmp[i - 1] >> 30)) + i); + } } - + unsigned long Utility::Rng::Get() { - unsigned long val = m_tmp[m_value]; - ++m_value; - if (m_value == TWIST_LEN) - { - for (int i = 0; i < TWIST_IB; ++i) - { - unsigned long s = TWIST(m_tmp, i, i + 1); - m_tmp[i] = m_tmp[i + TWIST_IA] ^ (s >> 1) ^ MAGIC_TWIST(s); - } - { - for (int i = 0; i < TWIST_LEN - 1; ++i) - { - unsigned long s = TWIST(m_tmp, i, i + 1); - m_tmp[i] = m_tmp[i - TWIST_IB] ^ (s >> 1) ^ MAGIC_TWIST(s); - } - } - unsigned long s = TWIST(m_tmp, TWIST_LEN - 1, 0); - m_tmp[TWIST_LEN - 1] = m_tmp[TWIST_IA - 1] ^ (s >> 1) ^ MAGIC_TWIST(s); + unsigned long val = m_tmp[m_value]; + ++m_value; + if (m_value == TWIST_LEN) + { + for (int i = 0; i < TWIST_IB; ++i) + { + unsigned long s = TWIST(m_tmp, i, i + 1); + m_tmp[i] = m_tmp[i + TWIST_IA] ^ (s >> 1) ^ MAGIC_TWIST(s); + } + { + for (int i = 0; i < TWIST_LEN - 1; ++i) + { + unsigned long s = TWIST(m_tmp, i, i + 1); + m_tmp[i] = m_tmp[i - TWIST_IB] ^ (s >> 1) ^ MAGIC_TWIST(s); + } + } + unsigned long s = TWIST(m_tmp, TWIST_LEN - 1, 0); + m_tmp[TWIST_LEN - 1] = m_tmp[TWIST_IA - 1] ^ (s >> 1) ^ MAGIC_TWIST(s); - m_value = 0; - } - return val; + m_value = 0; + } + return val; } #ifdef SOCKETS_NAMESPACE diff --git a/dep/src/sockets/socket_include.cpp b/dep/src/sockets/socket_include.cpp index 07b986b02b7..6f08e8e16ab 100644 --- a/dep/src/sockets/socket_include.cpp +++ b/dep/src/sockets/socket_include.cpp @@ -1,6 +1,6 @@ /** \file socket_include.cpp - ** \date 2004-11-28 - ** \author grymse@alhem.net + ** \date 2004-11-28 + ** \author grymse@alhem.net **/ /* Copyright (C) 2004-2007 Anders Hedstrom @@ -8,7 +8,7 @@ Copyright (C) 2004-2007 Anders Hedstrom This library is made available under the terms of the GNU GPL. If you would like to use this library in a closed-source application, -a separate license agreement is available. For information about +a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. @@ -30,60 +30,60 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include // only to be included in win32 projects -const char *StrError(int x) +const char *StrError(int x) { -static char tmp[100]; - switch (x) - { - case 10004: return "Interrupted function call."; - case 10013: return "Permission denied."; - case 10014: return "Bad address."; - case 10022: return "Invalid argument."; - case 10024: return "Too many open files."; - case 10035: return "Resource temporarily unavailable."; - case 10036: return "Operation now in progress."; - case 10037: return "Operation already in progress."; - case 10038: return "Socket operation on nonsocket."; - case 10039: return "Destination address required."; - case 10040: return "Message too long."; - case 10041: return "Protocol wrong type for socket."; - case 10042: return "Bad protocol option."; - case 10043: return "Protocol not supported."; - case 10044: return "Socket type not supported."; - case 10045: return "Operation not supported."; - case 10046: return "Protocol family not supported."; - case 10047: return "Address family not supported by protocol family."; - case 10048: return "Address already in use."; - case 10049: return "Cannot assign requested address."; - case 10050: return "Network is down."; - case 10051: return "Network is unreachable."; - case 10052: return "Network dropped connection on reset."; - case 10053: return "Software caused connection abort."; - case 10054: return "Connection reset by peer."; - case 10055: return "No buffer space available."; - case 10056: return "Socket is already connected."; - case 10057: return "Socket is not connected."; - case 10058: return "Cannot send after socket shutdown."; - case 10060: return "Connection timed out."; - case 10061: return "Connection refused."; - case 10064: return "Host is down."; - case 10065: return "No route to host."; - case 10067: return "Too many processes."; - case 10091: return "Network subsystem is unavailable."; - case 10092: return "Winsock.dll version out of range."; - case 10093: return "Successful WSAStartup not yet performed."; - case 10101: return "Graceful shutdown in progress."; - case 10109: return "Class type not found."; - case 11001: return "Host not found."; - case 11002: return "Nonauthoritative host not found."; - case 11003: return "This is a nonrecoverable error."; - case 11004: return "Valid name, no data record of requested type."; +static char tmp[100]; + switch (x) + { + case 10004: return "Interrupted function call."; + case 10013: return "Permission denied."; + case 10014: return "Bad address."; + case 10022: return "Invalid argument."; + case 10024: return "Too many open files."; + case 10035: return "Resource temporarily unavailable."; + case 10036: return "Operation now in progress."; + case 10037: return "Operation already in progress."; + case 10038: return "Socket operation on nonsocket."; + case 10039: return "Destination address required."; + case 10040: return "Message too long."; + case 10041: return "Protocol wrong type for socket."; + case 10042: return "Bad protocol option."; + case 10043: return "Protocol not supported."; + case 10044: return "Socket type not supported."; + case 10045: return "Operation not supported."; + case 10046: return "Protocol family not supported."; + case 10047: return "Address family not supported by protocol family."; + case 10048: return "Address already in use."; + case 10049: return "Cannot assign requested address."; + case 10050: return "Network is down."; + case 10051: return "Network is unreachable."; + case 10052: return "Network dropped connection on reset."; + case 10053: return "Software caused connection abort."; + case 10054: return "Connection reset by peer."; + case 10055: return "No buffer space available."; + case 10056: return "Socket is already connected."; + case 10057: return "Socket is not connected."; + case 10058: return "Cannot send after socket shutdown."; + case 10060: return "Connection timed out."; + case 10061: return "Connection refused."; + case 10064: return "Host is down."; + case 10065: return "No route to host."; + case 10067: return "Too many processes."; + case 10091: return "Network subsystem is unavailable."; + case 10092: return "Winsock.dll version out of range."; + case 10093: return "Successful WSAStartup not yet performed."; + case 10101: return "Graceful shutdown in progress."; + case 10109: return "Class type not found."; + case 11001: return "Host not found."; + case 11002: return "Nonauthoritative host not found."; + case 11003: return "This is a nonrecoverable error."; + case 11004: return "Valid name, no data record of requested type."; - default: - break; - } - sprintf(tmp, "Winsock error code: %d", x); - return tmp; + default: + break; + } + sprintf(tmp, "Winsock error code: %d", x); + return tmp; } diff --git a/dep/src/zthread/ConditionImpl.h b/dep/src/zthread/ConditionImpl.h index eeeaba10bbc..ad1503ef197 100644 --- a/dep/src/zthread/ConditionImpl.h +++ b/dep/src/zthread/ConditionImpl.h @@ -19,7 +19,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ - + #ifndef __ZTCONDITIONIMPL_H__ #define __ZTCONDITIONIMPL_H__ @@ -39,16 +39,16 @@ namespace ZThread { * * The ConditionImpl template allows how waiter lists are sorted * to be parameteized - */ -template + */ +template class ConditionImpl { - + //! Waiters currently blocked List _waiters; //! Serialize access to this object FastLock _lock; - + //! External lock Lockable& _predicateLock; @@ -80,7 +80,7 @@ class ConditionImpl { }; -template +template ConditionImpl::~ConditionImpl() { #ifndef NDEBUG @@ -89,7 +89,7 @@ ConditionImpl::~ConditionImpl() { if(!_waiters.empty()) { ZTDEBUG("** You are destroying a condition variable which still has waiting threads. **\n"); - assert(0); + assert(0); } @@ -101,14 +101,14 @@ ConditionImpl::~ConditionImpl() { /** * Signal the condition variable, waking one thread if any. */ -template +template void ConditionImpl::signal() { Guard g1(_lock); // Try to find a waiter with a backoff & retry scheme for(;;) { - + // Go through the list, attempt to notify() a waiter. for(typename List::iterator i = _waiters.begin(); i != _waiters.end();) { @@ -117,28 +117,28 @@ void ConditionImpl::signal() { Monitor& m = impl->getMonitor(); if(m.tryAcquire()) { - + // Notify the monitor & remove from the waiter list so time isn't // wasted checking it again. i = _waiters.erase(i); - - // If notify() is not sucessful, it is because the wait() has already + + // If notify() is not sucessful, it is because the wait() has already // been ended (killed/interrupted/notify'd) bool woke = m.notify(); - + m.release(); - + // Once notify() succeeds, return - if(woke) + if(woke) return; - + } else ++i; - + } - + if(_waiters.empty()) return; - + { // Backoff and try again Guard g2(g1); @@ -154,14 +154,14 @@ void ConditionImpl::signal() { * Broadcast to the condition variable, waking all threads waiting at the time of * the broadcast. */ -template +template void ConditionImpl::broadcast() { Guard g1(_lock); // Try to find a waiter with a backoff & retry scheme for(;;) { - + // Go through the list, attempt to notify() a waiter. for(typename List::iterator i = _waiters.begin(); i != _waiters.end();) { @@ -170,21 +170,21 @@ void ConditionImpl::broadcast() { Monitor& m = impl->getMonitor(); if(m.tryAcquire()) { - + // Notify the monitor & remove from the waiter list so time isn't // wasted checking it again. i = _waiters.erase(i); - + // Try to wake the waiter, it doesn't matter if this is successful - // or not (only fails when the monitor is already going to stop waiting). + // or not (only fails when the monitor is already going to stop waiting). m.notify(); - + m.release(); - + } else ++i; - + } - + if(_waiters.empty()) return; @@ -199,16 +199,16 @@ void ConditionImpl::broadcast() { } -/** +/** * Cause the currently executing thread to block until this ConditionImpl has * been signaled, the threads state changes. * - * @param predicate Lockable& + * @param predicate Lockable& * * @exception Interrupted_Exception thrown when the caller status is interrupted * @exception Synchronization_Exception thrown if there is some other error. */ -template +template void ConditionImpl::wait() { // Get the monitor for the current thread @@ -220,13 +220,13 @@ void ConditionImpl::wait() { { Guard g1(_lock); - - // Release the _predicateLock + + // Release the _predicateLock _predicateLock.release(); - + // Stuff the waiter into the list _waiters.insert(self); - + // Move to the monitor's lock m.acquire(); @@ -234,12 +234,12 @@ void ConditionImpl::wait() { Guard g2(g1); state = m.wait(); - + } // Move back to the Condition's lock m.release(); - + // Remove from waiter list, regarless of weather release() is called or // not. The monitor is sticky, so its possible a state 'stuck' from a // previous operation and will leave the wait() w/o release() having @@ -247,7 +247,7 @@ void ConditionImpl::wait() { typename List::iterator i = std::find(_waiters.begin(), _waiters.end(), self); if(i != _waiters.end()) _waiters.erase(i); - + } // Defer interruption until the external lock is acquire()d @@ -265,16 +265,16 @@ void ConditionImpl::wait() { } switch(state) { - + case Monitor::SIGNALED: break; - + case Monitor::INTERRUPTED: throw Interrupted_Exception(); - + default: throw Synchronization_Exception(); - } + } } @@ -283,7 +283,7 @@ void ConditionImpl::wait() { * Cause the currently executing thread to block until this ConditionImpl has * been signaled, or the timeout expires or the threads state changes. * - * @param _predicateLock Lockable& + * @param _predicateLock Lockable& * @param timeout maximum milliseconds to block. * * @return bool @@ -291,9 +291,9 @@ void ConditionImpl::wait() { * @exception Interrupted_Exception thrown when the caller status is interrupted * @exception Synchronization_Exception thrown if there is some other error. */ -template +template bool ConditionImpl::wait(unsigned long timeout) { - + // Get the monitor for the current thread ThreadImpl* self = ThreadImpl::current(); Monitor& m = self->getMonitor(); @@ -303,18 +303,18 @@ bool ConditionImpl::wait(unsigned long timeout) { { Guard g1(_lock); - - // Release the _predicateLock + + // Release the _predicateLock _predicateLock.release(); - + // Stuff the waiter into the list _waiters.insert(self); - + state = Monitor::TIMEDOUT; - + // Don't bother waiting if the timeout is 0 if(timeout) { - + m.acquire(); { @@ -325,9 +325,9 @@ bool ConditionImpl::wait(unsigned long timeout) { } m.release(); - + } - + // Remove from waiter list, regarless of weather release() is called or // not. The monitor is sticky, so its possible a state 'stuck' from a // previous operation and will leave the wait() w/o release() having @@ -335,7 +335,7 @@ bool ConditionImpl::wait(unsigned long timeout) { typename List::iterator i = std::find(_waiters.begin(), _waiters.end(), self); if(i != _waiters.end()) _waiters.erase(i); - + } @@ -354,19 +354,19 @@ bool ConditionImpl::wait(unsigned long timeout) { } switch(state) { - + case Monitor::SIGNALED: break; - + case Monitor::INTERRUPTED: throw Interrupted_Exception(); - + case Monitor::TIMEDOUT: return false; default: throw Synchronization_Exception(); - } + } return true; diff --git a/dep/src/zthread/Debug.h b/dep/src/zthread/Debug.h index 484b37f7d6f..1762de22fe3 100644 --- a/dep/src/zthread/Debug.h +++ b/dep/src/zthread/Debug.h @@ -26,7 +26,7 @@ # include # define ZTDEBUG printf #else -# define ZTDEBUG(x) +# define ZTDEBUG(x) #endif #endif diff --git a/dep/src/zthread/DeferredInterruptionScope.h b/dep/src/zthread/DeferredInterruptionScope.h index 041d1e427f6..5205c80ca58 100644 --- a/dep/src/zthread/DeferredInterruptionScope.h +++ b/dep/src/zthread/DeferredInterruptionScope.h @@ -34,14 +34,14 @@ namespace ZThread { * @date <2003-07-16T19:45:18-0400> * @version 2.3.0 * - * Locking policy for a Guard that will defer any state reported - * for the reported Status of a thread except SIGNALED until the + * Locking policy for a Guard that will defer any state reported + * for the reported Status of a thread except SIGNALED until the * scope has ended. This allows a Guard to be used to create an - * uninterruptible region in code. + * uninterruptible region in code. */ class DeferredInterruptionScope { public: - + template static void createScope(LockHolder& l) { diff --git a/dep/src/zthread/FastRecursiveLock.h b/dep/src/zthread/FastRecursiveLock.h index 0a36f62d5f8..96b66ebe675 100644 --- a/dep/src/zthread/FastRecursiveLock.h +++ b/dep/src/zthread/FastRecursiveLock.h @@ -33,11 +33,11 @@ // Select the correct FastRecusriveLock implementation based on // what the compilation environment has defined -#if defined(ZTHREAD_DUAL_LOCKS) +#if defined(ZTHREAD_DUAL_LOCKS) # include "vanilla/DualMutexRecursiveLock.h" #else -# ifndef ZT_VANILLA +# ifndef ZT_VANILLA # if defined(ZT_POSIX) @@ -50,7 +50,7 @@ # include "linux/FastRecursiveLock.h" # elif defined(HAVE_MUTEXATTR_SETTYPE) # include "solaris/FastRecursiveLock.h" -# elif defined(ZTHREAD_CONDITION_LOCKS) +# elif defined(ZTHREAD_CONDITION_LOCKS) # include "posix/ConditionRecursiveLock.h" # endif diff --git a/dep/src/zthread/IntrusivePtr.h b/dep/src/zthread/IntrusivePtr.h index 47d5afbfcb8..189ebaf8ad7 100644 --- a/dep/src/zthread/IntrusivePtr.h +++ b/dep/src/zthread/IntrusivePtr.h @@ -35,16 +35,16 @@ namespace ZThread { * @version 2.2.0 * * This template creates an intrusively reference counted object - * an IntrusivePtr starts out with a 1 count, which is updated as references are - * added and removed. When the reference count drops to 0, the - * IntrusivePtr will delete itself. + * an IntrusivePtr starts out with a 1 count, which is updated as references are + * added and removed. When the reference count drops to 0, the + * IntrusivePtr will delete itself. */ template class IntrusivePtr : NonCopyable { - + //! Intrusive reference count size_t _count; - + //! Synchornization object LockType _lock; @@ -54,7 +54,7 @@ public: * Create an IntrusivePtr with a count. */ IntrusivePtr(size_t InitialCount=1) : _count(InitialCount) { } - + /** * Destroy an IntrusivePtr */ @@ -67,7 +67,7 @@ public: void addReference() { Guard g(_lock); - _count++; + _count++; } diff --git a/dep/src/zthread/Monitor.h b/dep/src/zthread/Monitor.h index 6f9492fe32c..1170982292e 100644 --- a/dep/src/zthread/Monitor.h +++ b/dep/src/zthread/Monitor.h @@ -29,7 +29,7 @@ # error "Reserved symbol defined" #endif -// Include the dependencies for a Montior +// Include the dependencies for a Montior #ifdef HAVE_CONFIG_H # include "config.h" #endif diff --git a/dep/src/zthread/MutexImpl.h b/dep/src/zthread/MutexImpl.h index 10a9160ce5a..21338ba289c 100644 --- a/dep/src/zthread/MutexImpl.h +++ b/dep/src/zthread/MutexImpl.h @@ -58,14 +58,14 @@ protected: * @version 2.2.11 * @class MutexImpl * - * The MutexImpl template allows how waiter lists are sorted, and + * The MutexImpl template allows how waiter lists are sorted, and * what actions are taken when a thread interacts with the mutex * to be parametized. */ -template +template class MutexImpl : Behavior { - //! List of Events that are waiting for notification + //! List of Events that are waiting for notification List _waiters; //! Serialize access to this Mutex @@ -75,7 +75,7 @@ class MutexImpl : Behavior { volatile ThreadImpl* _owner; public: - + /** * Create a new MutexImpl @@ -84,11 +84,11 @@ class MutexImpl : Behavior { * properly allocated */ MutexImpl() : _owner(0) { } - + ~MutexImpl(); void acquire(); - + void release(); bool tryAcquire(unsigned long timeout); @@ -98,20 +98,20 @@ class MutexImpl : Behavior { /** * Destroy this MutexImpl and release its resources */ -template +template MutexImpl::~MutexImpl() { #ifndef NDEBUG // It is an error to destroy a mutex that has not been released - if(_owner != 0) { + if(_owner != 0) { ZTDEBUG("** You are destroying a mutex which was never released. **\n"); assert(0); // Destroyed mutex while in use } - if(!_waiters.empty()) { + if(!_waiters.empty()) { ZTDEBUG("** You are destroying a mutex which is blocking %d threads. **\n", _waiters.size()); assert(0); // Destroyed mutex while in use @@ -125,7 +125,7 @@ MutexImpl::~MutexImpl() { /** * Acquire a lock on the mutex. If this operation succeeds the calling - * thread holds an exclusive lock on this mutex, otherwise it is blocked + * thread holds an exclusive lock on this mutex, otherwise it is blocked * until the lock can be acquired. * * @exception Deadlock_Exception thrown when the caller attempts to acquire() more @@ -133,7 +133,7 @@ MutexImpl::~MutexImpl() { * @exception Interrupted_Exception thrown when the caller status is interrupted * @exception Synchronization_Exception thrown if there is some other error. */ -template +template void MutexImpl::acquire() { ThreadImpl* self = ThreadImpl::current(); @@ -142,41 +142,41 @@ void MutexImpl::acquire() { Monitor::STATE state; Guard g1(_lock); - - // Deadlock will occur if the current thread is the owner + + // Deadlock will occur if the current thread is the owner // and there is no entry count. - if(_owner == self) + if(_owner == self) throw Deadlock_Exception(); - + // Acquire the lock if it is free and there are no waiting threads if(_owner == 0 && _waiters.empty()) { _owner = self; this->ownerAcquired(self); - + } // Otherwise, wait for a signal from a thread releasing its // ownership of the lock - else { - + else { + _waiters.insert(self); m.acquire(); this->waiterArrived(self); - { - + { + Guard g2(g1); state = m.wait(); - + } this->waiterDeparted(self); m.release(); - + // Remove from waiter list, regardless of wether release() is called or // not. The monitor is sticky, so its possible a state 'stuck' from a // previous operation and will leave the wait() w/o release() having @@ -185,26 +185,26 @@ void MutexImpl::acquire() { if(i != _waiters.end()) _waiters.erase(i); - // If awoke due to a notify(), take ownership. + // If awoke due to a notify(), take ownership. switch(state) { case Monitor::SIGNALED: assert(_owner == 0); - _owner = self; + _owner = self; this->ownerAcquired(self); break; - + case Monitor::INTERRUPTED: throw Interrupted_Exception(); - + default: throw Synchronization_Exception(); - } - + } + } - + } @@ -218,17 +218,17 @@ void MutexImpl::acquire() { * @exception Interrupted_Exception thrown when the caller status is interrupted * @exception Synchronization_Exception thrown if there is some other error. */ -template +template bool MutexImpl::tryAcquire(unsigned long timeout) { - + ThreadImpl* self = ThreadImpl::current(); Monitor& m = self->getMonitor(); Guard g1(_lock); - - // Deadlock will occur if the current thread is the owner + + // Deadlock will occur if the current thread is the owner // and there is no entry count. - if(_owner == self) + if(_owner == self) throw Deadlock_Exception(); // Acquire the lock if it is free and there are no waiting threads @@ -237,38 +237,38 @@ bool MutexImpl::tryAcquire(unsigned long timeout) { _owner = self; this->ownerAcquired(self); - + } // Otherwise, wait for a signal from a thread releasing its // ownership of the lock else { - + _waiters.insert(self); - + Monitor::STATE state = Monitor::TIMEDOUT; - + // Don't bother waiting if the timeout is 0 if(timeout) { - + m.acquire(); this->waiterArrived(self); - + { - + Guard g2(g1); state = m.wait(timeout); - + } this->waiterDeparted(self); - + m.release(); - + } - - + + // Remove from waiter list, regarless of weather release() is called or // not. The monitor is sticky, so its possible a state 'stuck' from a // previous operation and will leave the wait() w/o release() having @@ -276,50 +276,50 @@ bool MutexImpl::tryAcquire(unsigned long timeout) { typename List::iterator i = std::find(_waiters.begin(), _waiters.end(), self); if(i != _waiters.end()) _waiters.erase(i); - - // If awoke due to a notify(), take ownership. + + // If awoke due to a notify(), take ownership. switch(state) { case Monitor::SIGNALED: - + assert(0 == _owner); _owner = self; this->ownerAcquired(self); - + break; - + case Monitor::INTERRUPTED: throw Interrupted_Exception(); - + case Monitor::TIMEDOUT: return false; - + default: throw Synchronization_Exception(); - } - + } + } - + return true; - + } /** * Release a lock on the mutex. If this operation succeeds the calling - * thread no longer holds an exclusive lock on this mutex. If there are - * waiting threads, one will be selected, assigned ownership and specifically + * thread no longer holds an exclusive lock on this mutex. If there are + * waiting threads, one will be selected, assigned ownership and specifically * awakened. * - * @exception InvalidOp_Exception - thrown if an attempt is made to + * @exception InvalidOp_Exception - thrown if an attempt is made to * release a mutex not owned by the calling thread. */ -template +template void MutexImpl::release() { ThreadImpl* impl = ThreadImpl::current(); Guard g1(_lock); - + // Make sure the operation is valid if(_owner != impl) throw InvalidOp_Exception(); @@ -327,45 +327,45 @@ void MutexImpl::release() { _owner = 0; this->ownerReleased(impl); - + // Try to find a waiter with a backoff & retry scheme for(;;) { - + // Go through the list, attempt to notify() a waiter. for(typename List::iterator i = _waiters.begin(); i != _waiters.end();) { - + // Try the monitor lock, if it cant be locked skip to the next waiter impl = *i; Monitor& m = impl->getMonitor(); if(m.tryAcquire()) { - - // If notify() is not sucessful, it is because the wait() has already + + // If notify() is not sucessful, it is because the wait() has already // been ended (killed/interrupted/notify'd) bool woke = m.notify(); - + m.release(); - + // Once notify() succeeds, return if(woke) return; - + } else ++i; - + } - + if(_waiters.empty()) return; { // Backoff and try again - + Guard g2(g1); ThreadImpl::yield(); } } - + } } // namespace ZThread diff --git a/dep/src/zthread/RecursiveMutexImpl.h b/dep/src/zthread/RecursiveMutexImpl.h index 9e1ae050c5b..1e477136f52 100644 --- a/dep/src/zthread/RecursiveMutexImpl.h +++ b/dep/src/zthread/RecursiveMutexImpl.h @@ -39,14 +39,14 @@ namespace ZThread { * @date <2003-07-16T19:58:26-0400> * @version 2.1.6 * - * This synchronization object provides serialized access - * through an acquire/release protocol. + * This synchronization object provides serialized access + * through an acquire/release protocol. */ class ZTHREAD_API RecursiveMutexImpl { - - typedef std::vector List; - //! List of Events that are waiting for notification + typedef std::vector List; + + //! List of Events that are waiting for notification List _waiters; //! Serialize access to this Mutex @@ -55,24 +55,24 @@ namespace ZThread { //! Current owning Event object Monitor* _owner; - //! Entry count + //! Entry count size_t _count; public: - - RecursiveMutexImpl(); + + RecursiveMutexImpl(); virtual ~RecursiveMutexImpl(); - + void acquire(); - + bool tryAcquire(unsigned long); - - void release(); + + void release(); }; /* RecursiveMutexImpl */ -}; +}; #endif diff --git a/dep/src/zthread/Scheduling.h b/dep/src/zthread/Scheduling.h index b12f7fff0b6..00061341d62 100644 --- a/dep/src/zthread/Scheduling.h +++ b/dep/src/zthread/Scheduling.h @@ -52,7 +52,7 @@ namespace ZThread { * @struct priority_order */ struct priority_order : public std::binary_function { - + std::less id; bool operator()(const ThreadImpl* t0, const ThreadImpl* t1) const { @@ -66,7 +66,7 @@ namespace ZThread { return id(t0, t1); } - + }; @@ -76,15 +76,15 @@ namespace ZThread { * @version 2.2.0 * @class priority_list */ - class priority_list : public std::deque { + class priority_list : public std::deque { priority_order comp; public: - void insert(const value_type& val) { + void insert(const value_type& val) { - push_back(val); + push_back(val); std::sort(begin(), end(), comp); } diff --git a/dep/src/zthread/SemaphoreImpl.h b/dep/src/zthread/SemaphoreImpl.h index 086c4333fd0..7f1b866c387 100644 --- a/dep/src/zthread/SemaphoreImpl.h +++ b/dep/src/zthread/SemaphoreImpl.h @@ -44,7 +44,7 @@ namespace ZThread { * The SemaphoreImpl template allows how waiter lists are sorted * to be parameteized */ - template + template class SemaphoreImpl { //! List of waiting events @@ -58,7 +58,7 @@ namespace ZThread { //! Maximum count if any volatile int _maxCount; - + //! Flag for bounded or unbounded count volatile bool _checked; @@ -66,41 +66,41 @@ namespace ZThread { volatile int _entryCount; public: - - + + /** - * Create a new SemaphoreImpl. Initialzes one pthreads mutex for + * Create a new SemaphoreImpl. Initialzes one pthreads mutex for * internal use. * * @exception Initialization_Exception thrown if resources could not be * properly allocated */ - SemaphoreImpl(int count, unsigned int maxCount, bool checked) + SemaphoreImpl(int count, unsigned int maxCount, bool checked) : _count(count), _maxCount(maxCount), _checked(checked), _entryCount(0) { } ~SemaphoreImpl(); void acquire(); - + void release(); bool tryAcquire(unsigned long timeout); - + int count(); - }; + }; /** - * Destroy this SemaphoreImpl and release its resources. + * Destroy this SemaphoreImpl and release its resources. */ - template + template SemaphoreImpl::~SemaphoreImpl() { #ifndef NDEBUG - if(!_waiters.empty()) { + if(!_waiters.empty()) { ZTDEBUG("** You are destroying a semaphore which is blocking %d threads. **\n", _waiters.size()); assert(0); // Destroyed semaphore while in use @@ -117,21 +117,21 @@ namespace ZThread { * * @return int */ - template + template int SemaphoreImpl::count() { Guard g(_lock); return _count; - + } /** * Decrement the count, blocking when that count becomes 0 or less. - * + * * @exception Interrupted_Exception thrown when the caller status is interrupted * @exception Synchronization_Exception thrown if there is some other error. */ - template + template void SemaphoreImpl::acquire() { // Get the monitor for the current thread @@ -155,14 +155,14 @@ namespace ZThread { m.acquire(); { - + Guard g2(g1); state = m.wait(); - + } m.release(); - + // Remove from waiter list, regarless of weather release() is called or // not. The monitor is sticky, so its possible a state 'stuck' from a // previous operation and will leave the wait() w/o release() having @@ -170,38 +170,38 @@ namespace ZThread { typename List::iterator i = std::find(_waiters.begin(), _waiters.end(), self); if(i != _waiters.end()) _waiters.erase(i); - + --_entryCount; switch(state) { // If awoke due to a notify(), update the count case Monitor::SIGNALED: - - _count--; + + _count--; break; - + case Monitor::INTERRUPTED: throw Interrupted_Exception(); - + default: throw Synchronization_Exception(); - } - + } + } } /** * Decrement the count, blocking when it that count is 0 or less. If the timeout - * expires before the count is raise above 0, the thread will stop blocking + * expires before the count is raise above 0, the thread will stop blocking * and return. - * + * * @exception Interrupted_Exception thrown when the caller status is interrupted * @exception Synchronization_Exception thrown if there is some other error. */ - template + template bool SemaphoreImpl::tryAcquire(unsigned long timeout) { - + // Get the monitor for the current thread ThreadImpl* self = ThreadImpl::current(); Monitor& m = self->getMonitor(); @@ -214,7 +214,7 @@ namespace ZThread { // Otherwise, wait() for the lock by placing the waiter in the list else { - + ++_entryCount; _waiters.push_back(self); @@ -222,20 +222,20 @@ namespace ZThread { // Don't bother waiting if the timeout is 0 if(timeout) { - + m.acquire(); { - + Guard g2(g1); state = m.wait(timeout); - + } m.release(); - + } - + // Remove from waiter list, regarless of weather release() is called or // not. The monitor is sticky, so its possible a state 'stuck' from a // previous operation and will leave the wait() w/o release() having @@ -243,26 +243,26 @@ namespace ZThread { typename List::iterator i = std::find(_waiters.begin(), _waiters.end(), self); if(i != _waiters.end()) _waiters.erase(i); - + --_entryCount; switch(state) { // If awoke due to a notify(), update the count case Monitor::SIGNALED: - - _count--; + + _count--; break; - + case Monitor::INTERRUPTED: throw Interrupted_Exception(); - + case Monitor::TIMEDOUT: return false; default: throw Synchronization_Exception(); - } - + } + } return true; @@ -272,18 +272,18 @@ namespace ZThread { /** * Increment the count and release a waiter if there are any. If the semaphore * is checked, then an exception will be raised if the maximum count is about to - * be exceeded. + * be exceeded. * * @exception InvalidOp_Exception thrown if the maximum count is exceeded while * the checked flag is set. */ - template + template void SemaphoreImpl::release() { Guard g1(_lock); // Make sure the operation is valid - if(_checked && _count == _maxCount) + if(_checked && _count == _maxCount) throw InvalidOp_Exception(); // Increment the count @@ -291,7 +291,7 @@ namespace ZThread { // Try to find a waiter with a backoff & retry scheme for(;;) { - + // Go through the list, attempt to notify() a waiter. for(typename List::iterator i = _waiters.begin(); i != _waiters.end();) { @@ -300,43 +300,43 @@ namespace ZThread { Monitor& m = impl->getMonitor(); if(m.tryAcquire()) { - + // Notify the monitor & remove from the waiter list so time isn't // wasted checking it again. i = _waiters.erase(i); - - // If notify() is not sucessful, it is because the wait() has already + + // If notify() is not sucessful, it is because the wait() has already // been ended (killed/interrupted/notify'd) bool woke = m.notify(); - + m.release(); - + // Once notify() succeeds, return - if(woke) + if(woke) return; - + } else ++i; - + } - + if(_waiters.empty()) return; - + { // Backoff and try again - + Guard g2(g1); ThreadImpl::yield(); } } - + } - class FifoSemaphoreImpl : public SemaphoreImpl { + class FifoSemaphoreImpl : public SemaphoreImpl { public: - FifoSemaphoreImpl(int count, unsigned int maxCount, bool checked) + FifoSemaphoreImpl(int count, unsigned int maxCount, bool checked) /* throw(Synchronization_Exception) */ : SemaphoreImpl(count, maxCount, checked) { } diff --git a/dep/src/zthread/State.h b/dep/src/zthread/State.h index 85279f4bde8..96697c9d4bd 100644 --- a/dep/src/zthread/State.h +++ b/dep/src/zthread/State.h @@ -26,7 +26,7 @@ namespace ZThread { /** - * @class State + * @class State * @author Eric Crahen * @date <2003-07-16T20:04:01-0400> * @version 2.2.1 @@ -52,7 +52,7 @@ class State { } /** - * Test for the JOINED state. A task has completed and + * Test for the JOINED state. A task has completed and * the thread is join()ed. * * @return bool diff --git a/dep/src/zthread/Status.h b/dep/src/zthread/Status.h index 4735e352861..a56d505a8f4 100644 --- a/dep/src/zthread/Status.h +++ b/dep/src/zthread/Status.h @@ -37,22 +37,22 @@ namespace ZThread { class Status { public: //! Aggregate of pending status changes - volatile unsigned short _pending; - - //! Interest mask + volatile unsigned short _pending; + + //! Interest mask volatile unsigned short _mask; public: - + //! State for the monitor typedef enum { - + // Default INVALID = 0x00, // Valid states SIGNALED = 0x01, - INTERRUPTED = 0x02, + INTERRUPTED = 0x02, TIMEDOUT = 0x04, CANCELED = 0x08, @@ -62,10 +62,10 @@ namespace ZThread { } STATE; Status() : _pending((unsigned short)INVALID), _mask((unsigned short)ANYTHING) { } - + /** * Set the mask for the STATE's that next() will report. - * STATE's not covered by the interest mask can still be + * STATE's not covered by the interest mask can still be * set, they just aren't reported until the mask is changed * to cover that STATE. * @@ -87,19 +87,19 @@ namespace ZThread { * * @param unsigned short * @pre accessed ONLY by the owning thread. - */ + */ bool pending(unsigned short mask) { - + assert(mask != INVALID); return ((_pending & _mask) & mask) != INVALID; } /** - * Check the state without the interest mask. + * Check the state without the interest mask. * - * @param state - * @return true if the flag is set + * @param state + * @return true if the flag is set * @pre access must be serial */ bool examine(STATE state) { @@ -113,12 +113,12 @@ namespace ZThread { * @pre access must be serial */ void push(STATE interest) { - _pending |= interest; + _pending |= interest; } /** * Clear the flags from the current state - * + * * @param interest - the flags to clear from the current state. * @pre access must be serial */ @@ -129,16 +129,16 @@ namespace ZThread { assert(interest != CANCELED); _pending &= ~interest; - + } /** * Get the next state from set that has accumulated. The order STATES are - * reported in is SIGNALED, TIMEOUT, or INTERRUPTED. Setting the - * intrest mask allows certain state to be selectively ignored for + * reported in is SIGNALED, TIMEOUT, or INTERRUPTED. Setting the + * intrest mask allows certain state to be selectively ignored for * a time - but not lost. The states will become visible again as soon - * as the interest mask is changed appropriately. The interest mask is - * generally used to create uninterruptable waits (waiting for threads + * as the interest mask is changed appropriately. The interest mask is + * generally used to create uninterruptable waits (waiting for threads * to start, reacquiring a conditions predicate lock, etc) * * @return STATE @@ -147,29 +147,29 @@ namespace ZThread { STATE next() { STATE state = INVALID; - + if(((_pending & _mask) & SIGNALED) != 0) { - + // Absorb the timeout if it happens when a signal // is available at the same time _pending &= ~(SIGNALED|TIMEDOUT); state = SIGNALED; - + } else if(((_pending & _mask) & TIMEDOUT) != 0) { _pending &= ~TIMEDOUT; state = TIMEDOUT; } else if(((_pending & _mask) & INTERRUPTED) != 0) { - + _pending &= ~INTERRUPTED; state = INTERRUPTED; - - } - + + } + assert(state != INVALID); return state; - + } }; diff --git a/dep/src/zthread/ThreadImpl.h b/dep/src/zthread/ThreadImpl.h index ae2c8f23960..f464242918c 100644 --- a/dep/src/zthread/ThreadImpl.h +++ b/dep/src/zthread/ThreadImpl.h @@ -53,7 +53,7 @@ class ThreadImpl : public IntrusivePtr, public ThreadOps { //! The Monitor for controlling this thread Monitor _monitor; - + //! Current state for the thread State _state; @@ -61,11 +61,11 @@ class ThreadImpl : public IntrusivePtr, public ThreadOps { List _joiners; public: - + typedef std::map ThreadLocalMap; private: - + ThreadLocalMap _tls; //! Cached thread priority @@ -73,7 +73,7 @@ class ThreadImpl : public IntrusivePtr, public ThreadOps { //! Request cancel() when main() goes out of scope bool _autoCancel; - + void start(const Task& task); public: @@ -82,7 +82,7 @@ class ThreadImpl : public IntrusivePtr, public ThreadOps { ThreadImpl(const Task&, bool); - ~ThreadImpl(); + ~ThreadImpl(); Monitor& getMonitor(); @@ -99,24 +99,24 @@ class ThreadImpl : public IntrusivePtr, public ThreadOps { // ThreadLocalMap& getThreadLocalMap(); ThreadLocalMap& getThreadLocalMap() { return _tls; } - bool join(unsigned long); - + bool join(unsigned long); + void setPriority(Priority); bool isActive(); bool isReference(); - static void sleep(unsigned long); + static void sleep(unsigned long); static void yield(); - + static ThreadImpl* current(); static void dispatch(ThreadImpl*, ThreadImpl*, Task); }; -} // namespace ZThread +} // namespace ZThread #endif // __ZTTHREADIMPL_H__ diff --git a/dep/src/zthread/ThreadOps.h b/dep/src/zthread/ThreadOps.h index eef9f3c6e31..d8737158e3e 100644 --- a/dep/src/zthread/ThreadOps.h +++ b/dep/src/zthread/ThreadOps.h @@ -39,9 +39,9 @@ #elif defined(ZT_WIN32) || defined(ZT_WIN9X) // Visual C provides the _beginthreadex function, other compilers -// might not have this if they don't use Microsoft's C runtime. -// _beginthreadex is similar to in effect defining REENTRANT on a -// POSIX system. CreateThreadEx doesn't use reentrant parts of the +// might not have this if they don't use Microsoft's C runtime. +// _beginthreadex is similar to in effect defining REENTRANT on a +// POSIX system. CreateThreadEx doesn't use reentrant parts of the // Microsfot C runtime, but if your not using that runtime, no problem. # if !defined(HAVE_BEGINTHREADEX) diff --git a/dep/src/zthread/ThreadQueue.h b/dep/src/zthread/ThreadQueue.h index 044f8263026..72049fda3b2 100644 --- a/dep/src/zthread/ThreadQueue.h +++ b/dep/src/zthread/ThreadQueue.h @@ -31,7 +31,7 @@ namespace ZThread { class ThreadImpl; - + /** * @class ThreadQueue * @version 2.3.0 @@ -41,7 +41,7 @@ namespace ZThread { * A ThreadQueue accumulates references to user and reference threads. * These are threads that are running outside the scope of the Thread * object that created them. ZThreads doesn't have a central manager for - * all threads (partly why I renamed the ThreadManager to someting more + * all threads (partly why I renamed the ThreadManager to someting more * appropriate). Instead, ZThreads will discover threads it did not create * and create a reference thread that allows ZThreads to interact with it. * Non user threads that are created by the user never have to touch the @@ -56,19 +56,19 @@ namespace ZThread { ThreadList _pendingThreads; ThreadList _referenceThreads; ThreadList _userThreads; - + //! Shutdown handlers TaskList _shutdownTasks; //! Serilize access to the thread list FastLock _lock; - + //! Reference thread waiting to cleanup any user & reference threads ThreadImpl* _waiter; public: - ThreadQueue(); + ThreadQueue(); /** * The thread destroys a ThreadQueue will be a reference thread, @@ -84,16 +84,16 @@ namespace ZThread { * * User-threads are known to be executing thier tasks and will be cancel()ed * as the ThreadQueue is destroyed when main() goes out of scope. This sends - * a request to the task to complete soon. Once the task exits, the thread is + * a request to the task to complete soon. Once the task exits, the thread is * transitioned to pending-thread status. */ void insertUserThread(ThreadImpl*); /** - * Insert a pending-thread into the queue. - * - * Pending-threads are known to have completed thier tasks and thier - * resources are reclaimed (lazily) as more threads are started or as the + * Insert a pending-thread into the queue. + * + * Pending-threads are known to have completed thier tasks and thier + * resources are reclaimed (lazily) as more threads are started or as the * ThreadQueue is destroyed. */ void insertPendingThread(ThreadImpl*); @@ -106,8 +106,8 @@ namespace ZThread { void insertReferenceThread(ThreadImpl*); /** - * Insert a task to be run before threads are joined. - * Any items inserted after the ThreadQueue desctructor has begun to + * Insert a task to be run before threads are joined. + * Any items inserted after the ThreadQueue desctructor has begun to * execute will be run() immediately. */ void insertShutdownTask(Task&); @@ -126,7 +126,7 @@ namespace ZThread { void pollReferenceThreads(); }; - + } // namespace ZThread diff --git a/dep/src/zthread/TimeStrategy.h b/dep/src/zthread/TimeStrategy.h index 0b9ad1e22ba..249d8ab5a64 100644 --- a/dep/src/zthread/TimeStrategy.h +++ b/dep/src/zthread/TimeStrategy.h @@ -65,7 +65,7 @@ # include "macos/UpTimeStrategy.h" #elif defined(HAVE_PERFORMANCECOUNTER) - + # include "win32/PerformanceCounterStrategy.h" #elif defined(HAVE_FTIME) diff --git a/dep/src/zthread/config.h b/dep/src/zthread/config.h index 0b630dcc36c..4ef2ca213d1 100644 --- a/dep/src/zthread/config.h +++ b/dep/src/zthread/config.h @@ -23,22 +23,22 @@ #define HAVE_MEMORY_H 1 /* defined when pthreads is available */ -#define HAVE_POSIX_THREADS +#define HAVE_POSIX_THREADS /* Defined if pthread_keycreate() is available */ /* #undef HAVE_PTHREADKEYCREATE */ /* Defined if pthread_key_create() is available */ -#define HAVE_PTHREADKEY_CREATE +#define HAVE_PTHREADKEY_CREATE /* Defined if pthread_yield() is available */ -#define HAVE_PTHREAD_YIELD +#define HAVE_PTHREAD_YIELD /* Defined if -lrt is needed for RT scheduling */ -#define HAVE_SCHED_RT +#define HAVE_SCHED_RT /* Defined if sched_yield() is available */ -#define HAVE_SCHED_YIELD +#define HAVE_SCHED_YIELD /* Define to 1 if you have the header file. */ #define HAVE_STDINT_H 1 diff --git a/dep/src/zthread/linux/AtomicFastLock.h b/dep/src/zthread/linux/AtomicFastLock.h index b9aa1babcd6..a416fef67cb 100644 --- a/dep/src/zthread/linux/AtomicFastLock.h +++ b/dep/src/zthread/linux/AtomicFastLock.h @@ -44,31 +44,31 @@ namespace ZThread { * This implementation of a FastLock uses the atomic operations that * linux provides with its kernel sources. This demonstrates how to implement * a spinlock with a decrement and test primative. - */ + */ class FastLock : private NonCopyable { - + atomic_t _value; - + #if !defined(NDEBUG) pthread_t _owner; #endif public: - + inline FastLock() { - + atomic_t tmp = ATOMIC_INIT(1); _value = tmp; } - + inline ~FastLock() { assert(atomic_read(&_value) == 1); assert(_owner == 0); } - + inline void acquire() { while(!atomic_dec_and_test(&_value)) { @@ -77,14 +77,14 @@ public: ThreadOps::yield(); } - + #if !defined(NDEBUG) _owner = pthread_self(); #endif } inline void release() { - + #if !defined(NDEBUG) assert(pthread_equal(_owner, pthread_self()) != 0); #endif @@ -93,9 +93,9 @@ public: _owner = 0; } - + inline bool tryAcquire(unsigned long timeout=0) { - + bool wasLocked = atomic_dec_and_test(&_value); if(!wasLocked) atomic_inc(&_value); @@ -106,9 +106,9 @@ public: #endif return wasLocked; - + } - + }; /* FastLock */ diff --git a/dep/src/zthread/linux/FastRecursiveLock.h b/dep/src/zthread/linux/FastRecursiveLock.h index d253652cb53..a9a74d21521 100644 --- a/dep/src/zthread/linux/FastRecursiveLock.h +++ b/dep/src/zthread/linux/FastRecursiveLock.h @@ -36,45 +36,45 @@ namespace ZThread { * @version 2.2.0 * * This implementation of a FastRecursiveLock uses the recursive mutex - * that linux pthreads provides. - */ + * that linux pthreads provides. + */ class FastRecursiveLock : private NonCopyable { - + pthread_mutex_t _mtx; - + public: - + inline FastRecursiveLock() { - + static const pthread_mutexattr_t attr = { PTHREAD_MUTEX_RECURSIVE_NP }; pthread_mutex_init(&_mtx, &attr); } - + inline ~FastRecursiveLock() { pthread_mutex_destroy(&_mtx); } - + inline void acquire() { - + pthread_mutex_lock(&_mtx); } inline void release() { - + pthread_mutex_unlock(&_mtx); - + } - + inline bool tryAcquire(unsigned long timeout=0) { return (pthread_mutex_trylock(&_mtx) == 0); } - + }; /* FastRecursiveLock */ diff --git a/dep/src/zthread/macos/FastLock.h b/dep/src/zthread/macos/FastLock.h index bae5c482903..0bd40e1f2fd 100644 --- a/dep/src/zthread/macos/FastLock.h +++ b/dep/src/zthread/macos/FastLock.h @@ -39,48 +39,48 @@ namespace ZThread { * @date <2003-07-16T23:25:31-0400> * @version 2.1.6 * - */ + */ class FastLock : private NonCopyable { - + MPCriticalRegionID _mtx; public: - + /** * Create a new FastLock. No safety or state checks are performed. * * @exception Initialization_Exception - not thrown */ inline FastLock() { - + // Apple TN1071 static bool init = MPLibraryIsLoaded(); - + if(!init || MPCreateCriticalRegion(&_mtx) != noErr) { assert(0); throw Initialization_Exception(); } } - + /** * Destroy a FastLock. No safety or state checks are performed. */ inline ~FastLock() throw () { OSStatus status = MPDeleteCriticalRegion(_mtx); - if(status != noErr) + if(status != noErr) assert(false); } - + /** * Acquire an exclusive lock. No safety or state checks are performed. * * @exception Synchronization_Exception - not thrown */ inline void acquire() { - + if(MPEnterCriticalRegion(_mtx, kDurationForever) != noErr) throw Synchronization_Exception(); @@ -96,38 +96,38 @@ class FastLock : private NonCopyable { */ inline bool tryAcquire(unsigned long timeout=0) { - OSStatus status = + OSStatus status = MPEnterCriticalRegion(_mtx, kDurationMillisecond * timeout); switch(status) { case kMPTimeoutErr: return false; - + case noErr: return true; - - } - + + } + assert(0); throw Synchronization_Exception(); } - + /** * Release an exclusive lock. No safety or state checks are performed. - * The caller should have already acquired the lock, and release it + * The caller should have already acquired the lock, and release it * only once. - * + * * @exception Synchronization_Exception - not thrown */ inline void release() { - + if(MPExitCriticalRegion(_mtx) != noErr) throw Synchronization_Exception(); } - - + + }; /* FastLock */ diff --git a/dep/src/zthread/macos/Monitor.h b/dep/src/zthread/macos/Monitor.h index f4312d7b7ee..9fa3c9a5aa2 100644 --- a/dep/src/zthread/macos/Monitor.h +++ b/dep/src/zthread/macos/Monitor.h @@ -49,40 +49,40 @@ class Monitor : public Status, private NonCopyable { MPTaskID _owner; //! Waiting flag, to avoid uneccessary signals - volatile bool _waiting; + volatile bool _waiting; //! Waiting flag, to avoid too many signals - volatile bool _pending; + volatile bool _pending; //! State of the monitor volatile int _state; - + public: - + //! Create a new monitor. Monitor(); //! Destroy the monitor. ~Monitor() throw(); - //! Acquire the external lock for this monitor. + //! Acquire the external lock for this monitor. inline void acquire() { _lock.acquire(); } - //! Try to acquire the external lock for this monitor. + //! Try to acquire the external lock for this monitor. inline bool tryAcquire() { return _lock.tryAcquire(); } - //! Release the external lock for this monitor. + //! Release the external lock for this monitor. inline void release() { _lock.release(); } - + /** * Wait for a state change and atomically unlock the external lock. - * Blocks for an indefinent amount of time. + * Blocks for an indefinent amount of time. * * @return INTERRUPTED if the wait was ended by a interrupt() * or SIGNALED if the wait was ended by a notify() @@ -95,11 +95,11 @@ class Monitor : public Status, private NonCopyable { /** * Wait for a state change and atomically unlock the external lock. - * May blocks for an indefinent amount of time. + * May blocks for an indefinent amount of time. * * @param timeout - maximum time to block (milliseconds) or 0 to * block indefinently - * + * * @return INTERRUPTED if the wait was ended by a interrupt() * or TIMEDOUT if the maximum wait time expired. * or SIGNALED if the wait was ended by a notify() @@ -119,9 +119,9 @@ class Monitor : public Status, private NonCopyable { /** * Notify this monitor. If there is a thread blocked on this monitor object - * it will be signaled and released. If there is no waiter, a flag is set and - * the next attempt to wait() will return SIGNALED w/o blocking, if no other - * flag is set. + * it will be signaled and released. If there is no waiter, a flag is set and + * the next attempt to wait() will return SIGNALED w/o blocking, if no other + * flag is set. * * @return false if the thread was previously INTERRUPTED. */ diff --git a/dep/src/zthread/macos/TSS.h b/dep/src/zthread/macos/TSS.h index 3f9805d0f7c..1be90c5f278 100644 --- a/dep/src/zthread/macos/TSS.h +++ b/dep/src/zthread/macos/TSS.h @@ -38,7 +38,7 @@ namespace ZThread { * @date <2003-07-27T14:19:10-0400> * @version 2.1.6 * - * An abstraction for dealing with POSIX thread specific storage (tss). + * An abstraction for dealing with POSIX thread specific storage (tss). * Provides get/set and creation/destruction. */ template @@ -49,13 +49,13 @@ namespace ZThread { public: /** - * Create a new object for accessing tss. + * Create a new object for accessing tss. */ TSS() { // Apple TN1071 static bool init = MPLibraryIsLoaded(); - + if(!init || MPAllocateTaskStorageIndex(&_key) != noErr) { assert(0); throw Initialization_Exception(); @@ -64,17 +64,17 @@ namespace ZThread { } /** - * Destroy the underlying supoprt for accessing tss with this + * Destroy the underlying supoprt for accessing tss with this * object. */ ~TSS() { - + OSStatus status = MPDeallocateTaskStorageIndex(_key); - if(status != noErr) + if(status != noErr) assert(0); } - + /** * Get the value stored in tss. * @@ -85,8 +85,8 @@ namespace ZThread { T get() const { return reinterpret_cast(MPGetTaskStorageValue(_key)); } - - + + /** * Store a value in tss. * @@ -99,18 +99,18 @@ namespace ZThread { T oldValue = get(); - OSStatus status = + OSStatus status = MPSetTaskStorageValue(_key, reinterpret_cast(value)); - + if(status != noErr) { assert(0); throw Synchronization_Exception(); } return oldValue; - + } - + }; } diff --git a/dep/src/zthread/macos/ThreadOps.h b/dep/src/zthread/macos/ThreadOps.h index c100fcfefe5..5c4eb044e73 100644 --- a/dep/src/zthread/macos/ThreadOps.h +++ b/dep/src/zthread/macos/ThreadOps.h @@ -33,14 +33,14 @@ namespace ZThread { class Runnable; - + /** * @class ThreadOps * @author Eric Crahen * @date <2003-07-16T23:26:01-0400> * @version 2.2.0 * - * This class is an abstraction used to perform various operations on a + * This class is an abstraction used to perform various operations on a * native POSIX thread. */ class ThreadOps { @@ -55,10 +55,10 @@ class ThreadOps { public: - const static ThreadOps INVALID; + const static ThreadOps INVALID; /** - * Create a new ThreadOps to manipulate a native thread. + * Create a new ThreadOps to manipulate a native thread. */ ThreadOps(); @@ -84,20 +84,20 @@ public: } /** - * Activating an instance of ThreadOps will map it onto the currently + * Activating an instance of ThreadOps will map it onto the currently * executing thread. - */ + */ static void activate(ThreadOps* ops) { assert(ops); assert(ops->_tid == 0); ops->_tid = MPCurrentTaskID(); - + } /** - * Test if this object represents the currently executing + * Test if this object represents the currently executing * native thread. * * @return bool true if successful @@ -119,7 +119,7 @@ public: static bool join(ThreadOps*); /** - * Force the current native thread to yield, letting the scheduler + * Force the current native thread to yield, letting the scheduler * give the CPU time to another thread. * * @return bool true if successful, false if the operation can't @@ -128,7 +128,7 @@ public: static bool yield(); /** - * Set the priority for the native thread if supported by the + * Set the priority for the native thread if supported by the * system. * * @param PRIORITY requested priority @@ -137,7 +137,7 @@ public: static bool setPriority(ThreadOps*, Priority); /** - * Set the priority for the native thread if supported by the + * Set the priority for the native thread if supported by the * system. * * @param Thread::PRIORITY& current priority diff --git a/dep/src/zthread/macos/UpTimeStrategy.h b/dep/src/zthread/macos/UpTimeStrategy.h index f2056e14ca2..0f7962d7eca 100644 --- a/dep/src/zthread/macos/UpTimeStrategy.h +++ b/dep/src/zthread/macos/UpTimeStrategy.h @@ -40,7 +40,7 @@ class TimeStrategy { unsigned long _s; public: - + TimeStrategy() { // Get the absolute time in milliseconds relative to the program startup @@ -53,12 +53,12 @@ class TimeStrategy { _ms = now % 1000; } - + inline unsigned long seconds() const { return _s; } - inline unsigned long milliseconds() const { + inline unsigned long milliseconds() const { return _ms; } diff --git a/dep/src/zthread/posix/ConditionRecursiveLock.h b/dep/src/zthread/posix/ConditionRecursiveLock.h index a46ed35548c..2be55c13797 100644 --- a/dep/src/zthread/posix/ConditionRecursiveLock.h +++ b/dep/src/zthread/posix/ConditionRecursiveLock.h @@ -38,13 +38,13 @@ namespace ZThread { * @version 2.2.0 * * This is an implementation of a FastRecursiveLock for any vannila - * POSIX system. It is based on a condition variable and a mutex; + * POSIX system. It is based on a condition variable and a mutex; * because of this it is important to not that its waiting properties * are not the same as other mutex implementations that generally * based on spin locks. Under high contention, this implementation may * be preferable to a spin lock, although refactoring the design of * code that puts a mutex under alot of preasure may be worth investigating. - */ + */ class FastRecursiveLock : private NonCopyable { //! Serialize state @@ -62,25 +62,25 @@ class FastRecursiveLock : private NonCopyable { public: inline FastRecursiveLock() : _owner(0), _count(0) { - + pthread_mutex_init(&_mtx, 0); if(pthread_cond_init(&_cond, 0) != 0) { assert(0); } } - + inline ~FastRecursiveLock() { pthread_mutex_destroy(&_mtx); if(pthread_cond_destroy(&_cond) != 0) { - assert(0); + assert(0); } - + } - + inline void acquire() { - + pthread_t self = pthread_self(); pthread_mutex_lock(&_mtx); @@ -91,14 +91,14 @@ public: do { // ignore signals status = pthread_cond_wait(&_cond, &_mtx); } while(status == EINTR && _owner == 0); - + } - + _owner = self; _count++; pthread_mutex_unlock(&_mtx); - + } inline bool tryAcquire(unsigned long timeout=0) { @@ -109,10 +109,10 @@ public: // If the caller owns the lock, or there is no owner update the count bool success = (_owner == 0 || pthread_equal(_owner, self)); if(success) { - + _owner = self; _count++; - + } pthread_mutex_unlock(&_mtx); @@ -122,7 +122,7 @@ public: } inline void release() { - + assert(pthread_equal(_owner, pthread_self())); pthread_mutex_lock(&_mtx); @@ -134,13 +134,13 @@ public: } pthread_mutex_unlock(&_mtx); - + } - - + + }; /* FastRecursiveLock */ -} // namespace ZThread +} // namespace ZThread #endif diff --git a/dep/src/zthread/posix/FastLock.h b/dep/src/zthread/posix/FastLock.h index 87faf34d4ff..261fd7c893a 100644 --- a/dep/src/zthread/posix/FastLock.h +++ b/dep/src/zthread/posix/FastLock.h @@ -39,16 +39,16 @@ namespace ZThread { * * This is the smallest and fastest synchronization object in the library. * It is an implementation of fast mutex, an all or nothing exclusive - * lock. It should be used only where you need speed and are willing + * lock. It should be used only where you need speed and are willing * to sacrifice all the state & safety checking provided by the framework * for speed. - */ + */ class FastLock : private NonCopyable { - + pthread_mutex_t _mtx; public: - + /** * Create a new FastLock. No safety or state checks are performed. * @@ -60,7 +60,7 @@ class FastLock : private NonCopyable { throw Initialization_Exception(); } - + /** * Destroy a FastLock. No safety or state checks are performed. */ @@ -71,14 +71,14 @@ class FastLock : private NonCopyable { } } - + /** * Acquire an exclusive lock. No safety or state checks are performed. * * @exception Synchronization_Exception - not thrown */ inline void acquire() { - + if(pthread_mutex_lock(&_mtx) != 0) throw Synchronization_Exception(); @@ -97,22 +97,22 @@ class FastLock : private NonCopyable { return (pthread_mutex_trylock(&_mtx) == 0); } - + /** * Release an exclusive lock. No safety or state checks are performed. - * The caller should have already acquired the lock, and release it + * The caller should have already acquired the lock, and release it * only once. - * + * * @exception Synchronization_Exception - not thrown */ inline void release() { - + if(pthread_mutex_unlock(&_mtx) != 0) throw Synchronization_Exception(); } - - + + }; /* FastLock */ diff --git a/dep/src/zthread/posix/FtimeStrategy.h b/dep/src/zthread/posix/FtimeStrategy.h index 5e703970c5c..5e8d33b6c9b 100644 --- a/dep/src/zthread/posix/FtimeStrategy.h +++ b/dep/src/zthread/posix/FtimeStrategy.h @@ -55,8 +55,8 @@ public: return (unsigned long)_value.time; } - inline unsigned long milliseconds() const { - return _value.millitm; + inline unsigned long milliseconds() const { + return _value.millitm; } unsigned long seconds(unsigned long s) { diff --git a/dep/src/zthread/posix/Monitor.h b/dep/src/zthread/posix/Monitor.h index 945c879f421..fe6c8b559e3 100644 --- a/dep/src/zthread/posix/Monitor.h +++ b/dep/src/zthread/posix/Monitor.h @@ -50,7 +50,7 @@ class Monitor : public Status, private NonCopyable { pthread_t _owner; //! Waiting flag, to avoid uneccessary signals - volatile bool _waiting; + volatile bool _waiting; public: @@ -62,12 +62,12 @@ class Monitor : public Status, private NonCopyable { //! Destroy the monitor. ~Monitor(); - //! Acquire the lock for this monitor. + //! Acquire the lock for this monitor. inline void acquire() { _lock.acquire(); } - //! Acquire the lock for this monitor. + //! Acquire the lock for this monitor. inline bool tryAcquire() { return _lock.tryAcquire(); } @@ -79,7 +79,7 @@ class Monitor : public Status, private NonCopyable { /** * Wait for a state change and atomically unlock the external lock. - * Blocks for an indefinent amount of time. + * Blocks for an indefinent amount of time. * * @return INTERRUPTED if the wait was ended by a interrupt() * or SIGNALED if the wait was ended by a notify() @@ -92,11 +92,11 @@ class Monitor : public Status, private NonCopyable { /** * Wait for a state change and atomically unlock the external lock. - * May blocks for an indefinent amount of time. + * May blocks for an indefinent amount of time. * * @param timeout - maximum time to block (milliseconds) or 0 to * block indefinently - * + * * @return INTERRUPTED if the wait was ended by a interrupt() * or TIMEDOUT if the maximum wait time expired. * or SIGNALED if the wait was ended by a notify() @@ -116,9 +116,9 @@ class Monitor : public Status, private NonCopyable { /** * Notify this monitor. If there is a thread blocked on this monitor object - * it will be signaled and released. If there is no waiter, a flag is set and - * the next attempt to wait() will return SIGNALED w/o blocking, if no other - * flag is set. + * it will be signaled and released. If there is no waiter, a flag is set and + * the next attempt to wait() will return SIGNALED w/o blocking, if no other + * flag is set. * * @return false if the thread was previously INTERRUPTED. */ diff --git a/dep/src/zthread/posix/PriorityOps.h b/dep/src/zthread/posix/PriorityOps.h index 92da66a9cff..3a7f822711d 100644 --- a/dep/src/zthread/posix/PriorityOps.h +++ b/dep/src/zthread/posix/PriorityOps.h @@ -34,15 +34,15 @@ namespace ZThread { * @date <2003-07-16T23:30:00-0400> * @version 2.2.0 * - * This class is an abstraction used to perform various operations on a + * This class is an abstraction used to perform various operations on a * native POSIX thread. */ class PriorityOps { - + public: - + }; diff --git a/dep/src/zthread/posix/TSS.h b/dep/src/zthread/posix/TSS.h index 931ff348b3d..c9c9c0e352a 100644 --- a/dep/src/zthread/posix/TSS.h +++ b/dep/src/zthread/posix/TSS.h @@ -35,18 +35,18 @@ namespace ZThread { * @date <2003-07-27T14:18:37-0400> * @version 2.3.0 * - * An abstraction for dealing with POSIX thread specific storage (tss). + * An abstraction for dealing with POSIX thread specific storage (tss). * Provides get/set and creation/destruction. */ template class TSS : private NonCopyable { - + pthread_key_t _key; public: /** - * Create a new object for accessing tss. + * Create a new object for accessing tss. */ TSS() { @@ -57,15 +57,15 @@ namespace ZThread { } /** - * Destroy the underlying supoprt for accessing tss with this + * Destroy the underlying supoprt for accessing tss with this * object. */ ~TSS() { - + pthread_key_delete(_key); - + } - + /** * Get the value stored in tss. * @@ -76,8 +76,8 @@ namespace ZThread { T get() const { return reinterpret_cast(pthread_getspecific(_key)); } - - + + /** * Store a value in tss. * @@ -90,11 +90,11 @@ namespace ZThread { T oldValue = get(); pthread_setspecific(_key, value); - + return oldValue; - + } - + }; } diff --git a/dep/src/zthread/posix/ThreadOps.h b/dep/src/zthread/posix/ThreadOps.h index be754c2d659..8fef43bb3fd 100644 --- a/dep/src/zthread/posix/ThreadOps.h +++ b/dep/src/zthread/posix/ThreadOps.h @@ -31,7 +31,7 @@ namespace ZThread { class Runnable; - + //! Dispatch function for native pthreads required extern C //! linkage. extern "C" void* _dispatch(void*); @@ -42,7 +42,7 @@ extern "C" void* _dispatch(void*); * @date <2003-07-16T23:30:25-0400> * @version 2.2.8 * - * This class is an abstraction used to perform various operations on a + * This class is an abstraction used to perform various operations on a * native POSIX thread. */ class ThreadOps { @@ -54,10 +54,10 @@ class ThreadOps { public: - const static ThreadOps INVALID; + const static ThreadOps INVALID; /** - * Create a new ThreadOps to manipulate a native thread. + * Create a new ThreadOps to manipulate a native thread. */ ThreadOps() : _tid(0) { } @@ -66,26 +66,26 @@ public: return pthread_equal(_tid, ops._tid); } - + static ThreadOps self() { return ThreadOps(pthread_self()); } /** - * Activating an instance of ThreadOps will map it onto the currently + * Activating an instance of ThreadOps will map it onto the currently * executing thread. - */ + */ static void activate(ThreadOps* ops) { assert(ops); assert(ops->_tid == 0); ops->_tid = pthread_self(); - + } /** - * Test if this object represents the currently executing + * Test if this object represents the currently executing * native thread. * * @return bool true if successful @@ -107,7 +107,7 @@ public: static bool join(ThreadOps*); /** - * Force the current native thread to yield, letting the scheduler + * Force the current native thread to yield, letting the scheduler * give the CPU time to another thread. * * @return bool true if successful, false if the operation can't @@ -116,7 +116,7 @@ public: static bool yield(); /** - * Set the priority for the native thread if supported by the + * Set the priority for the native thread if supported by the * system. * * @param PRIORITY requested priority @@ -125,7 +125,7 @@ public: static bool setPriority(ThreadOps*, Priority); /** - * Set the priority for the native thread if supported by the + * Set the priority for the native thread if supported by the * system. * * @param Thread::PRIORITY& current priority diff --git a/dep/src/zthread/solaris/FastRecursiveLock.h b/dep/src/zthread/solaris/FastRecursiveLock.h index 956e1dbd3ad..2de0f8cd022 100644 --- a/dep/src/zthread/solaris/FastRecursiveLock.h +++ b/dep/src/zthread/solaris/FastRecursiveLock.h @@ -35,13 +35,13 @@ namespace ZThread { * @date <2003-07-16T23:31:23-0400> * @version 2.2.0 * - * This FastRecursiveLock implementation uses pthreads mutex attribute - * functions to create a recursive lock. This implementation is not - * specific to solaris and will work on any system that supports - * pthread_mutexattr_settype(). - */ + * This FastRecursiveLock implementation uses pthreads mutex attribute + * functions to create a recursive lock. This implementation is not + * specific to solaris and will work on any system that supports + * pthread_mutexattr_settype(). + */ class FastRecursiveLock : private NonCopyable { - + pthread_mutex_t _mtx; /** @@ -50,7 +50,7 @@ class FastRecursiveLock : private NonCopyable { * Utility class to maintain the attribute as long as it is needed. */ class Attribute { - + pthread_mutexattr_t _attr; public: @@ -60,13 +60,13 @@ class FastRecursiveLock : private NonCopyable { if(pthread_mutexattr_init(&_attr) != 0) { assert(0); } - + if(pthread_mutexattr_settype(&_attr, PTHREAD_MUTEX_RECURSIVE) != 0) { assert(0); } } - + ~Attribute() { if(pthread_mutexattr_destroy(&_attr) != 0) { @@ -84,36 +84,36 @@ class FastRecursiveLock : private NonCopyable { public: inline FastRecursiveLock() { - + static Attribute attr; pthread_mutex_init(&_mtx, (pthread_mutexattr_t*)attr); } - + inline ~FastRecursiveLock() { pthread_mutex_destroy(&_mtx); } - + inline void acquire() { - + pthread_mutex_lock(&_mtx); } inline void release() { - + pthread_mutex_unlock(&_mtx); - + } - + inline bool tryAcquire(unsigned long timeout=0) { return (pthread_mutex_trylock(&_mtx) == 0); } - + }; /* FastRecursiveLock */ diff --git a/dep/src/zthread/vanilla/DualMutexRecursiveLock.h b/dep/src/zthread/vanilla/DualMutexRecursiveLock.h index ddce7a3cd27..63214133c02 100644 --- a/dep/src/zthread/vanilla/DualMutexRecursiveLock.h +++ b/dep/src/zthread/vanilla/DualMutexRecursiveLock.h @@ -38,11 +38,11 @@ namespace ZThread { * * This is a vanilla FastRecursiveLock implementation for a * system that doesn't provide recurisve locks. This implementation - * is based on using a pair of mutexes, because of this, it performs + * is based on using a pair of mutexes, because of this, it performs * roughly the same as a spin lock would. - */ + */ class FastRecursiveLock : private NonCopyable { - + //! Lock for blocking FastLock _blockingLock; @@ -58,14 +58,14 @@ class FastRecursiveLock : private NonCopyable { public: inline FastRecursiveLock() : _owner(ThreadOps::INVALID), _count(0) { } - + inline ~FastRecursiveLock() { assert(_owner == ThreadOps::INVALID); assert(_count == 0); } - + void acquire() { ThreadOps self(ThreadOps::self()); @@ -73,7 +73,7 @@ class FastRecursiveLock : private NonCopyable { // Try to lock the blocking mutex first bool wasLocked = _blockingLock.tryAcquire(); if(!wasLocked) { - + // Otherwise, grab the lock for the state _stateLock.acquire(); @@ -82,30 +82,30 @@ class FastRecursiveLock : private NonCopyable { _count++; _stateLock.release(); - + if(wasLocked) return; // Try to be cooperative ThreadOps::yield(); _blockingLock.acquire(); - + } - // Serialze access to the state + // Serialze access to the state _stateLock.acquire(); - - // Take ownership + + // Take ownership assert(_owner == ThreadOps::INVALID || _owner == self); _owner = self; _count++; - + _stateLock.release(); } - - + + bool tryAcquire(unsigned long timeout = 0) { ThreadOps self(ThreadOps::self()); @@ -113,7 +113,7 @@ class FastRecursiveLock : private NonCopyable { // Try to lock the blocking mutex first bool wasLocked = _blockingLock.tryAcquire(); if(!wasLocked) { - + // Otherwise, grab the lock for the state _stateLock.acquire(); @@ -122,52 +122,52 @@ class FastRecursiveLock : private NonCopyable { _count++; _stateLock.release(); - + return wasLocked; - + } - // Serialze access to the state + // Serialze access to the state _stateLock.acquire(); - - // Take ownership + + // Take ownership assert(_owner == ThreadOps::INVALID || _owner == self); _owner = self; _count++; - + _stateLock.release(); - + return true; } - + void release() { - // Assume that release is only used by the owning thread, as it + // Assume that release is only used by the owning thread, as it // should be. assert(_count != 0); assert(_owner == ThreadOps::self()); - + _stateLock.acquire(); - + // If the lock was owned and the count has reached 0, give up // ownership and release the blocking lock if(--_count == 0) { - + _owner = ThreadOps::INVALID; _blockingLock.release(); - + } - + _stateLock.release(); } - + }; /* FastRecursiveLock */ -} // namespace ZThread +} // namespace ZThread #endif diff --git a/dep/src/zthread/vanilla/SimpleRecursiveLock.h b/dep/src/zthread/vanilla/SimpleRecursiveLock.h index f4f309218b6..6adf4154fc4 100644 --- a/dep/src/zthread/vanilla/SimpleRecursiveLock.h +++ b/dep/src/zthread/vanilla/SimpleRecursiveLock.h @@ -37,49 +37,49 @@ namespace ZThread { * @version 2.2.8 * * This implementation of a FastRecursiveLock uses the which ever FastLock - * that is selected to create a recursive spin lock. - */ + * that is selected to create a recursive spin lock. + */ class FastRecursiveLock : private NonCopyable { - + FastLock _lock; ThreadOps _owner; volatile unsigned int _count; - + public: - + inline FastRecursiveLock() : _owner(ThreadOps::INVALID), _count(0) {} - + inline ~FastRecursiveLock() { assert(_owner == ThreadOps::INVALID); assert(_count == 0); } - + inline void acquire() { ThreadOps self(ThreadOps::self()); bool wasLocked = false; do { - + _lock.acquire(); - + // If there is no owner, or the owner is the caller // update the count if(_owner == ThreadOps::INVALID || _owner == self) { _owner = self; _count++; - + wasLocked = true; - + } _lock.release(); - + } while(!wasLocked); assert(_owner == ThreadOps::self()); @@ -96,32 +96,32 @@ public: _owner = ThreadOps::INVALID; _lock.release(); - + } - + inline bool tryAcquire(unsigned long timeout=0) { ThreadOps self(ThreadOps::self()); bool wasLocked = false; _lock.acquire(); - + if(_owner == ThreadOps::INVALID || _owner == self) { - + _owner = self; _count++; - + wasLocked = true; } - + _lock.release(); assert(!wasLocked || _owner == ThreadOps::self()); - return wasLocked; - + return wasLocked; + } - + }; /* FastRecursiveLock */ diff --git a/dep/src/zthread/win32/AtomicFastLock.h b/dep/src/zthread/win32/AtomicFastLock.h index a714c03789f..8d09f132a35 100644 --- a/dep/src/zthread/win32/AtomicFastLock.h +++ b/dep/src/zthread/win32/AtomicFastLock.h @@ -39,17 +39,17 @@ namespace ZThread { * * This is the smallest and fastest synchronization object in the library. * It is an implementation of fast mutex, an all or nothing exclusive - * lock. It should be used only where you need speed and are willing + * lock. It should be used only where you need speed and are willing * to sacrifice all the state & safety checking provided by the framework * for speed. * * The current Platform SDK defines: * * LONG InterlockedExchange(LPLONG, LONG) - * LONG InterlockedCompareExchange(LPLONG, LONG, LONG, LONG) + * LONG InterlockedCompareExchange(LPLONG, LONG, LONG, LONG) * * If your compiler complains about LPLONG not being implicitly casted to - * a PVOID, then you should get the SDK update from microsoft or use the + * a PVOID, then you should get the SDK update from microsoft or use the * WIN9X implementation of this class. * * ---- @@ -57,21 +57,21 @@ namespace ZThread { * don't all support the CMPXCHG function, and so Windows 95 an earlier dont support * InterlockedCompareExchange. For this, you should use the win9x implementation * of this class - */ + */ class FastLock : private NonCopyable { #pragma pack(push, 8) LONG volatile _lock; #pragma pack(pop) - + public: - + /** * Create a new FastLock */ inline FastLock() : _lock(0) { } - + /** * Destroy FastLock */ @@ -79,9 +79,9 @@ class FastLock : private NonCopyable { /** * Lock the fast Lock, no error check. - * + * * @exception None - */ + */ inline void acquire() { while (::InterlockedCompareExchange(const_cast(&_lock), 1, 0) != 0) @@ -89,18 +89,18 @@ class FastLock : private NonCopyable { } - + /** * Release the fast Lock, no error check. - * + * * @exception None - */ + */ inline void release() { ::InterlockedExchange(const_cast(&_lock), (LONG)0); } - + /** * Try to acquire an exclusive lock. No safety or state checks are performed. * This function returns immediately regardless of the value of the timeout @@ -110,11 +110,11 @@ class FastLock : private NonCopyable { * @exception Synchronization_Exception - not thrown */ inline bool tryAcquire(unsigned long timeout=0) { - + return ::InterlockedCompareExchange(const_cast(&_lock), 1, 0) == 0; } - + }; /* FastLock */ diff --git a/dep/src/zthread/win32/AtomicFastRecursiveLock.h b/dep/src/zthread/win32/AtomicFastRecursiveLock.h index c6a61b03b5d..a4dc3755265 100644 --- a/dep/src/zthread/win32/AtomicFastRecursiveLock.h +++ b/dep/src/zthread/win32/AtomicFastRecursiveLock.h @@ -37,36 +37,36 @@ namespace ZThread { * @date <2003-07-16T23:32:34-0400> * @version 2.1.6 * - * This is the smaller and faster implementation of a RecursiveLock. + * This is the smaller and faster implementation of a RecursiveLock. * A single thread can acquire the mutex any number of times, but it * must perform a release for each acquire(). Other threads are blocked * until a thread has released all of its locks on the mutex. - * - * This particular implementation performs fewer safety checks. Like - * the FastLock implementation, any waiting caused by an acquire() request + * + * This particular implementation performs fewer safety checks. Like + * the FastLock implementation, any waiting caused by an acquire() request * is not interruptable. This is so that the mutex can have the fastest * response time for a time critical application while still having a good * degree of reliability. * - * TryEnterCriticalSection() does not work at all on some systems, so its + * TryEnterCriticalSection() does not work at all on some systems, so its * not used. * * * The current Platform SDK defines: * * LONG InterlockedExchange(LPLONG, LONG) - * LONG InterlockedCompareExchange(LPLONG, LONG, LONG, LONG) + * LONG InterlockedCompareExchange(LPLONG, LONG, LONG, LONG) * * If your compiler complains about LPLONG not being implicitly casted to - * a PVOID, then you should get the SDK update from microsoft or use the + * a PVOID, then you should get the SDK update from microsoft or use the * WIN9X implementation of this class. * * ---- * Because Windows 95 and earlier can run on processors prior to the 486, they * don't all support the CMPXCHG function, and so Windows 95 an earlier dont support - * InterlockedCompareExchange. If you define ZT_WIN9X, you'll get a version of the + * InterlockedCompareExchange. If you define ZT_WIN9X, you'll get a version of the * FastLock that uses the XCHG instruction - */ + */ class FastRecursiveLock : private NonCopyable { // Add def for mingw32 or other non-ms compiler to align on 64-bit @@ -75,15 +75,15 @@ class FastRecursiveLock : private NonCopyable { LONG volatile _lock; #pragma pack(pop) LONG _count; - + public: - + /** * Create a new FastRecursiveLock */ inline FastRecursiveLock() : _lock(0), _count(0) { } - + /** * Destroy FastLock */ @@ -93,9 +93,9 @@ class FastRecursiveLock : private NonCopyable { /** * Lock the fast Lock, no error check. - * + * * @exception None - */ + */ inline void acquire() { DWORD id = ::GetCurrentThreadId(); @@ -110,24 +110,24 @@ class FastRecursiveLock : private NonCopyable { ::Sleep(0); } while(1); - + _count++; } - + /** * Release the fast Lock, no error check. - * + * * @exception None - */ + */ inline void release() { if(--_count == 0) ::InterlockedExchange(const_cast(&_lock), 0); } - + /** * Try to acquire an exclusive lock. No safety or state checks are performed. * This function returns immediately regardless of the value of the timeout @@ -137,20 +137,20 @@ class FastRecursiveLock : private NonCopyable { * @exception Synchronization_Exception - not thrown */ inline bool tryAcquire(unsigned long timeout=0) { - + DWORD id = ::GetCurrentThreadId(); DWORD owner = (DWORD)::InterlockedCompareExchange(const_cast(&_lock), id, 0); - + if(owner == 0 || owner == id) { _count++; return true; } - + return false; - + } - - + + }; /* FastRecursiveLock */ diff --git a/dep/src/zthread/win32/FastLock.h b/dep/src/zthread/win32/FastLock.h index 2e9fe829af6..3b212e1d891 100644 --- a/dep/src/zthread/win32/FastLock.h +++ b/dep/src/zthread/win32/FastLock.h @@ -39,10 +39,10 @@ namespace ZThread { * @version 2.2.11 * * This FastLock implementation is based on a Win32 Mutex - * object. This will perform better under high contention, + * object. This will perform better under high contention, * but will not be as fast as the spin lock under reasonable * circumstances. - */ + */ class FastLock : private NonCopyable { HANDLE _hMutex; @@ -51,11 +51,11 @@ namespace ZThread { #endif public: - + /** * Create a new FastLock */ - FastLock() { + FastLock() { #ifndef NDEBUG _locked = false; @@ -68,11 +68,11 @@ namespace ZThread { } - + ~FastLock() { ::CloseHandle(_hMutex); } - + void acquire() { if(::WaitForSingleObject(_hMutex, INFINITE) != WAIT_OBJECT_0) { @@ -113,7 +113,7 @@ namespace ZThread { switch(::WaitForSingleObject(_hMutex, timeout)) { case WAIT_OBJECT_0: - + #ifndef NDEBUG // Simulate deadlock to provide consistent behavior. This @@ -122,7 +122,7 @@ namespace ZThread { while(_locked) ThreadOps::yield(); - + _locked = true; #endif diff --git a/dep/src/zthread/win32/FastRecursiveLock.h b/dep/src/zthread/win32/FastRecursiveLock.h index e1a6e7cd692..de556ac4aa8 100644 --- a/dep/src/zthread/win32/FastRecursiveLock.h +++ b/dep/src/zthread/win32/FastRecursiveLock.h @@ -39,21 +39,21 @@ namespace ZThread { * @version 2.2.11 * * This FastRecursiveLock implementation is based on a Win32 Mutex - * object. This will perform better under high contention, + * object. This will perform better under high contention, * but will not be as fast as the spin lock under reasonable * circumstances. - */ + */ class FastRecursiveLock : private NonCopyable { HANDLE _hMutex; volatile unsigned int _count; public: - + /** * Create a new FastRecursiveLock */ - FastRecursiveLock() : _count(0) { + FastRecursiveLock() : _count(0) { _hMutex = ::CreateMutex(0, 0, 0); assert(_hMutex != NULL); @@ -62,12 +62,12 @@ class FastRecursiveLock : private NonCopyable { } - + ~FastRecursiveLock() { ::CloseHandle(_hMutex); } - + void acquire() { if(::WaitForSingleObject(_hMutex, INFINITE) != WAIT_OBJECT_0) { diff --git a/dep/src/zthread/win32/Monitor.h b/dep/src/zthread/win32/Monitor.h index 7073343b7f8..a527b8afff6 100644 --- a/dep/src/zthread/win32/Monitor.h +++ b/dep/src/zthread/win32/Monitor.h @@ -49,37 +49,37 @@ class Monitor : public Status, private NonCopyable { DWORD _owner; //! Waiting flag, to avoid uneccessary signals - volatile bool _waiting; + volatile bool _waiting; //! State of the monitor volatile int _state; public: - + //! Create a new monitor. Monitor(); //! Destroy the monitor. ~Monitor(); - //! Acquire the external lock for this monitor. + //! Acquire the external lock for this monitor. inline void acquire() { _lock.acquire(); } - //! Try to acquire the external lock for this monitor. + //! Try to acquire the external lock for this monitor. inline bool tryAcquire() { return _lock.tryAcquire(); } - //! Release the external lock for this monitor. + //! Release the external lock for this monitor. inline void release() { _lock.release(); } - + /** * Wait for a state change and atomically unlock the external lock. - * Blocks for an indefinent amount of time. + * Blocks for an indefinent amount of time. * * @return INTERRUPTED if the wait was ended by a interrupt() * or SIGNALED if the wait was ended by a notify() @@ -92,11 +92,11 @@ class Monitor : public Status, private NonCopyable { /** * Wait for a state change and atomically unlock the external lock. - * May blocks for an indefinent amount of time. + * May blocks for an indefinent amount of time. * * @param timeout - maximum time to block (milliseconds) or 0 to * block indefinently - * + * * @return INTERRUPTED if the wait was ended by a interrupt() * or TIMEDOUT if the maximum wait time expired. * or SIGNALED if the wait was ended by a notify() @@ -116,9 +116,9 @@ class Monitor : public Status, private NonCopyable { /** * Notify this monitor. If there is a thread blocked on this monitor object - * it will be signaled and released. If there is no waiter, a flag is set and - * the next attempt to wait() will return SIGNALED w/o blocking, if no other - * flag is set. + * it will be signaled and released. If there is no waiter, a flag is set and + * the next attempt to wait() will return SIGNALED w/o blocking, if no other + * flag is set. * * @return false if the thread was previously INTERRUPTED. */ diff --git a/dep/src/zthread/win32/PerformanceCounterStrategy.h b/dep/src/zthread/win32/PerformanceCounterStrategy.h index 95b526830b3..4c657af0c8a 100644 --- a/dep/src/zthread/win32/PerformanceCounterStrategy.h +++ b/dep/src/zthread/win32/PerformanceCounterStrategy.h @@ -31,19 +31,19 @@ namespace ZThread { /** * @class PerformanceCounterStrategy * - * Implement a strategy for time operatons based on - * Windows QueryPerformanceXXX() functions. + * Implement a strategy for time operatons based on + * Windows QueryPerformanceXXX() functions. * This only (erroneously) considers the lower 32 bits. */ class TimeStrategy { unsigned long _secs; unsigned long _millis; - + public: TimeStrategy() { - + // Keep track of the relative time the program started static LARGE_INTEGER i; static BOOL valid(::QueryPerformanceCounter(&i)); @@ -52,22 +52,22 @@ public: LARGE_INTEGER j; ::QueryPerformanceCounter(&j); - + j.LowPart -= i.LowPart; j.LowPart /= frequency(); - // Mask off the high bits + // Mask off the high bits _millis = (unsigned long)j.LowPart / 1000; _secs = (unsigned long)j.LowPart - _millis; } - + unsigned long seconds() const { return _secs; } - unsigned long milliseconds() const { - return _millis; + unsigned long milliseconds() const { + return _millis; } unsigned long seconds(unsigned long s) { diff --git a/dep/src/zthread/win32/TSS.h b/dep/src/zthread/win32/TSS.h index 2400830f06a..d1307a51e2a 100644 --- a/dep/src/zthread/win32/TSS.h +++ b/dep/src/zthread/win32/TSS.h @@ -33,12 +33,12 @@ namespace ZThread { * @date <2003-07-27T14:18:43-0400> * @version 2.3.0 * - * An abstraction for dealing with WIN32 thread specific storage (tss). + * An abstraction for dealing with WIN32 thread specific storage (tss). * Provides get/set and creation/destruction. */ template class TSS { - + DWORD _key; bool _valid; @@ -55,16 +55,16 @@ namespace ZThread { } /** - * Destroy the underlying supoprt for accessing tss with this + * Destroy the underlying supoprt for accessing tss with this * object. */ virtual ~TSS() { - - if(_valid) + + if(_valid) ::TlsFree(_key); - + } - + /** * Get the value stored in tss. * @@ -97,8 +97,8 @@ namespace ZThread { return oldValue; } - - + + }; } diff --git a/dep/src/zthread/win32/ThreadOps.h b/dep/src/zthread/win32/ThreadOps.h index 4a3eeac2ed9..1b3a0bfa174 100644 --- a/dep/src/zthread/win32/ThreadOps.h +++ b/dep/src/zthread/win32/ThreadOps.h @@ -37,7 +37,7 @@ class Runnable; * @date <2003-07-16T23:33:59-0400> * @version 2.2.8 * - * This class is an abstraction used to perform various operations on a + * This class is an abstraction used to perform various operations on a * native WIN32 thread. */ class ThreadOps { @@ -53,11 +53,11 @@ class ThreadOps { public: - const static ThreadOps INVALID; + const static ThreadOps INVALID; /** - * Create a new ThreadOps to represent a native thread. - */ + * Create a new ThreadOps to represent a native thread. + */ ThreadOps() : _tid(0), _hThread(NULL) {} @@ -65,7 +65,7 @@ class ThreadOps { return _tid == ops._tid; } - + static ThreadOps self() { return ThreadOps(::GetCurrentThreadId()); } @@ -73,7 +73,7 @@ class ThreadOps { /** * Update the native tid for this thread so it matches the current * thread. - */ + */ static void activate(ThreadOps* ops) { assert(ops); @@ -84,7 +84,7 @@ class ThreadOps { } /** - * Test if this object representative of the currently executing + * Test if this object representative of the currently executing * native thread. * * @return bool true if successful @@ -105,7 +105,7 @@ class ThreadOps { static bool join(ThreadOps*); /** - * Force the current native thread to yield, letting the scheduler + * Force the current native thread to yield, letting the scheduler * give the CPU time to another thread. * * @return bool true if successful @@ -113,7 +113,7 @@ class ThreadOps { static bool yield(); /** - * Set the priority for the native thread if supported by the + * Set the priority for the native thread if supported by the * system. * * @param PRIORITY requested priority @@ -122,7 +122,7 @@ class ThreadOps { static bool setPriority(ThreadOps*, Priority); /** - * Set the priority for the native thread if supported by the + * Set the priority for the native thread if supported by the * system. * * @param Thread::PRIORITY& current priority diff --git a/dep/src/zthread/win9x/AtomicFastLock.h b/dep/src/zthread/win9x/AtomicFastLock.h index 5b50a9c7337..7723b7077d8 100644 --- a/dep/src/zthread/win9x/AtomicFastLock.h +++ b/dep/src/zthread/win9x/AtomicFastLock.h @@ -48,22 +48,22 @@ namespace ZThread { * This is asm inlined for microsoft visual c, it needs to be changed in order to * compile with gcc, or another win32 compiler - but more likely than not you'll * be using the Win32 version on those compilers and this won't be a problem. - */ + */ class FastLock : private NonCopyable { // Add def for mingw32 or other non-ms compiler to align on 32-bit boundary #pragma pack(push, 4) unsigned char volatile _lock; #pragma pack(pop) - + public: - + /** * Create a new FastLock */ inline FastLock() : _lock(0) { } - + inline ~FastLock() { assert(_lock == 0); } @@ -77,7 +77,7 @@ class FastLock : private NonCopyable { mov al, 1 mov esi, dw - xchg [esi], al + xchg [esi], al and al,al jz spin_locked } @@ -95,15 +95,15 @@ class FastLock : private NonCopyable { DWORD dw = (DWORD)&_lock; - _asm { + _asm { mov al, 0 mov esi, dw - xchg [esi], al + xchg [esi], al } } - + inline bool tryAcquire(unsigned long timeout=0) { volatile DWORD dw = (DWORD)&_lock; @@ -113,16 +113,16 @@ class FastLock : private NonCopyable { mov al, 1 mov esi, dw - xchg [esi], al + xchg [esi], al and al,al mov esi, result - xchg [esi], al + xchg [esi], al } return result == 0; } - + }; /* Fast Lock */ } // namespace ZThread diff --git a/src/bindings/interface/ScriptMgr.cpp b/src/bindings/interface/ScriptMgr.cpp index c502f65b99c..276b5fa3a54 100644 --- a/src/bindings/interface/ScriptMgr.cpp +++ b/src/bindings/interface/ScriptMgr.cpp @@ -84,7 +84,7 @@ Script* GetScriptByName(std::string Name) TRINITY_DLL_EXPORT char const* ScriptsVersion() { - return "Default Trinity scripting library"; + return "Default Trinity scripting library"; } TRINITY_DLL_EXPORT bool GossipHello ( Player * player, Creature *_Creature ) diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index 34b43b14a92..c41a461e4d1 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -29,7 +29,7 @@ struct StringTextData uint32 SoundId; uint8 Type; uint32 Language; - uint32 Emote; + uint32 Emote; }; // Enums used by StringTextData::Type @@ -677,7 +677,7 @@ void LoadDatabase() temp.SoundId = fields[1].GetInt32(); temp.Type = fields[2].GetInt32(); temp.Language = fields[3].GetInt32(); - temp.Emote = 0;//fields[4].GetInt32(); + temp.Emote = 0;//fields[4].GetInt32(); if (i >= 0) { @@ -742,7 +742,7 @@ void LoadDatabase() temp.SoundId = fields[1].GetInt32(); temp.Type = fields[2].GetInt32(); temp.Language = fields[3].GetInt32(); - temp.Emote = fields[4].GetInt32(); + temp.Emote = fields[4].GetInt32(); if (i >= 0) { @@ -807,7 +807,7 @@ void LoadDatabase() temp.SoundId = fields[1].GetInt32(); temp.Type = fields[2].GetInt32(); temp.Language = fields[3].GetInt32(); - temp.Emote = fields[4].GetInt32(); + temp.Emote = fields[4].GetInt32(); if (i >= 0) { @@ -1211,7 +1211,7 @@ void ScriptsFree() delete []SpellSummary; // Free resources before library unload - for(int i=0;i> Loaded %i C++ Scripts.", num_sc_scripts); + outstring_log(">> Loaded %i C++ Scripts.", num_sc_scripts); outstring_log(">> Load Overriden SQL Data."); LoadOverridenSQLData(); @@ -1864,15 +1864,15 @@ void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target) error_log("TSCR: DoScriptText entry %i tried to process invalid sound id %u.",textEntry,(*i).second.SoundId); } - if((*i).second.Emote) - { - if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER) - { - ((Unit*)pSource)->HandleEmoteCommand((*i).second.Emote); - } - else - error_log("TSCR: DoScriptText entry %i tried to process emote for invalid TypeId (%u).",textEntry,pSource->GetTypeId()); - } + if((*i).second.Emote) + { + if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER) + { + ((Unit*)pSource)->HandleEmoteCommand((*i).second.Emote); + } + else + error_log("TSCR: DoScriptText entry %i tried to process emote for invalid TypeId (%u).",textEntry,pSource->GetTypeId()); + } switch((*i).second.Type) { @@ -1923,7 +1923,7 @@ void Script::RegisterSelf() TRINITY_DLL_EXPORT char const* ScriptsVersion() { - return "Default Trinity scripting library"; + return "Default Trinity scripting library"; } TRINITY_DLL_EXPORT bool GossipHello ( Player * player, Creature *_Creature ) diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp index 6ffa4261488..6c9a0059b11 100644 --- a/src/bindings/scripts/include/sc_creature.cpp +++ b/src/bindings/scripts/include/sc_creature.cpp @@ -221,12 +221,12 @@ void ScriptedAI::DoCastSpell(Unit* who,SpellEntry const *spellInfo, bool trigger void ScriptedAI::DoSay(const char* text, uint32 language, Unit* target, bool SayEmote) { - if (target) - { - m_creature->Say(text, language, target->GetGUID()); - if(SayEmote) - m_creature->HandleEmoteCommand(EMOTE_ONESHOT_TALK); - } + if (target) + { + m_creature->Say(text, language, target->GetGUID()); + if(SayEmote) + m_creature->HandleEmoteCommand(EMOTE_ONESHOT_TALK); + } else m_creature->Say(text, language, 0); } @@ -751,8 +751,8 @@ Unit* FindCreature(uint32 entry, float range, Unit* Finder) if(!Finder) return NULL; Creature* target = NULL; - Trinity::AllCreaturesOfEntryInRange check(Finder, entry, range); - Trinity::CreatureSearcher searcher(target, check); + Trinity::AllCreaturesOfEntryInRange check(Finder, entry, range); + Trinity::CreatureSearcher searcher(target, check); Finder->VisitNearbyObject(range, searcher); return target; } @@ -762,7 +762,7 @@ GameObject* FindGameObject(uint32 entry, float range, Unit* Finder) if(!Finder) return NULL; GameObject* target = NULL; - Trinity::AllGameObjectsWithEntryInGrid go_check(entry); + Trinity::AllGameObjectsWithEntryInGrid go_check(entry); Trinity::GameObjectSearcher searcher(target, go_check); Finder->VisitNearbyGridObject(range, searcher); return target; diff --git a/src/bindings/scripts/include/sc_instance.h b/src/bindings/scripts/include/sc_instance.h index c02b05fa709..59c19bda085 100644 --- a/src/bindings/scripts/include/sc_instance.h +++ b/src/bindings/scripts/include/sc_instance.h @@ -14,7 +14,7 @@ enum EncounterState IN_PROGRESS = 1, FAIL = 2, DONE = 3, - SPECIAL = 4 + SPECIAL = 4 }; #define OUT_SAVE_INST_DATA debug_log("SD2: Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) diff --git a/src/bindings/scripts/scripts/areatrigger/areatrigger_scripts.cpp b/src/bindings/scripts/scripts/areatrigger/areatrigger_scripts.cpp index 18757d05510..9c2684072b6 100644 --- a/src/bindings/scripts/scripts/areatrigger/areatrigger_scripts.cpp +++ b/src/bindings/scripts/scripts/areatrigger/areatrigger_scripts.cpp @@ -37,23 +37,23 @@ EndContentData */ bool AreaTrigger_at_legion_teleporter(Player *player, AreaTriggerEntry *at) { - if (player->isAlive() && !player->isInCombat()) - { - if (player->GetTeam()== ALLIANCE && player->GetQuestRewardStatus(10589)) - { - player->CastSpell(player,SPELL_TELE_A_TO,false); - return true; - } + if (player->isAlive() && !player->isInCombat()) + { + if (player->GetTeam()== ALLIANCE && player->GetQuestRewardStatus(10589)) + { + player->CastSpell(player,SPELL_TELE_A_TO,false); + return true; + } - if (player->GetTeam()== HORDE && player->GetQuestRewardStatus(10604)) - { - player->CastSpell(player,SPELL_TELE_H_TO,false); - return true; - } + if (player->GetTeam()== HORDE && player->GetQuestRewardStatus(10604)) + { + player->CastSpell(player,SPELL_TELE_H_TO,false); + return true; + } - return false; - } - return false; + return false; + } + return false; } bool ATtest(Player *player, AreaTriggerEntry *at) @@ -66,10 +66,10 @@ void AddSC_areatrigger_scripts() { Script *newscript; - newscript = new Script; - newscript->Name = "at_legion_teleporter"; - newscript->pAreaTrigger = &AreaTrigger_at_legion_teleporter; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name = "at_legion_teleporter"; + newscript->pAreaTrigger = &AreaTrigger_at_legion_teleporter; + newscript->RegisterSelf(); newscript = new Script; newscript->Name="at_test"; diff --git a/src/bindings/scripts/scripts/guard/guard_ai.cpp b/src/bindings/scripts/scripts/guard/guard_ai.cpp index ed766d24e0e..1a27a87c108 100644 --- a/src/bindings/scripts/scripts/guard/guard_ai.cpp +++ b/src/bindings/scripts/scripts/guard/guard_ai.cpp @@ -36,24 +36,24 @@ void guardAI::Reset() void guardAI::Aggro(Unit *who) { - if (m_creature->GetEntry() == 15184) - { - switch(rand()%3) - { - case 0: - DoSay("Taste blade, mongrel!", LANG_UNIVERSAL,NULL); - break; - case 1: - DoSay("Please tell me that you didn't just do what I think you just did. Please tell me that I'm not going to have to hurt you...", LANG_UNIVERSAL,NULL); - break; - case 2: - DoSay("As if we don't have enough problems, you go and create more!", LANG_UNIVERSAL,NULL); - break; - } - } + if (m_creature->GetEntry() == 15184) + { + switch(rand()%3) + { + case 0: + DoSay("Taste blade, mongrel!", LANG_UNIVERSAL,NULL); + break; + case 1: + DoSay("Please tell me that you didn't just do what I think you just did. Please tell me that I'm not going to have to hurt you...", LANG_UNIVERSAL,NULL); + break; + case 2: + DoSay("As if we don't have enough problems, you go and create more!", LANG_UNIVERSAL,NULL); + break; + } + } - if (SpellEntry const *spell = m_creature->reachWithSpellAttack(who)) - DoCastSpell(who, spell); + if (SpellEntry const *spell = m_creature->reachWithSpellAttack(who)) + DoCastSpell(who, spell); } void guardAI::JustDied(Unit *Killer) diff --git a/src/bindings/scripts/scripts/guard/guards.cpp b/src/bindings/scripts/scripts/guard/guards.cpp index 46b455e806f..f4bc70d1b00 100644 --- a/src/bindings/scripts/scripts/guard/guards.cpp +++ b/src/bindings/scripts/scripts/guard/guards.cpp @@ -493,7 +493,7 @@ CreatureAI* GetAI_guard_bluffwatcher(Creature *_Creature) CreatureAI* GetAI_guard_contested(Creature *_Creature) { - return new guardAI (_Creature); + return new guardAI (_Creature); } /******************************************************* * guard_contested end diff --git a/src/bindings/scripts/scripts/item/item_scripts.cpp b/src/bindings/scripts/scripts/item/item_scripts.cpp index 35d0cb5ab62..7fd6e7679c8 100644 --- a/src/bindings/scripts/scripts/item/item_scripts.cpp +++ b/src/bindings/scripts/scripts/item/item_scripts.cpp @@ -41,7 +41,7 @@ item_voodoo_charm Provide proper error message and target(q256 item_vorenthals_presence(i30259) Prevents abuse of this item item_yehkinyas_bramble(i10699) Allow cast spell on vale screecher only and remove corpse if cast sucessful (q3520) item_zezzak_shard(i31463) Quest The eyes of Grillok (q10813). Prevents abuse -item_inoculating_crystal Quest Inoculating. Prevent abuse +item_inoculating_crystal Quest Inoculating. Prevent abuse EndContentData */ #include "precompiled.h" @@ -105,11 +105,11 @@ bool ItemUse_item_attuned_crystal_cores(Player *player, Item* _Item, SpellCastTa { if( targets.getUnitTarget() && targets.getUnitTarget()->GetTypeId()==TYPEID_UNIT && targets.getUnitTarget()->GetEntry() == 24972 && targets.getUnitTarget()->isDead() && - (player->GetQuestStatus(11524) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(11525) == QUEST_STATUS_INCOMPLETE) ) - { - ((Creature*)targets.getUnitTarget())->RemoveCorpse(); - return false; - } + (player->GetQuestStatus(11524) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(11525) == QUEST_STATUS_INCOMPLETE) ) + { + ((Creature*)targets.getUnitTarget())->RemoveCorpse(); + return false; + } player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,_Item,NULL); return true; diff --git a/src/bindings/scripts/scripts/npc/npc_escortAI.cpp b/src/bindings/scripts/scripts/npc/npc_escortAI.cpp index 3d9bafb330a..16064bdd295 100644 --- a/src/bindings/scripts/scripts/npc/npc_escortAI.cpp +++ b/src/bindings/scripts/scripts/npc/npc_escortAI.cpp @@ -40,19 +40,19 @@ void npc_escortAI::AttackStart(Unit *who) { InCombat = true; - if (IsBeingEscorted) - { + if (IsBeingEscorted) + { //Store last position m_creature->GetPosition(LastPos.x, LastPos.y, LastPos.z); debug_log("SD2: EscortAI has entered combat and stored last location."); - } + } Aggro(who); } - m_creature->GetMotionMaster()->MovementExpired(); - m_creature->GetMotionMaster()->MoveChase(who); + m_creature->GetMotionMaster()->MovementExpired(); + m_creature->GetMotionMaster()->MoveChase(who); } } @@ -64,7 +64,7 @@ void npc_escortAI::MoveInLineOfSight(Unit *who) if(m_creature->getVictim() || !m_creature->canStartAttack(who)) return; - AttackStart(who); + AttackStart(who); } void npc_escortAI::JustRespawned() @@ -109,7 +109,7 @@ void npc_escortAI::UpdateAI(const uint32 diff) { //Waypoint Updating if (IsBeingEscorted && !InCombat && WaitTimer && !Returning) - { + { if (WaitTimer <= diff) { if (ReconnectWP) @@ -157,11 +157,11 @@ void npc_escortAI::UpdateAI(const uint32 diff) WaitTimer = 0; } }else WaitTimer -= diff; - } + } //Check if player is within range if (IsBeingEscorted && !InCombat && PlayerGUID) - { + { if (PlayerTimer < diff) { Unit* p = Unit::GetUnit(*m_creature, PlayerGUID); @@ -186,7 +186,7 @@ void npc_escortAI::UpdateAI(const uint32 diff) PlayerTimer = 1000; }else PlayerTimer -= diff; - } + } //Check if we have a current target if( m_creature->isAlive() && UpdateVictim()) diff --git a/src/bindings/scripts/scripts/npc/npcs_special.cpp b/src/bindings/scripts/scripts/npc/npcs_special.cpp index 432e225caa3..d0131bf4067 100644 --- a/src/bindings/scripts/scripts/npc/npcs_special.cpp +++ b/src/bindings/scripts/scripts/npc/npcs_special.cpp @@ -31,7 +31,7 @@ npc_doctor 100% Gustaf Vanhowzen and Gregory Victor, quest 6622 npc_mount_vendor 100% Regular mount vendors all over the world. Display gossip if player doesn't meet the requirements to buy npc_rogue_trainer 80% Scripted trainers, so they are able to offer item 17126 for class quest 6681 npc_sayge 100% Darkmoon event fortune teller, buff player based on answers given -npc_snake_trap_serpents 80% AI for snakes that summoned by Snake Trap +npc_snake_trap_serpents 80% AI for snakes that summoned by Snake Trap EndContentData */ #include "precompiled.h" @@ -132,44 +132,44 @@ bool QuestComplete_npc_chicken_cluck(Player *player, Creature *_Creature, const ## npc_dancing_flames ######*/ -#define SPELL_BRAZIER 45423 -#define SPELL_SEDUCTION 47057 -#define SPELL_FIERY_AURA 45427 +#define SPELL_BRAZIER 45423 +#define SPELL_SEDUCTION 47057 +#define SPELL_FIERY_AURA 45427 struct TRINITY_DLL_DECL npc_dancing_flamesAI : public ScriptedAI { npc_dancing_flamesAI(Creature *c) : ScriptedAI(c) {Reset();} - bool active; - uint32 can_iteract; + bool active; + uint32 can_iteract; void Reset() - { - active = true; - can_iteract = 3500; - DoCast(m_creature,SPELL_BRAZIER,true); - DoCast(m_creature,SPELL_FIERY_AURA,false); - float x, y, z; - m_creature->GetPosition(x,y,z); - m_creature->Relocate(x,y,z + 0.94f); - m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); - m_creature->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); - WorldPacket data; //send update position to client - m_creature->BuildHeartBeatMsg(&data); - m_creature->SendMessageToSet(&data,true); - } + { + active = true; + can_iteract = 3500; + DoCast(m_creature,SPELL_BRAZIER,true); + DoCast(m_creature,SPELL_FIERY_AURA,false); + float x, y, z; + m_creature->GetPosition(x,y,z); + m_creature->Relocate(x,y,z + 0.94f); + m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); + m_creature->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); + WorldPacket data; //send update position to client + m_creature->BuildHeartBeatMsg(&data); + m_creature->SendMessageToSet(&data,true); + } void UpdateAI(const uint32 diff) - { - if (!active) - { - if(can_iteract <= diff){ - active = true; - can_iteract = 3500; - m_creature->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); - }else can_iteract -= diff; - } - } + { + if (!active) + { + if(can_iteract <= diff){ + active = true; + can_iteract = 3500; + m_creature->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); + }else can_iteract -= diff; + } + } void Aggro(Unit* who){} }; @@ -181,30 +181,30 @@ CreatureAI* GetAI_npc_dancing_flames(Creature *_Creature) bool ReceiveEmote_npc_dancing_flames( Player *player, Creature *flame, uint32 emote ) { - if ( ((npc_dancing_flamesAI*)flame->AI())->active && - flame->IsWithinLOS(player->GetPositionX(),player->GetPositionY(),player->GetPositionZ()) && flame->IsWithinDistInMap(player,30.0f)) - { - flame->SetInFront(player); - ((npc_dancing_flamesAI*)flame->AI())->active = false; + if ( ((npc_dancing_flamesAI*)flame->AI())->active && + flame->IsWithinLOS(player->GetPositionX(),player->GetPositionY(),player->GetPositionZ()) && flame->IsWithinDistInMap(player,30.0f)) + { + flame->SetInFront(player); + ((npc_dancing_flamesAI*)flame->AI())->active = false; - WorldPacket data; - flame->BuildHeartBeatMsg(&data); - flame->SendMessageToSet(&data,true); - switch(emote) - { - case TEXTEMOTE_KISS: flame->HandleEmoteCommand(EMOTE_ONESHOT_SHY); break; - case TEXTEMOTE_WAVE: flame->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break; - case TEXTEMOTE_BOW: flame->HandleEmoteCommand(EMOTE_ONESHOT_BOW); break; - case TEXTEMOTE_JOKE: flame->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); break; - case TEXTEMOTE_DANCE: - { - if (!player->HasAura(SPELL_SEDUCTION,0)) - flame->CastSpell(player,SPELL_SEDUCTION,true); - } - break; - } - } - return true; + WorldPacket data; + flame->BuildHeartBeatMsg(&data); + flame->SendMessageToSet(&data,true); + switch(emote) + { + case TEXTEMOTE_KISS: flame->HandleEmoteCommand(EMOTE_ONESHOT_SHY); break; + case TEXTEMOTE_WAVE: flame->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break; + case TEXTEMOTE_BOW: flame->HandleEmoteCommand(EMOTE_ONESHOT_BOW); break; + case TEXTEMOTE_JOKE: flame->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); break; + case TEXTEMOTE_DANCE: + { + if (!player->HasAura(SPELL_SEDUCTION,0)) + flame->CastSpell(player,SPELL_SEDUCTION,true); + } + break; + } + } + return true; } /*###### @@ -964,22 +964,22 @@ CreatureAI* GetAI_npc_tonk_mine(Creature *_Creature) bool ReceiveEmote_npc_winter_reveler( Player *player, Creature *_Creature, uint32 emote ) { - //TODO: check auralist. - if(player->HasAura(26218, 0)) - return false; + //TODO: check auralist. + if(player->HasAura(26218, 0)) + return false; - if( emote == TEXTEMOTE_KISS ) - { - _Creature->CastSpell(_Creature, 26218, false); - player->CastSpell(player, 26218, false); - switch(rand()%3) - { - case 0: _Creature->CastSpell(player, 26207, false); break; - case 1: _Creature->CastSpell(player, 26206, false); break; - case 2: _Creature->CastSpell(player, 45036, false); break; - } - } - return true; + if( emote == TEXTEMOTE_KISS ) + { + _Creature->CastSpell(_Creature, 26218, false); + player->CastSpell(player, 26218, false); + switch(rand()%3) + { + case 0: _Creature->CastSpell(player, 26207, false); break; + case 1: _Creature->CastSpell(player, 26206, false); break; + case 2: _Creature->CastSpell(player, 45036, false); break; + } + } + return true; } /*#### @@ -988,10 +988,10 @@ bool ReceiveEmote_npc_winter_reveler( Player *player, Creature *_Creature, uint3 bool ReceiveEmote_npc_brewfest_reveler( Player *player, Creature *_Creature, uint32 emote ) { - if( emote == TEXTEMOTE_DANCE ) - _Creature->CastSpell(player, 41586, false); + if( emote == TEXTEMOTE_DANCE ) + _Creature->CastSpell(player, 41586, false); - return true; + return true; } /*#### @@ -1021,12 +1021,12 @@ struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI void Reset() { - Owner = m_creature->GetOwner(); + Owner = m_creature->GetOwner(); - if (!m_creature->isPet() || !Owner) - return; + if (!m_creature->isPet() || !Owner) + return; - CreatureInfo const *Info = m_creature->GetCreatureInfo(); + CreatureInfo const *Info = m_creature->GetCreatureInfo(); if(Info->Entry == C_VIPER) IsViper = true; @@ -1044,13 +1044,13 @@ struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI InCombat = false; - } + } //Redefined for random target selection: void MoveInLineOfSight(Unit *who) { if (!m_creature->isPet() || !Owner) - return; + return; if( !m_creature->getVictim() && who->isTargetableForAttack() && ( m_creature->IsHostileTo( who )) && who->isInAccessiblePlaceFor(m_creature) && Owner->IsHostileTo(who))//don't attack not-pvp-flaged { @@ -1060,21 +1060,21 @@ struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI float attackRadius = m_creature->GetAttackDistance(who); if( m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who) ) { - if (!(rand() % RAND) ) + if (!(rand() % RAND) ) { m_creature->setAttackTimer(BASE_ATTACK, (rand() % 10) * 100); SpellTimer = (rand() % 10) * 100; AttackStart(who); InCombat = true; - } - } - } - } + } + } + } + } void UpdateAI(const uint32 diff) { if (!m_creature->isPet() || !Owner) - return; + return; //Follow if not in combat if (!m_creature->hasUnitState(UNIT_STAT_FOLLOW)&& !InCombat) @@ -1087,19 +1087,19 @@ struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI if (!m_creature->getVictim()) { if (InCombat) - DoStopAttack(); + DoStopAttack(); - InCombat = false; + InCombat = false; - if(Owner->getAttackerForHelper()) - AttackStart(Owner->getAttackerForHelper()); + if(Owner->getAttackerForHelper()) + AttackStart(Owner->getAttackerForHelper()); return; } if (SpellTimer < diff) { - if (IsViper) //Viper + if (IsViper) //Viper { if (rand() % 3 == 0) //33% chance to cast { @@ -1112,7 +1112,7 @@ struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI DoCast(m_creature->getVictim(),spell); } - SpellTimer = VIPER_TIMER; + SpellTimer = VIPER_TIMER; } else //Venomous Snake { @@ -1121,7 +1121,7 @@ struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI SpellTimer = VENOMOUS_SNAKE_TIMER + (rand() %5)*100; } }else SpellTimer-=diff; - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); } }; @@ -1144,7 +1144,7 @@ void AddSC_npcs_special() newscript = new Script; newscript->Name="npc_dancing_flames"; - newscript->GetAI = &GetAI_npc_dancing_flames; + newscript->GetAI = &GetAI_npc_dancing_flames; newscript->pReceiveEmote = &ReceiveEmote_npc_dancing_flames; newscript->RegisterSelf(); @@ -1192,12 +1192,12 @@ void AddSC_npcs_special() newscript->GetAI = &GetAI_npc_tonk_mine; newscript->RegisterSelf(); - newscript = new Script; + newscript = new Script; newscript->Name="npc_winter_reveler"; newscript->pReceiveEmote = &ReceiveEmote_npc_winter_reveler; newscript->RegisterSelf(); - newscript = new Script; + newscript = new Script; newscript->Name="npc_brewfest_reveler"; newscript->pReceiveEmote = &ReceiveEmote_npc_brewfest_reveler; newscript->RegisterSelf(); diff --git a/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp b/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp index c684eeaf97d..5af8088a0b6 100644 --- a/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp +++ b/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp @@ -51,133 +51,133 @@ EndContentData */ struct TRINITY_DLL_DECL npc_torekAI : public npc_escortAI { - npc_torekAI(Creature *c) : npc_escortAI(c) {Reset();} + npc_torekAI(Creature *c) : npc_escortAI(c) {Reset();} - uint32 Rend_Timer; - uint32 Thunderclap_Timer; - bool Completed; + uint32 Rend_Timer; + uint32 Thunderclap_Timer; + bool Completed; - void WaypointReached(uint32 i) - { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + void WaypointReached(uint32 i) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - if (!player) - return; + if (!player) + return; - switch (i) - { - case 1: - DoScriptText(SAY_MOVE, m_creature, player); - break; - case 8: - DoScriptText(SAY_PREPARE, m_creature, player); - break; - case 19: - //TODO: verify location and creatures amount. - m_creature->SummonCreature(ENTRY_DURIEL,1776.73,-2049.06,109.83,1.54,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,25000); - m_creature->SummonCreature(ENTRY_SILVERWING_SENTINEL,1774.64,-2049.41,109.83,1.40,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,25000); - m_creature->SummonCreature(ENTRY_SILVERWING_WARRIOR,1778.73,-2049.50,109.83,1.67,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,25000); - break; - case 20: - DoScriptText(SAY_WIN, m_creature, player); - Completed = true; - if (player && player->GetTypeId() == TYPEID_PLAYER) - ((Player*)player)->GroupEventHappens(QUEST_TOREK_ASSULT,m_creature); - break; - case 21: - DoScriptText(SAY_END, m_creature, player); - break; - } - } + switch (i) + { + case 1: + DoScriptText(SAY_MOVE, m_creature, player); + break; + case 8: + DoScriptText(SAY_PREPARE, m_creature, player); + break; + case 19: + //TODO: verify location and creatures amount. + m_creature->SummonCreature(ENTRY_DURIEL,1776.73,-2049.06,109.83,1.54,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,25000); + m_creature->SummonCreature(ENTRY_SILVERWING_SENTINEL,1774.64,-2049.41,109.83,1.40,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,25000); + m_creature->SummonCreature(ENTRY_SILVERWING_WARRIOR,1778.73,-2049.50,109.83,1.67,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,25000); + break; + case 20: + DoScriptText(SAY_WIN, m_creature, player); + Completed = true; + if (player && player->GetTypeId() == TYPEID_PLAYER) + ((Player*)player)->GroupEventHappens(QUEST_TOREK_ASSULT,m_creature); + break; + case 21: + DoScriptText(SAY_END, m_creature, player); + break; + } + } - void Reset() - { - Rend_Timer = 5000; - Thunderclap_Timer = 8000; - Completed = false; - } + void Reset() + { + Rend_Timer = 5000; + Thunderclap_Timer = 8000; + Completed = false; + } - void Aggro(Unit* who) - { - } + void Aggro(Unit* who) + { + } - void JustSummoned(Creature* summoned) - { - summoned->AI()->AttackStart(m_creature); - } + void JustSummoned(Creature* summoned) + { + summoned->AI()->AttackStart(m_creature); + } - void JustDied(Unit* killer) - { - if (PlayerGUID && !Completed) - { - if (Unit* player = Unit::GetUnit((*m_creature), PlayerGUID)) - ((Player*)player)->FailQuest(QUEST_TOREK_ASSULT); - } - } + void JustDied(Unit* killer) + { + if (PlayerGUID && !Completed) + { + if (Unit* player = Unit::GetUnit((*m_creature), PlayerGUID)) + ((Player*)player)->FailQuest(QUEST_TOREK_ASSULT); + } + } - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - if (Rend_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_REND); - Rend_Timer = 20000; - }else Rend_Timer -= diff; + if (Rend_Timer < diff) + { + DoCast(m_creature->getVictim(),SPELL_REND); + Rend_Timer = 20000; + }else Rend_Timer -= diff; - if (Thunderclap_Timer < diff) - { - DoCast(m_creature,SPELL_THUNDERCLAP); - Thunderclap_Timer = 30000; - }else Thunderclap_Timer -= diff; - } + if (Thunderclap_Timer < diff) + { + DoCast(m_creature,SPELL_THUNDERCLAP); + Thunderclap_Timer = 30000; + }else Thunderclap_Timer -= diff; + } }; bool QuestAccept_npc_torek(Player* player, Creature* creature, Quest const* quest) { - if (quest->GetQuestId() == QUEST_TOREK_ASSULT) - { - //TODO: find companions, make them follow Torek, at any time (possibly done by mangos/database in future?) - ((npc_escortAI*)(creature->AI()))->Start(true, true, true, player->GetGUID()); - DoScriptText(SAY_READY, creature, player); - creature->setFaction(113); - } + if (quest->GetQuestId() == QUEST_TOREK_ASSULT) + { + //TODO: find companions, make them follow Torek, at any time (possibly done by mangos/database in future?) + ((npc_escortAI*)(creature->AI()))->Start(true, true, true, player->GetGUID()); + DoScriptText(SAY_READY, creature, player); + creature->setFaction(113); + } - return true; + return true; } CreatureAI* GetAI_npc_torek(Creature *_Creature) { - npc_torekAI* thisAI = new npc_torekAI(_Creature); + npc_torekAI* thisAI = new npc_torekAI(_Creature); - thisAI->AddWaypoint(0, 1782.63, -2241.11, 109.73, 5000); - thisAI->AddWaypoint(1, 1788.88, -2240.17, 111.71); - thisAI->AddWaypoint(2, 1797.49, -2238.11, 112.31); - thisAI->AddWaypoint(3, 1803.83, -2232.77, 111.22); - thisAI->AddWaypoint(4, 1806.65, -2217.83, 107.36); - thisAI->AddWaypoint(5, 1811.81, -2208.01, 107.45); - thisAI->AddWaypoint(6, 1820.85, -2190.82, 100.49); - thisAI->AddWaypoint(7, 1829.60, -2177.49, 96.44); - thisAI->AddWaypoint(8, 1837.98, -2164.19, 96.71); //prepare - thisAI->AddWaypoint(9, 1839.99, -2149.29, 96.78); - thisAI->AddWaypoint(10, 1835.14, -2134.98, 96.80); - thisAI->AddWaypoint(11, 1823.57, -2118.27, 97.43); - thisAI->AddWaypoint(12, 1814.99, -2110.35, 98.38); - thisAI->AddWaypoint(13, 1806.60, -2103.09, 99.19); - thisAI->AddWaypoint(14, 1798.27, -2095.77, 100.04); - thisAI->AddWaypoint(15, 1783.59, -2079.92, 100.81); - thisAI->AddWaypoint(16, 1776.79, -2069.48, 101.77); - thisAI->AddWaypoint(17, 1776.82, -2054.59, 109.82); - thisAI->AddWaypoint(18, 1776.88, -2047.56, 109.83); - thisAI->AddWaypoint(19, 1776.86, -2036.55, 109.83); - thisAI->AddWaypoint(20, 1776.90, -2024.56, 109.83); //win - thisAI->AddWaypoint(21, 1776.87, -2028.31, 109.83,60000);//stay - thisAI->AddWaypoint(22, 1776.90, -2028.30, 109.83); + thisAI->AddWaypoint(0, 1782.63, -2241.11, 109.73, 5000); + thisAI->AddWaypoint(1, 1788.88, -2240.17, 111.71); + thisAI->AddWaypoint(2, 1797.49, -2238.11, 112.31); + thisAI->AddWaypoint(3, 1803.83, -2232.77, 111.22); + thisAI->AddWaypoint(4, 1806.65, -2217.83, 107.36); + thisAI->AddWaypoint(5, 1811.81, -2208.01, 107.45); + thisAI->AddWaypoint(6, 1820.85, -2190.82, 100.49); + thisAI->AddWaypoint(7, 1829.60, -2177.49, 96.44); + thisAI->AddWaypoint(8, 1837.98, -2164.19, 96.71); //prepare + thisAI->AddWaypoint(9, 1839.99, -2149.29, 96.78); + thisAI->AddWaypoint(10, 1835.14, -2134.98, 96.80); + thisAI->AddWaypoint(11, 1823.57, -2118.27, 97.43); + thisAI->AddWaypoint(12, 1814.99, -2110.35, 98.38); + thisAI->AddWaypoint(13, 1806.60, -2103.09, 99.19); + thisAI->AddWaypoint(14, 1798.27, -2095.77, 100.04); + thisAI->AddWaypoint(15, 1783.59, -2079.92, 100.81); + thisAI->AddWaypoint(16, 1776.79, -2069.48, 101.77); + thisAI->AddWaypoint(17, 1776.82, -2054.59, 109.82); + thisAI->AddWaypoint(18, 1776.88, -2047.56, 109.83); + thisAI->AddWaypoint(19, 1776.86, -2036.55, 109.83); + thisAI->AddWaypoint(20, 1776.90, -2024.56, 109.83); //win + thisAI->AddWaypoint(21, 1776.87, -2028.31, 109.83,60000);//stay + thisAI->AddWaypoint(22, 1776.90, -2028.30, 109.83); - return (CreatureAI*)thisAI; + return (CreatureAI*)thisAI; } /*#### @@ -237,10 +237,10 @@ struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI Cage->SetGoState(1); } - void JustSummoned(Creature* summoned) - { - summoned->AI()->AttackStart(m_creature); - } + void JustSummoned(Creature* summoned) + { + summoned->AI()->AttackStart(m_creature); + } void JustDied(Unit* killer) { @@ -300,15 +300,15 @@ CreatureAI* GetAI_npc_ruul_snowhoofAI(Creature *_Creature) void AddSC_ashenvale() { - Script *newscript; + Script *newscript; - newscript = new Script; - newscript->Name = "npc_torek"; - newscript->GetAI = &GetAI_npc_torek; - newscript->pQuestAccept = &QuestAccept_npc_torek; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name = "npc_torek"; + newscript->GetAI = &GetAI_npc_torek; + newscript->pQuestAccept = &QuestAccept_npc_torek; + newscript->RegisterSelf(); - newscript = new Script; + newscript = new Script; newscript->Name = "npc_ruul_snowhoof"; newscript->GetAI = &GetAI_npc_ruul_snowhoofAI; newscript->pQuestAccept = &QuestAccept_npc_ruul_snowhoof; diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/auchenai_crypts/boss_exarch_maladaar.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/auchenai_crypts/boss_exarch_maladaar.cpp index c0ceb9fd35f..fd880dca50c 100644 --- a/src/bindings/scripts/scripts/zone/aunchindoun/auchenai_crypts/boss_exarch_maladaar.cpp +++ b/src/bindings/scripts/scripts/zone/aunchindoun/auchenai_crypts/boss_exarch_maladaar.cpp @@ -143,11 +143,11 @@ CreatureAI* GetAI_mob_stolen_soul(Creature *_Creature) struct TRINITY_DLL_DECL boss_exarch_maladaarAI : public ScriptedAI { - boss_exarch_maladaarAI(Creature *c) : ScriptedAI(c) - { - HasTaunted = false; - Reset(); - } + boss_exarch_maladaarAI(Creature *c) : ScriptedAI(c) + { + HasTaunted = false; + Reset(); + } uint32 soulmodel; uint64 soulholder; @@ -175,14 +175,14 @@ struct TRINITY_DLL_DECL boss_exarch_maladaarAI : public ScriptedAI void MoveInLineOfSight(Unit *who) { - if (!HasTaunted && m_creature->IsWithinDistInMap(who, 150.0)) - { - DoScriptText(SAY_INTRO, m_creature); - HasTaunted = true; - } + if (!HasTaunted && m_creature->IsWithinDistInMap(who, 150.0)) + { + DoScriptText(SAY_INTRO, m_creature); + HasTaunted = true; + } - ScriptedAI::MoveInLineOfSight(who); - } + ScriptedAI::MoveInLineOfSight(who); + } void Aggro(Unit *who) @@ -201,15 +201,15 @@ struct TRINITY_DLL_DECL boss_exarch_maladaarAI : public ScriptedAI { //SPELL_STOLEN_SOUL_VISUAL has shapeshift effect, but not implemented feature in Trinity for this spell. summoned->CastSpell(summoned,SPELL_STOLEN_SOUL_VISUAL,false); - summoned->SetDisplayId(soulmodel); - summoned->setFaction(m_creature->getFaction()); + summoned->SetDisplayId(soulmodel); + summoned->setFaction(m_creature->getFaction()); if (Unit *target = Unit::GetUnit(*m_creature,soulholder)) - { + { ((mob_stolen_soulAI*)summoned->AI())->SetMyClass(soulclass); - summoned->AI()->AttackStart(target); - } + summoned->AI()->AttackStart(target); + } } } diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher.cpp index 2db0ee3adc4..8802cbf5e4e 100644 --- a/src/bindings/scripts/scripts/zone/aunchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher.cpp +++ b/src/bindings/scripts/scripts/zone/aunchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher.cpp @@ -79,7 +79,7 @@ struct TRINITY_DLL_DECL boss_shirrak_the_dead_watcherAI : public ScriptedAI void UpdateAI(const uint32 diff) { - //Inhibitmagic_Timer + //Inhibitmagic_Timer if (Inhibitmagic_Timer < diff) { float dist; @@ -110,7 +110,7 @@ struct TRINITY_DLL_DECL boss_shirrak_the_dead_watcherAI : public ScriptedAI { DoCast(m_creature,SPELL_ATTRACTMAGIC); Attractmagic_Timer = 30000; - Carnivorousbite_Timer = 1500; + Carnivorousbite_Timer = 1500; }else Attractmagic_Timer -= diff; //Carnivorousbite_Timer @@ -133,11 +133,11 @@ struct TRINITY_DLL_DECL boss_shirrak_the_dead_watcherAI : public ScriptedAI // Emote std::string *emote = new std::string("focuses on "); emote->append(target->GetName()); - emote->append("!"); + emote->append("!"); DoTextEmote(emote->c_str(),NULL,true); delete emote; } - FocusFire_Timer = 15000+(rand()%5000); + FocusFire_Timer = 15000+(rand()%5000); }else FocusFire_Timer -= diff; DoMeleeAttackIfReady(); diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp index 2f720d03db8..e6d5897f57b 100644 --- a/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp +++ b/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp @@ -205,7 +205,7 @@ struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI { HeroicMode = m_creature->GetMap()->IsHeroic(); Reset(); - CanEvade = false; + CanEvade = false; } bool HeroicMode; @@ -241,10 +241,10 @@ struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI { DoCast(m_creature->getVictim(),SPELL_ARCANE_BOLT); ArcaneBolt_Timer = 2000 + rand()%2500; - Unit *shaffar = FindCreature(ENTRY_SHAFFAR, 100, m_creature); + Unit *shaffar = FindCreature(ENTRY_SHAFFAR, 100, m_creature); if(!shaffar || shaffar->isDead()) { - m_creature->SetVisibility(VISIBILITY_OFF); + m_creature->SetVisibility(VISIBILITY_OFF); m_creature->SetLootRecipient(NULL); m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/sethekk_halls/boss_darkweaver_syth.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/sethekk_halls/boss_darkweaver_syth.cpp index f7dfcb3ed0c..1b03590e7d9 100644 --- a/src/bindings/scripts/scripts/zone/aunchindoun/sethekk_halls/boss_darkweaver_syth.cpp +++ b/src/bindings/scripts/scripts/zone/aunchindoun/sethekk_halls/boss_darkweaver_syth.cpp @@ -55,7 +55,7 @@ struct TRINITY_DLL_DECL boss_darkweaver_sythAI : public ScriptedAI { boss_darkweaver_sythAI(Creature *c) : ScriptedAI(c) - { + { HeroicMode = m_creature->GetMap()->IsHeroic(); Reset(); } @@ -69,7 +69,7 @@ struct TRINITY_DLL_DECL boss_darkweaver_sythAI : public ScriptedAI bool summon90; bool summon50; bool summon10; - bool HeroicMode; + bool HeroicMode; void Reset() { @@ -208,14 +208,14 @@ struct TRINITY_DLL_DECL mob_syth_fireAI : public ScriptedAI { mob_syth_fireAI(Creature *c) : ScriptedAI(c) - { + { HeroicMode = m_creature->GetMap()->IsHeroic(); Reset(); } uint32 flameshock_timer; uint32 flamebuffet_timer; - bool HeroicMode; + bool HeroicMode; void Reset() { @@ -260,14 +260,14 @@ struct TRINITY_DLL_DECL mob_syth_arcaneAI : public ScriptedAI { mob_syth_arcaneAI(Creature *c) : ScriptedAI(c) - { - HeroicMode = m_creature->GetMap()->IsHeroic(); + { + HeroicMode = m_creature->GetMap()->IsHeroic(); Reset(); } uint32 arcaneshock_timer; uint32 arcanebuffet_timer; - bool HeroicMode; + bool HeroicMode; void Reset() { @@ -312,14 +312,14 @@ struct TRINITY_DLL_DECL mob_syth_frostAI : public ScriptedAI { mob_syth_frostAI(Creature *c) : ScriptedAI(c) - { + { HeroicMode = m_creature->GetMap()->IsHeroic(); Reset(); } uint32 frostshock_timer; uint32 frostbuffet_timer; - bool HeroicMode; + bool HeroicMode; void Reset() { @@ -364,14 +364,14 @@ struct TRINITY_DLL_DECL mob_syth_shadowAI : public ScriptedAI { mob_syth_shadowAI(Creature *c) : ScriptedAI(c) - { + { HeroicMode = m_creature->GetMap()->IsHeroic(); Reset(); } uint32 shadowshock_timer; uint32 shadowbuffet_timer; - bool HeroicMode; + bool HeroicMode; void Reset() { diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp index f93f670d6bc..2e28b2a7661 100644 --- a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp +++ b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp @@ -47,7 +47,7 @@ struct TRINITY_DLL_DECL boss_ambassador_hellmawAI : public ScriptedAI boss_ambassador_hellmawAI(Creature *c) : ScriptedAI(c) { pInstance = ((ScriptedInstance*)c->GetInstanceData()); - HeroicMode = m_creature->GetMap()->IsHeroic(); + HeroicMode = m_creature->GetMap()->IsHeroic(); Reset(); } @@ -88,13 +88,13 @@ struct TRINITY_DLL_DECL boss_ambassador_hellmawAI : public ScriptedAI } } - void MoveInLineOfSight(Unit *who) - { - if (m_creature->HasAura(SPELL_BANISH,0)) - return; + void MoveInLineOfSight(Unit *who) + { + if (m_creature->HasAura(SPELL_BANISH,0)) + return; - ScriptedAI::MoveInLineOfSight(who); - } + ScriptedAI::MoveInLineOfSight(who); + } void MovementInform(uint32 type, uint32 id) { diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp index 155f1c0e443..f94254f277d 100644 --- a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp +++ b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp @@ -41,18 +41,18 @@ struct TRINITY_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance instance_shadow_labyrinth(Map *map) : ScriptedInstance(map) {Initialize();}; uint32 Encounter[ENCOUNTERS]; - std::string str_data; + std::string str_data; uint64 RefectoryDoorGUID; - uint64 ScreamingHallDoorGUID; + uint64 ScreamingHallDoorGUID; uint64 GrandmasterVorpil; uint32 FelOverseerCount; void Initialize() { - RefectoryDoorGUID = 0; - ScreamingHallDoorGUID = 0; + RefectoryDoorGUID = 0; + ScreamingHallDoorGUID = 0; GrandmasterVorpil = 0; FelOverseerCount = 0; @@ -73,8 +73,8 @@ struct TRINITY_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance { switch(go->GetEntry()) { - case REFECTORY_DOOR: RefectoryDoorGUID = go->GetGUID(); break; - case SCREAMING_HALL_DOOR: ScreamingHallDoorGUID = go->GetGUID(); break; + case REFECTORY_DOOR: RefectoryDoorGUID = go->GetGUID(); break; + case SCREAMING_HALL_DOOR: ScreamingHallDoorGUID = go->GetGUID(); break; } } @@ -92,36 +92,36 @@ struct TRINITY_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance } } - Player* GetPlayerInMap() - { - Map::PlayerList const& players = instance->GetPlayers(); + Player* GetPlayerInMap() + { + Map::PlayerList const& players = instance->GetPlayers(); - if (!players.isEmpty()) - { - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - if (Player* plr = itr->getSource()) - return plr; - } - } + if (!players.isEmpty()) + { + for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* plr = itr->getSource()) + return plr; + } + } - debug_log("SD2: Instance Shadow Labyrinth: GetPlayerInMap, but PlayerList is empty!"); - return NULL; - } + debug_log("SD2: Instance Shadow Labyrinth: GetPlayerInMap, but PlayerList is empty!"); + return NULL; + } - void HandleGameObject(uint64 guid, uint32 state) - { - Player *player = GetPlayerInMap(); + void HandleGameObject(uint64 guid, uint32 state) + { + Player *player = GetPlayerInMap(); - if (!player || !guid) - { - debug_log("SD2: Shadow Labyrinth: HandleGameObject fail"); - return; - } + if (!player || !guid) + { + debug_log("SD2: Shadow Labyrinth: HandleGameObject fail"); + return; + } - if (GameObject *go = GameObject::GetGameObject(*player,guid)) - go->SetGoState(state); - } + if (GameObject *go = GameObject::GetGameObject(*player,guid)) + go->SetGoState(state); + } void SetData(uint32 type, uint32 data) { @@ -149,7 +149,7 @@ struct TRINITY_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance case DATA_BLACKHEARTTHEINCITEREVENT: if( data == DONE ) { - HandleGameObject(RefectoryDoorGUID,0); + HandleGameObject(RefectoryDoorGUID,0); } Encounter[2] = data; break; @@ -157,7 +157,7 @@ struct TRINITY_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance case DATA_GRANDMASTERVORPILEVENT: if( data == DONE ) { - HandleGameObject(ScreamingHallDoorGUID,0); + HandleGameObject(ScreamingHallDoorGUID,0); } Encounter[3] = data; break; @@ -167,22 +167,22 @@ struct TRINITY_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance break; } - if (data == DONE) - { - if (type == TYPE_OVERSEER && FelOverseerCount != 0) - return; + if (data == DONE) + { + if (type == TYPE_OVERSEER && FelOverseerCount != 0) + return; - OUT_SAVE_INST_DATA; + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << Encounter[0] << " " << Encounter[1] << " " - << Encounter[2] << " " << Encounter[3] << " " << Encounter[4]; + std::ostringstream saveStream; + saveStream << Encounter[0] << " " << Encounter[1] << " " + << Encounter[2] << " " << Encounter[3] << " " << Encounter[4]; - str_data = saveStream.str(); + str_data = saveStream.str(); - SaveToDB(); - OUT_SAVE_INST_DATA_COMPLETE; - } + SaveToDB(); + OUT_SAVE_INST_DATA_COMPLETE; + } } uint32 GetData(uint32 type) @@ -205,30 +205,30 @@ struct TRINITY_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance return 0; } - const char* Save() - { - return str_data.c_str(); - } + const char* Save() + { + return str_data.c_str(); + } - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - std::istringstream loadStream(in); - loadStream >> Encounter[0] >> Encounter[1] >> Encounter[2] >> Encounter[3] >> Encounter[4]; + std::istringstream loadStream(in); + loadStream >> Encounter[0] >> Encounter[1] >> Encounter[2] >> Encounter[3] >> Encounter[4]; - for(uint8 i = 0; i < ENCOUNTERS; ++i) - if (Encounter[i] == IN_PROGRESS) - Encounter[i] = NOT_STARTED; + for(uint8 i = 0; i < ENCOUNTERS; ++i) + if (Encounter[i] == IN_PROGRESS) + Encounter[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; - } + OUT_LOAD_INST_DATA_COMPLETE; + } }; InstanceData* GetInstanceData_instance_shadow_labyrinth(Map* map) diff --git a/src/bindings/scripts/scripts/zone/azshara/azshara.cpp b/src/bindings/scripts/scripts/zone/azshara/azshara.cpp index 6f31b7d0f67..adcb8fbf005 100644 --- a/src/bindings/scripts/scripts/zone/azshara/azshara.cpp +++ b/src/bindings/scripts/scripts/zone/azshara/azshara.cpp @@ -251,7 +251,7 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI bool Must_Die; bool Escape; bool ContinueWP; - bool Reached; + bool Reached; void Reset() { @@ -267,7 +267,7 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI Must_Die = false; Escape = false; ContinueWP = false; - Reached = false; + Reached = false; } void Despawn() @@ -306,8 +306,8 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI m_creature->AI_SendMoveToPacket(3706.39, -3969.15, 35.9118, 0, 0, 0); } //begin swimming and summon depth charges - Player* player = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID)); - SendText(MSG_ESCAPE_NOTICE, player); + Player* player = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID)); + SendText(MSG_ESCAPE_NOTICE, player); DoCast(m_creature, SPELL_PERIODIC_DEPTH_CHARGE); m_creature->SetUnitMovementFlags(MOVEMENTFLAG_FLYING2 | MOVEMENTFLAG_SWIMMING); m_creature->SetSpeed(MOVE_RUN, 0.85f, true); @@ -336,7 +336,7 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI Grenade_Timer = 30000; } else Grenade_Timer -= diff; - if(Check_Timer < diff) + if(Check_Timer < diff) { Player *player = (Player *)Unit::GetUnit((*m_creature), PlayerGUID); if(!player) @@ -345,16 +345,16 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI return; } float dist = m_creature->GetDistance(player); - if(dist < 10 && m_creature->GetPositionX() > player->GetPositionX() && !Reached) + if(dist < 10 && m_creature->GetPositionX() > player->GetPositionX() && !Reached) { DoScriptText(SAY_RIZZLE_FINAL, m_creature); m_creature->SetUInt32Value(UNIT_NPC_FLAGS, 1); - m_creature->setFaction(35); + m_creature->setFaction(35); m_creature->StopMoving(); m_creature->GetMotionMaster()->MovementExpired(); - m_creature->GetMotionMaster()->Clear(true); + m_creature->GetMotionMaster()->Clear(true); m_creature->RemoveAurasDueToSpell(SPELL_PERIODIC_DEPTH_CHARGE); - Reached = true; + Reached = true; } Check_Timer = 1000; @@ -362,13 +362,13 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI } - void SendText(const char *text, Player* player) - { - WorldPacket data(SMSG_SERVER_MESSAGE, 0); // guess size - data << text; - if(player) - player->GetSession()->SendPacket(&data); - } + void SendText(const char *text, Player* player) + { + WorldPacket data(SMSG_SERVER_MESSAGE, 0); // guess size + data << text; + if(player) + player->GetSession()->SendPacket(&data); + } void AttackStart(Unit *who) { @@ -443,7 +443,7 @@ struct TRINITY_DLL_DECL mob_depth_chargeAI : public ScriptedAI void Reset() { m_creature->SetUnitMovementFlags(MOVEMENTFLAG_FLYING2 | MOVEMENTFLAG_SWIMMING); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); we_must_die = false; must_die_timer = 1000; } @@ -478,9 +478,9 @@ struct TRINITY_DLL_DECL mob_depth_chargeAI : public ScriptedAI } void Aggro(Unit* who) - { + { return; - } + } }; CreatureAI* GetAI_mob_depth_charge(Creature *_Creature) @@ -503,7 +503,7 @@ void AddSC_azshara() newscript->pGossipSelect = &GossipSelect_npc_loramus_thalipedes; newscript->RegisterSelf(); - newscript = new Script; + newscript = new Script; newscript->Name="mob_rizzle_sprysprocket"; newscript->GetAI = &GetAI_mob_rizzle_sprysprocket; newscript->pGossipHello = &GossipHello_mob_rizzle_sprysprocket; diff --git a/src/bindings/scripts/scripts/zone/azshara/boss_azuregos.cpp b/src/bindings/scripts/scripts/zone/azshara/boss_azuregos.cpp index 4ff46437e35..9b58b553d0a 100644 --- a/src/bindings/scripts/scripts/zone/azshara/boss_azuregos.cpp +++ b/src/bindings/scripts/scripts/zone/azshara/boss_azuregos.cpp @@ -70,7 +70,7 @@ struct TRINITY_DLL_DECL boss_azuregosAI : public ScriptedAI if(Teleport_Timer < diff) { - DoScriptText(SAY_TELEPORT, m_creature); + DoScriptText(SAY_TELEPORT, m_creature); std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); std::list::iterator i = m_threatlist.begin(); for (i = m_threatlist.begin(); i!= m_threatlist.end();++i) @@ -110,7 +110,7 @@ struct TRINITY_DLL_DECL boss_azuregosAI : public ScriptedAI //ManaStorm_Timer if (ManaStorm_Timer < diff) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_MANASTORM); ManaStorm_Timer = 7500 + rand()%5000; }else ManaStorm_Timer -= diff; diff --git a/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp b/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp index 94616ed555a..d1acc9373c4 100644 --- a/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp +++ b/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp @@ -326,110 +326,110 @@ CreatureAI* GetAI_npc_injured_draenei(Creature *_Creature) struct TRINITY_DLL_DECL npc_magwinAI : public npc_escortAI { - npc_magwinAI(Creature *c) : npc_escortAI(c) {Reset();} + npc_magwinAI(Creature *c) : npc_escortAI(c) {Reset();} - void WaypointReached(uint32 i) - { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + void WaypointReached(uint32 i) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - if (!player) - return; + if (!player) + return; - switch(i) - { - case 0: - DoScriptText(SAY_START, m_creature, player); - break; - case 17: - DoScriptText(SAY_PROGRESS, m_creature, player); - break; - case 28: - DoScriptText(SAY_END1, m_creature, player); - break; - case 29: - DoScriptText(EMOTE_HUG, m_creature, player); - DoScriptText(SAY_END2, m_creature, player); - if (player && player->GetTypeId() == TYPEID_PLAYER) - ((Player*)player)->GroupEventHappens(QUEST_A_CRY_FOR_HELP,m_creature); - break; - } - } + switch(i) + { + case 0: + DoScriptText(SAY_START, m_creature, player); + break; + case 17: + DoScriptText(SAY_PROGRESS, m_creature, player); + break; + case 28: + DoScriptText(SAY_END1, m_creature, player); + break; + case 29: + DoScriptText(EMOTE_HUG, m_creature, player); + DoScriptText(SAY_END2, m_creature, player); + if (player && player->GetTypeId() == TYPEID_PLAYER) + ((Player*)player)->GroupEventHappens(QUEST_A_CRY_FOR_HELP,m_creature); + break; + } + } - void Aggro(Unit* who) - { - DoScriptText(SAY_AGGRO, m_creature, who); - } + void Aggro(Unit* who) + { + DoScriptText(SAY_AGGRO, m_creature, who); + } - void Reset() - { - if (!IsBeingEscorted) - m_creature->setFaction(80); - } + void Reset() + { + if (!IsBeingEscorted) + m_creature->setFaction(80); + } - void JustDied(Unit* killer) - { - if (PlayerGUID) - { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - if (player) - ((Player*)player)->FailQuest(QUEST_A_CRY_FOR_HELP); - } - } + void JustDied(Unit* killer) + { + if (PlayerGUID) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + if (player) + ((Player*)player)->FailQuest(QUEST_A_CRY_FOR_HELP); + } + } - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + } }; bool QuestAccept_npc_magwin(Player* player, Creature* creature, Quest const* quest) { - if (quest->GetQuestId() == QUEST_A_CRY_FOR_HELP) - { - creature->setFaction(113); - ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); - } - return true; + if (quest->GetQuestId() == QUEST_A_CRY_FOR_HELP) + { + creature->setFaction(113); + ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); + } + return true; } CreatureAI* GetAI_npc_magwinAI(Creature *_Creature) { - npc_magwinAI* magwinAI = new npc_magwinAI(_Creature); + npc_magwinAI* magwinAI = new npc_magwinAI(_Creature); - magwinAI->AddWaypoint(0, -4784.532227, -11051.060547, 3.484263); - magwinAI->AddWaypoint(1, -4805.509277, -11037.293945, 3.043942); - magwinAI->AddWaypoint(2, -4827.826172, -11034.398438, 1.741959); - magwinAI->AddWaypoint(3, -4852.630859, -11033.695313, 2.208656); - magwinAI->AddWaypoint(4, -4876.791992, -11034.517578, 3.175228); - magwinAI->AddWaypoint(5, -4895.486816, -11038.306641, 9.390890); - magwinAI->AddWaypoint(6, -4915.464844, -11048.402344, 12.369793); - magwinAI->AddWaypoint(7, -4937.288086, -11067.041992, 13.857983); - magwinAI->AddWaypoint(8, -4966.577637, -11067.507813, 15.754786); - magwinAI->AddWaypoint(9, -4993.799805, -11056.544922, 19.175295); - magwinAI->AddWaypoint(10, -5017.836426, -11052.569336, 22.476587); - magwinAI->AddWaypoint(11, -5039.706543, -11058.459961, 25.831593); - magwinAI->AddWaypoint(12, -5057.289063, -11045.474609, 26.972496); - magwinAI->AddWaypoint(13, -5078.828125, -11037.601563, 29.053417); - magwinAI->AddWaypoint(14, -5104.158691, -11039.195313, 29.440195); - magwinAI->AddWaypoint(15, -5120.780273, -11039.518555, 30.142139); - magwinAI->AddWaypoint(16, -5140.833008, -11039.810547, 28.788074); - magwinAI->AddWaypoint(17, -5161.201660, -11040.050781, 27.879545, 4000); - magwinAI->AddWaypoint(18, -5171.842285, -11046.803711, 27.183821); - magwinAI->AddWaypoint(19, -5185.995117, -11056.359375, 20.234867); - magwinAI->AddWaypoint(20, -5198.485840, -11065.065430, 18.872593); - magwinAI->AddWaypoint(21, -5214.062500, -11074.653320, 19.215731); - magwinAI->AddWaypoint(22, -5220.157227, -11088.377930, 19.818476); - magwinAI->AddWaypoint(23, -5233.652832, -11098.846680, 18.349432); - magwinAI->AddWaypoint(24, -5250.163086, -11111.653320, 16.438959); - magwinAI->AddWaypoint(25, -5268.194336, -11125.639648, 12.668313); - magwinAI->AddWaypoint(26, -5286.270508, -11130.669922, 6.912246); - magwinAI->AddWaypoint(27, -5317.449707, -11137.392578, 4.963446); - magwinAI->AddWaypoint(28, -5334.854492, -11154.384766, 6.742664); - magwinAI->AddWaypoint(29, -5353.874512, -11171.595703, 6.903912, 20000); - magwinAI->AddWaypoint(30, -5354.240000, -11171.940000, 6.890000); + magwinAI->AddWaypoint(0, -4784.532227, -11051.060547, 3.484263); + magwinAI->AddWaypoint(1, -4805.509277, -11037.293945, 3.043942); + magwinAI->AddWaypoint(2, -4827.826172, -11034.398438, 1.741959); + magwinAI->AddWaypoint(3, -4852.630859, -11033.695313, 2.208656); + magwinAI->AddWaypoint(4, -4876.791992, -11034.517578, 3.175228); + magwinAI->AddWaypoint(5, -4895.486816, -11038.306641, 9.390890); + magwinAI->AddWaypoint(6, -4915.464844, -11048.402344, 12.369793); + magwinAI->AddWaypoint(7, -4937.288086, -11067.041992, 13.857983); + magwinAI->AddWaypoint(8, -4966.577637, -11067.507813, 15.754786); + magwinAI->AddWaypoint(9, -4993.799805, -11056.544922, 19.175295); + magwinAI->AddWaypoint(10, -5017.836426, -11052.569336, 22.476587); + magwinAI->AddWaypoint(11, -5039.706543, -11058.459961, 25.831593); + magwinAI->AddWaypoint(12, -5057.289063, -11045.474609, 26.972496); + magwinAI->AddWaypoint(13, -5078.828125, -11037.601563, 29.053417); + magwinAI->AddWaypoint(14, -5104.158691, -11039.195313, 29.440195); + magwinAI->AddWaypoint(15, -5120.780273, -11039.518555, 30.142139); + magwinAI->AddWaypoint(16, -5140.833008, -11039.810547, 28.788074); + magwinAI->AddWaypoint(17, -5161.201660, -11040.050781, 27.879545, 4000); + magwinAI->AddWaypoint(18, -5171.842285, -11046.803711, 27.183821); + magwinAI->AddWaypoint(19, -5185.995117, -11056.359375, 20.234867); + magwinAI->AddWaypoint(20, -5198.485840, -11065.065430, 18.872593); + magwinAI->AddWaypoint(21, -5214.062500, -11074.653320, 19.215731); + magwinAI->AddWaypoint(22, -5220.157227, -11088.377930, 19.818476); + magwinAI->AddWaypoint(23, -5233.652832, -11098.846680, 18.349432); + magwinAI->AddWaypoint(24, -5250.163086, -11111.653320, 16.438959); + magwinAI->AddWaypoint(25, -5268.194336, -11125.639648, 12.668313); + magwinAI->AddWaypoint(26, -5286.270508, -11130.669922, 6.912246); + magwinAI->AddWaypoint(27, -5317.449707, -11137.392578, 4.963446); + magwinAI->AddWaypoint(28, -5334.854492, -11154.384766, 6.742664); + magwinAI->AddWaypoint(29, -5353.874512, -11171.595703, 6.903912, 20000); + magwinAI->AddWaypoint(30, -5354.240000, -11171.940000, 6.890000); - return (CreatureAI*)magwinAI; + return (CreatureAI*)magwinAI; } /*###### @@ -470,155 +470,155 @@ bool GossipSelect_npc_susurrus(Player *player, Creature *_Creature, uint32 sende ## npc_geezle ######*/ -#define GEEZLE_SAY_1 -1000259 -#define SPARK_SAY_2 -1000260 -#define SPARK_SAY_3 -1000261 -#define GEEZLE_SAY_4 -1000262 -#define SPARK_SAY_5 -1000263 -#define SPARK_SAY_6 -1000264 -#define GEEZLE_SAY_7 -1000265 +#define GEEZLE_SAY_1 -1000259 +#define SPARK_SAY_2 -1000260 +#define SPARK_SAY_3 -1000261 +#define GEEZLE_SAY_4 -1000262 +#define SPARK_SAY_5 -1000263 +#define SPARK_SAY_6 -1000264 +#define GEEZLE_SAY_7 -1000265 -#define EMOTE_SPARK -1000266 +#define EMOTE_SPARK -1000266 -#define MOB_SPARK 17243 -#define GO_NAGA_FLAG 181694 +#define MOB_SPARK 17243 +#define GO_NAGA_FLAG 181694 static float SparkPos[4] = {-5030.95, -11291.99, 7.97}; struct TRINITY_DLL_DECL npc_geezleAI : public ScriptedAI { - npc_geezleAI(Creature *c) : ScriptedAI(c) {Reset();} + npc_geezleAI(Creature *c) : ScriptedAI(c) {Reset();} - std::list FlagList; + std::list FlagList; - uint64 SparkGUID; + uint64 SparkGUID; - uint32 Step; - uint32 SayTimer; + uint32 Step; + uint32 SayTimer; - bool EventStarted; + bool EventStarted; - void Reset() - { - SparkGUID = 0; - Step = 0; - StartEvent(); - } + void Reset() + { + SparkGUID = 0; + Step = 0; + StartEvent(); + } - void Aggro(Unit* who){} + void Aggro(Unit* who){} - void StartEvent() - { - Step = 1; - EventStarted = true; - Creature* Spark = m_creature->SummonCreature(MOB_SPARK, SparkPos[0], SparkPos[1], SparkPos[2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000); - SparkGUID = Spark->GetGUID(); - Spark->setActive(true); - Spark->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - m_creature->GetMotionMaster()->MovePoint(0, -5092.26, -11252, 0.71); - Spark->GetMotionMaster()->MovePoint(0, -5080.70, -11253.61, 0.56); - SayTimer = 23000; - } + void StartEvent() + { + Step = 1; + EventStarted = true; + Creature* Spark = m_creature->SummonCreature(MOB_SPARK, SparkPos[0], SparkPos[1], SparkPos[2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000); + SparkGUID = Spark->GetGUID(); + Spark->setActive(true); + Spark->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + m_creature->GetMotionMaster()->MovePoint(0, -5092.26, -11252, 0.71); + Spark->GetMotionMaster()->MovePoint(0, -5080.70, -11253.61, 0.56); + SayTimer = 23000; + } - uint32 NextStep(uint32 Step) - { - Unit* Spark = Unit::GetUnit((*m_creature), SparkGUID); + uint32 NextStep(uint32 Step) + { + Unit* Spark = Unit::GetUnit((*m_creature), SparkGUID); - switch(Step) - { - case 0: return 99999; - case 1: - //DespawnNagaFlag(true); - DoScriptText(EMOTE_SPARK, Spark); - return 1000; - case 2: - DoScriptText(GEEZLE_SAY_1, m_creature, Spark); - Spark->SetInFront(m_creature); - m_creature->SetInFront(Spark); - return 5000; - case 3: DoScriptText(SPARK_SAY_2, Spark); return 7000; - case 4: DoScriptText(SPARK_SAY_3, Spark); return 8000; - case 5: DoScriptText(GEEZLE_SAY_4, m_creature, Spark); return 8000; - case 6: DoScriptText(SPARK_SAY_5, Spark); return 9000; - case 7: DoScriptText(SPARK_SAY_6, Spark); return 8000; - case 8: DoScriptText(GEEZLE_SAY_7, m_creature, Spark); return 2000; - case 9: - m_creature->GetMotionMaster()->MoveTargetedHome(); - Spark->GetMotionMaster()->MovePoint(0, -5030.95, -11291.99, 7.97); - return 20000; - case 10: - Spark->DealDamage(Spark,Spark->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - //DespawnNagaFlag(false); - m_creature->SetVisibility(VISIBILITY_OFF); - default: return 99999999; - } - } + switch(Step) + { + case 0: return 99999; + case 1: + //DespawnNagaFlag(true); + DoScriptText(EMOTE_SPARK, Spark); + return 1000; + case 2: + DoScriptText(GEEZLE_SAY_1, m_creature, Spark); + Spark->SetInFront(m_creature); + m_creature->SetInFront(Spark); + return 5000; + case 3: DoScriptText(SPARK_SAY_2, Spark); return 7000; + case 4: DoScriptText(SPARK_SAY_3, Spark); return 8000; + case 5: DoScriptText(GEEZLE_SAY_4, m_creature, Spark); return 8000; + case 6: DoScriptText(SPARK_SAY_5, Spark); return 9000; + case 7: DoScriptText(SPARK_SAY_6, Spark); return 8000; + case 8: DoScriptText(GEEZLE_SAY_7, m_creature, Spark); return 2000; + case 9: + m_creature->GetMotionMaster()->MoveTargetedHome(); + Spark->GetMotionMaster()->MovePoint(0, -5030.95, -11291.99, 7.97); + return 20000; + case 10: + Spark->DealDamage(Spark,Spark->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + //DespawnNagaFlag(false); + m_creature->SetVisibility(VISIBILITY_OFF); + default: return 99999999; + } + } - void DespawnNagaFlag(bool despawn) - { - CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); - Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; - cell.SetNoCreate(); + void DespawnNagaFlag(bool despawn) + { + CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); + Cell cell(pair); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); - Trinity::AllGameObjectsWithEntryInGrid go_check(GO_NAGA_FLAG); - Trinity::GameObjectListSearcher go_search(FlagList, go_check); - TypeContainerVisitor - , GridTypeMapContainer> go_visit(go_search); - CellLock cell_lock(cell, pair); - cell_lock->Visit(cell_lock, go_visit, *(m_creature->GetMap())); + Trinity::AllGameObjectsWithEntryInGrid go_check(GO_NAGA_FLAG); + Trinity::GameObjectListSearcher go_search(FlagList, go_check); + TypeContainerVisitor + , GridTypeMapContainer> go_visit(go_search); + CellLock cell_lock(cell, pair); + cell_lock->Visit(cell_lock, go_visit, *(m_creature->GetMap())); - Player* player = NULL; - if (!FlagList.empty()) - { - for(std::list::iterator itr = FlagList.begin(); itr != FlagList.end(); ++itr) - { - //TODO: Found how to despawn and respawn - if(despawn) - (*itr)->RemoveFromWorld(); - else - (*itr)->Respawn(); - } - } else error_log("SD2 ERROR: FlagList is empty!"); - } + Player* player = NULL; + if (!FlagList.empty()) + { + for(std::list::iterator itr = FlagList.begin(); itr != FlagList.end(); ++itr) + { + //TODO: Found how to despawn and respawn + if(despawn) + (*itr)->RemoveFromWorld(); + else + (*itr)->Respawn(); + } + } else error_log("SD2 ERROR: FlagList is empty!"); + } - void UpdateAI(const uint32 diff) - { - if(SayTimer < diff) - { - if(EventStarted) - { - SayTimer = NextStep(++Step); - } - }else SayTimer -= diff; - } + void UpdateAI(const uint32 diff) + { + if(SayTimer < diff) + { + if(EventStarted) + { + SayTimer = NextStep(++Step); + } + }else SayTimer -= diff; + } }; CreatureAI* GetAI_npc_geezleAI(Creature *_Creature) { - return new npc_geezleAI(_Creature); + return new npc_geezleAI(_Creature); } /*###### ## mob_nestlewood_owlkin ######*/ -#define INOCULATION_CHANNEL 29528 -#define INOCULATED_OWLKIN 16534 +#define INOCULATION_CHANNEL 29528 +#define INOCULATED_OWLKIN 16534 struct TRINITY_DLL_DECL mob_nestlewood_owlkinAI : public ScriptedAI { mob_nestlewood_owlkinAI(Creature *c) : ScriptedAI(c) {Reset();} - uint32 ChannelTimer; - bool Channeled; - bool Hitted; + uint32 ChannelTimer; + bool Channeled; + bool Hitted; void Reset() { - ChannelTimer = 0; - Channeled = false; - Hitted = false; + ChannelTimer = 0; + Channeled = false; + Hitted = false; } void Aggro(Unit *who){} @@ -629,23 +629,23 @@ struct TRINITY_DLL_DECL mob_nestlewood_owlkinAI : public ScriptedAI return; if(caster->GetTypeId() == TYPEID_PLAYER && spell->Id == INOCULATION_CHANNEL) - { - ChannelTimer = 3000; - Hitted = true; - } + { + ChannelTimer = 3000; + Hitted = true; + } } void UpdateAI(const uint32 diff) { - if(ChannelTimer < diff && !Channeled && Hitted) - { - m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - m_creature->RemoveCorpse(); - m_creature->SummonCreature(INOCULATED_OWLKIN, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 180000); - Channeled = true; - }else ChannelTimer -= diff; + if(ChannelTimer < diff && !Channeled && Hitted) + { + m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->RemoveCorpse(); + m_creature->SummonCreature(INOCULATED_OWLKIN, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 180000); + Channeled = true; + }else ChannelTimer -= diff; - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); } }; @@ -675,11 +675,11 @@ void AddSC_azuremyst_isle() newscript->GetAI = &GetAI_npc_injured_draenei; newscript->RegisterSelf(); - newscript = new Script; - newscript->Name = "npc_magwin"; - newscript->GetAI = &GetAI_npc_magwinAI; - newscript->pQuestAccept = &QuestAccept_npc_magwin; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name = "npc_magwin"; + newscript->GetAI = &GetAI_npc_magwinAI; + newscript->pQuestAccept = &QuestAccept_npc_magwin; + newscript->RegisterSelf(); newscript = new Script; newscript->Name="npc_susurrus"; @@ -687,14 +687,14 @@ void AddSC_azuremyst_isle() newscript->pGossipSelect = &GossipSelect_npc_susurrus; newscript->RegisterSelf(); - newscript = new Script; - newscript->Name="npc_geezle"; - newscript->GetAI = &GetAI_npc_geezleAI; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name="npc_geezle"; + newscript->GetAI = &GetAI_npc_geezleAI; + newscript->RegisterSelf(); - newscript = new Script; - newscript->Name="mob_nestlewood_owlkin"; - newscript->GetAI = &GetAI_mob_nestlewood_owlkinAI; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name="mob_nestlewood_owlkin"; + newscript->GetAI = &GetAI_mob_nestlewood_owlkinAI; + newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp b/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp index 08fb76889da..ceab92a1107 100644 --- a/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp +++ b/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp @@ -391,87 +391,87 @@ CreatureAI* GetAI_npc_twiggy_flathead(Creature *_Creature) ## npc_wizzlecrank_shredder #####*/ -#define SAY_PROGRESS_1 -1000272 -#define SAY_PROGRESS_2 -1000273 -#define SAY_PROGRESS_3 -1000274 +#define SAY_PROGRESS_1 -1000272 +#define SAY_PROGRESS_2 -1000273 +#define SAY_PROGRESS_3 -1000274 -#define SAY_MERCENARY_4 -1000275 +#define SAY_MERCENARY_4 -1000275 -#define SAY_PROGRESS_5 -1000276 -#define SAY_PROGRESS_6 -1000277 -#define SAY_PROGRESS_7 -1000278 -#define SAY_PROGRESS_8 -1000279 +#define SAY_PROGRESS_5 -1000276 +#define SAY_PROGRESS_6 -1000277 +#define SAY_PROGRESS_7 -1000278 +#define SAY_PROGRESS_8 -1000279 -#define QUEST_ESCAPE 863 -#define NPC_PILOT 3451 -#define MOB_MERCENARY 3282 +#define QUEST_ESCAPE 863 +#define NPC_PILOT 3451 +#define MOB_MERCENARY 3282 struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI { - npc_wizzlecrank_shredderAI(Creature* c) : npc_escortAI(c) {Reset();} + npc_wizzlecrank_shredderAI(Creature* c) : npc_escortAI(c) {Reset();} bool Completed; - void WaypointReached(uint32 i) - { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + void WaypointReached(uint32 i) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - if(!player) - return; + if(!player) + return; - switch(i) - { - case 0: DoScriptText(SAY_PROGRESS_1, m_creature); - m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; - case 1: DoScriptText(SAY_PROGRESS_2, m_creature); break; - case 10: DoScriptText(SAY_PROGRESS_3, m_creature, player); - m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; - case 20:{ - Unit* Mercenary = FindCreature(MOB_MERCENARY, 99, m_creature); - if(Mercenary) - { - DoScriptText(SAY_MERCENARY_4, Mercenary); - ((Creature*)Mercenary)->AI()->AttackStart(m_creature); - AttackStart(Mercenary); - } - }break; - case 21: DoScriptText(SAY_PROGRESS_5, m_creature); - m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; - case 28: DoScriptText(SAY_PROGRESS_6, m_creature); break; - case 29: DoScriptText(SAY_PROGRESS_7, m_creature); break; - case 30: DoScriptText(SAY_PROGRESS_8, m_creature); break; - case 31: m_creature->SummonCreature(NPC_PILOT, 1088.77, -2985.39, 91.84, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 300000); - m_creature->setDeathState(JUST_DIED); + switch(i) + { + case 0: DoScriptText(SAY_PROGRESS_1, m_creature); + m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; + case 1: DoScriptText(SAY_PROGRESS_2, m_creature); break; + case 10: DoScriptText(SAY_PROGRESS_3, m_creature, player); + m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; + case 20:{ + Unit* Mercenary = FindCreature(MOB_MERCENARY, 99, m_creature); + if(Mercenary) + { + DoScriptText(SAY_MERCENARY_4, Mercenary); + ((Creature*)Mercenary)->AI()->AttackStart(m_creature); + AttackStart(Mercenary); + } + }break; + case 21: DoScriptText(SAY_PROGRESS_5, m_creature); + m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; + case 28: DoScriptText(SAY_PROGRESS_6, m_creature); break; + case 29: DoScriptText(SAY_PROGRESS_7, m_creature); break; + case 30: DoScriptText(SAY_PROGRESS_8, m_creature); break; + case 31: m_creature->SummonCreature(NPC_PILOT, 1088.77, -2985.39, 91.84, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 300000); + m_creature->setDeathState(JUST_DIED); Completed = true; - if (player && player->GetTypeId() == TYPEID_PLAYER) + if (player && player->GetTypeId() == TYPEID_PLAYER) ((Player*)player)->GroupEventHappens(QUEST_ESCAPE, m_creature); - break; - } - } + break; + } + } - void Reset() - { - m_creature->setDeathState(ALIVE); + void Reset() + { + m_creature->setDeathState(ALIVE); Completed = false; m_creature->setFaction(69); - } + } - void Aggro(Unit* who){} + void Aggro(Unit* who){} - void JustDied(Unit* killer) - { - if (PlayerGUID && !Completed) + void JustDied(Unit* killer) + { + if (PlayerGUID && !Completed) { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); if (player) ((Player*)player)->FailQuest(QUEST_ESCAPE); } - } + } - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + } }; bool QuestAccept_npc_wizzlecrank_shredder(Player* player, Creature* creature, Quest const* quest) @@ -479,49 +479,49 @@ bool QuestAccept_npc_wizzlecrank_shredder(Player* player, Creature* creature, Qu if (quest->GetQuestId() == QUEST_ESCAPE) { ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); - creature->setFaction(113); + creature->setFaction(113); } return true; } CreatureAI* GetAI_npc_wizzlecrank_shredderAI(Creature *_Creature) { - npc_wizzlecrank_shredderAI* thisAI = new npc_wizzlecrank_shredderAI(_Creature); + npc_wizzlecrank_shredderAI* thisAI = new npc_wizzlecrank_shredderAI(_Creature); - thisAI->AddWaypoint(0, 1109.15, -3104.11, 82.41, 6000); - thisAI->AddWaypoint(1, 1105.39, -3102.86, 82.74, 2000); - thisAI->AddWaypoint(2, 1104.97, -3108.52, 83.10, 1000); - thisAI->AddWaypoint(3, 1110.01, -3110.48, 82.81, 1000); - thisAI->AddWaypoint(4, 1111.72, -3103.03, 82.21, 1000); - thisAI->AddWaypoint(5, 1106.98, -3099.44, 82.18, 1000); - thisAI->AddWaypoint(6, 1103.74, -3103.29, 83.05, 1000); - thisAI->AddWaypoint(7, 1112.55, -3106.56, 82.31, 1000); - thisAI->AddWaypoint(8, 1108.12, -3111.04, 82.99, 1000); - thisAI->AddWaypoint(9, 1109.32, -3100.39, 82.08, 1000); - thisAI->AddWaypoint(10, 1109.32, -3100.39, 82.08, 6000); - thisAI->AddWaypoint(11, 1098.92, -3095.14, 82.97); - thisAI->AddWaypoint(12, 1100.94, -3082.60, 82.83); - thisAI->AddWaypoint(13, 1101.12, -3068.83, 82.53); - thisAI->AddWaypoint(14, 1096.97, -3051.99, 82.50); - thisAI->AddWaypoint(15, 1094.06, -3036.79, 82.70); - thisAI->AddWaypoint(16, 1098.22, -3027.84, 83.79); - thisAI->AddWaypoint(17, 1109.51, -3015.92, 85.73); - thisAI->AddWaypoint(18, 1119.87, -3007.21, 87.08); - thisAI->AddWaypoint(19, 1130.23, -3002.49, 91.27, 5000); - thisAI->AddWaypoint(20, 1130.23, -3002.49, 91.27, 3000); - thisAI->AddWaypoint(21, 1130.23, -3002.49, 91.27, 4000); - thisAI->AddWaypoint(22, 1129.73, -2985.89, 92.46); - thisAI->AddWaypoint(23, 1124.10, -2983.29, 92.81); - thisAI->AddWaypoint(24, 1111.74, -2992.38, 91.59); - thisAI->AddWaypoint(25, 1111.06, -2976.54, 91.81); - thisAI->AddWaypoint(26, 1099.91, -2991.17, 91.67); - thisAI->AddWaypoint(27, 1096.32, -2981.55, 91.73); - thisAI->AddWaypoint(28, 1091.28, -2985.82, 91.74, 4000); - thisAI->AddWaypoint(29, 1091.28, -2985.82, 91.74, 3000); - thisAI->AddWaypoint(30, 1091.28, -2985.82, 91.74, 7000); - thisAI->AddWaypoint(31, 1091.28, -2985.82, 91.74, 3000); + thisAI->AddWaypoint(0, 1109.15, -3104.11, 82.41, 6000); + thisAI->AddWaypoint(1, 1105.39, -3102.86, 82.74, 2000); + thisAI->AddWaypoint(2, 1104.97, -3108.52, 83.10, 1000); + thisAI->AddWaypoint(3, 1110.01, -3110.48, 82.81, 1000); + thisAI->AddWaypoint(4, 1111.72, -3103.03, 82.21, 1000); + thisAI->AddWaypoint(5, 1106.98, -3099.44, 82.18, 1000); + thisAI->AddWaypoint(6, 1103.74, -3103.29, 83.05, 1000); + thisAI->AddWaypoint(7, 1112.55, -3106.56, 82.31, 1000); + thisAI->AddWaypoint(8, 1108.12, -3111.04, 82.99, 1000); + thisAI->AddWaypoint(9, 1109.32, -3100.39, 82.08, 1000); + thisAI->AddWaypoint(10, 1109.32, -3100.39, 82.08, 6000); + thisAI->AddWaypoint(11, 1098.92, -3095.14, 82.97); + thisAI->AddWaypoint(12, 1100.94, -3082.60, 82.83); + thisAI->AddWaypoint(13, 1101.12, -3068.83, 82.53); + thisAI->AddWaypoint(14, 1096.97, -3051.99, 82.50); + thisAI->AddWaypoint(15, 1094.06, -3036.79, 82.70); + thisAI->AddWaypoint(16, 1098.22, -3027.84, 83.79); + thisAI->AddWaypoint(17, 1109.51, -3015.92, 85.73); + thisAI->AddWaypoint(18, 1119.87, -3007.21, 87.08); + thisAI->AddWaypoint(19, 1130.23, -3002.49, 91.27, 5000); + thisAI->AddWaypoint(20, 1130.23, -3002.49, 91.27, 3000); + thisAI->AddWaypoint(21, 1130.23, -3002.49, 91.27, 4000); + thisAI->AddWaypoint(22, 1129.73, -2985.89, 92.46); + thisAI->AddWaypoint(23, 1124.10, -2983.29, 92.81); + thisAI->AddWaypoint(24, 1111.74, -2992.38, 91.59); + thisAI->AddWaypoint(25, 1111.06, -2976.54, 91.81); + thisAI->AddWaypoint(26, 1099.91, -2991.17, 91.67); + thisAI->AddWaypoint(27, 1096.32, -2981.55, 91.73); + thisAI->AddWaypoint(28, 1091.28, -2985.82, 91.74, 4000); + thisAI->AddWaypoint(29, 1091.28, -2985.82, 91.74, 3000); + thisAI->AddWaypoint(30, 1091.28, -2985.82, 91.74, 7000); + thisAI->AddWaypoint(31, 1091.28, -2985.82, 91.74, 3000); - return (CreatureAI*)thisAI; + return (CreatureAI*)thisAI; } void AddSC_the_barrens() @@ -551,9 +551,9 @@ void AddSC_the_barrens() newscript->GetAI = &GetAI_npc_twiggy_flathead; newscript->RegisterSelf(); - newscript = new Script; - newscript->Name="npc_wizzlecrank_shredder"; - newscript->GetAI = &GetAI_npc_wizzlecrank_shredderAI; - newscript->pQuestAccept = &QuestAccept_npc_wizzlecrank_shredder; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name="npc_wizzlecrank_shredder"; + newscript->GetAI = &GetAI_npc_wizzlecrank_shredderAI; + newscript->pQuestAccept = &QuestAccept_npc_wizzlecrank_shredder; + newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_bloodboil.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_bloodboil.cpp index 29b625dcaf6..d483b4ec1be 100644 --- a/src/bindings/scripts/scripts/zone/black_temple/boss_bloodboil.cpp +++ b/src/bindings/scripts/scripts/zone/black_temple/boss_bloodboil.cpp @@ -116,7 +116,7 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI void Aggro(Unit *who) { DoZoneInCombat(); - DoScriptText(SAY_AGGRO, m_creature); + DoScriptText(SAY_AGGRO, m_creature); if(pInstance) pInstance->SetData(DATA_GURTOGGBLOODBOILEVENT, IN_PROGRESS); } @@ -125,8 +125,8 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI { switch(rand()%2) { - case 0: DoScriptText(SAY_SLAY1, m_creature); break; - case 1: DoScriptText(SAY_SLAY2, m_creature); break; + case 0: DoScriptText(SAY_SLAY1, m_creature); break; + case 1: DoScriptText(SAY_SLAY2, m_creature); break; } } @@ -145,7 +145,7 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI std::list m_threatlist = m_creature->getThreatManager().getThreatList(); if(!m_threatlist.size()) // He doesn't have anyone in his threatlist, useless to continue - return; + return; std::list targets; std::list::iterator itr = m_threatlist.begin(); @@ -214,17 +214,17 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI }else FelAcidTimer -= diff; if(!m_creature->HasAura(SPELL_BERSERK, 0)) - { - if(EnrageTimer < diff) - { - DoCast(m_creature, SPELL_BERSERK); - switch(rand()%2) - { - case 0: DoScriptText(SAY_ENRAGE1, m_creature); break; - case 1: DoScriptText(SAY_ENRAGE2, m_creature); break; - } - }else EnrageTimer -= diff; - } + { + if(EnrageTimer < diff) + { + DoCast(m_creature, SPELL_BERSERK); + switch(rand()%2) + { + case 0: DoScriptText(SAY_ENRAGE1, m_creature); break; + case 1: DoScriptText(SAY_ENRAGE2, m_creature); break; + } + }else EnrageTimer -= diff; + } if(Phase1) { @@ -232,8 +232,8 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI { DoCast(m_creature->getVictim(), SPELL_BEWILDERING_STRIKE); float mt_threat = DoGetThreat(m_creature->getVictim()); - if (Unit* target = SelectUnit(SELECT_TARGET_TOPAGGRO, 1)) - m_creature->AddThreat(target, mt_threat); + if (Unit* target = SelectUnit(SELECT_TARGET_TOPAGGRO, 1)) + m_creature->AddThreat(target, mt_threat); BewilderingStrikeTimer = 20000; }else BewilderingStrikeTimer -= diff; @@ -305,8 +305,8 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI switch(rand()%2) { - case 0: DoScriptText(SAY_SPECIAL1, m_creature); break; - case 1: DoScriptText(SAY_SPECIAL2, m_creature); break; + case 0: DoScriptText(SAY_SPECIAL1, m_creature); break; + case 1: DoScriptText(SAY_SPECIAL2, m_creature); break; } AcidGeyserTimer = 1000; diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_mother_shahraz.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_mother_shahraz.cpp index a547034fd58..36dcd1ff58e 100644 --- a/src/bindings/scripts/scripts/zone/black_temple/boss_mother_shahraz.cpp +++ b/src/bindings/scripts/scripts/zone/black_temple/boss_mother_shahraz.cpp @@ -94,7 +94,7 @@ struct TRINITY_DLL_DECL boss_shahrazAI : public ScriptedAI uint32 FatalAttractionTimer; uint32 FatalAttractionExplodeTimer; uint32 ShriekTimer; - uint32 SaberTimer; + uint32 SaberTimer; uint32 RandomYellTimer; uint32 EnrageTimer; uint32 ExplosionCount; @@ -116,7 +116,7 @@ struct TRINITY_DLL_DECL boss_shahrazAI : public ScriptedAI FatalAttractionTimer = 60000; FatalAttractionExplodeTimer = 70000; ShriekTimer = 30000; - SaberTimer = 35000; + SaberTimer = 35000; RandomYellTimer = 70000 + rand()%41 * 1000; EnrageTimer = 600000; ExplosionCount = 0; @@ -130,15 +130,15 @@ struct TRINITY_DLL_DECL boss_shahrazAI : public ScriptedAI pInstance->SetData(DATA_MOTHERSHAHRAZEVENT, IN_PROGRESS); DoZoneInCombat(); - DoScriptText(SAY_AGGRO, m_creature); + DoScriptText(SAY_AGGRO, m_creature); } void KilledUnit(Unit *victim) { switch(rand()%2) { - case 0: DoScriptText(SAY_SLAY1, m_creature); break; - case 1: DoScriptText(SAY_SLAY2, m_creature); break; + case 0: DoScriptText(SAY_SLAY1, m_creature); break; + case 1: DoScriptText(SAY_SLAY2, m_creature); break; } } @@ -230,8 +230,8 @@ struct TRINITY_DLL_DECL boss_shahrazAI : public ScriptedAI switch(rand()%2) { - case 0: DoScriptText(SAY_SPELL2, m_creature); break; - case 1: DoScriptText(SAY_SPELL3, m_creature); break; + case 0: DoScriptText(SAY_SPELL2, m_creature); break; + case 1: DoScriptText(SAY_SPELL3, m_creature); break; } FatalAttractionExplodeTimer = 2000; FatalAttractionTimer = 40000 + rand()%31 * 1000; @@ -270,7 +270,7 @@ struct TRINITY_DLL_DECL boss_shahrazAI : public ScriptedAI ShriekTimer = 25000+rand()%10 * 1000; }else ShriekTimer -= diff; - if(SaberTimer < diff) + if(SaberTimer < diff) { DoCast(m_creature->getVictim(), SPELL_SABER_LASH); SaberTimer = 25000+rand()%10 * 1000; @@ -281,7 +281,7 @@ struct TRINITY_DLL_DECL boss_shahrazAI : public ScriptedAI if(EnrageTimer < diff) { DoCast(m_creature, SPELL_BERSERK); - DoScriptText(SAY_ENRAGE, m_creature); + DoScriptText(SAY_ENRAGE, m_creature); }else EnrageTimer -= diff; //Random taunts @@ -289,9 +289,9 @@ struct TRINITY_DLL_DECL boss_shahrazAI : public ScriptedAI { switch(rand()%3) { - case 0: DoScriptText(SAY_TAUNT1, m_creature); break; - case 1: DoScriptText(SAY_TAUNT2, m_creature); break; - case 2: DoScriptText(SAY_TAUNT3, m_creature); break; + case 0: DoScriptText(SAY_TAUNT1, m_creature); break; + case 1: DoScriptText(SAY_TAUNT2, m_creature); break; + case 2: DoScriptText(SAY_TAUNT3, m_creature); break; } RandomYellTimer = 60000 + rand()%91 * 1000; }else RandomYellTimer -= diff; diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp index af712a9bfd0..231a8410724 100644 --- a/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp +++ b/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp @@ -270,11 +270,11 @@ struct TRINITY_DLL_DECL boss_reliquary_of_soulsAI : public ScriptedAI case 5: if(Phase == 1) { - DoScriptText(SUFF_SAY_AFTER, Essence); + DoScriptText(SUFF_SAY_AFTER, Essence); } else { - DoScriptText(DESI_SAY_AFTER, Essence); + DoScriptText(DESI_SAY_AFTER, Essence); } Essence->SetVisibility(VISIBILITY_OFF); Essence->setDeathState(DEAD); @@ -356,7 +356,7 @@ struct TRINITY_DLL_DECL boss_essence_of_sufferingAI : public ScriptedAI void Aggro(Unit *who) { - DoScriptText(SUFF_SAY_FREED, m_creature); + DoScriptText(SUFF_SAY_FREED, m_creature); DoZoneInCombat(); m_creature->CastSpell(m_creature, AURA_OF_SUFFERING, true); // linked aura need core support m_creature->CastSpell(m_creature, ESSENCE_OF_SUFFERING_PASSIVE, true); @@ -367,9 +367,9 @@ struct TRINITY_DLL_DECL boss_essence_of_sufferingAI : public ScriptedAI { switch(rand()%2) { - case 0: DoScriptText(SUFF_SAY_SLAY1, m_creature); break; - case 1: DoScriptText(SUFF_SAY_SLAY2, m_creature); break; - case 2: DoScriptText(SUFF_SAY_SLAY3, m_creature); break; + case 0: DoScriptText(SUFF_SAY_SLAY1, m_creature); break; + case 1: DoScriptText(SUFF_SAY_SLAY2, m_creature); break; + case 2: DoScriptText(SUFF_SAY_SLAY3, m_creature); break; } } @@ -407,7 +407,7 @@ struct TRINITY_DLL_DECL boss_essence_of_sufferingAI : public ScriptedAI FixateTimer = 5000; if(!(rand()%16)) { - DoScriptText(SUFF_SAY_AGGRO, m_creature); + DoScriptText(SUFF_SAY_AGGRO, m_creature); } }else FixateTimer -= diff; @@ -415,7 +415,7 @@ struct TRINITY_DLL_DECL boss_essence_of_sufferingAI : public ScriptedAI { DoCast(m_creature, SPELL_ENRAGE); EnrageTimer = 60000; - DoScriptText(SUFF_EMOTE_ENRAGE, m_creature); + DoScriptText(SUFF_EMOTE_ENRAGE, m_creature); }else EnrageTimer -= diff; if(SoulDrainTimer < diff) @@ -453,7 +453,7 @@ struct TRINITY_DLL_DECL boss_essence_of_desireAI : public ScriptedAI { damage = 0; m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - DoScriptText(SUFF_SAY_RECAP, m_creature); + DoScriptText(SUFF_SAY_RECAP, m_creature); } else { @@ -474,7 +474,7 @@ struct TRINITY_DLL_DECL boss_essence_of_desireAI : public ScriptedAI void Aggro(Unit *who) { - DoScriptText(DESI_SAY_FREED, m_creature); + DoScriptText(DESI_SAY_FREED, m_creature); DoZoneInCombat(); DoCast(m_creature, AURA_OF_DESIRE, true); } @@ -516,7 +516,7 @@ struct TRINITY_DLL_DECL boss_essence_of_desireAI : public ScriptedAI DeadenTimer = 25000 + rand()%10000; if(!(rand()%2)) { - DoScriptText(DESI_SAY_SPEC, m_creature); + DoScriptText(DESI_SAY_SPEC, m_creature); } }else DeadenTimer -= diff; @@ -553,11 +553,11 @@ struct TRINITY_DLL_DECL boss_essence_of_angerAI : public ScriptedAI void Aggro(Unit *who) { - switch(rand()%2) - { - case 0: DoScriptText(ANGER_SAY_FREED, m_creature); break; - case 1: DoScriptText(ANGER_SAY_FREED2, m_creature); break; - } + switch(rand()%2) + { + case 0: DoScriptText(ANGER_SAY_FREED, m_creature); break; + case 1: DoScriptText(ANGER_SAY_FREED2, m_creature); break; + } DoZoneInCombat(); DoCast(m_creature, AURA_OF_ANGER, true); @@ -565,7 +565,7 @@ struct TRINITY_DLL_DECL boss_essence_of_angerAI : public ScriptedAI void JustDied(Unit *victim) { - DoScriptText(ANGER_SAY_DEATH, m_creature); + DoScriptText(ANGER_SAY_DEATH, m_creature); } void KilledUnit(Unit *victim) @@ -593,7 +593,7 @@ struct TRINITY_DLL_DECL boss_essence_of_angerAI : public ScriptedAI { if(m_creature->getVictim()->GetGUID() != AggroTargetGUID) { - DoScriptText(ANGER_SAY_BEFORE, m_creature); + DoScriptText(ANGER_SAY_BEFORE, m_creature); DoCast(m_creature, SPELL_SELF_SEETHE, true); AggroTargetGUID = m_creature->getVictim()->GetGUID(); } @@ -606,7 +606,7 @@ struct TRINITY_DLL_DECL boss_essence_of_angerAI : public ScriptedAI SoulScreamTimer = 9000 + rand()%2000; if(!(rand()%3)) { - DoScriptText(ANGER_SAY_SPEC, m_creature); + DoScriptText(ANGER_SAY_SPEC, m_creature); } }else SoulScreamTimer -= diff; @@ -614,7 +614,7 @@ struct TRINITY_DLL_DECL boss_essence_of_angerAI : public ScriptedAI { DoCast(m_creature, SPELL_SPITE_TARGET); SpiteTimer = 30000; - DoScriptText(ANGER_SAY_SPEC, m_creature); + DoScriptText(ANGER_SAY_SPEC, m_creature); }else SpiteTimer -= diff; DoMeleeAttackIfReady(); diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp index 1e82ce4be1b..d2b2da6d866 100644 --- a/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp +++ b/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp @@ -189,7 +189,7 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI bool IsBanished; bool HasKilledAkama; bool reseting; - bool GridSearcherSucceeded; + bool GridSearcherSucceeded; void Reset() { @@ -257,17 +257,17 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI { Channeler->RemoveCorpse(); Channeler->Respawn(); - Channeler->InterruptNonMeleeSpells(true); - Channeler->RemoveAurasDueToSpell(SPELL_SHADE_SOUL_CHANNEL); + Channeler->InterruptNonMeleeSpells(true); + Channeler->RemoveAurasDueToSpell(SPELL_SHADE_SOUL_CHANNEL); } - if (Channeler->isAlive()) - { + if (Channeler->isAlive()) + { Channeler->CastSpell(m_creature, SPELL_SHADE_SOUL_CHANNEL, true); Channeler->CastSpell(m_creature, SPELL_SHADE_SOUL_CHANNEL_2, true); Channeler->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - GridSearcherSucceeded = true; - } + GridSearcherSucceeded = true; + } } } }else error_log("SD2 ERROR: No Channelers are stored in the list. This encounter will not work properly"); @@ -329,8 +329,8 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI { Spawn->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); Spawn->GetMotionMaster()->MovePoint(0, AGGRO_X, AGGRO_Y, AGGRO_Z); - Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1); - Spawn->AI()->AttackStart(target); + Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1); + Spawn->AI()->AttackStart(target); } } } diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp index 7b772cbeb26..e82c35fad36 100644 --- a/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp +++ b/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp @@ -152,11 +152,11 @@ struct TRINITY_DLL_DECL boss_supremusAI : public ScriptedAI return; if(!m_creature->HasAura(SPELL_BERSERK, 0)) - { + { if(BerserkTimer < diff) DoCast(m_creature, SPELL_BERSERK); else BerserkTimer -= diff; - } + } if(SummonFlameTimer < diff) { @@ -184,7 +184,7 @@ struct TRINITY_DLL_DECL boss_supremusAI : public ScriptedAI { DoResetThreat(); m_creature->AddThreat(target, 5000000.0f); - DoScriptText(EMOTE_NEW_TARGET, m_creature); + DoScriptText(EMOTE_NEW_TARGET, m_creature); SwitchTargetTimer = 10000; } }else SwitchTargetTimer -= diff; @@ -193,11 +193,11 @@ struct TRINITY_DLL_DECL boss_supremusAI : public ScriptedAI { if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0, 999, true)) { - if(!target) - target = m_creature->getVictim(); + if(!target) + target = m_creature->getVictim(); DoCast(target, SPELL_VOLCANIC_SUMMON); - DoScriptText(EMOTE_GROUND_CRACK, m_creature); + DoScriptText(EMOTE_GROUND_CRACK, m_creature); SummonVolcanoTimer = 10000; } }else SummonVolcanoTimer -= diff; @@ -306,7 +306,7 @@ void AddSC_boss_supremus() newscript->GetAI = &GetAI_molten_flame; newscript->RegisterSelf(); - newscript = new Script; + newscript = new Script; newscript->Name="npc_volcano"; newscript->GetAI = &GetAI_npc_volcano; newscript->RegisterSelf(); diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp index d691407b91c..35f17986e88 100644 --- a/src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp +++ b/src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp @@ -143,7 +143,7 @@ struct TRINITY_DLL_DECL mob_shadowy_constructAI : public ScriptedAI if(!who || (!who->isAlive()) || (who->GetGUID() == GhostGUID)) return; - ScriptedAI::MoveInLineOfSight(who); + ScriptedAI::MoveInLineOfSight(who); } /* Comment it out for now. NOTE TO FUTURE DEV: UNCOMMENT THIS OUT ONLY AFTER MIND CONTROL IS IMPLEMENTED @@ -265,7 +265,7 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI m_creature->GetMotionMaster()->Clear(false); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - DoScriptText(SAY_INTRO, m_creature); + DoScriptText(SAY_INTRO, m_creature); m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_TALK); AggroTargetGUID = who->GetGUID(); Intro = true; @@ -277,8 +277,8 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI { switch(rand()%2) { - case 0: DoScriptText(SAY_SLAY1, m_creature); break; - case 1: DoScriptText(SAY_SLAY2, m_creature); break; + case 0: DoScriptText(SAY_SLAY1, m_creature); break; + case 1: DoScriptText(SAY_SLAY2, m_creature); break; } } @@ -287,7 +287,7 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI if(pInstance) pInstance->SetData(DATA_TERONGOREFIENDEVENT, DONE); - DoScriptText(SAY_DEATH, m_creature); + DoScriptText(SAY_DEATH, m_creature); } float CalculateRandomLocation(float Loc, uint32 radius) @@ -375,7 +375,7 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI { m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - DoScriptText(SAY_AGGRO, m_creature); + DoScriptText(SAY_AGGRO, m_creature); m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); Intro = false; if(AggroTargetGUID) @@ -417,7 +417,7 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI if(SummonDoomBlossomTimer < diff) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) { float X = CalculateRandomLocation(target->GetPositionX(), 20); float Y = CalculateRandomLocation(target->GetPositionY(), 20); @@ -445,8 +445,8 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI { switch(rand()%2) { - case 0: DoScriptText(SAY_SPECIAL1, m_creature); break; - case 1: DoScriptText(SAY_SPECIAL2, m_creature); break; + case 0: DoScriptText(SAY_SPECIAL1, m_creature); break; + case 1: DoScriptText(SAY_SPECIAL2, m_creature); break; } DoCast(target, SPELL_INCINERATE); IncinerateTimer = 20000 + rand()%31 * 1000; @@ -482,20 +482,20 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI { switch(rand()%2) { - case 0: DoScriptText(SAY_SPELL1, m_creature); break; - case 1: DoScriptText(SAY_SPELL2, m_creature); break; + case 0: DoScriptText(SAY_SPELL1, m_creature); break; + case 1: DoScriptText(SAY_SPELL2, m_creature); break; } RandomYellTimer = 50000 + rand()%51 * 1000; }else RandomYellTimer -= diff; if(!m_creature->HasAura(SPELL_BERSERK, 0)) - { + { if(EnrageTimer < diff) { DoCast(m_creature, SPELL_BERSERK); - DoScriptText(SAY_ENRAGE, m_creature); + DoScriptText(SAY_ENRAGE, m_creature); }else EnrageTimer -= diff; - } + } DoMeleeAttackIfReady(); } diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_warlord_najentus.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_warlord_najentus.cpp index d04ce294b22..1b1099e7948 100644 --- a/src/bindings/scripts/scripts/zone/black_temple/boss_warlord_najentus.cpp +++ b/src/bindings/scripts/scripts/zone/black_temple/boss_warlord_najentus.cpp @@ -81,8 +81,8 @@ struct TRINITY_DLL_DECL boss_najentusAI : public ScriptedAI { switch(rand()%2) { - case 0: DoScriptText(SAY_SLAY1, m_creature); break; - case 1: DoScriptText(SAY_SLAY2, m_creature); break; + case 0: DoScriptText(SAY_SLAY1, m_creature); break; + case 1: DoScriptText(SAY_SLAY2, m_creature); break; } } @@ -91,7 +91,7 @@ struct TRINITY_DLL_DECL boss_najentusAI : public ScriptedAI if(pInstance) pInstance->SetData(DATA_HIGHWARLORDNAJENTUSEVENT, DONE); - DoScriptText(SAY_DEATH, m_creature); + DoScriptText(SAY_DEATH, m_creature); } void SpellHit(Unit *caster, const SpellEntry *spell) @@ -143,7 +143,7 @@ struct TRINITY_DLL_DECL boss_najentusAI : public ScriptedAI if(EnrageTimer < diff) { - DoScriptText(SAY_ENRAGE2, m_creature); + DoScriptText(SAY_ENRAGE2, m_creature); m_creature->CastSpell(m_creature, SPELL_BERSERK, true); EnrageTimer = 600000; }else EnrageTimer -= diff; @@ -162,8 +162,8 @@ struct TRINITY_DLL_DECL boss_najentusAI : public ScriptedAI { switch(rand()%2) { - case 0: DoScriptText(SAY_SPECIAL1, m_creature); break; - case 1: DoScriptText(SAY_SPECIAL2, m_creature); break; + case 0: DoScriptText(SAY_SPECIAL1, m_creature); break; + case 1: DoScriptText(SAY_SPECIAL2, m_creature); break; } SpecialYellTimer = 25000 + (rand()%76)*1000; }else SpecialYellTimer -= diff; @@ -181,8 +181,8 @@ struct TRINITY_DLL_DECL boss_najentusAI : public ScriptedAI switch(rand()%2) { - case 0: DoScriptText(SAY_NEEDLE1, m_creature); break; - case 1: DoScriptText(SAY_NEEDLE2, m_creature); break; + case 0: DoScriptText(SAY_NEEDLE1, m_creature); break; + case 1: DoScriptText(SAY_NEEDLE2, m_creature); break; } ImpalingSpineTimer = 21000; } diff --git a/src/bindings/scripts/scripts/zone/black_temple/illidari_council.cpp b/src/bindings/scripts/scripts/zone/black_temple/illidari_council.cpp index 18acc17322c..eecdd70dc30 100644 --- a/src/bindings/scripts/scripts/zone/black_temple/illidari_council.cpp +++ b/src/bindings/scripts/scripts/zone/black_temple/illidari_council.cpp @@ -53,25 +53,25 @@ EndScriptData */ struct CouncilYells { - int32 entry; - uint32 timer; + int32 entry; + uint32 timer; }; static CouncilYells CouncilAggro[]= { - {-1564069, 5000}, // Gathios - {-1564070, 5500}, // Veras - {-1564071, 5000}, // Malande - {-1564072, 0}, // Zerevor + {-1564069, 5000}, // Gathios + {-1564070, 5500}, // Veras + {-1564071, 5000}, // Malande + {-1564072, 0}, // Zerevor }; // Need to get proper timers for this later static CouncilYells CouncilEnrage[]= { - {-1564073, 2000}, // Gathios - {-1564074, 6000}, // Veras - {-1564075, 5000}, // Malande - {-1564076, 0}, // Zerevor + {-1564073, 2000}, // Gathios + {-1564074, 6000}, // Veras + {-1564075, 5000}, // Malande + {-1564076, 0}, // Zerevor }; // High Nethermancer Zerevor's spells @@ -159,33 +159,33 @@ struct TRINITY_DLL_DECL mob_blood_elf_council_voice_triggerAI : public ScriptedA return; if(AggroYellTimer) - { + { if(AggroYellTimer <= diff) { if(Unit* pMember = Unit::GetUnit(*m_creature, Council[YellCounter])) { - DoScriptText(CouncilAggro[YellCounter].entry, pMember); + DoScriptText(CouncilAggro[YellCounter].entry, pMember); AggroYellTimer = CouncilAggro[YellCounter].timer; } ++YellCounter; if(YellCounter > 3) YellCounter = 0; // Reuse for Enrage Yells }else AggroYellTimer -= diff; - } + } if(EnrageTimer) - { + { if(EnrageTimer <= diff) { if(Unit* pMember = Unit::GetUnit(*m_creature, Council[YellCounter])) { pMember->CastSpell(pMember, SPELL_BERSERK, true); - DoScriptText(CouncilEnrage[YellCounter].entry, pMember); + DoScriptText(CouncilEnrage[YellCounter].entry, pMember); EnrageTimer = CouncilEnrage[YellCounter].timer; } ++YellCounter; }else EnrageTimer -= diff; - } + } } }; @@ -451,12 +451,12 @@ struct TRINITY_DLL_DECL boss_gathios_the_shattererAI : public boss_illidari_coun void KilledUnit(Unit *victim) { - DoScriptText(SAY_GATH_SLAY, m_creature); + DoScriptText(SAY_GATH_SLAY, m_creature); } void JustDied(Unit *victim) { - DoScriptText(SAY_GATH_DEATH, m_creature); + DoScriptText(SAY_GATH_DEATH, m_creature); } Unit* SelectCouncilMember() @@ -568,12 +568,12 @@ struct TRINITY_DLL_DECL boss_high_nethermancer_zerevorAI : public boss_illidari_ void KilledUnit(Unit *victim) { - DoScriptText(SAY_ZERE_SLAY, m_creature); + DoScriptText(SAY_ZERE_SLAY, m_creature); } void JustDied(Unit *victim) { - DoScriptText(SAY_ZERE_DEATH, m_creature); + DoScriptText(SAY_ZERE_DEATH, m_creature); } void UpdateAI(const uint32 diff) @@ -656,12 +656,12 @@ struct TRINITY_DLL_DECL boss_lady_malandeAI : public boss_illidari_councilAI void KilledUnit(Unit *victim) { - DoScriptText(SAY_MALA_SLAY, m_creature); + DoScriptText(SAY_MALA_SLAY, m_creature); } void JustDied(Unit *victim) { - DoScriptText(SAY_MALA_DEATH, m_creature); + DoScriptText(SAY_MALA_DEATH, m_creature); } void UpdateAI(const uint32 diff) @@ -730,12 +730,12 @@ struct TRINITY_DLL_DECL boss_veras_darkshadowAI : public boss_illidari_councilAI void KilledUnit(Unit *victim) { - DoScriptText(SAY_VERA_SLAY, m_creature); + DoScriptText(SAY_VERA_SLAY, m_creature); } void JustDied(Unit *victim) { - DoScriptText(SAY_VERA_DEATH, m_creature); + DoScriptText(SAY_VERA_DEATH, m_creature); } void UpdateAI(const uint32 diff) diff --git a/src/bindings/scripts/scripts/zone/black_temple/instance_black_temple.cpp b/src/bindings/scripts/scripts/zone/black_temple/instance_black_temple.cpp index 564958924b2..23f36badb62 100644 --- a/src/bindings/scripts/scripts/zone/black_temple/instance_black_temple.cpp +++ b/src/bindings/scripts/scripts/zone/black_temple/instance_black_temple.cpp @@ -113,35 +113,35 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance } Player* GetPlayerInMap() - { - Map::PlayerList const& players = instance->GetPlayers(); + { + Map::PlayerList const& players = instance->GetPlayers(); - if (!players.isEmpty()) - { - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - if (Player* plr = itr->getSource()) - return plr; - } - } + if (!players.isEmpty()) + { + for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* plr = itr->getSource()) + return plr; + } + } - debug_log("TSCR: Instance Black Temple: GetPlayerInMap, but PlayerList is empty!"); - return NULL; - } + debug_log("TSCR: Instance Black Temple: GetPlayerInMap, but PlayerList is empty!"); + return NULL; + } - void HandleGameObject(uint64 guid, uint32 state) - { - Player *player = GetPlayerInMap(); + void HandleGameObject(uint64 guid, uint32 state) + { + Player *player = GetPlayerInMap(); - if (!player || !guid) - { - debug_log("TSCR: Black Temple: HandleGameObject fail"); - return; - } + if (!player || !guid) + { + debug_log("TSCR: Black Temple: HandleGameObject fail"); + return; + } - if (GameObject *go = GameObject::GetGameObject(*player,guid)) - go->SetGoState(state); - } + if (GameObject *go = GameObject::GetGameObject(*player,guid)) + go->SetGoState(state); + } void OnCreatureCreate(Creature *creature, uint32 creature_entry) { @@ -274,20 +274,20 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance } if (data == DONE) - { + { OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << Encounters[0] << " " << Encounters[1] << " " - << Encounters[2] << " " << Encounters[3] << " " << Encounters[4] + std::ostringstream saveStream; + saveStream << Encounters[0] << " " << Encounters[1] << " " + << Encounters[2] << " " << Encounters[3] << " " << Encounters[4] << " " << Encounters[5] << " " << Encounters[6] << " " << Encounters[7] << " " << Encounters[8]; - str_data = saveStream.str(); + str_data = saveStream.str(); - SaveToDB(); - OUT_SAVE_INST_DATA_COMPLETE; - } + SaveToDB(); + OUT_SAVE_INST_DATA_COMPLETE; + } } uint32 GetData(uint32 type) @@ -309,31 +309,31 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance } const char* Save() - { - return str_data.c_str(); - } + { + return str_data.c_str(); + } - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - std::istringstream loadStream(in); - loadStream >> Encounters[0] >> Encounters[1] >> Encounters[2] + std::istringstream loadStream(in); + loadStream >> Encounters[0] >> Encounters[1] >> Encounters[2] >> Encounters[3] >> Encounters[4] >> Encounters[5] >> Encounters[6] >> Encounters[7] >> Encounters[8]; - for(uint8 i = 0; i < ENCOUNTERS; ++i) - if (Encounters[i] == IN_PROGRESS) - Encounters[i] = NOT_STARTED; + for(uint8 i = 0; i < ENCOUNTERS; ++i) + if (Encounters[i] == IN_PROGRESS) + Encounters[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; - } + OUT_LOAD_INST_DATA_COMPLETE; + } }; InstanceData* GetInstanceData_instance_black_temple(Map* map) diff --git a/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp b/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp index 75818bca575..44b668f7aca 100644 --- a/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp +++ b/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp @@ -1,5 +1,6 @@ /* Copyright (C) 2006 - 2008 ScriptDev2 * This program 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. @@ -46,49 +47,49 @@ EndContentData */ uint32 RingMob[]= { - 8925, // Dredge Worm - 8926, // Deep Stinger - 8927, // Dark Screecher - 8928, // Burrowing Thundersnout - 8933, // Cave Creeper - 8932, // Borer Beetle + 8925, // Dredge Worm + 8926, // Deep Stinger + 8927, // Dark Screecher + 8928, // Burrowing Thundersnout + 8933, // Cave Creeper + 8932, // Borer Beetle }; uint32 RingBoss[]= { - 9027, // Gorosh - 9028, // Grizzle - 9029, // Eviscerator - 9030, // Ok'thor - 9031, // Anub'shiah - 9032, // Hedrum + 9027, // Gorosh + 9028, // Grizzle + 9029, // Eviscerator + 9030, // Ok'thor + 9031, // Anub'shiah + 9032, // Hedrum }; float RingLocations[6][3]= { - {604.802673, -191.081985, -54.058590}, // ring - {604.072998, -222.106918, -52.743759}, // first gate - {621.400391, -214.499054, -52.814453}, // hiding in corner - {601.300781, -198.556992, -53.950256}, // ring - {631.818359, -180.548126, -52.654770}, // second gate - {627.390381, -201.075974, -52.692917} // hiding in corner + {604.802673, -191.081985, -54.058590}, // ring + {604.072998, -222.106918, -52.743759}, // first gate + {621.400391, -214.499054, -52.814453}, // hiding in corner + {601.300781, -198.556992, -53.950256}, // ring + {631.818359, -180.548126, -52.654770}, // second gate + {627.390381, -201.075974, -52.692917} // hiding in corner }; bool AreaTrigger_at_ring_of_law(Player *player, AreaTriggerEntry *at) { - ScriptedInstance* pInstance = ((ScriptedInstance*)player->GetInstanceData()); + ScriptedInstance* pInstance = ((ScriptedInstance*)player->GetInstanceData()); - if (pInstance) - { - if (pInstance->GetData(TYPE_RING_OF_LAW) == IN_PROGRESS || pInstance->GetData(TYPE_RING_OF_LAW) == DONE) - return false; + if (pInstance) + { + if (pInstance->GetData(TYPE_RING_OF_LAW) == IN_PROGRESS || pInstance->GetData(TYPE_RING_OF_LAW) == DONE) + return false; - pInstance->SetData(TYPE_RING_OF_LAW,IN_PROGRESS); - player->SummonCreature(C_GRIMSTONE,625.559,-205.618,-52.735,2.609,TEMPSUMMON_DEAD_DESPAWN,0); + pInstance->SetData(TYPE_RING_OF_LAW,IN_PROGRESS); + player->SummonCreature(C_GRIMSTONE,625.559,-205.618,-52.735,2.609,TEMPSUMMON_DEAD_DESPAWN,0); - return false; - } - return false; + return false; + } + return false; } /*###### @@ -98,235 +99,235 @@ bool AreaTrigger_at_ring_of_law(Player *player, AreaTriggerEntry *at) //TODO: implement quest part of event (different end boss) struct TRINITY_DLL_DECL npc_grimstoneAI : public npc_escortAI { - npc_grimstoneAI(Creature *c) : npc_escortAI(c) - { - pInstance = ((ScriptedInstance*)c->GetInstanceData()); - MobSpawnId = rand()%6; - Reset(); - } + npc_grimstoneAI(Creature *c) : npc_escortAI(c) + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + MobSpawnId = rand()%6; + Reset(); + } - ScriptedInstance* pInstance; + ScriptedInstance* pInstance; - uint8 EventPhase; - uint32 Event_Timer; + uint8 EventPhase; + uint32 Event_Timer; - uint8 MobSpawnId; - uint8 MobCount; - uint32 MobDeath_Timer; + uint8 MobSpawnId; + uint8 MobCount; + uint32 MobDeath_Timer; - uint64 RingMobGUID[4]; - uint64 RingBossGUID; + uint64 RingMobGUID[4]; + uint64 RingBossGUID; - bool CanWalk; + bool CanWalk; - void Reset() - { - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + void Reset() + { + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - EventPhase = 0; - Event_Timer = 1000; + EventPhase = 0; + Event_Timer = 1000; - MobCount = 0; - MobDeath_Timer = 0; + MobCount = 0; + MobDeath_Timer = 0; - for(uint8 i = 0; i < MOB_AMOUNT; i++) - RingMobGUID[i] = 0; + for(uint8 i = 0; i < MOB_AMOUNT; i++) + RingMobGUID[i] = 0; - RingBossGUID = 0; + RingBossGUID = 0; - CanWalk = false; - } + CanWalk = false; + } - void Aggro(Unit *who) { } + void Aggro(Unit *who) { } - void DoGate(uint32 id, uint32 state) - { - if (GameObject *go = GameObject::GetGameObject(*m_creature,pInstance->GetData64(id))) - go->SetGoState(state); + void DoGate(uint32 id, uint32 state) + { + if (GameObject *go = GameObject::GetGameObject(*m_creature,pInstance->GetData64(id))) + go->SetGoState(state); - debug_log("SD2: npc_grimstone, arena gate update state."); - } + debug_log("SD2: npc_grimstone, arena gate update state."); + } - //TODO: move them to center - void SummonRingMob() - { - if (Creature* tmp = m_creature->SummonCreature(RingMob[MobSpawnId],608.960,-235.322,-53.907,1.857,TEMPSUMMON_DEAD_DESPAWN,0)) - RingMobGUID[MobCount] = tmp->GetGUID(); + //TODO: move them to center + void SummonRingMob() + { + if (Creature* tmp = m_creature->SummonCreature(RingMob[MobSpawnId],608.960,-235.322,-53.907,1.857,TEMPSUMMON_DEAD_DESPAWN,0)) + RingMobGUID[MobCount] = tmp->GetGUID(); - ++MobCount; + ++MobCount; - if (MobCount == MOB_AMOUNT) - MobDeath_Timer = 2500; - } + if (MobCount == MOB_AMOUNT) + MobDeath_Timer = 2500; + } - //TODO: move them to center - void SummonRingBoss() - { - if (Creature* tmp = m_creature->SummonCreature(RingBoss[rand()%6],644.300,-175.989,-53.739,3.418,TEMPSUMMON_DEAD_DESPAWN,0)) - RingBossGUID = tmp->GetGUID(); + //TODO: move them to center + void SummonRingBoss() + { + if (Creature* tmp = m_creature->SummonCreature(RingBoss[rand()%6],644.300,-175.989,-53.739,3.418,TEMPSUMMON_DEAD_DESPAWN,0)) + RingBossGUID = tmp->GetGUID(); - MobDeath_Timer = 2500; - } + MobDeath_Timer = 2500; + } - void WaypointReached(uint32 i) - { - switch(i) - { - case 0: - DoScriptText(-1000000, m_creature);//2 - CanWalk = false; - Event_Timer = 5000; - break; - case 1: - DoScriptText(-1000000, m_creature);//4 - CanWalk = false; - Event_Timer = 5000; - break; - case 2: - CanWalk = false; - break; - case 3: - DoScriptText(-1000000, m_creature);//5 - break; - case 4: - DoScriptText(-1000000, m_creature);//6 - CanWalk = false; - Event_Timer = 5000; - break; - case 5: - if (pInstance) - { - pInstance->SetData(TYPE_RING_OF_LAW,DONE); - debug_log("SD2: npc_grimstone: event reached end and set complete."); - } - break; - } - } + void WaypointReached(uint32 i) + { + switch(i) + { + case 0: + DoScriptText(-1000000, m_creature);//2 + CanWalk = false; + Event_Timer = 5000; + break; + case 1: + DoScriptText(-1000000, m_creature);//4 + CanWalk = false; + Event_Timer = 5000; + break; + case 2: + CanWalk = false; + break; + case 3: + DoScriptText(-1000000, m_creature);//5 + break; + case 4: + DoScriptText(-1000000, m_creature);//6 + CanWalk = false; + Event_Timer = 5000; + break; + case 5: + if (pInstance) + { + pInstance->SetData(TYPE_RING_OF_LAW,DONE); + debug_log("SD2: npc_grimstone: event reached end and set complete."); + } + break; + } + } - void UpdateAI(const uint32 diff) - { - if (!pInstance) - return; + void UpdateAI(const uint32 diff) + { + if (!pInstance) + return; - if (MobDeath_Timer) - { - if (MobDeath_Timer <= diff) - { - MobDeath_Timer = 2500; + if (MobDeath_Timer) + { + if (MobDeath_Timer <= diff) + { + MobDeath_Timer = 2500; - if (RingBossGUID) - { - Creature *boss = (Creature*)Unit::GetUnit(*m_creature,RingBossGUID); - if (boss && !boss->isAlive() && boss->isDead()) - { - RingBossGUID = 0; - Event_Timer = 5000; - MobDeath_Timer = 0; - return; - } - return; - } + if (RingBossGUID) + { + Creature *boss = (Creature*)Unit::GetUnit(*m_creature,RingBossGUID); + if (boss && !boss->isAlive() && boss->isDead()) + { + RingBossGUID = 0; + Event_Timer = 5000; + MobDeath_Timer = 0; + return; + } + return; + } - for(uint8 i = 0; i < MOB_AMOUNT; i++) - { - Creature *mob = (Creature*)Unit::GetUnit(*m_creature,RingMobGUID[i]); - if (mob && !mob->isAlive() && mob->isDead()) - { - RingMobGUID[i] = 0; - --MobCount; + for(uint8 i = 0; i < MOB_AMOUNT; i++) + { + Creature *mob = (Creature*)Unit::GetUnit(*m_creature,RingMobGUID[i]); + if (mob && !mob->isAlive() && mob->isDead()) + { + RingMobGUID[i] = 0; + --MobCount; - //seems all are gone, so set timer to continue and discontinue this - if (!MobCount) - { - Event_Timer = 5000; - MobDeath_Timer = 0; - } - } - } - }else MobDeath_Timer -= diff; - } + //seems all are gone, so set timer to continue and discontinue this + if (!MobCount) + { + Event_Timer = 5000; + MobDeath_Timer = 0; + } + } + } + }else MobDeath_Timer -= diff; + } - if (Event_Timer) - { - if (Event_Timer <= diff) - { - switch(EventPhase) - { - case 0: - DoScriptText(-1000000, m_creature);//1 - DoGate(DATA_ARENA4,1); - Start(false, false, false); - CanWalk = true; - Event_Timer = 0; - break; - case 1: - CanWalk = true; - Event_Timer = 0; - break; - case 2: - Event_Timer = 2000; - break; - case 3: - DoGate(DATA_ARENA1,0); - Event_Timer = 3000; - break; - case 4: - CanWalk = true; - m_creature->SetVisibility(VISIBILITY_OFF); - SummonRingMob(); - Event_Timer = 8000; - break; - case 5: - SummonRingMob(); - SummonRingMob(); - Event_Timer = 8000; - break; - case 6: - SummonRingMob(); - Event_Timer = 0; - break; - case 7: - m_creature->SetVisibility(VISIBILITY_ON); - DoGate(DATA_ARENA1,1); - DoScriptText(-1000000, m_creature);//4 - CanWalk = true; - Event_Timer = 0; - break; - case 8: - DoGate(DATA_ARENA2,0); - Event_Timer = 5000; - break; - case 9: - m_creature->SetVisibility(VISIBILITY_OFF); - SummonRingBoss(); - Event_Timer = 0; - break; - case 10: - //if quest, complete - DoGate(DATA_ARENA2,1); - DoGate(DATA_ARENA3,0); - DoGate(DATA_ARENA4,0); - CanWalk = true; - Event_Timer = 0; - break; - } - ++EventPhase; - }else Event_Timer -= diff; - } + if (Event_Timer) + { + if (Event_Timer <= diff) + { + switch(EventPhase) + { + case 0: + DoScriptText(-1000000, m_creature);//1 + DoGate(DATA_ARENA4,1); + Start(false, false, false); + CanWalk = true; + Event_Timer = 0; + break; + case 1: + CanWalk = true; + Event_Timer = 0; + break; + case 2: + Event_Timer = 2000; + break; + case 3: + DoGate(DATA_ARENA1,0); + Event_Timer = 3000; + break; + case 4: + CanWalk = true; + m_creature->SetVisibility(VISIBILITY_OFF); + SummonRingMob(); + Event_Timer = 8000; + break; + case 5: + SummonRingMob(); + SummonRingMob(); + Event_Timer = 8000; + break; + case 6: + SummonRingMob(); + Event_Timer = 0; + break; + case 7: + m_creature->SetVisibility(VISIBILITY_ON); + DoGate(DATA_ARENA1,1); + DoScriptText(-1000000, m_creature);//4 + CanWalk = true; + Event_Timer = 0; + break; + case 8: + DoGate(DATA_ARENA2,0); + Event_Timer = 5000; + break; + case 9: + m_creature->SetVisibility(VISIBILITY_OFF); + SummonRingBoss(); + Event_Timer = 0; + break; + case 10: + //if quest, complete + DoGate(DATA_ARENA2,1); + DoGate(DATA_ARENA3,0); + DoGate(DATA_ARENA4,0); + CanWalk = true; + Event_Timer = 0; + break; + } + ++EventPhase; + }else Event_Timer -= diff; + } - if (CanWalk) - npc_escortAI::UpdateAI(diff); - } + if (CanWalk) + npc_escortAI::UpdateAI(diff); + } }; CreatureAI* GetAI_npc_grimstone(Creature *_Creature) { - npc_grimstoneAI* Grimstone_AI = new npc_grimstoneAI(_Creature); + npc_grimstoneAI* Grimstone_AI = new npc_grimstoneAI(_Creature); - for(uint8 i = 0; i < 6; ++i) - Grimstone_AI->AddWaypoint(i, RingLocations[i][0], RingLocations[i][1], RingLocations[i][2]); + for(uint8 i = 0; i < 6; ++i) + Grimstone_AI->AddWaypoint(i, RingLocations[i][0], RingLocations[i][1], RingLocations[i][2]); - return (CreatureAI*)Grimstone_AI; + return (CreatureAI*)Grimstone_AI; } @@ -425,10 +426,10 @@ bool GossipHello_npc_kharan_mighthammer(Player *player, Creature *_Creature) if( player->GetQuestStatus(4342) == QUEST_STATUS_INCOMPLETE ) player->ADD_GOSSIP_ITEM( 0, GOSSIP_ITEM_KHARAN_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - if (player->GetTeam() == HORDE) - player->SEND_GOSSIP_MENU(2473, _Creature->GetGUID()); - else - player->SEND_GOSSIP_MENU(2474, _Creature->GetGUID()); + if (player->GetTeam() == HORDE) + player->SEND_GOSSIP_MENU(2473, _Creature->GetGUID()); + else + player->SEND_GOSSIP_MENU(2474, _Creature->GetGUID()); return true; } @@ -473,9 +474,9 @@ bool GossipSelect_npc_kharan_mighthammer(Player *player, Creature *_Creature, ui case GOSSIP_ACTION_INFO_DEF+9: player->CLOSE_GOSSIP_MENU(); if (player->GetTeam() == HORDE) - player->AreaExploredOrEventHappens(QUEST_4001); - else - player->AreaExploredOrEventHappens(QUEST_4342); + player->AreaExploredOrEventHappens(QUEST_4001); + else + player->AreaExploredOrEventHappens(QUEST_4342); break; } return true; @@ -524,7 +525,7 @@ bool GossipSelect_npc_lokhtos_darkbargainer(Player *player, Creature *_Creature, player->CastSpell(player, SPELL_CREATE_THORIUM_BROTHERHOOD_CONTRACT_DND, false); } if (action == GOSSIP_ACTION_TRADE) - player->SEND_VENDORLIST( _Creature->GetGUID() ); + player->SEND_VENDORLIST( _Creature->GetGUID() ); return true; } @@ -533,9 +534,9 @@ bool GossipSelect_npc_lokhtos_darkbargainer(Player *player, Creature *_Creature, ## npc_dughal_stormwing ######*/ -#define QUEST_JAIL_BREAK 4322 -#define SAY_DUGHAL_FREE "Thank you, $N! I'm free!!!" -#define GOSSIP_DUGHAL "You're free, Dughal! Get out of here!" +#define QUEST_JAIL_BREAK 4322 +#define SAY_DUGHAL_FREE "Thank you, $N! I'm free!!!" +#define GOSSIP_DUGHAL "You're free, Dughal! Get out of here!" ScriptedInstance *pInstance; /* @@ -545,49 +546,49 @@ struct TRINITY_DLL_DECL npc_dughal_stormwingAI : public npc_escortAI void WaypointReached(uint32 i) { - switch(i) - { - case 0:m_creature->Say(SAY_DUGHAL_FREE, LANG_UNIVERSAL, PlayerGUID); break; - case 1:pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_OBJECTIVE_COMPLETED);break; - case 2: - m_creature->SetVisibility(VISIBILITY_OFF); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_ENDED); - break; - } - } + switch(i) + { + case 0:m_creature->Say(SAY_DUGHAL_FREE, LANG_UNIVERSAL, PlayerGUID); break; + case 1:pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_OBJECTIVE_COMPLETED);break; + case 2: + m_creature->SetVisibility(VISIBILITY_OFF); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_ENDED); + break; + } + } void Aggro(Unit* who) { } - void Reset() {} + void Reset() {} void JustDied(Unit* killer) { if (IsBeingEscorted && killer == m_creature) { - m_creature->SetVisibility(VISIBILITY_OFF); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_ENDED); + m_creature->SetVisibility(VISIBILITY_OFF); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_ENDED); } } void UpdateAI(const uint32 diff) { - if(pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; - if( (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_ENDED ) - { - m_creature->SetVisibility(VISIBILITY_OFF); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - else - { - m_creature->SetVisibility(VISIBILITY_ON); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - npc_escortAI::UpdateAI(diff); + if(pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; + if( (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_ENDED ) + { + m_creature->SetVisibility(VISIBILITY_OFF); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + else + { + m_creature->SetVisibility(VISIBILITY_ON); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + npc_escortAI::UpdateAI(diff); } }; CreatureAI* GetAI_npc_dughal_stormwing(Creature *_Creature) @@ -602,10 +603,10 @@ CreatureAI* GetAI_npc_dughal_stormwing(Creature *_Creature) } bool GossipHello_npc_dughal_stormwing(Player *player, Creature *_Creature) { - if(player->GetQuestStatus(QUEST_JAIL_BREAK) == QUEST_STATUS_INCOMPLETE && pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS ) + if(player->GetQuestStatus(QUEST_JAIL_BREAK) == QUEST_STATUS_INCOMPLETE && pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS ) { player->ADD_GOSSIP_ITEM(0, GOSSIP_DUGHAL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->SEND_GOSSIP_MENU(2846, _Creature->GetGUID()); + player->SEND_GOSSIP_MENU(2846, _Creature->GetGUID()); } return true; } @@ -616,8 +617,8 @@ bool GossipSelect_npc_dughal_stormwing(Player *player, Creature *_Creature, uint { player->CLOSE_GOSSIP_MENU(); ((npc_escortAI*)(_Creature->AI()))->Start(false, false, true, player->GetGUID()); - _Creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_IN_PROGRESS); + _Creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_IN_PROGRESS); } return true; } @@ -626,117 +627,117 @@ bool GossipSelect_npc_dughal_stormwing(Player *player, Creature *_Creature, uint ## npc_marshal_windsor ######*/ -#define SAY_WINDSOR_AGGRO1 "You locked up the wrong Marshal. Prepare to be destroyed!" -#define SAY_WINDSOR_AGGRO2 "I bet you're sorry now, aren't you !?!!" -#define SAY_WINDSOR_AGGRO3 "You better hold me back $N or they are going to feel some prison house beatings." -#define SAY_WINDSOR_1 "Let's get a move on. My gear should be in the storage area up this way..." -#define SAY_WINDSOR_4_1 "Check that cell, $N. If someone is alive in there, we need to get them out." -#define SAY_WINDSOR_4_2 "Get him out of there!" -#define SAY_WINDSOR_4_3 "Good work! We're almost there, $N. This way." -#define SAY_WINDSOR_6 "This is it, $N. My stuff should be in that room. Cover me, I'm going in!" -#define SAY_WINDSOR_9 "Ah, there it is!" -#define MOB_ENTRY_REGINALD_WINDSOR 9682 +#define SAY_WINDSOR_AGGRO1 "You locked up the wrong Marshal. Prepare to be destroyed!" +#define SAY_WINDSOR_AGGRO2 "I bet you're sorry now, aren't you !?!!" +#define SAY_WINDSOR_AGGRO3 "You better hold me back $N or they are going to feel some prison house beatings." +#define SAY_WINDSOR_1 "Let's get a move on. My gear should be in the storage area up this way..." +#define SAY_WINDSOR_4_1 "Check that cell, $N. If someone is alive in there, we need to get them out." +#define SAY_WINDSOR_4_2 "Get him out of there!" +#define SAY_WINDSOR_4_3 "Good work! We're almost there, $N. This way." +#define SAY_WINDSOR_6 "This is it, $N. My stuff should be in that room. Cover me, I'm going in!" +#define SAY_WINDSOR_9 "Ah, there it is!" +#define MOB_ENTRY_REGINALD_WINDSOR 9682 Player* PlayerStart; /* struct TRINITY_DLL_DECL npc_marshal_windsorAI : public npc_escortAI { - npc_marshal_windsorAI(Creature *c) : npc_escortAI(c) - { - pInstance = ((ScriptedInstance*)c->GetInstanceData()); - Reset(); - } - - void WaypointReached(uint32 i) + npc_marshal_windsorAI(Creature *c) : npc_escortAI(c) { - switch( i ) + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + Reset(); + } + + void WaypointReached(uint32 i) + { + switch( i ) { - case 1: - m_creature->Say(SAY_WINDSOR_1, LANG_UNIVERSAL, PlayerGUID); - break; - case 7: - m_creature->HandleEmoteCommand(EMOTE_STATE_POINT); - m_creature->Say(SAY_WINDSOR_4_1, LANG_UNIVERSAL, PlayerGUID); - IsOnHold=true; - break; - case 10: - m_creature->setFaction(534); - break; - case 12: - m_creature->Say(SAY_WINDSOR_6, LANG_UNIVERSAL, PlayerGUID); - pInstance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_IN_PROGRESS); - break; - case 13: - m_creature->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK - break; - case 14: - pInstance->SetData(DATA_GATE_SR,0); - m_creature->setFaction(11); - break; - case 16: - m_creature->Say(SAY_WINDSOR_9, LANG_UNIVERSAL, PlayerGUID); - break; - case 17: - m_creature->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK - break; - case 18: - pInstance->SetData(DATA_GATE_SC,0); - break; - case 19: - m_creature->SetVisibility(VISIBILITY_OFF); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - m_creature->SummonCreature(MOB_ENTRY_REGINALD_WINDSOR,403.61,-51.71,-63.92,3.600434,TEMPSUMMON_DEAD_DESPAWN ,0); - pInstance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_ENDED); - break; - } - } + case 1: + m_creature->Say(SAY_WINDSOR_1, LANG_UNIVERSAL, PlayerGUID); + break; + case 7: + m_creature->HandleEmoteCommand(EMOTE_STATE_POINT); + m_creature->Say(SAY_WINDSOR_4_1, LANG_UNIVERSAL, PlayerGUID); + IsOnHold=true; + break; + case 10: + m_creature->setFaction(534); + break; + case 12: + m_creature->Say(SAY_WINDSOR_6, LANG_UNIVERSAL, PlayerGUID); + pInstance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_IN_PROGRESS); + break; + case 13: + m_creature->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK + break; + case 14: + pInstance->SetData(DATA_GATE_SR,0); + m_creature->setFaction(11); + break; + case 16: + m_creature->Say(SAY_WINDSOR_9, LANG_UNIVERSAL, PlayerGUID); + break; + case 17: + m_creature->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK + break; + case 18: + pInstance->SetData(DATA_GATE_SC,0); + break; + case 19: + m_creature->SetVisibility(VISIBILITY_OFF); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + m_creature->SummonCreature(MOB_ENTRY_REGINALD_WINDSOR,403.61,-51.71,-63.92,3.600434,TEMPSUMMON_DEAD_DESPAWN ,0); + pInstance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_ENDED); + break; + } + } void Aggro(Unit* who) - { - switch(rand()%3) - { - case 0:m_creature->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, PlayerGUID);break; - case 1:m_creature->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, PlayerGUID);break; - case 2:m_creature->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID);break; - } - } + { + switch(rand()%3) + { + case 0:m_creature->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, PlayerGUID);break; + case 1:m_creature->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, PlayerGUID);break; + case 2:m_creature->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID);break; + } + } void Reset() {} - void JustDied(Unit *slayer) + void JustDied(Unit *slayer) { - pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_FAILED); + pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_FAILED); } void UpdateAI(const uint32 diff) { - if(pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; - if(pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED) - IsOnHold = false; - if(!pInstance->GetData(DATA_GATE_D) && pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_NOT_STARTED ) - { - m_creature->Say(SAY_WINDSOR_4_2, LANG_UNIVERSAL, PlayerGUID); - pInstance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_BEFORE_START); - } - if( pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED ) - { - m_creature->Say(SAY_WINDSOR_4_3, LANG_UNIVERSAL, PlayerGUID); - pInstance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_ENDED); - } - if( (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_SUPPLY_ROOM) == ENCOUNTER_STATE_ENDED ) - { - m_creature->SetVisibility(VISIBILITY_OFF); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - else - { - m_creature->SetVisibility(VISIBILITY_ON); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - npc_escortAI::UpdateAI(diff); + if(pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; + if(pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED) + IsOnHold = false; + if(!pInstance->GetData(DATA_GATE_D) && pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_NOT_STARTED ) + { + m_creature->Say(SAY_WINDSOR_4_2, LANG_UNIVERSAL, PlayerGUID); + pInstance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_BEFORE_START); + } + if( pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED ) + { + m_creature->Say(SAY_WINDSOR_4_3, LANG_UNIVERSAL, PlayerGUID); + pInstance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_ENDED); + } + if( (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_SUPPLY_ROOM) == ENCOUNTER_STATE_ENDED ) + { + m_creature->SetVisibility(VISIBILITY_OFF); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + else + { + m_creature->SetVisibility(VISIBILITY_ON); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + npc_escortAI::UpdateAI(diff); } }; CreatureAI* GetAI_npc_marshal_windsor(Creature *_Creature) @@ -745,7 +746,7 @@ CreatureAI* GetAI_npc_marshal_windsor(Creature *_Creature) marshal_windsorAI->AddWaypoint(0, 316.336,-225.528, -77.7258,7000); marshal_windsorAI->AddWaypoint(1, 316.336,-225.528, -77.7258,2000); - marshal_windsorAI->AddWaypoint(2, 322.96,-207.13, -77.87,0); + marshal_windsorAI->AddWaypoint(2, 322.96,-207.13, -77.87,0); marshal_windsorAI->AddWaypoint(3, 281.05,-172.16, -75.12,0); marshal_windsorAI->AddWaypoint(4, 272.19,-139.14, -70.61,0); marshal_windsorAI->AddWaypoint(5, 283.62,-116.09, -70.21,0); @@ -758,7 +759,7 @@ CreatureAI* GetAI_npc_marshal_windsor(Creature *_Creature) marshal_windsorAI->AddWaypoint(12, 400.98,-72.01, -62.31,0); marshal_windsorAI->AddWaypoint(13, 404.22,-62.30, -63.50,2300); marshal_windsorAI->AddWaypoint(14, 404.22,-62.30, -63.50,1500); - marshal_windsorAI->AddWaypoint(154, 407.65,-51.86, -63.96,0); + marshal_windsorAI->AddWaypoint(154, 407.65,-51.86, -63.96,0); marshal_windsorAI->AddWaypoint(16, 403.61,-51.71, -63.92,1000); marshal_windsorAI->AddWaypoint(17, 403.61,-51.71, -63.92,2000); marshal_windsorAI->AddWaypoint(18, 403.61,-51.71, -63.92,1000); @@ -770,15 +771,15 @@ CreatureAI* GetAI_npc_marshal_windsor(Creature *_Creature) bool QuestAccept_npc_marshal_windsor(Player *player, Creature *creature, Quest const *quest ) { if( quest->GetQuestId() == 4322 ) - {PlayerStart = player; - if( pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED ) - { - ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); - pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_IN_PROGRESS); - creature->setFaction(11); - } + {PlayerStart = player; + if( pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED ) + { + ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); + pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_IN_PROGRESS); + creature->setFaction(11); + } - } + } return false; } */ @@ -786,89 +787,89 @@ bool QuestAccept_npc_marshal_windsor(Player *player, Creature *creature, Quest c ## npc_marshal_reginald_windsor ######*/ -#define SAY_REGINALD_WINDSOR_0_1 "Can you feel the power, $N??? It's time to ROCK!" -#define SAY_REGINALD_WINDSOR_0_2 "Now we just have to free Tobias and we can get out of here. This way!" -#define SAY_REGINALD_WINDSOR_5_1 "Open it." -#define SAY_REGINALD_WINDSOR_5_2 "I never did like those two. Let's get moving." -#define SAY_REGINALD_WINDSOR_7_1 "Open it and be careful this time!" -#define SAY_REGINALD_WINDSOR_7_2 "That intolerant dirtbag finally got what was coming to him. Good riddance!" -#define SAY_REGINALD_WINDSOR_7_3 "Alright, let's go." -#define SAY_REGINALD_WINDSOR_13_1 "Open it. We need to hurry up. I can smell those Dark Irons coming a mile away and I can tell you one thing, they're COMING!" -#define SAY_REGINALD_WINDSOR_13_2 "Administering fists of fury on Crest Killer!" -#define SAY_REGINALD_WINDSOR_13_3 "He has to be in the last cell. Unless... they killed him." -#define SAY_REGINALD_WINDSOR_14_1 "Get him out of there!" -#define SAY_REGINALD_WINDSOR_14_2 "Excellent work, $N. Let's find the exit. I think I know the way. Follow me!" -#define SAY_REGINALD_WINDSOR_20_1 "We made it!" -#define SAY_REGINALD_WINDSOR_20_2 "Meet me at Maxwell's encampment. We'll go over the next stages of the plan there and figure out a way to decode my tablets without the decryption ring." -#define MOB_ENTRY_SHILL_DINGER 9678 -#define MOB_ENTRY_CREST_KILLER 9680 +#define SAY_REGINALD_WINDSOR_0_1 "Can you feel the power, $N??? It's time to ROCK!" +#define SAY_REGINALD_WINDSOR_0_2 "Now we just have to free Tobias and we can get out of here. This way!" +#define SAY_REGINALD_WINDSOR_5_1 "Open it." +#define SAY_REGINALD_WINDSOR_5_2 "I never did like those two. Let's get moving." +#define SAY_REGINALD_WINDSOR_7_1 "Open it and be careful this time!" +#define SAY_REGINALD_WINDSOR_7_2 "That intolerant dirtbag finally got what was coming to him. Good riddance!" +#define SAY_REGINALD_WINDSOR_7_3 "Alright, let's go." +#define SAY_REGINALD_WINDSOR_13_1 "Open it. We need to hurry up. I can smell those Dark Irons coming a mile away and I can tell you one thing, they're COMING!" +#define SAY_REGINALD_WINDSOR_13_2 "Administering fists of fury on Crest Killer!" +#define SAY_REGINALD_WINDSOR_13_3 "He has to be in the last cell. Unless... they killed him." +#define SAY_REGINALD_WINDSOR_14_1 "Get him out of there!" +#define SAY_REGINALD_WINDSOR_14_2 "Excellent work, $N. Let's find the exit. I think I know the way. Follow me!" +#define SAY_REGINALD_WINDSOR_20_1 "We made it!" +#define SAY_REGINALD_WINDSOR_20_2 "Meet me at Maxwell's encampment. We'll go over the next stages of the plan there and figure out a way to decode my tablets without the decryption ring." +#define MOB_ENTRY_SHILL_DINGER 9678 +#define MOB_ENTRY_CREST_KILLER 9680 int wp = 0; /* struct TRINITY_DLL_DECL npc_marshal_reginald_windsorAI : public npc_escortAI { - npc_marshal_reginald_windsorAI(Creature *c) : npc_escortAI(c) - { - Reset(); - } - - void WaypointReached(uint32 i) + npc_marshal_reginald_windsorAI(Creature *c) : npc_escortAI(c) { - wp=i; - switch( i ) + Reset(); + } + + void WaypointReached(uint32 i) + { + wp=i; + switch( i ) { - case 0: - m_creature->setFaction(11); - m_creature->Say(SAY_REGINALD_WINDSOR_0_1, LANG_UNIVERSAL, PlayerGUID); - break; - case 1: - m_creature->Say(SAY_REGINALD_WINDSOR_0_2, LANG_UNIVERSAL, PlayerGUID); - break; - case 7: - m_creature->HandleEmoteCommand(EMOTE_STATE_POINT); - m_creature->Say(SAY_REGINALD_WINDSOR_5_1, LANG_UNIVERSAL, PlayerGUID); - IsOnHold=true; - break; - case 8: - m_creature->Say(SAY_REGINALD_WINDSOR_5_2, LANG_UNIVERSAL, PlayerGUID); - break; - case 11: - m_creature->HandleEmoteCommand(EMOTE_STATE_POINT); - m_creature->Say(SAY_REGINALD_WINDSOR_7_1, LANG_UNIVERSAL, PlayerGUID); - IsOnHold=true; - break; - case 12: - m_creature->Say(SAY_REGINALD_WINDSOR_7_2, LANG_UNIVERSAL, PlayerGUID); - break; - case 13: - m_creature->Say(SAY_REGINALD_WINDSOR_7_3, LANG_UNIVERSAL, PlayerGUID); - break; - case 20: - m_creature->HandleEmoteCommand(EMOTE_STATE_POINT); - m_creature->Say(SAY_REGINALD_WINDSOR_13_1, LANG_UNIVERSAL, PlayerGUID); - IsOnHold=true; - break; - case 21: - m_creature->Say(SAY_REGINALD_WINDSOR_13_3, LANG_UNIVERSAL, PlayerGUID); - break; - case 23: - m_creature->HandleEmoteCommand(EMOTE_STATE_POINT); - m_creature->Say(SAY_REGINALD_WINDSOR_14_1, LANG_UNIVERSAL, PlayerGUID); - IsOnHold=true; - break; - case 24: - m_creature->Say(SAY_REGINALD_WINDSOR_14_2, LANG_UNIVERSAL, PlayerGUID); - break; - case 31: - m_creature->Say(SAY_REGINALD_WINDSOR_20_1, LANG_UNIVERSAL, PlayerGUID); - break; - case 32: - m_creature->Say(SAY_REGINALD_WINDSOR_20_2, LANG_UNIVERSAL, PlayerGUID); - PlayerStart->GroupEventHappens(QUEST_JAIL_BREAK, m_creature); - pInstance->SetData(DATA_SHILL, ENCOUNTER_STATE_ENDED); - break; - } - } + case 0: + m_creature->setFaction(11); + m_creature->Say(SAY_REGINALD_WINDSOR_0_1, LANG_UNIVERSAL, PlayerGUID); + break; + case 1: + m_creature->Say(SAY_REGINALD_WINDSOR_0_2, LANG_UNIVERSAL, PlayerGUID); + break; + case 7: + m_creature->HandleEmoteCommand(EMOTE_STATE_POINT); + m_creature->Say(SAY_REGINALD_WINDSOR_5_1, LANG_UNIVERSAL, PlayerGUID); + IsOnHold=true; + break; + case 8: + m_creature->Say(SAY_REGINALD_WINDSOR_5_2, LANG_UNIVERSAL, PlayerGUID); + break; + case 11: + m_creature->HandleEmoteCommand(EMOTE_STATE_POINT); + m_creature->Say(SAY_REGINALD_WINDSOR_7_1, LANG_UNIVERSAL, PlayerGUID); + IsOnHold=true; + break; + case 12: + m_creature->Say(SAY_REGINALD_WINDSOR_7_2, LANG_UNIVERSAL, PlayerGUID); + break; + case 13: + m_creature->Say(SAY_REGINALD_WINDSOR_7_3, LANG_UNIVERSAL, PlayerGUID); + break; + case 20: + m_creature->HandleEmoteCommand(EMOTE_STATE_POINT); + m_creature->Say(SAY_REGINALD_WINDSOR_13_1, LANG_UNIVERSAL, PlayerGUID); + IsOnHold=true; + break; + case 21: + m_creature->Say(SAY_REGINALD_WINDSOR_13_3, LANG_UNIVERSAL, PlayerGUID); + break; + case 23: + m_creature->HandleEmoteCommand(EMOTE_STATE_POINT); + m_creature->Say(SAY_REGINALD_WINDSOR_14_1, LANG_UNIVERSAL, PlayerGUID); + IsOnHold=true; + break; + case 24: + m_creature->Say(SAY_REGINALD_WINDSOR_14_2, LANG_UNIVERSAL, PlayerGUID); + break; + case 31: + m_creature->Say(SAY_REGINALD_WINDSOR_20_1, LANG_UNIVERSAL, PlayerGUID); + break; + case 32: + m_creature->Say(SAY_REGINALD_WINDSOR_20_2, LANG_UNIVERSAL, PlayerGUID); + PlayerStart->GroupEventHappens(QUEST_JAIL_BREAK, m_creature); + pInstance->SetData(DATA_SHILL, ENCOUNTER_STATE_ENDED); + break; + } + } void MoveInLineOfSight(Unit *who) { @@ -883,73 +884,73 @@ struct TRINITY_DLL_DECL npc_marshal_reginald_windsorAI : public npc_escortAI if( m_creature->IsWithinDistInMap(who, Radius) ) { IsOnHold = false; - ((npc_escortAI*)(m_creature->AI()))->Start(true, true, false, who->GetGUID()); + ((npc_escortAI*)(m_creature->AI()))->Start(true, true, false, who->GetGUID()); } } } } void Aggro(Unit* who) - { - switch(rand()%3) - { - case 0:m_creature->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, PlayerGUID);break; - case 1:m_creature->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, PlayerGUID);break; - case 2:m_creature->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID);break; - } - } + { + switch(rand()%3) + { + case 0:m_creature->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, PlayerGUID);break; + case 1:m_creature->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, PlayerGUID);break; + case 2:m_creature->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID);break; + } + } void Reset() {} - void JustDied(Unit *slayer) + void JustDied(Unit *slayer) { - pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_FAILED); + pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_FAILED); } void UpdateAI(const uint32 diff) { - if(pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; - if(wp==7) - { - if(!pInstance->GetData(DATA_GATE_J) && pInstance->GetData(DATA_JAZ) == ENCOUNTER_STATE_NOT_STARTED ) - { - pInstance->SetData(DATA_CREATURE_JAZ,1); - pInstance->SetData(DATA_JAZ,ENCOUNTER_STATE_IN_PROGRESS); - } - if( pInstance->GetData(DATA_CREATURE_JAZ) && pInstance->GetData(DATA_CREATURE_OGRABISI) && pInstance->GetData(DATA_JAZ) == ENCOUNTER_STATE_IN_PROGRESS ) - { - IsOnHold = false; - pInstance->SetData(DATA_JAZ,ENCOUNTER_STATE_ENDED); - } - } - else if(wp==11) - { - if(!pInstance->GetData(DATA_GATE_S) && pInstance->GetData(DATA_SHILL) == ENCOUNTER_STATE_NOT_STARTED ) - { - pInstance->SetData(DATA_CREATURE_SHILL,1); - pInstance->SetData(DATA_SHILL,ENCOUNTER_STATE_IN_PROGRESS); - } - if( pInstance->GetData(DATA_CREATURE_SHILL) && pInstance->GetData(DATA_SHILL) == ENCOUNTER_STATE_IN_PROGRESS ) - { - pInstance->SetData(DATA_SHILL,ENCOUNTER_STATE_ENDED); - IsOnHold = false; - } - } - else if(wp==20) - { - if(!pInstance->GetData(DATA_GATE_C) && pInstance->GetData(DATA_CREST) == ENCOUNTER_STATE_NOT_STARTED) - { - pInstance->SetData(DATA_CREATURE_CREST,1); - m_creature->Say(SAY_REGINALD_WINDSOR_13_2, LANG_UNIVERSAL, PlayerGUID); - pInstance->SetData(DATA_CREST,ENCOUNTER_STATE_IN_PROGRESS); - } - if( pInstance->GetData(DATA_CREATURE_CREST) && pInstance->GetData(DATA_CREST) == ENCOUNTER_STATE_IN_PROGRESS ) - { - IsOnHold = false; - pInstance->SetData(DATA_CREST,ENCOUNTER_STATE_ENDED); - } - } - if( pInstance->GetData(DATA_TOBIAS)==ENCOUNTER_STATE_OBJECTIVE_COMPLETED ) IsOnHold = false; - npc_escortAI::UpdateAI(diff); + if(pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; + if(wp==7) + { + if(!pInstance->GetData(DATA_GATE_J) && pInstance->GetData(DATA_JAZ) == ENCOUNTER_STATE_NOT_STARTED ) + { + pInstance->SetData(DATA_CREATURE_JAZ,1); + pInstance->SetData(DATA_JAZ,ENCOUNTER_STATE_IN_PROGRESS); + } + if( pInstance->GetData(DATA_CREATURE_JAZ) && pInstance->GetData(DATA_CREATURE_OGRABISI) && pInstance->GetData(DATA_JAZ) == ENCOUNTER_STATE_IN_PROGRESS ) + { + IsOnHold = false; + pInstance->SetData(DATA_JAZ,ENCOUNTER_STATE_ENDED); + } + } + else if(wp==11) + { + if(!pInstance->GetData(DATA_GATE_S) && pInstance->GetData(DATA_SHILL) == ENCOUNTER_STATE_NOT_STARTED ) + { + pInstance->SetData(DATA_CREATURE_SHILL,1); + pInstance->SetData(DATA_SHILL,ENCOUNTER_STATE_IN_PROGRESS); + } + if( pInstance->GetData(DATA_CREATURE_SHILL) && pInstance->GetData(DATA_SHILL) == ENCOUNTER_STATE_IN_PROGRESS ) + { + pInstance->SetData(DATA_SHILL,ENCOUNTER_STATE_ENDED); + IsOnHold = false; + } + } + else if(wp==20) + { + if(!pInstance->GetData(DATA_GATE_C) && pInstance->GetData(DATA_CREST) == ENCOUNTER_STATE_NOT_STARTED) + { + pInstance->SetData(DATA_CREATURE_CREST,1); + m_creature->Say(SAY_REGINALD_WINDSOR_13_2, LANG_UNIVERSAL, PlayerGUID); + pInstance->SetData(DATA_CREST,ENCOUNTER_STATE_IN_PROGRESS); + } + if( pInstance->GetData(DATA_CREATURE_CREST) && pInstance->GetData(DATA_CREST) == ENCOUNTER_STATE_IN_PROGRESS ) + { + IsOnHold = false; + pInstance->SetData(DATA_CREST,ENCOUNTER_STATE_ENDED); + } + } + if( pInstance->GetData(DATA_TOBIAS)==ENCOUNTER_STATE_OBJECTIVE_COMPLETED ) IsOnHold = false; + npc_escortAI::UpdateAI(diff); } }; CreatureAI* GetAI_npc_marshal_reginald_windsor(Creature *_Creature) @@ -962,9 +963,9 @@ CreatureAI* GetAI_npc_marshal_reginald_windsor(Creature *_Creature) marshal_reginald_windsorAI->AddWaypoint(3, 407.99,-73.91, -62.26,0); marshal_reginald_windsorAI->AddWaypoint(4, 557.03,-119.71, -61.83,0); marshal_reginald_windsorAI->AddWaypoint(5, 573.40,-124.39, -65.07,0); - marshal_reginald_windsorAI->AddWaypoint(6, 593.91,-130.29, -69.25,0); - marshal_reginald_windsorAI->AddWaypoint(7, 593.21,-132.16, -69.25,0); - marshal_reginald_windsorAI->AddWaypoint(8, 593.21,-132.16, -69.25,3000); + marshal_reginald_windsorAI->AddWaypoint(6, 593.91,-130.29, -69.25,0); + marshal_reginald_windsorAI->AddWaypoint(7, 593.21,-132.16, -69.25,0); + marshal_reginald_windsorAI->AddWaypoint(8, 593.21,-132.16, -69.25,3000); marshal_reginald_windsorAI->AddWaypoint(9, 622.81,-135.55, -71.92,0); marshal_reginald_windsorAI->AddWaypoint(10, 634.68,-151.29, -70.32,0); marshal_reginald_windsorAI->AddWaypoint(11, 635.06,-153.25, -70.32,0); @@ -973,33 +974,33 @@ CreatureAI* GetAI_npc_marshal_reginald_windsor(Creature *_Creature) marshal_reginald_windsorAI->AddWaypoint(14, 655.25,-172.39, -73.72,0); marshal_reginald_windsorAI->AddWaypoint(15, 654.79,-226.30, -83.06,0); marshal_reginald_windsorAI->AddWaypoint(16, 622.85,-268.85, -83.96,0); - marshal_reginald_windsorAI->AddWaypoint(17, 579.45,-275.56, -80.44,0); + marshal_reginald_windsorAI->AddWaypoint(17, 579.45,-275.56, -80.44,0); marshal_reginald_windsorAI->AddWaypoint(18, 561.19,-266.85, -75.59,0); - marshal_reginald_windsorAI->AddWaypoint(19, 547.91,-253.92, -70.34,0); - marshal_reginald_windsorAI->AddWaypoint(20, 549.20,-252.40, -70.34,0); - marshal_reginald_windsorAI->AddWaypoint(21, 549.20,-252.40, -70.34,4000); + marshal_reginald_windsorAI->AddWaypoint(19, 547.91,-253.92, -70.34,0); + marshal_reginald_windsorAI->AddWaypoint(20, 549.20,-252.40, -70.34,0); + marshal_reginald_windsorAI->AddWaypoint(21, 549.20,-252.40, -70.34,4000); marshal_reginald_windsorAI->AddWaypoint(22, 555.33,-269.16, -74.40,0); marshal_reginald_windsorAI->AddWaypoint(23, 554.31,-270.88, -74.40,0); marshal_reginald_windsorAI->AddWaypoint(24, 554.31,-270.88, -74.40,4000); - marshal_reginald_windsorAI->AddWaypoint(25, 536.10,-249.60, -67.47,0); + marshal_reginald_windsorAI->AddWaypoint(25, 536.10,-249.60, -67.47,0); marshal_reginald_windsorAI->AddWaypoint(26, 520.94,-216.65, -59.28,0); - marshal_reginald_windsorAI->AddWaypoint(27, 505.99,-148.74, -62.17,0); + marshal_reginald_windsorAI->AddWaypoint(27, 505.99,-148.74, -62.17,0); marshal_reginald_windsorAI->AddWaypoint(28, 484.21,-56.24, -62.43,0); - marshal_reginald_windsorAI->AddWaypoint(29, 470.39,-6.01, -70.10,0); + marshal_reginald_windsorAI->AddWaypoint(29, 470.39,-6.01, -70.10,0); marshal_reginald_windsorAI->AddWaypoint(30, 451.27,30.85, -70.07,0); marshal_reginald_windsorAI->AddWaypoint(31, 452.45,29.85, -70.37,1500); marshal_reginald_windsorAI->AddWaypoint(32, 452.45,29.85, -70.37,7000); marshal_reginald_windsorAI->AddWaypoint(33, 452.45,29.85, -70.37,10000); marshal_reginald_windsorAI->AddWaypoint(34, 451.27,31.85, -70.07,0); - return (CreatureAI*)marshal_reginald_windsorAI; + return (CreatureAI*)marshal_reginald_windsorAI; } */ /*###### ## npc_tobias_seecher ######*/ -#define SAY_TOBIAS_FREE "Thank you! I will run for safety immediately!" +#define SAY_TOBIAS_FREE "Thank you! I will run for safety immediately!" /* struct TRINITY_DLL_DECL npc_tobias_seecherAI : public npc_escortAI { @@ -1012,45 +1013,45 @@ struct TRINITY_DLL_DECL npc_tobias_seecherAI : public npc_escortAI { if (IsBeingEscorted && killer == m_creature) { - m_creature->SetVisibility(VISIBILITY_OFF); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_ENDED); + m_creature->SetVisibility(VISIBILITY_OFF); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_ENDED); } } - void WaypointReached(uint32 i) + void WaypointReached(uint32 i) { - switch(i) - { - case 0:m_creature->Say(SAY_TOBIAS_FREE, LANG_UNIVERSAL, PlayerGUID); break; - case 2: - pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_OBJECTIVE_COMPLETED);break; - case 4: - m_creature->SetVisibility(VISIBILITY_OFF); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_ENDED); - break; - } - } + switch(i) + { + case 0:m_creature->Say(SAY_TOBIAS_FREE, LANG_UNIVERSAL, PlayerGUID); break; + case 2: + pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_OBJECTIVE_COMPLETED);break; + case 4: + m_creature->SetVisibility(VISIBILITY_OFF); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_ENDED); + break; + } + } void UpdateAI(const uint32 diff) { - if(pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; - if( (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_TOBIAS) == ENCOUNTER_STATE_ENDED ) - { - m_creature->SetVisibility(VISIBILITY_OFF); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - else - { - m_creature->SetVisibility(VISIBILITY_ON); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - npc_escortAI::UpdateAI(diff); + if(pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; + if( (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_TOBIAS) == ENCOUNTER_STATE_ENDED ) + { + m_creature->SetVisibility(VISIBILITY_OFF); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + else + { + m_creature->SetVisibility(VISIBILITY_ON); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + npc_escortAI::UpdateAI(diff); } }; @@ -1069,10 +1070,10 @@ CreatureAI* GetAI_npc_tobias_seecher(Creature *_Creature) bool GossipHello_npc_tobias_seecher(Player *player, Creature *_Creature) { - if(player->GetQuestStatus(QUEST_JAIL_BREAK) == QUEST_STATUS_INCOMPLETE && pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS ) + if(player->GetQuestStatus(QUEST_JAIL_BREAK) == QUEST_STATUS_INCOMPLETE && pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS ) { player->ADD_GOSSIP_ITEM(0, "Get out of here, Tobias, you're free!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->SEND_GOSSIP_MENU(2847, _Creature->GetGUID()); + player->SEND_GOSSIP_MENU(2847, _Creature->GetGUID()); } return true; } @@ -1083,8 +1084,8 @@ bool GossipSelect_npc_tobias_seecher(Player *player, Creature *_Creature, uint32 { player->CLOSE_GOSSIP_MENU(); ((npc_escortAI*)(_Creature->AI()))->Start(false, false, true, player->GetGUID()); - _Creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_IN_PROGRESS); + _Creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_IN_PROGRESS); } return true; } @@ -1100,159 +1101,159 @@ bool GossipSelect_npc_tobias_seecher(Player *player, Creature *_Creature, uint32 float BarWpLocations[8][3]= { - {883.294861, -188.926300, -43.703655}, - {872.763550, -185.605621, -43.703655}, //b1 - {867.923401, -188.006393, -43.703655}, //b2 - {863.295898, -190.795212, -43.703655}, //b3 - {856.139587, -194.652756, -43.703655}, //b4 - {851.878906, -196.928131, -43.703655}, //b5 - {877.035217, -187.048080, -43.703655}, - {891.198000, -197.924000, -43.620400} //home + {883.294861, -188.926300, -43.703655}, + {872.763550, -185.605621, -43.703655}, //b1 + {867.923401, -188.006393, -43.703655}, //b2 + {863.295898, -190.795212, -43.703655}, //b3 + {856.139587, -194.652756, -43.703655}, //b4 + {851.878906, -196.928131, -43.703655}, //b5 + {877.035217, -187.048080, -43.703655}, + {891.198000, -197.924000, -43.620400} //home }; uint32 BarWpWait[8]= { - 0, - 5000, - 5000, - 5000, - 5000, - 15000, - 0, - 0 + 0, + 5000, + 5000, + 5000, + 5000, + 15000, + 0, + 0 }; struct TRINITY_DLL_DECL npc_rocknotAI : public npc_escortAI { - npc_rocknotAI(Creature *c) : npc_escortAI(c) - { - pInstance = ((ScriptedInstance*)c->GetInstanceData()); - Reset(); - } + npc_rocknotAI(Creature *c) : npc_escortAI(c) + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + Reset(); + } - ScriptedInstance* pInstance; + ScriptedInstance* pInstance; - uint32 BreakKeg_Timer; - uint32 BreakDoor_Timer; + uint32 BreakKeg_Timer; + uint32 BreakDoor_Timer; - void Reset() - { - if (IsBeingEscorted) - return; + void Reset() + { + if (IsBeingEscorted) + return; - BreakKeg_Timer = 0; - BreakDoor_Timer = 0; - } + BreakKeg_Timer = 0; + BreakDoor_Timer = 0; + } - void Aggro(Unit *who) { } + void Aggro(Unit *who) { } - void DoGo(uint32 id, uint32 state) - { - if (GameObject *go = GameObject::GetGameObject(*m_creature,pInstance->GetData64(id))) - go->SetGoState(state); - } + void DoGo(uint32 id, uint32 state) + { + if (GameObject *go = GameObject::GetGameObject(*m_creature,pInstance->GetData64(id))) + go->SetGoState(state); + } - void WaypointReached(uint32 i) - { - if (!pInstance) - return; + void WaypointReached(uint32 i) + { + if (!pInstance) + return; - switch(i) - { - case 1: - m_creature->HandleEmoteCommand(EMOTE_ONESHOT_KICK); - break; - case 2: - m_creature->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED); - break; - case 3: - m_creature->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED); - break; - case 4: - m_creature->HandleEmoteCommand(EMOTE_ONESHOT_KICK); - break; - case 5: - m_creature->HandleEmoteCommand(EMOTE_ONESHOT_KICK); - BreakKeg_Timer = 2000; - break; - } - } + switch(i) + { + case 1: + m_creature->HandleEmoteCommand(EMOTE_ONESHOT_KICK); + break; + case 2: + m_creature->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED); + break; + case 3: + m_creature->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED); + break; + case 4: + m_creature->HandleEmoteCommand(EMOTE_ONESHOT_KICK); + break; + case 5: + m_creature->HandleEmoteCommand(EMOTE_ONESHOT_KICK); + BreakKeg_Timer = 2000; + break; + } + } - void UpdateAI(const uint32 diff) - { - if (!pInstance) - return; + void UpdateAI(const uint32 diff) + { + if (!pInstance) + return; - if (BreakKeg_Timer) - { - if (BreakKeg_Timer <= diff) - { - DoGo(DATA_GO_BAR_KEG,0); - BreakKeg_Timer = 0; - BreakDoor_Timer = 1000; - }else BreakKeg_Timer -= diff; - } + if (BreakKeg_Timer) + { + if (BreakKeg_Timer <= diff) + { + DoGo(DATA_GO_BAR_KEG,0); + BreakKeg_Timer = 0; + BreakDoor_Timer = 1000; + }else BreakKeg_Timer -= diff; + } - if (BreakDoor_Timer) - { - if (BreakDoor_Timer <= diff) - { - DoGo(DATA_GO_BAR_DOOR,2); - DoGo(DATA_GO_BAR_KEG_TRAP,0); //doesn't work very well, leaving code here for future - //spell by trap has effect61, this indicate the bar go hostile + if (BreakDoor_Timer) + { + if (BreakDoor_Timer <= diff) + { + DoGo(DATA_GO_BAR_DOOR,2); + DoGo(DATA_GO_BAR_KEG_TRAP,0); //doesn't work very well, leaving code here for future + //spell by trap has effect61, this indicate the bar go hostile - if (Unit *tmp = Unit::GetUnit(*m_creature,pInstance->GetData64(DATA_PHALANX))) - tmp->setFaction(14); + if (Unit *tmp = Unit::GetUnit(*m_creature,pInstance->GetData64(DATA_PHALANX))) + tmp->setFaction(14); - //for later, this event(s) has alot more to it. - //optionally, DONE can trigger bar to go hostile. - pInstance->SetData(TYPE_BAR,DONE); + //for later, this event(s) has alot more to it. + //optionally, DONE can trigger bar to go hostile. + pInstance->SetData(TYPE_BAR,DONE); - BreakDoor_Timer = 0; - }else BreakDoor_Timer -= diff; - } + BreakDoor_Timer = 0; + }else BreakDoor_Timer -= diff; + } - npc_escortAI::UpdateAI(diff); - } + npc_escortAI::UpdateAI(diff); + } }; CreatureAI* GetAI_npc_rocknot(Creature *_Creature) { - npc_rocknotAI* Rocknot_AI = new npc_rocknotAI(_Creature); + npc_rocknotAI* Rocknot_AI = new npc_rocknotAI(_Creature); - for(uint8 i = 0; i < 8; ++i) - Rocknot_AI->AddWaypoint(i, BarWpLocations[i][0], BarWpLocations[i][1], BarWpLocations[i][2], BarWpWait[i]); + for(uint8 i = 0; i < 8; ++i) + Rocknot_AI->AddWaypoint(i, BarWpLocations[i][0], BarWpLocations[i][1], BarWpLocations[i][2], BarWpWait[i]); - return (CreatureAI*)Rocknot_AI; + return (CreatureAI*)Rocknot_AI; } bool ChooseReward_npc_rocknot(Player *player, Creature *_Creature, const Quest *_Quest, uint32 item) { - ScriptedInstance* pInstance = ((ScriptedInstance*)_Creature->GetInstanceData()); + ScriptedInstance* pInstance = ((ScriptedInstance*)_Creature->GetInstanceData()); - if (!pInstance) - return true; + if (!pInstance) + return true; - if (pInstance->GetData(TYPE_BAR) == DONE || pInstance->GetData(TYPE_BAR) == SPECIAL) - return true; + if (pInstance->GetData(TYPE_BAR) == DONE || pInstance->GetData(TYPE_BAR) == SPECIAL) + return true; - if (_Quest->GetQuestId() == QUEST_ALE) - { - if (pInstance->GetData(TYPE_BAR) != IN_PROGRESS) - pInstance->SetData(TYPE_BAR,IN_PROGRESS); + if (_Quest->GetQuestId() == QUEST_ALE) + { + if (pInstance->GetData(TYPE_BAR) != IN_PROGRESS) + pInstance->SetData(TYPE_BAR,IN_PROGRESS); - pInstance->SetData(TYPE_BAR,SPECIAL); + pInstance->SetData(TYPE_BAR,SPECIAL); - //keep track of amount in instance script, returns SPECIAL if amount ok and event in progress - if (pInstance->GetData(TYPE_BAR) == SPECIAL) - { - DoScriptText(SAY_GOT_BEER, _Creature); - _Creature->CastSpell(_Creature,SPELL_DRUNKEN_RAGE,false); - ((npc_escortAI*)(_Creature->AI()))->Start(false, false, false); - } - } + //keep track of amount in instance script, returns SPECIAL if amount ok and event in progress + if (pInstance->GetData(TYPE_BAR) == SPECIAL) + { + DoScriptText(SAY_GOT_BEER, _Creature); + _Creature->CastSpell(_Creature,SPELL_DRUNKEN_RAGE,false); + ((npc_escortAI*)(_Creature->AI()))->Start(false, false, false); + } + } - return true; + return true; } /*###### @@ -1263,15 +1264,15 @@ void AddSC_blackrock_depths() { Script *newscript; - newscript = new Script; - newscript->Name = "at_ring_of_law"; - newscript->pAreaTrigger = &AreaTrigger_at_ring_of_law; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name = "at_ring_of_law"; + newscript->pAreaTrigger = &AreaTrigger_at_ring_of_law; + newscript->RegisterSelf(); - newscript = new Script; - newscript->Name = "npc_grimstone"; - newscript->GetAI = &GetAI_npc_grimstone; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name = "npc_grimstone"; + newscript->GetAI = &GetAI_npc_grimstone; + newscript->RegisterSelf(); newscript = new Script; newscript->Name="phalanx"; @@ -1290,34 +1291,34 @@ void AddSC_blackrock_depths() newscript->pGossipSelect = &GossipSelect_npc_lokhtos_darkbargainer; newscript->RegisterSelf(); /* - newscript = new Script; - newscript->Name="npc_dughal_stormwing"; - newscript->pGossipHello = &GossipHello_npc_dughal_stormwing; - newscript->pGossipSelect = &GossipSelect_npc_dughal_stormwing; - newscript->GetAI = &GetAI_npc_dughal_stormwing; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="npc_tobias_seecher"; - newscript->pGossipHello = &GossipHello_npc_tobias_seecher; - newscript->pGossipSelect = &GossipSelect_npc_tobias_seecher; - newscript->GetAI = &GetAI_npc_tobias_seecher; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="npc_marshal_windsor"; - newscript->pQuestAccept = &QuestAccept_npc_marshal_windsor; - newscript->GetAI = &GetAI_npc_marshal_windsor; + newscript = new Script; + newscript->Name="npc_dughal_stormwing"; + newscript->pGossipHello = &GossipHello_npc_dughal_stormwing; + newscript->pGossipSelect = &GossipSelect_npc_dughal_stormwing; + newscript->GetAI = &GetAI_npc_dughal_stormwing; newscript->RegisterSelf(); - newscript = new Script; - newscript->Name="npc_marshal_reginald_windsor"; - newscript->GetAI = &GetAI_npc_marshal_reginald_windsor; - newscript->RegisterSelf();*/ + newscript = new Script; + newscript->Name="npc_tobias_seecher"; + newscript->pGossipHello = &GossipHello_npc_tobias_seecher; + newscript->pGossipSelect = &GossipSelect_npc_tobias_seecher; + newscript->GetAI = &GetAI_npc_tobias_seecher; + newscript->RegisterSelf(); - newscript = new Script; - newscript->Name = "npc_rocknot"; - newscript->GetAI = &GetAI_npc_rocknot; - newscript->pChooseReward = &ChooseReward_npc_rocknot; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name="npc_marshal_windsor"; + newscript->pQuestAccept = &QuestAccept_npc_marshal_windsor; + newscript->GetAI = &GetAI_npc_marshal_windsor; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="npc_marshal_reginald_windsor"; + newscript->GetAI = &GetAI_npc_marshal_reginald_windsor; + newscript->RegisterSelf();*/ + + newscript = new Script; + newscript->Name = "npc_rocknot"; + newscript->GetAI = &GetAI_npc_rocknot; + newscript->pChooseReward = &ChooseReward_npc_rocknot; + newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/blackrock_depths/instance_blackrock_depths.cpp b/src/bindings/scripts/scripts/zone/blackrock_depths/instance_blackrock_depths.cpp index 324e3bb8816..3ae0b910d07 100644 --- a/src/bindings/scripts/scripts/zone/blackrock_depths/instance_blackrock_depths.cpp +++ b/src/bindings/scripts/scripts/zone/blackrock_depths/instance_blackrock_depths.cpp @@ -57,244 +57,244 @@ update `instance_template` set `script`='instance_blackrock_depths' where `map`= struct TRINITY_DLL_DECL instance_blackrock_depths : public ScriptedInstance { - instance_blackrock_depths(Map *map) : ScriptedInstance(map) {Initialize();}; + instance_blackrock_depths(Map *map) : ScriptedInstance(map) {Initialize();}; - uint32 Encounter[ENCOUNTERS]; - std::string str_data; + uint32 Encounter[ENCOUNTERS]; + std::string str_data; - uint64 EmperorGUID; - uint64 PhalanxGUID; + uint64 EmperorGUID; + uint64 PhalanxGUID; - uint64 GoArena1GUID; - uint64 GoArena2GUID; - uint64 GoArena3GUID; - uint64 GoArena4GUID; - uint64 GoShadowLockGUID; - uint64 GoShadowMechGUID; - uint64 GoShadowGiantGUID; - uint64 GoShadowDummyGUID; - uint64 GoBarKegGUID; - uint64 GoBarKegTrapGUID; - uint64 GoBarDoorGUID; - uint64 GoTombEnterGUID; - uint64 GoTombExitGUID; - uint64 GoLyceumGUID; - uint64 GoGolemNGUID; - uint64 GoGolemSGUID; - uint64 GoThoneGUID; + uint64 GoArena1GUID; + uint64 GoArena2GUID; + uint64 GoArena3GUID; + uint64 GoArena4GUID; + uint64 GoShadowLockGUID; + uint64 GoShadowMechGUID; + uint64 GoShadowGiantGUID; + uint64 GoShadowDummyGUID; + uint64 GoBarKegGUID; + uint64 GoBarKegTrapGUID; + uint64 GoBarDoorGUID; + uint64 GoTombEnterGUID; + uint64 GoTombExitGUID; + uint64 GoLyceumGUID; + uint64 GoGolemNGUID; + uint64 GoGolemSGUID; + uint64 GoThoneGUID; - uint32 BarAleCount; + uint32 BarAleCount; - void Initialize() - { - EmperorGUID = 0; - PhalanxGUID = 0; + void Initialize() + { + EmperorGUID = 0; + PhalanxGUID = 0; - GoArena1GUID = 0; - GoArena2GUID = 0; - GoArena3GUID = 0; - GoArena4GUID = 0; - GoShadowLockGUID = 0; - GoShadowMechGUID = 0; - GoShadowGiantGUID = 0; - GoShadowDummyGUID = 0; - GoBarKegGUID = 0; - GoBarKegTrapGUID = 0; - GoBarDoorGUID = 0; - GoTombEnterGUID = 0; - GoTombExitGUID = 0; - GoLyceumGUID = 0; - GoGolemNGUID = 0; - GoGolemSGUID = 0; - GoThoneGUID = 0; + GoArena1GUID = 0; + GoArena2GUID = 0; + GoArena3GUID = 0; + GoArena4GUID = 0; + GoShadowLockGUID = 0; + GoShadowMechGUID = 0; + GoShadowGiantGUID = 0; + GoShadowDummyGUID = 0; + GoBarKegGUID = 0; + GoBarKegTrapGUID = 0; + GoBarDoorGUID = 0; + GoTombEnterGUID = 0; + GoTombExitGUID = 0; + GoLyceumGUID = 0; + GoGolemNGUID = 0; + GoGolemSGUID = 0; + GoThoneGUID = 0; - BarAleCount = 0; + BarAleCount = 0; - for(uint8 i = 0; i < ENCOUNTERS; i++) - Encounter[i] = NOT_STARTED; - } + for(uint8 i = 0; i < ENCOUNTERS; i++) + Encounter[i] = NOT_STARTED; + } - Player* GetPlayerInMap() - { - Map::PlayerList const& players = instance->GetPlayers(); + Player* GetPlayerInMap() + { + Map::PlayerList const& players = instance->GetPlayers(); - if (!players.isEmpty()) - { - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - if (Player* plr = itr->getSource()) - return plr; - } - } + if (!players.isEmpty()) + { + for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* plr = itr->getSource()) + return plr; + } + } - debug_log("SD2: Instance Blackrock Depths: GetPlayerInMap, but PlayerList is empty!"); - return NULL; - } + debug_log("SD2: Instance Blackrock Depths: GetPlayerInMap, but PlayerList is empty!"); + return NULL; + } - void OnCreatureCreate(Creature *creature, uint32 creature_entry) - { - switch(creature->GetEntry()) - { - case C_EMPEROR: EmperorGUID = creature->GetGUID(); break; - case C_PHALANX: PhalanxGUID = creature->GetGUID(); break; - } - } + void OnCreatureCreate(Creature *creature, uint32 creature_entry) + { + switch(creature->GetEntry()) + { + case C_EMPEROR: EmperorGUID = creature->GetGUID(); break; + case C_PHALANX: PhalanxGUID = creature->GetGUID(); break; + } + } - void OnObjectCreate(GameObject* go) - { - switch(go->GetEntry()) - { - case GO_ARENA1: GoArena1GUID = go->GetGUID(); break; - case GO_ARENA2: GoArena2GUID = go->GetGUID(); break; - case GO_ARENA3: GoArena3GUID = go->GetGUID(); break; - case GO_ARENA4: GoArena4GUID = go->GetGUID(); break; - case GO_SHADOW_LOCK: GoShadowLockGUID = go->GetGUID(); break; - case GO_SHADOW_MECHANISM: GoShadowMechGUID = go->GetGUID(); break; - case GO_SHADOW_GIANT_DOOR: GoShadowGiantGUID = go->GetGUID(); break; - case GO_SHADOW_DUMMY: GoShadowDummyGUID = go->GetGUID(); break; - case GO_BAR_KEG_SHOT: GoBarKegGUID = go->GetGUID(); break; - case GO_BAR_KEG_TRAP: GoBarKegTrapGUID = go->GetGUID(); break; - case GO_BAR_DOOR: GoBarDoorGUID = go->GetGUID(); break; - case GO_TOMB_ENTER: GoTombEnterGUID = go->GetGUID(); break; - case GO_TOMB_EXIT: GoTombExitGUID = go->GetGUID(); break; - case GO_LYCEUM: GoLyceumGUID = go->GetGUID(); break; - case GO_GOLEM_ROOM_N: GoGolemNGUID = go->GetGUID(); break; - case GO_GOLEM_ROOM_S: GoGolemSGUID = go->GetGUID(); break; - case GO_THONE_ROOM: GoThoneGUID = go->GetGUID(); break; - } - } + void OnObjectCreate(GameObject* go) + { + switch(go->GetEntry()) + { + case GO_ARENA1: GoArena1GUID = go->GetGUID(); break; + case GO_ARENA2: GoArena2GUID = go->GetGUID(); break; + case GO_ARENA3: GoArena3GUID = go->GetGUID(); break; + case GO_ARENA4: GoArena4GUID = go->GetGUID(); break; + case GO_SHADOW_LOCK: GoShadowLockGUID = go->GetGUID(); break; + case GO_SHADOW_MECHANISM: GoShadowMechGUID = go->GetGUID(); break; + case GO_SHADOW_GIANT_DOOR: GoShadowGiantGUID = go->GetGUID(); break; + case GO_SHADOW_DUMMY: GoShadowDummyGUID = go->GetGUID(); break; + case GO_BAR_KEG_SHOT: GoBarKegGUID = go->GetGUID(); break; + case GO_BAR_KEG_TRAP: GoBarKegTrapGUID = go->GetGUID(); break; + case GO_BAR_DOOR: GoBarDoorGUID = go->GetGUID(); break; + case GO_TOMB_ENTER: GoTombEnterGUID = go->GetGUID(); break; + case GO_TOMB_EXIT: GoTombExitGUID = go->GetGUID(); break; + case GO_LYCEUM: GoLyceumGUID = go->GetGUID(); break; + case GO_GOLEM_ROOM_N: GoGolemNGUID = go->GetGUID(); break; + case GO_GOLEM_ROOM_S: GoGolemSGUID = go->GetGUID(); break; + case GO_THONE_ROOM: GoThoneGUID = go->GetGUID(); break; + } + } - void SetData(uint32 type, uint32 data) - { - Player *player = GetPlayerInMap(); + void SetData(uint32 type, uint32 data) + { + Player *player = GetPlayerInMap(); - if (!player) - { - debug_log("SD2: Instance Blackrock Depths: SetData (Type: %u Data %u) cannot find any player.", type, data); - return; - } + if (!player) + { + debug_log("SD2: Instance Blackrock Depths: SetData (Type: %u Data %u) cannot find any player.", type, data); + return; + } - debug_log("SD2: Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data); + debug_log("SD2: Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data); - switch(type) - { - case TYPE_RING_OF_LAW: - Encounter[0] = data; - break; - case TYPE_VAULT: - Encounter[1] = data; - break; - case TYPE_BAR: - if (data == SPECIAL) - ++BarAleCount; - else - Encounter[2] = data; - break; - case TYPE_TOMB_OF_SEVEN: - Encounter[3] = data; - break; - case TYPE_LYCEUM: - Encounter[4] = data; - break; - case TYPE_IRON_HALL: - Encounter[5] = data; - break; - } + switch(type) + { + case TYPE_RING_OF_LAW: + Encounter[0] = data; + break; + case TYPE_VAULT: + Encounter[1] = data; + break; + case TYPE_BAR: + if (data == SPECIAL) + ++BarAleCount; + else + Encounter[2] = data; + break; + case TYPE_TOMB_OF_SEVEN: + Encounter[3] = data; + break; + case TYPE_LYCEUM: + Encounter[4] = data; + break; + case TYPE_IRON_HALL: + Encounter[5] = data; + break; + } - if (data == DONE) - { - OUT_SAVE_INST_DATA; + if (data == DONE) + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << Encounter[0] << " " << Encounter[1] << " " << Encounter[2] << " " - << Encounter[3] << " " << Encounter[4] << " " << Encounter[5]; + std::ostringstream saveStream; + saveStream << Encounter[0] << " " << Encounter[1] << " " << Encounter[2] << " " + << Encounter[3] << " " << Encounter[4] << " " << Encounter[5]; - str_data = saveStream.str(); + str_data = saveStream.str(); - SaveToDB(); - OUT_SAVE_INST_DATA_COMPLETE; - } - } + SaveToDB(); + OUT_SAVE_INST_DATA_COMPLETE; + } + } - uint32 GetData(uint32 type) - { - switch(type) - { - case TYPE_RING_OF_LAW: - return Encounter[0]; - case TYPE_VAULT: - return Encounter[1]; - case TYPE_BAR: - if (Encounter[2] == IN_PROGRESS && BarAleCount == 3) - return SPECIAL; - else - return Encounter[2]; - case TYPE_TOMB_OF_SEVEN: - return Encounter[3]; - case TYPE_LYCEUM: - return Encounter[4]; - case TYPE_IRON_HALL: - return Encounter[5]; - } - return 0; - } + uint32 GetData(uint32 type) + { + switch(type) + { + case TYPE_RING_OF_LAW: + return Encounter[0]; + case TYPE_VAULT: + return Encounter[1]; + case TYPE_BAR: + if (Encounter[2] == IN_PROGRESS && BarAleCount == 3) + return SPECIAL; + else + return Encounter[2]; + case TYPE_TOMB_OF_SEVEN: + return Encounter[3]; + case TYPE_LYCEUM: + return Encounter[4]; + case TYPE_IRON_HALL: + return Encounter[5]; + } + return 0; + } - uint64 GetData64(uint32 data) - { - switch(data) - { - case DATA_EMPEROR: - return EmperorGUID; - case DATA_PHALANX: - return PhalanxGUID; - case DATA_ARENA1: - return GoArena1GUID; - case DATA_ARENA2: - return GoArena2GUID; - case DATA_ARENA3: - return GoArena3GUID; - case DATA_ARENA4: - return GoArena4GUID; - case DATA_GO_BAR_KEG: - return GoBarKegGUID; - case DATA_GO_BAR_KEG_TRAP: - return GoBarKegTrapGUID; - case DATA_GO_BAR_DOOR: - return GoBarDoorGUID; - } - return 0; - } + uint64 GetData64(uint32 data) + { + switch(data) + { + case DATA_EMPEROR: + return EmperorGUID; + case DATA_PHALANX: + return PhalanxGUID; + case DATA_ARENA1: + return GoArena1GUID; + case DATA_ARENA2: + return GoArena2GUID; + case DATA_ARENA3: + return GoArena3GUID; + case DATA_ARENA4: + return GoArena4GUID; + case DATA_GO_BAR_KEG: + return GoBarKegGUID; + case DATA_GO_BAR_KEG_TRAP: + return GoBarKegTrapGUID; + case DATA_GO_BAR_DOOR: + return GoBarDoorGUID; + } + return 0; + } - const char* Save() - { - return str_data.c_str(); - } + const char* Save() + { + return str_data.c_str(); + } - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - std::istringstream loadStream(in); - loadStream >> Encounter[0] >> Encounter[1] >> Encounter[2] >> Encounter[3] - >> Encounter[4] >> Encounter[5]; + std::istringstream loadStream(in); + loadStream >> Encounter[0] >> Encounter[1] >> Encounter[2] >> Encounter[3] + >> Encounter[4] >> Encounter[5]; - for(uint8 i = 0; i < ENCOUNTERS; ++i) - if (Encounter[i] == IN_PROGRESS) - Encounter[i] = NOT_STARTED; + for(uint8 i = 0; i < ENCOUNTERS; ++i) + if (Encounter[i] == IN_PROGRESS) + Encounter[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; - } + OUT_LOAD_INST_DATA_COMPLETE; + } }; InstanceData* GetInstanceData_instance_blackrock_depths(Map* map) { - return new instance_blackrock_depths(map); + return new instance_blackrock_depths(map); } void AddSC_instance_blackrock_depths() diff --git a/src/bindings/scripts/scripts/zone/blackwing_lair/boss_flamegor.cpp b/src/bindings/scripts/scripts/zone/blackwing_lair/boss_flamegor.cpp index 1c3632c2326..32c7ae2aef6 100644 --- a/src/bindings/scripts/scripts/zone/blackwing_lair/boss_flamegor.cpp +++ b/src/bindings/scripts/scripts/zone/blackwing_lair/boss_flamegor.cpp @@ -74,7 +74,7 @@ struct TRINITY_DLL_DECL boss_flamegorAI : public ScriptedAI //Frenzy_Timer if (Frenzy_Timer < diff) { - DoScriptText(EMOTE_FRENZY, m_creature); + DoScriptText(EMOTE_FRENZY, m_creature); DoCast(m_creature,SPELL_FRENZY); Frenzy_Timer = 8000 + (rand()%2000); }else Frenzy_Timer -= diff; diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_aeonus.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_aeonus.cpp index 17958fb8ce0..d2d5f53e37c 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_aeonus.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_aeonus.cpp @@ -40,15 +40,15 @@ EndScriptData */ struct TRINITY_DLL_DECL boss_aeonusAI : public ScriptedAI { - boss_aeonusAI(Creature *c) : ScriptedAI(c) - { - pInstance = ((ScriptedInstance*)c->GetInstanceData()); - HeroicMode = m_creature->GetMap()->IsHeroic(); - Reset(); - } + boss_aeonusAI(Creature *c) : ScriptedAI(c) + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + HeroicMode = m_creature->GetMap()->IsHeroic(); + Reset(); + } - ScriptedInstance *pInstance; - bool HeroicMode; + ScriptedInstance *pInstance; + bool HeroicMode; uint32 SandBreath_Timer; uint32 TimeStop_Timer; @@ -66,28 +66,28 @@ struct TRINITY_DLL_DECL boss_aeonusAI : public ScriptedAI DoScriptText(SAY_AGGRO, m_creature); } - void MoveInLineOfSight(Unit *who) - { - //Despawn Time Keeper - if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == C_TIME_KEEPER) - { - if (m_creature->IsWithinDistInMap(who,20.0f)) - { - DoScriptText(SAY_BANISH, m_creature); - m_creature->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } - } + void MoveInLineOfSight(Unit *who) + { + //Despawn Time Keeper + if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == C_TIME_KEEPER) + { + if (m_creature->IsWithinDistInMap(who,20.0f)) + { + DoScriptText(SAY_BANISH, m_creature); + m_creature->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } + } - ScriptedAI::MoveInLineOfSight(who); - } + ScriptedAI::MoveInLineOfSight(who); + } void JustDied(Unit *victim) { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) + if (pInstance) { - pInstance->SetData(TYPE_RIFT,DONE); + pInstance->SetData(TYPE_RIFT,DONE); pInstance->SetData(TYPE_MEDIVH,DONE);//FIXME: later should be removed } } @@ -110,7 +110,7 @@ struct TRINITY_DLL_DECL boss_aeonusAI : public ScriptedAI //Sand Breath if (SandBreath_Timer < diff) { - DoCast(m_creature->getVictim(), SPELL_SAND_BREATH); + DoCast(m_creature->getVictim(), SPELL_SAND_BREATH); SandBreath_Timer = 30000; }else SandBreath_Timer -= diff; @@ -124,7 +124,7 @@ struct TRINITY_DLL_DECL boss_aeonusAI : public ScriptedAI //Frenzy if (Frenzy_Timer < diff) { - DoScriptText(EMOTE_FRENZY, m_creature); + DoScriptText(EMOTE_FRENZY, m_creature); DoCast(m_creature, SPELL_ENRAGE); Frenzy_Timer = 120000; }else Frenzy_Timer -= diff; diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_chrono_lord_deja.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_chrono_lord_deja.cpp index 79f5ff10920..106a330ec5e 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_chrono_lord_deja.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_chrono_lord_deja.cpp @@ -41,14 +41,14 @@ EndScriptData */ struct TRINITY_DLL_DECL boss_chrono_lord_dejaAI : public ScriptedAI { boss_chrono_lord_dejaAI(Creature *c) : ScriptedAI(c) - { - pInstance = ((ScriptedInstance*)c->GetInstanceData()); - HeroicMode = m_creature->GetMap()->IsHeroic(); - Reset(); - } + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + HeroicMode = m_creature->GetMap()->IsHeroic(); + Reset(); + } - ScriptedInstance *pInstance; - bool HeroicMode; + ScriptedInstance *pInstance; + bool HeroicMode; uint32 ArcaneBlast_Timer; uint32 TimeLapse_Timer; @@ -64,20 +64,20 @@ struct TRINITY_DLL_DECL boss_chrono_lord_dejaAI : public ScriptedAI DoScriptText(SAY_AGGRO, m_creature); } - void MoveInLineOfSight(Unit *who) - { - //Despawn Time Keeper - if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == C_TIME_KEEPER) - { - if (m_creature->IsWithinDistInMap(who,20.0f)) - { - DoScriptText(SAY_BANISH, m_creature); - m_creature->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } - } + void MoveInLineOfSight(Unit *who) + { + //Despawn Time Keeper + if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == C_TIME_KEEPER) + { + if (m_creature->IsWithinDistInMap(who,20.0f)) + { + DoScriptText(SAY_BANISH, m_creature); + m_creature->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } + } - ScriptedAI::MoveInLineOfSight(who); - } + ScriptedAI::MoveInLineOfSight(who); + } void KilledUnit(Unit *victim) { @@ -92,8 +92,8 @@ struct TRINITY_DLL_DECL boss_chrono_lord_dejaAI : public ScriptedAI { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) - pInstance->SetData(TYPE_RIFT,SPECIAL); + if (pInstance) + pInstance->SetData(TYPE_RIFT,SPECIAL); } void UpdateAI(const uint32 diff) diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_temporus.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_temporus.cpp index cacb460ac92..d55a4c61f98 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_temporus.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_temporus.cpp @@ -39,15 +39,15 @@ EndScriptData */ struct TRINITY_DLL_DECL boss_temporusAI : public ScriptedAI { - boss_temporusAI(Creature *c) : ScriptedAI(c) - { - pInstance = ((ScriptedInstance*)c->GetInstanceData()); - HeroicMode = m_creature->GetMap()->IsHeroic(); - Reset(); - } + boss_temporusAI(Creature *c) : ScriptedAI(c) + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + HeroicMode = m_creature->GetMap()->IsHeroic(); + Reset(); + } - ScriptedInstance *pInstance; - bool HeroicMode; + ScriptedInstance *pInstance; + bool HeroicMode; uint32 Haste_Timer; uint32 SpellReflection_Timer; @@ -79,8 +79,8 @@ struct TRINITY_DLL_DECL boss_temporusAI : public ScriptedAI { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) - pInstance->SetData(TYPE_RIFT,SPECIAL); + if (pInstance) + pInstance->SetData(TYPE_RIFT,SPECIAL); } void MoveInLineOfSight(Unit *who) @@ -88,9 +88,9 @@ struct TRINITY_DLL_DECL boss_temporusAI : public ScriptedAI //Despawn Time Keeper if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == C_TIME_KEEPER) { - if (m_creature->IsWithinDistInMap(who,20.0f)) + if (m_creature->IsWithinDistInMap(who,20.0f)) { - DoScriptText(SAY_BANISH, m_creature); + DoScriptText(SAY_BANISH, m_creature); m_creature->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/dark_portal.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/dark_portal.cpp index 1f12c88e8f3..58228135a01 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/dark_portal.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/dark_portal.cpp @@ -56,293 +56,293 @@ EndContentData */ struct TRINITY_DLL_DECL npc_medivh_bmAI : public ScriptedAI { - npc_medivh_bmAI(Creature *c) : ScriptedAI(c) - { - pInstance = ((ScriptedInstance*)c->GetInstanceData()); - Reset(); - } + npc_medivh_bmAI(Creature *c) : ScriptedAI(c) + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + Reset(); + } - ScriptedInstance *pInstance; + ScriptedInstance *pInstance; - uint32 SpellCorrupt_Timer; - uint32 Check_Timer; + uint32 SpellCorrupt_Timer; + uint32 Check_Timer; - bool Life75; - bool Life50; - bool Life25; + bool Life75; + bool Life50; + bool Life25; - void Reset() - { - SpellCorrupt_Timer = 0; + void Reset() + { + SpellCorrupt_Timer = 0; - if (!pInstance) - return; + if (!pInstance) + return; - if (pInstance->GetData(TYPE_MEDIVH) == IN_PROGRESS) - m_creature->CastSpell(m_creature,SPELL_CHANNEL,true); - else if (m_creature->HasAura(SPELL_CHANNEL,0)) - m_creature->RemoveAura(SPELL_CHANNEL,0); + if (pInstance->GetData(TYPE_MEDIVH) == IN_PROGRESS) + m_creature->CastSpell(m_creature,SPELL_CHANNEL,true); + else if (m_creature->HasAura(SPELL_CHANNEL,0)) + m_creature->RemoveAura(SPELL_CHANNEL,0); - m_creature->CastSpell(m_creature,SPELL_PORTAL_RUNE,true); - } + m_creature->CastSpell(m_creature,SPELL_PORTAL_RUNE,true); + } - void MoveInLineOfSight(Unit *who) - { - if (!pInstance) - return; + void MoveInLineOfSight(Unit *who) + { + if (!pInstance) + return; - if (who->GetTypeId() == TYPEID_PLAYER && m_creature->IsWithinDistInMap(who, 10.0f)) - { - if (pInstance->GetData(TYPE_MEDIVH) == IN_PROGRESS) - return; + if (who->GetTypeId() == TYPEID_PLAYER && m_creature->IsWithinDistInMap(who, 10.0f)) + { + if (pInstance->GetData(TYPE_MEDIVH) == IN_PROGRESS) + return; - DoScriptText(SAY_INTRO, m_creature); - pInstance->SetData(TYPE_MEDIVH,IN_PROGRESS); - m_creature->CastSpell(m_creature,SPELL_CHANNEL,false); - Check_Timer = 5000; - } - else if (who->GetTypeId() == TYPEID_UNIT && m_creature->IsWithinDistInMap(who, 15.0f)) - { - if (pInstance->GetData(TYPE_MEDIVH) != IN_PROGRESS) - return; + DoScriptText(SAY_INTRO, m_creature); + pInstance->SetData(TYPE_MEDIVH,IN_PROGRESS); + m_creature->CastSpell(m_creature,SPELL_CHANNEL,false); + Check_Timer = 5000; + } + else if (who->GetTypeId() == TYPEID_UNIT && m_creature->IsWithinDistInMap(who, 15.0f)) + { + if (pInstance->GetData(TYPE_MEDIVH) != IN_PROGRESS) + return; - uint32 entry = who->GetEntry(); - if (entry == C_ASSAS || entry == C_WHELP || entry == C_CHRON || entry == C_EXECU || entry == C_VANQU) - { - who->StopMoving(); - who->CastSpell(m_creature,SPELL_CORRUPT,false); - } - else if (entry == C_AEONUS) - { - who->StopMoving(); - who->CastSpell(m_creature,SPELL_CORRUPT_AEONUS,false); - } - } - } + uint32 entry = who->GetEntry(); + if (entry == C_ASSAS || entry == C_WHELP || entry == C_CHRON || entry == C_EXECU || entry == C_VANQU) + { + who->StopMoving(); + who->CastSpell(m_creature,SPELL_CORRUPT,false); + } + else if (entry == C_AEONUS) + { + who->StopMoving(); + who->CastSpell(m_creature,SPELL_CORRUPT_AEONUS,false); + } + } + } - void AttackStart(Unit *who) - { - //if (pInstance && pInstance->GetData(TYPE_MEDIVH) == IN_PROGRESS) - //return; + void AttackStart(Unit *who) + { + //if (pInstance && pInstance->GetData(TYPE_MEDIVH) == IN_PROGRESS) + //return; - //ScriptedAI::AttackStart(who); - } + //ScriptedAI::AttackStart(who); + } - void Aggro(Unit *who) {} + void Aggro(Unit *who) {} - void SpellHit(Unit* caster, const SpellEntry* spell) - { - if (SpellCorrupt_Timer) - return; + void SpellHit(Unit* caster, const SpellEntry* spell) + { + if (SpellCorrupt_Timer) + return; - if (spell->Id == SPELL_CORRUPT_AEONUS) - SpellCorrupt_Timer = 1000; + if (spell->Id == SPELL_CORRUPT_AEONUS) + SpellCorrupt_Timer = 1000; - if (spell->Id == SPELL_CORRUPT) - SpellCorrupt_Timer = 3000; - } + if (spell->Id == SPELL_CORRUPT) + SpellCorrupt_Timer = 3000; + } - void JustDied(Unit* Killer) - { - if (Killer->GetEntry() == m_creature->GetEntry()) - return; + void JustDied(Unit* Killer) + { + if (Killer->GetEntry() == m_creature->GetEntry()) + return; - DoScriptText(SAY_DEATH, m_creature); - } + DoScriptText(SAY_DEATH, m_creature); + } - void UpdateAI(const uint32 diff) - { - if (!pInstance) - return; + void UpdateAI(const uint32 diff) + { + if (!pInstance) + return; - if (SpellCorrupt_Timer) - { - if (SpellCorrupt_Timer < diff) - { - pInstance->SetData(TYPE_MEDIVH,SPECIAL); + if (SpellCorrupt_Timer) + { + if (SpellCorrupt_Timer < diff) + { + pInstance->SetData(TYPE_MEDIVH,SPECIAL); - if (m_creature->HasAura(SPELL_CORRUPT_AEONUS,0)) - SpellCorrupt_Timer = 1000; - else if (m_creature->HasAura(SPELL_CORRUPT,0)) - SpellCorrupt_Timer = 3000; - else - SpellCorrupt_Timer = 0; - }else SpellCorrupt_Timer -= diff; - } + if (m_creature->HasAura(SPELL_CORRUPT_AEONUS,0)) + SpellCorrupt_Timer = 1000; + else if (m_creature->HasAura(SPELL_CORRUPT,0)) + SpellCorrupt_Timer = 3000; + else + SpellCorrupt_Timer = 0; + }else SpellCorrupt_Timer -= diff; + } - if (Check_Timer) - { - if (Check_Timer < diff) - { - uint32 pct = pInstance->GetData(DATA_SHIELD); + if (Check_Timer) + { + if (Check_Timer < diff) + { + uint32 pct = pInstance->GetData(DATA_SHIELD); - Check_Timer = 5000; + Check_Timer = 5000; - if (Life25 && pct <= 25) - { - DoScriptText(SAY_WEAK25, m_creature); - Life25 = false; - Check_Timer = 0; - } - else if (Life50 && pct <= 50) - { - DoScriptText(SAY_WEAK50, m_creature); - Life50 = false; - } - else if (Life75 && pct <= 75) - { - DoScriptText(SAY_WEAK75, m_creature); - Life75 = false; - } + if (Life25 && pct <= 25) + { + DoScriptText(SAY_WEAK25, m_creature); + Life25 = false; + Check_Timer = 0; + } + else if (Life50 && pct <= 50) + { + DoScriptText(SAY_WEAK50, m_creature); + Life50 = false; + } + else if (Life75 && pct <= 75) + { + DoScriptText(SAY_WEAK75, m_creature); + Life75 = false; + } - //if we reach this it means event was running but at some point reset. - if (pInstance->GetData(TYPE_MEDIVH) == NOT_STARTED) - { - m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - m_creature->RemoveCorpse(); - m_creature->Respawn(); - return; - } + //if we reach this it means event was running but at some point reset. + if (pInstance->GetData(TYPE_MEDIVH) == NOT_STARTED) + { + m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->RemoveCorpse(); + m_creature->Respawn(); + return; + } - if (pInstance->GetData(TYPE_MEDIVH) == DONE) - { - DoScriptText(SAY_WIN, m_creature); - Check_Timer = 0; - //TODO: start the post-event here - } - }else Check_Timer -= diff; - } + if (pInstance->GetData(TYPE_MEDIVH) == DONE) + { + DoScriptText(SAY_WIN, m_creature); + Check_Timer = 0; + //TODO: start the post-event here + } + }else Check_Timer -= diff; + } - //if (!UpdateVictim()) - //return; + //if (!UpdateVictim()) + //return; - //DoMeleeAttackIfReady(); - } + //DoMeleeAttackIfReady(); + } }; CreatureAI* GetAI_npc_medivh_bm(Creature *_Creature) { - return new npc_medivh_bmAI (_Creature); + return new npc_medivh_bmAI (_Creature); } struct Wave { - uint32 PortalMob[4]; //spawns for portal waves (in order) + uint32 PortalMob[4]; //spawns for portal waves (in order) }; static Wave PortalWaves[]= { - {C_ASSAS, C_WHELP, C_CHRON, 0}, - {C_EXECU, C_CHRON, C_WHELP, C_ASSAS}, - {C_EXECU, C_VANQU, C_CHRON, C_ASSAS} + {C_ASSAS, C_WHELP, C_CHRON, 0}, + {C_EXECU, C_CHRON, C_WHELP, C_ASSAS}, + {C_EXECU, C_VANQU, C_CHRON, C_ASSAS} }; struct TRINITY_DLL_DECL npc_time_riftAI : public ScriptedAI { - npc_time_riftAI(Creature *c) : ScriptedAI(c) - { - pInstance = ((ScriptedInstance*)c->GetInstanceData()); - Reset(); - } + npc_time_riftAI(Creature *c) : ScriptedAI(c) + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + Reset(); + } - ScriptedInstance *pInstance; + ScriptedInstance *pInstance; - uint32 TimeRiftWave_Timer; - uint8 mRiftWaveCount; - uint8 mPortalCount; - uint8 mWaveId; + uint32 TimeRiftWave_Timer; + uint8 mRiftWaveCount; + uint8 mPortalCount; + uint8 mWaveId; - void Reset() - { + void Reset() + { - TimeRiftWave_Timer = 15000; - mRiftWaveCount = 0; + TimeRiftWave_Timer = 15000; + mRiftWaveCount = 0; - if (!pInstance) - return; + if (!pInstance) + return; - mPortalCount = pInstance->GetData(DATA_PORTAL_COUNT); + mPortalCount = pInstance->GetData(DATA_PORTAL_COUNT); - if (mPortalCount < 6) - mWaveId = 0; - else if (mPortalCount > 12) - mWaveId = 2; - else mWaveId = 1; + if (mPortalCount < 6) + mWaveId = 0; + else if (mPortalCount > 12) + mWaveId = 2; + else mWaveId = 1; - } - void Aggro(Unit *who) {} + } + void Aggro(Unit *who) {} - void DoSummonAtRift(uint32 creature_entry) - { - if (!creature_entry) - return; + void DoSummonAtRift(uint32 creature_entry) + { + if (!creature_entry) + return; - if (pInstance->GetData(TYPE_MEDIVH) != IN_PROGRESS) - { - m_creature->InterruptNonMeleeSpells(true); - m_creature->RemoveAllAuras(); - return; - } + if (pInstance->GetData(TYPE_MEDIVH) != IN_PROGRESS) + { + m_creature->InterruptNonMeleeSpells(true); + m_creature->RemoveAllAuras(); + return; + } - float x,y,z; - m_creature->GetRandomPoint(m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(),10.0f,x,y,z); + float x,y,z; + m_creature->GetRandomPoint(m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(),10.0f,x,y,z); - //normalize Z-level if we can, if rift is not at ground level. - z = std::max(m_creature->GetMap()->GetHeight(x, y, MAX_HEIGHT), m_creature->GetMap()->GetWaterLevel(x, y)); + //normalize Z-level if we can, if rift is not at ground level. + z = std::max(m_creature->GetMap()->GetHeight(x, y, MAX_HEIGHT), m_creature->GetMap()->GetWaterLevel(x, y)); - Unit *Summon = m_creature->SummonCreature(creature_entry,x,y,z,m_creature->GetOrientation(), - TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,30000); + Unit *Summon = m_creature->SummonCreature(creature_entry,x,y,z,m_creature->GetOrientation(), + TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,30000); - if (Summon) - { - if (Unit *temp = Unit::GetUnit(*m_creature,pInstance->GetData64(DATA_MEDIVH))) - Summon->AddThreat(temp,0.0f); - } - } + if (Summon) + { + if (Unit *temp = Unit::GetUnit(*m_creature,pInstance->GetData64(DATA_MEDIVH))) + Summon->AddThreat(temp,0.0f); + } + } - void DoSelectSummon() - { - uint32 entry = 0; + void DoSelectSummon() + { + uint32 entry = 0; - if ((mRiftWaveCount > 2 && mWaveId < 1) || mRiftWaveCount > 3) - mRiftWaveCount = 0; + if ((mRiftWaveCount > 2 && mWaveId < 1) || mRiftWaveCount > 3) + mRiftWaveCount = 0; - entry = PortalWaves[mWaveId].PortalMob[mRiftWaveCount]; - debug_log("SD2: npc_time_rift: summoning wave creature (Wave %u, Entry %u).",mRiftWaveCount,entry); + entry = PortalWaves[mWaveId].PortalMob[mRiftWaveCount]; + debug_log("SD2: npc_time_rift: summoning wave creature (Wave %u, Entry %u).",mRiftWaveCount,entry); - ++mRiftWaveCount; + ++mRiftWaveCount; - if (entry == C_WHELP) - { - for(uint8 i = 0; i < 3; i++) - DoSummonAtRift(entry); - }else DoSummonAtRift(entry); - } + if (entry == C_WHELP) + { + for(uint8 i = 0; i < 3; i++) + DoSummonAtRift(entry); + }else DoSummonAtRift(entry); + } - void UpdateAI(const uint32 diff) - { - if (!pInstance) - return; + void UpdateAI(const uint32 diff) + { + if (!pInstance) + return; - if (TimeRiftWave_Timer < diff) - { - DoSelectSummon(); - TimeRiftWave_Timer = 15000; - }else TimeRiftWave_Timer -= diff; + if (TimeRiftWave_Timer < diff) + { + DoSelectSummon(); + TimeRiftWave_Timer = 15000; + }else TimeRiftWave_Timer -= diff; - if (m_creature->IsNonMeleeSpellCasted(false)) - return; + if (m_creature->IsNonMeleeSpellCasted(false)) + return; - debug_log("SD2: npc_time_rift: not casting anylonger, i need to die."); - m_creature->setDeathState(JUST_DIED); + debug_log("SD2: npc_time_rift: not casting anylonger, i need to die."); + m_creature->setDeathState(JUST_DIED); - pInstance->SetData(TYPE_RIFT,SPECIAL); - } + pInstance->SetData(TYPE_RIFT,SPECIAL); + } }; CreatureAI* GetAI_npc_time_rift(Creature *_Creature) { - return new npc_time_riftAI (_Creature); + return new npc_time_riftAI (_Creature); } #define SAY_SAAT_WELCOME -1269019 diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp index e2248b541e9..295da36df23 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp @@ -249,7 +249,7 @@ struct TRINITY_DLL_DECL mob_doomfire_targettingAI : public ScriptedAI || who->GetEntry() == CREATURE_DOOMFIRE || who->GetEntry() == CREATURE_DOOMFIRE_TARGETING || !who->isTargetableForAttack()) return; - m_creature->AddThreat(who, 0.0f); + m_creature->AddThreat(who, 0.0f); } void DamageTaken(Unit *done_by, uint32 &damage) { damage = 0; } @@ -397,9 +397,9 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public ScriptedAI { switch(rand()%2) { - case 0: DoScriptText(SAY_SLAY1, m_creature); break; - case 1: DoScriptText(SAY_SLAY2, m_creature); break; - case 2: DoScriptText(SAY_SLAY3, m_creature); break; + case 0: DoScriptText(SAY_SLAY1, m_creature); break; + case 1: DoScriptText(SAY_SLAY2, m_creature); break; + case 2: DoScriptText(SAY_SLAY3, m_creature); break; } if(victim && (victim->GetTypeId() == TYPEID_PLAYER)) @@ -433,7 +433,7 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public ScriptedAI void JustDied(Unit *victim) { - DoScriptText(SAY_DEATH, m_creature); + DoScriptText(SAY_DEATH, m_creature); if(pInstance) pInstance->SetData(DATA_ARCHIMONDEEVENT, DONE); @@ -493,9 +493,9 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public ScriptedAI Doomfire->AI()->AttackStart(target); if(rand()%2 == 0) - DoScriptText(SAY_DOOMFIRE1, m_creature); - else - DoScriptText(SAY_DOOMFIRE2, m_creature); + DoScriptText(SAY_DOOMFIRE1, m_creature); + else + DoScriptText(SAY_DOOMFIRE2, m_creature); } } @@ -589,13 +589,13 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public ScriptedAI m_creature->GetMotionMaster()->Clear(false); m_creature->GetMotionMaster()->MoveIdle(); Enraged = true; - DoScriptText(SAY_ENRAGE, m_creature); + DoScriptText(SAY_ENRAGE, m_creature); } }else EnrageTimer -= diff; if(CheckDistanceTimer < diff) - { - // To simplify the check, we simply summon a creature in the location and then check how far we are from the creature + { + // To simplify the check, we simply summon a creature in the location and then check how far we are from the creature Creature* Check = m_creature->SummonCreature(CREATURE_CHANNEL_TARGET, NORDRASSIL_X, NORDRASSIL_Y, NORDRASSIL_Z, 0, TEMPSUMMON_TIMED_DESPAWN, 2000); if(Check) { @@ -605,7 +605,7 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public ScriptedAI m_creature->GetMotionMaster()->Clear(false); m_creature->GetMotionMaster()->MoveIdle(); Enraged = true; - DoScriptText(SAY_ENRAGE, m_creature); + DoScriptText(SAY_ENRAGE, m_creature); } } CheckDistanceTimer = 5000; @@ -618,7 +618,7 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public ScriptedAI { m_creature->GetMotionMaster()->Clear(false); m_creature->GetMotionMaster()->MoveIdle(); - //all members of raid must get this buff + //all members of raid must get this buff DoCast(m_creature->getVictim(), SPELL_PROTECTION_OF_ELUNE); HasProtected = true; Enraged = true; @@ -666,9 +666,9 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public ScriptedAI if(AirBurstTimer < diff) { if(rand()%2 == 0) - DoScriptText(SAY_AIR_BURST1, m_creature); - else - DoScriptText(SAY_AIR_BURST2, m_creature); + DoScriptText(SAY_AIR_BURST1, m_creature); + else + DoScriptText(SAY_AIR_BURST2, m_creature); DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_AIR_BURST); diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal.cpp index d8b308d03cd..11d74508537 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal.cpp @@ -134,13 +134,13 @@ bool GossipHello_npc_thrall(Player *player, Creature *_Creature) { hyjalAI* ai = ((hyjalAI*)_Creature->AI()); - if (ai->EventBegun) - return false; + if (ai->EventBegun) + return false; uint32 AnetheronEvent = ai->GetInstanceData(DATA_ANETHERONEVENT); - // Only let them start the Horde phases if Anetheron is dead. - if (AnetheronEvent == DONE) + // Only let them start the Horde phases if Anetheron is dead. + if (AnetheronEvent == DONE) { uint32 KazrogalEvent = ai->GetInstanceData(DATA_KAZROGALEVENT); uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT); @@ -187,37 +187,37 @@ bool GossipSelect_npc_thrall(Player *player, Creature *_Creature, uint32 sender, CreatureAI* GetAI_npc_tyrande_whisperwind(Creature *_Creature) { - hyjalAI* ai = new hyjalAI(_Creature); - ai->Reset(); - ai->EnterEvadeMode(); + hyjalAI* ai = new hyjalAI(_Creature); + ai->Reset(); + ai->EnterEvadeMode(); - return ai; + return ai; } bool GossipHello_npc_tyrande_whisperwind(Player* player, Creature* _Creature) { - hyjalAI* ai = ((hyjalAI*)_Creature->AI()); - uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT); + hyjalAI* ai = ((hyjalAI*)_Creature->AI()); + uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT); - // Only let them get item if Azgalor is dead. - if (AzgalorEvent == DONE && !player->HasItemCount(ITEM_TEAR_OF_GODDESS,1)) - player->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_TYRANDE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - player->SEND_GOSSIP_MENU(907, _Creature->GetGUID()); - return true; + // Only let them get item if Azgalor is dead. + if (AzgalorEvent == DONE && !player->HasItemCount(ITEM_TEAR_OF_GODDESS,1)) + player->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_TYRANDE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + player->SEND_GOSSIP_MENU(907, _Creature->GetGUID()); + return true; } bool GossipSelect_npc_tyrande_whisperwind(Player *player, Creature *_Creature, uint32 sender, uint32 action) { - if (action == GOSSIP_ACTION_INFO_DEF) - { - ItemPosCountVec dest; - uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_TEAR_OF_GODDESS, 1); - if (msg == EQUIP_ERR_OK) - { - player->StoreNewItem(dest, ITEM_TEAR_OF_GODDESS, true); - } - player->SEND_GOSSIP_MENU(907, _Creature->GetGUID()); - } + if (action == GOSSIP_ACTION_INFO_DEF) + { + ItemPosCountVec dest; + uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_TEAR_OF_GODDESS, 1); + if (msg == EQUIP_ERR_OK) + { + player->StoreNewItem(dest, ITEM_TEAR_OF_GODDESS, true); + } + player->SEND_GOSSIP_MENU(907, _Creature->GetGUID()); + } return true; } @@ -244,6 +244,6 @@ void AddSC_hyjal() newscript->Name = "npc_tyrande_whisperwind"; newscript->pGossipHello = &GossipHello_npc_tyrande_whisperwind; newscript->pGossipSelect = &GossipSelect_npc_tyrande_whisperwind; - newscript->GetAI = &GetAI_npc_tyrande_whisperwind; + newscript->GetAI = &GetAI_npc_tyrande_whisperwind; newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp index d0f1858271d..8b3eb0525dc 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp @@ -46,7 +46,7 @@ float HordeBase[4][3]= float AttackArea[2][3]= { {5042.9189, -1776.2562, 1323.0621}, // Alliance - {5510.4815, -2676.7112, 1480.4314} // Horde + {5510.4815, -2676.7112, 1480.4314} // Horde }; hyjalAI::hyjalAI(Creature *c) : ScriptedAI(c) @@ -78,9 +78,9 @@ void hyjalAI::Reset() DoCast(m_creature, SPELL_BRILLIANCE_AURA, true); break; - case 17852: - Faction = 1; - break; + case 17852: + Faction = 1; + break; } //Bools @@ -89,7 +89,7 @@ void hyjalAI::Reset() SecondBossDead = false; Summon = false; bRetreat = false; - Debug = false; + Debug = false; //Flags m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); @@ -132,7 +132,7 @@ void hyjalAI::EnterEvadeMode() if(m_creature->isAlive()) m_creature->GetMotionMaster()->MoveTargetedHome(); - m_creature->SetLootRecipient(NULL); + m_creature->SetLootRecipient(NULL); InCombat = false; } @@ -161,12 +161,12 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3]) Creature* pCreature = m_creature->SummonCreature(entry, SpawnLoc[0], SpawnLoc[1], SpawnLoc[2], 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000); if(pCreature) { - // Increment Enemy Count to be used in World States and instance script - ++EnemyCount; + // Increment Enemy Count to be used in World States and instance script + ++EnemyCount; pCreature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); pCreature->GetMotionMaster()->MovePoint(0, AttackLoc[0],AttackLoc[1],AttackLoc[2]); - pCreature->AddThreat(m_creature, 0.0f); + pCreature->AddThreat(m_creature, 0.0f); DoZoneInCombat(pCreature); // Check if creature is a boss. @@ -181,9 +181,9 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3]) void hyjalAI::SummonNextWave(Wave wave[18], uint32 Count, float Base[4][3]) { - // 1 in 4 chance we give a rally yell. Not sure if the chance is offilike. - if (rand()%4 == 0) - Talk(RALLY); + // 1 in 4 chance we give a rally yell. Not sure if the chance is offilike. + if (rand()%4 == 0) + Talk(RALLY); if(!pInstance) { @@ -278,18 +278,18 @@ void hyjalAI::Talk(uint32 id) uint8 ind = *(index.begin()) + rand()%index.size(); - int32 YellId = 0; + int32 YellId = 0; if(Faction == 0) // Alliance { - YellId = JainaQuotes[ind].textid; + YellId = JainaQuotes[ind].textid; } else if(Faction == 1) // Horde { - YellId = ThrallQuotes[ind].textid; + YellId = ThrallQuotes[ind].textid; } if (YellId) - DoScriptText(YellId, m_creature); + DoScriptText(YellId, m_creature); } void hyjalAI::UpdateWorldState(uint32 id, uint32 state) @@ -366,20 +366,20 @@ void hyjalAI::Retreat() void hyjalAI::UpdateAI(const uint32 diff) { if(bRetreat) - { + { if(RetreatTimer < diff) - { - bRetreat = false; - if(CreatureList.empty()) - return; + { + bRetreat = false; + if(CreatureList.empty()) + return; - for(std::list::iterator itr = CreatureList.begin(); itr != CreatureList.end(); ++itr) - if(Unit* pUnit = Unit::GetUnit(*m_creature, *itr)) - pUnit->SetVisibility(VISIBILITY_OFF); + for(std::list::iterator itr = CreatureList.begin(); itr != CreatureList.end(); ++itr) + if(Unit* pUnit = Unit::GetUnit(*m_creature, *itr)) + pUnit->SetVisibility(VISIBILITY_OFF); - m_creature->SetVisibility(VISIBILITY_OFF); - }else RetreatTimer -= diff; - } + m_creature->SetVisibility(VISIBILITY_OFF); + }else RetreatTimer -= diff; + } if(!EventBegun) return; diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h index ca95b1b99bf..cd6341a0544 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h @@ -45,8 +45,8 @@ struct Wave }; static Wave AllianceWaves[]= // Waves that will be summoned in the Alliance Base -{ // Rage Winterchill Wave 1-8 - {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, 0, 0, 0, 0, 0, 0, 0, 0, 120000, false}, +{ // Rage Winterchill Wave 1-8 + {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, 0, 0, 0, 0, 0, 0, 0, 0, 120000, false}, {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, 0, 0, 0, 0, 0, 0, 120000, false}, {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, 0, 0, 0, 0, 0, 0, 120000, false}, {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 120000, false}, @@ -55,8 +55,8 @@ static Wave AllianceWaves[]= // Waves that will b {GHOUL, GHOUL, GHOUL, GHOUL, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, 0, 0, 0, 0, 0, 0, 120000, false}, {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 180000, false}, // All 8 Waves are summoned, summon Rage Winterchill, next few waves are for Anetheron - {RAGE_WINTERCHILL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true}, - // Anetheron Wave 1-8 + {RAGE_WINTERCHILL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true}, + // Anetheron Wave 1-8 {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, 0, 0, 0, 0, 0, 0, 0, 0, 120000, false}, {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, 0, 0, 0, 0, 0, 0, 120000, false}, {GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 120000, false}, @@ -66,11 +66,11 @@ static Wave AllianceWaves[]= // Waves that will b {CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, BANSHEE, BANSHEE, BANSHEE, BANSHEE, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, 0, 0, 0, 0, 0, 0, 120000, false}, {GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, BANSHEE, BANSHEE, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 180000, false}, // All 8 Waves are summoned, summon Anatheron - {ANETHERON, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true} + {ANETHERON, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true} }; static Wave HordeWaves[]= // Waves that are summoned in the Horde base -{ // Kaz'Rogal Wave 1-8 +{ // Kaz'Rogal Wave 1-8 {GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, BANSHEE, BANSHEE, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 120000, false}, {GHOUL, GHOUL, GHOUL, GHOUL, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, 0, 0, 0, 0, 120000, false}, {GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 120000, false}, @@ -80,8 +80,8 @@ static Wave HordeWaves[]= // Waves that are su {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, NECROMANCER, FROST_WYRM, 0, 0, 120000, false}, {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, BANSHEE, BANSHEE, 180000, false}, // All 8 Waves are summoned, summon Kaz'Rogal, next few waves are for Azgalor - {KAZROGAL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true}, - // Azgalor Wave 1-8 + {KAZROGAL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true}, + // Azgalor Wave 1-8 {ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 120000, false}, {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, FROST_WYRM, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, 0, 0, 0, 0, 120000, false}, {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, 0, 0, 0, 0, 120000, false}, @@ -90,7 +90,7 @@ static Wave HordeWaves[]= // Waves that are su {NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, BANSHEE, BANSHEE, BANSHEE, BANSHEE, BANSHEE, BANSHEE, 0, 0, 0, 0, 120000, false}, {GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, FEL_STALKER, FEL_STALKER, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, 0, 0, 0, 0, 0, 0, 120000, false}, {CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, FEL_STALKER, FEL_STALKER, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, BANSHEE, BANSHEE, BANSHEE, BANSHEE, NECROMANCER, NECROMANCER, 0, 0, 180000, false}, - // All 8 Waves are summoned, summon Azgalor + // All 8 Waves are summoned, summon Azgalor {AZGALOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true} }; @@ -104,7 +104,7 @@ enum TargetType // Used in the spell struct Yells { uint32 id; // Used to determine the type of yell (attack, rally, etc) - int32 textid; // The text id to be yelled + int32 textid; // The text id to be yelled }; enum YellId @@ -120,28 +120,28 @@ enum YellId static Yells JainaQuotes[]= { - {ATTACKED, -1534000}, - {ATTACKED, -1534001}, - {INCOMING, -1534002}, - {BEGIN, -1534003}, - {RALLY, -1534004}, - {RALLY, -1534005}, - {FAILURE, -1534006}, - {SUCCESS, -1534007}, - {DEATH, -1534008}, + {ATTACKED, -1534000}, + {ATTACKED, -1534001}, + {INCOMING, -1534002}, + {BEGIN, -1534003}, + {RALLY, -1534004}, + {RALLY, -1534005}, + {FAILURE, -1534006}, + {SUCCESS, -1534007}, + {DEATH, -1534008}, }; static Yells ThrallQuotes[]= { - {ATTACKED, -1534009}, - {ATTACKED, -1534010}, - {INCOMING, -1534011}, - {BEGIN, -1534012}, - {RALLY, -1534013}, - {RALLY, -1534014}, - {FAILURE, -1534015}, - {SUCCESS, -1534016}, - {DEATH, -1534017}, + {ATTACKED, -1534009}, + {ATTACKED, -1534010}, + {INCOMING, -1534011}, + {BEGIN, -1534012}, + {RALLY, -1534013}, + {RALLY, -1534014}, + {FAILURE, -1534015}, + {SUCCESS, -1534016}, + {DEATH, -1534017}, }; struct TRINITY_DLL_DECL hyjalAI : public ScriptedAI diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp index a678b7f4776..e3b1c5ea0ec 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp @@ -124,7 +124,7 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance break; } - debug_log("SD2: Instance Hyjal: Instance data updated for event %u (Data=%u)",type,data); + debug_log("SD2: Instance Hyjal: Instance data updated for event %u (Data=%u)",type,data); if(data == DONE) SaveToDB(); @@ -162,8 +162,8 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance { OUT_SAVE_INST_DATA; std::ostringstream stream; - stream << Encounters[0] << " " << Encounters[1] << " " << Encounters[2] << " " - << Encounters[3] << " " << Encounters[4]; + stream << Encounters[0] << " " << Encounters[1] << " " << Encounters[2] << " " + << Encounters[3] << " " << Encounters[4]; char* out = new char[stream.str().length() + 1]; strcpy(out, stream.str().c_str()); if(out) @@ -183,11 +183,11 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance return; } - OUT_LOAD_INST_DATA(in); - std::istringstream loadStream; - loadStream.str(in); - loadStream >> Encounters[0] >> Encounters[1] >> Encounters[2] >> Encounters[3] >> Encounters[4]; - for(uint8 i = 0; i < ENCOUNTERS; ++i) + OUT_LOAD_INST_DATA(in); + std::istringstream loadStream; + loadStream.str(in); + loadStream >> Encounters[0] >> Encounters[1] >> Encounters[2] >> Encounters[3] >> Encounters[4]; + for(uint8 i = 0; i < ENCOUNTERS; ++i) if(Encounters[i] == IN_PROGRESS) // Do not load an encounter as IN_PROGRESS - reset it instead. Encounters[i] = NOT_STARTED; OUT_LOAD_INST_DATA_COMPLETE; diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/boss_leutenant_drake.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/boss_leutenant_drake.cpp index 1c8d9a3de6b..86214a50704 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/boss_leutenant_drake.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/boss_leutenant_drake.cpp @@ -31,15 +31,15 @@ EndScriptData */ bool GOHello_go_barrel_old_hillsbrad(Player *player, GameObject* _GO) { - ScriptedInstance* pInstance = (ScriptedInstance*)_GO->GetInstanceData(); + ScriptedInstance* pInstance = (ScriptedInstance*)_GO->GetInstanceData(); - if (!pInstance) - return false; + if (!pInstance) + return false; - if (pInstance->GetData(TYPE_BARREL_DIVERSION) == DONE) - return false; + if (pInstance->GetData(TYPE_BARREL_DIVERSION) == DONE) + return false; - pInstance->SetData(TYPE_BARREL_DIVERSION, IN_PROGRESS); + pInstance->SetData(TYPE_BARREL_DIVERSION, IN_PROGRESS); return false; } diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/instance_old_hillsbrad.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/instance_old_hillsbrad.cpp index 075def2f0d9..02689a7aa11 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/instance_old_hillsbrad.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/instance_old_hillsbrad.cpp @@ -56,42 +56,42 @@ struct TRINITY_DLL_DECL instance_old_hillsbrad : public ScriptedInstance Encounter[i] = NOT_STARTED; } - Player* GetPlayerInMap() - { - Map::PlayerList const& players = instance->GetPlayers(); + Player* GetPlayerInMap() + { + Map::PlayerList const& players = instance->GetPlayers(); - if (!players.isEmpty()) - { - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - if (Player* plr = itr->getSource()) - return plr; - } - } + if (!players.isEmpty()) + { + for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* plr = itr->getSource()) + return plr; + } + } - debug_log("SD2: Instance Old Hillsbrad: GetPlayerInMap, but PlayerList is empty!"); - return NULL; - } + debug_log("SD2: Instance Old Hillsbrad: GetPlayerInMap, but PlayerList is empty!"); + return NULL; + } - void UpdateOHWorldState() - { - Map::PlayerList const& players = instance->GetPlayers(); + void UpdateOHWorldState() + { + Map::PlayerList const& players = instance->GetPlayers(); - if (!players.isEmpty()) - { - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - if (Player* player = itr->getSource()) - { - player->SendUpdateWorldState(WORLD_STATE_OH,mBarrelCount); + if (!players.isEmpty()) + { + for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* player = itr->getSource()) + { + player->SendUpdateWorldState(WORLD_STATE_OH,mBarrelCount); - if (mBarrelCount == 5) - player->KilledMonster(LODGE_QUEST_TRIGGER,0); - } - } - }else - debug_log("SD2: Instance Old Hillsbrad: UpdateOHWorldState, but PlayerList is empty!"); - } + if (mBarrelCount == 5) + player->KilledMonster(LODGE_QUEST_TRIGGER,0); + } + } + }else + debug_log("SD2: Instance Old Hillsbrad: UpdateOHWorldState, but PlayerList is empty!"); + } void OnCreatureCreate(Creature *creature, uint32 creature_entry) { @@ -108,36 +108,36 @@ struct TRINITY_DLL_DECL instance_old_hillsbrad : public ScriptedInstance void SetData(uint32 type, uint32 data) { - Player *player = GetPlayerInMap(); + Player *player = GetPlayerInMap(); - if (!player) - { - debug_log("SD2: Instance Old Hillsbrad: SetData (Type: %u Data %u) cannot find any player.", type, data); - return; - } + if (!player) + { + debug_log("SD2: Instance Old Hillsbrad: SetData (Type: %u Data %u) cannot find any player.", type, data); + return; + } switch(type) { case TYPE_BARREL_DIVERSION: { - if (data == IN_PROGRESS) - { - if (mBarrelCount >= 5) - return; + if (data == IN_PROGRESS) + { + if (mBarrelCount >= 5) + return; - ++mBarrelCount; - UpdateOHWorldState(); + ++mBarrelCount; + UpdateOHWorldState(); - debug_log("SD2: Instance Old Hillsbrad: go_barrel_old_hillsbrad count %u",mBarrelCount); + debug_log("SD2: Instance Old Hillsbrad: go_barrel_old_hillsbrad count %u",mBarrelCount); - Encounter[0] = IN_PROGRESS; + Encounter[0] = IN_PROGRESS; - if (mBarrelCount == 5) - { - player->SummonCreature(DRAKE_ENTRY,2128.43,71.01,64.42,1.74,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000); - Encounter[0] = DONE; - } - } + if (mBarrelCount == 5) + { + player->SummonCreature(DRAKE_ENTRY,2128.43,71.01,64.42,1.74,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000); + Encounter[0] = DONE; + } + } break; } case TYPE_THRALL_EVENT: diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp index 288ccbb57ef..e3aeaf55605 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp @@ -214,7 +214,7 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI Reset(); } - ScriptedInstance *pInstance; + ScriptedInstance *pInstance; uint64 TarethaGUID; @@ -223,10 +223,10 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI void WaypointReached(uint32 i) { - if (!pInstance) - return; + if (!pInstance) + return; - switch( i ) + switch( i ) { case 8: m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); @@ -234,7 +234,7 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI break; case 9: DoScriptText(SAY_TH_ARMORY, m_creature); - m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, THRALL_WEAPON_MODEL); m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, THRALL_WEAPON_INFO); m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+1, 781); @@ -297,7 +297,7 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI //make horsie run off IsOnHold = true; m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - pInstance->SetData(TYPE_THRALL_PART2, DONE); + pInstance->SetData(TYPE_THRALL_PART2, DONE); break; case 64: m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); @@ -325,7 +325,7 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI break; case 91: m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - break; + break; case 93: m_creature->SummonCreature(MOB_ENTRY_INN_PROTECTOR,2652.71,660.31,61.93,1.67,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); m_creature->SummonCreature(MOB_ENTRY_INN_LOOKOUT,2648.96,662.59,61.93,0.79,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); @@ -334,58 +334,58 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI break; case 94: m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA)) - { - if (Unit* Taretha = Unit::GetUnit((*m_creature), TarethaGUID)) - DoScriptText(SAY_TA_ESCAPED, Taretha, m_creature); - } + if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA)) + { + if (Unit* Taretha = Unit::GetUnit((*m_creature), TarethaGUID)) + DoScriptText(SAY_TA_ESCAPED, Taretha, m_creature); + } break; case 95: DoScriptText(SAY_TH_MEET_TARETHA, m_creature); - pInstance->SetData(TYPE_THRALL_PART3,DONE); + pInstance->SetData(TYPE_THRALL_PART3,DONE); IsOnHold = true; break; case 96: DoScriptText(SAY_TH_EPOCH_WONDER, m_creature); - m_creature->HandleEmoteCommand(EMOTE_ONESHOT_TALK); + m_creature->HandleEmoteCommand(EMOTE_ONESHOT_TALK); break; case 97: DoScriptText(SAY_TH_EPOCH_KILL_TARETHA, m_creature); - m_creature->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); + m_creature->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; case 98: //trigger epoch Yell("Thrall! Come outside and face your fate! ....") - //from here, thrall should not never be allowed to move to point 106 which he currently does. + //from here, thrall should not never be allowed to move to point 106 which he currently does. break; case 106: - if (!PlayerGUID) - break; + if (!PlayerGUID) + break; - //trigger taretha to run down outside - if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA)) - { - if (Creature* Taretha = ((Creature*)Unit::GetUnit(*m_creature, TarethaGUID))) - ((npc_escortAI*)(Taretha->AI()))->Start(false, false, true, PlayerGUID); - } + //trigger taretha to run down outside + if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA)) + { + if (Creature* Taretha = ((Creature*)Unit::GetUnit(*m_creature, TarethaGUID))) + ((npc_escortAI*)(Taretha->AI()))->Start(false, false, true, PlayerGUID); + } - //kill credit creature for quest - Map *map = m_creature->GetMap(); - Map::PlayerList const& players = map->GetPlayers(); - if (!players.isEmpty() && map->IsDungeon()) - { - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - if (Player* pPlayer = itr->getSource()) - pPlayer->KilledMonster(20156,m_creature->GetGUID()); - } - } + //kill credit creature for quest + Map *map = m_creature->GetMap(); + Map::PlayerList const& players = map->GetPlayers(); + if (!players.isEmpty() && map->IsDungeon()) + { + for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* pPlayer = itr->getSource()) + pPlayer->KilledMonster(20156,m_creature->GetGUID()); + } + } - //alot will happen here, thrall and taretha talk, erozion appear at spot to explain - m_creature->SummonCreature(EROZION_ENTRY,2646.47,680.416,55.38,4.16,TEMPSUMMON_TIMED_DESPAWN,120000); - break; - } - } + //alot will happen here, thrall and taretha talk, erozion appear at spot to explain + m_creature->SummonCreature(EROZION_ENTRY,2646.47,680.416,55.38,4.16,TEMPSUMMON_TIMED_DESPAWN,120000); + break; + } + } void Reset() @@ -411,9 +411,9 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI { switch(rand()%3) { - case 0: DoScriptText(SAY_TH_LEAVE_COMBAT1, m_creature); break; - case 1: DoScriptText(SAY_TH_LEAVE_COMBAT2, m_creature); break; - case 2: DoScriptText(SAY_TH_LEAVE_COMBAT3, m_creature); break; + case 0: DoScriptText(SAY_TH_LEAVE_COMBAT1, m_creature); break; + case 1: DoScriptText(SAY_TH_LEAVE_COMBAT2, m_creature); break; + case 2: DoScriptText(SAY_TH_LEAVE_COMBAT3, m_creature); break; } } } @@ -437,10 +437,10 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI { switch(rand()%4) { - case 0: DoScriptText(SAY_TH_RANDOM_AGGRO1, m_creature); break; - case 1: DoScriptText(SAY_TH_RANDOM_AGGRO2, m_creature); break; - case 2: DoScriptText(SAY_TH_RANDOM_AGGRO3, m_creature); break; - case 3: DoScriptText(SAY_TH_RANDOM_AGGRO4, m_creature); break; + case 0: DoScriptText(SAY_TH_RANDOM_AGGRO1, m_creature); break; + case 1: DoScriptText(SAY_TH_RANDOM_AGGRO2, m_creature); break; + case 2: DoScriptText(SAY_TH_RANDOM_AGGRO3, m_creature); break; + case 3: DoScriptText(SAY_TH_RANDOM_AGGRO4, m_creature); break; } if( m_creature->IsMounted() ) { @@ -449,45 +449,45 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI } } - void JustSummoned(Creature* summoned) - { - switch(summoned->GetEntry()) - { - //TODO: make Scarloc start into event instead, and not start attack directly - case MOB_ENTRY_BARN_GUARDSMAN: - case MOB_ENTRY_BARN_PROTECTOR: - case MOB_ENTRY_BARN_LOOKOUT: - case SKARLOC_MOUNT: - case EROZION_ENTRY: - break; - default: - summoned->AI()->AttackStart(m_creature); - break; - } - } + void JustSummoned(Creature* summoned) + { + switch(summoned->GetEntry()) + { + //TODO: make Scarloc start into event instead, and not start attack directly + case MOB_ENTRY_BARN_GUARDSMAN: + case MOB_ENTRY_BARN_PROTECTOR: + case MOB_ENTRY_BARN_LOOKOUT: + case SKARLOC_MOUNT: + case EROZION_ENTRY: + break; + default: + summoned->AI()->AttackStart(m_creature); + break; + } + } void KilledUnit(Unit *victim) { switch(rand()%3) { - case 0: DoScriptText(SAY_TH_RANDOM_KILL1, m_creature); break; - case 1: DoScriptText(SAY_TH_RANDOM_KILL2, m_creature); break; - case 2: DoScriptText(SAY_TH_RANDOM_KILL3, m_creature); break; + case 0: DoScriptText(SAY_TH_RANDOM_KILL1, m_creature); break; + case 1: DoScriptText(SAY_TH_RANDOM_KILL2, m_creature); break; + case 2: DoScriptText(SAY_TH_RANDOM_KILL3, m_creature); break; } } void JustDied(Unit *slayer) { - if (pInstance) - pInstance->SetData(TYPE_THRALL_EVENT,FAIL); + if (pInstance) + pInstance->SetData(TYPE_THRALL_EVENT,FAIL); - // Don't do a yell if he kills self (if player goes too far or at the end). + // Don't do a yell if he kills self (if player goes too far or at the end). if(slayer == m_creature) return; switch(rand()%2) { - case 0: DoScriptText(SAY_TH_RANDOM_DIE1, m_creature); break; - case 1: DoScriptText(SAY_TH_RANDOM_DIE2, m_creature); break; + case 0: DoScriptText(SAY_TH_RANDOM_DIE1, m_creature); break; + case 1: DoScriptText(SAY_TH_RANDOM_DIE2, m_creature); break; } } @@ -495,16 +495,16 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI { npc_escortAI::UpdateAI(diff); - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; //TODO: add his abilities'n-crap here if( !LowHp && ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 20) ) { switch(rand()%2) { - case 0: DoScriptText(SAY_TH_RANDOM_LOW_HP1, m_creature); break; - case 1: DoScriptText(SAY_TH_RANDOM_LOW_HP2, m_creature); break; + case 0: DoScriptText(SAY_TH_RANDOM_LOW_HP1, m_creature); break; + case 1: DoScriptText(SAY_TH_RANDOM_LOW_HP2, m_creature); break; } LowHp = true; } @@ -670,15 +670,15 @@ CreatureAI* GetAI_npc_thrall_old_hillsbrad(Creature *_Creature) bool GossipHello_npc_thrall_old_hillsbrad(Player *player, Creature *_Creature) { if( _Creature->isQuestGiver() ) - { - player->PrepareQuestMenu( _Creature->GetGUID() ); - player->SendPreparedQuest(_Creature->GetGUID()); - } + { + player->PrepareQuestMenu( _Creature->GetGUID() ); + player->SendPreparedQuest(_Creature->GetGUID()); + } ScriptedInstance* pInstance = ((ScriptedInstance*)_Creature->GetInstanceData()); if( pInstance ) { - if (pInstance->GetData(TYPE_BARREL_DIVERSION) == DONE && !pInstance->GetData(TYPE_THRALL_EVENT)) + if (pInstance->GetData(TYPE_BARREL_DIVERSION) == DONE && !pInstance->GetData(TYPE_THRALL_EVENT)) { player->ADD_GOSSIP_ITEM( 0, "[PH] Start walking.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(GOSSIP_ID_START, _Creature->GetGUID()); @@ -772,10 +772,10 @@ struct TRINITY_DLL_DECL npc_tarethaAI : public npc_escortAI void Reset() {} void Aggro(Unit* who) {} - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + } }; CreatureAI* GetAI_npc_taretha(Creature *_Creature) { @@ -821,15 +821,15 @@ bool GossipSelect_npc_taretha(Player *player, Creature *_Creature, uint32 sender pInstance->SetData(TYPE_THRALL_PART4,IN_PROGRESS); _Creature->SummonCreature(ENTRY_EPOCH,2639.13,698.55,65.43,4.59,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000); - if (uint64 ThrallGUID = pInstance->GetData64(DATA_THRALL)) - { - Creature* Thrall = ((Creature*)Unit::GetUnit((*_Creature), ThrallGUID)); - if(Thrall) - ((npc_thrall_old_hillsbradAI*)Thrall->AI())->StartWP(); - } - } - } - return true; + if (uint64 ThrallGUID = pInstance->GetData64(DATA_THRALL)) + { + Creature* Thrall = ((Creature*)Unit::GetUnit((*_Creature), ThrallGUID)); + if(Thrall) + ((npc_thrall_old_hillsbradAI*)Thrall->AI())->StartWP(); + } + } + } + return true; } /*###### @@ -863,6 +863,6 @@ void AddSC_old_hillsbrad() newscript->Name="npc_taretha"; newscript->pGossipHello = &GossipHello_npc_taretha; newscript->pGossipSelect = &GossipSelect_npc_taretha; - newscript->GetAI = &GetAI_npc_taretha; + newscript->GetAI = &GetAI_npc_taretha; newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp index c626a8d4544..d8416e37a50 100644 --- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp +++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp @@ -42,38 +42,38 @@ EndScriptData */ #define SPELL_POWER_OF_CARIBDIS 38451 #define SPELL_ENRAGE 24318 #define SPELL_SEAR_NOVA 38445 -#define SPELL_BLESSING_OF_THE_TIDES 38449 +#define SPELL_BLESSING_OF_THE_TIDES 38449 //Sharkkis spells #define SPELL_LEECHING_THROW 29436 #define SPELL_THE_BEAST_WITHIN 38373 -#define SPELL_MULTISHOT 38366 -#define SPELL_SUMMON_FATHOM_LURKER 38433 -#define SPELL_SUMMON_FATHOM_SPOREBAT 38431 +#define SPELL_MULTISHOT 38366 +#define SPELL_SUMMON_FATHOM_LURKER 38433 +#define SPELL_SUMMON_FATHOM_SPOREBAT 38431 #define SPELL_PET_ENRAGE 19574 //Tidalvess spells -#define SPELL_FROST_SHOCK 38234 -#define SPELL_SPITFIRE_TOTEM 38236 -#define SPELL_POISON_CLEANSING_TOTEM 38306 -#define SPELL_POISON_CLEANSING_EFFECT 8167 -#define SPELL_EARTHBIND_TOTEM 38304 -#define SPELL_EARTHBIND_TOTEM_EFFECT 6474 -#define SPELL_WINDFURY_WEAPON 38184 +#define SPELL_FROST_SHOCK 38234 +#define SPELL_SPITFIRE_TOTEM 38236 +#define SPELL_POISON_CLEANSING_TOTEM 38306 +#define SPELL_POISON_CLEANSING_EFFECT 8167 +#define SPELL_EARTHBIND_TOTEM 38304 +#define SPELL_EARTHBIND_TOTEM_EFFECT 6474 +#define SPELL_WINDFURY_WEAPON 38184 //Caribdis Spells -#define SPELL_WATER_BOLT_VOLLEY 38335 -#define SPELL_TIDAL_SURGE 38358 -#define SPELL_TIDAL_SURGE_FREEZE 38357 -#define SPELL_HEAL 38330 -#define SPELL_SUMMON_CYCLONE 38337 -#define SPELL_CYCLONE_CYCLONE 29538 +#define SPELL_WATER_BOLT_VOLLEY 38335 +#define SPELL_TIDAL_SURGE 38358 +#define SPELL_TIDAL_SURGE_FREEZE 38357 +#define SPELL_HEAL 38330 +#define SPELL_SUMMON_CYCLONE 38337 +#define SPELL_CYCLONE_CYCLONE 29538 //Yells and Quotes -#define SAY_GAIN_BLESSING_OF_TIDES "Your overconfidence will be your undoing! Guards, lend me your strength!" -#define SOUND_GAIN_BLESSING_OF_TIDES 11278 -#define SAY_MISC "Alana be'lendor!" //don't know what use this -#define SOUND_MISC 11283 +#define SAY_GAIN_BLESSING_OF_TIDES "Your overconfidence will be your undoing! Guards, lend me your strength!" +#define SOUND_GAIN_BLESSING_OF_TIDES 11278 +#define SAY_MISC "Alana be'lendor!" //don't know what use this +#define SOUND_MISC 11283 //Summoned Unit GUIDs #define CREATURE_CYCLONE 22104 @@ -106,9 +106,9 @@ struct TRINITY_DLL_DECL boss_fathomlord_karathressAI : public ScriptedAI uint32 CataclysmicBolt_Timer; uint32 Enrage_Timer; - uint32 SearNova_Timer; + uint32 SearNova_Timer; - bool BlessingOfTides; + bool BlessingOfTides; uint64 Advisors[3]; @@ -116,38 +116,38 @@ struct TRINITY_DLL_DECL boss_fathomlord_karathressAI : public ScriptedAI { CataclysmicBolt_Timer = 10000; Enrage_Timer = 600000; //10 minutes - SearNova_Timer = 20000+rand()%40000; // 20 - 60 seconds + SearNova_Timer = 20000+rand()%40000; // 20 - 60 seconds - BlessingOfTides = false; + BlessingOfTides = false; - if(pInstance) - { - uint64 RAdvisors[3]; - RAdvisors[0] = pInstance->GetData64(DATA_SHARKKIS); - RAdvisors[1] = pInstance->GetData64(DATA_TIDALVESS); - RAdvisors[2] = pInstance->GetData64(DATA_CARIBDIS); - //Respawn of the 3 Advisors - Creature* pAdvisor = NULL; - for( int i=0; i<3; i++ ) + if(pInstance) + { + uint64 RAdvisors[3]; + RAdvisors[0] = pInstance->GetData64(DATA_SHARKKIS); + RAdvisors[1] = pInstance->GetData64(DATA_TIDALVESS); + RAdvisors[2] = pInstance->GetData64(DATA_CARIBDIS); + //Respawn of the 3 Advisors + Creature* pAdvisor = NULL; + for( int i=0; i<3; i++ ) - if(RAdvisors[i]) - { - pAdvisor = ((Creature*)Unit::GetUnit((*m_creature), RAdvisors[i])); - if(pAdvisor && !pAdvisor->isAlive()) - { - pAdvisor->Respawn(); - pAdvisor->AI()->EnterEvadeMode(); - pAdvisor->GetMotionMaster()->MoveTargetedHome(); - } - } - pInstance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED); - } + if(RAdvisors[i]) + { + pAdvisor = ((Creature*)Unit::GetUnit((*m_creature), RAdvisors[i])); + if(pAdvisor && !pAdvisor->isAlive()) + { + pAdvisor->Respawn(); + pAdvisor->AI()->EnterEvadeMode(); + pAdvisor->GetMotionMaster()->MoveTargetedHome(); + } + } + pInstance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED); + } - } + } void EventSharkkisDeath() { @@ -185,7 +185,7 @@ struct TRINITY_DLL_DECL boss_fathomlord_karathressAI : public ScriptedAI GetAdvisors(); DoScriptText(SAY_AGGRO, m_creature); - DoZoneInCombat(); + DoZoneInCombat(); pInstance->SetData64(DATA_KARATHRESSEVENT_STARTER, who->GetGUID()); pInstance->SetData(DATA_KARATHRESSEVENT, IN_PROGRESS); @@ -237,10 +237,10 @@ struct TRINITY_DLL_DECL boss_fathomlord_karathressAI : public ScriptedAI //someone evaded! if (pInstance && !pInstance->GetData(DATA_KARATHRESSEVENT)) - { + { EnterEvadeMode(); - return; - } + return; + } //CataclysmicBolt_Timer if (CataclysmicBolt_Timer < diff) @@ -258,12 +258,12 @@ struct TRINITY_DLL_DECL boss_fathomlord_karathressAI : public ScriptedAI CataclysmicBolt_Timer = 10000; }else CataclysmicBolt_Timer -= diff; - //SearNova_Timer - if(SearNova_Timer < diff) - { - DoCast(m_creature->getVictim(), SPELL_SEAR_NOVA); - SearNova_Timer = 20000+rand()%40000; - }else SearNova_Timer -= diff; + //SearNova_Timer + if(SearNova_Timer < diff) + { + DoCast(m_creature->getVictim(), SPELL_SEAR_NOVA); + SearNova_Timer = 20000+rand()%40000; + }else SearNova_Timer -= diff; //Enrage_Timer if (Enrage_Timer < diff) @@ -272,32 +272,32 @@ struct TRINITY_DLL_DECL boss_fathomlord_karathressAI : public ScriptedAI Enrage_Timer = 90000; }else Enrage_Timer -= diff; - //Blessing of Tides Trigger - if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 75 && !BlessingOfTides) - { - BlessingOfTides = true; - bool continueTriggering; - Creature* Advisor; - for(uint8 i = 0; i < 4; ++i) - if(Advisors[i]) - { - Advisor = ((Creature*)Unit::GetUnit(*m_creature, Advisors[i])); - if(Advisor) - { - if(Advisor->isAlive()) - { - continueTriggering = true; - break; - } - } - } - if( continueTriggering ) - { - DoCast(m_creature, SPELL_BLESSING_OF_THE_TIDES); - DoYell(SAY_GAIN_BLESSING_OF_TIDES, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(m_creature, SOUND_GAIN_BLESSING_OF_TIDES); - } - } + //Blessing of Tides Trigger + if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 75 && !BlessingOfTides) + { + BlessingOfTides = true; + bool continueTriggering; + Creature* Advisor; + for(uint8 i = 0; i < 4; ++i) + if(Advisors[i]) + { + Advisor = ((Creature*)Unit::GetUnit(*m_creature, Advisors[i])); + if(Advisor) + { + if(Advisor->isAlive()) + { + continueTriggering = true; + break; + } + } + } + if( continueTriggering ) + { + DoCast(m_creature, SPELL_BLESSING_OF_THE_TIDES); + DoYell(SAY_GAIN_BLESSING_OF_TIDES, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(m_creature, SOUND_GAIN_BLESSING_OF_TIDES); + } + } DoMeleeAttackIfReady(); } @@ -316,30 +316,30 @@ struct TRINITY_DLL_DECL boss_fathomguard_sharkkisAI : public ScriptedAI uint32 LeechingThrow_Timer; uint32 TheBeastWithin_Timer; - uint32 Multishot_Timer; - uint32 Pet_Timer; + uint32 Multishot_Timer; + uint32 Pet_Timer; - bool pet; + bool pet; - uint64 SummonedPet; + uint64 SummonedPet; void Reset() { LeechingThrow_Timer = 20000; TheBeastWithin_Timer = 30000; - Multishot_Timer = 15000; - Pet_Timer = 10000; + Multishot_Timer = 15000; + Pet_Timer = 10000; - pet = false; + pet = false; - Creature *Pet = (Creature*) Unit::GetUnit(*m_creature, SummonedPet); - if( Pet && Pet->isAlive() ) - { - Pet->DealDamage( Pet, Pet->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false ); - } + Creature *Pet = (Creature*) Unit::GetUnit(*m_creature, SummonedPet); + if( Pet && Pet->isAlive() ) + { + Pet->DealDamage( Pet, Pet->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false ); + } - SummonedPet = 0; + SummonedPet = 0; if( pInstance ) pInstance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED); @@ -354,7 +354,7 @@ struct TRINITY_DLL_DECL boss_fathomguard_sharkkisAI : public ScriptedAI if (Karathress) ((boss_fathomlord_karathressAI*)Karathress->AI())->EventSharkkisDeath(); - ((boss_fathomlord_karathressAI*)Karathress->AI())->EventSharkkisDeath(); + ((boss_fathomlord_karathressAI*)Karathress->AI())->EventSharkkisDeath(); } } @@ -386,10 +386,10 @@ struct TRINITY_DLL_DECL boss_fathomguard_sharkkisAI : public ScriptedAI //someone evaded! if (pInstance && !pInstance->GetData(DATA_KARATHRESSEVENT)) - { - EnterEvadeMode(); - return; - } + { + EnterEvadeMode(); + return; + } //LeechingThrow_Timer if(LeechingThrow_Timer < diff) @@ -398,51 +398,51 @@ struct TRINITY_DLL_DECL boss_fathomguard_sharkkisAI : public ScriptedAI LeechingThrow_Timer = 20000; }else LeechingThrow_Timer -= diff; - //Multishot_Timer - if(Multishot_Timer < diff) - { - DoCast(m_creature->getVictim(), SPELL_MULTISHOT); - Multishot_Timer = 20000; - }else Multishot_Timer -= diff; + //Multishot_Timer + if(Multishot_Timer < diff) + { + DoCast(m_creature->getVictim(), SPELL_MULTISHOT); + Multishot_Timer = 20000; + }else Multishot_Timer -= diff; - //TheBeastWithin_Timer - if(TheBeastWithin_Timer < diff) - { - DoCast(m_creature, SPELL_THE_BEAST_WITHIN); - Creature *Pet = (Creature*) Unit::GetUnit(*m_creature, SummonedPet); - if( Pet && Pet->isAlive() ) - { - Pet->CastSpell( Pet, SPELL_PET_ENRAGE, true ); - } - TheBeastWithin_Timer = 30000; - }else TheBeastWithin_Timer -= diff; + //TheBeastWithin_Timer + if(TheBeastWithin_Timer < diff) + { + DoCast(m_creature, SPELL_THE_BEAST_WITHIN); + Creature *Pet = (Creature*) Unit::GetUnit(*m_creature, SummonedPet); + if( Pet && Pet->isAlive() ) + { + Pet->CastSpell( Pet, SPELL_PET_ENRAGE, true ); + } + TheBeastWithin_Timer = 30000; + }else TheBeastWithin_Timer -= diff; - //Pet_Timer - if(Pet_Timer < diff && pet == false) - { - pet = true; - //uint32 spell_id; - uint32 pet_id; - switch( rand()%2 ) - { - case 0: - //spell_id = SPELL_SUMMON_FATHOM_LURKER; - pet_id = CREATURE_FATHOM_LURKER; - break; - case 1: - //spell_id = SPELL_SUMMON_FATHOM_SPOREBAT; - pet_id = CREATURE_FATHOM_SPOREBAT; - break; - } - //DoCast( m_creature, spell_id, true ); - Creature *Pet = DoSpawnCreature(pet_id,0,0,0,0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000 ); - Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0); - if (Pet && target) - { - Pet->AI()->AttackStart(target); - SummonedPet = Pet->GetGUID(); - } - }else Pet_Timer -= diff; + //Pet_Timer + if(Pet_Timer < diff && pet == false) + { + pet = true; + //uint32 spell_id; + uint32 pet_id; + switch( rand()%2 ) + { + case 0: + //spell_id = SPELL_SUMMON_FATHOM_LURKER; + pet_id = CREATURE_FATHOM_LURKER; + break; + case 1: + //spell_id = SPELL_SUMMON_FATHOM_SPOREBAT; + pet_id = CREATURE_FATHOM_SPOREBAT; + break; + } + //DoCast( m_creature, spell_id, true ); + Creature *Pet = DoSpawnCreature(pet_id,0,0,0,0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000 ); + Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0); + if (Pet && target) + { + Pet->AI()->AttackStart(target); + SummonedPet = Pet->GetGUID(); + } + }else Pet_Timer -= diff; DoMeleeAttackIfReady(); } @@ -460,16 +460,16 @@ struct TRINITY_DLL_DECL boss_fathomguard_tidalvessAI : public ScriptedAI ScriptedInstance* pInstance; uint32 FrostShock_Timer; - uint32 Spitfire_Timer; - uint32 PoisonCleansing_Timer; - uint32 Earthbind_Timer; + uint32 Spitfire_Timer; + uint32 PoisonCleansing_Timer; + uint32 Earthbind_Timer; void Reset() { FrostShock_Timer = 25000; - Spitfire_Timer = 60000; - PoisonCleansing_Timer = 30000; - Earthbind_Timer = 45000; + Spitfire_Timer = 60000; + PoisonCleansing_Timer = 30000; + Earthbind_Timer = 45000; if (pInstance) pInstance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED); @@ -483,8 +483,8 @@ struct TRINITY_DLL_DECL boss_fathomguard_tidalvessAI : public ScriptedAI Karathress = (Creature*)(Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_KARATHRESS))); if (Karathress) - if(!m_creature->isAlive() && Karathress) - ((boss_fathomlord_karathressAI*)Karathress->AI())->EventTidalvessDeath(); + if(!m_creature->isAlive() && Karathress) + ((boss_fathomlord_karathressAI*)Karathress->AI())->EventTidalvessDeath(); } } @@ -495,7 +495,7 @@ struct TRINITY_DLL_DECL boss_fathomguard_tidalvessAI : public ScriptedAI pInstance->SetData64(DATA_KARATHRESSEVENT_STARTER, who->GetGUID()); pInstance->SetData(DATA_KARATHRESSEVENT, IN_PROGRESS); } - DoCast(m_creature, SPELL_WINDFURY_WEAPON); + DoCast(m_creature, SPELL_WINDFURY_WEAPON); } void UpdateAI(const uint32 diff) @@ -517,15 +517,15 @@ struct TRINITY_DLL_DECL boss_fathomguard_tidalvessAI : public ScriptedAI //someone evaded! if (pInstance && !pInstance->GetData(DATA_KARATHRESSEVENT)) - { + { EnterEvadeMode(); - return; - } + return; + } - if( !m_creature->HasAura(SPELL_WINDFURY_WEAPON, 0) ) - { - DoCast(m_creature, SPELL_WINDFURY_WEAPON); - } + if( !m_creature->HasAura(SPELL_WINDFURY_WEAPON, 0) ) + { + DoCast(m_creature, SPELL_WINDFURY_WEAPON); + } //FrostShock_Timer if (FrostShock_Timer < diff) @@ -534,31 +534,31 @@ struct TRINITY_DLL_DECL boss_fathomguard_tidalvessAI : public ScriptedAI FrostShock_Timer = 25000+rand()%5000; }else FrostShock_Timer -= diff; - //Spitfire_Timer - if(Spitfire_Timer < diff) - { - DoCast(m_creature, SPELL_SPITFIRE_TOTEM); - Unit *SpitfireTotem = Unit::GetUnit( *m_creature, CREATURE_SPITFIRE_TOTEM ); - if( SpitfireTotem ) - { - ((Creature*)SpitfireTotem)->AI()->AttackStart( m_creature->getVictim() ); - } - Spitfire_Timer = 60000; - }else Spitfire_Timer -= diff; + //Spitfire_Timer + if(Spitfire_Timer < diff) + { + DoCast(m_creature, SPELL_SPITFIRE_TOTEM); + Unit *SpitfireTotem = Unit::GetUnit( *m_creature, CREATURE_SPITFIRE_TOTEM ); + if( SpitfireTotem ) + { + ((Creature*)SpitfireTotem)->AI()->AttackStart( m_creature->getVictim() ); + } + Spitfire_Timer = 60000; + }else Spitfire_Timer -= diff; - //PoisonCleansing_Timer - if(PoisonCleansing_Timer < diff) - { - DoCast(m_creature, SPELL_POISON_CLEANSING_TOTEM); - PoisonCleansing_Timer = 30000; - }else PoisonCleansing_Timer -= diff; + //PoisonCleansing_Timer + if(PoisonCleansing_Timer < diff) + { + DoCast(m_creature, SPELL_POISON_CLEANSING_TOTEM); + PoisonCleansing_Timer = 30000; + }else PoisonCleansing_Timer -= diff; - //Earthbind_Timer - if(Earthbind_Timer < diff) - { - DoCast(m_creature, SPELL_EARTHBIND_TOTEM); - Earthbind_Timer = 45000; - }else Earthbind_Timer -= diff; + //Earthbind_Timer + if(Earthbind_Timer < diff) + { + DoCast(m_creature, SPELL_EARTHBIND_TOTEM); + Earthbind_Timer = 45000; + }else Earthbind_Timer -= diff; DoMeleeAttackIfReady(); } @@ -578,14 +578,14 @@ struct TRINITY_DLL_DECL boss_fathomguard_caribdisAI : public ScriptedAI uint32 WaterBoltVolley_Timer; uint32 TidalSurge_Timer; uint32 Heal_Timer; - uint32 Cyclone_Timer; + uint32 Cyclone_Timer; void Reset() { WaterBoltVolley_Timer = 35000; TidalSurge_Timer = 15000+rand()%5000; Heal_Timer = 55000; - Cyclone_Timer = 30000+rand()%10000; + Cyclone_Timer = 30000+rand()%10000; if (pInstance) pInstance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED); @@ -599,8 +599,8 @@ struct TRINITY_DLL_DECL boss_fathomguard_caribdisAI : public ScriptedAI Karathress = (Creature*)(Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_KARATHRESS))); if (Karathress) - if(!m_creature->isAlive() && Karathress) - ((boss_fathomlord_karathressAI*)Karathress->AI())->EventCaribdisDeath(); + if(!m_creature->isAlive() && Karathress) + ((boss_fathomlord_karathressAI*)Karathress->AI())->EventCaribdisDeath(); } } @@ -632,10 +632,10 @@ struct TRINITY_DLL_DECL boss_fathomguard_caribdisAI : public ScriptedAI //someone evaded! if (pInstance && !pInstance->GetData(DATA_KARATHRESSEVENT)) - { + { EnterEvadeMode(); - return; - } + return; + } //WaterBoltVolley_Timer if (WaterBoltVolley_Timer < diff) @@ -648,69 +648,69 @@ struct TRINITY_DLL_DECL boss_fathomguard_caribdisAI : public ScriptedAI if (TidalSurge_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_TIDAL_SURGE); - // Hacky way to do it - won't trigger elseways - m_creature->getVictim()->CastSpell( m_creature->getVictim(), SPELL_TIDAL_SURGE_FREEZE, true ); + // Hacky way to do it - won't trigger elseways + m_creature->getVictim()->CastSpell( m_creature->getVictim(), SPELL_TIDAL_SURGE_FREEZE, true ); TidalSurge_Timer = 15000+rand()%5000; }else TidalSurge_Timer -= diff; - //Cyclone_Timer - if(Cyclone_Timer < diff) - { - //DoCast(m_creature, SPELL_SUMMON_CYCLONE); // Doesn't work - Cyclone_Timer = 30000+rand()%10000; - Creature *Cyclone = m_creature->SummonCreature(CREATURE_CYCLONE, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), (rand()%5), TEMPSUMMON_TIMED_DESPAWN, 15000); - if( Cyclone ) - { - ((Creature*)Cyclone)->SetFloatValue(OBJECT_FIELD_SCALE_X, 3.0f); - Cyclone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - Cyclone->setFaction(m_creature->getFaction()); - Cyclone->CastSpell(Cyclone, SPELL_CYCLONE_CYCLONE, true); - Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0); - if( target ) - { - Cyclone->AI()->AttackStart(target); - } - } - }else Cyclone_Timer -= diff; + //Cyclone_Timer + if(Cyclone_Timer < diff) + { + //DoCast(m_creature, SPELL_SUMMON_CYCLONE); // Doesn't work + Cyclone_Timer = 30000+rand()%10000; + Creature *Cyclone = m_creature->SummonCreature(CREATURE_CYCLONE, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), (rand()%5), TEMPSUMMON_TIMED_DESPAWN, 15000); + if( Cyclone ) + { + ((Creature*)Cyclone)->SetFloatValue(OBJECT_FIELD_SCALE_X, 3.0f); + Cyclone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + Cyclone->setFaction(m_creature->getFaction()); + Cyclone->CastSpell(Cyclone, SPELL_CYCLONE_CYCLONE, true); + Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0); + if( target ) + { + Cyclone->AI()->AttackStart(target); + } + } + }else Cyclone_Timer -= diff; - //Heal_Timer - if(Heal_Timer < diff) - { - // It can be cast on any of the mobs - Unit *pUnit = NULL; + //Heal_Timer + if(Heal_Timer < diff) + { + // It can be cast on any of the mobs + Unit *pUnit = NULL; - while( pUnit == NULL || !pUnit->isAlive() ) - { - pUnit = selectAdvisorUnit(); - } + while( pUnit == NULL || !pUnit->isAlive() ) + { + pUnit = selectAdvisorUnit(); + } - if(pUnit && pUnit->isAlive()) - DoCast(pUnit, SPELL_HEAL); - Heal_Timer = 60000; - }else Heal_Timer -= diff; + if(pUnit && pUnit->isAlive()) + DoCast(pUnit, SPELL_HEAL); + Heal_Timer = 60000; + }else Heal_Timer -= diff; DoMeleeAttackIfReady(); } - Unit* selectAdvisorUnit() - { - Unit* pUnit; - if(pInstance) - { - switch(rand()%4) - { - case 0: - pUnit = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_KARATHRESS)); - break; - case 1: - pUnit = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_SHARKKIS)); - break; - case 2: - pUnit = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_TIDALVESS)); - break; - case 3: - pUnit = m_creature; - break; + Unit* selectAdvisorUnit() + { + Unit* pUnit; + if(pInstance) + { + switch(rand()%4) + { + case 0: + pUnit = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_KARATHRESS)); + break; + case 1: + pUnit = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_SHARKKIS)); + break; + case 2: + pUnit = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_TIDALVESS)); + break; + case 3: + pUnit = m_creature; + break; } }else pUnit = m_creature; diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_hydross_the_unstable.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_hydross_the_unstable.cpp index 6c28e61e863..e9809b0a60f 100644 --- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_hydross_the_unstable.cpp +++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_hydross_the_unstable.cpp @@ -83,7 +83,7 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI } ScriptedInstance* pInstance; - uint64 beams[2]; + uint64 beams[2]; uint32 PosCheck_Timer; uint32 MarkOfHydross_Timer; uint32 MarkOfCorruption_Timer; @@ -93,14 +93,14 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI uint32 MarkOfCorruption_Count; uint32 EnrageTimer; bool CorruptedForm; - bool beam; - SummonList Summons; + bool beam; + SummonList Summons; void Reset() { - DeSummonBeams(); - beams[0] = 0; - beams[1] = 0; + DeSummonBeams(); + beams[0] = 0; + beams[1] = 0; PosCheck_Timer = 2500; MarkOfHydross_Timer = 15000; MarkOfCorruption_Timer = 15000; @@ -119,41 +119,41 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI if (pInstance) pInstance->SetData(DATA_HYDROSSTHEUNSTABLEEVENT, NOT_STARTED); - beam = false; - Summons.DespawnAll(); + beam = false; + Summons.DespawnAll(); } - void SummonBeams() - { - Creature* beamer = m_creature->SummonCreature(ENTRY_BEAM_DUMMY,-258.333,-356.34,22.0499,5.90835,TEMPSUMMON_CORPSE_DESPAWN,0); - if(beamer) - { - beamer->CastSpell(m_creature,SPELL_BLUE_BEAM,true); - beamer->SetUInt32Value(UNIT_FIELD_DISPLAYID , 11686); //invisible - beamer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - beams[0]=beamer->GetGUID(); - } - beamer = beamer = m_creature->SummonCreature(ENTRY_BEAM_DUMMY,-219.918,-371.308,22.0042,2.73072,TEMPSUMMON_CORPSE_DESPAWN,0); - if(beamer) - { - beamer->CastSpell(m_creature,SPELL_BLUE_BEAM,true); - beamer->SetUInt32Value(UNIT_FIELD_DISPLAYID , 11686); //invisible - beamer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - beams[1]=beamer->GetGUID(); - } - } - void DeSummonBeams() - { - for(uint8 i=0;i<2;i++) - { - Creature* mob = (Creature*)Unit::GetUnit(*m_creature,beams[i]); - if(mob) - { - mob->setDeathState(DEAD); + void SummonBeams() + { + Creature* beamer = m_creature->SummonCreature(ENTRY_BEAM_DUMMY,-258.333,-356.34,22.0499,5.90835,TEMPSUMMON_CORPSE_DESPAWN,0); + if(beamer) + { + beamer->CastSpell(m_creature,SPELL_BLUE_BEAM,true); + beamer->SetUInt32Value(UNIT_FIELD_DISPLAYID , 11686); //invisible + beamer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + beams[0]=beamer->GetGUID(); + } + beamer = beamer = m_creature->SummonCreature(ENTRY_BEAM_DUMMY,-219.918,-371.308,22.0042,2.73072,TEMPSUMMON_CORPSE_DESPAWN,0); + if(beamer) + { + beamer->CastSpell(m_creature,SPELL_BLUE_BEAM,true); + beamer->SetUInt32Value(UNIT_FIELD_DISPLAYID , 11686); //invisible + beamer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + beams[1]=beamer->GetGUID(); + } + } + void DeSummonBeams() + { + for(uint8 i=0;i<2;i++) + { + Creature* mob = (Creature*)Unit::GetUnit(*m_creature,beams[i]); + if(mob) + { + mob->setDeathState(DEAD); mob->RemoveCorpse(); - } - } - } + } + } + } void Aggro(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); @@ -185,20 +185,20 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI void JustSummoned(Creature* summoned) { if (summoned->GetEntry() == ENTRY_PURE_SPAWN) - { - summoned->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); - summoned->CastSpell(summoned,SPELL_ELEMENTAL_SPAWNIN,true); - Summons.Summon(summoned); - } + { + summoned->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); + summoned->CastSpell(summoned,SPELL_ELEMENTAL_SPAWNIN,true); + Summons.Summon(summoned); + } if (summoned->GetEntry() == ENTRY_TAINTED_SPAWN) - { - summoned->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true); - summoned->CastSpell(summoned,SPELL_ELEMENTAL_SPAWNIN,true); - Summons.Summon(summoned); - } + { + summoned->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true); + summoned->CastSpell(summoned,SPELL_ELEMENTAL_SPAWNIN,true); + Summons.Summon(summoned); + } } - void SummonedCreatureDespawn(Creature *summon) + void SummonedCreatureDespawn(Creature *summon) { Summons.Despawn(summon); } @@ -212,16 +212,16 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI if (pInstance) pInstance->SetData(DATA_HYDROSSTHEUNSTABLEEVENT, NOT_STARTED); - Summons.DespawnAll(); + Summons.DespawnAll(); } void UpdateAI(const uint32 diff) { - if(!beam) - { - SummonBeams(); - beam=true; - } + if(!beam) + { + SummonBeams(); + beam=true; + } //Return since we have no target if (!UpdateVictim() ) return; @@ -277,7 +277,7 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI DoScriptText(SAY_SWITCH_TO_CLEAN, m_creature); DoResetThreat(); - SummonBeams(); + SummonBeams(); // spawn 4 adds DoSpawnCreature(ENTRY_PURE_SPAWN, SPAWN_X_DIFF1, SPAWN_Y_DIFF1, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); @@ -344,7 +344,7 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI DoScriptText(SAY_SWITCH_TO_CORRUPT, m_creature); DoResetThreat(); - DeSummonBeams(); + DeSummonBeams(); // spawn 4 adds DoSpawnCreature(ENTRY_TAINTED_SPAWN, SPAWN_X_DIFF1, SPAWN_Y_DIFF1, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp index 1ef843807ee..eec977a7520 100644 --- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp +++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp @@ -41,7 +41,7 @@ EndScriptData */ #define SAY_SLAY3 -1548054 #define SAY_DEATH -1548055 -#define SPELL_SURGE 38044 +#define SPELL_SURGE 38044 #define SPELL_MULTI_SHOT 38310 #define SPELL_SHOCK_BLAST 38509 #define SPELL_ENTANGLE 38316 @@ -133,17 +133,17 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI boss_lady_vashjAI (Creature *c) : ScriptedAI(c) { pInstance = (c->GetInstanceData()) ? ((ScriptedInstance*)c->GetInstanceData()) : NULL; - Intro = false; - Reset(); - CanAttack = false;//must be after reset() - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); //set it only once on creature create (no need do intro if wiped) + Intro = false; + Reset(); + CanAttack = false;//must be after reset() + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); //set it only once on creature create (no need do intro if wiped) } ScriptedInstance *pInstance; uint64 ShieldGeneratorChannel[4]; - uint32 AggroTimer; + uint32 AggroTimer; uint32 ShockBlast_Timer; uint32 Entangle_Timer; uint32 StaticCharge_Timer; @@ -160,12 +160,12 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI bool Entangle; bool InCombat; - bool Intro; - bool CanAttack; + bool Intro; + bool CanAttack; void Reset() { - AggroTimer = 19000; + AggroTimer = 19000; ShockBlast_Timer = 1+rand()%60000; Entangle_Timer = 30000; StaticCharge_Timer = 10000+rand()%15000; @@ -182,24 +182,24 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI Entangle = false; InCombat = false; - CanAttack = true; + CanAttack = true; - Unit *remo; + Unit *remo; for(uint8 i = 0; i < 4; i++) { remo = Unit::GetUnit(*m_creature, ShieldGeneratorChannel[i]); if (remo) - remo->setDeathState(JUST_DIED); + remo->setDeathState(JUST_DIED); } if(pInstance) - pInstance->SetData(DATA_LADYVASHJEVENT, NOT_STARTED); + pInstance->SetData(DATA_LADYVASHJEVENT, NOT_STARTED); ShieldGeneratorChannel[0] = 0; ShieldGeneratorChannel[1] = 0; ShieldGeneratorChannel[2] = 0; ShieldGeneratorChannel[3] = 0; - m_creature->SetCorpseDelay(1000*60*60); + m_creature->SetCorpseDelay(1000*60*60); } //Called when a tainted elemental dies @@ -246,19 +246,19 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI void Aggro(Unit *who) { - if (pInstance) - { - //remove old tainted cores to prevent cheating in phase 2 - Map *map = m_creature->GetMap(); - Map::PlayerList const &PlayerList = map->GetPlayers(); - for(Map::PlayerList::const_iterator i = PlayerList.begin();i != PlayerList.end(); ++i) + if (pInstance) + { + //remove old tainted cores to prevent cheating in phase 2 + Map *map = m_creature->GetMap(); + Map::PlayerList const &PlayerList = map->GetPlayers(); + for(Map::PlayerList::const_iterator i = PlayerList.begin();i != PlayerList.end(); ++i) { if(Player* i_pl = i->getSource()) { i_pl->DestroyItemCount(31088, 1, true); } } - } + } if(Phase != 2) AttackStart(who); @@ -268,13 +268,13 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI void MoveInLineOfSight(Unit *who) { - if (!Intro) - { - Intro = true; - DoScriptText(SAY_INTRO, m_creature); - } - if (!CanAttack) - return; + if (!Intro) + { + Intro = true; + DoScriptText(SAY_INTRO, m_creature); + } + if (!CanAttack) + return; if (!who || m_creature->getVictim()) return; @@ -322,25 +322,25 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI void UpdateAI(const uint32 diff) { - if(!CanAttack && Intro) - { - if(AggroTimer < diff) - { - CanAttack = true; - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - AggroTimer=19000; - }else - { - AggroTimer-=diff; - return; - } - } + if(!CanAttack && Intro) + { + if(AggroTimer < diff) + { + CanAttack = true; + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + AggroTimer=19000; + }else + { + AggroTimer-=diff; + return; + } + } //to prevent abuses during phase 2 if(Phase == 2 && !m_creature->getVictim() && InCombat) - { - EnterEvadeMode(); - return; - } + { + EnterEvadeMode(); + return; + } //Return since we have no target if (!UpdateVictim() ) return; @@ -438,7 +438,7 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI SummonSporebat_Timer = SummonSporebat_StaticTimer; - if(SummonSporebat_Timer < 5000) + if(SummonSporebat_Timer < 5000) SummonSporebat_Timer = 5000; }else SummonSporebat_Timer -= diff; @@ -519,15 +519,15 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI { uint32 pos = rand()%3; Creature* CoilfangElite = NULL; - CoilfangElite = m_creature->SummonCreature(COILFANG_ELITE, CoilfangElitePos[pos][0], CoilfangElitePos[pos][1], CoilfangElitePos[pos][2], CoilfangElitePos[pos][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - if(CoilfangElite) + CoilfangElite = m_creature->SummonCreature(COILFANG_ELITE, CoilfangElitePos[pos][0], CoilfangElitePos[pos][1], CoilfangElitePos[pos][2], CoilfangElitePos[pos][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + if(CoilfangElite) { Unit *target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM, 0); if(target) CoilfangElite->AI()->AttackStart(target); - else if(m_creature->getVictim()) - CoilfangElite->AI()->AttackStart(m_creature->getVictim()); + else if(m_creature->getVictim()) + CoilfangElite->AI()->AttackStart(m_creature->getVictim()); } CoilfangElite_Timer = 45000+rand()%5000; }else CoilfangElite_Timer -= diff; @@ -536,16 +536,16 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI if(CoilfangStrider_Timer < diff) { uint32 pos = rand()%3; - Creature* CoilfangStrider = NULL; - CoilfangStrider = m_creature->SummonCreature(COILFANG_STRIDER, CoilfangStriderPos[pos][0], CoilfangStriderPos[pos][1], CoilfangStriderPos[pos][2], CoilfangStriderPos[pos][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - if(CoilfangStrider) + Creature* CoilfangStrider = NULL; + CoilfangStrider = m_creature->SummonCreature(COILFANG_STRIDER, CoilfangStriderPos[pos][0], CoilfangStriderPos[pos][1], CoilfangStriderPos[pos][2], CoilfangStriderPos[pos][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + if(CoilfangStrider) { Unit *target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM, 0); if(target) CoilfangStrider->AI()->AttackStart(target); - else if(m_creature->getVictim()) - CoilfangStrider->AI()->AttackStart(m_creature->getVictim()); + else if(m_creature->getVictim()) + CoilfangStrider->AI()->AttackStart(m_creature->getVictim()); } CoilfangStrider_Timer = 60000+rand()%10000; }else CoilfangStrider_Timer -= diff; @@ -590,39 +590,39 @@ struct TRINITY_DLL_DECL mob_enchanted_elementalAI : public ScriptedAI } ScriptedInstance *pInstance; - uint32 move; - uint32 phase; - float x, y, z; - Unit *Vashj; + uint32 move; + uint32 phase; + float x, y, z; + Unit *Vashj; void Reset() { - m_creature->SetSpeed(MOVE_WALK,0.6);//walk - m_creature->SetSpeed(MOVE_RUN,0.6);//run - move = 0; - phase = 1; - Vashj = NULL; + m_creature->SetSpeed(MOVE_WALK,0.6);//walk + m_creature->SetSpeed(MOVE_RUN,0.6);//run + move = 0; + phase = 1; + Vashj = NULL; - for (int i = 0;i<8;i++)//search for nearest waypoint (up on stairs) - { - if (!x || !y || !z) - { - x = ElementWPPos[i][0]; - y = ElementWPPos[i][1]; - z = ElementWPPos[i][2]; - } - else - { - if (m_creature->GetDistance(ElementWPPos[i][0],ElementWPPos[i][1],ElementWPPos[i][2]) < m_creature->GetDistance(x,y,z)) - { - x = ElementWPPos[i][0]; - y = ElementWPPos[i][1]; - z = ElementWPPos[i][2]; - } - } - } - if (pInstance) - Vashj = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_LADYVASHJ)); + for (int i = 0;i<8;i++)//search for nearest waypoint (up on stairs) + { + if (!x || !y || !z) + { + x = ElementWPPos[i][0]; + y = ElementWPPos[i][1]; + z = ElementWPPos[i][2]; + } + else + { + if (m_creature->GetDistance(ElementWPPos[i][0],ElementWPPos[i][1],ElementWPPos[i][2]) < m_creature->GetDistance(x,y,z)) + { + x = ElementWPPos[i][0]; + y = ElementWPPos[i][1]; + z = ElementWPPos[i][2]; + } + } + } + if (pInstance) + Vashj = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_LADYVASHJ)); } void Aggro(Unit *who) { return; } @@ -631,31 +631,31 @@ struct TRINITY_DLL_DECL mob_enchanted_elementalAI : public ScriptedAI void UpdateAI(const uint32 diff) { - if(!pInstance) - return; + if(!pInstance) + return; - if (!Vashj) - { - return; - } - - if(move < diff) + if (!Vashj) { - m_creature->SetUnitMovementFlags(MOVEMENTFLAG_WALK_MODE); - if (phase == 1) - { - m_creature->GetMotionMaster()->MovePoint(0, x, y, z); - } - if (phase == 1 && m_creature->GetDistance(x,y,z) < 0.1) - { - phase = 2; - } - if (phase == 2) - { - m_creature->GetMotionMaster()->MovePoint(0, MIDDLE_X, MIDDLE_Y, MIDDLE_Z); - phase = 3; - } - if (phase == 3) + return; + } + + if(move < diff) + { + m_creature->SetUnitMovementFlags(MOVEMENTFLAG_WALK_MODE); + if (phase == 1) + { + m_creature->GetMotionMaster()->MovePoint(0, x, y, z); + } + if (phase == 1 && m_creature->GetDistance(x,y,z) < 0.1) + { + phase = 2; + } + if (phase == 2) + { + m_creature->GetMotionMaster()->MovePoint(0, MIDDLE_X, MIDDLE_Y, MIDDLE_Z); + phase = 3; + } + if (phase == 3) { m_creature->GetMotionMaster()->MovePoint(0, MIDDLE_X, MIDDLE_Y, MIDDLE_Z); if(m_creature->GetDistance(MIDDLE_X, MIDDLE_Y, MIDDLE_Z) < 3) @@ -674,13 +674,13 @@ struct TRINITY_DLL_DECL mob_enchanted_elementalAI : public ScriptedAI m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } } - if(((boss_lady_vashjAI*)((Creature*)Vashj)->AI())->InCombat == false || ((boss_lady_vashjAI*)((Creature*)Vashj)->AI())->Phase != 2 || Vashj->isDead()) + if(((boss_lady_vashjAI*)((Creature*)Vashj)->AI())->InCombat == false || ((boss_lady_vashjAI*)((Creature*)Vashj)->AI())->Phase != 2 || Vashj->isDead()) { //call Unsummon() - m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } - move = 1000; - }else move -= diff; + move = 1000; + }else move -= diff; } }; @@ -719,7 +719,7 @@ struct TRINITY_DLL_DECL mob_tainted_elementalAI : public ScriptedAI void Aggro(Unit *who) { - m_creature->AddThreat(who, 0.1f); + m_creature->AddThreat(who, 0.1f); } void UpdateAI(const uint32 diff) @@ -760,18 +760,18 @@ struct TRINITY_DLL_DECL mob_toxic_sporebatAI : public ScriptedAI ScriptedInstance *pInstance; - uint32 movement_timer; + uint32 movement_timer; uint32 ToxicSpore_Timer; - uint32 bolt_timer; + uint32 bolt_timer; uint32 Check_Timer; void Reset() { - m_creature->AddUnitMovementFlag(/*MOVEMENTFLAG_ONTRANSPORT + */MOVEMENTFLAG_LEVITATING); + m_creature->AddUnitMovementFlag(/*MOVEMENTFLAG_ONTRANSPORT + */MOVEMENTFLAG_LEVITATING); m_creature->setFaction(14); - movement_timer = 0; + movement_timer = 0; ToxicSpore_Timer = 5000; - bolt_timer = 5500; + bolt_timer = 5500; Check_Timer = 1000; } @@ -781,50 +781,50 @@ struct TRINITY_DLL_DECL mob_toxic_sporebatAI : public ScriptedAI } void MoveInLineOfSight(Unit *who) - { + { } - void MovementInform(uint32 type, uint32 id) + void MovementInform(uint32 type, uint32 id) { if(type != POINT_MOTION_TYPE) return; if(id == 1) - movement_timer = 0; - } + movement_timer = 0; + } void UpdateAI (const uint32 diff) { - /*if(!m_creature->isInCombat()) - m_creature->SetInCombatState(false);*/ + /*if(!m_creature->isInCombat()) + m_creature->SetInCombatState(false);*/ - //Random movement + //Random movement if (movement_timer < diff) { - uint32 rndpos = rand()%8; - m_creature->GetMotionMaster()->MovePoint(1,SporebatWPPos[rndpos][0], SporebatWPPos[rndpos][1], SporebatWPPos[rndpos][2]); - movement_timer = 6000; - }else movement_timer -= diff; + uint32 rndpos = rand()%8; + m_creature->GetMotionMaster()->MovePoint(1,SporebatWPPos[rndpos][0], SporebatWPPos[rndpos][1], SporebatWPPos[rndpos][2]); + movement_timer = 6000; + }else movement_timer -= diff; - //toxic spores - if(bolt_timer < diff) - { - Unit *target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM, 0); - if(target) - { - Creature* trig = m_creature->SummonCreature(TOXIC_SPORES_TRIGGER,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,30000); - if(trig) - { - trig->setFaction(14); - trig->CastSpell(trig, SPELL_TOXIC_SPORES,true); - } - } - bolt_timer = 10000+rand()%5000; - } - else bolt_timer -= diff; + //toxic spores + if(bolt_timer < diff) + { + Unit *target = NULL; + target = SelectUnit(SELECT_TARGET_RANDOM, 0); + if(target) + { + Creature* trig = m_creature->SummonCreature(TOXIC_SPORES_TRIGGER,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,30000); + if(trig) + { + trig->setFaction(14); + trig->CastSpell(trig, SPELL_TOXIC_SPORES,true); + } + } + bolt_timer = 10000+rand()%5000; + } + else bolt_timer -= diff; //Check_Timer if(Check_Timer < diff) @@ -845,7 +845,7 @@ struct TRINITY_DLL_DECL mob_toxic_sporebatAI : public ScriptedAI Check_Timer = 1000; }else Check_Timer -= diff; - } + } }; //Coilfang Elite @@ -896,11 +896,11 @@ struct TRINITY_DLL_DECL mob_shield_generator_channelAI : public ScriptedAI ScriptedInstance *pInstance; uint32 Check_Timer; - bool Casted; + bool Casted; void Reset() { Check_Timer = 0; - Casted = false; + Casted = false; m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID , 11686); //invisible m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -923,13 +923,13 @@ struct TRINITY_DLL_DECL mob_shield_generator_channelAI : public ScriptedAI if(Vashj && Vashj->isAlive()) { //start visual channel - if (!Casted || !Vashj->HasAura(SPELL_MAGIC_BARRIER,0)) - { - m_creature->CastSpell(Vashj,SPELL_MAGIC_BARRIER,true); - Casted = true; - } + if (!Casted || !Vashj->HasAura(SPELL_MAGIC_BARRIER,0)) + { + m_creature->CastSpell(Vashj,SPELL_MAGIC_BARRIER,true); + Casted = true; + } } - Check_Timer = 1000; + Check_Timer = 1000; }else Check_Timer -= diff; } }; diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp index dfb3ba69eb9..1643f1068cf 100644 --- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp +++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp @@ -27,30 +27,30 @@ EndScriptData */ // --- Spells used by Leotheras The Blind #define SPELL_WHIRLWIND 37640 #define SPELL_CHAOS_BLAST 37674 -#define SPELL_BERSERK 26662 +#define SPELL_BERSERK 26662 #define SPELL_INSIDIOUS_WHISPER 37676 -#define SPELL_DUAL_WIELD 42459 +#define SPELL_DUAL_WIELD 42459 // --- Spells used in banish phase --- -#define BANISH_BEAM 38909 -#define AURA_BANISH 37833 +#define BANISH_BEAM 38909 +#define AURA_BANISH 37833 // --- Spells used by Greyheart Spellbinders -#define SPELL_EARTHSHOCK 39076 -#define SPELL_MINDBLAST 37531 +#define SPELL_EARTHSHOCK 39076 +#define SPELL_MINDBLAST 37531 // --- Spells used by Inner Demons and creature ID -#define INNER_DEMON_ID 21857 -#define AURA_DEMONIC_ALIGNMENT 37713 -#define SPELL_SHADOWBOLT 39309 -#define SPELL_SOUL_LINK 38007 -#define SPELL_CONSUMING_MADNESS 37749 //not supported by core yet +#define INNER_DEMON_ID 21857 +#define AURA_DEMONIC_ALIGNMENT 37713 +#define SPELL_SHADOWBOLT 39309 +#define SPELL_SOUL_LINK 38007 +#define SPELL_CONSUMING_MADNESS 37749 //not supported by core yet //Misc. -#define MODEL_DEMON 20125 -#define MODEL_NIGHTELF 20514 -#define DEMON_FORM 21875 -#define MOB_SPELLBINDER 21806 +#define MODEL_DEMON 20125 +#define MODEL_NIGHTELF 20514 +#define DEMON_FORM 21875 +#define MOB_SPELLBINDER 21806 #define SAY_AGGRO -1548009 #define SAY_SWITCH_TO_DEMON -1548010 @@ -67,47 +67,47 @@ EndScriptData */ class TRINITY_DLL_DECL InsidiousAura : public Aura { public: - InsidiousAura(SpellEntry *spell, uint32 eff, int32 *bp, Unit *target, Unit *caster) : Aura(spell, eff, bp, target, caster, NULL) - {} + InsidiousAura(SpellEntry *spell, uint32 eff, int32 *bp, Unit *target, Unit *caster) : Aura(spell, eff, bp, target, caster, NULL) + {} }; struct TRINITY_DLL_DECL mob_inner_demonAI : public ScriptedAI { mob_inner_demonAI(Creature *c) : ScriptedAI(c) { - victimGUID = 0; + victimGUID = 0; Reset(); } uint32 ShadowBolt_Timer; - uint32 Link_Timer; - uint64 victimGUID; + uint32 Link_Timer; + uint64 victimGUID; void Reset() { ShadowBolt_Timer = 10000; - Link_Timer = 1000; + Link_Timer = 1000; } - void JustDied(Unit *victim) + void JustDied(Unit *victim) { - Unit* pUnit = Unit::GetUnit((*m_creature),victimGUID); - if (pUnit && pUnit->HasAura(SPELL_INSIDIOUS_WHISPER,0)) - pUnit->RemoveAurasDueToSpell(SPELL_INSIDIOUS_WHISPER); - } + Unit* pUnit = Unit::GetUnit((*m_creature),victimGUID); + if (pUnit && pUnit->HasAura(SPELL_INSIDIOUS_WHISPER,0)) + pUnit->RemoveAurasDueToSpell(SPELL_INSIDIOUS_WHISPER); + } - void DamageTaken(Unit *done_by, uint32 &damage) - { - if(done_by->GetGUID() != victimGUID && done_by->GetGUID() != m_creature->GetGUID()) - { - damage = 0; - DoModifyThreatPercent(done_by, -100); - } - } - - void Aggro(Unit *who) + void DamageTaken(Unit *done_by, uint32 &damage) { - if (!victimGUID) return; + if(done_by->GetGUID() != victimGUID && done_by->GetGUID() != m_creature->GetGUID()) + { + damage = 0; + DoModifyThreatPercent(done_by, -100); + } + } + + void Aggro(Unit *who) + { + if (!victimGUID) return; } void UpdateAI(const uint32 diff) @@ -116,27 +116,27 @@ struct TRINITY_DLL_DECL mob_inner_demonAI : public ScriptedAI if (!UpdateVictim()) return; - if (m_creature->getVictim()->GetGUID() != victimGUID) - { - Unit* owner = Unit::GetUnit((*m_creature),victimGUID); - if (owner) - AttackStart(owner); - } - if(Link_Timer < diff) - { - DoCast(m_creature->getVictim(), SPELL_SOUL_LINK, true); - Link_Timer = 1000; - }else Link_Timer -= diff; + if (m_creature->getVictim()->GetGUID() != victimGUID) + { + Unit* owner = Unit::GetUnit((*m_creature),victimGUID); + if (owner) + AttackStart(owner); + } + if(Link_Timer < diff) + { + DoCast(m_creature->getVictim(), SPELL_SOUL_LINK, true); + Link_Timer = 1000; + }else Link_Timer -= diff; - if(!m_creature->HasAura(AURA_DEMONIC_ALIGNMENT, 0)) - DoCast(m_creature, AURA_DEMONIC_ALIGNMENT,true); + if(!m_creature->HasAura(AURA_DEMONIC_ALIGNMENT, 0)) + DoCast(m_creature, AURA_DEMONIC_ALIGNMENT,true); - if(ShadowBolt_Timer < diff) - { - DoCast(m_creature->getVictim(), SPELL_SHADOWBOLT, false); - ShadowBolt_Timer = 10000; - }else ShadowBolt_Timer -= diff; + if(ShadowBolt_Timer < diff) + { + DoCast(m_creature->getVictim(), SPELL_SHADOWBOLT, false); + ShadowBolt_Timer = 10000; + }else ShadowBolt_Timer -= diff; DoMeleeAttackIfReady(); } @@ -146,112 +146,112 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI { boss_leotheras_the_blindAI(Creature *c) : ScriptedAI(c) { - m_creature->GetPosition(x,y,z); + m_creature->GetPosition(x,y,z); pInstance = (c->GetInstanceData()) ? ((ScriptedInstance*)c->GetInstanceData()) : NULL; Demon = 0; - for(uint8 i = 0; i < 3; i++)//clear guids - SpellBinderGUID[i] = 0; + for(uint8 i = 0; i < 3; i++)//clear guids + SpellBinderGUID[i] = 0; Reset(); - } + } ScriptedInstance *pInstance; uint32 Whirlwind_Timer; uint32 ChaosBlast_Timer; - uint32 SwitchToDemon_Timer; + uint32 SwitchToDemon_Timer; uint32 SwitchToHuman_Timer; - uint32 Berserk_Timer; - uint32 InnerDemons_Timer; - uint32 BanishTimer; + uint32 Berserk_Timer; + uint32 InnerDemons_Timer; + uint32 BanishTimer; - bool DealDamage; - bool NeedThreatReset; + bool DealDamage; + bool NeedThreatReset; bool DemonForm; bool IsFinalForm; - bool EnrageUsed; - float x,y,z; + bool EnrageUsed; + float x,y,z; - uint64 InnderDemon[5]; - uint32 InnderDemon_Count; + uint64 InnderDemon[5]; + uint32 InnderDemon_Count; uint64 Demon; - uint64 SpellBinderGUID[3]; + uint64 SpellBinderGUID[3]; void Reset() { - CheckChannelers(); - BanishTimer = 1000; + CheckChannelers(); + BanishTimer = 1000; Whirlwind_Timer = 15000; ChaosBlast_Timer = 1000; - SwitchToDemon_Timer = 45000; + SwitchToDemon_Timer = 45000; SwitchToHuman_Timer = 60000; - Berserk_Timer = 600000; - InnerDemons_Timer = 30000; - m_creature->SetCanDualWield(true); - DealDamage = true; + Berserk_Timer = 600000; + InnerDemons_Timer = 30000; + m_creature->SetCanDualWield(true); + DealDamage = true; DemonForm = false; IsFinalForm = false; - NeedThreatReset = false; - EnrageUsed = false; - InnderDemon_Count = 0; - m_creature->SetSpeed( MOVE_RUN, 2.0f, true); - m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); - m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); - m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_NIGHTELF); - m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY , 0); + NeedThreatReset = false; + EnrageUsed = false; + InnderDemon_Count = 0; + m_creature->SetSpeed( MOVE_RUN, 2.0f, true); + m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); + m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); + m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_NIGHTELF); + m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY , 0); m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+1, 0); - m_creature->CastSpell(m_creature, SPELL_DUAL_WIELD, true); - m_creature->SetCorpseDelay(1000*60*60); - if(pInstance) - pInstance->SetData(DATA_LEOTHERASTHEBLINDEVENT, NOT_STARTED); + m_creature->CastSpell(m_creature, SPELL_DUAL_WIELD, true); + m_creature->SetCorpseDelay(1000*60*60); + if(pInstance) + pInstance->SetData(DATA_LEOTHERASTHEBLINDEVENT, NOT_STARTED); } - void CheckChannelers(bool DoEvade = true) - { - for(uint8 i = 0; i < 3; i++) - { - Creature *add = (Creature*)Unit::GetUnit(*m_creature,SpellBinderGUID[i]); - if (add && add->isAlive()) - { - add->setDeathState(DEAD); + void CheckChannelers(bool DoEvade = true) + { + for(uint8 i = 0; i < 3; i++) + { + Creature *add = (Creature*)Unit::GetUnit(*m_creature,SpellBinderGUID[i]); + if (add && add->isAlive()) + { + add->setDeathState(DEAD); add->RemoveCorpse(); - }else{ - if(add && add->isDead()) - add->RemoveCorpse(); - } - float nx = x; - float ny = y; - float o = 2.4f; - if (i == 0) {nx += 20;o=3.0f;} - if (i == 1) ny -= 20; - if (i == 2) {nx += 18;ny -= 18;o=2.0f;} - Creature* binder = m_creature->SummonCreature(MOB_SPELLBINDER,nx,ny,z,o,TEMPSUMMON_DEAD_DESPAWN,0); - if (binder) - SpellBinderGUID[i] = binder->GetGUID(); + }else{ + if(add && add->isDead()) + add->RemoveCorpse(); + } + float nx = x; + float ny = y; + float o = 2.4f; + if (i == 0) {nx += 20;o=3.0f;} + if (i == 1) ny -= 20; + if (i == 2) {nx += 18;ny -= 18;o=2.0f;} + Creature* binder = m_creature->SummonCreature(MOB_SPELLBINDER,nx,ny,z,o,TEMPSUMMON_DEAD_DESPAWN,0); + if (binder) + SpellBinderGUID[i] = binder->GetGUID(); - } - } - void MoveInLineOfSight(Unit *who) - { - if(m_creature->HasAura(AURA_BANISH, 0)) - return; + } + } + void MoveInLineOfSight(Unit *who) + { + if(m_creature->HasAura(AURA_BANISH, 0)) + return; - if( !m_creature->getVictim() && who->isTargetableForAttack() && ( m_creature->IsHostileTo( who )) && who->isInAccessiblePlaceFor(m_creature) ) - { - if (m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) - return; + if( !m_creature->getVictim() && who->isTargetableForAttack() && ( m_creature->IsHostileTo( who )) && who->isInAccessiblePlaceFor(m_creature) ) + { + if (m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) + return; - float attackRadius = m_creature->GetAttackDistance(who); - if(m_creature->IsWithinDistInMap(who, attackRadius)) - { - // Check first that object is in an angle in front of this one before LoS check - if( m_creature->HasInArc(M_PI/2.0f, who) && m_creature->IsWithinLOSInMap(who) ) - { - AttackStart(who); - } - } - } - } + float attackRadius = m_creature->GetAttackDistance(who); + if(m_creature->IsWithinDistInMap(who, attackRadius)) + { + // Check first that object is in an angle in front of this one before LoS check + if( m_creature->HasInArc(M_PI/2.0f, who) && m_creature->IsWithinLOSInMap(who) ) + { + AttackStart(who); + } + } + } + } void StartEvent() { @@ -260,95 +260,95 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI pInstance->SetData(DATA_LEOTHERASTHEBLINDEVENT, IN_PROGRESS); } - void CheckBanish() - { - uint8 AliveChannelers = 0; - for(uint8 i = 0; i < 3; i++) - { - Unit *add = Unit::GetUnit(*m_creature,SpellBinderGUID[i]); - if (add && add->isAlive()) - AliveChannelers++; - } + void CheckBanish() + { + uint8 AliveChannelers = 0; + for(uint8 i = 0; i < 3; i++) + { + Unit *add = Unit::GetUnit(*m_creature,SpellBinderGUID[i]); + if (add && add->isAlive()) + AliveChannelers++; + } - // channelers == 0 remove banish aura - if(AliveChannelers == 0 && m_creature->HasAura(AURA_BANISH, 0)) - { - // removing banish aura - m_creature->RemoveAurasDueToSpell(AURA_BANISH); + // channelers == 0 remove banish aura + if(AliveChannelers == 0 && m_creature->HasAura(AURA_BANISH, 0)) + { + // removing banish aura + m_creature->RemoveAurasDueToSpell(AURA_BANISH); - // Leotheras is getting immune again + // Leotheras is getting immune again m_creature->ApplySpellImmune(AURA_BANISH, IMMUNITY_MECHANIC, MECHANIC_BANISH, true); - // changing model to bloodelf + // changing model to bloodelf m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_NIGHTELF); - // and reseting equipment - m_creature->LoadEquipment(m_creature->GetEquipmentId()); + // and reseting equipment + m_creature->LoadEquipment(m_creature->GetEquipmentId()); - if(pInstance && pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)) - { - Unit *victim = NULL; - victim = Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)); - if(victim) - m_creature->getThreatManager().addThreat(victim, 1); - StartEvent(); - } - } - else if(AliveChannelers != 0 && !m_creature->HasAura(AURA_BANISH, 0)) - { - // channelers != 0 apply banish aura - // removing Leotheras banish immune to apply AURA_BANISH + if(pInstance && pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)) + { + Unit *victim = NULL; + victim = Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)); + if(victim) + m_creature->getThreatManager().addThreat(victim, 1); + StartEvent(); + } + } + else if(AliveChannelers != 0 && !m_creature->HasAura(AURA_BANISH, 0)) + { + // channelers != 0 apply banish aura + // removing Leotheras banish immune to apply AURA_BANISH m_creature->ApplySpellImmune(AURA_BANISH, IMMUNITY_MECHANIC, MECHANIC_BANISH, false); - DoCast(m_creature, AURA_BANISH); + DoCast(m_creature, AURA_BANISH); - // changing model + // changing model m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_DEMON); - // and removing weapons + // and removing weapons m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY , 0); m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+1, 0); - } - } + } + } - //Despawn all Inner Demon summoned - void DespawnDemon() - { + //Despawn all Inner Demon summoned + void DespawnDemon() + { for(int i=0; i<5; i++) - { + { if(InnderDemon[i]) - { + { //delete creature Unit* pUnit = Unit::GetUnit((*m_creature), InnderDemon[i]); if (pUnit && pUnit->isAlive()) - { + { pUnit->DealDamage(pUnit, pUnit->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } - InnderDemon[i] = 0; - } - } + } + InnderDemon[i] = 0; + } + } - InnderDemon_Count = 0; - } + InnderDemon_Count = 0; + } - void CastConsumingMadness() //remove this once SPELL_INSIDIOUS_WHISPER is supported by core - { + void CastConsumingMadness() //remove this once SPELL_INSIDIOUS_WHISPER is supported by core + { for(int i=0; i<5; i++) - { + { if(InnderDemon[i] > 0 ) - { + { Unit* pUnit = Unit::GetUnit((*m_creature), InnderDemon[i]); if (pUnit && pUnit->isAlive()) - { - Unit* pUnit_target = Unit::GetUnit((*pUnit), ((mob_inner_demonAI *)((Creature *)pUnit)->AI())->victimGUID); - if( pUnit_target && pUnit_target->isAlive()) - { - pUnit->CastSpell(pUnit_target, SPELL_CONSUMING_MADNESS, true); - DoModifyThreatPercent(pUnit_target, -100); - } - } - } - } - } + { + Unit* pUnit_target = Unit::GetUnit((*pUnit), ((mob_inner_demonAI *)((Creature *)pUnit)->AI())->victimGUID); + if( pUnit_target && pUnit_target->isAlive()) + { + pUnit->CastSpell(pUnit_target, SPELL_CONSUMING_MADNESS, true); + DoModifyThreatPercent(pUnit_target, -100); + } + } + } + } + } void KilledUnit(Unit *victim) { @@ -394,85 +394,85 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI void Aggro(Unit *who) { - if(m_creature->HasAura(AURA_BANISH, 0)) - return; + if(m_creature->HasAura(AURA_BANISH, 0)) + return; - m_creature->LoadEquipment(m_creature->GetEquipmentId()); + m_creature->LoadEquipment(m_creature->GetEquipmentId()); } void UpdateAI(const uint32 diff) { //Return since we have no target if (m_creature->HasAura(AURA_BANISH, 0) || !UpdateVictim()) - { - if(BanishTimerHasAura(SPELL_WHIRLWIND, 0)) - if(Whirlwind_Timer < diff) - { - Unit *newTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if(newTarget) - { - DoResetThreat(); - m_creature->GetMotionMaster()->Clear(); - m_creature->GetMotionMaster()->MovePoint(0,newTarget->GetPositionX(),newTarget->GetPositionY(),newTarget->GetPositionZ()); - } - Whirlwind_Timer = 2000; - }else Whirlwind_Timer -= diff; + { + if(BanishTimerHasAura(SPELL_WHIRLWIND, 0)) + if(Whirlwind_Timer < diff) + { + Unit *newTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if(newTarget) + { + DoResetThreat(); + m_creature->GetMotionMaster()->Clear(); + m_creature->GetMotionMaster()->MovePoint(0,newTarget->GetPositionX(),newTarget->GetPositionY(),newTarget->GetPositionZ()); + } + Whirlwind_Timer = 2000; + }else Whirlwind_Timer -= diff; - // reseting after changing forms and after ending whirlwind - if(NeedThreatReset && !m_creature->HasAura(SPELL_WHIRLWIND, 0)) - { - // when changing forms seting timers (or when ending whirlwind - to avoid adding new variable i use Whirlwind_Timer to countdown 2s while whirlwinding) - if(DemonForm) - InnerDemons_Timer = 30000; - else - Whirlwind_Timer = 15000; + // reseting after changing forms and after ending whirlwind + if(NeedThreatReset && !m_creature->HasAura(SPELL_WHIRLWIND, 0)) + { + // when changing forms seting timers (or when ending whirlwind - to avoid adding new variable i use Whirlwind_Timer to countdown 2s while whirlwinding) + if(DemonForm) + InnerDemons_Timer = 30000; + else + Whirlwind_Timer = 15000; - NeedThreatReset = false; - DoResetThreat(); - m_creature->GetMotionMaster()->Clear(); - m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); - } + NeedThreatReset = false; + DoResetThreat(); + m_creature->GetMotionMaster()->Clear(); + m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); + } //Enrage_Timer ( 10 min ) if(Berserk_Timer < diff && !EnrageUsed) { DoCast(m_creature, SPELL_BERSERK); - EnrageUsed = true; + EnrageUsed = true; }else Berserk_Timer -= diff; if(!DemonForm) { - //Whirldind Timer + //Whirldind Timer if(!m_creature->HasAura(SPELL_WHIRLWIND, 0)) - { - if(Whirlwind_Timer < diff) - { - DoCast(m_creature, SPELL_WHIRLWIND); - // while whirlwinding this variable is used to countdown target's change - Whirlwind_Timer = 2000; - NeedThreatReset = true; - }else Whirlwind_Timer -= diff; - } + { + if(Whirlwind_Timer < diff) + { + DoCast(m_creature, SPELL_WHIRLWIND); + // while whirlwinding this variable is used to countdown target's change + Whirlwind_Timer = 2000; + NeedThreatReset = true; + }else Whirlwind_Timer -= diff; + } //Switch_Timer if(!IsFinalForm) if(SwitchToDemon_Timer < diff) { //switch to demon form - m_creature->RemoveAurasDueToSpell(SPELL_WHIRLWIND,0); - m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_DEMON); - DoScriptText(SAY_SWITCH_TO_DEMON, m_creature); - m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY , 0); - m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+1, 0); - DemonForm = true; - NeedThreatReset = true; + m_creature->RemoveAurasDueToSpell(SPELL_WHIRLWIND,0); + m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_DEMON); + DoScriptText(SAY_SWITCH_TO_DEMON, m_creature); + m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY , 0); + m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+1, 0); + DemonForm = true; + NeedThreatReset = true; SwitchToDemon_Timer = 45000; }else SwitchToDemon_Timer -= diff; DoMeleeAttackIfReady(); @@ -481,98 +481,98 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI { //ChaosBlast_Timer if (!m_creature->getVictim()) - return; - if(m_creature->GetDistance(m_creature->getVictim()) < 30) - m_creature->StopMoving(); - if(ChaosBlast_Timer < diff) - { - // will cast only when in range of spell - if(m_creature->GetDistance(m_creature->getVictim()) < 30) - { - //m_creature->CastSpell(m_creature->getVictim(), SPELL_CHAOS_BLAST, true); - int damage = 100; - m_creature->CastCustomSpell(m_creature->getVictim(), SPELL_CHAOS_BLAST, &damage, NULL, NULL, false, NULL, NULL, m_creature->GetGUID()); - } - ChaosBlast_Timer = 3000; - }else ChaosBlast_Timer -= diff; - //Summon Inner Demon - if(InnerDemons_Timer < diff) - { - std::list& ThreatList = m_creature->getThreatManager().getThreatList(); - std::vector TargetList; - for(std::list::iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) - { - Unit *tempTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); - if(tempTarget && tempTarget->GetTypeId() == TYPEID_PLAYER && tempTarget->GetGUID() != m_creature->getVictim()->GetGUID() && TargetList.size()<5) - TargetList.push_back( tempTarget ); - } - SpellEntry *spell = (SpellEntry *)GetSpellStore()->LookupEntry(SPELL_INSIDIOUS_WHISPER); - for(std::vector::iterator itr = TargetList.begin(); itr != TargetList.end(); ++itr) - { - if( (*itr) && (*itr)->isAlive() ) - { - Creature * demon = (Creature *)m_creature->SummonCreature(INNER_DEMON_ID, (*itr)->GetPositionX()+10, (*itr)->GetPositionY()+10, (*itr)->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - if(demon) - { - ((ScriptedAI *)demon->AI())->AttackStart( (*itr) ); - ((mob_inner_demonAI *)demon->AI())->victimGUID = (*itr)->GetGUID(); + return; + if(m_creature->GetDistance(m_creature->getVictim()) < 30) + m_creature->StopMoving(); + if(ChaosBlast_Timer < diff) + { + // will cast only when in range of spell + if(m_creature->GetDistance(m_creature->getVictim()) < 30) + { + //m_creature->CastSpell(m_creature->getVictim(), SPELL_CHAOS_BLAST, true); + int damage = 100; + m_creature->CastCustomSpell(m_creature->getVictim(), SPELL_CHAOS_BLAST, &damage, NULL, NULL, false, NULL, NULL, m_creature->GetGUID()); + } + ChaosBlast_Timer = 3000; + }else ChaosBlast_Timer -= diff; + //Summon Inner Demon + if(InnerDemons_Timer < diff) + { + std::list& ThreatList = m_creature->getThreatManager().getThreatList(); + std::vector TargetList; + for(std::list::iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) + { + Unit *tempTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); + if(tempTarget && tempTarget->GetTypeId() == TYPEID_PLAYER && tempTarget->GetGUID() != m_creature->getVictim()->GetGUID() && TargetList.size()<5) + TargetList.push_back( tempTarget ); + } + SpellEntry *spell = (SpellEntry *)GetSpellStore()->LookupEntry(SPELL_INSIDIOUS_WHISPER); + for(std::vector::iterator itr = TargetList.begin(); itr != TargetList.end(); ++itr) + { + if( (*itr) && (*itr)->isAlive() ) + { + Creature * demon = (Creature *)m_creature->SummonCreature(INNER_DEMON_ID, (*itr)->GetPositionX()+10, (*itr)->GetPositionY()+10, (*itr)->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + if(demon) + { + ((ScriptedAI *)demon->AI())->AttackStart( (*itr) ); + ((mob_inner_demonAI *)demon->AI())->victimGUID = (*itr)->GetGUID(); - for (int i=0; i<3; i++) - { - if (!spell->Effect[i]) - continue; - (*itr)->AddAura(new InsidiousAura(spell, i, NULL, (*itr), (*itr))); - } - if( InnderDemon_Count > 4 ) InnderDemon_Count = 0; + for (int i=0; i<3; i++) + { + if (!spell->Effect[i]) + continue; + (*itr)->AddAura(new InsidiousAura(spell, i, NULL, (*itr), (*itr))); + } + if( InnderDemon_Count > 4 ) InnderDemon_Count = 0; - //Safe storing of creatures - InnderDemon[InnderDemon_Count] = demon->GetGUID(); + //Safe storing of creatures + InnderDemon[InnderDemon_Count] = demon->GetGUID(); - //Update demon count - InnderDemon_Count++; - } - } - } - DoScriptText(SAY_INNER_DEMONS, m_creature); + //Update demon count + InnderDemon_Count++; + } + } + } + DoScriptText(SAY_INNER_DEMONS, m_creature); - InnerDemons_Timer = 999999; - }else InnerDemons_Timer -= diff; + InnerDemons_Timer = 999999; + }else InnerDemons_Timer -= diff; //Switch_Timer if(SwitchToHuman_Timer < diff) { //switch to nightelf form m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_NIGHTELF); - m_creature->LoadEquipment(m_creature->GetEquipmentId()); + m_creature->LoadEquipment(m_creature->GetEquipmentId()); - CastConsumingMadness(); - DespawnDemon(); + CastConsumingMadness(); + DespawnDemon(); DemonForm = false; - NeedThreatReset = true; + NeedThreatReset = true; SwitchToHuman_Timer = 60000; }else SwitchToHuman_Timer -= diff; - } + } if (!IsFinalForm && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 15) { //at this point he divides himself in two parts - Creature *Copy = NULL; + Creature *Copy = NULL; Copy = DoSpawnCreature(DEMON_FORM, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 6000); - if(Copy) + if(Copy) { Demon = Copy->GetGUID(); - if (m_creature->getVictim()) - Copy->AI()->AttackStart(m_creature->getVictim()); - } + if (m_creature->getVictim()) + Copy->AI()->AttackStart(m_creature->getVictim()); + } //set nightelf final form IsFinalForm = true; DemonForm = false; DoScriptText(SAY_FINAL_FORM, m_creature); - m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_NIGHTELF); - m_creature->LoadEquipment(m_creature->GetEquipmentId()); + m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_NIGHTELF); + m_creature->LoadEquipment(m_creature->GetEquipmentId()); } } }; @@ -586,12 +586,12 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blind_demonformAI : public ScriptedAI } uint32 ChaosBlast_Timer; - bool DealDamage; + bool DealDamage; void Reset() { ChaosBlast_Timer = 1000; - DealDamage = true; + DealDamage = true; } void StartEvent() @@ -629,19 +629,19 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blind_demonformAI : public ScriptedAI if (!UpdateVictim() ) return; //ChaosBlast_Timer - if(m_creature->GetDistance(m_creature->getVictim()) < 30) - m_creature->StopMoving(); + if(m_creature->GetDistance(m_creature->getVictim()) < 30) + m_creature->StopMoving(); - if(ChaosBlast_Timer < diff) + if(ChaosBlast_Timer < diff) { - // will cast only when in range od spell - if(m_creature->GetDistance(m_creature->getVictim()) < 30) - { - //m_creature->CastSpell(m_creature->getVictim(),SPELL_CHAOS_BLAST,true); - int damage = 100; - m_creature->CastCustomSpell(m_creature->getVictim(), SPELL_CHAOS_BLAST, &damage, NULL, NULL, false, NULL, NULL, m_creature->GetGUID()); - ChaosBlast_Timer = 3000; - } + // will cast only when in range od spell + if(m_creature->GetDistance(m_creature->getVictim()) < 30) + { + //m_creature->CastSpell(m_creature->getVictim(),SPELL_CHAOS_BLAST,true); + int damage = 100; + m_creature->CastCustomSpell(m_creature->getVictim(), SPELL_CHAOS_BLAST, &damage, NULL, NULL, false, NULL, NULL, m_creature->GetGUID()); + ChaosBlast_Timer = 3000; + } }else ChaosBlast_Timer -= diff; //Do NOT deal any melee damage to the target. @@ -649,128 +649,128 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blind_demonformAI : public ScriptedAI }; struct TRINITY_DLL_DECL mob_greyheart_spellbinderAI : public ScriptedAI { - mob_greyheart_spellbinderAI(Creature *c) : ScriptedAI(c) + mob_greyheart_spellbinderAI(Creature *c) : ScriptedAI(c) { - pInstance = ((ScriptedInstance *)c->GetInstanceData());; - leotherasGUID = 0; - AddedBanish = false; - Reset(); - } + pInstance = ((ScriptedInstance *)c->GetInstanceData());; + leotherasGUID = 0; + AddedBanish = false; + Reset(); + } - ScriptedInstance *pInstance; + ScriptedInstance *pInstance; - uint64 leotherasGUID; + uint64 leotherasGUID; - uint32 Mindblast_Timer; - uint32 Earthshock_Timer; + uint32 Mindblast_Timer; + uint32 Earthshock_Timer; - bool AddedBanish; + bool AddedBanish; - void Reset() - { - Mindblast_Timer = 3000 + rand()%5000; - Earthshock_Timer = 5000 + rand()%5000; + void Reset() + { + Mindblast_Timer = 3000 + rand()%5000; + Earthshock_Timer = 5000 + rand()%5000; - if(pInstance) - { - pInstance->SetData64(DATA_LEOTHERAS_EVENT_STARTER, 0); - Creature *leotheras = (Creature *)Unit::GetUnit(*m_creature, leotherasGUID); - if(leotheras && leotheras->isAlive()) - ((boss_leotheras_the_blindAI*)leotheras->AI())->CheckChannelers(false); - } - } + if(pInstance) + { + pInstance->SetData64(DATA_LEOTHERAS_EVENT_STARTER, 0); + Creature *leotheras = (Creature *)Unit::GetUnit(*m_creature, leotherasGUID); + if(leotheras && leotheras->isAlive()) + ((boss_leotheras_the_blindAI*)leotheras->AI())->CheckChannelers(false); + } + } - void Aggro(Unit *who) - { - m_creature->InterruptNonMeleeSpells(false); - if(pInstance) - pInstance->SetData64(DATA_LEOTHERAS_EVENT_STARTER, who->GetGUID()); - } + void Aggro(Unit *who) + { + m_creature->InterruptNonMeleeSpells(false); + if(pInstance) + pInstance->SetData64(DATA_LEOTHERAS_EVENT_STARTER, who->GetGUID()); + } - void JustRespawned() - { - InCombat = false; - AddedBanish = false; - Reset(); - } + void JustRespawned() + { + InCombat = false; + AddedBanish = false; + Reset(); + } - void CastChanneling() - { - if(!InCombat && !m_creature->m_currentSpells[CURRENT_CHANNELED_SPELL]) - { - if(leotherasGUID) - { - Creature *leotheras = (Creature *)Unit::GetUnit(*m_creature, leotherasGUID); - if(leotheras && leotheras->isAlive()) - DoCast(leotheras, BANISH_BEAM); - } - } - } + void CastChanneling() + { + if(!InCombat && !m_creature->m_currentSpells[CURRENT_CHANNELED_SPELL]) + { + if(leotherasGUID) + { + Creature *leotheras = (Creature *)Unit::GetUnit(*m_creature, leotherasGUID); + if(leotheras && leotheras->isAlive()) + DoCast(leotheras, BANISH_BEAM); + } + } + } - void UpdateAI(const uint32 diff) - { - if(pInstance) - { - if(!leotherasGUID) - leotherasGUID = pInstance->GetData64(DATA_LEOTHERAS); + void UpdateAI(const uint32 diff) + { + if(pInstance) + { + if(!leotherasGUID) + leotherasGUID = pInstance->GetData64(DATA_LEOTHERAS); - if(!InCombat && pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)) - { - Unit *victim = NULL; - victim = Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)); - if(victim) - AttackStart(victim); - } - } + if(!InCombat && pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)) + { + Unit *victim = NULL; + victim = Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)); + if(victim) + AttackStart(victim); + } + } - if(!UpdateVictim()) - { - CastChanneling(); - return; - } + if(!UpdateVictim()) + { + CastChanneling(); + return; + } - if(pInstance && !pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)) - { - EnterEvadeMode(); - return; - } + if(pInstance && !pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)) + { + EnterEvadeMode(); + return; + } - if(Mindblast_Timer < diff) - { - Unit* target = NULL; + if(Mindblast_Timer < diff) + { + Unit* target = NULL; target = SelectUnit(SELECT_TARGET_RANDOM,0); - if ( target )DoCast(target, SPELL_MINDBLAST); + if ( target )DoCast(target, SPELL_MINDBLAST); - Mindblast_Timer = 10000 + rand()%5000; - }else Mindblast_Timer -= diff; + Mindblast_Timer = 10000 + rand()%5000; + }else Mindblast_Timer -= diff; - if(Earthshock_Timer < diff) - { - Map *map = m_creature->GetMap(); - Map::PlayerList const &PlayerList = map->GetPlayers(); - for(Map::PlayerList::const_iterator itr = PlayerList.begin();itr != PlayerList.end(); ++itr) + if(Earthshock_Timer < diff) + { + Map *map = m_creature->GetMap(); + Map::PlayerList const &PlayerList = map->GetPlayers(); + for(Map::PlayerList::const_iterator itr = PlayerList.begin();itr != PlayerList.end(); ++itr) { if (Player* i_pl = itr->getSource()) { - bool isCasting = false; - for(uint8 i = 0; i < CURRENT_MAX_SPELL; ++i) - if(i_pl->m_currentSpells[i]) - isCasting = true; + bool isCasting = false; + for(uint8 i = 0; i < CURRENT_MAX_SPELL; ++i) + if(i_pl->m_currentSpells[i]) + isCasting = true; - if(isCasting) - { - DoCast(i_pl, SPELL_EARTHSHOCK); - break; - } + if(isCasting) + { + DoCast(i_pl, SPELL_EARTHSHOCK); + break; + } } - } - Earthshock_Timer = 8000 + rand()%7000; - }else Earthshock_Timer -= diff; - DoMeleeAttackIfReady(); - } + } + Earthshock_Timer = 8000 + rand()%7000; + }else Earthshock_Timer -= diff; + DoMeleeAttackIfReady(); + } - void JustDied(Unit *killer) {} + void JustDied(Unit *killer) {} }; CreatureAI* GetAI_boss_leotheras_the_blind(Creature *_Creature) { @@ -784,12 +784,12 @@ CreatureAI* GetAI_boss_leotheras_the_blind_demonform(Creature *_Creature) CreatureAI* GetAI_mob_greyheart_spellbinder(Creature *_Creature) { - return new mob_greyheart_spellbinderAI (_Creature); + return new mob_greyheart_spellbinderAI (_Creature); } CreatureAI* GetAI_mob_inner_demon(Creature *_Creature) { - return new mob_inner_demonAI (_Creature); + return new mob_inner_demonAI (_Creature); } void AddSC_boss_leotheras_the_blind() { @@ -805,12 +805,12 @@ void AddSC_boss_leotheras_the_blind() newscript->GetAI = &GetAI_boss_leotheras_the_blind_demonform; newscript->RegisterSelf(); - newscript = new Script; + newscript = new Script; newscript->Name="mob_greyheart_spellbinder"; newscript->GetAI = &GetAI_mob_greyheart_spellbinder; newscript->RegisterSelf(); - newscript = new Script; + newscript = new Script; newscript->Name="mob_inner_demon"; newscript->GetAI = &GetAI_mob_inner_demon; newscript->RegisterSelf(); diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp index 83a8554c754..1489f128dbd 100644 --- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp +++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp @@ -26,199 +26,199 @@ EndScriptData */ #include "../../../creature/simple_ai.h" #include "Spell.h" -#define SPELL_SPOUT 37433 -#define SPELL_SPOUT_ANIM 42835 -#define SPELL_SPOUT_BREATH 37431 -#define SPELL_KNOCKBACK 19813 -#define SPELL_GEYSER 37478 -#define SPELL_WHIRL 37660 -#define SPELL_WATERBOLT 37138 -#define SPELL_SUBMERGE 37550 -#define SPELL_EMERGE 20568 -#define SPELL_SCALDINGWATER 37284 +#define SPELL_SPOUT 37433 +#define SPELL_SPOUT_ANIM 42835 +#define SPELL_SPOUT_BREATH 37431 +#define SPELL_KNOCKBACK 19813 +#define SPELL_GEYSER 37478 +#define SPELL_WHIRL 37660 +#define SPELL_WATERBOLT 37138 +#define SPELL_SUBMERGE 37550 +#define SPELL_EMERGE 20568 +#define SPELL_SCALDINGWATER 37284 -#define EMOTE_SPOUT "takes a deep breath." +#define EMOTE_SPOUT "takes a deep breath." -#define SPOUT_DIST 100 +#define SPOUT_DIST 100 #define MOB_COILFANG_GUARDIAN 21873 #define MOB_COILFANG_AMBUSHER 21865 //Ambusher spells -#define SPELL_SPREAD_SHOT 37790 -#define SPELL_SHOOT 37770 +#define SPELL_SPREAD_SHOT 37790 +#define SPELL_SHOOT 37770 //Guardian spells -#define SPELL_ARCINGSMASH 38761 // Wrong SpellId. Can't find the right one. -#define SPELL_HAMSTRING 26211 +#define SPELL_ARCINGSMASH 38761 // Wrong SpellId. Can't find the right one. +#define SPELL_HAMSTRING 26211 float AddPos[9][3] = { - {2.8553810, -459.823914, -19.182686}, //MOVE_AMBUSHER_1 X, Y, Z - {12.400000, -466.042267, -19.182686}, //MOVE_AMBUSHER_2 X, Y, Z - {51.366653, -460.836060, -19.182686}, //MOVE_AMBUSHER_3 X, Y, Z - {62.597980, -457.433044, -19.182686}, //MOVE_AMBUSHER_4 X, Y, Z - {77.607452, -384.302765, -19.182686}, //MOVE_AMBUSHER_5 X, Y, Z - {63.897900, -378.984924, -19.182686}, //MOVE_AMBUSHER_6 X, Y, Z - {34.447250, -387.333618, -19.182686}, //MOVE_GUARDIAN_1 X, Y, Z - {14.388216, -423.468018, -19.625271}, //MOVE_GUARDIAN_2 X, Y, Z - {42.471519, -445.115295, -19.769423} //MOVE_GUARDIAN_3 X, Y, Z + {2.8553810, -459.823914, -19.182686}, //MOVE_AMBUSHER_1 X, Y, Z + {12.400000, -466.042267, -19.182686}, //MOVE_AMBUSHER_2 X, Y, Z + {51.366653, -460.836060, -19.182686}, //MOVE_AMBUSHER_3 X, Y, Z + {62.597980, -457.433044, -19.182686}, //MOVE_AMBUSHER_4 X, Y, Z + {77.607452, -384.302765, -19.182686}, //MOVE_AMBUSHER_5 X, Y, Z + {63.897900, -378.984924, -19.182686}, //MOVE_AMBUSHER_6 X, Y, Z + {34.447250, -387.333618, -19.182686}, //MOVE_GUARDIAN_1 X, Y, Z + {14.388216, -423.468018, -19.625271}, //MOVE_GUARDIAN_2 X, Y, Z + {42.471519, -445.115295, -19.769423} //MOVE_GUARDIAN_3 X, Y, Z }; enum RotationType { - NOROTATE = 0, - CLOCKWISE = 1, - COUNTERCLOCKWISE = 2, + NOROTATE = 0, + CLOCKWISE = 1, + COUNTERCLOCKWISE = 2, }; struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI { boss_the_lurker_belowAI(Creature *c) : Scripted_NoMovementAI(c), Summons(m_creature) - { - pInstance = ((ScriptedInstance*)c->GetInstanceData()); - Reset(); - SpellEntry *TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_SPOUT_ANIM); + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + Reset(); + SpellEntry *TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_SPOUT_ANIM); if(TempSpell) - { - TempSpell->Effect[0] = 0;//remove all spell effect, only anim is needed - TempSpell->Effect[1] = 0; - TempSpell->Effect[2] = 0; - } - } + { + TempSpell->Effect[0] = 0;//remove all spell effect, only anim is needed + TempSpell->Effect[1] = 0; + TempSpell->Effect[2] = 0; + } + } - ScriptedInstance* pInstance; + ScriptedInstance* pInstance; SummonList Summons; - bool Spawned; + bool Spawned; bool Submerged; double SpoutAngle; - uint8 RotType; + uint8 RotType; - uint32 RotTimer; - uint32 SpoutAnimTimer; - uint32 WaterboltTimer; - uint32 SpoutTimer; - uint32 WhirlTimer;//after avery spout - uint32 PhaseTimer; - uint32 GeyserTimer; + uint32 RotTimer; + uint32 SpoutAnimTimer; + uint32 WaterboltTimer; + uint32 SpoutTimer; + uint32 WhirlTimer;//after avery spout + uint32 PhaseTimer; + uint32 GeyserTimer; - void Reset() - { - m_creature->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING + MOVEMENTFLAG_LEVITATING); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->SetCorpseDelay(1000*60*60); + void Reset() + { + m_creature->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING + MOVEMENTFLAG_LEVITATING); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->SetCorpseDelay(1000*60*60); RotType = NOROTATE; - SpoutAngle = 0; - SpoutAnimTimer = 1000; - RotTimer = 20000; - WaterboltTimer = 3000; - SpoutTimer = 15000; - WhirlTimer = 18000;//after avery spout - PhaseTimer = 120000; - GeyserTimer = rand()%5000 + 15000; + SpoutAngle = 0; + SpoutAnimTimer = 1000; + RotTimer = 20000; + WaterboltTimer = 3000; + SpoutTimer = 15000; + WhirlTimer = 18000;//after avery spout + PhaseTimer = 120000; + GeyserTimer = rand()%5000 + 15000; Submerged = false; - Spawned = false; + Spawned = false; Summons.DespawnAll(); - if(pInstance) - pInstance->SetData(DATA_THELURKERBELOWEVENT, NOT_STARTED); + if(pInstance) + pInstance->SetData(DATA_THELURKERBELOWEVENT, NOT_STARTED); - /*if(pInstance->GetData(DATA_STRANGE_POOL) != DONE) - { - m_creature->SetReactState(REACT_PASSIVE); - m_creature->SetVisibility(VISIBILITY_OFF); - }else { - m_creature->SetVisibility(VISIBILITY_ON); - m_creature->SetReactState(REACT_AGGRESSIVE); - }*/ - } + /*if(pInstance->GetData(DATA_STRANGE_POOL) != DONE) + { + m_creature->SetReactState(REACT_PASSIVE); + m_creature->SetVisibility(VISIBILITY_OFF); + }else { + m_creature->SetVisibility(VISIBILITY_ON); + m_creature->SetReactState(REACT_AGGRESSIVE); + }*/ + } void MoveInLineOfSight(Unit *who) { - if (!who || m_creature->getVictim()) + if (!who || m_creature->getVictim()) return; - if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(m_creature) && m_creature->IsHostileTo(who)) + if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(m_creature) && m_creature->IsHostileTo(who)) { float attackRadius = m_creature->GetAttackDistance(who); if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) - AttackStart(who); + AttackStart(who); } } - void Aggro(Unit *who) - { - if(pInstance) - pInstance->SetData(DATA_THELURKERBELOWEVENT, IN_PROGRESS); + void Aggro(Unit *who) + { + if(pInstance) + pInstance->SetData(DATA_THELURKERBELOWEVENT, IN_PROGRESS); - if (!who || m_creature->getVictim()) - return; + if (!who || m_creature->getVictim()) + return; - if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(m_creature) && m_creature->IsHostileTo(who)) - { - float attackRadius = m_creature->GetAttackDistance(who); - if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) - AttackStart(who); - } - } + if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(m_creature) && m_creature->IsHostileTo(who)) + { + float attackRadius = m_creature->GetAttackDistance(who); + if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) + AttackStart(who); + } + } - void JustDied(Unit* Killer) - { - if(pInstance) - pInstance->SetData(DATA_THELURKERBELOWEVENT, DONE); + void JustDied(Unit* Killer) + { + if(pInstance) + pInstance->SetData(DATA_THELURKERBELOWEVENT, DONE); Summons.DespawnAll(); - } + } - void Rotate(const uint32 diff) - { - bool Spout = false; - switch (RotType) - { - case NOROTATE: - return; - case CLOCKWISE://20secs for 360turn - //no target if rotating! - m_creature->SetUInt64Value(UNIT_FIELD_TARGET, 0); - SpoutAngle += (double)diff/20000*(double)M_PI*2; - if (SpoutAngle >= M_PI*2)SpoutAngle = 0; - m_creature->SetOrientation(SpoutAngle); - m_creature->StopMoving(); - Spout = true; - break; - case COUNTERCLOCKWISE://20secs for 360turn - //no target if rotating! - m_creature->SetUInt64Value(UNIT_FIELD_TARGET, 0); - SpoutAngle -= (double)diff/20000*(double)M_PI*2; - if (SpoutAngle <= 0)SpoutAngle = M_PI*2; - m_creature->SetOrientation(SpoutAngle); - m_creature->StopMoving(); - Spout = true; - break; - } + void Rotate(const uint32 diff) + { + bool Spout = false; + switch (RotType) + { + case NOROTATE: + return; + case CLOCKWISE://20secs for 360turn + //no target if rotating! + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, 0); + SpoutAngle += (double)diff/20000*(double)M_PI*2; + if (SpoutAngle >= M_PI*2)SpoutAngle = 0; + m_creature->SetOrientation(SpoutAngle); + m_creature->StopMoving(); + Spout = true; + break; + case COUNTERCLOCKWISE://20secs for 360turn + //no target if rotating! + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, 0); + SpoutAngle -= (double)diff/20000*(double)M_PI*2; + if (SpoutAngle <= 0)SpoutAngle = M_PI*2; + m_creature->SetOrientation(SpoutAngle); + m_creature->StopMoving(); + Spout = true; + break; + } - if(!Spout) - return; + if(!Spout) + return; - if(RotTimerInterruptNonMeleeSpells(false); - WhirlTimer = 4000; //whirl directly after spout ends - return; - }else RotTimer-=diff; + if(RotTimerInterruptNonMeleeSpells(false); + WhirlTimer = 4000; //whirl directly after spout ends + return; + }else RotTimer-=diff; - if(SpoutAnimTimergetSource(); if(target->isAlive() && m_creature->HasInArc((double)diff/20000*(double)M_PI*2,target) && m_creature->GetDistance(target) <= SPOUT_DIST && !target->IsInWater()) - DoCast(target,SPELL_SPOUT,true);//only knock back palyers in arc, in 100yards, not in water - } + DoCast(target,SPELL_SPOUT,true);//only knock back palyers in arc, in 100yards, not in water + } } - } + } - void StartRotate(Unit* victim) - { - switch (rand()%2) - { - case 0: RotType = CLOCKWISE; break; - case 1: RotType = COUNTERCLOCKWISE; break; - } + void StartRotate(Unit* victim) + { + switch (rand()%2) + { + case 0: RotType = CLOCKWISE; break; + case 1: RotType = COUNTERCLOCKWISE; break; + } RotTimer=20000; if(victim) - SpoutAngle = m_creature->GetAngle(victim); + SpoutAngle = m_creature->GetAngle(victim); m_creature->MonsterTextEmote(EMOTE_SPOUT,0,true); - //DoCast(m_creature,SPELL_SPOUT_BREATH);//take breath anim - } + //DoCast(m_creature,SPELL_SPOUT_BREATH);//take breath anim + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim() /*|| !m_creature->getVictim()*/ )//rotate resets target - return; + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim() /*|| !m_creature->getVictim()*/ )//rotate resets target + return; - //Check if players in water and if in water cast spell - Map *map = m_creature->GetMap(); - if (map->IsDungeon() && pInstance->GetData(DATA_THELURKERBELOWEVENT) == IN_PROGRESS) - { - Map::PlayerList const &PlayerList = map->GetPlayers(); + //Check if players in water and if in water cast spell + Map *map = m_creature->GetMap(); + if (map->IsDungeon() && pInstance->GetData(DATA_THELURKERBELOWEVENT) == IN_PROGRESS) + { + Map::PlayerList const &PlayerList = map->GetPlayers(); - if (PlayerList.isEmpty()) - return; + if (PlayerList.isEmpty()) + return; - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - if (i->getSource()->isAlive() && i->getSource()->IsInWater() && !i->getSource()->HasAura(SPELL_SCALDINGWATER, 0)) - i->getSource()->CastSpell(i->getSource(), SPELL_SCALDINGWATER, true); - else if(!i->getSource()->IsInWater()) - i->getSource()->RemoveAurasDueToSpell(SPELL_SCALDINGWATER); - } - } + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if (i->getSource()->isAlive() && i->getSource()->IsInWater() && !i->getSource()->HasAura(SPELL_SCALDINGWATER, 0)) + i->getSource()->CastSpell(i->getSource(), SPELL_SCALDINGWATER, true); + else if(!i->getSource()->IsInWater()) + i->getSource()->RemoveAurasDueToSpell(SPELL_SCALDINGWATER); + } + } - Rotate(diff);//always check rotate things - if(!Submerged) - { - if(PhaseTimer < diff) - { - m_creature->InterruptNonMeleeSpells(false); - DoCast(m_creature,SPELL_SUBMERGE); - PhaseTimer = 60000;//60secs submerged - Submerged = true; - }else PhaseTimer-=diff; - } + Rotate(diff);//always check rotate things + if(!Submerged) + { + if(PhaseTimer < diff) + { + m_creature->InterruptNonMeleeSpells(false); + DoCast(m_creature,SPELL_SUBMERGE); + PhaseTimer = 60000;//60secs submerged + Submerged = true; + }else PhaseTimer-=diff; + } - if(!Submerged && RotType == NOROTATE)//is not spouting and not submerged - { - if(SpoutTimer < diff) - { - if(m_creature->getVictim() && RotType == NOROTATE) - StartRotate(m_creature->getVictim());//start spout and random rotate + if(!Submerged && RotType == NOROTATE)//is not spouting and not submerged + { + if(SpoutTimer < diff) + { + if(m_creature->getVictim() && RotType == NOROTATE) + StartRotate(m_creature->getVictim());//start spout and random rotate - SpoutTimer= 35000; - return; - }else SpoutTimer -= diff; + SpoutTimer= 35000; + return; + }else SpoutTimer -= diff; - //Whirl directly after a Spout and at random times - if(WhirlTimer < diff) - { - WhirlTimer = rand()%5000 + 15000; - DoCast(m_creature,SPELL_WHIRL); - WaterboltTimer += 5000;//add 5secs to waterbolt timer, to add some time to run back to boss - }else WhirlTimer -= diff; + //Whirl directly after a Spout and at random times + if(WhirlTimer < diff) + { + WhirlTimer = rand()%5000 + 15000; + DoCast(m_creature,SPELL_WHIRL); + WaterboltTimer += 5000;//add 5secs to waterbolt timer, to add some time to run back to boss + }else WhirlTimer -= diff; - if(GeyserTimer < diff) - { - Unit* target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM,1); + if(GeyserTimer < diff) + { + Unit* target = NULL; + target = SelectUnit(SELECT_TARGET_RANDOM,1); - if(target) - DoCast(target,SPELL_GEYSER,true); - else - target = SelectUnit(SELECT_TARGET_RANDOM,0); - if(target) - DoCast(target,SPELL_GEYSER,true); + if(target) + DoCast(target,SPELL_GEYSER,true); + else + target = SelectUnit(SELECT_TARGET_RANDOM,0); + if(target) + DoCast(target,SPELL_GEYSER,true); - GeyserTimer = rand()%5000 + 15000; - }else GeyserTimer -= diff; + GeyserTimer = rand()%5000 + 15000; + }else GeyserTimer -= diff; - if(WaterboltTimer < diff) - { - Unit* target = SelectUnit(SELECT_TARGET_NEAREST,0,14,true); - if(!target) - { - target = SelectUnit(SELECT_TARGET_RANDOM,0); - if(target) - DoCast(target,SPELL_WATERBOLT); - } - WaterboltTimer = 3000; - }else WaterboltTimer -= diff; + if(WaterboltTimer < diff) + { + Unit* target = SelectUnit(SELECT_TARGET_NEAREST,0,14,true); + if(!target) + { + target = SelectUnit(SELECT_TARGET_RANDOM,0); + if(target) + DoCast(target,SPELL_WATERBOLT); + } + WaterboltTimer = 3000; + }else WaterboltTimer -= diff; - if (!UpdateVictim() ) - return; + if (!UpdateVictim() ) + return; - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); - }else if(!Submerged) - return; - else if(Submerged)//phase 2, submerged - { - if(PhaseTimer < diff) - { - Submerged = false; - m_creature->InterruptNonMeleeSpells(false);//shouldn't be any - m_creature->RemoveAllAuras(); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->RemoveFlag(UNIT_NPC_EMOTESTATE,EMOTE_STATE_SUBMERGED); - m_creature->RemoveFlag(UNIT_FIELD_BYTES_1,9); - DoCast(m_creature,SPELL_EMERGE); - Spawned = false; - SpoutTimer = 4000; // directly cast Spout after emerging! - WhirlTimer = 26000; - PhaseTimer = 120000; - return; - }else PhaseTimer-=diff; + }else if(!Submerged) + return; + else if(Submerged)//phase 2, submerged + { + if(PhaseTimer < diff) + { + Submerged = false; + m_creature->InterruptNonMeleeSpells(false);//shouldn't be any + m_creature->RemoveAllAuras(); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->RemoveFlag(UNIT_NPC_EMOTESTATE,EMOTE_STATE_SUBMERGED); + m_creature->RemoveFlag(UNIT_FIELD_BYTES_1,9); + DoCast(m_creature,SPELL_EMERGE); + Spawned = false; + SpoutTimer = 4000; // directly cast Spout after emerging! + WhirlTimer = 26000; + PhaseTimer = 120000; + return; + }else PhaseTimer-=diff; - if(!m_creature->isInCombat()) - m_creature->SetInCombatState(false); + if(!m_creature->isInCombat()) + m_creature->SetInCombatState(false); - if(!Spawned) - { - m_creature->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - //spawn adds + if(!Spawned) + { + m_creature->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + //spawn adds for (uint8 i = 0; i < 9; ++i) { Creature* Summoned; - if(i < 7) + if(i < 7) Summoned = m_creature->SummonCreature(MOB_COILFANG_AMBUSHER,AddPos[i][0],AddPos[i][1],AddPos[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 0); else Summoned = m_creature->SummonCreature(MOB_COILFANG_GUARDIAN,AddPos[i][0],AddPos[i][1],AddPos[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 0); @@ -396,66 +396,66 @@ CreatureAI* GetAI_mob_coilfang_guardian(Creature *_Creature) ai->Spell[1].First_Cast = 2000; ai->Spell[1].Cast_Target_Type = CAST_HOSTILE_TARGET; - return ai; + return ai; } struct TRINITY_DLL_DECL mob_coilfang_ambusherAI : public Scripted_NoMovementAI { mob_coilfang_ambusherAI(Creature *c) : Scripted_NoMovementAI(c) - { - Reset(); - SpellEntry *TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_SHOOT); + { + Reset(); + SpellEntry *TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_SHOOT); if(TempSpell) - TempSpell->Effect[0] = 2;//change spell effect from weapon % dmg to simple phisical dmg - } + TempSpell->Effect[0] = 2;//change spell effect from weapon % dmg to simple phisical dmg + } - uint32 MultiShotTimer; - uint32 ShootBowTimer; + uint32 MultiShotTimer; + uint32 ShootBowTimer; void Reset() { - MultiShotTimer = 10000; - ShootBowTimer = 4000; + MultiShotTimer = 10000; + ShootBowTimer = 4000; - } + } - void Aggro(Unit *who) + void Aggro(Unit *who) { } void MoveInLineOfSight(Unit *who) - { - if (!who || m_creature->getVictim()) return; - - if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(m_creature) && m_creature->IsHostileTo(who)) - { - AttackStart(who); - } - } - - void UpdateAI(const uint32 diff) { - if(MultiShotTimer < diff) - { - if(m_creature->getVictim()) - DoCast(m_creature->getVictim(), SPELL_SPREAD_SHOT, true); + if (!who || m_creature->getVictim()) return; - MultiShotTimer = 10000; - ShootBowTimer += 1500;//add global cooldown - }else MultiShotTimer -= diff; + if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(m_creature) && m_creature->IsHostileTo(who)) + { + AttackStart(who); + } + } - if(ShootBowTimer < diff) - { - Unit* target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM, 0); - int bp0 = 1100; - if(target) - m_creature->CastCustomSpell(target,SPELL_SHOOT,&bp0,NULL,NULL,true); - ShootBowTimer = 4000; - MultiShotTimer += 1500;//add global cooldown - }else ShootBowTimer -= diff; - } + void UpdateAI(const uint32 diff) + { + if(MultiShotTimer < diff) + { + if(m_creature->getVictim()) + DoCast(m_creature->getVictim(), SPELL_SPREAD_SHOT, true); + + MultiShotTimer = 10000; + ShootBowTimer += 1500;//add global cooldown + }else MultiShotTimer -= diff; + + if(ShootBowTimer < diff) + { + Unit* target = NULL; + target = SelectUnit(SELECT_TARGET_RANDOM, 0); + int bp0 = 1100; + if(target) + m_creature->CastCustomSpell(target,SPELL_SHOOT,&bp0,NULL,NULL,true); + ShootBowTimer = 4000; + MultiShotTimer += 1500;//add global cooldown + }else ShootBowTimer -= diff; + } }; CreatureAI* GetAI_mob_coilfang_ambusher(Creature *_Creature) @@ -476,12 +476,12 @@ void AddSC_boss_the_lurker_below() newscript->GetAI = &GetAI_boss_the_lurker_below; newscript->RegisterSelf(); - newscript = new Script; + newscript = new Script; newscript->Name="mob_coilfang_guardian"; newscript->GetAI = &GetAI_mob_coilfang_guardian; newscript->RegisterSelf(); - newscript = new Script; + newscript = new Script; newscript->Name="mob_coilfang_ambusher"; newscript->GetAI = &GetAI_mob_coilfang_ambusher; newscript->RegisterSelf(); diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp index 3e0ff3e2c77..febabd896cd 100644 --- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp +++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp @@ -55,27 +55,27 @@ EndScriptData */ #define WATERY_GRAVE_Y4 -690.96 #define WATERY_GRAVE_Z4 -14.44 -#define SPELL_WATERY_GRAVE_1 38023 -#define SPELL_WATERY_GRAVE_2 38024 -#define SPELL_WATERY_GRAVE_3 38025 -#define SPELL_WATERY_GRAVE_4 37850 +#define SPELL_WATERY_GRAVE_1 38023 +#define SPELL_WATERY_GRAVE_2 38024 +#define SPELL_WATERY_GRAVE_3 38025 +#define SPELL_WATERY_GRAVE_4 37850 -#define SPELL_SUMMON_WATER_GLOBULE_1 37854 -#define SPELL_SUMMON_WATER_GLOBULE_2 37858 -#define SPELL_SUMMON_WATER_GLOBULE_3 37860 -#define SPELL_SUMMON_WATER_GLOBULE_4 37861 +#define SPELL_SUMMON_WATER_GLOBULE_1 37854 +#define SPELL_SUMMON_WATER_GLOBULE_2 37858 +#define SPELL_SUMMON_WATER_GLOBULE_3 37860 +#define SPELL_SUMMON_WATER_GLOBULE_4 37861 -/*#define SPELL_SUMMON_MURLOC_A6 39813 -#define SPELL_SUMMON_MURLOC_A7 39814 -#define SPELL_SUMMON_MURLOC_A8 39815 -#define SPELL_SUMMON_MURLOC_A9 39816 -#define SPELL_SUMMON_MURLOC_A10 39817 +/*#define SPELL_SUMMON_MURLOC_A6 39813 +#define SPELL_SUMMON_MURLOC_A7 39814 +#define SPELL_SUMMON_MURLOC_A8 39815 +#define SPELL_SUMMON_MURLOC_A9 39816 +#define SPELL_SUMMON_MURLOC_A10 39817 -#define SPELL_SUMMON_MURLOC_B6 39818 -#define SPELL_SUMMON_MURLOC_B7 39819 -#define SPELL_SUMMON_MURLOC_B8 39820 -#define SPELL_SUMMON_MURLOC_B9 39821 -#define SPELL_SUMMON_MURLOC_B10 39822*/ +#define SPELL_SUMMON_MURLOC_B6 39818 +#define SPELL_SUMMON_MURLOC_B7 39819 +#define SPELL_SUMMON_MURLOC_B8 39820 +#define SPELL_SUMMON_MURLOC_B9 39821 +#define SPELL_SUMMON_MURLOC_B10 39822*/ float MurlocCords[10][5] = { @@ -105,7 +105,7 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI } ScriptedInstance* pInstance; - Map::PlayerList const *PlayerList; + Map::PlayerList const *PlayerList; uint32 TidalWave_Timer; uint32 WateryGrave_Timer; @@ -124,7 +124,7 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI WateryGrave_Timer = 30000; Earthquake_Timer = 40000; WateryGlobules_Timer = 0; - globulespell[0] = SPELL_SUMMON_WATER_GLOBULE_1; + globulespell[0] = SPELL_SUMMON_WATER_GLOBULE_1; globulespell[1] = SPELL_SUMMON_WATER_GLOBULE_2; globulespell[2] = SPELL_SUMMON_WATER_GLOBULE_3; globulespell[3] = SPELL_SUMMON_WATER_GLOBULE_4; @@ -148,9 +148,9 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI { switch(rand()%3) { - case 0: DoScriptText(SAY_SLAY1, m_creature); break; - case 1: DoScriptText(SAY_SLAY2, m_creature); break; - case 2: DoScriptText(SAY_SLAY3, m_creature); break; + case 0: DoScriptText(SAY_SLAY1, m_creature); break; + case 1: DoScriptText(SAY_SLAY2, m_creature); break; + case 2: DoScriptText(SAY_SLAY3, m_creature); break; } } @@ -162,18 +162,18 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI pInstance->SetData(DATA_MOROGRIMTIDEWALKEREVENT, NOT_STARTED); } - void Aggro(Unit *who) - { + void Aggro(Unit *who) + { PlayerList = &((InstanceMap*)m_creature->GetMap())->GetPlayers(); Playercount = PlayerList->getSize(); StartEvent(); - } + } void ApplyWateryGrave(Unit *player, uint8 i) { - switch(i) + switch(i) { - case 0: player->CastSpell(player, SPELL_WATERY_GRAVE_1, true); break; + case 0: player->CastSpell(player, SPELL_WATERY_GRAVE_1, true); break; case 1: player->CastSpell(player, SPELL_WATERY_GRAVE_2, true); break; case 2: player->CastSpell(player, SPELL_WATERY_GRAVE_3, true); break; case 3: player->CastSpell(player, SPELL_WATERY_GRAVE_4, true); break; @@ -203,17 +203,17 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI case 1: DoScriptText(SAY_SUMMON2, m_creature); break; } - for(uint8 i = 0; i < 10; i++) - { - Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); - Creature* Murloc = m_creature->SummonCreature(MurlocCords[i][0],MurlocCords[i][1],MurlocCords[i][2],MurlocCords[i][3],MurlocCords[i][4], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); - Murloc->AI()->AttackStart(target); - } - DoScriptText(EMOTE_EARTHQUAKE, m_creature); - Earthquake = false; - Earthquake_Timer = 40000+rand()%5000; - } - }else Earthquake_Timer -= diff; + for(uint8 i = 0; i < 10; i++) + { + Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); + Creature* Murloc = m_creature->SummonCreature(MurlocCords[i][0],MurlocCords[i][1],MurlocCords[i][2],MurlocCords[i][3],MurlocCords[i][4], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); + Murloc->AI()->AttackStart(target); + } + DoScriptText(EMOTE_EARTHQUAKE, m_creature); + Earthquake = false; + Earthquake_Timer = 40000+rand()%5000; + } + }else Earthquake_Timer -= diff; //TidalWave_Timer if (TidalWave_Timer < diff) @@ -229,21 +229,21 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI { //Teleport 4 players under the waterfalls Unit *target; - using std::set; + using std::set; setlist; set::iterator itr; for(uint8 i = 0; i < 4; i++) { - counter = 0; - do{target = SelectUnit(SELECT_TARGET_RANDOM, 1, 50, true); //target players only - if(counter < Playercount) - break; - if(target) itr = list.find(target->GetGUID()); - counter++; - }while(itr != list.end()); - if(target){list.insert(target->GetGUID()); - ApplyWateryGrave(target, i); - } + counter = 0; + do{target = SelectUnit(SELECT_TARGET_RANDOM, 1, 50, true); //target players only + if(counter < Playercount) + break; + if(target) itr = list.find(target->GetGUID()); + counter++; + }while(itr != list.end()); + if(target){list.insert(target->GetGUID()); + ApplyWateryGrave(target, i); + } } switch(rand()%2) @@ -265,7 +265,7 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI //WateryGlobules_Timer if (WateryGlobules_Timer < diff) { - Unit* globuletarget; + Unit* globuletarget; using std::set; setglobulelist; set::iterator itr; @@ -333,7 +333,7 @@ struct TRINITY_DLL_DECL mob_water_globuleAI : public ScriptedAI { if (m_creature->IsWithinDistInMap(m_creature->getVictim(), 5)) { - DoCast(m_creature->getVictim(), SPELL_GLOBULE_EXPLOSION); + DoCast(m_creature->getVictim(), SPELL_GLOBULE_EXPLOSION); //despawn m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp index 1b7bade5f14..919a455bb79 100644 --- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp +++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp @@ -39,11 +39,11 @@ bool GOHello_go_bridge_console(Player *player, GameObject* go) { ScriptedInstance* pInstance = (ScriptedInstance*)go->GetInstanceData(); - if(!pInstance) - return false; + if(!pInstance) + return false; - if (pInstance) - pInstance->SetData(DATA_CONTROL_CONSOLE, DONE); + if (pInstance) + pInstance->SetData(DATA_CONTROL_CONSOLE, DONE); return true; } @@ -52,40 +52,40 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance { instance_serpentshrine_cavern(Map *map) : ScriptedInstance(map) {Initialize();}; - uint64 LurkerBelow; + uint64 LurkerBelow; uint64 Sharkkis; uint64 Tidalvess; uint64 Caribdis; uint64 LadyVashj; uint64 Karathress; uint64 KarathressEvent_Starter; - uint64 LeotherasTheBlind; - uint64 LeotherasEventStarter; + uint64 LeotherasTheBlind; + uint64 LeotherasEventStarter; - uint64 ControlConsole; - uint64 BridgePart[3]; - uint64 StrangePool; + uint64 ControlConsole; + uint64 BridgePart[3]; + uint64 StrangePool; bool ShieldGeneratorDeactivated[4]; bool Encounters[ENCOUNTERS]; void Initialize() { - LurkerBelow = 0; + LurkerBelow = 0; Sharkkis = 0; Tidalvess = 0; Caribdis = 0; LadyVashj = 0; Karathress = 0; KarathressEvent_Starter = 0; - LeotherasTheBlind = 0; - LeotherasEventStarter = 0; + LeotherasTheBlind = 0; + LeotherasEventStarter = 0; - ControlConsole = 0; - BridgePart[0] = 0; - BridgePart[1] = 0; - BridgePart[2] = 0; - StrangePool = 0; + ControlConsole = 0; + BridgePart[0] = 0; + BridgePart[1] = 0; + BridgePart[2] = 0; + StrangePool = 0; ShieldGeneratorDeactivated[0] = false; ShieldGeneratorDeactivated[1] = false; @@ -104,37 +104,37 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance return false; } - void OnObjectCreate(GameObject *go) + void OnObjectCreate(GameObject *go) { switch(go->GetEntry()) { - case 184568: - ControlConsole = go->GetGUID(); - go->setActive(true); + case 184568: + ControlConsole = go->GetGUID(); + go->setActive(true); break; case 184203: - BridgePart[0] = go->GetGUID(); - go->setActive(true); + BridgePart[0] = go->GetGUID(); + go->setActive(true); break; case 184204: - BridgePart[1] = go->GetGUID(); - go->setActive(true); + BridgePart[1] = go->GetGUID(); + go->setActive(true); break; - case 184205: - BridgePart[2] = go->GetGUID(); - go->setActive(true); + case 184205: + BridgePart[2] = go->GetGUID(); + go->setActive(true); break; - case 184956: - StrangePool = go->GetGUID(); - if(go->isActive()) - SetData(DATA_STRANGE_POOL, DONE); + case 184956: + StrangePool = go->GetGUID(); + if(go->isActive()) + SetData(DATA_STRANGE_POOL, DONE); } } - void OpenDoor(uint64 DoorGUID, bool open) + void OpenDoor(uint64 DoorGUID, bool open) { if(GameObject *Door = instance->GetGameObjectInMap(DoorGUID)) Door->SetUInt32Value(GAMEOBJECT_STATE, open ? 0 : 1); @@ -144,36 +144,36 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance { switch(creature_entry) { - case 21212: LadyVashj = creature->GetGUID(); break; - case 21214: Karathress = creature->GetGUID(); break; - case 21966: Sharkkis = creature->GetGUID(); break; - case 21217: LurkerBelow = creature->GetGUID(); break; - case 21965: Tidalvess = creature->GetGUID(); break; - case 21964: Caribdis = creature->GetGUID(); break; - case 21215: LeotherasTheBlind = creature->GetGUID(); break;} + case 21212: LadyVashj = creature->GetGUID(); break; + case 21214: Karathress = creature->GetGUID(); break; + case 21966: Sharkkis = creature->GetGUID(); break; + case 21217: LurkerBelow = creature->GetGUID(); break; + case 21965: Tidalvess = creature->GetGUID(); break; + case 21964: Caribdis = creature->GetGUID(); break; + case 21215: LeotherasTheBlind = creature->GetGUID(); break;} } void SetData64(uint32 type, uint64 data) { if(type == DATA_KARATHRESSEVENT_STARTER) - KarathressEvent_Starter = data; - if(type == DATA_LEOTHERAS_EVENT_STARTER) - LeotherasEventStarter = data; + KarathressEvent_Starter = data; + if(type == DATA_LEOTHERAS_EVENT_STARTER) + LeotherasEventStarter = data; } uint64 GetData64(uint32 identifier) { switch(identifier) { - case DATA_THELURKERBELOW: return LurkerBelow; - case DATA_SHARKKIS: return Sharkkis; - case DATA_TIDALVESS: return Tidalvess; - case DATA_CARIBDIS: return Caribdis; - case DATA_LADYVASHJ: return LadyVashj; - case DATA_KARATHRESS: return Karathress; - case DATA_KARATHRESSEVENT_STARTER: return KarathressEvent_Starter; - case DATA_LEOTHERAS: return LeotherasTheBlind; - case DATA_LEOTHERAS_EVENT_STARTER: return LeotherasEventStarter; + case DATA_THELURKERBELOW: return LurkerBelow; + case DATA_SHARKKIS: return Sharkkis; + case DATA_TIDALVESS: return Tidalvess; + case DATA_CARIBDIS: return Caribdis; + case DATA_LADYVASHJ: return LadyVashj; + case DATA_KARATHRESS: return Karathress; + case DATA_KARATHRESSEVENT_STARTER: return KarathressEvent_Starter; + case DATA_LEOTHERAS: return LeotherasTheBlind; + case DATA_LEOTHERAS_EVENT_STARTER: return LeotherasEventStarter; } return 0; } @@ -182,63 +182,63 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance { switch(type) { - case DATA_STRANGE_POOL: StrangePool = data; - case DATA_CONTROL_CONSOLE: - if(data = DONE) - { - OpenDoor(BridgePart[0], true); - OpenDoor(BridgePart[1], true); - OpenDoor(BridgePart[2], true); - } - ControlConsole = data; - case DATA_HYDROSSTHEUNSTABLEEVENT: Encounters[0] = data; break; - case DATA_LEOTHERASTHEBLINDEVENT: Encounters[1] = data; break; - case DATA_THELURKERBELOWEVENT: Encounters[2] = data; break; - case DATA_KARATHRESSEVENT: Encounters[3] = data; break; - case DATA_MOROGRIMTIDEWALKEREVENT: Encounters[4] = data; break; - //Lady Vashj - case DATA_LADYVASHJEVENT: - if(data == NOT_STARTED) - { - ShieldGeneratorDeactivated[0] = false; - ShieldGeneratorDeactivated[1] = false; - ShieldGeneratorDeactivated[2] = false; - ShieldGeneratorDeactivated[3] = false; - } - Encounters[5] = data; break; - case DATA_SHIELDGENERATOR1:ShieldGeneratorDeactivated[0] = (data) ? true : false; break; - case DATA_SHIELDGENERATOR2:ShieldGeneratorDeactivated[1] = (data) ? true : false; break; - case DATA_SHIELDGENERATOR3:ShieldGeneratorDeactivated[2] = (data) ? true : false; break; - case DATA_SHIELDGENERATOR4:ShieldGeneratorDeactivated[3] = (data) ? true : false; break; - } + case DATA_STRANGE_POOL: StrangePool = data; + case DATA_CONTROL_CONSOLE: + if(data = DONE) + { + OpenDoor(BridgePart[0], true); + OpenDoor(BridgePart[1], true); + OpenDoor(BridgePart[2], true); + } + ControlConsole = data; + case DATA_HYDROSSTHEUNSTABLEEVENT: Encounters[0] = data; break; + case DATA_LEOTHERASTHEBLINDEVENT: Encounters[1] = data; break; + case DATA_THELURKERBELOWEVENT: Encounters[2] = data; break; + case DATA_KARATHRESSEVENT: Encounters[3] = data; break; + case DATA_MOROGRIMTIDEWALKEREVENT: Encounters[4] = data; break; + //Lady Vashj + case DATA_LADYVASHJEVENT: + if(data == NOT_STARTED) + { + ShieldGeneratorDeactivated[0] = false; + ShieldGeneratorDeactivated[1] = false; + ShieldGeneratorDeactivated[2] = false; + ShieldGeneratorDeactivated[3] = false; + } + Encounters[5] = data; break; + case DATA_SHIELDGENERATOR1:ShieldGeneratorDeactivated[0] = (data) ? true : false; break; + case DATA_SHIELDGENERATOR2:ShieldGeneratorDeactivated[1] = (data) ? true : false; break; + case DATA_SHIELDGENERATOR3:ShieldGeneratorDeactivated[2] = (data) ? true : false; break; + case DATA_SHIELDGENERATOR4:ShieldGeneratorDeactivated[3] = (data) ? true : false; break; + } - if(data = DONE) - SaveToDB(); + if(data = DONE) + SaveToDB(); } uint32 GetData(uint32 type) { switch(type) { - case DATA_HYDROSSTHEUNSTABLEEVENT: return Encounters[0]; - case DATA_LEOTHERASTHEBLINDEVENT: return Encounters[1]; - case DATA_THELURKERBELOWEVENT: return Encounters[2]; - case DATA_KARATHRESSEVENT: return Encounters[3]; - case DATA_MOROGRIMTIDEWALKEREVENT: return Encounters[4]; + case DATA_HYDROSSTHEUNSTABLEEVENT: return Encounters[0]; + case DATA_LEOTHERASTHEBLINDEVENT: return Encounters[1]; + case DATA_THELURKERBELOWEVENT: return Encounters[2]; + case DATA_KARATHRESSEVENT: return Encounters[3]; + case DATA_MOROGRIMTIDEWALKEREVENT: return Encounters[4]; //Lady Vashj - case DATA_LADYVASHJEVENT: return Encounters[5]; - case DATA_SHIELDGENERATOR1: return ShieldGeneratorDeactivated[0]; - case DATA_SHIELDGENERATOR2: return ShieldGeneratorDeactivated[1]; - case DATA_SHIELDGENERATOR3: return ShieldGeneratorDeactivated[2]; - case DATA_SHIELDGENERATOR4: return ShieldGeneratorDeactivated[3]; + case DATA_LADYVASHJEVENT: return Encounters[5]; + case DATA_SHIELDGENERATOR1: return ShieldGeneratorDeactivated[0]; + case DATA_SHIELDGENERATOR2: return ShieldGeneratorDeactivated[1]; + case DATA_SHIELDGENERATOR3: return ShieldGeneratorDeactivated[2]; + case DATA_SHIELDGENERATOR4: return ShieldGeneratorDeactivated[3]; case DATA_CANSTARTPHASE3: - if(ShieldGeneratorDeactivated[0] && ShieldGeneratorDeactivated[1] && ShieldGeneratorDeactivated[2] && ShieldGeneratorDeactivated[3])return 1;break; + if(ShieldGeneratorDeactivated[0] && ShieldGeneratorDeactivated[1] && ShieldGeneratorDeactivated[2] && ShieldGeneratorDeactivated[3])return 1;break; } return 0; } - const char* Save() - { - OUT_SAVE_INST_DATA; + const char* Save() + { + OUT_SAVE_INST_DATA; std::ostringstream stream; stream << Encounters[0] << " " << Encounters[1] << " " << Encounters[2] << " " << Encounters[3] << " " << Encounters[4] << " " << Encounters[5]; @@ -262,11 +262,11 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance OUT_LOAD_INST_DATA(in); std::istringstream stream(in); stream >> Encounters[0] >> Encounters[1] >> Encounters[2] >> Encounters[3] - >> Encounters[4] >> Encounters[5]; - for(uint8 i = 0; i < ENCOUNTERS; ++i) - if(Encounters[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. - Encounters[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; + >> Encounters[4] >> Encounters[5]; + for(uint8 i = 0; i < ENCOUNTERS; ++i) + if(Encounters[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. + Encounters[i] = NOT_STARTED; + OUT_LOAD_INST_DATA_COMPLETE; } }; @@ -284,8 +284,8 @@ void AddSC_instance_serpentshrine_cavern() newscript->GetInstanceData = &GetInstanceData_instance_serpentshrine_cavern; newscript->RegisterSelf(); - newscript = new Script; + newscript = new Script; newscript->Name="go_bridge_console"; newscript->pGOHello = &GOHello_go_bridge_console; - newscript->RegisterSelf(); + newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/steam_vault/instance_steam_vault.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/steam_vault/instance_steam_vault.cpp index 6ea5517acf7..a0063a4eef9 100644 --- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/steam_vault/instance_steam_vault.cpp +++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/steam_vault/instance_steam_vault.cpp @@ -38,33 +38,33 @@ EndScriptData */ bool GOHello_go_main_chambers_access_panel(Player *player, GameObject* _GO) { - ScriptedInstance* pInstance = (ScriptedInstance*)_GO->GetInstanceData(); + ScriptedInstance* pInstance = (ScriptedInstance*)_GO->GetInstanceData(); - if (!pInstance) - return false; + if (!pInstance) + return false; - if (_GO->GetEntry() == ACCESS_PANEL_HYDRO && pInstance->GetData(TYPE_HYDROMANCER_THESPIA) == DONE) - pInstance->SetData(TYPE_HYDROMANCER_THESPIA,SPECIAL); + if (_GO->GetEntry() == ACCESS_PANEL_HYDRO && pInstance->GetData(TYPE_HYDROMANCER_THESPIA) == DONE) + pInstance->SetData(TYPE_HYDROMANCER_THESPIA,SPECIAL); - if (_GO->GetEntry() == ACCESS_PANEL_MEK && pInstance->GetData(TYPE_MEKGINEER_STEAMRIGGER) == DONE) - pInstance->SetData(TYPE_MEKGINEER_STEAMRIGGER,SPECIAL); + if (_GO->GetEntry() == ACCESS_PANEL_MEK && pInstance->GetData(TYPE_MEKGINEER_STEAMRIGGER) == DONE) + pInstance->SetData(TYPE_MEKGINEER_STEAMRIGGER,SPECIAL); - return true; + return true; } struct TRINITY_DLL_DECL instance_steam_vault : public ScriptedInstance { instance_steam_vault(Map *map) : ScriptedInstance(map) {Initialize();}; - uint32 Encounter[ENCOUNTERS]; + uint32 Encounter[ENCOUNTERS]; uint64 ThespiaGUID; uint64 MekgineerGUID; uint64 KalithreshGUID; - uint64 MainChambersDoor; - uint64 AccessPanelHydro; - uint64 AccessPanelMek; + uint64 MainChambersDoor; + uint64 AccessPanelHydro; + uint64 AccessPanelMek; void Initialize() { @@ -72,46 +72,46 @@ struct TRINITY_DLL_DECL instance_steam_vault : public ScriptedInstance MekgineerGUID = 0; KalithreshGUID = 0; MainChambersDoor = 0; - AccessPanelHydro = 0; - AccessPanelMek = 0; + AccessPanelHydro = 0; + AccessPanelMek = 0; for(uint8 i = 0; i < ENCOUNTERS; i++) - Encounter[i] = NOT_STARTED; + Encounter[i] = NOT_STARTED; } bool IsEncounterInProgress() const { for(uint8 i = 0; i < ENCOUNTERS; i++) if (Encounter[i] == IN_PROGRESS) - return true; + return true; return false; } - Player* GetPlayerInMap() - { - Map::PlayerList const& players = instance->GetPlayers(); + Player* GetPlayerInMap() + { + Map::PlayerList const& players = instance->GetPlayers(); - if (!players.isEmpty()) - { - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - if (Player* plr = itr->getSource()) - return plr; - } - } + if (!players.isEmpty()) + { + for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* plr = itr->getSource()) + return plr; + } + } - debug_log("SD2: Instance Steamvault: GetPlayerInMap, but PlayerList is empty!"); - return NULL; - } + debug_log("SD2: Instance Steamvault: GetPlayerInMap, but PlayerList is empty!"); + return NULL; + } void OnCreatureCreate(Creature *creature, uint32 creature_entry) { switch(creature->GetEntry()) { - case 17797: ThespiaGUID = creature->GetGUID(); break; - case 17796: MekgineerGUID = creature->GetGUID(); break; - case 17798: KalithreshGUID = creature->GetGUID(); break; + case 17797: ThespiaGUID = creature->GetGUID(); break; + case 17796: MekgineerGUID = creature->GetGUID(); break; + case 17798: KalithreshGUID = creature->GetGUID(); break; } } @@ -119,51 +119,51 @@ struct TRINITY_DLL_DECL instance_steam_vault : public ScriptedInstance { switch(go->GetEntry()) { - case MAIN_CHAMBERS_DOOR: MainChambersDoor = go->GetGUID(); break; - case ACCESS_PANEL_HYDRO: AccessPanelHydro = go->GetGUID(); break; - case ACCESS_PANEL_MEK: AccessPanelMek = go->GetGUID(); break; + case MAIN_CHAMBERS_DOOR: MainChambersDoor = go->GetGUID(); break; + case ACCESS_PANEL_HYDRO: AccessPanelHydro = go->GetGUID(); break; + case ACCESS_PANEL_MEK: AccessPanelMek = go->GetGUID(); break; } } void SetData(uint32 type, uint32 data) { - Player *player = GetPlayerInMap(); + Player *player = GetPlayerInMap(); - if (!player) - { - debug_log("SD2: Instance Steamvault: SetData (Type: %u Data %u) cannot find any player.", type, data); - return; - } + if (!player) + { + debug_log("SD2: Instance Steamvault: SetData (Type: %u Data %u) cannot find any player.", type, data); + return; + } switch(type) { case TYPE_HYDROMANCER_THESPIA: - if (data == SPECIAL) - { - if (GameObject *_go = GameObject::GetGameObject(*player,AccessPanelHydro)) - _go->SetGoState(0); + if (data == SPECIAL) + { + if (GameObject *_go = GameObject::GetGameObject(*player,AccessPanelHydro)) + _go->SetGoState(0); - if (GetData(TYPE_MEKGINEER_STEAMRIGGER) == SPECIAL) - { - if (GameObject *_go = GameObject::GetGameObject(*player,MainChambersDoor)) - _go->SetGoState(0); - } - debug_log("SD2: Instance Steamvault: Access panel used."); - } - Encounter[0] = data; - break; + if (GetData(TYPE_MEKGINEER_STEAMRIGGER) == SPECIAL) + { + if (GameObject *_go = GameObject::GetGameObject(*player,MainChambersDoor)) + _go->SetGoState(0); + } + debug_log("SD2: Instance Steamvault: Access panel used."); + } + Encounter[0] = data; + break; case TYPE_MEKGINEER_STEAMRIGGER: - if (data == SPECIAL) - { - if (GameObject *_go = GameObject::GetGameObject(*player,AccessPanelMek)) - _go->SetGoState(0); + if (data == SPECIAL) + { + if (GameObject *_go = GameObject::GetGameObject(*player,AccessPanelMek)) + _go->SetGoState(0); - if (GetData(TYPE_HYDROMANCER_THESPIA) == SPECIAL) - { + if (GetData(TYPE_HYDROMANCER_THESPIA) == SPECIAL) + { if (GameObject *_go = GameObject::GetGameObject(*player,MainChambersDoor)) _go->SetGoState(0); - } - debug_log("SD2: Instance Steamvault: Access panel used."); + } + debug_log("SD2: Instance Steamvault: Access panel used."); } Encounter[1] = data; break; @@ -216,10 +216,10 @@ void AddSC_instance_steam_vault() { Script *newscript; - newscript = new Script; - newscript->Name = "go_main_chambers_access_panel"; - newscript->pGOHello = &GOHello_go_main_chambers_access_panel; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name = "go_main_chambers_access_panel"; + newscript->pGOHello = &GOHello_go_main_chambers_access_panel; + newscript->RegisterSelf(); newscript = new Script; newscript->Name = "instance_steam_vault"; diff --git a/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp b/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp index b0fbc5487e3..1aa7a6259d9 100644 --- a/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp +++ b/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp @@ -554,79 +554,79 @@ bool GOHello_go_second_trial(Player *player, GameObject* _GO) ## npc_apprentice_mirveda ######*/ -#define QUEST_UNEXPECTED_RESULT 8488 -#define MOB_GHARZUL 15958 -#define MOB_ANGERSHADE 15656 +#define QUEST_UNEXPECTED_RESULT 8488 +#define MOB_GHARZUL 15958 +#define MOB_ANGERSHADE 15656 struct TRINITY_DLL_DECL npc_apprentice_mirvedaAI : public ScriptedAI { - npc_apprentice_mirvedaAI(Creature* c) : ScriptedAI(c), Summons(m_creature) {Reset();} + npc_apprentice_mirvedaAI(Creature* c) : ScriptedAI(c), Summons(m_creature) {Reset();} - uint32 KillCount; - uint64 PlayerGUID; - bool Summon; - SummonList Summons; + uint32 KillCount; + uint64 PlayerGUID; + bool Summon; + SummonList Summons; - void Reset() - { - KillCount = 0; - PlayerGUID = 0; - Summons.DespawnAll(); - Summon = false; - } + void Reset() + { + KillCount = 0; + PlayerGUID = 0; + Summons.DespawnAll(); + Summon = false; + } - void Aggro(Unit* who){} + void Aggro(Unit* who){} - void JustSummoned(Creature *summoned) - { - summoned->AI()->AttackStart(m_creature); - Summons.Summon(summoned); - } + void JustSummoned(Creature *summoned) + { + summoned->AI()->AttackStart(m_creature); + Summons.Summon(summoned); + } - void SummonedCreatureDespawn(Creature* summoned) - { - Summons.Despawn(summoned); - ++KillCount; - } + void SummonedCreatureDespawn(Creature* summoned) + { + Summons.Despawn(summoned); + ++KillCount; + } - void JustDied(Unit* killer) - { - if (PlayerGUID) - { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - if (player) - ((Player*)player)->FailQuest(QUEST_UNEXPECTED_RESULT); - } - } + void JustDied(Unit* killer) + { + if (PlayerGUID) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + if (player) + ((Player*)player)->FailQuest(QUEST_UNEXPECTED_RESULT); + } + } - void UpdateAI(const uint32 diff) - { - if(KillCount >= 3) - { - if (PlayerGUID) - { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - if(player) - ((Player*)player)->CompleteQuest(QUEST_UNEXPECTED_RESULT); - } - } + void UpdateAI(const uint32 diff) + { + if(KillCount >= 3) + { + if (PlayerGUID) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + if(player) + ((Player*)player)->CompleteQuest(QUEST_UNEXPECTED_RESULT); + } + } - if(Summon) - { - m_creature->SummonCreature(MOB_GHARZUL, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); - m_creature->SummonCreature(MOB_ANGERSHADE, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); - m_creature->SummonCreature(MOB_ANGERSHADE, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); - Summon = false; - } - } + if(Summon) + { + m_creature->SummonCreature(MOB_GHARZUL, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); + m_creature->SummonCreature(MOB_ANGERSHADE, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); + m_creature->SummonCreature(MOB_ANGERSHADE, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); + Summon = false; + } + } }; bool QuestAccept_npc_apprentice_mirveda(Player* player, Creature* creature, Quest const* quest) { if (quest->GetQuestId() == QUEST_UNEXPECTED_RESULT) { - ((npc_apprentice_mirvedaAI*)creature->AI())->Summon = true; - ((npc_apprentice_mirvedaAI*)creature->AI())->PlayerGUID = player->GetGUID(); + ((npc_apprentice_mirvedaAI*)creature->AI())->Summon = true; + ((npc_apprentice_mirvedaAI*)creature->AI())->PlayerGUID = player->GetGUID(); } return true; } @@ -640,9 +640,9 @@ CreatureAI* GetAI_npc_apprentice_mirvedaAI(Creature *_Creature) ## npc_infused_crystal ######*/ -#define MOB_ENRAGED_WRAITH 17086 -#define EMOTE -1000283 -#define QUEST_POWERING_OUR_DEFENSES 8490 +#define MOB_ENRAGED_WRAITH 17086 +#define EMOTE -1000283 +#define QUEST_POWERING_OUR_DEFENSES 8490 struct Location { @@ -651,97 +651,97 @@ struct Location static Location SpawnLocations[]= { - {8270.68, -7188.53, 139.619}, - {8284.27, -7187.78, 139.603}, - {8297.43, -7193.53, 139.603}, - {8303.5, -7201.96, 139.577}, - {8273.22, -7241.82, 139.382}, - {8254.89, -7222.12, 139.603}, - {8278.51, -7242.13, 139.162}, - {8267.97, -7239.17, 139.517} + {8270.68, -7188.53, 139.619}, + {8284.27, -7187.78, 139.603}, + {8297.43, -7193.53, 139.603}, + {8303.5, -7201.96, 139.577}, + {8273.22, -7241.82, 139.382}, + {8254.89, -7222.12, 139.603}, + {8278.51, -7242.13, 139.162}, + {8267.97, -7239.17, 139.517} }; struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI { - npc_infused_crystalAI(Creature* c) : Scripted_NoMovementAI(c) {Reset();} + npc_infused_crystalAI(Creature* c) : Scripted_NoMovementAI(c) {Reset();} - uint32 EndTimer; - uint32 WaveTimer; - bool Completed; - bool Progress; - uint64 PlayerGUID; + uint32 EndTimer; + uint32 WaveTimer; + bool Completed; + bool Progress; + uint64 PlayerGUID; - void Reset() - { - EndTimer = 0; - Completed = false; - Progress = false; - PlayerGUID = 0; - WaveTimer = 0; - } + void Reset() + { + EndTimer = 0; + Completed = false; + Progress = false; + PlayerGUID = 0; + WaveTimer = 0; + } - void Aggro(Unit* who){} + void Aggro(Unit* who){} - void MoveInLineOfSight(Unit* who) - { - if( who->GetTypeId() == TYPEID_PLAYER && !m_creature->canStartAttack(who) && !Progress) - { - if( ((Player*)who)->GetQuestStatus(QUEST_POWERING_OUR_DEFENSES) == QUEST_STATUS_INCOMPLETE ) - { - float Radius = 10.0; - if( m_creature->IsWithinDistInMap(who, Radius) ) - { - PlayerGUID = who->GetGUID(); - WaveTimer = 1000; - EndTimer = 60000; - Progress = true; - } - } - } - } + void MoveInLineOfSight(Unit* who) + { + if( who->GetTypeId() == TYPEID_PLAYER && !m_creature->canStartAttack(who) && !Progress) + { + if( ((Player*)who)->GetQuestStatus(QUEST_POWERING_OUR_DEFENSES) == QUEST_STATUS_INCOMPLETE ) + { + float Radius = 10.0; + if( m_creature->IsWithinDistInMap(who, Radius) ) + { + PlayerGUID = who->GetGUID(); + WaveTimer = 1000; + EndTimer = 60000; + Progress = true; + } + } + } + } - void JustSummoned(Creature *summoned) - { - summoned->AI()->AttackStart(m_creature); - } + void JustSummoned(Creature *summoned) + { + summoned->AI()->AttackStart(m_creature); + } - void JustDied(Unit* killer) - { - if (PlayerGUID && !Completed) - { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - if (player) - ((Player*)player)->FailQuest(QUEST_POWERING_OUR_DEFENSES); - } - } + void JustDied(Unit* killer) + { + if (PlayerGUID && !Completed) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + if (player) + ((Player*)player)->FailQuest(QUEST_POWERING_OUR_DEFENSES); + } + } - void UpdateAI(const uint32 diff) - { - if(EndTimer < diff && Progress) - { - DoScriptText(EMOTE, m_creature); - Completed = true; - if (PlayerGUID) - { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - if(player) - ((Player*)player)->CompleteQuest(QUEST_POWERING_OUR_DEFENSES); - } - m_creature->DealDamage(m_creature,m_creature->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - m_creature->RemoveCorpse(); - }else EndTimer -= diff; + void UpdateAI(const uint32 diff) + { + if(EndTimer < diff && Progress) + { + DoScriptText(EMOTE, m_creature); + Completed = true; + if (PlayerGUID) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + if(player) + ((Player*)player)->CompleteQuest(QUEST_POWERING_OUR_DEFENSES); + } + m_creature->DealDamage(m_creature,m_creature->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->RemoveCorpse(); + }else EndTimer -= diff; - if(WaveTimer < diff && !Completed && Progress) - { - uint32 ran1 = rand()%8; - uint32 ran2 = rand()%8; - uint32 ran3 = rand()%8; - m_creature->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran1].x, SpawnLocations[ran1].y, SpawnLocations[ran1].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); - m_creature->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran2].x, SpawnLocations[ran2].y, SpawnLocations[ran2].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); - m_creature->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran3].x, SpawnLocations[ran3].y, SpawnLocations[ran3].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); - WaveTimer = 30000; - }else WaveTimer -= diff; - } + if(WaveTimer < diff && !Completed && Progress) + { + uint32 ran1 = rand()%8; + uint32 ran2 = rand()%8; + uint32 ran3 = rand()%8; + m_creature->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran1].x, SpawnLocations[ran1].y, SpawnLocations[ran1].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); + m_creature->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran2].x, SpawnLocations[ran2].y, SpawnLocations[ran2].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); + m_creature->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran3].x, SpawnLocations[ran3].y, SpawnLocations[ran3].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); + WaveTimer = 30000; + }else WaveTimer -= diff; + } }; CreatureAI* GetAI_npc_infused_crystalAI(Creature *_Creature) @@ -782,14 +782,14 @@ void AddSC_eversong_woods() newscript->pGOHello = &GOHello_go_second_trial; newscript->RegisterSelf(); - newscript = new Script; - newscript->Name = "npc_apprentice_mirveda"; - newscript->GetAI = &GetAI_npc_apprentice_mirvedaAI; - newscript->pQuestAccept = &QuestAccept_npc_apprentice_mirveda; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name = "npc_apprentice_mirveda"; + newscript->GetAI = &GetAI_npc_apprentice_mirvedaAI; + newscript->pQuestAccept = &QuestAccept_npc_apprentice_mirveda; + newscript->RegisterSelf(); - newscript = new Script; - newscript->Name = "npc_infused_crystal"; - newscript->GetAI = &GetAI_npc_infused_crystalAI; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name = "npc_infused_crystal"; + newscript->GetAI = &GetAI_npc_infused_crystalAI; + newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp b/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp index a81adad1291..c61a9318bdb 100644 --- a/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp +++ b/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp @@ -149,87 +149,87 @@ bool GOHello_gilded_brazier(Player *player, GameObject* _GO) struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI { - npc_ranger_lilathaAI(Creature *c) : npc_escortAI(c) {Reset();} + npc_ranger_lilathaAI(Creature *c) : npc_escortAI(c) {Reset();} - std::list CageList; + std::list CageList; - void WaypointReached(uint32 i) - { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + void WaypointReached(uint32 i) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - if (!player) + if (!player) return; switch(i) - { - case 0: - { - m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - GameObject* Cage = FindGameObject(GO_CAGE, 20, m_creature); - if(Cage) - Cage->SetGoState(0); - DoScriptText(SAY_START, m_creature, player); - break; - } - case 5: - DoScriptText(SAY_PROGRESS1, m_creature, player); - case 11: - DoScriptText(SAY_PROGRESS2, m_creature, player); - m_creature->SetOrientation(4.762841); - break; - case 18: - { - DoScriptText(SAY_PROGRESS3, m_creature, player); - Creature* Summ1 = m_creature->SummonCreature(16342, 7627.083984, -7532.538086, 152.128616, 1.082733, TEMPSUMMON_DEAD_DESPAWN, 0); - Creature* Summ2 = m_creature->SummonCreature(16343, 7620.432129, -7532.550293, 152.454865, 0.827478, TEMPSUMMON_DEAD_DESPAWN, 0); - Summ1->Attack(m_creature, true); - Summ2->Attack(player, true); - m_creature->AI()->AttackStart(Summ1); - break; - } - case 19: m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; - case 25: m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; - case 30: - if (player && player->GetTypeId() == TYPEID_PLAYER) - ((Player*)player)->GroupEventHappens(QUEST_ESCAPE_FROM_THE_CATACOMBS,m_creature); - break; - case 32: - m_creature->SetOrientation(2.978281); - DoScriptText(SAY_END1, m_creature, player); - break; - case 33: - m_creature->SetOrientation(5.858011); - DoScriptText(SAY_END2, m_creature, player); - Unit* CaptainHelios = FindCreature(NPC_CAPTAIN_HELIOS, 50, m_creature); - if(CaptainHelios) - DoScriptText(SAY_CAPTAIN_ANSWER, CaptainHelios, player); - break; - } - } + { + case 0: + { + m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + GameObject* Cage = FindGameObject(GO_CAGE, 20, m_creature); + if(Cage) + Cage->SetGoState(0); + DoScriptText(SAY_START, m_creature, player); + break; + } + case 5: + DoScriptText(SAY_PROGRESS1, m_creature, player); + case 11: + DoScriptText(SAY_PROGRESS2, m_creature, player); + m_creature->SetOrientation(4.762841); + break; + case 18: + { + DoScriptText(SAY_PROGRESS3, m_creature, player); + Creature* Summ1 = m_creature->SummonCreature(16342, 7627.083984, -7532.538086, 152.128616, 1.082733, TEMPSUMMON_DEAD_DESPAWN, 0); + Creature* Summ2 = m_creature->SummonCreature(16343, 7620.432129, -7532.550293, 152.454865, 0.827478, TEMPSUMMON_DEAD_DESPAWN, 0); + Summ1->Attack(m_creature, true); + Summ2->Attack(player, true); + m_creature->AI()->AttackStart(Summ1); + break; + } + case 19: m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; + case 25: m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; + case 30: + if (player && player->GetTypeId() == TYPEID_PLAYER) + ((Player*)player)->GroupEventHappens(QUEST_ESCAPE_FROM_THE_CATACOMBS,m_creature); + break; + case 32: + m_creature->SetOrientation(2.978281); + DoScriptText(SAY_END1, m_creature, player); + break; + case 33: + m_creature->SetOrientation(5.858011); + DoScriptText(SAY_END2, m_creature, player); + Unit* CaptainHelios = FindCreature(NPC_CAPTAIN_HELIOS, 50, m_creature); + if(CaptainHelios) + DoScriptText(SAY_CAPTAIN_ANSWER, CaptainHelios, player); + break; + } + } void Aggro(Unit* who) {} - void Reset() - { - if (!IsBeingEscorted) - m_creature->setFaction(1602); + void Reset() + { + if (!IsBeingEscorted) + m_creature->setFaction(1602); - GameObject* Cage = FindGameObject(GO_CAGE, 20, m_creature); - if(Cage) - Cage->SetGoState(1); - } + GameObject* Cage = FindGameObject(GO_CAGE, 20, m_creature); + if(Cage) + Cage->SetGoState(1); + } - void JustDied(Unit* killer) - { - if (PlayerGUID) - { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - if (player) - ((Player*)player)->FailQuest(QUEST_ESCAPE_FROM_THE_CATACOMBS); - } - } + void JustDied(Unit* killer) + { + if (PlayerGUID) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + if (player) + ((Player*)player)->FailQuest(QUEST_ESCAPE_FROM_THE_CATACOMBS); + } + } - void UpdateAI(const uint32 diff) + void UpdateAI(const uint32 diff) { npc_escortAI::UpdateAI(diff); } @@ -249,43 +249,43 @@ CreatureAI* GetAI_npc_ranger_lilathaAI(Creature *_Creature) { npc_ranger_lilathaAI* ranger_lilathaAI = new npc_ranger_lilathaAI(_Creature); - ranger_lilathaAI->AddWaypoint(0, 7545.07, -7359.87, 162.354, 4000); // Say0 - ranger_lilathaAI->AddWaypoint(1, 7550.048340, -7362.237793, 162.235657); - ranger_lilathaAI->AddWaypoint(2, 7566.976074, -7364.315430, 161.738770); - ranger_lilathaAI->AddWaypoint(3, 7578.830566, -7361.677734, 161.738770); - ranger_lilathaAI->AddWaypoint(4, 7590.969238, -7359.053711, 162.257660); - ranger_lilathaAI->AddWaypoint(5, 7598.354004, -7362.815430, 162.256683, 4000); // Say1 - ranger_lilathaAI->AddWaypoint(6, 7605.861328, -7380.424316, 161.937073); - ranger_lilathaAI->AddWaypoint(7, 7605.295410, -7387.382813, 157.253998); - ranger_lilathaAI->AddWaypoint(8, 7606.131836, -7393.893555, 156.941925); - ranger_lilathaAI->AddWaypoint(9, 7615.207520, -7400.187012, 157.142639); - ranger_lilathaAI->AddWaypoint(10, 7618.956543, -7402.652832, 158.202042); - ranger_lilathaAI->AddWaypoint(11, 7636.850586, -7401.756836, 162.144791); - ranger_lilathaAI->AddWaypoint(12, 7637.058105, -7404.944824, 162.206970, 4000);// Say2 - ranger_lilathaAI->AddWaypoint(13, 7636.910645, -7412.585449, 162.366425); - ranger_lilathaAI->AddWaypoint(14, 7637.607910, -7425.591797, 162.630661); - ranger_lilathaAI->AddWaypoint(15, 7637.816895, -7459.057129, 163.302704); - ranger_lilathaAI->AddWaypoint(16, 7638.859863, -7470.902344, 162.517059); - ranger_lilathaAI->AddWaypoint(17, 7641.395996, -7488.217285, 157.381287); - ranger_lilathaAI->AddWaypoint(18, 7634.455566, -7505.451660, 154.682159); - ranger_lilathaAI->AddWaypoint(19, 7631.906738, -7516.948730, 153.597382); // say3 - ranger_lilathaAI->AddWaypoint(20, 7622.231445, -7537.037598, 151.587112); - ranger_lilathaAI->AddWaypoint(21, 7610.921875, -7550.670410, 149.639374); - ranger_lilathaAI->AddWaypoint(22, 7598.229004, -7562.551758, 145.953888); - ranger_lilathaAI->AddWaypoint(23, 7588.509277, -7577.755371, 148.294479); - ranger_lilathaAI->AddWaypoint(24, 7567.339355, -7608.456055, 146.006485); - ranger_lilathaAI->AddWaypoint(25, 7562.547852, -7617.417969, 148.097504); - ranger_lilathaAI->AddWaypoint(26, 7561.508789, -7645.064453, 151.245163); - ranger_lilathaAI->AddWaypoint(27, 7563.337402, -7654.652344, 151.227158); - ranger_lilathaAI->AddWaypoint(28, 7565.533691, -7658.296387, 151.248886); - ranger_lilathaAI->AddWaypoint(29, 7571.155762, -7659.118652, 151.244568); - ranger_lilathaAI->AddWaypoint(30, 7579.119629, -7662.213867, 151.651505); - ranger_lilathaAI->AddWaypoint(31, 7603.768066, -7667.000488, 153.997726); - ranger_lilathaAI->AddWaypoint(32, 7603.768066, -7667.000488, 153.997726, 4000); // Say4 & Set orientation - ranger_lilathaAI->AddWaypoint(33, 7603.768066, -7667.000488, 153.997726, 8000); // Say5 & Set orientation - ranger_lilathaAI->AddWaypoint(34, 7603.768066, -7667.000488, 153.997726); + ranger_lilathaAI->AddWaypoint(0, 7545.07, -7359.87, 162.354, 4000); // Say0 + ranger_lilathaAI->AddWaypoint(1, 7550.048340, -7362.237793, 162.235657); + ranger_lilathaAI->AddWaypoint(2, 7566.976074, -7364.315430, 161.738770); + ranger_lilathaAI->AddWaypoint(3, 7578.830566, -7361.677734, 161.738770); + ranger_lilathaAI->AddWaypoint(4, 7590.969238, -7359.053711, 162.257660); + ranger_lilathaAI->AddWaypoint(5, 7598.354004, -7362.815430, 162.256683, 4000); // Say1 + ranger_lilathaAI->AddWaypoint(6, 7605.861328, -7380.424316, 161.937073); + ranger_lilathaAI->AddWaypoint(7, 7605.295410, -7387.382813, 157.253998); + ranger_lilathaAI->AddWaypoint(8, 7606.131836, -7393.893555, 156.941925); + ranger_lilathaAI->AddWaypoint(9, 7615.207520, -7400.187012, 157.142639); + ranger_lilathaAI->AddWaypoint(10, 7618.956543, -7402.652832, 158.202042); + ranger_lilathaAI->AddWaypoint(11, 7636.850586, -7401.756836, 162.144791); + ranger_lilathaAI->AddWaypoint(12, 7637.058105, -7404.944824, 162.206970, 4000);// Say2 + ranger_lilathaAI->AddWaypoint(13, 7636.910645, -7412.585449, 162.366425); + ranger_lilathaAI->AddWaypoint(14, 7637.607910, -7425.591797, 162.630661); + ranger_lilathaAI->AddWaypoint(15, 7637.816895, -7459.057129, 163.302704); + ranger_lilathaAI->AddWaypoint(16, 7638.859863, -7470.902344, 162.517059); + ranger_lilathaAI->AddWaypoint(17, 7641.395996, -7488.217285, 157.381287); + ranger_lilathaAI->AddWaypoint(18, 7634.455566, -7505.451660, 154.682159); + ranger_lilathaAI->AddWaypoint(19, 7631.906738, -7516.948730, 153.597382); // say3 + ranger_lilathaAI->AddWaypoint(20, 7622.231445, -7537.037598, 151.587112); + ranger_lilathaAI->AddWaypoint(21, 7610.921875, -7550.670410, 149.639374); + ranger_lilathaAI->AddWaypoint(22, 7598.229004, -7562.551758, 145.953888); + ranger_lilathaAI->AddWaypoint(23, 7588.509277, -7577.755371, 148.294479); + ranger_lilathaAI->AddWaypoint(24, 7567.339355, -7608.456055, 146.006485); + ranger_lilathaAI->AddWaypoint(25, 7562.547852, -7617.417969, 148.097504); + ranger_lilathaAI->AddWaypoint(26, 7561.508789, -7645.064453, 151.245163); + ranger_lilathaAI->AddWaypoint(27, 7563.337402, -7654.652344, 151.227158); + ranger_lilathaAI->AddWaypoint(28, 7565.533691, -7658.296387, 151.248886); + ranger_lilathaAI->AddWaypoint(29, 7571.155762, -7659.118652, 151.244568); + ranger_lilathaAI->AddWaypoint(30, 7579.119629, -7662.213867, 151.651505); + ranger_lilathaAI->AddWaypoint(31, 7603.768066, -7667.000488, 153.997726); + ranger_lilathaAI->AddWaypoint(32, 7603.768066, -7667.000488, 153.997726, 4000); // Say4 & Set orientation + ranger_lilathaAI->AddWaypoint(33, 7603.768066, -7667.000488, 153.997726, 8000); // Say5 & Set orientation + ranger_lilathaAI->AddWaypoint(34, 7603.768066, -7667.000488, 153.997726); - return (CreatureAI*)ranger_lilathaAI; + return (CreatureAI*)ranger_lilathaAI; } void AddSC_ghostlands() @@ -315,9 +315,9 @@ void AddSC_ghostlands() newscript->pGOHello = &GOHello_gilded_brazier; newscript->RegisterSelf(); - newscript = new Script; - newscript->Name = "npc_ranger_lilatha"; - newscript->GetAI = &GetAI_npc_ranger_lilathaAI; - newscript->pQuestAccept = &QuestAccept_npc_ranger_lilatha; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name = "npc_ranger_lilatha"; + newscript->GetAI = &GetAI_npc_ranger_lilathaAI; + newscript->pQuestAccept = &QuestAccept_npc_ranger_lilatha; + newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/gruuls_lair/boss_gruul.cpp b/src/bindings/scripts/scripts/zone/gruuls_lair/boss_gruul.cpp index 0aed97dcf66..3588552fb46 100644 --- a/src/bindings/scripts/scripts/zone/gruuls_lair/boss_gruul.cpp +++ b/src/bindings/scripts/scripts/zone/gruuls_lair/boss_gruul.cpp @@ -52,10 +52,10 @@ EndScriptData */ struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI { boss_gruulAI(Creature *c) : ScriptedAI(c) - { - pInstance = ((ScriptedInstance*)c->GetInstanceData()); - Reset(); - } + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + Reset(); + } ScriptedInstance *pInstance; @@ -77,36 +77,36 @@ struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI HurtfulStrike_Timer= 8000; Reverberation_Timer= 60000+45000; - if(pInstance) - { - pInstance->SetData(DATA_GRUULEVENT, NOT_STARTED); + if(pInstance) + { + pInstance->SetData(DATA_GRUULEVENT, NOT_STARTED); - GameObject* Door = NULL; - Door = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GRUULDOOR)); - if(Door) - Door->SetGoState(0); - } - } + GameObject* Door = NULL; + Door = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GRUULDOOR)); + if(Door) + Door->SetGoState(0); + } + } void JustDied(Unit* Killer) { - DoScriptText(SAY_DEATH, m_creature); + DoScriptText(SAY_DEATH, m_creature); - if(pInstance) - { - pInstance->SetData(DATA_GRUULEVENT, DONE); + if(pInstance) + { + pInstance->SetData(DATA_GRUULEVENT, DONE); - GameObject* Door = NULL; - Door = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GRUULDOOR)); - if(Door) - Door->SetGoState(0); - } - } + GameObject* Door = NULL; + Door = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GRUULDOOR)); + if(Door) + Door->SetGoState(0); + } + } void Aggro(Unit *who) { - DoScriptText(SAY_AGGRO, m_creature); - DoZoneInCombat(); + DoScriptText(SAY_AGGRO, m_creature); + DoZoneInCombat(); if(pInstance) { @@ -119,15 +119,15 @@ struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI } } - void KilledUnit() - { - switch(rand()%3) - { - case 0: DoScriptText(SAY_SLAY1, m_creature); break; - case 1: DoScriptText(SAY_SLAY2, m_creature); break; - case 2: DoScriptText(SAY_SLAY3, m_creature); break; - } - } + void KilledUnit() + { + switch(rand()%3) + { + case 0: DoScriptText(SAY_SLAY1, m_creature); break; + case 1: DoScriptText(SAY_SLAY2, m_creature); break; + case 2: DoScriptText(SAY_SLAY3, m_creature); break; + } + } void UpdateAI(const uint32 diff) { @@ -184,7 +184,7 @@ struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI GroundSlamTimer = 7000; break; - } + } case 1: { @@ -205,7 +205,7 @@ struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI GroundSlamTimer = 5000; break; - } + } case 2: { @@ -215,7 +215,7 @@ struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI GroundSlamTimer = 1000; break; - } + } case 3: { @@ -253,7 +253,7 @@ struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI Reverberation_Timer += 10000; break; - } + } } GroundSlamStage++; @@ -280,14 +280,14 @@ struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI // Reverberation if (Reverberation_Timer < diff) { - DoCast(m_creature->getVictim(), SPELL_REVERBERATION, true); - Reverberation_Timer = 30000; + DoCast(m_creature->getVictim(), SPELL_REVERBERATION, true); + Reverberation_Timer = 30000; }else Reverberation_Timer -= diff; // Cave In if (CaveIn_Timer < diff) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_CAVE_IN); CaveIn_Timer = 20000; diff --git a/src/bindings/scripts/scripts/zone/gruuls_lair/boss_high_king_maulgar.cpp b/src/bindings/scripts/scripts/zone/gruuls_lair/boss_high_king_maulgar.cpp index ce828367531..e0d3aea7d06 100644 --- a/src/bindings/scripts/scripts/zone/gruuls_lair/boss_high_king_maulgar.cpp +++ b/src/bindings/scripts/scripts/zone/gruuls_lair/boss_high_king_maulgar.cpp @@ -42,7 +42,7 @@ EndScriptData */ #define SPELL_BERSERKER_C 26561 #define SPELL_ROAR 16508 #define SPELL_FLURRY 33232 -#define SPELL_DUAL_WIELD 29651 //used in phase +#define SPELL_DUAL_WIELD 29651 //used in phase // Olm the Summoner #define SPELL_DARK_DECAY 33129 @@ -50,14 +50,14 @@ EndScriptData */ #define SPELL_SUMMON_WFH 33131 //Kiggler the Craed -#define SPELL_GREATER_POLYMORPH 33173 -#define SPELL_LIGHTNING_BOLT 36152 -#define SPELL_ARCANE_SHOCK 33175 -#define SPELL_ARCANE_EXPLOSION 33237 +#define SPELL_GREATER_POLYMORPH 33173 +#define SPELL_LIGHTNING_BOLT 36152 +#define SPELL_ARCANE_SHOCK 33175 +#define SPELL_ARCANE_EXPLOSION 33237 //Blindeye the Seer -#define SPELL_GREATER_PW_SHIELD 33147 -#define SPELL_HEAL 33144 +#define SPELL_GREATER_PW_SHIELD 33147 +#define SPELL_HEAL 33144 #define SPELL_PRAYER_OH 33152 //Krosh Firehand @@ -94,9 +94,9 @@ struct TRINITY_DLL_DECL boss_high_king_maulgarAI : public ScriptedAI MightyBlow_Timer = 40000; Whirlwind_Timer = 30000; Charging_Timer = 0; - Roar_Timer = 0; + Roar_Timer = 0; - m_creature->CastSpell(m_creature, SPELL_DUAL_WIELD, false); + m_creature->CastSpell(m_creature, SPELL_DUAL_WIELD, false); Phase2 = false; @@ -134,25 +134,25 @@ struct TRINITY_DLL_DECL boss_high_king_maulgarAI : public ScriptedAI DoScriptText(SAY_DEATH, m_creature); if (pInstance) - { - pInstance->SetData(DATA_MAULGAREVENT, DONE); + { + pInstance->SetData(DATA_MAULGAREVENT, DONE); - GameObject* Door = NULL; - Door = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_MAULGARDOOR)); - if(Door) - Door->SetGoState(0); - } - } + GameObject* Door = NULL; + Door = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_MAULGARDOOR)); + if(Door) + Door->SetGoState(0); + } + } void AddDeath() { switch(rand()%4) - { - case 0: DoScriptText(SAY_OGRE_DEATH1, m_creature);break; - case 1: DoScriptText(SAY_OGRE_DEATH2, m_creature);break; - case 2: DoScriptText(SAY_OGRE_DEATH3, m_creature);break; - case 3: DoScriptText(SAY_OGRE_DEATH4, m_creature);break; - } + { + case 0: DoScriptText(SAY_OGRE_DEATH1, m_creature);break; + case 1: DoScriptText(SAY_OGRE_DEATH2, m_creature);break; + case 2: DoScriptText(SAY_OGRE_DEATH3, m_creature);break; + case 3: DoScriptText(SAY_OGRE_DEATH4, m_creature);break; + } } @@ -182,7 +182,7 @@ struct TRINITY_DLL_DECL boss_high_king_maulgarAI : public ScriptedAI pInstance->SetData64(DATA_MAULGAREVENT_TANK, who->GetGUID()); pInstance->SetData(DATA_MAULGAREVENT, IN_PROGRESS); - DoZoneInCombat(); + DoZoneInCombat(); } void UpdateAI(const uint32 diff) @@ -234,10 +234,10 @@ struct TRINITY_DLL_DECL boss_high_king_maulgarAI : public ScriptedAI //Entering Phase 2 if(!Phase2 && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 50) { - Phase2 = true; - DoScriptText(SAY_ENRAGE, m_creature); + Phase2 = true; + DoScriptText(SAY_ENRAGE, m_creature); - m_creature->CastSpell(m_creature, SPELL_DUAL_WIELD, true); + m_creature->CastSpell(m_creature, SPELL_DUAL_WIELD, true); m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, 0); m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+1, 0); } diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp index b8247eac92f..ed94765333f 100644 --- a/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp +++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp @@ -134,21 +134,21 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI } } for(int i=0; i<5; ++i) - { - Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]); - if(who && channeler && !channeler->isInCombat()) - channeler->AI()->AttackStart(who); - } + { + Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]); + if(who && channeler && !channeler->isInCombat()) + channeler->AI()->AttackStart(who); + } } void ChannelerDied(Unit* killer) { for(int i=0; i<5; ++i) - { - Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]); - if(channeler && channeler->isAlive()) - return; - } + { + Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]); + if(channeler && channeler->isAlive()) + return; + } if(killer) m_creature->AI()->AttackStart(killer); @@ -160,30 +160,30 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI if(!channeler1) return NULL; int i; for(i=0; i<5; ++i) - { - Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]); - if(channeler && channeler->GetGUID()==channeler1->GetGUID()) - break; - } + { + Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]); + if(channeler && channeler->GetGUID()==channeler1->GetGUID()) + break; + } return Channelers[(i+2)%5]; } void SummonChannelers() { - for(int i=0; i<5; ++i) - { - Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]); - if(!channeler || channeler->isDead()) - channeler = m_creature->SummonCreature(ENTRY_CHANNELER,ShadowmoonChannelers[i][0],ShadowmoonChannelers[i][1],ShadowmoonChannelers[i][2],ShadowmoonChannelers[i][3],TEMPSUMMON_CORPSE_TIMED_DESPAWN,300000); - Channelers[i] = channeler->GetGUID(); - } + for(int i=0; i<5; ++i) + { + Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]); + if(!channeler || channeler->isDead()) + channeler = m_creature->SummonCreature(ENTRY_CHANNELER,ShadowmoonChannelers[i][0],ShadowmoonChannelers[i][1],ShadowmoonChannelers[i][2],ShadowmoonChannelers[i][3],TEMPSUMMON_CORPSE_TIMED_DESPAWN,300000); + Channelers[i] = channeler->GetGUID(); + } } void JustDied(Unit* Killer) { DoScriptText(SAY_DIE, m_creature); if(pInstance) - pInstance->SetData(DATA_KELIDANEVENT, DONE); + pInstance->SetData(DATA_KELIDANEVENT, DONE); } void UpdateAI(const uint32 diff) @@ -315,11 +315,11 @@ struct TRINITY_DLL_DECL mob_shadowmoon_channelerAI : public ScriptedAI { if (!m_creature->IsNonMeleeSpellCasted(false)) if(Creature *Kelidan = (Creature *)FindCreature(ENTRY_KELIDAN, 100, m_creature)) - { - uint64 channeler = ((boss_kelidan_the_breakerAI*)Kelidan->AI())->GetChanneled(m_creature); - if(Unit *channeled = Unit::GetUnit(*m_creature, channeler)) - DoCast(channeled,SPELL_CHANNELING); - } + { + uint64 channeler = ((boss_kelidan_the_breakerAI*)Kelidan->AI())->GetChanneled(m_creature); + if(Unit *channeled = Unit::GetUnit(*m_creature, channeler)) + DoCast(channeled,SPELL_CHANNELING); + } check_Timer = 5000; }else check_Timer -= diff; return; diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp index 165b27c9a0f..97d2878bc1d 100644 --- a/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp +++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp @@ -114,7 +114,7 @@ struct TRINITY_DLL_DECL boss_nazanAI : public ScriptedAI m_creature->SetLootRecipient(NULL); m_creature->SetVisibility(VISIBILITY_OFF); m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - m_creature->RemoveCorpse(); + m_creature->RemoveCorpse(); }else UnsummonCheck -= diff; return; } diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp index c6d7fd2031a..f114cd005f7 100644 --- a/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp +++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp @@ -62,15 +62,15 @@ static Yell RandomTaunt[]= #define SPELL_BLAZE_TARGET 30541 // core bug, does not support target 7 #define SPELL_BLAZE_TRAP 30542 #define SPELL_DEBRIS_KNOCKDOWN 36449 -#define SPELL_DEBRIS_VISUAL 30632 -#define SPELL_DEBRIS_DAMAGE 30631 // core bug, does not support target 8 +#define SPELL_DEBRIS_VISUAL 30632 +#define SPELL_DEBRIS_DAMAGE 30631 // core bug, does not support target 8 #define SPELL_CAMERA_SHAKE 36455 #define SPELL_BERSERK 27680 #define SPELL_SHADOW_CAGE 30168 #define SPELL_SHADOW_GRASP 30410 #define SPELL_SHADOW_GRASP_VISUAL 30166 -#define SPELL_MIND_EXHAUSTION 44032 //Casted by the cubes when channeling ends +#define SPELL_MIND_EXHAUSTION 44032 //Casted by the cubes when channeling ends #define SPELL_SHADOW_CAGE_C 30205 #define SPELL_SHADOW_GRASP_C 30207 @@ -81,10 +81,10 @@ static Yell RandomTaunt[]= #define SPELL_BURNING_ABYSSAL 30511 #define SPELL_SOUL_TRANSFER 30531 // core bug, does not support target 7 -#define SPELL_FIRE_BLAST 37110 +#define SPELL_FIRE_BLAST 37110 // count of clickers needed to interrupt blast nova -#define CLICKERS_COUNT 5 +#define CLICKERS_COUNT 5 typedef std::map CubeMap; @@ -202,7 +202,7 @@ struct TRINITY_DLL_DECL boss_magtheridonAI : public ScriptedAI uint32 BlastNova_Timer; uint32 Blaze_Timer; uint32 Debris_Timer; - uint32 RandChat_Timer; + uint32 RandChat_Timer; bool Phase3; bool NeedCheckCube; diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/def_magtheridons_lair.h b/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/def_magtheridons_lair.h index 6469ed413c5..8c235a36a30 100644 --- a/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/def_magtheridons_lair.h +++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/def_magtheridons_lair.h @@ -6,8 +6,8 @@ #define DEF_MAGTHERIDONS_LAIR_H #define DATA_MAGTHERIDON_EVENT 1 -#define DATA_MAGTHERIDON 3 +#define DATA_MAGTHERIDON 3 #define DATA_CHANNELER_EVENT 2 -#define DATA_COLLAPSE 6 -#define DATA_CHANNELER 9 +#define DATA_COLLAPSE 6 +#define DATA_CHANNELER 9 #endif diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/instance_magtheridons_lair.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/instance_magtheridons_lair.cpp index c4a2eabd068..20c64e0504b 100644 --- a/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/instance_magtheridons_lair.cpp +++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/instance_magtheridons_lair.cpp @@ -27,9 +27,9 @@ EndScriptData */ #define SPELL_SOUL_TRANSFER 30531 // core bug, does not support target 7 #define SPELL_BLAZE_TARGET 30541 // core bug, does not support target 7 -#define CHAMBER_CENTER_X -15.14 -#define CHAMBER_CENTER_Y 1.8 -#define CHAMBER_CENTER_Z -0.4 +#define CHAMBER_CENTER_X -15.14 +#define CHAMBER_CENTER_Y 1.8 +#define CHAMBER_CENTER_Z -0.4 #define ENCOUNTERS 2 @@ -180,7 +180,7 @@ struct TRINITY_DLL_DECL instance_magtheridons_lair : public ScriptedInstance { //Channeler->CastSpell(Channeler, SPELL_SOUL_TRANSFER, true); data = IN_PROGRESS; - break; + break; } }break; } diff --git a/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp b/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp index 7cfd32955ca..1a96f0be0c2 100644 --- a/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp +++ b/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp @@ -238,22 +238,22 @@ bool GossipHello_npc_wing_commander_brack(Player *player, Creature *_Creature) bool GossipSelect_npc_wing_commander_brack(Player *player, Creature *_Creature, uint32 sender, uint32 action ) { - switch(action) - { - case GOSSIP_ACTION_INFO_DEF + 1: - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player,33659,true); //TaxiPath 584 (Gateways Murket and Shaadraz) - break; - case GOSSIP_ACTION_INFO_DEF + 2: - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player,33825,true); //TaxiPath 587 (Aerial Assault Flight (Horde)) - break; - case GOSSIP_ACTION_INFO_DEF + 3: - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player,34578,true); //TaxiPath 604 (Taxi - Reaver's Fall to Spinebreaker Ridge) - break; - } - return true; + switch(action) + { + case GOSSIP_ACTION_INFO_DEF + 1: + player->CLOSE_GOSSIP_MENU(); + player->CastSpell(player,33659,true); //TaxiPath 584 (Gateways Murket and Shaadraz) + break; + case GOSSIP_ACTION_INFO_DEF + 2: + player->CLOSE_GOSSIP_MENU(); + player->CastSpell(player,33825,true); //TaxiPath 587 (Aerial Assault Flight (Horde)) + break; + case GOSSIP_ACTION_INFO_DEF + 3: + player->CLOSE_GOSSIP_MENU(); + player->CastSpell(player,34578,true); //TaxiPath 604 (Taxi - Reaver's Fall to Spinebreaker Ridge) + break; + } + return true; } /*###### @@ -271,130 +271,130 @@ bool GossipSelect_npc_wing_commander_brack(Player *player, Creature *_Creature, struct TRINITY_DLL_DECL npc_wounded_blood_elfAI : public npc_escortAI { - npc_wounded_blood_elfAI(Creature *c) : npc_escortAI(c) {Reset();} + npc_wounded_blood_elfAI(Creature *c) : npc_escortAI(c) {Reset();} - void WaypointReached(uint32 i) - { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + void WaypointReached(uint32 i) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - if (!player) - return; + if (!player) + return; - switch (i) - { - case 0: - DoScriptText(SAY_ELF_START, m_creature, player); - break; - case 9: - DoScriptText(SAY_ELF_SUMMON1, m_creature, player); - // Spawn two Haal'eshi Talonguard - DoSpawnCreature(16967, -15, -15, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - DoSpawnCreature(16967, -17, -17, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - break; - case 13: - DoScriptText(SAY_ELF_RESTING, m_creature, player); - // make the NPC kneel - m_creature->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL); - break; - case 14: - DoScriptText(SAY_ELF_SUMMON2, m_creature, player); - // Spawn two Haal'eshi Windwalker - DoSpawnCreature(16966, -15, -15, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - DoSpawnCreature(16966, -17, -17, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - break; - case 27: - DoScriptText(SAY_ELF_COMPLETE, m_creature, player); - // Award quest credit - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - if (player && player->GetTypeId() == TYPEID_PLAYER) - ((Player*)player)->GroupEventHappens(QUEST_ROAD_TO_FALCON_WATCH,m_creature); - break; - } - } + switch (i) + { + case 0: + DoScriptText(SAY_ELF_START, m_creature, player); + break; + case 9: + DoScriptText(SAY_ELF_SUMMON1, m_creature, player); + // Spawn two Haal'eshi Talonguard + DoSpawnCreature(16967, -15, -15, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + DoSpawnCreature(16967, -17, -17, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + break; + case 13: + DoScriptText(SAY_ELF_RESTING, m_creature, player); + // make the NPC kneel + m_creature->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL); + break; + case 14: + DoScriptText(SAY_ELF_SUMMON2, m_creature, player); + // Spawn two Haal'eshi Windwalker + DoSpawnCreature(16966, -15, -15, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + DoSpawnCreature(16966, -17, -17, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + break; + case 27: + DoScriptText(SAY_ELF_COMPLETE, m_creature, player); + // Award quest credit + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + if (player && player->GetTypeId() == TYPEID_PLAYER) + ((Player*)player)->GroupEventHappens(QUEST_ROAD_TO_FALCON_WATCH,m_creature); + break; + } + } - void Reset() - { - if (!IsBeingEscorted) - m_creature->setFaction(1604); - } + void Reset() + { + if (!IsBeingEscorted) + m_creature->setFaction(1604); + } - void Aggro(Unit* who) - { - if (IsBeingEscorted) - DoScriptText(SAY_ELF_AGGRO, m_creature); - } + void Aggro(Unit* who) + { + if (IsBeingEscorted) + DoScriptText(SAY_ELF_AGGRO, m_creature); + } - void JustSummoned(Creature* summoned) - { - summoned->AI()->AttackStart(m_creature); - } + void JustSummoned(Creature* summoned) + { + summoned->AI()->AttackStart(m_creature); + } - void JustDied(Unit* killer) - { - if (!IsBeingEscorted) - return; + void JustDied(Unit* killer) + { + if (!IsBeingEscorted) + return; - if (PlayerGUID) - { - // If NPC dies, player fails the quest - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - if (player && player->GetTypeId() == TYPEID_PLAYER) - ((Player*)player)->FailQuest(QUEST_ROAD_TO_FALCON_WATCH); - } - } + if (PlayerGUID) + { + // If NPC dies, player fails the quest + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + if (player && player->GetTypeId() == TYPEID_PLAYER) + ((Player*)player)->FailQuest(QUEST_ROAD_TO_FALCON_WATCH); + } + } - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + } }; CreatureAI* GetAI_npc_wounded_blood_elf(Creature *_Creature) { - npc_wounded_blood_elfAI* welfAI = new npc_wounded_blood_elfAI(_Creature); + npc_wounded_blood_elfAI* welfAI = new npc_wounded_blood_elfAI(_Creature); - welfAI->AddWaypoint(0, -1137.72, 4272.10, 14.04, 5000); - welfAI->AddWaypoint(1, -1141.34, 4232.42, 14.63); - welfAI->AddWaypoint(2, -1133.47, 4220.88, 11.78); - welfAI->AddWaypoint(3, -1126.18, 4213.26, 13.51); - welfAI->AddWaypoint(4, -1100.12, 4204.32, 16.41); - welfAI->AddWaypoint(5, -1063.68, 4197.92, 15.51); - welfAI->AddWaypoint(6, -1027.28, 4194.36, 15.52); - welfAI->AddWaypoint(7, -995.68, 4189.59, 19.84); - welfAI->AddWaypoint(8, -970.90, 4188.60, 24.61); - welfAI->AddWaypoint(9, -961.93, 4193.34, 26.11, 15000); // Summon 1 - welfAI->AddWaypoint(10, -935.52, 4210.99, 31.98); - welfAI->AddWaypoint(11, -913.42, 4218.27, 37.29); - welfAI->AddWaypoint(12, -896.53, 4207.73, 43.23); - welfAI->AddWaypoint(13, -868.49, 4194.77, 46.75, 30000);// Kneel and Rest Here - welfAI->AddWaypoint(14, -852.83, 4198.29, 47.28, 15000);// Summon 2 - welfAI->AddWaypoint(15, -819.85, 4200.50, 46.37); - welfAI->AddWaypoint(16, -791.92, 4201.96, 44.19); - welfAI->AddWaypoint(17, -774.42, 4202.46, 47.41); - welfAI->AddWaypoint(18, -762.90, 4202.17, 48.81); - welfAI->AddWaypoint(19, -728.25, 4195.35, 50.68); - welfAI->AddWaypoint(20, -713.58, 4192.07, 53.98); - welfAI->AddWaypoint(21, -703.09, 4189.74, 56.96); - welfAI->AddWaypoint(22, -693.70, 4185.43, 57.06); - welfAI->AddWaypoint(23, -686.38, 4159.81, 60.26); - welfAI->AddWaypoint(24, -679.88, 4147.04, 64.20); - welfAI->AddWaypoint(25, -656.74, 4147.72, 64.11); - welfAI->AddWaypoint(26, -652.22, 4137.50, 64.58); - welfAI->AddWaypoint(27, -649.99, 4136.38, 64.63, 30000);// Award Quest Credit + welfAI->AddWaypoint(0, -1137.72, 4272.10, 14.04, 5000); + welfAI->AddWaypoint(1, -1141.34, 4232.42, 14.63); + welfAI->AddWaypoint(2, -1133.47, 4220.88, 11.78); + welfAI->AddWaypoint(3, -1126.18, 4213.26, 13.51); + welfAI->AddWaypoint(4, -1100.12, 4204.32, 16.41); + welfAI->AddWaypoint(5, -1063.68, 4197.92, 15.51); + welfAI->AddWaypoint(6, -1027.28, 4194.36, 15.52); + welfAI->AddWaypoint(7, -995.68, 4189.59, 19.84); + welfAI->AddWaypoint(8, -970.90, 4188.60, 24.61); + welfAI->AddWaypoint(9, -961.93, 4193.34, 26.11, 15000); // Summon 1 + welfAI->AddWaypoint(10, -935.52, 4210.99, 31.98); + welfAI->AddWaypoint(11, -913.42, 4218.27, 37.29); + welfAI->AddWaypoint(12, -896.53, 4207.73, 43.23); + welfAI->AddWaypoint(13, -868.49, 4194.77, 46.75, 30000);// Kneel and Rest Here + welfAI->AddWaypoint(14, -852.83, 4198.29, 47.28, 15000);// Summon 2 + welfAI->AddWaypoint(15, -819.85, 4200.50, 46.37); + welfAI->AddWaypoint(16, -791.92, 4201.96, 44.19); + welfAI->AddWaypoint(17, -774.42, 4202.46, 47.41); + welfAI->AddWaypoint(18, -762.90, 4202.17, 48.81); + welfAI->AddWaypoint(19, -728.25, 4195.35, 50.68); + welfAI->AddWaypoint(20, -713.58, 4192.07, 53.98); + welfAI->AddWaypoint(21, -703.09, 4189.74, 56.96); + welfAI->AddWaypoint(22, -693.70, 4185.43, 57.06); + welfAI->AddWaypoint(23, -686.38, 4159.81, 60.26); + welfAI->AddWaypoint(24, -679.88, 4147.04, 64.20); + welfAI->AddWaypoint(25, -656.74, 4147.72, 64.11); + welfAI->AddWaypoint(26, -652.22, 4137.50, 64.58); + welfAI->AddWaypoint(27, -649.99, 4136.38, 64.63, 30000);// Award Quest Credit - return (CreatureAI*)welfAI; + return (CreatureAI*)welfAI; } bool QuestAccept_npc_wounded_blood_elf(Player* player, Creature* creature, Quest const* quest) { - if (quest->GetQuestId() == QUEST_ROAD_TO_FALCON_WATCH) - { - ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); - // Change faction so mobs attack - creature->setFaction(775); - } + if (quest->GetQuestId() == QUEST_ROAD_TO_FALCON_WATCH) + { + ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); + // Change faction so mobs attack + creature->setFaction(775); + } - return true; + return true; } /*###### @@ -406,7 +406,7 @@ void AddSC_hellfire_peninsula() Script *newscript; newscript = new Script; - newscript->Name = "npc_aeranas"; + newscript->Name = "npc_aeranas"; newscript->GetAI = &GetAI_npc_aeranas; newscript->RegisterSelf(); diff --git a/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp b/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp index 99aedf23bca..4e61ad68780 100644 --- a/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp +++ b/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp @@ -141,52 +141,52 @@ bool GossipSelect_npc_unrestrained_dragonhawk(Player *player, Creature *_Creatur ## npc_greengill_slave ######*/ -#define ENRAGE 45111 -#define ORB 45109 -#define QUESTG 11541 -#define DM 25060 +#define ENRAGE 45111 +#define ORB 45109 +#define QUESTG 11541 +#define DM 25060 struct TRINITY_DLL_DECL npc_greengill_slaveAI : public ScriptedAI { - npc_greengill_slaveAI(Creature* c) : ScriptedAI(c) {Reset();} + npc_greengill_slaveAI(Creature* c) : ScriptedAI(c) {Reset();} - uint64 PlayerGUID; + uint64 PlayerGUID; - void Aggro(Unit* who){} + void Aggro(Unit* who){} - void Reset() - { - PlayerGUID = 0; - } + void Reset() + { + PlayerGUID = 0; + } - void SpellHit(Unit* caster, const SpellEntry* spell) - { - if(!caster) + void SpellHit(Unit* caster, const SpellEntry* spell) + { + if(!caster) return; - if(caster->GetTypeId() == TYPEID_PLAYER && spell->Id == ORB && !m_creature->HasAura(ENRAGE, 0)) - { - PlayerGUID = caster->GetGUID(); - if(PlayerGUID) + if(caster->GetTypeId() == TYPEID_PLAYER && spell->Id == ORB && !m_creature->HasAura(ENRAGE, 0)) + { + PlayerGUID = caster->GetGUID(); + if(PlayerGUID) { Unit* plr = Unit::GetUnit((*m_creature), PlayerGUID); if(plr && ((Player*)plr)->GetQuestStatus(QUESTG) == QUEST_STATUS_INCOMPLETE) - ((Player*)plr)->KilledMonster(25086, m_creature->GetGUID()); - } - DoCast(m_creature, ENRAGE); - Unit* Myrmidon = FindCreature(DM, 70, m_creature); - if(Myrmidon) - { - m_creature->AddThreat(Myrmidon, 100000.0f); + ((Player*)plr)->KilledMonster(25086, m_creature->GetGUID()); + } + DoCast(m_creature, ENRAGE); + Unit* Myrmidon = FindCreature(DM, 70, m_creature); + if(Myrmidon) + { + m_creature->AddThreat(Myrmidon, 100000.0f); AttackStart(Myrmidon); - } - } - } + } + } + } - void UpdateAI(const uint32 diff) - { - DoMeleeAttackIfReady(); - } + void UpdateAI(const uint32 diff) + { + DoMeleeAttackIfReady(); + } }; CreatureAI* GetAI_npc_greengill_slaveAI(Creature* _Creature) @@ -215,8 +215,8 @@ void AddSC_isle_of_queldanas() newscript->pGossipSelect = &GossipSelect_npc_unrestrained_dragonhawk; newscript->RegisterSelf(); - newscript = new Script; - newscript->Name="npc_greengill_slave"; - newscript->GetAI = &GetAI_npc_greengill_slaveAI; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name="npc_greengill_slave"; + newscript->GetAI = &GetAI_npc_greengill_slaveAI; + newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_curator.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_curator.cpp index bf26d71398f..eada90f9473 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/boss_curator.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/boss_curator.cpp @@ -69,9 +69,9 @@ struct TRINITY_DLL_DECL boss_curatorAI : public ScriptedAI { switch(rand()%2) { - case 0: DoScriptText(SAY_KILL1, m_creature); break; - case 1: DoScriptText(SAY_KILL2, m_creature); break; - } + case 0: DoScriptText(SAY_KILL1, m_creature); break; + case 1: DoScriptText(SAY_KILL2, m_creature); break; + } } void JustDied(Unit *victim) diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_maiden_of_virtue.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_maiden_of_virtue.cpp index 3030715ff27..b04b39c0796 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/boss_maiden_of_virtue.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/boss_maiden_of_virtue.cpp @@ -66,7 +66,7 @@ struct TRINITY_DLL_DECL boss_maiden_of_virtueAI : public ScriptedAI void KilledUnit(Unit* Victim) { if(rand()%2) - return; + return; switch(rand()%3) { @@ -117,7 +117,7 @@ struct TRINITY_DLL_DECL boss_maiden_of_virtueAI : public ScriptedAI if (Holyfire_Timer < diff) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target,SPELL_HOLYFIRE); Holyfire_Timer = 8000 + rand()%17000; //Anywhere from 8 to 25 seconds, good luck having several of those in a row! @@ -125,10 +125,10 @@ struct TRINITY_DLL_DECL boss_maiden_of_virtueAI : public ScriptedAI if (Holywrath_Timer < diff) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_HOLYWRATH); + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_HOLYWRATH); - Holywrath_Timer = 20000+(rand()%10000); //20-30 secs sounds nice + Holywrath_Timer = 20000+(rand()%10000); //20-30 secs sounds nice }else Holywrath_Timer -= diff; diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_midnight.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_midnight.cpp index 731f7ce2df9..2324385e4ba 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/boss_midnight.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/boss_midnight.cpp @@ -58,7 +58,7 @@ struct TRINITY_DLL_DECL boss_midnightAI : public ScriptedAI Attumen = 0; Mount_Timer = 0; - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->SetVisibility(VISIBILITY_ON); } @@ -81,7 +81,7 @@ struct TRINITY_DLL_DECL boss_midnightAI : public ScriptedAI if(Phase == 1 && (m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 95) { Phase = 2; - Creature *pAttumen = DoSpawnCreature(SUMMON_ATTUMEN, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000); + Creature *pAttumen = DoSpawnCreature(SUMMON_ATTUMEN, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000); if(pAttumen) { Attumen = pAttumen->GetGUID(); @@ -89,9 +89,9 @@ struct TRINITY_DLL_DECL boss_midnightAI : public ScriptedAI SetMidnight(pAttumen, m_creature->GetGUID()); switch(rand()%3) { - case 0: DoScriptText(SAY_APPEAR1, pAttumen); break; - case 1: DoScriptText(SAY_APPEAR2, pAttumen); break; - case 2: DoScriptText(SAY_APPEAR3, pAttumen); break; + case 0: DoScriptText(SAY_APPEAR1, pAttumen); break; + case 1: DoScriptText(SAY_APPEAR2, pAttumen); break; + case 2: DoScriptText(SAY_APPEAR3, pAttumen); break; } } } @@ -102,27 +102,27 @@ struct TRINITY_DLL_DECL boss_midnightAI : public ScriptedAI } else if(Phase ==3) { - if(Mount_Timer) - { - if(Mount_Timer <= diff) - { - Mount_Timer = 0; - m_creature->SetVisibility(VISIBILITY_OFF); - m_creature->GetMotionMaster()->MoveIdle(); - if (Unit *pAttumen = Unit::GetUnit(*m_creature, Attumen)) - { - pAttumen->SetUInt32Value(UNIT_FIELD_DISPLAYID, MOUNTED_DISPLAYID); - pAttumen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if(pAttumen->getVictim()) - { - pAttumen->GetMotionMaster()->MoveChase(pAttumen->getVictim()); - pAttumen->SetUInt64Value(UNIT_FIELD_TARGET, pAttumen->getVictim()->GetGUID()); - } - pAttumen->SetFloatValue(OBJECT_FIELD_SCALE_X,1); - } - } else Mount_Timer -= diff; - } - } + if(Mount_Timer) + { + if(Mount_Timer <= diff) + { + Mount_Timer = 0; + m_creature->SetVisibility(VISIBILITY_OFF); + m_creature->GetMotionMaster()->MoveIdle(); + if (Unit *pAttumen = Unit::GetUnit(*m_creature, Attumen)) + { + pAttumen->SetUInt32Value(UNIT_FIELD_DISPLAYID, MOUNTED_DISPLAYID); + pAttumen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if(pAttumen->getVictim()) + { + pAttumen->GetMotionMaster()->MoveChase(pAttumen->getVictim()); + pAttumen->SetUInt64Value(UNIT_FIELD_TARGET, pAttumen->getVictim()->GetGUID()); + } + pAttumen->SetFloatValue(OBJECT_FIELD_SCALE_X,1); + } + } else Mount_Timer -= diff; + } + } if(Phase != 3) DoMeleeAttackIfReady(); @@ -130,7 +130,7 @@ struct TRINITY_DLL_DECL boss_midnightAI : public ScriptedAI void Mount(Unit *pAttumen) { - DoScriptText(SAY_MOUNT, pAttumen); + DoScriptText(SAY_MOUNT, pAttumen); Phase = 3; m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pAttumen->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -194,36 +194,36 @@ struct TRINITY_DLL_DECL boss_attumenAI : public ScriptedAI { switch(rand()%2) { - case 0: DoScriptText(SAY_KILL1, m_creature); break; - case 1: DoScriptText(SAY_KILL2, m_creature); break; + case 0: DoScriptText(SAY_KILL1, m_creature); break; + case 1: DoScriptText(SAY_KILL2, m_creature); break; } } void JustDied(Unit *victim) { DoScriptText(SAY_DEATH, m_creature); - if (Unit *pMidnight = Unit::GetUnit(*m_creature, Midnight)) - pMidnight->DealDamage(pMidnight, pMidnight->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + if (Unit *pMidnight = Unit::GetUnit(*m_creature, Midnight)) + pMidnight->DealDamage(pMidnight, pMidnight->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } void UpdateAI(const uint32 diff) { - if(ResetTimer) - { - if(ResetTimer <= diff) - { - ResetTimer = 0; - Unit *pMidnight = Unit::GetUnit(*m_creature, Midnight); - if(pMidnight) - { - pMidnight->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pMidnight->SetVisibility(VISIBILITY_ON); - } - Midnight = 0; - m_creature->SetVisibility(VISIBILITY_OFF); - m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } - } else ResetTimer -= diff; + if(ResetTimer) + { + if(ResetTimer <= diff) + { + ResetTimer = 0; + Unit *pMidnight = Unit::GetUnit(*m_creature, Midnight); + if(pMidnight) + { + pMidnight->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pMidnight->SetVisibility(VISIBILITY_ON); + } + Midnight = 0; + m_creature->SetVisibility(VISIBILITY_OFF); + m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } + } else ResetTimer -= diff; //Return since we have no target if (!UpdateVictim()) @@ -234,7 +234,7 @@ struct TRINITY_DLL_DECL boss_attumenAI : public ScriptedAI if(CleaveTimer < diff) { - DoCast(m_creature->getVictim(), SPELL_SHADOWCLEAVE); + DoCast(m_creature->getVictim(), SPELL_SHADOWCLEAVE); CleaveTimer = 10000 + (rand()%6)*1000; } else CleaveTimer -= diff; @@ -248,8 +248,8 @@ struct TRINITY_DLL_DECL boss_attumenAI : public ScriptedAI { switch(rand()%2) { - case 0: DoScriptText(SAY_RANDOM1, m_creature); break; - case 1: DoScriptText(SAY_RANDOM2, m_creature); break; + case 0: DoScriptText(SAY_RANDOM1, m_creature); break; + case 1: DoScriptText(SAY_RANDOM2, m_creature); break; } RandomYellTimer = 30000 + (rand()%31)*1000; } else RandomYellTimer -= diff; @@ -294,7 +294,7 @@ struct TRINITY_DLL_DECL boss_attumenAI : public ScriptedAI void SpellHit(Unit *source, const SpellEntry *spell) { if(spell->Mechanic == MECHANIC_DISARM) - DoScriptText(SAY_DISARMED, m_creature); + DoScriptText(SAY_DISARMED, m_creature); } }; diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp index 12c2a92ec91..5055d7ca0ed 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp @@ -124,9 +124,9 @@ struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI { switch (rand()%3) { - case 0: DoScriptText(SAY_KILL_1, m_creature); break; - case 1: DoScriptText(SAY_KILL_2, m_creature); break; - case 2: DoScriptText(SAY_KILL_3, m_creature); break; + case 0: DoScriptText(SAY_KILL_1, m_creature); break; + case 1: DoScriptText(SAY_KILL_2, m_creature); break; + case 2: DoScriptText(SAY_KILL_3, m_creature); break; } } @@ -139,22 +139,22 @@ struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI DeSpawnAdds(); - //remove aura from spell Garrote when Moroes dies - Map *map = m_creature->GetMap(); - if (map->IsDungeon()) - { - Map::PlayerList const &PlayerList = map->GetPlayers(); + //remove aura from spell Garrote when Moroes dies + Map *map = m_creature->GetMap(); + if (map->IsDungeon()) + { + Map::PlayerList const &PlayerList = map->GetPlayers(); - if (PlayerList.isEmpty()) - return; + if (PlayerList.isEmpty()) + return; - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - if (i->getSource()->isAlive() && i->getSource()->HasAura(SPELL_GARROTE,0)) - i->getSource()->RemoveAurasDueToSpell(SPELL_GARROTE); - } - } - } + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if (i->getSource()->isAlive() && i->getSource()->HasAura(SPELL_GARROTE,0)) + i->getSource()->RemoveAurasDueToSpell(SPELL_GARROTE); + } + } + } uint8 CheckAdd(uint64 guid) { @@ -308,8 +308,8 @@ struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI { switch(rand()%2) { - case 0: DoScriptText(SAY_SPECIAL_1, m_creature); break; - case 1: DoScriptText(SAY_SPECIAL_2, m_creature); break; + case 0: DoScriptText(SAY_SPECIAL_1, m_creature); break; + case 1: DoScriptText(SAY_SPECIAL_2, m_creature); break; } if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_nightbane.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_nightbane.cpp index f819037e7da..1a3c6684bbd 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/boss_nightbane.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/boss_nightbane.cpp @@ -35,7 +35,7 @@ EndScriptData */ #define SPELL_SMOKING_BLAST 37057 #define SPELL_FIREBALL_BARRAGE 30282 #define SPELL_SEARING_CINDERS 30127 -#define SPELL_SUMMON_SKELETON 30170 +#define SPELL_SUMMON_SKELETON 30170 #define EMOTE_SUMMON "An ancient being awakens in the distance..." #define YELL_AGGRO "What fools! I shall bring a quick end to your suffering!" @@ -60,17 +60,17 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI { boss_nightbaneAI(Creature* c) : ScriptedAI(c) { - pInstance = ((ScriptedInstance*)c->GetInstanceData()); + pInstance = ((ScriptedInstance*)c->GetInstanceData()); Intro = true; Reset(); } - ScriptedInstance* pInstance; + ScriptedInstance* pInstance; uint32 Phase; bool RainBones; - bool Skeletons; + bool Skeletons; uint32 BellowingRoarTimer; uint32 CharredEarthTimer; @@ -87,7 +87,7 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI bool Intro; bool Flying; - bool Movement; + bool Movement; uint32 WaitTimer; uint32 MovePhase; @@ -103,16 +103,16 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI SmokingBlastTimer = 20000; FireballBarrageTimer = 13000; SearingCindersTimer = 14000; - WaitTimer = 1000; + WaitTimer = 1000; - Phase =1; + Phase =1; FlyCount = 0; - MovePhase = 0; + MovePhase = 0; m_creature->SetSpeed(MOVE_RUN, 2.0f); m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING); m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - m_creature->setActive(true); + m_creature->setActive(true); pInstance->SetData(DATA_NIGHTBANE_EVENT, 6); if(pInstance->GetData(DATA_NIGHTBANE_EVENT) > 1) @@ -121,10 +121,10 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI m_creature->RemoveCorpse(); }else pInstance->SetData(DATA_NIGHTBANE_EVENT, NOT_STARTED); - HandleTerraceDoors(true); + HandleTerraceDoors(true); Flying = false; - Movement = false; + Movement = false; if(!Intro) { @@ -133,22 +133,22 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI } } - void HandleTerraceDoors(bool open) + void HandleTerraceDoors(bool open) { - if(GameObject *Door = GameObject::GetGameObject((*m_creature),pInstance->GetData64(DATA_MASTERS_TERRACE_DOOR_1))) - Door->SetUInt32Value(GAMEOBJECT_STATE, open ? 0 : 1); - if(GameObject *Door = GameObject::GetGameObject((*m_creature),pInstance->GetData64(DATA_MASTERS_TERRACE_DOOR_2))) - Door->SetUInt32Value(GAMEOBJECT_STATE, open ? 0 : 1); + if(GameObject *Door = GameObject::GetGameObject((*m_creature),pInstance->GetData64(DATA_MASTERS_TERRACE_DOOR_1))) + Door->SetUInt32Value(GAMEOBJECT_STATE, open ? 0 : 1); + if(GameObject *Door = GameObject::GetGameObject((*m_creature),pInstance->GetData64(DATA_MASTERS_TERRACE_DOOR_2))) + Door->SetUInt32Value(GAMEOBJECT_STATE, open ? 0 : 1); } void Aggro(Unit *who) - { - if(pInstance) - pInstance->SetData(DATA_NIGHTBANE_EVENT, IN_PROGRESS); + { + if(pInstance) + pInstance->SetData(DATA_NIGHTBANE_EVENT, IN_PROGRESS); - HandleTerraceDoors(false); - DoYell(YELL_AGGRO, LANG_UNIVERSAL, NULL); - } + HandleTerraceDoors(false); + DoYell(YELL_AGGRO, LANG_UNIVERSAL, NULL); + } void AttackStart(Unit* who) { @@ -156,13 +156,13 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI ScriptedAI::AttackStart(who); } - void JustDied(Unit* killer) - { - if(pInstance) - pInstance->SetData(DATA_NIGHTBANE_EVENT, DONE); + void JustDied(Unit* killer) + { + if(pInstance) + pInstance->SetData(DATA_NIGHTBANE_EVENT, DONE); - HandleTerraceDoors(true); - } + HandleTerraceDoors(true); + } void MoveInLineOfSight(Unit *who) { @@ -194,7 +194,7 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI { if(id == 0) { - DoTextEmote(EMOTE_BREATH, NULL, true); + DoTextEmote(EMOTE_BREATH, NULL, true); Flying = false; Phase = 2; return; @@ -211,7 +211,7 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI { Flying = false; Phase = 1; - Movement = true; + Movement = true; return; } @@ -219,12 +219,12 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI } } - void JustSummoned(Creature *summoned) - { - summoned->AI()->AttackStart(m_creature->getVictim()); - } + void JustSummoned(Creature *summoned) + { + summoned->AI()->AttackStart(m_creature->getVictim()); + } - void TakeOff() + void TakeOff() { DoYell(YELL_FLY_PHASE, LANG_UNIVERSAL, NULL); @@ -234,14 +234,14 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI (*m_creature).GetMotionMaster()->Clear(false); (*m_creature).GetMotionMaster()->MovePoint(0,IntroWay[2][0],IntroWay[2][1],IntroWay[2][2]); - Flying = true; + Flying = true; FlyTimer = 45000+rand()%15000; //timer wrong between 45 and 60 seconds ++FlyCount; RainofBonesTimer = 5000; //timer wrong (maybe) RainBones = false; - Skeletons = false; + Skeletons = false; } void UpdateAI(const uint32 diff) @@ -291,44 +291,44 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI // Phase 1 "GROUND FIGHT" if(Phase == 1) { - if(Movement) - { - DoStartMovement(m_creature->getVictim()); - Movement = false; - } + if(Movement) + { + DoStartMovement(m_creature->getVictim()); + Movement = false; + } - if (BellowingRoarTimer < diff) - { - DoCast(m_creature->getVictim(),SPELL_BELLOWING_ROAR); - BellowingRoarTimer = 30000+rand()%10000 ; //Timer - }else BellowingRoarTimer -= diff; + if (BellowingRoarTimer < diff) + { + DoCast(m_creature->getVictim(),SPELL_BELLOWING_ROAR); + BellowingRoarTimer = 30000+rand()%10000 ; //Timer + }else BellowingRoarTimer -= diff; if (SmolderingBreathTimer < diff) - { - DoCast(m_creature->getVictim(),SPELL_SMOLDERING_BREATH); - SmolderingBreathTimer = 20000;//timer + { + DoCast(m_creature->getVictim(),SPELL_SMOLDERING_BREATH); + SmolderingBreathTimer = 20000;//timer }else SmolderingBreathTimer -= diff; if (CharredEarthTimer < diff) - { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(target,SPELL_CHARRED_EARTH); - CharredEarthTimer = 20000; //timer + { + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(target,SPELL_CHARRED_EARTH); + CharredEarthTimer = 20000; //timer }else CharredEarthTimer -= diff; if (TailSweepTimer < diff) - { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) - if (!m_creature->HasInArc( M_PI, target)) - DoCast(target,SPELL_TAIL_SWEEP); - TailSweepTimer = 15000;//timer - }else TailSweepTimer -= diff; + { + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + if (!m_creature->HasInArc( M_PI, target)) + DoCast(target,SPELL_TAIL_SWEEP); + TailSweepTimer = 15000;//timer + }else TailSweepTimer -= diff; if (SearingCindersTimer < diff) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(target,SPELL_SEARING_CINDERS); - SearingCindersTimer = 10000; //timer + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(target,SPELL_SEARING_CINDERS); + SearingCindersTimer = 10000; //timer }else SearingCindersTimer -= diff; uint32 Prozent; @@ -338,10 +338,10 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI TakeOff(); if (Prozent < 50 && FlyCount == 1) // secound take off 50% - TakeOff(); + TakeOff(); if (Prozent < 25 && FlyCount == 2) // third take off 25% - TakeOff(); + TakeOff(); DoMeleeAttackIfReady(); } @@ -351,13 +351,13 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI { if (!RainBones) { - if (!Skeletons) - { - DoCast(m_creature->getVictim(), SPELL_SUMMON_SKELETON); - DoCast(m_creature->getVictim(), SPELL_SUMMON_SKELETON); - DoCast(m_creature->getVictim(), SPELL_SUMMON_SKELETON); - Skeletons = true; - } + if (!Skeletons) + { + DoCast(m_creature->getVictim(), SPELL_SUMMON_SKELETON); + DoCast(m_creature->getVictim(), SPELL_SUMMON_SKELETON); + DoCast(m_creature->getVictim(), SPELL_SUMMON_SKELETON); + Skeletons = true; + } if (RainofBonesTimer < diff && !RainBones) // only once at the beginning of phase 2 { @@ -368,8 +368,8 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI if (DistractingAshTimer < diff) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(target,SPELL_DISTRACTING_ASH); + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(target,SPELL_DISTRACTING_ASH); DistractingAshTimer = 2000;//timer wrong }else DistractingAshTimer -= diff; } @@ -385,17 +385,17 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI if (FireballBarrageTimer < diff) { - if (Unit* target = SelectUnit(SELECT_TARGET_FARTHEST, 0)) - DoCast(target,SPELL_FIREBALL_BARRAGE); - FireballBarrageTimer = 20000; //Timer + if (Unit* target = SelectUnit(SELECT_TARGET_FARTHEST, 0)) + DoCast(target,SPELL_FIREBALL_BARRAGE); + FireballBarrageTimer = 20000; //Timer }else FireballBarrageTimer -= diff; if (FlyTimer < diff) //landing { - if(rand()%2 == 0) - DoYell(YELL_LAND_PHASE_1, LANG_UNIVERSAL, NULL); - else - DoYell(YELL_LAND_PHASE_2, LANG_UNIVERSAL, NULL); + if(rand()%2 == 0) + DoYell(YELL_LAND_PHASE_1, LANG_UNIVERSAL, NULL); + else + DoYell(YELL_LAND_PHASE_2, LANG_UNIVERSAL, NULL); (*m_creature).GetMotionMaster()->Clear(false); m_creature->GetMotionMaster()->MovePoint(3,IntroWay[3][0],IntroWay[3][1],IntroWay[3][2]); @@ -416,6 +416,6 @@ void AddSC_boss_nightbane() Script *newscript; newscript = new Script; newscript->Name="boss_nightbane"; - newscript->GetAI = &GetAI_boss_nightbane; + newscript->GetAI = &GetAI_boss_nightbane; newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_prince_malchezaar.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_prince_malchezaar.cpp index 96d24878ebd..34a1114a12d 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/boss_prince_malchezaar.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/boss_prince_malchezaar.cpp @@ -219,15 +219,15 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI { switch(rand()%3) { - case 0: DoScriptText(SAY_SLAY1, m_creature); break; - case 1: DoScriptText(SAY_SLAY2, m_creature); break; - case 2: DoScriptText(SAY_SLAY3, m_creature); break; + case 0: DoScriptText(SAY_SLAY1, m_creature); break; + case 1: DoScriptText(SAY_SLAY2, m_creature); break; + case 2: DoScriptText(SAY_SLAY3, m_creature); break; } } void JustDied(Unit *victim) { - DoScriptText(SAY_DEATH, m_creature); + DoScriptText(SAY_DEATH, m_creature); AxesCleanup(); ClearWeapons(); @@ -249,7 +249,7 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI void Aggro(Unit *who) { - DoScriptText(SAY_AGGRO, m_creature); + DoScriptText(SAY_AGGRO, m_creature); if(pInstance) { @@ -392,8 +392,8 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI switch(rand()%2) { - case 0: DoScriptText(SAY_SUMMON1, m_creature); break; - case 1: DoScriptText(SAY_SUMMON2, m_creature); break; + case 0: DoScriptText(SAY_SUMMON1, m_creature); break; + case 1: DoScriptText(SAY_SUMMON2, m_creature); break; } } @@ -451,7 +451,7 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI m_creature->SetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE, cinfo->mindmg); m_creature->SetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE, cinfo->maxdmg); - m_creature->SetAttackTime(OFF_ATTACK, (m_creature->GetAttackTime(BASE_ATTACK)*150)/100); + m_creature->SetAttackTime(OFF_ATTACK, (m_creature->GetAttackTime(BASE_ATTACK)*150)/100); } } else if(phase == 2) @@ -557,16 +557,16 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI { if(SWPainTimer < diff) { - Unit* target = NULL; + Unit* target = NULL; if(phase == 1) target = m_creature->getVictim(); // the tank else //anyone but the tank target = SelectUnit(SELECT_TARGET_RANDOM, 1); - if (target) - DoCast(target, SPELL_SW_PAIN); + if (target) + DoCast(target, SPELL_SW_PAIN); - SWPainTimer = 20000; + SWPainTimer = 20000; }else SWPainTimer -= diff; } diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_shade_of_aran.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_shade_of_aran.cpp index 5ffc122f233..dac9b190065 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/boss_shade_of_aran.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/boss_shade_of_aran.cpp @@ -152,14 +152,14 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI { switch(rand()%2) { - case 0: DoScriptText(SAY_KILL1, m_creature); break; - case 1: DoScriptText(SAY_KILL2, m_creature); break; + case 0: DoScriptText(SAY_KILL1, m_creature); break; + case 1: DoScriptText(SAY_KILL2, m_creature); break; } } void JustDied(Unit *victim) { - DoScriptText(SAY_DEATH, m_creature); + DoScriptText(SAY_DEATH, m_creature); if(pInstance) { @@ -174,9 +174,9 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI { switch(rand()%3) { - case 0: DoScriptText(SAY_AGGRO1, m_creature); break; - case 1: DoScriptText(SAY_AGGRO2, m_creature); break; - case 2: DoScriptText(SAY_AGGRO3, m_creature); break; + case 0: DoScriptText(SAY_AGGRO1, m_creature); break; + case 1: DoScriptText(SAY_AGGRO2, m_creature); break; + case 2: DoScriptText(SAY_AGGRO3, m_creature); break; } if(pInstance) @@ -228,39 +228,39 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI return; if(CloseDoorTimer) - { - if(CloseDoorTimer <= diff) - { - if(pInstance) - { - if(GameObject* Door = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DATA_GAMEOBJECT_LIBRARY_DOOR))) - Door->SetGoState(1); - CloseDoorTimer = 0; - } - }else CloseDoorTimer -= diff; - } + { + if(CloseDoorTimer <= diff) + { + if(pInstance) + { + if(GameObject* Door = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DATA_GAMEOBJECT_LIBRARY_DOOR))) + Door->SetGoState(1); + CloseDoorTimer = 0; + } + }else CloseDoorTimer -= diff; + } //Cooldowns for casts if (ArcaneCooldown) - { + { if (ArcaneCooldown >= diff) ArcaneCooldown -= diff; else ArcaneCooldown = 0; - } + } if (FireCooldown) - { + { if (FireCooldown >= diff) FireCooldown -= diff; else FireCooldown = 0; - } + } if (FrostCooldown) - { - if (FrostCooldown >= diff) + { + if (FrostCooldown >= diff) FrostCooldown -= diff; else FrostCooldown = 0; - } + } if(!Drinking && m_creature->GetMaxPower(POWER_MANA) && (m_creature->GetPower(POWER_MANA)*100 / m_creature->GetMaxPower(POWER_MANA)) < 20) { @@ -356,8 +356,8 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI DoCast(m_creature, SPELL_AOE_CS); break; case 1: - if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_CHAINSOFICE); + if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pUnit, SPELL_CHAINSOFICE); break; } SecondarySpellTimer = 5000 + (rand()%15000); @@ -390,9 +390,9 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI case SUPER_AE: if (rand()%2) - DoScriptText(SAY_EXPLOSION1, m_creature); - else - DoScriptText(SAY_EXPLOSION2, m_creature); + DoScriptText(SAY_EXPLOSION1, m_creature); + else + DoScriptText(SAY_EXPLOSION2, m_creature); m_creature->CastSpell(m_creature, SPELL_BLINK_CENTER, true); m_creature->CastSpell(m_creature, SPELL_PLAYERPULL, true); @@ -402,9 +402,9 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI case SUPER_FLAME: if (rand()%2) - DoScriptText(SAY_FLAMEWREATH1, m_creature); - else - DoScriptText(SAY_FLAMEWREATH2, m_creature); + DoScriptText(SAY_FLAMEWREATH1, m_creature); + else + DoScriptText(SAY_FLAMEWREATH2, m_creature); FlameWreathTimer = 20000; FlameWreathCheckTime = 500; @@ -419,9 +419,9 @@ struct TRINITY_DLL_DECL boss_aranAI : public ScriptedAI case SUPER_BLIZZARD: if (rand()%2) - DoScriptText(SAY_BLIZZARD1, m_creature); - else - DoScriptText(SAY_BLIZZARD2, m_creature); + DoScriptText(SAY_BLIZZARD1, m_creature); + else + DoScriptText(SAY_BLIZZARD2, m_creature); Creature* Spawn = NULL; Spawn = DoSpawnCreature(CREATURE_ARAN_BLIZZARD, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 25000); diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_terestian_illhoof.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_terestian_illhoof.cpp index c7c95a4eabc..dd4c0ce3300 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/boss_terestian_illhoof.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/boss_terestian_illhoof.cpp @@ -230,8 +230,8 @@ struct TRINITY_DLL_DECL boss_terestianAI : public ScriptedAI { switch(rand()%2) { - case 0: DoScriptText(SAY_SLAY1, m_creature); break; - case 1: DoScriptText(SAY_SLAY2, m_creature); break; + case 0: DoScriptText(SAY_SLAY1, m_creature); break; + case 1: DoScriptText(SAY_SLAY2, m_creature); break; } } @@ -298,8 +298,8 @@ struct TRINITY_DLL_DECL boss_terestianAI : public ScriptedAI Chains->CastSpell(Chains, SPELL_DEMON_CHAINS, true); switch(rand()%2) { - case 0: DoScriptText(SAY_SACRIFICE1, m_creature); break; - case 1: DoScriptText(SAY_SACRIFICE2, m_creature); break; + case 0: DoScriptText(SAY_SACRIFICE1, m_creature); break; + case 1: DoScriptText(SAY_SACRIFICE2, m_creature); break; } SacrificeTimer = 30000; } @@ -325,8 +325,8 @@ struct TRINITY_DLL_DECL boss_terestianAI : public ScriptedAI SummonedPortals = true; switch(rand()%2) { - case 0: DoScriptText(SAY_SUMMON1, m_creature); break; - case 1: DoScriptText(SAY_SUMMON2, m_creature); break; + case 0: DoScriptText(SAY_SUMMON1, m_creature); break; + case 1: DoScriptText(SAY_SUMMON2, m_creature); break; } } uint32 random = rand()%2; @@ -340,13 +340,13 @@ struct TRINITY_DLL_DECL boss_terestianAI : public ScriptedAI }else SummonTimer -= diff; if(!Berserk) - { - if(BerserkTimer < diff) - { - DoCast(m_creature, SPELL_BERSERK); - Berserk = true; - }else BerserkTimer -= diff; - } + { + if(BerserkTimer < diff) + { + DoCast(m_creature, SPELL_BERSERK); + Berserk = true; + }else BerserkTimer -= diff; + } DoMeleeAttackIfReady(); } diff --git a/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp b/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp index ef528d518df..10828248927 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp @@ -135,7 +135,7 @@ struct TRINITY_DLL_DECL boss_dorotheeAI : public ScriptedAI void Aggro(Unit* who) { - DoScriptText(SAY_DOROTHEE_AGGRO, m_creature); + DoScriptText(SAY_DOROTHEE_AGGRO, m_creature); } void SummonTito(); // See below @@ -167,13 +167,13 @@ struct TRINITY_DLL_DECL boss_dorotheeAI : public ScriptedAI void UpdateAI(const uint32 diff) { if(AggroTimer) - { - if(AggroTimer <= diff) - { - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - AggroTimer = 0; - }else AggroTimer -= diff; - } + { + if(AggroTimer <= diff) + { + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + AggroTimer = 0; + }else AggroTimer -= diff; + } if(!UpdateVictim()) return; @@ -229,7 +229,7 @@ struct TRINITY_DLL_DECL mob_titoAI : public ScriptedAI if(Dorothee && Dorothee->isAlive()) { ((boss_dorotheeAI*)Dorothee->AI())->TitoDied = true; - DoScriptText(SAY_DOROTHEE_TITO_DEATH, Dorothee); + DoScriptText(SAY_DOROTHEE_TITO_DEATH, Dorothee); } } } @@ -254,7 +254,7 @@ void boss_dorotheeAI::SummonTito() Creature* Tito = DoSpawnCreature(CREATURE_TITO, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); if(Tito) { - DoScriptText(SAY_DOROTHEE_SUMMON, m_creature); + DoScriptText(SAY_DOROTHEE_SUMMON, m_creature); ((mob_titoAI*)Tito->AI())->DorotheeGUID = m_creature->GetGUID(); Tito->AI()->AttackStart(m_creature->getVictim()); SummonedTito = true; @@ -301,7 +301,7 @@ struct TRINITY_DLL_DECL boss_strawmanAI : public ScriptedAI void Aggro(Unit* who) { - DoScriptText(SAY_STRAWMAN_AGGRO, m_creature); + DoScriptText(SAY_STRAWMAN_AGGRO, m_creature); } void SpellHit(Unit* caster, const SpellEntry *Spell) @@ -312,7 +312,7 @@ struct TRINITY_DLL_DECL boss_strawmanAI : public ScriptedAI void JustDied(Unit* killer) { - DoScriptText(SAY_STRAWMAN_DEATH, m_creature); + DoScriptText(SAY_STRAWMAN_DEATH, m_creature); if(pInstance) SummonCroneIfReady(pInstance, m_creature); @@ -320,19 +320,19 @@ struct TRINITY_DLL_DECL boss_strawmanAI : public ScriptedAI void KilledUnit(Unit* victim) { - DoScriptText(SAY_STRAWMAN_SLAY, m_creature); + DoScriptText(SAY_STRAWMAN_SLAY, m_creature); } void UpdateAI(const uint32 diff) { if(AggroTimer) - { - if(AggroTimer <= diff) - { - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - AggroTimer = 0; - }else AggroTimer -= diff; - } + { + if(AggroTimer <= diff) + { + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + AggroTimer = 0; + }else AggroTimer -= diff; + } if(!UpdateVictim()) return; @@ -380,7 +380,7 @@ struct TRINITY_DLL_DECL boss_tinheadAI : public ScriptedAI void Aggro(Unit* who) { - DoScriptText(SAY_TINHEAD_AGGRO, m_creature); + DoScriptText(SAY_TINHEAD_AGGRO, m_creature); } void AttackStart(Unit* who) @@ -401,7 +401,7 @@ struct TRINITY_DLL_DECL boss_tinheadAI : public ScriptedAI void JustDied(Unit* killer) { - DoScriptText(SAY_TINHEAD_DEATH, m_creature); + DoScriptText(SAY_TINHEAD_DEATH, m_creature); if(pInstance) SummonCroneIfReady(pInstance, m_creature); @@ -409,19 +409,19 @@ struct TRINITY_DLL_DECL boss_tinheadAI : public ScriptedAI void KilledUnit(Unit* victim) { - DoScriptText(SAY_TINHEAD_SLAY, m_creature); + DoScriptText(SAY_TINHEAD_SLAY, m_creature); } void UpdateAI(const uint32 diff) { if(AggroTimer) - { + { if(AggroTimer < diff) - { - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - AggroTimer = 0; - }else AggroTimer -= diff; - } + { + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + AggroTimer = 0; + }else AggroTimer -= diff; + } if(!UpdateVictim()) return; @@ -488,12 +488,12 @@ struct TRINITY_DLL_DECL boss_roarAI : public ScriptedAI void Aggro(Unit* who) { - DoScriptText(SAY_ROAR_AGGRO, m_creature); + DoScriptText(SAY_ROAR_AGGRO, m_creature); } void JustDied(Unit* killer) { - DoScriptText(SAY_ROAR_DEATH, m_creature); + DoScriptText(SAY_ROAR_DEATH, m_creature); if(pInstance) SummonCroneIfReady(pInstance, m_creature); @@ -501,19 +501,19 @@ struct TRINITY_DLL_DECL boss_roarAI : public ScriptedAI void KilledUnit(Unit* victim) { - DoScriptText(SAY_ROAR_SLAY, m_creature); + DoScriptText(SAY_ROAR_SLAY, m_creature); } void UpdateAI(const uint32 diff) { if(AggroTimer) - { + { if(AggroTimer <= diff) - { - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - AggroTimer = 0; - }else AggroTimer -= diff; - } + { + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + AggroTimer = 0; + }else AggroTimer -= diff; + } if(!UpdateVictim()) return; @@ -563,11 +563,11 @@ struct TRINITY_DLL_DECL boss_croneAI : public ScriptedAI { switch(rand()%2) { - case 0: DoScriptText(SAY_CRONE_AGGRO, m_creature); break; - case 1: DoScriptText(SAY_CRONE_AGGRO2, m_creature); break; + case 0: DoScriptText(SAY_CRONE_AGGRO, m_creature); break; + case 1: DoScriptText(SAY_CRONE_AGGRO2, m_creature); break; } m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); } void JustDied(Unit* killer) @@ -1088,12 +1088,12 @@ struct TRINITY_DLL_DECL boss_romuloAI : public ScriptedAI void JustDied(Unit* killer) { - DoScriptText(SAY_ROMULO_DEATH, m_creature); + DoScriptText(SAY_ROMULO_DEATH, m_creature); } void KilledUnit(Unit* victim) { - DoScriptText(SAY_ROMULO_SLAY, m_creature); + DoScriptText(SAY_ROMULO_SLAY, m_creature); } void UpdateAI(const uint32 diff); @@ -1106,7 +1106,7 @@ void boss_julianneAI::DamageTaken(Unit* done_by, uint32 &damage) if(Phase == PHASE_JULIANNE) { - DoScriptText(SAY_JULIANNE_DEATH01, m_creature); + DoScriptText(SAY_JULIANNE_DEATH01, m_creature); m_creature->InterruptNonMeleeSpells(true); DoCast(m_creature, SPELL_DRINK_POISON); PretendToDie(m_creature); @@ -1200,23 +1200,23 @@ void boss_romuloAI::DamageTaken(Unit* done_by, uint32 &damage) void boss_julianneAI::UpdateAI(const uint32 diff) { if(EntryYellTimer) - { - if(EntryYellTimer < diff) - { - DoScriptText(SAY_JULIANNE_ENTER, m_creature); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - EntryYellTimer = 0; - }else EntryYellTimer -= diff; - } + { + if(EntryYellTimer < diff) + { + DoScriptText(SAY_JULIANNE_ENTER, m_creature); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + EntryYellTimer = 0; + }else EntryYellTimer -= diff; + } if(AggroYellTimer) - { - if(AggroYellTimer < diff) - { - DoScriptText(SAY_JULIANNE_AGGRO, m_creature); - AggroYellTimer = 0; - }else AggroYellTimer -= diff; - } + { + if(AggroYellTimer < diff) + { + DoScriptText(SAY_JULIANNE_AGGRO, m_creature); + AggroYellTimer = 0; + }else AggroYellTimer -= diff; + } if(Phase == PHASE_ROMULO && !SummonedRomulo) { @@ -1243,20 +1243,20 @@ void boss_julianneAI::UpdateAI(const uint32 diff) return; if(RomuloDead) - { + { if(ResurrectTimer < diff) - { - Creature* Romulo = ((Creature*)Unit::GetUnit((*m_creature), RomuloGUID)); - if(Romulo && ((boss_romuloAI*)Romulo->AI())->IsFakingDeath) - { - DoScriptText(SAY_JULIANNE_RESURRECT, m_creature); - Resurrect(Romulo); - ((boss_romuloAI*)Romulo->AI())->IsFakingDeath = false; - ResurrectTimer = 10000; - } - RomuloDead = false; - }else ResurrectTimer -= diff; - } + { + Creature* Romulo = ((Creature*)Unit::GetUnit((*m_creature), RomuloGUID)); + if(Romulo && ((boss_romuloAI*)Romulo->AI())->IsFakingDeath) + { + DoScriptText(SAY_JULIANNE_RESURRECT, m_creature); + Resurrect(Romulo); + ((boss_romuloAI*)Romulo->AI())->IsFakingDeath = false; + ResurrectTimer = 10000; + } + RomuloDead = false; + }else ResurrectTimer -= diff; + } if(BlindingPassionTimer < diff) { @@ -1299,20 +1299,20 @@ void boss_romuloAI::UpdateAI(const uint32 diff) return; if(JulianneDead) - { + { if(ResurrectTimer < diff) - { - Creature* Julianne = ((Creature*)Unit::GetUnit((*m_creature), JulianneGUID)); - if(Julianne && ((boss_julianneAI*)Julianne->AI())->IsFakingDeath) - { - DoScriptText(SAY_ROMULO_RESURRECT, m_creature); - Resurrect(Julianne); - ((boss_julianneAI*)Julianne->AI())->IsFakingDeath = false; - ResurrectTimer = 10000; - } - JulianneDead = false; - }else ResurrectTimer -= diff; - } + { + Creature* Julianne = ((Creature*)Unit::GetUnit((*m_creature), JulianneGUID)); + if(Julianne && ((boss_julianneAI*)Julianne->AI())->IsFakingDeath) + { + DoScriptText(SAY_ROMULO_RESURRECT, m_creature); + Resurrect(Julianne); + ((boss_julianneAI*)Julianne->AI())->IsFakingDeath = false; + ResurrectTimer = 10000; + } + JulianneDead = false; + }else ResurrectTimer -= diff; + } if(BackwardLungeTimer < diff) { diff --git a/src/bindings/scripts/scripts/zone/karazhan/def_karazhan.h b/src/bindings/scripts/scripts/zone/karazhan/def_karazhan.h index 29660dd6426..e1c4f7c3220 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/def_karazhan.h +++ b/src/bindings/scripts/scripts/zone/karazhan/def_karazhan.h @@ -31,8 +31,8 @@ #define DATA_GAMEOBJECT_GAME_DOOR 24 #define DATA_GAMEOBJECT_GAME_EXIT_DOOR 25 #define DATA_IMAGE_OF_MEDIVH 26 -#define DATA_MASTERS_TERRACE_DOOR_1 27 -#define DATA_MASTERS_TERRACE_DOOR_2 28 +#define DATA_MASTERS_TERRACE_DOOR_1 27 +#define DATA_MASTERS_TERRACE_DOOR_2 28 // Opera Performances #define EVENT_OZ 1 diff --git a/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp b/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp index 96938daaa82..f997f5fc6ea 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp @@ -60,9 +60,9 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance uint64 MassiveDoor; // Door at Netherspite uint64 GamesmansDoor; // Door before Chess uint64 GamesmansExitDoor; // Door after Chess - uint64 NetherspaceDoor; // Door at Malchezaar - uint64 MastersTerraceDoor[2]; - uint64 ImageGUID; + uint64 NetherspaceDoor; // Door at Malchezaar + uint64 MastersTerraceDoor[2]; + uint64 ImageGUID; uint8 Nightbane; bool CheckNightbane; @@ -88,12 +88,12 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance GamesmansDoor = 0; GamesmansExitDoor = 0; NetherspaceDoor = 0; - MastersTerraceDoor[0]= 0; - MastersTerraceDoor[1]= 0; - ImageGUID = 0; + MastersTerraceDoor[0]= 0; + MastersTerraceDoor[1]= 0; + ImageGUID = 0; Nightbane = 0; - + CheckNightbane = false; } @@ -101,7 +101,7 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance { for (uint8 i = 0; i < ENCOUNTERS; ++i) if (Encounters[i] == IN_PROGRESS) - return true; + return true; return false; } @@ -129,7 +129,7 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance }else return Encounters[11]; case DATA_OPERA_PERFORMANCE: return OperaEvent; case DATA_OPERA_OZ_DEATHCOUNT: return OzDeathCount; - case DATA_IMAGE_OF_MEDIVH: return ImageGUID; + case DATA_IMAGE_OF_MEDIVH: return ImageGUID; } return 0; @@ -160,8 +160,8 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance case DATA_GAMEOBJECT_GAME_DOOR: return GamesmansDoor; case DATA_GAMEOBJECT_GAME_EXIT_DOOR: return GamesmansExitDoor; case DATA_GAMEOBJECT_NETHER_DOOR: return NetherspaceDoor; - case DATA_MASTERS_TERRACE_DOOR_1: return MastersTerraceDoor[0]; - case DATA_MASTERS_TERRACE_DOOR_2: return MastersTerraceDoor[1]; + case DATA_MASTERS_TERRACE_DOOR_1: return MastersTerraceDoor[0]; + case DATA_MASTERS_TERRACE_DOOR_2: return MastersTerraceDoor[1]; } return 0; @@ -172,11 +172,11 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance switch (type) { case DATA_ATTUMEN_EVENT: Encounters[0] = data; break; - case DATA_MOROES_EVENT: - if (Encounters[1] == DONE) - break; - Encounters[1] = data; - break; + case DATA_MOROES_EVENT: + if (Encounters[1] == DONE) + break; + Encounters[1] = data; + break; case DATA_MAIDENOFVIRTUE_EVENT: Encounters[2] = data; break; case DATA_OPTIONAL_BOSS_EVENT: Encounters[3] = data; break; case DATA_OPERA_EVENT: Encounters[4] = data; break; @@ -186,7 +186,7 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance case DATA_NETHERSPITE_EVENT: Encounters[8] = data; break; case DATA_CHESS_EVENT: Encounters[9] = data; break; case DATA_MALCHEZZAR_EVENT: Encounters[10] = data; break; - case DATA_NIGHTBANE_EVENT: + case DATA_NIGHTBANE_EVENT: if(data == 6) { Nightbane; @@ -200,13 +200,13 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance SaveToDB(); } - void SetData64(uint32 identifier, uint64 data) - { - switch(identifier) - { - case DATA_IMAGE_OF_MEDIVH: ImageGUID = data; - } - } + void SetData64(uint32 identifier, uint64 data) + { + switch(identifier) + { + case DATA_IMAGE_OF_MEDIVH: ImageGUID = data; + } + } void OnObjectCreate(GameObject* go) { @@ -220,8 +220,8 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance case 184276: GamesmansDoor = go->GetGUID(); break; case 184277: GamesmansExitDoor = go->GetGUID(); break; case 185134: NetherspaceDoor = go->GetGUID(); break; - case 184274: MastersTerraceDoor[0] = go->GetGUID(); break; - case 184280: MastersTerraceDoor[1] = go->GetGUID(); break; + case 184274: MastersTerraceDoor[0] = go->GetGUID(); break; + case 184280: MastersTerraceDoor[1] = go->GetGUID(); break; } switch(OperaEvent) diff --git a/src/bindings/scripts/scripts/zone/karazhan/karazhan.cpp b/src/bindings/scripts/scripts/zone/karazhan/karazhan.cpp index 49febb5520f..fd315e65cce 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/karazhan.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/karazhan.cpp @@ -49,31 +49,31 @@ EndContentData */ struct Dialogue { int32 textid; - uint32 timer; + uint32 timer; }; static Dialogue OzDialogue[]= { - {-1532103, 6000}, - {-1532104, 18000}, - {-1532105, 9000}, - {-1532106, 15000} + {-1532103, 6000}, + {-1532104, 18000}, + {-1532105, 9000}, + {-1532106, 15000} }; static Dialogue HoodDialogue[]= { - {-1532107, 6000}, - {-1532108, 10000}, - {-1532109, 14000}, - {-1532110, 15000} + {-1532107, 6000}, + {-1532108, 10000}, + {-1532109, 14000}, + {-1532110, 15000} }; static Dialogue RAJDialogue[]= { - {-1532111, 5000}, - {-1532112, 7000}, - {-1532113, 14000}, - {-1532114, 14000} + {-1532111, 5000}, + {-1532112, 7000}, + {-1532113, 14000}, + {-1532114, 14000} }; // Entries and spawn locations for creatures in Oz event @@ -166,7 +166,7 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI float x,y,z; m_creature->GetPosition(x, y, z); - if (Creature* Spotlight = m_creature->SummonCreature(CREATURE_SPOTLIGHT, x, y, z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 50000)) + if (Creature* Spotlight = m_creature->SummonCreature(CREATURE_SPOTLIGHT, x, y, z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 50000)) { Spotlight->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Spotlight->CastSpell(Spotlight, SPELL_SPOTLIGHT, false); @@ -177,7 +177,7 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI case 5: if(pInstance) { - if (GameObject* Door = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_STAGEDOORLEFT))) + if (GameObject* Door = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_STAGEDOORLEFT))) Door->SetGoState(1); } IsBeingEscorted = false; @@ -194,21 +194,21 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI { case EVENT_OZ: if (OzDialogue[count].textid) - text = OzDialogue[count].textid; + text = OzDialogue[count].textid; if(OzDialogue[count].timer) TalkTimer = OzDialogue[count].timer; break; case EVENT_HOOD: - if (HoodDialogue[count].textid) - text = HoodDialogue[count].textid; + if (HoodDialogue[count].textid) + text = HoodDialogue[count].textid; if(HoodDialogue[count].timer) TalkTimer = HoodDialogue[count].timer; break; case EVENT_RAJ: if (RAJDialogue[count].textid) - text = RAJDialogue[count].textid; + text = RAJDialogue[count].textid; if(RAJDialogue[count].timer) TalkTimer = RAJDialogue[count].timer; break; @@ -249,7 +249,7 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI if(PerformanceReady) { if(CurtainTimer) - { + { if(CurtainTimer <= diff) { PrepareEncounter(); @@ -257,12 +257,12 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI if(!pInstance) return; - if (GameObject* Curtain = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_CURTAINS))) + if (GameObject* Curtain = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_CURTAINS))) Curtain->SetGoState(0); CurtainTimer = 0; }else CurtainTimer -= diff; - } + } if(!RaidWiped) { @@ -310,7 +310,7 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI pInstance->SetData(DATA_OPERA_EVENT, IN_PROGRESS); - if (GameObject* Door = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_STAGEDOORLEFT))) + if (GameObject* Door = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_STAGEDOORLEFT))) Door->SetGoState(0); m_creature->CastSpell(m_creature, SPELL_TUXEDO, true); @@ -451,7 +451,7 @@ bool GossipSelect_npc_berthold(Player* player, Creature* _Creature, uint32 sende #define SPELL_FIRE_BALL 30967 #define SPELL_UBER_FIREBALL 30971 #define SPELL_CONFLAGRATION_BLAST 30977 -#define SPELL_MANA_SHIELD 31635 +#define SPELL_MANA_SHIELD 31635 static float MedivPos[4] = {-11161.49,-1902.24,91.48,1.94}; static float ArcanagosPos[4] = {-11169.75,-1881.48,95.39,4.83}; @@ -473,11 +473,11 @@ struct TRINITY_DLL_DECL npc_image_of_medivhAI : public ScriptedAI uint32 FireMedivhTimer; uint32 FireArcanagosTimer; - bool EventStarted; + bool EventStarted; void Reset() { - ArcanagosGUID = 0; + ArcanagosGUID = 0; if(pInstance && pInstance->GetData64(DATA_IMAGE_OF_MEDIVH) == 0) { @@ -551,7 +551,7 @@ struct TRINITY_DLL_DECL npc_image_of_medivhAI : public ScriptedAI return 5000; case 8: FireMedivhTimer = 500; - DoCast(m_creature, SPELL_MANA_SHIELD); + DoCast(m_creature, SPELL_MANA_SHIELD); return 10000; case 9: m_creature->TextEmote(EMOTE_DIALOG_MEDIVH_7, 0, false); @@ -565,34 +565,34 @@ struct TRINITY_DLL_DECL npc_image_of_medivhAI : public ScriptedAI ((Creature*)arca)->Yell(SAY_DIALOG_ARCANAGOS_8, LANG_UNIVERSAL, NULL); return 5000; case 12: - arca->GetMotionMaster()->MovePoint(0, -11010.82,-1761.18, 156.47); - arca->setActive(true); - arca->InterruptNonMeleeSpells(true); - arca->SetSpeed(MOVE_FLIGHT, 2.0f); + arca->GetMotionMaster()->MovePoint(0, -11010.82,-1761.18, 156.47); + arca->setActive(true); + arca->InterruptNonMeleeSpells(true); + arca->SetSpeed(MOVE_FLIGHT, 2.0f); return 10000; case 13: m_creature->Yell(SAY_DIALOG_MEDIVH_9, LANG_UNIVERSAL, NULL); return 10000; - case 14: - m_creature->SetVisibility(VISIBILITY_OFF); - m_creature->ClearInCombat(); + case 14: + m_creature->SetVisibility(VISIBILITY_OFF); + m_creature->ClearInCombat(); - if(map->IsDungeon()) - { + if(map->IsDungeon()) + { InstanceMap::PlayerList const &PlayerList = ((InstanceMap*)map)->GetPlayers(); for (InstanceMap::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { - if(i->getSource()->isAlive()) + if(i->getSource()->isAlive()) { - if(i->getSource()->GetQuestStatus(9645) == QUEST_STATUS_INCOMPLETE) - i->getSource()->CompleteQuest(9645); + if(i->getSource()->GetQuestStatus(9645) == QUEST_STATUS_INCOMPLETE) + i->getSource()->CompleteQuest(9645); } } } - return 50000; - case 15: - arca->DealDamage(arca,arca->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - return 5000; + return 50000; + case 15: + arca->DealDamage(arca,arca->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + return 5000; default : return 9999999; } @@ -653,7 +653,7 @@ void AddSC_karazhan() newscript->pGossipSelect = &GossipSelect_npc_berthold; newscript->RegisterSelf(); - newscript = new Script; + newscript = new Script; newscript->Name = "npc_image_of_medivh"; newscript->GetAI = &GetAI_npc_image_of_medivh; newscript->RegisterSelf(); diff --git a/src/bindings/scripts/scripts/zone/magisters_terrace/boss_felblood_kaelthas.cpp b/src/bindings/scripts/scripts/zone/magisters_terrace/boss_felblood_kaelthas.cpp index edcf0c09c13..7136e4c83bd 100644 --- a/src/bindings/scripts/scripts/zone/magisters_terrace/boss_felblood_kaelthas.cpp +++ b/src/bindings/scripts/scripts/zone/magisters_terrace/boss_felblood_kaelthas.cpp @@ -42,7 +42,7 @@ EndScriptData */ #define SPELL_PHOENIX 44194 // Summons a phoenix (Doesn't work?) #define SPELL_PHOENIX_BURN 44198 // A spell Phoenix uses to damage everything around -#define SPELL_PHOENIX_FIREBALL 44202 // Phoenix casts this in phase 2 and stops moving +#define SPELL_PHOENIX_FIREBALL 44202 // Phoenix casts this in phase 2 and stops moving #define SPELL_FLAMESTRIKE1_NORMAL 44190 // Damage part #define SPELL_FLAMESTRIKE1_HEROIC 46163 // Heroic damage part @@ -73,9 +73,9 @@ float KaelLocations[6][2]= {148.744659, 181.377426},//center {140.823883, 195.403046},//phoenixpos1 {156.574188, 195.650482},//phoenixpos2 - {149.813, 160.917},//spherepos1 - {167.223, 173.594},//spherepos2 - {130.68, 173.007},//spherepos3 + {149.813, 160.917},//spherepos1 + {167.223, 173.594},//spherepos2 + {130.68, 173.007},//spherepos3 }; #define LOCATION_Z -16.727455 @@ -85,7 +85,7 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI { pInstance = ((ScriptedInstance*)c->GetInstanceData()); Reset(); - Heroic = c->GetMap()->IsHeroic(); + Heroic = c->GetMap()->IsHeroic(); } ScriptedInstance* pInstance; @@ -132,15 +132,15 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI Phase = 0; if(pInstance) - { - if(m_creature->isDead()) - pInstance->SetData(DATA_KAELTHAS_EVENT, DONE); - else - pInstance->SetData(DATA_KAELTHAS_EVENT, NOT_STARTED); - } + { + if(m_creature->isDead()) + pInstance->SetData(DATA_KAELTHAS_EVENT, DONE); + else + pInstance->SetData(DATA_KAELTHAS_EVENT, NOT_STARTED); + } } - void KilledUnit(Unit* victim) + void KilledUnit(Unit* victim) { if(victim && (victim->GetTypeId() == TYPEID_PLAYER)) { @@ -152,13 +152,13 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI data << uint32(0); victim->SendMessageToSet(&data, true); } - } + } void JustDied(Unit *killer) { - RemoveGravityLapse(); + RemoveGravityLapse(); DoScriptText(SAY_DEATH, m_creature); - if(pInstance) - pInstance->SetData(DATA_KAELTHAS_EVENT, DONE); + if(pInstance) + pInstance->SetData(DATA_KAELTHAS_EVENT, DONE); } void DamageTaken(Unit* done_by, uint32 &damage) @@ -170,14 +170,14 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI void Aggro(Unit *who) { DoScriptText(SAY_AGGRO, m_creature); - if(pInstance) - pInstance->SetData(DATA_KAELTHAS_EVENT, IN_PROGRESS); + if(pInstance) + pInstance->SetData(DATA_KAELTHAS_EVENT, IN_PROGRESS); } void SetThreatList(Creature* SummonedUnit) { if(!SummonedUnit) - return; + return; std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); std::list::iterator i = m_threatlist.begin(); @@ -192,53 +192,53 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI } } - void EnterEvadeMode() - { - RemoveGravityLapse(); - m_creature->InterruptNonMeleeSpells(true); - m_creature->RemoveAllAuras(); - m_creature->DeleteThreatList(); - m_creature->CombatStop(); - m_creature->LoadCreaturesAddon(); + void EnterEvadeMode() + { + RemoveGravityLapse(); + m_creature->InterruptNonMeleeSpells(true); + m_creature->RemoveAllAuras(); + m_creature->DeleteThreatList(); + m_creature->CombatStop(); + m_creature->LoadCreaturesAddon(); - if( m_creature->isAlive() ) - m_creature->GetMotionMaster()->MoveTargetedHome(); + if( m_creature->isAlive() ) + m_creature->GetMotionMaster()->MoveTargetedHome(); - m_creature->SetLootRecipient(NULL); + m_creature->SetLootRecipient(NULL); - InCombat = false; - Reset(); - } + InCombat = false; + Reset(); + } void TeleportPlayersToSelf() { - float x,y,z; + float x,y,z; m_creature->Relocate(KaelLocations[0][0], KaelLocations[0][1], LOCATION_Z, 0); - Map *map = m_creature->GetMap(); + Map *map = m_creature->GetMap(); Map::PlayerList const &PlayerList = map->GetPlayers(); - Map::PlayerList::const_iterator i; - for (i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - if (Player* i_pl = i->getSource()) - if(i_pl->isAlive()) - { - i_pl->CastSpell(i_pl, SPELL_TELEPORT_CENTER, true); - m_creature->GetNearPoint(m_creature,x,y,z,5,5,0); - i_pl->TeleportTo(m_creature->GetMapId(),x,y,LOCATION_Z,i_pl->GetOrientation()); - } + Map::PlayerList::const_iterator i; + for (i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if (Player* i_pl = i->getSource()) + if(i_pl->isAlive()) + { + i_pl->CastSpell(i_pl, SPELL_TELEPORT_CENTER, true); + m_creature->GetNearPoint(m_creature,x,y,z,5,5,0); + i_pl->TeleportTo(m_creature->GetMapId(),x,y,LOCATION_Z,i_pl->GetOrientation()); + } } DoCast(m_creature, SPELL_TELEPORT_CENTER, true); } void CastGravityLapseKnockUp() { - Map *map = m_creature->GetMap(); + Map *map = m_creature->GetMap(); Map::PlayerList const &PlayerList = map->GetPlayers(); - Map::PlayerList::const_iterator i; - for (i = PlayerList.begin(); i != PlayerList.end(); ++i) - { + Map::PlayerList::const_iterator i; + for (i = PlayerList.begin(); i != PlayerList.end(); ++i) + { if (Player* i_pl = i->getSource()) - if(i_pl->isAlive()) + if(i_pl->isAlive()) // Knockback into the air i_pl->CastSpell(i_pl, SPELL_GRAVITY_LAPSE_DOT, true, 0, 0, m_creature->GetGUID()); } @@ -246,14 +246,14 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI void CastGravityLapseFly() // Use Fly Packet hack for now as players can't cast "fly" spells unless in map 530. Has to be done a while after they get knocked into the air... { - Map *map = m_creature->GetMap(); - Map::PlayerList const &PlayerList = map->GetPlayers(); - Map::PlayerList::const_iterator i; - for (i = PlayerList.begin(); i != PlayerList.end(); ++i) - { + Map *map = m_creature->GetMap(); + Map::PlayerList const &PlayerList = map->GetPlayers(); + Map::PlayerList::const_iterator i; + for (i = PlayerList.begin(); i != PlayerList.end(); ++i) + { if (Player* i_pl = i->getSource()) { - if(i_pl->isAlive()) + if(i_pl->isAlive()) { // Also needs an exception in spell system. i_pl->CastSpell(i_pl, SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, m_creature->GetGUID()); @@ -263,7 +263,7 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI data.append(i_pl->GetPackGUID()); data << uint32(0); i_pl->SendMessageToSet(&data, true); - i_pl->SetSpeed(MOVE_FLIGHT, 2.0f); + i_pl->SetSpeed(MOVE_FLIGHT, 2.0f); } } } @@ -271,11 +271,11 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI void RemoveGravityLapse() { - Map *map = m_creature->GetMap(); + Map *map = m_creature->GetMap(); Map::PlayerList const &PlayerList = map->GetPlayers(); - Map::PlayerList::const_iterator i; - for (i = PlayerList.begin(); i != PlayerList.end(); ++i) - { + Map::PlayerList::const_iterator i; + for (i = PlayerList.begin(); i != PlayerList.end(); ++i) + { if(Player* i_pl = i->getSource()) { i_pl->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY); @@ -300,14 +300,14 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI { // *Heroic mode only: if(Heroic) - { + { if(PyroblastTimer < diff) - { - DoCast(m_creature, SPELL_SHOCK_BARRIER, true); - DoCast(m_creature->getVictim(), SPELL_PYROBLAST); - PyroblastTimer = 60000; - }else PyroblastTimer -= diff; - } + { + DoCast(m_creature, SPELL_SHOCK_BARRIER, true); + DoCast(m_creature->getVictim(), SPELL_PYROBLAST); + PyroblastTimer = 60000; + }else PyroblastTimer -= diff; + } if(FireballTimer < diff) { @@ -325,19 +325,19 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI { Phoenix->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); SetThreatList(Phoenix); - Unit *target = SelectUnit(SELECT_TARGET_RANDOM,1); - if(target) - { - Phoenix->AddThreat(target,1000); - Phoenix->Attack(target,true); - Phoenix->GetMotionMaster()->MoveChase(target); - } - else - { - Phoenix->AddThreat(m_creature->getVictim(),1000); - Phoenix->Attack(m_creature->getVictim(),true); - Phoenix->GetMotionMaster()->MoveChase(m_creature->getVictim()); - } + Unit *target = SelectUnit(SELECT_TARGET_RANDOM,1); + if(target) + { + Phoenix->AddThreat(target,1000); + Phoenix->Attack(target,true); + Phoenix->GetMotionMaster()->MoveChase(target); + } + else + { + Phoenix->AddThreat(m_creature->getVictim(),1000); + Phoenix->Attack(m_creature->getVictim(),true); + Phoenix->GetMotionMaster()->MoveChase(m_creature->getVictim()); + } } DoScriptText(SAY_PHOENIX, m_creature); @@ -347,13 +347,13 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI if(FlameStrikeTimer < diff) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) { - m_creature->InterruptNonMeleeSpells(false); + m_creature->InterruptNonMeleeSpells(false); DoCast(target, SPELL_FLAMESTRIKE3, true); - DoScriptText(SAY_FLAMESTRIKE, m_creature); + DoScriptText(SAY_FLAMESTRIKE, m_creature); - FlameStrikeTimer = 20000 + rand()%5000; + FlameStrikeTimer = 20000 + rand()%5000; } }else FlameStrikeTimer -= diff; @@ -374,7 +374,7 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI case 1: { - m_creature->StopMoving(); + m_creature->StopMoving(); if(GravityLapseTimer < diff) { switch(GravityLapsePhase) @@ -382,7 +382,7 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI case 0: if(FirstGravityLapse) // Different yells at 50%, and at every following Gravity Lapse { - DoScriptText(SAY_GRAVITY_LAPSE, m_creature); + DoScriptText(SAY_GRAVITY_LAPSE, m_creature); FirstGravityLapse = false; if(pInstance) { @@ -393,9 +393,9 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI } }else { - DoScriptText(SAY_RECAST_GRAVITY, m_creature); + DoScriptText(SAY_RECAST_GRAVITY, m_creature); } - m_creature->StopMoving(); + m_creature->StopMoving(); DoCast(m_creature, SPELL_GRAVITY_LAPSE_INITIAL); GravityLapseTimer = 2000 + diff;// Don't interrupt the visual spell GravityLapsePhase = 1; @@ -419,28 +419,28 @@ struct TRINITY_DLL_DECL boss_felblood_kaelthasAI : public ScriptedAI GravityLapsePhase = 4; for(uint8 i = 0; i < 3; ++i) { - Creature* Orb = m_creature->SummonCreature(CREATURE_ARCANE_SPHERE,KaelLocations[3+i][0],KaelLocations[3+i][1],LOCATION_Z,0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,30000); - if(Orb) - { - SetThreatList(Orb); - Unit *target = SelectUnit(SELECT_TARGET_BOTTOMAGGRO,i); - if(target) - { - Orb->AddThreat(target,1000); - Orb->Attack(target,true); - Orb->GetMotionMaster()->MoveChase(target); - } - else - { - Unit *ntarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if(ntarget) - { - Orb->AddThreat(ntarget,1000); - Orb->Attack(ntarget,true); - Orb->GetMotionMaster()->MoveChase(ntarget); - } - } - } + Creature* Orb = m_creature->SummonCreature(CREATURE_ARCANE_SPHERE,KaelLocations[3+i][0],KaelLocations[3+i][1],LOCATION_Z,0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,30000); + if(Orb) + { + SetThreatList(Orb); + Unit *target = SelectUnit(SELECT_TARGET_BOTTOMAGGRO,i); + if(target) + { + Orb->AddThreat(target,1000); + Orb->Attack(target,true); + Orb->GetMotionMaster()->MoveChase(target); + } + else + { + Unit *ntarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if(ntarget) + { + Orb->AddThreat(ntarget,1000); + Orb->Attack(ntarget,true); + Orb->GetMotionMaster()->MoveChase(ntarget); + } + } + } } DoCast(m_creature, SPELL_GRAVITY_LAPSE_CHANNEL); break; @@ -497,73 +497,73 @@ struct TRINITY_DLL_DECL mob_felkael_flamestrikeAI : public ScriptedAI struct TRINITY_DLL_DECL mob_felkael_phoenixAI : public ScriptedAI { mob_felkael_phoenixAI(Creature *c) : ScriptedAI(c) - { + { pInstance = ((ScriptedInstance*)c->GetInstanceData()); Reset(); } uint32 BurnTimer; - uint32 CheckTimer; - uint8 phase; - ScriptedInstance* pInstance; - bool end; + uint32 CheckTimer; + uint8 phase; + ScriptedInstance* pInstance; + bool end; void Reset() { - m_creature->SetSpeed(MOVE_RUN, 0.5f); - m_creature->SetSpeed(MOVE_WALK, 0.5f); + m_creature->SetSpeed(MOVE_RUN, 0.5f); + m_creature->SetSpeed(MOVE_WALK, 0.5f); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); BurnTimer = 2000; - CheckTimer = 1000; - phase = 0; - end = false; + CheckTimer = 1000; + phase = 0; + end = false; } void Aggro(Unit* who) {} void JustDied(Unit* slayer) { - if (end) - return; + if (end) + return; DoSpawnCreature(CREATURE_PHOENIX_EGG, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 45000); } void UpdateAI(const uint32 diff) { - if(CheckTimer < diff) + if(CheckTimer < diff) { if (pInstance) - { - Creature *boss = ((Creature*)Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_KAEL))); - if (boss) - { - phase = ((boss_felblood_kaelthasAI*)boss->AI())->Phase; - if(boss->isDead() || !boss->isInCombat()) - { - end = true; - m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_FIRE, NULL, false);//temphack, hellfire is not damaging self - } - } - } + { + Creature *boss = ((Creature*)Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_KAEL))); + if (boss) + { + phase = ((boss_felblood_kaelthasAI*)boss->AI())->Phase; + if(boss->isDead() || !boss->isInCombat()) + { + end = true; + m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_FIRE, NULL, false);//temphack, hellfire is not damaging self + } + } + } CheckTimer = 1000; }else CheckTimer -= diff; if (!UpdateVictim()) return; - if (BurnTimer < diff) - { - if(!phase) - { - DoCast(m_creature, SPELL_PHOENIX_BURN); - m_creature->DealDamage(m_creature, 1500, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_FIRE, NULL, false);//temphack, hellfire is not damaging self - } - else - { - m_creature->StopMoving(); - DoCast(m_creature->getVictim(), SPELL_PHOENIX_FIREBALL); - } - BurnTimer = 2000; - }else BurnTimer -= diff; + if (BurnTimer < diff) + { + if(!phase) + { + DoCast(m_creature, SPELL_PHOENIX_BURN); + m_creature->DealDamage(m_creature, 1500, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_FIRE, NULL, false);//temphack, hellfire is not damaging self + } + else + { + m_creature->StopMoving(); + DoCast(m_creature->getVictim(), SPELL_PHOENIX_FIREBALL); + } + BurnTimer = 2000; + }else BurnTimer -= diff; //DoMeleeAttackIfReady(); } @@ -572,13 +572,13 @@ struct TRINITY_DLL_DECL mob_felkael_phoenixAI : public ScriptedAI struct TRINITY_DLL_DECL mob_felkael_phoenix_eggAI : public Scripted_NoMovementAI { mob_felkael_phoenix_eggAI(Creature *c) : Scripted_NoMovementAI(c) - { - pInstance = ((ScriptedInstance*)c->GetInstanceData()); - Reset(); - } + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + Reset(); + } uint32 HatchTimer; - ScriptedInstance* pInstance; + ScriptedInstance* pInstance; void Reset() { HatchTimer = 15000; } void Aggro(Unit* who) {} @@ -588,43 +588,43 @@ struct TRINITY_DLL_DECL mob_felkael_phoenix_eggAI : public Scripted_NoMovementAI if(HatchTimer < diff) { - Creature *bird = DoSpawnCreature(CREATURE_PHOENIX, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 60000); - if (bird) - { - Unit *boss = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_KAEL)); - if (boss && boss->getVictim()) - { - bird->AddThreat(boss->getVictim(),100); - bird->Attack(boss->getVictim(),true); - bird->GetMotionMaster()->MoveChase(boss->getVictim()); - } - } - m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - }else HatchTimer -= diff; + Creature *bird = DoSpawnCreature(CREATURE_PHOENIX, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 60000); + if (bird) + { + Unit *boss = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_KAEL)); + if (boss && boss->getVictim()) + { + bird->AddThreat(boss->getVictim(),100); + bird->Attack(boss->getVictim(),true); + bird->GetMotionMaster()->MoveChase(boss->getVictim()); + } + } + m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + }else HatchTimer -= diff; } }; struct TRINITY_DLL_DECL mob_arcane_sphereAI : public ScriptedAI { mob_arcane_sphereAI(Creature *c) : ScriptedAI(c) - { + { pInstance = ((ScriptedInstance*)c->GetInstanceData()); Reset(); } uint32 DespawnTimer; uint32 ChangeTargetTimer; - uint32 CheckTimer; + uint32 CheckTimer; - ScriptedInstance* pInstance; + ScriptedInstance* pInstance; void Reset() { - m_creature->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); + m_creature->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); DespawnTimer = 30000; ChangeTargetTimer = 5000; - CheckTimer = 1000; - m_creature->SetSpeed(MOVE_RUN, 0.5f); - m_creature->SetSpeed(MOVE_WALK, 0.5f); + CheckTimer = 1000; + m_creature->SetSpeed(MOVE_RUN, 0.5f); + m_creature->SetSpeed(MOVE_WALK, 0.5f); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->setFaction(14); DoCast(m_creature, SPELL_ARCANE_SPHERE_PASSIVE, true); @@ -636,9 +636,9 @@ struct TRINITY_DLL_DECL mob_arcane_sphereAI : public ScriptedAI { if(!target) return; - m_creature->AddThreat(target,100000); - m_creature->GetMotionMaster()->MoveChase(target); - m_creature->Attack(target,true); + m_creature->AddThreat(target,100000); + m_creature->GetMotionMaster()->MoveChase(target); + m_creature->Attack(target,true); } void UpdateAI(const uint32 diff) @@ -648,28 +648,28 @@ struct TRINITY_DLL_DECL mob_arcane_sphereAI : public ScriptedAI else DespawnTimer -= diff; if(!UpdateVictim()) - ChangeTargetTimer = 0; + ChangeTargetTimer = 0; if(ChangeTargetTimer < diff) { - DoResetThreat(); + DoResetThreat(); Unit *ntarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (ntarget) - StalkTarget(ntarget); + if (ntarget) + StalkTarget(ntarget); ChangeTargetTimer = 10000; }else ChangeTargetTimer -= diff; - if(CheckTimer < diff) + if(CheckTimer < diff) { if (pInstance) - { - Creature *boss = (Creature*)Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_KAEL)); - if(boss) - { - if(!((boss_felblood_kaelthasAI*)boss->AI())->Phase || boss->isDead()) - DespawnTimer = 0; - }else DespawnTimer = 0; - } + { + Creature *boss = (Creature*)Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_KAEL)); + if(boss) + { + if(!((boss_felblood_kaelthasAI*)boss->AI())->Phase || boss->isDead()) + DespawnTimer = 0; + }else DespawnTimer = 0; + } CheckTimer = 1000; }else CheckTimer -= diff; } @@ -678,30 +678,30 @@ struct TRINITY_DLL_DECL mob_arcane_sphereAI : public ScriptedAI bool GOHello_go_kael_orb(Player *player, GameObject* _GO) { ScriptedInstance* pInst = (ScriptedInstance*)_GO->GetInstanceData(); - if (pInst && player) - { - Unit *kael = Unit::GetUnit((*_GO),pInst->GetData64(DATA_KAEL)); - if (kael && kael->isDead()) - player->TeleportTo(530, 12888, -6876, 9, 0.3); - } + if (pInst && player) + { + Unit *kael = Unit::GetUnit((*_GO),pInst->GetData64(DATA_KAEL)); + if (kael && kael->isDead()) + player->TeleportTo(530, 12888, -6876, 9, 0.3); + } return true; } bool GOHello_go_movie_orb(Player *player, GameObject* _GO) { - if (player) - { - WorldPacket data(SMSG_TRIGGER_CINEMATIC, 4); + if (player) + { + WorldPacket data(SMSG_TRIGGER_CINEMATIC, 4); data << (uint32)164; player->GetSession()->SendPacket(&data); - if (player->GetQuestStatus(11490) == QUEST_STATUS_INCOMPLETE) - { - Unit *qUnit = player->SummonCreature(25042,player->GetPositionX(),player->GetPositionY(),player->GetPositionZ()-10,0,TEMPSUMMON_CORPSE_DESPAWN,0); - if(qUnit) - player->DealDamage(qUnit, qUnit->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } - } + if (player->GetQuestStatus(11490) == QUEST_STATUS_INCOMPLETE) + { + Unit *qUnit = player->SummonCreature(25042,player->GetPositionX(),player->GetPositionY(),player->GetPositionZ()-10,0,TEMPSUMMON_CORPSE_DESPAWN,0); + if(qUnit) + player->DealDamage(qUnit, qUnit->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } + } return true; } @@ -759,12 +759,12 @@ void AddSC_boss_felblood_kaelthas() newscript->GetAI = &GetAI_mob_felkael_flamestrike; newscript->RegisterSelf(); - newscript = new Script; + newscript = new Script; newscript->Name="go_kael_orb"; newscript->pGOHello = &GOHello_go_kael_orb; newscript->RegisterSelf(); - newscript = new Script; + newscript = new Script; newscript->Name="go_movie_orb"; newscript->pGOHello = &GOHello_go_movie_orb; newscript->RegisterSelf(); diff --git a/src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp b/src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp index 5eae41aa45f..15af5cce3b8 100644 --- a/src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp +++ b/src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp @@ -26,7 +26,7 @@ EndScriptData */ struct Speech { - int32 id; + int32 id; }; static Speech LackeyDeath[]= @@ -39,10 +39,10 @@ static Speech LackeyDeath[]= static Speech PlayerDeath[]= { - {-1585017}, - {-1585018}, - {-1585019}, - {-1585020}, + {-1585017}, + {-1585018}, + {-1585019}, + {-1585020}, {-1585021}, }; @@ -98,7 +98,7 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI { pInstance = ((ScriptedInstance*)c->GetInstanceData()); Adds.clear(); - //SummonAdds(); + //SummonAdds(); Reset(); Heroic = c->GetMap()->IsHeroic(); } @@ -122,7 +122,7 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI void Reset() { - m_creature->SetCorpseDelay(60*60*1000); + m_creature->SetCorpseDelay(60*60*1000); LackeysKilled = 0; PlayersKilled = 0; @@ -136,18 +136,18 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI CheckAdds(); - if(pInstance) - { - pInstance->SetData(DATA_DELRISSA_DEATH_COUNT, 0); - if (m_creature->isDead()) - pInstance->SetData(DATA_DELRISSA_EVENT, DONE); - else pInstance->SetData(DATA_DELRISSA_EVENT, NOT_STARTED); - }else error_log(ERROR_INST_DATA); + if(pInstance) + { + pInstance->SetData(DATA_DELRISSA_DEATH_COUNT, 0); + if (m_creature->isDead()) + pInstance->SetData(DATA_DELRISSA_EVENT, DONE); + else pInstance->SetData(DATA_DELRISSA_EVENT, NOT_STARTED); + }else error_log(ERROR_INST_DATA); } void Aggro(Unit* who) { - DoScriptText(SAY_AGGRO, m_creature); + DoScriptText(SAY_AGGRO, m_creature); for(uint8 i = 0; i < Adds.size(); ++i) if(Unit* pAdd = Unit::GetUnit(*m_creature, Adds[i]->guid)) @@ -156,8 +156,8 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI void SummonAdds() { - /*if (m_creature->isDead()) - return;*/ + /*if (m_creature->isDead()) + return;*/ std::vector AddList; for(uint8 i = 0; i < 8; ++i) AddList.push_back(AddEntry[i]); @@ -178,35 +178,35 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI void CheckAdds() { - //if (m_creature->isDead()) - // return; + //if (m_creature->isDead()) + // return; if(Adds.empty()) - { - SummonAdds(); + { + SummonAdds(); return; - } + } for(uint8 i = 0; i < Adds.size(); ++i) { Creature* pAdd = ((Creature*)Unit::GetUnit(*m_creature, Adds[i]->guid)); if(pAdd && pAdd->isAlive()) { - pAdd->AI()->EnterEvadeMode(); - pAdd->GetMotionMaster()->MovePoint(0,LackeyLocations[i][0], LackeyLocations[i][1], POS_Z); + pAdd->AI()->EnterEvadeMode(); + pAdd->GetMotionMaster()->MovePoint(0,LackeyLocations[i][0], LackeyLocations[i][1], POS_Z); } - if(!pAdd || (pAdd && pAdd->isDead())) + if(!pAdd || (pAdd && pAdd->isDead())) { - if(pAdd) - pAdd->RemoveCorpse();//looks stupid if mob is alive but has a dead corpse in front of him :) - Creature* pAdd = m_creature->SummonCreature(Adds[i]->entry, LackeyLocations[i][0], LackeyLocations[i][1], POS_Z, ORIENT, TEMPSUMMON_DEAD_DESPAWN, 0); - if(pAdd) - Adds[i]->guid = pAdd->GetGUID(); - } + if(pAdd) + pAdd->RemoveCorpse();//looks stupid if mob is alive but has a dead corpse in front of him :) + Creature* pAdd = m_creature->SummonCreature(Adds[i]->entry, LackeyLocations[i][0], LackeyLocations[i][1], POS_Z, ORIENT, TEMPSUMMON_DEAD_DESPAWN, 0); + if(pAdd) + Adds[i]->guid = pAdd->GetGUID(); + } } } void KilledUnit(Unit* victim) { - if(victim->GetTypeId() != TYPEID_PLAYER || m_creature->isDead()) + if(victim->GetTypeId() != TYPEID_PLAYER || m_creature->isDead()) return; DoScriptText(PlayerDeath[PlayersKilled].id, m_creature); @@ -216,18 +216,18 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI void KilledLackey() { - if(m_creature->isDead())//no sense to talk if dead.. - return; + if(m_creature->isDead())//no sense to talk if dead.. + return; DoScriptText(LackeyDeath[LackeysKilled].id, m_creature); if( LackeysKilled < 3 ) ++LackeysKilled; - CheckLootable(); + CheckLootable(); } void JustDied(Unit* killer) { - DoScriptText(SAY_DEATH, m_creature); + DoScriptText(SAY_DEATH, m_creature); CheckLootable(); @@ -370,12 +370,12 @@ struct TRINITY_DLL_DECL boss_priestess_guestAI : public ScriptedAI void Reset() { UsedPotion = false; - if(pInstance) - { - Creature *boss = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_DELRISSA))); - if (boss && boss->isDead()) - boss->Respawn(); - } + if(pInstance) + { + Creature *boss = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_DELRISSA))); + if (boss && boss->isDead()) + boss->Respawn(); + } ResetThreatTimer = 5000 + rand()%15000; // These guys like to switch targets often, and are not meant to be tanked. } @@ -646,8 +646,8 @@ struct TRINITY_DLL_DECL boss_ellris_duskhallowAI : public boss_priestess_guestAI Fear_Timer = 10000; }else Fear_Timer -= diff; - if (m_creature->GetDistance(m_creature->getVictim()) <= 10) - m_creature->StopMoving(); + if (m_creature->GetDistance(m_creature->getVictim()) <= 10) + m_creature->StopMoving(); //DoMeleeAttackIfReady();//should not melee, she's a warlock } }; @@ -755,7 +755,7 @@ struct TRINITY_DLL_DECL boss_yazzaiAI : public boss_priestess_guestAI if(Polymorph_Timer < diff) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) { DoCast(target, SPELL_POLYMORPH); DoModifyThreatPercent(target,-100); @@ -802,27 +802,27 @@ struct TRINITY_DLL_DECL boss_yazzaiAI : public boss_priestess_guestAI if(Unit* target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid())) //if in melee range if (target->IsWithinDistInMap(m_creature, 5)) - { - InMeleeRange = true; - break; - } + { + InMeleeRange = true; + break; + } } //if anybody is in melee range than escape by blink if(InMeleeRange) - { - //DoCast(m_creature, SPELL_BLINK); //blink does not work on npcs - float x,y,z; - m_creature->GetPosition(x,y,z); - x = rand()%2 ? x+10+rand()%10 : x-10-rand()%10; - y = rand()%2 ? y+10+rand()%10 : y-10-rand()%10; - m_creature->Relocate(x,y,z); - m_creature->SendMonsterMove(x, y, m_creature->GetPositionZ(), 0,0,0); - } + { + //DoCast(m_creature, SPELL_BLINK); //blink does not work on npcs + float x,y,z; + m_creature->GetPosition(x,y,z); + x = rand()%2 ? x+10+rand()%10 : x-10-rand()%10; + y = rand()%2 ? y+10+rand()%10 : y-10-rand()%10; + m_creature->Relocate(x,y,z); + m_creature->SendMonsterMove(x, y, m_creature->GetPositionZ(), 0,0,0); + } Blink_Timer = 8000; }else Blink_Timer -= diff; - if (m_creature->GetDistance(m_creature->getVictim()) <= 10) - m_creature->StopMoving(); + if (m_creature->GetDistance(m_creature->getVictim()) <= 10) + m_creature->StopMoving(); //DoMeleeAttackIfReady(); //mage type, no melee needed } @@ -968,8 +968,8 @@ struct TRINITY_DLL_DECL boss_garaxxasAI : public boss_priestess_guestAI uint32 Multi_Shot_Timer; uint32 Wing_Clip_Timer; uint32 Freezing_Trap_Timer; - uint32 StopMoving; - bool Stopped; + uint32 StopMoving; + bool Stopped; void Reset() { @@ -982,8 +982,8 @@ struct TRINITY_DLL_DECL boss_garaxxasAI : public boss_priestess_guestAI Multi_Shot_Timer = 10000; Wing_Clip_Timer = 4000; Freezing_Trap_Timer = 15000; - StopMoving = 2000; - Stopped = false; + StopMoving = 2000; + Stopped = false; boss_priestess_guestAI::Reset(); } @@ -1054,16 +1054,16 @@ struct TRINITY_DLL_DECL boss_garaxxasAI : public boss_priestess_guestAI Shoot_Timer = 2500; }else Shoot_Timer -= diff; } - if(StopMoving < diff) + if(StopMoving < diff) { - if(Stopped) - Stopped = false; - else - Stopped = true; + if(Stopped) + Stopped = false; + else + Stopped = true; StopMoving = 2000+rand()%5000; }else StopMoving -= diff; - if (Stopped) - m_creature->StopMoving(); + if (Stopped) + m_creature->StopMoving(); } }; @@ -1207,11 +1207,11 @@ struct TRINITY_DLL_DECL boss_zelfanAI : public boss_priestess_guestAI if(Goblin_Dragon_Gun_Timer < diff) { - if (m_creature->GetDistance(m_creature->getVictim()) <= 5) - { - Goblin_Dragon_Gun_Timer = 10000; - DoCast(m_creature->getVictim(), SPELL_GOBLIN_DRAGON_GUN); - }else Goblin_Dragon_Gun_Timer = 2000; + if (m_creature->GetDistance(m_creature->getVictim()) <= 5) + { + Goblin_Dragon_Gun_Timer = 10000; + DoCast(m_creature->getVictim(), SPELL_GOBLIN_DRAGON_GUN); + }else Goblin_Dragon_Gun_Timer = 2000; }else Goblin_Dragon_Gun_Timer -= diff; if(Rocket_Launch_Timer < diff) diff --git a/src/bindings/scripts/scripts/zone/magisters_terrace/boss_selin_fireheart.cpp b/src/bindings/scripts/scripts/zone/magisters_terrace/boss_selin_fireheart.cpp index df5653eba1f..219a773039b 100644 --- a/src/bindings/scripts/scripts/zone/magisters_terrace/boss_selin_fireheart.cpp +++ b/src/bindings/scripts/scripts/zone/magisters_terrace/boss_selin_fireheart.cpp @@ -68,7 +68,7 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI } } Reset(); - Heroic = c->GetMap()->IsHeroic(); + Heroic = c->GetMap()->IsHeroic(); } ScriptedInstance* pInstance; @@ -109,9 +109,9 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI Door->SetGoState(0); // Open the big encounter door. Close it in Aggro and open it only in JustDied(and here) // Small door opened after event are expected to be closed by default // Set Inst data for encounter - if (m_creature->isDead()) - pInstance->SetData(DATA_SELIN_EVENT, DONE); - else pInstance->SetData(DATA_SELIN_EVENT, NOT_STARTED); + if (m_creature->isDead()) + pInstance->SetData(DATA_SELIN_EVENT, DONE); + else pInstance->SetData(DATA_SELIN_EVENT, NOT_STARTED); }else error_log(ERROR_INST_DATA); DrainLifeTimer = 3000 + rand()%4000; @@ -154,7 +154,7 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI if( CrystalChosen ) { DoScriptText(SAY_ENERGY, m_creature); - DoScriptText(EMOTE_CRYSTAL, m_creature); + DoScriptText(EMOTE_CRYSTAL, m_creature); CrystalChosen->CastSpell(CrystalChosen, SPELL_FEL_CRYSTAL_COSMETIC, true); @@ -184,7 +184,7 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI void Aggro(Unit* who) { - m_creature->SetPower(POWER_MANA, 0); + m_creature->SetPower(POWER_MANA, 0); DoScriptText(SAY_AGGRO, m_creature); if( pInstance ) @@ -199,8 +199,8 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI { switch(rand()%2) { - case 0: DoScriptText(SAY_KILL_1, m_creature); break; - case 1: DoScriptText(SAY_KILL_2, m_creature); break; + case 0: DoScriptText(SAY_KILL_1, m_creature); break; + case 1: DoScriptText(SAY_KILL_2, m_creature); break; } } @@ -228,7 +228,7 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI void JustDied(Unit* killer) { - DoScriptText(SAY_DEATH, m_creature); + DoScriptText(SAY_DEATH, m_creature); if(!pInstance) { @@ -300,33 +300,33 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI { if( IsDraining ) { - if (CheckTimer < diff) - { - Unit* CrystalChosen = Unit::GetUnit(*m_creature, CrystalGUID); - if(CrystalChosen) - { - if(CrystalChosen->GetUInt32Value(UNIT_CHANNEL_SPELL) == SPELL_MANA_RAGE) - { - m_creature->StopMoving(); - }else{ - IsDraining = false; - DrainingCrystal = false; + if (CheckTimer < diff) + { + Unit* CrystalChosen = Unit::GetUnit(*m_creature, CrystalGUID); + if(CrystalChosen) + { + if(CrystalChosen->GetUInt32Value(UNIT_CHANNEL_SPELL) == SPELL_MANA_RAGE) + { + m_creature->StopMoving(); + }else{ + IsDraining = false; + DrainingCrystal = false; - DoScriptText(SAY_EMPOWERED, m_creature); + DoScriptText(SAY_EMPOWERED, m_creature); - Unit* CrystalChosen = Unit::GetUnit(*m_creature, CrystalGUID); - if( CrystalChosen && CrystalChosen->isAlive() ) - // Use Deal Damage to kill it, not setDeathState. - CrystalChosen->DealDamage(CrystalChosen, CrystalChosen->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - CrystalGUID = 0; + Unit* CrystalChosen = Unit::GetUnit(*m_creature, CrystalGUID); + if( CrystalChosen && CrystalChosen->isAlive() ) + // Use Deal Damage to kill it, not setDeathState. + CrystalChosen->DealDamage(CrystalChosen, CrystalChosen->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + CrystalGUID = 0; - m_creature->GetMotionMaster()->Clear(); - m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); - } - } - CheckTimer = 1000; - }else CheckTimer -= diff; - } + m_creature->GetMotionMaster()->Clear(); + m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); + } + } + CheckTimer = 1000; + }else CheckTimer -= diff; + } } DoMeleeAttackIfReady(); // No need to check if we are draining crystal here, as the spell has a stun. } @@ -349,7 +349,7 @@ struct TRINITY_DLL_DECL mob_fel_crystalAI : public ScriptedAI void JustDied(Unit* killer) { - m_creature->RemoveAurasDueToSpell(SPELL_MANA_RAGE); + m_creature->RemoveAurasDueToSpell(SPELL_MANA_RAGE); if(ScriptedInstance* pInstance = ((ScriptedInstance*)m_creature->GetInstanceData())) { Creature* Selin = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_SELIN))); @@ -360,7 +360,7 @@ struct TRINITY_DLL_DECL mob_fel_crystalAI : public ScriptedAI // Set this to false if we are the creature that Selin is draining so his AI flows properly ((boss_selin_fireheartAI*)Selin->AI())->DrainingCrystal = false; ((boss_selin_fireheartAI*)Selin->AI())->IsDraining = false; - Selin->RemoveAurasDueToSpell(SPELL_MANA_RAGE); + Selin->RemoveAurasDueToSpell(SPELL_MANA_RAGE); if(Selin->getVictim()) { Selin->AI()->AttackStart(Selin->getVictim()); diff --git a/src/bindings/scripts/scripts/zone/magisters_terrace/boss_vexallus.cpp b/src/bindings/scripts/scripts/zone/magisters_terrace/boss_vexallus.cpp index 1c51e98a1d4..e3ed21fcbea 100644 --- a/src/bindings/scripts/scripts/zone/magisters_terrace/boss_vexallus.cpp +++ b/src/bindings/scripts/scripts/zone/magisters_terrace/boss_vexallus.cpp @@ -41,7 +41,7 @@ EndScriptData */ #define SPELL_SUMMON_PURE_ENERGY 44322 //not-working, this script summon this creatures without this spell #define SPELL_OVERLOAD 44353 #define SPELL_ARCANE_SHOCK 44319 -#define ASTRAL_FLARE_VISUAL 30237 +#define ASTRAL_FLARE_VISUAL 30237 //Creatures #define CREATURE_PURE_ENERGY 24745 @@ -76,16 +76,16 @@ struct TRINITY_DLL_DECL boss_vexallusAI : public ScriptedAI Enraged = false; if(pInstance) - { - if (m_creature->isDead()) - pInstance->SetData(DATA_VEXALLUS_EVENT, DONE); - else pInstance->SetData(DATA_VEXALLUS_EVENT, NOT_STARTED); - } + { + if (m_creature->isDead()) + pInstance->SetData(DATA_VEXALLUS_EVENT, DONE); + else pInstance->SetData(DATA_VEXALLUS_EVENT, NOT_STARTED); + } } void KilledUnit(Unit *victim) { - DoScriptText(SAY_KILL, m_creature); + DoScriptText(SAY_KILL, m_creature); } void JustDied(Unit *victim) @@ -124,8 +124,8 @@ struct TRINITY_DLL_DECL boss_vexallusAI : public ScriptedAI //used for check, when Vexallus cast adds 85%, 70%, 55%, 40%, 25% if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < (100-(SpawnAddInterval*(AlreadySpawnedAmount+1)))) { - DoScriptText(SAY_ENERGY, m_creature); - DoScriptText(EMOTE_DISCHARGE_ENERGY, m_creature); + DoScriptText(SAY_ENERGY, m_creature); + DoScriptText(EMOTE_DISCHARGE_ENERGY, m_creature); Creature* PureEnergyCreature = NULL; PureEnergyCreature = DoSpawnCreature(CREATURE_PURE_ENERGY, 10, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); Unit* target = NULL; @@ -146,7 +146,7 @@ struct TRINITY_DLL_DECL boss_vexallusAI : public ScriptedAI if(ChainLightningTimer < diff) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_CHAIN_LIGHTNING); ChainLightningTimer = 10000; }else ChainLightningTimer -= diff; @@ -162,7 +162,7 @@ struct TRINITY_DLL_DECL boss_vexallusAI : public ScriptedAI { if(OverloadTimer < diff) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_OVERLOAD); OverloadTimer = 2200; }else OverloadTimer -= diff; @@ -181,14 +181,14 @@ struct TRINITY_DLL_DECL mob_pure_energyAI : public ScriptedAI mob_pure_energyAI(Creature *c) : ScriptedAI(c) {Reset();} uint32 EnergyBoltTimer; - uint32 VisualTimer; + uint32 VisualTimer; void Reset() { EnergyBoltTimer = 1700; - VisualTimer = 1000; - m_creature->SetSpeed(MOVE_RUN, 0.5f); - m_creature->SetSpeed(MOVE_WALK, 0.5f); + VisualTimer = 1000; + m_creature->SetSpeed(MOVE_RUN, 0.5f); + m_creature->SetSpeed(MOVE_WALK, 0.5f); } void JustDied(Unit* slayer) @@ -208,7 +208,7 @@ struct TRINITY_DLL_DECL mob_pure_energyAI : public ScriptedAI DoCast(m_creature->getVictim(), SPELL_ENERGY_BOLT); EnergyBoltTimer = 1700; }else EnergyBoltTimer -= diff; - if(VisualTimer < diff) + if(VisualTimer < diff) { DoCast(m_creature->getVictim(), ASTRAL_FLARE_VISUAL, true); VisualTimer = 1000; diff --git a/src/bindings/scripts/scripts/zone/magisters_terrace/def_magisters_terrace.h b/src/bindings/scripts/scripts/zone/magisters_terrace/def_magisters_terrace.h index 1e31421247f..7d52cbb7404 100644 --- a/src/bindings/scripts/scripts/zone/magisters_terrace/def_magisters_terrace.h +++ b/src/bindings/scripts/scripts/zone/magisters_terrace/def_magisters_terrace.h @@ -25,7 +25,7 @@ #define DATA_DELRISSA_DEATH_COUNT 15 -#define DATA_KAEL 16 +#define DATA_KAEL 16 #define ERROR_INST_DATA "SD2 Error: Instance Data not set properly for Magister's Terrace instance (map 585). Encounters will be buggy." #endif diff --git a/src/bindings/scripts/scripts/zone/magisters_terrace/instance_magisters_terrace.cpp b/src/bindings/scripts/scripts/zone/magisters_terrace/instance_magisters_terrace.cpp index fe07b7d7f2f..018c86b065d 100644 --- a/src/bindings/scripts/scripts/zone/magisters_terrace/instance_magisters_terrace.cpp +++ b/src/bindings/scripts/scripts/zone/magisters_terrace/instance_magisters_terrace.cpp @@ -37,14 +37,14 @@ struct TRINITY_DLL_DECL instance_magisters_terrace : public ScriptedInstance { instance_magisters_terrace(Map* map) : ScriptedInstance(map) {Initialize();} - uint32 DoorState[3];//0seline, 1vexallus, 2derlissa + uint32 DoorState[3];//0seline, 1vexallus, 2derlissa uint32 Encounters[NUMBER_OF_ENCOUNTERS]; uint32 DelrissaDeathCount; std::list FelCrystals; std::list::iterator CrystalItr; - uint64 KaelGUID; + uint64 KaelGUID; uint64 SelinGUID; uint64 DelrissaGUID; uint64 VexallusDoorGUID; @@ -57,8 +57,8 @@ struct TRINITY_DLL_DECL instance_magisters_terrace : public ScriptedInstance void Initialize() { - for(uint8 i = 0; i < 3; i++) - DoorState[i] = 1;//1 closed, 0 opened + for(uint8 i = 0; i < 3; i++) + DoorState[i] = 1;//1 closed, 0 opened for(uint8 i = 0; i < NUMBER_OF_ENCOUNTERS; i++) Encounters[i] = NOT_STARTED; @@ -67,7 +67,7 @@ struct TRINITY_DLL_DECL instance_magisters_terrace : public ScriptedInstance DelrissaDeathCount = 0; - KaelGUID = 0; + KaelGUID = 0; SelinGUID = 0; DelrissaGUID = 0; VexallusDoorGUID = 0; @@ -107,29 +107,29 @@ struct TRINITY_DLL_DECL instance_magisters_terrace : public ScriptedInstance switch(identifier) { case DATA_SELIN_EVENT: - Encounters[0] = data; - if(data==DONE) - { - DoorState[0] = 0; - SaveToDB(); - } - break; + Encounters[0] = data; + if(data==DONE) + { + DoorState[0] = 0; + SaveToDB(); + } + break; case DATA_VEXALLUS_EVENT: - Encounters[1] = data; - if(data==DONE) - { - DoorState[1] = 0; - SaveToDB(); - } - break; + Encounters[1] = data; + if(data==DONE) + { + DoorState[1] = 0; + SaveToDB(); + } + break; case DATA_DELRISSA_EVENT: - Encounters[2] = data; - if(data==DONE) - { - DoorState[2] = 0; - SaveToDB(); - } - break; + Encounters[2] = data; + if(data==DONE) + { + DoorState[2] = 0; + SaveToDB(); + } + break; case DATA_KAELTHAS_EVENT: Encounters[3] = data; break; case DATA_DELRISSA_DEATH_COUNT: @@ -138,7 +138,7 @@ struct TRINITY_DLL_DECL instance_magisters_terrace : public ScriptedInstance } } - const char* Save() + const char* Save() { std::ostringstream ss; ss << "S " << DoorState[0] << " " << DoorState[1] << " " << DoorState[2]; @@ -169,7 +169,7 @@ struct TRINITY_DLL_DECL instance_magisters_terrace : public ScriptedInstance case 24723: SelinGUID = creature->GetGUID(); break; case 24560: DelrissaGUID = creature->GetGUID(); break; case 24722: FelCrystals.push_back(creature->GetGUID()); break; - case 24664: KaelGUID = creature->GetGUID(); break; + case 24664: KaelGUID = creature->GetGUID(); break; } } @@ -178,20 +178,20 @@ struct TRINITY_DLL_DECL instance_magisters_terrace : public ScriptedInstance switch(go->GetEntry()) { case 187896: - VexallusDoorGUID = go->GetGUID(); - go->SetGoState(DoorState[1]); - break; + VexallusDoorGUID = go->GetGUID(); + go->SetGoState(DoorState[1]); + break; //SunwellRaid Gate 02 case 187979: - SelinDoorGUID = go->GetGUID(); - go->SetGoState(DoorState[0]); - break; + SelinDoorGUID = go->GetGUID(); + go->SetGoState(DoorState[0]); + break; //Assembly Chamber Door case 188065: SelinEncounterDoorGUID = go->GetGUID(); break; case 187770: - DelrissaDoorGUID = go->GetGUID(); - go->SetGoState(DoorState[2]); - break; + DelrissaDoorGUID = go->GetGUID(); + go->SetGoState(DoorState[2]); + break; case 188165: KaelStatue[0] = go->GetGUID(); break; case 188166: KaelStatue[1] = go->GetGUID(); break; } @@ -202,7 +202,7 @@ struct TRINITY_DLL_DECL instance_magisters_terrace : public ScriptedInstance switch(identifier) { case DATA_SELIN: return SelinGUID; - case DATA_KAEL: return KaelGUID; + case DATA_KAEL: return KaelGUID; case DATA_DELRISSA: return DelrissaGUID; case DATA_VEXALLUS_DOOR: return VexallusDoorGUID; case DATA_SELIN_DOOR: return SelinDoorGUID; diff --git a/src/bindings/scripts/scripts/zone/molten_core/boss_baron_geddon.cpp b/src/bindings/scripts/scripts/zone/molten_core/boss_baron_geddon.cpp index 7e907c41581..4f74a48c431 100644 --- a/src/bindings/scripts/scripts/zone/molten_core/boss_baron_geddon.cpp +++ b/src/bindings/scripts/scripts/zone/molten_core/boss_baron_geddon.cpp @@ -57,9 +57,9 @@ struct TRINITY_DLL_DECL boss_baron_geddonAI : public ScriptedAI //If we are <2% hp cast Armageddom if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 2) { - m_creature->InterruptNonMeleeSpells(true); + m_creature->InterruptNonMeleeSpells(true); DoCast(m_creature,SPELL_ARMAGEDDOM); - DoScriptText(EMOTE_SERVICE, m_creature); + DoScriptText(EMOTE_SERVICE, m_creature); return; } @@ -74,7 +74,7 @@ struct TRINITY_DLL_DECL boss_baron_geddonAI : public ScriptedAI if (IgniteMana_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_IGNITEMANA); + DoCast(target,SPELL_IGNITEMANA); IgniteMana_Timer = 30000; }else IgniteMana_Timer -= diff; @@ -83,7 +83,7 @@ struct TRINITY_DLL_DECL boss_baron_geddonAI : public ScriptedAI if (LivingBomb_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_LIVINGBOMB); + DoCast(target,SPELL_LIVINGBOMB); LivingBomb_Timer = 35000; }else LivingBomb_Timer -= diff; diff --git a/src/bindings/scripts/scripts/zone/molten_core/boss_golemagg.cpp b/src/bindings/scripts/scripts/zone/molten_core/boss_golemagg.cpp index 1001a9240ab..76c19d26436 100644 --- a/src/bindings/scripts/scripts/zone/molten_core/boss_golemagg.cpp +++ b/src/bindings/scripts/scripts/zone/molten_core/boss_golemagg.cpp @@ -43,7 +43,7 @@ struct TRINITY_DLL_DECL boss_golemaggAI : public ScriptedAI pInstance = ((ScriptedInstance*)c->GetInstanceData()); Reset(); } - ScriptedInstance *pInstance; + ScriptedInstance *pInstance; uint32 Pyroblast_Timer; uint32 EarthQuake_Timer; @@ -79,7 +79,7 @@ struct TRINITY_DLL_DECL boss_golemaggAI : public ScriptedAI if (Pyroblast_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_PYROBLAST); + DoCast(target,SPELL_PYROBLAST); Pyroblast_Timer = 7000; }else Pyroblast_Timer -= diff; @@ -153,7 +153,7 @@ struct TRINITY_DLL_DECL mob_core_ragerAI : public ScriptedAI if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 50 ) { DoCast(m_creature,SPELL_AEGIS); - DoScriptText(EMOTE_AEGIS, m_creature); + DoScriptText(EMOTE_AEGIS, m_creature); } //Check_Timer diff --git a/src/bindings/scripts/scripts/zone/molten_core/boss_majordomo_executus.cpp b/src/bindings/scripts/scripts/zone/molten_core/boss_majordomo_executus.cpp index cce0a783d44..17d45819a15 100644 --- a/src/bindings/scripts/scripts/zone/molten_core/boss_majordomo_executus.cpp +++ b/src/bindings/scripts/scripts/zone/molten_core/boss_majordomo_executus.cpp @@ -54,12 +54,12 @@ EndScriptData */ struct TRINITY_DLL_DECL boss_majordomoAI : public ScriptedAI { boss_majordomoAI(Creature *c) : ScriptedAI(c) - { - pInstance = ((ScriptedInstance*)c->GetInstanceData()); - Reset(); - } + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + Reset(); + } - ScriptedInstance* pInstance; + ScriptedInstance* pInstance; uint32 MagicReflection_Timer; uint32 DamageReflection_Timer; @@ -77,12 +77,12 @@ struct TRINITY_DLL_DECL boss_majordomoAI : public ScriptedAI if (rand()%5) return; - DoScriptText(SAY_SLAY, m_creature); + DoScriptText(SAY_SLAY, m_creature); } void Aggro(Unit *who) { - DoScriptText(SAY_AGGRO, m_creature); + DoScriptText(SAY_AGGRO, m_creature); } void UpdateAI(const uint32 diff) diff --git a/src/bindings/scripts/scripts/zone/molten_core/boss_ragnaros.cpp b/src/bindings/scripts/scripts/zone/molten_core/boss_ragnaros.cpp index 8c2f65930f5..d4304c6196d 100644 --- a/src/bindings/scripts/scripts/zone/molten_core/boss_ragnaros.cpp +++ b/src/bindings/scripts/scripts/zone/molten_core/boss_ragnaros.cpp @@ -124,7 +124,7 @@ struct TRINITY_DLL_DECL boss_ragnarosAI : public Scripted_NoMovementAI if (rand()%5) return; - DoScriptText(SAY_KILL, m_creature); + DoScriptText(SAY_KILL, m_creature); } void Aggro(Unit *who) @@ -158,7 +158,7 @@ struct TRINITY_DLL_DECL boss_ragnarosAI : public Scripted_NoMovementAI if (rand()%2 == 0) { - DoScriptText(SAY_WRATH, m_creature); + DoScriptText(SAY_WRATH, m_creature); } WrathOfRagnaros_Timer = 30000; @@ -171,7 +171,7 @@ struct TRINITY_DLL_DECL boss_ragnarosAI : public Scripted_NoMovementAI if (rand()%2==0) { - DoScriptText(SAY_HAND, m_creature); + DoScriptText(SAY_HAND, m_creature); } HandOfRagnaros_Timer = 25000; @@ -217,7 +217,7 @@ struct TRINITY_DLL_DECL boss_ragnarosAI : public Scripted_NoMovementAI if (!HasSubmergedOnce) { - DoScriptText(SAY_REINFORCEMENTS1, m_creature); + DoScriptText(SAY_REINFORCEMENTS1, m_creature); // summon 10 elementals Unit* target = NULL; @@ -235,7 +235,7 @@ struct TRINITY_DLL_DECL boss_ragnarosAI : public Scripted_NoMovementAI }else { - DoScriptText(SAY_REINFORCEMENTS2, m_creature); + DoScriptText(SAY_REINFORCEMENTS2, m_creature); Unit* target = NULL; for(int i = 0; i < 9;i++) @@ -272,7 +272,7 @@ struct TRINITY_DLL_DECL boss_ragnarosAI : public Scripted_NoMovementAI if (!HasYelledMagmaBurst) { //Say our dialog - DoScriptText(SAY_MAGMABURST, m_creature); + DoScriptText(SAY_MAGMABURST, m_creature); HasYelledMagmaBurst = true; } diff --git a/src/bindings/scripts/scripts/zone/molten_core/instance_molten_core.cpp b/src/bindings/scripts/scripts/zone/molten_core/instance_molten_core.cpp index 9069175a5ef..4326315d4c3 100644 --- a/src/bindings/scripts/scripts/zone/molten_core/instance_molten_core.cpp +++ b/src/bindings/scripts/scripts/zone/molten_core/instance_molten_core.cpp @@ -40,15 +40,15 @@ EndScriptData */ struct TRINITY_DLL_DECL instance_molten_core : public ScriptedInstance { - instance_molten_core(Map *map) : ScriptedInstance(map) {Initialize();}; + instance_molten_core(Map *map) : ScriptedInstance(map) {Initialize();}; uint64 Lucifron, Magmadar, Gehennas, Garr, Geddon, Shazzrah, Sulfuron, Golemagg, Domo, Ragnaros, FlamewakerPriest; - uint64 RuneKoro, RuneZeth, RuneMazj, RuneTheri, RuneBlaz, RuneKress, RuneMohn; + uint64 RuneKoro, RuneZeth, RuneMazj, RuneTheri, RuneBlaz, RuneKress, RuneMohn; //If all Bosses are dead. bool IsBossDied[9]; - uint32 Encounter[ENCOUNTERS]; + uint32 Encounter[ENCOUNTERS]; void Initialize() { @@ -64,13 +64,13 @@ struct TRINITY_DLL_DECL instance_molten_core : public ScriptedInstance Ragnaros = 0; FlamewakerPriest = 0; - RuneKoro = 0; - RuneZeth = 0; - RuneMazj = 0; - RuneTheri = 0; - RuneBlaz = 0; - RuneKress = 0; - RuneMohn = 0; + RuneKoro = 0; + RuneZeth = 0; + RuneMazj = 0; + RuneTheri = 0; + RuneBlaz = 0; + RuneKress = 0; + RuneMohn = 0; IsBossDied[0] = false; IsBossDied[1] = false; @@ -84,7 +84,7 @@ struct TRINITY_DLL_DECL instance_molten_core : public ScriptedInstance IsBossDied[8] = false; for(uint8 i = 0; i < ENCOUNTERS; i++) - Encounter[i] = NOT_STARTED; + Encounter[i] = NOT_STARTED; } @@ -98,29 +98,29 @@ struct TRINITY_DLL_DECL instance_molten_core : public ScriptedInstance void OnObjectCreate(GameObject *go) { switch(go->GetEntry()) - { - case 176951: //Sulfuron - RuneKoro = go->GetGUID(); - break; - case 176952: //Geddon - RuneZeth = go->GetGUID(); - break; - case 176953: //Shazzrah - RuneMazj = go->GetGUID(); - break; - case 176954: //Golemagg - RuneTheri = go->GetGUID(); - break; - case 176955: //Garr - RuneBlaz = go->GetGUID(); - break; - case 176956: //Magmadar - RuneKress = go->GetGUID(); - break; - case 176957: //Gehennas - RuneMohn = go->GetGUID(); - break; - } + { + case 176951: //Sulfuron + RuneKoro = go->GetGUID(); + break; + case 176952: //Geddon + RuneZeth = go->GetGUID(); + break; + case 176953: //Shazzrah + RuneMazj = go->GetGUID(); + break; + case 176954: //Golemagg + RuneTheri = go->GetGUID(); + break; + case 176955: //Garr + RuneBlaz = go->GetGUID(); + break; + case 176956: //Magmadar + RuneKress = go->GetGUID(); + break; + case 176957: //Gehennas + RuneMohn = go->GetGUID(); + break; + } } @@ -243,11 +243,11 @@ struct TRINITY_DLL_DECL instance_molten_core : public ScriptedInstance return 0; } - void SetData(uint32 type, uint32 data) - { - if (type == DATA_GOLEMAGG_DEATH) - IsBossDied[7] = true; - } + void SetData(uint32 type, uint32 data) + { + if (type == DATA_GOLEMAGG_DEATH) + IsBossDied[7] = true; + } }; InstanceData* GetInstance_instance_molten_core(Map *map) diff --git a/src/bindings/scripts/scripts/zone/moonglade/moonglade.cpp b/src/bindings/scripts/scripts/zone/moonglade/moonglade.cpp index 03d799e30d7..70ce6517c15 100644 --- a/src/bindings/scripts/scripts/zone/moonglade/moonglade.cpp +++ b/src/bindings/scripts/scripts/zone/moonglade/moonglade.cpp @@ -275,9 +275,9 @@ public: uint32 Event_Timer; uint32 checkPlayer_Timer; - uint64 PlayerGUID; + uint64 PlayerGUID; - bool Event_onWait; + bool Event_onWait; void Reset() { @@ -481,7 +481,7 @@ public: case 0: m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 2); DoScriptText(CLINTAR_SPIRIT_SAY_GET_FINAL, m_creature, player); - player->CompleteQuest(10965); + player->CompleteQuest(10965); Event_Timer = 1500; Step = 1; break; @@ -563,7 +563,7 @@ void AddSC_moonglade() newscript->pGossipSelect = &GossipSelect_npc_silva_filnaveth; newscript->RegisterSelf(); - newscript = new Script; + newscript = new Script; newscript->Name="npc_clintar_dreamwalker"; newscript->pQuestAccept = &QuestAccept_npc_clintar_dreamwalker; newscript->RegisterSelf(); diff --git a/src/bindings/scripts/scripts/zone/mulgore/mulgore.cpp b/src/bindings/scripts/scripts/zone/mulgore/mulgore.cpp index 8d4d68fe7fb..51bdf5c3af0 100644 --- a/src/bindings/scripts/scripts/zone/mulgore/mulgore.cpp +++ b/src/bindings/scripts/scripts/zone/mulgore/mulgore.cpp @@ -61,96 +61,96 @@ bool GossipSelect_npc_skorn_whitecloud(Player *player, Creature *_Creature, uint struct TRINITY_DLL_DECL npc_kyle_frenziedAI : public ScriptedAI { - npc_kyle_frenziedAI(Creature *c) : ScriptedAI(c) {Reset();} + npc_kyle_frenziedAI(Creature *c) : ScriptedAI(c) {Reset();} - int STATE; - uint32 wait; - uint64 player; + int STATE; + uint32 wait; + uint64 player; - void Reset() - { - STATE = 0; - m_creature->SetDefaultMovementType(WAYPOINT_MOTION_TYPE); - m_creature->GetMotionMaster()->Initialize(); - } - void Aggro(Unit* who){} + void Reset() + { + STATE = 0; + m_creature->SetDefaultMovementType(WAYPOINT_MOTION_TYPE); + m_creature->GetMotionMaster()->Initialize(); + } + void Aggro(Unit* who){} - void SpellHit(Unit *caster, const SpellEntry* spell) - { // we can feed him without any quest - if(spell->Id == 42222 && caster->GetTypeId() == TYPEID_PLAYER && ((Player*)caster)->GetTeam() == HORDE) - { - STATE = 1; - player = caster->GetGUID(); - float x, y, z, z2; - caster->GetPosition(x, y, z); - x = x + 3.7*cos(caster->GetOrientation()); - y = y + 3.7*sin(caster->GetOrientation()); - z2 = m_creature->GetBaseMap()->GetHeight(x,y,z,false); - z = (z2 <= INVALID_HEIGHT) ? z : z2; - m_creature->SetDefaultMovementType(IDLE_MOTION_TYPE); //there is other way to stop waypoint movement? - m_creature->GetMotionMaster()->Initialize(); - m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - m_creature->GetMotionMaster()->MovePoint(0,x, y, z); - } - } + void SpellHit(Unit *caster, const SpellEntry* spell) + { // we can feed him without any quest + if(spell->Id == 42222 && caster->GetTypeId() == TYPEID_PLAYER && ((Player*)caster)->GetTeam() == HORDE) + { + STATE = 1; + player = caster->GetGUID(); + float x, y, z, z2; + caster->GetPosition(x, y, z); + x = x + 3.7*cos(caster->GetOrientation()); + y = y + 3.7*sin(caster->GetOrientation()); + z2 = m_creature->GetBaseMap()->GetHeight(x,y,z,false); + z = (z2 <= INVALID_HEIGHT) ? z : z2; + m_creature->SetDefaultMovementType(IDLE_MOTION_TYPE); //there is other way to stop waypoint movement? + m_creature->GetMotionMaster()->Initialize(); + m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + m_creature->GetMotionMaster()->MovePoint(0,x, y, z); + } + } void MovementInform(uint32 type, uint32 id) - { - if(type == POINT_MOTION_TYPE) - { - switch(STATE) - { - case 1: - { - Unit *plr = Unit::GetUnit((*m_creature),player); - if(plr) - m_creature->SetOrientation(m_creature->GetAngle(plr)); - m_creature->HandleEmoteCommand(EMOTE_STATE_USESTANDING); //eat - WorldPacket data; - m_creature->BuildHeartBeatMsg(&data); - m_creature->SendMessageToSet(&data,true); - wait = 3000; - STATE = 2; - break; - } - case 4: - m_creature->setDeathState(JUST_DIED); - m_creature->Respawn(); - break; - } - } - } + { + if(type == POINT_MOTION_TYPE) + { + switch(STATE) + { + case 1: + { + Unit *plr = Unit::GetUnit((*m_creature),player); + if(plr) + m_creature->SetOrientation(m_creature->GetAngle(plr)); + m_creature->HandleEmoteCommand(EMOTE_STATE_USESTANDING); //eat + WorldPacket data; + m_creature->BuildHeartBeatMsg(&data); + m_creature->SendMessageToSet(&data,true); + wait = 3000; + STATE = 2; + break; + } + case 4: + m_creature->setDeathState(JUST_DIED); + m_creature->Respawn(); + break; + } + } + } - void UpdateAI(const uint32 diff) - { - if (!STATE || STATE == 4) - return; - if(wait < diff) - { - switch(STATE) - { - case 2: - STATE = 3; wait = 7000; - m_creature->UpdateEntry(23622,HORDE); - m_creature->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); - break; - case 3: - STATE = 4; //go home - Unit *plr = Unit::GetUnit((*m_creature),player); - if(plr && ((Player*)plr)->GetQuestStatus(11129) == QUEST_STATUS_INCOMPLETE) - ((Player*)plr)->CompleteQuest(11129); - float x, y, z, z2, angle; - angle = m_creature->GetAngle(-2146, -430); - m_creature->GetPosition(x,y,z); - x = x + 40*cos(angle); - y = y + 40*sin(angle); - z2 = m_creature->GetBaseMap()->GetHeight(x,y,MAX_HEIGHT,false); - z = (z2 <= INVALID_HEIGHT) ? z : z2; - m_creature->GetMotionMaster()->MovePoint(0,x,y,z); - break; - } - }else wait -= diff; - } + void UpdateAI(const uint32 diff) + { + if (!STATE || STATE == 4) + return; + if(wait < diff) + { + switch(STATE) + { + case 2: + STATE = 3; wait = 7000; + m_creature->UpdateEntry(23622,HORDE); + m_creature->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); + break; + case 3: + STATE = 4; //go home + Unit *plr = Unit::GetUnit((*m_creature),player); + if(plr && ((Player*)plr)->GetQuestStatus(11129) == QUEST_STATUS_INCOMPLETE) + ((Player*)plr)->CompleteQuest(11129); + float x, y, z, z2, angle; + angle = m_creature->GetAngle(-2146, -430); + m_creature->GetPosition(x,y,z); + x = x + 40*cos(angle); + y = y + 40*sin(angle); + z2 = m_creature->GetBaseMap()->GetHeight(x,y,MAX_HEIGHT,false); + z = (z2 <= INVALID_HEIGHT) ? z : z2; + m_creature->GetMotionMaster()->MovePoint(0,x,y,z); + break; + } + }else wait -= diff; + } }; CreatureAI* GetAI_npc_kyle_frenzied(Creature *_Creature) @@ -168,7 +168,7 @@ void AddSC_mulgore() newscript->pGossipSelect = &GossipSelect_npc_skorn_whitecloud; newscript->RegisterSelf(); - newscript = new Script; + newscript = new Script; newscript->Name="npc_kyle_frenzied"; newscript->GetAI = &GetAI_npc_kyle_frenzied; newscript->RegisterSelf(); diff --git a/src/bindings/scripts/scripts/zone/naxxramas/boss_anubrekhan.cpp b/src/bindings/scripts/scripts/zone/naxxramas/boss_anubrekhan.cpp index eb601bc7979..e876dc93201 100644 --- a/src/bindings/scripts/scripts/zone/naxxramas/boss_anubrekhan.cpp +++ b/src/bindings/scripts/scripts/zone/naxxramas/boss_anubrekhan.cpp @@ -75,24 +75,24 @@ struct TRINITY_DLL_DECL boss_anubrekhanAI : public ScriptedAI { switch(rand()%3) { - case 0: DoScriptText(SAY_AGGRO1, m_creature); break; - case 1: DoScriptText(SAY_AGGRO2, m_creature); break; - case 2: DoScriptText(SAY_AGGRO3, m_creature); break; + case 0: DoScriptText(SAY_AGGRO1, m_creature); break; + case 1: DoScriptText(SAY_AGGRO2, m_creature); break; + case 2: DoScriptText(SAY_AGGRO3, m_creature); break; } } void MoveInLineOfSight(Unit *who) { - if (!HasTaunted && m_creature->IsWithinDistInMap(who, 60.0f)) - { + if (!HasTaunted && m_creature->IsWithinDistInMap(who, 60.0f)) + { switch(rand()%5) { - case 0: DoScriptText(SAY_GREET, m_creature); break; - case 1: DoScriptText(SAY_TAUNT1, m_creature); break; - case 2: DoScriptText(SAY_TAUNT2, m_creature); break; - case 3: DoScriptText(SAY_TAUNT3, m_creature); break; - case 4: DoScriptText(SAY_TAUNT4, m_creature); break; + case 0: DoScriptText(SAY_GREET, m_creature); break; + case 1: DoScriptText(SAY_TAUNT1, m_creature); break; + case 2: DoScriptText(SAY_TAUNT2, m_creature); break; + case 3: DoScriptText(SAY_TAUNT3, m_creature); break; + case 4: DoScriptText(SAY_TAUNT4, m_creature); break; } HasTaunted = true; } @@ -111,8 +111,8 @@ struct TRINITY_DLL_DECL boss_anubrekhanAI : public ScriptedAI //Do NOT cast it when we are afflicted by locust swarm if (!m_creature->HasAura(SPELL_LOCUSTSWARM,1)) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_IMPALE); + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_IMPALE); } Impale_Timer = 15000; diff --git a/src/bindings/scripts/scripts/zone/naxxramas/boss_faerlina.cpp b/src/bindings/scripts/scripts/zone/naxxramas/boss_faerlina.cpp index 1df59d08ca5..dcf4d7cab0e 100644 --- a/src/bindings/scripts/scripts/zone/naxxramas/boss_faerlina.cpp +++ b/src/bindings/scripts/scripts/zone/naxxramas/boss_faerlina.cpp @@ -59,22 +59,22 @@ struct TRINITY_DLL_DECL boss_faerlinaAI : public ScriptedAI { switch (rand()%4) { - case 0: DoScriptText(SAY_AGGRO1, m_creature); break; - case 1: DoScriptText(SAY_AGGRO2, m_creature); break; - case 2: DoScriptText(SAY_AGGRO3, m_creature); break; - case 3: DoScriptText(SAY_AGGRO4, m_creature); break; + case 0: DoScriptText(SAY_AGGRO1, m_creature); break; + case 1: DoScriptText(SAY_AGGRO2, m_creature); break; + case 2: DoScriptText(SAY_AGGRO3, m_creature); break; + case 3: DoScriptText(SAY_AGGRO4, m_creature); break; } } void MoveInLineOfSight(Unit *who) { if (!HasTaunted && m_creature->IsWithinDistInMap(who, 60.0f)) - { + { DoScriptText(SAY_GREET, m_creature); HasTaunted = true; } - ScriptedAI::MoveInLineOfSight(who); + ScriptedAI::MoveInLineOfSight(who); } void KilledUnit(Unit* victim) @@ -88,7 +88,7 @@ struct TRINITY_DLL_DECL boss_faerlinaAI : public ScriptedAI void JustDied(Unit* Killer) { - DoScriptText(SAY_DEATH, m_creature); + DoScriptText(SAY_DEATH, m_creature); } void UpdateAI(const uint32 diff) @@ -106,8 +106,8 @@ struct TRINITY_DLL_DECL boss_faerlinaAI : public ScriptedAI //RainOfFire_Timer if (RainOfFire_Timer < diff) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_RAINOFFIRE); + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_RAINOFFIRE); RainOfFire_Timer = 16000; }else RainOfFire_Timer -= diff; diff --git a/src/bindings/scripts/scripts/zone/naxxramas/boss_kelthuzad.cpp b/src/bindings/scripts/scripts/zone/naxxramas/boss_kelthuzad.cpp index bf939da9572..ded2c5bdc71 100644 --- a/src/bindings/scripts/scripts/zone/naxxramas/boss_kelthuzad.cpp +++ b/src/bindings/scripts/scripts/zone/naxxramas/boss_kelthuzad.cpp @@ -187,7 +187,7 @@ struct TRINITY_DLL_DECL boss_kelthuzadAI : public ScriptedAI GuardiansOfIcecrown_Timer = 5000; //5 seconds for summoning each Guardian of Icecrown in phase 3 for(int i=0; i<5; i++) - { + { if(GuardiansOfIcecrown[i]) { //delete creature @@ -196,7 +196,7 @@ struct TRINITY_DLL_DECL boss_kelthuzadAI : public ScriptedAI pUnit->DealDamage(pUnit, pUnit->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); GuardiansOfIcecrown[i] = 0; } - } + } Phase1_Timer = 310000; //Phase 1 lasts 5 minutes and 10 seconds Phase2 = false; @@ -205,10 +205,10 @@ struct TRINITY_DLL_DECL boss_kelthuzadAI : public ScriptedAI void KilledUnit() { - if (rand()%2) - DoScriptText(SAY_SLAY1, m_creature); - else - DoScriptText(SAY_SLAY2, m_creature); + if (rand()%2) + DoScriptText(SAY_SLAY1, m_creature); + else + DoScriptText(SAY_SLAY2, m_creature); } void JustDied(Unit* Killer) @@ -266,9 +266,9 @@ struct TRINITY_DLL_DECL boss_kelthuzadAI : public ScriptedAI { switch(rand()%3) { - case 0: DoScriptText(SAY_AGGRO1, m_creature); break; - case 1: DoScriptText(SAY_AGGRO2, m_creature); break; - case 2: DoScriptText(SAY_AGGRO3, m_creature); break; + case 0: DoScriptText(SAY_AGGRO1, m_creature); break; + case 1: DoScriptText(SAY_AGGRO2, m_creature); break; + case 2: DoScriptText(SAY_AGGRO3, m_creature); break; } } @@ -299,7 +299,7 @@ struct TRINITY_DLL_DECL boss_kelthuzadAI : public ScriptedAI { //DoCast(m_creature->getVictim(),SPELL_CHAINS_OF_KELTHUZAD); - //if(rand()%2 == 0) + //if(rand()%2 == 0) //DoScriptText(SAY_CHAIN1, m_creature); //else //DoScriptText(SAY_CHAIN2, m_creature); @@ -313,7 +313,7 @@ struct TRINITY_DLL_DECL boss_kelthuzadAI : public ScriptedAI DoCast(m_creature->getVictim(),SPELL_MANA_DETONATION); if (rand()%2) - DoScriptText(SAY_SPECIAL1_MANA_DET, m_creature); + DoScriptText(SAY_SPECIAL1_MANA_DET, m_creature); ManaDetonation_Timer = 20000; }else ManaDetonation_Timer -= diff; @@ -323,7 +323,7 @@ struct TRINITY_DLL_DECL boss_kelthuzadAI : public ScriptedAI DoCast(m_creature->getVictim(),SPELL_SHADOW_FISURE); if (rand()%2) - DoScriptText(SAY_SPECIAL3_MANA_DET, m_creature); + DoScriptText(SAY_SPECIAL3_MANA_DET, m_creature); ShadowFisure_Timer = 25000; }else ShadowFisure_Timer -= diff; @@ -334,7 +334,7 @@ struct TRINITY_DLL_DECL boss_kelthuzadAI : public ScriptedAI DoCast(m_creature->getVictim(),SPELL_FROST_BLAST); if(rand()%2 == 0) - DoScriptText(SAY_FROST_BLAST, m_creature); + DoScriptText(SAY_FROST_BLAST, m_creature); FrostBlast_Timer = (rand()%30+30)*1000; }else FrostBlast_Timer -= diff; @@ -342,7 +342,7 @@ struct TRINITY_DLL_DECL boss_kelthuzadAI : public ScriptedAI if(!Phase3 && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 40) { Phase3 = true; - DoScriptText(SAY_REQUEST_AID, m_creature); + DoScriptText(SAY_REQUEST_AID, m_creature); //here Lich King should respond to KelThuzad but I don't know which creature to make talk //so for now just make Kelthuzad says it. DoScriptText(SAY_ANSWER_REQUEST, m_creature); diff --git a/src/bindings/scripts/scripts/zone/naxxramas/boss_noth.cpp b/src/bindings/scripts/scripts/zone/naxxramas/boss_noth.cpp index 57dbe53cc0a..24e4deaf7e5 100644 --- a/src/bindings/scripts/scripts/zone/naxxramas/boss_noth.cpp +++ b/src/bindings/scripts/scripts/zone/naxxramas/boss_noth.cpp @@ -68,9 +68,9 @@ struct TRINITY_DLL_DECL boss_nothAI : public ScriptedAI { switch (rand()%3) { - case 0: DoScriptText(SAY_AGGRO1, m_creature); break; - case 1: DoScriptText(SAY_AGGRO2, m_creature); break; - case 2: DoScriptText(SAY_AGGRO3, m_creature); break; + case 0: DoScriptText(SAY_AGGRO1, m_creature); break; + case 1: DoScriptText(SAY_AGGRO2, m_creature); break; + case 2: DoScriptText(SAY_AGGRO3, m_creature); break; } } @@ -78,16 +78,16 @@ struct TRINITY_DLL_DECL boss_nothAI : public ScriptedAI { switch (rand()%2) { - case 0: DoScriptText(SAY_SLAY1, m_creature); break; - case 1: DoScriptText(SAY_SLAY2, m_creature); break; + case 0: DoScriptText(SAY_SLAY1, m_creature); break; + case 1: DoScriptText(SAY_SLAY2, m_creature); break; } } - void JustSummoned(Creature* summoned) - { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) - summoned->AddThreat(target,0.0f); - } + void JustSummoned(Creature* summoned) + { + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + summoned->AddThreat(target,0.0f); + } void JustDied(Unit* Killer) { @@ -120,8 +120,8 @@ struct TRINITY_DLL_DECL boss_nothAI : public ScriptedAI { DoScriptText(SAY_SUMMON, m_creature); - for(uint8 i = 0; i < 6; i++) - m_creature->SummonCreature(C_PLAGUED_WARRIOR,2684.804,-3502.517,261.313,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,80000); + for(uint8 i = 0; i < 6; i++) + m_creature->SummonCreature(C_PLAGUED_WARRIOR,2684.804,-3502.517,261.313,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,80000); Summon_Timer = 30500; } else Summon_Timer -= diff; diff --git a/src/bindings/scripts/scripts/zone/naxxramas/boss_sapphiron.cpp b/src/bindings/scripts/scripts/zone/naxxramas/boss_sapphiron.cpp index 2c28cf0d438..8529ba85a77 100644 --- a/src/bindings/scripts/scripts/zone/naxxramas/boss_sapphiron.cpp +++ b/src/bindings/scripts/scripts/zone/naxxramas/boss_sapphiron.cpp @@ -88,15 +88,15 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public ScriptedAI if(LifeDrain_Timer < diff) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_LIFE_DRAIN); + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_LIFE_DRAIN); LifeDrain_Timer = 24000; }else LifeDrain_Timer -= diff; if(Blizzard_Timer < diff) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_BLIZZARD); + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_BLIZZARD); Blizzard_Timer = 20000; }else Blizzard_Timer -= diff; @@ -117,14 +117,14 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public ScriptedAI landoff = false; }else Fly_Timer -= diff; } - } + } if (phase == 2) { if(Icebolt_Timer < diff && Icebolt_Count < 5) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_ICEBOLT); + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_ICEBOLT); Icebolt_Count ++; Icebolt_Timer = 4000; }else Icebolt_Timer -= diff; @@ -167,7 +167,7 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public ScriptedAI } if (phase!=2) - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); } }; diff --git a/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp b/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp index ba98121757c..fc27da1b649 100644 --- a/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp +++ b/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp @@ -356,323 +356,323 @@ bool GOHello_go_manaforge_control_console(Player *player, GameObject* _GO) // Entries of Arcanist Ardonis, Commander Dawnforge, Pathaleon the Curators Image int CreatureEntry[3][1] = { - {19830}, // Ardonis - {19831}, // Dawnforge - {21504} // Pathaleon + {19830}, // Ardonis + {19831}, // Dawnforge + {21504} // Pathaleon }; struct TRINITY_DLL_DECL npc_commander_dawnforgeAI : public ScriptedAI { - npc_commander_dawnforgeAI(Creature *c) : ScriptedAI(c) { Reset (); } + npc_commander_dawnforgeAI(Creature *c) : ScriptedAI(c) { Reset (); } - uint64 playerGUID; - uint64 ardonisGUID; - uint64 pathaleonGUID; + uint64 playerGUID; + uint64 ardonisGUID; + uint64 pathaleonGUID; - uint32 Phase; - uint32 PhaseSubphase; - uint32 Phase_Timer; - bool isEvent; + uint32 Phase; + uint32 PhaseSubphase; + uint32 Phase_Timer; + bool isEvent; - float angle_dawnforge; - float angle_ardonis; + float angle_dawnforge; + float angle_ardonis; - void Reset() - { - playerGUID = 0; - ardonisGUID = 0; - pathaleonGUID = 0; + void Reset() + { + playerGUID = 0; + ardonisGUID = 0; + pathaleonGUID = 0; - Phase = 1; - PhaseSubphase = 0; - Phase_Timer = 4000; - isEvent = false; - } + Phase = 1; + PhaseSubphase = 0; + Phase_Timer = 4000; + isEvent = false; + } - void Aggro(Unit *who) { } + void Aggro(Unit *who) { } - //Select any creature in a grid - Creature* SelectCreatureInGrid(uint32 entry, float range) - { - Creature* pCreature = NULL; + //Select any creature in a grid + Creature* SelectCreatureInGrid(uint32 entry, float range) + { + Creature* pCreature = NULL; - CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); - Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; - cell.SetNoCreate(); + CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); + Cell cell(pair); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); - Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck creature_check(*m_creature, entry, true, range); - Trinity::CreatureLastSearcher searcher(pCreature, creature_check); + Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck creature_check(*m_creature, entry, true, range); + Trinity::CreatureLastSearcher searcher(pCreature, creature_check); - TypeContainerVisitor, GridTypeMapContainer> creature_searcher(searcher); + TypeContainerVisitor, GridTypeMapContainer> creature_searcher(searcher); - CellLock cell_lock(cell, pair); - cell_lock->Visit(cell_lock, creature_searcher,*(m_creature->GetMap())); + CellLock cell_lock(cell, pair); + cell_lock->Visit(cell_lock, creature_searcher,*(m_creature->GetMap())); - return pCreature; - } + return pCreature; + } - void JustSummoned(Creature *summoned) - { - pathaleonGUID = summoned->GetGUID(); - } + void JustSummoned(Creature *summoned) + { + pathaleonGUID = summoned->GetGUID(); + } - // Emote Ardonis and Pathaleon - void Turn_to_Pathaleons_Image() - { - Unit *ardonis = Unit::GetUnit(*m_creature,ardonisGUID); - Unit *pathaleon = Unit::GetUnit(*m_creature,pathaleonGUID); - Player *player = (Player*)Unit::GetUnit(*m_creature,playerGUID); + // Emote Ardonis and Pathaleon + void Turn_to_Pathaleons_Image() + { + Unit *ardonis = Unit::GetUnit(*m_creature,ardonisGUID); + Unit *pathaleon = Unit::GetUnit(*m_creature,pathaleonGUID); + Player *player = (Player*)Unit::GetUnit(*m_creature,playerGUID); - if (!ardonis || !pathaleon || !player) - return; + if (!ardonis || !pathaleon || !player) + return; - //Calculate the angle to Pathaleon - angle_dawnforge = m_creature->GetAngle(pathaleon->GetPositionX(), pathaleon->GetPositionY()); - angle_ardonis = ardonis->GetAngle(pathaleon->GetPositionX(), pathaleon->GetPositionY()); + //Calculate the angle to Pathaleon + angle_dawnforge = m_creature->GetAngle(pathaleon->GetPositionX(), pathaleon->GetPositionY()); + angle_ardonis = ardonis->GetAngle(pathaleon->GetPositionX(), pathaleon->GetPositionY()); - //Turn Dawnforge and update - m_creature->SetOrientation(angle_dawnforge); - m_creature->SendUpdateToPlayer(player); - //Turn Ardonis and update - ardonis->SetOrientation(angle_ardonis); - ardonis->SendUpdateToPlayer(player); + //Turn Dawnforge and update + m_creature->SetOrientation(angle_dawnforge); + m_creature->SendUpdateToPlayer(player); + //Turn Ardonis and update + ardonis->SetOrientation(angle_ardonis); + ardonis->SendUpdateToPlayer(player); - //Set them to kneel - m_creature->SetStandState(PLAYER_STATE_KNEEL); - ardonis->SetStandState(PLAYER_STATE_KNEEL); - } + //Set them to kneel + m_creature->SetStandState(PLAYER_STATE_KNEEL); + ardonis->SetStandState(PLAYER_STATE_KNEEL); + } - //Set them back to each other - void Turn_to_eachother() - { - if (Unit *ardonis = Unit::GetUnit(*m_creature,ardonisGUID)) - { - Player *player = (Player*)Unit::GetUnit(*m_creature,playerGUID); + //Set them back to each other + void Turn_to_eachother() + { + if (Unit *ardonis = Unit::GetUnit(*m_creature,ardonisGUID)) + { + Player *player = (Player*)Unit::GetUnit(*m_creature,playerGUID); - if (!player) - return; + if (!player) + return; - angle_dawnforge = m_creature->GetAngle(ardonis->GetPositionX(), ardonis->GetPositionY()); - angle_ardonis = ardonis->GetAngle(m_creature->GetPositionX(), m_creature->GetPositionY()); + angle_dawnforge = m_creature->GetAngle(ardonis->GetPositionX(), ardonis->GetPositionY()); + angle_ardonis = ardonis->GetAngle(m_creature->GetPositionX(), m_creature->GetPositionY()); - //Turn Dawnforge and update - m_creature->SetOrientation(angle_dawnforge); - m_creature->SendUpdateToPlayer(player); - //Turn Ardonis and update - ardonis->SetOrientation(angle_ardonis); - ardonis->SendUpdateToPlayer(player); + //Turn Dawnforge and update + m_creature->SetOrientation(angle_dawnforge); + m_creature->SendUpdateToPlayer(player); + //Turn Ardonis and update + ardonis->SetOrientation(angle_ardonis); + ardonis->SendUpdateToPlayer(player); - //Set state - m_creature->SetStandState(PLAYER_STATE_NONE); - ardonis->SetStandState(PLAYER_STATE_NONE); - } - } + //Set state + m_creature->SetStandState(PLAYER_STATE_NONE); + ardonis->SetStandState(PLAYER_STATE_NONE); + } + } - bool CanStartEvent(Player *player) - { - if (!isEvent) - { - Creature *ardonis = SelectCreatureInGrid(CreatureEntry[0][0], 10.0f); - if (!ardonis) - return false; + bool CanStartEvent(Player *player) + { + if (!isEvent) + { + Creature *ardonis = SelectCreatureInGrid(CreatureEntry[0][0], 10.0f); + if (!ardonis) + return false; - ardonisGUID = ardonis->GetGUID(); - playerGUID = player->GetGUID(); + ardonisGUID = ardonis->GetGUID(); + playerGUID = player->GetGUID(); - isEvent = true; + isEvent = true; - Turn_to_eachother(); - return true; - } + Turn_to_eachother(); + return true; + } - debug_log("TSCR: npc_commander_dawnforge event already in progress, need to wait."); - return false; - } + debug_log("TSCR: npc_commander_dawnforge event already in progress, need to wait."); + return false; + } - void UpdateAI(const uint32 diff) - { - //Is event even running? - if (!isEvent) - return; + void UpdateAI(const uint32 diff) + { + //Is event even running? + if (!isEvent) + return; - //Phase timing - if (Phase_Timer >= diff) - { - Phase_Timer -= diff; - return; - } + //Phase timing + if (Phase_Timer >= diff) + { + Phase_Timer -= diff; + return; + } - Unit *ardonis = Unit::GetUnit(*m_creature,ardonisGUID); - Unit *pathaleon = Unit::GetUnit(*m_creature,pathaleonGUID); - Player *player = (Player*)Unit::GetUnit(*m_creature,playerGUID); + Unit *ardonis = Unit::GetUnit(*m_creature,ardonisGUID); + Unit *pathaleon = Unit::GetUnit(*m_creature,pathaleonGUID); + Player *player = (Player*)Unit::GetUnit(*m_creature,playerGUID); - if (!ardonis || !player) - { - Reset(); - return; - } + if (!ardonis || !player) + { + Reset(); + return; + } - if (Phase > 4 && !pathaleon) - { - Reset(); - return; - } + if (Phase > 4 && !pathaleon) + { + Reset(); + return; + } - //Phase 1 Dawnforge say - switch (Phase) - { - case 1: - DoScriptText(SAY_COMMANDER_DAWNFORGE_1, m_creature); - ++Phase; - Phase_Timer = 16000; - break; - //Phase 2 Ardonis say - case 2: - DoScriptText(SAY_ARCANIST_ARDONIS_1, ardonis); - ++Phase; - Phase_Timer = 16000; - break; - //Phase 3 Dawnforge say - case 3: - DoScriptText(SAY_COMMANDER_DAWNFORGE_2, m_creature); - ++Phase; - Phase_Timer = 16000; - break; - //Phase 4 Pathaleon spawns up to phase 9 - case 4: - //spawn pathaleon's image - m_creature->SummonCreature(CreatureEntry[2][0], 2325.851563, 2799.534668, 133.084229, 6.038996, TEMPSUMMON_TIMED_DESPAWN, 90000); - ++Phase; - Phase_Timer = 500; - break; - //Phase 5 Pathaleon say - case 5: - DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_1, pathaleon); - ++Phase; - Phase_Timer = 6000; - break; - //Phase 6 - case 6: - switch(PhaseSubphase) - { - //Subphase 1: Turn Dawnforge and Ardonis - case 0: - Turn_to_Pathaleons_Image(); - ++PhaseSubphase; - Phase_Timer = 8000; - break; - //Subphase 2 Dawnforge say - case 1: - DoScriptText(SAY_COMMANDER_DAWNFORGE_3, m_creature); - PhaseSubphase = 0; - ++Phase; - Phase_Timer = 8000; - break; - } - break; - //Phase 7 Pathaleons say 3 Sentence, every sentence need a subphase - case 7: - switch(PhaseSubphase) - { - //Subphase 1 - case 0: - DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_2, pathaleon); - ++PhaseSubphase; - Phase_Timer = 12000; - break; - //Subphase 2 - case 1: - DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_2_1, pathaleon); - ++PhaseSubphase; - Phase_Timer = 16000; - break; - //Subphase 3 - case 2: - DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_2_2, pathaleon); - PhaseSubphase = 0; - ++Phase; - Phase_Timer = 10000; - break; - } - break; - //Phase 8 Dawnforge & Ardonis say - case 8: - DoScriptText(SAY_COMMANDER_DAWNFORGE_4, m_creature); - DoScriptText(SAY_ARCANIST_ARDONIS_2, ardonis); - ++Phase; - Phase_Timer = 4000; - break; - //Phase 9 Pathaleons Despawn, Reset Dawnforge & Ardonis angle - case 9: - Turn_to_eachother(); - //hide pathaleon, unit will despawn shortly - pathaleon->SetVisibility(VISIBILITY_OFF); - PhaseSubphase = 0; - ++Phase; - Phase_Timer = 3000; - break; - //Phase 10 Dawnforge say - case 10: - DoScriptText(SAY_COMMANDER_DAWNFORGE_5, m_creature); - player->AreaExploredOrEventHappens(QUEST_INFO_GATHERING); - Reset(); - break; - } - } + //Phase 1 Dawnforge say + switch (Phase) + { + case 1: + DoScriptText(SAY_COMMANDER_DAWNFORGE_1, m_creature); + ++Phase; + Phase_Timer = 16000; + break; + //Phase 2 Ardonis say + case 2: + DoScriptText(SAY_ARCANIST_ARDONIS_1, ardonis); + ++Phase; + Phase_Timer = 16000; + break; + //Phase 3 Dawnforge say + case 3: + DoScriptText(SAY_COMMANDER_DAWNFORGE_2, m_creature); + ++Phase; + Phase_Timer = 16000; + break; + //Phase 4 Pathaleon spawns up to phase 9 + case 4: + //spawn pathaleon's image + m_creature->SummonCreature(CreatureEntry[2][0], 2325.851563, 2799.534668, 133.084229, 6.038996, TEMPSUMMON_TIMED_DESPAWN, 90000); + ++Phase; + Phase_Timer = 500; + break; + //Phase 5 Pathaleon say + case 5: + DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_1, pathaleon); + ++Phase; + Phase_Timer = 6000; + break; + //Phase 6 + case 6: + switch(PhaseSubphase) + { + //Subphase 1: Turn Dawnforge and Ardonis + case 0: + Turn_to_Pathaleons_Image(); + ++PhaseSubphase; + Phase_Timer = 8000; + break; + //Subphase 2 Dawnforge say + case 1: + DoScriptText(SAY_COMMANDER_DAWNFORGE_3, m_creature); + PhaseSubphase = 0; + ++Phase; + Phase_Timer = 8000; + break; + } + break; + //Phase 7 Pathaleons say 3 Sentence, every sentence need a subphase + case 7: + switch(PhaseSubphase) + { + //Subphase 1 + case 0: + DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_2, pathaleon); + ++PhaseSubphase; + Phase_Timer = 12000; + break; + //Subphase 2 + case 1: + DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_2_1, pathaleon); + ++PhaseSubphase; + Phase_Timer = 16000; + break; + //Subphase 3 + case 2: + DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_2_2, pathaleon); + PhaseSubphase = 0; + ++Phase; + Phase_Timer = 10000; + break; + } + break; + //Phase 8 Dawnforge & Ardonis say + case 8: + DoScriptText(SAY_COMMANDER_DAWNFORGE_4, m_creature); + DoScriptText(SAY_ARCANIST_ARDONIS_2, ardonis); + ++Phase; + Phase_Timer = 4000; + break; + //Phase 9 Pathaleons Despawn, Reset Dawnforge & Ardonis angle + case 9: + Turn_to_eachother(); + //hide pathaleon, unit will despawn shortly + pathaleon->SetVisibility(VISIBILITY_OFF); + PhaseSubphase = 0; + ++Phase; + Phase_Timer = 3000; + break; + //Phase 10 Dawnforge say + case 10: + DoScriptText(SAY_COMMANDER_DAWNFORGE_5, m_creature); + player->AreaExploredOrEventHappens(QUEST_INFO_GATHERING); + Reset(); + break; + } + } }; CreatureAI* GetAI_npc_commander_dawnforge(Creature* _Creature) { - return new npc_commander_dawnforgeAI(_Creature); + return new npc_commander_dawnforgeAI(_Creature); } Creature* SearchDawnforge(Player *source, uint32 entry, float range) { - Creature* pCreature = NULL; + Creature* pCreature = NULL; - CellPair pair(Trinity::ComputeCellPair(source->GetPositionX(), source->GetPositionY())); - Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; - cell.SetNoCreate(); + CellPair pair(Trinity::ComputeCellPair(source->GetPositionX(), source->GetPositionY())); + Cell cell(pair); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); - Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck creature_check(*source, entry, true, range); - Trinity::CreatureLastSearcher searcher(pCreature, creature_check); + Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck creature_check(*source, entry, true, range); + Trinity::CreatureLastSearcher searcher(pCreature, creature_check); - TypeContainerVisitor, GridTypeMapContainer> creature_searcher(searcher); + TypeContainerVisitor, GridTypeMapContainer> creature_searcher(searcher); - CellLock cell_lock(cell, pair); - cell_lock->Visit(cell_lock, creature_searcher,*(source->GetMap())); + CellLock cell_lock(cell, pair); + cell_lock->Visit(cell_lock, creature_searcher,*(source->GetMap())); - return pCreature; + return pCreature; } bool AreaTrigger_at_commander_dawnforge(Player *player, AreaTriggerEntry *at) { - //if player lost aura or not have at all, we should not try start event. - if (!player->HasAura(SPELL_SUNFURY_DISGUISE,0)) - return false; + //if player lost aura or not have at all, we should not try start event. + if (!player->HasAura(SPELL_SUNFURY_DISGUISE,0)) + return false; - if (player->isAlive() && player->GetQuestStatus(QUEST_INFO_GATHERING) == QUEST_STATUS_INCOMPLETE) - { - Creature* Dawnforge = SearchDawnforge(player, CreatureEntry[1][0], 30.0f); + if (player->isAlive() && player->GetQuestStatus(QUEST_INFO_GATHERING) == QUEST_STATUS_INCOMPLETE) + { + Creature* Dawnforge = SearchDawnforge(player, CreatureEntry[1][0], 30.0f); - if (!Dawnforge) - return false; + if (!Dawnforge) + return false; - if (((npc_commander_dawnforgeAI*)Dawnforge->AI())->CanStartEvent(player)) - return true; - } - return false; + if (((npc_commander_dawnforgeAI*)Dawnforge->AI())->CanStartEvent(player)) + return true; + } + return false; } /*###### ## npc_protectorate_nether_drake ######*/ -#define GOSSIP_ITEM "I'm ready to fly! Take me up, dragon!" +#define GOSSIP_ITEM "I'm ready to fly! Take me up, dragon!" bool GossipHello_npc_protectorate_nether_drake(Player *player, Creature *_Creature) { @@ -705,43 +705,43 @@ bool GossipSelect_npc_protectorate_nether_drake(Player *player, Creature *_Creat ## npc_professor_dabiri ######*/ -#define SPELL_PHASE_DISTRUPTOR 35780 -#define GOSSIP_ITEM "I need a new phase distruptor, Professor" +#define SPELL_PHASE_DISTRUPTOR 35780 +#define GOSSIP_ITEM "I need a new phase distruptor, Professor" #define WHISPER_DABIRI -1000302 -#define QUEST_DIMENSIUS 10439 +#define QUEST_DIMENSIUS 10439 #define QUEST_ON_NETHERY_WINGS 10438 bool GossipHello_npc_professor_dabiri(Player *player, Creature *_Creature) { - if (_Creature->isQuestGiver()) + if (_Creature->isQuestGiver()) player->PrepareQuestMenu( _Creature->GetGUID() ); - if(player->GetQuestStatus(QUEST_ON_NETHERY_WINGS) == QUEST_STATUS_INCOMPLETE && !player->HasItemCount(29778, 1)) - player->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + if(player->GetQuestStatus(QUEST_ON_NETHERY_WINGS) == QUEST_STATUS_INCOMPLETE && !player->HasItemCount(29778, 1)) + player->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); + player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); - return true; + return true; } bool GossipSelect_npc_professor_dabiri(Player *player, Creature *_Creature, uint32 sender, uint32 action ) { - if (action == GOSSIP_ACTION_INFO_DEF+1) - { - _Creature->CastSpell(player, SPELL_PHASE_DISTRUPTOR, false); - player->CLOSE_GOSSIP_MENU(); - } + if (action == GOSSIP_ACTION_INFO_DEF+1) + { + _Creature->CastSpell(player, SPELL_PHASE_DISTRUPTOR, false); + player->CLOSE_GOSSIP_MENU(); + } - return true; + return true; } bool QuestAccept_npc_professor_dabiri(Player *player, Creature *creature, Quest const *quest ) { - if(quest->GetQuestId() == QUEST_DIMENSIUS) - DoScriptText(WHISPER_DABIRI, creature, player); + if(quest->GetQuestId() == QUEST_DIMENSIUS) + DoScriptText(WHISPER_DABIRI, creature, player); - return true; + return true; } /*###### @@ -911,7 +911,7 @@ struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI bool Completed; - void JustDied(Unit* killer) + void JustDied(Unit* killer) { if (PlayerGUID) { @@ -928,12 +928,12 @@ struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI return; switch(i) - { + { case 3: //first spawn m_creature->SummonCreature(SPAWN_FIRST, 2449.67, 2183.11, 96.85, 6.20, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); m_creature->SummonCreature(SPAWN_FIRST, 2449.53, 2184.43, 96.36, 6.27, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); m_creature->SummonCreature(SPAWN_FIRST, 2449.85, 2186.34, 97.57, 6.08, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - break; + break; case 7: m_creature->SummonCreature(SPAWN_SECOND, 2309.64, 2186.24, 92.25, 6.06, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); @@ -947,16 +947,16 @@ struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI Completed = true; } {Unit* Thadell = FindCreature(N_THADELL, 30, m_creature); - if(Thadell) + if(Thadell) DoScriptText(SAY_THADELL_1, m_creature);}break; - case 13: - {Unit* Thadell = FindCreature(N_THADELL, 30, m_creature); - if(Thadell) + case 13: + {Unit* Thadell = FindCreature(N_THADELL, 30, m_creature); + if(Thadell) DoScriptText(SAY_THADELL_2, m_creature, player);}break; - } + } } - void JustSummoned(Creature* summoned) + void JustSummoned(Creature* summoned) { summoned->AI()->AttackStart(m_creature); } @@ -980,8 +980,8 @@ bool QuestAccept_npc_bessy(Player* player, Creature* creature, Quest const* ques { if (quest->GetQuestId() == Q_ALMABTRIEB) { - creature->setFaction(113); - creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + creature->setFaction(113); + creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); } return true; @@ -1004,7 +1004,7 @@ CreatureAI* GetAI_npc_bessy(Creature *_Creature) bessyAI->AddWaypoint(10, 2304.58, 2272.23, 96.67); bessyAI->AddWaypoint(11, 2297.09, 2271.40, 95.16); bessyAI->AddWaypoint(12, 2297.68, 2266.79, 95.07,4000); - bessyAI->AddWaypoint(13, 2297.67, 2266.76, 95.07,4000); + bessyAI->AddWaypoint(13, 2297.67, 2266.76, 95.07,4000); return (CreatureAI*)bessyAI; } @@ -1027,15 +1027,15 @@ void AddSC_netherstorm() newscript->GetAI = &GetAI_npc_manaforge_control_console; newscript->RegisterSelf(); - newscript = new Script; - newscript->Name = "npc_commander_dawnforge"; - newscript->GetAI = &GetAI_npc_commander_dawnforge; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name = "npc_commander_dawnforge"; + newscript->GetAI = &GetAI_npc_commander_dawnforge; + newscript->RegisterSelf(); - newscript = new Script; - newscript->Name = "at_commander_dawnforge"; - newscript->pAreaTrigger = &AreaTrigger_at_commander_dawnforge; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name = "at_commander_dawnforge"; + newscript->pAreaTrigger = &AreaTrigger_at_commander_dawnforge; + newscript->RegisterSelf(); newscript = new Script; newscript->Name="npc_protectorate_nether_drake"; @@ -1043,12 +1043,12 @@ void AddSC_netherstorm() newscript->pGossipSelect = &GossipSelect_npc_protectorate_nether_drake; newscript->RegisterSelf(); - newscript = new Script; - newscript->Name = "npc_professor_dabiri"; - newscript->pGossipHello = &GossipHello_npc_professor_dabiri; + newscript = new Script; + newscript->Name = "npc_professor_dabiri"; + newscript->pGossipHello = &GossipHello_npc_professor_dabiri; newscript->pGossipSelect = &GossipSelect_npc_professor_dabiri; - newscript->pQuestAccept = &QuestAccept_npc_professor_dabiri; - newscript->RegisterSelf(); + newscript->pQuestAccept = &QuestAccept_npc_professor_dabiri; + newscript->RegisterSelf(); newscript = new Script; newscript->Name="npc_veronia"; @@ -1061,7 +1061,7 @@ void AddSC_netherstorm() newscript->GetAI = &GetAI_mob_phase_hunter; newscript->RegisterSelf(); - newscript = new Script; + newscript = new Script; newscript->Name = "npc_bessy"; newscript->GetAI = &GetAI_npc_bessy; newscript->pQuestAccept = &QuestAccept_npc_bessy; diff --git a/src/bindings/scripts/scripts/zone/onyxias_lair/boss_onyxia.cpp b/src/bindings/scripts/scripts/zone/onyxias_lair/boss_onyxia.cpp index 8a0342cb116..c621ebf566c 100644 --- a/src/bindings/scripts/scripts/zone/onyxias_lair/boss_onyxia.cpp +++ b/src/bindings/scripts/scripts/zone/onyxias_lair/boss_onyxia.cpp @@ -40,7 +40,7 @@ EndScriptData */ #define SPELL_FIREBALL 18392 #define SPELL_BELLOWINGROAR 18431 -#define SPELL_HEATED_GROUND 22191 //Wrong Spell +#define SPELL_HEATED_GROUND 22191 //Wrong Spell #define SPELL_SUMMONWHELP 17646 @@ -76,10 +76,10 @@ struct TRINITY_DLL_DECL boss_onyxiaAI : public ScriptedAI uint32 SummonWhelpsTimer; uint32 BellowingRoarTimer; uint32 WingBuffetTimer; - uint32 KnockAwayTimer; - uint32 FireballTimer; + uint32 KnockAwayTimer; + uint32 FireballTimer; - bool InitialSpawn; + bool InitialSpawn; void Reset() { @@ -93,24 +93,24 @@ struct TRINITY_DLL_DECL boss_onyxiaAI : public ScriptedAI SummonWhelpsTimer = 45000; BellowingRoarTimer = 30000; WingBuffetTimer = 17000; - KnockAwayTimer = 15000; - FireballTimer = 18000; + KnockAwayTimer = 15000; + FireballTimer = 18000; - InitialSpawn = true; + InitialSpawn = true; - m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); - m_creature->ApplySpellImmune(1, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); + m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); + m_creature->ApplySpellImmune(1, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); } - void Aggro(Unit* who) + void Aggro(Unit* who) { DoScriptText(SAY_AGGRO, m_creature); - DoZoneInCombat(); + DoZoneInCombat(); } - void JustDied(Unit* Killer) + void JustDied(Unit* Killer) { - } + } void KilledUnit(Unit *victim) { @@ -122,30 +122,30 @@ struct TRINITY_DLL_DECL boss_onyxiaAI : public ScriptedAI if(!UpdateVictim()) return; - if(((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 60) && (Phase == 1)) + if(((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 60) && (Phase == 1)) { - Phase = 2; - m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + Phase = 2; + m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); m_creature->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING + MOVEMENTFLAG_ONTRANSPORT); - m_creature->SetHover(true); + m_creature->SetHover(true); m_creature->GetMotionMaster()->Clear(false); m_creature->GetMotionMaster()->MoveIdle(); - DoScriptText(SAY_PHASE_2_TRANS, m_creature); - } + DoScriptText(SAY_PHASE_2_TRANS, m_creature); + } - if(((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 40) && (Phase == 2)) + if(((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 40) && (Phase == 2)) { - Phase = 3; + Phase = 3; m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING + MOVEMENTFLAG_ONTRANSPORT); m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LAND); - m_creature->SetHover(false); - m_creature->GetMotionMaster()->MovePoint(0, -10.6155, -219.357, -87.7344); - DoStartMovement(m_creature->getVictim()); - m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + m_creature->SetHover(false); + m_creature->GetMotionMaster()->MovePoint(0, -10.6155, -219.357, -87.7344); + DoStartMovement(m_creature->getVictim()); + m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); DoScriptText(SAY_PHASE_3_TRANS, m_creature); - } + } - if(Phase == 1 || Phase == 3) + if(Phase == 1 || Phase == 3) { if(FlameBreathTimer < diff) { @@ -174,75 +174,75 @@ struct TRINITY_DLL_DECL boss_onyxiaAI : public ScriptedAI WingBuffetTimer = 7000 + ((rand()%8)*1000); }else WingBuffetTimer -= diff; - if(KnockAwayTimer < diff) - { - if(rand() <= 30) - { - DoCast(m_creature->getVictim(), SPELL_KNOCK_AWAY); - } - KnockAwayTimer = 15000; - }else KnockAwayTimer -= diff; - - if(Phase == 3) - { - if(BellowingRoarTimer < diff) - { - DoCast(m_creature->getVictim(), SPELL_BELLOWINGROAR); - - BellowingRoarTimer = 30000; - }else BellowingRoarTimer -= diff; - - if(SummonWhelpsTimer < diff) - { - SummonWhelps(Phase); - - SummonWhelpsTimer = 45000; - }else SummonWhelpsTimer -= diff; - } - - DoMeleeAttackIfReady(); - } - - if(Phase == 2) - { - if(InitialSpawn) - { - InitialSpawn = false; - - for(uint32 i = 0; i < 10; ++i) - { - uint32 random = rand()%4; - Creature* Whelp = m_creature->SummonCreature(CREATURE_WHELP, SpawnLocations[random][0], SpawnLocations[random][1], SpawnLocations[random][2], 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); - if(Whelp) - Whelp->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); - } - } - - if(EngulfingFlamesTimer < diff) - { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_ENGULFINGFLAMES); - m_creature->HandleEmoteCommand(ANIM_FLY); - - EngulfingFlamesTimer = 10000; - } - else EngulfingFlamesTimer -= diff; - - if(FireballTimer < diff) - { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_FIREBALL); - - FireballTimer = 18000; - } - else FireballTimer -= diff; - - if(MovementTimer < diff) + if(KnockAwayTimer < diff) { - if(rand()%100 < 30) - { - DoScriptText(EMOTE_BREATH, m_creature); - DoCast(m_creature->getVictim(), SPELL_DEEPBREATH); - } - else ChangePosition(); + if(rand() <= 30) + { + DoCast(m_creature->getVictim(), SPELL_KNOCK_AWAY); + } + KnockAwayTimer = 15000; + }else KnockAwayTimer -= diff; + + if(Phase == 3) + { + if(BellowingRoarTimer < diff) + { + DoCast(m_creature->getVictim(), SPELL_BELLOWINGROAR); + + BellowingRoarTimer = 30000; + }else BellowingRoarTimer -= diff; + + if(SummonWhelpsTimer < diff) + { + SummonWhelps(Phase); + + SummonWhelpsTimer = 45000; + }else SummonWhelpsTimer -= diff; + } + + DoMeleeAttackIfReady(); + } + + if(Phase == 2) + { + if(InitialSpawn) + { + InitialSpawn = false; + + for(uint32 i = 0; i < 10; ++i) + { + uint32 random = rand()%4; + Creature* Whelp = m_creature->SummonCreature(CREATURE_WHELP, SpawnLocations[random][0], SpawnLocations[random][1], SpawnLocations[random][2], 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); + if(Whelp) + Whelp->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); + } + } + + if(EngulfingFlamesTimer < diff) + { + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_ENGULFINGFLAMES); + m_creature->HandleEmoteCommand(ANIM_FLY); + + EngulfingFlamesTimer = 10000; + } + else EngulfingFlamesTimer -= diff; + + if(FireballTimer < diff) + { + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_FIREBALL); + + FireballTimer = 18000; + } + else FireballTimer -= diff; + + if(MovementTimer < diff) + { + if(rand()%100 < 30) + { + DoScriptText(EMOTE_BREATH, m_creature); + DoCast(m_creature->getVictim(), SPELL_DEEPBREATH); + } + else ChangePosition(); MovementTimer = 25000; }else MovementTimer -= diff; @@ -253,46 +253,46 @@ struct TRINITY_DLL_DECL boss_onyxiaAI : public ScriptedAI SummonWhelpsTimer = 45000; } - else SummonWhelpsTimer -= diff; - } - } + else SummonWhelpsTimer -= diff; + } + } - void ChangePosition() - { - uint32 random = rand() % 4; - if(random<4){ - m_creature->GetMotionMaster()->MovePoint(0, MovementLocations[random][0], MovementLocations[random][1], MovementLocations[random][2]);} - } + void ChangePosition() + { + uint32 random = rand() % 4; + if(random<4){ + m_creature->GetMotionMaster()->MovePoint(0, MovementLocations[random][0], MovementLocations[random][1], MovementLocations[random][2]);} + } - void SummonWhelps(uint32 Phase) - { - if(Phase == 2) - { - uint32 max = rand()%10; - for(uint32 i = 0; i < max; ++i) - { - uint32 random = rand()%3; - Creature* Whelp = m_creature->SummonCreature(CREATURE_WHELP, SpawnLocations[random][0], SpawnLocations[random][1], SpawnLocations[random][2], 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); - if(Whelp) - Whelp->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); - } - } + void SummonWhelps(uint32 Phase) + { + if(Phase == 2) + { + uint32 max = rand()%10; + for(uint32 i = 0; i < max; ++i) + { + uint32 random = rand()%3; + Creature* Whelp = m_creature->SummonCreature(CREATURE_WHELP, SpawnLocations[random][0], SpawnLocations[random][1], SpawnLocations[random][2], 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); + if(Whelp) + Whelp->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); + } + } - if(Phase == 3) - { - uint32 max = rand() % 10 +1; - if(max < 5) - { - for(uint32 i = 0; i < max; ++i) - { - uint32 random = rand()%4; - Creature* Whelp = m_creature->SummonCreature(CREATURE_WHELP, SpawnLocations[random][0], SpawnLocations[random][1], SpawnLocations[random][2], 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); - if(Whelp) - Whelp->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); - } - } - } - } + if(Phase == 3) + { + uint32 max = rand() % 10 +1; + if(max < 5) + { + for(uint32 i = 0; i < max; ++i) + { + uint32 random = rand()%4; + Creature* Whelp = m_creature->SummonCreature(CREATURE_WHELP, SpawnLocations[random][0], SpawnLocations[random][1], SpawnLocations[random][2], 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); + if(Whelp) + Whelp->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0)); + } + } + } + } }; CreatureAI* GetAI_boss_onyxiaAI(Creature *_Creature) diff --git a/src/bindings/scripts/scripts/zone/ruins_of_ahnqiraj/boss_moam.cpp b/src/bindings/scripts/scripts/zone/ruins_of_ahnqiraj/boss_moam.cpp index e6336122406..2b148b2e730 100644 --- a/src/bindings/scripts/scripts/zone/ruins_of_ahnqiraj/boss_moam.cpp +++ b/src/bindings/scripts/scripts/zone/ruins_of_ahnqiraj/boss_moam.cpp @@ -54,7 +54,7 @@ struct TRINITY_DLL_DECL boss_moamAI : public ScriptedAI void Aggro(Unit *who) { - DoScriptText(EMOTE_AGGRO, m_creature); + DoScriptText(EMOTE_AGGRO, m_creature); pTarget = who; } @@ -67,7 +67,7 @@ struct TRINITY_DLL_DECL boss_moamAI : public ScriptedAI //if (j==1 && m_creature->GetMana()*100 / m_creature->GetMaxMana() == 100 && !m_creature->IsNonMeleeSpellCasted(false)) { DoCast(m_creature->getVictim(),SPELL_ARCANEERUPTION); - DoScriptText(EMOTE_MANA_FULL, m_creature); + DoScriptText(EMOTE_MANA_FULL, m_creature); } //If we are <50%HP cast MANA FIEND (Summon Mana) and Sleep diff --git a/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_headless_horseman.cpp b/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_headless_horseman.cpp index fd8b070f50a..66270e79539 100644 --- a/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_headless_horseman.cpp +++ b/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_headless_horseman.cpp @@ -25,59 +25,59 @@ EndScriptData */ #include "SpellMgr.h" #include "def_scarlet_monastery.h" -#define SAY_ENTRANCE -1189001 -#define SAY_REJOINED -1189002 -#define SAY_LOST_HEAD -1189003 -#define SAY_CONFLAGRATION -1189004 -#define SAY_SPROUTING_PUMPKINS -1189005 -#define SAY_PLAYER_DEATH -1189006 -#define SAY_DEATH -1189007 +#define SAY_ENTRANCE -1189001 +#define SAY_REJOINED -1189002 +#define SAY_LOST_HEAD -1189003 +#define SAY_CONFLAGRATION -1189004 +#define SAY_SPROUTING_PUMPKINS -1189005 +#define SAY_PLAYER_DEATH -1189006 +#define SAY_DEATH -1189007 uint32 RandomLaught[] = {11965, 11975, 11976}; - // Entryes -#define HH_MOUNTED 23682 -#define HH_UNHORSED 23800 -#define HEAD 23775 -#define PULSING_PUMPKIN 23694 -#define PUMPKIN_FIEND 23545 -#define HELPER 23686 -#define WISP_INVIS 24034 + // Entryes +#define HH_MOUNTED 23682 +#define HH_UNHORSED 23800 +#define HEAD 23775 +#define PULSING_PUMPKIN 23694 +#define PUMPKIN_FIEND 23545 +#define HELPER 23686 +#define WISP_INVIS 24034 - //Spells -#define SPELL_CLEAVE 42587 -#define SPELL_CONFLAGRATION 42380 //Phase 2, can't find real spell(Dim Fire?) -//#define SPELL_CONFL_SPEED 22587 //8% increase speed, value 22587 from SPELL_CONFLAGRATION mains that spell? -#define SPELL_SUMMON_PUMPKIN 42394 + //Spells +#define SPELL_CLEAVE 42587 +#define SPELL_CONFLAGRATION 42380 //Phase 2, can't find real spell(Dim Fire?) +//#define SPELL_CONFL_SPEED 22587 //8% increase speed, value 22587 from SPELL_CONFLAGRATION mains that spell? +#define SPELL_SUMMON_PUMPKIN 42394 -#define SPELL_WHIRLWIND 43116 -#define SPELL_IMMUNE 42556 -#define SPELL_BODY_REGEN 42403 -#define SPELL_CONFUSE 43105 +#define SPELL_WHIRLWIND 43116 +#define SPELL_IMMUNE 42556 +#define SPELL_BODY_REGEN 42403 +#define SPELL_CONFUSE 43105 -#define SPELL_FLYING_HEAD 42399 //visual flying head -#define SPELL_HEAD 42413 //visual buff, "head" -#define SPELL_HEAD_IS_DEAD 42428 //at killing head, Phase 3 +#define SPELL_FLYING_HEAD 42399 //visual flying head +#define SPELL_HEAD 42413 //visual buff, "head" +#define SPELL_HEAD_IS_DEAD 42428 //at killing head, Phase 3 -#define SPELL_PUMPKIN_AURA 42280 -#define SPELL_PUMPKIN_AURA_GREEN 42294 -#define SPELL_SQUASH_SOUL 42514 -#define SPELL_SPROUTING 42281 -#define SPELL_SPROUT_BODY 42285 +#define SPELL_PUMPKIN_AURA 42280 +#define SPELL_PUMPKIN_AURA_GREEN 42294 +#define SPELL_SQUASH_SOUL 42514 +#define SPELL_SPROUTING 42281 +#define SPELL_SPROUT_BODY 42285 - //Effects -#define SPELL_RHYME_BIG 42909 -//#define SPELL_RHYME_SMALL 42910 -#define SPELL_HEAD_SPEAKS 43129 -#define SPELL_HEAD_LANDS 42400 -#define SPELL_BODY_FLAME 42074 -#define SPELL_HEAD_FLAME 42971 -//#define SPELL_ENRAGE_VISUAL 42438 // he uses this spell? -#define SPELL_WISP_BLUE 42821 -#define SPELL_WISP_FLIGHT_PORT 42818 -//#define SPELL_WISP_INVIS 42823 -#define SPELL_SMOKE 42355 -#define SPELL_DEATH 42566 //not correct spell + //Effects +#define SPELL_RHYME_BIG 42909 +//#define SPELL_RHYME_SMALL 42910 +#define SPELL_HEAD_SPEAKS 43129 +#define SPELL_HEAD_LANDS 42400 +#define SPELL_BODY_FLAME 42074 +#define SPELL_HEAD_FLAME 42971 +//#define SPELL_ENRAGE_VISUAL 42438 // he uses this spell? +#define SPELL_WISP_BLUE 42821 +#define SPELL_WISP_FLIGHT_PORT 42818 +//#define SPELL_WISP_INVIS 42823 +#define SPELL_SMOKE 42355 +#define SPELL_DEATH 42566 //not correct spell struct Locations { @@ -86,397 +86,397 @@ struct Locations static Locations FlightPoint[]= { - {1754.00,1346.00,17.50}, - {1765.00,1347.00,19.00}, - {1784.00,1346.80,25.40}, - {1803.30,1347.60,33.00}, - {1824.00,1350.00,42.60}, - {1838.80,1353.20,49.80}, - {1852.00,1357.60,55.70}, - {1861.30,1364.00,59.40}, - {1866.30,1374.80,61.70}, - {1864.00,1387.30,63.20}, - {1854.80,1399.40,64.10}, - {1844.00,1406.90,64.10}, - {1824.30,1411.40,63.30}, - {1801.00,1412.30,60.40}, - {1782.00,1410.10,55.50}, - {1770.50,1405.20,50.30}, - {1765.20,1400.70,46.60}, - {1761.40,1393.40,41.70}, - {1759.10,1386.70,36.60}, - {1757.80,1378.20,29.00}, - {1758.00,1367.00,19.51} + {1754.00,1346.00,17.50}, + {1765.00,1347.00,19.00}, + {1784.00,1346.80,25.40}, + {1803.30,1347.60,33.00}, + {1824.00,1350.00,42.60}, + {1838.80,1353.20,49.80}, + {1852.00,1357.60,55.70}, + {1861.30,1364.00,59.40}, + {1866.30,1374.80,61.70}, + {1864.00,1387.30,63.20}, + {1854.80,1399.40,64.10}, + {1844.00,1406.90,64.10}, + {1824.30,1411.40,63.30}, + {1801.00,1412.30,60.40}, + {1782.00,1410.10,55.50}, + {1770.50,1405.20,50.30}, + {1765.20,1400.70,46.60}, + {1761.40,1393.40,41.70}, + {1759.10,1386.70,36.60}, + {1757.80,1378.20,29.00}, + {1758.00,1367.00,19.51} }; static Locations Spawn[]= { - {1776.27,1348.74,19.20}, //spawn point for pumpkin shrine mob - {1765.28,1347.46,17.55} //spawn point for smoke + {1776.27,1348.74,19.20}, //spawn point for pumpkin shrine mob + {1765.28,1347.46,17.55} //spawn point for smoke }; struct Summon { - const std::string text; + const std::string text; }; static Summon Text[]= { - {"Horseman rise..."}, - {"Your time is night..."}, - {"You felt death once..."}, - {"Now, know demise!"} + {"Horseman rise..."}, + {"Your time is night..."}, + {"You felt death once..."}, + {"Now, know demise!"} }; struct TRINITY_DLL_DECL mob_wisp_invisAI : public ScriptedAI { - mob_wisp_invisAI(Creature *c) : ScriptedAI(c) - { - Creaturetype = delay = spell = spell2 = 0; - //that's hack but there are no info about range of this spells in dbc - SpellEntry *wisp = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_WISP_BLUE); - if (wisp) - wisp->rangeIndex = 6; //100 yards - SpellEntry *port = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_WISP_FLIGHT_PORT); - if (port) - port->rangeIndex = 6; - } + mob_wisp_invisAI(Creature *c) : ScriptedAI(c) + { + Creaturetype = delay = spell = spell2 = 0; + //that's hack but there are no info about range of this spells in dbc + SpellEntry *wisp = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_WISP_BLUE); + if (wisp) + wisp->rangeIndex = 6; //100 yards + SpellEntry *port = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_WISP_FLIGHT_PORT); + if (port) + port->rangeIndex = 6; + } - uint32 Creaturetype; - uint32 delay; - uint32 spell; - uint32 spell2; - void Reset(){} - void Aggro(Unit *who){} - void SetType(uint32 _type) - { - Creaturetype = _type; - switch(Creaturetype) - { - case 1: - spell = SPELL_PUMPKIN_AURA_GREEN; break; - case 2: - delay = 15000; spell = SPELL_BODY_FLAME;spell2 = SPELL_DEATH; break; - case 3: - delay = 15000; spell = SPELL_SMOKE; break; - case 4: - delay = 7000; spell2 = SPELL_WISP_BLUE; break; - } - if (spell)DoCast(m_creature,spell); - } + uint32 Creaturetype; + uint32 delay; + uint32 spell; + uint32 spell2; + void Reset(){} + void Aggro(Unit *who){} + void SetType(uint32 _type) + { + Creaturetype = _type; + switch(Creaturetype) + { + case 1: + spell = SPELL_PUMPKIN_AURA_GREEN; break; + case 2: + delay = 15000; spell = SPELL_BODY_FLAME;spell2 = SPELL_DEATH; break; + case 3: + delay = 15000; spell = SPELL_SMOKE; break; + case 4: + delay = 7000; spell2 = SPELL_WISP_BLUE; break; + } + if (spell)DoCast(m_creature,spell); + } - void SpellHit(Unit* caster, const SpellEntry *spell) - { - if(spell->Id == SPELL_WISP_FLIGHT_PORT && Creaturetype == 4) - m_creature->SetDisplayId(2027); - } + void SpellHit(Unit* caster, const SpellEntry *spell) + { + if(spell->Id == SPELL_WISP_FLIGHT_PORT && Creaturetype == 4) + m_creature->SetDisplayId(2027); + } - void MoveInLineOfSight(Unit *who) - { - if (!who || Creaturetype != 1 || !who->isTargetableForAttack()) - return; + void MoveInLineOfSight(Unit *who) + { + if (!who || Creaturetype != 1 || !who->isTargetableForAttack()) + return; - if (m_creature->GetDistance2d(who) < 0.1 && !who->HasAura(SPELL_SQUASH_SOUL,0)) - DoCast(who,SPELL_SQUASH_SOUL); - } + if (m_creature->GetDistance2d(who) < 0.1 && !who->HasAura(SPELL_SQUASH_SOUL,0)) + DoCast(who,SPELL_SQUASH_SOUL); + } - void UpdateAI(const uint32 diff) - { - if(delay) - { - if (delay <= diff) - { - m_creature->RemoveAurasDueToSpell(SPELL_SMOKE); - if(spell2) - DoCast(m_creature,spell2); - delay = 0; - }else delay -= diff; - } - } + void UpdateAI(const uint32 diff) + { + if(delay) + { + if (delay <= diff) + { + m_creature->RemoveAurasDueToSpell(SPELL_SMOKE); + if(spell2) + DoCast(m_creature,spell2); + delay = 0; + }else delay -= diff; + } + } }; struct TRINITY_DLL_DECL mob_headAI : public ScriptedAI { - mob_headAI(Creature *c) : ScriptedAI(c) {Reset();} + mob_headAI(Creature *c) : ScriptedAI(c) {Reset();} - uint64 bodyGUID; + uint64 bodyGUID; - uint32 Phase; - uint32 laugh; - uint32 wait; + uint32 Phase; + uint32 laugh; + uint32 wait; - bool withbody; - bool die; + bool withbody; + bool die; void Reset() { - Phase = 0; - bodyGUID = 0; - die = false; - withbody = true; - wait = 1000; - laugh = 15000 + rand()%16 * 1000; + Phase = 0; + bodyGUID = 0; + die = false; + withbody = true; + wait = 1000; + laugh = 15000 + rand()%16 * 1000; } - void Aggro(Unit *who) {} - void SaySound(int32 textEntry, Unit *target = 0) - { - DoScriptText(textEntry, m_creature, target); - //DoCast(m_creature,SPELL_HEAD_SPEAKS,true); - Creature *speaker = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,1000); - speaker->CastSpell(speaker,SPELL_HEAD_SPEAKS,false); - laugh += 3000; - } + void Aggro(Unit *who) {} + void SaySound(int32 textEntry, Unit *target = 0) + { + DoScriptText(textEntry, m_creature, target); + //DoCast(m_creature,SPELL_HEAD_SPEAKS,true); + Creature *speaker = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,1000); + speaker->CastSpell(speaker,SPELL_HEAD_SPEAKS,false); + laugh += 3000; + } - void DamageTaken(Unit* done_by,uint32 &damage) - { - if (withbody) - return; + void DamageTaken(Unit* done_by,uint32 &damage) + { + if (withbody) + return; - switch(Phase) - { - case 1: - if(((m_creature->GetHealth() - damage)*100)/m_creature->GetMaxHealth() < 67) - Disappear();break; - case 2: - if(((m_creature->GetHealth() - damage)*100)/m_creature->GetMaxHealth() < 34) - Disappear();break; - case 3: - if (damage >= m_creature->GetHealth()) - { - die = true; - withbody = true; - wait = 300; - damage = m_creature->GetHealth() - m_creature->GetMaxHealth()/100; - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - m_creature->StopMoving(); - //m_creature->GetMotionMaster()->MoveIdle(); - DoCast(m_creature,SPELL_HEAD_IS_DEAD); - }break; - } - } + switch(Phase) + { + case 1: + if(((m_creature->GetHealth() - damage)*100)/m_creature->GetMaxHealth() < 67) + Disappear();break; + case 2: + if(((m_creature->GetHealth() - damage)*100)/m_creature->GetMaxHealth() < 34) + Disappear();break; + case 3: + if (damage >= m_creature->GetHealth()) + { + die = true; + withbody = true; + wait = 300; + damage = m_creature->GetHealth() - m_creature->GetMaxHealth()/100; + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + m_creature->StopMoving(); + //m_creature->GetMotionMaster()->MoveIdle(); + DoCast(m_creature,SPELL_HEAD_IS_DEAD); + }break; + } + } - void SpellHit(Unit *caster, const SpellEntry* spell) - { - if (!withbody) - return; + void SpellHit(Unit *caster, const SpellEntry* spell) + { + if (!withbody) + return; - if (spell->Id == SPELL_FLYING_HEAD) - { - if (Phase < 3) ++Phase; - else Phase = 3; - withbody = false; - if(!bodyGUID) - bodyGUID = caster->GetGUID(); - m_creature->RemoveAllAuras(); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - DoCast(m_creature,SPELL_HEAD_LANDS,true); - DoCast(m_creature,SPELL_HEAD,false); - SaySound(SAY_LOST_HEAD); - m_creature->GetMotionMaster()->Clear(false); - m_creature->GetMotionMaster()->MoveFleeing(caster->getVictim()); - } - } - void Disappear();//we must set returned=true(this will prevent from "body calls head" while head flying to body), see function below + if (spell->Id == SPELL_FLYING_HEAD) + { + if (Phase < 3) ++Phase; + else Phase = 3; + withbody = false; + if(!bodyGUID) + bodyGUID = caster->GetGUID(); + m_creature->RemoveAllAuras(); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + DoCast(m_creature,SPELL_HEAD_LANDS,true); + DoCast(m_creature,SPELL_HEAD,false); + SaySound(SAY_LOST_HEAD); + m_creature->GetMotionMaster()->Clear(false); + m_creature->GetMotionMaster()->MoveFleeing(caster->getVictim()); + } + } + void Disappear();//we must set returned=true(this will prevent from "body calls head" while head flying to body), see function below void UpdateAI(const uint32 diff) { - if (!withbody) - { - if (wait < diff) - { - wait = 1000; - if (!m_creature->getVictim()) return; - m_creature->GetMotionMaster()->Clear(false); - m_creature->GetMotionMaster()->MoveFleeing(m_creature->getVictim()); - }else wait -= diff; - if (laugh < diff) - { - laugh = 15000 + (rand()%16)*1000; - DoPlaySoundToSet(m_creature, RandomLaught[rand()%3]); - //DoCast(m_creature,SPELL_HEAD_SPEAKS,true); //this spell remove buff "head" - Creature *speaker = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,1000); - speaker->CastSpell(speaker,SPELL_HEAD_SPEAKS,false); - DoTextEmote("laughts",NULL); - } else laugh -= diff; + if (!withbody) + { + if (wait < diff) + { + wait = 1000; + if (!m_creature->getVictim()) return; + m_creature->GetMotionMaster()->Clear(false); + m_creature->GetMotionMaster()->MoveFleeing(m_creature->getVictim()); + }else wait -= diff; + if (laugh < diff) + { + laugh = 15000 + (rand()%16)*1000; + DoPlaySoundToSet(m_creature, RandomLaught[rand()%3]); + //DoCast(m_creature,SPELL_HEAD_SPEAKS,true); //this spell remove buff "head" + Creature *speaker = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,1000); + speaker->CastSpell(speaker,SPELL_HEAD_SPEAKS,false); + DoTextEmote("laughts",NULL); + } else laugh -= diff; - } else { + } else { - if (die) { - if (wait < diff) - { - die = false; - Unit *body = Unit::GetUnit((*m_creature),bodyGUID); - if (body) - body->DealDamage(body, body->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - m_creature->setDeathState(JUST_DIED); - } else wait -= diff; - } - } + if (die) { + if (wait < diff) + { + die = false; + Unit *body = Unit::GetUnit((*m_creature),bodyGUID); + if (body) + body->DealDamage(body, body->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->setDeathState(JUST_DIED); + } else wait -= diff; + } + } } }; struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI { - boss_headless_horsemanAI(Creature *c) : ScriptedAI(c) - { - SpellEntry *confl = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_CONFLAGRATION); - if(confl) - { - confl->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DAMAGE_PERCENT; - confl->EffectBasePoints[0] = 10; - confl->EffectBaseDice[0] = 10; - confl->DmgMultiplier[0] = 1; - } -/* SpellEntry *confl = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_CONFLAGRATION); - if(confl) - confl->EffectTriggerSpell[1] = 22587; + boss_headless_horsemanAI(Creature *c) : ScriptedAI(c) + { + SpellEntry *confl = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_CONFLAGRATION); + if(confl) + { + confl->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DAMAGE_PERCENT; + confl->EffectBasePoints[0] = 10; + confl->EffectBaseDice[0] = 10; + confl->DmgMultiplier[0] = 1; + } +/* SpellEntry *confl = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_CONFLAGRATION); + if(confl) + confl->EffectTriggerSpell[1] = 22587; - SpellEntry *speed = (SpellEntry*)GetSpellStore()->LookupEntry(22587); - if(speed) - { - speed->Effect[1] = SPELL_EFFECT_APPLY_AURA; - speed->EffectApplyAuraName[1] = SPELL_AURA_MOD_CONFUSE; - }*/ - pInstance = ((ScriptedInstance*)c->GetInstanceData()); - Reset(); - } + SpellEntry *speed = (SpellEntry*)GetSpellStore()->LookupEntry(22587); + if(speed) + { + speed->Effect[1] = SPELL_EFFECT_APPLY_AURA; + speed->EffectApplyAuraName[1] = SPELL_AURA_MOD_CONFUSE; + }*/ + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + Reset(); + } - ScriptedInstance *pInstance; + ScriptedInstance *pInstance; - uint64 headGUID; - uint64 playerGUID; + uint64 headGUID; + uint64 playerGUID; - uint32 Phase; - uint32 id; - uint32 count; - uint32 say_timer; + uint32 Phase; + uint32 id; + uint32 count; + uint32 say_timer; - uint32 conflagrate; - uint32 summonadds; - uint32 cleave; - uint32 regen; - uint32 whirlwind; - uint32 laugh; - uint32 burn; + uint32 conflagrate; + uint32 summonadds; + uint32 cleave; + uint32 regen; + uint32 whirlwind; + uint32 laugh; + uint32 burn; - bool withhead; - bool returned; - bool IsFlying; - bool wp_reached; - bool burned; + bool withhead; + bool returned; + bool IsFlying; + bool wp_reached; + bool burned; void Reset() { - Phase = 1; - conflagrate = 15000; - summonadds = 15000; - laugh = 16000 + rand()%5 * 1000; - cleave = 2000; - regen = 1000; - burn = 6000; - count = 0; - say_timer = 3000; + Phase = 1; + conflagrate = 15000; + summonadds = 15000; + laugh = 16000 + rand()%5 * 1000; + cleave = 2000; + regen = 1000; + burn = 6000; + count = 0; + say_timer = 3000; - withhead = true; - returned = true; - burned = false; - IsFlying = false; - DoCast(m_creature,SPELL_HEAD); - if (headGUID){ - Unit* Head = Unit::GetUnit((*m_creature), headGUID); - if(Head){ - Head->SetVisibility(VISIBILITY_OFF); - Head->setDeathState(JUST_DIED); - } - headGUID = 0; - } + withhead = true; + returned = true; + burned = false; + IsFlying = false; + DoCast(m_creature,SPELL_HEAD); + if (headGUID){ + Unit* Head = Unit::GetUnit((*m_creature), headGUID); + if(Head){ + Head->SetVisibility(VISIBILITY_OFF); + Head->setDeathState(JUST_DIED); + } + headGUID = 0; + } - if (pInstance) - pInstance->SetData(DATA_HORSEMAN_EVENT, 0); + if (pInstance) + pInstance->SetData(DATA_HORSEMAN_EVENT, 0); } - void FlyMode() - { - m_creature->SetVisibility(VISIBILITY_OFF); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - m_creature->AddUnitMovementFlag(MOVEMENTFLAG_FLYING2); - m_creature->SetSpeed(MOVE_WALK,5.0f,true); - wp_reached = false; - count = 0; - say_timer = 3000; - id = 0; - Phase = 0; + void FlyMode() + { + m_creature->SetVisibility(VISIBILITY_OFF); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + m_creature->AddUnitMovementFlag(MOVEMENTFLAG_FLYING2); + m_creature->SetSpeed(MOVE_WALK,5.0f,true); + wp_reached = false; + count = 0; + say_timer = 3000; + id = 0; + Phase = 0; } - void MovementInform(uint32 type, uint32 i) - { - if (type != POINT_MOTION_TYPE || !IsFlying) - return; - if (i != id) - return; - wp_reached = true; + void MovementInform(uint32 type, uint32 i) + { + if (type != POINT_MOTION_TYPE || !IsFlying) + return; + if (i != id) + return; + wp_reached = true; - switch (id) - { - case 0: - m_creature->SetVisibility(VISIBILITY_ON);break; - case 1: { - Creature *smoke = m_creature->SummonCreature(HELPER,Spawn[1].x,Spawn[1].y,Spawn[1].z,0,TEMPSUMMON_TIMED_DESPAWN,20000); - ((mob_wisp_invisAI*)smoke->AI())->SetType(3); - DoCast(m_creature,SPELL_RHYME_BIG); - break;} - case 6: - if(pInstance) - pInstance->SetData(GAMEOBJECT_PUMPKIN_SHRINE, 0); //hide gameobject - break; - case 19: - m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_FLYING2);break; - case 20: { - Phase = 1; - IsFlying = false; - wp_reached = false; - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - SaySound(SAY_ENTRANCE); - Unit *plr = Unit::GetUnit((*m_creature),playerGUID); - if (plr) - DoStartMovement(plr); - } - break; - } - ++id; - } + switch (id) + { + case 0: + m_creature->SetVisibility(VISIBILITY_ON);break; + case 1: { + Creature *smoke = m_creature->SummonCreature(HELPER,Spawn[1].x,Spawn[1].y,Spawn[1].z,0,TEMPSUMMON_TIMED_DESPAWN,20000); + ((mob_wisp_invisAI*)smoke->AI())->SetType(3); + DoCast(m_creature,SPELL_RHYME_BIG); + break;} + case 6: + if(pInstance) + pInstance->SetData(GAMEOBJECT_PUMPKIN_SHRINE, 0); //hide gameobject + break; + case 19: + m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_FLYING2);break; + case 20: { + Phase = 1; + IsFlying = false; + wp_reached = false; + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + SaySound(SAY_ENTRANCE); + Unit *plr = Unit::GetUnit((*m_creature),playerGUID); + if (plr) + DoStartMovement(plr); + } + break; + } + ++id; + } - void Aggro(Unit *who) - { - if(pInstance) + void Aggro(Unit *who) + { + if(pInstance) pInstance->SetData(DATA_HORSEMAN_EVENT, IN_PROGRESS); - DoZoneInCombat(); - } - void AttackStart(Unit* who) {ScriptedAI::AttackStart(who);} - void MoveInLineOfSight(Unit *who) - { - if (withhead && Phase != 0) - ScriptedAI::MoveInLineOfSight(who); - } - void KilledUnit(Unit *plr) - { - if (plr->GetTypeId() == TYPEID_PLAYER) - { - if (withhead) - SaySound(SAY_PLAYER_DEATH); - else { //maybe possible when player dies from conflagration - Creature *Head = (Creature*)Unit::GetUnit((*m_creature), headGUID); - if (Head) - ((mob_headAI*)Head->AI())->SaySound(SAY_PLAYER_DEATH); - } - } - } + DoZoneInCombat(); + } + void AttackStart(Unit* who) {ScriptedAI::AttackStart(who);} + void MoveInLineOfSight(Unit *who) + { + if (withhead && Phase != 0) + ScriptedAI::MoveInLineOfSight(who); + } + void KilledUnit(Unit *plr) + { + if (plr->GetTypeId() == TYPEID_PLAYER) + { + if (withhead) + SaySound(SAY_PLAYER_DEATH); + else { //maybe possible when player dies from conflagration + Creature *Head = (Creature*)Unit::GetUnit((*m_creature), headGUID); + if (Head) + ((mob_headAI*)Head->AI())->SaySound(SAY_PLAYER_DEATH); + } + } + } - void SaySound(int32 textEntry, Unit *target = 0) - { - DoScriptText(textEntry, m_creature, target); - laugh += 4000; - } + void SaySound(int32 textEntry, Unit *target = 0) + { + DoScriptText(textEntry, m_creature, target); + laugh += 4000; + } Player* SelectRandomPlayer(float range = 0.0f, bool checkLoS = true) { @@ -484,320 +484,320 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI if (!map->IsDungeon()) return NULL; Map::PlayerList const &PlayerList = map->GetPlayers(); - Map::PlayerList::const_iterator i; - if(PlayerList.isEmpty()) return NULL; + Map::PlayerList::const_iterator i; + if(PlayerList.isEmpty()) return NULL; std::list temp; std::list::iterator j; for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if((m_creature->IsWithinLOSInMap(i->getSource()) || !checkLoS) && m_creature->getVictim() != i->getSource() && - m_creature->IsWithinDistInMap(i->getSource(), range) && i->getSource()->isAlive()) - temp.push_back(i->getSource()); + if((m_creature->IsWithinLOSInMap(i->getSource()) || !checkLoS) && m_creature->getVictim() != i->getSource() && + m_creature->IsWithinDistInMap(i->getSource(), range) && i->getSource()->isAlive()) + temp.push_back(i->getSource()); - if (temp.size()) { - j = temp.begin(); - advance(j, rand()%temp.size()); - return (*j); - } + if (temp.size()) { + j = temp.begin(); + advance(j, rand()%temp.size()); + return (*j); + } return NULL; } - void SpellHitTarget(Unit* unit, const SpellEntry* spell) - { - if (spell->Id == SPELL_CONFLAGRATION) - if (unit->HasAura(SPELL_CONFLAGRATION,0)) - SaySound(SAY_CONFLAGRATION,unit); - } + void SpellHitTarget(Unit* unit, const SpellEntry* spell) + { + if (spell->Id == SPELL_CONFLAGRATION) + if (unit->HasAura(SPELL_CONFLAGRATION,0)) + SaySound(SAY_CONFLAGRATION,unit); + } - void JustDied(Unit* killer) - { - m_creature->StopMoving(); - //m_creature->GetMotionMaster()->MoveIdle(); test - SaySound(SAY_DEATH); - Creature *flame = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,60000); - flame->CastSpell(flame,SPELL_BODY_FLAME,false); - Creature *wisp = DoSpawnCreature(WISP_INVIS,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,60000); - ((mob_wisp_invisAI*)wisp->AI())->SetType(4); - if(pInstance) - pInstance->SetData(DATA_HORSEMAN_EVENT, DONE); - } + void JustDied(Unit* killer) + { + m_creature->StopMoving(); + //m_creature->GetMotionMaster()->MoveIdle(); test + SaySound(SAY_DEATH); + Creature *flame = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,60000); + flame->CastSpell(flame,SPELL_BODY_FLAME,false); + Creature *wisp = DoSpawnCreature(WISP_INVIS,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,60000); + ((mob_wisp_invisAI*)wisp->AI())->SetType(4); + if(pInstance) + pInstance->SetData(DATA_HORSEMAN_EVENT, DONE); + } - void SpellHit(Unit *caster, const SpellEntry* spell) - { - if (withhead) - return; + void SpellHit(Unit *caster, const SpellEntry* spell) + { + if (withhead) + return; - if (spell->Id == SPELL_FLYING_HEAD) - { - if (Phase < 3) Phase++; - else Phase = 3; - withhead = true; - m_creature->RemoveAllAuras(); - m_creature->SetName("Headless Horseman"); - m_creature->SetHealth(m_creature->GetMaxHealth()); - SaySound(SAY_REJOINED); - DoCast(m_creature,SPELL_HEAD); - caster->GetMotionMaster()->Clear(false); - caster->GetMotionMaster()->MoveFollow(m_creature,6,rand()%6); - //DoResetThreat();//not sure if need - std::list::iterator itr; - for(itr = caster->getThreatManager().getThreatList().begin(); itr != caster->getThreatManager().getThreatList().end(); ++itr) - { - Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); - if(pUnit && pUnit->isAlive() && pUnit != caster) - m_creature->AddThreat(pUnit,caster->getThreatManager().getThreat(pUnit)); - } - } - } + if (spell->Id == SPELL_FLYING_HEAD) + { + if (Phase < 3) Phase++; + else Phase = 3; + withhead = true; + m_creature->RemoveAllAuras(); + m_creature->SetName("Headless Horseman"); + m_creature->SetHealth(m_creature->GetMaxHealth()); + SaySound(SAY_REJOINED); + DoCast(m_creature,SPELL_HEAD); + caster->GetMotionMaster()->Clear(false); + caster->GetMotionMaster()->MoveFollow(m_creature,6,rand()%6); + //DoResetThreat();//not sure if need + std::list::iterator itr; + for(itr = caster->getThreatManager().getThreatList().begin(); itr != caster->getThreatManager().getThreatList().end(); ++itr) + { + Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); + if(pUnit && pUnit->isAlive() && pUnit != caster) + m_creature->AddThreat(pUnit,caster->getThreatManager().getThreat(pUnit)); + } + } + } - void DamageTaken(Unit *done_by, uint32 &damage) - { - if (damage >= m_creature->GetHealth() && withhead) - { - withhead = false; - returned = false; - damage = m_creature->GetHealth() - m_creature->GetMaxHealth()/100; - m_creature->RemoveAllAuras(); - m_creature->SetName("Headless Horseman, Unhorsed"); + void DamageTaken(Unit *done_by, uint32 &damage) + { + if (damage >= m_creature->GetHealth() && withhead) + { + withhead = false; + returned = false; + damage = m_creature->GetHealth() - m_creature->GetMaxHealth()/100; + m_creature->RemoveAllAuras(); + m_creature->SetName("Headless Horseman, Unhorsed"); - if (!headGUID) - headGUID = DoSpawnCreature(HEAD,rand()%6,rand()%6,0,0,TEMPSUMMON_DEAD_DESPAWN,0)->GetGUID(); - Unit* Head = Unit::GetUnit((*m_creature), headGUID); - if (Head && Head->isAlive()) - { - Head->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - //Head->CastSpell(Head,SPELL_HEAD_INVIS,false); - m_creature->InterruptNonMeleeSpells(false); - DoCast(m_creature,SPELL_IMMUNE,true); - DoCast(m_creature,SPELL_BODY_REGEN,true); - m_creature->CastSpell(Head, SPELL_FLYING_HEAD,true); - DoCast(m_creature,SPELL_CONFUSE,false); //test - done_by->ProcDamageAndSpell(m_creature,PROC_FLAG_KILL_AND_GET_XP,PROC_FLAG_KILLED,PROC_EX_NONE,0); - whirlwind = 4000 + (rand()%5)*1000; - regen = 0; - } - } - } + if (!headGUID) + headGUID = DoSpawnCreature(HEAD,rand()%6,rand()%6,0,0,TEMPSUMMON_DEAD_DESPAWN,0)->GetGUID(); + Unit* Head = Unit::GetUnit((*m_creature), headGUID); + if (Head && Head->isAlive()) + { + Head->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + //Head->CastSpell(Head,SPELL_HEAD_INVIS,false); + m_creature->InterruptNonMeleeSpells(false); + DoCast(m_creature,SPELL_IMMUNE,true); + DoCast(m_creature,SPELL_BODY_REGEN,true); + m_creature->CastSpell(Head, SPELL_FLYING_HEAD,true); + DoCast(m_creature,SPELL_CONFUSE,false); //test + done_by->ProcDamageAndSpell(m_creature,PROC_FLAG_KILL_AND_GET_XP,PROC_FLAG_KILLED,PROC_EX_NONE,0); + whirlwind = 4000 + (rand()%5)*1000; + regen = 0; + } + } + } void UpdateAI(const uint32 diff) { - if (withhead) - { - switch(Phase) - { - case 0: { - if (!IsFlying) - { - if (say_timer < diff) { - say_timer = 3000; - Player *plr = SelectRandomPlayer(100.0f,false); - if (count < 3) - plr->Say(Text[count].text,0); - else { - DoCast(m_creature,SPELL_RHYME_BIG); - plr->Say(Text[count].text,0); - plr->HandleEmoteCommand(ANIM_EMOTE_SHOUT); - wp_reached = true; - IsFlying = true; - count = 0; - break; - } - ++count; - }else say_timer -= diff; - }else{ - if (wp_reached) { - wp_reached = false; - m_creature->GetMotionMaster()->Clear(false); - m_creature->GetMotionMaster()->MovePoint(id,FlightPoint[id].x,FlightPoint[id].y,FlightPoint[id].z); - } - } - } - break; - case 1: - if(burned) break; - if(burn < diff) - { - Creature *flame = m_creature->SummonCreature(HELPER,Spawn[0].x,Spawn[0].y,Spawn[0].z,0,TEMPSUMMON_TIMED_DESPAWN,17000); - ((mob_wisp_invisAI*)flame->AI())->SetType(2); - burned = true; - }else burn -= diff; - break; - case 2: - if (conflagrate < diff) - { - Unit *plr = (Unit*)SelectRandomPlayer(30.0f); - if (plr) - m_creature->CastSpell(plr,SPELL_CONFLAGRATION,false); - conflagrate = 10000 + rand()%7 * 1000; - }else conflagrate -= diff; - break; - case 3: - if (summonadds < diff) - { - m_creature->InterruptNonMeleeSpells(false); - DoCast(m_creature,SPELL_SUMMON_PUMPKIN); - SaySound(SAY_SPROUTING_PUMPKINS); - summonadds = 25000 + rand()%11 *1000; - }else summonadds -= diff; - break; - } + if (withhead) + { + switch(Phase) + { + case 0: { + if (!IsFlying) + { + if (say_timer < diff) { + say_timer = 3000; + Player *plr = SelectRandomPlayer(100.0f,false); + if (count < 3) + plr->Say(Text[count].text,0); + else { + DoCast(m_creature,SPELL_RHYME_BIG); + plr->Say(Text[count].text,0); + plr->HandleEmoteCommand(ANIM_EMOTE_SHOUT); + wp_reached = true; + IsFlying = true; + count = 0; + break; + } + ++count; + }else say_timer -= diff; + }else{ + if (wp_reached) { + wp_reached = false; + m_creature->GetMotionMaster()->Clear(false); + m_creature->GetMotionMaster()->MovePoint(id,FlightPoint[id].x,FlightPoint[id].y,FlightPoint[id].z); + } + } + } + break; + case 1: + if(burned) break; + if(burn < diff) + { + Creature *flame = m_creature->SummonCreature(HELPER,Spawn[0].x,Spawn[0].y,Spawn[0].z,0,TEMPSUMMON_TIMED_DESPAWN,17000); + ((mob_wisp_invisAI*)flame->AI())->SetType(2); + burned = true; + }else burn -= diff; + break; + case 2: + if (conflagrate < diff) + { + Unit *plr = (Unit*)SelectRandomPlayer(30.0f); + if (plr) + m_creature->CastSpell(plr,SPELL_CONFLAGRATION,false); + conflagrate = 10000 + rand()%7 * 1000; + }else conflagrate -= diff; + break; + case 3: + if (summonadds < diff) + { + m_creature->InterruptNonMeleeSpells(false); + DoCast(m_creature,SPELL_SUMMON_PUMPKIN); + SaySound(SAY_SPROUTING_PUMPKINS); + summonadds = 25000 + rand()%11 *1000; + }else summonadds -= diff; + break; + } - if (laugh < diff) { - laugh = 11000 + rand()%12 * 1000; - DoTextEmote("laughts",NULL); - DoPlaySoundToSet(m_creature, RandomLaught[rand()%3]); - } else laugh -= diff; + if (laugh < diff) { + laugh = 11000 + rand()%12 * 1000; + DoTextEmote("laughts",NULL); + DoPlaySoundToSet(m_creature, RandomLaught[rand()%3]); + } else laugh -= diff; - if (UpdateVictim()) - { - DoMeleeAttackIfReady(); - if (cleave < diff) { - DoCast(m_creature->getVictim(),SPELL_CLEAVE); - cleave = 2000*(1 + rand()%3); //1 cleave per 2.0-6.0sec - } else cleave -= diff; - } + if (UpdateVictim()) + { + DoMeleeAttackIfReady(); + if (cleave < diff) { + DoCast(m_creature->getVictim(),SPELL_CLEAVE); + cleave = 2000*(1 + rand()%3); //1 cleave per 2.0-6.0sec + } else cleave -= diff; + } - } else { + } else { - if (regen < diff) - { - regen = 1000; //"body calls head" - if (m_creature->GetHealth()/m_creature->GetMaxHealth() == 1 && !returned) - { - if (Phase > 1) --Phase; - else Phase = 1; - Creature* Head = (Creature*)Unit::GetUnit((*m_creature), headGUID); - if (Head && Head->isAlive()) - { - ((mob_headAI*)Head->AI())->Phase = Phase; - ((mob_headAI*)Head->AI())->Disappear(); - } - return; - } - } - else regen -= diff; + if (regen < diff) + { + regen = 1000; //"body calls head" + if (m_creature->GetHealth()/m_creature->GetMaxHealth() == 1 && !returned) + { + if (Phase > 1) --Phase; + else Phase = 1; + Creature* Head = (Creature*)Unit::GetUnit((*m_creature), headGUID); + if (Head && Head->isAlive()) + { + ((mob_headAI*)Head->AI())->Phase = Phase; + ((mob_headAI*)Head->AI())->Disappear(); + } + return; + } + } + else regen -= diff; - if (whirlwind < diff) - { - whirlwind = 4000 + rand()%5 * 1000; - if (rand()%2) { - m_creature->RemoveAurasDueToSpell(SPELL_CONFUSE); - DoCast(m_creature,SPELL_WHIRLWIND,true); - DoCast(m_creature,SPELL_CONFUSE); - }else - m_creature->RemoveAurasDueToSpell(SPELL_WHIRLWIND); - }else whirlwind -= diff; - } + if (whirlwind < diff) + { + whirlwind = 4000 + rand()%5 * 1000; + if (rand()%2) { + m_creature->RemoveAurasDueToSpell(SPELL_CONFUSE); + DoCast(m_creature,SPELL_WHIRLWIND,true); + DoCast(m_creature,SPELL_CONFUSE); + }else + m_creature->RemoveAurasDueToSpell(SPELL_WHIRLWIND); + }else whirlwind -= diff; + } } }; void mob_headAI::Disappear() { - if (withbody) - return; - if (bodyGUID) - { - Creature *body = (Creature*)Unit::GetUnit((*m_creature), bodyGUID); - if(body && body->isAlive()) - { - withbody = true; - m_creature->RemoveAllAuras(); - body->RemoveAurasDueToSpell(SPELL_IMMUNE);//hack, SpellHit doesn't calls if body has immune aura - DoCast(body,SPELL_FLYING_HEAD); - m_creature->SetHealth(m_creature->GetMaxHealth()); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->GetMotionMaster()->MoveIdle(); - m_creature->StopMoving(); - ((boss_headless_horsemanAI*)body->AI())->returned = true; - } - } + if (withbody) + return; + if (bodyGUID) + { + Creature *body = (Creature*)Unit::GetUnit((*m_creature), bodyGUID); + if(body && body->isAlive()) + { + withbody = true; + m_creature->RemoveAllAuras(); + body->RemoveAurasDueToSpell(SPELL_IMMUNE);//hack, SpellHit doesn't calls if body has immune aura + DoCast(body,SPELL_FLYING_HEAD); + m_creature->SetHealth(m_creature->GetMaxHealth()); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->GetMotionMaster()->MoveIdle(); + m_creature->StopMoving(); + ((boss_headless_horsemanAI*)body->AI())->returned = true; + } + } } struct TRINITY_DLL_DECL mob_pulsing_pumpkinAI : public ScriptedAI { - mob_pulsing_pumpkinAI(Creature *c) : ScriptedAI(c) {Reset();} + mob_pulsing_pumpkinAI(Creature *c) : ScriptedAI(c) {Reset();} - bool sprouted; - uint64 debuffGUID; + bool sprouted; + uint64 debuffGUID; - void Reset() - { - float x, y, z; - m_creature->GetPosition(x, y, z); //this visual aura some under ground - m_creature->Relocate(x,y,z + 0.35f); - Despawn(); - Creature *debuff = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,14500); - debuff->SetDisplayId(m_creature->GetDisplayId()); - debuff->CastSpell(debuff,SPELL_PUMPKIN_AURA_GREEN,false); - ((mob_wisp_invisAI*)debuff->AI())->SetType(1); - debuffGUID = debuff->GetGUID(); - sprouted = false; - DoCast(m_creature,SPELL_PUMPKIN_AURA,true); - DoCast(m_creature,SPELL_SPROUTING); - m_creature->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_ROTATE); - } + void Reset() + { + float x, y, z; + m_creature->GetPosition(x, y, z); //this visual aura some under ground + m_creature->Relocate(x,y,z + 0.35f); + Despawn(); + Creature *debuff = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,14500); + debuff->SetDisplayId(m_creature->GetDisplayId()); + debuff->CastSpell(debuff,SPELL_PUMPKIN_AURA_GREEN,false); + ((mob_wisp_invisAI*)debuff->AI())->SetType(1); + debuffGUID = debuff->GetGUID(); + sprouted = false; + DoCast(m_creature,SPELL_PUMPKIN_AURA,true); + DoCast(m_creature,SPELL_SPROUTING); + m_creature->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_ROTATE); + } - void Aggro(Unit *who){} + void Aggro(Unit *who){} - void SpellHit(Unit *caster, const SpellEntry *spell) - { - if (spell->Id == SPELL_SPROUTING) - { - sprouted = true; - m_creature->RemoveAllAuras(); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_ROTATE); - DoCast(m_creature,SPELL_SPROUT_BODY,true); - m_creature->UpdateEntry(PUMPKIN_FIEND); - DoStartMovement(m_creature->getVictim()); - } - } + void SpellHit(Unit *caster, const SpellEntry *spell) + { + if (spell->Id == SPELL_SPROUTING) + { + sprouted = true; + m_creature->RemoveAllAuras(); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_ROTATE); + DoCast(m_creature,SPELL_SPROUT_BODY,true); + m_creature->UpdateEntry(PUMPKIN_FIEND); + DoStartMovement(m_creature->getVictim()); + } + } - void Despawn() - { - if (!debuffGUID) return; - Unit *debuff = Unit::GetUnit((*m_creature),debuffGUID); - if(debuff) - debuff->SetVisibility(VISIBILITY_OFF); - debuffGUID = 0; - } + void Despawn() + { + if (!debuffGUID) return; + Unit *debuff = Unit::GetUnit((*m_creature),debuffGUID); + if(debuff) + debuff->SetVisibility(VISIBILITY_OFF); + debuffGUID = 0; + } - void JustDied(Unit *killer) {if(!sprouted) Despawn();} + void JustDied(Unit *killer) {if(!sprouted) Despawn();} - void MoveInLineOfSight(Unit *who) - { - if (!who || !who->isTargetableForAttack() || !m_creature->IsHostileTo(who) || m_creature->getVictim()) - return; + void MoveInLineOfSight(Unit *who) + { + if (!who || !who->isTargetableForAttack() || !m_creature->IsHostileTo(who) || m_creature->getVictim()) + return; - m_creature->AddThreat(who,0.0f); - if(sprouted) - DoStartMovement(who); - } + m_creature->AddThreat(who,0.0f); + if(sprouted) + DoStartMovement(who); + } void UpdateAI(const uint32 diff) { - if (sprouted) - if (UpdateVictim()) - DoMeleeAttackIfReady(); - } + if (sprouted) + if (UpdateVictim()) + DoMeleeAttackIfReady(); + } }; bool GOHello_go_loosely_turned_soil(Player *plr, GameObject* soil) { -/* if (soil->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER && plr->getLevel() > 64) - { - plr->PrepareQuestMenu(soil->GetGUID()); - plr->SendPreparedQuest(soil->GetGUID()); - } - if (plr->GetQuestStatus(11405) == QUEST_STATUS_INCOMPLETE && plr->getLevel() > 64) - { */ - plr->AreaExploredOrEventHappens(11405); - Creature *horseman = soil->SummonCreature(HH_MOUNTED,FlightPoint[20].x,FlightPoint[20].y,FlightPoint[20].z,0,TEMPSUMMON_MANUAL_DESPAWN,0); - ((boss_headless_horsemanAI*)horseman->AI())->playerGUID = plr->GetGUID(); - ((boss_headless_horsemanAI*)horseman->AI())->FlyMode(); - //} - return true; +/* if (soil->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER && plr->getLevel() > 64) + { + plr->PrepareQuestMenu(soil->GetGUID()); + plr->SendPreparedQuest(soil->GetGUID()); + } + if (plr->GetQuestStatus(11405) == QUEST_STATUS_INCOMPLETE && plr->getLevel() > 64) + { */ + plr->AreaExploredOrEventHappens(11405); + Creature *horseman = soil->SummonCreature(HH_MOUNTED,FlightPoint[20].x,FlightPoint[20].y,FlightPoint[20].z,0,TEMPSUMMON_MANUAL_DESPAWN,0); + ((boss_headless_horsemanAI*)horseman->AI())->playerGUID = plr->GetGUID(); + ((boss_headless_horsemanAI*)horseman->AI())->FlyMode(); + //} + return true; } CreatureAI* GetAI_mob_head(Creature *_Creature) @@ -844,8 +844,8 @@ void AddSC_boss_headless_horseman() newscript->GetAI = &GetAI_mob_wisp_invis; newscript->RegisterSelf(); - newscript = new Script; - newscript->Name = "go_loosely_turned_soil"; - newscript->pGOHello = &GOHello_go_loosely_turned_soil; + newscript = new Script; + newscript->Name = "go_loosely_turned_soil"; + newscript->pGOHello = &GOHello_go_loosely_turned_soil; newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_herod.cpp b/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_herod.cpp index 2bfc66f38df..9cd9b930ba2 100644 --- a/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_herod.cpp +++ b/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_herod.cpp @@ -42,7 +42,7 @@ struct TRINITY_DLL_DECL boss_herodAI : public ScriptedAI { boss_herodAI(Creature *c) : ScriptedAI(c) {Reset();} - bool Enrage; + bool Enrage; uint32 Cleave_Timer; uint32 Whirlwind_Timer; @@ -50,40 +50,40 @@ struct TRINITY_DLL_DECL boss_herodAI : public ScriptedAI void Reset() { - Enrage = false; + Enrage = false; Cleave_Timer = 12000; Whirlwind_Timer = 60000; } void Aggro(Unit *who) { - DoScriptText(SAY_AGGRO, m_creature); - DoCast(m_creature,SPELL_RUSHINGCHARGE); + DoScriptText(SAY_AGGRO, m_creature); + DoCast(m_creature,SPELL_RUSHINGCHARGE); } - void KilledUnit(Unit *victim) - { - DoScriptText(SAY_KILL, m_creature); - } + void KilledUnit(Unit *victim) + { + DoScriptText(SAY_KILL, m_creature); + } - void JustDied(Unit* killer) - { - for(uint8 i = 0; i < 20; ++i) - m_creature->SummonCreature(ENTRY_SCARLET_TRAINEE, 1939.18, -431.58, 17.09, 6.22, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); - } + void JustDied(Unit* killer) + { + for(uint8 i = 0; i < 20; ++i) + m_creature->SummonCreature(ENTRY_SCARLET_TRAINEE, 1939.18, -431.58, 17.09, 6.22, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); + } void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - //If we are <30% hp goes Enraged - if (!Enrage && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 30 && !m_creature->IsNonMeleeSpellCasted(false)) - { - DoScriptText(EMOTE_ENRAGE, m_creature); - DoScriptText(SAY_ENRAGE, m_creature); + //If we are <30% hp goes Enraged + if (!Enrage && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 30 && !m_creature->IsNonMeleeSpellCasted(false)) + { + DoScriptText(EMOTE_ENRAGE, m_creature); + DoScriptText(SAY_ENRAGE, m_creature); DoCast(m_creature,SPELL_FRENZY); - Enrage = true; + Enrage = true; } //Cleave_Timer @@ -93,10 +93,10 @@ struct TRINITY_DLL_DECL boss_herodAI : public ScriptedAI Cleave_Timer = 12000; }else Cleave_Timer -= diff; - // Whirlwind_Timer + // Whirlwind_Timer if (Whirlwind_Timer < diff) { - DoScriptText(SAY_WHIRLWIND, m_creature); + DoScriptText(SAY_WHIRLWIND, m_creature); DoCast(m_creature->getVictim(),SPELL_WHIRLWIND); Whirlwind_Timer = 30000; }else Whirlwind_Timer -= diff; @@ -112,63 +112,63 @@ CreatureAI* GetAI_boss_herod(Creature *_Creature) float Location[12][3]= { - {1945.81, -431.54, 16.36}, - {1946.21, -436.41, 16.36}, - {1950.01, -444.11, 14.63}, - {1956.08, -449.34, 13.12}, - {1966.59, -450.55, 11.27}, - {1976.09, -447.51, 11.27}, - {1983.42, -435.85, 11.27}, - {1978.17, -428.81, 11.27}, - {1973.97, -422.08, 9.04}, - {1963.84, -418.90, 6.17}, - {1961.22, -422.74, 6.17}, - {1964.80, -431.26, 6.17} + {1945.81, -431.54, 16.36}, + {1946.21, -436.41, 16.36}, + {1950.01, -444.11, 14.63}, + {1956.08, -449.34, 13.12}, + {1966.59, -450.55, 11.27}, + {1976.09, -447.51, 11.27}, + {1983.42, -435.85, 11.27}, + {1978.17, -428.81, 11.27}, + {1973.97, -422.08, 9.04}, + {1963.84, -418.90, 6.17}, + {1961.22, -422.74, 6.17}, + {1964.80, -431.26, 6.17} }; uint32 Wait[12][1]= { - {0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{600000} + {0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{600000} }; struct TRINITY_DLL_DECL mob_scarlet_traineeAI : public npc_escortAI { - mob_scarlet_traineeAI(Creature *c) : npc_escortAI(c) {Reset();} + mob_scarlet_traineeAI(Creature *c) : npc_escortAI(c) {Reset();} - uint32 Start_Timer; + uint32 Start_Timer; - void WaypointReached(uint32 i) { } + void WaypointReached(uint32 i) { } - void Reset() - { - Start_Timer = urand(1500,4500); - } + void Reset() + { + Start_Timer = urand(1500,4500); + } - void Aggro(Unit* who) { } + void Aggro(Unit* who) { } - void UpdateAI(const uint32 diff) - { - if (Start_Timer) - { - if (Start_Timer < diff) - { - Start(true,true,true); - Start_Timer = 0; - }else Start_Timer -= diff; - } + void UpdateAI(const uint32 diff) + { + if (Start_Timer) + { + if (Start_Timer < diff) + { + Start(true,true,true); + Start_Timer = 0; + }else Start_Timer -= diff; + } - npc_escortAI::UpdateAI(diff); - } + npc_escortAI::UpdateAI(diff); + } }; CreatureAI* GetAI_mob_scarlet_trainee(Creature* _Creature) { - mob_scarlet_traineeAI* thisAI = new mob_scarlet_traineeAI(_Creature); + mob_scarlet_traineeAI* thisAI = new mob_scarlet_traineeAI(_Creature); - for(uint32 i = 0; i < 12; ++i) - thisAI->AddWaypoint(i, Location[i][0], Location[i][1], Location[i][2], Wait[i][0]); + for(uint32 i = 0; i < 12; ++i) + thisAI->AddWaypoint(i, Location[i][0], Location[i][1], Location[i][2], Wait[i][0]); - return ((CreatureAI*)thisAI); + return ((CreatureAI*)thisAI); } void AddSC_boss_herod() @@ -179,8 +179,8 @@ void AddSC_boss_herod() newscript->GetAI = &GetAI_boss_herod; newscript->RegisterSelf(); - newscript = new Script; - newscript->Name = "mob_scarlet_trainee"; - newscript->GetAI = &GetAI_mob_scarlet_trainee; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name = "mob_scarlet_trainee"; + newscript->GetAI = &GetAI_mob_scarlet_trainee; + newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/scarlet_monastery/instance_scarlet_monastery.cpp b/src/bindings/scripts/scripts/zone/scarlet_monastery/instance_scarlet_monastery.cpp index fdf12f2fd2f..953ae804e39 100644 --- a/src/bindings/scripts/scripts/zone/scarlet_monastery/instance_scarlet_monastery.cpp +++ b/src/bindings/scripts/scripts/zone/scarlet_monastery/instance_scarlet_monastery.cpp @@ -25,10 +25,10 @@ EndScriptData */ #include "def_scarlet_monastery.h" #include "sc_creature.h" -#define ENTRY_PUMPKIN_SHRINE 186267 -#define ENTRY_HORSEMAN 23682 -#define ENTRY_HEAD 23775 -#define ENTRY_PUMPKIN 23694 +#define ENTRY_PUMPKIN_SHRINE 186267 +#define ENTRY_HORSEMAN 23682 +#define ENTRY_HEAD 23775 +#define ENTRY_PUMPKIN 23694 #define ENCOUNTERS 1 @@ -37,102 +37,102 @@ struct TRINITY_DLL_DECL instance_scarlet_monastery : public ScriptedInstance instance_scarlet_monastery(Map *Map) : ScriptedInstance(Map) {Initialize();}; uint64 PumpkinShrineGUID; - uint64 HorsemanGUID; - uint64 HeadGUID; - std::set HorsemanAdds; + uint64 HorsemanGUID; + uint64 HeadGUID; + std::set HorsemanAdds; - uint64 MograineGUID; - uint64 WhitemaneGUID; - uint64 DoorHighInquisitorGUID; + uint64 MograineGUID; + uint64 WhitemaneGUID; + uint64 DoorHighInquisitorGUID; - uint32 Encounter[ENCOUNTERS]; + uint32 Encounter[ENCOUNTERS]; void Initialize() { PumpkinShrineGUID = 0; - HorsemanGUID = 0; - HeadGUID = 0; - HorsemanAdds.clear(); + HorsemanGUID = 0; + HeadGUID = 0; + HorsemanAdds.clear(); - MograineGUID = 0; - WhitemaneGUID = 0; - DoorHighInquisitorGUID = 0; + MograineGUID = 0; + WhitemaneGUID = 0; + DoorHighInquisitorGUID = 0; - for(uint8 i = 0; i < ENCOUNTERS; i++) - Encounter[i] = NOT_STARTED; + for(uint8 i = 0; i < ENCOUNTERS; i++) + Encounter[i] = NOT_STARTED; } void OnObjectCreate(GameObject *go) { switch(go->GetEntry()) { - case ENTRY_PUMPKIN_SHRINE: PumpkinShrineGUID = go->GetGUID();break; - case 104600: DoorHighInquisitorGUID = go->GetGUID(); break; + case ENTRY_PUMPKIN_SHRINE: PumpkinShrineGUID = go->GetGUID();break; + case 104600: DoorHighInquisitorGUID = go->GetGUID(); break; } } - void OnCreatureCreate(Creature *creature, uint32 creature_entry) + void OnCreatureCreate(Creature *creature, uint32 creature_entry) { switch(creature_entry) { - case ENTRY_HORSEMAN: HorsemanGUID = creature->GetGUID(); break; - case ENTRY_HEAD: HeadGUID = creature->GetGUID(); break; - case ENTRY_PUMPKIN: HorsemanAdds.insert(creature->GetGUID());break; - case 3976: MograineGUID = creature->GetGUID(); break; - case 3977: WhitemaneGUID = creature->GetGUID(); break; + case ENTRY_HORSEMAN: HorsemanGUID = creature->GetGUID(); break; + case ENTRY_HEAD: HeadGUID = creature->GetGUID(); break; + case ENTRY_PUMPKIN: HorsemanAdds.insert(creature->GetGUID());break; + case 3976: MograineGUID = creature->GetGUID(); break; + case 3977: WhitemaneGUID = creature->GetGUID(); break; } } void SetData(uint32 type, uint32 data) { - switch(type) + switch(type) { - case TYPE_MOGRAINE_AND_WHITE_EVENT: Encounter[0] = data; break; - case GAMEOBJECT_PUMPKIN_SHRINE: - { - GameObject *Shrine = instance->GetGameObjectInMap(PumpkinShrineGUID); - if(Shrine) - Shrine->SetUInt32Value(GAMEOBJECT_STATE,1); - }break; - case DATA_HORSEMAN_EVENT: - if (data == DONE) - { - for(std::set::iterator itr = HorsemanAdds.begin(); itr != HorsemanAdds.end(); ++itr) - { - Creature* add = instance->GetCreatureInMap(*itr); - if(add && add->isAlive()) - add->DealDamage(add, add->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } - HorsemanAdds.clear(); - GameObject *Shrine = instance->GetGameObjectInMap(PumpkinShrineGUID); - if(Shrine) - Shrine->SetUInt32Value(GAMEOBJECT_STATE,1); - } - break; + case TYPE_MOGRAINE_AND_WHITE_EVENT: Encounter[0] = data; break; + case GAMEOBJECT_PUMPKIN_SHRINE: + { + GameObject *Shrine = instance->GetGameObjectInMap(PumpkinShrineGUID); + if(Shrine) + Shrine->SetUInt32Value(GAMEOBJECT_STATE,1); + }break; + case DATA_HORSEMAN_EVENT: + if (data == DONE) + { + for(std::set::iterator itr = HorsemanAdds.begin(); itr != HorsemanAdds.end(); ++itr) + { + Creature* add = instance->GetCreatureInMap(*itr); + if(add && add->isAlive()) + add->DealDamage(add, add->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } + HorsemanAdds.clear(); + GameObject *Shrine = instance->GetGameObjectInMap(PumpkinShrineGUID); + if(Shrine) + Shrine->SetUInt32Value(GAMEOBJECT_STATE,1); + } + break; } } - uint64 GetData64(uint32 type) - { + uint64 GetData64(uint32 type) + { switch(type) { - //case GAMEOBJECT_PUMPKIN_SHRINE: return PumpkinShrineGUID; - //case DATA_HORSEMAN: return HorsemanGUID; - //case DATA_HEAD: return HeadGUID; - case DATA_MOGRAINE: return MograineGUID; - case DATA_WHITEMANE: return WhitemaneGUID; - case DATA_DOOR_WHITEMANE: return DoorHighInquisitorGUID; + //case GAMEOBJECT_PUMPKIN_SHRINE: return PumpkinShrineGUID; + //case DATA_HORSEMAN: return HorsemanGUID; + //case DATA_HEAD: return HeadGUID; + case DATA_MOGRAINE: return MograineGUID; + case DATA_WHITEMANE: return WhitemaneGUID; + case DATA_DOOR_WHITEMANE: return DoorHighInquisitorGUID; } - return 0; - } + return 0; + } - uint32 GetData(uint32 type) - { - if (type == TYPE_MOGRAINE_AND_WHITE_EVENT) - return Encounter[0]; + uint32 GetData(uint32 type) + { + if (type == TYPE_MOGRAINE_AND_WHITE_EVENT) + return Encounter[0]; - return 0; - } + return 0; + } }; InstanceData* GetInstanceData_instance_scarlet_monastery(Map* map) diff --git a/src/bindings/scripts/scripts/zone/shadowfang_keep/instance_shadowfang_keep.cpp b/src/bindings/scripts/scripts/zone/shadowfang_keep/instance_shadowfang_keep.cpp index ca63a3338f8..07fbeb0d54f 100644 --- a/src/bindings/scripts/scripts/zone/shadowfang_keep/instance_shadowfang_keep.cpp +++ b/src/bindings/scripts/scripts/zone/shadowfang_keep/instance_shadowfang_keep.cpp @@ -31,7 +31,7 @@ struct TRINITY_DLL_DECL instance_shadowfang_keep : public ScriptedInstance instance_shadowfang_keep(Map *map) : ScriptedInstance(map) {Initialize();}; uint32 Encounter[ENCOUNTERS]; - std::string str_data; + std::string str_data; uint64 DoorCourtyardGUID; uint64 DoorSorcererGUID; @@ -43,49 +43,49 @@ struct TRINITY_DLL_DECL instance_shadowfang_keep : public ScriptedInstance DoorSorcererGUID = 0; DoorArugalGUID = 0; - for(uint8 i=0; i < ENCOUNTERS; ++i) - Encounter[i] = NOT_STARTED; + for(uint8 i=0; i < ENCOUNTERS; ++i) + Encounter[i] = NOT_STARTED; } - Player* GetPlayerInMap() - { - Map::PlayerList const& players = instance->GetPlayers(); + Player* GetPlayerInMap() + { + Map::PlayerList const& players = instance->GetPlayers(); - if (!players.isEmpty()) - { - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - if (Player* plr = itr->getSource()) - return plr; - } - } - debug_log("TSCR: Instance Shadowfang Keep: GetPlayerInMap, but PlayerList is empty!"); - return NULL; - } + if (!players.isEmpty()) + { + for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* plr = itr->getSource()) + return plr; + } + } + debug_log("TSCR: Instance Shadowfang Keep: GetPlayerInMap, but PlayerList is empty!"); + return NULL; + } void OnObjectCreate(GameObject *go) { switch(go->GetEntry()) { - case 18895: DoorCourtyardGUID = go->GetGUID(); break; - case 18972: DoorSorcererGUID = go->GetGUID(); break; - case 18971: DoorArugalGUID = go->GetGUID(); break; + case 18895: DoorCourtyardGUID = go->GetGUID(); break; + case 18972: DoorSorcererGUID = go->GetGUID(); break; + case 18971: DoorArugalGUID = go->GetGUID(); break; } } - void HandleGameObject(uint64 guid, uint32 state) - { - Player *player = GetPlayerInMap(); + void HandleGameObject(uint64 guid, uint32 state) + { + Player *player = GetPlayerInMap(); - if (!player || !guid) - { - debug_log("SD2: Instance Shadowfang Keep: HandleGameObject fail"); - return; - } + if (!player || !guid) + { + debug_log("SD2: Instance Shadowfang Keep: HandleGameObject fail"); + return; + } - if (GameObject *go = GameObject::GetGameObject(*player,guid)) - go->SetGoState(state); - } + if (GameObject *go = GameObject::GetGameObject(*player,guid)) + go->SetGoState(state); + } void SetData(uint32 type, uint32 data) { @@ -101,7 +101,7 @@ struct TRINITY_DLL_DECL instance_shadowfang_keep : public ScriptedInstance break; case TYPE_FENRUS: if(data == DONE) - HandleGameObject(DoorSorcererGUID,0); + HandleGameObject(DoorSorcererGUID,0); Encounter[2] = data; break; case TYPE_NANDOS: @@ -111,18 +111,18 @@ struct TRINITY_DLL_DECL instance_shadowfang_keep : public ScriptedInstance break; } - if (data == DONE) - { - OUT_SAVE_INST_DATA; + if (data == DONE) + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << Encounter[0] << " " << Encounter[1] << " " << Encounter[2] << " " << Encounter[3]; + std::ostringstream saveStream; + saveStream << Encounter[0] << " " << Encounter[1] << " " << Encounter[2] << " " << Encounter[3]; - str_data = saveStream.str(); + str_data = saveStream.str(); - SaveToDB(); - OUT_SAVE_INST_DATA_COMPLETE; - } + SaveToDB(); + OUT_SAVE_INST_DATA_COMPLETE; + } } uint32 GetData(uint32 type) @@ -141,30 +141,30 @@ struct TRINITY_DLL_DECL instance_shadowfang_keep : public ScriptedInstance return 0; } - const char* Save() - { - return str_data.c_str(); - } + const char* Save() + { + return str_data.c_str(); + } - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - std::istringstream loadStream(in); - loadStream >> Encounter[0] >> Encounter[1] >> Encounter[2] >> Encounter[3]; + std::istringstream loadStream(in); + loadStream >> Encounter[0] >> Encounter[1] >> Encounter[2] >> Encounter[3]; - for(uint8 i = 0; i < ENCOUNTERS; ++i) - if (Encounter[i] == IN_PROGRESS) - Encounter[i] = NOT_STARTED; + for(uint8 i = 0; i < ENCOUNTERS; ++i) + if (Encounter[i] == IN_PROGRESS) + Encounter[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; - } + OUT_LOAD_INST_DATA_COMPLETE; + } }; InstanceData* GetInstanceData_instance_shadowfang_keep(Map* map) diff --git a/src/bindings/scripts/scripts/zone/shadowfang_keep/shadowfang_keep.cpp b/src/bindings/scripts/scripts/zone/shadowfang_keep/shadowfang_keep.cpp index 4fa7baa2561..1d00385a076 100644 --- a/src/bindings/scripts/scripts/zone/shadowfang_keep/shadowfang_keep.cpp +++ b/src/bindings/scripts/scripts/zone/shadowfang_keep/shadowfang_keep.cpp @@ -85,11 +85,11 @@ bool GossipHello_npc_shadowfang_prisoner(Player *player, Creature *_Creature) { ScriptedInstance* pInstance = ((ScriptedInstance*)_Creature->GetInstanceData()); - if (!pInstance) - return false; + if (!pInstance) + return false; - if (pInstance->GetData(TYPE_FREE_NPC) != DONE && pInstance->GetData(TYPE_RETHILGORE) == DONE) - player->ADD_GOSSIP_ITEM( 0, GOSSIP_ITEM_DOOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + if (pInstance->GetData(TYPE_FREE_NPC) != DONE && pInstance->GetData(TYPE_RETHILGORE) == DONE) + player->ADD_GOSSIP_ITEM( 0, GOSSIP_ITEM_DOOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); @@ -101,7 +101,7 @@ bool GossipSelect_npc_shadowfang_prisoner(Player *player, Creature *_Creature, u if (action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); - ((npc_escortAI*)(_Creature->AI()))->Start(false, false, false); + ((npc_escortAI*)(_Creature->AI()))->Start(false, false, false); } return true; } diff --git a/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp b/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp index eb929787f5f..4d4f0f69799 100644 --- a/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp +++ b/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp @@ -826,13 +826,13 @@ return new npc_overlord_morghorAI(_Creature); bool QuestAccept_npc_overlord_morghor(Player *player, Creature *_Creature, const Quest *_Quest ) { - if(_Quest->GetQuestId() == QUEST_LORD_ILLIDAN_STORMRAGE) - { + if(_Quest->GetQuestId() == QUEST_LORD_ILLIDAN_STORMRAGE) + { ((npc_overlord_morghorAI*)_Creature->AI())->PlayerGUID = player->GetGUID(); ((npc_overlord_morghorAI*)_Creature->AI())->StartEvent(); - return true; - } - return false; + return true; + } + return false; } /*#### @@ -1771,10 +1771,10 @@ void AddSC_shadowmoon_valley() newscript->GetAI = &GetAI_mob_enslaved_netherwing_drake; newscript->RegisterSelf(); - newscript = new Script; - newscript->Name = "mob_dragonmaw_peon"; - newscript->GetAI = &GetAI_mob_dragonmaw_peon; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name = "mob_dragonmaw_peon"; + newscript->GetAI = &GetAI_mob_dragonmaw_peon; + newscript->RegisterSelf(); newscript = new Script; newscript->Name="npc_drake_dealer_hurlunk"; @@ -1811,13 +1811,13 @@ void AddSC_shadowmoon_valley() newscript->pGossipSelect = &GossipSelect_npc_oronok_tornheart; newscript->RegisterSelf(); - newscript = new Script; - newscript->Name = "npc_overlord_morghor"; - newscript->GetAI = &GetAI_npc_overlord_morghorAI; - newscript->pQuestAccept = &QuestAccept_npc_overlord_morghor; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name = "npc_overlord_morghor"; + newscript->GetAI = &GetAI_npc_overlord_morghorAI; + newscript->pQuestAccept = &QuestAccept_npc_overlord_morghor; + newscript->RegisterSelf(); - newscript = new Script; + newscript = new Script; newscript->Name = "npc_earthmender_wilda"; newscript->GetAI = &GetAI_npc_earthmender_wildaAI; newscript->pQuestAccept = &QuestAccept_npc_earthmender_wilda; diff --git a/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp b/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp index 4c560066b85..ce86aa21b1f 100644 --- a/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp +++ b/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp @@ -416,168 +416,168 @@ CreatureAI* GetAI_npc_kservantAI(Creature *_Creature) # npc_dirty_larry ######*/ -#define GOSSIP_BOOK "Ezekiel said that you might have a certain book..." +#define GOSSIP_BOOK "Ezekiel said that you might have a certain book..." -#define SAY_1 -1000328 -#define SAY_2 -1000329 -#define SAY_3 -1000330 -#define SAY_4 -1000331 -#define SAY_5 -1000332 -#define SAY_GIVEUP -1000333 +#define SAY_1 -1000328 +#define SAY_2 -1000329 +#define SAY_3 -1000330 +#define SAY_4 -1000331 +#define SAY_5 -1000332 +#define SAY_GIVEUP -1000333 -#define QUEST_WBI 10231 -#define NPC_CREEPJACK 19726 -#define NPC_MALONE 19725 +#define QUEST_WBI 10231 +#define NPC_CREEPJACK 19726 +#define NPC_MALONE 19725 struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI { - npc_dirty_larryAI(Creature* c) : ScriptedAI(c) {Reset();} + npc_dirty_larryAI(Creature* c) : ScriptedAI(c) {Reset();} - bool Event; - bool Attack; - bool Done; + bool Event; + bool Attack; + bool Done; - uint64 PlayerGUID; + uint64 PlayerGUID; - uint32 SayTimer; - uint32 Step; + uint32 SayTimer; + uint32 Step; - void Reset() - { - Event = false; - Attack = false; - Done = false; + void Reset() + { + Event = false; + Attack = false; + Done = false; - PlayerGUID = 0; - SayTimer = 0; - Step = 0; + PlayerGUID = 0; + SayTimer = 0; + Step = 0; - m_creature->setFaction(1194); - Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20, m_creature); - if(Creepjack) - { - ((Creature*)Creepjack)->AI()->EnterEvadeMode(); - Creepjack->setFaction(1194); - } - Unit* Malone = FindCreature(NPC_MALONE, 20, m_creature); - if(Malone) - { - ((Creature*)Malone)->AI()->EnterEvadeMode(); - Malone->setFaction(1194); - } - } + m_creature->setFaction(1194); + Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20, m_creature); + if(Creepjack) + { + ((Creature*)Creepjack)->AI()->EnterEvadeMode(); + Creepjack->setFaction(1194); + } + Unit* Malone = FindCreature(NPC_MALONE, 20, m_creature); + if(Malone) + { + ((Creature*)Malone)->AI()->EnterEvadeMode(); + Malone->setFaction(1194); + } + } - uint32 NextStep(uint32 Step) - { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + uint32 NextStep(uint32 Step) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - switch(Step) - { - case 0:{ m_creature->SetInFront(player); - Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20, m_creature); - if(Creepjack) - Creepjack->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - Unit* Malone = FindCreature(NPC_MALONE, 20, m_creature); - if(Malone) - Malone->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); }return 2000; - case 1: DoScriptText(SAY_1, m_creature, player); return 3000; - case 2: DoScriptText(SAY_2, m_creature, player); return 5000; - case 3: DoScriptText(SAY_3, m_creature, player); return 2000; - case 4: DoScriptText(SAY_4, m_creature, player); return 2000; - case 5: DoScriptText(SAY_5, m_creature, player); return 2000; - case 6: Attack = true; return 2000; - default: return 0; - } - } + switch(Step) + { + case 0:{ m_creature->SetInFront(player); + Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20, m_creature); + if(Creepjack) + Creepjack->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + Unit* Malone = FindCreature(NPC_MALONE, 20, m_creature); + if(Malone) + Malone->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); }return 2000; + case 1: DoScriptText(SAY_1, m_creature, player); return 3000; + case 2: DoScriptText(SAY_2, m_creature, player); return 5000; + case 3: DoScriptText(SAY_3, m_creature, player); return 2000; + case 4: DoScriptText(SAY_4, m_creature, player); return 2000; + case 5: DoScriptText(SAY_5, m_creature, player); return 2000; + case 6: Attack = true; return 2000; + default: return 0; + } + } - void Aggro(Unit* who){} + void Aggro(Unit* who){} - void UpdateAI(const uint32 diff) - { - if(SayTimer < diff) + void UpdateAI(const uint32 diff) + { + if(SayTimer < diff) { if(Event) SayTimer = NextStep(++Step); }else SayTimer -= diff; - if(Attack) - { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - m_creature->setFaction(14); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if(player) - { - Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20, m_creature); - if(Creepjack) - { - Creepjack->Attack(player, true); - Creepjack->setFaction(14); - Creepjack->GetMotionMaster()->MoveChase(player); - } - Unit* Malone = FindCreature(NPC_MALONE, 20, m_creature); - if(Malone) - { - Malone->Attack(player, true); - Malone->setFaction(14); - Malone->GetMotionMaster()->MoveChase(player); - } - DoStartMovement(player); - AttackStart(player); - } - Attack = false; - } + if(Attack) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + m_creature->setFaction(14); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if(player) + { + Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20, m_creature); + if(Creepjack) + { + Creepjack->Attack(player, true); + Creepjack->setFaction(14); + Creepjack->GetMotionMaster()->MoveChase(player); + } + Unit* Malone = FindCreature(NPC_MALONE, 20, m_creature); + if(Malone) + { + Malone->Attack(player, true); + Malone->setFaction(14); + Malone->GetMotionMaster()->MoveChase(player); + } + DoStartMovement(player); + AttackStart(player); + } + Attack = false; + } - if((m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 1 && !Done) - { - Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20, m_creature); - if(Creepjack) - { - ((Creature*)Creepjack)->AI()->EnterEvadeMode(); - Creepjack->setFaction(1194); - } - Unit* Malone = FindCreature(NPC_MALONE, 20, m_creature); - if(Malone) - { - ((Creature*)Malone)->AI()->EnterEvadeMode(); - Malone->setFaction(1194); - } - m_creature->setFaction(1194); - Done = true; - DoScriptText(SAY_GIVEUP, m_creature, NULL); - m_creature->DeleteThreatList(); - m_creature->CombatStop(); - m_creature->GetMotionMaster()->MoveTargetedHome(); - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - if(player) - ((Player*)player)->GroupEventHappens(QUEST_WBI, m_creature); - } - DoMeleeAttackIfReady(); - } + if((m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 1 && !Done) + { + Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20, m_creature); + if(Creepjack) + { + ((Creature*)Creepjack)->AI()->EnterEvadeMode(); + Creepjack->setFaction(1194); + } + Unit* Malone = FindCreature(NPC_MALONE, 20, m_creature); + if(Malone) + { + ((Creature*)Malone)->AI()->EnterEvadeMode(); + Malone->setFaction(1194); + } + m_creature->setFaction(1194); + Done = true; + DoScriptText(SAY_GIVEUP, m_creature, NULL); + m_creature->DeleteThreatList(); + m_creature->CombatStop(); + m_creature->GetMotionMaster()->MoveTargetedHome(); + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + if(player) + ((Player*)player)->GroupEventHappens(QUEST_WBI, m_creature); + } + DoMeleeAttackIfReady(); + } }; bool GossipHello_npc_dirty_larry(Player *player, Creature *creature) { - if (creature->isQuestGiver()) + if (creature->isQuestGiver()) player->PrepareQuestMenu(creature->GetGUID()); - if(player->GetQuestStatus(QUEST_WBI) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(0, GOSSIP_BOOK, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + if(player->GetQuestStatus(QUEST_WBI) == QUEST_STATUS_INCOMPLETE) + player->ADD_GOSSIP_ITEM(0, GOSSIP_BOOK, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->SEND_GOSSIP_MENU(creature->GetNpcTextId(), creature->GetGUID()); - return true; + player->SEND_GOSSIP_MENU(creature->GetNpcTextId(), creature->GetGUID()); + return true; } bool GossipSelect_npc_dirty_larry(Player *player, Creature *creature, uint32 sender, uint32 action ) { - if (action == GOSSIP_ACTION_INFO_DEF+1) - { - ((npc_dirty_larryAI*)creature->AI())->Event = true; - ((npc_dirty_larryAI*)creature->AI())->PlayerGUID = player->GetGUID(); - player->CLOSE_GOSSIP_MENU(); - } + if (action == GOSSIP_ACTION_INFO_DEF+1) + { + ((npc_dirty_larryAI*)creature->AI())->Event = true; + ((npc_dirty_larryAI*)creature->AI())->PlayerGUID = player->GetGUID(); + player->CLOSE_GOSSIP_MENU(); + } - return true; + return true; } CreatureAI* GetAI_npc_dirty_larryAI(Creature *_Creature) @@ -594,8 +594,8 @@ CreatureAI* GetAI_npc_dirty_larryAI(Creature *_Creature) bool GossipHello_npc_ishanah(Player *player, Creature *_Creature) { - if (_Creature->isQuestGiver()) - player->PrepareQuestMenu(_Creature->GetGUID()); + if (_Creature->isQuestGiver()) + player->PrepareQuestMenu(_Creature->GetGUID()); player->ADD_GOSSIP_ITEM(0, ISANAH_GOSSIP_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->ADD_GOSSIP_ITEM(0, ISANAH_GOSSIP_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); @@ -619,60 +619,60 @@ bool GossipSelect_npc_ishanah(Player *player, Creature *_Creature, uint32 sender # npc_khadgar ######*/ -#define KHADGAR_GOSSIP_1 "I've heard your name spoken only in whispers, mage. Who are you?" -#define KHADGAR_GOSSIP_2 "Go on, please." -#define KHADGAR_GOSSIP_3 "I see." //6th too this -#define KHADGAR_GOSSIP_4 "What did you do then?" -#define KHADGAR_GOSSIP_5 "What happened next?" -#define KHADGAR_GOSSIP_7 "There was something else I wanted to ask you." +#define KHADGAR_GOSSIP_1 "I've heard your name spoken only in whispers, mage. Who are you?" +#define KHADGAR_GOSSIP_2 "Go on, please." +#define KHADGAR_GOSSIP_3 "I see." //6th too this +#define KHADGAR_GOSSIP_4 "What did you do then?" +#define KHADGAR_GOSSIP_5 "What happened next?" +#define KHADGAR_GOSSIP_7 "There was something else I wanted to ask you." bool GossipHello_npc_khadgar(Player *player, Creature *creature) { - if (creature->isQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); + if (creature->isQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); - if(!player->hasQuest(10211)) - player->ADD_GOSSIP_ITEM(0, KHADGAR_GOSSIP_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + if(!player->hasQuest(10211)) + player->ADD_GOSSIP_ITEM(0, KHADGAR_GOSSIP_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->SEND_GOSSIP_MENU(9243, creature->GetGUID()); + player->SEND_GOSSIP_MENU(9243, creature->GetGUID()); - return true; + return true; } bool GossipSelect_npc_khadgar(Player *player, Creature *creature, uint32 sender, uint32 action) { - switch(action) - { - case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(0, KHADGAR_GOSSIP_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - player->SEND_GOSSIP_MENU(9876, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM(0, KHADGAR_GOSSIP_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - player->SEND_GOSSIP_MENU(9877, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - player->ADD_GOSSIP_ITEM(0, KHADGAR_GOSSIP_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - player->SEND_GOSSIP_MENU(9878, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - player->ADD_GOSSIP_ITEM(0, KHADGAR_GOSSIP_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - player->SEND_GOSSIP_MENU(9879, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - player->ADD_GOSSIP_ITEM(0, KHADGAR_GOSSIP_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); - player->SEND_GOSSIP_MENU(9880, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - player->ADD_GOSSIP_ITEM(0, KHADGAR_GOSSIP_7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+7); - player->SEND_GOSSIP_MENU(9881, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+7: - player->ADD_GOSSIP_ITEM(0, KHADGAR_GOSSIP_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->SEND_GOSSIP_MENU(9243, creature->GetGUID()); - break; - } - return true; + switch(action) + { + case GOSSIP_ACTION_INFO_DEF+1: + player->ADD_GOSSIP_ITEM(0, KHADGAR_GOSSIP_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + player->SEND_GOSSIP_MENU(9876, creature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + player->ADD_GOSSIP_ITEM(0, KHADGAR_GOSSIP_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + player->SEND_GOSSIP_MENU(9877, creature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + player->ADD_GOSSIP_ITEM(0, KHADGAR_GOSSIP_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + player->SEND_GOSSIP_MENU(9878, creature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + player->ADD_GOSSIP_ITEM(0, KHADGAR_GOSSIP_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + player->SEND_GOSSIP_MENU(9879, creature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + player->ADD_GOSSIP_ITEM(0, KHADGAR_GOSSIP_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); + player->SEND_GOSSIP_MENU(9880, creature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+6: + player->ADD_GOSSIP_ITEM(0, KHADGAR_GOSSIP_7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+7); + player->SEND_GOSSIP_MENU(9881, creature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+7: + player->ADD_GOSSIP_ITEM(0, KHADGAR_GOSSIP_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->SEND_GOSSIP_MENU(9243, creature->GetGUID()); + break; + } + return true; } void AddSC_shattrath_city() @@ -708,22 +708,22 @@ void AddSC_shattrath_city() newscript->GetAI = &GetAI_npc_kservantAI; newscript->RegisterSelf(); - newscript = new Script; - newscript->Name="npc_dirty_larry"; - newscript->GetAI = &GetAI_npc_dirty_larryAI; - newscript->pGossipHello = &GossipHello_npc_dirty_larry; - newscript->pGossipSelect = &GossipSelect_npc_dirty_larry; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name="npc_dirty_larry"; + newscript->GetAI = &GetAI_npc_dirty_larryAI; + newscript->pGossipHello = &GossipHello_npc_dirty_larry; + newscript->pGossipSelect = &GossipSelect_npc_dirty_larry; + newscript->RegisterSelf(); - newscript = new Script; + newscript = new Script; newscript->Name="npc_ishanah"; newscript->pGossipHello = &GossipHello_npc_ishanah; newscript->pGossipSelect = &GossipSelect_npc_ishanah; newscript->RegisterSelf(); - newscript = new Script; - newscript->Name="npc_khadgar"; - newscript->pGossipHello = &GossipHello_npc_khadgar; + newscript = new Script; + newscript->Name="npc_khadgar"; + newscript->pGossipHello = &GossipHello_npc_khadgar; newscript->pGossipSelect = &GossipSelect_npc_khadgar; newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/silithus/silithus.cpp b/src/bindings/scripts/scripts/zone/silithus/silithus.cpp index 443a9a709c7..b2fb697811a 100644 --- a/src/bindings/scripts/scripts/zone/silithus/silithus.cpp +++ b/src/bindings/scripts/scripts/zone/silithus/silithus.cpp @@ -42,55 +42,55 @@ EndContentData */ bool GossipHello_npc_highlord_demitrian(Player *player, Creature *_Creature) { - if (_Creature->isQuestGiver()) - player->PrepareQuestMenu(_Creature->GetGUID()); + if (_Creature->isQuestGiver()) + player->PrepareQuestMenu(_Creature->GetGUID()); - if (player->GetQuestStatus(7785) == QUEST_STATUS_NONE && - (player->HasItemCount(18563,1,false) || player->HasItemCount(18564,1,false))) - player->ADD_GOSSIP_ITEM(0, GOSSIP_DEMITRIAN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + if (player->GetQuestStatus(7785) == QUEST_STATUS_NONE && + (player->HasItemCount(18563,1,false) || player->HasItemCount(18564,1,false))) + player->ADD_GOSSIP_ITEM(0, GOSSIP_DEMITRIAN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - player->SEND_GOSSIP_MENU(6812, _Creature->GetGUID()); - return true; + player->SEND_GOSSIP_MENU(6812, _Creature->GetGUID()); + return true; } bool GossipSelect_npc_highlord_demitrian(Player *player, Creature *_Creature, uint32 sender, uint32 action) { - switch (action) - { - case GOSSIP_ACTION_INFO_DEF: - player->ADD_GOSSIP_ITEM(0, GOSSIP_DEMITRIAN2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->SEND_GOSSIP_MENU(6842, _Creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(0, GOSSIP_DEMITRIAN3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - player->SEND_GOSSIP_MENU(6843, _Creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM(0, GOSSIP_DEMITRIAN4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - player->SEND_GOSSIP_MENU(6844, _Creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - player->ADD_GOSSIP_ITEM(0, GOSSIP_DEMITRIAN5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - player->SEND_GOSSIP_MENU(6867, _Creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - player->ADD_GOSSIP_ITEM(0, GOSSIP_DEMITRIAN6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - player->SEND_GOSSIP_MENU(6868, _Creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - player->ADD_GOSSIP_ITEM(0, GOSSIP_DEMITRIAN7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); - player->SEND_GOSSIP_MENU(6869, _Creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - player->SEND_GOSSIP_MENU(6870, _Creature->GetGUID()); + switch (action) + { + case GOSSIP_ACTION_INFO_DEF: + player->ADD_GOSSIP_ITEM(0, GOSSIP_DEMITRIAN2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->SEND_GOSSIP_MENU(6842, _Creature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + player->ADD_GOSSIP_ITEM(0, GOSSIP_DEMITRIAN3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + player->SEND_GOSSIP_MENU(6843, _Creature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + player->ADD_GOSSIP_ITEM(0, GOSSIP_DEMITRIAN4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + player->SEND_GOSSIP_MENU(6844, _Creature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + player->ADD_GOSSIP_ITEM(0, GOSSIP_DEMITRIAN5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + player->SEND_GOSSIP_MENU(6867, _Creature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + player->ADD_GOSSIP_ITEM(0, GOSSIP_DEMITRIAN6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + player->SEND_GOSSIP_MENU(6868, _Creature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + player->ADD_GOSSIP_ITEM(0, GOSSIP_DEMITRIAN7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); + player->SEND_GOSSIP_MENU(6869, _Creature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+6: + player->SEND_GOSSIP_MENU(6870, _Creature->GetGUID()); - ItemPosCountVec dest; - uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 19016, 1); - if (msg == EQUIP_ERR_OK) - player->StoreNewItem(dest, 19016, true); - break; - } - return true; + ItemPosCountVec dest; + uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 19016, 1); + if (msg == EQUIP_ERR_OK) + player->StoreNewItem(dest, 19016, true); + break; + } + return true; } /*### @@ -208,13 +208,13 @@ void AddSC_silithus() { Script *newscript; - newscript = new Script; - newscript->Name = "npc_highlord_demitrian"; - newscript->pGossipHello = &GossipHello_npc_highlord_demitrian; - newscript->pGossipSelect = &GossipSelect_npc_highlord_demitrian; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name = "npc_highlord_demitrian"; + newscript->pGossipHello = &GossipHello_npc_highlord_demitrian; + newscript->pGossipSelect = &GossipSelect_npc_highlord_demitrian; + newscript->RegisterSelf(); - newscript = new Script; + newscript = new Script; newscript->Name="npcs_rutgar_and_frankal"; newscript->pGossipHello = &GossipHello_npcs_rutgar_and_frankal; newscript->pGossipSelect = &GossipSelect_npcs_rutgar_and_frankal; diff --git a/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp b/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp index 05890cd67aa..73c708d4a21 100644 --- a/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp +++ b/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp @@ -91,86 +91,86 @@ bool GossipSelect_npc_astor_hadren(Player *player, Creature *_Creature, uint32 s ## npc_deathstalker_erland ######*/ -#define SAY_QUESTACCEPT -1000335 -#define SAY_START -1000336 -#define SAY_AGGRO_1 -1000337 -#define SAY_AGGRO_2 -1000338 -#define SAY_LAST -1000339 +#define SAY_QUESTACCEPT -1000335 +#define SAY_START -1000336 +#define SAY_AGGRO_1 -1000337 +#define SAY_AGGRO_2 -1000338 +#define SAY_LAST -1000339 -#define SAY_THANKS -1000340 -#define SAY_RANE -1000341 -#define SAY_ANSWER -1000342 -#define SAY_MOVE_QUINN -1000343 +#define SAY_THANKS -1000340 +#define SAY_RANE -1000341 +#define SAY_ANSWER -1000342 +#define SAY_MOVE_QUINN -1000343 -#define SAY_GREETINGS -1000344 -#define SAY_QUINN -1000345 -#define SAY_ON_BYE -1000346 +#define SAY_GREETINGS -1000344 +#define SAY_QUINN -1000345 +#define SAY_ON_BYE -1000346 -#define QUEST_ESCORTING 435 -#define NPC_RANE 1950 -#define NPC_QUINN 1951 +#define QUEST_ESCORTING 435 +#define NPC_RANE 1950 +#define NPC_QUINN 1951 struct TRINITY_DLL_DECL npc_deathstalker_erlandAI : public npc_escortAI { - npc_deathstalker_erlandAI(Creature *c) : npc_escortAI(c) {Reset();} + npc_deathstalker_erlandAI(Creature *c) : npc_escortAI(c) {Reset();} - void WaypointReached(uint32 i) - { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + void WaypointReached(uint32 i) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - if (!player) + if (!player) return; - switch(i) - { - case 1: DoScriptText(SAY_START, m_creature, player);break; - case 13: - DoScriptText(SAY_LAST, m_creature, player); + switch(i) + { + case 1: DoScriptText(SAY_START, m_creature, player);break; + case 13: + DoScriptText(SAY_LAST, m_creature, player); if(player) ((Player*)player)->GroupEventHappens(QUEST_ESCORTING, m_creature);break; - case 14: DoScriptText(SAY_THANKS, m_creature, player);break; - case 15: { - Unit* Rane = FindCreature(NPC_RANE, 20, m_creature); - if(Rane) - DoScriptText(SAY_RANE, Rane); - break;} - case 16: DoScriptText(SAY_ANSWER, m_creature);break; - case 17: DoScriptText(SAY_MOVE_QUINN, m_creature); break; - case 24: DoScriptText(SAY_GREETINGS, m_creature);break; - case 25: { - Unit* Quinn = FindCreature(NPC_QUINN, 20, m_creature); - if(Quinn) - DoScriptText(SAY_QUINN, Quinn); - break;} - case 26: DoScriptText(SAY_ON_BYE, m_creature, NULL);break; + case 14: DoScriptText(SAY_THANKS, m_creature, player);break; + case 15: { + Unit* Rane = FindCreature(NPC_RANE, 20, m_creature); + if(Rane) + DoScriptText(SAY_RANE, Rane); + break;} + case 16: DoScriptText(SAY_ANSWER, m_creature);break; + case 17: DoScriptText(SAY_MOVE_QUINN, m_creature); break; + case 24: DoScriptText(SAY_GREETINGS, m_creature);break; + case 25: { + Unit* Quinn = FindCreature(NPC_QUINN, 20, m_creature); + if(Quinn) + DoScriptText(SAY_QUINN, Quinn); + break;} + case 26: DoScriptText(SAY_ON_BYE, m_creature, NULL);break; - } - } + } + } - void Reset() {} + void Reset() {} - void Aggro(Unit* who) - { - switch(rand()%2) - { - case 0: DoScriptText(SAY_AGGRO_1, m_creature, who);break; - case 1: DoScriptText(SAY_AGGRO_2, m_creature, who);break; - } - } + void Aggro(Unit* who) + { + switch(rand()%2) + { + case 0: DoScriptText(SAY_AGGRO_1, m_creature, who);break; + case 1: DoScriptText(SAY_AGGRO_2, m_creature, who);break; + } + } - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + } }; bool QuestAccept_npc_deathstalker_erland(Player* player, Creature* creature, Quest const* quest) { if (quest->GetQuestId() == QUEST_ESCORTING) - { - DoScriptText(SAY_QUESTACCEPT, creature, player); - ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); - } + { + DoScriptText(SAY_QUESTACCEPT, creature, player); + ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); + } return true; } @@ -179,35 +179,35 @@ CreatureAI* GetAI_npc_deathstalker_erlandAI(Creature *_Creature) { npc_deathstalker_erlandAI* deathstalker_erlandAI = new npc_deathstalker_erlandAI(_Creature); - deathstalker_erlandAI->AddWaypoint(0, 1406.32, 1083.10, 52.55); - deathstalker_erlandAI->AddWaypoint(1, 1400.49, 1080.42, 52.50); //first say - deathstalker_erlandAI->AddWaypoint(2, 1388.48, 1083.10, 52.52); - deathstalker_erlandAI->AddWaypoint(3, 1370.16, 1084.02, 52.30); - deathstalker_erlandAI->AddWaypoint(4, 1359.02, 1080.85, 52.46); - deathstalker_erlandAI->AddWaypoint(5, 1341.43, 1087.39, 52.69); - deathstalker_erlandAI->AddWaypoint(6, 1321.93, 1090.51, 50.66); - deathstalker_erlandAI->AddWaypoint(7, 1312.98, 1095.91, 47.49); - deathstalker_erlandAI->AddWaypoint(8, 1301.09, 1102.94, 47.76); - deathstalker_erlandAI->AddWaypoint(9, 1297.73, 1106.35, 50.18); - deathstalker_erlandAI->AddWaypoint(10, 1295.49, 1124.32, 50.49); - deathstalker_erlandAI->AddWaypoint(11, 1294.84, 1137.25, 51.75); - deathstalker_erlandAI->AddWaypoint(12, 1292.89, 1158.99, 52.65); - deathstalker_erlandAI->AddWaypoint(13, 1290.75, 1168.67, 52.56, 1000); //complete quest and say last - deathstalker_erlandAI->AddWaypoint(14, 1287.12, 1203.49, 52.66, 5000); - deathstalker_erlandAI->AddWaypoint(15, 1287.12, 1203.49, 52.66, 4000); - deathstalker_erlandAI->AddWaypoint(16, 1287.12, 1203.49, 52.66, 5000); - deathstalker_erlandAI->AddWaypoint(17, 1287.12, 1203.49, 52.66, 4000); - deathstalker_erlandAI->AddWaypoint(18, 1290.72, 1207.44, 52.69); - deathstalker_erlandAI->AddWaypoint(19, 1297.50, 1207.18, 53.74); - deathstalker_erlandAI->AddWaypoint(20, 1301.32, 1220.90, 53.74); - deathstalker_erlandAI->AddWaypoint(21, 1298.55, 1220.43, 53.74); - deathstalker_erlandAI->AddWaypoint(22, 1297.59, 1211.23, 58.47); - deathstalker_erlandAI->AddWaypoint(23, 1305.01, 1206.10, 58.51); - deathstalker_erlandAI->AddWaypoint(24, 1310.51, 1207.36, 58.51, 5000); - deathstalker_erlandAI->AddWaypoint(25, 1310.51, 1207.36, 58.51, 5000); - deathstalker_erlandAI->AddWaypoint(26, 1310.51, 1207.36, 58.51, 2000); + deathstalker_erlandAI->AddWaypoint(0, 1406.32, 1083.10, 52.55); + deathstalker_erlandAI->AddWaypoint(1, 1400.49, 1080.42, 52.50); //first say + deathstalker_erlandAI->AddWaypoint(2, 1388.48, 1083.10, 52.52); + deathstalker_erlandAI->AddWaypoint(3, 1370.16, 1084.02, 52.30); + deathstalker_erlandAI->AddWaypoint(4, 1359.02, 1080.85, 52.46); + deathstalker_erlandAI->AddWaypoint(5, 1341.43, 1087.39, 52.69); + deathstalker_erlandAI->AddWaypoint(6, 1321.93, 1090.51, 50.66); + deathstalker_erlandAI->AddWaypoint(7, 1312.98, 1095.91, 47.49); + deathstalker_erlandAI->AddWaypoint(8, 1301.09, 1102.94, 47.76); + deathstalker_erlandAI->AddWaypoint(9, 1297.73, 1106.35, 50.18); + deathstalker_erlandAI->AddWaypoint(10, 1295.49, 1124.32, 50.49); + deathstalker_erlandAI->AddWaypoint(11, 1294.84, 1137.25, 51.75); + deathstalker_erlandAI->AddWaypoint(12, 1292.89, 1158.99, 52.65); + deathstalker_erlandAI->AddWaypoint(13, 1290.75, 1168.67, 52.56, 1000); //complete quest and say last + deathstalker_erlandAI->AddWaypoint(14, 1287.12, 1203.49, 52.66, 5000); + deathstalker_erlandAI->AddWaypoint(15, 1287.12, 1203.49, 52.66, 4000); + deathstalker_erlandAI->AddWaypoint(16, 1287.12, 1203.49, 52.66, 5000); + deathstalker_erlandAI->AddWaypoint(17, 1287.12, 1203.49, 52.66, 4000); + deathstalker_erlandAI->AddWaypoint(18, 1290.72, 1207.44, 52.69); + deathstalker_erlandAI->AddWaypoint(19, 1297.50, 1207.18, 53.74); + deathstalker_erlandAI->AddWaypoint(20, 1301.32, 1220.90, 53.74); + deathstalker_erlandAI->AddWaypoint(21, 1298.55, 1220.43, 53.74); + deathstalker_erlandAI->AddWaypoint(22, 1297.59, 1211.23, 58.47); + deathstalker_erlandAI->AddWaypoint(23, 1305.01, 1206.10, 58.51); + deathstalker_erlandAI->AddWaypoint(24, 1310.51, 1207.36, 58.51, 5000); + deathstalker_erlandAI->AddWaypoint(25, 1310.51, 1207.36, 58.51, 5000); + deathstalker_erlandAI->AddWaypoint(26, 1310.51, 1207.36, 58.51, 2000); - return (CreatureAI*)deathstalker_erlandAI; + return (CreatureAI*)deathstalker_erlandAI; } /*###### @@ -225,9 +225,9 @@ void AddSC_silverpine_forest() newscript->GetAI = &GetAI_npc_astor_hadren; newscript->RegisterSelf(); - newscript = new Script; - newscript->Name="npc_deathstalker_erland"; - newscript->GetAI = &GetAI_npc_deathstalker_erlandAI; - newscript->pQuestAccept = &QuestAccept_npc_deathstalker_erland; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name="npc_deathstalker_erland"; + newscript->GetAI = &GetAI_npc_deathstalker_erlandAI; + newscript->pQuestAccept = &QuestAccept_npc_deathstalker_erland; + newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp b/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp index 40d3a5c7b9d..b20998b5884 100644 --- a/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp +++ b/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp @@ -80,65 +80,65 @@ bool GossipSelect_npc_braug_dimspirit(Player *player, Creature *_Creature, uint3 ## npc_kaya_flathoof ######*/ -#define SAY_START -1000347 -#define SAY_AMBUSH -1000348 -#define SAY_END -1000349 +#define SAY_START -1000347 +#define SAY_AMBUSH -1000348 +#define SAY_END -1000349 -#define QUEST_PK 6523 -#define MOB_GB 11912 -#define MOB_GR 11910 -#define MOB_GS 11913 +#define QUEST_PK 6523 +#define MOB_GB 11912 +#define MOB_GR 11910 +#define MOB_GS 11913 struct TRINITY_DLL_DECL npc_kaya_flathoofAI : public npc_escortAI { - npc_kaya_flathoofAI(Creature* c) : npc_escortAI(c) {Reset();} + npc_kaya_flathoofAI(Creature* c) : npc_escortAI(c) {Reset();} - void WaypointReached(uint32 i) - { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + void WaypointReached(uint32 i) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - if(!player) - return; + if(!player) + return; - switch(i) - { - case 22: - DoScriptText(SAY_AMBUSH, m_creature); - m_creature->SummonCreature(MOB_GB, -48.53, -503.34, -46.31, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - m_creature->SummonCreature(MOB_GR, -38.85, -503.77, -45.90, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - m_creature->SummonCreature(MOB_GS, -36.37, -496.23, -45.71, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - break; - case 23: m_creature->SetInFront(player); - DoScriptText(SAY_END, m_creature, player); - if (player && player->GetTypeId() == TYPEID_PLAYER) - ((Player*)player)->GroupEventHappens(QUEST_PK, m_creature); - break; - } - } + switch(i) + { + case 22: + DoScriptText(SAY_AMBUSH, m_creature); + m_creature->SummonCreature(MOB_GB, -48.53, -503.34, -46.31, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + m_creature->SummonCreature(MOB_GR, -38.85, -503.77, -45.90, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + m_creature->SummonCreature(MOB_GS, -36.37, -496.23, -45.71, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + case 23: m_creature->SetInFront(player); + DoScriptText(SAY_END, m_creature, player); + if (player && player->GetTypeId() == TYPEID_PLAYER) + ((Player*)player)->GroupEventHappens(QUEST_PK, m_creature); + break; + } + } - void JustSummoned(Creature* summoned) + void JustSummoned(Creature* summoned) { summoned->AI()->AttackStart(m_creature); } - void Reset(){} + void Reset(){} - void Aggro(Unit* who){} + void Aggro(Unit* who){} - void JustDied(Unit* killer) - { - if (PlayerGUID) + void JustDied(Unit* killer) + { + if (PlayerGUID) { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); if (player) ((Player*)player)->FailQuest(QUEST_PK); } - } + } - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + } }; bool QuestAccept_npc_kaya_flathoof(Player* player, Creature* creature, Quest const* quest) @@ -146,43 +146,43 @@ bool QuestAccept_npc_kaya_flathoof(Player* player, Creature* creature, Quest con if (quest->GetQuestId() == QUEST_PK) { ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); - DoScriptText(SAY_START, creature); - creature->setFaction(113); - creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); + DoScriptText(SAY_START, creature); + creature->setFaction(113); + creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); } return true; } CreatureAI* GetAI_npc_kaya_flathoofAI(Creature *_Creature) { - npc_kaya_flathoofAI* thisAI = new npc_kaya_flathoofAI(_Creature); + npc_kaya_flathoofAI* thisAI = new npc_kaya_flathoofAI(_Creature); - thisAI->AddWaypoint(0, 122.37, -345.80, 3.59); - thisAI->AddWaypoint(1, 113.69, -350.01, 4.54); - thisAI->AddWaypoint(2, 107.32, -353.09, 3.33); - thisAI->AddWaypoint(3, 99.25, -342.43, 2.87); - thisAI->AddWaypoint(4, 111.19, -315.60, 3.71); - thisAI->AddWaypoint(5, 109.99, -293.92, 5.16); - thisAI->AddWaypoint(6, 104.59, -268.27, 4.78); - thisAI->AddWaypoint(7, 82.80, -247.28, 5.73); - thisAI->AddWaypoint(8, 66.44, -245.99, 5.85); - thisAI->AddWaypoint(9, 34.36, -246.01, 5.97); - thisAI->AddWaypoint(10, 13.24, -245.61, 5.25); - thisAI->AddWaypoint(11, -10.27, -248.66, 4.69); - thisAI->AddWaypoint(12, -26.07, -262.76, 0.01); - thisAI->AddWaypoint(13, -33.15, -282.03, -4.12); - thisAI->AddWaypoint(14, -28.42, -315.52, -8.56); - thisAI->AddWaypoint(15, -32.05, -339.34, -10.84); - thisAI->AddWaypoint(16, -35.22, -358.11, -16.20); - thisAI->AddWaypoint(17, -51.57, -391.63, -24.85); - thisAI->AddWaypoint(18, -58.58, -409.08, -29.97); - thisAI->AddWaypoint(19, -60.37, -441.23, -36.80); - thisAI->AddWaypoint(20, -59.03, -476.39, -44.98); - thisAI->AddWaypoint(21, -53.18, -490.31, -46.11); - thisAI->AddWaypoint(22, -43.77, -497.99, -46.13, 3000);// summon - thisAI->AddWaypoint(23, -41.77, -518.15, -46.13, 5000);//end + thisAI->AddWaypoint(0, 122.37, -345.80, 3.59); + thisAI->AddWaypoint(1, 113.69, -350.01, 4.54); + thisAI->AddWaypoint(2, 107.32, -353.09, 3.33); + thisAI->AddWaypoint(3, 99.25, -342.43, 2.87); + thisAI->AddWaypoint(4, 111.19, -315.60, 3.71); + thisAI->AddWaypoint(5, 109.99, -293.92, 5.16); + thisAI->AddWaypoint(6, 104.59, -268.27, 4.78); + thisAI->AddWaypoint(7, 82.80, -247.28, 5.73); + thisAI->AddWaypoint(8, 66.44, -245.99, 5.85); + thisAI->AddWaypoint(9, 34.36, -246.01, 5.97); + thisAI->AddWaypoint(10, 13.24, -245.61, 5.25); + thisAI->AddWaypoint(11, -10.27, -248.66, 4.69); + thisAI->AddWaypoint(12, -26.07, -262.76, 0.01); + thisAI->AddWaypoint(13, -33.15, -282.03, -4.12); + thisAI->AddWaypoint(14, -28.42, -315.52, -8.56); + thisAI->AddWaypoint(15, -32.05, -339.34, -10.84); + thisAI->AddWaypoint(16, -35.22, -358.11, -16.20); + thisAI->AddWaypoint(17, -51.57, -391.63, -24.85); + thisAI->AddWaypoint(18, -58.58, -409.08, -29.97); + thisAI->AddWaypoint(19, -60.37, -441.23, -36.80); + thisAI->AddWaypoint(20, -59.03, -476.39, -44.98); + thisAI->AddWaypoint(21, -53.18, -490.31, -46.11); + thisAI->AddWaypoint(22, -43.77, -497.99, -46.13, 3000);// summon + thisAI->AddWaypoint(23, -41.77, -518.15, -46.13, 5000);//end - return (CreatureAI*)thisAI; + return (CreatureAI*)thisAI; } /*###### @@ -199,9 +199,9 @@ void AddSC_stonetalon_mountains() newscript->pGossipSelect = &GossipSelect_npc_braug_dimspirit; newscript->RegisterSelf(); - newscript = new Script; - newscript->Name="npc_kaya_flathoof"; - newscript->GetAI = &GetAI_npc_kaya_flathoofAI; - newscript->pQuestAccept = &QuestAccept_npc_kaya_flathoof; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name="npc_kaya_flathoof"; + newscript->GetAI = &GetAI_npc_kaya_flathoofAI; + newscript->pQuestAccept = &QuestAccept_npc_kaya_flathoof; + newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/stranglethorn_vale/stranglethorn_vale.cpp b/src/bindings/scripts/scripts/zone/stranglethorn_vale/stranglethorn_vale.cpp index 0eb90f5702e..e517a17d766 100644 --- a/src/bindings/scripts/scripts/zone/stranglethorn_vale/stranglethorn_vale.cpp +++ b/src/bindings/scripts/scripts/zone/stranglethorn_vale/stranglethorn_vale.cpp @@ -72,8 +72,8 @@ struct TRINITY_DLL_DECL mob_yennikuAI : public ScriptedAI void UpdateAI(const uint32 diff) { if (bReset) - { - if(Reset_Timer < diff) + { + if(Reset_Timer < diff) { EnterEvadeMode(); bReset = false; diff --git a/src/bindings/scripts/scripts/zone/stratholme/boss_baron_rivendare.cpp b/src/bindings/scripts/scripts/zone/stratholme/boss_baron_rivendare.cpp index 48eb910dd4b..4a49dae13bc 100644 --- a/src/bindings/scripts/scripts/zone/stratholme/boss_baron_rivendare.cpp +++ b/src/bindings/scripts/scripts/zone/stratholme/boss_baron_rivendare.cpp @@ -77,13 +77,13 @@ EndScriptData */ struct TRINITY_DLL_DECL boss_baron_rivendareAI : public ScriptedAI { - boss_baron_rivendareAI(Creature *c) : ScriptedAI(c) - { - pInstance = (ScriptedInstance*)m_creature->GetInstanceData(); - Reset(); - } + boss_baron_rivendareAI(Creature *c) : ScriptedAI(c) + { + pInstance = (ScriptedInstance*)m_creature->GetInstanceData(); + Reset(); + } - ScriptedInstance* pInstance; + ScriptedInstance* pInstance; uint32 ShadowBolt_Timer; uint32 Cleave_Timer; @@ -103,21 +103,21 @@ struct TRINITY_DLL_DECL boss_baron_rivendareAI : public ScriptedAI void Aggro(Unit *who) { - if (pInstance) - pInstance->SetData(TYPE_BARON,IN_PROGRESS); + if (pInstance) + pInstance->SetData(TYPE_BARON,IN_PROGRESS); } - void JustSummoned(Creature* summoned) - { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) - summoned->AI()->AttackStart(target); - } + void JustSummoned(Creature* summoned) + { + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + summoned->AI()->AttackStart(target); + } - void JustDied(Unit* Killer) - { - if (pInstance) - pInstance->SetData(TYPE_BARON,DONE); - } + void JustDied(Unit* Killer) + { + if (pInstance) + pInstance->SetData(TYPE_BARON,DONE); + } void UpdateAI(const uint32 diff) { @@ -127,7 +127,7 @@ struct TRINITY_DLL_DECL boss_baron_rivendareAI : public ScriptedAI //ShadowBolt if (ShadowBolt_Timer < diff) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(m_creature->getVictim(),SPELL_SHADOWBOLT); ShadowBolt_Timer = 10000; @@ -136,7 +136,7 @@ struct TRINITY_DLL_DECL boss_baron_rivendareAI : public ScriptedAI //Cleave if (Cleave_Timer < diff) { - DoCast(m_creature->getVictim(),SPELL_CLEAVE); + DoCast(m_creature->getVictim(),SPELL_CLEAVE); //13 seconds until we should cast this again Cleave_Timer = 7000 + (rand()%10000); }else Cleave_Timer -= diff; @@ -144,26 +144,26 @@ struct TRINITY_DLL_DECL boss_baron_rivendareAI : public ScriptedAI //MortalStrike if (MortalStrike_Timer < diff) { - DoCast(m_creature->getVictim(),SPELL_MORTALSTRIKE); - MortalStrike_Timer = 10000 + (rand()%15000); + DoCast(m_creature->getVictim(),SPELL_MORTALSTRIKE); + MortalStrike_Timer = 10000 + (rand()%15000); }else MortalStrike_Timer -= diff; //RaiseDead // if (RaiseDead_Timer < diff) - // { - // DoCast(m_creature,SPELL_RAISEDEAD); + // { + // DoCast(m_creature,SPELL_RAISEDEAD); // RaiseDead_Timer = 45000; // }else RaiseDead_Timer -= diff; //SummonSkeletons if (SummonSkeletons_Timer < diff) { - m_creature->SummonCreature(11197,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,29000); - m_creature->SummonCreature(11197,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,29000); - m_creature->SummonCreature(11197,ADD_3X,ADD_3Y,ADD_3Z,ADD_3O,TEMPSUMMON_TIMED_DESPAWN,29000); - m_creature->SummonCreature(11197,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,29000); - m_creature->SummonCreature(11197,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,29000); - m_creature->SummonCreature(11197,ADD_6X,ADD_6Y,ADD_6Z,ADD_6O,TEMPSUMMON_TIMED_DESPAWN,29000); + m_creature->SummonCreature(11197,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,29000); + m_creature->SummonCreature(11197,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,29000); + m_creature->SummonCreature(11197,ADD_3X,ADD_3Y,ADD_3Z,ADD_3O,TEMPSUMMON_TIMED_DESPAWN,29000); + m_creature->SummonCreature(11197,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,29000); + m_creature->SummonCreature(11197,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,29000); + m_creature->SummonCreature(11197,ADD_6X,ADD_6Y,ADD_6Z,ADD_6O,TEMPSUMMON_TIMED_DESPAWN,29000); //34 seconds until we should cast this again SummonSkeletons_Timer = 40000; diff --git a/src/bindings/scripts/scripts/zone/stratholme/boss_baroness_anastari.cpp b/src/bindings/scripts/scripts/zone/stratholme/boss_baroness_anastari.cpp index 438d7f6501b..108ae8bb9d3 100644 --- a/src/bindings/scripts/scripts/zone/stratholme/boss_baroness_anastari.cpp +++ b/src/bindings/scripts/scripts/zone/stratholme/boss_baroness_anastari.cpp @@ -31,13 +31,13 @@ EndScriptData */ struct TRINITY_DLL_DECL boss_baroness_anastariAI : public ScriptedAI { - boss_baroness_anastariAI(Creature *c) : ScriptedAI(c) - { - pInstance = (ScriptedInstance*)m_creature->GetInstanceData(); - Reset(); - } + boss_baroness_anastariAI(Creature *c) : ScriptedAI(c) + { + pInstance = (ScriptedInstance*)m_creature->GetInstanceData(); + Reset(); + } - ScriptedInstance* pInstance; + ScriptedInstance* pInstance; uint32 BansheeWail_Timer; uint32 BansheeCurse_Timer; @@ -56,11 +56,11 @@ struct TRINITY_DLL_DECL boss_baroness_anastariAI : public ScriptedAI { } - void JustDied(Unit* Killer) - { - if (pInstance) - pInstance->SetData(TYPE_BARONESS,IN_PROGRESS); - } + void JustDied(Unit* Killer) + { + if (pInstance) + pInstance->SetData(TYPE_BARONESS,IN_PROGRESS); + } void UpdateAI(const uint32 diff) { @@ -70,8 +70,8 @@ struct TRINITY_DLL_DECL boss_baroness_anastariAI : public ScriptedAI //BansheeWail if (BansheeWail_Timer < diff) { - if (rand()%100 < 95) - DoCast(m_creature->getVictim(),SPELL_BANSHEEWAIL); + if (rand()%100 < 95) + DoCast(m_creature->getVictim(),SPELL_BANSHEEWAIL); //4 seconds until we should cast this again BansheeWail_Timer = 4000; }else BansheeWail_Timer -= diff; @@ -88,8 +88,8 @@ struct TRINITY_DLL_DECL boss_baroness_anastariAI : public ScriptedAI //Silence if (Silence_Timer < diff) { - if (rand()%100 < 80) - DoCast(m_creature->getVictim(),SPELL_SILENCE); + if (rand()%100 < 80) + DoCast(m_creature->getVictim(),SPELL_SILENCE); //13 seconds until we should cast this again Silence_Timer = 13000; }else Silence_Timer -= diff; diff --git a/src/bindings/scripts/scripts/zone/stratholme/boss_magistrate_barthilas.cpp b/src/bindings/scripts/scripts/zone/stratholme/boss_magistrate_barthilas.cpp index 89f1cafcaaa..95f2a5670dc 100644 --- a/src/bindings/scripts/scripts/zone/stratholme/boss_magistrate_barthilas.cpp +++ b/src/bindings/scripts/scripts/zone/stratholme/boss_magistrate_barthilas.cpp @@ -34,45 +34,45 @@ EndScriptData */ struct TRINITY_DLL_DECL boss_magistrate_barthilasAI : public ScriptedAI { - boss_magistrate_barthilasAI(Creature *c) : ScriptedAI(c) - { - pInstance = (ScriptedInstance*)m_creature->GetInstanceData(); - Reset(); - } + boss_magistrate_barthilasAI(Creature *c) : ScriptedAI(c) + { + pInstance = (ScriptedInstance*)m_creature->GetInstanceData(); + Reset(); + } - ScriptedInstance* pInstance; + ScriptedInstance* pInstance; uint32 DrainingBlow_Timer; uint32 CrowdPummel_Timer; uint32 MightyBlow_Timer; uint32 FuriousAnger_Timer; - uint32 AngerCount; + uint32 AngerCount; void Reset() { - DrainingBlow_Timer = 20000; - CrowdPummel_Timer = 15000; - MightyBlow_Timer = 10000; - FuriousAnger_Timer = 5000; - AngerCount = 0; + DrainingBlow_Timer = 20000; + CrowdPummel_Timer = 15000; + MightyBlow_Timer = 10000; + FuriousAnger_Timer = 5000; + AngerCount = 0; - if (m_creature->isAlive()) - m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_NORMAL); - else - m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_HUMAN); - } + if (m_creature->isAlive()) + m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_NORMAL); + else + m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_HUMAN); + } - void MoveInLineOfSight(Unit *who) - { - //nothing to see here yet + void MoveInLineOfSight(Unit *who) + { + //nothing to see here yet - ScriptedAI::MoveInLineOfSight(who); - } + ScriptedAI::MoveInLineOfSight(who); + } - void JustDied(Unit* Killer) - { - m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_HUMAN); - } + void JustDied(Unit* Killer) + { + m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_HUMAN); + } void Aggro(Unit *who) { @@ -84,35 +84,35 @@ struct TRINITY_DLL_DECL boss_magistrate_barthilasAI : public ScriptedAI if (!UpdateVictim()) return; - if (FuriousAnger_Timer < diff) - { - FuriousAnger_Timer = 4000; - if (AngerCount > 25) - return; + if (FuriousAnger_Timer < diff) + { + FuriousAnger_Timer = 4000; + if (AngerCount > 25) + return; - ++AngerCount; - m_creature->CastSpell(m_creature,SPELL_FURIOUS_ANGER,false); - }else FuriousAnger_Timer -= diff; + ++AngerCount; + m_creature->CastSpell(m_creature,SPELL_FURIOUS_ANGER,false); + }else FuriousAnger_Timer -= diff; //DrainingBlow if (DrainingBlow_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_DRAININGBLOW); - DrainingBlow_Timer = 15000; + DrainingBlow_Timer = 15000; }else DrainingBlow_Timer -= diff; //CrowdPummel if (CrowdPummel_Timer < diff) { - DoCast(m_creature->getVictim(),SPELL_CROWDPUMMEL); - CrowdPummel_Timer = 15000; + DoCast(m_creature->getVictim(),SPELL_CROWDPUMMEL); + CrowdPummel_Timer = 15000; }else CrowdPummel_Timer -= diff; //MightyBlow if (MightyBlow_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_MIGHTYBLOW); - MightyBlow_Timer = 20000; + MightyBlow_Timer = 20000; }else MightyBlow_Timer -= diff; DoMeleeAttackIfReady(); diff --git a/src/bindings/scripts/scripts/zone/stratholme/boss_maleki_the_pallid.cpp b/src/bindings/scripts/scripts/zone/stratholme/boss_maleki_the_pallid.cpp index f980df57c5e..7e3d8340c4e 100644 --- a/src/bindings/scripts/scripts/zone/stratholme/boss_maleki_the_pallid.cpp +++ b/src/bindings/scripts/scripts/zone/stratholme/boss_maleki_the_pallid.cpp @@ -31,13 +31,13 @@ EndScriptData */ struct TRINITY_DLL_DECL boss_maleki_the_pallidAI : public ScriptedAI { - boss_maleki_the_pallidAI(Creature *c) : ScriptedAI(c) - { - pInstance = (ScriptedInstance*)m_creature->GetInstanceData(); - Reset(); - } + boss_maleki_the_pallidAI(Creature *c) : ScriptedAI(c) + { + pInstance = (ScriptedInstance*)m_creature->GetInstanceData(); + Reset(); + } - ScriptedInstance* pInstance; + ScriptedInstance* pInstance; uint32 Frostbolt_Timer; uint32 IceTomb_Timer; @@ -54,11 +54,11 @@ struct TRINITY_DLL_DECL boss_maleki_the_pallidAI : public ScriptedAI { } - void JustDied(Unit* Killer) - { - if (pInstance) - pInstance->SetData(TYPE_PALLID,IN_PROGRESS); - } + void JustDied(Unit* Killer) + { + if (pInstance) + pInstance->SetData(TYPE_PALLID,IN_PROGRESS); + } void UpdateAI(const uint32 diff) { diff --git a/src/bindings/scripts/scripts/zone/stratholme/boss_nerubenkan.cpp b/src/bindings/scripts/scripts/zone/stratholme/boss_nerubenkan.cpp index 57fa122e6c0..a9441c6008f 100644 --- a/src/bindings/scripts/scripts/zone/stratholme/boss_nerubenkan.cpp +++ b/src/bindings/scripts/scripts/zone/stratholme/boss_nerubenkan.cpp @@ -31,13 +31,13 @@ EndScriptData */ struct TRINITY_DLL_DECL boss_nerubenkanAI : public ScriptedAI { - boss_nerubenkanAI(Creature *c) : ScriptedAI(c) - { - pInstance = (ScriptedInstance*)m_creature->GetInstanceData(); - Reset(); - } + boss_nerubenkanAI(Creature *c) : ScriptedAI(c) + { + pInstance = (ScriptedInstance*)m_creature->GetInstanceData(); + Reset(); + } - ScriptedInstance* pInstance; + ScriptedInstance* pInstance; uint32 EncasingWebs_Timer; uint32 PierceArmor_Timer; @@ -60,11 +60,11 @@ struct TRINITY_DLL_DECL boss_nerubenkanAI : public ScriptedAI { } - void JustDied(Unit* Killer) - { - if (pInstance) - pInstance->SetData(TYPE_NERUB,IN_PROGRESS); - } + void JustDied(Unit* Killer) + { + if (pInstance) + pInstance->SetData(TYPE_NERUB,IN_PROGRESS); + } void RaiseUndeadScarab(Unit* victim) { diff --git a/src/bindings/scripts/scripts/zone/stratholme/boss_ramstein_the_gorger.cpp b/src/bindings/scripts/scripts/zone/stratholme/boss_ramstein_the_gorger.cpp index 2f2186f5749..5984a60ac9c 100644 --- a/src/bindings/scripts/scripts/zone/stratholme/boss_ramstein_the_gorger.cpp +++ b/src/bindings/scripts/scripts/zone/stratholme/boss_ramstein_the_gorger.cpp @@ -31,13 +31,13 @@ EndScriptData */ struct TRINITY_DLL_DECL boss_ramstein_the_gorgerAI : public ScriptedAI { - boss_ramstein_the_gorgerAI(Creature *c) : ScriptedAI(c) - { - pInstance = (ScriptedInstance*)m_creature->GetInstanceData(); - Reset(); - } + boss_ramstein_the_gorgerAI(Creature *c) : ScriptedAI(c) + { + pInstance = (ScriptedInstance*)m_creature->GetInstanceData(); + Reset(); + } - ScriptedInstance* pInstance; + ScriptedInstance* pInstance; uint32 Trample_Timer; uint32 Knockout_Timer; @@ -52,14 +52,14 @@ struct TRINITY_DLL_DECL boss_ramstein_the_gorgerAI : public ScriptedAI { } - void JustDied(Unit* Killer) - { - for(uint8 i = 0; i < 30; i++) - m_creature->SummonCreature(C_MINDLESS_UNDEAD,3969.35,-3391.87,119.11,5.91,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000); + void JustDied(Unit* Killer) + { + for(uint8 i = 0; i < 30; i++) + m_creature->SummonCreature(C_MINDLESS_UNDEAD,3969.35,-3391.87,119.11,5.91,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000); - if (pInstance) - pInstance->SetData(TYPE_RAMSTEIN,DONE); - } + if (pInstance) + pInstance->SetData(TYPE_RAMSTEIN,DONE); + } void UpdateAI(const uint32 diff) { @@ -77,7 +77,7 @@ struct TRINITY_DLL_DECL boss_ramstein_the_gorgerAI : public ScriptedAI //Knockout if (Knockout_Timer < diff) { - DoCast(m_creature->getVictim(),SPELL_KNOCKOUT); + DoCast(m_creature->getVictim(),SPELL_KNOCKOUT); Knockout_Timer = 10000; }else Knockout_Timer -= diff; diff --git a/src/bindings/scripts/scripts/zone/stratholme/instance_stratholme.cpp b/src/bindings/scripts/scripts/zone/stratholme/instance_stratholme.cpp index fbabfa7b3f8..108bfd1dbc0 100644 --- a/src/bindings/scripts/scripts/zone/stratholme/instance_stratholme.cpp +++ b/src/bindings/scripts/scripts/zone/stratholme/instance_stratholme.cpp @@ -51,332 +51,332 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance { instance_stratholme(Map *map) : ScriptedInstance(map) {Initialize();}; - uint32 Encounter[ENCOUNTERS]; + uint32 Encounter[ENCOUNTERS]; - bool IsSilverHandDead[5]; + bool IsSilverHandDead[5]; - uint32 BaronRun_Timer; - uint32 SlaugtherSquare_Timer; + uint32 BaronRun_Timer; + uint32 SlaugtherSquare_Timer; - uint64 serviceEntranceGUID; - uint64 gauntletGate1GUID; - uint64 ziggurat1GUID; - uint64 ziggurat2GUID; - uint64 ziggurat3GUID; - uint64 ziggurat4GUID; - uint64 ziggurat5GUID; - uint64 portGauntletGUID; - uint64 portSlaugtherGUID; - uint64 portElderGUID; + uint64 serviceEntranceGUID; + uint64 gauntletGate1GUID; + uint64 ziggurat1GUID; + uint64 ziggurat2GUID; + uint64 ziggurat3GUID; + uint64 ziggurat4GUID; + uint64 ziggurat5GUID; + uint64 portGauntletGUID; + uint64 portSlaugtherGUID; + uint64 portElderGUID; - uint64 baronGUID; - uint64 ysidaTriggerGUID; - std::set crystalsGUID; - std::set abomnationGUID; + uint64 baronGUID; + uint64 ysidaTriggerGUID; + std::set crystalsGUID; + std::set abomnationGUID; - void Initialize() - { - for(uint8 i = 0; i < ENCOUNTERS; i++) - Encounter[i] = NOT_STARTED; - - for(uint8 i = 0; i < 5; i++) - IsSilverHandDead[5] = false; - - BaronRun_Timer = 0; - SlaugtherSquare_Timer = 0; - - serviceEntranceGUID = 0; - gauntletGate1GUID = 0; - ziggurat1GUID = 0; - ziggurat2GUID = 0; - ziggurat3GUID = 0; - ziggurat4GUID = 0; - ziggurat5GUID = 0; - portGauntletGUID = 0; - portSlaugtherGUID = 0; - portElderGUID = 0; - - baronGUID = 0; - ysidaTriggerGUID = 0; - crystalsGUID.clear(); - abomnationGUID.clear(); - } - - Player* GetPlayerInMap() - { - Map::PlayerList const& players = instance->GetPlayers(); - - if (!players.isEmpty()) - { - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - if (Player* plr = itr->getSource()) - return plr; - } - } - - debug_log("SD2: Instance Stratholme: GetPlayerInMap, but PlayerList is empty!"); - return NULL; - } - - bool StartSlaugtherSquare() - { - //change to DONE when crystals implemented - if (Encounter[1] == IN_PROGRESS && Encounter[2] == IN_PROGRESS && Encounter[3] == IN_PROGRESS) - { - UpdateGoState(portGauntletGUID,0,false); - UpdateGoState(portSlaugtherGUID,0,false); - return true; - } - - debug_log("SD2: Instance Stratholme: Cannot open slaugther square yet."); - return false; - } - - //if withRestoreTime true, then newState will be ignored and GO should be restored to original state after 10 seconds - void UpdateGoState(uint64 goGuid, uint32 newState, bool withRestoreTime) - { - Player *player = GetPlayerInMap(); - - if (!player || !goGuid) - return; - - if (GameObject *go = GameObject::GetGameObject(*player, goGuid)) - { - if (withRestoreTime) - go->UseDoorOrButton(10); - else - go->SetGoState(newState); - } - } - - void OnCreatureCreate(Creature *creature, uint32 creature_entry) - { - switch(creature->GetEntry()) - { - case C_BARON: baronGUID = creature->GetGUID(); break; - case C_YSIDA_TRIGGER: ysidaTriggerGUID = creature->GetGUID(); break; - case C_CRYSTAL: crystalsGUID.insert(creature->GetGUID()); break; - case C_ABOM_BILE: - case C_ABOM_VENOM: abomnationGUID.insert(creature->GetGUID()); break; - } - } - - void OnObjectCreate(GameObject *go) - { - switch(go->GetEntry()) - { - case GO_SERVICE_ENTRANCE: serviceEntranceGUID = go->GetGUID(); break; - case GO_GAUNTLET_GATE1: - //weird, but unless flag is set, client will not respond as expected. DB bug? - go->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_LOCKED); - gauntletGate1GUID = go->GetGUID(); - break; - case GO_ZIGGURAT1: ziggurat1GUID = go->GetGUID(); break; - case GO_ZIGGURAT2: ziggurat2GUID = go->GetGUID(); break; - case GO_ZIGGURAT3: ziggurat3GUID = go->GetGUID(); break; - case GO_ZIGGURAT4: ziggurat4GUID = go->GetGUID(); break; - case GO_ZIGGURAT5: ziggurat5GUID = go->GetGUID(); break; - case GO_PORT_GAUNTLET: portGauntletGUID = go->GetGUID(); break; - case GO_PORT_SLAUGTHER: portSlaugtherGUID = go->GetGUID(); break; - case GO_PORT_ELDERS: portElderGUID = go->GetGUID(); break; - } - } - - void SetData(uint32 type, uint32 data) + void Initialize() { - Player *player = GetPlayerInMap(); + for(uint8 i = 0; i < ENCOUNTERS; i++) + Encounter[i] = NOT_STARTED; - if (!player) - { - debug_log("SD2: Instance Stratholme: SetData (Type: %u Data %u) cannot find any player.", type, data); - return; - } + for(uint8 i = 0; i < 5; i++) + IsSilverHandDead[5] = false; + + BaronRun_Timer = 0; + SlaugtherSquare_Timer = 0; + + serviceEntranceGUID = 0; + gauntletGate1GUID = 0; + ziggurat1GUID = 0; + ziggurat2GUID = 0; + ziggurat3GUID = 0; + ziggurat4GUID = 0; + ziggurat5GUID = 0; + portGauntletGUID = 0; + portSlaugtherGUID = 0; + portElderGUID = 0; + + baronGUID = 0; + ysidaTriggerGUID = 0; + crystalsGUID.clear(); + abomnationGUID.clear(); + } + + Player* GetPlayerInMap() + { + Map::PlayerList const& players = instance->GetPlayers(); + + if (!players.isEmpty()) + { + for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* plr = itr->getSource()) + return plr; + } + } + + debug_log("SD2: Instance Stratholme: GetPlayerInMap, but PlayerList is empty!"); + return NULL; + } + + bool StartSlaugtherSquare() + { + //change to DONE when crystals implemented + if (Encounter[1] == IN_PROGRESS && Encounter[2] == IN_PROGRESS && Encounter[3] == IN_PROGRESS) + { + UpdateGoState(portGauntletGUID,0,false); + UpdateGoState(portSlaugtherGUID,0,false); + return true; + } + + debug_log("SD2: Instance Stratholme: Cannot open slaugther square yet."); + return false; + } + + //if withRestoreTime true, then newState will be ignored and GO should be restored to original state after 10 seconds + void UpdateGoState(uint64 goGuid, uint32 newState, bool withRestoreTime) + { + Player *player = GetPlayerInMap(); + + if (!player || !goGuid) + return; + + if (GameObject *go = GameObject::GetGameObject(*player, goGuid)) + { + if (withRestoreTime) + go->UseDoorOrButton(10); + else + go->SetGoState(newState); + } + } + + void OnCreatureCreate(Creature *creature, uint32 creature_entry) + { + switch(creature->GetEntry()) + { + case C_BARON: baronGUID = creature->GetGUID(); break; + case C_YSIDA_TRIGGER: ysidaTriggerGUID = creature->GetGUID(); break; + case C_CRYSTAL: crystalsGUID.insert(creature->GetGUID()); break; + case C_ABOM_BILE: + case C_ABOM_VENOM: abomnationGUID.insert(creature->GetGUID()); break; + } + } + + void OnObjectCreate(GameObject *go) + { + switch(go->GetEntry()) + { + case GO_SERVICE_ENTRANCE: serviceEntranceGUID = go->GetGUID(); break; + case GO_GAUNTLET_GATE1: + //weird, but unless flag is set, client will not respond as expected. DB bug? + go->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_LOCKED); + gauntletGate1GUID = go->GetGUID(); + break; + case GO_ZIGGURAT1: ziggurat1GUID = go->GetGUID(); break; + case GO_ZIGGURAT2: ziggurat2GUID = go->GetGUID(); break; + case GO_ZIGGURAT3: ziggurat3GUID = go->GetGUID(); break; + case GO_ZIGGURAT4: ziggurat4GUID = go->GetGUID(); break; + case GO_ZIGGURAT5: ziggurat5GUID = go->GetGUID(); break; + case GO_PORT_GAUNTLET: portGauntletGUID = go->GetGUID(); break; + case GO_PORT_SLAUGTHER: portSlaugtherGUID = go->GetGUID(); break; + case GO_PORT_ELDERS: portElderGUID = go->GetGUID(); break; + } + } + + void SetData(uint32 type, uint32 data) + { + Player *player = GetPlayerInMap(); + + if (!player) + { + debug_log("SD2: Instance Stratholme: SetData (Type: %u Data %u) cannot find any player.", type, data); + return; + } switch(type) { - case TYPE_BARON_RUN: - switch(data) - { - case IN_PROGRESS: - if (Encounter[0] == IN_PROGRESS || Encounter[0] == FAIL) - break; - BaronRun_Timer = 2700000; - debug_log("SD2: Instance Stratholme: Baron run in progress."); - break; - case FAIL: - //may add code to remove aura from players, but in theory the time should be up already and removed. - break; - case DONE: - if (Unit *t = Unit::GetUnit(*player, ysidaTriggerGUID)) - t->SummonCreature(C_YSIDA,t->GetPositionX(),t->GetPositionY(),t->GetPositionZ(),t->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,1800000); - BaronRun_Timer = 0; - break; - } - Encounter[0] = data; - break; - case TYPE_BARONESS: - Encounter[1] = data; - if (data == IN_PROGRESS) - UpdateGoState(ziggurat1GUID,0,false); - if (data == IN_PROGRESS) //change to DONE when crystals implemented - StartSlaugtherSquare(); - break; - case TYPE_NERUB: - Encounter[2] = data; - if (data == IN_PROGRESS) - UpdateGoState(ziggurat2GUID,0,false); - if (data == IN_PROGRESS) //change to DONE when crystals implemented - StartSlaugtherSquare(); - break; - case TYPE_PALLID: - Encounter[3] = data; - if (data == IN_PROGRESS) - UpdateGoState(ziggurat3GUID,0,false); - if (data == IN_PROGRESS) //change to DONE when crystals implemented - StartSlaugtherSquare(); - break; - case TYPE_RAMSTEIN: - if (data == IN_PROGRESS) - { - if (Encounter[4] != IN_PROGRESS) - UpdateGoState(portGauntletGUID,1,false); + case TYPE_BARON_RUN: + switch(data) + { + case IN_PROGRESS: + if (Encounter[0] == IN_PROGRESS || Encounter[0] == FAIL) + break; + BaronRun_Timer = 2700000; + debug_log("SD2: Instance Stratholme: Baron run in progress."); + break; + case FAIL: + //may add code to remove aura from players, but in theory the time should be up already and removed. + break; + case DONE: + if (Unit *t = Unit::GetUnit(*player, ysidaTriggerGUID)) + t->SummonCreature(C_YSIDA,t->GetPositionX(),t->GetPositionY(),t->GetPositionZ(),t->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,1800000); + BaronRun_Timer = 0; + break; + } + Encounter[0] = data; + break; + case TYPE_BARONESS: + Encounter[1] = data; + if (data == IN_PROGRESS) + UpdateGoState(ziggurat1GUID,0,false); + if (data == IN_PROGRESS) //change to DONE when crystals implemented + StartSlaugtherSquare(); + break; + case TYPE_NERUB: + Encounter[2] = data; + if (data == IN_PROGRESS) + UpdateGoState(ziggurat2GUID,0,false); + if (data == IN_PROGRESS) //change to DONE when crystals implemented + StartSlaugtherSquare(); + break; + case TYPE_PALLID: + Encounter[3] = data; + if (data == IN_PROGRESS) + UpdateGoState(ziggurat3GUID,0,false); + if (data == IN_PROGRESS) //change to DONE when crystals implemented + StartSlaugtherSquare(); + break; + case TYPE_RAMSTEIN: + if (data == IN_PROGRESS) + { + if (Encounter[4] != IN_PROGRESS) + UpdateGoState(portGauntletGUID,1,false); - uint32 count = abomnationGUID.size(); - for(std::set::iterator i = abomnationGUID.begin(); i != abomnationGUID.end(); ++i) - { - if (Unit* abom = Unit::GetUnit(*player, *i)) - { - if (!abom->isAlive()) - --count; - } - } + uint32 count = abomnationGUID.size(); + for(std::set::iterator i = abomnationGUID.begin(); i != abomnationGUID.end(); ++i) + { + if (Unit* abom = Unit::GetUnit(*player, *i)) + { + if (!abom->isAlive()) + --count; + } + } - if (!count) - { - //a bit itchy, it should close the door after 10 secs, but it doesn't. skipping it for now. - //UpdateGoState(ziggurat4GUID,0,true); - player->SummonCreature(C_RAMSTEIN,4032.84,-3390.24,119.73,4.71,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000); - debug_log("SD2: Instance Stratholme: Ramstein spawned."); - } else debug_log("SD2: Instance Stratholme: %u Abomnation left to kill.",count); - } - if (data == DONE) - { - SlaugtherSquare_Timer = 300000; - debug_log("SD2: Instance Stratholme: Slaugther event will continue in 5 minutes."); - } - Encounter[4] = data; - break; - case TYPE_BARON: - if (data == IN_PROGRESS) - { - if (GetData(TYPE_BARON_RUN) == IN_PROGRESS) - { - if (Group *pGroup = player->GetGroup()) - { - for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) - { - Player* pGroupie = itr->getSource(); - if (!pGroupie) - continue; + if (!count) + { + //a bit itchy, it should close the door after 10 secs, but it doesn't. skipping it for now. + //UpdateGoState(ziggurat4GUID,0,true); + player->SummonCreature(C_RAMSTEIN,4032.84,-3390.24,119.73,4.71,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000); + debug_log("SD2: Instance Stratholme: Ramstein spawned."); + } else debug_log("SD2: Instance Stratholme: %u Abomnation left to kill.",count); + } + if (data == DONE) + { + SlaugtherSquare_Timer = 300000; + debug_log("SD2: Instance Stratholme: Slaugther event will continue in 5 minutes."); + } + Encounter[4] = data; + break; + case TYPE_BARON: + if (data == IN_PROGRESS) + { + if (GetData(TYPE_BARON_RUN) == IN_PROGRESS) + { + if (Group *pGroup = player->GetGroup()) + { + for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player* pGroupie = itr->getSource(); + if (!pGroupie) + continue; - if (pGroupie->HasAura(SPELL_BARON_ULTIMATUM,0)) - pGroupie->RemoveAurasDueToSpell(SPELL_BARON_ULTIMATUM); - } - } else if (player->HasAura(SPELL_BARON_ULTIMATUM,0)) - player->RemoveAurasDueToSpell(SPELL_BARON_ULTIMATUM); + if (pGroupie->HasAura(SPELL_BARON_ULTIMATUM,0)) + pGroupie->RemoveAurasDueToSpell(SPELL_BARON_ULTIMATUM); + } + } else if (player->HasAura(SPELL_BARON_ULTIMATUM,0)) + player->RemoveAurasDueToSpell(SPELL_BARON_ULTIMATUM); - if (Unit *temp = Unit::GetUnit(*player,GetData64(DATA_BARON))) - player->GroupEventHappens(QUEST_DEAD_MAN_PLEA,temp); + if (Unit *temp = Unit::GetUnit(*player,GetData64(DATA_BARON))) + player->GroupEventHappens(QUEST_DEAD_MAN_PLEA,temp); - SetData(TYPE_BARON_RUN,DONE); - } - } - Encounter[5] = data; - break; - case TYPE_SH_AELMAR: - IsSilverHandDead[0] = (data) ? true : false; - break; - case TYPE_SH_CATHELA: - IsSilverHandDead[1] = (data) ? true : false; - break; - case TYPE_SH_GREGOR: - IsSilverHandDead[2] = (data) ? true : false; - break; - case TYPE_SH_NEMAS: - IsSilverHandDead[3] = (data) ? true : false; - break; - case TYPE_SH_VICAR: - IsSilverHandDead[4] = (data) ? true : false; - break; - } - } + SetData(TYPE_BARON_RUN,DONE); + } + } + Encounter[5] = data; + break; + case TYPE_SH_AELMAR: + IsSilverHandDead[0] = (data) ? true : false; + break; + case TYPE_SH_CATHELA: + IsSilverHandDead[1] = (data) ? true : false; + break; + case TYPE_SH_GREGOR: + IsSilverHandDead[2] = (data) ? true : false; + break; + case TYPE_SH_NEMAS: + IsSilverHandDead[3] = (data) ? true : false; + break; + case TYPE_SH_VICAR: + IsSilverHandDead[4] = (data) ? true : false; + break; + } + } uint32 GetData(uint32 type) { switch(type) - { - case TYPE_SH_QUEST: - if(IsSilverHandDead[0] && IsSilverHandDead[1] && IsSilverHandDead[2] && IsSilverHandDead[3] && IsSilverHandDead[4]) - return 1; - return 0; - case TYPE_BARON_RUN: - return Encounter[0]; - case TYPE_BARONESS: - return Encounter[1]; - case TYPE_NERUB: - return Encounter[2]; - case TYPE_PALLID: - return Encounter[3]; - case TYPE_RAMSTEIN: - return Encounter[4]; - case TYPE_BARON: - return Encounter[5]; - } - return 0; - } + { + case TYPE_SH_QUEST: + if(IsSilverHandDead[0] && IsSilverHandDead[1] && IsSilverHandDead[2] && IsSilverHandDead[3] && IsSilverHandDead[4]) + return 1; + return 0; + case TYPE_BARON_RUN: + return Encounter[0]; + case TYPE_BARONESS: + return Encounter[1]; + case TYPE_NERUB: + return Encounter[2]; + case TYPE_PALLID: + return Encounter[3]; + case TYPE_RAMSTEIN: + return Encounter[4]; + case TYPE_BARON: + return Encounter[5]; + } + return 0; + } - uint64 GetData64(uint32 data) - { - switch(data) - { - case DATA_BARON: - return baronGUID; - case DATA_YSIDA_TRIGGER: - return ysidaTriggerGUID; - } - return 0; - } + uint64 GetData64(uint32 data) + { + switch(data) + { + case DATA_BARON: + return baronGUID; + case DATA_YSIDA_TRIGGER: + return ysidaTriggerGUID; + } + return 0; + } - void Update(uint32 diff) - { - if (BaronRun_Timer) - { - if (BaronRun_Timer <= diff) - { - if (GetData(TYPE_BARON_RUN) != DONE) - SetData(TYPE_BARON_RUN, FAIL); - BaronRun_Timer = 0; - debug_log("SD2: Instance Stratholme: Baron run event reached end. Event has state %u.",GetData(TYPE_BARON_RUN)); - }else BaronRun_Timer -= diff; - } + void Update(uint32 diff) + { + if (BaronRun_Timer) + { + if (BaronRun_Timer <= diff) + { + if (GetData(TYPE_BARON_RUN) != DONE) + SetData(TYPE_BARON_RUN, FAIL); + BaronRun_Timer = 0; + debug_log("SD2: Instance Stratholme: Baron run event reached end. Event has state %u.",GetData(TYPE_BARON_RUN)); + }else BaronRun_Timer -= diff; + } - if (SlaugtherSquare_Timer) - { - if (SlaugtherSquare_Timer <= diff) - { - if (Player *p = GetPlayerInMap()) - { - for(uint8 i = 0; i < 4; i++) - p->SummonCreature(C_BLACK_GUARD,4032.84,-3390.24,119.73,4.71,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000); + if (SlaugtherSquare_Timer) + { + if (SlaugtherSquare_Timer <= diff) + { + if (Player *p = GetPlayerInMap()) + { + for(uint8 i = 0; i < 4; i++) + p->SummonCreature(C_BLACK_GUARD,4032.84,-3390.24,119.73,4.71,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000); - UpdateGoState(ziggurat4GUID,0,false); - UpdateGoState(ziggurat5GUID,0,false); - debug_log("SD2: Instance Stratholme: Black guard sentries spawned. Opening gates to baron."); - } - SlaugtherSquare_Timer = 0; - }else SlaugtherSquare_Timer -= diff; - } + UpdateGoState(ziggurat4GUID,0,false); + UpdateGoState(ziggurat5GUID,0,false); + debug_log("SD2: Instance Stratholme: Black guard sentries spawned. Opening gates to baron."); + } + SlaugtherSquare_Timer = 0; + }else SlaugtherSquare_Timer -= diff; + } } }; diff --git a/src/bindings/scripts/scripts/zone/stratholme/stratholme.cpp b/src/bindings/scripts/scripts/zone/stratholme/stratholme.cpp index e3c11e5480c..0ce345f65dd 100644 --- a/src/bindings/scripts/scripts/zone/stratholme/stratholme.cpp +++ b/src/bindings/scripts/scripts/zone/stratholme/stratholme.cpp @@ -204,13 +204,13 @@ struct TRINITY_DLL_DECL mobs_spectral_ghostly_citizenAI : public ScriptedAI float x,y,z; m_creature->GetRandomPoint(m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(),20.0f,x,y,z); - //100%, 50%, 33%, 25% chance to spawn - uint32 j = urand(1,i); - if (j==1) - m_creature->SummonCreature(ENTRY_RESTLESS,x,y,z,0,TEMPSUMMON_CORPSE_DESPAWN,600000); - } - } - } + //100%, 50%, 33%, 25% chance to spawn + uint32 j = urand(1,i); + if (j==1) + m_creature->SummonCreature(ENTRY_RESTLESS,x,y,z,0,TEMPSUMMON_CORPSE_DESPAWN,600000); + } + } + } void UpdateAI(const uint32 diff) { diff --git a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_brutallus.cpp b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_brutallus.cpp index 9ab4009a8e7..d114ee28378 100644 --- a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_brutallus.cpp +++ b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_brutallus.cpp @@ -59,20 +59,20 @@ EndScriptData */ struct TRINITY_DLL_DECL boss_brutallusAI : public ScriptedAI { boss_brutallusAI(Creature *c) : ScriptedAI(c) - { - pInstance = ((ScriptedInstance*)c->GetInstanceData()); - Reset(); - } + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + Reset(); + } - ScriptedInstance* pInstance; + ScriptedInstance* pInstance; uint32 SlashTimer; uint32 BurnTimer; uint32 StompTimer; uint32 BerserkTimer; - uint32 ConversationTimer; - bool Intro; + uint32 ConversationTimer; + bool Intro; void Reset() { @@ -82,34 +82,34 @@ struct TRINITY_DLL_DECL boss_brutallusAI : public ScriptedAI BerserkTimer = 360000; m_creature->CastSpell(m_creature, SPELL_DUAL_WIELD, true); - if(pInstance) - pInstance->SetData(DATA_BRUTALLUS, NOT_STARTED); + if(pInstance) + pInstance->SetData(DATA_BRUTALLUS, NOT_STARTED); } void Aggro(Unit *who) { - DoScriptText(YELL_AGGRO, m_creature); + DoScriptText(YELL_AGGRO, m_creature); - if(pInstance) - pInstance->SetData(DATA_BRUTALLUS, IN_PROGRESS); + if(pInstance) + pInstance->SetData(DATA_BRUTALLUS, IN_PROGRESS); } void KilledUnit(Unit* victim) { switch(rand()%3) { - case 0: DoScriptText(YELL_KILL1, m_creature); break; - case 1: DoScriptText(YELL_KILL2, m_creature); break; - case 2: DoScriptText(YELL_KILL3, m_creature); break; + case 0: DoScriptText(YELL_KILL1, m_creature); break; + case 1: DoScriptText(YELL_KILL2, m_creature); break; + case 2: DoScriptText(YELL_KILL3, m_creature); break; } } void JustDied(Unit* Killer) { - DoScriptText(YELL_DEATH, m_creature); + DoScriptText(YELL_DEATH, m_creature); - if(pInstance) - pInstance->SetData(DATA_BRUTALLUS, DONE); + if(pInstance) + pInstance->SetData(DATA_BRUTALLUS, DONE); } void UpdateAI(const uint32 diff) @@ -119,20 +119,20 @@ struct TRINITY_DLL_DECL boss_brutallusAI : public ScriptedAI if(SlashTimer < diff) { - DoCast(m_creature->getVictim(),SPELL_METEOR_SLASH); + DoCast(m_creature->getVictim(),SPELL_METEOR_SLASH); SlashTimer = 11000; }else SlashTimer -= diff; if(StompTimer < diff) { - switch(rand()%3) - { - case 0: DoScriptText(YELL_LOVE1, m_creature); break; - case 1: DoScriptText(YELL_LOVE2, m_creature); break; - case 2: DoScriptText(YELL_LOVE3, m_creature); break; - } + switch(rand()%3) + { + case 0: DoScriptText(YELL_LOVE1, m_creature); break; + case 1: DoScriptText(YELL_LOVE2, m_creature); break; + case 2: DoScriptText(YELL_LOVE3, m_creature); break; + } - Unit *Target = m_creature->getVictim(); + Unit *Target = m_creature->getVictim(); DoCast(Target,SPELL_STOMP); if(Target->HasAura(45151,0)) Target->RemoveAura(45151,0); StompTimer = 30000; @@ -142,19 +142,19 @@ struct TRINITY_DLL_DECL boss_brutallusAI : public ScriptedAI { if(Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0)) target->CastSpell(target,SPELL_BURN,true); - BurnTimer = 60000; + BurnTimer = 60000; } else BurnTimer -= diff; if(BerserkTimer < diff) { - DoScriptText(YELL_BERSERK, m_creature); + DoScriptText(YELL_BERSERK, m_creature); DoCast(m_creature,SPELL_BERSERK); BerserkTimer = 20000; } else BerserkTimer -= diff; - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); } }; diff --git a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_eredar_twins.cpp b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_eredar_twins.cpp index a00f1ab1c2e..e7762757c4a 100644 --- a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_eredar_twins.cpp +++ b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_eredar_twins.cpp @@ -420,17 +420,17 @@ struct TRINITY_DLL_DECL boss_alythessAI : public Scripted_NoMovementAI { Unit* Temp = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_SACROLASH)); if (Temp && Temp->isAlive() && !(Temp->getVictim())) - ((Creature*)Temp)->AI()->AttackStart(who); - } - } + ((Creature*)Temp)->AI()->AttackStart(who); + } + } - void AttackStart(Unit *who) - { - if (!InCombat) - { - Scripted_NoMovementAI::AttackStart(who); - } - } + void AttackStart(Unit *who) + { + if (!InCombat) + { + Scripted_NoMovementAI::AttackStart(who); + } + } void MoveInLineOfSight(Unit *who) { diff --git a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp index f2238af0866..3c358c1f3b6 100644 --- a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp +++ b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp @@ -169,8 +169,8 @@ struct TRINITY_DLL_DECL boss_kalecgosAI : public ScriptedAI { switch(rand()%2) { - case 0: DoScriptText(SAY_EVIL_SLAY1, m_creature); break; - case 1: DoScriptText(SAY_EVIL_SLAY2, m_creature); break; + case 0: DoScriptText(SAY_EVIL_SLAY1, m_creature); break; + case 1: DoScriptText(SAY_EVIL_SLAY2, m_creature); break; } } @@ -215,7 +215,7 @@ struct TRINITY_DLL_DECL boss_kalecgosAI : public ScriptedAI switch(TalkSequence) { case 1: - DoScriptText(SAY_EVIL_ENRAGE, m_creature); + DoScriptText(SAY_EVIL_ENRAGE, m_creature); TalkTimer = 3000; break; case 2: @@ -321,7 +321,7 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI void JustDied(Unit *killer) { - DoScriptText(SAY_SATH_DEATH, m_creature); + DoScriptText(SAY_SATH_DEATH, m_creature); m_creature->Relocate(m_creature->GetPositionX(), m_creature->GetPositionY(), DRAGON_REALM_Z, m_creature->GetOrientation()); TeleportAllPlayersBack(); if(Unit *Kalecgos = Unit::GetUnit(*m_creature, KalecgosGUID)) @@ -381,7 +381,7 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI if(ShadowBoltTimer < diff) { - DoScriptText(SAY_SATH_SPELL1, m_creature); + DoScriptText(SAY_SATH_SPELL1, m_creature); DoCast(m_creature, SPELL_SHADOW_BOLT); ShadowBoltTimer = 7000+(rand()%3000); }else ShadowBoltTimer -= diff; @@ -396,7 +396,7 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI if(CorruptionStrikeTimer < diff) { - DoScriptText(SAY_SATH_SPELL2, m_creature); + DoScriptText(SAY_SATH_SPELL2, m_creature); DoCast(m_creature->getVictim(), SPELL_CORRUPTION_STRIKE); CorruptionStrikeTimer = 13000; }else CorruptionStrikeTimer -= diff; @@ -611,7 +611,7 @@ void boss_sathrovarrAI::Enrage() error_log("SD2 ERROR: unable to find Kalec"); return; } - DoScriptText(SAY_SATH_ENRAGE, m_creature); + DoScriptText(SAY_SATH_ENRAGE, m_creature); m_creature->CastSpell(m_creature, SPELL_ENRAGE, true); Kalecgos->CastSpell(Kalecgos, SPELL_ENRAGE, true); isEnraged = true; diff --git a/src/bindings/scripts/scripts/zone/sunwell_plateau/def_sunwell_plateau.h b/src/bindings/scripts/scripts/zone/sunwell_plateau/def_sunwell_plateau.h index 95ff1f112bf..497f6d30479 100644 --- a/src/bindings/scripts/scripts/zone/sunwell_plateau/def_sunwell_plateau.h +++ b/src/bindings/scripts/scripts/zone/sunwell_plateau/def_sunwell_plateau.h @@ -18,7 +18,7 @@ #define DATA_KALECGOS_HUMAN 7 #define DATA_SATHROVARR 8 #define DATA_BRUTALLUS 9 -#define DATA_MADRIGOSA 24 +#define DATA_MADRIGOSA 24 #define DATA_FELMYST 10 #define DATA_ALYTHESS 11 #define DATA_SACROLASH 12 diff --git a/src/bindings/scripts/scripts/zone/sunwell_plateau/instance_sunwell_plateau.cpp b/src/bindings/scripts/scripts/zone/sunwell_plateau/instance_sunwell_plateau.cpp index 3de2c14e93a..2bbc0160d4c 100644 --- a/src/bindings/scripts/scripts/zone/sunwell_plateau/instance_sunwell_plateau.cpp +++ b/src/bindings/scripts/scripts/zone/sunwell_plateau/instance_sunwell_plateau.cpp @@ -34,7 +34,7 @@ struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance uint64 Kalecgos_Human; uint64 Sathrovarr; uint64 Brutallus; - uint64 Madrigosa; + uint64 Madrigosa; uint64 Felmyst; uint64 Alythess; uint64 Sacrolash; @@ -59,7 +59,7 @@ struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance Kalecgos_Human = 0; Sathrovarr = 0; Brutallus = 0; - Madrigosa = 0; + Madrigosa = 0; Felmyst = 0; Alythess = 0; Sacrolash = 0; @@ -102,7 +102,7 @@ struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance case 24891: Kalecgos_Human = creature->GetGUID(); break; case 24892: Sathrovarr = creature->GetGUID(); break; case 24882: Brutallus = creature->GetGUID(); break; - case 24895: Madrigosa = creature->GetGUID(); break; + case 24895: Madrigosa = creature->GetGUID(); break; case 25038: Felmyst = creature->GetGUID(); break; case 25166: Alythess = creature->GetGUID(); break; case 25165: Sacrolash = creature->GetGUID(); break; @@ -150,7 +150,7 @@ struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance case DATA_KALECGOS_HUMAN: return Kalecgos_Human; break; case DATA_SATHROVARR: return Sathrovarr; break; case DATA_BRUTALLUS: return Brutallus; break; - case DATA_MADRIGOSA: return Madrigosa; break; + case DATA_MADRIGOSA: return Madrigosa; break; case DATA_FELMYST: return Felmyst; break; case DATA_ALYTHESS: return Alythess; break; case DATA_SACROLASH: return Sacrolash; break; diff --git a/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp b/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp index db1cb4c43a4..022f1d29f6b 100644 --- a/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp +++ b/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp @@ -158,7 +158,7 @@ struct TRINITY_DLL_DECL npc_custodian_of_timeAI : public npc_escortAI switch( i ) { - case 2: DoScriptText(WHISPER_CUSTODIAN_1, m_creature, pTemp); break; + case 2: DoScriptText(WHISPER_CUSTODIAN_1, m_creature, pTemp); break; case 3: DoScriptText(WHISPER_CUSTODIAN_2, m_creature, pTemp); break; case 4: DoScriptText(WHISPER_CUSTODIAN_3, m_creature, pTemp); break; case 5: DoScriptText(WHISPER_CUSTODIAN_4, m_creature, pTemp); break; @@ -370,20 +370,20 @@ bool GossipSelect_npc_stone_watcher_of_norgannon(Player *player, Creature *_Crea ## npc_OOX17 ######*/ -#define Q_OOX17 648 -#define SPAWN_FIRST 7803 -#define SPAWN_SECOND_1 5617 -#define SPAWN_SECOND_2 7805 -#define SAY_SCOFF -1060004 -#define SAY_CHICKEN_ACC -1060000 -#define SAY_CHICKEN_AGGRO_1 -1060001 +#define Q_OOX17 648 +#define SPAWN_FIRST 7803 +#define SPAWN_SECOND_1 5617 +#define SPAWN_SECOND_2 7805 +#define SAY_SCOFF -1060004 +#define SAY_CHICKEN_ACC -1060000 +#define SAY_CHICKEN_AGGRO_1 -1060001 #define SAY_CHICKEN_AGGRO_2 -1060002 -#define SAY_CHICKEN_AMB -1060003 -#define SAY_CHICKEN_COMP -1060005 +#define SAY_CHICKEN_AMB -1060003 +#define SAY_CHICKEN_COMP -1060005 struct TRINITY_DLL_DECL npc_OOX17AI : public npc_escortAI { - npc_OOX17AI(Creature *c) : npc_escortAI(c) {Reset();} + npc_OOX17AI(Creature *c) : npc_escortAI(c) {Reset();} void WaypointReached(uint32 i) { @@ -393,50 +393,50 @@ struct TRINITY_DLL_DECL npc_OOX17AI : public npc_escortAI return; switch(i) { - case 23: + case 23: m_creature->SummonCreature(SPAWN_FIRST, -8350.96, -4445.79, 10.10, 6.20, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); m_creature->SummonCreature(SPAWN_FIRST, -8355.96, -4447.79, 10.10, 6.27, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); m_creature->SummonCreature(SPAWN_FIRST, -8353.96, -4442.79, 10.10, 6.08, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_CHICKEN_AMB, m_creature); - break; + DoScriptText(SAY_CHICKEN_AMB, m_creature); + break; case 56: m_creature->SummonCreature(SPAWN_SECOND_1, -7510.07, -4795.50, 9.35, 6.06, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); m_creature->SummonCreature(SPAWN_SECOND_2, -7515.07, -4797.50, 9.35, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - m_creature->SummonCreature(SPAWN_SECOND_2, -7518.07, -4792.50, 9.35, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_CHICKEN_AMB, m_creature); - {Unit* scoff = FindCreature(SPAWN_SECOND_2, 30, m_creature); - if(scoff) - DoScriptText(SAY_SCOFF, scoff);}break; + m_creature->SummonCreature(SPAWN_SECOND_2, -7518.07, -4792.50, 9.35, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_CHICKEN_AMB, m_creature); + {Unit* scoff = FindCreature(SPAWN_SECOND_2, 30, m_creature); + if(scoff) + DoScriptText(SAY_SCOFF, scoff);}break; break; case 86: if (player) { - DoScriptText(SAY_CHICKEN_COMP, m_creature); + DoScriptText(SAY_CHICKEN_COMP, m_creature); ((Player*)player)->GroupEventHappens(Q_OOX17, m_creature); } - break; + break; } } - void Reset(){} + void Reset(){} - void Aggro(Unit* who) + void Aggro(Unit* who) { - switch (rand()%2) + switch (rand()%2) { - case 0: DoScriptText(SAY_CHICKEN_AGGRO_1, m_creature); break; + case 0: DoScriptText(SAY_CHICKEN_AGGRO_1, m_creature); break; case 1: DoScriptText(SAY_CHICKEN_AGGRO_2, m_creature); break; - } + } } - void JustSummoned(Creature* summoned) + void JustSummoned(Creature* summoned) { summoned->AI()->AttackStart(m_creature); } - void JustDied(Unit* killer) + void JustDied(Unit* killer) { if (PlayerGUID) { @@ -449,20 +449,20 @@ struct TRINITY_DLL_DECL npc_OOX17AI : public npc_escortAI void UpdateAI(const uint32 diff) { npc_escortAI::UpdateAI(diff); - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; } - }; + }; bool QuestAccept_npc_OOX17(Player* player, Creature* creature, Quest const* quest) { if (quest->GetQuestId() == Q_OOX17) { - creature->setFaction(113); - creature->SetHealth(creature->GetMaxHealth()); - creature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); - creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); - DoScriptText(SAY_CHICKEN_ACC, creature); + creature->setFaction(113); + creature->SetHealth(creature->GetMaxHealth()); + creature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); + creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); + DoScriptText(SAY_CHICKEN_ACC, creature); ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); } @@ -601,7 +601,7 @@ void AddSC_tanaris() newscript->pGossipSelect = &GossipSelect_npc_stone_watcher_of_norgannon; newscript->RegisterSelf(); - newscript = new Script; + newscript = new Script; newscript->Name = "npc_OOX17"; newscript->GetAI = &GetAI_npc_OOX17; newscript->pQuestAccept = &QuestAccept_npc_OOX17; diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/arcatraz.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/arcatraz.cpp index 85fa16e21be..1493b6d0d1d 100644 --- a/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/arcatraz.cpp +++ b/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/arcatraz.cpp @@ -94,7 +94,7 @@ struct TRINITY_DLL_DECL npc_millhouse_manastormAI : public ScriptedAI if( pInstance->GetData(TYPE_HARBINGERSKYRISS) == DONE ) { - DoScriptText(SAY_COMPLETE, m_creature); + DoScriptText(SAY_COMPLETE, m_creature); } } } @@ -124,14 +124,14 @@ struct TRINITY_DLL_DECL npc_millhouse_manastormAI : public ScriptedAI { switch(rand()%2) { - case 0: DoScriptText(SAY_KILL_1, m_creature); break; - case 1: DoScriptText(SAY_KILL_2, m_creature); break; + case 0: DoScriptText(SAY_KILL_1, m_creature); break; + case 1: DoScriptText(SAY_KILL_2, m_creature); break; } } void JustDied(Unit *victim) { - DoScriptText(SAY_DEATH, m_creature); + DoScriptText(SAY_DEATH, m_creature); /*for questId 10886 (heroic mode only) if( pInstance && pInstance->GetData(TYPE_HARBINGERSKYRISS) != DONE ) @@ -315,13 +315,13 @@ struct TRINITY_DLL_DECL npc_warden_mellicharAI : public ScriptedAI if( pInstance ) { pInstance->SetData(TYPE_HARBINGERSKYRISS,IN_PROGRESS); - if (GameObject* Sphere = GameObject::GetGameObject(*m_creature,pInstance->GetData64(DATA_SPHERE_SHIELD))) - Sphere->SetGoState(1); + if (GameObject* Sphere = GameObject::GetGameObject(*m_creature,pInstance->GetData64(DATA_SPHERE_SHIELD))) + Sphere->SetGoState(1); IsRunning = true; } } - bool CanProgress() + bool CanProgress() { if( pInstance ) { @@ -356,8 +356,8 @@ struct TRINITY_DLL_DECL npc_warden_mellicharAI : public ScriptedAI case 2: DoCast(m_creature,SPELL_TARGET_ALPHA); pInstance->SetData(TYPE_WARDEN_1,IN_PROGRESS); - if (GameObject *Sphere = GameObject::GetGameObject(*m_creature,pInstance->GetData64(DATA_SPHERE_SHIELD))) - Sphere->SetGoState(1); + if (GameObject *Sphere = GameObject::GetGameObject(*m_creature,pInstance->GetData64(DATA_SPHERE_SHIELD))) + Sphere->SetGoState(1); break; case 3: DoCast(m_creature,SPELL_TARGET_BETA); diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/boss_harbinger_skyriss.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/boss_harbinger_skyriss.cpp index bb418e29389..1721c8bfe61 100644 --- a/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/boss_harbinger_skyriss.cpp +++ b/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/boss_harbinger_skyriss.cpp @@ -59,7 +59,7 @@ struct TRINITY_DLL_DECL boss_harbinger_skyrissAI : public ScriptedAI { pInstance = ((ScriptedInstance*)c->GetInstanceData()); HeroicMode = m_creature->GetMap()->IsHeroic(); - Intro = false; + Intro = false; Reset(); } @@ -80,7 +80,7 @@ struct TRINITY_DLL_DECL boss_harbinger_skyrissAI : public ScriptedAI void Reset() { if(!Intro) - m_creature->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NOT_ATTACKABLE_2); + m_creature->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NOT_ATTACKABLE_2); IsImage33 = false; IsImage66 = false; @@ -96,9 +96,9 @@ struct TRINITY_DLL_DECL boss_harbinger_skyrissAI : public ScriptedAI void MoveInLineOfSight(Unit *who) { if(!Intro) - { - return; - } + { + return; + } ScriptedAI::MoveInLineOfSight(who); } @@ -126,14 +126,14 @@ struct TRINITY_DLL_DECL boss_harbinger_skyrissAI : public ScriptedAI void KilledUnit(Unit* victim) { - //won't yell killing pet/other unit - if( victim->GetEntry() == 21436 ) + //won't yell killing pet/other unit + if( victim->GetEntry() == 21436 ) return; switch(rand()%2) { - case 0: DoScriptText(SAY_KILL_1, m_creature); break; - case 1: DoScriptText(SAY_KILL_2, m_creature); break; + case 0: DoScriptText(SAY_KILL_1, m_creature); break; + case 1: DoScriptText(SAY_KILL_2, m_creature); break; } } @@ -163,8 +163,8 @@ struct TRINITY_DLL_DECL boss_harbinger_skyrissAI : public ScriptedAI { case 1: DoScriptText(SAY_INTRO, m_creature); - if (GameObject* Sphere = GameObject::GetGameObject(*m_creature,pInstance->GetData64(DATA_SPHERE_SHIELD))) - Sphere->SetGoState(0); + if (GameObject* Sphere = GameObject::GetGameObject(*m_creature,pInstance->GetData64(DATA_SPHERE_SHIELD))) + Sphere->SetGoState(0); ++Intro_Phase; Intro_Timer = 25000; break; @@ -175,13 +175,13 @@ struct TRINITY_DLL_DECL boss_harbinger_skyrissAI : public ScriptedAI //should have a better way to do this. possibly spell exist. mellic->setDeathState(JUST_DIED); mellic->SetHealth(0); - pInstance->SetData(TYPE_SHIELD_OPEN,IN_PROGRESS); + pInstance->SetData(TYPE_SHIELD_OPEN,IN_PROGRESS); } ++Intro_Phase; Intro_Timer = 3000; break; case 3: - m_creature->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NOT_ATTACKABLE_2); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NOT_ATTACKABLE_2); Intro = true; break; } @@ -219,8 +219,8 @@ struct TRINITY_DLL_DECL boss_harbinger_skyrissAI : public ScriptedAI switch(rand()%2) { - case 0: DoScriptText(SAY_FEAR_1, m_creature); break; - case 1: DoScriptText(SAY_FEAR_2, m_creature); break; + case 0: DoScriptText(SAY_FEAR_1, m_creature); break; + case 1: DoScriptText(SAY_FEAR_2, m_creature); break; } if( Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1) ) @@ -238,8 +238,8 @@ struct TRINITY_DLL_DECL boss_harbinger_skyrissAI : public ScriptedAI switch(rand()%2) { - case 0: DoScriptText(SAY_MIND_1, m_creature); break; - case 1: DoScriptText(SAY_MIND_2, m_creature); break; + case 0: DoScriptText(SAY_MIND_1, m_creature); break; + case 1: DoScriptText(SAY_MIND_2, m_creature); break; } if( Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1) ) diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/instance_arcatraz.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/instance_arcatraz.cpp index ae355968650..86cf7d35d9b 100644 --- a/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/instance_arcatraz.cpp +++ b/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/instance_arcatraz.cpp @@ -33,7 +33,7 @@ EndScriptData */ #define POD_DELTA 183964 //pod third boss wave #define POD_GAMMA 183962 //pod fourth boss wave #define POD_OMEGA 183965 //pod fifth boss wave -#define WARDENS_SHIELD 184802 // warden shield +#define WARDENS_SHIELD 184802 // warden shield #define SEAL_SPHERE 184802 //shield 'protecting' mellichar #define MELLICHAR 20904 //skyriss will kill this unit @@ -59,10 +59,10 @@ struct TRINITY_DLL_DECL instance_arcatraz : public ScriptedInstance GameObject *Pod_Beta; GameObject *Pod_Delta; GameObject *Pod_Omega; - GameObject *Wardens_Shield; + GameObject *Wardens_Shield; - uint64 GoSphereGUID; - uint64 MellicharGUID; + uint64 GoSphereGUID; + uint64 MellicharGUID; void Initialize() { @@ -73,10 +73,10 @@ struct TRINITY_DLL_DECL instance_arcatraz : public ScriptedInstance Pod_Delta = NULL; Pod_Gamma = NULL; Pod_Omega = NULL; - Wardens_Shield = NULL; + Wardens_Shield = NULL; - GoSphereGUID = 0; - MellicharGUID = 0; + GoSphereGUID = 0; + MellicharGUID = 0; for(uint8 i = 0; i < ENCOUNTERS; i++) Encounter[i] = NOT_STARTED; @@ -86,7 +86,7 @@ struct TRINITY_DLL_DECL instance_arcatraz : public ScriptedInstance { for(uint8 i = 0; i < ENCOUNTERS; i++) if(Encounter[i]) - return true; + return true; return false; } @@ -97,20 +97,20 @@ struct TRINITY_DLL_DECL instance_arcatraz : public ScriptedInstance { case CONTAINMENT_CORE_SECURITY_FIELD_ALPHA: Containment_Core_Security_Field_Alpha = go; break; case CONTAINMENT_CORE_SECURITY_FIELD_BETA: Containment_Core_Security_Field_Beta = go; break; - case SEAL_SPHERE: GoSphereGUID = go->GetGUID(); break; + case SEAL_SPHERE: GoSphereGUID = go->GetGUID(); break; case POD_ALPHA: Pod_Alpha = go; break; case POD_BETA: Pod_Beta = go; break; case POD_DELTA: Pod_Delta = go; break; case POD_GAMMA: Pod_Gamma = go; break; case POD_OMEGA: Pod_Omega = go; break; - //case WARDENS_SHIELD: Wardens_Shield = go; break; + //case WARDENS_SHIELD: Wardens_Shield = go; break; } } void OnCreatureCreate(Creature *creature, uint32 creature_entry) { if (creature->GetEntry() == MELLICHAR) - MellicharGUID = creature->GetGUID(); + MellicharGUID = creature->GetGUID(); } void SetData(uint32 type, uint32 data) @@ -215,9 +215,9 @@ struct TRINITY_DLL_DECL instance_arcatraz : public ScriptedInstance switch(data) { case DATA_MELLICHAR: - return MellicharGUID; - case DATA_SPHERE_SHIELD: - return GoSphereGUID; + return MellicharGUID; + case DATA_SPHERE_SHIELD: + return GoSphereGUID; } return 0; } diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/botanica/boss_high_botanist_freywinn.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/botanica/boss_high_botanist_freywinn.cpp index a524c06352c..7eeeb55f5c1 100644 --- a/src/bindings/scripts/scripts/zone/tempest_keep/botanica/boss_high_botanist_freywinn.cpp +++ b/src/bindings/scripts/scripts/zone/tempest_keep/botanica/boss_high_botanist_freywinn.cpp @@ -66,7 +66,7 @@ struct TRINITY_DLL_DECL boss_high_botanist_freywinnAI : public ScriptedAI void Aggro(Unit *who) { - DoScriptText(SAY_AGGRO, m_creature); + DoScriptText(SAY_AGGRO, m_creature); } void JustSummoned(Creature *summoned) @@ -90,15 +90,15 @@ struct TRINITY_DLL_DECL boss_high_botanist_freywinnAI : public ScriptedAI { switch(rand()%2) { - case 0: DoScriptText(SAY_KILL_1, m_creature); break; - case 1: DoScriptText(SAY_KILL_2, m_creature); break; + case 0: DoScriptText(SAY_KILL_1, m_creature); break; + case 1: DoScriptText(SAY_KILL_2, m_creature); break; } } - void JustDied(Unit* Killer) - { - DoScriptText(SAY_DEATH, m_creature); - } + void JustDied(Unit* Killer) + { + DoScriptText(SAY_DEATH, m_creature); + } void UpdateAI(const uint32 diff) { @@ -109,8 +109,8 @@ struct TRINITY_DLL_DECL boss_high_botanist_freywinnAI : public ScriptedAI { switch(rand()%2) { - case 0: DoScriptText(SAY_TREE_1, m_creature); break; - case 1: DoScriptText(SAY_TREE_2, m_creature); break; + case 0: DoScriptText(SAY_TREE_1, m_creature); break; + case 1: DoScriptText(SAY_TREE_2, m_creature); break; } if( m_creature->IsNonMeleeSpellCasted(false) ) diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/botanica/boss_laj.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/botanica/boss_laj.cpp index ad78c98ba21..19f5445b380 100644 --- a/src/bindings/scripts/scripts/zone/tempest_keep/botanica/boss_laj.cpp +++ b/src/bindings/scripts/scripts/zone/tempest_keep/botanica/boss_laj.cpp @@ -159,7 +159,7 @@ struct TRINITY_DLL_DECL boss_lajAI : public ScriptedAI { if( Summon_Timer < diff ) { - DoScriptText(EMOTE_SUMMON, m_creature); + DoScriptText(EMOTE_SUMMON, m_creature); DoSummons(); Summon_Timer = 2500; }else Summon_Timer -= diff; diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/botanica/boss_warp_splinter.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/botanica/boss_warp_splinter.cpp index 3fdadb2903c..3602729587c 100644 --- a/src/bindings/scripts/scripts/zone/tempest_keep/botanica/boss_warp_splinter.cpp +++ b/src/bindings/scripts/scripts/zone/tempest_keep/botanica/boss_warp_splinter.cpp @@ -95,7 +95,7 @@ struct TRINITY_DLL_DECL mob_treantAI : public ScriptedAI #define TREANT_SPAWN_DIST 50 //50 yards from Warp Splinter's spawn point -float treant_pos[6][3] = +float treant_pos[6][3] = { {24.301233, 427.221100, -27.060635}, {16.795492, 359.678802, -27.355425}, @@ -134,27 +134,27 @@ struct TRINITY_DLL_DECL boss_warp_splinterAI : public ScriptedAI void Aggro(Unit *who) { - DoScriptText(SAY_AGGRO, m_creature); + DoScriptText(SAY_AGGRO, m_creature); } void KilledUnit(Unit* victim) { switch(rand()%2) { - case 0: DoScriptText(SAY_SLAY_1, m_creature); break; - case 1: DoScriptText(SAY_SLAY_2, m_creature); break; + case 0: DoScriptText(SAY_SLAY_1, m_creature); break; + case 1: DoScriptText(SAY_SLAY_2, m_creature); break; } } void JustDied(Unit* Killer) { - DoScriptText(SAY_DEATH, m_creature); + DoScriptText(SAY_DEATH, m_creature); } void SummonTreants() { for(int i = 0; i < 6; ++i) - { + { float angle = (M_PI / 3) * i; float X = Treant_Spawn_Pos_X + TREANT_SPAWN_DIST * cos(angle); @@ -165,9 +165,9 @@ struct TRINITY_DLL_DECL boss_warp_splinterAI : public ScriptedAI ((mob_treantAI*)pTreant->AI())->WarpGuid = m_creature->GetGUID(); } switch(rand()%2) - { - case 0: DoScriptText(SAY_SUMMON_1, m_creature); break; - case 1: DoScriptText(SAY_SUMMON_2, m_creature); break; + { + case 0: DoScriptText(SAY_SUMMON_1, m_creature); break; + case 1: DoScriptText(SAY_SUMMON_2, m_creature); break; } } @@ -180,21 +180,21 @@ struct TRINITY_DLL_DECL boss_warp_splinterAI : public ScriptedAI if(War_Stomp_Timer < diff) { DoCast(m_creature->getVictim(),WAR_STOMP); - War_Stomp_Timer = 25000 + rand()%15000; + War_Stomp_Timer = 25000 + rand()%15000; }else War_Stomp_Timer -= diff; //Check for Arcane Volley if(Arcane_Volley_Timer < diff) { DoCast(m_creature->getVictim(),ARCANE_VOLLEY); - Arcane_Volley_Timer = 20000 + rand()%15000; + Arcane_Volley_Timer = 20000 + rand()%15000; }else Arcane_Volley_Timer -= diff; //Check for Summon Treants if(Summon_Treants_Timer < diff) { SummonTreants(); - Summon_Treants_Timer = 45000; + Summon_Treants_Timer = 45000; }else Summon_Treants_Timer -= diff; DoMeleeAttackIfReady(); diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_astromancer.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_astromancer.cpp index 45797e010e6..ea5e8ca9f58 100644 --- a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_astromancer.cpp +++ b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_astromancer.cpp @@ -128,7 +128,7 @@ struct TRINITY_DLL_DECL boss_high_astromancer_solarianAI : public ScriptedAI void StartEvent() { - DoScriptText(SAY_AGGRO, m_creature); + DoScriptText(SAY_AGGRO, m_creature); if(pInstance) pInstance->SetData(DATA_HIGHASTROMANCERSOLARIANEVENT, IN_PROGRESS); @@ -138,9 +138,9 @@ struct TRINITY_DLL_DECL boss_high_astromancer_solarianAI : public ScriptedAI { switch(rand()%3) { - case 0: DoScriptText(SAY_KILL1, m_creature); break; - case 1: DoScriptText(SAY_KILL2, m_creature); break; - case 2: DoScriptText(SAY_KILL3, m_creature); break; + case 0: DoScriptText(SAY_KILL1, m_creature); break; + case 1: DoScriptText(SAY_KILL2, m_creature); break; + case 2: DoScriptText(SAY_KILL3, m_creature); break; } } @@ -148,7 +148,7 @@ struct TRINITY_DLL_DECL boss_high_astromancer_solarianAI : public ScriptedAI { m_creature->SetFloatValue(OBJECT_FIELD_SCALE_X, defaultsize); m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_HUMAN); - DoScriptText(SAY_DEATH, m_creature); + DoScriptText(SAY_DEATH, m_creature); if(pInstance) pInstance->SetData(DATA_HIGHASTROMANCERSOLARIANEVENT, DONE); @@ -164,15 +164,15 @@ struct TRINITY_DLL_DECL boss_high_astromancer_solarianAI : public ScriptedAI Creature* Summoned = m_creature->SummonCreature(entry, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); if(Summoned) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) - Summoned->AI()->AttackStart(target); + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + Summoned->AI()->AttackStart(target); } } float Portal_X(float radius) { if ((rand()%2)==1) - radius = -radius; + radius = -radius; return (radius * (float)(rand()%100)/100.0f + CENTER_X); } @@ -271,7 +271,7 @@ struct TRINITY_DLL_DECL boss_high_astromancer_solarianAI : public ScriptedAI if (MarkOfTheAstromancer_Timer < diff) { //A debuff that lasts for 5 seconds, cast several times each phase on a random raid member, but not the main tank - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1)) + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1)) { DoCast(target, SPELL_MARK_OF_THE_ASTROMANCER); @@ -307,7 +307,7 @@ struct TRINITY_DLL_DECL boss_high_astromancer_solarianAI : public ScriptedAI Portals[i][1] = Portal_Y(Portals[i][0], SMALL_PORTAL_RADIUS); Portals[i][2] = CENTER_Z; } - else + else { Portals[i][0] = Portal_X(LARGE_PORTAL_RADIUS); Portals[i][1] = Portal_Y(Portals[i][0], LARGE_PORTAL_RADIUS); @@ -346,19 +346,19 @@ struct TRINITY_DLL_DECL boss_high_astromancer_solarianAI : public ScriptedAI for (int j=1; j<=4; j++) SummonMinion(SOLARIUM_AGENT, Portals[i][0], Portals[i][1], Portals[i][2]); - DoScriptText(SAY_SUMMON1, m_creature); + DoScriptText(SAY_SUMMON1, m_creature); Phase2_Timer = 10000; } else Phase2_Timer -= diff; } else if(Phase == 3) { - m_creature->AttackStop(); - m_creature->StopMoving(); + m_creature->AttackStop(); + m_creature->StopMoving(); //Check Phase3_Timer if(Phase3_Timer < diff) { - Phase = 1; + Phase = 1; //15 seconds later Solarian reappears out of one of the 3 portals. Simultaneously, 2 healers appear in the two other portals. int i = rand()%3; @@ -402,8 +402,8 @@ struct TRINITY_DLL_DECL boss_high_astromancer_solarianAI : public ScriptedAI //To make sure she wont be invisible or not selecatble m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetVisibility(VISIBILITY_ON); - DoScriptText(SAY_VOIDA, m_creature); - DoScriptText(SAY_VOIDB, m_creature); + DoScriptText(SAY_VOIDA, m_creature); + DoScriptText(SAY_VOIDB, m_creature); m_creature->SetArmor(WV_ARMOR); m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_VOIDWALKER); m_creature->SetFloatValue(OBJECT_FIELD_SCALE_X, defaultsize*2.5f); diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp index 0e84f71d8de..2c9df9cb219 100644 --- a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp +++ b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp @@ -248,23 +248,23 @@ struct TRINITY_DLL_DECL advisorbase_ai : public ScriptedAI void UpdateAI(const uint32 diff) { if (DelayRes_Timer) - { + { if (DelayRes_Timer <= diff) - { - DelayRes_Timer = 0; - FakeDeath = false; + { + DelayRes_Timer = 0; + FakeDeath = false; - Unit* Target = Unit::GetUnit((*m_creature), DelayRes_Target); - if (!Target) - Target = m_creature->getVictim(); - DoResetThreat(); - AttackStart(Target); - m_creature->GetMotionMaster()->Clear(); - m_creature->GetMotionMaster()->MoveChase(Target); - m_creature->AddThreat(Target, 0.0f); - }else DelayRes_Timer -= diff; - } - } + Unit* Target = Unit::GetUnit((*m_creature), DelayRes_Target); + if (!Target) + Target = m_creature->getVictim(); + DoResetThreat(); + AttackStart(Target); + m_creature->GetMotionMaster()->Clear(); + m_creature->GetMotionMaster()->MoveChase(Target); + m_creature->AddThreat(Target, 0.0f); + }else DelayRes_Timer -= diff; + } + } }; //Kael'thas AI @@ -282,7 +282,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI ScriptedInstance* pInstance; - std::list Phoenix; + std::list Phoenix; uint32 Fireball_Timer; uint32 ArcaneDisruption_Timer; @@ -294,7 +294,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI uint32 NetherVapor_Timer; uint32 FlameStrike_Timer; uint32 MindControl_Timer; - uint32 Check_Timer; + uint32 Check_Timer; uint32 Phase; uint32 PhaseSubphase; //generic uint32 Phase_Timer; //generic timer @@ -305,37 +305,37 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI bool ChainPyros; uint64 AdvisorGuid[4]; - uint64 WeaponGuid[7]; + uint64 WeaponGuid[7]; - void DeleteLegs() - { - InstanceMap::PlayerList const &playerliste = ((InstanceMap*)m_creature->GetMap())->GetPlayers(); - InstanceMap::PlayerList::const_iterator it; + void DeleteLegs() + { + InstanceMap::PlayerList const &playerliste = ((InstanceMap*)m_creature->GetMap())->GetPlayers(); + InstanceMap::PlayerList::const_iterator it; - Map::PlayerList const &PlayerList = ((InstanceMap*)m_creature->GetMap())->GetPlayers(); - for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - Player* i_pl = i->getSource(); - i_pl->DestroyItemCount(30312, 1, true); - i_pl->DestroyItemCount(30311, 1, true); - i_pl->DestroyItemCount(30317, 1, true); - i_pl->DestroyItemCount(30316, 1, true); - i_pl->DestroyItemCount(30313, 1, true); - i_pl->DestroyItemCount(30314, 1, true); - i_pl->DestroyItemCount(30318, 1, true); - i_pl->DestroyItemCount(30319, 1, true); - i_pl->DestroyItemCount(30320, 1, true); - } - if(pInstance) { - for(uint32 i = 0; i < 7; i++) { - Creature* weapon = (Creature*)(Unit::GetUnit((*m_creature), WeaponGuid[i]));; - delete weapon; - } - } - } + Map::PlayerList const &PlayerList = ((InstanceMap*)m_creature->GetMap())->GetPlayers(); + for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + Player* i_pl = i->getSource(); + i_pl->DestroyItemCount(30312, 1, true); + i_pl->DestroyItemCount(30311, 1, true); + i_pl->DestroyItemCount(30317, 1, true); + i_pl->DestroyItemCount(30316, 1, true); + i_pl->DestroyItemCount(30313, 1, true); + i_pl->DestroyItemCount(30314, 1, true); + i_pl->DestroyItemCount(30318, 1, true); + i_pl->DestroyItemCount(30319, 1, true); + i_pl->DestroyItemCount(30320, 1, true); + } + if(pInstance) { + for(uint32 i = 0; i < 7; i++) { + Creature* weapon = (Creature*)(Unit::GetUnit((*m_creature), WeaponGuid[i]));; + delete weapon; + } + } + } - void CleanPhoenix() - { + void CleanPhoenix() + { CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); Cell cell(pair); cell.data.Part.reserved = ALL_DISTRICT; @@ -354,10 +354,10 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI { for(std::list::iterator itr = PhoenixList.begin(); itr != PhoenixList.end(); ++itr) { - (*itr)->RemoveFromWorld(); + (*itr)->RemoveFromWorld(); } - } - } + } + } void Reset() { @@ -371,7 +371,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI GravityLapse_Phase = 0; NetherBeam_Timer = 8000; NetherVapor_Timer = 10000; - Check_Timer = 4000; + Check_Timer = 4000; PyrosCasted = 0; Phase = 0; InGravityLapse = false; @@ -381,13 +381,13 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI if(InCombat) PrepareAdvisors(); - DeleteLegs(); - CleanPhoenix(); + DeleteLegs(); + CleanPhoenix(); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); - m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); + m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); + m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); if(pInstance) @@ -419,7 +419,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI AdvisorGuid[1] = pInstance->GetData64(DATA_LORDSANGUINAR); AdvisorGuid[2] = pInstance->GetData64(DATA_GRANDASTROMANCERCAPERNIAN); AdvisorGuid[3] = pInstance->GetData64(DATA_MASTERENGINEERTELONICUS); - m_creature->addUnitState(UNIT_STAT_STUNNED); + m_creature->addUnitState(UNIT_STAT_STUNNED); if(!AdvisorGuid[0] || !AdvisorGuid[1] || !AdvisorGuid[2] || !AdvisorGuid[3]) { @@ -456,32 +456,32 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI void KilledUnit() { - switch(rand()%3) + switch(rand()%3) { - case 0: DoScriptText(SAY_SLAY1, m_creature); break; - case 1: DoScriptText(SAY_SLAY2, m_creature); break; - case 2: DoScriptText(SAY_SLAY3, m_creature); break; + case 0: DoScriptText(SAY_SLAY1, m_creature); break; + case 1: DoScriptText(SAY_SLAY2, m_creature); break; + case 2: DoScriptText(SAY_SLAY3, m_creature); break; } } - void JustSummoned(Creature* summoned) - { - if(summoned->GetEntry() == PHOENIX) - { - summoned->setFaction(m_creature->getFaction()); - Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); - summoned->AI()->AttackStart(target); - } - } + void JustSummoned(Creature* summoned) + { + if(summoned->GetEntry() == PHOENIX) + { + summoned->setFaction(m_creature->getFaction()); + Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); + summoned->AI()->AttackStart(target); + } + } void JustDied(Unit* Killer) { m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - DoScriptText(SAY_DEATH, m_creature); + DoScriptText(SAY_DEATH, m_creature); - DeleteLegs(); + DeleteLegs(); if(pInstance) pInstance->SetData(DATA_KAELTHASEVENT, DONE); @@ -577,7 +577,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI Advisor = (Creature*)(Unit::GetUnit((*m_creature), AdvisorGuid[0])); if(Advisor && (Advisor->GetUInt32Value(UNIT_FIELD_BYTES_1) == PLAYER_STATE_DEAD)) { - DoScriptText(SAY_INTRO_SANGUINAR, m_creature); + DoScriptText(SAY_INTRO_SANGUINAR, m_creature); //start advisor within 12.5 seconds Phase_Timer = 12500; @@ -645,7 +645,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI Advisor = (Creature*)(Unit::GetUnit((*m_creature), AdvisorGuid[2])); if(Advisor && (Advisor->GetUInt32Value(UNIT_FIELD_BYTES_1) == PLAYER_STATE_DEAD)) { - DoScriptText(SAY_INTRO_TELONICUS, m_creature); + DoScriptText(SAY_INTRO_TELONICUS, m_creature); //start advisor within 8.4 seconds Phase_Timer = 8400; @@ -709,7 +709,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI Creature* Weapon; for (uint32 i = 0; i < 7; ++i) { - Unit* Target = SelectUnit(SELECT_TARGET_RANDOM, 0); + Unit* Target = SelectUnit(SELECT_TARGET_RANDOM, 0); Weapon = m_creature->SummonCreature(((uint32)KaelthasWeapons[i][0]),KaelthasWeapons[i][1],KaelthasWeapons[i][2],KaelthasWeapons[i][3],0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); if (!Weapon) @@ -719,7 +719,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI Weapon->setFaction(m_creature->getFaction()); Weapon->AI()->AttackStart(Target); Weapon->CastSpell(Weapon, SPELL_WEAPON_SPAWN, false); - WeaponGuid[i] = Weapon->GetGUID(); + WeaponGuid[i] = Weapon->GetGUID(); } } @@ -735,7 +735,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI Phase = 3; PhaseSubphase = 0; }else Phase_Timer -= diff; - //missing Resetcheck + //missing Resetcheck }break; case 3: @@ -770,7 +770,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) { - m_creature->clearUnitState(UNIT_STAT_STUNNED); + m_creature->clearUnitState(UNIT_STAT_STUNNED); AttackStart(target); } Phase_Timer = 30000; @@ -821,8 +821,8 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI if (FlameStrike_Timer < diff) { - if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0, 70, true)) - DoCast(pUnit, SPELL_FLAME_STRIKE); + if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0, 70, true)) + DoCast(pUnit, SPELL_FLAME_STRIKE); FlameStrike_Timer = 30000; }FlameStrike_Timer -= diff; @@ -833,10 +833,10 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI for (uint32 i = 0; i < 3; i++) { - Unit* target =SelectUnit(SELECT_TARGET_RANDOM, 1, 70, true); - if(!target) target = m_creature->getVictim(); - debug_log("TSCR: Kael'Thas mind control not supported."); - DoCast(target, SPELL_MIND_CONTROL); + Unit* target =SelectUnit(SELECT_TARGET_RANDOM, 1, 70, true); + if(!target) target = m_creature->getVictim(); + debug_log("TSCR: Kael'Thas mind control not supported."); + DoCast(target, SPELL_MIND_CONTROL); } MindControl_Timer = 60000; @@ -846,11 +846,11 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI //Phoenix_Timer if(Phoenix_Timer < diff) { - DoCast(m_creature, SPELL_SUMMON_PHOENIX); - switch(rand()%2) - { - case 0: DoScriptText(SAY_SUMMON_PHOENIX1, m_creature); break; - case 1: DoScriptText(SAY_SUMMON_PHOENIX2, m_creature); break; + DoCast(m_creature, SPELL_SUMMON_PHOENIX); + switch(rand()%2) + { + case 0: DoScriptText(SAY_SUMMON_PHOENIX1, m_creature); break; + case 1: DoScriptText(SAY_SUMMON_PHOENIX2, m_creature); break; } Phoenix_Timer = 60000; @@ -865,7 +865,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI Phase = 5; Phase_Timer = 10000; - DoScriptText(SAY_PHASE5_NUTS, m_creature); + DoScriptText(SAY_PHASE5_NUTS, m_creature); m_creature->StopMoving(); m_creature->GetMotionMaster()->Clear(); @@ -884,22 +884,22 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI DoCast(m_creature, SPELL_SHOCK_BARRIER); ChainPyros = true; PyrosCasted = 0; - Check_Timer = 0; + Check_Timer = 0; ShockBarrier_Timer = 60000; }else ShockBarrier_Timer -= diff; //Chain Pyros (3 of them max) - if (ChainPyros){ - if (PyrosCasted < 3 && Check_Timer < diff) + if (ChainPyros){ + if (PyrosCasted < 3 && Check_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_PYROBLAST); ++PyrosCasted; - Check_Timer = 4400; - }else Check_Timer -= diff; - if(PyrosCasted > 3) - { + Check_Timer = 4400; + }else Check_Timer -= diff; + if(PyrosCasted > 3) + { ChainPyros = false; Fireball_Timer = 2500; ArcaneDisruption_Timer = 60000; @@ -916,7 +916,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI DoCast(m_creature, SPELL_EXPLODE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); Phase = 6; - DoStartMovement(m_creature->getVictim()); + DoStartMovement(m_creature->getVictim()); AttackStart(m_creature->getVictim()); }else Phase_Timer -= diff; } @@ -957,8 +957,8 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI case 1: switch(rand()%2) { - case 0: DoScriptText(SAY_GRAVITYLAPSE1, m_creature); break; - case 1: DoScriptText(SAY_GRAVITYLAPSE2, m_creature); break; + case 0: DoScriptText(SAY_GRAVITYLAPSE1, m_creature); break; + case 1: DoScriptText(SAY_GRAVITYLAPSE2, m_creature); break; } // 2) At that point he will put a Gravity Lapse debuff on everyone @@ -1013,7 +1013,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI InGravityLapse = false; GravityLapse_Timer = 60000; GravityLapse_Phase = 0; - DoStartMovement(m_creature->getVictim()); + DoStartMovement(m_creature->getVictim()); AttackStart(m_creature->getVictim()); DoResetThreat(); break; @@ -1032,8 +1032,8 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI //NetherBeam_Timer if(NetherBeam_Timer < diff) { - if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_NETHER_BEAM); + if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pUnit, SPELL_NETHER_BEAM); NetherBeam_Timer = 4000; }else NetherBeam_Timer -= diff; @@ -1067,8 +1067,8 @@ struct TRINITY_DLL_DECL boss_thaladred_the_darkenerAI : public advisorbase_ai void JustDied(Unit* pKiller) { - DoScriptText(SAY_THALADRED_DEATH, m_creature); - } + DoScriptText(SAY_THALADRED_DEATH, m_creature); + } void Aggro(Unit *who) { @@ -1101,7 +1101,7 @@ struct TRINITY_DLL_DECL boss_thaladred_the_darkenerAI : public advisorbase_ai { DoResetThreat(); m_creature->AddThreat(target, 5000000.0f); - DoScriptText(EMOTE_THALADRED_GAZE, m_creature, target); + DoScriptText(EMOTE_THALADRED_GAZE, m_creature, target); Gaze_Timer = 8500; } }else Gaze_Timer -= diff; @@ -1139,7 +1139,7 @@ struct TRINITY_DLL_DECL boss_lord_sanguinarAI : public advisorbase_ai void JustDied(Unit* Killer) { - DoScriptText(SAY_SANGUINAR_DEATH, m_creature); + DoScriptText(SAY_SANGUINAR_DEATH, m_creature); } void Aggro(Unit *who) @@ -1150,7 +1150,7 @@ struct TRINITY_DLL_DECL boss_lord_sanguinarAI : public advisorbase_ai if (!who || FakeDeath) return; - DoScriptText(SAY_SANGUINAR_AGGRO, m_creature); + DoScriptText(SAY_SANGUINAR_AGGRO, m_creature); } void UpdateAI(const uint32 diff) @@ -1245,14 +1245,14 @@ struct TRINITY_DLL_DECL boss_grand_astromancer_capernianAI : public advisorbase_ //Yell_Timer if(!Yell) - { + { if(Yell_Timer < diff) - { - DoScriptText(SAY_CAPERNIAN_AGGRO, m_creature); + { + DoScriptText(SAY_CAPERNIAN_AGGRO, m_creature); - Yell = true; - }else Yell_Timer -= diff; - } + Yell = true; + }else Yell_Timer -= diff; + } //Fireball_Timer if(Fireball_Timer < diff) @@ -1562,7 +1562,7 @@ CreatureAI* GetAI_mob_phoenix_tk(Creature *_Creature) CreatureAI* GetAI_mob_phoenix_egg_tk(Creature *_Creature) { - return new mob_phoenix_egg_tkAI (_Creature); + return new mob_phoenix_egg_tkAI (_Creature); } void AddSC_boss_kaelthas() { @@ -1602,8 +1602,8 @@ void AddSC_boss_kaelthas() newscript->GetAI = &GetAI_mob_phoenix_tk; newscript->RegisterSelf(); - newscript = new Script; - newscript->Name = "mob_phoenix_egg_tk"; - newscript->GetAI = &GetAI_mob_phoenix_egg_tk; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name = "mob_phoenix_egg_tk"; + newscript->GetAI = &GetAI_mob_phoenix_egg_tk; + newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_void_reaver.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_void_reaver.cpp index 82d4e22d3dd..14a2dc60f33 100644 --- a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_void_reaver.cpp +++ b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_void_reaver.cpp @@ -57,12 +57,12 @@ struct TRINITY_DLL_DECL boss_void_reaverAI : public ScriptedAI m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true); - Pounding_Timer = 15000; + Pounding_Timer = 15000; ArcaneOrb_Timer = 3000; KnockAway_Timer = 30000; Berserk_Timer = 600000; - if (pInstance && m_creature->isAlive()) + if (pInstance && m_creature->isAlive()) pInstance->SetData(DATA_VOIDREAVEREVENT, NOT_STARTED); } @@ -70,9 +70,9 @@ struct TRINITY_DLL_DECL boss_void_reaverAI : public ScriptedAI { switch(rand()%3) { - case 0: DoScriptText(SAY_SLAY1, m_creature); break; - case 1: DoScriptText(SAY_SLAY2, m_creature); break; - case 2: DoScriptText(SAY_SLAY3, m_creature); break; + case 0: DoScriptText(SAY_SLAY1, m_creature); break; + case 1: DoScriptText(SAY_SLAY2, m_creature); break; + case 2: DoScriptText(SAY_SLAY3, m_creature); break; } } @@ -104,8 +104,8 @@ struct TRINITY_DLL_DECL boss_void_reaverAI : public ScriptedAI switch(rand()%2) { - case 0: DoScriptText(SAY_POUNDING1, m_creature); break; - case 1: DoScriptText(SAY_POUNDING2, m_creature); break; + case 0: DoScriptText(SAY_POUNDING1, m_creature); break; + case 1: DoScriptText(SAY_POUNDING2, m_creature); break; } Pounding_Timer = 15000; //cast time(3000) + cooldown time(12000) }else Pounding_Timer -= diff; @@ -113,7 +113,7 @@ struct TRINITY_DLL_DECL boss_void_reaverAI : public ScriptedAI // Arcane Orb if(ArcaneOrb_Timer < diff) { - Unit *target = NULL; + Unit *target = NULL; std::list t_list = m_creature->getThreatManager().getThreatList(); std::vector target_list; for(std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) @@ -128,7 +128,7 @@ struct TRINITY_DLL_DECL boss_void_reaverAI : public ScriptedAI target = *(target_list.begin()+rand()%target_list.size()); if (target) - m_creature->CastSpell(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), SPELL_ARCANE_ORB, false); + m_creature->CastSpell(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), SPELL_ARCANE_ORB, false); ArcaneOrb_Timer = 3000; }else ArcaneOrb_Timer -= diff; diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/def_the_eye.h b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/def_the_eye.h index 2a6492fdd74..42b3af63421 100644 --- a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/def_the_eye.h +++ b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/def_the_eye.h @@ -15,5 +15,5 @@ #define DATA_MASTERENGINEERTELONICUS 8 #define DATA_THALADREDTHEDARKENER 10 #define DATA_VOIDREAVEREVENT 11 -#define DATA_ALAR 12 +#define DATA_ALAR 12 #endif diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/instance_the_eye.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/instance_the_eye.cpp index b92d18ac54e..20bd72ab593 100644 --- a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/instance_the_eye.cpp +++ b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/instance_the_eye.cpp @@ -85,7 +85,7 @@ struct TRINITY_DLL_DECL instance_the_eye : public ScriptedInstance case 20060: LordSanguinar = creature->GetGUID(); break; case 19622: Kaelthas = creature->GetGUID(); break; case 18805: Astromancer = creature->GetGUID(); break; - case 19514: Alar = creature->GetGUID(); break; + case 19514: Alar = creature->GetGUID(); break; } } @@ -93,13 +93,13 @@ struct TRINITY_DLL_DECL instance_the_eye : public ScriptedInstance { switch(identifier) { - case DATA_THALADREDTHEDARKENER: return ThaladredTheDarkener; - case DATA_LORDSANGUINAR: return LordSanguinar; - case DATA_GRANDASTROMANCERCAPERNIAN: return GrandAstromancerCapernian; - case DATA_MASTERENGINEERTELONICUS: return MasterEngineerTelonicus; - case DATA_KAELTHAS: return Kaelthas; - case DATA_ASTROMANCER: return Astromancer; - case DATA_ALAR: return Alar; + case DATA_THALADREDTHEDARKENER: return ThaladredTheDarkener; + case DATA_LORDSANGUINAR: return LordSanguinar; + case DATA_GRANDASTROMANCERCAPERNIAN: return GrandAstromancerCapernian; + case DATA_MASTERENGINEERTELONICUS: return MasterEngineerTelonicus; + case DATA_KAELTHAS: return Kaelthas; + case DATA_ASTROMANCER: return Astromancer; + case DATA_ALAR: return Alar; } return 0; } @@ -108,30 +108,30 @@ struct TRINITY_DLL_DECL instance_the_eye : public ScriptedInstance { switch(type) { - case DATA_ALAREVENT: AlarEventPhase = data; Encounters[0] = data; break; - case DATA_HIGHASTROMANCERSOLARIANEVENT: Encounters[1] = data; break; - case DATA_VOIDREAVEREVENT: Encounters[2] = data; break; - case DATA_KAELTHASEVENT: KaelthasEventPhase = data; Encounters[3] = data; break; + case DATA_ALAREVENT: AlarEventPhase = data; Encounters[0] = data; break; + case DATA_HIGHASTROMANCERSOLARIANEVENT: Encounters[1] = data; break; + case DATA_VOIDREAVEREVENT: Encounters[2] = data; break; + case DATA_KAELTHASEVENT: KaelthasEventPhase = data; Encounters[3] = data; break; } - if(data == DONE) - SaveToDB(); + if(data == DONE) + SaveToDB(); } uint32 GetData(uint32 type) { switch(type) { - case DATA_ALAREVENT: return AlarEventPhase; - case DATA_HIGHASTROMANCERSOLARIANEVENT: return Encounters[1]; - case DATA_VOIDREAVEREVENT: return Encounters[2]; - case DATA_KAELTHASEVENT: return KaelthasEventPhase; + case DATA_ALAREVENT: return AlarEventPhase; + case DATA_HIGHASTROMANCERSOLARIANEVENT: return Encounters[1]; + case DATA_VOIDREAVEREVENT: return Encounters[2]; + case DATA_KAELTHASEVENT: return KaelthasEventPhase; } return 0; } - const char* Save() - { - OUT_SAVE_INST_DATA; + const char* Save() + { + OUT_SAVE_INST_DATA; std::ostringstream stream; stream << Encounters[0] << " " << Encounters[1] << " " << Encounters[2] << " " << Encounters[3]; char* out = new char[stream.str().length() + 1]; @@ -154,10 +154,10 @@ struct TRINITY_DLL_DECL instance_the_eye : public ScriptedInstance OUT_LOAD_INST_DATA(in); std::istringstream stream(in); stream >> Encounters[0] >> Encounters[1] >> Encounters[2] >> Encounters[3]; - for(uint8 i = 0; i < ENCOUNTERS; ++i) - if(Encounters[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. - Encounters[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; + for(uint8 i = 0; i < ENCOUNTERS; ++i) + if(Encounters[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. + Encounters[i] = NOT_STARTED; + OUT_LOAD_INST_DATA_COMPLETE; } }; diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_gatewatcher_ironhand.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_gatewatcher_ironhand.cpp index de9526d495a..2a7d9eae3dc 100644 --- a/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_gatewatcher_ironhand.cpp +++ b/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_gatewatcher_ironhand.cpp @@ -32,26 +32,26 @@ EndScriptData */ #define EMOTE_HAMMER -1554012 // Spells to be casted -#define SPELL_SHADOW_POWER 35322 +#define SPELL_SHADOW_POWER 35322 #define H_SPELL_SHADOW_POWER 39193 #define SPELL_HAMMER_PUNCH 35326 #define SPELL_JACKHAMMER 35327 #define H_SPELL_JACKHAMMER 39194 -#define SPELL_STREAM_OF_MACHINE_FLUID 35311 +#define SPELL_STREAM_OF_MACHINE_FLUID 35311 // Gatewatcher Iron-Hand AI struct TRINITY_DLL_DECL boss_gatewatcher_iron_handAI : public ScriptedAI { boss_gatewatcher_iron_handAI(Creature *c) : ScriptedAI(c) { - pInstance = ((ScriptedInstance*)c->GetInstanceData()); - HeroicMode = m_creature->GetMap()->IsHeroic(); - Reset(); + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + HeroicMode = m_creature->GetMap()->IsHeroic(); + Reset(); } - ScriptedInstance *pInstance; + ScriptedInstance *pInstance; - bool HeroicMode; + bool HeroicMode; uint32 Shadow_Power_Timer; uint32 Jackhammer_Timer; @@ -66,7 +66,7 @@ boss_gatewatcher_iron_handAI(Creature *c) : ScriptedAI(c) } void Aggro(Unit *who) { - DoScriptText(SAY_AGGRO_1, m_creature); + DoScriptText(SAY_AGGRO_1, m_creature); } void KilledUnit(Unit* victim) @@ -76,20 +76,20 @@ boss_gatewatcher_iron_handAI(Creature *c) : ScriptedAI(c) switch(rand()%2) { - case 0: DoScriptText(SAY_SLAY_1, m_creature); break; - case 1: DoScriptText(SAY_SLAY_2, m_creature); break; + case 0: DoScriptText(SAY_SLAY_1, m_creature); break; + case 1: DoScriptText(SAY_SLAY_2, m_creature); break; } } void JustDied(Unit* Killer) { - DoScriptText(SAY_DEATH_1, m_creature); + DoScriptText(SAY_DEATH_1, m_creature); - if (!pInstance) - return; + if (!pInstance) + return; - //TODO: Add door check/open code - } + //TODO: Add door check/open code + } void UpdateAI(const uint32 diff) { @@ -100,25 +100,25 @@ boss_gatewatcher_iron_handAI(Creature *c) : ScriptedAI(c) //Shadow Power if(Shadow_Power_Timer < diff) { - DoCast(m_creature,HeroicMode ? H_SPELL_SHADOW_POWER : SPELL_SHADOW_POWER); + DoCast(m_creature,HeroicMode ? H_SPELL_SHADOW_POWER : SPELL_SHADOW_POWER); Shadow_Power_Timer = 20000 + rand()%8000; }else Shadow_Power_Timer -= diff; //Jack Hammer if(Jackhammer_Timer < diff) { - //TODO: expect cast this about 5 times in a row (?), announce it by emote only once - DoScriptText(EMOTE_HAMMER, m_creature); - DoCast(m_creature->getVictim(),HeroicMode ? H_SPELL_JACKHAMMER : SPELL_JACKHAMMER); + //TODO: expect cast this about 5 times in a row (?), announce it by emote only once + DoScriptText(EMOTE_HAMMER, m_creature); + DoCast(m_creature->getVictim(),HeroicMode ? H_SPELL_JACKHAMMER : SPELL_JACKHAMMER); - //chance to yell, but not same time as emote (after spell in fact casted) - if (rand()%2) + //chance to yell, but not same time as emote (after spell in fact casted) + if (rand()%2) return; switch(rand()%2) { - case 0: DoScriptText(SAY_HAMMER_1, m_creature); break; - case 1: DoScriptText(SAY_HAMMER_2, m_creature); break; + case 0: DoScriptText(SAY_HAMMER_1, m_creature); break; + case 1: DoScriptText(SAY_HAMMER_2, m_creature); break; } Jackhammer_Timer = 30000; }else Jackhammer_Timer -= diff; @@ -131,7 +131,7 @@ boss_gatewatcher_iron_handAI(Creature *c) : ScriptedAI(c) }else Stream_of_Machine_Fluid_Timer -= diff; DoMeleeAttackIfReady(); - } + } }; CreatureAI* GetAI_boss_gatewatcher_iron_hand(Creature *_Creature) { diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_nethermancer_sepethrea.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_nethermancer_sepethrea.cpp index 31293ca9f56..01c786be535 100644 --- a/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_nethermancer_sepethrea.cpp +++ b/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_nethermancer_sepethrea.cpp @@ -44,14 +44,14 @@ struct TRINITY_DLL_DECL boss_nethermancer_sepethreaAI : public ScriptedAI { boss_nethermancer_sepethreaAI(Creature *c) : ScriptedAI(c) { - pInstance = ((ScriptedInstance*)c->GetInstanceData()); - HeroicMode = m_creature->GetMap()->IsHeroic(); - Reset(); + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + HeroicMode = m_creature->GetMap()->IsHeroic(); + Reset(); } - ScriptedInstance *pInstance; + ScriptedInstance *pInstance; - bool HeroicMode; + bool HeroicMode; uint32 frost_attack_Timer; uint32 arcane_blast_Timer; @@ -70,25 +70,25 @@ boss_nethermancer_sepethreaAI(Creature *c) : ScriptedAI(c) void Aggro(Unit *who) { - DoScriptText(SAY_AGGRO, m_creature); + DoScriptText(SAY_AGGRO, m_creature); - //Summon two guards, three in heroic - uint8 am = (HeroicMode ? 1 : 2); - for(int i = 0; i < am; i++) - { - DoCast(who,SPELL_SUMMON_RAGIN_FLAMES); - } - DoScriptText(SAY_SUMMON, m_creature); + //Summon two guards, three in heroic + uint8 am = (HeroicMode ? 1 : 2); + for(int i = 0; i < am; i++) + { + DoCast(who,SPELL_SUMMON_RAGIN_FLAMES); + } + DoScriptText(SAY_SUMMON, m_creature); } void KilledUnit(Unit* victim) { - switch(rand()%2) - { - case 0: DoScriptText(SAY_SLAY1, m_creature); break; - case 1: DoScriptText(SAY_SLAY2, m_creature); break; - } - } + switch(rand()%2) + { + case 0: DoScriptText(SAY_SLAY1, m_creature); break; + case 1: DoScriptText(SAY_SLAY2, m_creature); break; + } + } void JustDied(Unit* Killer) { @@ -128,8 +128,8 @@ boss_nethermancer_sepethreaAI(Creature *c) : ScriptedAI(c) switch(rand()%2) { - case 0: DoScriptText(SAY_DRAGONS_BREATH_1, m_creature); break; - case 1: DoScriptText(SAY_DRAGONS_BREATH_2, m_creature); break; + case 0: DoScriptText(SAY_DRAGONS_BREATH_1, m_creature); break; + case 1: DoScriptText(SAY_DRAGONS_BREATH_2, m_creature); break; } } dragons_breath_Timer = 12000 + rand()%10000; @@ -169,12 +169,12 @@ struct TRINITY_DLL_DECL mob_ragin_flamesAI : public ScriptedAI { pInstance = ((ScriptedInstance*)c->GetInstanceData()); Reset(); - HeroicMode = m_creature->GetMap()->IsHeroic(); + HeroicMode = m_creature->GetMap()->IsHeroic(); } ScriptedInstance *pInstance; - bool HeroicMode; + bool HeroicMode; uint32 inferno_Timer; uint32 flame_timer; @@ -203,8 +203,8 @@ struct TRINITY_DLL_DECL mob_ragin_flamesAI : public ScriptedAI if (!onlyonce) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) - m_creature->GetMotionMaster()->MoveChase(target); + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + m_creature->GetMotionMaster()->MoveChase(target); onlyonce = true; } diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_pathaleon_the_calculator.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_pathaleon_the_calculator.cpp index 18fe0a6476b..c93d38a0d6e 100644 --- a/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_pathaleon_the_calculator.cpp +++ b/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_pathaleon_the_calculator.cpp @@ -81,21 +81,21 @@ struct TRINITY_DLL_DECL boss_pathaleon_the_calculatorAI : public ScriptedAI } void Aggro(Unit *who) { - DoScriptText(SAY_AGGRO, m_creature); + DoScriptText(SAY_AGGRO, m_creature); } void KilledUnit(Unit* victim) { - switch(rand()%2) - { - case 0: DoScriptText(SAY_SLAY_1, m_creature); break; - case 1: DoScriptText(SAY_SLAY_2, m_creature); break; - } - } + switch(rand()%2) + { + case 0: DoScriptText(SAY_SLAY_1, m_creature); break; + case 1: DoScriptText(SAY_SLAY_2, m_creature); break; + } + } void JustDied(Unit* Killer) { - DoScriptText(SAY_DEATH, m_creature); + DoScriptText(SAY_DEATH, m_creature); } void UpdateAI(const uint32 diff) @@ -108,14 +108,14 @@ struct TRINITY_DLL_DECL boss_pathaleon_the_calculatorAI : public ScriptedAI { for(int i = 0; i < 3;i++) { - Unit* target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM,0); - Creature* Wraith = m_creature->SummonCreature(21062,m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - if (target && Wraith) - Wraith->AI()->AttackStart(target); + Unit* target = NULL; + target = SelectUnit(SELECT_TARGET_RANDOM,0); + Creature* Wraith = m_creature->SummonCreature(21062,m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + if (target && Wraith) + Wraith->AI()->AttackStart(target); } - DoScriptText(SAY_SUMMON, m_creature); - Summon_Timer = 30000 + rand()%15000; + DoScriptText(SAY_SUMMON, m_creature); + Summon_Timer = 30000 + rand()%15000; }else Summon_Timer -= diff; if(ManaTap_Timer < diff) @@ -132,18 +132,18 @@ struct TRINITY_DLL_DECL boss_pathaleon_the_calculatorAI : public ScriptedAI if(Domination_Timer < diff) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1)) - { - switch(rand()%2) - { - case 0: DoScriptText(SAY_DOMINATION_1, m_creature); break; - case 1: DoScriptText(SAY_DOMINATION_2, m_creature); break; - } + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1)) + { + switch(rand()%2) + { + case 0: DoScriptText(SAY_DOMINATION_1, m_creature); break; + case 1: DoScriptText(SAY_DOMINATION_2, m_creature); break; + } - DoCast(target,SPELL_DOMINATION); - } - Domination_Timer = 25000 + rand()%5000; - }else Domination_Timer -= diff; + DoCast(target,SPELL_DOMINATION); + } + Domination_Timer = 25000 + rand()%5000; + }else Domination_Timer -= diff; //Only casting if Heroic Mode is used if (HeroicMode) @@ -157,8 +157,8 @@ struct TRINITY_DLL_DECL boss_pathaleon_the_calculatorAI : public ScriptedAI if (!Enraged && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 21) { - DoCast(m_creature, SPELL_FRENZY); - DoScriptText(SAY_ENRAGE, m_creature); + DoCast(m_creature, SPELL_FRENZY); + DoScriptText(SAY_ENRAGE, m_creature); Enraged = true; } @@ -202,13 +202,13 @@ struct TRINITY_DLL_DECL mob_nether_wraithAI : public ScriptedAI if(ArcaneMissiles_Timer < diff) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1)) - DoCast(target,SPELL_ARCANE_MISSILES); - else - DoCast(m_creature->getVictim(),SPELL_ARCANE_MISSILES); + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1)) + DoCast(target,SPELL_ARCANE_MISSILES); + else + DoCast(m_creature->getVictim(),SPELL_ARCANE_MISSILES); - ArcaneMissiles_Timer = 5000 + rand()%5000; - }else ArcaneMissiles_Timer -=diff; + ArcaneMissiles_Timer = 5000 + rand()%5000; + }else ArcaneMissiles_Timer -=diff; if (!Detonation) { diff --git a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp index ede0c649b36..52106a6825f 100644 --- a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp +++ b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp @@ -576,7 +576,7 @@ struct TRINITY_DLL_DECL cthunAI : public Scripted_NoMovementAI if (Player* i_pl = i->getSource()) { //Play random sound to the zone - i_pl->SendPlaySound(RANDOM_SOUND_WHISPER, true); + i_pl->SendPlaySound(RANDOM_SOUND_WHISPER, true); } } diff --git a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_sartura.cpp b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_sartura.cpp index 8fe53cc70a1..918ad92c6e2 100644 --- a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_sartura.cpp +++ b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_sartura.cpp @@ -70,18 +70,18 @@ struct TRINITY_DLL_DECL boss_sarturaAI : public ScriptedAI void Aggro(Unit *who) { - DoScriptText(SAY_AGGRO, m_creature); + DoScriptText(SAY_AGGRO, m_creature); } - void JustDied(Unit* Killer) - { - DoScriptText(SAY_DEATH, m_creature); - } + void JustDied(Unit* Killer) + { + DoScriptText(SAY_DEATH, m_creature); + } - void KilledUnit(Unit* victim) - { - DoScriptText(SAY_SLAY, m_creature); - } + void KilledUnit(Unit* victim) + { + DoScriptText(SAY_SLAY, m_creature); + } void UpdateAI(const uint32 diff) { diff --git a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_skeram.cpp b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_skeram.cpp index 9e6cdf2abb7..ffea6281d60 100644 --- a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_skeram.cpp +++ b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_skeram.cpp @@ -53,7 +53,7 @@ struct TRINITY_DLL_DECL boss_skeramAI : public ScriptedAI { boss_skeramAI(Creature *c) : ScriptedAI(c) { - pInstance = ((ScriptedInstance*)c->GetInstanceData()); + pInstance = ((ScriptedInstance*)c->GetInstanceData()); IsImage = false; Reset(); } @@ -98,16 +98,16 @@ struct TRINITY_DLL_DECL boss_skeramAI : public ScriptedAI { switch(rand()%3) { - case 0: DoScriptText(SAY_SLAY1, m_creature); break; - case 1: DoScriptText(SAY_SLAY2, m_creature); break; - case 2: DoScriptText(SAY_SLAY3, m_creature); break; + case 0: DoScriptText(SAY_SLAY1, m_creature); break; + case 1: DoScriptText(SAY_SLAY2, m_creature); break; + case 2: DoScriptText(SAY_SLAY3, m_creature); break; } } void JustDied(Unit* Killer) { if (!IsImage) - DoScriptText(SAY_DEATH, m_creature); + DoScriptText(SAY_DEATH, m_creature); } void Aggro(Unit *who) @@ -116,9 +116,9 @@ struct TRINITY_DLL_DECL boss_skeramAI : public ScriptedAI return; switch(rand()%3) { - case 0: DoScriptText(SAY_AGGRO1, m_creature); break; - case 1: DoScriptText(SAY_AGGRO2, m_creature); break; - case 2: DoScriptText(SAY_AGGRO3, m_creature); break; + case 0: DoScriptText(SAY_AGGRO1, m_creature); break; + case 1: DoScriptText(SAY_AGGRO2, m_creature); break; + case 2: DoScriptText(SAY_AGGRO3, m_creature); break; } } @@ -212,7 +212,7 @@ struct TRINITY_DLL_DECL boss_skeramAI : public ScriptedAI void DoSplit(int atPercent /* 75 50 25 */) { - DoScriptText(SAY_SPLIT, m_creature); + DoScriptText(SAY_SPLIT, m_creature); ov_mycoordinates *place1 = new ov_mycoordinates(-8340.782227,2083.814453,125.648788,0); ov_mycoordinates *place2 = new ov_mycoordinates(-8341.546875,2118.504639,133.058151,0); @@ -224,18 +224,18 @@ struct TRINITY_DLL_DECL boss_skeramAI : public ScriptedAI { case 0: bossc=place1; - i1=place2; - i2=place3; + i1=place2; + i2=place3; break; case 1: bossc=place2; - i1=place1; - i2=place3; + i1=place1; + i2=place3; break; case 2: bossc=place3; - i1=place1; - i2=place2; + i1=place1; + i2=place2; break; } @@ -272,18 +272,18 @@ struct TRINITY_DLL_DECL boss_skeramAI : public ScriptedAI case 25: Images25 = true; break; } - Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0); + Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0); Image1 = m_creature->SummonCreature(15263, i1->x, i1->y, i1->z, i1->r, TEMPSUMMON_CORPSE_DESPAWN, 30000); Image1->SetMaxHealth(m_creature->GetMaxHealth() / 5); Image1->SetHealth(m_creature->GetHealth() / 5); - if (target) + if (target) Image1->AI()->AttackStart(target); Image2 = m_creature->SummonCreature(15263,i2->x, i2->y, i2->z, i2->r, TEMPSUMMON_CORPSE_DESPAWN, 30000); Image2->SetMaxHealth(m_creature->GetMaxHealth() / 5); Image2->SetHealth(m_creature->GetHealth() / 5); - if (target) + if (target) Image2->AI()->AttackStart(target); ((boss_skeramAI*)Image1->AI())->IsImage = true; diff --git a/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp b/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp index d03579bdaff..444e8b0a528 100644 --- a/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp +++ b/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp @@ -360,135 +360,135 @@ bool GossipSelect_npc_skyguard_handler_deesak(Player *player, Creature *_Creatur ## npc_isla_starmane ######*/ -#define SAY_PROGRESS_1 -1000353 -#define SAY_PROGRESS_2 -1000354 -#define SAY_PROGRESS_3 -1000355 -#define SAY_PROGRESS_4 -1000356 +#define SAY_PROGRESS_1 -1000353 +#define SAY_PROGRESS_2 -1000354 +#define SAY_PROGRESS_3 -1000355 +#define SAY_PROGRESS_4 -1000356 -#define QUEST_EFTW_H 10052 -#define QUEST_EFTW_A 10051 -#define GO_CAGE 182794 -#define SPELL_CAT 32447 +#define QUEST_EFTW_H 10052 +#define QUEST_EFTW_A 10051 +#define GO_CAGE 182794 +#define SPELL_CAT 32447 struct TRINITY_DLL_DECL npc_isla_starmaneAI : public npc_escortAI { - npc_isla_starmaneAI(Creature* c) : npc_escortAI(c) {Reset();} + npc_isla_starmaneAI(Creature* c) : npc_escortAI(c) {Reset();} - bool Completed; + bool Completed; - void WaypointReached(uint32 i) - { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + void WaypointReached(uint32 i) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - if(!player) - return; + if(!player) + return; - switch(i) - { - case 0: - { - GameObject* Cage = FindGameObject(GO_CAGE, 10, m_creature); - if(Cage) - Cage->SetGoState(0); - }break; - case 2: DoScriptText(SAY_PROGRESS_1, m_creature, player); break; - case 5: DoScriptText(SAY_PROGRESS_2, m_creature, player); break; - case 6: DoScriptText(SAY_PROGRESS_3, m_creature, player); break; - case 29:DoScriptText(SAY_PROGRESS_4, m_creature, player); - if (player) - { - if(((Player*)player)->GetTeam() == ALLIANCE) - ((Player*)player)->GroupEventHappens(QUEST_EFTW_A, m_creature); - else if(((Player*)player)->GetTeam() == HORDE) - ((Player*)player)->GroupEventHappens(QUEST_EFTW_H, m_creature); - } Completed = true; - m_creature->SetInFront(player); break; - case 30: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break; - case 31: DoCast(m_creature, SPELL_CAT); - m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; - } - } + switch(i) + { + case 0: + { + GameObject* Cage = FindGameObject(GO_CAGE, 10, m_creature); + if(Cage) + Cage->SetGoState(0); + }break; + case 2: DoScriptText(SAY_PROGRESS_1, m_creature, player); break; + case 5: DoScriptText(SAY_PROGRESS_2, m_creature, player); break; + case 6: DoScriptText(SAY_PROGRESS_3, m_creature, player); break; + case 29:DoScriptText(SAY_PROGRESS_4, m_creature, player); + if (player) + { + if(((Player*)player)->GetTeam() == ALLIANCE) + ((Player*)player)->GroupEventHappens(QUEST_EFTW_A, m_creature); + else if(((Player*)player)->GetTeam() == HORDE) + ((Player*)player)->GroupEventHappens(QUEST_EFTW_H, m_creature); + } Completed = true; + m_creature->SetInFront(player); break; + case 30: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break; + case 31: DoCast(m_creature, SPELL_CAT); + m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; + } + } - void Reset() - { - Completed = false; + void Reset() + { + Completed = false; m_creature->setFaction(1660); - } + } - void Aggro(Unit* who){} + void Aggro(Unit* who){} - void JustDied(Unit* killer) - { - if (PlayerGUID) - { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - if (player && !Completed) - { - if(((Player*)player)->GetTeam() == ALLIANCE) - ((Player*)player)->FailQuest(QUEST_EFTW_A); - else if(((Player*)player)->GetTeam() == HORDE) - ((Player*)player)->FailQuest(QUEST_EFTW_H); - } - } - } + void JustDied(Unit* killer) + { + if (PlayerGUID) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + if (player && !Completed) + { + if(((Player*)player)->GetTeam() == ALLIANCE) + ((Player*)player)->FailQuest(QUEST_EFTW_A); + else if(((Player*)player)->GetTeam() == HORDE) + ((Player*)player)->FailQuest(QUEST_EFTW_H); + } + } + } - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + } }; bool QuestAccept_npc_isla_starmane(Player* player, Creature* creature, Quest const* quest) { - if (quest->GetQuestId() == QUEST_EFTW_H || quest->GetQuestId() == QUEST_EFTW_A) + if (quest->GetQuestId() == QUEST_EFTW_H || quest->GetQuestId() == QUEST_EFTW_A) { ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); - creature->setFaction(113); + creature->setFaction(113); } return true; } CreatureAI* GetAI_npc_isla_starmaneAI(Creature *_Creature) { - npc_isla_starmaneAI* thisAI = new npc_isla_starmaneAI(_Creature); + npc_isla_starmaneAI* thisAI = new npc_isla_starmaneAI(_Creature); - thisAI->AddWaypoint(0, -2265.21, 3091.14, 13.91); - thisAI->AddWaypoint(1, -2266.80, 3091.33, 13.82, 1000); - thisAI->AddWaypoint(2, -2268.20, 3091.14, 13.82, 7000);//progress1 - thisAI->AddWaypoint(3, -2278.32, 3098.98, 13.82); - thisAI->AddWaypoint(4, -2294.82, 3110.59, 13.82); - thisAI->AddWaypoint(5, -2300.71, 3114.60, 13.82, 20000);//progress2 - thisAI->AddWaypoint(6, -2300.71, 3114.60, 13.82, 3000);//progress3 - thisAI->AddWaypoint(7, -2307.36, 3122.76, 13.79); - thisAI->AddWaypoint(8, -2312.83, 3130.55, 12.04); - thisAI->AddWaypoint(9, -2345.02, 3151.00, 8.38); - thisAI->AddWaypoint(10, -2351.97, 3157.61, 6.27); - thisAI->AddWaypoint(11, -2360.35, 3171.48, 3.31); - thisAI->AddWaypoint(12, -2371.44, 3185.41, 0.89); - thisAI->AddWaypoint(13, -2371.21, 3197.92, -0.96); - thisAI->AddWaypoint(14, -2380.35, 3210.45, -1.08); - thisAI->AddWaypoint(15, -2384.74, 3221.25, -1.17); - thisAI->AddWaypoint(16, -2386.15, 3233.39, -1.29); - thisAI->AddWaypoint(17, -2383.45, 3247.79, -1.32); - thisAI->AddWaypoint(18, -2367.50, 3265.64, -1.33); - thisAI->AddWaypoint(19, -2354.90, 3273.30, -1.50); - thisAI->AddWaypoint(20, -2348.88, 3280.58, -0.09); - thisAI->AddWaypoint(21, -2349.06, 3295.86, -0.95); - thisAI->AddWaypoint(22, -2350.43, 3328.27, -2.10); - thisAI->AddWaypoint(23, -2346.76, 3356.27, -2.82); - thisAI->AddWaypoint(24, -2340.56, 3370.68, -4.02); - thisAI->AddWaypoint(25, -2318.84, 3384.60, -7.61); - thisAI->AddWaypoint(26, -2313.99, 3398.61, -10.40); - thisAI->AddWaypoint(27, -2320.85, 3414.49, -11.49); - thisAI->AddWaypoint(28, -2338.26, 3426.06, -11.46); - thisAI->AddWaypoint(29, -2342.67, 3439.44, -11.32, 12000);//progress4 - thisAI->AddWaypoint(30, -2342.67, 3439.44, -11.32, 7000);//emote bye - thisAI->AddWaypoint(31, -2342.67, 3439.44, -11.32, 5000);//cat form - thisAI->AddWaypoint(32, -2344.60, 3461.27, -10.44); - thisAI->AddWaypoint(33, -2396.81, 3517.17, -3.55); - thisAI->AddWaypoint(34, -2439.23, 3523.00, -1.05); + thisAI->AddWaypoint(0, -2265.21, 3091.14, 13.91); + thisAI->AddWaypoint(1, -2266.80, 3091.33, 13.82, 1000); + thisAI->AddWaypoint(2, -2268.20, 3091.14, 13.82, 7000);//progress1 + thisAI->AddWaypoint(3, -2278.32, 3098.98, 13.82); + thisAI->AddWaypoint(4, -2294.82, 3110.59, 13.82); + thisAI->AddWaypoint(5, -2300.71, 3114.60, 13.82, 20000);//progress2 + thisAI->AddWaypoint(6, -2300.71, 3114.60, 13.82, 3000);//progress3 + thisAI->AddWaypoint(7, -2307.36, 3122.76, 13.79); + thisAI->AddWaypoint(8, -2312.83, 3130.55, 12.04); + thisAI->AddWaypoint(9, -2345.02, 3151.00, 8.38); + thisAI->AddWaypoint(10, -2351.97, 3157.61, 6.27); + thisAI->AddWaypoint(11, -2360.35, 3171.48, 3.31); + thisAI->AddWaypoint(12, -2371.44, 3185.41, 0.89); + thisAI->AddWaypoint(13, -2371.21, 3197.92, -0.96); + thisAI->AddWaypoint(14, -2380.35, 3210.45, -1.08); + thisAI->AddWaypoint(15, -2384.74, 3221.25, -1.17); + thisAI->AddWaypoint(16, -2386.15, 3233.39, -1.29); + thisAI->AddWaypoint(17, -2383.45, 3247.79, -1.32); + thisAI->AddWaypoint(18, -2367.50, 3265.64, -1.33); + thisAI->AddWaypoint(19, -2354.90, 3273.30, -1.50); + thisAI->AddWaypoint(20, -2348.88, 3280.58, -0.09); + thisAI->AddWaypoint(21, -2349.06, 3295.86, -0.95); + thisAI->AddWaypoint(22, -2350.43, 3328.27, -2.10); + thisAI->AddWaypoint(23, -2346.76, 3356.27, -2.82); + thisAI->AddWaypoint(24, -2340.56, 3370.68, -4.02); + thisAI->AddWaypoint(25, -2318.84, 3384.60, -7.61); + thisAI->AddWaypoint(26, -2313.99, 3398.61, -10.40); + thisAI->AddWaypoint(27, -2320.85, 3414.49, -11.49); + thisAI->AddWaypoint(28, -2338.26, 3426.06, -11.46); + thisAI->AddWaypoint(29, -2342.67, 3439.44, -11.32, 12000);//progress4 + thisAI->AddWaypoint(30, -2342.67, 3439.44, -11.32, 7000);//emote bye + thisAI->AddWaypoint(31, -2342.67, 3439.44, -11.32, 5000);//cat form + thisAI->AddWaypoint(32, -2344.60, 3461.27, -10.44); + thisAI->AddWaypoint(33, -2396.81, 3517.17, -3.55); + thisAI->AddWaypoint(34, -2439.23, 3523.00, -1.05); - return (CreatureAI*)thisAI; + return (CreatureAI*)thisAI; } void AddSC_terokkar_forest() @@ -527,9 +527,9 @@ void AddSC_terokkar_forest() newscript->pGossipSelect = &GossipSelect_npc_skyguard_handler_deesak; newscript->RegisterSelf(); - newscript = new Script; - newscript->Name= "npc_isla_starmane"; - newscript->GetAI = &GetAI_npc_isla_starmaneAI; - newscript->pQuestAccept = &QuestAccept_npc_isla_starmane; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name= "npc_isla_starmane"; + newscript->GetAI = &GetAI_npc_isla_starmaneAI; + newscript->pQuestAccept = &QuestAccept_npc_isla_starmane; + newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/thousand_needles/thousand_needles.cpp b/src/bindings/scripts/scripts/zone/thousand_needles/thousand_needles.cpp index e95f7e7ca5d..d1ba50406d1 100644 --- a/src/bindings/scripts/scripts/zone/thousand_needles/thousand_needles.cpp +++ b/src/bindings/scripts/scripts/zone/thousand_needles/thousand_needles.cpp @@ -53,12 +53,12 @@ npc_swiftmountainAI(Creature *c) : npc_escortAI(c) {Reset();} case 46: DoScriptText(SAY_AGGRO, m_creature, player); break; - case 47: + case 47: m_creature->SummonCreature(ENTRY_WYVERN, -5016.45, -935.01, -5.46, 5.36,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); m_creature->SummonCreature(ENTRY_WYVERN, -5001.98, -934.96, -5.55, 3.18,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); m_creature->SummonCreature(ENTRY_WYVERN, -4999.06, -949.61, -5.42, 2.04,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); break; - case 70: + case 70: DoScriptText(SAY_FINISH, m_creature, player); if (player && player->GetTypeId() == TYPEID_PLAYER) ((Player*)player)->GroupEventHappens(QUEST_HOMEWARD_BOUND,m_creature); diff --git a/src/bindings/scripts/scripts/zone/tirisfal_glades/tirisfal_glades.cpp b/src/bindings/scripts/scripts/zone/tirisfal_glades/tirisfal_glades.cpp index 9b75549bc4c..779466f2863 100644 --- a/src/bindings/scripts/scripts/zone/tirisfal_glades/tirisfal_glades.cpp +++ b/src/bindings/scripts/scripts/zone/tirisfal_glades/tirisfal_glades.cpp @@ -44,7 +44,7 @@ struct TRINITY_DLL_DECL npc_calvin_montagueAI : public ScriptedAI void Reset() { m_creature->setFaction(FACTION_FRIENDLY); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); } void Aggro(Unit* who) { } @@ -74,7 +74,7 @@ bool QuestAccept_npc_calvin_montague(Player* player, Creature* creature, Quest c if( quest->GetQuestId() == QUEST_590 ) { creature->setFaction(FACTION_HOSTILE); - creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); + creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); ((npc_calvin_montagueAI*)creature->AI())->AttackStart(player); } return true; @@ -150,7 +150,7 @@ void AddSC_tirisfal_glades() newscript->pQuestAccept = &QuestAccept_npc_calvin_montague; newscript->RegisterSelf(); - newscript = new Script; + newscript = new Script; newscript->Name = "go_mausoleum_door"; newscript->pGOHello = &GOHello_go_mausoleum_door; newscript->RegisterSelf(); diff --git a/src/bindings/scripts/scripts/zone/uldaman/instance_uldaman.cpp b/src/bindings/scripts/scripts/zone/uldaman/instance_uldaman.cpp index 930e0d2f562..08e1eeee423 100644 --- a/src/bindings/scripts/scripts/zone/uldaman/instance_uldaman.cpp +++ b/src/bindings/scripts/scripts/zone/uldaman/instance_uldaman.cpp @@ -185,7 +185,7 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance if (target && target->isDead()) { target->Respawn(); - target->GetMotionMaster()->MoveTargetedHome(); + target->GetMotionMaster()->MoveTargetedHome(); SetFrozenState(target); } } @@ -197,7 +197,7 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance if (target && target->isDead()) { target->Respawn(); - target->GetMotionMaster()->MoveTargetedHome(); + target->GetMotionMaster()->MoveTargetedHome(); SetFrozenState(target); } } @@ -209,7 +209,7 @@ struct TRINITY_DLL_DECL instance_uldaman : public ScriptedInstance if (target && target->isDead()) { target->Respawn(); - target->GetMotionMaster()->MoveTargetedHome(); + target->GetMotionMaster()->MoveTargetedHome(); SetFrozenState(target); } } diff --git a/src/bindings/scripts/scripts/zone/ungoro_crater/ungoro_crater.cpp b/src/bindings/scripts/scripts/zone/ungoro_crater/ungoro_crater.cpp index 50f7bbcf9e4..36598bddf2d 100644 --- a/src/bindings/scripts/scripts/zone/ungoro_crater/ungoro_crater.cpp +++ b/src/bindings/scripts/scripts/zone/ungoro_crater/ungoro_crater.cpp @@ -45,9 +45,9 @@ EndContentData */ struct TRINITY_DLL_DECL npc_ameAI : public npc_escortAI { - npc_ameAI(Creature *c) : npc_escortAI(c) {Reset();} + npc_ameAI(Creature *c) : npc_escortAI(c) {Reset();} - uint32 DEMORALIZINGSHOUT_Timer; + uint32 DEMORALIZINGSHOUT_Timer; void WaypointReached(uint32 i) { @@ -126,7 +126,7 @@ bool QuestAccept_npc_ame(Player* player, Creature* creature, Quest const* quest) { ((npc_escortAI*)(creature->AI()))->Start(false, true, false, player->GetGUID()); DoScriptText(SAY_READY, creature, player); - creature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); + creature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); // Change faction so mobs attack creature->setFaction(113); } diff --git a/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp b/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp index 274d07ca0e8..235813ec98b 100644 --- a/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp +++ b/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp @@ -255,123 +255,123 @@ bool GossipSelect_npc_mortog_steamhead(Player *player, Creature *_Creature, uint ## npc_kayra_longmane ######*/ -#define SAY_PROGRESS_1 -1000360 -#define SAY_PROGRESS_2 -1000361 -#define SAY_PROGRESS_3 -1000362 -#define SAY_PROGRESS_4 -1000363 -#define SAY_PROGRESS_5 -1000364 -#define SAY_PROGRESS_6 -1000365 +#define SAY_PROGRESS_1 -1000360 +#define SAY_PROGRESS_2 -1000361 +#define SAY_PROGRESS_3 -1000362 +#define SAY_PROGRESS_4 -1000363 +#define SAY_PROGRESS_5 -1000364 +#define SAY_PROGRESS_6 -1000365 -#define QUEST_EFU 9752 -#define MOB_AMBUSH 18042 +#define QUEST_EFU 9752 +#define MOB_AMBUSH 18042 -struct TRINITY_DLL_DECL npc_kayra_longmaneAI : public npc_escortAI +struct TRINITY_DLL_DECL npc_kayra_longmaneAI : public npc_escortAI { - npc_kayra_longmaneAI(Creature* c) : npc_escortAI(c) {Reset();} + npc_kayra_longmaneAI(Creature* c) : npc_escortAI(c) {Reset();} - bool Completed; + bool Completed; - void Reset() - { - Completed = false; + void Reset() + { + Completed = false; m_creature->setFaction(1660); - } + } - void Aggro(Unit* who){} + void Aggro(Unit* who){} - void JustSummoned(Creature *summoned) - { - summoned->AI()->AttackStart(m_creature); - summoned->setFaction(14); - } + void JustSummoned(Creature *summoned) + { + summoned->AI()->AttackStart(m_creature); + summoned->setFaction(14); + } - void WaypointReached(uint32 i) - { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + void WaypointReached(uint32 i) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - switch(i) - { - case 0: DoScriptText(SAY_PROGRESS_1, m_creature, player); break; - case 5: DoScriptText(SAY_PROGRESS_2, m_creature, player); - m_creature->SummonCreature(MOB_AMBUSH, -922.24, 5357.98, 17.93, 5.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); - m_creature->SummonCreature(MOB_AMBUSH, -922.24, 5357.98, 17.93, 5.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); - break; - case 6: DoScriptText(SAY_PROGRESS_3, m_creature, player); - m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - break; - case 18: DoScriptText(SAY_PROGRESS_4, m_creature, player); - m_creature->SummonCreature(MOB_AMBUSH, -671.86, 5379.81, 22.12, 5.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); - m_creature->SummonCreature(MOB_AMBUSH, -671.86, 5379.81, 22.12, 5.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); - break; - case 19: m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - DoScriptText(SAY_PROGRESS_5, m_creature, player); break; - case 26: DoScriptText(SAY_PROGRESS_6, m_creature, player); - Completed = true; - if(player) - ((Player*)player)->GroupEventHappens(QUEST_EFU, m_creature); - break; - } - } + switch(i) + { + case 0: DoScriptText(SAY_PROGRESS_1, m_creature, player); break; + case 5: DoScriptText(SAY_PROGRESS_2, m_creature, player); + m_creature->SummonCreature(MOB_AMBUSH, -922.24, 5357.98, 17.93, 5.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); + m_creature->SummonCreature(MOB_AMBUSH, -922.24, 5357.98, 17.93, 5.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); + break; + case 6: DoScriptText(SAY_PROGRESS_3, m_creature, player); + m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + break; + case 18: DoScriptText(SAY_PROGRESS_4, m_creature, player); + m_creature->SummonCreature(MOB_AMBUSH, -671.86, 5379.81, 22.12, 5.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); + m_creature->SummonCreature(MOB_AMBUSH, -671.86, 5379.81, 22.12, 5.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); + break; + case 19: m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + DoScriptText(SAY_PROGRESS_5, m_creature, player); break; + case 26: DoScriptText(SAY_PROGRESS_6, m_creature, player); + Completed = true; + if(player) + ((Player*)player)->GroupEventHappens(QUEST_EFU, m_creature); + break; + } + } - void JustDied(Unit* killer) - { - if (PlayerGUID && !Completed) - { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - if (player && !Completed) - ((Player*)player)->FailQuest(QUEST_EFU); - } - } + void JustDied(Unit* killer) + { + if (PlayerGUID && !Completed) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + if (player && !Completed) + ((Player*)player)->FailQuest(QUEST_EFU); + } + } - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + } }; bool QuestAccept_npc_kayra_longmane(Player* player, Creature* creature, Quest const* quest) { - if (quest->GetQuestId() == QUEST_EFU) + if (quest->GetQuestId() == QUEST_EFU) { ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); - creature->setFaction(113); + creature->setFaction(113); } return true; } CreatureAI* GetAI_npc_kayra_longmaneAI(Creature* _Creature) { - npc_kayra_longmaneAI* thisAI = new npc_kayra_longmaneAI(_Creature); + npc_kayra_longmaneAI* thisAI = new npc_kayra_longmaneAI(_Creature); - thisAI->AddWaypoint(0, -931.88, 5283.56, 23.98);//SAY_PROGRESS_1 - thisAI->AddWaypoint(1, -930.52, 5287.57, 23.82); - thisAI->AddWaypoint(2, -924.98, 5297.94, 17.78); - thisAI->AddWaypoint(3, -928.83, 5316.07, 18.18); - thisAI->AddWaypoint(4, -930.07, 5323.10, 18.63); - thisAI->AddWaypoint(5, -926.58, 5331.24, 18.74, 6000);//SAY_PROGRESS_2 - thisAI->AddWaypoint(6, -926.58, 5331.24, 18.74, 3000);//SAY_PROGRESS_3 Run to the hills! - thisAI->AddWaypoint(7, -931.24, 5358.89, 18.14); - thisAI->AddWaypoint(8, -934.43, 5370.20, 22.41); - thisAI->AddWaypoint(9, -943.01, 5400.55, 22.74); - thisAI->AddWaypoint(10, -929.62, 5417.98, 23.07); - thisAI->AddWaypoint(11, -901.92, 5420.38, 24.19); - thisAI->AddWaypoint(12, -859.03, 5415.36, 23.64); - thisAI->AddWaypoint(13, -808.94, 5401.93, 23.11); - thisAI->AddWaypoint(14, -772.74, 5390.53, 22.97); - thisAI->AddWaypoint(15, -749.71, 5385.39, 22.75); - thisAI->AddWaypoint(16, -721.23, 5380.38, 22.47); - thisAI->AddWaypoint(17, -687.96, 5379.08, 22.16); - thisAI->AddWaypoint(18, -680.87, 5378.95, 21.99, 6000);//SAY_PROGRESS_4 Summon Ambush - thisAI->AddWaypoint(19, -680.87, 5378.95, 21.99, 6000);//SAY_PROGRESS_5 - thisAI->AddWaypoint(20, -636.14, 5385.25, 22.20); - thisAI->AddWaypoint(21, -602.94, 5411.36, 21.48); - thisAI->AddWaypoint(22, -566.86, 5421.87, 21.25); - thisAI->AddWaypoint(23, -547.27, 5427.87, 21.10); - thisAI->AddWaypoint(24, -520.59, 5444.83, 21.15); - thisAI->AddWaypoint(25, -488.45, 5447.83, 22.38); - thisAI->AddWaypoint(26, -449.65, 5463.78, 21.77, 11000);//SAY_PROGRESS_6 + thisAI->AddWaypoint(0, -931.88, 5283.56, 23.98);//SAY_PROGRESS_1 + thisAI->AddWaypoint(1, -930.52, 5287.57, 23.82); + thisAI->AddWaypoint(2, -924.98, 5297.94, 17.78); + thisAI->AddWaypoint(3, -928.83, 5316.07, 18.18); + thisAI->AddWaypoint(4, -930.07, 5323.10, 18.63); + thisAI->AddWaypoint(5, -926.58, 5331.24, 18.74, 6000);//SAY_PROGRESS_2 + thisAI->AddWaypoint(6, -926.58, 5331.24, 18.74, 3000);//SAY_PROGRESS_3 Run to the hills! + thisAI->AddWaypoint(7, -931.24, 5358.89, 18.14); + thisAI->AddWaypoint(8, -934.43, 5370.20, 22.41); + thisAI->AddWaypoint(9, -943.01, 5400.55, 22.74); + thisAI->AddWaypoint(10, -929.62, 5417.98, 23.07); + thisAI->AddWaypoint(11, -901.92, 5420.38, 24.19); + thisAI->AddWaypoint(12, -859.03, 5415.36, 23.64); + thisAI->AddWaypoint(13, -808.94, 5401.93, 23.11); + thisAI->AddWaypoint(14, -772.74, 5390.53, 22.97); + thisAI->AddWaypoint(15, -749.71, 5385.39, 22.75); + thisAI->AddWaypoint(16, -721.23, 5380.38, 22.47); + thisAI->AddWaypoint(17, -687.96, 5379.08, 22.16); + thisAI->AddWaypoint(18, -680.87, 5378.95, 21.99, 6000);//SAY_PROGRESS_4 Summon Ambush + thisAI->AddWaypoint(19, -680.87, 5378.95, 21.99, 6000);//SAY_PROGRESS_5 + thisAI->AddWaypoint(20, -636.14, 5385.25, 22.20); + thisAI->AddWaypoint(21, -602.94, 5411.36, 21.48); + thisAI->AddWaypoint(22, -566.86, 5421.87, 21.25); + thisAI->AddWaypoint(23, -547.27, 5427.87, 21.10); + thisAI->AddWaypoint(24, -520.59, 5444.83, 21.15); + thisAI->AddWaypoint(25, -488.45, 5447.83, 22.38); + thisAI->AddWaypoint(26, -449.65, 5463.78, 21.77, 11000);//SAY_PROGRESS_6 - return (CreatureAI*)thisAI; + return (CreatureAI*)thisAI; } /*###### ## AddSC @@ -405,9 +405,9 @@ void AddSC_zangarmarsh() newscript->pGossipSelect = &GossipSelect_npc_mortog_steamhead; newscript->RegisterSelf(); - newscript = new Script; - newscript->Name="npc_kayra_longmane"; - newscript->GetAI = &GetAI_npc_kayra_longmaneAI; - newscript->pQuestAccept = &QuestAccept_npc_kayra_longmane; - newscript->RegisterSelf(); + newscript = new Script; + newscript->Name="npc_kayra_longmane"; + newscript->GetAI = &GetAI_npc_kayra_longmaneAI; + newscript->pQuestAccept = &QuestAccept_npc_kayra_longmane; + newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/zulaman/boss_akilzon.cpp b/src/bindings/scripts/scripts/zone/zulaman/boss_akilzon.cpp index 453f111d6bd..7eb9fb81426 100644 --- a/src/bindings/scripts/scripts/zone/zulaman/boss_akilzon.cpp +++ b/src/bindings/scripts/scripts/zone/zulaman/boss_akilzon.cpp @@ -27,15 +27,15 @@ EndScriptData */ #include "def_zulaman.h" #include "Weather.h" -#define SPELL_STATIC_DISRUPTION 43622 -#define SPELL_STATIC_VISUAL 45265 -#define SPELL_CALL_LIGHTNING 43661 //Missing timer -#define SPELL_GUST_OF_WIND 43621 -#define SPELL_ELECTRICAL_STORM 43648 -#define SPELL_BERSERK 45078 -#define SPELL_ELECTRICAL_DAMAGE 43657 -#define SPELL_ELECTRICAL_OVERLOAD 43658 -#define SPELL_EAGLE_SWOOP 44732 +#define SPELL_STATIC_DISRUPTION 43622 +#define SPELL_STATIC_VISUAL 45265 +#define SPELL_CALL_LIGHTNING 43661 //Missing timer +#define SPELL_GUST_OF_WIND 43621 +#define SPELL_ELECTRICAL_STORM 43648 +#define SPELL_BERSERK 45078 +#define SPELL_ELECTRICAL_DAMAGE 43657 +#define SPELL_ELECTRICAL_OVERLOAD 43658 +#define SPELL_EAGLE_SWOOP 44732 //"Your death gonna be quick, strangers. You shoulda never have come to this place..." #define SAY_ONAGGRO "I be da predator! You da prey..." @@ -61,7 +61,7 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI { boss_akilzonAI(Creature *c) : ScriptedAI(c) { - SpellEntry *TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_ELECTRICAL_DAMAGE); + SpellEntry *TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_ELECTRICAL_DAMAGE); if(TempSpell) TempSpell->EffectBasePoints[1] = 49;//disable bugged lightning until fixed in core pInstance = ((ScriptedInstance*)c->GetInstanceData()); @@ -69,7 +69,7 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI } ScriptedInstance *pInstance; - uint64 BirdGUIDs[8]; + uint64 BirdGUIDs[8]; uint64 TargetGUID; uint64 CycloneGUID; uint64 CloudGUID; @@ -101,9 +101,9 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI TargetGUID = 0; CloudGUID = 0; CycloneGUID = 0; - DespawnSummons(); - for(uint8 i = 0; i < 8; i++) - BirdGUIDs[i] = 0; + DespawnSummons(); + for(uint8 i = 0; i < 8; i++) + BirdGUIDs[i] = 0; StormCount = 0; StormSequenceTimer = 0; @@ -148,15 +148,15 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI void DespawnSummons() { - for (uint8 i = 0; i < 8; i++) + for (uint8 i = 0; i < 8; i++) { - Unit* bird = Unit::GetUnit(*m_creature,BirdGUIDs[i]); - if(bird && bird->isAlive()) - { - bird->SetVisibility(VISIBILITY_OFF); - bird->setDeathState(JUST_DIED); - } - } + Unit* bird = Unit::GetUnit(*m_creature,BirdGUIDs[i]); + if(bird && bird->isAlive()) + { + bird->SetVisibility(VISIBILITY_OFF); + bird->setDeathState(JUST_DIED); + } + } } void SetWeather(uint32 weather, float grade) @@ -197,29 +197,29 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI cell_lock->Visit(cell_lock, world_unit_searcher, *(m_creature->GetMap())); cell_lock->Visit(cell_lock, grid_unit_searcher, *(m_creature->GetMap())); } - //dealdamege - for(std::list::iterator i = tempUnitMap.begin(); i != tempUnitMap.end(); ++i) + //dealdamege + for(std::list::iterator i = tempUnitMap.begin(); i != tempUnitMap.end(); ++i) { - if(Cloud->GetDistance2d(*i)>= 6) + if(Cloud->GetDistance2d(*i)>= 6) { Cloud->CastCustomSpell(*i, 43137, &bp0, NULL, NULL, true, 0, 0, m_creature->GetGUID()); } } // visual float x,y,z; - z = m_creature->GetPositionZ(); + z = m_creature->GetPositionZ(); for(uint8 i = 0; i < 5+rand()%5; ++i) { x = 343+rand()%60; y = 1380+rand()%60; if(Unit *trigger = m_creature->SummonTrigger(x, y, z, 0, 2000)) { - trigger->setFaction(35); + trigger->setFaction(35); trigger->SetMaxHealth(100000); trigger->SetHealth(100000); - trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (Cloud) - Cloud->CastCustomSpell(trigger, /*43661*/43137, &bp0, NULL, NULL,true, 0, 0, Cloud->GetGUID()); + trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + if (Cloud) + Cloud->CastCustomSpell(trigger, /*43661*/43137, &bp0, NULL, NULL,true, 0, 0, Cloud->GetGUID()); } } } @@ -230,8 +230,8 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI SummonEagles_Timer = 5000; m_creature->InterruptNonMeleeSpells(false); CloudGUID = 0; - if (Cloud) - Cloud->DealDamage(Cloud, Cloud->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + if (Cloud) + Cloud->DealDamage(Cloud, Cloud->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); SetWeather(WEATHER_STATE_FINE, 0.0f); isRaining = false; } @@ -304,23 +304,23 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI EnterEvadeMode(); return; } - target->CastSpell(target, 44007, true);//cloud visual - m_creature->CastSpell(target, SPELL_ELECTRICAL_STORM, false);//storm cyclon + visual + target->CastSpell(target, 44007, true);//cloud visual + m_creature->CastSpell(target, SPELL_ELECTRICAL_STORM, false);//storm cyclon + visual float x,y,z; - target->GetPosition(x,y,z); - if (target) - { - target->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); - target->SendMonsterMove(x,y,m_creature->GetPositionZ()+15,0,0,0); - } - Unit *Cloud = m_creature->SummonTrigger(x, y, m_creature->GetPositionZ()+16, 0, 15000); + target->GetPosition(x,y,z); + if (target) + { + target->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); + target->SendMonsterMove(x,y,m_creature->GetPositionZ()+15,0,0,0); + } + Unit *Cloud = m_creature->SummonTrigger(x, y, m_creature->GetPositionZ()+16, 0, 15000); if(Cloud) { - CloudGUID = Cloud->GetGUID(); - Cloud->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); + CloudGUID = Cloud->GetGUID(); + Cloud->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); Cloud->StopMoving(); Cloud->SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); - Cloud->setFaction(35); + Cloud->setFaction(35); Cloud->SetMaxHealth(9999999); Cloud->SetHealth(9999999); Cloud->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -338,27 +338,27 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI float x, y, z; m_creature->GetPosition(x, y, z); - for (uint8 i = 0; i < 8; i++) + for (uint8 i = 0; i < 8; i++) { - Unit* bird = Unit::GetUnit(*m_creature,BirdGUIDs[i]); - if(!bird)//they despawned on die - { - if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) - { - x = target->GetPositionX() + 10 - rand()%20; - y = target->GetPositionY() + 10 - rand()%20; - z = target->GetPositionZ() + 6 + rand()%5 + 10; - if(z > 95) z = 95 - rand()%5; - } - Creature *pCreature = m_creature->SummonCreature(MOB_SOARING_EAGLE, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); - if (pCreature) - { - pCreature->AddThreat(m_creature->getVictim(), 1.0f); - pCreature->AI()->AttackStart(m_creature->getVictim()); - BirdGUIDs[i] = pCreature->GetGUID(); - } - } - } + Unit* bird = Unit::GetUnit(*m_creature,BirdGUIDs[i]); + if(!bird)//they despawned on die + { + if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + x = target->GetPositionX() + 10 - rand()%20; + y = target->GetPositionY() + 10 - rand()%20; + z = target->GetPositionZ() + 6 + rand()%5 + 10; + if(z > 95) z = 95 - rand()%5; + } + Creature *pCreature = m_creature->SummonCreature(MOB_SOARING_EAGLE, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); + if (pCreature) + { + pCreature->AddThreat(m_creature->getVictim(), 1.0f); + pCreature->AI()->AttackStart(m_creature->getVictim()); + BirdGUIDs[i] = pCreature->GetGUID(); + } + } + } SummonEagles_Timer = 999999; } else SummonEagles_Timer -= diff; diff --git a/src/bindings/scripts/scripts/zone/zulaman/boss_halazzi.cpp b/src/bindings/scripts/scripts/zone/zulaman/boss_halazzi.cpp index 818e87b3ce0..03ed35fcf6c 100644 --- a/src/bindings/scripts/scripts/zone/zulaman/boss_halazzi.cpp +++ b/src/bindings/scripts/scripts/zone/zulaman/boss_halazzi.cpp @@ -100,7 +100,7 @@ struct TRINITY_DLL_DECL boss_halazziAI : public ScriptedAI void Reset() { - if(pInstance) + if(pInstance) pInstance->SetData(DATA_HALAZZIEVENT, NOT_STARTED); TransformCount = 0; @@ -115,7 +115,7 @@ struct TRINITY_DLL_DECL boss_halazziAI : public ScriptedAI void Aggro(Unit *who) { - if(pInstance) + if(pInstance) pInstance->SetData(DATA_HALAZZIEVENT, IN_PROGRESS); DoYell(YELL_AGGRO, LANG_UNIVERSAL, NULL); @@ -282,18 +282,18 @@ struct TRINITY_DLL_DECL boss_halazziAI : public ScriptedAI if(CheckTimer < diff) { Unit *Lynx = Unit::GetUnit(*m_creature, LynxGUID); - if(Lynx) - { - Lynx->GetMotionMaster()->MoveFollow(m_creature, 0, 0); - m_creature->GetMotionMaster()->MoveFollow(Lynx, 0, 0); - if(m_creature->IsWithinDistInMap(Lynx, 6.0f)) - { - if(TransformCount < 3) - EnterPhase(PHASE_LYNX); - else - EnterPhase(PHASE_ENRAGE); - } - } + if(Lynx) + { + Lynx->GetMotionMaster()->MoveFollow(m_creature, 0, 0); + m_creature->GetMotionMaster()->MoveFollow(Lynx, 0, 0); + if(m_creature->IsWithinDistInMap(Lynx, 6.0f)) + { + if(TransformCount < 3) + EnterPhase(PHASE_LYNX); + else + EnterPhase(PHASE_ENRAGE); + } + } CheckTimer = 1000; }else CheckTimer -= diff; } @@ -319,7 +319,7 @@ struct TRINITY_DLL_DECL boss_halazziAI : public ScriptedAI void JustDied(Unit* Killer) { - if(pInstance) + if(pInstance) pInstance->SetData(DATA_HALAZZIEVENT, DONE); DoYell(YELL_DEATH, LANG_UNIVERSAL, NULL); diff --git a/src/bindings/scripts/scripts/zone/zulaman/boss_janalai.cpp b/src/bindings/scripts/scripts/zone/zulaman/boss_janalai.cpp index e4efe3d83ba..d7ce85055d3 100644 --- a/src/bindings/scripts/scripts/zone/zulaman/boss_janalai.cpp +++ b/src/bindings/scripts/scripts/zone/zulaman/boss_janalai.cpp @@ -157,7 +157,7 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI void JustDied(Unit* Killer) { - DoScriptText(SAY_DEATH, m_creature); + DoScriptText(SAY_DEATH, m_creature); if(pInstance) pInstance->SetData(DATA_JANALAIEVENT, DONE); @@ -167,8 +167,8 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI { switch(rand()%2) { - case 0: DoScriptText(SAY_SLAY_1, m_creature); break; - case 1: DoScriptText(SAY_SLAY_2, m_creature); break; + case 0: DoScriptText(SAY_SLAY_1, m_creature); break; + case 1: DoScriptText(SAY_SLAY_2, m_creature); break; } } @@ -177,7 +177,7 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI if(pInstance) pInstance->SetData(DATA_JANALAIEVENT, IN_PROGRESS); - DoScriptText(SAY_AGGRO, m_creature); + DoScriptText(SAY_AGGRO, m_creature); // DoZoneInCombat(); } @@ -353,7 +353,7 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI } else { - DoScriptText(SAY_BERSERK, m_creature); + DoScriptText(SAY_BERSERK, m_creature); m_creature->CastSpell(m_creature, SPELL_BERSERK, true); EnrageTimer = 300000; } @@ -361,7 +361,7 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI if(BombTimer < diff) { - DoScriptText(SAY_FIRE_BOMBS, m_creature); + DoScriptText(SAY_FIRE_BOMBS, m_creature); m_creature->AttackStop(); m_creature->GetMotionMaster()->Clear(); @@ -395,7 +395,7 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI { if(100 * m_creature->GetHealth() < 35 * m_creature->GetMaxHealth()) { - DoScriptText(SAY_ALL_EGGS, m_creature); + DoScriptText(SAY_ALL_EGGS, m_creature); m_creature->AttackStop(); m_creature->GetMotionMaster()->Clear(); @@ -410,7 +410,7 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI { if(HatchAllEggs(0)) { - DoScriptText(SAY_SUMMON_HATCHER, m_creature); + DoScriptText(SAY_SUMMON_HATCHER, m_creature); m_creature->SummonCreature(MOB_AMANI_HATCHER,hatcherway[0][0][0],hatcherway[0][0][1],hatcherway[0][0][2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,10000); m_creature->SummonCreature(MOB_AMANI_HATCHER,hatcherway[1][0][0],hatcherway[1][0][1],hatcherway[1][0][2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,10000); HatcherTimer = 90000; diff --git a/src/bindings/scripts/scripts/zone/zulaman/instance_zulaman.cpp b/src/bindings/scripts/scripts/zone/zulaman/instance_zulaman.cpp index 8ab8b973581..dff3148aa57 100644 --- a/src/bindings/scripts/scripts/zone/zulaman/instance_zulaman.cpp +++ b/src/bindings/scripts/scripts/zone/zulaman/instance_zulaman.cpp @@ -53,7 +53,7 @@ struct TRINITY_DLL_DECL instance_zulaman : public ScriptedInstance { instance_zulaman(Map *map) : ScriptedInstance(map) {Initialize();}; - uint64 HarkorsSatchelGUID; + uint64 HarkorsSatchelGUID; uint64 TanzarsTrunkGUID; uint64 AshlisBagGUID; uint64 KrazsPackageGUID; @@ -74,10 +74,10 @@ struct TRINITY_DLL_DECL instance_zulaman : public ScriptedInstance void Initialize() { - HarkorsSatchelGUID = 0; - TanzarsTrunkGUID = 0; - AshlisBagGUID = 0; - KrazsPackageGUID = 0; + HarkorsSatchelGUID = 0; + TanzarsTrunkGUID = 0; + AshlisBagGUID = 0; + KrazsPackageGUID = 0; uint64 HexLordGateGUID = 0; uint64 ZulJinGateGUID = 0; diff --git a/src/bindings/scripts/scripts/zone/zulgurub/boss_arlokk.cpp b/src/bindings/scripts/scripts/zone/zulgurub/boss_arlokk.cpp index 16344adc5ba..461b1a8ee33 100644 --- a/src/bindings/scripts/scripts/zone/zulgurub/boss_arlokk.cpp +++ b/src/bindings/scripts/scripts/zone/zulgurub/boss_arlokk.cpp @@ -36,15 +36,15 @@ EndScriptData */ struct TRINITY_DLL_DECL boss_arlokkAI : public ScriptedAI { - boss_arlokkAI(Creature *c) : ScriptedAI(c) - { - pInstance = ((ScriptedInstance*)c->GetInstanceData()); - Reset(); - } + boss_arlokkAI(Creature *c) : ScriptedAI(c) + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + Reset(); + } - ScriptedInstance *pInstance; + ScriptedInstance *pInstance; - uint32 ShadowWordPain_Timer; + uint32 ShadowWordPain_Timer; uint32 Gouge_Timer; uint32 Mark_Timer; uint32 Cleave_Timer; @@ -81,12 +81,12 @@ struct TRINITY_DLL_DECL boss_arlokkAI : public ScriptedAI void Aggro(Unit *who) { - DoScriptText(SAY_AGGRO, m_creature); + DoScriptText(SAY_AGGRO, m_creature); } void JustDied(Unit* Killer) { - DoScriptText(SAY_DEATH, m_creature); + DoScriptText(SAY_DEATH, m_creature); m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID,15218); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -123,10 +123,10 @@ struct TRINITY_DLL_DECL boss_arlokkAI : public ScriptedAI Panther = m_creature->SummonCreature(15101,-11532.79980,-1649.6734,41.4800,0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if(markedTarget && Panther ) - { - DoScriptText(SAY_FEAST_PANTHER, m_creature, markedTarget); + { + DoScriptText(SAY_FEAST_PANTHER, m_creature, markedTarget); Panther ->AI()->AttackStart(markedTarget); - }else Panther ->AI()->AttackStart(target); + }else Panther ->AI()->AttackStart(target); Panther = m_creature->SummonCreature(15101,-11532.9970,-1606.4840,41.2979,0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); diff --git a/src/bindings/scripts/scripts/zone/zulgurub/boss_hakkar.cpp b/src/bindings/scripts/scripts/zone/zulgurub/boss_hakkar.cpp index d8eada5662c..d4c8039f5c6 100644 --- a/src/bindings/scripts/scripts/zone/zulgurub/boss_hakkar.cpp +++ b/src/bindings/scripts/scripts/zone/zulgurub/boss_hakkar.cpp @@ -50,7 +50,7 @@ struct TRINITY_DLL_DECL boss_hakkarAI : public ScriptedAI Reset(); } - ScriptedInstance *pInstance; + ScriptedInstance *pInstance; uint32 BloodSiphon_Timer; uint32 CorruptedBlood_Timer; @@ -97,7 +97,7 @@ struct TRINITY_DLL_DECL boss_hakkarAI : public ScriptedAI void Aggro(Unit *who) { - DoScriptText(SAY_AGGRO, m_creature); + DoScriptText(SAY_AGGRO, m_creature); } void UpdateAI(const uint32 diff) @@ -120,21 +120,21 @@ struct TRINITY_DLL_DECL boss_hakkarAI : public ScriptedAI }else CorruptedBlood_Timer -= diff; //CauseInsanity_Timer - /*if (CauseInsanity_Timer < diff) - { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_CAUSEINSANITY); + /*if (CauseInsanity_Timer < diff) + { + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_CAUSEINSANITY); - CauseInsanity_Timer = 35000 + rand()%8000; - }else CauseInsanity_Timer -= diff;*/ + CauseInsanity_Timer = 35000 + rand()%8000; + }else CauseInsanity_Timer -= diff;*/ //WillOfHakkar_Timer if (WillOfHakkar_Timer < diff) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_WILLOFHAKKAR); + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_WILLOFHAKKAR); - WillOfHakkar_Timer = 25000 + rand()%10000; + WillOfHakkar_Timer = 25000 + rand()%10000; }else WillOfHakkar_Timer -= diff; if (!Enraged && Enrage_Timer < diff) diff --git a/src/bindings/scripts/scripts/zone/zulgurub/boss_jeklik.cpp b/src/bindings/scripts/scripts/zone/zulgurub/boss_jeklik.cpp index 0d22a980f37..a5ac43e6cef 100644 --- a/src/bindings/scripts/scripts/zone/zulgurub/boss_jeklik.cpp +++ b/src/bindings/scripts/scripts/zone/zulgurub/boss_jeklik.cpp @@ -43,13 +43,13 @@ EndScriptData */ struct TRINITY_DLL_DECL boss_jeklikAI : public ScriptedAI { - boss_jeklikAI(Creature *c) : ScriptedAI(c) - { - pInstance = ((ScriptedInstance*)c->GetInstanceData()); - Reset(); - } + boss_jeklikAI(Creature *c) : ScriptedAI(c) + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + Reset(); + } - ScriptedInstance *pInstance; + ScriptedInstance *pInstance; uint32 Charge_Timer; uint32 SonicBurst_Timer; @@ -94,8 +94,8 @@ struct TRINITY_DLL_DECL boss_jeklikAI : public ScriptedAI void UpdateAI(const uint32 diff) { - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; if( m_creature->getVictim() && m_creature->isAlive()) { @@ -158,7 +158,7 @@ struct TRINITY_DLL_DECL boss_jeklikAI : public ScriptedAI { if(PhaseTwo && ShadowWordPain_Timer < diff) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) { DoCast(target, SPELL_SHADOW_WORD_PAIN); ShadowWordPain_Timer = 12000 + rand()%6000; @@ -244,7 +244,7 @@ struct TRINITY_DLL_DECL mob_batriderAI : public ScriptedAI //Bomb_Timer if(Bomb_Timer < diff) { - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0)) { DoCast(target, SPELL_BOMB); Bomb_Timer = 5000; diff --git a/src/bindings/scripts/scripts/zone/zulgurub/boss_jindo.cpp b/src/bindings/scripts/scripts/zone/zulgurub/boss_jindo.cpp index 3be31b32e11..fa0bced67c9 100644 --- a/src/bindings/scripts/scripts/zone/zulgurub/boss_jindo.cpp +++ b/src/bindings/scripts/scripts/zone/zulgurub/boss_jindo.cpp @@ -47,7 +47,7 @@ struct TRINITY_DLL_DECL boss_jindoAI : public ScriptedAI Reset(); } - ScriptedInstance *pInstance; + ScriptedInstance *pInstance; uint32 BrainWashTotem_Timer; uint32 HealingWard_Timer; @@ -70,7 +70,7 @@ struct TRINITY_DLL_DECL boss_jindoAI : public ScriptedAI void Aggro(Unit *who) { - DoScriptText(SAY_AGGRO, m_creature); + DoScriptText(SAY_AGGRO, m_creature); } void UpdateAI(const uint32 diff) @@ -107,13 +107,13 @@ struct TRINITY_DLL_DECL boss_jindoAI : public ScriptedAI //Casting the delusion curse with a shade. So shade will attack the same target with the curse. if (Delusions_Timer < diff) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) - { + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + { DoCast(target, SPELL_DELUSIONSOFJINDO); Shade = m_creature->SummonCreature(14986, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); Shade->AI()->AttackStart(target); - } + } Delusions_Timer = 4000 + rand()%8000; }else Delusions_Timer -= diff; diff --git a/src/bindings/scripts/scripts/zone/zulgurub/boss_mandokir.cpp b/src/bindings/scripts/scripts/zone/zulgurub/boss_mandokir.cpp index bccd9c44bf5..e365ba7f153 100644 --- a/src/bindings/scripts/scripts/zone/zulgurub/boss_mandokir.cpp +++ b/src/bindings/scripts/scripts/zone/zulgurub/boss_mandokir.cpp @@ -50,7 +50,7 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI Reset(); } - uint32 KillCount; + uint32 KillCount; uint32 Watch_Timer; uint32 TargetInRange; uint32 Cleave_Timer; @@ -73,7 +73,7 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI void Reset() { - KillCount = 0; + KillCount = 0; Watch_Timer = 33000; Cleave_Timer = 7000; Whirlwind_Timer = 20000; @@ -100,34 +100,34 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI { if(victim->GetTypeId() == TYPEID_PLAYER) { - ++KillCount; + ++KillCount; - if (KillCount == 3) - { - DoScriptText(SAY_DING_KILL, m_creature); + if (KillCount == 3) + { + DoScriptText(SAY_DING_KILL, m_creature); - if (pInstance) - { - uint64 JindoGUID = pInstance->GetData64(DATA_JINDO); - if (JindoGUID) - { - if (Unit* jTemp = Unit::GetUnit(*m_creature,JindoGUID)) - { - if (jTemp->isAlive()) - DoScriptText(SAY_GRATS_JINDO, jTemp); - } - } - } + if (pInstance) + { + uint64 JindoGUID = pInstance->GetData64(DATA_JINDO); + if (JindoGUID) + { + if (Unit* jTemp = Unit::GetUnit(*m_creature,JindoGUID)) + { + if (jTemp->isAlive()) + DoScriptText(SAY_GRATS_JINDO, jTemp); + } + } + } DoCast(m_creature, SPELL_LEVEL_UP, true); - KillCount = 0; - } - } - } + KillCount = 0; + } + } + } void Aggro(Unit *who) - { - DoScriptText(SAY_AGGRO, m_creature); - } + { + DoScriptText(SAY_AGGRO, m_creature); + } void UpdateAI(const uint32 diff) { diff --git a/src/bindings/scripts/scripts/zone/zulgurub/boss_marli.cpp b/src/bindings/scripts/scripts/zone/zulgurub/boss_marli.cpp index 481784cc04c..31aff621b00 100644 --- a/src/bindings/scripts/scripts/zone/zulgurub/boss_marli.cpp +++ b/src/bindings/scripts/scripts/zone/zulgurub/boss_marli.cpp @@ -40,13 +40,13 @@ EndScriptData */ struct TRINITY_DLL_DECL boss_marliAI : public ScriptedAI { - boss_marliAI(Creature *c) : ScriptedAI(c) - { - pInstance = ((ScriptedInstance*)c->GetInstanceData()); - Reset(); - } + boss_marliAI(Creature *c) : ScriptedAI(c) + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + Reset(); + } - ScriptedInstance *pInstance; + ScriptedInstance *pInstance; uint32 SpawnStartSpiders_Timer; uint32 PoisonVolley_Timer; @@ -79,12 +79,12 @@ struct TRINITY_DLL_DECL boss_marliAI : public ScriptedAI void Aggro(Unit *who) { - DoScriptText(SAY_AGGRO, m_creature); + DoScriptText(SAY_AGGRO, m_creature); } void JustDied(Unit* Killer) { - DoScriptText(SAY_DEATH, m_creature); + DoScriptText(SAY_DEATH, m_creature); if(pInstance) pInstance->SetData(DATA_MARLI_DEATH, 0); } @@ -110,9 +110,9 @@ struct TRINITY_DLL_DECL boss_marliAI : public ScriptedAI if (!Spawned && SpawnStartSpiders_Timer < diff) { - DoScriptText(SAY_SPIDER_SPAWN, m_creature); + DoScriptText(SAY_SPIDER_SPAWN, m_creature); - Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0); + Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0); Spider = m_creature->SummonCreature(15041,target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if(target && Spider ) Spider ->AI()->AttackStart(target); @@ -128,17 +128,17 @@ struct TRINITY_DLL_DECL boss_marliAI : public ScriptedAI if (SpawnSpider_Timer < diff) { - Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0); + Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0); Spider = m_creature->SummonCreature(15041,target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (target && Spider ) - Spider ->AI()->AttackStart(target); + if (target && Spider ) + Spider ->AI()->AttackStart(target); SpawnSpider_Timer = 12000 + rand()%5000; }else SpawnSpider_Timer -= diff; if(!PhaseTwo && Transform_Timer < diff) { - DoScriptText(SAY_TRANSFORM, m_creature); + DoScriptText(SAY_TRANSFORM, m_creature); DoCast(m_creature,SPELL_SPIDER_FORM); const CreatureInfo *cinfo = m_creature->GetCreatureInfo(); m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35))); diff --git a/src/bindings/scripts/scripts/zone/zulgurub/boss_thekal.cpp b/src/bindings/scripts/scripts/zone/zulgurub/boss_thekal.cpp index db9ad23858d..312c94bd009 100644 --- a/src/bindings/scripts/scripts/zone/zulgurub/boss_thekal.cpp +++ b/src/bindings/scripts/scripts/zone/zulgurub/boss_thekal.cpp @@ -54,7 +54,7 @@ struct TRINITY_DLL_DECL boss_thekalAI : public ScriptedAI { boss_thekalAI(Creature *c) : ScriptedAI(c) { - pInstance = ((ScriptedInstance*)c->GetInstanceData()); + pInstance = ((ScriptedInstance*)c->GetInstanceData()); Reset(); } @@ -192,12 +192,12 @@ struct TRINITY_DLL_DECL boss_thekalAI : public ScriptedAI if (Charge_Timer < diff) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) - { + { DoCast(target,SPELL_CHARGE); m_creature->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true,1); DoResetThreat(); AttackStart(target); - } + } Charge_Timer = 15000 + rand()%7000; }else Charge_Timer -= diff; diff --git a/src/bindings/scripts/scripts/zone/zulgurub/boss_venoxis.cpp b/src/bindings/scripts/scripts/zone/zulgurub/boss_venoxis.cpp index 721476c5780..75436b8080b 100644 --- a/src/bindings/scripts/scripts/zone/zulgurub/boss_venoxis.cpp +++ b/src/bindings/scripts/scripts/zone/zulgurub/boss_venoxis.cpp @@ -39,13 +39,13 @@ EndScriptData */ struct TRINITY_DLL_DECL boss_venoxisAI : public ScriptedAI { - boss_venoxisAI(Creature *c) : ScriptedAI(c) - { - pInstance = ((ScriptedInstance*)c->GetInstanceData()); - Reset(); - } + boss_venoxisAI(Creature *c) : ScriptedAI(c) + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + Reset(); + } - ScriptedInstance *pInstance; + ScriptedInstance *pInstance; uint32 HolyFire_Timer; uint32 HolyWrath_Timer; @@ -80,9 +80,9 @@ struct TRINITY_DLL_DECL boss_venoxisAI : public ScriptedAI void JustDied(Unit* Killer) { - DoScriptText(SAY_DEATH, m_creature); - if(pInstance) - pInstance->SetData(DATA_VENOXIS_DEATH, 0); + DoScriptText(SAY_DEATH, m_creature); + if(pInstance) + pInstance->SetData(DATA_VENOXIS_DEATH, 0); } void UpdateAI(const uint32 diff) @@ -115,7 +115,7 @@ struct TRINITY_DLL_DECL boss_venoxisAI : public ScriptedAI TargetInRange = 0; for(int i=0; i<10; i++) { - if (Unit* target = SelectUnit(SELECT_TARGET_TOPAGGRO,i)) + if (Unit* target = SelectUnit(SELECT_TARGET_TOPAGGRO,i)) if(m_creature->IsWithinMeleeRange(target)) TargetInRange++; } @@ -134,7 +134,7 @@ struct TRINITY_DLL_DECL boss_venoxisAI : public ScriptedAI if (HolyFire_Timer < diff && TargetInRange < 3) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(target, SPELL_HOLY_FIRE); HolyFire_Timer = 8000; @@ -144,7 +144,7 @@ struct TRINITY_DLL_DECL boss_venoxisAI : public ScriptedAI { if(!PhaseTwo) { - DoScriptText(SAY_TRANSFORM, m_creature); + DoScriptText(SAY_TRANSFORM, m_creature); m_creature->InterruptNonMeleeSpells(false); DoCast(m_creature,SPELL_SNAKE_FORM); m_creature->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.00f); diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h index 3c98afe6d17..d1d9cb19f28 100644 --- a/src/game/BattleGround.h +++ b/src/game/BattleGround.h @@ -34,7 +34,7 @@ enum BattleGroundSounds SOUND_HORDE_WINS = 8454, SOUND_ALLIANCE_WINS = 8455, SOUND_BG_START = 3439, - SOUND_BG_START_L70ETC = 11803, + SOUND_BG_START_L70ETC = 11803, }; enum BattleGroundQuests diff --git a/src/game/BattleGroundAV.cpp b/src/game/BattleGroundAV.cpp index 6b892a0fa5d..c65ca479712 100644 --- a/src/game/BattleGroundAV.cpp +++ b/src/game/BattleGroundAV.cpp @@ -53,7 +53,7 @@ void BattleGroundAV::HandleKillPlayer(Player *player, Player *killer) return; BattleGround::HandleKillPlayer(player, killer); - UpdateScore(player->GetTeam(),-1); + UpdateScore(player->GetTeam(),-1); } void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer) @@ -344,19 +344,19 @@ void BattleGroundAV::Update(time_t diff) //creatures sLog.outDebug("BG_AV start poputlating nodes"); - for(BG_AV_Nodes i= BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i ) + for(BG_AV_Nodes i= BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i ) { if(m_Nodes[i].Owner) - PopulateNode(i); + PopulateNode(i); } //all creatures which don't get despawned through the script are static sLog.outDebug("BG_AV: start spawning static creatures"); for(i=0; i < AV_STATICCPLACE_MAX; i++ ) AddAVCreature(0,i+AV_CPLACE_MAX); - //mainspiritguides: + //mainspiritguides: sLog.outDebug("BG_AV: start spawning spiritguides creatures"); - AddSpiritGuide(7, BG_AV_CreaturePos[7][0], BG_AV_CreaturePos[7][1], BG_AV_CreaturePos[7][2], BG_AV_CreaturePos[7][3], ALLIANCE); - AddSpiritGuide(8, BG_AV_CreaturePos[8][0], BG_AV_CreaturePos[8][1], BG_AV_CreaturePos[8][2], BG_AV_CreaturePos[8][3], HORDE); + AddSpiritGuide(7, BG_AV_CreaturePos[7][0], BG_AV_CreaturePos[7][1], BG_AV_CreaturePos[7][2], BG_AV_CreaturePos[7][3], ALLIANCE); + AddSpiritGuide(8, BG_AV_CreaturePos[8][0], BG_AV_CreaturePos[8][1], BG_AV_CreaturePos[8][2], BG_AV_CreaturePos[8][3], HORDE); //spawn the marshals (those who get deleted, if a tower gets destroyed) sLog.outDebug("BG_AV: start spawning marshal creatures"); for(i=AV_NPC_A_MARSHAL_SOUTH; i<= AV_NPC_H_MARSHAL_WTOWER; i++) @@ -541,7 +541,7 @@ void BattleGroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger) { case 95: case 2608: - if(Source->GetTeam() != ALLIANCE) + if(Source->GetTeam() != ALLIANCE) Source->GetSession()->SendAreaTriggerMessage("Only The Alliance can use that portal"); else Source->LeaveBattleground(); @@ -558,7 +558,7 @@ void BattleGroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger) case 3329: case 3330: case 3331: - //Source->Unmount(); + //Source->Unmount(); break; default: sLog.outDebug("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); @@ -743,8 +743,8 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial) if(team == ALLIANCE || team == HORDE) { m_Mine_Reclaim_Timer[mine]=AV_MINE_RECLAIM_TIMER; - char buf[256]; - sprintf(buf, GetTrinityString(LANG_BG_AV_MINE_TAKEN), GetTrinityString(( mine == AV_NORTH_MINE ) ? LANG_BG_AV_MINE_NORTH : LANG_BG_AV_MINE_SOUTH), ( team == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE)); + char buf[256]; + sprintf(buf, GetTrinityString(LANG_BG_AV_MINE_TAKEN), GetTrinityString(( mine == AV_NORTH_MINE ) ? LANG_BG_AV_MINE_NORTH : LANG_BG_AV_MINE_SOUTH), ( team == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE)); Creature* creature = GetBGCreature(AV_CPLACE_HERALD); if(creature) YellToAll(creature,buf,LANG_UNIVERSAL); @@ -772,7 +772,7 @@ bool BattleGroundAV::PlayerCanDoMineQuest(int32 GOId,uint32 team) void BattleGroundAV::PopulateNode(BG_AV_Nodes node) { uint32 owner = m_Nodes[node].Owner; - assert(owner); + assert(owner); uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + ( 4 * node ); uint32 creatureid; @@ -781,7 +781,7 @@ void BattleGroundAV::PopulateNode(BG_AV_Nodes node) else { uint8 team2 = GetTeamIndexByTeamId(owner); - if (m_Team_QuestStatus[team2][0] < 500 ) + if (m_Team_QuestStatus[team2][0] < 500 ) creatureid = ( owner == ALLIANCE )? AV_NPC_A_GRAVEDEFENSE0 : AV_NPC_H_GRAVEDEFENSE0; else if ( m_Team_QuestStatus[team2][0] < 1000 ) creatureid = ( owner == ALLIANCE )? AV_NPC_A_GRAVEDEFENSE1 : AV_NPC_H_GRAVEDEFENSE1; @@ -803,7 +803,7 @@ void BattleGroundAV::PopulateNode(BG_AV_Nodes node) } void BattleGroundAV::DePopulateNode(BG_AV_Nodes node) { - uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + ( 4 * node ); + uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + ( 4 * node ); for(uint8 i=0; i<4; i++) if( m_BgCreatures[c_place+i] ) DelCreature(c_place+i); @@ -816,21 +816,21 @@ void BattleGroundAV::DePopulateNode(BG_AV_Nodes node) const BG_AV_Nodes BattleGroundAV::GetNodeThroughObject(uint32 object) { sLog.outDebug("bg_AV getnodethroughobject %i",object); - if( object <= BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER ) - return BG_AV_Nodes(object); - if( object <= BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_HUT ) - return BG_AV_Nodes(object - 11); - if( object <= BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_WTOWER ) - return BG_AV_Nodes(object - 7); - if( object <= BG_AV_OBJECT_FLAG_C_H_STONEHEART_BUNKER ) - return BG_AV_Nodes(object -22); - if( object <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT ) - return BG_AV_Nodes(object - 33); - if( object <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER ) - return BG_AV_Nodes(object - 29); - if( object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE ) - return BG_AV_NODES_SNOWFALL_GRAVE; - sLog.outError("BattleGroundAV: ERROR! GetPlace got a wrong object :("); + if( object <= BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER ) + return BG_AV_Nodes(object); + if( object <= BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_HUT ) + return BG_AV_Nodes(object - 11); + if( object <= BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_WTOWER ) + return BG_AV_Nodes(object - 7); + if( object <= BG_AV_OBJECT_FLAG_C_H_STONEHEART_BUNKER ) + return BG_AV_Nodes(object -22); + if( object <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT ) + return BG_AV_Nodes(object - 33); + if( object <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER ) + return BG_AV_Nodes(object - 29); + if( object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE ) + return BG_AV_NODES_SNOWFALL_GRAVE; + sLog.outError("BattleGroundAV: ERROR! GetPlace got a wrong object :("); assert(false); return BG_AV_Nodes(0); } @@ -941,7 +941,7 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, uint32 object) SpawnBGObject(object, RESPAWN_ONE_DAY); DefendNode(node,team); - PopulateNode(node); + PopulateNode(node); UpdateNodeWorldState(node); if(IsTower(node)) @@ -960,14 +960,14 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, uint32 object) SpawnBGObject(((team==ALLIANCE)?BG_AV_OBJECT_SNOW_EYECANDY_A : BG_AV_OBJECT_SNOW_EYECANDY_H)+i,RESPAWN_IMMEDIATELY); } } - //send a nice message to all :) - char buf[256]; - sprintf(buf, GetTrinityString(( IsTower(node) ) ? LANG_BG_AV_TOWER_DEFENDED : LANG_BG_AV_GRAVE_DEFENDED), GetNodeName(node),( team == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE)); + //send a nice message to all :) + char buf[256]; + sprintf(buf, GetTrinityString(( IsTower(node) ) ? LANG_BG_AV_TOWER_DEFENDED : LANG_BG_AV_GRAVE_DEFENDED), GetNodeName(node),( team == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE)); Creature* creature = GetBGCreature(AV_CPLACE_HERALD); if(creature) YellToAll(creature,buf,LANG_UNIVERSAL); - //update the statistic for the defending player - UpdatePlayerScore(player, ( IsTower(node) ) ? SCORE_TOWERS_DEFENDED : SCORE_GRAVEYARDS_DEFENDED, 1); + //update the statistic for the defending player + UpdatePlayerScore(player, ( IsTower(node) ) ? SCORE_TOWERS_DEFENDED : SCORE_GRAVEYARDS_DEFENDED, 1); if(IsTower(node)) PlaySoundToAll(AV_SOUND_BOTH_TOWER_DEFEND); else @@ -1421,7 +1421,7 @@ void BattleGroundAV::ResetBGSubclass() { for(uint8 j=0; j<9; j++) m_Team_QuestStatus[i][j]=0; - m_Team_Scores[i]=BG_AV_SCORE_INITIAL_POINTS; + m_Team_Scores[i]=BG_AV_SCORE_INITIAL_POINTS; m_IsInformedNearVictory[i]=false; m_CaptainAlive[i] = true; m_CaptainBuffTimer[i] = 120000 + urand(0,4)* 60; //as far as i could see, the buff is randomly so i make 2minutes (thats the duration of the buff itself) + 0-4minutes TODO get the right times @@ -1430,7 +1430,7 @@ void BattleGroundAV::ResetBGSubclass() } for(BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_STONEHEART_GRAVE; ++i) //alliance graves InitNode(i,ALLIANCE,false); - for(BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) //alliance towers + for(BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) //alliance towers InitNode(i,ALLIANCE,true); for(BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_GRAVE; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i) //horde graves InitNode(i,HORDE,false); diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index ccc6594a72c..192e85a5347 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -489,7 +489,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) Player* pCurrChar = new Player(this); pCurrChar->GetMotionMaster()->Initialize(); - // for send server info and strings (config) + // for send server info and strings (config) ChatHandler chH = ChatHandler(pCurrChar); // "GetAccountId()==db stored account id" checked in LoadFromDB (prevent login not own character using cheating tools) @@ -555,7 +555,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) SendPacket( &data ); DEBUG_LOG( "WORLD: Sent motd (SMSG_MOTD)" ); - // send server info + // send server info if(sWorld.getConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1) chH.PSendSysMessage(_FULLVERSION); @@ -626,7 +626,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) data << uint32(rEntry->startmovie); SendPacket( &data ); - // send new char string if not empty + // send new char string if not empty if (!sWorld.GetNewCharString().empty()) chH.PSendSysMessage(sWorld.GetNewCharString().c_str()); } diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 05204262c77..fa2bc71152c 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -140,12 +140,12 @@ ChatCommand * ChatHandler::getCommandTable() { { "show", SEC_GAMEMASTER, false, &ChatHandler::HandleWpShowCommand, "", NULL }, { "addwp", SEC_GAMEMASTER, false, &ChatHandler::HandleWpAddCommand, "", NULL }, - { "load", SEC_GAMEMASTER, false, &ChatHandler::HandleWpLoadPathCommand, "", NULL }, - { "modify", SEC_GAMEMASTER, false, &ChatHandler::HandleWpModifyCommand, "", NULL }, - { "event", SEC_GAMEMASTER, false, &ChatHandler::HandleWpEventCommand, "", NULL }, - { "unload", SEC_GAMEMASTER, false, &ChatHandler::HandleWpUnLoadPathCommand, "", NULL }, + { "load", SEC_GAMEMASTER, false, &ChatHandler::HandleWpLoadPathCommand, "", NULL }, + { "modify", SEC_GAMEMASTER, false, &ChatHandler::HandleWpModifyCommand, "", NULL }, + { "event", SEC_GAMEMASTER, false, &ChatHandler::HandleWpEventCommand, "", NULL }, + { "unload", SEC_GAMEMASTER, false, &ChatHandler::HandleWpUnLoadPathCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { NULL, 0, false, NULL, "", NULL } }; @@ -299,8 +299,8 @@ ChatCommand * ChatHandler::getCommandTable() { "locales_npc_text", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesNpcTextCommand, "", NULL }, { "locales_page_text", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesPageTextCommand, "", NULL }, { "locales_quest", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesQuestCommand, "", NULL }, - { "waypoint_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadWpScriptsCommand, "", NULL }, - { "gm_tickets", SEC_ADMINISTRATOR, true, &ChatHandler::HandleGMTicketReloadCommand, "", NULL }, + { "waypoint_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadWpScriptsCommand, "", NULL }, + { "gm_tickets", SEC_ADMINISTRATOR, true, &ChatHandler::HandleGMTicketReloadCommand, "", NULL }, { "", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } @@ -339,7 +339,7 @@ ChatCommand * ChatHandler::getCommandTable() { "leader", SEC_ADMINISTRATOR, false, &ChatHandler::HandleGroupLeaderCommand, "", NULL }, { "disband", SEC_ADMINISTRATOR, false, &ChatHandler::HandleGroupDisbandCommand, "", NULL }, { "remove", SEC_ADMINISTRATOR, false, &ChatHandler::HandleGroupRemoveCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { NULL, 0, false, NULL, "", NULL } }; static ChatCommand lookupPlayerCommandTable[] = @@ -438,8 +438,8 @@ ChatCommand * ChatHandler::getCommandTable() { "unfollow", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcUnFollowCommand, "", NULL }, { "whisper", SEC_MODERATOR, false, &ChatHandler::HandleNpcWhisperCommand, "", NULL }, { "yell", SEC_MODERATOR, false, &ChatHandler::HandleNpcYellCommand, "", NULL }, - { "addtemp", SEC_GAMEMASTER, false, &ChatHandler::HandleTempAddSpwCommand, "", NULL }, - { "addformation", SEC_MODERATOR, false, &ChatHandler::HandleNpcAddFormationCommand, "", NULL }, + { "addtemp", SEC_GAMEMASTER, false, &ChatHandler::HandleTempAddSpwCommand, "", NULL }, + { "addformation", SEC_MODERATOR, false, &ChatHandler::HandleNpcAddFormationCommand, "", NULL }, //{ TODO: fix or remove this commands { "name", SEC_GAMEMASTER, false, &ChatHandler::HandleNameCommand, "", NULL }, @@ -473,7 +473,7 @@ ChatCommand * ChatHandler::getCommandTable() { "move", SEC_GAMEMASTER, false, &ChatHandler::HandleMoveObjectCommand, "", NULL }, { "near", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNearObjectCommand, "", NULL }, { "activate", SEC_GAMEMASTER, false, &ChatHandler::HandleActivateObjectCommand, "", NULL }, - { "addtemp", SEC_GAMEMASTER, false, &ChatHandler::HandleTempGameObjectCommand, "", NULL }, + { "addtemp", SEC_GAMEMASTER, false, &ChatHandler::HandleTempGameObjectCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; @@ -505,26 +505,26 @@ ChatCommand * ChatHandler::getCommandTable() { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand ticketCommandTable[] = - { - { "list", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketListCommand, "", NULL }, - { "onlinelist", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketListOnlineCommand, "", NULL }, - { "viewname", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketGetByNameCommand, "", NULL }, - { "viewid", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketGetByIdCommand, "", NULL }, - { "close", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketCloseByIdCommand, "", NULL }, - { "closedlist", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketListClosedCommand, "", NULL }, - { "delete", SEC_ADMINISTRATOR, false, &ChatHandler::HandleGMTicketDeleteByIdCommand, "", NULL }, - { "assign", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketAssignToCommand, "", NULL }, - { "unassign", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketUnAssignCommand, "", NULL }, - { "comment", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketCommentCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; + static ChatCommand ticketCommandTable[] = + { + { "list", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketListCommand, "", NULL }, + { "onlinelist", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketListOnlineCommand, "", NULL }, + { "viewname", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketGetByNameCommand, "", NULL }, + { "viewid", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketGetByIdCommand, "", NULL }, + { "close", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketCloseByIdCommand, "", NULL }, + { "closedlist", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketListClosedCommand, "", NULL }, + { "delete", SEC_ADMINISTRATOR, false, &ChatHandler::HandleGMTicketDeleteByIdCommand, "", NULL }, + { "assign", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketAssignToCommand, "", NULL }, + { "unassign", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketUnAssignCommand, "", NULL }, + { "comment", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketCommentCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; static ChatCommand commandTable[] = { { "account", SEC_PLAYER, true, NULL, "", accountCommandTable }, { "gm", SEC_MODERATOR, true, NULL, "", gmCommandTable }, - { "ticket", SEC_MODERATOR, false, NULL, "", ticketCommandTable }, + { "ticket", SEC_MODERATOR, false, NULL, "", ticketCommandTable }, { "npc", SEC_MODERATOR, false, NULL, "", npcCommandTable }, { "go", SEC_MODERATOR, false, NULL, "", goCommandTable }, { "learn", SEC_MODERATOR, false, NULL, "", learnCommandTable }, @@ -535,11 +535,11 @@ ChatCommand * ChatHandler::getCommandTable() { "gobject", SEC_GAMEMASTER, false, NULL, "", gobjectCommandTable }, { "honor", SEC_GAMEMASTER, false, NULL, "", honorCommandTable }, - //wp commands - { "path", SEC_GAMEMASTER, false, NULL, "", wpCommandTable }, - { "loadpath", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadAllPaths, "", NULL }, + //wp commands + { "path", SEC_GAMEMASTER, false, NULL, "", wpCommandTable }, + { "loadpath", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadAllPaths, "", NULL }, - { "quest", SEC_ADMINISTRATOR, false, NULL, "", questCommandTable }, + { "quest", SEC_ADMINISTRATOR, false, NULL, "", questCommandTable }, { "reload", SEC_ADMINISTRATOR, true, NULL, "", reloadCommandTable }, { "list", SEC_ADMINISTRATOR, true, NULL, "", listCommandTable }, { "lookup", SEC_ADMINISTRATOR, true, NULL, "", lookupCommandTable }, @@ -863,10 +863,10 @@ int ChatHandler::ParseCommands(const char* text) ASSERT(text); ASSERT(*text); - std::string fullcmd = text; + std::string fullcmd = text; - //if(m_session->GetSecurity() == 0) - // return 0; + //if(m_session->GetSecurity() == 0) + // return 0; /// chat case (.command or !command format) if(m_session) diff --git a/src/game/Chat.h b/src/game/Chat.h index 0317886c691..8329aab4d67 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -46,7 +46,7 @@ class ChatHandler public: explicit ChatHandler(WorldSession* session) : m_session(session) {} explicit ChatHandler(Player* player) : m_session(player->GetSession()) {} - ~ChatHandler() {} + ~ChatHandler() {} static void FillMessageData( WorldPacket *data, WorldSession* session, uint8 type, uint32 language, const char *channelName, uint64 target_guid, const char *message, Unit *speaker); @@ -204,7 +204,7 @@ class ChatHandler bool HandleNpcUnFollowCommand(const char* args); bool HandleNpcWhisperCommand(const char* args); bool HandleNpcYellCommand(const char* args); - bool HandleNpcAddFormationCommand(const char* args); + bool HandleNpcAddFormationCommand(const char* args); bool HandleReloadCommand(const char* args); bool HandleReloadAllCommand(const char* args); @@ -220,7 +220,7 @@ class ChatHandler bool HandleReloadConfigCommand(const char* args); bool HandleReloadWpScriptsCommand(const char* args); - bool HandleReloadAreaTriggerTavernCommand(const char* args); + bool HandleReloadAreaTriggerTavernCommand(const char* args); bool HandleReloadAreaTriggerTeleportCommand(const char* args); bool HandleReloadEventScriptsCommand(const char* args); bool HandleReloadCommandCommand(const char* args); @@ -411,18 +411,18 @@ class ChatHandler bool HandleResetAllCommand(const char * args); - // GM ticket command handlers - bool HandleGMTicketListCommand(const char* args); - bool HandleGMTicketListOnlineCommand(const char* args); - bool HandleGMTicketListClosedCommand(const char* args); - bool HandleGMTicketGetByIdCommand(const char* args); - bool HandleGMTicketGetByNameCommand(const char* args); - bool HandleGMTicketCloseByIdCommand(const char* args); - bool HandleGMTicketAssignToCommand(const char* args); - bool HandleGMTicketUnAssignCommand(const char* args); - bool HandleGMTicketCommentCommand(const char* args); - bool HandleGMTicketDeleteByIdCommand(const char* args); - bool HandleGMTicketReloadCommand(const char*); + // GM ticket command handlers + bool HandleGMTicketListCommand(const char* args); + bool HandleGMTicketListOnlineCommand(const char* args); + bool HandleGMTicketListClosedCommand(const char* args); + bool HandleGMTicketGetByIdCommand(const char* args); + bool HandleGMTicketGetByNameCommand(const char* args); + bool HandleGMTicketCloseByIdCommand(const char* args); + bool HandleGMTicketAssignToCommand(const char* args); + bool HandleGMTicketUnAssignCommand(const char* args); + bool HandleGMTicketCommentCommand(const char* args); + bool HandleGMTicketDeleteByIdCommand(const char* args); + bool HandleGMTicketReloadCommand(const char*); bool HandleMaxSkillCommand(const char* args); bool HandleSetSkillCommand(const char* args); @@ -434,13 +434,13 @@ class ChatHandler bool HandleLockAccountCommand(const char* args); bool HandleRespawnCommand(const char* args); - //New Wp Commands - bool HandleWpAddCommand(const char* args); + //New Wp Commands + bool HandleWpAddCommand(const char* args); bool HandleWpLoadPathCommand(const char* args); - bool HandleWpUnLoadPathCommand(const char* args); - bool HandleWpModifyCommand(const char* args); + bool HandleWpUnLoadPathCommand(const char* args); + bool HandleWpModifyCommand(const char* args); bool HandleWpEventCommand(const char* args); - bool HandleWpShowCommand(const char* args); + bool HandleWpShowCommand(const char* args); bool HandleReloadAllPaths(const char *args); bool HandleFlyModeCommand(const char* args); @@ -462,12 +462,12 @@ class ChatHandler bool HandleComeToMeCommand(const char *args); bool HandleCombatStopCommand(const char *args); bool HandleCharDeleteCommand(const char *args); - bool HandleSendMessageCommand(const char * args); + bool HandleSendMessageCommand(const char * args); bool HandleFlushArenaPointsCommand(const char *args); bool HandlePlayAllCommand(const char* args); bool HandleRepairitemsCommand(const char* args); - bool HandleTempGameObjectCommand(const char* args); + bool HandleTempGameObjectCommand(const char* args); bool HandleTempAddSpwCommand(const char* args); //! Development Commands @@ -523,10 +523,10 @@ class CliHandler : public ChatHandler typedef void Print(char const*); explicit CliHandler(Print* zprint) : m_print(zprint) {} - // overwrite functions - const char *GetTrinityString(int32 entry) const; - bool isAvailable(ChatCommand const& cmd) const; - void SendSysMessage(const char *str); + // overwrite functions + const char *GetTrinityString(int32 entry) const; + bool isAvailable(ChatCommand const& cmd) const; + void SendSysMessage(const char *str); char const* GetName() const; bool needReportToTarget(Player* chr) const; diff --git a/src/game/ConfusedMovementGenerator.h b/src/game/ConfusedMovementGenerator.h index 502617e140f..8847460c504 100644 --- a/src/game/ConfusedMovementGenerator.h +++ b/src/game/ConfusedMovementGenerator.h @@ -39,14 +39,14 @@ class TRINITY_DLL_SPEC ConfusedMovementGenerator void Reset(T &); bool Update(T &, const uint32 &); - bool GetDestination(float &x, float &y, float &z) const + bool GetDestination(float &x, float &y, float &z) const { - if(i_destinationHolder.HasArrived()) return false; + if(i_destinationHolder.HasArrived()) return false; i_destinationHolder.GetDestination(x,y,z); return true; } - MovementGeneratorType GetMovementGeneratorType() { return CONFUSED_MOTION_TYPE; } + MovementGeneratorType GetMovementGeneratorType() { return CONFUSED_MOTION_TYPE; } private: void _InitSpecific(T &, bool &, bool &); TimeTracker i_nextMoveTime; diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index efad9c5e484..681aab3ebe3 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -182,28 +182,28 @@ void Creature::AddToWorld() ///- Register the creature for guid lookup if(!IsInWorld()) ObjectAccessor::Instance().AddObject(this); Unit::AddToWorld(); - SearchFormation(); + SearchFormation(); } void Creature::RemoveFromWorld() { if(m_formationID) - formation_mgr.DestroyGroup(m_formationID, GetGUID()); + formation_mgr.DestroyGroup(m_formationID, GetGUID()); - ///- Remove the creature from the accessor + ///- Remove the creature from the accessor if(IsInWorld()) ObjectAccessor::Instance().RemoveObject(this); Unit::RemoveFromWorld(); } void Creature::SearchFormation() { - uint32 lowguid = GetDBTableGUIDLow(); + uint32 lowguid = GetDBTableGUIDLow(); - if(CreatureGroupMap.find(lowguid) != CreatureGroupMap.end()) - { - m_formationID = CreatureGroupMap[lowguid]->leaderGUID; - formation_mgr.UpdateCreatureGroup(m_formationID, this); - } + if(CreatureGroupMap.find(lowguid) != CreatureGroupMap.end()) + { + m_formationID = CreatureGroupMap[lowguid]->leaderGUID; + formation_mgr.UpdateCreatureGroup(m_formationID, this); + } } void Creature::RemoveCorpse() @@ -219,8 +219,8 @@ void Creature::RemoveCorpse() float x,y,z,o; GetRespawnCoord(x, y, z, &o); - SetHomePosition(x,y,z,o); - GetMap()->CreatureRelocation(this,x,y,z,o); + SetHomePosition(x,y,z,o); + GetMap()->CreatureRelocation(this,x,y,z,o); } /** @@ -416,7 +416,7 @@ void Creature::Update(uint32 diff) UpdateEntry(m_originalEntry); CreatureInfo const *cinfo = GetCreatureInfo(); - SelectLevel(cinfo); + SelectLevel(cinfo); if (m_isDeadByDefault) { @@ -512,14 +512,14 @@ void Creature::Update(uint32 diff) if (m_regenTimer != 0) break; - if (!isInCombat()) - { - if(HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_OTHER_TAGGER)) - SetUInt32Value(UNIT_DYNAMIC_FLAGS, GetCreatureInfo()->dynamicflags); - RegenerateHealth(); - } - else if(IsPolymorphed()) - RegenerateHealth(); + if (!isInCombat()) + { + if(HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_OTHER_TAGGER)) + SetUInt32Value(UNIT_DYNAMIC_FLAGS, GetCreatureInfo()->dynamicflags); + RegenerateHealth(); + } + else if(IsPolymorphed()) + RegenerateHealth(); RegenerateMana(); @@ -974,7 +974,7 @@ void Creature::OnGossipSelect(Player* player, uint32 option) player->PlayerTalkClass->CloseGossip(); player->PlayerTalkClass->SendTalking(textid); break; - } + } case GOSSIP_OPTION_OUTDOORPVP: sOutdoorPvPMgr.HandleGossipOption(player, GetGUID(), option); break; @@ -1427,10 +1427,10 @@ bool Creature::LoadFromDB(uint32 guid, Map *map) sLog.outError("ERROR: Creature (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)",GetGUIDLow(),GetEntry(),GetPositionX(),GetPositionY()); return false; } - //We should set first home position, because then AI calls home movement - SetHomePosition(data->posX,data->posY,data->posZ,data->orientation); + //We should set first home position, because then AI calls home movement + SetHomePosition(data->posX,data->posY,data->posZ,data->orientation); - m_respawnradius = data->spawndist; + m_respawnradius = data->spawndist; m_respawnDelay = data->spawntimesecs; m_isDeadByDefault = data->is_dead; @@ -1679,11 +1679,11 @@ void Creature::setDeathState(DeathState s) SetLootRecipient(NULL); Unit::setDeathState(ALIVE); CreatureInfo const *cinfo = GetCreatureInfo(); - RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); + RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); SetUInt32Value(UNIT_NPC_FLAGS, cinfo->npcflag); clearUnitState(UNIT_STAT_ALL_STATE); - i_motionMaster.Initialize(); + i_motionMaster.Initialize(); SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool)); LoadCreaturesAddon(true); } @@ -1695,9 +1695,9 @@ bool Creature::FallGround() if (getDeathState() == DEAD_FALLING) return false; - float x, y, z; - GetPosition(x, y, z); - float ground_Z = GetMap()->GetVmapHeight(x, y, z, true); + float x, y, z; + GetPosition(x, y, z); + float ground_Z = GetMap()->GetVmapHeight(x, y, z, true); if (fabs(ground_Z - z) < 0.1f) return false; @@ -2055,8 +2055,8 @@ bool Creature::LoadCreaturesAddon(bool reload) SetUnitMovementFlags(cainfo->move_flags); //Load Path - if (cainfo->path_id != 0) - m_path_id = cainfo->path_id; + if (cainfo->path_id != 0) + m_path_id = cainfo->path_id; if(cainfo->auras) { diff --git a/src/game/Creature.h b/src/game/Creature.h index aafb4f3249a..97796f3e639 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -283,7 +283,7 @@ struct CreatureDataAddon { uint32 guidOrEntry; uint32 path_id; - uint32 mount; + uint32 mount; uint32 bytes0; uint32 bytes1; uint32 bytes2; @@ -622,18 +622,18 @@ class TRINITY_DLL_SPEC Creature : public Unit uint32 GetGlobalCooldown() const { return m_GlobalCooldown; } - uint32 GetWaypointPath(){return m_path_id;} - void LoadPath(uint32 pathid) { m_path_id = pathid; } + uint32 GetWaypointPath(){return m_path_id;} + void LoadPath(uint32 pathid) { m_path_id = pathid; } - uint32 GetCurrentWaypointID(){return m_waypointID;} - void UpdateWaypointID(uint32 wpID){m_waypointID = wpID;} + uint32 GetCurrentWaypointID(){return m_waypointID;} + void UpdateWaypointID(uint32 wpID){m_waypointID = wpID;} - void SearchFormation(); - bool IsFormationLeader() {return (GetDBTableGUIDLow() && GetDBTableGUIDLow() == m_formationID);} - uint32 GetFormationID(){return m_formationID;} + void SearchFormation(); + bool IsFormationLeader() {return (GetDBTableGUIDLow() && GetDBTableGUIDLow() == m_formationID);} + uint32 GetFormationID(){return m_formationID;} Unit *SelectVictim(); - protected: + protected: bool CreateFromProto(uint32 guidlow,uint32 Entry,uint32 team, const CreatureData *data = NULL); bool InitEntry(uint32 entry, uint32 team=ALLIANCE, const CreatureData* data=NULL); @@ -681,17 +681,17 @@ class TRINITY_DLL_SPEC Creature : public Unit float mHome_X; float mHome_Y; float mHome_Z; - float mHome_O; + float mHome_O; private: - //WaypointMovementGenerator vars - uint32 m_waypointID; - uint32 m_path_id; + //WaypointMovementGenerator vars + uint32 m_waypointID; + uint32 m_path_id; - //Formation var - uint32 m_formationID; + //Formation var + uint32 m_formationID; - GridReference m_gridRef; + GridReference m_gridRef; CreatureInfo const* m_creatureInfo; // in heroic mode can different from ObjMgr::GetCreatureTemplate(GetEntry()) }; diff --git a/src/game/CreatureGroups.cpp b/src/game/CreatureGroups.cpp index 49d77881e74..3669c638c45 100644 --- a/src/game/CreatureGroups.cpp +++ b/src/game/CreatureGroups.cpp @@ -33,182 +33,182 @@ UNORDERED_MAP CreatureGroupMap; void CreatureGroupManager::UpdateCreatureGroup(uint32 group_id, Creature *member) { - if(CreatureGroupHolder.find(group_id) != CreatureGroupHolder.end()) - { - sLog.outDebug("Group found: %u, inserting creature GUID: %u", group_id, member->GetGUIDLow()); - CreatureGroupHolder[group_id]->AddMember(member); - } - else - { - sLog.outDebug("Group not found: %u. Creating new group.", group_id); - CreatureGroup* formation = new CreatureGroup; - CreatureGroupHolder[group_id] = formation; - formation->AddMember(member); - } + if(CreatureGroupHolder.find(group_id) != CreatureGroupHolder.end()) + { + sLog.outDebug("Group found: %u, inserting creature GUID: %u", group_id, member->GetGUIDLow()); + CreatureGroupHolder[group_id]->AddMember(member); + } + else + { + sLog.outDebug("Group not found: %u. Creating new group.", group_id); + CreatureGroup* formation = new CreatureGroup; + CreatureGroupHolder[group_id] = formation; + formation->AddMember(member); + } } void CreatureGroupManager::DestroyGroup(uint32 group_id, uint64 guid) { - if(CreatureGroupHolder.find(group_id) != CreatureGroupHolder.end()) - { - sLog.outDebug("Deleting member pointer to GUID: %u from group %u", group_id, guid); - CreatureGroupHolder[group_id]->RemoveMember(guid); + if(CreatureGroupHolder.find(group_id) != CreatureGroupHolder.end()) + { + sLog.outDebug("Deleting member pointer to GUID: %u from group %u", group_id, guid); + CreatureGroupHolder[group_id]->RemoveMember(guid); - if(CreatureGroupHolder[group_id]->isEmpty()) - { - sLog.outDebug("Deleting group %u", group_id); - delete CreatureGroupHolder[group_id]; - CreatureGroupHolder.erase(group_id); - } - } + if(CreatureGroupHolder[group_id]->isEmpty()) + { + sLog.outDebug("Deleting group %u", group_id); + delete CreatureGroupHolder[group_id]; + CreatureGroupHolder.erase(group_id); + } + } } void CreatureGroupManager::LoadCreatureFormations() { - //Clear existing map - CreatureGroupMap.clear(); + //Clear existing map + CreatureGroupMap.clear(); - //Check Integrity of the table - QueryResult *result = WorldDatabase.PQuery("SELECT MAX(`leaderGUID`) FROM `creature_formations`"); + //Check Integrity of the table + QueryResult *result = WorldDatabase.PQuery("SELECT MAX(`leaderGUID`) FROM `creature_formations`"); - if(!result) + if(!result) { sLog.outErrorDb(" an error occured while loading the table `creature_formations` ( maybe it doesn't exist ?)\n"); return; } - delete result; + delete result; - //Get group data - result = WorldDatabase.PQuery("SELECT `leaderGUID`, `memberGUID`, `dist`, `angle`, `groupAI` FROM `creature_formations` ORDER BY `leaderGUID`"); + //Get group data + result = WorldDatabase.PQuery("SELECT `leaderGUID`, `memberGUID`, `dist`, `angle`, `groupAI` FROM `creature_formations` ORDER BY `leaderGUID`"); - if(!result) + if(!result) { sLog.outErrorDb("The table `creature_formations` is empty or corrupted"); return; } uint32 total_records = result->GetRowCount(), lastLeaderGUID = 0; - barGoLink bar( total_records); + barGoLink bar( total_records); Field *fields; - FormationMember *group_member; - //Loading data... - do + FormationMember *group_member; + //Loading data... + do { fields = result->Fetch(); - bar.step(); + bar.step(); //Load group member data - group_member = new FormationMember; - group_member->leaderGUID = fields[0].GetUInt32(); - group_member->memberGUID = fields[1].GetUInt32(); - group_member->groupAI = fields[4].GetUInt8(); - //If creature is group leader we may skip loading of dist/angle - if(group_member->leaderGUID != group_member->memberGUID) - { - group_member->follow_dist = fields[2].GetUInt32(); - group_member->follow_angle = fields[3].GetUInt32(); - } + group_member = new FormationMember; + group_member->leaderGUID = fields[0].GetUInt32(); + group_member->memberGUID = fields[1].GetUInt32(); + group_member->groupAI = fields[4].GetUInt8(); + //If creature is group leader we may skip loading of dist/angle + if(group_member->leaderGUID != group_member->memberGUID) + { + group_member->follow_dist = fields[2].GetUInt32(); + group_member->follow_angle = fields[3].GetUInt32(); + } - CreatureGroupMap[group_member->memberGUID] = group_member; + CreatureGroupMap[group_member->memberGUID] = group_member; - if(lastLeaderGUID != group_member->leaderGUID) - lastLeaderGUID = group_member->leaderGUID; - } - while(result->NextRow()) ; + if(lastLeaderGUID != group_member->leaderGUID) + lastLeaderGUID = group_member->leaderGUID; + } + while(result->NextRow()) ; - sLog.outString(); - sLog.outString( ">> Loaded %u creatures in formations", total_records ); sLog.outString(); - //Free some heap - delete result; + sLog.outString( ">> Loaded %u creatures in formations", total_records ); + sLog.outString(); + //Free some heap + delete result; } void CreatureGroup::AddMember(Creature *member) { - sLog.outDebug("Adding unit GUID: %u.", member->GetGUIDLow()); + sLog.outDebug("Adding unit GUID: %u.", member->GetGUIDLow()); - uint64 guid = member->GetGUID(); - //We first search creature member if exist - if(CreatureGroupMembers.find(guid) != CreatureGroupMembers.end()) - return; - //Check is that shit is a leader - if(member->IsFormationLeader()) - { - sLog.outDebug("Unit GUID: %u is formation leader. Adding group.", member->GetGUIDLow()); - m_leader = member; - } - //Add to the club - CreatureGroupMembers[guid] = member; - sLog.outDebug("Unit GUID: %u added.", member->GetGUID()); + uint64 guid = member->GetGUID(); + //We first search creature member if exist + if(CreatureGroupMembers.find(guid) != CreatureGroupMembers.end()) + return; + //Check is that shit is a leader + if(member->IsFormationLeader()) + { + sLog.outDebug("Unit GUID: %u is formation leader. Adding group.", member->GetGUIDLow()); + m_leader = member; + } + //Add to the club + CreatureGroupMembers[guid] = member; + sLog.outDebug("Unit GUID: %u added.", member->GetGUID()); } void CreatureGroup::RemoveMember(uint64 guid) { - if(CreatureGroupMembers.find(guid) != CreatureGroupMembers.end()) - CreatureGroupMembers.erase(guid); + if(CreatureGroupMembers.find(guid) != CreatureGroupMembers.end()) + CreatureGroupMembers.erase(guid); } void CreatureGroup::MemberHasAttacked(Creature *member) { - uint8 groupAI = CreatureGroupMap[member->GetDBTableGUIDLow()]->groupAI;; + uint8 groupAI = CreatureGroupMap[member->GetDBTableGUIDLow()]->groupAI;; - for(UNORDERED_MAP::iterator itr = CreatureGroupMembers.begin(); itr != CreatureGroupMembers.end(); itr++) - { - sLog.outDebug("AI:%u:Group member found: %u, attacked by %s.", groupAI, itr->second->GetGUIDLow(), member->getVictim()->GetName()); - if(itr->second) - { - switch(groupAI) - { - case 0: - return; - case 1: - if(!member->IsFormationLeader()) - return; - } - //Attack if everything is OK - itr->second->AI()->AttackStart(member->getVictim()); - } - } + for(UNORDERED_MAP::iterator itr = CreatureGroupMembers.begin(); itr != CreatureGroupMembers.end(); itr++) + { + sLog.outDebug("AI:%u:Group member found: %u, attacked by %s.", groupAI, itr->second->GetGUIDLow(), member->getVictim()->GetName()); + if(itr->second) + { + switch(groupAI) + { + case 0: + return; + case 1: + if(!member->IsFormationLeader()) + return; + } + //Attack if everything is OK + itr->second->AI()->AttackStart(member->getVictim()); + } + } } void CreatureGroup::LeaderMovedInEvade() { - for(UNORDERED_MAP::iterator itr = CreatureGroupMembers.begin(); itr != CreatureGroupMembers.end(); itr++) - { - if(itr->second && itr->second->isAlive() && !itr->second->isInCombat() && !itr->second->getVictim()) - SetMemberDestination(itr->second); - } + for(UNORDERED_MAP::iterator itr = CreatureGroupMembers.begin(); itr != CreatureGroupMembers.end(); itr++) + { + if(itr->second && itr->second->isAlive() && !itr->second->isInCombat() && !itr->second->getVictim()) + SetMemberDestination(itr->second); + } } void CreatureGroup::SetMemberDestination(Creature *member) { - if(!member || !m_leader || member->IsFormationLeader()) - return; + if(!member || !m_leader || member->IsFormationLeader()) + return; - float x,y,z; - uint32 lowguid = member->GetGUIDLow(); + float x,y,z; + uint32 lowguid = member->GetGUIDLow(); - UNORDERED_MAP::iterator itr2 = CreatureGroupMap.find(lowguid); + UNORDERED_MAP::iterator itr2 = CreatureGroupMap.find(lowguid); - if(m_leader->GetMotionMaster()->GetDestination(x,y,z) && itr2 != CreatureGroupMap.end()) - { - float dist, angle, pathangle; + if(m_leader->GetMotionMaster()->GetDestination(x,y,z) && itr2 != CreatureGroupMap.end()) + { + float dist, angle, pathangle; - angle = CreatureGroupMap[lowguid]->follow_angle; - dist = CreatureGroupMap[lowguid]->follow_dist; - pathangle = atan2(m_leader->GetPositionY()-y, m_leader->GetPositionX()-x); + angle = CreatureGroupMap[lowguid]->follow_angle; + dist = CreatureGroupMap[lowguid]->follow_dist; + pathangle = atan2(m_leader->GetPositionY()-y, m_leader->GetPositionX()-x); - x = x+cos(angle+pathangle)*dist; - y = y+sin(angle+pathangle)*dist; + x = x+cos(angle+pathangle)*dist; + y = y+sin(angle+pathangle)*dist; - member->GetMotionMaster()->Clear(); + member->GetMotionMaster()->Clear(); - if(member->GetDistance(m_leader) < dist+MAX_DESYNC) - member->SetUnitMovementFlags(m_leader->GetUnitMovementFlags()); - else - member->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + if(member->GetDistance(m_leader) < dist+MAX_DESYNC) + member->SetUnitMovementFlags(m_leader->GetUnitMovementFlags()); + else + member->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - member->GetMotionMaster()->MovePoint(0, x, y, z); - } + member->GetMotionMaster()->MovePoint(0, x, y, z); + } } diff --git a/src/game/CreatureGroups.h b/src/game/CreatureGroups.h index c2155049745..c8dd45c1b3f 100644 --- a/src/game/CreatureGroups.h +++ b/src/game/CreatureGroups.h @@ -27,35 +27,35 @@ struct FormationMember { - float follow_dist; - float follow_angle; - uint32 memberGUID; - uint32 leaderGUID; - uint8 groupAI; + float follow_dist; + float follow_angle; + uint32 memberGUID; + uint32 leaderGUID; + uint8 groupAI; }; class CreatureGroupManager { - public: - void UpdateCreatureGroup(uint32 group_id, Creature *member); - void DestroyGroup(uint32 group_id, uint64 guid); - void LoadCreatureFormations(); + public: + void UpdateCreatureGroup(uint32 group_id, Creature *member); + void DestroyGroup(uint32 group_id, uint64 guid); + void LoadCreatureFormations(); }; class CreatureGroup { - UNORDERED_MAPCreatureGroupMembers; - Creature *m_leader; //Important do not forget sometimes to work with pointers instead synonims :D:D + UNORDERED_MAPCreatureGroupMembers; + Creature *m_leader; //Important do not forget sometimes to work with pointers instead synonims :D:D - public: - CreatureGroup() : m_leader(NULL) {} - ~CreatureGroup(){sLog.outDebug("Destroying group");} - void AddMember(Creature *); - void RemoveMember(uint64 guid); - void LeaderMovedInEvade(); - void MemberHasAttacked(Creature *); - void SetMemberDestination(Creature *); - bool isEmpty() {return CreatureGroupMembers.empty();} + public: + CreatureGroup() : m_leader(NULL) {} + ~CreatureGroup(){sLog.outDebug("Destroying group");} + void AddMember(Creature *); + void RemoveMember(uint64 guid); + void LeaderMovedInEvade(); + void MemberHasAttacked(Creature *); + void SetMemberDestination(Creature *); + bool isEmpty() {return CreatureGroupMembers.empty();} }; typedef UNORDERED_MAP CreatureGroupHolderType; diff --git a/src/game/FleeingMovementGenerator.cpp b/src/game/FleeingMovementGenerator.cpp index 478e472662c..ff3d2f21b78 100644 --- a/src/game/FleeingMovementGenerator.cpp +++ b/src/game/FleeingMovementGenerator.cpp @@ -62,7 +62,7 @@ bool FleeingMovementGenerator::GetDestination(float &x, float &y, floa template<> bool FleeingMovementGenerator::GetDestination(float &x, float &y, float &z) const { - return false; + return false; } template diff --git a/src/game/FleeingMovementGenerator.h b/src/game/FleeingMovementGenerator.h index 6024f64ded6..23b5a0ad589 100644 --- a/src/game/FleeingMovementGenerator.h +++ b/src/game/FleeingMovementGenerator.h @@ -37,7 +37,7 @@ class TRINITY_DLL_SPEC FleeingMovementGenerator void Finalize(T &); void Reset(T &); bool Update(T &, const uint32 &); - bool GetDestination(float &x, float &y, float &z) const; + bool GetDestination(float &x, float &y, float &z) const; MovementGeneratorType GetMovementGeneratorType() { return FLEEING_MOTION_TYPE; } diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index bea125cf5ee..4bbb31c65c0 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -596,13 +596,13 @@ namespace Trinity float i_range; }; - class CreatureWithDbGUIDCheck + class CreatureWithDbGUIDCheck { public: CreatureWithDbGUIDCheck(WorldObject const* obj, uint32 lowguid) : i_obj(obj), i_lowguid(lowguid) {} bool operator()(Creature* u) { - return u->GetDBTableGUIDLow() == i_lowguid; + return u->GetDBTableGUIDLow() == i_lowguid; } private: WorldObject const* i_obj; diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 52b8e6244d9..829538f8af7 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -44,7 +44,7 @@ Group::Group() m_lootMethod = (LootMethod)0; m_looterGuid = 0; m_lootThreshold = ITEM_QUALITY_UNCOMMON; - m_subGroupsCounts = NULL; + m_subGroupsCounts = NULL; for(int i=0; isecond.save->RemoveGroup(this); - if (m_subGroupsCounts) - delete[] m_subGroupsCounts; + if (m_subGroupsCounts) + delete[] m_subGroupsCounts; } bool Group::Create(const uint64 &guid, const char * name) @@ -85,8 +85,8 @@ bool Group::Create(const uint64 &guid, const char * name) m_groupType = isBGGroup() ? GROUPTYPE_RAID : GROUPTYPE_NORMAL; - if (m_groupType == GROUPTYPE_RAID) - _initRaidSubGroupsCounter(); + if (m_groupType == GROUPTYPE_RAID) + _initRaidSubGroupsCounter(); m_lootMethod = GROUP_LOOT; m_lootThreshold = ITEM_QUALITY_UNCOMMON; @@ -144,8 +144,8 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult *result, bool m_groupType = (*result)[13].GetBool() ? GROUPTYPE_RAID : GROUPTYPE_NORMAL; - if (m_groupType == GROUPTYPE_RAID) - _initRaidSubGroupsCounter(); + if (m_groupType == GROUPTYPE_RAID) + _initRaidSubGroupsCounter(); m_difficulty = (*result)[14].GetUInt8(); m_mainTank = (*result)[0].GetUInt64(); @@ -190,19 +190,19 @@ bool Group::LoadMemberFromDB(uint32 guidLow, uint8 subgroup, bool assistant) member.assistant = assistant; m_memberSlots.push_back(member); - SubGroupCounterIncrease(subgroup); + SubGroupCounterIncrease(subgroup); return true; } void Group::ConvertToRaid() { - m_groupType = GROUPTYPE_RAID; + m_groupType = GROUPTYPE_RAID; - _initRaidSubGroupsCounter(); + _initRaidSubGroupsCounter(); - if(!isBGGroup()) CharacterDatabase.PExecute("UPDATE groups SET isRaid = 1 WHERE leaderGuid='%u'", GUID_LOPART(m_leaderGuid)); - SendUpdate(); + if(!isBGGroup()) CharacterDatabase.PExecute("UPDATE groups SET isRaid = 1 WHERE leaderGuid='%u'", GUID_LOPART(m_leaderGuid)); + SendUpdate(); } bool Group::AddInvite(Player *player) @@ -974,17 +974,17 @@ bool Group::_addMember(const uint64 &guid, const char* name, bool isAssistant) if (m_subGroupsCounts) { bool groupFound = false; - for (; groupid < MAXRAIDSIZE/MAXGROUPSIZE; ++groupid) - { - if (m_subGroupsCounts[groupid] < MAXGROUPSIZE) - { - groupFound = true; - break; - } - } - // We are raid group and no one slot is free - if (!groupFound) - return false; + for (; groupid < MAXRAIDSIZE/MAXGROUPSIZE; ++groupid) + { + if (m_subGroupsCounts[groupid] < MAXGROUPSIZE) + { + groupFound = true; + break; + } + } + // We are raid group and no one slot is free + if (!groupFound) + return false; } return _addMember(guid, name, isAssistant, groupid); @@ -1007,7 +1007,7 @@ bool Group::_addMember(const uint64 &guid, const char* name, bool isAssistant, u member.assistant = isAssistant; m_memberSlots.push_back(member); - SubGroupCounterIncrease(group); + SubGroupCounterIncrease(group); if(player) { @@ -1046,10 +1046,10 @@ bool Group::_removeMember(const uint64 &guid) member_witerator slot = _getMemberWSlot(guid); if (slot != m_memberSlots.end()) - { - SubGroupCounterDecrease(slot->group); + { + SubGroupCounterDecrease(slot->group); m_memberSlots.erase(slot); - } + } if(!isBGGroup()) CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid='%u'", GUID_LOPART(guid)); @@ -1150,7 +1150,7 @@ bool Group::_setMembersGroup(const uint64 &guid, const uint8 &group) slot->group = group; - SubGroupCounterIncrease(group); + SubGroupCounterIncrease(group); if(!isBGGroup()) CharacterDatabase.PExecute("UPDATE group_member SET subgroup='%u' WHERE memberGuid='%u'", group, GUID_LOPART(guid)); @@ -1209,16 +1209,16 @@ void Group::ChangeMembersGroup(const uint64 &guid, const uint8 &group) Player *player = objmgr.GetPlayer(guid); if (!player) { - uint8 prevSubGroup; - prevSubGroup = GetMemberGroup(guid); + uint8 prevSubGroup; + prevSubGroup = GetMemberGroup(guid); - SubGroupCounterDecrease(prevSubGroup); + SubGroupCounterDecrease(prevSubGroup); if(_setMembersGroup(guid, group)) SendUpdate(); } else - ChangeMembersGroup(player, group); + ChangeMembersGroup(player, group); } // only for online members @@ -1228,10 +1228,10 @@ void Group::ChangeMembersGroup(Player *player, const uint8 &group) return; if(_setMembersGroup(player->GetGUID(), group)) { - uint8 prevSubGroup; - prevSubGroup = player->GetSubGroup(); + uint8 prevSubGroup; + prevSubGroup = player->GetSubGroup(); - SubGroupCounterDecrease(prevSubGroup); + SubGroupCounterDecrease(prevSubGroup); player->GetGroupRef().setSubGroup(group); SendUpdate(); diff --git a/src/game/Group.h b/src/game/Group.h index dabb1715968..9882966e3f6 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -225,10 +225,10 @@ class TRINITY_DLL_SPEC Group return (mslot1->group==slot2->group); } - bool HasFreeSlotSubGroup(uint8 subgroup) const - { - return (m_subGroupsCounts && m_subGroupsCounts[subgroup] < MAXGROUPSIZE); - } + bool HasFreeSlotSubGroup(uint8 subgroup) const + { + return (m_subGroupsCounts && m_subGroupsCounts[subgroup] < MAXGROUPSIZE); + } bool SameSubGroup(Player const* member1, Player const* member2) const; @@ -304,8 +304,8 @@ class TRINITY_DLL_SPEC Group void SendLootRollWon(const uint64& SourceGuid, const uint64& TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r); void SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r); void GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature); - void NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *creature); - void MasterLoot(const uint64& playerGUID, Loot *loot, Creature *creature); + void NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *creature); + void MasterLoot(const uint64& playerGUID, Loot *loot, Creature *creature); Rolls::iterator GetRoll(uint64 Guid) { Rolls::iterator iter; @@ -348,17 +348,17 @@ class TRINITY_DLL_SPEC Group void _homebindIfInstance(Player *player); - void _initRaidSubGroupsCounter() - { - // Sub group counters initialization - if (!m_subGroupsCounts) - m_subGroupsCounts = new uint8[MAXRAIDSIZE / MAXGROUPSIZE]; + void _initRaidSubGroupsCounter() + { + // Sub group counters initialization + if (!m_subGroupsCounts) + m_subGroupsCounts = new uint8[MAXRAIDSIZE / MAXGROUPSIZE]; - memset((void*)m_subGroupsCounts, 0, (MAXRAIDSIZE / MAXGROUPSIZE)*sizeof(uint8)); + memset((void*)m_subGroupsCounts, 0, (MAXRAIDSIZE / MAXGROUPSIZE)*sizeof(uint8)); - for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr) - ++m_subGroupsCounts[itr->group]; - } + for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr) + ++m_subGroupsCounts[itr->group]; + } member_citerator _getMemberCSlot(uint64 Guid) const { @@ -380,17 +380,17 @@ class TRINITY_DLL_SPEC Group return m_memberSlots.end(); } - void SubGroupCounterIncrease(uint8 subgroup) - { - if (m_subGroupsCounts) - ++m_subGroupsCounts[subgroup]; - } + void SubGroupCounterIncrease(uint8 subgroup) + { + if (m_subGroupsCounts) + ++m_subGroupsCounts[subgroup]; + } - void SubGroupCounterDecrease(uint8 subgroup) - { - if (m_subGroupsCounts) - --m_subGroupsCounts[subgroup]; - } + void SubGroupCounterDecrease(uint8 subgroup) + { + if (m_subGroupsCounts) + --m_subGroupsCounts[subgroup]; + } MemberSlotList m_memberSlots; GroupRefManager m_memberMgr; @@ -408,6 +408,6 @@ class TRINITY_DLL_SPEC Group uint64 m_looterGuid; Rolls RollId; BoundInstancesMap m_boundInstances[TOTAL_DIFFICULTIES]; - uint8* m_subGroupsCounts; + uint8* m_subGroupsCounts; }; #endif diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp index 897110afe55..d16274dbf5b 100644 --- a/src/game/Guild.cpp +++ b/src/game/Guild.cpp @@ -361,7 +361,7 @@ bool Guild::FillPlayerData(uint64 guid, MemberSlot* memslot) } else { - PCachePlayerInfo pInfo = objmgr.GetPlayerInfoFromCache(GUID_LOPART(guid)); + PCachePlayerInfo pInfo = objmgr.GetPlayerInfoFromCache(GUID_LOPART(guid)); if(pInfo) { plName = pInfo->sPlayerName; @@ -412,7 +412,7 @@ bool Guild::FillPlayerData(uint64 guid, MemberSlot* memslot) return false; } } - } + } memslot->name = plName; memslot->level = plLevel; diff --git a/src/game/HomeMovementGenerator.cpp b/src/game/HomeMovementGenerator.cpp index 76d5b9626d6..0f5b9b2543b 100644 --- a/src/game/HomeMovementGenerator.cpp +++ b/src/game/HomeMovementGenerator.cpp @@ -70,10 +70,10 @@ HomeMovementGenerator::Update(Creature &owner, const uint32& time_diff // restore orientation of not moving creature at returning to home if(owner.GetDefaultMovementType()==IDLE_MOTION_TYPE) { - owner.SetOrientation(ori); - WorldPacket packet; - owner.BuildHeartBeatMsg(&packet); - owner.SendMessageToSet(&packet, false); + owner.SetOrientation(ori); + WorldPacket packet; + owner.BuildHeartBeatMsg(&packet); + owner.SendMessageToSet(&packet, false); } return false; } diff --git a/src/game/HomeMovementGenerator.h b/src/game/HomeMovementGenerator.h index ce47d0351ee..a116027608f 100644 --- a/src/game/HomeMovementGenerator.h +++ b/src/game/HomeMovementGenerator.h @@ -51,7 +51,7 @@ class TRINITY_DLL_SPEC HomeMovementGenerator void _setTargetLocation(Creature &); DestinationHolder< Traveller > i_destinationHolder; - float ori; + float ori; uint32 i_travel_timer; }; #endif diff --git a/src/game/Language.h b/src/game/Language.h index a76393e95b5..590c21e715b 100644 --- a/src/game/Language.h +++ b/src/game/Language.h @@ -269,9 +269,9 @@ enum TrinityStrings LANG_COMMAND_WHISPERON = 285, LANG_COMMAND_WHISPEROFF = 286, LANG_COMMAND_CREATGUIDNOTFOUND = 287, - // TICKET STRINGS NEED REWRITE // 288-296 FREE + // TICKET STRINGS NEED REWRITE // 288-296 FREE - // END + // END LANG_COMMAND_SPAWNDIST = 297, LANG_COMMAND_SPAWNTIME = 298, LANG_COMMAND_MODIFY_HONOR = 299, @@ -758,24 +758,24 @@ enum TrinityStrings LANG_YOU_CHANGE_GENDER = 1120, LANG_YOUR_GENDER_CHANGED = 1121, - // Ticket Strings 2000-2029 - LANG_COMMAND_TICKETNEW = 2000, + // Ticket Strings 2000-2029 + LANG_COMMAND_TICKETNEW = 2000, LANG_COMMAND_TICKETUPDATED = 2001, - LANG_COMMAND_TICKETPLAYERABANDON = 2002, - LANG_COMMAND_TICKETCLOSED = 2003, - LANG_COMMAND_TICKETDELETED = 2004, - LANG_COMMAND_TICKETNOTEXIST = 2005, - LANG_COMMAND_TICKETCLOSEFIRST = 2006, - LANG_COMMAND_TICKETALREADYASSIGNED = 2007, - LANG_COMMAND_TICKETRELOAD = 2008, - LANG_COMMAND_TICKETSHOWLIST = 2009, - LANG_COMMAND_TICKETSHOWONLINELIST = 2010, - LANG_COMMAND_TICKETSHOWCLOSEDLIST = 2011, - LANG_COMMAND_TICKETASSIGNERROR_A = 2012, - LANG_COMMAND_TICKETASSIGNERROR_B = 2013, - LANG_COMMAND_TICKETNOTASSIGNED = 2014, - LANG_COMMAND_TICKETUNASSIGNSECURITY = 2015, - LANG_COMMAND_TICKETCANNOTCLOSE = 2016, + LANG_COMMAND_TICKETPLAYERABANDON = 2002, + LANG_COMMAND_TICKETCLOSED = 2003, + LANG_COMMAND_TICKETDELETED = 2004, + LANG_COMMAND_TICKETNOTEXIST = 2005, + LANG_COMMAND_TICKETCLOSEFIRST = 2006, + LANG_COMMAND_TICKETALREADYASSIGNED = 2007, + LANG_COMMAND_TICKETRELOAD = 2008, + LANG_COMMAND_TICKETSHOWLIST = 2009, + LANG_COMMAND_TICKETSHOWONLINELIST = 2010, + LANG_COMMAND_TICKETSHOWCLOSEDLIST = 2011, + LANG_COMMAND_TICKETASSIGNERROR_A = 2012, + LANG_COMMAND_TICKETASSIGNERROR_B = 2013, + LANG_COMMAND_TICKETNOTASSIGNED = 2014, + LANG_COMMAND_TICKETUNASSIGNSECURITY = 2015, + LANG_COMMAND_TICKETCANNOTCLOSE = 2016, LANG_COMMAND_TICKETLISTGUID = 2017, LANG_COMMAND_TICKETLISTNAME = 2018, LANG_COMMAND_TICKETLISTAGE = 2019, @@ -867,8 +867,8 @@ enum TrinityStrings LANG_OPVP_EP_FLIGHT_CGT = 10053, LANG_OPVP_ZM_GOSSIP_ALLIANCE = 10054, LANG_OPVP_ZM_GOSSIP_HORDE = 10055, - LANG_NO_ENTER_HALL_OF_LEGENDS = 10056, - LANG_NO_ENTER_CHAMPIONS_HALL = 10057, + LANG_NO_ENTER_HALL_OF_LEGENDS = 10056, + LANG_NO_ENTER_CHAMPIONS_HALL = 10057, // Use for custom patches 11000-11999 diff --git a/src/game/Level0.cpp b/src/game/Level0.cpp index ff7d58f8da1..bd40ee431ac 100644 --- a/src/game/Level0.cpp +++ b/src/game/Level0.cpp @@ -36,17 +36,17 @@ bool ChatHandler::HandleHelpCommand(const char* args) { - char* cmd = strtok((char*)args, " "); + char* cmd = strtok((char*)args, " "); if(!cmd) - { - ShowHelpForCommand(getCommandTable(), "help"); - ShowHelpForCommand(getCommandTable(), ""); - } - else - { - if(!ShowHelpForCommand(getCommandTable(), cmd)) - SendSysMessage(LANG_NO_HELP_CMD); - } + { + ShowHelpForCommand(getCommandTable(), "help"); + ShowHelpForCommand(getCommandTable(), ""); + } + else + { + if(!ShowHelpForCommand(getCommandTable(), cmd)) + SendSysMessage(LANG_NO_HELP_CMD); + } return true; } @@ -163,8 +163,8 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/) for(; itr != m.end(); ++itr) { if (itr->second->GetSession()->GetSecurity() && - (itr->second->isGameMaster() || sWorld.getConfig(CONFIG_GM_IN_GM_LIST)) && - (!m_session || itr->second->IsVisibleGloballyFor(m_session->GetPlayer())) ) + (itr->second->isGameMaster() || sWorld.getConfig(CONFIG_GM_IN_GM_LIST)) && + (!m_session || itr->second->IsVisibleGloballyFor(m_session->GetPlayer())) ) { if(first) { @@ -201,14 +201,14 @@ bool ChatHandler::HandlePasswordCommand(const char* args) if (strcmp(new_pass, new_pass_c) != 0) { SendSysMessage (LANG_NEW_PASSWORDS_NOT_MATCH); - SetSentErrorMessage (true); - return false; - } + SetSentErrorMessage (true); + return false; + } - if (!accmgr.CheckPassword (m_session->GetAccountId(), password_old)) - { - SendSysMessage (LANG_COMMAND_WRONGOLDPASSWORD); - SetSentErrorMessage (true); + if (!accmgr.CheckPassword (m_session->GetAccountId(), password_old)) + { + SendSysMessage (LANG_COMMAND_WRONGOLDPASSWORD); + SetSentErrorMessage (true); return false; } @@ -219,11 +219,11 @@ bool ChatHandler::HandlePasswordCommand(const char* args) case AOR_OK: SendSysMessage(LANG_COMMAND_PASSWORD); break; - case AOR_PASS_TOO_LONG: - SendSysMessage(LANG_PASSWORD_TOO_LONG); - SetSentErrorMessage(true); - return false; - case AOR_NAME_NOT_EXIST: // not possible case, don't want get account name for output + case AOR_PASS_TOO_LONG: + SendSysMessage(LANG_PASSWORD_TOO_LONG); + SetSentErrorMessage(true); + return false; + case AOR_NAME_NOT_EXIST: // not possible case, don't want get account name for output default: SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD); SetSentErrorMessage(true); @@ -263,6 +263,6 @@ bool ChatHandler::HandleLockAccountCommand(const char* args) /// Display the 'Message of the day' for the realm bool ChatHandler::HandleServerMotdCommand(const char* /*args*/) { - PSendSysMessage(LANG_MOTD_CURRENT, sWorld.GetMotd()); - return true; + PSendSysMessage(LANG_MOTD_CURRENT, sWorld.GetMotd()); + return true; } diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index 0219876aa7f..5ee72a786d9 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -279,345 +279,345 @@ std::string ChatHandler::PGetParseString(int32 entry, ...) } bool ChatHandler::HandleGMTicketListCommand(const char* args) { - SendSysMessage(LANG_COMMAND_TICKETSHOWLIST); - for(GmTicketList::iterator itr = ticketmgr.GM_TicketList.begin(); itr != ticketmgr.GM_TicketList.end(); ++itr) - { - if((*itr)->closed != 0) - continue; + SendSysMessage(LANG_COMMAND_TICKETSHOWLIST); + for(GmTicketList::iterator itr = ticketmgr.GM_TicketList.begin(); itr != ticketmgr.GM_TicketList.end(); ++itr) + { + if((*itr)->closed != 0) + continue; std::string gmname; std::stringstream ss; ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, (*itr)->guid); ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, (*itr)->name.c_str()); ss << PGetParseString(LANG_COMMAND_TICKETLISTAGE, (secsToTimeString(time(NULL) - (*itr)->timestamp, true, false)).c_str()); - if(objmgr.GetPlayerNameByGUID((*itr)->assignedToGM, gmname)) - { + if(objmgr.GetPlayerNameByGUID((*itr)->assignedToGM, gmname)) + { ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str()); } SendSysMessage(ss.str().c_str()); - } - return true; + } + return true; } bool ChatHandler::HandleGMTicketListOnlineCommand(const char* args) { - SendSysMessage(LANG_COMMAND_TICKETSHOWONLINELIST); - for(GmTicketList::iterator itr = ticketmgr.GM_TicketList.begin(); itr != ticketmgr.GM_TicketList.end(); ++itr) - { - if((*itr)->closed != 0 || !objmgr.GetPlayer((*itr)->playerGuid)) - continue; + SendSysMessage(LANG_COMMAND_TICKETSHOWONLINELIST); + for(GmTicketList::iterator itr = ticketmgr.GM_TicketList.begin(); itr != ticketmgr.GM_TicketList.end(); ++itr) + { + if((*itr)->closed != 0 || !objmgr.GetPlayer((*itr)->playerGuid)) + continue; std::string gmname; std::stringstream ss; ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, (*itr)->guid); ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, (*itr)->name.c_str()); ss << PGetParseString(LANG_COMMAND_TICKETLISTAGE, (secsToTimeString(time(NULL) - (*itr)->timestamp, true, false)).c_str()); - if(objmgr.GetPlayerNameByGUID((*itr)->assignedToGM, gmname)) - { + if(objmgr.GetPlayerNameByGUID((*itr)->assignedToGM, gmname)) + { ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str()); } SendSysMessage(ss.str().c_str()); - } - return true; + } + return true; } bool ChatHandler::HandleGMTicketListClosedCommand(const char* args) { - SendSysMessage(LANG_COMMAND_TICKETSHOWCLOSEDLIST); - for(GmTicketList::iterator itr = ticketmgr.GM_TicketList.begin(); itr != ticketmgr.GM_TicketList.end(); ++itr) - { - if((*itr)->closed == 0) - continue; + SendSysMessage(LANG_COMMAND_TICKETSHOWCLOSEDLIST); + for(GmTicketList::iterator itr = ticketmgr.GM_TicketList.begin(); itr != ticketmgr.GM_TicketList.end(); ++itr) + { + if((*itr)->closed == 0) + continue; std::string gmname; std::stringstream ss; ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, (*itr)->guid); ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, (*itr)->name.c_str()); ss << PGetParseString(LANG_COMMAND_TICKETLISTAGE, (secsToTimeString(time(NULL) - (*itr)->timestamp, true, false)).c_str()); - if(objmgr.GetPlayerNameByGUID((*itr)->assignedToGM, gmname)) - { + if(objmgr.GetPlayerNameByGUID((*itr)->assignedToGM, gmname)) + { ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str()); } SendSysMessage(ss.str().c_str()); - } - return true; + } + return true; } bool ChatHandler::HandleGMTicketGetByIdCommand(const char* args) { - if(!*args) - return false; + if(!*args) + return false; - uint64 tguid = atoi(args); - GM_Ticket *ticket = ticketmgr.GetGMTicket(tguid); - if(!ticket) - { - SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); - return true; - } + uint64 tguid = atoi(args); + GM_Ticket *ticket = ticketmgr.GetGMTicket(tguid); + if(!ticket) + { + SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } std::string gmname; std::stringstream ss; ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, ticket->guid); ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str()); ss << PGetParseString(LANG_COMMAND_TICKETLISTAGE, (secsToTimeString(time(NULL) - ticket->timestamp, true, false)).c_str()); - if(objmgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname)) - { + if(objmgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname)) + { ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str()); } - ss << PGetParseString(LANG_COMMAND_TICKETLISTMESSAGE, ticket->message.c_str()); - if(ticket->comment != "") - { - ss << PGetParseString(LANG_COMMAND_TICKETLISTCOMMENT, ticket->comment.c_str()); - } + ss << PGetParseString(LANG_COMMAND_TICKETLISTMESSAGE, ticket->message.c_str()); + if(ticket->comment != "") + { + ss << PGetParseString(LANG_COMMAND_TICKETLISTCOMMENT, ticket->comment.c_str()); + } SendSysMessage(ss.str().c_str()); - return true; + return true; } bool ChatHandler::HandleGMTicketGetByNameCommand(const char* args) { - if(!*args) - return false; + if(!*args) + return false; - GM_Ticket *ticket = ticketmgr.GetGMTicketByName(args); - if(!ticket) - { - SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); - return true; - } + GM_Ticket *ticket = ticketmgr.GetGMTicketByName(args); + if(!ticket) + { + SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } std::string gmname; std::stringstream ss; ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, ticket->guid); ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str()); ss << PGetParseString(LANG_COMMAND_TICKETLISTAGE, (secsToTimeString(time(NULL) - ticket->timestamp, true, false)).c_str()); - if(objmgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname)) - { + if(objmgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname)) + { ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str()); } - ss << PGetParseString(LANG_COMMAND_TICKETLISTMESSAGE, ticket->message.c_str()); - if(ticket->comment != "") - { - ss << PGetParseString(LANG_COMMAND_TICKETLISTCOMMENT, ticket->comment.c_str()); - } + ss << PGetParseString(LANG_COMMAND_TICKETLISTMESSAGE, ticket->message.c_str()); + if(ticket->comment != "") + { + ss << PGetParseString(LANG_COMMAND_TICKETLISTCOMMENT, ticket->comment.c_str()); + } SendSysMessage(ss.str().c_str()); - return true; + return true; } bool ChatHandler::HandleGMTicketCloseByIdCommand(const char* args) { - if(!*args) - return false; + if(!*args) + return false; - uint64 tguid = atoi(args); - GM_Ticket *ticket = ticketmgr.GetGMTicket(tguid); - if(!ticket || ticket->closed != 0) - { - SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); - return true; - } - if(ticket && ticket->assignedToGM != 0 && ticket->assignedToGM != m_session->GetPlayer()->GetGUID()) - { - PSendSysMessage(LANG_COMMAND_TICKETCANNOTCLOSE, ticket->guid); - return true; - } - std::stringstream ss; + uint64 tguid = atoi(args); + GM_Ticket *ticket = ticketmgr.GetGMTicket(tguid); + if(!ticket || ticket->closed != 0) + { + SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + if(ticket && ticket->assignedToGM != 0 && ticket->assignedToGM != m_session->GetPlayer()->GetGUID()) + { + PSendSysMessage(LANG_COMMAND_TICKETCANNOTCLOSE, ticket->guid); + return true; + } + std::stringstream ss; ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, ticket->guid); ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str()); ss << PGetParseString(LANG_COMMAND_TICKETCLOSED, m_session->GetPlayer()->GetName()); - SendGlobalGMSysMessage(ss.str().c_str()); - ticketmgr.RemoveGMTicket(ticket->guid, m_session->GetPlayer()->GetGUID()); - Player *plr = objmgr.GetPlayer(ticket->playerGuid); + SendGlobalGMSysMessage(ss.str().c_str()); + ticketmgr.RemoveGMTicket(ticket->guid, m_session->GetPlayer()->GetGUID()); + Player *plr = objmgr.GetPlayer(ticket->playerGuid); - if(!plr || !plr->IsInWorld()) - return true; + if(!plr || !plr->IsInWorld()) + return true; - // send abandon ticket - WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4); - data << uint32(9); - plr->GetSession()->SendPacket( &data ); - return true; + // send abandon ticket + WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4); + data << uint32(9); + plr->GetSession()->SendPacket( &data ); + return true; } bool ChatHandler::HandleGMTicketAssignToCommand(const char* args) { - if(!*args) - return false; + if(!*args) + return false; - char* tguid = strtok((char*)args, " "); - uint64 ticketGuid = atoi(tguid); - char* targetgm = strtok( NULL, " "); + char* tguid = strtok((char*)args, " "); + uint64 ticketGuid = atoi(tguid); + char* targetgm = strtok( NULL, " "); - if(!targetgm) - return false; + if(!targetgm) + return false; - std::string targm = targetgm; + std::string targm = targetgm; - if(!normalizePlayerName(targm)) - return true; + if(!normalizePlayerName(targm)) + return true; - Player *cplr = m_session->GetPlayer(); - std::string gmname; - GM_Ticket *ticket = ticketmgr.GetGMTicket(ticketGuid); + Player *cplr = m_session->GetPlayer(); + std::string gmname; + GM_Ticket *ticket = ticketmgr.GetGMTicket(ticketGuid); - if(!ticket || ticket->closed != 0) - { - SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); - return true; - } - uint64 tarGUID = objmgr.GetPlayerGUIDByName(targm.c_str()); - uint64 accid = objmgr.GetPlayerAccountIdByGUID(tarGUID); - QueryResult *result = LoginDatabase.PQuery("SELECT `gmlevel` FROM `account` WHERE `id` = '%u'", accid); - if(!tarGUID|| !result || result->Fetch()->GetUInt32() < SEC_MODERATOR) - { - SendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_A); - return true; - } - if(ticket->assignedToGM == tarGUID) - { - PSendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_B, ticket->guid); - return true; - } - objmgr.GetPlayerNameByGUID(tarGUID, gmname); - if(ticket->assignedToGM != 0 && ticket->assignedToGM != cplr->GetGUID()) - { - PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->guid, gmname.c_str()); - return true; - } + if(!ticket || ticket->closed != 0) + { + SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + uint64 tarGUID = objmgr.GetPlayerGUIDByName(targm.c_str()); + uint64 accid = objmgr.GetPlayerAccountIdByGUID(tarGUID); + QueryResult *result = LoginDatabase.PQuery("SELECT `gmlevel` FROM `account` WHERE `id` = '%u'", accid); + if(!tarGUID|| !result || result->Fetch()->GetUInt32() < SEC_MODERATOR) + { + SendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_A); + return true; + } + if(ticket->assignedToGM == tarGUID) + { + PSendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_B, ticket->guid); + return true; + } + objmgr.GetPlayerNameByGUID(tarGUID, gmname); + if(ticket->assignedToGM != 0 && ticket->assignedToGM != cplr->GetGUID()) + { + PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->guid, gmname.c_str()); + return true; + } - ticket->assignedToGM = tarGUID; - ticketmgr.UpdateGMTicket(ticket); - std::stringstream ss; + ticket->assignedToGM = tarGUID; + ticketmgr.UpdateGMTicket(ticket); + std::stringstream ss; ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, ticket->guid); ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str()); ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str()); - SendGlobalGMSysMessage(ss.str().c_str()); - return true; + SendGlobalGMSysMessage(ss.str().c_str()); + return true; } bool ChatHandler::HandleGMTicketUnAssignCommand(const char* args) { - if(!*args) - return false; + if(!*args) + return false; - uint64 ticketGuid = atoi(args); - Player *cplr = m_session->GetPlayer(); - GM_Ticket *ticket = ticketmgr.GetGMTicket(ticketGuid); + uint64 ticketGuid = atoi(args); + Player *cplr = m_session->GetPlayer(); + GM_Ticket *ticket = ticketmgr.GetGMTicket(ticketGuid); - if(!ticket|| ticket->closed != 0) - { - SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); - return true; - } - if(ticket->assignedToGM == 0) - { - PSendSysMessage(LANG_COMMAND_TICKETNOTASSIGNED, ticket->guid); - return true; - } + if(!ticket|| ticket->closed != 0) + { + SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + if(ticket->assignedToGM == 0) + { + PSendSysMessage(LANG_COMMAND_TICKETNOTASSIGNED, ticket->guid); + return true; + } - std::string gmname; - objmgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname); - Player *plr = objmgr.GetPlayer(ticket->assignedToGM); - if(plr && plr->IsInWorld() && plr->GetSession()->GetSecurity() > cplr->GetSession()->GetSecurity()) - { - SendSysMessage(LANG_COMMAND_TICKETUNASSIGNSECURITY); - return true; - } + std::string gmname; + objmgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname); + Player *plr = objmgr.GetPlayer(ticket->assignedToGM); + if(plr && plr->IsInWorld() && plr->GetSession()->GetSecurity() > cplr->GetSession()->GetSecurity()) + { + SendSysMessage(LANG_COMMAND_TICKETUNASSIGNSECURITY); + return true; + } - std::stringstream ss; + std::stringstream ss; ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, ticket->guid); ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str()); ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str()); ss << PGetParseString(LANG_COMMAND_TICKETLISTUNASSIGNED, cplr->GetName()); - SendGlobalGMSysMessage(ss.str().c_str()); - ticket->assignedToGM = 0; - ticketmgr.UpdateGMTicket(ticket); - return true; + SendGlobalGMSysMessage(ss.str().c_str()); + ticket->assignedToGM = 0; + ticketmgr.UpdateGMTicket(ticket); + return true; } bool ChatHandler::HandleGMTicketCommentCommand(const char* args) { - if(!*args) - return false; + if(!*args) + return false; - char* tguid = strtok((char*)args, " "); - uint64 ticketGuid = atoi(tguid); - char* comment = strtok( NULL, "\n"); + char* tguid = strtok((char*)args, " "); + uint64 ticketGuid = atoi(tguid); + char* comment = strtok( NULL, "\n"); - if(!comment) - return false; + if(!comment) + return false; - Player *cplr = m_session->GetPlayer(); - GM_Ticket *ticket = ticketmgr.GetGMTicket(ticketGuid); + Player *cplr = m_session->GetPlayer(); + GM_Ticket *ticket = ticketmgr.GetGMTicket(ticketGuid); - if(!ticket || ticket->closed != 0) - { - PSendSysMessage(LANG_COMMAND_TICKETNOTEXIST); - return true; - } - if(ticket->assignedToGM != 0 && ticket->assignedToGM != cplr->GetGUID()) - { - PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->guid); - return true; - } + if(!ticket || ticket->closed != 0) + { + PSendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + if(ticket->assignedToGM != 0 && ticket->assignedToGM != cplr->GetGUID()) + { + PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->guid); + return true; + } - std::string gmname; - objmgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname); - ticket->comment = comment; - ticketmgr.UpdateGMTicket(ticket); - std::stringstream ss; + std::string gmname; + objmgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname); + ticket->comment = comment; + ticketmgr.UpdateGMTicket(ticket); + std::stringstream ss; ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, ticket->guid); ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str()); - if(objmgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname)) - { + if(objmgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname)) + { ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str()); } ss << PGetParseString(LANG_COMMAND_TICKETLISTADDCOMMENT, cplr->GetName(), ticket->comment.c_str()); - SendGlobalGMSysMessage(ss.str().c_str()); - return true; + SendGlobalGMSysMessage(ss.str().c_str()); + return true; } bool ChatHandler::HandleGMTicketDeleteByIdCommand(const char* args) { - if(!*args) - return false; - uint64 ticketGuid = atoi(args); - GM_Ticket *ticket = ticketmgr.GetGMTicket(ticketGuid); + if(!*args) + return false; + uint64 ticketGuid = atoi(args); + GM_Ticket *ticket = ticketmgr.GetGMTicket(ticketGuid); - if(!ticket) - { - SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); - return true; - } - if(ticket->closed == 0) - { - SendSysMessage(LANG_COMMAND_TICKETCLOSEFIRST); - return true; - } + if(!ticket) + { + SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + if(ticket->closed == 0) + { + SendSysMessage(LANG_COMMAND_TICKETCLOSEFIRST); + return true; + } - std::stringstream ss; + std::stringstream ss; ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, ticket->guid); ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str()); ss << PGetParseString(LANG_COMMAND_TICKETDELETED, m_session->GetPlayer()->GetName()); - SendGlobalGMSysMessage(ss.str().c_str()); - Player *plr = objmgr.GetPlayer(ticket->playerGuid); - ticketmgr.DeleteGMTicketPermanently(ticket->guid); - if(plr && plr->IsInWorld()) - { - // Force abandon ticket - WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4); - data << uint32(9); - plr->GetSession()->SendPacket( &data ); - } + SendGlobalGMSysMessage(ss.str().c_str()); + Player *plr = objmgr.GetPlayer(ticket->playerGuid); + ticketmgr.DeleteGMTicketPermanently(ticket->guid); + if(plr && plr->IsInWorld()) + { + // Force abandon ticket + WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4); + data << uint32(9); + plr->GetSession()->SendPacket( &data ); + } - ticket = NULL; - return true; + ticket = NULL; + return true; } bool ChatHandler::HandleGMTicketReloadCommand(const char*) { - ticketmgr.LoadGMTickets(); - return true; + ticketmgr.LoadGMTickets(); + return true; } //Enable\Dissable Invisible mode @@ -635,7 +635,7 @@ bool ChatHandler::HandleVisibleCommand(const char* args) { m_session->GetPlayer()->SetGMVisible(true); m_session->SendNotification(LANG_INVISIBLE_VISIBLE); - return true; + return true; } if (argstr == "off") @@ -2116,9 +2116,9 @@ bool ChatHandler::HandleLookupAreaCommand(const char* args) // send area in "id - [name]" format std::ostringstream ss; if (m_session) - ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << " " << localeNames[loc]<< "]|h|r"; - else - ss << areaEntry->ID << " - " << name << " " << localeNames[loc]; + ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << " " << localeNames[loc]<< "]|h|r"; + else + ss << areaEntry->ID << " - " << name << " " << localeNames[loc]; SendSysMessage (ss.str ().c_str()); @@ -2156,7 +2156,7 @@ bool ChatHandler::HandleLookupTeleCommand(const char * args) std::ostringstream reply; - GameTeleMap const & teleMap = objmgr.GetGameTeleMap(); + GameTeleMap const & teleMap = objmgr.GetGameTeleMap(); for(GameTeleMap::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr) { GameTele const* tele = &itr->second; @@ -2165,9 +2165,9 @@ bool ChatHandler::HandleLookupTeleCommand(const char * args) continue; if (m_session) - reply << " |cffffffff|Htele:" << itr->first << "|h[" << tele->name << "]|h|r\n"; - else - reply << " " << itr->first << " " << tele->name << "\n"; + reply << " |cffffffff|Htele:" << itr->first << "|h[" << tele->name << "]|h|r\n"; + else + reply << " " << itr->first << " " << tele->name << "\n"; } if(reply.str().empty()) diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index d155b0d274f..2b996cfd0fb 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -562,7 +562,7 @@ bool ChatHandler::HandleLookupFactionCommand(const char* args) return false; // Can be NULL at console call - Player *target = getSelectedPlayer (); + Player *target = getSelectedPlayer (); std::string namepart = args; std::wstring wnamepart; @@ -581,12 +581,12 @@ bool ChatHandler::HandleLookupFactionCommand(const char* args) if (factionEntry) { FactionState const* repState = NULL; - if(target) - { - FactionStateList::const_iterator repItr = target->m_factions.find (factionEntry->reputationListID); - if(repItr != target->m_factions.end()) - repState = &repItr->second; - } + if(target) + { + FactionStateList::const_iterator repItr = target->m_factions.find (factionEntry->reputationListID); + if(repItr != target->m_factions.end()) + repState = &repItr->second; + } int loc = m_session ? m_session->GetSessionDbcLocale() : sWorld.GetDefaultDbcLocale(); std::string name = factionEntry->name[loc]; @@ -616,9 +616,9 @@ bool ChatHandler::HandleLookupFactionCommand(const char* args) // or "id - [faction] [no reputation]" format std::ostringstream ss; if (m_session) - ss << id << " - |cffffffff|Hfaction:" << id << "|h[" << name << " " << localeNames[loc] << "]|h|r"; - else - ss << id << " - " << name << " " << localeNames[loc]; + ss << id << " - |cffffffff|Hfaction:" << id << "|h[" << name << " " << localeNames[loc] << "]|h|r"; + else + ss << id << " - " << name << " " << localeNames[loc]; if (repState) // and then target!=NULL also { @@ -1505,10 +1505,10 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(const char* args) if(pCreature) { // update movement type - if(doNotDelete == false) - pCreature->LoadPath(0); + if(doNotDelete == false) + pCreature->LoadPath(0); - pCreature->SetDefaultMovementType(move_type); + pCreature->SetDefaultMovementType(move_type); pCreature->GetMotionMaster()->Initialize(); if(pCreature->isAlive()) // dead creature will reset movement generator at respawn { @@ -1678,96 +1678,96 @@ bool ChatHandler::HandleNpcFactionIdCommand(const char* args) //kick player bool ChatHandler::HandleKickPlayerCommand(const char *args) { - const char* kickName = strtok((char*)args, " "); - char* kickReason = strtok(NULL, "\n"); - std::string reason = "No Reason"; - std::string kicker = "Console"; - if(kickReason) - reason = kickReason; - if(m_session) - kicker = m_session->GetPlayer()->GetName(); + const char* kickName = strtok((char*)args, " "); + char* kickReason = strtok(NULL, "\n"); + std::string reason = "No Reason"; + std::string kicker = "Console"; + if(kickReason) + reason = kickReason; + if(m_session) + kicker = m_session->GetPlayer()->GetName(); - if(!kickName) + if(!kickName) { - Player* player = getSelectedPlayer(); - if(!player) - { - SendSysMessage(LANG_NO_CHAR_SELECTED); - SetSentErrorMessage(true); - return false; - } + Player* player = getSelectedPlayer(); + if(!player) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } - if(player==m_session->GetPlayer()) + if(player==m_session->GetPlayer()) { SendSysMessage(LANG_COMMAND_KICKSELF); SetSentErrorMessage(true); return false; } - if(sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1) - { + if(sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1) + { - sWorld.SendWorldText(LANG_COMMAND_KICKMESSAGE, player->GetName(), kicker.c_str(), reason.c_str()); - } - else - { + sWorld.SendWorldText(LANG_COMMAND_KICKMESSAGE, player->GetName(), kicker.c_str(), reason.c_str()); + } + else + { - PSendSysMessage(LANG_COMMAND_KICKMESSAGE, player->GetName(), kicker.c_str(), reason.c_str()); - } + PSendSysMessage(LANG_COMMAND_KICKMESSAGE, player->GetName(), kicker.c_str(), reason.c_str()); + } player->GetSession()->KickPlayer(); } - else - { - std::string name = kickName; - if(!normalizePlayerName(name)) - { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); - return false; - } + else + { + std::string name = kickName; + if(!normalizePlayerName(name)) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } - if(m_session && name==m_session->GetPlayer()->GetName()) - { - SendSysMessage(LANG_COMMAND_KICKSELF); - SetSentErrorMessage(true); - return false; - } + if(m_session && name==m_session->GetPlayer()->GetName()) + { + SendSysMessage(LANG_COMMAND_KICKSELF); + SetSentErrorMessage(true); + return false; + } - Player* player = objmgr.GetPlayer(kickName); - if(!player) - { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); - return false; - } + Player* player = objmgr.GetPlayer(kickName); + if(!player) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } - if(m_session && player->GetSession()->GetSecurity() > m_session->GetSecurity()) - { - SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); //maybe replacement string for this later on - SetSentErrorMessage(true); - return false; - } + if(m_session && player->GetSession()->GetSecurity() > m_session->GetSecurity()) + { + SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); //maybe replacement string for this later on + SetSentErrorMessage(true); + return false; + } - if(sWorld.KickPlayer(name.c_str())) - { - if(sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1) - { + if(sWorld.KickPlayer(name.c_str())) + { + if(sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1) + { - sWorld.SendWorldText(LANG_COMMAND_KICKMESSAGE, name.c_str(), kicker.c_str(), reason.c_str()); - } - else - { - PSendSysMessage(LANG_COMMAND_KICKMESSAGE, name.c_str(), kicker.c_str(), reason.c_str()); - } - } - else - { - PSendSysMessage(LANG_COMMAND_KICKNOTFOUNDPLAYER, name.c_str()); - return false; - } - } - return true; + sWorld.SendWorldText(LANG_COMMAND_KICKMESSAGE, name.c_str(), kicker.c_str(), reason.c_str()); + } + else + { + PSendSysMessage(LANG_COMMAND_KICKMESSAGE, name.c_str(), kicker.c_str(), reason.c_str()); + } + } + else + { + PSendSysMessage(LANG_COMMAND_KICKNOTFOUNDPLAYER, name.c_str()); + return false; + } + } + return true; } //show info of player @@ -1876,7 +1876,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args) username = fields[0].GetCppString(); security = fields[1].GetUInt32(); - if(!m_session || m_session->GetSecurity() >= security) + if(!m_session || m_session->GetSecurity() >= security) { last_ip = fields[2].GetCppString(); last_login = fields[3].GetCppString(); @@ -2021,170 +2021,170 @@ bool ChatHandler::HandleWpAddCommand(const char* args) // optional char* path_number = NULL; - uint32 pathid = 0; + uint32 pathid = 0; if(*args) - path_number = strtok((char*)args, " "); + path_number = strtok((char*)args, " "); uint32 point = 0; Creature* target = getSelectedCreature(); - if (!path_number) - { - if(target) - pathid = target->GetWaypointPath(); - else - { - QueryResult *result = WorldDatabase.PQuery( "SELECT MAX(id) FROM waypoint_data"); - uint32 maxpathid = result->Fetch()->GetInt32(); - pathid = maxpathid+1; - sLog.outDebug("DEBUG: HandleWpAddCommand - New path started."); - PSendSysMessage("%s%s|r", "|cff00ff00", "New path started."); - } - } - else - pathid = atoi(path_number); + if (!path_number) + { + if(target) + pathid = target->GetWaypointPath(); + else + { + QueryResult *result = WorldDatabase.PQuery( "SELECT MAX(id) FROM waypoint_data"); + uint32 maxpathid = result->Fetch()->GetInt32(); + pathid = maxpathid+1; + sLog.outDebug("DEBUG: HandleWpAddCommand - New path started."); + PSendSysMessage("%s%s|r", "|cff00ff00", "New path started."); + } + } + else + pathid = atoi(path_number); - // path_id -> ID of the Path + // path_id -> ID of the Path // point -> number of the waypoint (if not 0) - if(!pathid) - { - sLog.outDebug("DEBUG: HandleWpAddCommand - Current creature haven't loaded path."); - PSendSysMessage("%s%s|r", "|cffff33ff", "Current creature haven't loaded path."); - return true; - } + if(!pathid) + { + sLog.outDebug("DEBUG: HandleWpAddCommand - Current creature haven't loaded path."); + PSendSysMessage("%s%s|r", "|cffff33ff", "Current creature haven't loaded path."); + return true; + } - sLog.outDebug("DEBUG: HandleWpAddCommand - point == 0"); + sLog.outDebug("DEBUG: HandleWpAddCommand - point == 0"); QueryResult *result = WorldDatabase.PQuery( "SELECT MAX(point) FROM waypoint_data WHERE id = '%u'",pathid); - if( result ) + if( result ) { point = (*result)[0].GetUInt32(); delete result; } - Player* player = m_session->GetPlayer(); - Map *map = player->GetMap(); + Player* player = m_session->GetPlayer(); + Map *map = player->GetMap(); - WorldDatabase.PExecuteLog("INSERT INTO waypoint_data (id, point, position_x, position_y, position_z) VALUES ('%u','%u','%f', '%f', '%f')", + WorldDatabase.PExecuteLog("INSERT INTO waypoint_data (id, point, position_x, position_y, position_z) VALUES ('%u','%u','%f', '%f', '%f')", pathid, point+1, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); - PSendSysMessage("%s%s%u%s%u%s|r", "|cff00ff00", "PathID: |r|cff00ffff", pathid, "|r|cff00ff00: Waypoint |r|cff00ffff", point,"|r|cff00ff00 created. "); + PSendSysMessage("%s%s%u%s%u%s|r", "|cff00ff00", "PathID: |r|cff00ffff", pathid, "|r|cff00ff00: Waypoint |r|cff00ffff", point,"|r|cff00ff00 created. "); return true; } // HandleWpAddCommand bool ChatHandler::HandleWpLoadPathCommand(const char *args) { - if(!*args) - return false; + if(!*args) + return false; - // optional + // optional char* path_number = NULL; - if(*args) - path_number = strtok((char*)args, " "); + if(*args) + path_number = strtok((char*)args, " "); - uint32 pathid = 0; + uint32 pathid = 0; uint32 guidlow = 0; Creature* target = getSelectedCreature(); - // Did player provide a path_id? + // Did player provide a path_id? if (!path_number) - sLog.outDebug("DEBUG: HandleWpLoadPathCommand - No path number provided"); + sLog.outDebug("DEBUG: HandleWpLoadPathCommand - No path number provided"); if(!target) - { - SendSysMessage(LANG_SELECT_CREATURE); + { + SendSysMessage(LANG_SELECT_CREATURE); SetSentErrorMessage(true); - return false; - } + return false; + } - if(target->GetEntry() == 1) - { - PSendSysMessage("%s%s|r", "|cffff33ff", "You want to load path to a waypoint? Aren't you?"); - SetSentErrorMessage(true); - return false; - } + if(target->GetEntry() == 1) + { + PSendSysMessage("%s%s|r", "|cffff33ff", "You want to load path to a waypoint? Aren't you?"); + SetSentErrorMessage(true); + return false; + } - pathid = atoi(path_number); + pathid = atoi(path_number); - if(!pathid) - { - PSendSysMessage("%s%s|r", "|cffff33ff", "No vallid path number provided."); - return true; - } + if(!pathid) + { + PSendSysMessage("%s%s|r", "|cffff33ff", "No vallid path number provided."); + return true; + } - guidlow = target->GetGUIDLow(); - QueryResult *result = WorldDatabase.PQuery( "SELECT guid FROM creature_addon WHERE guid = '%u'",guidlow); + guidlow = target->GetGUIDLow(); + QueryResult *result = WorldDatabase.PQuery( "SELECT guid FROM creature_addon WHERE guid = '%u'",guidlow); - if( result ) + if( result ) { WorldDatabase.PExecute("UPDATE creature_addon SET path_id = '%u' WHERE guid = '%u'", pathid, guidlow); - delete result; - } + delete result; + } else - WorldDatabase.PExecute("INSERT INTO creature_addon(guid,path_id) VALUES ('%u','%u')", guidlow, pathid); + WorldDatabase.PExecute("INSERT INTO creature_addon(guid,path_id) VALUES ('%u','%u')", guidlow, pathid); - WorldDatabase.PExecute("UPDATE creature SET MovementType = '%u' WHERE guid = '%u'", WAYPOINT_MOTION_TYPE, guidlow); + WorldDatabase.PExecute("UPDATE creature SET MovementType = '%u' WHERE guid = '%u'", WAYPOINT_MOTION_TYPE, guidlow); - target->LoadPath(pathid); - target->SetDefaultMovementType(WAYPOINT_MOTION_TYPE); + target->LoadPath(pathid); + target->SetDefaultMovementType(WAYPOINT_MOTION_TYPE); target->GetMotionMaster()->Initialize(); target->Say("Path loaded.",0,0); - return true; + return true; } bool ChatHandler::HandleReloadAllPaths(const char* args) { if(!*args) - return false; + return false; uint32 id = atoi(args); if(!id) - return false; + return false; - PSendSysMessage("%s%s|r|cff00ffff%u|r", "|cff00ff00", "Loading Path: ", id); - WaypointMgr.UpdatePath(id); - return true; + PSendSysMessage("%s%s|r|cff00ffff%u|r", "|cff00ff00", "Loading Path: ", id); + WaypointMgr.UpdatePath(id); + return true; } bool ChatHandler::HandleWpUnLoadPathCommand(const char *args) { - uint32 guidlow = 0; - Creature* target = getSelectedCreature(); + uint32 guidlow = 0; + Creature* target = getSelectedCreature(); - if(!target) - { - PSendSysMessage("%s%s|r", "|cff33ffff", "You must select target."); - return true; - } + if(!target) + { + PSendSysMessage("%s%s|r", "|cff33ffff", "You must select target."); + return true; + } - if(target->GetCreatureAddon()) - { - if(target->GetCreatureAddon()->path_id != 0) - { - WorldDatabase.PExecute("DELETE FROM creature_addon WHERE guid = %u", target->GetGUIDLow()); - target->UpdateWaypointID(0); - WorldDatabase.PExecute("UPDATE creature SET MovementType = '%u' WHERE guid = '%u'", IDLE_MOTION_TYPE, guidlow); - target->LoadPath(0); - target->SetDefaultMovementType(IDLE_MOTION_TYPE); - target->GetMotionMaster()->MoveTargetedHome(); - target->GetMotionMaster()->Initialize(); - target->Say("Path unloaded.",0,0); - return true; - } - PSendSysMessage("%s%s|r", "|cffff33ff", "Target have no loaded path."); - return true; - } - PSendSysMessage("%s%s|r", "|cffff33ff", "Target have no loaded path."); - return true; + if(target->GetCreatureAddon()) + { + if(target->GetCreatureAddon()->path_id != 0) + { + WorldDatabase.PExecute("DELETE FROM creature_addon WHERE guid = %u", target->GetGUIDLow()); + target->UpdateWaypointID(0); + WorldDatabase.PExecute("UPDATE creature SET MovementType = '%u' WHERE guid = '%u'", IDLE_MOTION_TYPE, guidlow); + target->LoadPath(0); + target->SetDefaultMovementType(IDLE_MOTION_TYPE); + target->GetMotionMaster()->MoveTargetedHome(); + target->GetMotionMaster()->Initialize(); + target->Say("Path unloaded.",0,0); + return true; + } + PSendSysMessage("%s%s|r", "|cffff33ff", "Target have no loaded path."); + return true; + } + PSendSysMessage("%s%s|r", "|cffff33ff", "Target have no loaded path."); + return true; } bool ChatHandler::HandleWpEventCommand(const char* args) @@ -2192,151 +2192,151 @@ bool ChatHandler::HandleWpEventCommand(const char* args) if(!*args) return false; - char* show_str = strtok((char*)args, " "); + char* show_str = strtok((char*)args, " "); - std::string show = show_str; + std::string show = show_str; - // Check + // Check if( (show != "add") && (show != "mod") && (show != "del") && (show != "listid")) return false; - if(show == "add") - { - uint32 id = 0; - char* arg_id = strtok(NULL, " "); + if(show == "add") + { + uint32 id = 0; + char* arg_id = strtok(NULL, " "); - if(arg_id) - uint32 id = atoi(arg_id); + if(arg_id) + uint32 id = atoi(arg_id); - if(id) - { - QueryResult *result = WorldDatabase.PQuery( "SELECT `id` FROM waypoint_scripts WHERE guid = %u", id); + if(id) + { + QueryResult *result = WorldDatabase.PQuery( "SELECT `id` FROM waypoint_scripts WHERE guid = %u", id); - if( !result ) - { + if( !result ) + { WorldDatabase.PExecute("INSERT INTO waypoint_scripts(guid)VALUES(%u)", id); - PSendSysMessage("%s%s%u|r", "|cff00ff00", "Wp Event: New waypoint event added: ", id); - } - else - { - PSendSysMessage("|cff00ff00Wp Event: You have choosed an existing waypoint script guid: %u|r", id); - delete result; - } - } - else - { - QueryResult *result = WorldDatabase.PQuery( "SELECT MAX(guid) FROM waypoint_scripts"); - id = result->Fetch()->GetUInt32(); - WorldDatabase.PExecute("INSERT INTO waypoint_scripts(guid)VALUES(%u)", id+1); - PSendSysMessage("%s%s%u|r", "|cff00ff00","Wp Event: New waypoint event added: |r|cff00ffff", id+1); - } + PSendSysMessage("%s%s%u|r", "|cff00ff00", "Wp Event: New waypoint event added: ", id); + } + else + { + PSendSysMessage("|cff00ff00Wp Event: You have choosed an existing waypoint script guid: %u|r", id); + delete result; + } + } + else + { + QueryResult *result = WorldDatabase.PQuery( "SELECT MAX(guid) FROM waypoint_scripts"); + id = result->Fetch()->GetUInt32(); + WorldDatabase.PExecute("INSERT INTO waypoint_scripts(guid)VALUES(%u)", id+1); + PSendSysMessage("%s%s%u|r", "|cff00ff00","Wp Event: New waypoint event added: |r|cff00ffff", id+1); + } - return true; - } + return true; + } - if(show == "listid") - { - uint32 id; - char* arg_id = strtok(NULL, " "); + if(show == "listid") + { + uint32 id; + char* arg_id = strtok(NULL, " "); - if(!arg_id) - { - PSendSysMessage("%s%s|r", "|cff33ffff","Wp Event: You must provide waypoint script id."); - return true; - } + if(!arg_id) + { + PSendSysMessage("%s%s|r", "|cff33ffff","Wp Event: You must provide waypoint script id."); + return true; + } - id = atoi(arg_id); + id = atoi(arg_id); - uint32 a2, a3, a4, a5, a6; - float a8, a9, a10, a11; - char const* a7; + uint32 a2, a3, a4, a5, a6; + float a8, a9, a10, a11; + char const* a7; - QueryResult *result = WorldDatabase.PQuery( "SELECT `guid`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o` FROM waypoint_scripts WHERE id = %u", id); + QueryResult *result = WorldDatabase.PQuery( "SELECT `guid`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o` FROM waypoint_scripts WHERE id = %u", id); - if( !result ) - { - PSendSysMessage("%s%s%u|r", "|cff33ffff", "Wp Event: No waypoint scripts found on id: ", id); - return true; - } + if( !result ) + { + PSendSysMessage("%s%s%u|r", "|cff33ffff", "Wp Event: No waypoint scripts found on id: ", id); + return true; + } - Field *fields; + Field *fields; - do - { - fields = result->Fetch(); - a2 = fields[0].GetUInt32(); - a3 = fields[1].GetUInt32(); - a4 = fields[2].GetUInt32(); - a5 = fields[3].GetUInt32(); - a6 = fields[4].GetUInt32(); - a7 = fields[5].GetString(); - a8 = fields[6].GetFloat(); - a9 = fields[7].GetFloat(); - a10 = fields[8].GetFloat(); - a11 = fields[9].GetFloat(); + do + { + fields = result->Fetch(); + a2 = fields[0].GetUInt32(); + a3 = fields[1].GetUInt32(); + a4 = fields[2].GetUInt32(); + a5 = fields[3].GetUInt32(); + a6 = fields[4].GetUInt32(); + a7 = fields[5].GetString(); + a8 = fields[6].GetFloat(); + a9 = fields[7].GetFloat(); + a10 = fields[8].GetFloat(); + a11 = fields[9].GetFloat(); - PSendSysMessage("|cffff33ffid:|r|cff00ffff %u|r|cff00ff00, guid: |r|cff00ffff%u|r|cff00ff00, delay: |r|cff00ffff%u|r|cff00ff00, command: |r|cff00ffff%u|r|cff00ff00, datalong: |r|cff00ffff%u|r|cff00ff00, datalong2: |r|cff00ffff%u|r|cff00ff00, datatext: |r|cff00ffff%s|r|cff00ff00, posx: |r|cff00ffff%f|r|cff00ff00, posy: |r|cff00ffff%f|r|cff00ff00, posz: |r|cff00ffff%f|r|cff00ff00, orientation: |r|cff00ffff%f|r", id, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); - }while(result->NextRow()); + PSendSysMessage("|cffff33ffid:|r|cff00ffff %u|r|cff00ff00, guid: |r|cff00ffff%u|r|cff00ff00, delay: |r|cff00ffff%u|r|cff00ff00, command: |r|cff00ffff%u|r|cff00ff00, datalong: |r|cff00ffff%u|r|cff00ff00, datalong2: |r|cff00ffff%u|r|cff00ff00, datatext: |r|cff00ffff%s|r|cff00ff00, posx: |r|cff00ffff%f|r|cff00ff00, posy: |r|cff00ffff%f|r|cff00ff00, posz: |r|cff00ffff%f|r|cff00ff00, orientation: |r|cff00ffff%f|r", id, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + }while(result->NextRow()); - delete result; - } + delete result; + } - if(show == "del") - { + if(show == "del") + { - char* arg_id = strtok(NULL, " "); - uint32 id = atoi(arg_id); + char* arg_id = strtok(NULL, " "); + uint32 id = atoi(arg_id); - QueryResult *result = WorldDatabase.PQuery( "SELECT `guid` FROM waypoint_scripts WHERE guid = %u", id); + QueryResult *result = WorldDatabase.PQuery( "SELECT `guid` FROM waypoint_scripts WHERE guid = %u", id); - if( result ) + if( result ) { WorldDatabase.PExecuteLog("DELETE FROM waypoint_scripts WHERE guid = %u", id); PSendSysMessage("%s%s%u|r","|cff00ff00","Wp Event: Waypoint script removed: ", id); - delete result; - } + delete result; + } else - PSendSysMessage("|cffff33ffWp Event: ERROR: you have selected a non existing script: %u|r", id); + PSendSysMessage("|cffff33ffWp Event: ERROR: you have selected a non existing script: %u|r", id); - return true; - } + return true; + } - if(show == "mod") - { - char* arg_1 = strtok(NULL," "); + if(show == "mod") + { + char* arg_1 = strtok(NULL," "); - if(!arg_1) - { - SendSysMessage("|cffff33ffERROR: Waypoint script guid not present.|r"); - return true; - } + if(!arg_1) + { + SendSysMessage("|cffff33ffERROR: Waypoint script guid not present.|r"); + return true; + } - uint32 id = atoi(arg_1); + uint32 id = atoi(arg_1); - if(!id) - { - SendSysMessage("|cffff33ffERROR: No vallid waypoint script id not present.|r"); - return true; - } + if(!id) + { + SendSysMessage("|cffff33ffERROR: No vallid waypoint script id not present.|r"); + return true; + } - char* arg_2 = strtok(NULL," "); + char* arg_2 = strtok(NULL," "); - if(!arg_2) - { SendSysMessage("|cffff33ffERROR: No argument present.|r"); - return true;} + if(!arg_2) + { SendSysMessage("|cffff33ffERROR: No argument present.|r"); + return true;} - std::string arg_string = arg_2; + std::string arg_string = arg_2; if( (arg_string != "setid") && (arg_string != "delay") && (arg_string != "command") && (arg_string != "datalong") && (arg_string != "datalong2") && (arg_string != "dataint") && (arg_string != "posx") && (arg_string != "posy") && (arg_string != "posz") && (arg_string != "orientation") -) { SendSysMessage("|cffff33ffERROR: No valid argument present.|r"); - return true;} +) { SendSysMessage("|cffff33ffERROR: No valid argument present.|r"); + return true;} char* arg_3; @@ -2345,73 +2345,73 @@ arg_3 = strtok(NULL," "); if(!arg_3) {SendSysMessage("|cffff33ffERROR: No additional argument present.|r"); - return true;} + return true;} float coord; - if(arg_str_2 == "setid") - { - uint32 newid = atoi(arg_3); - PSendSysMessage("%s%s|r|cff00ffff%u|r|cff00ff00%s|r|cff00ffff%u|r","|cff00ff00","Wp Event: Wypoint scipt guid: ", newid," id changed: ", id); - WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET id='%u' WHERE guid='%u'", + if(arg_str_2 == "setid") + { + uint32 newid = atoi(arg_3); + PSendSysMessage("%s%s|r|cff00ffff%u|r|cff00ff00%s|r|cff00ffff%u|r","|cff00ff00","Wp Event: Wypoint scipt guid: ", newid," id changed: ", id); + WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET id='%u' WHERE guid='%u'", newid, id); return true; - } - else - { + } + else + { - QueryResult *result = WorldDatabase.PQuery("SELECT id FROM waypoint_scripts WHERE guid='%u'",id); + QueryResult *result = WorldDatabase.PQuery("SELECT id FROM waypoint_scripts WHERE guid='%u'",id); - if(!result) - { - SendSysMessage("|cffff33ffERROR: You have selected an non existing waypoint script guid.|r"); - return true; - } + if(!result) + { + SendSysMessage("|cffff33ffERROR: You have selected an non existing waypoint script guid.|r"); + return true; + } - delete result; + delete result; if(arg_str_2 == "posx") { - coord = atof(arg_3); - WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET x='%f' WHERE guid='%u'", + coord = atof(arg_3); + WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET x='%f' WHERE guid='%u'", coord, id); - PSendSysMessage("|cff00ff00Waypoint script:|r|cff00ffff %u|r|cff00ff00 position_x updated.|r", id); - return true; + PSendSysMessage("|cff00ff00Waypoint script:|r|cff00ffff %u|r|cff00ff00 position_x updated.|r", id); + return true; }else if(arg_str_2 == "posy") { - coord = atof(arg_3); - WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET y='%f' WHERE guid='%u'", + coord = atof(arg_3); + WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET y='%f' WHERE guid='%u'", coord, id); - PSendSysMessage("|cff00ff00Waypoint script: %u position_y updated.|r", id); - return true; + PSendSysMessage("|cff00ff00Waypoint script: %u position_y updated.|r", id); + return true; } else if(arg_str_2 == "posz") { - coord = atof(arg_3); - WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET z='%f' WHERE guid='%u'", - coord, id); - PSendSysMessage("|cff00ff00Waypoint script: |r|cff00ffff%u|r|cff00ff00 position_z updated.|r", id); - return true; + coord = atof(arg_3); + WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET z='%f' WHERE guid='%u'", + coord, id); + PSendSysMessage("|cff00ff00Waypoint script: |r|cff00ffff%u|r|cff00ff00 position_z updated.|r", id); + return true; } else if(arg_str_2 == "orientation") { - coord = atof(arg_3); - WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET o='%f' WHERE guid='%u'", + coord = atof(arg_3); + WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET o='%f' WHERE guid='%u'", coord, id); - PSendSysMessage("|cff00ff00Waypoint script: |r|cff00ffff%u|r|cff00ff00 orientation updated.|r", id); - return true; + PSendSysMessage("|cff00ff00Waypoint script: |r|cff00ffff%u|r|cff00ff00 orientation updated.|r", id); + return true; } else if(arg_str_2 == "dataint") { - WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET %s='%u' WHERE guid='%u'", + WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET %s='%u' WHERE guid='%u'", arg_2, atoi(arg_3), id); - PSendSysMessage("|cff00ff00Waypoint script: |r|cff00ffff%u|r|cff00ff00 dataint updated.|r", id); - return true; + PSendSysMessage("|cff00ff00Waypoint script: |r|cff00ffff%u|r|cff00ff00 dataint updated.|r", id); + return true; }else { - std::string arg_str_3 = arg_3; + std::string arg_str_3 = arg_3; WorldDatabase.escape_string(arg_str_3); WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET %s='%s' WHERE guid='%u'", arg_2, arg_str_3.c_str(), id); } } - PSendSysMessage("%s%s|r|cff00ffff%u:|r|cff00ff00 %s %s|r","|cff00ff00","Waypoint script:", id, arg_2,"updated."); + PSendSysMessage("%s%s|r|cff00ffff%u:|r|cff00ff00 %s %s|r","|cff00ff00","Waypoint script:", id, arg_2,"updated."); } return true; } @@ -2452,87 +2452,87 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) Creature* target = getSelectedCreature(); if(!target || target->GetEntry() != VISUAL_WAYPOINT) - { - SendSysMessage("|cffff33ffERROR: You must select a waypoint.|r"); - return false; - } + { + SendSysMessage("|cffff33ffERROR: You must select a waypoint.|r"); + return false; + } - sLog.outDebug("DEBUG: HandleWpModifyCommand - User did select an NPC"); - // The visual waypoint + sLog.outDebug("DEBUG: HandleWpModifyCommand - User did select an NPC"); + // The visual waypoint Creature* wpCreature = NULL; - wpGuid = target->GetGUIDLow(); + wpGuid = target->GetGUIDLow(); // Did the user select a visual spawnpoint? - if(wpGuid) - wpCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(),MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)); - // attempt check creature existence by DB data + if(wpGuid) + wpCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(),MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)); + // attempt check creature existence by DB data else { - PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, wpGuid); - return false; + PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, wpGuid); + return false; } - // User did select a visual waypoint? - // Check the creature - if (wpCreature->GetEntry() == VISUAL_WAYPOINT ) - { - QueryResult *result = - WorldDatabase.PQuery( "SELECT id, point FROM waypoint_data WHERE wpguid = %u", wpGuid); + // User did select a visual waypoint? + // Check the creature + if (wpCreature->GetEntry() == VISUAL_WAYPOINT ) + { + QueryResult *result = + WorldDatabase.PQuery( "SELECT id, point FROM waypoint_data WHERE wpguid = %u", wpGuid); - if(!result) - { - sLog.outDebug("DEBUG: HandleWpModifyCommand - No waypoint found - used 'wpguid'"); + if(!result) + { + sLog.outDebug("DEBUG: HandleWpModifyCommand - No waypoint found - used 'wpguid'"); - PSendSysMessage(LANG_WAYPOINT_NOTFOUNDSEARCH, target->GetGUIDLow()); - // Select waypoint number from database - // Since we compare float values, we have to deal with - // some difficulties. - // Here we search for all waypoints that only differ in one from 1 thousand - // (0.001) - There is no other way to compare C++ floats with mySQL floats - // See also: http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html - const char* maxDIFF = "0.01"; - result = WorldDatabase.PQuery( "SELECT id, point FROM waypoint_data WHERE (abs(position_x - %f) <= %s ) and (abs(position_y - %f) <= %s ) and (abs(position_z - %f) <= %s )", - wpCreature->GetPositionX(), maxDIFF, wpCreature->GetPositionY(), maxDIFF, wpCreature->GetPositionZ(), maxDIFF); - if(!result) - { + PSendSysMessage(LANG_WAYPOINT_NOTFOUNDSEARCH, target->GetGUIDLow()); + // Select waypoint number from database + // Since we compare float values, we have to deal with + // some difficulties. + // Here we search for all waypoints that only differ in one from 1 thousand + // (0.001) - There is no other way to compare C++ floats with mySQL floats + // See also: http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html + const char* maxDIFF = "0.01"; + result = WorldDatabase.PQuery( "SELECT id, point FROM waypoint_data WHERE (abs(position_x - %f) <= %s ) and (abs(position_y - %f) <= %s ) and (abs(position_z - %f) <= %s )", + wpCreature->GetPositionX(), maxDIFF, wpCreature->GetPositionY(), maxDIFF, wpCreature->GetPositionZ(), maxDIFF); + if(!result) + { PSendSysMessage(LANG_WAYPOINT_NOTFOUNDDBPROBLEM, wpGuid); return true; - } - } - sLog.outDebug("DEBUG: HandleWpModifyCommand - After getting wpGuid"); + } + } + sLog.outDebug("DEBUG: HandleWpModifyCommand - After getting wpGuid"); - do - { - Field *fields = result->Fetch(); - pathid = fields[0].GetUInt32(); - point = fields[1].GetUInt32(); - } - while( result->NextRow() ); + do + { + Field *fields = result->Fetch(); + pathid = fields[0].GetUInt32(); + point = fields[1].GetUInt32(); + } + while( result->NextRow() ); // Cleanup memory sLog.outDebug("DEBUG: HandleWpModifyCommand - Cleanup memory"); delete result; // We have the waypoint number and the GUID of the "master npc" - // Text is enclosed in "<>", all other arguments not + // Text is enclosed in "<>", all other arguments not arg_str = strtok((char*)NULL, " "); } - sLog.outDebug("DEBUG: HandleWpModifyCommand - Parameters parsed - now execute the command"); + sLog.outDebug("DEBUG: HandleWpModifyCommand - Parameters parsed - now execute the command"); // Check for argument if(show != "del" && show != "move" && arg_str == NULL) { PSendSysMessage(LANG_WAYPOINT_ARGUMENTREQ, show_str); - return false; + return false; } if(show == "del" && target) { PSendSysMessage("|cff00ff00DEBUG: wp modify del, PathID: |r|cff00ffff%u|r", pathid); - // wpCreature - Creature* wpCreature = NULL; + // wpCreature + Creature* wpCreature = NULL; - if( wpGuid != 0 ) + if( wpGuid != 0 ) { wpCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(),MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)); wpCreature->CombatStop(); @@ -2540,7 +2540,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) wpCreature->AddObjectToRemoveList(); } - WorldDatabase.PExecuteLog("DELETE FROM waypoint_data WHERE id='%u' AND point='%u'", + WorldDatabase.PExecuteLog("DELETE FROM waypoint_data WHERE id='%u' AND point='%u'", pathid, point); WorldDatabase.PExecuteLog("UPDATE waypoint_data SET point=point-1 WHERE id='%u' AND point>'%u'", pathid, point); @@ -2556,8 +2556,8 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) Player *chr = m_session->GetPlayer(); Map *map = chr->GetMap(); { - // wpCreature - Creature* wpCreature = NULL; + // wpCreature + Creature* wpCreature = NULL; // What to do: // Move the visual spawnpoint // Respawn the owner of the waypoints @@ -2617,7 +2617,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) show_str, text2.c_str(), pathid, point); } - PSendSysMessage(LANG_WAYPOINT_CHANGED_NO, show_str); + PSendSysMessage(LANG_WAYPOINT_CHANGED_NO, show_str); return true; } @@ -2641,7 +2641,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args) sLog.outDebug("DEBUG: HandleWpShowCommand: show_str: %s guid_str: %s", show_str, guid_str); uint32 pathid = 0; - Creature* target = getSelectedCreature(); + Creature* target = getSelectedCreature(); // Did player provide a PathID? @@ -2658,8 +2658,8 @@ bool ChatHandler::HandleWpShowCommand(const char* args) return false; } - pathid = target->GetWaypointPath(); - } + pathid = target->GetWaypointPath(); + } else { @@ -2673,26 +2673,26 @@ bool ChatHandler::HandleWpShowCommand(const char* args) } pathid = atoi((char*)guid_str); - } + } - sLog.outDebug("DEBUG: HandleWpShowCommand: danach"); + sLog.outDebug("DEBUG: HandleWpShowCommand: danach"); std::string show = show_str; uint32 Maxpoint; - sLog.outDebug("DEBUG: HandleWpShowCommand: PathID: %u", pathid); + sLog.outDebug("DEBUG: HandleWpShowCommand: PathID: %u", pathid); - //PSendSysMessage("wpshow - show: %s", show); + //PSendSysMessage("wpshow - show: %s", show); // Show info for the selected waypoint if(show == "info") - { + { - // Check if the user did specify a visual waypoint + // Check if the user did specify a visual waypoint if( target->GetEntry() != VISUAL_WAYPOINT ) { @@ -2702,56 +2702,56 @@ bool ChatHandler::HandleWpShowCommand(const char* args) } - QueryResult *result = WorldDatabase.PQuery( "SELECT id, point, delay, move_flag, action, action_chance FROM waypoint_data WHERE wpguid = %u", target->GetGUIDLow()); + QueryResult *result = WorldDatabase.PQuery( "SELECT id, point, delay, move_flag, action, action_chance FROM waypoint_data WHERE wpguid = %u", target->GetGUIDLow()); - if(!result) + if(!result) { - SendSysMessage(LANG_WAYPOINT_NOTFOUNDDBPROBLEM); + SendSysMessage(LANG_WAYPOINT_NOTFOUNDDBPROBLEM); return true; - } + } - SendSysMessage("|cff00ffffDEBUG: wp show info:|r"); + SendSysMessage("|cff00ffffDEBUG: wp show info:|r"); - do + do { Field *fields = result->Fetch(); - pathid = fields[0].GetUInt32(); - uint32 point = fields[1].GetUInt32(); - uint32 delay = fields[2].GetUInt32(); - uint32 flag = fields[3].GetUInt32(); - uint32 ev_id = fields[4].GetUInt32(); - uint32 ev_chance = fields[5].GetUInt32(); + pathid = fields[0].GetUInt32(); + uint32 point = fields[1].GetUInt32(); + uint32 delay = fields[2].GetUInt32(); + uint32 flag = fields[3].GetUInt32(); + uint32 ev_id = fields[4].GetUInt32(); + uint32 ev_chance = fields[5].GetUInt32(); - PSendSysMessage("|cff00ff00Show info: for current point: |r|cff00ffff%u|r|cff00ff00, Path ID: |r|cff00ffff%u|r", point, pathid); - PSendSysMessage("|cff00ff00Show info: delay: |r|cff00ffff%u|r", delay); - PSendSysMessage("|cff00ff00Show info: Move flag: |r|cff00ffff%u|r", flag); - PSendSysMessage("|cff00ff00Show info: Waypoint event: |r|cff00ffff%u|r", ev_id); - PSendSysMessage("|cff00ff00Show info: Event chance: |r|cff00ffff%u|r", ev_chance); + PSendSysMessage("|cff00ff00Show info: for current point: |r|cff00ffff%u|r|cff00ff00, Path ID: |r|cff00ffff%u|r", point, pathid); + PSendSysMessage("|cff00ff00Show info: delay: |r|cff00ffff%u|r", delay); + PSendSysMessage("|cff00ff00Show info: Move flag: |r|cff00ffff%u|r", flag); + PSendSysMessage("|cff00ff00Show info: Waypoint event: |r|cff00ffff%u|r", ev_id); + PSendSysMessage("|cff00ff00Show info: Event chance: |r|cff00ffff%u|r", ev_chance); }while( result->NextRow() ); - // Cleanup memory + // Cleanup memory delete result; return true; } if(show == "on") - { + { QueryResult *result = WorldDatabase.PQuery( "SELECT point, position_x,position_y,position_z FROM waypoint_data WHERE id = '%u'", pathid); - if(!result) + if(!result) { - SendSysMessage("|cffff33ffPath no found.|r"); + SendSysMessage("|cffff33ffPath no found.|r"); SetSentErrorMessage(true); return false; } - PSendSysMessage("|cff00ff00DEBUG: wp on, PathID: |cff00ffff%u|r", pathid); + PSendSysMessage("|cff00ff00DEBUG: wp on, PathID: |cff00ffff%u|r", pathid); - // Delete all visuals for this NPC + // Delete all visuals for this NPC QueryResult *result2 = WorldDatabase.PQuery( "SELECT wpguid FROM waypoint_data WHERE id = '%u' and wpguid <> 0", pathid); - if(result2) + if(result2) { bool hasError = false; do @@ -2775,9 +2775,9 @@ bool ChatHandler::HandleWpShowCommand(const char* args) }while( result2->NextRow() ); - delete result2; + delete result2; - if( hasError ) + if( hasError ) { PSendSysMessage(LANG_WAYPOINT_TOOFAR1); PSendSysMessage(LANG_WAYPOINT_TOOFAR2); @@ -2808,9 +2808,9 @@ bool ChatHandler::HandleWpShowCommand(const char* args) return false; } - wpCreature->Relocate(x, y, z, o); + wpCreature->Relocate(x, y, z, o); - if(!wpCreature->IsPositionValid()) + if(!wpCreature->IsPositionValid()) { sLog.outError("ERROR: Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)",wpCreature->GetGUIDLow(),wpCreature->GetEntry(),wpCreature->GetPositionX(),wpCreature->GetPositionY()); delete wpCreature; @@ -2818,7 +2818,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args) return false; } - sLog.outDebug("DEBUG: UPDATE waypoint_data SET wpguid = '%u"); + sLog.outDebug("DEBUG: UPDATE waypoint_data SET wpguid = '%u"); // set "wpguid" column to the visual waypoint WorldDatabase.PExecuteLog("UPDATE waypoint_data SET wpguid = '%u' WHERE id = '%u' and point = '%u'", wpCreature->GetGUIDLow(), pathid, point); @@ -2826,16 +2826,16 @@ bool ChatHandler::HandleWpShowCommand(const char* args) wpCreature->LoadFromDB(wpCreature->GetDBTableGUIDLow(),map); map->Add(wpCreature); - if(target) - { - wpCreature->SetDisplayId(target->GetDisplayId()); - wpCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5); - } - } - while( result->NextRow() ); + if(target) + { + wpCreature->SetDisplayId(target->GetDisplayId()); + wpCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5); + } + } + while( result->NextRow() ); SendSysMessage("|cff00ff00Showing the current creature's path.|r"); - // Cleanup memory + // Cleanup memory delete result; return true; } @@ -2881,17 +2881,17 @@ bool ChatHandler::HandleWpShowCommand(const char* args) return false; } - pCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode())); + pCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode())); pCreature->LoadFromDB(pCreature->GetDBTableGUIDLow(), map); map->Add(pCreature); - if(target) - { - pCreature->SetDisplayId(target->GetDisplayId()); - pCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5); - } + if(target) + { + pCreature->SetDisplayId(target->GetDisplayId()); + pCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5); + } - // Cleanup memory + // Cleanup memory delete result; return true; } @@ -2946,17 +2946,17 @@ bool ChatHandler::HandleWpShowCommand(const char* args) return false; } - pCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode())); + pCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode())); pCreature->LoadFromDB(pCreature->GetDBTableGUIDLow(), map); map->Add(pCreature); - if(target) - { - pCreature->SetDisplayId(target->GetDisplayId()); - pCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5); - } + if(target) + { + pCreature->SetDisplayId(target->GetDisplayId()); + pCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5); + } - // Cleanup memory + // Cleanup memory delete result; return true; } @@ -3242,10 +3242,10 @@ bool ChatHandler::HandleLookupEventCommand(const char* args) { char const* active = activeEvents.find(id) != activeEvents.end() ? GetTrinityString(LANG_ACTIVE) : ""; - if(m_session) - PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT,id,id,eventData.description.c_str(),active ); - else - PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE,id,eventData.description.c_str(),active ); + if(m_session) + PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT,id,id,eventData.description.c_str(),active ); + else + PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE,id,eventData.description.c_str(),active ); ++counter; } @@ -3272,9 +3272,9 @@ bool ChatHandler::HandleEventActiveListCommand(const char* args) GameEventData const& eventData = events[event_id]; if(m_session) - PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT,event_id,event_id,eventData.description.c_str(),active ); - else - PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE,event_id,eventData.description.c_str(),active ); + PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT,event_id,event_id,eventData.description.c_str(),active ); + else + PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE,event_id,eventData.description.c_str(),active ); ++counter; } @@ -3580,8 +3580,8 @@ bool ChatHandler::HandleLookupPlayerIpCommand(const char* args) return false; std::string ip = strtok ((char*)args, " "); - char* limit_str = strtok (NULL, " "); - int32 limit = limit_str ? atoi (limit_str) : -1; + char* limit_str = strtok (NULL, " "); + int32 limit = limit_str ? atoi (limit_str) : -1; LoginDatabase.escape_string (ip); @@ -3596,8 +3596,8 @@ bool ChatHandler::HandleLookupPlayerAccountCommand(const char* args) return false; std::string account = strtok ((char*)args, " "); - char* limit_str = strtok (NULL, " "); - int32 limit = limit_str ? atoi (limit_str) : -1; + char* limit_str = strtok (NULL, " "); + int32 limit = limit_str ? atoi (limit_str) : -1; if (!AccountMgr::normilizeString (account)) return false; @@ -3616,8 +3616,8 @@ bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args) return false; std::string email = strtok ((char*)args, " "); - char* limit_str = strtok (NULL, " "); - int32 limit = limit_str ? atoi (limit_str) : -1; + char* limit_str = strtok (NULL, " "); + int32 limit = limit_str ? atoi (limit_str) : -1; LoginDatabase.escape_string (email); @@ -3673,8 +3673,8 @@ bool ChatHandler::LookupPlayerSearchCommand(QueryResult* result, int32 limit) /// Triggering corpses expire check in world bool ChatHandler::HandleServerCorpsesCommand(const char* /*args*/) { - CorpsesErase(); - return true; + CorpsesErase(); + return true; } bool ChatHandler::HandleRepairitemsCommand(const char* /*args*/) @@ -3686,7 +3686,7 @@ bool ChatHandler::HandleRepairitemsCommand(const char* /*args*/) PSendSysMessage(LANG_NO_CHAR_SELECTED); SetSentErrorMessage(true); return false; - } + } // Repair items target->DurabilityRepairAll(false, 0, false); @@ -3755,175 +3755,175 @@ bool ChatHandler::HandleNpcUnFollowCommand(const char* /*args*/) bool ChatHandler::HandleCreatePetCommand(const char* args) { - Player *player = m_session->GetPlayer(); - Creature *creatureTarget = getSelectedCreature(); + Player *player = m_session->GetPlayer(); + Creature *creatureTarget = getSelectedCreature(); - if(!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER) - { - PSendSysMessage(LANG_SELECT_CREATURE); - SetSentErrorMessage(true); - return false; - } + if(!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER) + { + PSendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } - CreatureInfo const* cInfo = objmgr.GetCreatureTemplate(creatureTarget->GetEntry()); - // Creatures with family 0 crashes the server - if(cInfo->family == 0) - { - PSendSysMessage("This creature cannot be tamed. (family id: 0)."); - SetSentErrorMessage(true); - return false; - } + CreatureInfo const* cInfo = objmgr.GetCreatureTemplate(creatureTarget->GetEntry()); + // Creatures with family 0 crashes the server + if(cInfo->family == 0) + { + PSendSysMessage("This creature cannot be tamed. (family id: 0)."); + SetSentErrorMessage(true); + return false; + } - if(player->GetPetGUID()) - { - PSendSysMessage("You already have a pet"); - SetSentErrorMessage(true); - return false; - } + if(player->GetPetGUID()) + { + PSendSysMessage("You already have a pet"); + SetSentErrorMessage(true); + return false; + } - // Everything looks OK, create new pet - Pet* pet = new Pet(HUNTER_PET); + // Everything looks OK, create new pet + Pet* pet = new Pet(HUNTER_PET); - if(!pet->CreateBaseAtCreature(creatureTarget)) - { - delete pet; - PSendSysMessage("Error 1"); - return false; - } + if(!pet->CreateBaseAtCreature(creatureTarget)) + { + delete pet; + PSendSysMessage("Error 1"); + return false; + } - creatureTarget->setDeathState(JUST_DIED); - creatureTarget->RemoveCorpse(); - creatureTarget->SetHealth(0); // just for nice GM-mode view + creatureTarget->setDeathState(JUST_DIED); + creatureTarget->RemoveCorpse(); + creatureTarget->SetHealth(0); // just for nice GM-mode view - pet->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, player->GetGUID()); - pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID()); - pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction()); + pet->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, player->GetGUID()); + pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID()); + pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction()); - if(!pet->InitStatsForLevel(creatureTarget->getLevel())) - { - sLog.outError("ERROR: InitStatsForLevel() in EffectTameCreature failed! Pet deleted."); - PSendSysMessage("Error 2"); - return false; - } + if(!pet->InitStatsForLevel(creatureTarget->getLevel())) + { + sLog.outError("ERROR: InitStatsForLevel() in EffectTameCreature failed! Pet deleted."); + PSendSysMessage("Error 2"); + return false; + } - // prepare visual effect for levelup - pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel()-1); + // prepare visual effect for levelup + pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel()-1); - pet->GetCharmInfo()->SetPetNumber(objmgr.GeneratePetNumber(), true); - // this enables pet details window (Shift+P) - pet->AIM_Initialize(); - pet->InitPetCreateSpells(); - pet->SetHealth(pet->GetMaxHealth()); + pet->GetCharmInfo()->SetPetNumber(objmgr.GeneratePetNumber(), true); + // this enables pet details window (Shift+P) + pet->AIM_Initialize(); + pet->InitPetCreateSpells(); + pet->SetHealth(pet->GetMaxHealth()); - MapManager::Instance().GetMap(pet->GetMapId(), pet)->Add((Creature*)pet); + MapManager::Instance().GetMap(pet->GetMapId(), pet)->Add((Creature*)pet); - // visual effect for levelup - pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel()); + // visual effect for levelup + pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel()); - player->SetPet(pet); - pet->SavePetToDB(PET_SAVE_AS_CURRENT); - player->PetSpellInitialize(); + player->SetPet(pet); + pet->SavePetToDB(PET_SAVE_AS_CURRENT); + player->PetSpellInitialize(); - return true; + return true; } bool ChatHandler::HandlePetLearnCommand(const char* args) { - if(!*args) - return false; - - Player *plr = m_session->GetPlayer(); - Pet *pet = plr->GetPet(); - - if(!pet) - { - PSendSysMessage("You have no pet"); - SetSentErrorMessage(true); - return false; - } - - uint32 spellId = extractSpellIdFromLink((char*)args); - - if(!spellId || !sSpellStore.LookupEntry(spellId)) + if(!*args) return false; - // Check if pet already has it - if(pet->HasSpell(spellId)) - { - PSendSysMessage("Pet already has spell: %u", spellId); - SetSentErrorMessage(true); - return false; - } + Player *plr = m_session->GetPlayer(); + Pet *pet = plr->GetPet(); - // Check if spell is valid - SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId); - if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo)) + if(!pet) + { + PSendSysMessage("You have no pet"); + SetSentErrorMessage(true); + return false; + } + + uint32 spellId = extractSpellIdFromLink((char*)args); + + if(!spellId || !sSpellStore.LookupEntry(spellId)) + return false; + + // Check if pet already has it + if(pet->HasSpell(spellId)) + { + PSendSysMessage("Pet already has spell: %u", spellId); + SetSentErrorMessage(true); + return false; + } + + // Check if spell is valid + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId); + if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo)) { PSendSysMessage(LANG_COMMAND_SPELL_BROKEN,spellId); SetSentErrorMessage(true); return false; } - pet->learnSpell(spellId); + pet->learnSpell(spellId); - PSendSysMessage("Pet has learned spell %u", spellId); - return true; + PSendSysMessage("Pet has learned spell %u", spellId); + return true; } bool ChatHandler::HandlePetUnlearnCommand(const char *args) { - if(!*args) - return false; + if(!*args) + return false; - Player *plr = m_session->GetPlayer(); - Pet *pet = plr->GetPet(); + Player *plr = m_session->GetPlayer(); + Pet *pet = plr->GetPet(); - if(!pet) - { - PSendSysMessage("You have no pet"); - SetSentErrorMessage(true); - return false; - } + if(!pet) + { + PSendSysMessage("You have no pet"); + SetSentErrorMessage(true); + return false; + } - uint32 spellId = extractSpellIdFromLink((char*)args); + uint32 spellId = extractSpellIdFromLink((char*)args); - if(pet->HasSpell(spellId)) - pet->removeSpell(spellId); - else - PSendSysMessage("Pet doesn't have that spell"); + if(pet->HasSpell(spellId)) + pet->removeSpell(spellId); + else + PSendSysMessage("Pet doesn't have that spell"); - return true; + return true; } bool ChatHandler::HandlePetTpCommand(const char *args) { - if(!*args) - return false; + if(!*args) + return false; - Player *plr = m_session->GetPlayer(); - Pet *pet = plr->GetPet(); + Player *plr = m_session->GetPlayer(); + Pet *pet = plr->GetPet(); - if(!pet) - { - PSendSysMessage("You have no pet"); - SetSentErrorMessage(true); - return false; - } + if(!pet) + { + PSendSysMessage("You have no pet"); + SetSentErrorMessage(true); + return false; + } - uint32 tp = atol(args); + uint32 tp = atol(args); - pet->SetTP(tp); + pet->SetTP(tp); - PSendSysMessage("Pet's tp changed to %u", tp); - return true; + PSendSysMessage("Pet's tp changed to %u", tp); + return true; } bool ChatHandler::HandleActivateObjectCommand(const char *args) { - if(!*args) - return false; + if(!*args) + return false; - char* cId = extractKeyFromLink((char*)args,"Hgameobject"); + char* cId = extractKeyFromLink((char*)args,"Hgameobject"); if(!cId) return false; @@ -3944,13 +3944,13 @@ bool ChatHandler::HandleActivateObjectCommand(const char *args) return false; } - // Activate - obj->SetLootState(GO_READY); - obj->UseDoorOrButton(10000); + // Activate + obj->SetLootState(GO_READY); + obj->UseDoorOrButton(10000); - PSendSysMessage("Object activated!"); + PSendSysMessage("Object activated!"); - return true; + return true; } // add creature, temp only @@ -4036,12 +4036,12 @@ bool ChatHandler::HandleNpcAddFormationCommand(const char* args) Player *chr = m_session->GetPlayer(); FormationMember *group_member; - group_member = new FormationMember; - group_member->follow_angle = pCreature->GetAngle(chr) - chr->GetOrientation(); - group_member->follow_dist = sqrtf(pow(chr->GetPositionX() - pCreature->GetPositionX(),int(2))+pow(chr->GetPositionY()-pCreature->GetPositionY(),int(2))); - group_member->memberGUID = lowguid; - group_member->leaderGUID = leaderGUID; - group_member->groupAI = 0; + group_member = new FormationMember; + group_member->follow_angle = pCreature->GetAngle(chr) - chr->GetOrientation(); + group_member->follow_dist = sqrtf(pow(chr->GetPositionX() - pCreature->GetPositionX(),int(2))+pow(chr->GetPositionY()-pCreature->GetPositionY(),int(2))); + group_member->memberGUID = lowguid; + group_member->leaderGUID = leaderGUID; + group_member->groupAI = 0; CreatureGroupMap[lowguid] = group_member; pCreature->SearchFormation(); diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 6e9704c322d..a36571d20a4 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -510,7 +510,7 @@ bool ChatHandler::HandleReloadAllScriptsCommand(const char*) SendGlobalGMSysMessage("DB tables `*_scripts` reloaded."); HandleReloadDbScriptStringCommand("a"); HandleReloadWpScriptsCommand("a"); - return true; + return true; } bool ChatHandler::HandleReloadAllSpellCommand(const char*) @@ -928,9 +928,9 @@ bool ChatHandler::HandleReloadWpScriptsCommand(const char* arg) if(*arg!='a') sLog.outString( "Re-Loading Scripts from `waypoint_scripts`..."); - objmgr.LoadWaypointScripts(); + objmgr.LoadWaypointScripts(); - if(*arg!='a') + if(*arg!='a') SendGlobalGMSysMessage("DB table `waypoint_scripts` reloaded."); return true; diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 7bf4c3fa83e..dd62f1e1c9f 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -1271,22 +1271,22 @@ float Map::GetHeight(float x, float y, float z, bool pUseVmaps) const float Map::GetVmapHeight(float x, float y, float z, bool useMaps) const { - float mapHeight; - float vmapHeight; - if (useMaps) - { - mapHeight = GetHeight(x, y, z, false); - if (fabs(mapHeight - z) < 0.1) - return mapHeight; - } - else - mapHeight = INVALID_HEIGHT; - VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager(); - if (vmgr->isLineOfSightCalcEnabled()) - bool result = vmgr->getObjectHitPos(GetId(), x, y, z + 2.0f, x, y, mapHeight, x, y, vmapHeight, 0); - else - return INVALID_HEIGHT; - return vmapHeight; + float mapHeight; + float vmapHeight; + if (useMaps) + { + mapHeight = GetHeight(x, y, z, false); + if (fabs(mapHeight - z) < 0.1) + return mapHeight; + } + else + mapHeight = INVALID_HEIGHT; + VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager(); + if (vmgr->isLineOfSightCalcEnabled()) + bool result = vmgr->getObjectHitPos(GetId(), x, y, z + 2.0f, x, y, mapHeight, x, y, vmapHeight, 0); + else + return INVALID_HEIGHT; + return vmapHeight; } uint16 Map::GetAreaFlag(float x, float y ) const diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index cfba9a5f7c4..a6b84d30de2 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -860,7 +860,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) missingItem = at->requiredItem2; uint32 missingKey = 0; - uint32 missingHeroicQuest = 0; + uint32 missingHeroicQuest = 0; if(GetPlayer()->GetDifficulty() == DIFFICULTY_HEROIC) { if(at->heroicKey) @@ -872,7 +872,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) else if(at->heroicKey2 && !GetPlayer()->HasItemCount(at->heroicKey2, 1)) missingKey = at->heroicKey2; - if(at->heroicQuest && !GetPlayer()->GetQuestRewardStatus(at->heroicQuest)) + if(at->heroicQuest && !GetPlayer()->GetQuestRewardStatus(at->heroicQuest)) missingHeroicQuest = at->heroicQuest; } @@ -887,7 +887,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) SendAreaTriggerMessage(GetTrinityString(LANG_LEVEL_MINREQUIRED_AND_ITEM), at->requiredLevel, objmgr.GetItemPrototype(missingItem)->Name1); else if(missingKey) GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY2); - else if(missingHeroicQuest) + else if(missingHeroicQuest) SendAreaTriggerMessage(at->heroicQuestFailedText.c_str()); else if(missingQuest) SendAreaTriggerMessage(at->requiredFailedText.c_str()); diff --git a/src/game/MotionMaster.cpp b/src/game/MotionMaster.cpp index d74602844a5..b5a68a19d38 100644 --- a/src/game/MotionMaster.cpp +++ b/src/game/MotionMaster.cpp @@ -178,7 +178,7 @@ void MotionMaster::MoveIdle(MovementSlot slot) void MotionMaster::MoveRandom(float spawndist) { - if(i_owner->GetTypeId()==TYPEID_UNIT) + if(i_owner->GetTypeId()==TYPEID_UNIT) { DEBUG_LOG("Creature (GUID: %u) start moving random", i_owner->GetGUIDLow() ); Mutate(new RandomMovementGenerator(spawndist), MOTION_SLOT_IDLE); @@ -402,10 +402,10 @@ void MotionMaster::Mutate(MovementGenerator *m, MovementSlot slot) void MotionMaster::MovePath(uint32 path_id, bool repeatable) { - if(!path_id) - return; - //We set waypoint movement as new default movement generator - // clear ALL movement generators (including default) + if(!path_id) + return; + //We set waypoint movement as new default movement generator + // clear ALL movement generators (including default) /*while(!empty()) { MovementGenerator *curr = top(); @@ -415,13 +415,13 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable) delete curr; }*/ - //i_owner->GetTypeId()==TYPEID_PLAYER ? - //Mutate(new WaypointMovementGenerator(path_id, repeatable)): - Mutate(new WaypointMovementGenerator(path_id, repeatable), MOTION_SLOT_IDLE); + //i_owner->GetTypeId()==TYPEID_PLAYER ? + //Mutate(new WaypointMovementGenerator(path_id, repeatable)): + Mutate(new WaypointMovementGenerator(path_id, repeatable), MOTION_SLOT_IDLE); - DEBUG_LOG("%s (GUID: %u) start moving over path(Id:%u, repeatable: %s)", - i_owner->GetTypeId()==TYPEID_PLAYER ? "Player" : "Creature", - i_owner->GetGUIDLow(), path_id, repeatable ? "YES" : "NO" ); + DEBUG_LOG("%s (GUID: %u) start moving over path(Id:%u, repeatable: %s)", + i_owner->GetTypeId()==TYPEID_PLAYER ? "Player" : "Creature", + i_owner->GetGUIDLow(), path_id, repeatable ? "YES" : "NO" ); } void MotionMaster::propagateSpeedChange() diff --git a/src/game/MotionMaster.h b/src/game/MotionMaster.h index 2822cdcd327..84057741d08 100644 --- a/src/game/MotionMaster.h +++ b/src/game/MotionMaster.h @@ -123,7 +123,7 @@ class TRINITY_DLL_SPEC MotionMaster //: private std::stack void MoveIdle(MovementSlot slot = MOTION_SLOT_ACTIVE); void MoveTargetedHome(); void MoveRandom(float spawndist = 0.0f); - void MoveFollow(Unit* target, float dist, float angle); + void MoveFollow(Unit* target, float dist, float angle); void MoveChase(Unit* target, float dist = 0.0f, float angle = 0.0f); void MoveConfused(); void MoveFleeing(Unit* enemy); @@ -131,7 +131,7 @@ class TRINITY_DLL_SPEC MotionMaster //: private std::stack void MoveCharge(float x, float y, float z); void MoveTaxiFlight(uint32 path, uint32 pathnode); void MoveDistract(uint32 time); - void MovePath(uint32 path_id, bool repeatable); + void MovePath(uint32 path_id, bool repeatable); MovementGeneratorType GetCurrentMovementGeneratorType() const; diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 181e7f2541d..1d5db0e925e 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1595,8 +1595,8 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa return NULL; } - pCreature->SetHomePosition(x, y, z, ang); - pCreature->Summon(spwtype, despwtime); + pCreature->SetHomePosition(x, y, z, ang); + pCreature->Summon(spwtype, despwtime); if(GetTypeId()==TYPEID_UNIT && ((Creature*)this)->AI()) ((Creature*)this)->AI()->JustSummoned(pCreature); @@ -1670,9 +1670,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y, { GetNearPoint2D(x,y,distance2d+searcher_size,absAngle); - z = GetPositionZ(); + z = GetPositionZ(); - UpdateGroundPositionZ(x,y,z); + UpdateGroundPositionZ(x,y,z); } void WorldObject::GetGroundPoint(float &x, float &y, float &z, float dist, float angle) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 08fcc059b8b..a68b8315492 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -5112,9 +5112,9 @@ void ObjectMgr::LoadAreaTriggerTeleports() uint32 count = 0; - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 QueryResult *result = WorldDatabase.Query("SELECT id, required_level, required_item, required_item2, heroic_key, heroic_key2, heroic_required_quest_done, heroic_required_failed_quest_text, required_quest_done, required_failed_text, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM areatrigger_teleport"); - if( !result ) + if( !result ) { barGoLink bar( 1 ); @@ -5201,14 +5201,14 @@ void ObjectMgr::LoadAreaTriggerTeleports() } } - if(at.heroicQuest) - { - if(!mQuestTemplates[at.heroicQuest]) - { - sLog.outErrorDb("Required Heroic Quest %u not exist for trigger %u, remove heroic quest done requirement.",at.heroicQuest,Trigger_ID); - at.heroicQuest = 0; - } - } + if(at.heroicQuest) + { + if(!mQuestTemplates[at.heroicQuest]) + { + sLog.outErrorDb("Required Heroic Quest %u not exist for trigger %u, remove heroic quest done requirement.",at.heroicQuest,Trigger_ID); + at.heroicQuest = 0; + } + } if(at.requiredQuest) { diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index a6c2ecbbdf2..7d7a419d923 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -107,7 +107,7 @@ struct AreaTrigger uint32 requiredItem2; uint32 heroicKey; uint32 heroicKey2; - uint32 heroicQuest; + uint32 heroicQuest; std::string heroicQuestFailedText; uint32 requiredQuest; std::string requiredFailedText; @@ -323,9 +323,9 @@ class ObjectMgr typedef std::vector ScriptNameMap; - UNORDERED_MAP TransportEventMap; + UNORDERED_MAP TransportEventMap; - Player* GetPlayer(const char* name) const { return ObjectAccessor::Instance().FindPlayerByName(name);} + Player* GetPlayer(const char* name) const { return ObjectAccessor::Instance().FindPlayerByName(name);} Player* GetPlayer(uint64 guid) const { return ObjectAccessor::FindPlayer(guid); } static GameObjectInfo const *GetGameObjectInfo(uint32 id) { return sGOStorage.LookupEntry(id); } @@ -536,13 +536,13 @@ class ObjectMgr void LoadQuestStartScripts(); void LoadEventScripts(); void LoadSpellScripts(); - void LoadWaypointScripts(); + void LoadWaypointScripts(); - void LoadTransportEvents(); + void LoadTransportEvents(); bool LoadTrinityStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value); bool LoadTrinityStrings() { return LoadTrinityStrings(WorldDatabase,"trinity_string",MIN_TRINITY_STRING_ID,MAX_TRINITY_STRING_ID); } - void LoadDbScriptStrings(); + void LoadDbScriptStrings(); void LoadPetCreateSpells(); void LoadCreatureLocales(); void LoadCreatureTemplates(); @@ -714,7 +714,7 @@ class ObjectMgr } const char *GetTrinityString(int32 entry, int locale_idx) const; const char *GetTrinityStringForDBCLocale(int32 entry) const { return GetTrinityString(entry,DBCLocaleIndex); } - int32 GetDBCLocaleIndex() const { return DBCLocaleIndex; } + int32 GetDBCLocaleIndex() const { return DBCLocaleIndex; } void SetDBCLocaleIndex(uint32 lang) { DBCLocaleIndex = GetIndexForLocale(LocaleConstant(lang)); } void AddCorpseCellData(uint32 mapid, uint32 cellid, uint32 player_guid, uint32 instance); diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index 73b6650caa1..7012ea04fb6 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -547,7 +547,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x204*/ { "CMSG_DECHARGE", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x205*/ { "CMSG_GMTICKET_CREATE", STATUS_LOGGEDIN, &WorldSession::HandleGMTicketCreateOpcode }, /*0x206*/ { "SMSG_GMTICKET_CREATE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x207*/ { "CMSG_GMTICKET_UPDATETEXT", STATUS_LOGGEDIN, &WorldSession::HandleGMTicketUpdateOpcode }, + /*0x207*/ { "CMSG_GMTICKET_UPDATETEXT", STATUS_LOGGEDIN, &WorldSession::HandleGMTicketUpdateOpcode }, /*0x208*/ { "SMSG_GMTICKET_UPDATETEXT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x209*/ { "SMSG_ACCOUNT_DATA_TIMES", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x20A*/ { "CMSG_REQUEST_ACCOUNT_DATA", STATUS_LOGGEDIN, &WorldSession::HandleRequestAccountData }, @@ -838,7 +838,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x327*/ { "CMSG_GM_UPDATE_TICKET_STATUS", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x328*/ { "SMSG_GM_TICKET_STATUS_UPDATE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x329*/ { "MSG_SET_DUNGEON_DIFFICULTY", STATUS_LOGGEDIN, &WorldSession::HandleDungeonDifficultyOpcode }, - /*0x32A*/ { "CMSG_GMSURVEY_SUBMIT", STATUS_LOGGEDIN, &WorldSession::Handle_NULL },//&WorldSession::HandleGMSurveySubmit + /*0x32A*/ { "CMSG_GMSURVEY_SUBMIT", STATUS_LOGGEDIN, &WorldSession::Handle_NULL },//&WorldSession::HandleGMSurveySubmit /*0x32B*/ { "SMSG_UPDATE_INSTANCE_OWNERSHIP", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x32C*/ { "CMSG_IGNORE_KNOCKBACK_CHEAT", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x32D*/ { "SMSG_CHAT_PLAYER_AMBIGUOUS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, diff --git a/src/game/Player.cpp b/src/game/Player.cpp index e1d12009afb..02e6e94f94c 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1575,15 +1575,15 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati if(!InBattleGround() && mEntry->IsBattleGroundOrArena()) return false; - // 449 - Champions' Hall (Alliance) // 450 - Hall of Legends (Horde) - if(mapid == 449 && GetTeam()==HORDE) + // 449 - Champions' Hall (Alliance) // 450 - Hall of Legends (Horde) + if(mapid == 449 && GetTeam()==HORDE) { GetSession()->SendNotification(LANG_NO_ENTER_CHAMPIONS_HALL); return false; } - if(mapid == 450 && GetTeam() == ALLIANCE) - { + if(mapid == 450 && GetTeam() == ALLIANCE) + { GetSession()->SendNotification(LANG_NO_ENTER_HALL_OF_LEGENDS); return false; } @@ -15447,8 +15447,8 @@ void Player::SaveToDB() ss << ", '"; ss << m_taxi.SaveTaxiDestinationsToString(); - ss << "', '0', '"; - ss << GetSession()->GetLatency(); + ss << "', '0', '"; + ss << GetSession()->GetLatency(); ss << "' )"; CharacterDatabase.Execute( ss.str().c_str() ); @@ -18754,7 +18754,7 @@ void Player::UpdateZoneDependentAuras( uint32 newZone ) { // remove new continent flight forms if( !isGameMaster() && - GetVirtualMapForMapAndZone(GetMapId(),newZone) != 530) + GetVirtualMapForMapAndZone(GetMapId(),newZone) != 530) { RemoveSpellsCausingAura(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED); RemoveSpellsCausingAura(SPELL_AURA_FLY); diff --git a/src/game/PlayerDump.h b/src/game/PlayerDump.h index 86224d1fbca..c8335216716 100644 --- a/src/game/PlayerDump.h +++ b/src/game/PlayerDump.h @@ -75,11 +75,11 @@ enum DumpTableType enum DumpReturn { - DUMP_SUCCESS, - DUMP_FILE_OPEN_ERROR, - DUMP_TOO_MANY_CHARS, - DUMP_UNEXPECTED_END, - DUMP_FILE_BROKEN, + DUMP_SUCCESS, + DUMP_FILE_OPEN_ERROR, + DUMP_TOO_MANY_CHARS, + DUMP_UNEXPECTED_END, + DUMP_FILE_BROKEN, }; class PlayerDump diff --git a/src/game/RandomMovementGenerator.cpp b/src/game/RandomMovementGenerator.cpp index 615a8721fa8..0679d1381db 100644 --- a/src/game/RandomMovementGenerator.cpp +++ b/src/game/RandomMovementGenerator.cpp @@ -123,9 +123,9 @@ RandomMovementGenerator::Initialize(Creature &creature) if(!creature.isAlive()) return; - wander_distance = creature.GetRespawnRadius(); + wander_distance = creature.GetRespawnRadius(); - if (creature.canFly()) + if (creature.canFly()) creature.AddUnitMovementFlag(MOVEMENTFLAG_FLYING2); else creature.SetUnitMovementFlags(irand(0,RUNNING_CHANCE_RANDOMMV) > 0 ? MOVEMENTFLAG_WALK_MODE : MOVEMENTFLAG_NONE ); diff --git a/src/game/RandomMovementGenerator.h b/src/game/RandomMovementGenerator.h index dcc03dfa721..ed34b96f608 100644 --- a/src/game/RandomMovementGenerator.h +++ b/src/game/RandomMovementGenerator.h @@ -30,16 +30,16 @@ class TRINITY_DLL_SPEC RandomMovementGenerator : public MovementGeneratorMedium< T, RandomMovementGenerator > { public: - // Wander dist is related on db spawn dist. So what if we wanna set eandom movement on summoned creature?! - RandomMovementGenerator(float spawn_dist = 0.0f) : i_nextMoveTime(0), wander_distance(spawn_dist) {} + // Wander dist is related on db spawn dist. So what if we wanna set eandom movement on summoned creature?! + RandomMovementGenerator(float spawn_dist = 0.0f) : i_nextMoveTime(0), wander_distance(spawn_dist) {} - void _setRandomLocation(T &); + void _setRandomLocation(T &); void Initialize(T &); void Finalize(T &); void Reset(T &); bool Update(T &, const uint32 &); bool GetDestination(float &x, float &y, float &z) const; - void UpdateMapPosition(uint32 mapid, float &x ,float &y, float &z) + void UpdateMapPosition(uint32 mapid, float &x ,float &y, float &z) { i_destinationHolder.GetLocationNow(mapid, x,y,z); } @@ -49,6 +49,6 @@ class TRINITY_DLL_SPEC RandomMovementGenerator DestinationHolder< Traveller > i_destinationHolder; float wander_distance; - uint32 i_nextMove; + uint32 i_nextMove; }; #endif diff --git a/src/game/ScriptCalls.cpp b/src/game/ScriptCalls.cpp index 8c763809f63..4bd305917b2 100644 --- a/src/game/ScriptCalls.cpp +++ b/src/game/ScriptCalls.cpp @@ -58,7 +58,7 @@ bool LoadScriptingModule(char const* libName) if( !(testScript->ScriptsInit =(scriptCallScriptsInit )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsInit" )) ||!(testScript->ScriptsFree =(scriptCallScriptsFree )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsFree" )) - ||!(testScript->ScriptsVersion =(scriptCallScriptsVersion )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsVersion" )) + ||!(testScript->ScriptsVersion =(scriptCallScriptsVersion )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsVersion" )) ||!(testScript->GossipHello =(scriptCallGossipHello )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GossipHello" )) ||!(testScript->GOChooseReward =(scriptCallGOChooseReward )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GOChooseReward" )) ||!(testScript->QuestAccept =(scriptCallQuestAccept )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"QuestAccept" )) @@ -95,7 +95,7 @@ bool LoadScriptingModule(char const* libName) Script=testScript; Script->ScriptsInit(); - sWorld.SetScriptsVersion(Script->ScriptsVersion()); + sWorld.SetScriptsVersion(Script->ScriptsVersion()); return true; } diff --git a/src/game/ScriptCalls.h b/src/game/ScriptCalls.h index eb6cf09fab9..52b2f27f218 100644 --- a/src/game/ScriptCalls.h +++ b/src/game/ScriptCalls.h @@ -65,7 +65,7 @@ typedef struct { scriptCallScriptsInit ScriptsInit; scriptCallScriptsFree ScriptsFree; - scriptCallScriptsVersion ScriptsVersion; + scriptCallScriptsVersion ScriptsVersion; scriptCallGossipHello GossipHello; scriptCallGOChooseReward GOChooseReward; diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 4ee86880443..e0e3a5ba077 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -2202,16 +2202,16 @@ enum ResponseCodes /// Ban function modes enum BanMode { - BAN_ACCOUNT, - BAN_CHARACTER, - BAN_IP + BAN_ACCOUNT, + BAN_CHARACTER, + BAN_IP }; /// Ban function return codes enum BanReturn { - BAN_SUCCESS, - BAN_SYNTAX_ERROR, - BAN_NOTFOUND + BAN_SUCCESS, + BAN_SYNTAX_ERROR, + BAN_NOTFOUND }; #endif diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index abdeeb275b5..d7d9446ab50 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4163,11 +4163,11 @@ uint8 Spell::CanCast(bool strict) case SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED: case SPELL_AURA_FLY: { - // not allow cast fly spells at old maps by players (all spells is self target) + // not allow cast fly spells at old maps by players (all spells is self target) if(m_caster->GetTypeId()==TYPEID_PLAYER) { if( !((Player*)m_caster)->isGameMaster() && - GetVirtualMapForMapAndZone(m_caster->GetMapId(),m_caster->GetZoneId()) != 530) + GetVirtualMapForMapAndZone(m_caster->GetMapId(),m_caster->GetZoneId()) != 530) return SPELL_FAILED_NOT_HERE; } break; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index b74f9f0a8a4..c77e84b85f5 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -888,7 +888,7 @@ void Aura::_AddAura() SetAuraSlot( slot ); } - UpdateSlotCounterAndDuration(); + UpdateSlotCounterAndDuration(); // Update Seals information if( IsSealSpell(GetSpellProto()) ) @@ -5674,13 +5674,13 @@ void Aura::PeriodicTick() int32 gain = pCaster->ModifyPower(power,gain_amount); m_target->AddThreat(pCaster, float(gain) * 0.5f, GetSpellSchoolMask(GetSpellProto()), GetSpellProto()); } - // Mark of Kaz'rogal - if(GetId() == 31447 && m_target->GetPower(power) == 0) - { - m_target->CastSpell(m_target, 31463, true, 0, this); - // Remove aura - SetAuraDuration(0); - } + // Mark of Kaz'rogal + if(GetId() == 31447 && m_target->GetPower(power) == 0) + { + m_target->CastSpell(m_target, 31463, true, 0, this); + // Remove aura + SetAuraDuration(0); + } break; } case SPELL_AURA_PERIODIC_ENERGIZE: diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index db608094426..07e5d4afef9 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1291,7 +1291,7 @@ void Spell::EffectDummy(uint32 i) return; spell_id = 20647; - bp = damage+int32(m_caster->GetPower(POWER_RAGE) * m_spellInfo->DmgMultiplier[i]); + bp = damage+int32(m_caster->GetPower(POWER_RAGE) * m_spellInfo->DmgMultiplier[i]); m_caster->SetPower(POWER_RAGE,0); break; } @@ -3385,13 +3385,13 @@ void Spell::EffectDispel(uint32 i) SpellEntry const* spellInfo = sSpellStore.LookupEntry(j->first); data << uint32(spellInfo->Id); // Spell Id data << uint8(0); // 0 - dispelled !=0 cleansed - if(spellInfo->StackAmount!= 0) - { - //Why are Aura's Removed by EffIndex? Auras should be removed as a whole..... - unitTarget->RemoveSingleAuraFromStackByDispel(spellInfo->Id); - } - else - unitTarget->RemoveAurasDueToSpellByDispel(spellInfo->Id, j->second, m_caster); + if(spellInfo->StackAmount!= 0) + { + //Why are Aura's Removed by EffIndex? Auras should be removed as a whole..... + unitTarget->RemoveSingleAuraFromStackByDispel(spellInfo->Id); + } + else + unitTarget->RemoveAurasDueToSpellByDispel(spellInfo->Id, j->second, m_caster); } m_caster->SendMessageToSet(&data, true); diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index edf41e16492..940135e2db5 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -362,27 +362,27 @@ void WorldSession::HandleCancelAuraOpcode( WorldPacket& recvPacket) if(!IsPositiveSpell(spellId) || (spellInfo->Attributes & SPELL_ATTR_CANT_CANCEL)) return; - // lifebloom must delete final heal effect - if (spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && (spellInfo->SpellFamilyFlags & 0x1000000000LL) ) - { - Unit::AuraMap::iterator iter; - while((iter = _player->m_Auras.find(Unit::spellEffectPair(spellId, 1))) != _player->m_Auras.end()) - { - _player->m_modAuras[SPELL_AURA_DUMMY].remove(iter->second); + // lifebloom must delete final heal effect + if (spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && (spellInfo->SpellFamilyFlags & 0x1000000000LL) ) + { + Unit::AuraMap::iterator iter; + while((iter = _player->m_Auras.find(Unit::spellEffectPair(spellId, 1))) != _player->m_Auras.end()) + { + _player->m_modAuras[SPELL_AURA_DUMMY].remove(iter->second); - Aura* Aur = iter->second; - _player->m_Auras.erase(iter); - ++_player->m_removedAuras; // internal count used by unit update + Aura* Aur = iter->second; + _player->m_Auras.erase(iter); + ++_player->m_removedAuras; // internal count used by unit update - delete Aur; + delete Aur; - if( _player->m_Auras.empty() ) - iter = _player->m_Auras.end(); - else - iter = _player->m_Auras.begin(); + if( _player->m_Auras.empty() ) + iter = _player->m_Auras.end(); + else + iter = _player->m_Auras.begin(); - } - } + } + } // channeled spell case (it currently casted then) if(IsChanneledSpell(spellInfo)) diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 36d1cf391d4..435481de949 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -2192,29 +2192,29 @@ void SpellMgr::LoadSpellCustomAttr() break; case 41376: // Spite case 39992: // Needle Spine - case 29576: //Multi-Shot - case 40816: //Saber Lash - case 37790: //Spread Shot - case 46771: //Flame Sear - case 45248: //Shadow Blades + case 29576: //Multi-Shot + case 40816: //Saber Lash + case 37790: //Spread Shot + case 46771: //Flame Sear + case 45248: //Shadow Blades case 41303: // Soul Drain spellInfo->MaxAffectedTargets = 3; break; - case 38310: //Multi-Shot - spellInfo->MaxAffectedTargets = 4; - break; + case 38310: //Multi-Shot + spellInfo->MaxAffectedTargets = 4; + break; case 42005: // Bloodboil - case 38296: //Spitfire Totem - case 37676: //Insidious Whisper - case 46009: //Negative Energy + case 38296: //Spitfire Totem + case 37676: //Insidious Whisper + case 46009: //Negative Energy spellInfo->MaxAffectedTargets = 5; break; - case 40827: //Sinful Beam - case 40859: //Sinister Beam - case 40860: //Vile Beam - case 40861: //Wicked Beam - spellInfo->MaxAffectedTargets = 10; - break; + case 40827: //Sinful Beam + case 40859: //Sinister Beam + case 40860: //Vile Beam + case 40861: //Wicked Beam + spellInfo->MaxAffectedTargets = 10; + break; case 8122: case 8124: case 10888: case 10890: // Psychic Scream case 12494: // Frostbite spellInfo->Attributes |= SPELL_ATTR_BREAKABLE_BY_DAMAGE; diff --git a/src/game/TicketHandler.cpp b/src/game/TicketHandler.cpp index 23a6331b20d..5d6b1e095fa 100644 --- a/src/game/TicketHandler.cpp +++ b/src/game/TicketHandler.cpp @@ -33,158 +33,158 @@ void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data ) { - // always do a packet check + // always do a packet check CHECK_PACKET_SIZE(recv_data, 4*4+1+2*4); - uint32 map; + uint32 map; float x, y, z; std::string ticketText = ""; - std::string ticketText2 = ""; - GM_Ticket *ticket = new GM_Ticket; + std::string ticketText2 = ""; + GM_Ticket *ticket = new GM_Ticket; - WorldPacket data(SMSG_GMTICKET_CREATE, 4); + WorldPacket data(SMSG_GMTICKET_CREATE, 4); - // recv Data - //TODO: Add map coordinates to tickets. + // recv Data + //TODO: Add map coordinates to tickets. recv_data >> map; recv_data >> x; recv_data >> y; recv_data >> z; recv_data >> ticketText; - // get additional data, rarely used - recv_data >> ticketText2; + // get additional data, rarely used + recv_data >> ticketText2; - // assign values - ticket->name = GetPlayer()->GetName(); - ticket->guid = ticketmgr.GenerateTicketID(); - ticket->playerGuid = GetPlayer()->GetGUID(); - ticket->message = ticketText; - ticket->timestamp = time(NULL); - ticket->closed = 0; - ticket->assignedToGM = 0; - ticket->comment = ""; + // assign values + ticket->name = GetPlayer()->GetName(); + ticket->guid = ticketmgr.GenerateTicketID(); + ticket->playerGuid = GetPlayer()->GetGUID(); + ticket->message = ticketText; + ticket->timestamp = time(NULL); + ticket->closed = 0; + ticket->assignedToGM = 0; + ticket->comment = ""; - // remove ticket by player, shouldn't happen - ticketmgr.RemoveGMTicketByPlayer(GetPlayer()->GetGUID(), GetPlayer()->GetGUID()); + // remove ticket by player, shouldn't happen + ticketmgr.RemoveGMTicketByPlayer(GetPlayer()->GetGUID(), GetPlayer()->GetGUID()); - // add ticket - ticketmgr.AddGMTicket(ticket, false); + // add ticket + ticketmgr.AddGMTicket(ticket, false); - // Response - no errors - data << uint32(2); + // Response - no errors + data << uint32(2); - // Send ticket creation - SendPacket(&data); + // Send ticket creation + SendPacket(&data); - sWorld.SendGMText(LANG_COMMAND_TICKETNEW, ticket->name.c_str(), ticket->guid); + sWorld.SendGMText(LANG_COMMAND_TICKETNEW, ticket->name.c_str(), ticket->guid); } void WorldSession::HandleGMTicketUpdateOpcode( WorldPacket & recv_data) { - // always do a packet check - CHECK_PACKET_SIZE(recv_data,1); + // always do a packet check + CHECK_PACKET_SIZE(recv_data,1); - std::string message = ""; - time_t t = time(NULL); + std::string message = ""; + time_t t = time(NULL); - WorldPacket data(SMSG_GMTICKET_UPDATETEXT, 4); + WorldPacket data(SMSG_GMTICKET_UPDATETEXT, 4); - // recv Data - recv_data >> message; + // recv Data + recv_data >> message; - // Update Ticket - GM_Ticket *ticket = ticketmgr.GetGMTicketByPlayer(GetPlayer()->GetGUID()); + // Update Ticket + GM_Ticket *ticket = ticketmgr.GetGMTicketByPlayer(GetPlayer()->GetGUID()); - // Check if player has a GM Ticket yet - if(!ticket) - { - // Response - error couldnt find existing Ticket - data << uint32(1); + // Check if player has a GM Ticket yet + if(!ticket) + { + // Response - error couldnt find existing Ticket + data << uint32(1); - // Send packet - SendPacket(&data); - return; - } + // Send packet + SendPacket(&data); + return; + } - ticket->message = message; - ticket->timestamp = (uint32)t; + ticket->message = message; + ticket->timestamp = (uint32)t; - ticketmgr.UpdateGMTicket(ticket); + ticketmgr.UpdateGMTicket(ticket); - // Response - no errors - data << uint32(2); + // Response - no errors + data << uint32(2); - // Send packet - SendPacket(&data); + // Send packet + SendPacket(&data); - sWorld.SendGMText(LANG_COMMAND_TICKETUPDATED, GetPlayer()->GetName(), ticket->guid); + sWorld.SendGMText(LANG_COMMAND_TICKETUPDATED, GetPlayer()->GetName(), ticket->guid); } void WorldSession::HandleGMTicketDeleteOpcode( WorldPacket & /*recv_data*/) { - // NO recv_data, NO packet check size + // NO recv_data, NO packet check size - GM_Ticket* ticket = ticketmgr.GetGMTicketByPlayer(GetPlayer()->GetGUID()); + GM_Ticket* ticket = ticketmgr.GetGMTicketByPlayer(GetPlayer()->GetGUID()); - // CHeck for Ticket - if(ticket) - { - // Remove Tickets from Player + // CHeck for Ticket + if(ticket) + { + // Remove Tickets from Player - // Response - no errors - WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4); - data << uint32(9); - // Send Packet - SendPacket(&data); + // Response - no errors + WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4); + data << uint32(9); + // Send Packet + SendPacket(&data); - sWorld.SendGMText(LANG_COMMAND_TICKETPLAYERABANDON, GetPlayer()->GetName(), ticket->guid ); - ticketmgr.RemoveGMTicketByPlayer(GetPlayer()->GetGUID(), GetPlayer()->GetGUID()); - } + sWorld.SendGMText(LANG_COMMAND_TICKETPLAYERABANDON, GetPlayer()->GetName(), ticket->guid ); + ticketmgr.RemoveGMTicketByPlayer(GetPlayer()->GetGUID(), GetPlayer()->GetGUID()); + } } void WorldSession::HandleGMTicketGetTicketOpcode( WorldPacket & /*recv_data*/) { - // NO recv_data NO packet size check + // NO recv_data NO packet size check - WorldPacket data(SMSG_GMTICKET_GETTICKET, 400); + WorldPacket data(SMSG_GMTICKET_GETTICKET, 400); - // get Current Ticket - GM_Ticket *ticket = ticketmgr.GetGMTicketByPlayer(GetPlayer()->GetGUID()); + // get Current Ticket + GM_Ticket *ticket = ticketmgr.GetGMTicketByPlayer(GetPlayer()->GetGUID()); - // check for existing ticket - if(!ticket) - { - data << uint32(10); - // send packet - SendPacket(&data); - return; - } + // check for existing ticket + if(!ticket) + { + data << uint32(10); + // send packet + SendPacket(&data); + return; + } - // Send current Ticket - data << uint32(6); // unk ? - data << ticket->message.c_str(); + // Send current Ticket + data << uint32(6); // unk ? + data << ticket->message.c_str(); - SendPacket(&data); + SendPacket(&data); } void WorldSession::HandleGMTicketSystemStatusOpcode( WorldPacket & /*recv_data*/) { - // NO recv_data NO packet size check + // NO recv_data NO packet size check - WorldPacket data(SMSG_GMTICKET_SYSTEMSTATUS, 4); + WorldPacket data(SMSG_GMTICKET_SYSTEMSTATUS, 4); - // Response - System is working Fine + // Response - System is working Fine - // No need for checks, ticket system is active - // in case of disactivity, this should be set to (0) + // No need for checks, ticket system is active + // in case of disactivity, this should be set to (0) - data << uint32(1); + data << uint32(1); - // Send Packet - SendPacket(&data); + // Send Packet + SendPacket(&data); } diff --git a/src/game/TicketMgr.cpp b/src/game/TicketMgr.cpp index 571a872ac2b..09d975ccf21 100644 --- a/src/game/TicketMgr.cpp +++ b/src/game/TicketMgr.cpp @@ -30,179 +30,179 @@ INSTANTIATE_SINGLETON_1( TicketMgr ); GM_Ticket* TicketMgr::GetGMTicket(uint64 ticketGuid) { - for(GmTicketList::iterator i = GM_TicketList.begin(); i != GM_TicketList.end();) - { - if((*i)->guid == ticketGuid) - { - return (*i); - } - ++i; - } - return NULL; + for(GmTicketList::iterator i = GM_TicketList.begin(); i != GM_TicketList.end();) + { + if((*i)->guid == ticketGuid) + { + return (*i); + } + ++i; + } + return NULL; } GM_Ticket* TicketMgr::GetGMTicketByPlayer(uint64 playerGuid) { - for(GmTicketList::iterator i = GM_TicketList.begin(); i != GM_TicketList.end();) - { - if((*i)->playerGuid == playerGuid && (*i)->closed == 0) - { - return (*i); - } - ++i; - } - return NULL; + for(GmTicketList::iterator i = GM_TicketList.begin(); i != GM_TicketList.end();) + { + if((*i)->playerGuid == playerGuid && (*i)->closed == 0) + { + return (*i); + } + ++i; + } + return NULL; } GM_Ticket* TicketMgr::GetGMTicketByName(const char* name) { - std::string pname = name; - if(!normalizePlayerName(pname)) - return NULL; + std::string pname = name; + if(!normalizePlayerName(pname)) + return NULL; - Player *plr = objmgr.GetPlayer(pname.c_str()); - if(!plr) - return NULL; + Player *plr = objmgr.GetPlayer(pname.c_str()); + if(!plr) + return NULL; - uint64 playerGuid = plr->GetGUID(); + uint64 playerGuid = plr->GetGUID(); - for(GmTicketList::iterator i = GM_TicketList.begin(); i != GM_TicketList.end();) - { - if((*i)->playerGuid == playerGuid && (*i)->closed == 0) - { - return (*i); - } - ++i; - } - return NULL; + for(GmTicketList::iterator i = GM_TicketList.begin(); i != GM_TicketList.end();) + { + if((*i)->playerGuid == playerGuid && (*i)->closed == 0) + { + return (*i); + } + ++i; + } + return NULL; } void TicketMgr::AddGMTicket(GM_Ticket *ticket, bool startup) { - ASSERT( ticket ); - GM_TicketList.push_back(ticket); + ASSERT( ticket ); + GM_TicketList.push_back(ticket); - // save - if(!startup) - SaveGMTicket(ticket); + // save + if(!startup) + SaveGMTicket(ticket); } void TicketMgr::DeleteGMTicketPermanently(uint64 ticketGuid) { - for(GmTicketList::iterator i = GM_TicketList.begin(); i != GM_TicketList.end();) - { - if((*i)->guid == ticketGuid) - { - i = GM_TicketList.erase(i); - } - else - { - ++i; - } - } + for(GmTicketList::iterator i = GM_TicketList.begin(); i != GM_TicketList.end();) + { + if((*i)->guid == ticketGuid) + { + i = GM_TicketList.erase(i); + } + else + { + ++i; + } + } - // delete database record - CharacterDatabase.PExecute("DELETE FROM `gm_tickets` WHERE guid= '%u'", ticketGuid); + // delete database record + CharacterDatabase.PExecute("DELETE FROM `gm_tickets` WHERE guid= '%u'", ticketGuid); } void TicketMgr::LoadGMTickets() { - InitTicketID(); - // Delete all out of object holder - GM_TicketList.clear(); - QueryResult *result = CharacterDatabase.Query( "SELECT `guid`, `playerGuid`, `name`, `message`, `timestamp`, `closed`, `assignedto`, `comment` FROM `gm_tickets`" ); - GM_Ticket *ticket; + InitTicketID(); + // Delete all out of object holder + GM_TicketList.clear(); + QueryResult *result = CharacterDatabase.Query( "SELECT `guid`, `playerGuid`, `name`, `message`, `timestamp`, `closed`, `assignedto`, `comment` FROM `gm_tickets`" ); + GM_Ticket *ticket; - if(!result) - return; + if(!result) + return; - // Assign values from SQL to the object holder - do - { - Field *fields = result->Fetch(); - ticket = new GM_Ticket; - ticket->guid = fields[0].GetUInt64(); - ticket->playerGuid = fields[1].GetUInt64(); - ticket->name = fields[2].GetString(); - ticket->message = fields[3].GetString(); - ticket->timestamp = fields[4].GetUInt32(); - ticket->closed = fields[5].GetUInt16(); - ticket->assignedToGM = fields[6].GetUInt64(); - ticket->comment = fields[7].GetString(); + // Assign values from SQL to the object holder + do + { + Field *fields = result->Fetch(); + ticket = new GM_Ticket; + ticket->guid = fields[0].GetUInt64(); + ticket->playerGuid = fields[1].GetUInt64(); + ticket->name = fields[2].GetString(); + ticket->message = fields[3].GetString(); + ticket->timestamp = fields[4].GetUInt32(); + ticket->closed = fields[5].GetUInt16(); + ticket->assignedToGM = fields[6].GetUInt64(); + ticket->comment = fields[7].GetString(); - AddGMTicket(ticket, true); + AddGMTicket(ticket, true); - } while( result->NextRow() ); + } while( result->NextRow() ); - sWorld.SendGMText(LANG_COMMAND_TICKETRELOAD, result->GetRowCount()); + sWorld.SendGMText(LANG_COMMAND_TICKETRELOAD, result->GetRowCount()); - delete result; + delete result; } void TicketMgr::RemoveGMTicket(uint64 ticketGuid, uint64 GMguid) { - for(GmTicketList::iterator i = GM_TicketList.begin(); i != GM_TicketList.end();) - { - if((*i)->guid == ticketGuid && (*i)->closed == 0) - { - (*i)->closed = GMguid; - SaveGMTicket((*i)); - } - ++i; - } + for(GmTicketList::iterator i = GM_TicketList.begin(); i != GM_TicketList.end();) + { + if((*i)->guid == ticketGuid && (*i)->closed == 0) + { + (*i)->closed = GMguid; + SaveGMTicket((*i)); + } + ++i; + } } void TicketMgr::RemoveGMTicketByPlayer(uint64 playerGuid, uint64 GMguid) { - for(GmTicketList::iterator i = GM_TicketList.begin(); i != GM_TicketList.end();) - { - if((*i)->playerGuid == playerGuid && (*i)->closed == 0) - { - (*i)->closed = GMguid; - SaveGMTicket((*i)); - } - ++i; - } + for(GmTicketList::iterator i = GM_TicketList.begin(); i != GM_TicketList.end();) + { + if((*i)->playerGuid == playerGuid && (*i)->closed == 0) + { + (*i)->closed = GMguid; + SaveGMTicket((*i)); + } + ++i; + } } void TicketMgr::SaveGMTicket(GM_Ticket* ticket) { - std::string msg = ticket->message; + std::string msg = ticket->message; CharacterDatabase.escape_string(msg); - std::stringstream ss; - ss << "REPLACE INTO `gm_tickets` (`guid`, `playerGuid`, `name`, `message`, `timestamp`, `closed`, `assignedto`, `comment`) VALUES('"; - ss << ticket->guid << "', '"; - ss << ticket->playerGuid << "', '"; - ss << ticket->name << "', '"; - ss << msg << "', '" ; - ss << ticket->timestamp << "', '"; - ss << ticket->closed << "', '"; - ss << ticket->assignedToGM << "', '"; - ss << ticket->comment << "');"; + std::stringstream ss; + ss << "REPLACE INTO `gm_tickets` (`guid`, `playerGuid`, `name`, `message`, `timestamp`, `closed`, `assignedto`, `comment`) VALUES('"; + ss << ticket->guid << "', '"; + ss << ticket->playerGuid << "', '"; + ss << ticket->name << "', '"; + ss << msg << "', '" ; + ss << ticket->timestamp << "', '"; + ss << ticket->closed << "', '"; + ss << ticket->assignedToGM << "', '"; + ss << ticket->comment << "');"; CharacterDatabase.BeginTransaction(); - CharacterDatabase.Execute(ss.str().c_str()); - CharacterDatabase.CommitTransaction(); + CharacterDatabase.Execute(ss.str().c_str()); + CharacterDatabase.CommitTransaction(); } void TicketMgr::UpdateGMTicket(GM_Ticket *ticket) { - SaveGMTicket(ticket); + SaveGMTicket(ticket); } void TicketMgr::InitTicketID() { - QueryResult *result = CharacterDatabase.Query("SELECT MAX(guid) FROM gm_tickets"); - if(result) - { - m_ticketid = result->Fetch()[0].GetUInt64(); - delete result; - } + QueryResult *result = CharacterDatabase.Query("SELECT MAX(guid) FROM gm_tickets"); + if(result) + { + m_ticketid = result->Fetch()[0].GetUInt64(); + delete result; + } } uint64 TicketMgr::GenerateTicketID() { - return ++m_ticketid; + return ++m_ticketid; } diff --git a/src/game/TicketMgr.h b/src/game/TicketMgr.h index ea5f997f3cc..f8a0632c0ca 100644 --- a/src/game/TicketMgr.h +++ b/src/game/TicketMgr.h @@ -29,14 +29,14 @@ struct GM_Ticket { - uint64 guid; - uint64 playerGuid; - std::string name; - std::string message; - uint64 timestamp; - uint16 closed; - uint64 assignedToGM; - std::string comment; + uint64 guid; + uint64 playerGuid; + std::string name; + std::string message; + uint64 timestamp; + uint16 closed; + uint64 assignedToGM; + std::string comment; }; // Map Typedef @@ -44,31 +44,31 @@ typedef std::list GmTicketList class TicketMgr { - public: - TicketMgr(){m_ticketid = 1;} //constructor - ~TicketMgr(){} //destructor + public: + TicketMgr(){m_ticketid = 1;} //constructor + ~TicketMgr(){} //destructor - // Object Holder - GmTicketList GM_TicketList; + // Object Holder + GmTicketList GM_TicketList; - void AddGMTicket(GM_Ticket *ticket, bool startup); - void DeleteAllRemovedGMTickets(); - void DeleteGMTicketPermanently(uint64 ticketGuid); - void LoadGMTickets(); - void RemoveGMTicketByPlayer(uint64 playerGuid, uint64 GMguid); - void RemoveGMTicket(uint64 ticketGuid, uint64 GMguid); - void UpdateGMTicket(GM_Ticket *ticket); - void SaveGMTicket(GM_Ticket* ticket); + void AddGMTicket(GM_Ticket *ticket, bool startup); + void DeleteAllRemovedGMTickets(); + void DeleteGMTicketPermanently(uint64 ticketGuid); + void LoadGMTickets(); + void RemoveGMTicketByPlayer(uint64 playerGuid, uint64 GMguid); + void RemoveGMTicket(uint64 ticketGuid, uint64 GMguid); + void UpdateGMTicket(GM_Ticket *ticket); + void SaveGMTicket(GM_Ticket* ticket); - uint64 GenerateTicketID(); - void InitTicketID(); - GM_Ticket* GetGMTicket(uint64 ticketGuid); - GM_Ticket* GetGMTicketByPlayer(uint64 playerGuid); - GM_Ticket* GetGMTicketByName(const char *name); + uint64 GenerateTicketID(); + void InitTicketID(); + GM_Ticket* GetGMTicket(uint64 ticketGuid); + GM_Ticket* GetGMTicketByPlayer(uint64 playerGuid); + GM_Ticket* GetGMTicketByName(const char *name); - protected: - uint64 m_ticketid; + protected: + uint64 m_ticketid; }; #endif diff --git a/src/game/Transports.cpp b/src/game/Transports.cpp index 42130a6d0de..b2ed69fe251 100644 --- a/src/game/Transports.cpp +++ b/src/game/Transports.cpp @@ -402,8 +402,8 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set &mapids) // sLog.outString("T: %d, x: %f, y: %f, z: %f, t:%d", t, pos.x, pos.y, pos.z, teleport); /* - if(keyFrames[i+1].delay > 5) - pos.delayed = true; + if(keyFrames[i+1].delay > 5) + pos.delayed = true; */ //if (teleport) m_WayPoints[t] = pos; @@ -489,9 +489,9 @@ bool Transport::RemovePassenger(Player* passenger) void Transport::CheckForEvent(uint32 entry, uint32 wp_id) { - uint32 key = entry*100+wp_id; - if(objmgr.TransportEventMap.find(key) != objmgr.TransportEventMap.end()) - sWorld.ScriptsStart(sEventScripts, objmgr.TransportEventMap[key], this, NULL); + uint32 key = entry*100+wp_id; + if(objmgr.TransportEventMap.find(key) != objmgr.TransportEventMap.end()) + sWorld.ScriptsStart(sEventScripts, objmgr.TransportEventMap[key], this, NULL); } void Transport::Update(uint32 /*p_time*/) @@ -516,25 +516,25 @@ void Transport::Update(uint32 /*p_time*/) Relocate(m_curr->second.x, m_curr->second.y, m_curr->second.z); } /* - if(m_curr->second.delayed) - { - switch (GetEntry()) - { - case 176495: - case 164871: - case 175080: - SendPlaySound(11804, false); break; // ZeppelinDocked - case 20808: - case 181646: - case 176231: - case 176244: - case 176310: - case 177233: - SendPlaySound(5495, false);break; // BoatDockingWarning - default: - SendPlaySound(5154, false); break; // ShipDocked - } - } + if(m_curr->second.delayed) + { + switch (GetEntry()) + { + case 176495: + case 164871: + case 175080: + SendPlaySound(11804, false); break; // ZeppelinDocked + case 20808: + case 181646: + case 176231: + case 176244: + case 176310: + case 177233: + SendPlaySound(5495, false);break; // BoatDockingWarning + default: + SendPlaySound(5154, false); break; // ShipDocked + } + } */ /* for(PlayerSet::iterator itr = m_passengers.begin(); itr != m_passengers.end();) @@ -557,8 +557,8 @@ void Transport::Update(uint32 /*p_time*/) if ((sLog.getLogFilter() & LOG_FILTER_TRANSPORT_MOVES)==0) sLog.outDetail("%s moved to %f %f %f %d", this->m_name.c_str(), m_curr->second.x, m_curr->second.y, m_curr->second.z, m_curr->second.mapid); - //Transport Event System - CheckForEvent(this->GetEntry(), m_curr->second.id); - sLog.outDetail("%s is at wp id: %u", this->m_name.c_str(), m_curr->second.id); - } + //Transport Event System + CheckForEvent(this->GetEntry(), m_curr->second.id); + sLog.outDetail("%s is at wp id: %u", this->m_name.c_str(), m_curr->second.id); + } } diff --git a/src/game/Transports.h b/src/game/Transports.h index 5fb15dbe98f..e49383ad1de 100644 --- a/src/game/Transports.h +++ b/src/game/Transports.h @@ -78,7 +78,7 @@ class Transport : private GameObject void Update(uint32 p_time); bool AddPassenger(Player* passenger); bool RemovePassenger(Player* passenger); - void CheckForEvent(uint32 entry, uint32 wp_id); + void CheckForEvent(uint32 entry, uint32 wp_id); typedef std::set PlayerSet; PlayerSet const& GetPassengers() const { return m_passengers; } @@ -95,7 +95,7 @@ class Transport : private GameObject float y; float z; bool teleport; - uint32 id; + uint32 id; }; typedef std::map WayPointMap; diff --git a/src/game/Traveller.h b/src/game/Traveller.h index 8d7dda0e055..64b9d1c310d 100644 --- a/src/game/Traveller.h +++ b/src/game/Traveller.h @@ -80,11 +80,11 @@ template<> inline void Traveller::MoveTo(float x, float y, float z, uint32 t) { //Call for creature group update - if(i_traveller.IsFormationLeader() && !i_traveller.isInCombat() && - CreatureGroupHolder.find(i_traveller.GetFormationID()) != CreatureGroupHolder.end()) - CreatureGroupHolder[i_traveller.GetFormationID()]->LeaderMovedInEvade(); + if(i_traveller.IsFormationLeader() && !i_traveller.isInCombat() && + CreatureGroupHolder.find(i_traveller.GetFormationID()) != CreatureGroupHolder.end()) + CreatureGroupHolder[i_traveller.GetFormationID()]->LeaderMovedInEvade(); - i_traveller.AI_SendMoveToPacket(x, y, z, t, i_traveller.GetUnitMovementFlags(), 0); + i_traveller.AI_SendMoveToPacket(x, y, z, t, i_traveller.GetUnitMovementFlags(), 0); } // specialization for players diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index a68c93c909c..234922f040e 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -478,9 +478,9 @@ void Unit::GetRandomContactPoint( const Unit* obj, float &x, float &y, float &z, // sLog.outError("Creature entry %u has invalid combat_reach", ((Creature*)this)->GetEntry()); combat_reach = DEFAULT_COMBAT_REACH; } - uint32 attacker_number = getAttackers().size(); + uint32 attacker_number = getAttackers().size(); if(attacker_number > 0) --attacker_number; - GetNearPoint(obj,x,y,z,obj->GetCombatReach(), distance2dMin+(distance2dMax-distance2dMin)*rand_norm() + GetNearPoint(obj,x,y,z,obj->GetCombatReach(), distance2dMin+(distance2dMax-distance2dMin)*rand_norm() , GetAngle(obj) + (attacker_number ? (M_PI/2 - M_PI * rand_norm()) * (float)attacker_number / combat_reach / 3 : 0)); } @@ -600,34 +600,34 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa //Script Event damage taken if( pVictim->GetTypeId()== TYPEID_UNIT && ((Creature *)pVictim)->AI() ) - { - ((Creature *)pVictim)->AI()->DamageTaken(this, damage); + { + ((Creature *)pVictim)->AI()->DamageTaken(this, damage); - // Set tagging - if(!pVictim->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_OTHER_TAGGER) && !((Creature*)pVictim)->isPet()) - { - //Set Loot - switch(GetTypeId()) - { - case TYPEID_PLAYER: - { - ((Creature *)pVictim)->SetLootRecipient(this); - //Set tagged - ((Creature *)pVictim)->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_OTHER_TAGGER); - break; - } - case TYPEID_UNIT: - { - if(((Creature*)this)->isPet()) - { - ((Creature *)pVictim)->SetLootRecipient(this->GetOwner()); - ((Creature *)pVictim)->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_OTHER_TAGGER); - } - break; - } - } - } - } + // Set tagging + if(!pVictim->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_OTHER_TAGGER) && !((Creature*)pVictim)->isPet()) + { + //Set Loot + switch(GetTypeId()) + { + case TYPEID_PLAYER: + { + ((Creature *)pVictim)->SetLootRecipient(this); + //Set tagged + ((Creature *)pVictim)->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_OTHER_TAGGER); + break; + } + case TYPEID_UNIT: + { + if(((Creature*)this)->isPet()) + { + ((Creature *)pVictim)->SetLootRecipient(this->GetOwner()); + ((Creature *)pVictim)->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_OTHER_TAGGER); + } + break; + } + } + } + } if (damagetype != NODAMAGE) { @@ -3578,7 +3578,7 @@ uint32 Unit::GetWeaponSkillValue (WeaponAttackType attType, Unit const* target) if(attType != BASE_ATTACK && !item ) { if(attType == RANGED_ATTACK && getClass() == CLASS_PALADIN) //hammer - return GetMaxSkillValueForLevel(); + return GetMaxSkillValueForLevel(); return 0; } @@ -4096,7 +4096,7 @@ int32 Unit::GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_ for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i) { Modifier* mod = (*i)->GetModifier(); - int32 amount = (*i)->GetModifierValue(); + int32 amount = (*i)->GetModifierValue(); if (mod->m_miscvalue == misc_value && amount < modifier) modifier = amount; } @@ -4137,9 +4137,9 @@ bool Unit::AddAura(Aura *Aur) // replace aura if next will > spell StackAmount if(aurSpellInfo->StackAmount) { - Aur->SetStackAmount(i->second->GetStackAmount()); - if(Aur->GetStackAmount() < aurSpellInfo->StackAmount) - Aur->SetStackAmount(Aur->GetStackAmount()+1); + Aur->SetStackAmount(i->second->GetStackAmount()); + if(Aur->GetStackAmount() < aurSpellInfo->StackAmount) + Aur->SetStackAmount(Aur->GetStackAmount()+1); RemoveAura(i,AURA_REMOVE_BY_STACK); } // if StackAmount==0 not allow auras from same caster @@ -4509,27 +4509,27 @@ void Unit::RemoveAurasWithDispelType( DispelType type ) void Unit::RemoveSingleAuraFromStackByDispel(uint32 spellId) { - for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); ) + for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); ) { Aura *aur = iter->second; if (aur->GetId() == spellId) { - if(iter->second->GetStackAmount() > 1) + if(iter->second->GetStackAmount() > 1) { // reapply modifier with reduced stack amount iter->second->ApplyModifier(false,true); - iter->second->SetStackAmount(iter->second->GetStackAmount()-1); + iter->second->SetStackAmount(iter->second->GetStackAmount()-1); iter->second->ApplyModifier(true,true); iter->second->UpdateSlotCounterAndDuration(); return; // not remove aura if stack amount > 1 } - else + else RemoveAura(iter,AURA_REMOVE_BY_DISPEL); - } - else - ++iter; - } + } + else + ++iter; + } } void Unit::RemoveSingleAuraFromStack(uint32 spellId, uint32 effindex) @@ -4537,18 +4537,18 @@ void Unit::RemoveSingleAuraFromStack(uint32 spellId, uint32 effindex) AuraMap::iterator iter = m_Auras.find(spellEffectPair(spellId, effindex)); if(iter != m_Auras.end()) { - if(iter->second->GetStackAmount() > 1) + if(iter->second->GetStackAmount() > 1) { // reapply modifier with reduced stack amount iter->second->ApplyModifier(false,true); - iter->second->SetStackAmount(iter->second->GetStackAmount()-1); + iter->second->SetStackAmount(iter->second->GetStackAmount()-1); iter->second->ApplyModifier(true,true); iter->second->UpdateSlotCounterAndDuration(); return; // not remove aura if stack amount > 1 } RemoveAura(iter); - } + } } void Unit::RemoveAurasDueToSpell(uint32 spellId, Aura* except) @@ -4704,7 +4704,7 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) assert(!Aur->IsInUse()); Aur->ApplyModifier(false,true); - Aur->SetStackAmount(0); + Aur->SetStackAmount(0); Aur->_RemoveAura(); @@ -8693,22 +8693,22 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 switch(spellProto->SpellFamilyName) { - case SPELLFAMILY_GENERIC: - // Siphon Essence - 0% - if(spellProto->AttributesEx == 268435456 && spellProto->SpellIconID == 2027) - { - CastingTime = 0; - } - // Goblin Rocket Launcher - 0% - else if (spellProto->SpellIconID == 184 && spellProto->Attributes == 4259840) - { - CastingTime = 0; - } - // Darkmoon Card: Vengeance - 0.1% - else if (spellProto->SpellVisual == 9850 && spellProto->SpellIconID == 2230) - { - CastingTime = 3.5; - } + case SPELLFAMILY_GENERIC: + // Siphon Essence - 0% + if(spellProto->AttributesEx == 268435456 && spellProto->SpellIconID == 2027) + { + CastingTime = 0; + } + // Goblin Rocket Launcher - 0% + else if (spellProto->SpellIconID == 184 && spellProto->Attributes == 4259840) + { + CastingTime = 0; + } + // Darkmoon Card: Vengeance - 0.1% + else if (spellProto->SpellVisual == 9850 && spellProto->SpellIconID == 2230) + { + CastingTime = 3.5; + } case SPELLFAMILY_MAGE: // Ignite - do not modify, it is (8*Rank)% damage of procing Spell if(spellProto->Id==12654) @@ -9139,7 +9139,7 @@ uint32 Unit::SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, if (spellProto->Id == 15290 || spellProto->Id == 39373 || spellProto->Id == 33778 || spellProto->Id == 379 || spellProto->Id == 38395 || spellProto->Id == 40972 || - spellProto->Id == 22845 || spellProto->Id == 33504 || + spellProto->Id == 22845 || spellProto->Id == 33504 || spellProto->Id == 34299) return healamount; @@ -9244,12 +9244,12 @@ uint32 Unit::SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, DotFactor = damagetype == DOT ? 0.705f : 1.0f; CastingTime = damagetype == DOT ? 3500 : 1010; } - // Improved Leader of the Pack - else if (spellProto->AttributesEx2 == 536870912 && spellProto->SpellIconID == 312 - && spellProto->AttributesEx3 == 33554432) - { - CastingTime = 0; - } + // Improved Leader of the Pack + else if (spellProto->AttributesEx2 == 536870912 && spellProto->SpellIconID == 312 + && spellProto->AttributesEx3 == 33554432) + { + CastingTime = 0; + } break; case SPELLFAMILY_PRIEST: // Holy Nova - 14% diff --git a/src/game/Unit.h b/src/game/Unit.h index 4edbd4eb2ac..7050121c5bb 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1105,7 +1105,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject void RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); void RemoveAura(uint32 spellId, uint32 effindex, Aura* except = NULL); void RemoveSingleAuraFromStackByDispel(uint32 spellId); - void RemoveSingleAuraFromStack(uint32 spellId, uint32 effindex); + void RemoveSingleAuraFromStack(uint32 spellId, uint32 effindex); void RemoveAurasDueToSpell(uint32 spellId, Aura* except = NULL); void RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId); void RemoveAurasDueToCasterSpell(uint32 spellId, uint64 guid); diff --git a/src/game/WaypointManager.cpp b/src/game/WaypointManager.cpp index b5a83422ef5..8a9de3849c4 100644 --- a/src/game/WaypointManager.cpp +++ b/src/game/WaypointManager.cpp @@ -29,7 +29,7 @@ WaypointStore WaypointMgr; void WaypointStore::Free() { - waypoint_map.clear(); + waypoint_map.clear(); } void WaypointStore::Load() @@ -41,10 +41,10 @@ void WaypointStore::Load() exit(1); // Stop server at loading non exited table or not accessable table } - records = (*result)[0].GetUInt32(); + records = (*result)[0].GetUInt32(); delete result; - result = WorldDatabase.PQuery("SELECT `id`,`point`,`position_x`,`position_y`,`position_z`,`move_flag`,`delay`,`action`,`action_chance` FROM `waypoint_data` ORDER BY `id`, `point`"); + result = WorldDatabase.PQuery("SELECT `id`,`point`,`position_x`,`position_y`,`position_z`,`move_flag`,`delay`,`action`,`action_chance` FROM `waypoint_data` ORDER BY `id`, `point`"); if(!result) { sLog.outErrorDb("The table `creature_addon` is empty or corrupted"); @@ -54,21 +54,21 @@ void WaypointStore::Load() WaypointPath* path_data; uint32 total_records = result->GetRowCount(); - barGoLink bar( total_records); + barGoLink bar( total_records); Field *fields; uint32 last_id = 0; - do + do { fields = result->Fetch(); uint32 id = fields[0].GetUInt32(); bar.step(); WaypointData *wp = new WaypointData; - if(last_id != id) - path_data = new WaypointPath; + if(last_id != id) + path_data = new WaypointPath; - float x,y,z; + float x,y,z; x = fields[2].GetFloat(); y = fields[3].GetFloat(); z = fields[4].GetFloat(); @@ -85,14 +85,14 @@ void WaypointStore::Load() wp->event_id = fields[7].GetUInt32(); wp->event_chance = fields[8].GetUInt8(); - path_data->push_back(wp); + path_data->push_back(wp); - if(id != last_id) - waypoint_map[id] = path_data; + if(id != last_id) + waypoint_map[id] = path_data; - last_id = id; + last_id = id; - } while(result->NextRow()) ; + } while(result->NextRow()) ; delete result; @@ -101,35 +101,35 @@ void WaypointStore::Load() void WaypointStore::UpdatePath(uint32 id) { - if(waypoint_map.find(id)!= waypoint_map.end()) - waypoint_map[id]->clear(); + if(waypoint_map.find(id)!= waypoint_map.end()) + waypoint_map[id]->clear(); - QueryResult *result; + QueryResult *result; result = WorldDatabase.PQuery("SELECT `id`,`point`,`position_x`,`position_y`,`position_z`,`move_flag`,`delay`,`action`,`action_chance` FROM `waypoint_data` WHERE id = %u ORDER BY `point`", id); - if(!result) - return; + if(!result) + return; - WaypointPath* path_data; + WaypointPath* path_data; - path_data = new WaypointPath; + path_data = new WaypointPath; - Field *fields; + Field *fields; - do + do { - fields = result->Fetch(); + fields = result->Fetch(); uint32 id = fields[0].GetUInt32(); WaypointData *wp = new WaypointData; - float x,y,z; + float x,y,z; x = fields[2].GetFloat(); y = fields[3].GetFloat(); z = fields[4].GetFloat(); - Trinity::NormalizeMapCoord(x); + Trinity::NormalizeMapCoord(x); Trinity::NormalizeMapCoord(y); wp->id = fields[1].GetUInt32(); @@ -141,11 +141,11 @@ void WaypointStore::UpdatePath(uint32 id) wp->event_id = fields[7].GetUInt32(); wp->event_chance = fields[8].GetUInt8(); - path_data->push_back(wp); + path_data->push_back(wp); - }while (result->NextRow()); + }while (result->NextRow()); - waypoint_map[id] = path_data; + waypoint_map[id] = path_data; - delete result; + delete result; } diff --git a/src/game/WaypointManager.h b/src/game/WaypointManager.h index 023fa590961..2e1ac25c369 100644 --- a/src/game/WaypointManager.h +++ b/src/game/WaypointManager.h @@ -25,7 +25,7 @@ struct WaypointData { - uint32 id; + uint32 id; float x,y,z; bool run; uint32 delay; @@ -39,21 +39,21 @@ extern UNORDERED_MAP waypoint_map; class WaypointStore { private : - uint32 records; + uint32 records; - public: + public: void UpdatePath(uint32 id); - void Load(); + void Load(); void Free(); WaypointPath* GetPath(uint32 id) { - if(waypoint_map.find(id) != waypoint_map.end()) + if(waypoint_map.find(id) != waypoint_map.end()) return waypoint_map[id]; - else return 0; - } + else return 0; + } - inline uint32 GetRecordsCount() { return records; } + inline uint32 GetRecordsCount() { return records; } }; extern WaypointStore WaypointMgr; diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index a817c75bff1..5a3b1eee8e2 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -62,14 +62,14 @@ bool WaypointMovementGenerator::GetDestination(float &x, float &y, flo template<> bool WaypointMovementGenerator::GetDestination(float &x, float &y, float &z) const { - return false; + return false; } template<> void WaypointMovementGenerator::Reset(Creature &unit) { - StopedByPlayer = true; - i_nextMoveTime.Reset(0); + StopedByPlayer = true; + i_nextMoveTime.Reset(0); } template<> @@ -78,16 +78,16 @@ void WaypointMovementGenerator::Reset(Player &unit){} template<> void WaypointMovementGenerator::InitTraveller(Creature &unit, const WaypointData &node) { - node.run ? unit.RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE): - unit.AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + node.run ? unit.RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE): + unit.AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - unit.SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - unit.SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + unit.SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); + unit.SetUInt32Value(UNIT_FIELD_BYTES_1, 0); if(unit.canFly()) - unit.AddUnitMovementFlag(MOVEMENTFLAG_FLYING2); + unit.AddUnitMovementFlag(MOVEMENTFLAG_FLYING2); - unit.addUnitState(UNIT_STAT_ROAMING); + unit.addUnitState(UNIT_STAT_ROAMING); } template<> @@ -101,13 +101,13 @@ WaypointMovementGenerator::Initialize(Creature &u) if(!path_id) path_id = u.GetWaypointPath(); waypoints = WaypointMgr.GetPath(path_id); - i_currentNode = 0; + i_currentNode = 0; if(waypoints && waypoints->size()) { node = waypoints->front(); Traveller traveller(u); - InitTraveller(u, *node); - i_destinationHolder.SetDestination(traveller, node->x, node->y, node->z); + InitTraveller(u, *node); + i_destinationHolder.SetDestination(traveller, node->x, node->y, node->z); i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime()); } else @@ -121,7 +121,7 @@ template bool WaypointMovementGenerator::Update(T &unit, const uint32 &diff) { - return false; + return false; } template<> @@ -131,84 +131,84 @@ WaypointMovementGenerator::Update(Creature &unit, const uint32 &diff) if(!&unit) return true; - if(!path_id) - return false; + if(!path_id) + return false; - // Waypoint movement can be switched on/off + // Waypoint movement can be switched on/off // This is quite handy for escort quests and other stuff - if(unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED)) - return true; + if(unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED)) + return true; // Clear the generator if the path doesn't exist if(!waypoints || !waypoints->size()) return false; - Traveller traveller(unit); + Traveller traveller(unit); - i_nextMoveTime.Update(diff); + i_nextMoveTime.Update(diff); i_destinationHolder.UpdateTraveller(traveller, diff, false, true); - if(i_nextMoveTime.Passed()) - { - if(unit.IsStopped()) - { - if(StopedByPlayer) - { + if(i_nextMoveTime.Passed()) + { + if(unit.IsStopped()) + { + if(StopedByPlayer) + { assert(node); - InitTraveller(unit, *node); - i_destinationHolder.SetDestination(traveller, node->x, node->y, node->z); - i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime()); - StopedByPlayer = false; - return true; - } + InitTraveller(unit, *node); + i_destinationHolder.SetDestination(traveller, node->x, node->y, node->z); + i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime()); + StopedByPlayer = false; + return true; + } - if(i_currentNode == waypoints->size() - 1) //If that's our last waypoint - { - if(repeating) //If the movement is repeating - i_currentNode = 0; //Start moving all over again - else - { - unit.SetHomePosition(node->x, node->y, node->z, unit.GetOrientation()); - unit.GetMotionMaster()->Initialize(); - return false; //Clear the waypoint movement - } - } - else - i_currentNode++; + if(i_currentNode == waypoints->size() - 1) //If that's our last waypoint + { + if(repeating) //If the movement is repeating + i_currentNode = 0; //Start moving all over again + else + { + unit.SetHomePosition(node->x, node->y, node->z, unit.GetOrientation()); + unit.GetMotionMaster()->Initialize(); + return false; //Clear the waypoint movement + } + } + else + i_currentNode++; - node = waypoints->at(i_currentNode); - InitTraveller(unit, *node); - i_destinationHolder.SetDestination(traveller, node->x, node->y, node->z); - i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime()); - } - else - { - //Determine waittime - if(node->delay) - i_nextMoveTime.Reset(node->delay); + node = waypoints->at(i_currentNode); + InitTraveller(unit, *node); + i_destinationHolder.SetDestination(traveller, node->x, node->y, node->z); + i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime()); + } + else + { + //Determine waittime + if(node->delay) + i_nextMoveTime.Reset(node->delay); - if(node->event_id && rand()%100 < node->event_chance) - sWorld.ScriptsStart(sWaypointScripts, node->event_id, &unit, NULL); + if(node->event_id && rand()%100 < node->event_chance) + sWorld.ScriptsStart(sWaypointScripts, node->event_id, &unit, NULL); - MovementInform(unit); - unit.UpdateWaypointID(i_currentNode); - unit.clearUnitState(UNIT_STAT_MOVING); - unit.Relocate(node->x, node->y, node->z); - } + MovementInform(unit); + unit.UpdateWaypointID(i_currentNode); + unit.clearUnitState(UNIT_STAT_MOVING); + unit.Relocate(node->x, node->y, node->z); + } } - else - { - if(unit.IsStopped() && !i_destinationHolder.HasArrived()) - { - if(!StopedByPlayer) - { - i_destinationHolder.IncreaseTravelTime(STOP_TIME_FOR_PLAYER); - i_nextMoveTime.Reset(STOP_TIME_FOR_PLAYER); - StopedByPlayer = true; - } - } - } - return true; + else + { + if(unit.IsStopped() && !i_destinationHolder.HasArrived()) + { + if(!StopedByPlayer) + { + i_destinationHolder.IncreaseTravelTime(STOP_TIME_FOR_PLAYER); + i_nextMoveTime.Reset(STOP_TIME_FOR_PLAYER); + StopedByPlayer = true; + } + } + } + return true; } template void WaypointMovementGenerator::Initialize(Player &); diff --git a/src/game/WaypointMovementGenerator.h b/src/game/WaypointMovementGenerator.h index 7f8ce929ade..b8f72bb5dbf 100644 --- a/src/game/WaypointMovementGenerator.h +++ b/src/game/WaypointMovementGenerator.h @@ -65,23 +65,23 @@ template class TRINITY_DLL_SPEC WaypointMovementGenerator : public MovementGeneratorMedium< T, WaypointMovementGenerator >, public PathMovementBase { - public: - WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true) : - i_nextMoveTime(0), path_id(_path_id), repeating(_repeating), StopedByPlayer(false), node(NULL) {} + public: + WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true) : + i_nextMoveTime(0), path_id(_path_id), repeating(_repeating), StopedByPlayer(false), node(NULL) {} - void Initialize(T &); + void Initialize(T &); void Finalize(T &); - void MovementInform(T &); - void InitTraveller(T &, const WaypointData &); - void GeneratePathId(T &); - void Reset(T &unit); + void MovementInform(T &); + void InitTraveller(T &, const WaypointData &); + void GeneratePathId(T &); + void Reset(T &unit); bool Update(T &, const uint32 &); - bool GetDestination(float &x, float &y, float &z) const; - MovementGeneratorType GetMovementGeneratorType() { return WAYPOINT_MOTION_TYPE; } + bool GetDestination(float &x, float &y, float &z) const; + MovementGeneratorType GetMovementGeneratorType() { return WAYPOINT_MOTION_TYPE; } - private: - WaypointData *node; - uint32 path_id; + private: + WaypointData *node; + uint32 path_id; TimeTrackerSmall i_nextMoveTime; WaypointPath *waypoints; bool repeating, StopedByPlayer; @@ -112,7 +112,7 @@ public PathMovementBase inline bool HasArrived() const { return (i_currentNode >= i_path.Size()); } void SetCurrentNodeAfterTeleport(); void SkipCurrentNode() { ++i_currentNode; } - bool GetDestination(float& x, float& y, float& z) const { i_destinationHolder.GetDestination(x,y,z); return true; } + bool GetDestination(float& x, float& y, float& z) const { i_destinationHolder.GetDestination(x,y,z); return true; } }; #endif diff --git a/src/game/World.cpp b/src/game/World.cpp index 95acb99fef7..e494d041b5f 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -72,7 +72,7 @@ volatile bool World::m_stopEvent = false; uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE; volatile uint32 World::m_worldLoopCounter = 0; -float World::m_MaxVisibleDistance = DEFAULT_VISIBILITY_DISTANCE; +float World::m_MaxVisibleDistance = DEFAULT_VISIBILITY_DISTANCE; float World::m_MaxVisibleDistanceForCreature = DEFAULT_VISIBILITY_DISTANCE; float World::m_MaxVisibleDistanceForPlayer = DEFAULT_VISIBILITY_DISTANCE; float World::m_MaxVisibleDistanceForObject = DEFAULT_VISIBILITY_DISTANCE; @@ -409,7 +409,7 @@ void World::LoadConfigSettings(bool reload) SetPlayerLimit( sConfig.GetIntDefault("PlayerLimit", DEFAULT_PLAYER_LIMIT), true ); SetMotd( sConfig.GetStringDefault("Motd", "Welcome to the Massive Network Game Object Server." ) ); - ///- Get string for new logins (newly created characters) + ///- Get string for new logins (newly created characters) SetNewCharString(sConfig.GetStringDefault("PlayerStart.String", "")); ///- Send server info on login? @@ -1283,10 +1283,10 @@ void World::SetInitialWorldSettings() sLog.outString( "Loading Waypoints..." ); WaypointMgr.Load(); - sLog.outString( "Loading Creature Formations..." ); - formation_mgr.LoadCreatureFormations(); + sLog.outString( "Loading Creature Formations..." ); + formation_mgr.LoadCreatureFormations(); - sLog.outString( "Loading GM tickets..."); + sLog.outString( "Loading GM tickets..."); ticketmgr.LoadGMTickets(); ///- Handle outdated emails (delete/return) @@ -1300,7 +1300,7 @@ void World::SetInitialWorldSettings() objmgr.LoadSpellScripts(); // must be after load Creature/Gameobject(Template/Data) objmgr.LoadGameObjectScripts(); // must be after load Creature/Gameobject(Template/Data) objmgr.LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data) - objmgr.LoadWaypointScripts(); + objmgr.LoadWaypointScripts(); sLog.outString( "Loading Scripts text locales..." ); // must be after Load*Scripts calls objmgr.LoadDbScriptStrings(); @@ -1362,8 +1362,8 @@ void World::SetInitialWorldSettings() sLog.outString( "Loading Transports..." ); MapManager::Instance().LoadTransports(); - sLog.outString( "Loading Transports Events..." ); - objmgr.LoadTransportEvents(); + sLog.outString( "Loading Transports Events..." ); + objmgr.LoadTransportEvents(); sLog.outString("Deleting expired bans..." ); LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate"); @@ -1660,7 +1660,7 @@ void World::ScriptsStart(ScriptMapMap const& scripts, uint32 id, Object* source, return; // prepare static data - uint64 sourceGUID = source ? source->GetGUID() : (uint64)0; //some script commands doesn't have source + uint64 sourceGUID = source ? source->GetGUID() : (uint64)0; //some script commands doesn't have source uint64 targetGUID = target ? target->GetGUID() : (uint64)0; uint64 ownerGUID = (source->GetTypeId()==TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : (uint64)0; @@ -1743,22 +1743,22 @@ void World::ScriptsProcess() source = HashMapHolder::Find(step.sourceGUID); break; case HIGHGUID_GAMEOBJECT: - source = HashMapHolder::Find(step.sourceGUID); + source = HashMapHolder::Find(step.sourceGUID); break; case HIGHGUID_CORPSE: source = HashMapHolder::Find(step.sourceGUID); break; - case HIGHGUID_MO_TRANSPORT: - for (MapManager::TransportSet::iterator iter = MapManager::Instance().m_Transports.begin(); iter != MapManager::Instance().m_Transports.end(); ++iter) - { - if((*iter)->GetGUID() == step.sourceGUID) - { - source = reinterpret_cast(*iter); - break; - } - } - break; - default: + case HIGHGUID_MO_TRANSPORT: + for (MapManager::TransportSet::iterator iter = MapManager::Instance().m_Transports.begin(); iter != MapManager::Instance().m_Transports.end(); ++iter) + { + if((*iter)->GetGUID() == step.sourceGUID) + { + source = reinterpret_cast(*iter); + break; + } + } + break; + default: sLog.outError("*_script source with unsupported high guid value %u",GUID_HIPART(step.sourceGUID)); break; } @@ -2300,9 +2300,9 @@ void World::ScriptsProcess() break; } - case SCRIPT_COMMAND_LOAD_PATH: - { - if(!source) + case SCRIPT_COMMAND_LOAD_PATH: + { + if(!source) { sLog.outError("SCRIPT_COMMAND_START_MOVE is tried to apply to NON-existing unit."); break; @@ -2314,98 +2314,98 @@ void World::ScriptsProcess() break; } - if(!WaypointMgr.GetPath(step.script->datalong)) - { + if(!WaypointMgr.GetPath(step.script->datalong)) + { sLog.outError("SCRIPT_COMMAND_START_MOVE source mover has an invallid path, skipping.", step.script->datalong2); break; } - dynamic_cast(source)->GetMotionMaster()->MovePath(step.script->datalong, step.script->datalong2); - break; - } + dynamic_cast(source)->GetMotionMaster()->MovePath(step.script->datalong, step.script->datalong2); + break; + } - case SCRIPT_COMMAND_CALLSCRIPT_TO_UNIT: - { - if(!step.script->datalong || !step.script->datalong2) - { - sLog.outError("SCRIPT_COMMAND_CALLSCRIPT calls invallid db_script_id or lowguid not present: skipping."); - break; - } - //our target - Creature* target = NULL; + case SCRIPT_COMMAND_CALLSCRIPT_TO_UNIT: + { + if(!step.script->datalong || !step.script->datalong2) + { + sLog.outError("SCRIPT_COMMAND_CALLSCRIPT calls invallid db_script_id or lowguid not present: skipping."); + break; + } + //our target + Creature* target = NULL; - if(source) //using grid searcher - { - CellPair p(Trinity::ComputeCellPair(((Unit*)source)->GetPositionX(), ((Unit*)source)->GetPositionY())); - Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; + if(source) //using grid searcher + { + CellPair p(Trinity::ComputeCellPair(((Unit*)source)->GetPositionX(), ((Unit*)source)->GetPositionY())); + Cell cell(p); + cell.data.Part.reserved = ALL_DISTRICT; - //sLog.outDebug("Attempting to find Creature: Db GUID: %i", step.script->datalong); - Trinity::CreatureWithDbGUIDCheck target_check(((Unit*)source), step.script->datalong); - Trinity::CreatureSearcher checker(target,target_check); + //sLog.outDebug("Attempting to find Creature: Db GUID: %i", step.script->datalong); + Trinity::CreatureWithDbGUIDCheck target_check(((Unit*)source), step.script->datalong); + Trinity::CreatureSearcher checker(target,target_check); - TypeContainerVisitor, GridTypeMapContainer > unit_checker(checker); - CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, unit_checker, *(((Unit*)source)->GetMap())); - } - else //check hashmap holders - { - if(CreatureData const* data = objmgr.GetCreatureData(step.script->datalong)) - target = ObjectAccessor::GetObjectInWorld(data->mapid, data->posX, data->posY, MAKE_NEW_GUID(step.script->datalong, data->id, HIGHGUID_UNIT), target); - } - //sLog.outDebug("attempting to pass target..."); - if(!target) - break; - //sLog.outDebug("target passed"); - //Lets choose our ScriptMap map - ScriptMapMap *datamap = NULL; - switch(step.script->dataint) - { - case 1://QUEST END SCRIPTMAP - datamap = &sQuestEndScripts; - break; - case 2://QUEST START SCRIPTMAP - datamap = &sQuestStartScripts; - break; - case 3://SPELLS SCRIPTMAP - datamap = &sSpellScripts; - break; - case 4://GAMEOBJECTS SCRIPTMAP - datamap = &sGameObjectScripts; - break; - case 5://EVENTS SCRIPTMAP - datamap = &sEventScripts; - break; - case 6://WAYPOINTS SCRIPTMAP - datamap = &sWaypointScripts; - break; - default: - sLog.outError("SCRIPT_COMMAND_CALLSCRIPT ERROR: no scriptmap present... ignoring"); - break; - } - //if no scriptmap present... - if(!datamap) - break; + TypeContainerVisitor, GridTypeMapContainer > unit_checker(checker); + CellLock cell_lock(cell, p); + cell_lock->Visit(cell_lock, unit_checker, *(((Unit*)source)->GetMap())); + } + else //check hashmap holders + { + if(CreatureData const* data = objmgr.GetCreatureData(step.script->datalong)) + target = ObjectAccessor::GetObjectInWorld(data->mapid, data->posX, data->posY, MAKE_NEW_GUID(step.script->datalong, data->id, HIGHGUID_UNIT), target); + } + //sLog.outDebug("attempting to pass target..."); + if(!target) + break; + //sLog.outDebug("target passed"); + //Lets choose our ScriptMap map + ScriptMapMap *datamap = NULL; + switch(step.script->dataint) + { + case 1://QUEST END SCRIPTMAP + datamap = &sQuestEndScripts; + break; + case 2://QUEST START SCRIPTMAP + datamap = &sQuestStartScripts; + break; + case 3://SPELLS SCRIPTMAP + datamap = &sSpellScripts; + break; + case 4://GAMEOBJECTS SCRIPTMAP + datamap = &sGameObjectScripts; + break; + case 5://EVENTS SCRIPTMAP + datamap = &sEventScripts; + break; + case 6://WAYPOINTS SCRIPTMAP + datamap = &sWaypointScripts; + break; + default: + sLog.outError("SCRIPT_COMMAND_CALLSCRIPT ERROR: no scriptmap present... ignoring"); + break; + } + //if no scriptmap present... + if(!datamap) + break; - uint32 script_id = step.script->datalong2; - //delete iter and return it to begin pos(next one) - m_scriptSchedule.erase(iter); - iter = m_scriptSchedule.begin(); + uint32 script_id = step.script->datalong2; + //delete iter and return it to begin pos(next one) + m_scriptSchedule.erase(iter); + iter = m_scriptSchedule.begin(); - ScriptsStart(*datamap, script_id, target, NULL); - return; - } + ScriptsStart(*datamap, script_id, target, NULL); + return; + } - case SCRIPT_COMMAND_PLAYSOUND: - { - if(!source) - break; - //datalong sound_id, datalong2 onlyself - ((WorldObject*)source)->SendPlaySound(step.script->datalong, step.script->datalong2); - break; - } + case SCRIPT_COMMAND_PLAYSOUND: + { + if(!source) + break; + //datalong sound_id, datalong2 onlyself + ((WorldObject*)source)->SendPlaySound(step.script->datalong, step.script->datalong2); + break; + } - default: + default: sLog.outError("Unknown script command %u called.",step.script->command); break; } diff --git a/src/game/World.h b/src/game/World.h index 63d9b52d7f2..502f403d130 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -199,7 +199,7 @@ enum WorldConfigs CONFIG_SHOW_KICK_IN_WORLD, CONFIG_INTERVAL_LOG_UPDATE, CONFIG_MIN_LOG_UPDATE, - CONFIG_ENABLE_SINFO_LOGIN, + CONFIG_ENABLE_SINFO_LOGIN, CONFIG_VALUE_COUNT }; @@ -327,9 +327,9 @@ enum RealmZone #define SCRIPT_COMMAND_ACTIVATE_OBJECT 13 // source = unit, target=GO #define SCRIPT_COMMAND_REMOVE_AURA 14 // source (datalong2!=0) or target (datalong==0) unit, datalong = spell_id #define SCRIPT_COMMAND_CAST_SPELL 15 // source (datalong2!=0) or target (datalong==0) unit, datalong = spell_id -#define SCRIPT_COMMAND_LOAD_PATH 16 // source = unit, path = datalong, repeatable datalong2 -#define SCRIPT_COMMAND_CALLSCRIPT_TO_UNIT 17 // datalong scriptid, lowguid datalong2, dataint table -#define SCRIPT_COMMAND_PLAYSOUND 18 // datalong soundid, datalong2 play only self +#define SCRIPT_COMMAND_LOAD_PATH 16 // source = unit, path = datalong, repeatable datalong2 +#define SCRIPT_COMMAND_CALLSCRIPT_TO_UNIT 17 // datalong scriptid, lowguid datalong2, dataint table +#define SCRIPT_COMMAND_PLAYSOUND 18 // datalong soundid, datalong2 play only self /// Storage class for commands issued for delayed execution @@ -402,7 +402,7 @@ class World /// Get the current Message of the Day const char* GetMotd() const { return m_motd.c_str(); } - /// Set the string for new characters (first login) + /// Set the string for new characters (first login) void SetNewCharString(std::string str) { m_newCharString = str; } /// Get the string for new characters (first login) const std::string& GetNewCharString() const { return m_newCharString; } @@ -552,7 +552,7 @@ class World std::multimap m_scriptSchedule; - std::string m_newCharString; + std::string m_newCharString; float rate_values[MAX_RATES]; uint32 m_configs[CONFIG_VALUE_COUNT]; diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index bd692d5d9a7..a19e0bb7376 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -201,8 +201,8 @@ class TRINITY_DLL_SPEC WorldSession // Locales LocaleConstant GetSessionDbcLocale() const { return m_sessionDbcLocale; } - int GetSessionDbLocaleIndex() const { return m_sessionDbLocaleIndex; } - const char *GetTrinityString(int32 entry) const; + int GetSessionDbLocaleIndex() const { return m_sessionDbLocaleIndex; } + const char *GetTrinityString(int32 entry) const; uint32 GetLatency() const { return m_latency; } void SetLatency(uint32 latency) { m_latency = latency; } @@ -269,12 +269,12 @@ class TRINITY_DLL_SPEC WorldSession void HandlePlayerLogoutOpcode(WorldPacket& recvPacket); void HandleLogoutCancelOpcode(WorldPacket& recvPacket); - // GM Ticket opcodes - void HandleGMTicketCreateOpcode(WorldPacket& recvPacket); - void HandleGMTicketUpdateOpcode(WorldPacket& recvPacket); - void HandleGMTicketDeleteOpcode(WorldPacket& recvPacket); - void HandleGMTicketGetTicketOpcode(WorldPacket& recvPacket); - void HandleGMTicketSystemStatusOpcode(WorldPacket& recvPacket); + // GM Ticket opcodes + void HandleGMTicketCreateOpcode(WorldPacket& recvPacket); + void HandleGMTicketUpdateOpcode(WorldPacket& recvPacket); + void HandleGMTicketDeleteOpcode(WorldPacket& recvPacket); + void HandleGMTicketGetTicketOpcode(WorldPacket& recvPacket); + void HandleGMTicketSystemStatusOpcode(WorldPacket& recvPacket); //void HandleGMSurveySubmit(WorldPacket& recvPacket); @@ -523,7 +523,7 @@ class TRINITY_DLL_SPEC WorldSession void HandleChannelRosterQuery(WorldPacket& recvPacket); void HandleChannelInfoQuery(WorldPacket& recvPacket); void HandleChannelJoinNotify(WorldPacket& recvPacket); - void HandleChannelDeclineInvite(WorldPacket& recvPacket); + void HandleChannelDeclineInvite(WorldPacket& recvPacket); void HandleCompleteCinema(WorldPacket& recvPacket); void HandleNextCinematicCamera(WorldPacket& recvPacket); diff --git a/src/shared/Common.h b/src/shared/Common.h index 8bf60d9375e..c97de30ed46 100644 --- a/src/shared/Common.h +++ b/src/shared/Common.h @@ -170,7 +170,7 @@ enum AccountTypes SEC_MODERATOR = 1, SEC_GAMEMASTER = 2, SEC_ADMINISTRATOR = 3, - SEC_CONSOLE = 4 // must be always last in list, accounts must have less security level always also + SEC_CONSOLE = 4 // must be always last in list, accounts must have less security level always also }; enum LocaleConstant diff --git a/src/shared/WheatyExceptionReport.cpp b/src/shared/WheatyExceptionReport.cpp index 5aa4a19d583..5d365639fbf 100644 --- a/src/shared/WheatyExceptionReport.cpp +++ b/src/shared/WheatyExceptionReport.cpp @@ -606,7 +606,7 @@ bool bWriteVariables, HANDLE pThreadHandle) { _tprintf( _T("\r\nCall stack:\r\n") ); - _tprintf( _T("Address Frame Function SourceFile\r\n") ); + _tprintf( _T("Address Frame Function SourceFile\r\n") ); DWORD dwMachineType = 0; // Could use SymSetOptions here to add the SYMOPT_DEFERRED_LOADS flag @@ -908,10 +908,10 @@ char* Name) // BasicType basicType = GetBasicType(children.ChildId[i], modBase ); // - // pszCurrBuffer += sprintf( pszCurrBuffer, rgBaseType[basicType]); + // pszCurrBuffer += sprintf( pszCurrBuffer, rgBaseType[basicType]); // // Emit the variable name - // pszCurrBuffer += sprintf( pszCurrBuffer, "\'%s\'", Name ); + // pszCurrBuffer += sprintf( pszCurrBuffer, "\'%s\'", Name ); pszCurrBuffer = FormatOutputValue( pszCurrBuffer, basicType, length, (PVOID)dwFinalOffset ); diff --git a/src/shared/vmap/AABSPTree.h b/src/shared/vmap/AABSPTree.h index 5107676d48e..bc33a6699d1 100644 --- a/src/shared/vmap/AABSPTree.h +++ b/src/shared/vmap/AABSPTree.h @@ -279,11 +279,11 @@ public: /** Compares centers */ class CenterComparator { public: - Vector3::Axis sortAxis; + Vector3::Axis sortAxis; - CenterComparator(Vector3::Axis a) : sortAxis(a) {} + CenterComparator(Vector3::Axis a) : sortAxis(a) {} - inline int operator()(_AABSPTree::Handle* A, const _AABSPTree::Handle* B) const { + inline int operator()(_AABSPTree::Handle* A, const _AABSPTree::Handle* B) const { float a = A->center[sortAxis]; float b = B->center[sortAxis]; @@ -294,18 +294,18 @@ public: } else { return 0; } - } + } }; /** Compares bounds for strict >, <, or overlap*/ class BoundsComparator { public: - Vector3::Axis sortAxis; + Vector3::Axis sortAxis; - BoundsComparator(Vector3::Axis a) : sortAxis(a) {} + BoundsComparator(Vector3::Axis a) : sortAxis(a) {} - inline int operator()(_AABSPTree::Handle* A, const _AABSPTree::Handle* B) const { + inline int operator()(_AABSPTree::Handle* A, const _AABSPTree::Handle* B) const { const AABox& a = A->bounds; const AABox& b = B->bounds; @@ -316,33 +316,33 @@ public: } else { return 0; } - } + } }; /** Compares bounds to the sort location */ class Comparator { public: - Vector3::Axis sortAxis; - float sortLocation; + Vector3::Axis sortAxis; + float sortLocation; - Comparator(Vector3::Axis a, float l) : sortAxis(a), sortLocation(l) {} + Comparator(Vector3::Axis a, float l) : sortAxis(a), sortLocation(l) {} - inline int operator()(_AABSPTree::Handle* /*ignore*/, const _AABSPTree::Handle* handle) const { + inline int operator()(_AABSPTree::Handle* /*ignore*/, const _AABSPTree::Handle* handle) const { const AABox& box = handle->bounds; debugAssert(ignore == NULL); - if (box.high()[sortAxis] < sortLocation) { + if (box.high()[sortAxis] < sortLocation) { // Box is strictly below the sort location return -1; - } else if (box.low()[sortAxis] > sortLocation) { + } else if (box.low()[sortAxis] > sortLocation) { // Box is strictly above the sort location - return 1; - } else { + return 1; + } else { // Box overlaps the sort location - return 0; - } - } + return 0; + } + } }; // Using System::malloc with this class provided no speed improvement. @@ -450,42 +450,42 @@ public: } } - void verifyNode(const Vector3& lo, const Vector3& hi) { - // debugPrintf("Verifying: split %d @ %f [%f, %f, %f], [%f, %f, %f]\n", - // splitAxis, splitLocation, lo.x, lo.y, lo.z, hi.x, hi.y, hi.z); + void verifyNode(const Vector3& lo, const Vector3& hi) { + // debugPrintf("Verifying: split %d @ %f [%f, %f, %f], [%f, %f, %f]\n", + // splitAxis, splitLocation, lo.x, lo.y, lo.z, hi.x, hi.y, hi.z); debugAssert(lo == splitBounds.low()); debugAssert(hi == splitBounds.high()); - for (int i = 0; i < valueArray.length(); ++i) { - const AABox& b = valueArray[i]->bounds; + for (int i = 0; i < valueArray.length(); ++i) { + const AABox& b = valueArray[i]->bounds; debugAssert(b == boundsArray[i]); - for(int axis = 0; axis < 3; ++axis) { - debugAssert(b.low()[axis] <= b.high()[axis]); - debugAssert(b.low()[axis] >= lo[axis]); - debugAssert(b.high()[axis] <= hi[axis]); - } - } + for(int axis = 0; axis < 3; ++axis) { + debugAssert(b.low()[axis] <= b.high()[axis]); + debugAssert(b.low()[axis] >= lo[axis]); + debugAssert(b.high()[axis] <= hi[axis]); + } + } - if (child[0] || child[1]) { - debugAssert(lo[splitAxis] < splitLocation); - debugAssert(hi[splitAxis] > splitLocation); - } + if (child[0] || child[1]) { + debugAssert(lo[splitAxis] < splitLocation); + debugAssert(hi[splitAxis] > splitLocation); + } - Vector3 newLo = lo; - newLo[splitAxis] = splitLocation; - Vector3 newHi = hi; - newHi[splitAxis] = splitLocation; + Vector3 newLo = lo; + newLo[splitAxis] = splitLocation; + Vector3 newHi = hi; + newHi[splitAxis] = splitLocation; - if (child[0] != NULL) { - child[0]->verifyNode(lo, newHi); - } + if (child[0] != NULL) { + child[0]->verifyNode(lo, newHi); + } - if (child[1] != NULL) { - child[1]->verifyNode(newLo, hi); - } - } + if (child[1] != NULL) { + child[1]->verifyNode(newLo, hi); + } + } #if 0 /** @@ -735,26 +735,26 @@ public: int numMeanSplits, Array<_AABSPTree::Handle * >& temp) { - Node* node = NULL; + Node* node = NULL; - if (source.size() <= valuesPerNode) { - // Make a new leaf node - node = new Node(source); + if (source.size() <= valuesPerNode) { + // Make a new leaf node + node = new Node(source); - // Set the pointers in the memberTable - for (int i = 0; i < source.size(); ++i) { - memberTable.set(Member(source[i]), node); - } + // Set the pointers in the memberTable + for (int i = 0; i < source.size(); ++i) { + memberTable.set(Member(source[i]), node); + } source.clear(); } else { - // Make a new internal node - node = new Node(); + // Make a new internal node + node = new Node(); const AABox bounds = computeBounds(source, 0, source.size() - 1); - const Vector3 extent = bounds.high() - bounds.low(); + const Vector3 extent = bounds.high() - bounds.low(); - Vector3::Axis splitAxis = extent.primaryAxis(); + Vector3::Axis splitAxis = extent.primaryAxis(); float splitLocation; @@ -846,20 +846,20 @@ public: for (int i = 0; i < node->valueArray.size(); ++i) { _AABSPTree::Handle * v = node->valueArray[i]; node->boundsArray[i] = v->bounds; - memberTable.set(Member(v), node); + memberTable.set(Member(v), node); } if (lt.size() > 0) { - node->child[0] = makeNode(lt, valuesPerNode, numMeanSplits - 1, temp); - } + node->child[0] = makeNode(lt, valuesPerNode, numMeanSplits - 1, temp); + } - if (gt.size() > 0) { - node->child[1] = makeNode(gt, valuesPerNode, numMeanSplits - 1, temp); - } + if (gt.size() > 0) { + node->child[1] = makeNode(gt, valuesPerNode, numMeanSplits - 1, temp); + } - } + } - return node; + return node; } /** @@ -1317,51 +1317,51 @@ public: BoxIntersectionIterator& operator++() { ++nextValueArrayIndex; - bool foundIntersection = false; + bool foundIntersection = false; while (! isEnd && ! foundIntersection) { - // Search for the next node if we've exhausted this one + // Search for the next node if we've exhausted this one while ((! isEnd) && (nextValueArrayIndex >= node->valueArray.length())) { - // If we entered this loop, then the iterator has exhausted the elements at - // node (possibly because it just switched to a child node with no members). - // This loop continues until it finds a node with members or reaches - // the end of the whole intersection search. + // If we entered this loop, then the iterator has exhausted the elements at + // node (possibly because it just switched to a child node with no members). + // This loop continues until it finds a node with members or reaches + // the end of the whole intersection search. - // If the right child overlaps the box, push it onto the stack for - // processing. - if ((node->child[1] != NULL) && - (box.high()[node->splitAxis] > node->splitLocation)) { - stack.push(node->child[1]); - } + // If the right child overlaps the box, push it onto the stack for + // processing. + if ((node->child[1] != NULL) && + (box.high()[node->splitAxis] > node->splitLocation)) { + stack.push(node->child[1]); + } - // If the left child overlaps the box, push it onto the stack for - // processing. - if ((node->child[0] != NULL) && - (box.low()[node->splitAxis] < node->splitLocation)) { - stack.push(node->child[0]); - } + // If the left child overlaps the box, push it onto the stack for + // processing. + if ((node->child[0] != NULL) && + (box.low()[node->splitAxis] < node->splitLocation)) { + stack.push(node->child[0]); + } - if (stack.length() > 0) { - // Go on to the next node (which may be either one of the ones we - // just pushed, or one from farther back the tree). - node = stack.pop(); - nextValueArrayIndex = 0; - } else { - // That was the last node; we're done iterating - isEnd = true; - } - } + if (stack.length() > 0) { + // Go on to the next node (which may be either one of the ones we + // just pushed, or one from farther back the tree). + node = stack.pop(); + nextValueArrayIndex = 0; + } else { + // That was the last node; we're done iterating + isEnd = true; + } + } - // Search for the next intersection at this node until we run out of children - while (! isEnd && ! foundIntersection && (nextValueArrayIndex < node->valueArray.length())) { - if (box.intersects(node->boundsArray[nextValueArrayIndex])) { - foundIntersection = true; - } else { - ++nextValueArrayIndex; - // If we exhaust this node, we'll loop around the master loop - // to find a new node. - } - } + // Search for the next intersection at this node until we run out of children + while (! isEnd && ! foundIntersection && (nextValueArrayIndex < node->valueArray.length())) { + if (box.intersects(node->boundsArray[nextValueArrayIndex])) { + foundIntersection = true; + } else { + ++nextValueArrayIndex; + // If we exhaust this node, we'll loop around the master loop + // to find a new node. + } + } } return *this; diff --git a/src/shared/vmap/ModelContainer.cpp b/src/shared/vmap/ModelContainer.cpp index 889ba4fc9bf..4d2dc2aac78 100644 --- a/src/shared/vmap/ModelContainer.cpp +++ b/src/shared/vmap/ModelContainer.cpp @@ -68,7 +68,7 @@ namespace VMAP nSubModels += pNode.valueArray.size(); for(int i=0;i* h= pNode.valueArray[i]; + G3D::_AABSPTree::Handle* h= pNode.valueArray[i]; SubModel *m = h->value; // add the internal nodes as well nNodes += m->getNNodes(); diff --git a/src/trinitycore/Master.cpp b/src/trinitycore/Master.cpp index 75fea010337..66c1c17664e 100644 --- a/src/trinitycore/Master.cpp +++ b/src/trinitycore/Master.cpp @@ -458,7 +458,7 @@ bool Master::_StartDB() ///- Clean the database before starting clearOnlineAccounts(); - ///- Insert version info into DB + ///- Insert version info into DB WorldDatabase.PExecute("UPDATE `version` SET `core_version` = '%s', `core_revision` = '%s'", _FULLVERSION, _REVISION); sWorld.LoadDBVersion();