Understanding #define HASH_…

Discuss development issues and submit patches here
Post Reply
Edgar5
Posts: 63
Joined: Sun Apr 02, 2017 7:22 am

Understanding #define HASH_…

Post by Edgar5 »

In folder:
explorer++_1.3.5_src\Explorer++\Explorer++\XMLSettings.cpp
at or near line number 50 we see:
[code]/* These represent the pre-hashed values of attribute
names. They are used to avoid string comparisons
on each attribute. If the hash function or any of
the attribute names change in any way, these values
will need to be changed correspondingly. */
#define HASH_ALWAYSOPENINNEWTAB 1123321600
#define HASH_ALWAYSSHOWSIZESINBYTES 1986148483[/code]
ending with:
[code]#define HASH_PLAYNAVIGATIONSOUND 1987363412[/code]
I am making quite radical changes by adding numerous new buttons and, before I found this section of the code, I thought nothing of changing the intrinsic value of the underlying #define's:
[code]#define IDC_OPTION_LARGETOOLBARICONS 1279
#define IDC_OPTIONS_PLAY_SOUND 1280//efm5
#define IDC_OPTIONS_PLAYNAVIGATIONSOUND 1281
#define IDC_OPTIONS_PLAYNAVIGATIONSPEECH 1282//efm5
#define IDC_OPTIONS_PLAY_ENTERING_FOLDER 1283//efm5
#define IDC_OPTIONS_PLAY_DELETING 1284//efm5
#define IDC_OPTIONS_PLAY_WARNING 1285//efm5
#define IDC_CHECK_USEREGULAREXPRESSIONS 1286
#define IDC_CHECK_CASE_SENSITIVE 1287//efm5
#define IDC_LINK_STATUS 1288[/code]
note that I have added IDC_OPTIONS and changed the values of existing ones. What I need to know is, if I change the value of IDC_OPTIONS_PLAYNAVIGATIONSOUND (a #define which already existed) do I need to change the HASH value? For the new IDC_OPTIONS that I have added, how do I compute the HASH value?
David Erceg
Site Admin
Posts: 933
Joined: Sat Apr 18, 2009 1:46 am

Re: Understanding #define HASH_…

Post by David Erceg »

Good question. The values that are hashed are the strings used in the config file. For example, "AllowMultipleInstances" hashes to 3463984536, while "ConfirmCloseTabs" hashes to 2636757395. The hash function used can be seen here. You shouldn't have to change anything if you're only updating the control IDs.
Edgar5
Posts: 63
Joined: Sun Apr 02, 2017 7:22 am

Re: Understanding #define HASH_…

Post by Edgar5 »

Perfect! Thanks for the reply.
Post Reply