1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-14 00:14:18 +00:00

Fixed a small streaming bug, tidied up some warnings.

This commit is contained in:
Julian Storer 2009-12-22 14:53:12 +00:00
parent aa98aa03ec
commit 24a121e4dd
12 changed files with 124 additions and 76 deletions

View file

@ -4236,10 +4236,13 @@
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
GCC_WARN_MISSING_PARENTHESES = YES;
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
GCC_WARN_SIGN_COMPARE = YES;
GCC_WARN_UNKNOWN_PRAGMAS = YES;
GCC_WARN_UNUSED_VALUE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PRODUCT_NAME = jucedebug;
RUN_CLANG_STATIC_ANALYZER = YES;
@ -4260,10 +4263,13 @@
"NDEBUG=1",
);
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
GCC_WARN_MISSING_PARENTHESES = YES;
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
GCC_WARN_SIGN_COMPARE = YES;
GCC_WARN_UNKNOWN_PRAGMAS = YES;
GCC_WARN_UNUSED_VALUE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PRODUCT_NAME = juce;

View file

@ -5364,27 +5364,24 @@ int InputStream::readIntBigEndian()
int InputStream::readCompressedInt()
{
int num = 0;
const unsigned char sizeByte = readByte();
if (sizeByte == 0)
return 0;
if (! isExhausted())
const int numBytes = (sizeByte & 0x7f);
if (numBytes > 4)
{
unsigned char numBytes = readByte();
const bool negative = (numBytes & 0x80) != 0;
numBytes &= 0x7f;
if (numBytes <= 4)
{
if (read (&num, numBytes) != numBytes)
return 0;
num = (int) swapIfBigEndian ((uint32) num);
if (negative)
num = -num;
}
jassertfalse // trying to read corrupt data - this method must only be used
// to read data that was written by OutputStream::writeCompressedInt()
return 0;
}
return num;
char bytes[4] = { 0, 0, 0, 0 };
if (read (bytes, numBytes) != numBytes)
return 0;
const int num = (int) littleEndianInt (bytes);
return (sizeByte >> 7) ? -num : num;
}
int64 InputStream::readInt64()
@ -5639,23 +5636,22 @@ void OutputStream::writeCompressedInt (int value)
{
unsigned int un = (value < 0) ? (unsigned int) -value
: (unsigned int) value;
unsigned int tn = un;
int numSigBytes = 0;
uint8 data[5];
int num = 0;
do
while (un > 0)
{
tn >>= 8;
numSigBytes++;
data[++num] = (uint8) un;
un >>= 8;
}
} while (tn & 0xff);
data[0] = num;
if (value < 0)
numSigBytes |= 0x80;
data[0] |= 0x80;
writeByte ((char) numSigBytes);
un = swapIfBigEndian (un);
write (&un, numSigBytes);
write (data, num + 1);
}
void OutputStream::writeInt64 (int64 value)
@ -21761,7 +21757,7 @@ const StringPairArray WavAudioFormat::createBWAVMetadata (const String& descript
#if JUCE_MSVC
#pragma pack (push, 1)
#define PACKED
#elif defined (JUCE_GCC)
#elif JUCE_GCC
#define PACKED __attribute__((packed))
#else
#define PACKED
@ -44691,7 +44687,7 @@ void CodeDocument::setSavePoint() throw()
bool CodeDocument::hasChangedSinceSavePoint() const throw()
{
return currentActionIndex == indexOfSavedState;
return currentActionIndex != indexOfSavedState;
}
static int getCodeCharacterCategory (const tchar character) throw()
@ -261354,7 +261350,7 @@ bool juce_launchFile (const String& fileName,
ok = [[NSWorkspace sharedWorkspace] openURLs: urls
withAppBundleIdentifier: [[NSBundle bundleWithPath: juceStringToNS (fileName)] bundleIdentifier]
options: nil
options: 0
additionalEventParamDescriptor: nil
launchIdentifiers: nil];
}
@ -262059,7 +262055,7 @@ public:
const int length = text.length();
CGGlyph* const glyphs = createGlyphsForString (text, length);
int x = 0;
float x = 0;
#if SUPPORT_ONLY_10_4_FONTS
NSSize* const advances = (NSSize*) juce_malloc (length * sizeof (NSSize));
@ -262129,7 +262125,7 @@ public:
NSSize* const advances = (NSSize*) juce_malloc (length * sizeof (NSSize));
[nsFont getAdvancements: advances forGlyphs: (NSGlyph*) glyphs count: length];
int x = 0;
float x = 0;
for (int i = 0; i < length; ++i)
{
x += advances[i].width;
@ -262785,8 +262781,8 @@ public:
while (x > clip.origin.x) x -= iw;
while (y > clip.origin.y) y -= ih;
const int right = clip.origin.x + clip.size.width;
const int bottom = clip.origin.y + clip.size.height;
const int right = (int) (clip.origin.x + clip.size.width);
const int bottom = (int) (clip.origin.y + clip.size.height);
while (y < bottom)
{
@ -266525,7 +266521,7 @@ public:
const int length = text.length();
CGGlyph* const glyphs = createGlyphsForString (text, length);
int x = 0;
float x = 0;
#if SUPPORT_ONLY_10_4_FONTS
NSSize* const advances = (NSSize*) juce_malloc (length * sizeof (NSSize));
@ -266595,7 +266591,7 @@ public:
NSSize* const advances = (NSSize*) juce_malloc (length * sizeof (NSSize));
[nsFont getAdvancements: advances forGlyphs: (NSGlyph*) glyphs count: length];
int x = 0;
float x = 0;
for (int i = 0; i < length; ++i)
{
x += advances[i].width;
@ -267253,8 +267249,8 @@ public:
while (x > clip.origin.x) x -= iw;
while (y > clip.origin.y) y -= ih;
const int right = clip.origin.x + clip.size.width;
const int bottom = clip.origin.y + clip.size.height;
const int right = (int) (clip.origin.x + clip.size.width);
const int bottom = (int) (clip.origin.y + clip.size.height);
while (y < bottom)
{
@ -270806,8 +270802,8 @@ void QuickTimeMovieComponent::getMovieNormalSize (int& width, int& height) const
if (movie != 0)
{
NSSize s = [[theMovie attributeForKey: QTMovieNaturalSizeAttribute] sizeValue];
width = s.width;
height = s.height;
width = (int) s.width;
height = (int) s.height;
}
}

View file

@ -46986,6 +46986,11 @@ public:
*/
void setVelocityBasedMode (const bool isVelocityBased) throw();
/** Returns true if velocity-based mode is active.
@see setVelocityBasedMode
*/
bool getVelocityBasedMode() const throw() { return isVelocityBased; }
/** Changes aspects of the scaling used when in velocity-sensitive mode.
These apply when you've used setVelocityBasedMode() to turn on velocity mode,
@ -47004,6 +47009,26 @@ public:
const double offset = 0.0,
const bool userCanPressKeyToSwapMode = true) throw();
/** Returns the velocity sensitivity setting.
@see setVelocityModeParameters
*/
double getVelocitySensitivity() const throw() { return velocityModeSensitivity; }
/** Returns the velocity threshold setting.
@see setVelocityModeParameters
*/
int getVelocityThreshold() const throw() { return velocityModeThreshold; }
/** Returns the velocity offset setting.
@see setVelocityModeParameters
*/
double getVelocityOffset() const throw() { return velocityModeOffset; }
/** Returns the velocity user key setting.
@see setVelocityModeParameters
*/
bool getVelocityModeIsSwappable() const throw() { return userKeyOverridesVelocity; }
/** Sets up a skew factor to alter the way values are distributed.
You may want to use a range of values on the slider where more accuracy

View file

@ -73,7 +73,7 @@ const StringPairArray WavAudioFormat::createBWAVMetadata (const String& descript
#if JUCE_MSVC
#pragma pack (push, 1)
#define PACKED
#elif defined (JUCE_GCC)
#elif JUCE_GCC
#define PACKED __attribute__((packed))
#else
#define PACKED

View file

@ -580,7 +580,7 @@ void CodeDocument::setSavePoint() throw()
bool CodeDocument::hasChangedSinceSavePoint() const throw()
{
return currentActionIndex == indexOfSavedState;
return currentActionIndex != indexOfSavedState;
}
//==============================================================================

View file

@ -151,6 +151,11 @@ public:
*/
void setVelocityBasedMode (const bool isVelocityBased) throw();
/** Returns true if velocity-based mode is active.
@see setVelocityBasedMode
*/
bool getVelocityBasedMode() const throw() { return isVelocityBased; }
/** Changes aspects of the scaling used when in velocity-sensitive mode.
These apply when you've used setVelocityBasedMode() to turn on velocity mode,
@ -169,6 +174,26 @@ public:
const double offset = 0.0,
const bool userCanPressKeyToSwapMode = true) throw();
/** Returns the velocity sensitivity setting.
@see setVelocityModeParameters
*/
double getVelocitySensitivity() const throw() { return velocityModeSensitivity; }
/** Returns the velocity threshold setting.
@see setVelocityModeParameters
*/
int getVelocityThreshold() const throw() { return velocityModeThreshold; }
/** Returns the velocity offset setting.
@see setVelocityModeParameters
*/
double getVelocityOffset() const throw() { return velocityModeOffset; }
/** Returns the velocity user key setting.
@see setVelocityModeParameters
*/
bool getVelocityModeIsSwappable() const throw() { return userKeyOverridesVelocity; }
//==============================================================================
/** Sets up a skew factor to alter the way values are distributed.

View file

@ -86,27 +86,24 @@ int InputStream::readIntBigEndian()
int InputStream::readCompressedInt()
{
int num = 0;
const unsigned char sizeByte = readByte();
if (sizeByte == 0)
return 0;
if (! isExhausted())
const int numBytes = (sizeByte & 0x7f);
if (numBytes > 4)
{
unsigned char numBytes = readByte();
const bool negative = (numBytes & 0x80) != 0;
numBytes &= 0x7f;
if (numBytes <= 4)
{
if (read (&num, numBytes) != numBytes)
return 0;
num = (int) swapIfBigEndian ((uint32) num);
if (negative)
num = -num;
}
jassertfalse // trying to read corrupt data - this method must only be used
// to read data that was written by OutputStream::writeCompressedInt()
return 0;
}
return num;
char bytes[4] = { 0, 0, 0, 0 };
if (read (bytes, numBytes) != numBytes)
return 0;
const int num = (int) littleEndianInt (bytes);
return (sizeByte >> 7) ? -num : num;
}
int64 InputStream::readInt64()

View file

@ -109,23 +109,22 @@ void OutputStream::writeCompressedInt (int value)
{
unsigned int un = (value < 0) ? (unsigned int) -value
: (unsigned int) value;
unsigned int tn = un;
int numSigBytes = 0;
uint8 data[5];
int num = 0;
do
while (un > 0)
{
tn >>= 8;
numSigBytes++;
data[++num] = (uint8) un;
un >>= 8;
}
} while (tn & 0xff);
data[0] = num;
if (value < 0)
numSigBytes |= 0x80;
data[0] |= 0x80;
writeByte ((char) numSigBytes);
un = swapIfBigEndian (un);
write (&un, numSigBytes);
write (data, num + 1);
}
void OutputStream::writeInt64 (int64 value)

View file

@ -420,8 +420,8 @@ public:
while (x > clip.origin.x) x -= iw;
while (y > clip.origin.y) y -= ih;
const int right = clip.origin.x + clip.size.width;
const int bottom = clip.origin.y + clip.size.height;
const int right = (int) (clip.origin.x + clip.size.width);
const int bottom = (int) (clip.origin.y + clip.size.height);
while (y < bottom)
{

View file

@ -483,7 +483,7 @@ bool juce_launchFile (const String& fileName,
ok = [[NSWorkspace sharedWorkspace] openURLs: urls
withAppBundleIdentifier: [[NSBundle bundleWithPath: juceStringToNS (fileName)] bundleIdentifier]
options: nil
options: 0
additionalEventParamDescriptor: nil
launchIdentifiers: nil];
}

View file

@ -203,7 +203,7 @@ public:
const int length = text.length();
CGGlyph* const glyphs = createGlyphsForString (text, length);
int x = 0;
float x = 0;
#if SUPPORT_ONLY_10_4_FONTS
NSSize* const advances = (NSSize*) juce_malloc (length * sizeof (NSSize));
@ -273,7 +273,7 @@ public:
NSSize* const advances = (NSSize*) juce_malloc (length * sizeof (NSSize));
[nsFont getAdvancements: advances forGlyphs: (NSGlyph*) glyphs count: length];
int x = 0;
float x = 0;
for (int i = 0; i < length; ++i)
{
x += advances[i].width;

View file

@ -251,8 +251,8 @@ void QuickTimeMovieComponent::getMovieNormalSize (int& width, int& height) const
if (movie != 0)
{
NSSize s = [[theMovie attributeForKey: QTMovieNaturalSizeAttribute] sizeValue];
width = s.width;
height = s.height;
width = (int) s.width;
height = (int) s.height;
}
}