Adding scrypt to Objective-C project

790 views Asked by At

I want to add the SCrypt library to my XCode Objective-C project. However I am getting a very large number of error of the following type:

blkcpy(void * dest, void * src, size_t len)
{
    size_t * D = dest; //cannot initialize a variable of type size_t * (aka 'unsigned long) with an lvalue of type void *
    size_t * S = src;/cannot initialize a variable of type size_t * (aka 'unsigned long) with an lvalue of type void *
    size_t L = len / sizeof(size_t);
    size_t i;

    for (i = 0; i < L; i++)
        D[i] = S[i];
}

What do do about this? Has anybody ever added the scrypt library to XCode?

1

There are 1 answers

0
mah On

Placing the errors into your code as comments at the end isn't directly useful... would have been better to at least note what you were doing in the question to make it more clear.

You can't just assign the void pointers to other pointer types, as the errors explain. You need to do casting, such as this:

blkcpy(void * dest, void * src, size_t len)
{
    size_t * D = (size_t *)dest;
    size_t * S = (size_t *)src;
    size_t L = len / sizeof(size_t);
    size_t i;

    for (i = 0; i < L; i++)
        D[i] = S[i];
}