Able to send a particular page now
This commit is contained in:
16
src/files.rs
16
src/files.rs
@@ -90,6 +90,7 @@ fn encode_npon(file_contents: &str, depth: u8) ->
|
||||
let mut index_flag: usize = 0;
|
||||
let mut flag: u8 = 0;
|
||||
let mut backslash_flag: bool = false;
|
||||
let mut temp_string: Vec<u8> = vec![];
|
||||
for (index, character) in file_contents.bytes().enumerate()
|
||||
{
|
||||
if backslash_flag
|
||||
@@ -119,7 +120,7 @@ fn encode_npon(file_contents: &str, depth: u8) ->
|
||||
{
|
||||
40 =>
|
||||
{
|
||||
bytes.push(3); // ( for name start
|
||||
temp_string.push(3); // ( for name start
|
||||
flag = 2;
|
||||
}
|
||||
123 => bytes.push(5),
|
||||
@@ -131,7 +132,7 @@ fn encode_npon(file_contents: &str, depth: u8) ->
|
||||
},
|
||||
39 | 34 =>
|
||||
{
|
||||
bytes.push(7);
|
||||
temp_string.push(7);
|
||||
flag = 1;
|
||||
},
|
||||
_ => (),
|
||||
@@ -144,14 +145,15 @@ fn encode_npon(file_contents: &str, depth: u8) ->
|
||||
{
|
||||
39 | 34 =>
|
||||
{
|
||||
bytes.push(8);
|
||||
temp_string.push(8);
|
||||
bytes.append(&mut temp_string);
|
||||
flag = 0;
|
||||
},
|
||||
92 =>
|
||||
{
|
||||
backslash_flag = true;
|
||||
},
|
||||
_ => bytes.push(character),
|
||||
_ => temp_string.push(character),
|
||||
}
|
||||
continue
|
||||
},
|
||||
@@ -161,14 +163,16 @@ fn encode_npon(file_contents: &str, depth: u8) ->
|
||||
{
|
||||
41 =>
|
||||
{
|
||||
bytes.push(4); // ) for name end
|
||||
temp_string.push(4);
|
||||
bytes.append(&mut temp_string); // ) for name end
|
||||
temp_string = vec![];
|
||||
flag = 0;
|
||||
},
|
||||
92 =>
|
||||
{
|
||||
backslash_flag = true;
|
||||
},
|
||||
_ => bytes.push(character),
|
||||
_ => temp_string.push(character),
|
||||
}
|
||||
continue
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user