Browse Source

fix integer overflow

ibireme 9 năm trước cách đây
mục cha
commit
8330d7f1d1
1 tập tin đã thay đổi với 1 bổ sung2 xóa
  1. 1 2
      YYText/Utility/YYTextAsyncLayer.m

+ 1 - 2
YYText/Utility/YYTextAsyncLayer.m

@@ -35,8 +35,7 @@ static dispatch_queue_t YYTextAsyncLayerGetDisplayQueue() {
             }
         }
     });
-    int32_t cur = OSAtomicIncrement32(&counter);
-    if (cur < 0) cur = -cur;
+    uint32_t cur = (uint32_t)OSAtomicIncrement32(&counter);
     return queues[(cur) % queueCount];
 #undef MAX_QUEUE_COUNT
 }