mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-23 09:59:54 +00:00
src/common.[ch] : Add function psf_rand_long().
This commit is contained in:
parent
27089bf884
commit
e35511f9af
@ -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
|
||||
|
22
src/common.c
22
src/common.c
@ -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 */
|
||||
|
@ -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, ...) ;
|
||||
|
Loading…
Reference in New Issue
Block a user