- Timestamp:
- 12/01/20 01:11:25 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/vm/classes/collectionobj.cpp
r931 r1041 272 272 #ifdef QSORT_R_USING_QSORT_S 273 273 static int compare(void* _this, const void *a, const void *b); 274 bool operator()(const ExtValue *a, const ExtValue *b) { return compare(this,&a,&b) == ExtValue::ResultLower; } 274 275 #else 275 276 static int compare(const void *a, const void *b, void* _this); 277 bool operator()(const ExtValue *a, const ExtValue *b) { return compare(&a,&b,this) == ExtValue::ResultLower; } 276 278 #endif 277 279 }; … … 319 321 //However, std::sort() requires "strict weak ordering" and may crash (and indeed crashes, "undefined behavior") when given a non-compliant comparator. 320 322 //We use qsort() instead because we can't control what kind of user script comparator function will be passed to Vector.sort(), and qsort() seems to behave safely for every function. 323 #ifdef __ANDROID__ 324 std::sort(first, first + data.size(), cmp); //no qsort_r() or equivalent on Android (yet) 325 #else 321 326 qsort_r(first, data.size(), sizeof(ExtValue*), cmp.compare, &cmp); 327 #endif 322 328 } 323 329 else
Note: See TracChangeset
for help on using the changeset viewer.