diff --git a/src/juce_appframework/gui/components/keyboard/juce_KeyPress.cpp b/src/juce_appframework/gui/components/keyboard/juce_KeyPress.cpp index 1008d4e1a9..e81266c081 100644 --- a/src/juce_appframework/gui/components/keyboard/juce_KeyPress.cpp +++ b/src/juce_appframework/gui/components/keyboard/juce_KeyPress.cpp @@ -246,6 +246,11 @@ const String KeyPress::getTextDescription() const throw() if (keyCode > 0) { + // some keyboard layouts use a shift-key to get the slash, but in those cases, we + // want to store it as being a slash, not shift+whatever. + if (textCharacter == T('/')) + return "/"; + if (mods.isCtrlDown()) desc << "ctrl + "; diff --git a/src/juce_core/basics/juce_Time.cpp b/src/juce_core/basics/juce_Time.cpp index 919bd298ba..ec70bf3de8 100644 --- a/src/juce_core/basics/juce_Time.cpp +++ b/src/juce_core/basics/juce_Time.cpp @@ -68,7 +68,7 @@ static void millisToLocal (const int64 millis, struct tm& result) throw() if (seconds < literal64bit (86400) || seconds >= literal64bit (2145916800)) { // use extended maths for dates beyond 1970 to 2037.. - const int timeZoneAdjustment = 86400 - (int) (Time (1970, 0, 2, 0, 0).toMilliseconds() / 1000); + const int timeZoneAdjustment = 31536000 - (int) (Time (1971, 0, 1, 0, 0).toMilliseconds() / 1000); const int64 jdm = seconds + timeZoneAdjustment + literal64bit (210866803200); const int days = (int) (jdm / literal64bit (86400)); @@ -141,14 +141,14 @@ Time::Time (const int year, if (year < 1971 || year >= 2038) { // use extended maths for dates beyond 1970 to 2037.. - const int timeZoneAdjustment = 86400 - (int) (Time (1970, 0, 2, 0, 0).toMilliseconds() / 1000); + const int timeZoneAdjustment = 31536000 - (int) (Time (1971, 0, 1, 0, 0).toMilliseconds() / 1000); const int a = (13 - month) / 12; - const int y = year + 6700 - a; + const int y = year + 4800 - a; const int jd = day + (153 * (month + 12 * a - 2) + 2) / 5 + (y * 365) + (y / 4) - (y / 100) + (y / 400) - 32045; - const int64 s = jd * literal64bit (86400) - literal64bit (210866803200); + const int64 s = ((int64) jd) * literal64bit (86400) - literal64bit (210866803200); millisSinceEpoch = 1000 * (s + (hours * 3600 + minutes * 60 + seconds - timeZoneAdjustment)) + milliseconds; diff --git a/src/juce_core/io/juce_InputStream.cpp b/src/juce_core/io/juce_InputStream.cpp index b74fe47d11..74a52969cf 100644 --- a/src/juce_core/io/juce_InputStream.cpp +++ b/src/juce_core/io/juce_InputStream.cpp @@ -115,22 +115,22 @@ int InputStream::readCompressedInt() int64 InputStream::readInt64() { - const int temp1 = readInt(); - int64 temp = readInt(); - temp <<= 32; - temp |= temp1 & (int64) 0xffffffff; - - return temp; + char temp [8]; + + if (read (temp, 8) == 8) + return (int64) swapIfBigEndian (*(uint64*)temp); + else + return 0; } int64 InputStream::readInt64BigEndian() { - int64 temp = readIntBigEndian(); - const int temp2 = readIntBigEndian(); - temp <<= 32; - temp |= temp2 & (int64) 0xffffffff; - - return temp; + char temp [8]; + + if (read (temp, 8) == 8) + return (int64) swapIfLittleEndian (*(uint64*)temp); + else + return 0; } float InputStream::readFloat() diff --git a/src/juce_core/io/juce_OutputStream.cpp b/src/juce_core/io/juce_OutputStream.cpp index 181af20fd4..b512776e42 100644 --- a/src/juce_core/io/juce_OutputStream.cpp +++ b/src/juce_core/io/juce_OutputStream.cpp @@ -97,14 +97,14 @@ void OutputStream::writeCompressedInt (int value) void OutputStream::writeInt64 (int64 value) { - writeInt ((int) (value & 0xffffffff)); - writeInt ((int) (value >> 32)); + const uint64 v = swapIfBigEndian ((uint64) value); + write (&v, 8); } void OutputStream::writeInt64BigEndian (int64 value) { - writeInt ((int) (value >> 32)); - writeInt ((int) (value & 0xffffffff)); + const uint64 v = swapIfLittleEndian ((uint64) value); + write (&v, 8); } void OutputStream::writeFloat (float value)