Stefan Schuermans commited on 2011-11-14 21:42:56
Showing 1 changed files, with 14 additions and 54 deletions.
| ... | ... |
@@ -507,15 +507,8 @@ void BlinkenFrameScale(stBlinkenFrame *pFrame, int height, int width) |
| 507 | 507 |
ox = (double)nx / scaleHor; |
| 508 | 508 |
oy1 = (double)(ny + 1) / scaleVer - 0.000001; |
| 509 | 509 |
ox1 = (double)(nx + 1) / scaleHor - 0.000001; |
| 510 |
- if (oy < 0 || ox < 0 || oy1 >= pFrame->height || ox1 >= pFrame->width) // out |
|
| 511 |
- // |
|
| 512 |
- // |
|
| 513 |
- // |
|
| 514 |
- // |
|
| 515 |
- // |
|
| 516 |
- // of |
|
| 517 |
- // old |
|
| 518 |
- // picture |
|
| 510 |
+ if (oy < 0 || ox < 0 || oy1 >= pFrame->height || ox1 >= pFrame->width) |
|
| 511 |
+ // out of old picture |
|
| 519 | 512 |
ppData[ny][nx * chans + c] = 0; |
| 520 | 513 |
else {
|
| 521 | 514 |
oyi = (int)oy; |
| ... | ... |
@@ -765,22 +758,11 @@ int BlinkenFrameToNetwork(stBlinkenFrame *pFrame, etBlinkenProto proto, |
| 765 | 758 |
return 0; |
| 766 | 759 |
|
| 767 | 760 |
case BlinkenProtoBlp: |
| 768 |
- if (maxLength < (int)sizeof(stBlinkenProtoBlpHdr) + pFrame->height * pFrame->width) // buffer |
|
| 769 |
- // |
|
| 770 |
- // |
|
| 771 |
- // |
|
| 772 |
- // |
|
| 773 |
- // |
|
| 774 |
- // too |
|
| 775 |
- // short |
|
| 761 |
+ // buffer too short |
|
| 762 |
+ if (maxLength < (int)sizeof(stBlinkenProtoBlpHdr) + pFrame->height * pFrame->width) |
|
| 776 | 763 |
return -1; |
| 777 |
- ((stBlinkenProtoBlpHdr *) pData)->magic = htonl(BlinkenProtoBlpMagic); // build |
|
| 778 |
- // |
|
| 779 |
- // |
|
| 780 |
- // |
|
| 781 |
- // |
|
| 782 |
- // |
|
| 783 |
- // header |
|
| 764 |
+ // build header |
|
| 765 |
+ ((stBlinkenProtoBlpHdr *) pData)->magic = htonl(BlinkenProtoBlpMagic); |
|
| 784 | 766 |
((stBlinkenProtoBlpHdr *) pData)->frameNo = htonl(0); |
| 785 | 767 |
((stBlinkenProtoBlpHdr *) pData)->width = htons((uint16_t) pFrame->width); |
| 786 | 768 |
((stBlinkenProtoBlpHdr *) pData)->height = |
| ... | ... |
@@ -798,22 +780,11 @@ int BlinkenFrameToNetwork(stBlinkenFrame *pFrame, etBlinkenProto proto, |
| 798 | 780 |
return i; // return length |
| 799 | 781 |
|
| 800 | 782 |
case BlinkenProtoEblp: |
| 801 |
- if (maxLength < (int)sizeof(stBlinkenProtoEblpHdr) + pFrame->height * pFrame->width) // buffer |
|
| 802 |
- // |
|
| 803 |
- // |
|
| 804 |
- // |
|
| 805 |
- // |
|
| 806 |
- // |
|
| 807 |
- // too |
|
| 808 |
- // short |
|
| 783 |
+ // buffer too short |
|
| 784 |
+ if (maxLength < (int)sizeof(stBlinkenProtoEblpHdr) + pFrame->height * pFrame->width) |
|
| 809 | 785 |
return -1; |
| 810 |
- ((stBlinkenProtoEblpHdr *) pData)->magic = htonl(BlinkenProtoEblpMagic); // build |
|
| 811 |
- // |
|
| 812 |
- // |
|
| 813 |
- // |
|
| 814 |
- // |
|
| 815 |
- // |
|
| 816 |
- // header |
|
| 786 |
+ // build header |
|
| 787 |
+ ((stBlinkenProtoEblpHdr *) pData)->magic = htonl(BlinkenProtoEblpMagic); |
|
| 817 | 788 |
((stBlinkenProtoEblpHdr *) pData)->frameNo = htonl(0); |
| 818 | 789 |
((stBlinkenProtoEblpHdr *) pData)->width = |
| 819 | 790 |
htons((uint16_t) pFrame->width); |
| ... | ... |
@@ -834,22 +805,11 @@ int BlinkenFrameToNetwork(stBlinkenFrame *pFrame, etBlinkenProto proto, |
| 834 | 805 |
return i; // return length |
| 835 | 806 |
|
| 836 | 807 |
case BlinkenProtoMcuf: |
| 837 |
- if (maxLength < (int)sizeof(stBlinkenProtoMcufHdr) + pFrame->height * pFrame->width * pFrame->channels) // buffer |
|
| 838 |
- // |
|
| 839 |
- // |
|
| 840 |
- // |
|
| 841 |
- // |
|
| 842 |
- // |
|
| 843 |
- // too |
|
| 844 |
- // short |
|
| 808 |
+ // buffer too short |
|
| 809 |
+ if (maxLength < (int)sizeof(stBlinkenProtoMcufHdr) + pFrame->height * pFrame->width * pFrame->channels) |
|
| 845 | 810 |
return -1; |
| 846 |
- ((stBlinkenProtoMcufHdr *) pData)->magic = htonl(BlinkenProtoMcufMagic); // build |
|
| 847 |
- // |
|
| 848 |
- // |
|
| 849 |
- // |
|
| 850 |
- // |
|
| 851 |
- // |
|
| 852 |
- // header |
|
| 811 |
+ // build header |
|
| 812 |
+ ((stBlinkenProtoMcufHdr *) pData)->magic = htonl(BlinkenProtoMcufMagic); |
|
| 853 | 813 |
((stBlinkenProtoMcufHdr *) pData)->height = |
| 854 | 814 |
htons((uint16_t) pFrame->height); |
| 855 | 815 |
((stBlinkenProtoMcufHdr *) pData)->width = |
| 856 | 816 |