Changeset 150729 in webkit
- Timestamp:
- May 26, 2013 6:25:52 PM (11 years ago)
- Location:
- trunk/Source/WTF
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r150724 r150729 1 2013-05-26 Patrick Gansterer <paroga@webkit.org> 2 3 [WINCE] Add wtf_bsearch() 4 https://bugs.webkit.org/show_bug.cgi?id=116528 5 6 Reviewed by Darin Adler. 7 8 r149833 introduced usage of ::bsearch(), which does not exist on Windwos CE. 9 Add our own implementation of this function as wtf_bsearch and define 10 bsearch as wtf_bsearch to fix compilation on Windwos CE. 11 12 * wtf/StdLibExtras.h: 13 (wtf_bsearch): 14 1 15 2013-05-26 Kent Tamura <tkent@chromium.org> 2 16 -
trunk/Source/WTF/wtf/StdLibExtras.h
r146774 r150729 1 1 /* 2 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 3 * Copyright (C) 2013 Patrick Gansterer <paroga@paroga.com> 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 262 263 } // namespace WTF 263 264 265 #if OS(WINCE) 266 // Windows CE CRT has does not implement bsearch(). 267 inline void* wtf_bsearch(const void* key, const void* base, size_t count, size_t size, int (*compare)(const void *, const void *)) 268 { 269 const char* first = static_cast<const char*>(base); 270 271 while (count) { 272 size_t pos = (count - 1) >> 1; 273 const char* item = first + pos * size; 274 int compareResult = compare(item, key); 275 if (!compareResult) 276 return const_cast<char*>(item); 277 if (compareResult < 0) { 278 count -= (pos + 1); 279 first += (pos + 1) * size; 280 } else 281 count = pos; 282 } 283 284 return 0; 285 } 286 287 #define bsearch(key, base, count, size, compare) wtf_bsearch(key, base, count, size, compare) 288 #endif 289 264 290 // This version of placement new omits a 0 check. 265 291 enum NotNullTag { NotNull };
Note: See TracChangeset
for help on using the changeset viewer.