Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-kde
Path: blob/main/archivers/ccmix/files/patch-src_mixid.cpp
16461 views
1
From c55a16f2a142c55f344480c3eecc6ecdedcfa735 Mon Sep 17 00:00:00 2001
2
From: askeladdk <askeladdk@users.noreply.github.com>
3
Date: Sat, 2 Jan 2016 14:15:35 +0100
4
Subject: [PATCH] The filenames of unidentified files will be used as the
5
internal ID without being re-hashed. This lets you repack
6
unidentified files easily. Unidentified filenames are
7
detected if their name is exactly 8 characters long and
8
does not contain a dot ('.').
9
10
--- src/mixid.cpp.orig 2017-06-12 14:07:35 UTC
11
+++ src/mixid.cpp
12
@@ -8,7 +8,7 @@ namespace MixID
13
{
14
namespace
15
{
16
- int32_t crc_table[256] = {
17
+ uint32_t crc_table[256] = {
18
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
19
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
20
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
21
@@ -42,8 +42,6 @@ namespace MixID
22
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
23
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d};
24
25
- const char* marker = "[id]";
26
-
27
uint32_t do_block(const void* data, int size);
28
29
uint32_t do_block(const void* data, int size)
30
@@ -62,7 +60,7 @@ namespace MixID
31
{
32
//if the filename starts [id] treat next 8 chars as an id to convert to int
33
if(isIdName(fname)){
34
- return strId(fname.substr(4, 8));
35
+ return strId(fname);
36
}
37
std::transform(fname.begin(), fname.end(), fname.begin(),
38
(int(*)(int)) toupper); // convert to uppercase
39
@@ -128,6 +126,6 @@ namespace MixID
40
41
bool isIdName(std::string fname)
42
{
43
- return !strncmp(fname.c_str(), marker, strlen(marker));
44
+ return (fname.size() == 8) && (fname.find('.') == std::string::npos);
45
}
46
}
47
48