Ignore:
Timestamp:
Dec 18, 2011, 10:28:22 PM (14 years ago)
Author:
dmik
Message:

Merge branch gcc-kmk to trunk.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        1 bin
        2 Makefile.inc
         1env.cmd
         2LocalConfig.kmk
    • Property svn:mergeinfo set to
      /branches/gcc-kmkmergedeligible
  • trunk/src/oleaut32/variant.c

    r21308 r21916  
    674674 * Round the double value to the nearest integer value.
    675675 */
    676 static double round( double d )
     676static double rnd( double d )
    677677{
    678678   double decimals = 0.0, integerValue = 0.0, roundedValue = 0.0;
     
    22542254        /* Check range of value.
    22552255     */
    2256     fltIn = round( fltIn );
     2256    fltIn = rnd( fltIn );
    22572257        if( fltIn < UI1_MIN || fltIn > UI1_MAX )
    22582258        {
     
    22742274        /* Check range of value.
    22752275     */
    2276     dblIn = round( dblIn );
     2276    dblIn = rnd( dblIn );
    22772277        if( dblIn < UI1_MIN || dblIn > UI1_MAX )
    22782278        {
     
    22942294        /* Check range of value.
    22952295     */
    2296     dateIn = round( dateIn );
     2296    dateIn = rnd( dateIn );
    22972297        if( dateIn < UI1_MIN || dateIn > UI1_MAX )
    22982298        {
     
    23972397        /* Check range of value.
    23982398     */
    2399     dValue = round( dValue );
     2399    dValue = rnd( dValue );
    24002400        if( dValue < UI1_MIN || dValue > UI1_MAX )
    24012401        {
     
    24132413 */
    24142414HRESULT WINAPI VarUI1FromCy(CY cyIn, BYTE* pbOut) {
    2415    double t = round((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000);
     2415   double t = rnd((((double)cyIn.DUMMYSTRUCTNAME_DOT Hi * 4294967296.0) + (double)cyIn.DUMMYSTRUCTNAME_DOT Lo) / 10000);
    24162416
    24172417   if (t > UI1_MAX || t < UI1_MIN) return DISP_E_OVERFLOW;
     
    24612461        /* Check range of value.
    24622462     */
    2463     fltIn = round( fltIn );
     2463    fltIn = rnd( fltIn );
    24642464        if( fltIn < I2_MIN || fltIn > I2_MAX )
    24652465        {
     
    24812481        /* Check range of value.
    24822482     */
    2483     dblIn = round( dblIn );
     2483    dblIn = rnd( dblIn );
    24842484        if( dblIn < I2_MIN || dblIn > I2_MAX )
    24852485        {
     
    25012501        /* Check range of value.
    25022502     */
    2503     dateIn = round( dateIn );
     2503    dateIn = rnd( dateIn );
    25042504        if( dateIn < I2_MIN || dateIn > I2_MAX )
    25052505        {
     
    26032603        /* Check range of value.
    26042604     */
    2605     dValue = round( dValue );
     2605    dValue = rnd( dValue );
    26062606        if( dValue < I2_MIN || dValue > I2_MAX )
    26072607        {
     
    26192619 */
    26202620HRESULT WINAPI VarI2FromCy(CY cyIn, short* psOut) {
    2621    double t = round((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000);
     2621   double t = rnd((((double)cyIn.DUMMYSTRUCTNAME_DOT Hi * 4294967296.0) + (double)cyIn.DUMMYSTRUCTNAME_DOT Lo) / 10000);
    26222622
    26232623   if (t > I2_MAX || t < I2_MIN) return DISP_E_OVERFLOW;
     
    26492649        /* Check range of value.
    26502650     */
    2651     fltIn = round( fltIn );
     2651    fltIn = rnd( fltIn );
    26522652        if( fltIn < I4_MIN || fltIn > I4_MAX )
    26532653        {
     
    26692669        /* Check range of value.
    26702670     */
    2671     dblIn = round( dblIn );
     2671    dblIn = rnd( dblIn );
    26722672        if( dblIn < I4_MIN || dblIn > I4_MAX )
    26732673        {
     
    26892689        /* Check range of value.
    26902690     */
    2691     dateIn = round( dateIn );
     2691    dateIn = rnd( dateIn );
    26922692        if( dateIn < I4_MIN || dateIn > I4_MAX )
    26932693        {
     
    27962796        /* Check range of value.
    27972797     */
    2798     dValue = round( dValue );
     2798    dValue = rnd( dValue );
    27992799        if( dValue < I4_MIN || dValue > I4_MAX )
    28002800        {
     
    28122812 */
    28132813HRESULT WINAPI VarI4FromCy(CY cyIn, LONG* plOut) {
    2814    double t = round((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000);
     2814   double t = rnd((((double)cyIn.DUMMYSTRUCTNAME_DOT Hi * 4294967296.0) + (double)cyIn.DUMMYSTRUCTNAME_DOT Lo) / 10000);
    28152815
    28162816   if (t > I4_MAX || t < I4_MIN) return DISP_E_OVERFLOW;
     
    29862986 */
    29872987HRESULT WINAPI VarR4FromCy(CY cyIn, FLOAT* pfltOut) {
    2988    *pfltOut = (FLOAT)((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000);
     2988   *pfltOut = (FLOAT)((((double)cyIn.DUMMYSTRUCTNAME_DOT Hi * 4294967296.0) + (double)cyIn.DUMMYSTRUCTNAME_DOT Lo) / 10000);
    29892989
    29902990   return S_OK;
     
    31363136 */
    31373137HRESULT WINAPI VarR8FromCy(CY cyIn, double* pdblOut) {
    3138    *pdblOut = (double)((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000);
    3139    TRACE("%lu %ld -> %f\n", cyIn.s.Hi, cyIn.s.Lo, *pdblOut);
     3138   *pdblOut = (double)((((double)cyIn.DUMMYSTRUCTNAME_DOT Hi * 4294967296.0) + (double)cyIn.DUMMYSTRUCTNAME_DOT Lo) / 10000);
     3139   TRACE("%lu %ld -> %f\n", cyIn.DUMMYSTRUCTNAME_DOT Hi, cyIn.DUMMYSTRUCTNAME_DOT Lo, *pdblOut);
    31403140   return S_OK;
    31413141}
     
    33283328 */
    33293329HRESULT WINAPI VarDateFromCy(CY cyIn, DATE* pdateOut) {
    3330    *pdateOut = (DATE)((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000);
     3330   *pdateOut = (DATE)((((double)cyIn.DUMMYSTRUCTNAME_DOT Hi * 4294967296.0) + (double)cyIn.DUMMYSTRUCTNAME_DOT Lo) / 10000);
    33313331
    33323332   if (*pdateOut > DATE_MAX || *pdateOut < DATE_MIN) return DISP_E_TYPEMISMATCH;
     
    36883688 */
    36893689HRESULT WINAPI VarBoolFromCy(CY cyIn, VARIANT_BOOL* pboolOut) {
    3690       if (cyIn.s.Hi || cyIn.s.Lo) *pboolOut = -1;
     3690      if (cyIn.DUMMYSTRUCTNAME_DOT Hi || cyIn.DUMMYSTRUCTNAME_DOT Lo) *pboolOut = -1;
    36913691      else *pboolOut = 0;
    36923692
     
    37543754        TRACE("( %f, %p ), stub\n", fltIn, pcOut );
    37553755
    3756     fltIn = round( fltIn );
     3756    fltIn = rnd( fltIn );
    37573757        if( fltIn < CHAR_MIN || fltIn > CHAR_MAX )
    37583758        {
     
    37723772        TRACE("( %f, %p ), stub\n", dblIn, pcOut );
    37733773
    3774     dblIn = round( dblIn );
     3774    dblIn = rnd( dblIn );
    37753775    if( dblIn < CHAR_MIN || dblIn > CHAR_MAX )
    37763776        {
     
    37903790        TRACE("( %f, %p ), stub\n", dateIn, pcOut );
    37913791
    3792     dateIn = round( dateIn );
     3792    dateIn = rnd( dateIn );
    37933793        if( dateIn < CHAR_MIN || dateIn > CHAR_MAX )
    37943794        {
     
    38303830        /* Check range of value.
    38313831     */
    3832     dValue = round( dValue );
     3832    dValue = rnd( dValue );
    38333833        if( dValue < CHAR_MIN || dValue > CHAR_MAX )
    38343834        {
     
    38923892 */
    38933893HRESULT WINAPI VarI1FromCy(CY cyIn, CHAR* pcOut) {
    3894    double t = round((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000);
     3894   double t = rnd((((double)cyIn.DUMMYSTRUCTNAME_DOT Hi * 4294967296.0) + (double)cyIn.DUMMYSTRUCTNAME_DOT Lo) / 10000);
    38953895
    38963896   if (t > CHAR_MAX || t < CHAR_MIN) return DISP_E_OVERFLOW;
     
    39533953        TRACE("( %f, %p ), stub\n", fltIn, puiOut );
    39543954
    3955     fltIn = round( fltIn );
     3955    fltIn = rnd( fltIn );
    39563956        if( fltIn < UI2_MIN || fltIn > UI2_MAX )
    39573957        {
     
    39713971        TRACE("( %f, %p ), stub\n", dblIn, puiOut );
    39723972
    3973     dblIn = round( dblIn );
     3973    dblIn = rnd( dblIn );
    39743974    if( dblIn < UI2_MIN || dblIn > UI2_MAX )
    39753975        {
     
    39893989        TRACE("( %f, %p ), stub\n", dateIn, puiOut );
    39903990
    3991     dateIn = round( dateIn );
     3991    dateIn = rnd( dateIn );
    39923992        if( dateIn < UI2_MIN || dateIn > UI2_MAX )
    39933993        {
     
    40294029        /* Check range of value.
    40304030     */
    4031     dValue = round( dValue );
     4031    dValue = rnd( dValue );
    40324032        if( dValue < UI2_MIN || dValue > UI2_MAX )
    40334033        {
     
    41104110        /* Check range of value.
    41114111     */
    4112     dValue = round( dValue );
     4112    dValue = rnd( dValue );
    41134113        if( dValue < UI4_MIN || dValue > UI4_MAX )
    41144114        {
     
    41264126 */
    41274127HRESULT WINAPI VarUI2FromCy(CY cyIn, USHORT* pusOut) {
    4128    double t = round((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000);
     4128   double t = rnd((((double)cyIn.DUMMYSTRUCTNAME_DOT Hi * 4294967296.0) + (double)cyIn.DUMMYSTRUCTNAME_DOT Lo) / 10000);
    41294129
    41304130   if (t > UI2_MAX || t < UI2_MIN) return DISP_E_OVERFLOW;
     
    41864186HRESULT WINAPI VarUI4FromR4(FLOAT fltIn, ULONG* pulOut)
    41874187{
    4188     fltIn = round( fltIn );
     4188    fltIn = rnd( fltIn );
    41894189    if( fltIn < UI4_MIN || fltIn > UI4_MAX )
    41904190        {
     
    42044204        TRACE("( %f, %p ), stub\n", dblIn, pulOut );
    42054205
    4206         dblIn = round( dblIn );
     4206        dblIn = rnd( dblIn );
    42074207        if( dblIn < UI4_MIN || dblIn > UI4_MAX )
    42084208        {
     
    42224222        TRACE("( %f, %p ), stub\n", dateIn, pulOut );
    42234223
    4224         dateIn = round( dateIn );
     4224        dateIn = rnd( dateIn );
    42254225        if( dateIn < UI4_MIN || dateIn > UI4_MAX )
    42264226        {
     
    42744274 */
    42754275HRESULT WINAPI VarUI4FromCy(CY cyIn, ULONG* pulOut) {
    4276    double t = round((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000);
     4276   double t = rnd((((double)cyIn.DUMMYSTRUCTNAME_DOT Hi * 4294967296.0) + (double)cyIn.DUMMYSTRUCTNAME_DOT Lo) / 10000);
    42774277
    42784278   if (t > UI4_MAX || t < UI4_MIN) return DISP_E_OVERFLOW;
     
    42884288 */
    42894289HRESULT WINAPI VarCyFromUI1(BYTE bIn, CY* pcyOut) {
    4290     pcyOut->s.Hi = 0;
    4291     pcyOut->s.Lo = ((ULONG)bIn) * 10000;
     4290    pcyOut->DUMMYSTRUCTNAME_DOT Hi = 0;
     4291    pcyOut->DUMMYSTRUCTNAME_DOT Lo = ((ULONG)bIn) * 10000;
    42924292
    42934293    return S_OK;
     
    42994299 */
    43004300HRESULT WINAPI VarCyFromI2(short sIn, CY* pcyOut) {
    4301     if (sIn < 0) pcyOut->s.Hi = -1;
    4302     else pcyOut->s.Hi = 0;
    4303     pcyOut->s.Lo = ((ULONG)sIn) * 10000;
     4301    if (sIn < 0) pcyOut->DUMMYSTRUCTNAME_DOT Hi = -1;
     4302    else pcyOut->DUMMYSTRUCTNAME_DOT Hi = 0;
     4303    pcyOut->DUMMYSTRUCTNAME_DOT Lo = ((ULONG)sIn) * 10000;
    43044304
    43054305    return S_OK;
     
    43124312HRESULT WINAPI VarCyFromI4(LONG lIn, CY* pcyOut) {
    43134313      double t = (double)lIn * (double)10000;
    4314       pcyOut->s.Hi = (LONG)(t / (double)4294967296.0);
    4315       pcyOut->s.Lo = (ULONG)fmod(t, (double)4294967296.0);
    4316       if (lIn < 0) pcyOut->s.Hi--;
     4314      pcyOut->DUMMYSTRUCTNAME_DOT Hi = (LONG)(t / (double)4294967296.0);
     4315      pcyOut->DUMMYSTRUCTNAME_DOT Lo = (ULONG)fmod(t, (double)4294967296.0);
     4316      if (lIn < 0) pcyOut->DUMMYSTRUCTNAME_DOT Hi--;
    43174317
    43184318      return S_OK;
     
    43244324 */
    43254325HRESULT WINAPI VarCyFromR4(FLOAT fltIn, CY* pcyOut) {
    4326    double t = round((double)fltIn * (double)10000);
    4327    pcyOut->s.Hi = (LONG)(t / (double)4294967296.0);
    4328    pcyOut->s.Lo = (ULONG)fmod(t, (double)4294967296.0);
    4329    if (fltIn < 0) pcyOut->s.Hi--;
     4326   double t = rnd((double)fltIn * (double)10000);
     4327   pcyOut->DUMMYSTRUCTNAME_DOT Hi = (LONG)(t / (double)4294967296.0);
     4328   pcyOut->DUMMYSTRUCTNAME_DOT Lo = (ULONG)fmod(t, (double)4294967296.0);
     4329   if (fltIn < 0) pcyOut->DUMMYSTRUCTNAME_DOT Hi--;
    43304330
    43314331   return S_OK;
     
    43374337 */
    43384338HRESULT WINAPI VarCyFromR8(double dblIn, CY* pcyOut) {
    4339    double t = round(dblIn * (double)10000);
    4340    pcyOut->s.Hi = (LONG)(t / (double)4294967296.0);
    4341    pcyOut->s.Lo = (ULONG)fmod(t, (double)4294967296.0);
    4342    if (dblIn < 0) pcyOut->s.Hi--;
     4339   double t = rnd(dblIn * (double)10000);
     4340   pcyOut->DUMMYSTRUCTNAME_DOT Hi = (LONG)(t / (double)4294967296.0);
     4341   pcyOut->DUMMYSTRUCTNAME_DOT Lo = (ULONG)fmod(t, (double)4294967296.0);
     4342   if (dblIn < 0) pcyOut->DUMMYSTRUCTNAME_DOT Hi--;
    43434343
    43444344   return S_OK;
     
    43504350 */
    43514351HRESULT WINAPI VarCyFromDate(DATE dateIn, CY* pcyOut) {
    4352    double t = round((double)dateIn * (double)10000);
    4353    pcyOut->s.Hi = (LONG)(t / (double)4294967296.0);
    4354    pcyOut->s.Lo = (ULONG)fmod(t, (double)4294967296.0);
    4355    if (dateIn < 0) pcyOut->s.Hi--;
     4352   double t = rnd((double)dateIn * (double)10000);
     4353   pcyOut->DUMMYSTRUCTNAME_DOT Hi = (LONG)(t / (double)4294967296.0);
     4354   pcyOut->DUMMYSTRUCTNAME_DOT Lo = (ULONG)fmod(t, (double)4294967296.0);
     4355   if (dateIn < 0) pcyOut->DUMMYSTRUCTNAME_DOT Hi--;
    43564356
    43574357   return S_OK;
     
    44184418 */
    44194419HRESULT WINAPI VarCyFromBool(VARIANT_BOOL boolIn, CY* pcyOut) {
    4420    if (boolIn < 0) pcyOut->s.Hi = -1;
    4421    else pcyOut->s.Hi = 0;
    4422    pcyOut->s.Lo = (ULONG)boolIn * (ULONG)10000;
     4420   if (boolIn < 0) pcyOut->DUMMYSTRUCTNAME_DOT Hi = -1;
     4421   else pcyOut->DUMMYSTRUCTNAME_DOT Hi = 0;
     4422   pcyOut->DUMMYSTRUCTNAME_DOT Lo = (ULONG)boolIn * (ULONG)10000;
    44234423
    44244424   return S_OK;
     
    44304430 */
    44314431HRESULT WINAPI VarCyFromI1(signed char cIn, CY* pcyOut) {
    4432    if (cIn < 0) pcyOut->s.Hi = -1;
    4433    else pcyOut->s.Hi = 0;
    4434    pcyOut->s.Lo = (ULONG)cIn * (ULONG)10000;
     4432   if (cIn < 0) pcyOut->DUMMYSTRUCTNAME_DOT Hi = -1;
     4433   else pcyOut->DUMMYSTRUCTNAME_DOT Hi = 0;
     4434   pcyOut->DUMMYSTRUCTNAME_DOT Lo = (ULONG)cIn * (ULONG)10000;
    44354435
    44364436   return S_OK;
     
    44424442 */
    44434443HRESULT WINAPI VarCyFromUI2(USHORT usIn, CY* pcyOut) {
    4444    pcyOut->s.Hi = 0;
    4445    pcyOut->s.Lo = (ULONG)usIn * (ULONG)10000;
     4444   pcyOut->DUMMYSTRUCTNAME_DOT Hi = 0;
     4445   pcyOut->DUMMYSTRUCTNAME_DOT Lo = (ULONG)usIn * (ULONG)10000;
    44464446
    44474447   return S_OK;
     
    44544454HRESULT WINAPI VarCyFromUI4(ULONG ulIn, CY* pcyOut) {
    44554455   double t = (double)ulIn * (double)10000;
    4456    pcyOut->s.Hi = (LONG)(t / (double)4294967296.0);
    4457    pcyOut->s.Lo = (ULONG)fmod(t, (double)4294967296.0);
     4456   pcyOut->DUMMYSTRUCTNAME_DOT Hi = (LONG)(t / (double)4294967296.0);
     4457   pcyOut->DUMMYSTRUCTNAME_DOT Lo = (ULONG)fmod(t, (double)4294967296.0);
    44584458
    44594459   return S_OK;
     
    45704570        TRACE("Calculated currency is xint=%ld\n", xint);
    45714571        VarCyFromInt( (int) xint, &V_UNION(pvar,cyVal) );
    4572         TRACE("Calculated cy is %ld,%lu\n", V_UNION(pvar,cyVal).s.Hi, V_UNION(pvar,cyVal).s.Lo);
     4572        TRACE("Calculated cy is %ld,%lu\n", V_UNION(pvar,cyVal).DUMMYSTRUCTNAME_DOT Hi, V_UNION(pvar,cyVal).DUMMYSTRUCTNAME_DOT Lo);
    45734573        return VarCyFromInt( (int) xint, &V_UNION(pvar,cyVal) );
    45744574    }
     
    55705570        rc = VarCyFromR8((cyVal * (double) mulBy), pcyOut);
    55715571        TRACE("Multiply %f by %ld = %f [%ld,%lu]\n", cyVal, mulBy, (cyVal * (double) mulBy),
    5572                     pcyOut->s.Hi, pcyOut->s.Lo);
     5572                    pcyOut->DUMMYSTRUCTNAME_DOT Hi, pcyOut->DUMMYSTRUCTNAME_DOT Lo);
    55735573    }
    55745574    return rc;
Note: See TracChangeset for help on using the changeset viewer.