<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 06/24/14 15:59, Shuai Meng wrote:<br>
    </div>
    <blockquote
cite="mid:CAOhhAYOiYrkxLifgQ-KQD8owzkmgd3w1RDqeWoXhK2mvW3ZvVQ@mail.gmail.com"
      type="cite">
      <div dir="ltr"><br>
        <div class="gmail_extra"><br>
          <br>
          <div class="gmail_quote">2014-06-19 8:30 GMT+08:00 Shuai Meng
            <span dir="ltr"><<a moz-do-not-send="true"
                href="mailto:mengshuaicalendr@gmail.com" target="_blank">mengshuaicalendr@gmail.com</a>></span>:<br>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
              <div dir="ltr"><br>
                <div class="gmail_extra"><br>
                  <br>
                  <div class="gmail_quote">
                    2014-06-17 17:43 GMT+08:00 Jacek Caban <span
                      dir="ltr"><<a moz-do-not-send="true"
                        href="mailto:jacek@codeweavers.com"
                        target="_blank">jacek@codeweavers.com</a>></span>:
                    <div>
                      <div class="h5"><br>
                        <blockquote class="gmail_quote"
                          style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">On
                          06/17/14 07:59, Shuai Meng wrote:<br>
                          > diff --git a/dlls/vbscript/global.c
                          b/dlls/vbscript/global.c<br>
                          > index c2b2edd..d21784d 100644<br>
                          > --- a/dlls/vbscript/global.c<br>
                          > +++ b/dlls/vbscript/global.c<br>
                          > @@ -1320,8 +1320,24 @@ static HRESULT
                          Global_Int(vbdisp_t *This, VARIANT *arg,
                          unsigned args_cnt, VARIA<br>
                          ><br>
                          >  static HRESULT Global_Sgn(vbdisp_t
                          *This, VARIANT *arg, unsigned args_cnt,
                          VARIANT *res)<br>
                          >  {<br>
                          > -    FIXME("\n");<br>
                          > -    return E_NOTIMPL;<br>
                          > +    VARIANT v;<br>
                          > +    HRESULT hres;<br>
                          > +<br>
                          > +    TRACE("(%s)\n",
                          debugstr_variant(arg));<br>
                          > +<br>
                          > +    assert(args_cnt == 1);<br>
                          > +<br>
                          > +    V_VT(&v) = VT_EMPTY;<br>
                          > +    hres = VariantChangeType(&v,
                          arg, VARIANT_LOCALBOOL, VT_R8);<br>
                          > +        if (FAILED(hres))<br>
                          > +            return S_OK;<br>
                          <br>
                          Please use to_double() instead. to_double may
                          need some fixes (it may<br>
                          require similar changes as you did for
                          to_string first).<br>
                          <span><font color="#888888"><br>
                            </font></span></blockquote>
                      </div>
                    </div>
                    <div>Yes, to_double is better and simpler. </div>
                    <blockquote class="gmail_quote" style="margin:0px
                      0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span><font
                          color="#888888">
                          Jacek<br>
                          <br>
                          <br>
                        </font></span></blockquote>
                  </div>
                  <br>
                </div>
              </div>
            </blockquote>
          </div>
          I have tried to_double, but I don't think it is as convenient
          as VariantChangeType.</div>
      </div>
    </blockquote>
    <br>
    Not if you fix to_double first. Just call VariantChangeType inside
    to_double, like you did in to_string:<br>
<a class="moz-txt-link-freetext" href="http://source.winehq.org/git/wine.git/commitdiff/6bef4da592c8be4857dc0fa179a3139835266d3c">http://source.winehq.org/git/wine.git/commitdiff/6bef4da592c8be4857dc0fa179a3139835266d3c</a><br>
    <br>
    <blockquote
cite="mid:CAOhhAYOiYrkxLifgQ-KQD8owzkmgd3w1RDqeWoXhK2mvW3ZvVQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra"> I have to add more types such as VT_CY
          and VT_EMPTY, and they don't work. For example, if </div>
        <div class="gmail_extra">
          <div class="gmail_extra"> 185     switch(V_VT(v)) {</div>
          <div class="gmail_extra"> 186     case VT_EMPTY:</div>
          <div class="gmail_extra"> 187         *ret = VT_EMPTY(v);</div>
          <div class="gmail_extra"><br>
          </div>
          <div class="gmail_extra">
            but there is no VT_EMPTY(), how can I give ret whose type is
            double a "EMPTY" value?</div>
        </div>
      </div>
    </blockquote>
    <br>
    Well... of course there is no. As the name suggests, the type
    "empty" is empty and has no values ;) What will be result of
    converting empty to double is a matter of language semantic and
    vbscript happens to have the same semantic as VT_EMPTY->VT_R8
    conversion in VariantChangeType.<br>
    <br>
    <blockquote
cite="mid:CAOhhAYOiYrkxLifgQ-KQD8owzkmgd3w1RDqeWoXhK2mvW3ZvVQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_extra">Why must we pick up to_double and
            give up VariantChangeType?</div>
        </div>
      </div>
    </blockquote>
    <br>
    I'm not saying about giving up VariantChangeType, I just want to use
    it right.<br>
    <br>
    Jacek<br>
  </body>
</html>