From 36dfa2c6e50f7a04ccb6a547bd5e3b7027a10aec Mon Sep 17 00:00:00 2001 From: jsmorley Date: Wed, 7 Jul 2010 22:31:44 +0000 Subject: [PATCH] Alex2539 found a problem in the ccalc lexer.c file which caused an error if a number was used in a calc statement (say from a WebParser measure) which had a leading "0". (08 for instance) This would cause the library to see the number as an Octal, and the formula would be incorrect at best, and fail with an error in the log at worst. (08 is an invalid Octal number) Alex has changed the library so you CAN indicate and do math with Octal, Hex and Binary numbers, but the numbers must be preceded with 0b (binary) 0x (hex) 0o (octal). If a number like 08 is used, it will be treated as "8", as it should. Change to RainThemes to support new Logging= setting in Rainmeter.ini --- Application/Application.rc | 8 ++++---- Library/ccalc-0.5.1/lexer.c | 10 ++++++++-- revision-number.h | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Application/Application.rc b/Application/Application.rc index 0131a5c5..306e0f1d 100644 --- a/Application/Application.rc +++ b/Application/Application.rc @@ -28,8 +28,8 @@ LANGUAGE LANG_FINNISH, SUBLANG_DEFAULT // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,3,0,454 - PRODUCTVERSION 1,3,0,454 + FILEVERSION 1,3,0,455 + PRODUCTVERSION 1,3,0,455 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -45,12 +45,12 @@ BEGIN BLOCK "040b04b0" BEGIN VALUE "FileDescription", "Rainmeter - A Customizable Resource Meter" - VALUE "FileVersion", "1, 3, 0, 454" + VALUE "FileVersion", "1, 3, 0, 455" VALUE "InternalName", "Rainmeter" VALUE "LegalCopyright", "Copyright (C) 2010 - Rainy" VALUE "OriginalFilename", "Rainmeter.exe" VALUE "ProductName", "Rainmeter" - VALUE "ProductVersion", "1, 3, 0, 454" + VALUE "ProductVersion", "1, 3, 0, 455" END END BLOCK "VarFileInfo" diff --git a/Library/ccalc-0.5.1/lexer.c b/Library/ccalc-0.5.1/lexer.c index 5836ea33..535664ce 100644 --- a/Library/ccalc-0.5.1/lexer.c +++ b/Library/ccalc-0.5.1/lexer.c @@ -137,8 +137,14 @@ next_token: intreaded = 1; } // Readind oct number - if ( ch == '0' && nch >= '0' && nch <= '9' ) { - lexer->IntValue = strtol( lexer->SS, &NewSS, 8 ); + if ( ch == '0' && nch == 'o') { // original version: if ( ch == '0' && nch >= '0' && nch <='9') + lexer->IntValue = strtol( lexer->SS+2, &NewSS, 8 ); + intreaded = 1; + } + + // Readind bin number + if ( ch == '0' && nch == 'b') { // original version: if ( ch == '0' && nch >= '0' && nch <='9') + lexer->IntValue = strtol( lexer->SS+2, &NewSS, 2 ); intreaded = 1; } diff --git a/revision-number.h b/revision-number.h index c462a5a6..89584d59 100644 --- a/revision-number.h +++ b/revision-number.h @@ -1,2 +1,2 @@ #pragma once -const int revision_number = 454; \ No newline at end of file +const int revision_number = 455; \ No newline at end of file