____________________________________________________________ Read a header record for join operation
| 2144 | // Read a header record for join operation |
| 2145 | // |
| 2146 | bool MVOL_split_hdr_read() |
| 2147 | { |
| 2148 | BurpGlobals* tdgbl = BurpGlobals::getSpecific(); |
| 2149 | |
| 2150 | fb_assert(tdgbl->action); |
| 2151 | fb_assert(tdgbl->action->act_file); |
| 2152 | fb_assert(tdgbl->action->act_file->fil_fd != INVALID_HANDLE_VALUE); |
| 2153 | |
| 2154 | if (tdgbl->action && tdgbl->action->act_file && |
| 2155 | (tdgbl->action->act_file->fil_fd != INVALID_HANDLE_VALUE)) |
| 2156 | { |
| 2157 | TEXT buffer[HDR_SPLIT_SIZE]; |
| 2158 | int cnt = 0; |
| 2159 | |
| 2160 | #ifdef WIN_NT |
| 2161 | ReadFile(tdgbl->action->act_file->fil_fd, buffer, HDR_SPLIT_SIZE, |
| 2162 | reinterpret_cast<DWORD*>(&cnt), NULL); |
| 2163 | #else |
| 2164 | cnt = read(tdgbl->action->act_file->fil_fd, buffer, HDR_SPLIT_SIZE); |
| 2165 | #endif |
| 2166 | if ((cnt >= 0) && ((ULONG) cnt == HDR_SPLIT_SIZE) && |
| 2167 | ((strncmp(buffer, HDR_SPLIT_TAG, (sizeof(HDR_SPLIT_TAG) - 1)) == 0) || |
| 2168 | (strncmp(buffer, HDR_SPLIT_TAG5, (sizeof(HDR_SPLIT_TAG) - 1)) == 0))) |
| 2169 | { |
| 2170 | const hdr_split* hdr = (hdr_split*) buffer; |
| 2171 | if ((tdgbl->action->act_file->fil_seq = atoi(hdr->hdr_split_sequence)) > 0 && |
| 2172 | (tdgbl->action->act_total = atoi(hdr->hdr_split_total)) > 0 && |
| 2173 | (tdgbl->action->act_file->fil_seq <= tdgbl->action->act_total)) |
| 2174 | { |
| 2175 | return true; |
| 2176 | } |
| 2177 | } |
| 2178 | } |
| 2179 | |
| 2180 | return false; |
| 2181 | } |