VirtualBox

Changeset 575 in kBuild


Ignore:
Timestamp:
Nov 23, 2006 8:57:34 AM (18 years ago)
Author:
bird
Message:

Fixed an bug in the code getting SDKs. And fetch SDK.$(BUILD_TARGET_ARCH) too (old bug).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/gmake/kbuild.c

    r558 r575  
    547547{
    548548    int i, j;
    549     size_t cchTmp;
     549    size_t cchTmp, cch;
    550550    char *pszTmp;
    551551    unsigned cchCur;
     
    559559
    560560    /* determin required tmp variable name space. */
    561     cchTmp = (  pTarget->value_length + 1
    562               + pSource->value_length + 6
    563               + pBldTrg->value_length + 1
    564               + pBldTrgArch->value_length + 4) * 4;
     561    cchTmp = sizeof("$(__SDKS) $(__SDKS.) $(__SDKS.) $(__SDKS.) $(__SDKS..)")
     562           + (pTarget->value_length + pSource->value_length) * 5
     563           + pBldType->value_length
     564           + pBldTrg->value_length
     565           + pBldTrgArch->value_length
     566           + pBldTrg->value_length + pBldTrgArch->value_length;
    565567    pszTmp = alloca(cchTmp);
    566 
    567568
    568569    /* the global sdks. */
    569570    pSdks->iGlobal = i;
    570571    pSdks->cGlobal = 0;
    571     sprintf(pszTmp, "$(SDKS) $(SDKS.%s) $(SDKS.%s) $(SDKS.%s.%s)",
    572             pBldType->value, pBldTrg->value, pBldTrg->value, pBldTrgArch->value);
     572    sprintf(pszTmp, "$(SDKS) $(SDKS.%s) $(SDKS.%s) $(SDKS.%s) $(SDKS.%s.%s)",
     573            pBldType->value,
     574            pBldTrg->value,
     575            pBldTrgArch->value,
     576            pBldTrg->value, pBldTrgArch->value);
    573577    pszIterator = pSdks->apsz[0] = allocated_variable_expand(pszTmp);
    574578    while ((pszCur = find_next_token(&pszIterator, &cchCur)) != 0)
     
    579583    pSdks->iTarget = i;
    580584    pSdks->cTarget = 0;
    581     sprintf(pszTmp, "$(%s_SDKS) $(%s_SDKS.%s) $(%s_SDKS.%s) $(%s_SDKS.%s.%s)",
     585    sprintf(pszTmp, "$(%s_SDKS) $(%s_SDKS.%s) $(%s_SDKS.%s) $(%s_SDKS.%s) $(%s_SDKS.%s.%s)",
    582586            pTarget->value,
    583587            pTarget->value, pBldType->value,
    584588            pTarget->value, pBldTrg->value,
     589            pTarget->value, pBldTrgArch->value,
    585590            pTarget->value, pBldTrg->value, pBldTrgArch->value);
    586591    pszIterator = pSdks->apsz[1] = allocated_variable_expand(pszTmp);
     
    592597    pSdks->iSource = i;
    593598    pSdks->cSource = 0;
    594     sprintf(pszTmp, "$(%s_SDKS) $(%s_SDKS.%s) $(%s_SDKS.%s) $(%s_SDKS.%s.%s)",
     599    sprintf(pszTmp, "$(%s_SDKS) $(%s_SDKS.%s) $(%s_SDKS.%s) $(%s_SDKS.%s) $(%s_SDKS.%s.%s)",
    595600            pSource->value,
    596601            pSource->value, pBldType->value,
    597602            pSource->value, pBldTrg->value,
     603            pSource->value, pBldTrgArch->value,
    598604            pSource->value, pBldTrg->value, pBldTrgArch->value);
    599605    pszIterator = pSdks->apsz[2] = allocated_variable_expand(pszTmp);
     
    605611    pSdks->iTargetSource = i;
    606612    pSdks->cTargetSource = 0;
    607     sprintf(pszTmp, "$(%s_%s_SDKS) $(%s_%s_SDKS.%s) $(%s_%s_SDKS.%s) $(%s_%s_SDKS.%s.%s)",
    608             pTarget->value, pSource->value,
    609             pTarget->value, pSource->value, pBldType->value,
    610             pTarget->value, pSource->value, pBldTrg->value,
    611             pTarget->value, pSource->value, pBldTrg->value, pBldTrgArch->value);
     613    cch = sprintf(pszTmp, "$(%s_%s_SDKS) $(%s_%s_SDKS.%s) $(%s_%s_SDKS.%s) $(%s_%s_SDKS.%s) $(%s_%s_SDKS.%s.%s)",
     614                  pTarget->value, pSource->value,
     615                  pTarget->value, pSource->value, pBldType->value,
     616                  pTarget->value, pSource->value, pBldTrg->value,
     617                  pTarget->value, pSource->value, pBldTrgArch->value,
     618                  pTarget->value, pSource->value, pBldTrg->value, pBldTrgArch->value);
     619    assert(cch < cchTmp); (void)cch;
    612620    pszIterator = pSdks->apsz[3] = allocated_variable_expand(pszTmp);
    613621    while ((pszCur = find_next_token(&pszIterator, &cchCur)) != 0)
     
    626634    for (i = j = 0; j < sizeof(pSdks->apsz) / sizeof(pSdks->apsz[0]); j++)
    627635    {
     636        int k = i;
    628637        pszIterator = pSdks->apsz[j];
    629638        while ((pszCur = find_next_token(&pszIterator, &cchCur)) != 0)
     
    631640            pSdks->pa[i].value = pszCur;
    632641            pSdks->pa[i].value_length = cchCur;
    633             pszCur[cchCur] = '\0';
     642            i++;
    634643        }
    635644    }
     645    assert(i == pSdks->c);
     646
     647    /* terminate them (find_next_token won't work if we terminate them in the previous loop). */
     648    while (i-- > 0)
     649        pSdks->pa[i].value[pSdks->pa[i].value_length] = '\0';
    636650}
    637651
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette