Tools: Fix for Windows and constant fields

This commit is contained in:
shahramn 2024-05-02 10:54:23 +01:00
parent e06656c673
commit 607f15bbdc
1 changed files with 4 additions and 2 deletions

View File

@ -122,7 +122,7 @@ int main(int argc, char* argv[])
continue; continue;
} }
f = fopen(argv[i], "r"); f = fopen(argv[i], "rb");
if (!f) { if (!f) {
perror(argv[i]); perror(argv[i]);
exit(1); exit(1);
@ -226,7 +226,9 @@ int main(int argc, char* argv[])
if (v > ucap) { if (v > ucap) {
v = ucap; v = ucap;
} }
c = (v - min) * 65535 / (max - min); double denom = 1;
if (max != min) denom = max - min;
c = (v - min) * 65535 / denom;
hh = c >> 8; hh = c >> 8;
l = c & 0xff; l = c & 0xff;
printf("%c", hh); printf("%c", hh);