<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><div><br></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div><br></div><div dir="ltr">I agree, I will use your first suggestion.<div><br></div><div>Tomáš<br></div></div></blockquote><div><br></div><div>As a note, I'm not a Javascript expert as you, I just tested my suggestion with a small test<br></div><div>script.<br></div><div><br></div><div>Frediano<br></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div class="gmail_extra"><br><div class="gmail_quote">2017-09-07 10:31 GMT+02:00 Frediano Ziglio <span dir="ltr"><<a href="mailto:fziglio@redhat.com" target="_blank">fziglio@redhat.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">><br>
> This will be used in other commits.<br>
> ---<br>
> spiceconn.js | 19 +++++++++++++++++++<br>
> 1 file changed, 19 insertions(+)<br>
><br>
> diff --git a/spiceconn.js b/spiceconn.js<br>
> index 33e7388..78d5820 100644<br>
> --- a/spiceconn.js<br>
> +++ b/spiceconn.js<br>
> @@ -243,6 +243,9 @@ SpiceConn.prototype =<br>
> else if (this.state == "link")<br>
> {<br>
> this.reply_link = new SpiceLinkReply(mb);<br>
> + this.common_caps = this.reply_link.common_caps;<br>
> + this.channel_caps = this.reply_link.channel_caps;<br>
> +<br>
> // FIXME - Screen the caps - require minihdr at least, right?<br>
> if (this.reply_link.error)<br>
> {<br>
> @@ -495,6 +498,22 @@ SpiceConn.prototype =<br>
> var e = new Error("Connection timed out.");<br>
> this.report_error(e);<br>
> },<br>
> +<br>
> + test_capability: function(caps, cap)<br>
> + {<br>
> + var ret = (caps >> cap) & 1;<br>
> + return ret;<br>
> + },<br>
> +<br><br></div></div>This will work till cap is < 32, maybe safer to use a<br><br>
return (caps[cap >> 5] >> (cap & 31)) & 1;<br><br>
Or maybe put a comment where capabilities constants are defined<br>
to change this function when we reach 32.<br><div class="HOEnZb"><div class="h5"><br>
> + channel_test_capability: function(cap)<br>
> + {<br>
> + return this.test_capability(this.channel_caps, cap);<br>
> + },<br>
> +<br>
> + channel_test_common_capability: function(cap)<br>
> + {<br>
> + return this.test_capability(this.common_caps, cap);<br>
> + }<br>
> }<br>
><br>
> function spiceconn_timeout(sc)<br><br></div></div><span class="HOEnZb"><span data-mce-style="color: #888888;" style="color: #888888;">Frediano<br>
</span></span></blockquote></div><br></div></blockquote><div><br></div></div></body></html>