src/common.[ch] : Add function psf_rand_long().

This commit is contained in:
Erik de Castro Lopo 2007-07-15 20:21:45 +10:00
parent 27089bf884
commit e35511f9af
3 changed files with 22 additions and 5 deletions

View File

@ -4,6 +4,9 @@
Fix memory leak; set copy parameter to FALSE in call to
FLAC__metadata_object_vorbiscomment_append_comment.
* src/common.[ch]
Add function psf_rand_long().
2007-07-14 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/FLAC

View File

@ -1283,9 +1283,21 @@ u_bitwidth_to_subformat (int bits)
} /* bitwidth_to_subformat */
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 33e9795e-f717-461a-9feb-65d083a56395
** psf_rand_long : Not crypto quality, but more than adequate for things
** like stream serial numbers in Ogg files.
*/
long
psf_rand_long (void)
{ static long serial = -1 ;
int k, count ;
if (serial == -1)
serial = time (NULL) ;
count = 4 + (serial & 7) ;
for (k = 0 ; k < count ; k++)
serial = 11117 * serial + 211231 ;
return serial ;
} /* psf_rand_long */

View File

@ -589,6 +589,8 @@ void psf_log_SF_INFO (SF_PRIVATE *psf) ;
void psf_hexdump (const void *ptr, int len) ;
long psf_rand_long (void) ;
/* Functions used when writing file headers. */
int psf_binheader_writef (SF_PRIVATE *psf, const char *format, ...) ;