Replacement for - GeAllocNC [SOLVED]
-
On 05/03/2015 at 03:13, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R16
Platform:
Language(s) : C++ ;---------
Hi Everyone,I'm looking through this article at the moment:
[URL-REMOVED]
- and I'm trying to figure out how to convert some of the code so I can get some steps closer to implementing my own licensing system. I see that there are some deprecated methods/classes in the code below and would like to know what would be the current alternative.
The thing i'm looking at is:
GeAllocNC
It looks like I need to allocate some memory so I can pass a "
Char
\*" to the GetCString, thats the bit I can't quite figure out.
`#include "c4d_md5.h"` `CHAR` `*ConvString(``const` `String& s, STRINGENCODING encoding=(STRINGENCODING)STRINGENCODING_7BIT)` `{` ` ``// Use STRINGENCODING_UTF8 as same default encoding as Python` ` ``LONG` `len = s.GetCStringLen(encoding);` ` ``CHAR` `*code = (``CHAR``* ) GeAllocNC(len+1);` ` ``if` `(!code) ``return` `NULL;` ` ``s.GetCString(code, len+1, encoding);` ` ``return` `code;` `}` `String GetMD5(``const` `String& p)` `{` ` ``DigestMD5 md5;` ` ``String key;` ` ``CHAR` `*c_str = NULL;` ` ``CHAR` `*c_tmp = NULL;` ` ``c_str = ConvString(p, STRINGENCODING_7BIT);` ` ``if` `(!c_str)` ` ``return` `String();` ` ``c_tmp = md5.get_md5hash(c_str, (unsigned ``long``)``strlen``(str));` ` ``if` `(!c_tmp)` ` ``{` ` ``GeFree(str);` ` ``return` `String();` ` ``}` ` ``key = c_tmp;` ` ``GeFree(c_str);` ` ``GeFree(c_tmp);` ` ``return` `key;` `}`
Any help greatly appreciated.
Thanks,
Adam
[URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.
-
On 05/03/2015 at 07:06, xxxxxxxx wrote:
Hi Adam,
GeAllocNC()/GeFree() have been renamed to NewMem()/DeleteMem() in R15.
-
On 05/03/2015 at 08:11, xxxxxxxx wrote:
Amazing, thanks very much.