소스 검색

fix integer overflow

ibireme 9 년 전
부모
커밋
8330d7f1d1
1개의 변경된 파일1개의 추가작업 그리고 2개의 파일을 삭제
  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
 }