Changeset 217 in xtideuniversalbios for trunk/Serial_Server/library/FlatImage.cpp
- Timestamp:
- Jan 23, 2012, 10:08:13 AM (13 years ago)
- google:author:
- gregli@hotmail.com
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Serial_Server/library/FlatImage.cpp
r213 r217 12 12 #include "FlatImage.h" 13 13 14 FlatImage::FlatImage( char *name, int p_readOnly, int p_drive, int p_create, unsigned long p_cyl, unsigned long p_ sect, unsigned long p_head ) : Image( name, p_readOnly, p_drive, p_create, p_cyl, p_sect, p_head)14 FlatImage::FlatImage( char *name, int p_readOnly, int p_drive, int p_create, unsigned long p_cyl, unsigned long p_head, unsigned long p_sect, int p_useCHS ) : Image( name, p_readOnly, p_drive, p_create, p_cyl, p_head, p_sect, p_useCHS ) 15 15 { 16 double sizef;16 long filesize; 17 17 18 18 if( p_create ) … … 40 40 41 41 sizef = size2/2048.0; 42 log( 0, "Created file '%s' with geometry %u:%u:%u, size %.1lf megabytes\n", name, p_cyl, p_sect, p_head, sizef ); 42 if( p_cyl > 1024 ) 43 log( 0, "Created file '%s', size %.1lf MB", name, sizef ); 44 else 45 log( 0, "Created file '%s', geometry %u:%u:%u, size %.1lf MB", name, p_cyl, p_sect, p_head, sizef ); 43 46 } 44 47 … … 48 51 49 52 fseek( fp, 0, SEEK_END ); 50 totallba= ftell( fp );53 filesize = ftell( fp ); 51 54 52 if( !totallba)53 log( -1, "Could not get file size for '%s' ", name );55 if( filesize == 0 || filesize == -1L ) 56 log( -1, "Could not get file size for '%s', file possibly larger than 2 GB", name ); 54 57 55 if( totallba& 0x1ff )58 if( filesize & 0x1ff ) 56 59 log( -1, "'%s' not made up of 512 byte sectors", name ); 57 60 58 totallba >>= 9; 59 if( totallba != (p_sect * p_head * p_cyl) ) 60 { 61 if( p_sect || p_head || p_cyl ) 62 log( -1, "'%s', file size does not match geometry", name ); 63 else if( (totallba % 16) != 0 || ((totallba/16) % 63) != 0 ) 64 log( -1, "'%s', file size does not match standard geometry (x:16:63), please geometry explicitly with -g", name ); 65 else 66 { 67 sect = 63; 68 head = 16; 69 cyl = (totallba / sect / head); 70 } 71 } 72 else 73 { 74 sect = p_sect; 75 head = p_head; 76 cyl = p_cyl; 77 } 61 totallba = filesize >> 9; // 512 bytes per sector 78 62 79 sizef = totallba/2048.0; 80 log( 0, "Opening disk '%s', geometry %u:%u:%u, total size %.1lf MB", name, cyl, sect, head, sizef ); 63 init( name, p_readOnly, p_drive, p_cyl, p_head, p_sect, p_useCHS ); 81 64 } 82 65
Note:
See TracChangeset
for help on using the changeset viewer.