File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed
Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change 7676 <MicrosoftTestingPlatformVersion >1.9.0</MicrosoftTestingPlatformVersion >
7777 <SkiaSharpVersion >3.119.0</SkiaSharpVersion >
7878 <HarfbuzzSharpVersion >8.3.1.1</HarfbuzzSharpVersion >
79- <UnoICUVersion >77.1.0-dev.45 </UnoICUVersion >
79+ <UnoICUVersion >77.1.0-dev.46 </UnoICUVersion >
8080 </PropertyGroup >
8181
8282 <ItemGroup >
Original file line number Diff line number Diff line change @@ -96,16 +96,15 @@ static unsafe ICU()
9696 . Where ( t => t . Item2 != null )
9797 . Select ( t => t . a . GetManifestResourceStream ( t . Item2 ! ) )
9898 . First ( ) ! ;
99- var data = new byte [ stream . Length ] ;
100- stream . ReadExactly ( data , 0 , data . Length ) ;
101- fixed ( byte * dataPtr = data )
99+ // udata_setCommonData does not copy the buffer, so it needs to be pinned.
100+ // For alignment, the ICU docs require 16-byte alignment. https://unicode-org.github.io/icu/userguide/icu_data/#alignment
101+ var data = NativeMemory . AlignedAlloc ( ( UIntPtr ) stream . Length , 16 ) ;
102+ stream . ReadExactly ( new Span < byte > ( data , ( int ) stream . Length ) ) ;
103+ var errorPtr = BrowserICUSymbols . uno_udata_setCommonData ( ( IntPtr ) data ) ;
104+ var errorString = Marshal . PtrToStringUTF8 ( errorPtr ) ;
105+ if ( errorString is not null )
102106 {
103- var errorPtr = BrowserICUSymbols . uno_udata_setCommonData ( ( IntPtr ) dataPtr ) ;
104- var errorString = Marshal . PtrToStringUTF8 ( errorPtr ) ;
105- if ( errorString is not null )
106- {
107- throw new InvalidOperationException ( $ "uno_udata_setCommonData failed: { errorString } ") ;
108- }
107+ throw new InvalidOperationException ( $ "uno_udata_setCommonData failed: { errorString } ") ;
109108 }
110109
111110 // ICU is included in the dotnet runtime itself
You can’t perform that action at this time.
0 commit comments