Browse Source

fix integer overflow

ibireme 9 years ago
parent
commit
8330d7f1d1
1 changed files with 1 additions and 2 deletions
  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];
     return queues[(cur) % queueCount];
 #undef MAX_QUEUE_COUNT
 #undef MAX_QUEUE_COUNT
 }
 }