shithub: dumb

Download patch

ref: f5f34570905e87f1933a0220d71d0d48c05b9b49
parent: d78c28566689e3fca51f1fbb7208cde8b6e190a6
author: Chris Moeller <kode54@gmail.com>
date: Wed Feb 9 03:10:45 EST 2011

- Added a workaround for bad sample offsets in STM files
- Disabled inserting note cut commands in STM files, as there is no such command in the format
- Version is now 0.9.9.35

git-tfs-id: [http://localhost:8080/tfs/DefaultCollection/]$/foobar2000/files/plugins.root;C614

--- a/dumb/src/it/readstm.c
+++ b/dumb/src/it/readstm.c
@@ -146,10 +146,6 @@
 				entry->effectvalue = buffer[ pos + 3 ];
 				if ( entry->instrument && entry->instrument < 32 )
 					entry->mask |= IT_ENTRY_INSTRUMENT;
-				if ( note == 0xFC || note == 0xFE ) {
-					entry->mask |= IT_ENTRY_NOTE;
-					entry->note = IT_NOTE_CUT;
-				}
 				if ( note < 251 ) {
 					entry->mask |= IT_ENTRY_NOTE;
 					entry->note = ( note >> 4 ) * 12 + ( note & 0x0F );
@@ -374,8 +370,15 @@
 		}
 	}
 
-	dumbfile_skip( f, o - dumbfile_pos( f ) );
-	if ( dumbfile_getnc( (char*)data_block, p - o, f ) != p - o ) {
+	q = o - dumbfile_pos( f );
+	p -= o;
+	o = 0;
+	if ( q >= 0 ) dumbfile_skip( f, q );
+	else {
+		o = -q;
+		memset ( data_block, 0, o );
+	}
+	if ( dumbfile_getnc( (char*)data_block + o, p - o, f ) != p - o ) {
 		free( data_block );
 		_dumb_it_unload_sigdata( sigdata );
 		return NULL;