| 1065 | // Local functions - flat stream support |
| 1066 | |
| 1067 | static DWORD FlatStream_CheckFile(TBlockStream * pStream) |
| 1068 | { |
| 1069 | LPBYTE FileBitmap = (LPBYTE)pStream->FileBitmap; |
| 1070 | DWORD WholeByteCount = (pStream->BlockCount / 8); |
| 1071 | DWORD ExtraBitsCount = (pStream->BlockCount & 7); |
| 1072 | BYTE ExpectedValue; |
| 1073 | |
| 1074 | // Verify the whole bytes - their value must be 0xFF |
| 1075 | for(DWORD i = 0; i < WholeByteCount; i++) |
| 1076 | { |
| 1077 | if(FileBitmap[i] != 0xFF) |
| 1078 | return 0; |
| 1079 | } |
| 1080 | |
| 1081 | // If there are extra bits, calculate the mask |
| 1082 | if(ExtraBitsCount != 0) |
| 1083 | { |
| 1084 | ExpectedValue = (BYTE)((1 << ExtraBitsCount) - 1); |
| 1085 | if(FileBitmap[WholeByteCount] != ExpectedValue) |
| 1086 | return 0; |
| 1087 | } |
| 1088 | |
| 1089 | // Yes, the file is complete |
| 1090 | return 1; |
| 1091 | } |
| 1092 | |
| 1093 | static bool FlatStream_LoadBitmap(TBlockStream * pStream) |
| 1094 | { |
no outgoing calls
no test coverage detected