2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change 13
13
UTF8ToString
14
14
stringToUTF8
15
15
lengthBytesUTF8
16
- allocate
17
- ALLOC_NORMAL
18
16
allocateUTF8OnStack
19
17
removeFunction
20
18
addFunction
@@ -545,8 +543,8 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
545
543
pos = this . pos ;
546
544
this . pos += 1 ;
547
545
}
548
- var bytes = intArrayFromString ( string ) ;
549
- var strptr = allocate ( bytes , ALLOC_NORMAL ) ;
546
+ var length = lengthBytesUTF8 ( string ) ;
547
+ var strptr = stringToNewUTF8 ( string ) ;
550
548
this . allocatedmem . push ( strptr ) ;
551
549
this . db . handleError ( sqlite3_bind_text (
552
550
this . stmt ,
@@ -563,7 +561,8 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
563
561
pos = this . pos ;
564
562
this . pos += 1 ;
565
563
}
566
- var blobptr = allocate ( array , ALLOC_NORMAL ) ;
564
+ var blobptr = _malloc ( array . length ) ;
565
+ writeArrayToMemory ( array , blobptr )
567
566
this . allocatedmem . push ( blobptr ) ;
568
567
this . db . handleError ( sqlite3_bind_blob (
569
568
this . stmt ,
@@ -1204,7 +1203,8 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
1204
1203
if ( result === null ) {
1205
1204
sqlite3_result_null ( cx ) ;
1206
1205
} else if ( result . length != null ) {
1207
- var blobptr = allocate ( result , ALLOC_NORMAL ) ;
1206
+ var blobptr = _malloc ( result . length ) ;
1207
+ writeArrayToMemory ( array , blobptr )
1208
1208
sqlite3_result_blob ( cx , blobptr , result . length , - 1 ) ;
1209
1209
_free ( blobptr ) ;
1210
1210
} else {
Original file line number Diff line number Diff line change 4
4
" stackSave" ,
5
5
" stackRestore" ,
6
6
" UTF8ToString" ,
7
-
8
- " allocate" ,
9
- " ALLOC_NORMAL" ,
7
+ " writeArrayToMemory" ,
10
8
" allocateUTF8OnStack" ,
11
9
" removeFunction" ,
12
10
" addFunction"
0 commit comments