diff options
author | Araq <rumpf_a@web.de> | 2012-07-08 21:03:47 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-07-08 21:03:47 +0200 |
commit | 4fbba0a65ad310ba9498f1cf9f79eb0826b19f81 (patch) | |
tree | dece3596fbdf153263f5672b4011139f70a4df6a /lib | |
parent | 36247e0947699a56d5bc51d48188b6dda1815587 (diff) | |
download | Nim-4fbba0a65ad310ba9498f1cf9f79eb0826b19f81.tar.gz |
changed integer promotion rules; breaks bootstrapping and lots of code
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/core/typeinfo.nim | 2 | ||||
-rwxr-xr-x | lib/impure/db_postgres.nim | 6 | ||||
-rwxr-xr-x | lib/impure/db_sqlite.nim | 10 | ||||
-rwxr-xr-x | lib/impure/graphics.nim | 9 | ||||
-rwxr-xr-x | lib/impure/re.nim | 16 | ||||
-rw-r--r-- | lib/pure/oids.nim | 3 | ||||
-rwxr-xr-x | lib/pure/osproc.nim | 26 | ||||
-rwxr-xr-x | lib/pure/sockets.nim | 22 | ||||
-rwxr-xr-x | lib/pure/times.nim | 44 | ||||
-rwxr-xr-x | lib/system.nim | 16 | ||||
-rwxr-xr-x | lib/system/ansi_c.nim | 3 | ||||
-rwxr-xr-x | lib/system/repr.nim | 7 | ||||
-rwxr-xr-x | lib/system/sysio.nim | 8 | ||||
-rwxr-xr-x | lib/windows/windows.nim | 98 | ||||
-rwxr-xr-x | lib/wrappers/gtk/gtk2.nim | 2 | ||||
-rwxr-xr-x | lib/wrappers/gtk/pango.nim | 4 | ||||
-rwxr-xr-x | lib/wrappers/sdl/sdl.nim | 10 | ||||
-rwxr-xr-x | lib/wrappers/sdl/sdl_image.nim | 6 | ||||
-rwxr-xr-x | lib/wrappers/sdl/sdl_mixer.nim | 6 | ||||
-rwxr-xr-x | lib/wrappers/sdl/sdl_mixer_nosmpeg.nim | 6 | ||||
-rwxr-xr-x | lib/wrappers/sdl/sdl_net.nim | 6 | ||||
-rwxr-xr-x | lib/wrappers/sdl/sdl_ttf.nim | 6 | ||||
-rwxr-xr-x | lib/wrappers/sdl/smpeg.nim | 6 | ||||
-rwxr-xr-x | lib/wrappers/zip/zlib.nim | 9 |
24 files changed, 171 insertions, 160 deletions
diff --git a/lib/core/typeinfo.nim b/lib/core/typeinfo.nim index 549e4724a..9030b7b53 100755 --- a/lib/core/typeinfo.nim +++ b/lib/core/typeinfo.nim @@ -59,7 +59,7 @@ type rawType: PNimType ppointer = ptr pointer - pbyteArray = ptr array[0.. 0xffff, byte] + pbyteArray = ptr array[0.. 0xffff, int8] TGenSeq {.pure.} = object len, space: int diff --git a/lib/impure/db_postgres.nim b/lib/impure/db_postgres.nim index 506da9c84..19701f896 100755 --- a/lib/impure/db_postgres.nim +++ b/lib/impure/db_postgres.nim @@ -84,7 +84,7 @@ proc setupQuery(db: TDbConn, query: TSqlQuery, result = PQExec(db, q) if PQresultStatus(result) != PGRES_TUPLES_OK: dbError(db) -proc setRow(res: PPGresult, r: var TRow, line, cols: int) = +proc setRow(res: PPGresult, r: var TRow, line, cols: int32) = for col in 0..cols-1: setLen(r[col], 0) var x = PQgetvalue(res, line, col) @@ -96,7 +96,7 @@ iterator FastRows*(db: TDbConn, query: TSqlQuery, ## fast, but potenially dangerous: If the for-loop-body executes another ## query, the results can be undefined. For Postgres it is safe though. var res = setupQuery(db, query, args) - var L = int(PQnfields(res)) + var L = PQnfields(res) var result = newRow(L) for i in 0..PQntuples(res)-1: setRow(res, result, i, L) @@ -107,7 +107,7 @@ proc getRow*(db: TDbConn, query: TSqlQuery, args: openarray[string]): TRow = ## retrieves a single row. var res = setupQuery(db, query, args) - var L = int(PQnfields(res)) + var L = PQnfields(res) result = newRow(L) setRow(res, result, 0, L) PQclear(res) diff --git a/lib/impure/db_sqlite.nim b/lib/impure/db_sqlite.nim index b6c8003b9..dbeb1e594 100755 --- a/lib/impure/db_sqlite.nim +++ b/lib/impure/db_sqlite.nim @@ -64,7 +64,7 @@ proc TryExec*(db: TDbConn, query: TSqlQuery, ## tries to execute the query and returns true if successful, false otherwise. var q = dbFormat(query, args) var stmt: sqlite3.PStmt - if prepare_v2(db, q, q.len, stmt, nil) == SQLITE_OK: + if prepare_v2(db, q, q.len.cint, stmt, nil) == SQLITE_OK: if step(stmt) == SQLITE_DONE: result = finalize(stmt) == SQLITE_OK @@ -79,9 +79,9 @@ proc newRow(L: int): TRow = proc setupQuery(db: TDbConn, query: TSqlQuery, args: openarray[string]): PStmt = var q = dbFormat(query, args) - if prepare_v2(db, q, q.len, result, nil) != SQLITE_OK: dbError(db) + if prepare_v2(db, q, q.len.cint, result, nil) != SQLITE_OK: dbError(db) -proc setRow(stmt: PStmt, r: var TRow, cols: int) = +proc setRow(stmt: PStmt, r: var TRow, cols: cint) = for col in 0..cols-1: setLen(r[col], column_bytes(stmt, col)) # set capacity setLen(r[col], 0) @@ -94,7 +94,7 @@ iterator FastRows*(db: TDbConn, query: TSqlQuery, ## fast, but potenially dangerous: If the for-loop-body executes another ## query, the results can be undefined. For Sqlite it is safe though. var stmt = setupQuery(db, query, args) - var L = int(columnCount(stmt)) + var L = (columnCount(stmt)) var result = newRow(L) while step(stmt) == SQLITE_ROW: setRow(stmt, result, L) @@ -105,7 +105,7 @@ proc getRow*(db: TDbConn, query: TSqlQuery, args: openarray[string]): TRow = ## retrieves a single row. var stmt = setupQuery(db, query, args) - var L = int(columnCount(stmt)) + var L = (columnCount(stmt)) result = newRow(L) if step(stmt) == SQLITE_ROW: setRow(stmt, result, L) diff --git a/lib/impure/graphics.nim b/lib/impure/graphics.nim index 348907f9a..1392fd903 100755 --- a/lib/impure/graphics.nim +++ b/lib/impure/graphics.nim @@ -35,14 +35,15 @@ type proc toSdlColor*(c: TColor): Sdl.TColor = ## Convert colors.TColor to SDL.TColor var x = c.extractRGB - result.r = toU8(x.r) - result.g = toU8(x.g) - result.b = toU8(x.b) + result.r = x.r and 0xff + result.g = x.g and 0xff + result.b = x.b and 0xff proc createSdlColor*(sur: PSurface, c: TColor, alpha: int = 0): int32 = ## Creates a color using ``sdl.MapRGBA``. var x = c.extractRGB - return sdl.MapRGBA(sur.s.format, toU8(x.r), toU8(x.g), toU8(x.b), toU8(alpha)) + return sdl.MapRGBA(sur.s.format, x.r and 0xff, x.g and 0xff, + x.b and 0xff, alpha and 0xff) proc toSdlRect*(r: TRect): sdl.TRect = ## Convert ``graphics.TRect`` to ``sdl.TRect``. diff --git a/lib/impure/re.nim b/lib/impure/re.nim index 1fe1582bd..f3a6e5a44 100755 --- a/lib/impure/re.nim +++ b/lib/impure/re.nim @@ -82,7 +82,7 @@ proc matchOrFind(s: string, pattern: TRegEx, matches: var openarray[string], start, flags: cint): cint = var rawMatches: array[0..maxSubpatterns * 3 - 1, cint] - res = pcre.Exec(pattern.h, pattern.e, s, len(s), start, flags, + res = pcre.Exec(pattern.h, pattern.e, s, len(s).cint, start, flags, cast[ptr cint](addr(rawMatches)), maxSubpatterns * 3) if res < 0'i32: return res for i in 1..int(res)-1: @@ -100,7 +100,7 @@ proc findBounds*(s: string, pattern: TRegEx, matches: var openarray[string], ## is written into `matches` and ``(-1,0)`` is returned. var rawMatches: array[0..maxSubpatterns * 3 - 1, cint] - res = pcre.Exec(pattern.h, pattern.e, s, len(s), start, 0'i32, + res = pcre.Exec(pattern.h, pattern.e, s, len(s).cint, start, 0'i32, cast[ptr cint](addr(rawMatches)), maxSubpatterns * 3) if res < 0'i32: return (-1, 0) for i in 1..int(res)-1: @@ -119,7 +119,7 @@ proc findBounds*(s: string, pattern: TRegEx, ## ``(-1,0)`` is returned. var rawMatches: array[0..maxSubpatterns * 3 - 1, cint] - res = pcre.Exec(pattern.h, pattern.e, s, len(s), start, 0'i32, + res = pcre.Exec(pattern.h, pattern.e, s, len(s).cint, start, 0'i32, cast[ptr cint](addr(rawMatches)), maxSubpatterns * 3) if res < 0'i32: return (-1, 0) for i in 1..int(res)-1: @@ -135,14 +135,14 @@ proc findBounds*(s: string, pattern: TRegEx, ## match, ``(-1,0)`` is returned. var rawMatches: array[0..3 - 1, cint] - res = pcre.Exec(pattern.h, nil, s, len(s), start, 0'i32, + res = pcre.Exec(pattern.h, nil, s, len(s).cint, start, 0'i32, cast[ptr cint](addr(rawMatches)), 3) if res < 0'i32: return (int(res), 0) return (int(rawMatches[0]), int(rawMatches[1]-1)) proc matchOrFind(s: string, pattern: TRegEx, start, flags: cint): cint = var rawMatches: array [0..maxSubpatterns * 3 - 1, cint] - result = pcre.Exec(pattern.h, pattern.e, s, len(s), start, flags, + result = pcre.Exec(pattern.h, pattern.e, s, len(s).cint, start, flags, cast[ptr cint](addr(rawMatches)), maxSubpatterns * 3) if result >= 0'i32: result = rawMatches[1] - rawMatches[0] @@ -180,7 +180,7 @@ proc find*(s: string, pattern: TRegEx, matches: var openarray[string], ## is written into ``matches`` and -1 is returned. var rawMatches: array[0..maxSubpatterns * 3 - 1, cint] - res = pcre.Exec(pattern.h, pattern.e, s, len(s), start, 0'i32, + res = pcre.Exec(pattern.h, pattern.e, s, len(s).cint, start, 0'i32, cast[ptr cint](addr(rawMatches)), maxSubpatterns * 3) if res < 0'i32: return res for i in 1..int(res)-1: @@ -195,7 +195,7 @@ proc find*(s: string, pattern: TRegEx, start = 0): int = ## match, -1 is returned. var rawMatches: array[0..3 - 1, cint] - res = pcre.Exec(pattern.h, nil, s, len(s), start, 0'i32, + res = pcre.Exec(pattern.h, nil, s, len(s).cint, start, 0'i32, cast[ptr cint](addr(rawMatches)), 3) if res < 0'i32: return res return rawMatches[0] @@ -205,7 +205,7 @@ iterator findAll*(s: string, pattern: TRegEx, start = 0): string = var i = int32(start) var rawMatches: array[0..maxSubpatterns * 3 - 1, cint] while true: - let res = pcre.Exec(pattern.h, pattern.e, s, len(s), i, 0'i32, + let res = pcre.Exec(pattern.h, pattern.e, s, len(s).cint, i, 0'i32, cast[ptr cint](addr(rawMatches)), maxSubpatterns * 3) if res < 0'i32: break let a = rawMatches[0] diff --git a/lib/pure/oids.nim b/lib/pure/oids.nim index b84c3d53e..0fd1d8cd2 100644 --- a/lib/pure/oids.nim +++ b/lib/pure/oids.nim @@ -53,7 +53,8 @@ proc oidToString*(oid: TOid, str: cstring) = str[24] = '\0' var - incr, fuzz: int + incr: int + fuzz: int32 proc genOid*(): TOid = ## generates a new OID. diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim index 808c0735e..6ed7e8d2c 100755 --- a/lib/pure/osproc.nim +++ b/lib/pure/osproc.nim @@ -244,7 +244,7 @@ when defined(Windows) and not defined(useNimRtl): var s = PFileHandleStream(s) if s.atTheEnd: return 0 var br: int32 - var a = winlean.ReadFile(s.handle, buffer, bufLen, br, nil) + var a = winlean.ReadFile(s.handle, buffer, bufLen.cint, br, nil) # TRUE and zero bytes returned (EOF). # TRUE and n (>0) bytes returned (good data). # FALSE and bytes returned undefined (system error). @@ -255,7 +255,7 @@ when defined(Windows) and not defined(useNimRtl): proc hsWriteData(s: PStream, buffer: pointer, bufLen: int) = var s = PFileHandleStream(s) var bytesWritten: int32 - var a = winlean.writeFile(s.handle, buffer, bufLen, bytesWritten, nil) + var a = winlean.writeFile(s.handle, buffer, bufLen.cint, bytesWritten, nil) if a == 0: OSError() proc newFileHandleStream(handle: THandle): PFileHandleStream = @@ -293,7 +293,7 @@ when defined(Windows) and not defined(useNimRtl): proc CreatePipeHandles(Rdhandle, WrHandle: var THandle) = var piInheritablePipe: TSecurityAttributes - piInheritablePipe.nlength = SizeOF(TSecurityAttributes) + piInheritablePipe.nlength = SizeOF(TSecurityAttributes).cint piInheritablePipe.lpSecurityDescriptor = nil piInheritablePipe.Binherithandle = 1 if CreatePipe(Rdhandle, Wrhandle, piInheritablePipe, 1024) == 0'i32: @@ -313,7 +313,7 @@ when defined(Windows) and not defined(useNimRtl): success: int hi, ho, he: THandle new(result) - SI.cb = SizeOf(SI) + SI.cb = SizeOf(SI).cint if poParentStreams notin options: SI.dwFlags = STARTF_USESTDHANDLES # STARTF_USESHOWWINDOW or CreatePipeHandles(SI.hStdInput, HI) @@ -323,16 +323,16 @@ when defined(Windows) and not defined(useNimRtl): HE = HO else: CreatePipeHandles(HE, Si.hStdError) - result.inputHandle = hi - result.outputHandle = ho - result.errorHandle = he + result.inputHandle = TFileHandle(hi) + result.outputHandle = TFileHandle(ho) + result.errorHandle = TFileHandle(he) else: SI.hStdError = GetStdHandle(STD_ERROR_HANDLE) SI.hStdInput = GetStdHandle(STD_INPUT_HANDLE) SI.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE) - result.inputHandle = si.hStdInput - result.outputHandle = si.hStdOutput - result.errorHandle = si.hStdError + result.inputHandle = TFileHandle(si.hStdInput) + result.outputHandle = TFileHandle(si.hStdOutput) + result.errorHandle = TFileHandle(si.hStdError) var cmdl: cstring when false: # poUseShell in options: @@ -394,7 +394,7 @@ when defined(Windows) and not defined(useNimRtl): discard TerminateProcess(p.FProcessHandle, 0) proc waitForExit(p: PProcess, timeout: int = -1): int = - discard WaitForSingleObject(p.FProcessHandle, timeout) + discard WaitForSingleObject(p.FProcessHandle, timeout.int32) var res: int32 discard GetExitCodeProcess(p.FProcessHandle, res) @@ -424,7 +424,7 @@ when defined(Windows) and not defined(useNimRtl): ProcInfo: TProcessInformation process: THandle L: int32 - SI.cb = SizeOf(SI) + SI.cb = SizeOf(SI).cint SI.hStdError = GetStdHandle(STD_ERROR_HANDLE) SI.hStdInput = GetStdHandle(STD_INPUT_HANDLE) SI.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE) @@ -454,7 +454,7 @@ when defined(Windows) and not defined(useNimRtl): for i in 0..readfds.len()-1: rfds[i] = readfds[i].FProcessHandle - var ret = waitForMultipleObjects(readfds.len, + var ret = waitForMultipleObjects(readfds.len.int32, addr(rfds), 0'i32, timeout) case ret of WAIT_TIMEOUT: diff --git a/lib/pure/sockets.nim b/lib/pure/sockets.nim index 8c15c6adb..162e644d9 100755 --- a/lib/pure/sockets.nim +++ b/lib/pure/sockets.nim @@ -343,7 +343,7 @@ proc bindAddr*(socket: TSocket, port = TPort(0), address = "") = name.sin_port = sockets.htons(int16(port)) name.sin_addr.s_addr = sockets.htonl(INADDR_ANY) if bindSocket(socket.fd, cast[ptr TSockAddr](addr(name)), - sizeof(name)) < 0'i32: + sizeof(name).TSockLen) < 0'i32: OSError() else: var hints: TAddrInfo @@ -366,7 +366,7 @@ when false: name.sin_port = sockets.htons(int16(port)) name.sin_addr.s_addr = sockets.htonl(INADDR_ANY) if bindSocket(cint(socket), cast[ptr TSockAddr](addr(name)), - sizeof(name)) < 0'i32: + sizeof(name).TSockLen) < 0'i32: OSError() proc getSockName*(socket: TSocket): TPort = @@ -378,7 +378,7 @@ proc getSockName*(socket: TSocket): TPort = name.sin_family = posix.AF_INET #name.sin_port = htons(cint16(port)) #name.sin_addr.s_addr = htonl(INADDR_ANY) - var namelen: cint = sizeof(name) + var namelen = sizeof(name).TSockLen if getsockname(socket.fd, cast[ptr TSockAddr](addr(name)), addr(namelen)) == -1'i32: OSError() @@ -398,7 +398,7 @@ proc acceptAddr*(server: TSocket): tuple[client: TSocket, address: string] = ## **Warning:** This function might block even if socket is non-blocking ## when using SSL. var sockAddress: Tsockaddr_in - var addrLen: cint = sizeof(sockAddress) + var addrLen = sizeof(sockAddress).TSockLen var sock = accept(server.fd, cast[ptr TSockAddr](addr(sockAddress)), addr(addrLen)) @@ -477,9 +477,9 @@ proc getServByName*(name, proto: string): TServent = proc getServByPort*(port: TPort, proto: string): TServent = ## well-known getservbyport proc. when defined(Windows): - var s = winlean.getservbyport(ze(int16(port)), proto) + var s = winlean.getservbyport(ze(int16(port)).cint, proto) else: - var s = posix.getservbyport(ze(int16(port)), proto) + var s = posix.getservbyport(ze(int16(port)).cint, proto) if s == nil: OSError() result.name = $s.s_name result.aliases = cstringArrayToSeq(s.s_aliases) @@ -492,11 +492,11 @@ proc getHostByAddr*(ip: string): THostEnt = myaddr.s_addr = inet_addr(ip) when defined(windows): - var s = winlean.gethostbyaddr(addr(myaddr), sizeof(myaddr), + var s = winlean.gethostbyaddr(addr(myaddr), sizeof(myaddr).cint, cint(sockets.AF_INET)) if s == nil: OSError() else: - var s = posix.gethostbyaddr(addr(myaddr), sizeof(myaddr), + var s = posix.gethostbyaddr(addr(myaddr), sizeof(myaddr).cint, cint(posix.AF_INET)) if s == nil: raise newException(EOS, $hStrError(h_errno)) @@ -539,7 +539,7 @@ proc getHostByName*(name: string): THostEnt = proc getSockOptInt*(socket: TSocket, level, optname: int): int = ## getsockopt for integer options. var res: cint - var size: cint = sizeof(res) + var size = sizeof(res).cint if getsockopt(socket.fd, cint(level), cint(optname), addr(res), addr(size)) < 0'i32: OSError() @@ -549,7 +549,7 @@ proc setSockOptInt*(socket: TSocket, level, optname, optval: int) = ## setsockopt for integer options. var value = cint(optval) if setsockopt(socket.fd, cint(level), cint(optname), addr(value), - sizeof(value)) < 0'i32: + sizeof(value).cint) < 0'i32: OSError() proc connect*(socket: TSocket, name: string, port = TPort(0), @@ -608,7 +608,7 @@ proc connect*(socket: TSocket, name: string, port = TPort(0), of AF_INET: s.sin_family = posix.AF_INET of AF_INET6: s.sin_family = posix.AF_INET6 else: nil - if connect(socket.fd, cast[ptr TSockAddr](addr(s)), sizeof(s)) < 0'i32: + if connect(socket.fd, cast[ptr TSockAddr](addr(s)), sizeof(s).cint) < 0'i32: OSError() proc connectAsync*(socket: TSocket, name: string, port = TPort(0), diff --git a/lib/pure/times.nim b/lib/pure/times.nim index e6163ad8c..622c2655f 100755 --- a/lib/pure/times.nim +++ b/lib/pure/times.nim @@ -111,7 +111,7 @@ type ## in the range 0 to 23. monthday*: range[1..31] ## The day of the month, in the range 1 to 31. month*: TMonth ## The current month. - year*: int ## The current year. + year*: range[-10_000..10_000] ## The current year. weekday*: TWeekDay ## The current day of the week. yearday*: range[0..365] ## The number of days since January 1, ## in the range 0 to 365. @@ -122,7 +122,7 @@ type timezone*: int ## The offset of the (non-DST) timezone in seconds ## west of UTC. - TTimeInterval* = object + TTimeInterval* {.pure.} = object ## a time interval miliseconds*: int ## The number of miliseconds seconds*: int ## The number of seconds minutes*: int ## The number of minutes @@ -150,11 +150,11 @@ proc `$` *(timeInfo: TTimeInfo): string proc `$` *(time: TTime): string ## converts a calendar time to a string representation. -proc `-` *(a, b: TTime): int64{. +proc `-`*(a, b: TTime): int64 {. rtl, extern: "ntDiffTime".} ## computes the difference of two calendar times. Result is in seconds. -proc `<` * (a, b: TTime): bool {. +proc `<`*(a, b: TTime): bool {. rtl, extern: "ntLtTime".} = ## returns true iff ``a < b``, that is iff a happened before b. result = a - b < 0 @@ -175,8 +175,8 @@ proc getStartMilsecs*(): int {.deprecated.} ## get the miliseconds from the start of the program. **Deprecated since ## version 0.8.10.** Use ``epochTime`` or ``cpuTime`` instead. -proc newInterval*(miliseconds, seconds, minutes, hours, days, months, - years: int = 0): TTimeInterval = +proc initInterval*(miliseconds, seconds, minutes, hours, days, months, + years: int = 0): TTimeInterval = ## creates a new ``TTimeInterval``. result.miliseconds = miliseconds result.seconds = seconds @@ -188,23 +188,20 @@ proc newInterval*(miliseconds, seconds, minutes, hours, days, months, proc isLeapYear(year: int): bool = if year mod 400 == 0: - return true + return true elif year mod 100 == 0: - return false + return false elif year mod 4 == 0: - return true + return true else: - return false + return false proc getDaysInMonth(month: TMonth, year: int): int = # http://www.dispersiondesign.com/articles/time/number_of_days_in_a_month - if month == mFeb: # Feb - if isLeapYear(year): - result = 29 - else: - result = 28 - elif month in [mApr, mJun, mSep, mNov]: result = 30 - else: result = 31 + case month + of mFeb: result = if isLeapYear(year): 29 else: 28 + of mApr, mJun, mSep, mNov: result = 30 + else: result = 31 proc calculateSeconds(a: TTimeInfo, interval: TTimeInterval): float = var anew = a @@ -228,9 +225,10 @@ proc calculateSeconds(a: TTimeInfo, interval: TTimeInterval): float = proc `+`*(a: TTimeInfo, interval: TTimeInterval): TTimeInfo = ## adds ``interval`` time. ## - ## **Note:** This has been only briefly tested and it may not be very accurate. + ## **Note:** This has been only briefly tested and it may not be + ## very accurate. let t = timeInfoToTime(a) - var secs = calculateSeconds(a, interval) + let secs = calculateSeconds(a, interval) if a.tzname == "UTC": result = getGMTime(TTime(float(t) + secs)) else: @@ -242,7 +240,7 @@ proc `-`*(a: TTimeInfo, interval: TTimeInterval): TTimeInfo = ## **Note:** This has been only briefly tested, it is inaccurate especially ## when you subtract so much that you reach the Julian calendar. let t = timeInfoToTime(a) - var secs = calculateSeconds(a, interval) + let secs = calculateSeconds(a, interval) if a.tzname == "UTC": result = getGMTime(TTime(float(t) - secs)) else: @@ -329,7 +327,7 @@ when not defined(ECMAScript): proc timeInfoToTM(t: TTimeInfo): structTM = const - weekDays: array [TWeekDay, int] = [1, 2, 3, 4, 5, 6, 0] + weekDays: array [TWeekDay, int8] = [1'i8,2'i8,3'i8,4'i8,5'i8,6'i8,0'i8] result.second = t.second result.minute = t.minute result.hour = t.hour @@ -362,13 +360,13 @@ when not defined(ECMAScript): var a = t result = tmToTimeInfo(localtime(addr(a))[], true) # copying is needed anyway to provide reentrancity; thus - # the convertion is not expensive + # the conversion is not expensive proc getGMTime(t: TTime): TTimeInfo = var a = t result = tmToTimeInfo(gmtime(addr(a))[], false) # copying is needed anyway to provide reentrancity; thus - # the convertion is not expensive + # the conversion is not expensive proc TimeInfoToTime(timeInfo: TTimeInfo): TTime = var cTimeInfo = timeInfo # for C++ we have to make a copy, diff --git a/lib/system.nim b/lib/system.nim index e90ca56e1..69733d6a1 100755 --- a/lib/system.nim +++ b/lib/system.nim @@ -182,8 +182,8 @@ when not defined(EcmaScript) and not defined(NimrodVM): include "system/hti" type - Byte* = Int8 ## this is an alias for ``int8``, that is a signed - ## int 8 bits wide. + Byte* = uInt8 ## this is an alias for ``uint8``, that is an unsigned + ## int 8 bits wide. Natural* = range[0..high(int)] ## is an int type ranging from zero to the maximum value @@ -967,7 +967,7 @@ type type # these work for most platforms: cchar* {.importc: "char", nodecl.} = char ## This is the same as the type ``char`` in *C*. - cschar* {.importc: "signed char", nodecl.} = byte + cschar* {.importc: "signed char", nodecl.} = int8 ## This is the same as the type ``signed char`` in *C*. cshort* {.importc: "short", nodecl.} = int16 ## This is the same as the type ``short`` in *C*. @@ -1156,6 +1156,10 @@ proc `$` *(x: int64): string {.magic: "Int64ToStr", noSideEffect.} ## The stingify operator for an integer argument. Returns `x` ## converted to a decimal string. +proc `$` *(x: uint64): string {.noSideEffect.} + ## The stingify operator for an unsigned integer argument. Returns `x` + ## converted to a decimal string. + proc `$` *(x: float): string {.magic: "FloatToStr", noSideEffect.} ## The stingify operator for a float argument. Returns `x` ## converted to a decimal string. @@ -1177,7 +1181,7 @@ proc `$` *(x: string): string {.magic: "StrToStr", noSideEffect.} ## as it is. This operator is useful for generic code, so ## that ``$expr`` also works if ``expr`` is already a string. -proc `$` *[T](x: ordinal[T]): string {.magic: "EnumToStr", noSideEffect.} +proc `$` *[TEnum: enum](x: TEnum): string {.magic: "EnumToStr", noSideEffect.} ## The stingify operator for an enumeration argument. This works for ## any enumeration type thanks to compiler magic. If ## a ``$`` operator for a concrete enumeration is provided, this is @@ -1850,7 +1854,7 @@ when not defined(EcmaScript) and not defined(NimrodVM): proc getFileSize*(f: TFile): int64 ## retrieves the file size (in bytes) of `f`. - proc ReadBytes*(f: TFile, a: var openarray[byte], start, len: int): int + proc ReadBytes*(f: TFile, a: var openarray[int8], start, len: int): int ## reads `len` bytes into the buffer `a` starting at ``a[start]``. Returns ## the actual number of bytes that have been read which may be less than ## `len` (if not as many bytes are remaining), but not greater. @@ -1865,7 +1869,7 @@ when not defined(EcmaScript) and not defined(NimrodVM): ## the actual number of bytes that have been read which may be less than ## `len` (if not as many bytes are remaining), but not greater. - proc writeBytes*(f: TFile, a: openarray[byte], start, len: int): int + proc writeBytes*(f: TFile, a: openarray[int8], start, len: int): int ## writes the bytes of ``a[start..start+len-1]`` to the file `f`. Returns ## the number of actual written bytes, which may be less than `len` in case ## of an error. diff --git a/lib/system/ansi_c.nim b/lib/system/ansi_c.nim index 3376b9413..7c2c234c2 100755 --- a/lib/system/ansi_c.nim +++ b/lib/system/ansi_c.nim @@ -71,7 +71,8 @@ proc c_fopen(filename, mode: cstring): C_TextFileStar {. importc: "fopen", nodecl.} proc c_fclose(f: C_TextFileStar) {.importc: "fclose", nodecl.} -proc c_sprintf(buf, frmt: CString) {.nodecl, importc: "sprintf", varargs.} +proc c_sprintf(buf, frmt: CString) {.nodecl, importc: "sprintf", varargs, + noSideEffect.} # we use it only in a way that cannot lead to security issues proc c_fread(buf: Pointer, size, n: int, f: C_BinaryFileStar): int {. diff --git a/lib/system/repr.nim b/lib/system/repr.nim index 83fa7aa1d..028887b4c 100755 --- a/lib/system/repr.nim +++ b/lib/system/repr.nim @@ -20,6 +20,11 @@ proc reprPointer(x: pointer): string {.compilerproc.} = c_sprintf(buf, "%p", x) return $buf +proc `$`(x: uint64): string = + var buf: array [0..59, char] + c_sprintf(buf, "%llu", x) + return $buf + proc reprStrAux(result: var string, s: string) = if cast[pointer](s) == nil: add result, "nil" @@ -67,7 +72,7 @@ proc reprEnum(e: int, typ: PNimType): string {.compilerRtl.} = result = $e & " (invalid data!)" type - pbyteArray = ptr array[0.. 0xffff, byte] + pbyteArray = ptr array[0.. 0xffff, int8] proc addSetElem(result: var string, elem: int, typ: PNimType) = case typ.kind diff --git a/lib/system/sysio.nim b/lib/system/sysio.nim index ac0880f79..d5234e62f 100755 --- a/lib/system/sysio.nim +++ b/lib/system/sysio.nim @@ -222,17 +222,17 @@ proc fwrite(buf: Pointer, size, n: int, f: TFile): int {. proc readBuffer(f: TFile, buffer: pointer, len: int): int = result = fread(buffer, 1, len, f) -proc ReadBytes(f: TFile, a: var openarray[byte], start, len: int): int = +proc ReadBytes(f: TFile, a: var openarray[int8], start, len: int): int = result = readBuffer(f, addr(a[start]), len) proc ReadChars(f: TFile, a: var openarray[char], start, len: int): int = result = readBuffer(f, addr(a[start]), len) -proc writeBytes(f: TFile, a: openarray[byte], start, len: int): int = - var x = cast[ptr array[0..1000_000_000, byte]](a) +proc writeBytes(f: TFile, a: openarray[int8], start, len: int): int = + var x = cast[ptr array[0..1000_000_000, int8]](a) result = writeBuffer(f, addr(x[start]), len) proc writeChars(f: TFile, a: openarray[char], start, len: int): int = - var x = cast[ptr array[0..1000_000_000, byte]](a) + var x = cast[ptr array[0..1000_000_000, int8]](a) result = writeBuffer(f, addr(x[start]), len) proc writeBuffer(f: TFile, buffer: pointer, len: int): int = result = fwrite(buffer, 1, len, f) diff --git a/lib/windows/windows.nim b/lib/windows/windows.nim index d3ff5ad91..ff28ab255 100755 --- a/lib/windows/windows.nim +++ b/lib/windows/windows.nim @@ -13,8 +13,8 @@ {.deadCodeElim: on.} type - WideChar* = int16 - PWideChar* = ptr int16 + WideChar* = uint16 + PWideChar* = ptr uint16 type # WinNT.h -- Defines the 32-Bit Windows types and constants SHORT* = int16 @@ -72,7 +72,6 @@ type # WinDef.h -- Basic Windows Type Definitions DWORD* = int32 WINBOOL* = int32 - BYTE* = char WORD* = int16 # FLOAT* = float PFLOAT* = ptr FLOAT @@ -296,13 +295,13 @@ type when defined(winUnicode): type - PTBYTE* = ptr int16 + PTBYTE* = ptr uint16 PTCH* = PWideChar PTCHAR* = PWideChar PTSTR* = PWideChar else: type - PTBYTE* = ptr int8 + PTBYTE* = ptr byte PTCH* = cstring PTCHAR* = cstring PTSTR* = cstring @@ -316,12 +315,12 @@ type when defined(winUnicode): type - TBYTE* = int16 + TBYTE* = uint16 TCHAR* = widechar BCHAR* = int16 else: type - TBYTE* = int8 + TBYTE* = uint8 TCHAR* = char BCHAR* = int8 type @@ -7432,34 +7431,34 @@ type PDCB* = ptr DCB const - bm_DCB_fBinary* = 0x00000001 - bp_DCB_fBinary* = 0 + bm_DCB_fBinary* = 1 + bp_DCB_fBinary* = 0'i32 bm_DCB_fParity* = 0x00000002 - bp_DCB_fParity* = 1 + bp_DCB_fParity* = 1'i32 bm_DCB_fOutxCtsFlow* = 0x00000004 - bp_DCB_fOutxCtsFlow* = 2 + bp_DCB_fOutxCtsFlow* = 2'i32 bm_DCB_fOutxDsrFlow* = 0x00000008 - bp_DCB_fOutxDsrFlow* = 3 + bp_DCB_fOutxDsrFlow* = 3'i32 bm_DCB_fDtrControl* = 0x00000030 - bp_DCB_fDtrControl* = 4 + bp_DCB_fDtrControl* = 4'i32 bm_DCB_fDsrSensitivity* = 0x00000040 - bp_DCB_fDsrSensitivity* = 6 + bp_DCB_fDsrSensitivity* = 6'i32 bm_DCB_fTXContinueOnXoff* = 0x00000080 - bp_DCB_fTXContinueOnXoff* = 7 + bp_DCB_fTXContinueOnXoff* = 7'i32 bm_DCB_fOutX* = 0x00000100 - bp_DCB_fOutX* = 8 + bp_DCB_fOutX* = 8'i32 bm_DCB_fInX* = 0x00000200 - bp_DCB_fInX* = 9 + bp_DCB_fInX* = 9'i32 bm_DCB_fErrorChar* = 0x00000400 - bp_DCB_fErrorChar* = 10 + bp_DCB_fErrorChar* = 10'i32 bm_DCB_fNull* = 0x00000800 - bp_DCB_fNull* = 11 + bp_DCB_fNull* = 11'i32 bm_DCB_fRtsControl* = 0x00003000 - bp_DCB_fRtsControl* = 12 + bp_DCB_fRtsControl* = 12'i32 bm_DCB_fAbortOnError* = 0x00004000 - bp_DCB_fAbortOnError* = 14 + bp_DCB_fAbortOnError* = 14'i32 bm_DCB_fDummy2* = 0xFFFF8000'i32 - bp_DCB_fDummy2* = 15 + bp_DCB_fDummy2* = 15'i32 proc fBinary*(a: var DCB): DWORD proc set_fBinary*(a: var DCB, fBinary: DWORD) @@ -7575,21 +7574,21 @@ type const bm_COMSTAT_fCtsHold* = 0x00000001 - bp_COMSTAT_fCtsHold* = 0 + bp_COMSTAT_fCtsHold* = 0'i32 bm_COMSTAT_fDsrHold* = 0x00000002 - bp_COMSTAT_fDsrHold* = 1 + bp_COMSTAT_fDsrHold* = 1'i32 bm_COMSTAT_fRlsdHold* = 0x00000004 - bp_COMSTAT_fRlsdHold* = 2 + bp_COMSTAT_fRlsdHold* = 2'i32 bm_COMSTAT_fXoffHold* = 0x00000008 - bp_COMSTAT_fXoffHold* = 3 + bp_COMSTAT_fXoffHold* = 3'i32 bm_COMSTAT_fXoffSent* = 0x00000010 - bp_COMSTAT_fXoffSent* = 4 + bp_COMSTAT_fXoffSent* = 4'i32 bm_COMSTAT_fEof* = 0x00000020 - bp_COMSTAT_fEof* = 5 + bp_COMSTAT_fEof* = 5'i32 bm_COMSTAT_fTxim* = 0x00000040 - bp_COMSTAT_fTxim* = 6 + bp_COMSTAT_fTxim* = 6'i32 bm_COMSTAT_fReserved* = 0xFFFFFF80'i32 - bp_COMSTAT_fReserved* = 7 + bp_COMSTAT_fReserved* = 7'i32 proc fCtsHold*(a: var COMSTAT): DWORD # should be renamed to get_<x>? @@ -9984,25 +9983,25 @@ type const bm_LDT_ENTRY_BaseMid* = 0x000000FF - bp_LDT_ENTRY_BaseMid* = 0 + bp_LDT_ENTRY_BaseMid* = 0'i32 bm_LDT_ENTRY_Type* = 0x00001F00 - bp_LDT_ENTRY_Type* = 8 + bp_LDT_ENTRY_Type* = 8'i32 bm_LDT_ENTRY_Dpl* = 0x00006000 - bp_LDT_ENTRY_Dpl* = 13 + bp_LDT_ENTRY_Dpl* = 13'i32 bm_LDT_ENTRY_Pres* = 0x00008000 - bp_LDT_ENTRY_Pres* = 15 + bp_LDT_ENTRY_Pres* = 15'i32 bm_LDT_ENTRY_LimitHi* = 0x000F0000 - bp_LDT_ENTRY_LimitHi* = 16 + bp_LDT_ENTRY_LimitHi* = 16'i32 bm_LDT_ENTRY_Sys* = 0x00100000 - bp_LDT_ENTRY_Sys* = 20 + bp_LDT_ENTRY_Sys* = 20'i32 bm_LDT_ENTRY_Reserved_0* = 0x00200000 - bp_LDT_ENTRY_Reserved_0* = 21 + bp_LDT_ENTRY_Reserved_0* = 21'i32 bm_LDT_ENTRY_Default_Big* = 0x00400000 - bp_LDT_ENTRY_Default_Big* = 22 + bp_LDT_ENTRY_Default_Big* = 22'i32 bm_LDT_ENTRY_Granularity* = 0x00800000 - bp_LDT_ENTRY_Granularity* = 23 + bp_LDT_ENTRY_Granularity* = 23'i32 bm_LDT_ENTRY_BaseHi* = 0xFF000000 - bp_LDT_ENTRY_BaseHi* = 24 + bp_LDT_ENTRY_BaseHi* = 24'i32 type LOCALESIGNATURE* {.final, pure.} = object @@ -22820,7 +22819,7 @@ proc SEXT_HIWORD*(L: int32): int32 = proc ZEXT_HIWORD*(L: int32): int32 = # return type might be wrong - result = ze(HIWORD(L)) + result = HIWORD(L) and 0xffff'i32 proc SEXT_LOWORD*(L: int32): int32 = result = LOWORD(L) @@ -22869,13 +22868,13 @@ proc MAKEWPARAM*(L, h: int32): WPARAM = result = WPARAM(MAKELONG(L, h)) proc GET_X_LPARAM*(lp: Windows.LParam): int32 = - result = int16(LOWORD(lp)) + result = LOWORD(lp.int32) proc GET_Y_LPARAM*(lp: Windows.LParam): int32 = - result = int16(HIWORD(lp)) + result = HIWORD(lp.int32) proc UNICODE_NULL*(): WCHAR = - result = 0'i16 + result = 0'u16 @@ -23500,7 +23499,8 @@ proc ListView_EnsureVisible(hwndLV: HWND, i, fPartialOK: int32): LRESULT = MAKELPARAM(fPartialOK, 0)) proc ListView_FindItem(wnd: HWND, iStart: int32, lvfi: var LV_FINDINFO): int32 = - result = SendMessage(wnd, LVM_FINDITEM, WPARAM(iStart), cast[LPARAM](addr(lvfi))) + result = SendMessage(wnd, LVM_FINDITEM, WPARAM(iStart), + cast[LPARAM](addr(lvfi))).int32 proc ListView_GetBkColor(wnd: HWND): LRESULT = result = SendMessage(wnd, LVM_GETBKCOLOR, 0, 0) @@ -23534,7 +23534,7 @@ proc ListView_GetItemCount(wnd: HWND): LRESULT = proc ListView_GetItemPosition(hwndLV: HWND, i: int32, pt: var POINT): int32 = result = SendMessage(hwndLV, LVM_GETITEMPOSITION, WPARAM(int32(i)), - cast[LPARAM](addr(pt))) + cast[LPARAM](addr(pt))).int32 proc ListView_GetItemSpacing(hwndLV: HWND, fSmall: int32): LRESULT = result = SendMessage(hwndLV, LVM_GETITEMSPACING, fSmall, 0) @@ -23878,10 +23878,10 @@ proc GetLargestConsoleWindowSize(hConsoleOutput: HANDLE): COORD = result.x = toU16(res shr 16) proc Succeeded(Status: HRESULT): WINBOOL = - result = (Status and 0x80000000'i32) + result = (Status and 0x80000000).WinBool proc Failed(Status: HRESULT): WINBOOL = - result = (Status and 0x80000000'i32) + result = (Status and 0x80000000).WinBool proc IsError(Status: HRESULT): WINBOOL = result = ord((int(Status) shr 31) == SEVERITY_ERROR) @@ -23920,7 +23920,7 @@ proc MAKELCID(LangId, SortId: int16): DWORD = result = toU32((ze(SortId) shl 16) or ze(LangId)) proc MAKESORTLCID(LangId, SortId, SortVersion: int16): DWORD = - result = MAKELCID(LangId, SortId) or int(SortVersion shl 20'i32) + result = MAKELCID(LangId, SortId) or (SortVersion shl 20'i32) proc LANGIDFROMLCID(LocaleId: LCID): int16 = result = toU16(LocaleId) diff --git a/lib/wrappers/gtk/gtk2.nim b/lib/wrappers/gtk/gtk2.nim index 9f455e5ba..515b65002 100755 --- a/lib/wrappers/gtk/gtk2.nim +++ b/lib/wrappers/gtk/gtk2.nim @@ -16257,7 +16257,7 @@ proc COLUMN_REQUESTED_WIDTH*(column: PTreeViewColumn): int32 = MaxWidth = column.max_width else: MaxWidth = column.requested_width - result = CLAMP(column.requested_width, MinWidth, MaxWidth) + result = CLAMP(column.requested_width, MinWidth, MaxWidth).int32 proc DRAW_EXPANDERS*(tree_view: PTreeView): bool = result = (not (FLAG_SET(tree_view, TREE_VIEW_IS_LIST))) and diff --git a/lib/wrappers/gtk/pango.nim b/lib/wrappers/gtk/pango.nim index cc6acb005..5d9fcd96f 100755 --- a/lib/wrappers/gtk/pango.nim +++ b/lib/wrappers/gtk/pango.nim @@ -878,10 +878,10 @@ proc get_tab*(tab_array: PTabArray, tab_index: gint, proc get_positions_in_pixels*(tab_array: PTabArray): gboolean{.cdecl, dynlib: lib, importc: "pango_tab_array_get_positions_in_pixels".} proc ASCENT*(rect: TRectangle): int32 = - result = - int(rect.y) + result = -rect.y proc DESCENT*(rect: TRectangle): int32 = - result = int(rect.y) + int(rect.height) + result = (rect.y) + (rect.height) proc LBEARING*(rect: TRectangle): int32 = result = rect.x diff --git a/lib/wrappers/sdl/sdl.nim b/lib/wrappers/sdl/sdl.nim index a48cb59ef..597a9b0b0 100755 --- a/lib/wrappers/sdl/sdl.nim +++ b/lib/wrappers/sdl/sdl.nim @@ -280,9 +280,9 @@ else: const LibName = "libSDL.so(|.1|.0)" const - MAJOR_VERSION* = 1'i8 - MINOR_VERSION* = 2'i8 - PATCHLEVEL* = 11'i8 # SDL.h constants + MAJOR_VERSION* = 1 + MINOR_VERSION* = 2 + PATCHLEVEL* = 11 # SDL.h constants INIT_TIMER* = 0x00000001 INIT_AUDIO* = 0x00000010 INIT_VIDEO* = 0x00000020 @@ -2523,8 +2523,8 @@ proc AllocSurface(flags: int32, width, height, depth: int, AMask) proc MustLock(Surface: PSurface): bool = - Result = ((surface[] .offset != 0) or - ((surface[] .flags and (HWSURFACE or ASYNCBLIT or RLEACCEL)) != 0)) + Result = ((surface[].offset != 0) or + ((surface[].flags and (HWSURFACE or ASYNCBLIT or RLEACCEL)) != 0)) proc LockMutex(mutex: Pmutex): int = Result = mutexP(mutex) diff --git a/lib/wrappers/sdl/sdl_image.nim b/lib/wrappers/sdl/sdl_image.nim index cc770a07f..7df9aedd4 100755 --- a/lib/wrappers/sdl/sdl_image.nim +++ b/lib/wrappers/sdl/sdl_image.nim @@ -141,9 +141,9 @@ else: const ImageLibName = "libSDL_image.so" const - IMAGE_MAJOR_VERSION* = 1'i8 - IMAGE_MINOR_VERSION* = 2'i8 - IMAGE_PATCHLEVEL* = 5'i8 + IMAGE_MAJOR_VERSION* = 1 + IMAGE_MINOR_VERSION* = 2 + IMAGE_PATCHLEVEL* = 5 # This macro can be used to fill a version structure with the compile-time # version of the SDL_image library. diff --git a/lib/wrappers/sdl/sdl_mixer.nim b/lib/wrappers/sdl/sdl_mixer.nim index 09abe182f..9199a9271 100755 --- a/lib/wrappers/sdl/sdl_mixer.nim +++ b/lib/wrappers/sdl/sdl_mixer.nim @@ -161,9 +161,9 @@ else: const MixerLibName = "libSDL_mixer.so" const - MAJOR_VERSION* = 1'i8 - MINOR_VERSION* = 2'i8 - PATCHLEVEL* = 7'i8 # Backwards compatibility + MAJOR_VERSION* = 1 + MINOR_VERSION* = 2 + PATCHLEVEL* = 7 # Backwards compatibility CHANNELS* = 8 # Good default values for a PC soundcard DEFAULT_FREQUENCY* = 22050 diff --git a/lib/wrappers/sdl/sdl_mixer_nosmpeg.nim b/lib/wrappers/sdl/sdl_mixer_nosmpeg.nim index 885e9845b..11f00e0a7 100755 --- a/lib/wrappers/sdl/sdl_mixer_nosmpeg.nim +++ b/lib/wrappers/sdl/sdl_mixer_nosmpeg.nim @@ -15,9 +15,9 @@ else: const MixerLibName = "libSDL_mixer.so" const - MAJOR_VERSION* = 1'i8 - MINOR_VERSION* = 2'i8 - PATCHLEVEL* = 7'i8 # Backwards compatibility + MAJOR_VERSION* = 1 + MINOR_VERSION* = 2 + PATCHLEVEL* = 7 # Backwards compatibility CHANNELS* = 8 # Good default values for a PC soundcard DEFAULT_FREQUENCY* = 22050 diff --git a/lib/wrappers/sdl/sdl_net.nim b/lib/wrappers/sdl/sdl_net.nim index bfd4f0a28..742a59314 100755 --- a/lib/wrappers/sdl/sdl_net.nim +++ b/lib/wrappers/sdl/sdl_net.nim @@ -122,9 +122,9 @@ else: const NetLibName = "libSDL_net.so" const #* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL * - MAJOR_VERSION* = 1'i8 - MINOR_VERSION* = 2'i8 - PATCHLEVEL* = 5'i8 # SDL_Net.h constants + MAJOR_VERSION* = 1 + MINOR_VERSION* = 2 + PATCHLEVEL* = 5 # SDL_Net.h constants #* Resolve a host name and port to an IP address in network form. # If the function succeeds, it will return 0. # If the host couldn't be resolved, the host portion of the returned diff --git a/lib/wrappers/sdl/sdl_ttf.nim b/lib/wrappers/sdl/sdl_ttf.nim index dd65af275..f501e31d8 100755 --- a/lib/wrappers/sdl/sdl_ttf.nim +++ b/lib/wrappers/sdl/sdl_ttf.nim @@ -165,9 +165,9 @@ else: const ttfLibName = "libSDL_ttf.so(|.1|.0)" const - MAJOR_VERSION* = 2'i8 - MINOR_VERSION* = 0'i8 - PATCHLEVEL* = 8'i8 # Backwards compatibility + MAJOR_VERSION* = 2 + MINOR_VERSION* = 0 + PATCHLEVEL* = 8 # Backwards compatibility STYLE_NORMAL* = 0x00000000 STYLE_BOLD* = 0x00000001 diff --git a/lib/wrappers/sdl/smpeg.nim b/lib/wrappers/sdl/smpeg.nim index a836379ac..33f317631 100755 --- a/lib/wrappers/sdl/smpeg.nim +++ b/lib/wrappers/sdl/smpeg.nim @@ -171,9 +171,9 @@ proc filter_deblocking*(): PFilter{.cdecl, # SMPEG.h #------------------------------------------------------------------------------ const - MAJOR_VERSION* = 0'i8 - MINOR_VERSION* = 4'i8 - PATCHLEVEL* = 2'i8 + MAJOR_VERSION* = 0 + MINOR_VERSION* = 4 + PATCHLEVEL* = 2 type TVersion*{.final.} = object diff --git a/lib/wrappers/zip/zlib.nim b/lib/wrappers/zip/zlib.nim index 9b49b9663..de52a06e1 100755 --- a/lib/wrappers/zip/zlib.nim +++ b/lib/wrappers/zip/zlib.nim @@ -160,19 +160,20 @@ proc inflateSyncPoint*(z: PZstream): int32{.cdecl, dynlib: libz, proc get_crc_table*(): pointer{.cdecl, dynlib: libz, importc: "get_crc_table".} proc deflateInit(strm: var TZStream, level: int32): int32 = - result = deflateInitu(strm, level, ZLIB_VERSION(), sizeof(TZStream)) + result = deflateInitu(strm, level, ZLIB_VERSION(), sizeof(TZStream).cint) proc inflateInit(strm: var TZStream): int32 = - result = inflateInitu(strm, ZLIB_VERSION(), sizeof(TZStream)) + result = inflateInitu(strm, ZLIB_VERSION(), sizeof(TZStream).cint) proc deflateInit2(strm: var TZStream, level, `method`, windowBits, memLevel, strategy: int32): int32 = result = deflateInit2u(strm, level, `method`, windowBits, memLevel, - strategy, ZLIB_VERSION(), sizeof(TZStream)) + strategy, ZLIB_VERSION(), sizeof(TZStream).cint) proc inflateInit2(strm: var TZStream, windowBits: int32): int32 = - result = inflateInit2u(strm, windowBits, ZLIB_VERSION(), sizeof(TZStream)) + result = inflateInit2u(strm, windowBits, ZLIB_VERSION(), + sizeof(TZStream).cint) proc zlibAllocMem*(AppData: Pointer, Items, Size: int): Pointer {.cdecl.} = result = Alloc(Items * Size) |