History

Bgetbe(): return int status.

dhoskin committed 12 years ago

Commit 4ee1ab21 parent c4d55081 file · +10 −8Browse files

Unified · Split

websocket.c+10−8
@@ -165,8 +165,8 @@ testwsversion(const char *vs) · 164 unmodified lines
165 return 0;165 return 0;
166}166}
167 167
168uvlong168int
169Bgetbe(Biobuf *b, int sz)169Bgetbe(Biobuf *b, uvlong *u, int sz)
170{170{
171 uchar buf[8];171 uchar buf[8];
172 int i;172 int i;
@@ -175,11 +175,14 @@ Bgetbe(Biobuf *b, int sz) · 2 unmodified lines
175 if(Bread(b, buf, sz) != sz)175 if(Bread(b, buf, sz) != sz)
176 return -1;176 return -1;
177 177
178 /* XXX This should use getbe(). */
179 //*u = getbe(buf, sz);
178 x = 0;180 x = 0;
179 for(i = 0; i < sz; ++i)181 for(i = 0; i < sz; ++i)
180 x |= buf[i] << (8 * (sz - 1 - i));182 x |= buf[i] << (8 * (sz - 1 - i));
181 183
182 return x;184 *u = x;
185 return 1;
183}186}
184 187
185int188int
@@ -242,12 +245,11 @@ recvpkt(Wspkt *pkt, Biobuf *b) · 56 unmodified lines
242 pkt->n &= 0x7F;245 pkt->n &= 0x7F;
243 246
244 if(pkt->n >= 127){247 if(pkt->n >= 127){
245 pkt->n = Bgetbe(b, 8);248 if(Bgetbe(b, (uvlong *)&pkt->n, 8) != 1)
249 return -1;
246 }else if(pkt->n == 126){250 }else if(pkt->n == 126){
247 pkt->n = Bgetbe(b, 2);251 if(Bgetbe(b, (uvlong *)&pkt->n, 2) != 1)
248 }252 return -1;
249 if(pkt->n < 0){
250 return -1;
251 }253 }
252 254
253 if(masked){255 if(masked){

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t