| 1142 | } |
| 1143 | |
| 1144 | DWORD On_DLEVEL(int pnum, TCmd *pCmd) |
| 1145 | { |
| 1146 | TCmdPlrInfoHdr *p = (TCmdPlrInfoHdr *)pCmd; |
| 1147 | |
| 1148 | if (gbDeltaSender != pnum) { |
| 1149 | if (p->bCmd == CMD_DLEVEL_END) { |
| 1150 | gbDeltaSender = pnum; |
| 1151 | sgbRecvCmd = CMD_DLEVEL_END; |
| 1152 | } else if (p->bCmd == CMD_DLEVEL_0 && p->wOffset == 0) { |
| 1153 | gbDeltaSender = pnum; |
| 1154 | sgbRecvCmd = CMD_DLEVEL_END; |
| 1155 | } else { |
| 1156 | return p->wBytes + sizeof(*p); |
| 1157 | } |
| 1158 | } |
| 1159 | if (sgbRecvCmd == CMD_DLEVEL_END) { |
| 1160 | if (p->bCmd == CMD_DLEVEL_END) { |
| 1161 | sgbDeltaChunks = 20; |
| 1162 | return p->wBytes + sizeof(*p); |
| 1163 | } else if (p->bCmd == CMD_DLEVEL_0 && p->wOffset == 0) { |
| 1164 | sgdwRecvOffset = 0; |
| 1165 | sgbRecvCmd = p->bCmd; |
| 1166 | } else { |
| 1167 | return p->wBytes + sizeof(*p); |
| 1168 | } |
| 1169 | } else if (sgbRecvCmd != p->bCmd) { |
| 1170 | DeltaImportData(sgbRecvCmd, sgdwRecvOffset); |
| 1171 | if (p->bCmd == CMD_DLEVEL_END) { |
| 1172 | sgbDeltaChunks = 20; |
| 1173 | sgbRecvCmd = CMD_DLEVEL_END; |
| 1174 | return p->wBytes + sizeof(*p); |
| 1175 | } else { |
| 1176 | sgdwRecvOffset = 0; |
| 1177 | sgbRecvCmd = p->bCmd; |
| 1178 | } |
| 1179 | } |
| 1180 | |
| 1181 | /// ASSERT: assert(p->wOffset == sgdwRecvOffset); |
| 1182 | memcpy(&sgRecvBuf[p->wOffset], &p[1], p->wBytes); |
| 1183 | sgdwRecvOffset += p->wBytes; |
| 1184 | return p->wBytes + sizeof(*p); |
| 1185 | } |
| 1186 | |
| 1187 | void DeltaImportData(BYTE cmd, DWORD recv_offset) |
| 1188 | { |
no test coverage detected