mirror of
https://github.com/WerWolv/ImHex-Patterns.git
synced 2026-03-30 21:05:55 -05:00
git: Various style fixes everywhere, removing whitespaces (#321)
* repo-wide: trim trailing spaces Note: This doesn't touch the .tbl files in encodings/ since they include meaningful trailing spaces (`20= `) * patterns: clean up duplicate semicolons * ELF: add header magic check * glTF: use type::Magic for magic value * glTF: check that the file size in the header matches * xgstexture: fix generics syntax for magic value * JPEG: define hex enum with 0x00 instead of 0X00 * CI: update deprecated actions --------- Co-authored-by: Nik <werwolv98@gmail.com>
This commit is contained in:
@@ -8,20 +8,20 @@ import std.mem;
|
||||
import std.string;
|
||||
|
||||
namespace bencode {
|
||||
|
||||
|
||||
struct ASCIIDecimal {
|
||||
char value[while(std::ctype::isdigit(std::mem::read_unsigned($, 1)))];
|
||||
} [[sealed, format("bencode::format_ascii_decimal"), transform("bencode::format_ascii_decimal")]];
|
||||
|
||||
|
||||
fn format_ascii_decimal(ASCIIDecimal adsasd) {
|
||||
return std::string::parse_int(adsasd.value, 10);
|
||||
};
|
||||
|
||||
|
||||
enum Type : u8 {
|
||||
Integer = 'i',
|
||||
Dictionary = 'd',
|
||||
List = 'l',
|
||||
|
||||
|
||||
String0 = '0',
|
||||
String1 = '1',
|
||||
String2 = '2',
|
||||
@@ -33,30 +33,30 @@ namespace bencode {
|
||||
String8 = '8',
|
||||
String9 = '9'
|
||||
};
|
||||
|
||||
|
||||
struct String {
|
||||
ASCIIDecimal length;
|
||||
char separator [[hidden]];
|
||||
char value[length];
|
||||
} [[sealed, format("bencode::format_string"), transform("bencode::format_string")]];
|
||||
|
||||
|
||||
fn format_string(String string) {
|
||||
return string.value;
|
||||
return string.value;
|
||||
};
|
||||
|
||||
|
||||
using Bencode;
|
||||
using Value;
|
||||
|
||||
|
||||
struct DictionaryEntry {
|
||||
String key;
|
||||
Value value;
|
||||
};
|
||||
|
||||
|
||||
struct Value {
|
||||
Type type;
|
||||
|
||||
|
||||
if (type == Type::Dictionary) {
|
||||
DictionaryEntry entry[while(std::mem::read_unsigned($, 1) != 'e')];
|
||||
DictionaryEntry entry[while(std::mem::read_unsigned($, 1) != 'e')];
|
||||
} else if (type == Type::Integer) {
|
||||
ASCIIDecimal value;
|
||||
char end;
|
||||
@@ -65,12 +65,12 @@ namespace bencode {
|
||||
String value;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct Bencode {
|
||||
Value value[while(!std::mem::eof())] [[inline]];
|
||||
Value value[while(!std::mem::eof())] [[inline]];
|
||||
char end;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
bencode::Bencode bencode @ 0x00;
|
||||
|
||||
Reference in New Issue
Block a user