1
0
mirror of https://github.com/pcvolkmer/osc-variant.git synced 2025-04-20 20:26:50 +00:00

chore: code cleanup

This commit is contained in:
Paul-Christian Volkmer 2024-04-24 08:00:40 +02:00
parent 5e297a0353
commit 79193ba91b
4 changed files with 10 additions and 7 deletions

View File

@ -24,13 +24,16 @@
#include "deob.h" #include "deob.h"
void deob(char * in) { void deob(char *in) {
const long long s[2] = { S0, S1 }; const long long s[2] = {S0, S1};
char d[] = "OSTAR.password$OSB"; char d[] = "OSTAR.password$OSB";
for (size_t i = 0; i < DL; i++) d[i] = (CS)[i]; for (size_t i = 0; i < DL; i++) d[i] = (CS)[i];
size_t l = strlen(in) / 2; size_t l = strlen(in) / 2;
for (size_t i = 0; i < l; i++) { for (size_t i = 0; i < l; i++) {
for (size_t j = 0; j < DL; j++) { DLT(0); DLT(1); } for (size_t j = 0; j < DL; j++) {
DLT(0);
DLT(1);
}
DLS(i); DLS(i);
} }
INZ(l); INZ(l);

View File

@ -32,12 +32,12 @@
#define S0 8373972096940928081 #define S0 8373972096940928081
#define S1 7378413942531504450 #define S1 7378413942531504450
#define CS (char*)&s #define CS (char*)&s
#define DL sizeof(d) / sizeof(d[0]) - 2 #define DL sizeof(d) / sizeof(d[0]) - 3
#define I2 i*2 #define I2 i*2
#define INZ(var) in[var] = 0 #define INZ(var) in[var] = 0
#define DLS(idx) in[idx] = (d[DL+1]<<4)|d[DL] #define DLS(idx) in[idx] = (d[DL+1]<<4)|d[DL]
#define DLT(idx) d[DL+idx] = (in[I2+idx] == d[j]) ? (char)j : d[DL+idx] #define DLT(idx) d[DL+idx] = (in[I2+idx] == d[j]) ? (char)j : d[DL+idx]
void deob(char * in); void deob(char *in);
#endif //OSC_VARIANT_DEOB_H #endif //OSC_VARIANT_DEOB_H

View File

@ -141,7 +141,7 @@ impl InputFile {
} }
} else { } else {
return Err(FileError::Parsing( return Err(FileError::Parsing(
filename.into(), filename,
"Kann OSB-Datei nicht lesen".to_string(), "Kann OSB-Datei nicht lesen".to_string(),
)); ));
} }

View File

@ -88,7 +88,7 @@ pub fn unzip_osb_using_password(path: &str, dir: &str, password: &str) {
}; };
let outpath = match file.enclosed_name() { let outpath = match file.enclosed_name() {
Some(path) => Path::new(dir).join(path.to_owned()), Some(path) => Path::new(dir).join(&path),
None => continue, None => continue,
}; };