瀏覽代碼

Updated for mem function changes.

woollybah 8 年之前
父節點
當前提交
d5d7ad687d

+ 2 - 2
audiosample.mod/audiosample.bmx

@@ -44,7 +44,7 @@ Type TAudioSample
 	end rem
 	Field format
 	
-	Field capacity
+	Field capacity:Size_T
 
 	Method Delete()
 		If capacity>=0 MemFree samples
@@ -76,7 +76,7 @@ Type TAudioSample
 	end rem
 	Function Create:TAudioSample( length,hertz,format )
 		Local t:TAudioSample=New TAudioSample
-		Local capacity=length*BytesPerSample[format]
+		Local capacity:Size_T=length*BytesPerSample[format]
 		t.samples=MemAlloc( capacity )
 		t.length=length
 		t.hertz=hertz

+ 1 - 1
audiosample.mod/sample.bmx

@@ -15,7 +15,7 @@ Global BytesPerSample[]=[0,1,2,2,2,4,4]
 Global ChannelsPerSample[]=[0,1,1,1,2,2,2]
 
 Function CopySamples( in_buf:Byte Ptr,out_buf:Byte Ptr,format,count )
-	MemCopy out_buf,in_buf,count*BytesPerSample[format]
+	MemCopy out_buf,in_buf,Size_T(count*BytesPerSample[format])
 End Function
 
 Function ConvertSamples( in_buf:Byte Ptr,in_format,out_buf:Byte Ptr,out_format,count )

+ 41 - 41
bank.mod/bank.bmx

@@ -25,7 +25,7 @@ end rem
 Type TBank
 
 	Field _buf:Byte Ptr
-	Field _size:Long,_capacity:Long
+	Field _size:Size_T,_capacity:Size_T
 	Field _locked
 	
 	Method _pad()
@@ -74,7 +74,7 @@ Type TBank
 	bbdoc: Get a bank's size
 	returns: The size, in bytes, of the memory block controlled by the bank
 	End Rem
-	Method Size:Long()
+	Method Size:Size_T()
 		Return _size
 	End Method
 
@@ -82,18 +82,18 @@ Type TBank
 	bbdoc: Get capacity of bank
 	returns: The capacity, in bytes, of the bank's internal memory buffer
 	End Rem
-	Method Capacity:Long()
+	Method Capacity:Size_T()
 		Return _capacity
 	End Method
 
 	Rem
 	bbdoc: Resize a bank
 	End Rem
-	Method Resize( size:Long )
+	Method Resize( size:Size_T )
 		Assert _locked=0 Else "Locked banks cannot be resize"
 		Assert _capacity>=0 Else "Static banks cannot be resized"
 		If size>_capacity
-			Local n:Long=_capacity*3/2
+			Local n:Size_T=_capacity*3/2
 			If n<size n=size
 			Local tmp:Byte Ptr=MemAlloc(n)
 			MemCopy tmp,_buf,_size
@@ -124,7 +124,7 @@ Type TBank
 	bbdoc: Peek a byte from a bank
 	returns: The byte value at the specified byte offset within the bank
 	End Rem
-	Method PeekByte( offset:Long )
+	Method PeekByte( offset:Size_T )
 		Assert offset>=0 And offset<_size Else "Illegal bank offset"
 		Return _buf[offset]
 	End Method
@@ -132,7 +132,7 @@ Type TBank
 	Rem
 	bbdoc: Poke a byte into a bank
 	End Rem
-	Method PokeByte( offset:Long,value )
+	Method PokeByte( offset:Size_T,value )
 		Assert offset>=0 And offset<_size Else "Illegal bank offset"
 		_buf[offset]=value
 	End Method
@@ -141,7 +141,7 @@ Type TBank
 	bbdoc: Peek a short from a bank
 	returns: The short value at the specified byte offset within the bank
 	End Rem
