From: <zu...@us...> - 2015-03-19 15:08:49
|
Revision: 5184 http://sourceforge.net/p/fuse-emulator/code/5184 Author: zubzero Date: 2015-03-19 15:08:41 +0000 (Thu, 19 Mar 2015) Log Message: ----------- Const and static cleanups Modified Paths: -------------- trunk/libspectrum/crypto.c trunk/libspectrum/csw.c trunk/libspectrum/hacking/ChangeLog trunk/libspectrum/internals.h trunk/libspectrum/libspectrum.c trunk/libspectrum/pzx_read.c trunk/libspectrum/rzx.c trunk/libspectrum/szx.c trunk/libspectrum/tzx_read.c Modified: trunk/libspectrum/crypto.c =================================================================== --- trunk/libspectrum/crypto.c 2015-03-19 14:47:11 UTC (rev 5183) +++ trunk/libspectrum/crypto.c 2015-03-19 15:08:41 UTC (rev 5184) @@ -31,12 +31,12 @@ #include "internals.h" -static const char *private_key_format = +static const char * const private_key_format = "(key-data (private-key (dsa (p %m) (q %m) (g %m) (y %m) (x %m))))"; -static const char *public_key_format = +static const char * const public_key_format = "(key-data (public-key (dsa (p %m) (q %m) (g %m) (y %m))))"; -static const char *hash_format = "(data (flags raw) (value %m))"; -static const char *signature_format = "(sig-val (dsa (r %m) (s %m)))"; +static const char * const hash_format = "(data (flags raw) (value %m))"; +static const char * const signature_format = "(sig-val (dsa (r %m) (s %m)))"; #define HASH_ALGORITHM GCRY_MD_SHA1 #define MPI_COUNT 5 Modified: trunk/libspectrum/csw.c =================================================================== --- trunk/libspectrum/csw.c 2015-03-19 14:47:11 UTC (rev 5183) +++ trunk/libspectrum/csw.c 2015-03-19 15:08:41 UTC (rev 5184) @@ -31,7 +31,7 @@ #include "tape_block.h" /* The .csw file signature (first 23 bytes) */ -const char *libspectrum_csw_signature = "Compressed Square Wave\x1a"; +static const char * const csw_signature = "Compressed Square Wave\x1a"; libspectrum_error libspectrum_csw_read( libspectrum_tape *tape, @@ -42,11 +42,11 @@ int compressed; - size_t signature_length = strlen( libspectrum_csw_signature ); + size_t signature_length = strlen( csw_signature ); if( length < signature_length + 2 ) goto csw_short; - if( memcmp( libspectrum_csw_signature, buffer, signature_length ) ) { + if( memcmp( csw_signature, buffer, signature_length ) ) { libspectrum_print_error( LIBSPECTRUM_ERROR_SIGNATURE, "libspectrum_csw_read: wrong signature" ); return LIBSPECTRUM_ERROR_SIGNATURE; @@ -320,12 +320,12 @@ libspectrum_byte *ptr = *buffer; - size_t signature_length = strlen( libspectrum_csw_signature ); + size_t signature_length = strlen( csw_signature ); /* First, write the .csw signature and the rest of the header */ libspectrum_make_room( buffer, signature_length + 29, &ptr, length ); - memcpy( ptr, libspectrum_csw_signature, signature_length ); + memcpy( ptr, csw_signature, signature_length ); ptr += signature_length; *ptr++ = 2; /* Major version number */ Modified: trunk/libspectrum/hacking/ChangeLog =================================================================== --- trunk/libspectrum/hacking/ChangeLog 2015-03-19 14:47:11 UTC (rev 5183) +++ trunk/libspectrum/hacking/ChangeLog 2015-03-19 15:08:41 UTC (rev 5184) @@ -1002,3 +1002,5 @@ 20150316 doc/libspectrum.txt: add missing line break (Stuart). 20150316 snapshot.c: store PC-1 for all snapshot formats whilst in the halted state (Stuart). +20150318 crypto.c,csw.c,internals.h,libspectrum.c,pzx_read.c,rzx.c,szx.c, + tzx_read.c: const and static cleanups (Stuart). Modified: trunk/libspectrum/internals.h =================================================================== --- trunk/libspectrum/internals.h 2015-03-19 14:47:11 UTC (rev 5183) +++ trunk/libspectrum/internals.h 2015-03-19 15:08:41 UTC (rev 5184) @@ -130,7 +130,7 @@ /* The TZX file signature */ -extern const char *libspectrum_tzx_signature; +extern const char * const libspectrum_tzx_signature; /* Convert a 48K memory dump into separate RAM pages */ Modified: trunk/libspectrum/libspectrum.c =================================================================== --- trunk/libspectrum/libspectrum.c 2015-03-19 14:47:11 UTC (rev 5183) +++ trunk/libspectrum/libspectrum.c 2015-03-19 15:08:41 UTC (rev 5184) @@ -36,7 +36,7 @@ #include <gcrypt.h> /* The version of libgcrypt that we need */ -static const char *MIN_GCRYPT_VERSION = "1.1.42"; +static const char * const MIN_GCRYPT_VERSION = "1.1.42"; #endif /* #ifdef HAVE_GCRYPT_H */ Modified: trunk/libspectrum/pzx_read.c =================================================================== --- trunk/libspectrum/pzx_read.c 2015-03-19 14:47:11 UTC (rev 5183) +++ trunk/libspectrum/pzx_read.c 2015-03-19 15:08:41 UTC (rev 5184) @@ -83,7 +83,7 @@ /* TODO: an extension to be similar to the TZX Custom Block Picture type */ #define PZX_INLAY "inly" -static const char *signature = PZX_HEADER; +static const char * const signature = PZX_HEADER; static const size_t signature_length = 4; static libspectrum_error Modified: trunk/libspectrum/rzx.c =================================================================== --- trunk/libspectrum/rzx.c 2015-03-19 14:47:11 UTC (rev 5183) +++ trunk/libspectrum/rzx.c 2015-03-19 15:08:41 UTC (rev 5184) @@ -173,7 +173,7 @@ libspectrum_rzx_dsa_key *key ); /* The signature used to identify .rzx files */ -const char *rzx_signature = "RZX!"; +static const char * const rzx_signature = "RZX!"; /* The IN count used to signify 'repeat last frame' */ const libspectrum_word libspectrum_rzx_repeat_frame = 0xffff; Modified: trunk/libspectrum/szx.c =================================================================== --- trunk/libspectrum/szx.c 2015-03-19 14:47:11 UTC (rev 5183) +++ trunk/libspectrum/szx.c 2015-03-19 15:08:41 UTC (rev 5184) @@ -61,12 +61,12 @@ } szx_machine_type; -static const char *signature = "ZXST"; +static const char * const signature = "ZXST"; static const size_t signature_length = 4; static const libspectrum_byte ZXSTMF_ALTERNATETIMINGS = 1; -static const char *libspectrum_string = "libspectrum: "; +static const char * const libspectrum_string = "libspectrum: "; static const libspectrum_byte SZX_VERSION_MAJOR = 1; static const libspectrum_byte SZX_VERSION_MINOR = 5; Modified: trunk/libspectrum/tzx_read.c =================================================================== --- trunk/libspectrum/tzx_read.c 2015-03-19 14:47:11 UTC (rev 5183) +++ trunk/libspectrum/tzx_read.c 2015-03-19 15:08:41 UTC (rev 5184) @@ -33,7 +33,7 @@ #include "internals.h" /* The .tzx file signature (first 8 bytes) */ -const char *libspectrum_tzx_signature = "ZXTape!\x1a"; +const char * const libspectrum_tzx_signature = "ZXTape!\x1a"; /*** Local function prototypes ***/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |