| 1104 | // Local functions - flat stream support |
| 1105 | |
| 1106 | static DWORD FlatStream_CheckFile(TBlockStream * pStream) |
| 1107 | { |
| 1108 | LPBYTE FileBitmap = (LPBYTE)pStream->FileBitmap; |
| 1109 | DWORD WholeByteCount = (pStream->BlockCount / 8); |
| 1110 | DWORD ExtraBitsCount = (pStream->BlockCount & 7); |
| 1111 | BYTE ExpectedValue; |
| 1112 | |
| 1113 | // Verify the whole bytes - their value must be 0xFF |
| 1114 | for(DWORD i = 0; i < WholeByteCount; i++) |
| 1115 | { |
| 1116 | if(FileBitmap[i] != 0xFF) |
| 1117 | return 0; |
| 1118 | } |
| 1119 | |
| 1120 | // If there are extra bits, calculate the mask |
| 1121 | if(ExtraBitsCount != 0) |
| 1122 | { |
| 1123 | ExpectedValue = (BYTE)((1 << ExtraBitsCount) - 1); |
| 1124 | if(FileBitmap[WholeByteCount] != ExpectedValue) |
| 1125 | return 0; |
| 1126 | } |
| 1127 | |
| 1128 | // Yes, the file is complete |
| 1129 | return 1; |
| 1130 | } |
| 1131 | |
| 1132 | static bool FlatStream_LoadBitmap(TBlockStream * pStream) |
| 1133 | { |
no outgoing calls
no test coverage detected