Browse Source

tags/2021-05-28
jules 18 years ago
parent
commit
2f6d0bf70f
4 changed files with 25 additions and 20 deletions
  1. +5
    -0
      src/juce_appframework/gui/components/keyboard/juce_KeyPress.cpp
  2. +4
    -4
      src/juce_core/basics/juce_Time.cpp
  3. +12
    -12
      src/juce_core/io/juce_InputStream.cpp
  4. +4
    -4
      src/juce_core/io/juce_OutputStream.cpp

+ 5
- 0
src/juce_appframework/gui/components/keyboard/juce_KeyPress.cpp View File

@@ -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 + ";


+ 4
- 4
src/juce_core/basics/juce_Time.cpp View File

@@ -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;


+ 12
- 12
src/juce_core/io/juce_InputStream.cpp View File

@@ -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()


+ 4
- 4
src/juce_core/io/juce_OutputStream.cpp View File

@@ -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)


Loading…
Cancel
Save