From: DeaDDooMER Date: Sun, 30 Jul 2017 21:07:18 +0000 (+0300) Subject: NativeInt -> NativeUInt for pointers X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=2a785940b8e595cffcc9e9d652c2ae9248c989ee;p=d2df-sdl.git NativeInt -> NativeUInt for pointers --- diff --git a/src/engine/e_input.pas b/src/engine/e_input.pas index 2a2f435..269a1d1 100644 --- a/src/engine/e_input.pas +++ b/src/engine/e_input.pas @@ -192,14 +192,14 @@ function PollKeyboard(): Boolean; var Keys: PByte; NKeys: Integer; - i: NativeInt; + i: NativeUInt; begin Result := False; Keys := SDL_GetKeyboardState(@NKeys); if (Keys = nil) or (NKeys < 1) then Exit; for i := 0 to NKeys do - KeyBuffer[i] := ((PByte(NativeInt(Keys) + i)^) <> 0); + KeyBuffer[i] := ((PByte(NativeUInt(Keys) + i)^) <> 0); for i := NKeys to High(KeyBuffer) do KeyBuffer[i] := False; end; diff --git a/src/shared/BinEditor.pas b/src/shared/BinEditor.pas index cd0eb06..9e77d0e 100644 --- a/src/shared/BinEditor.pas +++ b/src/shared/BinEditor.pas @@ -166,7 +166,7 @@ begin if (FPosition + varSize) > FSize then ExtendMemory(varSize); - CopyMemory(Pointer(NativeInt(FData) + FPosition), + CopyMemory(Pointer(NativeUInt(FData) + FPosition), @x, varSize); FPosition := FPosition + varSize; end; @@ -256,13 +256,13 @@ begin ExtendMemory(SizeOf(Byte) + len); // Äëèíà ñòðîêè: - CopyMemory(Pointer(NativeInt(FData) + FPosition), + CopyMemory(Pointer(NativeUInt(FData) + FPosition), @len, SizeOf(Byte)); FPosition := FPosition + SizeOf(Byte); // Ñòðîêà: if len > 0 then begin - CopyMemory(Pointer(NativeInt(FData) + FPosition), + CopyMemory(Pointer(NativeUInt(FData) + FPosition), @x[1], len); FPosition := FPosition + len; end; @@ -274,13 +274,13 @@ begin ExtendMemory(SizeOf(Cardinal) + memSize); // Äëèíà áëîêà ïàìÿòè: - CopyMemory(Pointer(NativeInt(FData) + FPosition), + CopyMemory(Pointer(NativeUInt(FData) + FPosition), @memSize, SizeOf(Cardinal)); FPosition := FPosition + SizeOf(Cardinal); // Áëîê ïàìÿòè: if memSize > 0 then begin - CopyMemory(Pointer(NativeInt(FData) + FPosition), + CopyMemory(Pointer(NativeUInt(FData) + FPosition), x, memSize); FPosition := FPosition + memSize; end; @@ -293,7 +293,7 @@ begin if aLen > 0 then begin - FillMemory(Pointer(NativeInt(FData) + FPosition), + FillMemory(Pointer(NativeUInt(FData) + FPosition), aLen, aFillSym); FPosition := FPosition + aLen; end; @@ -354,7 +354,7 @@ begin if (FPosition + varSize) <= FSize then begin CopyMemory(@x, - Pointer(NativeInt(FData) + FPosition), + Pointer(NativeUInt(FData) + FPosition), varSize); FPosition := FPosition + varSize; end @@ -419,7 +419,7 @@ begin begin // Äëèíà ñòðîêè: CopyMemory(@len, - Pointer(NativeInt(FData) + FPosition), + Pointer(NativeUInt(FData) + FPosition), SizeOf(Byte)); if (FPosition + SizeOf(Byte) + len) <= FSize then @@ -430,7 +430,7 @@ begin if len > 0 then begin CopyMemory(@x[1], - Pointer(NativeInt(FData) + FPosition), + Pointer(NativeUInt(FData) + FPosition), len); FPosition := FPosition + len; end @@ -461,7 +461,7 @@ begin begin GetMem(x, memSize); CopyMemory(x, - Pointer(NativeInt(FData) + FPosition), + Pointer(NativeUInt(FData) + FPosition), memSize); FPosition := FPosition + memSize; end diff --git a/src/shared/MAPREADER.pas b/src/shared/MAPREADER.pas index a122bee..93de6b0 100644 --- a/src/shared/MAPREADER.pas +++ b/src/shared/MAPREADER.pas @@ -152,7 +152,7 @@ function TMapReader_1.GetAreas(): TAreasRec1Array; var TempDataBlocks: TDataBlocksArray; a: Integer; - b, Size: NativeInt; + b, Size: NativeUInt; begin Result := nil; @@ -167,7 +167,7 @@ begin begin SetLength(Result, Length(Result)+1); //CopyMemory(@Result[High(Result)], Pointer(LongWord(TempDataBlocks[a].Data)+b*size), size); - mb_Read_TAreaRec_1(Result[High(Result)], Pointer(NativeInt(TempDataBlocks[a].Data)+b*size)^, size); + mb_Read_TAreaRec_1(Result[High(Result)], Pointer(NativeUInt(TempDataBlocks[a].Data)+b*size)^, size); end; TempDataBlocks := nil; @@ -177,7 +177,7 @@ function TMapReader_1.GetItems(): TItemsRec1Array; var TempDataBlocks: TDataBlocksArray; a: Integer; - b, Size: NativeInt; + b, Size: NativeUInt; begin Result := nil; @@ -192,7 +192,7 @@ begin begin SetLength(Result, Length(Result)+1); //CopyMemory(@Result[High(Result)], Pointer(LongWord(TempDataBlocks[a].Data)+b*size), size); - mb_Read_TItemRec_1(Result[High(Result)], Pointer(NativeInt(TempDataBlocks[a].Data)+b*size)^, size); + mb_Read_TItemRec_1(Result[High(Result)], Pointer(NativeUInt(TempDataBlocks[a].Data)+b*size)^, size); end; TempDataBlocks := nil; @@ -218,7 +218,7 @@ function TMapReader_1.GetMonsters(): TMonsterRec1Array; var TempDataBlocks: TDataBlocksArray; a: Integer; - b, Size: NativeInt; + b, Size: NativeUInt; begin Result := nil; @@ -233,7 +233,7 @@ begin begin SetLength(Result, Length(Result)+1); //CopyMemory(@Result[High(Result)], Pointer(LongWord(TempDataBlocks[a].Data)+b*size), size); - mb_Read_TMonsterRec_1(Result[High(Result)], Pointer(NativeInt(TempDataBlocks[a].Data)+b*size)^, size); + mb_Read_TMonsterRec_1(Result[High(Result)], Pointer(NativeUInt(TempDataBlocks[a].Data)+b*size)^, size); end; TempDataBlocks := nil; @@ -243,7 +243,7 @@ function TMapReader_1.GetPanels(): TPanelsRec1Array; var TempDataBlocks: TDataBlocksArray; a: Integer; - b, Size: NativeInt; + b, Size: NativeUInt; begin Result := nil; @@ -258,7 +258,7 @@ begin begin SetLength(Result, Length(Result)+1); //CopyMemory(@Result[High(Result)], Pointer(LongWord(TempDataBlocks[a].Data)+b*size), size); - mb_Read_TPanelRec_1(Result[High(Result)], Pointer(NativeInt(TempDataBlocks[a].Data)+b*size)^, size); + mb_Read_TPanelRec_1(Result[High(Result)], Pointer(NativeUInt(TempDataBlocks[a].Data)+b*size)^, size); end; TempDataBlocks := nil; @@ -268,7 +268,7 @@ function TMapReader_1.GetTextures(): TTexturesRec1Array; var TempDataBlocks: TDataBlocksArray; a: Integer; - b, Size: NativeInt; + b, Size: NativeUInt; begin Result := nil; @@ -283,7 +283,7 @@ begin begin SetLength(Result, Length(Result)+1); //CopyMemory(@Result[High(Result)], Pointer(LongWord(TempDataBlocks[a].Data)+b*size), size); - mb_Read_TTextureRec_1(Result[High(Result)], Pointer(NativeInt(TempDataBlocks[a].Data)+b*size)^, size); + mb_Read_TTextureRec_1(Result[High(Result)], Pointer(NativeUInt(TempDataBlocks[a].Data)+b*size)^, size); end; TempDataBlocks := nil; @@ -293,7 +293,7 @@ function TMapReader_1.GetTriggers(): TTriggersRec1Array; var TempDataBlocks: TDataBlocksArray; a: Integer; - b: NativeInt; + b: NativeUInt; Size: LongWord; trdata: TTriggerData; begin @@ -310,7 +310,7 @@ begin begin SetLength(Result, Length(Result)+1); //CopyMemory(@Result[High(Result)], Pointer(LongWord(TempDataBlocks[a].Data)+b*size), size); - mb_Read_TTriggerRec_1(Result[High(Result)], Pointer(NativeInt(TempDataBlocks[a].Data)+b*size)^, size); + mb_Read_TTriggerRec_1(Result[High(Result)], Pointer(NativeUInt(TempDataBlocks[a].Data)+b*size)^, size); if (Result[High(Result)].TriggerType <> 0) then begin // preprocess trigger data @@ -380,7 +380,7 @@ end; function TMapReader.LoadMap(Data: Pointer): Boolean; var - adr: NativeInt; + adr: NativeUInt; _id: Integer; Sign: array[0..2] of Char; Ver: Byte; @@ -395,7 +395,7 @@ begin end; adr := 3; - CopyMemory(@Ver, Pointer(NativeInt(Data)+adr), 1); + CopyMemory(@Ver, Pointer(NativeUInt(Data)+adr), 1); FVersion := Ver; if Ver > HandledVersion() then begin @@ -408,12 +408,12 @@ begin SetLength(FDataBlocks, Length(FDataBlocks)+1); _id := High(FDataBlocks); - CopyMemory(@FDataBlocks[_id].Block, Pointer(NativeInt(Data)+adr), SizeOf(TBlock)); + CopyMemory(@FDataBlocks[_id].Block, Pointer(NativeUInt(Data)+adr), SizeOf(TBlock)); adr := adr+SizeOf(TBlock); FDataBlocks[_id].Data := GetMemory(FDataBlocks[_id].Block.BlockSize); - CopyMemory(FDataBlocks[_id].Data, Pointer(NativeInt(Data)+adr), FDataBlocks[_id].Block.BlockSize); + CopyMemory(FDataBlocks[_id].Data, Pointer(NativeUInt(Data)+adr), FDataBlocks[_id].Block.BlockSize); adr := adr+FDataBlocks[_id].Block.BlockSize; until FDataBlocks[_id].Block.BlockType = BLOCK_NONE;