Compare commits
No commits in common. "3d2e5b72a41337add34e36de63aae0028c08951b" and "80bc3317218c00829d128f0a1e3ef10d2ed817ac" have entirely different histories.
3d2e5b72a4
...
80bc331721
|
@ -1,5 +1,5 @@
|
||||||
```
|
```
|
||||||
title = "Tusker is Now Available"
|
title = "Tusker is now Available"
|
||||||
tags = ["swift"]
|
tags = ["swift"]
|
||||||
date = "2023-01-23 11:00:42 -0500"
|
date = "2023-01-23 11:00:42 -0500"
|
||||||
short_desc = ""
|
short_desc = ""
|
||||||
|
|
|
@ -37,7 +37,7 @@ let data = Data(buffer: buf)
|
||||||
let code = String(data: data, encoding: .utf8)!
|
let code = String(data: data, encoding: .utf8)!
|
||||||
```
|
```
|
||||||
|
|
||||||
You may notice that the code string length is being passed into the function as an unsigned 64-bit integer, and then being converted to an `Int`, which may not be capable of representing the value. But, since this is just a syntax highlighter for my blog, there's absolutely no chance of it ever being used to highlight a string longer than 2<sup>63</sup>-1 bytes.
|
You may notice that the code string length is being passed into the function as an unsigned 64-bit integer, and then being converted to an `Int`, which may not be capable of representing the value. But, since this is just a syntax highlighter for my blog, there's absolutely no chance of it ever being used to highlight a string longer than 2^63-1 bytes.
|
||||||
|
|
||||||
The actual highlighting I'll skip, you can refer to the documentation for Splash. Once that's done, though, the output needs to be sent back to Rust somehow. Again, since the function signature needs to be compatible with C, it returns a pointer to a byte buffer containing the UTF-8 encoded string. It also sets a length pointer provided by the caller to the length in bytes of the output.
|
The actual highlighting I'll skip, you can refer to the documentation for Splash. Once that's done, though, the output needs to be sent back to Rust somehow. Again, since the function signature needs to be compatible with C, it returns a pointer to a byte buffer containing the UTF-8 encoded string. It also sets a length pointer provided by the caller to the length in bytes of the output.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue