• R/O
  • SSH
  • HTTPS

eirrepo: Commit


Commit MetaInfo

Revision190 (tree)
Time2019-01-27 20:28:39
Authorquiret

Log Message

- some linux fixes, ugh...

Change Summary

Incremental Difference

--- common/sdk/PluginFactory.h (revision 189)
+++ common/sdk/PluginFactory.h (revision 190)
@@ -60,7 +60,7 @@
6060 inline ~AnonymousPluginStructRegistry( void )
6161 {
6262 // TODO: allow custom memory allocators.
63-
63+
6464 // The runtime is allowed to destroy with plugins still attached, so clean up.
6565 while ( this->regPlugins.GetCount() != 0 )
6666 {
@@ -453,7 +453,7 @@
453453
454454 private:
455455 // Object construction helper.
456- template <typename structType, typename classType, typename... Args>
456+ template <typename structType, typename... Args>
457457 static AINLINE structType* construct_helper( void *structMem, classType *obj, Args&&... theArgs )
458458 {
459459 if constexpr ( std::is_constructible <structType, classType*, Args...>::value )
@@ -500,7 +500,7 @@
500500
501501 // Construct the struct!
502502 // We prefer giving the class object as argument to the default constructor.
503- structType *theStruct = construct_helper <structType, classType, AdditionalArgs...> ( structMem, obj, std::forward <AdditionalArgs> ( addArgs )... );
503+ structType *theStruct = construct_helper <structType, AdditionalArgs...> ( structMem, obj, std::forward <AdditionalArgs> ( addArgs )... );
504504
505505 return ( theStruct != nullptr );
506506 }
@@ -539,7 +539,7 @@
539539 return false;
540540
541541 // Construct the struct!
542- structType *theStruct = construct_helper <structType, classType, AdditionalArgs...> ( structMem, obj, std::forward <AdditionalArgs> ( addArgs )... );
542+ structType *theStruct = construct_helper <structType, AdditionalArgs...> ( structMem, obj, std::forward <AdditionalArgs> ( addArgs )... );
543543
544544 if ( theStruct )
545545 {
@@ -794,11 +794,11 @@
794794 }
795795
796796 template <typename structPluginInterfaceType, typename... Args>
797- inline pluginOffset_t RegisterCustomPlugin( size_t pluginSize, unsigned int pluginId, Args&&... constrArgs )
797+ inline pluginOffset_t RegisterCustomPlugin( size_t pluginSize, unsigned int pluginId, Args&&... cArgs )
798798 {
799799 struct selfDeletingPlugin : public structPluginInterfaceType
800800 {
801- inline selfDeletingPlugin( StaticPluginClassFactory *fact, Args&&... constrArgs ) : structPluginInterfaceType( std::forward <Args> ( constrArgs )... )
801+ inline selfDeletingPlugin( StaticPluginClassFactory *fact, Args&&... cArgs ) : structPluginInterfaceType( std::forward <Args> ( cArgs )... )
802802 {
803803 this->fact = fact;
804804 }
@@ -813,7 +813,7 @@
813813 StaticPluginClassFactory *fact;
814814 };
815815
816- selfDeletingPlugin *pluginInfo = eir::dyn_new_struct <selfDeletingPlugin> ( this->data.allocData, this, this, std::forward <Args> ( constrArgs )... );
816+ selfDeletingPlugin *pluginInfo = eir::dyn_new_struct <selfDeletingPlugin> ( this->data.allocData, this, this, std::forward <Args> ( cArgs )... );
817817
818818 try
819819 {
@@ -914,8 +914,8 @@
914914 return resultObject;
915915 }
916916
917- template <typename allocatorType, typename constructorType>
918- inline classType* ConstructTemplate( allocatorType& memAllocator, const constructorType& constructor, constrArgs... args )
917+ template <typename subAllocatorType, typename constructorType>
918+ inline classType* ConstructTemplate( subAllocatorType& memAllocator, const constructorType& constructor, constrArgs... args )
919919 {
920920 // Attempt to allocate the necessary memory.
921921 const size_t wholeClassSize = this->GetClassSize();
@@ -936,8 +936,8 @@
936936 return resultObj;
937937 }
938938
939- template <typename allocatorType, typename... Args>
940- inline classType* ConstructArgs( allocatorType& memAllocator, Args&&... theArgs )
939+ template <typename subAllocatorType, typename... Args>
940+ inline classType* ConstructArgs( subAllocatorType& memAllocator, Args&&... theArgs )
941941 {
942942 // We try saving the arguments in a struct and then unpacking them on call
943943 // to the constructor, using C++17 std::apply!
@@ -1022,8 +1022,8 @@
10221022 return clonedObject;
10231023 }
10241024
1025- template <typename allocatorType, typename constructorType>
1026- inline classType* CloneTemplate( allocatorType& memAllocator, const classType *srcObject, const constructorType& constructor, constrArgs... args )
1025+ template <typename subAllocatorType, typename constructorType>
1026+ inline classType* CloneTemplate( subAllocatorType& memAllocator, const classType *srcObject, const constructorType& constructor, constrArgs... args )
10271027 {
10281028 // Attempt to allocate the necessary memory.
10291029 const size_t baseClassSize = sizeof( classType );
@@ -1057,8 +1057,8 @@
10571057 }
10581058 };
10591059
1060- template <typename allocatorType>
1061- inline classType* Construct( allocatorType& memAllocator, constrArgs... args )
1060+ template <typename subAllocatorType>
1061+ inline classType* Construct( subAllocatorType& memAllocator, constrArgs... args )
10621062 {
10631063 basicClassConstructor constructor;
10641064
@@ -1072,8 +1072,8 @@
10721072 return ConstructPlacementEx( memPtr, constructor, std::forward <constrArgs> ( args )... );
10731073 }
10741074
1075- template <typename allocatorType>
1076- inline classType* Clone( allocatorType& memAllocator, const classType *srcObject, constrArgs... args )
1075+ template <typename subAllocatorType>
1076+ inline classType* Clone( subAllocatorType& memAllocator, const classType *srcObject, constrArgs... args )
10771077 {
10781078 basicClassConstructor constructor;
10791079
@@ -1126,8 +1126,8 @@
11261126 this->data.aliveClasses--;
11271127 }
11281128
1129- template <typename allocatorType>
1130- inline void Destroy( allocatorType& memAllocator, classType *classObject )
1129+ template <typename subAllocatorType>
1130+ inline void Destroy( subAllocatorType& memAllocator, classType *classObject )
11311131 {
11321132 if ( classObject == nullptr )
11331133 return;
@@ -1141,18 +1141,18 @@
11411141 memAllocator.Free( this, classMem );
11421142 }
11431143
1144- template <typename allocatorType>
1144+ template <typename subAllocatorType>
11451145 struct DeferredConstructor
11461146 {
11471147 StaticPluginClassFactory *pluginRegistry;
1148- allocatorType& memAllocator;
1148+ subAllocatorType& memAllocator;
11491149
1150- inline DeferredConstructor( StaticPluginClassFactory *pluginRegistry, allocatorType& memAllocator ) : memAllocator( memAllocator )
1150+ inline DeferredConstructor( StaticPluginClassFactory *pluginRegistry, subAllocatorType& memAllocator ) : memAllocator( memAllocator )
11511151 {
11521152 this->pluginRegistry = pluginRegistry;
11531153 }
11541154
1155- inline allocatorType& GetAllocator( void )
1155+ inline subAllocatorType& GetAllocator( void )
11561156 {
11571157 return memAllocator;
11581158 }
@@ -1179,18 +1179,18 @@
11791179 }
11801180 };
11811181
1182- template <typename allocatorType>
1183- inline DeferredConstructor <allocatorType>* CreateConstructor( allocatorType& memAllocator )
1182+ template <typename subAllocatorType>
1183+ inline DeferredConstructor <subAllocatorType>* CreateConstructor( subAllocatorType& memAllocator )
11841184 {
1185- typedef DeferredConstructor <allocatorType> Constructor;
1185+ typedef DeferredConstructor <subAllocatorType> Constructor;
11861186
11871187 return eir::dyn_new_struct <Constructor> ( memAllocator, this, this, memAllocator );
11881188 }
11891189
1190- template <typename allocatorType>
1191- inline void DeleteConstructor( DeferredConstructor <allocatorType> *handle )
1190+ template <typename subAllocatorType>
1191+ inline void DeleteConstructor( DeferredConstructor <subAllocatorType> *handle )
11921192 {
1193- typedef DeferredConstructor <allocatorType> Constructor;
1193+ typedef DeferredConstructor <subAllocatorType> Constructor;
11941194
11951195 eir::dyn_del_struct <Constructor> ( handle->GetAllocator(), this, handle );
11961196 }
@@ -1217,4 +1217,4 @@
12171217 IMPL_HEAP_REDIR_METH_FREE_RETURN StaticPluginClassFactory SPCF_TEMPLUSE::spcfAllocRedir::Free IMPL_HEAP_REDIR_METH_FREE_ARGS
12181218 IMPL_HEAP_REDIR_DYN_ALLOC_METH_FREE_BODY( StaticPluginClassFactory, structRegistry, data.allocData )
12191219
1220-#endif //_EIR_PLUGIN_FACTORY_HEADER_
\ No newline at end of file
1220+#endif //_EIR_PLUGIN_FACTORY_HEADER_
--- common/sdk/eirutils.h (revision 189)
+++ common/sdk/eirutils.h (revision 190)
@@ -17,8 +17,9 @@
1717 #include <type_traits>
1818
1919 #include <cstddef>
20-#include <malloc.h>
20+#include <malloc.h>
2121
22+#include "DataUtil.h"
2223 #include "MacroUtils.h"
2324
2425 namespace eir
@@ -96,7 +97,7 @@
9697 {
9798 throw eir_exception();
9899 }
99-
100+
100101 try
101102 {
102103 return new (mem) structType( std::forward <Args> ( theArgs )... );
@@ -131,7 +132,7 @@
131132 {
132133 throw eir_exception();
133134 }
134-
135+
135136 try
136137 {
137138 return new (mem) structType( std::forward <Args> ( theArgs )... );
@@ -344,7 +345,7 @@
344345 return nullptr;
345346 }
346347
347- memcpy( newMemPtr, memPtr, oldSize );
348+ FSDataUtil::copy_impl( (const char*)memPtr, (const char*)memPtr + oldSize, (char*)newMemPtr );
348349
349350 memAlloc.Free( refPtr, memPtr );
350351
@@ -351,4 +352,4 @@
351352 return newMemPtr;
352353 }
353354
354-#endif //_EIR_COMMON_SDK_UTILITIES_
\ No newline at end of file
355+#endif //_EIR_COMMON_SDK_UTILITIES_
Show on old repository browser