-	Method PeekShort( offset:Long )
+	Method PeekShort( offset:Size_T )
 		Assert offset>=0 And offset<_size-1 Else "Illegal bank offset"
 		Return (Short Ptr(_buf+offset))[0]
 	End Method
@@ -149,7 +149,7 @@ Type TBank
 	Rem
 	bbdoc: Poke a short into a bank
 	End Rem
-	Method PokeShort( offset:Long,value )
+	Method PokeShort( offset:Size_T,value )
 		Assert offset>=0 And offset<_size-1 Else "Illegal bank offset"
 		(Short Ptr(_buf+offset))[0]=value
 	End Method
@@ -158,7 +158,7 @@ Type TBank
 	bbdoc: Peek an int from a bank
 	returns: The int value at the specified byte offset within the bank
 	End Rem
-	Method PeekInt( offset:Long )
+	Method PeekInt( offset:Size_T )
 		Assert offset>=0 And offset<_size-3 Else "Illegal bank offset"
 		Return (Int Ptr(_buf+offset))[0]
 	End Method
@@ -166,7 +166,7 @@ Type TBank
 	Rem
 	bbdoc: Poke an int into a bank
 	End Rem
-	Method PokeInt( offset:Long,value )
+	Method PokeInt( offset:Size_T,value )
 		Assert offset>=0 And offset<_size-3 Else "Illegal bank offset"
 		(Int Ptr(_buf+offset))[0]=value
 	End Method
@@ -175,7 +175,7 @@ Type TBank
 	bbdoc: Peek a long from a bank
 	returns: The long value at the specified byte offset within the bank
 	End Rem
-	Method PeekLong:Long( offset:Long )
+	Method PeekLong:Long( offset:Size_T )
 		Assert offset>=0 And offset<_size-7 Else "Illegal bank offset"
 		Return (Long Ptr(_buf+offset))[0]
 	End Method
@@ -183,7 +183,7 @@ Type TBank
 	Rem
 	bbdoc: Poke a long value into a bank
 	End Rem
-	Method PokeLong( offset:Long,value:Long )
+	Method PokeLong( offset:Size_T,value:Long )
 		Assert offset>=0 And offset<_size-7 Else "Illegal bank offset"
 		(Long Ptr(_buf+offset))[0]=value
 	End Method
@@ -192,7 +192,7 @@ Type TBank
 	bbdoc: Peek a float from a bank
 	returns: The float value at the specified byte offset within the bank
 	End Rem
-	Method PeekFloat#( offset:Long )
+	Method PeekFloat#( offset:Size_T )
 		Assert offset>=0 And offset<_size-3 Else "Illegal bank offset"
 		Return (Float Ptr(_buf+offset))[0]
 	End Method
@@ -200,7 +200,7 @@ Type TBank
 	Rem
 	bbdoc: Poke a float value into a bank
 	End Rem
-	Method PokeFloat( offset:Long,value# )
+	Method PokeFloat( offset:Size_T,value# )
 		Assert offset>=0 And offset<_size-3 Else "Illegal bank offset"
 		(Float Ptr(_buf+offset))[0]=value
 	End Method
@@ -209,7 +209,7 @@ Type TBank
 	bbdoc: Peek a double from a bank
 	returns: The double value at the specified byte offset within the bank
 	End Rem
-	Method PeekDouble!( offset:Long )
+	Method PeekDouble!( offset:Size_T )
 		Assert offset>=0 And offset<_size-7 Else "Illegal bank offset"
 		Return (Double Ptr(_buf+offset))[0]
 	End Method
@@ -217,7 +217,7 @@ Type TBank
 	Rem
 	bbdoc: Poke a double value into a bank
 	End Rem
-	Method PokeDouble( offset:Long,value! )
+	Method PokeDouble( offset:Size_T,value! )
 		Assert offset>=0 And offset<_size-7 Else "Illegal bank offset"
 		(Double Ptr(_buf+offset))[0]=value
 	End Method
@@ -245,8 +245,8 @@ Type TBank
 		Local stream:TStream=ReadStream( url )
 		If Not stream Return
 		Local data:Byte[]=LoadByteArray( stream )
-		Local bank:TBank=Create( data.length )
-		MemCopy bank.Buf(),data,data.length 
+		Local bank:TBank=Create( Size_T(data.length) )
+		MemCopy bank.Buf(),data,Size_T(data.length)
 		stream.Close
 		Return bank
 	End Function
@@ -255,8 +255,8 @@ Type TBank
 	bbdoc: Create a bank
 	returns: A new TBank object with an initial size of @size
 	End Rem
-	Function Create:TBank( size:Long )
-		Assert size>=0 Else "Illegal bank size"
+	Function Create:TBank( size:Size_T )
+		'Assert size>=0 Else "Illegal bank size"
 		Local bank:TBank=New TBank
 		bank._buf=MemAlloc( size )
 		bank._size=size
@@ -267,8 +267,8 @@ Type TBank
 	Rem
 	bbdoc: Create a bank from an existing block of memory
 	End Rem
-	Function CreateStatic:TBank( buf:Byte Ptr,size:Long )
-		Assert size>=0 Else "Illegal bank size"
+	Function CreateStatic:TBank( buf:Byte Ptr,size:Size_T )
+		'Assert size>=0 Else "Illegal bank size"
 		Local bank:TBank=New TBank
 		bank._buf=buf
 		bank._size=size
@@ -286,7 +286,7 @@ about:
 can be used for storage of binary data using the various Poke and
 Peek commands. 
 End Rem
-Function CreateBank:TBank( size:Long=0 )
+Function CreateBank:TBank( size:Size_T=0 )
 	Return TBank.Create( size )
 End Function
 
@@ -297,7 +297,7 @@ about:
 The memory referenced by a static bank is not released when the bank is deleted.
 A static bank cannot be resized.
 End Rem
-Function CreateStaticBank:TBank( buf:Byte Ptr,size:Long )
+Function CreateStaticBank:TBank( buf:Byte Ptr,size:Size_T )
 	Return TBank.CreateStatic( buf,size )
 End Function
 
@@ -384,7 +384,7 @@ about:
 allocated if the requested size is greater than the bank's current capacity,
 see #BankCapacity for more information.
 End Rem
-Function ResizeBank( bank:TBank,size:Long )
+Function ResizeBank( bank:TBank,size:Size_T )
 	bank.Resize size
 End Function
 
@@ -394,7 +394,7 @@ about:
 #CopyBank copies @count bytes from @src_offset in @src_bank to @dst_offset
 in @dst_bank.
 End Rem
-Function CopyBank( src_bank:TBank,src_offset:Long,dst_bank:TBank,dst_offset:Long,count:Long )
+Function CopyBank( src_bank:TBank,src_offset:Size_T,dst_bank:TBank,dst_offset:Size_T,count:Size_T )
 	Assert..
 	count>=0 And..
 	src_offset>=0 And..
@@ -410,14 +410,14 @@ returns: The byte value at the specified byte offset within the bank
 about:
 A byte is an unsigned 8 bit value with a range of 0..255.
 End Rem
-Function PeekByte( bank:TBank,offset:Long )
+Function PeekByte( bank:TBank,offset:Size_T )
 	Return bank.PeekByte( offset )
 End Function
 
 Rem
 bbdoc: Poke a byte into a bank
 End Rem
-Function PokeByte( bank:TBank,offset:Long,value )
+Function PokeByte( bank:TBank,offset:Size_T,value )
 	bank.PokeByte offset,value
 End Function
 
@@ -427,7 +427,7 @@ returns: The short value at the specified byte offset within the bank
 about:
 A short is an unsigned 16 bit (2 bytes) value with a range of 0..65535.
 End Rem
-Function PeekShort( bank:TBank,offset:Long )
+Function PeekShort( bank:TBank,offset:Size_T )
 	Return bank.PeekShort( offset )
 End Function
 
@@ -436,7 +436,7 @@ bbdoc: Poke a short into a bank
 about:
 An short is an unsigned 16 bit value that requires 2 bytes of storage.
 End Rem
-Function PokeShort( bank:TBank,offset:Long,value )
+Function PokeShort( bank:TBank,offset:Size_T,value )
 	bank.PokeShort offset,value
 End Function
 
@@ -446,7 +446,7 @@ returns: The int value at the specified byte offset within the bank
 about:
 An int is a signed 32 bit value (4 bytes).
 End Rem
-Function PeekInt( bank:TBank,offset:Long )
+Function PeekInt( bank:TBank,offset:Size_T )
 	Return bank.PeekInt( offset )
 End Function
 
@@ -455,7 +455,7 @@ bbdoc: Poke an int into a bank
 about:
 An int is a signed 32 bit value that requires 4 bytes of storage.
 End Rem
-Function PokeInt( bank:TBank,offset:Long,value )
+Function PokeInt( bank:TBank,offset:Size_T,value )
 	bank.PokeInt offset,value
 End Function
 
@@ -465,7 +465,7 @@ returns: The long integer value at the specified byte offset within the bank
 about:
 A long is a 64 bit integer that requires 8 bytes of memory.
 End Rem
-Function PeekLong:Long( bank:TBank,offset:Long )
+Function PeekLong:Long( bank:TBank,offset:Size_T )
 	Return bank.PeekLong( offset )
 End Function
 
@@ -474,7 +474,7 @@ bbdoc: Poke a long integer int into a bank
 about:
 A long is a 64 bit integer that requires 8 bytes of storage.
 End Rem
-Function PokeLong( bank:TBank,offset:Long,value:Long )
+Function PokeLong( bank:TBank,offset:Size_T,value:Long )
 	bank.PokeLong offset,value
 End Function
 
@@ -484,7 +484,7 @@ returns: The float value at the specified byte offset within the bank
 about:
 A float requires 4 bytes of storage
 End Rem
-Function PeekFloat#( bank:TBank,offset:Long )
+Function PeekFloat#( bank:TBank,offset:Size_T )
 	Return bank.PeekFloat( offset )
 End Function
 
@@ -493,7 +493,7 @@ bbdoc: Poke a float into a bank
 about:
 A float requires 4 bytes of storage
 End Rem
-Function PokeFloat( bank:TBank,offset:Long,value# )
+Function PokeFloat( bank:TBank,offset:Size_T,value# )
 	bank.PokeFloat offset,value
 End Function
 
@@ -503,7 +503,7 @@ returns: The double value at the specified byte offset within the bank
 about:
 A double requires 8 bytes of storage
 End Rem
-Function PeekDouble!( bank:TBank,offset:Long )
+Function PeekDouble!( bank:TBank,offset:Size_T )
 	Return bank.PeekDouble( offset )
 End Function
 
@@ -512,7 +512,7 @@ bbdoc: Poke a double into a bank
 about:
 A double requires 8 bytes of storage
 End Rem
-Function PokeDouble( bank:TBank,offset:Long,value! )
+Function PokeDouble( bank:TBank,offset:Size_T,value! )
 	bank.PokeDouble offset,value
 End Function
 
@@ -520,7 +520,7 @@ Rem
 bbdoc: Read bytes from a Stream to a Bank
 returns: The number of bytes successfully read from the Stream
 End Rem
-Function ReadBank:Long( bank:TBank,stream:TStream,offset:Long,count:Long )
+Function ReadBank:Long( bank:TBank,stream:TStream,offset:Size_T,count:Long )
 	Return bank.Read( stream,offset,count )
 End Function
 
@@ -528,6 +528,6 @@ Rem
 bbdoc: Write bytes from a Bank to a Stream
 returns: The number of bytes successfully written to the Stream
 end rem
-Function WriteBank:Long( bank:TBank,stream:TStream,offset:Long,count:Long )
+Function WriteBank:Long( bank:TBank,stream:TStream,offset:Size_T,count:Long )
 	Return bank.Write( stream,offset,count )
 End Function

+ 3 - 3
bankstream.mod/bankstream.bmx

@@ -52,15 +52,15 @@ Type TBankStream Extends TStream
 	Method Read:Long( buf:Byte Ptr,count:Long )
 		If count<=0 Or _pos>=_bank.Size() Return 0
 		If _pos+count>_bank.Size() count=_bank.Size()-_pos
-		MemCopy buf,_bank.Buf()+_pos,count
+		MemCopy buf,_bank.Buf()+_pos,Size_T(count)
 		_pos:+count
 		Return count
 	End Method
 
 	Method Write:Long( buf:Byte Ptr,count:Long )
 		If count<=0 Or _pos>_bank.Size() Return 0
-		If _pos+count>_bank.Size() _bank.Resize _pos+count
-		MemCopy _bank.Buf()+_pos,buf,count
+		If _pos+count>_bank.Size() _bank.Resize Size_T(_pos+count)
+		MemCopy _bank.Buf()+_pos,buf,Size_T(count)
 		_pos:+count
 		Return count
 	End Method

+ 3 - 3
freetypefont.mod/freetypefont.bmx

@@ -33,7 +33,7 @@ Private
 
 Function PadPixmap:TPixmap( p:TPixmap )
 	Local t:TPixmap=TPixmap.Create( p.width+2,p.height+2,p.format )
-	MemClear t.pixels,t.capacity
+	MemClear t.pixels,Size_T(t.capacity)
 	t.Paste p,1,1
 	Return t
 End Function
@@ -170,8 +170,8 @@ Type TFreeTypeFont Extends BRL.Font.TFont
 			Local tmp:Byte[]=LoadByteArray( src )
 			buf_size=tmp.length
 			If Not buf_size Return Null
-			buf=MemAlloc( buf_size )
-			MemCopy buf,tmp,buf_size
+			buf=MemAlloc( Size_T(buf_size) )
+			MemCopy buf,tmp,Size_T(buf_size)
 			If FT_New_Memory_Face( ft_lib,buf,buf_size,0,Varptr ft_face )
 				MemFree buf
 				Return Null

+ 5 - 5
gnet.mod/gnet.bmx

@@ -348,7 +348,7 @@ Type TGNetObject
 				p:+5
 			Case GNET_STRING
 				Local data$=GetString( index )
-				Local n=data.length
+				Local n:Size_T=data.length
 				p[0]=GNET_STRING Shl 5 | index
 				p[1]=n Shr 8
 				p[2]=n Shr 0
@@ -732,7 +732,7 @@ Type TGNetPeer
 		
 		If sz
 			msg.data=New Byte[sz]
-			MemCopy msg.data,buf+2,sz
+			MemCopy msg.data,buf+2,Size_T(sz)
 		EndIf
 ?Debug
 		If msg.state<>2 dprint "RecvMsg id="+msg.id+", state="+msg.state+", size="+sz
@@ -741,8 +741,8 @@ Type TGNetPeer
 	End Method
 	
 	Method SendMsg( msg:TGNetMsg )
-		Local sz=msg.data.length
-		Local buf:Byte Ptr=MemAlloc( sz+2 )
+		Local sz:Int=msg.data.length
+		Local buf:Byte Ptr=MemAlloc( Size_T(sz+2) )
 
 		Local id=msg.id
 		If msg.state=GNET_MESSAGE
@@ -752,7 +752,7 @@ Type TGNetPeer
 		
 		buf[0]=(msg.state Shl 12 | id) Shr 8
 		buf[1]=(msg.state Shl 12 | id) Shr 0
-		If sz MemCopy buf+2,msg.data,sz
+		If sz MemCopy buf+2,msg.data,Size_T(sz)
 ?Debug
 		dprint "SendMsg id="+id+", state="+msg.state+", size="+sz
 ?

+ 5 - 1
max2d.mod/max2d.bmx

@@ -934,6 +934,10 @@ Function AutoImageFlags( flags )
 	gc.auto_imageflags=flags
 End Function
 
+Function GetAutoImageFlags:Int()
+	Return gc.auto_imageflags
+End Function
+
 Rem
 bbdoc: Set an image's handle to its center
 End Rem
@@ -1388,7 +1392,7 @@ Function CollideSpans(polys:TList,count,y)
 	width=endx-startx
 	If width<=0 Return 0
 	If width>Len(LineBuffer) LineBuffer=New Int[width]
-	MemClear LineBuffer,width*4
+	MemClear LineBuffer,Size_T(width*4)
 	For p=EachIn polys
 		src=p.texture
 		If src

+ 1 - 1
pixmap.mod/pixel.bmx

@@ -48,7 +48,7 @@ Global BitsPerPixel[]=			[0,8,8,24,24,32,32, 4,4,4,4,4,4]
 Global ColorBitsPerPixel[]=		[0,0,0,24,24,24,24, 8,8,8,0,0,0]
 
 Function CopyPixels( in_buf:Byte Ptr,out_buf:Byte Ptr,format,count )
-	MemCopy out_buf,in_buf,count*BytesPerPixel[format]
+	MemCopy out_buf,in_buf, Size_T(count*BytesPerPixel[format])
 End Function
 
 Function ConvertPixels( in_buf:Byte Ptr,in_format,out_buf:Byte Ptr,out_format,count )

+ 3 - 3
pixmap.mod/pixmap.bmx

@@ -178,7 +178,7 @@ Type TPixmap
 	Function Create:TPixmap( width,height,format,align=4 )
 		Local pitch=width*BytesPerPixel[format]
 		pitch=(pitch+(align-1))/align*align
-		Local capacity=pitch*height
+		Local capacity:Size_T=pitch*height
 		Local pixmap:TPixmap=New TPixmap
 		pixmap.pixels=MemAlloc( capacity )
 		pixmap.width=width
@@ -209,13 +209,13 @@ Type TPixmap
 	End Rem	
 	Method ClearPixels( argb )
 		If Not argb And width*BytesPerPixel[format]=pitch
-			MemClear pixels,pitch*height
+			MemClear pixels,Size_T(pitch*height)
 			Return
 		EndIf
 		For Local y=0 Until height
 			Local p:Byte Ptr=PixelPtr(0,y)
 			If Not argb
-				MemClear p,width*BytesPerPixel[format]
+				MemClear p,Size_T(width*BytesPerPixel[format])
 				Continue
 			EndIf			
 			Select format

+ 2 - 2
ramstream.mod/ramstream.bmx

@@ -46,7 +46,7 @@ Type TRamStream Extends TStream
 	Method Read:Long( buf:Byte Ptr,count:Long )
 		If count<=0 Or _read=False Return 0
 		If _pos+count>_size count=_size-_pos
-		MemCopy buf,_buf+_pos,count
+		MemCopy buf,_buf+_pos,Size_T(count)
 		_pos:+count
 		Return count
 	End Method
@@ -54,7 +54,7 @@ Type TRamStream Extends TStream
 	Method Write:Long( buf:Byte Ptr,count:Long )
 		If count<=0 Or _write=False Return 0
 		If _pos+count>_size count=_size-_pos
-		MemCopy _buf+_pos,buf,count
+		MemCopy _buf+_pos,buf,Size_T(count)
 		_pos:+count
 		Return count
 	End Method

+ 1 - 1
stbimageloader.mod/stbimageloader.bmx

@@ -78,7 +78,7 @@ Type TPixmapLoaderSTB Extends TPixmapLoader
 			If pf
 				pixmap = CreatePixmap( width, height, pf )
 
-				MemCopy(pixmap.pixels, imgPtr, width * height * BytesPerPixel[pf])
+				MemCopy(pixmap.pixels, imgPtr, Size_T(width * height * BytesPerPixel[pf]))
 			End If
 			
 			stbi_image_free(imgPtr)