summaryrefslogtreecommitdiff
path: root/plugins/CryptoPP/mmi.cpp
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-05-15 10:38:20 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-05-15 10:38:20 +0000
commit48540940b6c28bb4378abfeb500ec45a625b37b6 (patch)
tree2ef294c0763e802f91d868bdef4229b6868527de /plugins/CryptoPP/mmi.cpp
parent5c350913f011e119127baeb32a6aedeb4f0d33bc (diff)
initial commit
git-svn-id: http://svn.miranda-ng.org/main/trunk@2 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/CryptoPP/mmi.cpp')
-rw-r--r--plugins/CryptoPP/mmi.cpp88
1 files changed, 88 insertions, 0 deletions
diff --git a/plugins/CryptoPP/mmi.cpp b/plugins/CryptoPP/mmi.cpp
new file mode 100644
index 0000000000..03294c6017
--- /dev/null
+++ b/plugins/CryptoPP/mmi.cpp
@@ -0,0 +1,88 @@
+#include "commonheaders.h"
+
+/*
+void m_check(void *ptr, const char *module) {
+ if(ptr==NULL) {
+ char buffer[128];
+ strcpy(buffer,module); strcat(buffer,": NULL pointer detected !");
+ MessageBoxA(0,buffer,szModuleName,MB_OK|MB_ICONSTOP);
+ __asm{ int 3 };
+ exit(1);
+ }
+}
+
+
+void *m_alloc(size_t size) {
+ void *ptr;
+ ptr = malloc(size);
+ m_check(ptr,"m_alloc");
+ ZeroMemory(ptr,size);
+ return ptr;
+}
+
+
+void m_free(void *ptr) {
+// m_check(ptr,"m_free");
+ if(ptr) {
+ free(ptr);
+ }
+}
+
+
+void *m_realloc(void *ptr,size_t size) {
+ r = realloc(ptr,size);
+ m_check(ptr,"m_realloc");
+ return ptr;
+}
+
+
+#ifndef _DEBUG
+void *operator new(size_t size) {
+ return malloc(size);
+}
+#endif
+
+
+void operator delete(void *p) {
+ free(p);
+}
+
+
+void *operator new[](size_t size) {
+ return operator new(size);
+}
+
+
+void operator delete[](void *p) {
+ operator delete(p);
+}
+
+
+char *m_strdup(const char *str) {
+ if(str==NULL) return NULL;
+ int len = (int)strlen(str)+1;
+ char *dup = (char*) m_alloc(len);
+ MoveMemory((void*)dup,(void*)str,len);
+ return dup;
+}
+*/
+
+void __fastcall safe_free(void** p)
+{
+ if (*p) {
+ free(*p);
+ *p = NULL;
+ }
+}
+
+
+void __fastcall safe_delete(void** p)
+{
+ if (*p) {
+ delete(*p);
+ *p = NULL;
+ }
+}
+
+
+// EOF