libusb20_desc.c (248236) | libusb20_desc.c (284744) |
---|---|
1/* $FreeBSD: head/lib/libusb/libusb20_desc.c 248236 2013-03-13 12:23:14Z hselasky $ */ | 1/* $FreeBSD: head/lib/libusb/libusb20_desc.c 284744 2015-06-24 01:34:35Z araujo $ */ |
2/*- 3 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. --- 502 unchanged lines hidden (view full) --- 512 if (buf && src_len) { 513 if (ps->type == LIBUSB20_ME_IS_DECODED) { 514 /* 515 * Repeat encode 516 * procedure - we have 517 * room for the 518 * complete structure: 519 */ | 2/*- 3 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. --- 502 unchanged lines hidden (view full) --- 512 if (buf && src_len) { 513 if (ps->type == LIBUSB20_ME_IS_DECODED) { 514 /* 515 * Repeat encode 516 * procedure - we have 517 * room for the 518 * complete structure: 519 */ |
520 uint16_t dummy; 521 522 dummy = libusb20_me_encode(buf, | 520 (void) libusb20_me_encode(buf, |
523 0xFFFF - 3, ps->ptr); 524 } else { 525 bcopy(src_ptr, buf, src_len); 526 } 527 buf += src_len; 528 } 529 pd_offset += sizeof(struct libusb20_me_struct); 530 } --- 137 unchanged lines hidden (view full) --- 668 } 669 break; 670 671 case LIBUSB20_ME_STRUCT: 672 pd_offset = -((-pd_offset) & 673 ~(LIBUSB20_ME_STRUCT_ALIGN - 1)); /* align */ 674 while (pd_count--) { 675 uint16_t temp; | 521 0xFFFF - 3, ps->ptr); 522 } else { 523 bcopy(src_ptr, buf, src_len); 524 } 525 buf += src_len; 526 } 527 pd_offset += sizeof(struct libusb20_me_struct); 528 } --- 137 unchanged lines hidden (view full) --- 666 } 667 break; 668 669 case LIBUSB20_ME_STRUCT: 670 pd_offset = -((-pd_offset) & 671 ~(LIBUSB20_ME_STRUCT_ALIGN - 1)); /* align */ 672 while (pd_count--) { 673 uint16_t temp; |
676 uint16_t dummy; | |
677 struct libusb20_me_struct *ps; 678 679 ps = LIBUSB20_ADD_BYTES(pd, pd_offset); 680 681 if (ps->type == LIBUSB20_ME_IS_ENCODED) { 682 /* 683 * Pre-store a de-constified 684 * pointer to the raw --- 73 unchanged lines hidden (view full) --- 758 if (temp != 0) { 759 /* update type */ 760 ps->type = LIBUSB20_ME_IS_DECODED; 761 ps->len = 0; 762 /* 763 * Recursivly decode 764 * the next structure 765 */ | 674 struct libusb20_me_struct *ps; 675 676 ps = LIBUSB20_ADD_BYTES(pd, pd_offset); 677 678 if (ps->type == LIBUSB20_ME_IS_ENCODED) { 679 /* 680 * Pre-store a de-constified 681 * pointer to the raw --- 73 unchanged lines hidden (view full) --- 755 if (temp != 0) { 756 /* update type */ 757 ps->type = LIBUSB20_ME_IS_DECODED; 758 ps->len = 0; 759 /* 760 * Recursivly decode 761 * the next structure 762 */ |
766 dummy = libusb20_me_decode(buf, | 763 (void) libusb20_me_decode(buf, |
767 temp, ps->ptr); 768 } else { 769 /* update type */ 770 ps->type = LIBUSB20_ME_IS_EMPTY; 771 ps->len = 0; 772 } 773 break; 774 --- 22 unchanged lines hidden --- | 764 temp, ps->ptr); 765 } else { 766 /* update type */ 767 ps->type = LIBUSB20_ME_IS_EMPTY; 768 ps->len = 0; 769 } 770 break; 771 --- 22 unchanged lines hidden --- |