Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Testicular Slingshot
Alchemy Viewer
Commits
c1db961a
Commit
c1db961a
authored
12 years ago
by
Aura Linden
Browse files
Options
Downloads
Patches
Plain Diff
Fixed small one-time memory leaks.
parent
3a72577f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/llvfs/llvfs_objc.mm
+20
-3
20 additions, 3 deletions
indra/llvfs/llvfs_objc.mm
indra/mac_updater/MacUpdaterAppDelegate.mm
+20
-2
20 additions, 2 deletions
indra/mac_updater/MacUpdaterAppDelegate.mm
with
40 additions
and
5 deletions
indra/llvfs/llvfs_objc.mm
+
20
−
3
View file @
c1db961a
...
@@ -32,16 +32,22 @@
...
@@ -32,16 +32,22 @@
std
::
string
*
getSystemTempFolder
()
std
::
string
*
getSystemTempFolder
()
{
{
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
NSString
*
tempDir
=
NSTemporaryDirectory
();
NSString
*
tempDir
=
NSTemporaryDirectory
();
if
(
tempDir
==
nil
)
if
(
tempDir
==
nil
)
tempDir
=
@"/tmp"
;
tempDir
=
@"/tmp"
;
return
(
new
std
::
string
([
tempDir
UTF8String
])
);
std
::
string
*
result
=
(
new
std
::
string
([
tempDir
UTF8String
])
);
[
pool
release
];
return
result
;
}
}
//findSystemDirectory scoped exclusively to this file.
//findSystemDirectory scoped exclusively to this file.
std
::
string
*
findSystemDirectory
(
NSSearchPathDirectory
searchPathDirectory
,
std
::
string
*
findSystemDirectory
(
NSSearchPathDirectory
searchPathDirectory
,
NSSearchPathDomainMask
domainMask
)
NSSearchPathDomainMask
domainMask
)
{
{
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
std
::
string
*
result
;
std
::
string
*
result
;
NSString
*
path
=
nil
;
NSString
*
path
=
nil
;
...
@@ -60,19 +66,30 @@ std::string* findSystemDirectory(NSSearchPathDirectory searchPathDirectory,
...
@@ -60,19 +66,30 @@ std::string* findSystemDirectory(NSSearchPathDirectory searchPathDirectory,
result
=
new
std
::
string
([
path
UTF8String
]);
result
=
new
std
::
string
([
path
UTF8String
]);
}
}
[
pool
release
];
return
result
;
return
result
;
}
}
std
::
string
*
getSystemExecutableFolder
()
std
::
string
*
getSystemExecutableFolder
()
{
{
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
NSString
*
bundlePath
=
[[
NSBundle
mainBundle
]
executablePath
];
NSString
*
bundlePath
=
[[
NSBundle
mainBundle
]
executablePath
];
return
(
new
std
::
string
([
bundlePath
UTF8String
]));
std
::
string
*
result
=
(
new
std
::
string
([
bundlePath
UTF8String
]));
[
pool
release
];
return
result
;
}
}
std
::
string
*
getSystemResourceFolder
()
std
::
string
*
getSystemResourceFolder
()
{
{
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
NSString
*
bundlePath
=
[[
NSBundle
mainBundle
]
resourcePath
];
NSString
*
bundlePath
=
[[
NSBundle
mainBundle
]
resourcePath
];
return
(
new
std
::
string
([
bundlePath
UTF8String
]));
std
::
string
*
result
=
(
new
std
::
string
([
bundlePath
UTF8String
]));
[
pool
release
];
return
result
;
}
}
std
::
string
*
getSystemCacheFolder
()
std
::
string
*
getSystemCacheFolder
()
...
...
This diff is collapsed.
Click to expand it.
indra/mac_updater/MacUpdaterAppDelegate.mm
+
20
−
2
View file @
c1db961a
...
@@ -126,6 +126,8 @@ void sendProgress(int cur, int max, const std::string str)
...
@@ -126,6 +126,8 @@ void sendProgress(int cur, int max, const std::string str)
bool
copyDir
(
const
std
::
string
&
src_dir
,
const
std
::
string
&
dest_dir
)
bool
copyDir
(
const
std
::
string
&
src_dir
,
const
std
::
string
&
dest_dir
)
{
{
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
NSString
*
file
=
[
NSString
stringWithCString
:
src_dir
.
c_str
()
NSString
*
file
=
[
NSString
stringWithCString
:
src_dir
.
c_str
()
encoding:
[
NSString
defaultCStringEncoding
]];
encoding:
[
NSString
defaultCStringEncoding
]];
NSString
*
toParent
=
[
NSString
stringWithCString
:
dest_dir
.
c_str
()
NSString
*
toParent
=
[
NSString
stringWithCString
:
dest_dir
.
c_str
()
...
@@ -137,6 +139,8 @@ bool copyDir(const std::string& src_dir, const std::string& dest_dir)
...
@@ -137,6 +139,8 @@ bool copyDir(const std::string& src_dir, const std::string& dest_dir)
if
(
!
result
)
{
if
(
!
result
)
{
NSLog
(
@"Error during copy: %@"
,
[
error
localizedDescription
]);
NSLog
(
@"Error during copy: %@"
,
[
error
localizedDescription
]);
}
}
[
pool
release
];
return
result
;
return
result
;
}
}
...
@@ -178,26 +182,38 @@ bool copyDir(const std::string& src_dir, const std::string& dest_dir)
...
@@ -178,26 +182,38 @@ bool copyDir(const std::string& src_dir, const std::string& dest_dir)
bool
isDirWritable
(
const
std
::
string
&
dir_name
)
bool
isDirWritable
(
const
std
::
string
&
dir_name
)
{
{
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
NSString
*
fullPath
=
[
NSString
stringWithCString
:
dir_name
.
c_str
()
NSString
*
fullPath
=
[
NSString
stringWithCString
:
dir_name
.
c_str
()
encoding:
[
NSString
defaultCStringEncoding
]];
encoding:
[
NSString
defaultCStringEncoding
]];
NSFileManager
*
fm
=
[
NSFileManager
defaultManager
];
NSFileManager
*
fm
=
[
NSFileManager
defaultManager
];
bool
result
=
[
fm
isWritableFileAtPath
:
fullPath
];
bool
result
=
[
fm
isWritableFileAtPath
:
fullPath
];
[
pool
release
];
return
result
;
return
result
;
}
}
std
::
string
*
getUserTrashFolder
()
std
::
string
*
getUserTrashFolder
()
{
{
std
::
string
*
result
;
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
NSString
*
trash_str
=
[
NSHomeDirectory
()
stringByAppendingPathComponent
:
@".Trash"
];
NSString
*
trash_str
=
[
NSHomeDirectory
()
stringByAppendingPathComponent
:
@".Trash"
];
return
NSToString
(
trash_str
);
result
=
NSToString
(
trash_str
);
[
pool
release
];
return
result
;
}
}
bool
isFSRefViewerBundle
(
const
std
::
string
&
targetURL
)
bool
isFSRefViewerBundle
(
const
std
::
string
&
targetURL
)
{
{
bool
result
=
false
;
bool
result
=
false
;
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
NSString
*
fullPath
=
[
NSString
stringWithCString
:
targetURL
.
c_str
()
NSString
*
fullPath
=
[
NSString
stringWithCString
:
targetURL
.
c_str
()
encoding:
[
NSString
defaultCStringEncoding
]];
encoding:
[
NSString
defaultCStringEncoding
]];
NSBundle
*
targetBundle
=
[
NSBundle
bundleWithPath
:
fullPath
];
NSBundle
*
targetBundle
=
[
NSBundle
bundleWithPath
:
fullPath
];
...
@@ -212,6 +228,8 @@ bool isFSRefViewerBundle(const std::string& targetURL)
...
@@ -212,6 +228,8 @@ bool isFSRefViewerBundle(const std::string& targetURL)
std
::
cout
<<
"Target bundle ID mismatch."
<<
std
::
endl
;
std
::
cout
<<
"Target bundle ID mismatch."
<<
std
::
endl
;
}
}
[
pool
release
];
return
result
;
return
result
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment