Iyengar111 / NanoLog

Low Latency C++11 Logging Library
727 stars 186 forks source link

some type mismatches #10

Closed BTNC closed 7 years ago

BTNC commented 8 years ago

Hi,

I see following type mismatch warnings when compiling nanolog: NanoLog.cpp(232): warning C4267: '=': conversion from 'size_t' to 'uint32_t', possible loss of data NanoLog.cpp(239): warning C4267: '=': conversion from 'size_t' to 'uint32_t', possible loss of data NanoLog.cpp(268): warning C4267: '+=': conversion from 'size_t' to 'uint32_t', possible loss of data NanoLog.cpp(571): warning C4244: '+=': conversion from 'std::streamoff' to 'uint32_t', possible loss of data According to the code, they may cause unexpected behaviors when uint32_t variable is overflow. To be safe, I can not simply ignore them.

Thanks,

BTNC commented 8 years ago

Another type mismatch for msvc is this line. 'lu' represents unsigned long, which is 64 bit on nix systems, but is 32 bit for msvc. I think it is safe to change it to 'llu', unsigned long long, which is 64 bit for both nix systems and msvc.

Iyengar111 commented 8 years ago

Hi

Sorry for the delay. Thanks for having a look and trying it out in detail. Unfortunately I'm a bit busy at the moment.

If you have the time could you raise a pull request with the required changes. I will take a look and merge it.

Thanks

Karthik

Iyengar111 commented 7 years ago

Fixed.