Uploaded image for project: 'Qpid Proton'
  1. Qpid Proton
  2. PROTON-148

Porting Issue -- Visual Studio requires an explicit cast inside the resize macros

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • proton-0.4
    • proton-c
    • WIndows using Visual Studio 2010

    Description

      The PN_ENSURE and PN_ENSUREZ macros do not compile using Visual Studio toolset.

      Suggest changing the macros to the following for both ports:

      #define PN_ENSURE(ARRAY, CAPACITY, COUNT, PNTYPE) \
      while ((CAPACITY) < (COUNT))

      { \ (CAPACITY) = (CAPACITY) ? 2 * (CAPACITY) : 16; \ (ARRAY) = (PNTYPE) realloc((ARRAY), (CAPACITY) * sizeof (*(ARRAY))); \ }

      #define PN_ENSUREZ(ARRAY, CAPACITY, COUNT, PNTYPE) \

      { \ size_t _old_capacity = (CAPACITY); \ PN_ENSURE((ARRAY), (CAPACITY), (COUNT), PNTYPE); \ memset((ARRAY) + _old_capacity, 0, \ sizeof(*(ARRAY))*((CAPACITY) - _old_capacity)); \ }

      Attachments

        1. PN_ENSURE.patch
          6 kB
          Mary hinton

        Activity

          People

            cliffjansen Clifford Jansen
            marydhinton Mary hinton
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: