I was using and compiling meflib in Visual Studio directly (so not compiling via matlab this time), and Visual studio comes up with two errors before you can compile. I though I would share the fixes, so others don't have to handle these errors before being able to use the library.
The second error that the compiler gives is potentially uninitialized local pointer variable 'key' used (on line 6620). If I follow the logic of the program, it currently should not reach that line if indeed key is not set; but the compiler gives an error because hypothetically encryption_level could get a value higher than 2 (LEVEL_2_ENCRYPTION) which would cause it to indeed use key as a uninitialized local pointer. I fixed it by added a NULL initialization for key to the existing else that precedes it.
After these fixes, it will compile in Visual Studio. Hope this helps others!
Hi Jan and Dan,
I was using and compiling meflib in Visual Studio directly (so not compiling via matlab this time), and Visual studio comes up with two errors before you can compile. I though I would share the fixes, so others don't have to handle these errors before being able to use the library.
The first error that I got came from the use of
fileno
(on line 3731). This has been deprecated for windows (https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/posix-fileno?view=vs-2019). I understand for UNIX this is the standard so I changed the precompiler to differentiate:fileno
for unix,_fileno
for windowsThe second error that the compiler gives is
potentially uninitialized local pointer variable 'key' used
(on line 6620). If I follow the logic of the program, it currently should not reach that line if indeedkey
is not set; but the compiler gives an error because hypothetically encryption_level could get a value higher than 2 (LEVEL_2_ENCRYPTION
) which would cause it to indeed usekey
as a uninitialized local pointer. I fixed it by added a NULL initialization forkey
to the existingelse
that precedes it.After these fixes, it will compile in Visual Studio. Hope this helps others!