andrivet/ADVobfuscator

Compiler warning question

Amadeus- opened this issue · 4 comments

On line 93 of MetaString4.h:
constexpr char key(int position) const { return buffer_[0] + position; }

I got a compiler warning on this and after looking at it, I thought you might want to check it out. Should 'position' also be a char in this instance? (The compiler does not like returning a value as char when you're doing math with an int.)

There are a few other instances similar to this in the same file.

Another example (line 84, same file)
for(int i = 0; i < sizeof...(I); ++i)
buffer_[i + 1] = decrypt(buffer_[i + 1], i);

The compiler doesn't like that i is an "int" ...if changed to "char", the compiler warning goes away. (But, I'm not 100% sure if this is the correct solution.)

Looks like I have to add a static_cast. I will fix that.

"int i" is also wrong. It has to be "size_t"

Fixed in the latest version