Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
morpheus.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Daria Zenkova
morpheus.js
Commits
2b20737b
Commit
2b20737b
authored
Jul 21, 2016
by
jgould
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
string memory leaks
parent
962d2c09
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
22 deletions
+27
-22
js/morpheus-latest.min.js
js/morpheus-latest.min.js
+3
-3
src/io/buffered_reader.js
src/io/buffered_reader.js
+15
-15
src/io/gct_reader.js
src/io/gct_reader.js
+4
-1
src/util/util.js
src/util/util.js
+5
-3
No files found.
js/morpheus-latest.min.js
View file @
2b20737b
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/io/buffered_reader.js
View file @
2b20737b
morpheus
.
BufferedReader
=
function
(
buffer
)
{
morpheus
.
BufferedReader
=
function
(
buffer
)
{
this
.
buffer
=
buffer
;
this
.
bufferLength
=
buffer
.
length
;
this
.
index
=
0
;
if
(
typeof
TextDecoder
!==
'
undefined
'
)
{
var
textDecoder
=
new
TextDecoder
();
this
.
decoder
=
function
(
buf
,
start
,
end
)
{
this
.
decoder
=
function
(
buf
,
start
,
end
)
{
return
textDecoder
.
decode
(
buf
.
subarray
(
start
,
end
));
};
}
else
{
this
.
decoder
=
function
(
buf
,
start
,
end
)
{
this
.
decoder
=
function
(
buf
,
start
,
end
)
{
// TODO convert in chunks
var
s
=
''
;
var
s
=
[]
;
for
(
var
i
=
start
;
i
<
end
;
i
++
)
{
s
+=
String
.
fromCharCode
(
buffer
[
i
]
);
s
.
push
(
String
.
fromCharCode
(
buffer
[
i
])
);
}
return
s
;
return
s
.
join
(
''
)
;
};
}
};
morpheus
.
BufferedReader
.
prototype
=
{
readLine
:
function
()
{
readLine
:
function
()
{
var
index
=
this
.
index
;
var
bufferLength
=
this
.
bufferLength
;
if
(
index
>=
bufferLength
)
{
...
...
@@ -35,7 +35,7 @@ morpheus.BufferedReader.prototype = {
if
(
c
===
10
||
c
===
13
)
{
// \n or \r
end
=
index
;
if
((
index
!==
bufferLength
-
1
)
&&
(
buffer
[
index
+
1
]
===
10
||
buffer
[
index
+
1
]
===
13
))
{
// skip
&&
(
buffer
[
index
+
1
]
===
10
||
buffer
[
index
+
1
]
===
13
))
{
// skip
// ahead
index
++
;
}
...
...
@@ -53,13 +53,13 @@ morpheus.BufferedReader.prototype = {
}
};
morpheus
.
BufferedReader
.
getArrayBuffer
=
function
(
fileOrUrl
,
callback
)
{
morpheus
.
BufferedReader
.
getArrayBuffer
=
function
(
fileOrUrl
,
callback
)
{
var
isString
=
typeof
fileOrUrl
===
'
string
'
||
fileOrUrl
instanceof
String
;
if
(
isString
)
{
// URL
var
oReq
=
new
XMLHttpRequest
();
oReq
.
open
(
'
GET
'
,
fileOrUrl
,
true
);
oReq
.
responseType
=
'
arraybuffer
'
;
oReq
.
onload
=
function
(
oEvent
)
{
oReq
.
onload
=
function
(
oEvent
)
{
callback
(
null
,
oReq
.
response
);
};
...
...
@@ -72,10 +72,10 @@ morpheus.BufferedReader.getArrayBuffer = function(fileOrUrl, callback) {
// }
// };
oReq
.
onerror
=
function
(
oEvent
)
{
oReq
.
onerror
=
function
(
oEvent
)
{
callback
(
oEvent
);
};
oReq
.
onreadystatechange
=
function
(
oEvent
)
{
oReq
.
onreadystatechange
=
function
(
oEvent
)
{
if
(
oReq
.
readyState
===
4
&&
oReq
.
status
!==
200
)
{
oReq
.
onload
=
null
;
oReq
.
onerror
=
null
;
...
...
@@ -90,12 +90,12 @@ morpheus.BufferedReader.getArrayBuffer = function(fileOrUrl, callback) {
oReq
.
send
(
null
);
}
else
{
var
reader
=
new
FileReader
();
reader
.
onload
=
function
(
event
)
{
reader
.
onload
=
function
(
event
)
{
callback
(
null
,
event
.
target
.
result
);
};
reader
.
onerror
=
function
(
event
)
{
reader
.
onerror
=
function
(
event
)
{
callback
(
event
);
};
reader
.
readAsArrayBuffer
(
fileOrUrl
);
}
};
\ No newline at end of file
};
src/io/gct_reader.js
View file @
2b20737b
...
...
@@ -76,6 +76,9 @@ morpheus.GctReader.prototype = {
dataColumnStart
=
numRowAnnotations
+
1
;
}
else
if
(
lineNumber
===
2
)
{
columnNamesArray
=
result
.
data
[
0
];
for
(
var
i
=
0
;
i
<
columnNamesArray
.
length
;
i
++
)
{
columnNamesArray
[
i
]
=
morpheus
.
Util
.
copyString
(
columnNamesArray
[
i
]);
}
if
(
ncols
===
-
1
)
{
ncols
=
columnNamesArray
.
length
-
numRowAnnotations
-
1
;
}
...
...
@@ -114,7 +117,7 @@ morpheus.GctReader.prototype = {
}
else
{
// lines >=3
var
tokens
=
result
.
data
[
0
];
if
(
lineNumber
<
dataMatrixLineNumberStart
)
{
var
metadataName
=
tokens
[
0
]
;
var
metadataName
=
morpheus
.
Util
.
copyString
(
tokens
[
0
])
;
var
v
=
[];
columnMetadata
.
push
(
v
);
columnMetadataNames
.
push
(
metadataName
);
...
...
src/util/util.js
View file @
2b20737b
...
...
@@ -143,11 +143,13 @@ morpheus.Util.getWindowSearchObject = function () {
};
morpheus
.
Util
.
copyString
=
function
(
s
)
{
var
copy
=
''
;
//return (' ' + s).slice(1);
// return (' ' + s).substr(1);
var
copy
=
[];
for
(
var
i
=
0
,
end
=
s
.
length
;
i
<
end
;
i
++
)
{
copy
+=
s
[
i
]
;
copy
.
push
(
s
[
i
])
;
}
return
copy
;
return
copy
.
join
(
''
)
;
};
morpheus
.
Util
.
getQueryParams
=
function
(
s
)
{
var
params
=
{};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment