فهرست منبع

Native large file support.

woollybah 10 سال پیش
والد
کامیت
fcaf2c35ea
4فایلهای تغییر یافته به همراه30 افزوده شده و 24 حذف شده
  1. 1 1
      oggvorbis.mod/oggvorbis.bmx
  2. 9 5
      stdc.mod/stdc.bmx
  3. 18 14
      stdc.mod/stdc.c
  4. 2 4
      stdc.mod/stdc.x

+ 1 - 1
oggvorbis.mod/oggvorbis.bmx

@@ -54,7 +54,7 @@ Function Decode_Ogg:Byte Ptr(..
 	reado(buf@Ptr,size,nmemb,src:Object),..
 	seeko(src:Object,offset:Long,whence),..
 	closeo(src:Object),..
-	tello(src:Object ),..
+	tello:Long(src:Object ),..
 	samples Var,channels Var,freq Var)
 
 Function Read_Ogg(ogg:Byte Ptr,buf:Byte Ptr,size)	'null buffer to close

+ 9 - 5
stdc.mod/stdc.bmx

@@ -36,6 +36,10 @@ ModuleInfo "History: 1.05 Release"
 ModuleInfo "History: 1.04 Release"
 ModuleInfo "History: Fixed C Compiler warnings"
 
+?linux
+ModuleInfo "CC_OPTS: -D_FILE_OFFSET_BITS=64"
+?
+
 Import "stdc.c"
 
 'c lib
@@ -65,11 +69,11 @@ Function getenv_$( env$ )
 
 Function fopen_:Byte Ptr( file$,Mode$ )
 Function fclose_%( c_stream:Byte Ptr )="fclose"
-Function fread_( buf:Byte Ptr,size,count,c_stream:Byte Ptr )="fread"
-Function fwrite_( buf:Byte Ptr,size,count,c_stream:Byte Ptr )="fwrite"
+Function fread_:Long( buf:Byte Ptr,size:Long,count:Long,c_stream:Byte Ptr )="fread"
+Function fwrite_:Long( buf:Byte Ptr,size:Long,count:Long,c_stream:Byte Ptr )="fwrite"
 Function fflush_( c_stream:Byte Ptr )="fflush"
-Function fseek_( c_stream:Byte Ptr,offset,origin )="fseek"
-Function ftell_( c_stream:Byte Ptr )="ftell"
+Function fseek_( c_stream:Byte Ptr,offset:Long,origin )'="fseek"
+Function ftell_:Long( c_stream:Byte Ptr )'="ftell"
 Function feof_( c_stream:Byte Ptr )="feof"
 Function fgetc_( c_stream:Byte Ptr )="fgetc"
 Function ungetc_( char,c_stream:Byte Ptr )="ungetc"
@@ -87,7 +91,7 @@ Function remove_( path$ )
 Function opendir_:Byte Ptr( path$ )
 Function closedir_( dir:Byte Ptr )
 Function readdir_$( dir:Byte Ptr )
-Function stat_( path$,st_mode Var,st_size Var,st_mtime Var,st_ctime Var )
+Function stat_( path$,st_mode Var,st_size:Long Var,st_mtime Var,st_ctime Var )
 Function system_( cmd$ )
 
 'misc

+ 18 - 14
stdc.mod/stdc.c

@@ -131,7 +131,7 @@ BBString *readdir_( void* dir ){
 	return t ? bbStringFromCString( t->d_name ) : &bbEmptyString;
 }
 
-int stat_( BBString *path,int *t_mode,int *t_size,int *t_mtime,int *t_ctime ){
+int stat_( BBString *path,int *t_mode,BBLONG *t_size,int *t_mtime,int *t_ctime ){
 	int i;
 	struct _stat st;
 	
@@ -189,6 +189,14 @@ int system_( BBString *cmd ){
 	return res;
 }
 
+int fseek_( FILE* stream, BBLONG offset, int origin ) {
+	return _fseeki64(stream, offset, origin);
+}
+
+BBLONG ftell_( FILE* stream ) {
+	return _ftelli64(stream);
+}
+
 #else
 
 int getchar_(){
@@ -261,7 +269,7 @@ int closedir_( DIR* dir ){
 	return closedir( dir );
 }
 
-int stat_( BBString *path,int *t_mode,int *t_size,int *t_mtime,int *t_ctime ){
+int stat_( BBString *path,int *t_mode,BBLONG *t_size,int *t_mtime,int *t_ctime ){
 	struct stat st;
 	if( stat( bbTmpUTF8String(path),&st ) ) return -1;
 	*t_mode=st.st_mode;
@@ -275,6 +283,14 @@ int system_( BBString *cmd ){
 	return system( bbTmpUTF8String(cmd) );
 }
 
+int fseek_( FILE* stream, BBLONG offset, int origin ) {
+	return fseeko(stream, offset, origin);
+}
+
+BBLONG ftell_( FILE* stream ) {
+	return ftello(stream);
+}
+
 #endif
 
 int fclose_( FILE* stream ) {
@@ -285,22 +301,10 @@ int feof_(FILE* stream) {
 	return feof(stream);
 }
 
-int fread_( void * ptr, int size, int count, FILE* stream ) {
-	return (int)fread(ptr, size, count, stream);
-}
-
-int fwrite_( void * ptr, int size, int count, FILE* stream ) {
-	return (int)fwrite(ptr, size, count, stream);
-}
-
 int fflush_( FILE* stream ) {
 	return fflush(stream);
 }
 
-int fseek_( FILE* stream, int offset, int origin ) {
-	return fseek(stream, offset, origin);
-}
-
 int htons_( int n ){
 	return htons( n );
 }

+ 2 - 4
stdc.mod/stdc.x

@@ -1,9 +1,7 @@
 int fclose( FILE* ) !
-int fread( void* , size_t, int, FILE* ) !
-int fwrite( void* ,size_t, int, FILE* ) !
+size_t fread( void* , size_t, size_t, FILE* ) !
+size_t fwrite( void* ,size_t, size_t, FILE* ) !
 int fflush( FILE* ) !
-int fseek( FILE*, int , int ) !
-int ftell( FILE* ) !
 int feof( FILE* ) !
 int fgetc( FILE* ) !
 int ungetc( int,FILE* ) !