Changeset 931


Ignore:
Timestamp:
05/28/20 17:56:12 (4 years ago)
Author:
Maciej Komosinski
Message:

Supported all platforms using either qsort_r() or qsort_s()

Location:
cpp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpp/common/nonstd.h

    r886 r931  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2019  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    5555//typedef char byte; //rozne srodowiska c++ definiuja byte jako unsigned char! w javie jest inaczej -> trzeba i tak zmienic w portowanych zrodlach byte na char.
    5656
    57 
     57#ifdef _MSC_VER
     58#define QSORT_R_USING_QSORT_S //qsort_r callers use this macro to adjust argument order in comparator, because microsoft and gcc/clang are incompatible here
     59#define qsort_r(base,nmemb,size,compar,context) qsort_s((base),(nmemb),(size),(compar),(context))
     60#endif
    5861
    5962#ifdef __BORLANDC__
  • cpp/frams/vm/classes/collectionobj.cpp

    r930 r931  
    270270        VMachine *vm;
    271271        VMVEComparator(VMachine::JumpTargetObject *_jto) :jto(_jto), vm(jto->vm) {}
     272#ifdef QSORT_R_USING_QSORT_S
     273        static int compare(void* _this, const void *a, const void *b);
     274#else
    272275        static int compare(const void *a, const void *b, void* _this);
     276#endif
    273277};
    274278
     279#ifdef QSORT_R_USING_QSORT_S
     280int VMVEComparator::compare(void* _this, const void *a, const void *b)
     281#else
    275282int VMVEComparator::compare(const void *a, const void *b, void* _this)
     283#endif
    276284{
    277285        VMachine *vm = ((VMVEComparator*)_this)->vm;
Note: See TracChangeset for help on using the changeset viewer.