2017-09-22 2 views
0

Ich habe eine Cocoapod 'SwiftProtobuf' installiert, aber es kommt mit diesem Fehler 'Integer Literal' 9223372036854775808 'überläuft, wenn in' Int 'gespeichert Der Fehler tritt innerhalb dieser Funktion in diesem Abschnitt:Fehlermeldung in swift protobuf CocoaPods

 if n >= 0x8000000000000000 { // -Int64.min 
      if n > 0x8000000000000000 { 

Hier ist die ganze Funktion:

internal mutating func nextSInt() throws -> Int64 { 
    if p == end { 
     throw TextFormatDecodingError.malformedNumber 
    } 
    let c = p[0] 
    if c == asciiMinus { // - 
     p += 1 
     // character after '-' must be digit 
     let digit = p[0] 
     if digit < asciiZero || digit > asciiNine { 
      throw TextFormatDecodingError.malformedNumber 
     } 
     let n = try nextUInt() 
     if n >= 0x8000000000000000 { // -Int64.min 
      if n > 0x8000000000000000 { 
       // Too large negative number 
       throw TextFormatDecodingError.malformedNumber 
      } else { 
       return Int64.min // Special case for Int64.min 
      } 
     } 
     return -Int64(bitPattern: n) 
    } else { 
     let n = try nextUInt() 
     if n > UInt64(bitPattern: Int64.max) { 
      throw TextFormatDecodingError.malformedNumber 
     } 
     return Int64(bitPattern: n) 
    } 
} 

Antwort

0

I verwendet 0xffffffff wie UInt32 und der Fehler ging weg.