| 323 | } |
| 324 | |
| 325 | static void xSER_init_buffers(S32 count, st_SERIAL_PERCID_SIZE* sizeinfo) |
| 326 | { |
| 327 | st_XSERIAL_DATA_PRIV* xsd = &g_xserdata; |
| 328 | S32 i = 0; |
| 329 | S32 tally = 0; |
| 330 | S32 sicnt = 0; |
| 331 | st_SERIAL_PERCID_SIZE* sitmp = NULL; |
| 332 | st_SERIAL_CLIENTINFO* tmp_clt = NULL; |
| 333 | |
| 334 | XOrdInit(&g_xserdata.cltlist, count, 0); |
| 335 | |
| 336 | xsd->cltbuf = |
| 337 | (st_SERIAL_CLIENTINFO*)xMemAlloc(gActiveHeap, count * sizeof(st_SERIAL_CLIENTINFO), 0); |
| 338 | memset(xsd->cltbuf, 0, count * sizeof(st_SERIAL_CLIENTINFO)); |
| 339 | xsd->cltnext = xsd->cltbuf; |
| 340 | |
| 341 | sitmp = sizeinfo; |
| 342 | while (sitmp->idtag != 0) |
| 343 | { |
| 344 | tally += (sitmp->needsize + 3) & ~3; |
| 345 | sicnt++; |
| 346 | sitmp++; |
| 347 | } |
| 348 | tally += (count - sicnt) * 400; |
| 349 | |
| 350 | xsd->bitbuf = (S32*)xMemAlloc(gActiveHeap, tally, 0); |
| 351 | memset(xsd->bitbuf, 0, tally); |
| 352 | |
| 353 | xsd->buf_bytcnt = tally; |
| 354 | |
| 355 | sitmp = sizeinfo; |
| 356 | tally = 0; |
| 357 | tmp_clt = xsd->cltnext; |
| 358 | while (sitmp->idtag != 0) |
| 359 | { |
| 360 | tmp_clt->idtag = sitmp->idtag; |
| 361 | tmp_clt->trueoff = tally; |
| 362 | tmp_clt->actsize = (sitmp->needsize + 3) & ~3; |
| 363 | tmp_clt->membuf = xsd->bitbuf + tally / 4; |
| 364 | XOrdAppend(&xsd->cltlist, tmp_clt); |
| 365 | tally += tmp_clt->actsize; |
| 366 | sitmp++; |
| 367 | tmp_clt++; |
| 368 | } |
| 369 | XOrdSort(&xsd->cltlist, xSER_ord_compare); |
| 370 | xsd->cltnext = tmp_clt; |
| 371 | |
| 372 | for (i = sicnt; i < count; i++) |
| 373 | { |
| 374 | tmp_clt->idtag = 0; |
| 375 | tmp_clt->trueoff = tally; |
| 376 | tmp_clt->actsize = 400; |
| 377 | tmp_clt->membuf = xsd->bitbuf + tally / 4; |
| 378 | tally += tmp_clt->actsize; |
| 379 | tmp_clt++; |
| 380 | } |
| 381 | } |
| 382 |
no test coverage detected