Format document
This commit is contained in:
parent
30a99f35a6
commit
57828f39be
@ -8,7 +8,7 @@
|
||||
#include "cryptography.h"
|
||||
|
||||
|
||||
const char*arg_get(Buffer& decrypted_buffer, const char* label)
|
||||
const char* arg_get(Buffer& decrypted_buffer, const char* label)
|
||||
{
|
||||
int pass = find_password_in_buffer(decrypted_buffer, label);
|
||||
if (pass < 0) {
|
||||
|
@ -21,7 +21,7 @@ Buffer::~Buffer()
|
||||
|
||||
bool Buffer::resize(size_t new_size)
|
||||
{
|
||||
if(size >= new_size) return true;
|
||||
if (size >= new_size) return true;
|
||||
uint8_t* new_buffer = (uint8_t*)realloc(buffer, new_size);
|
||||
if (!new_buffer)
|
||||
{
|
||||
|
@ -9,14 +9,14 @@ int find_password_in_buffer(Buffer& decrypted_buffer, const char* label)
|
||||
|
||||
for (size_t i = 0; i < index->count; i++)
|
||||
{
|
||||
if (glob(label, (const char*) decrypted_buffer.buffer + pass[i].label + index->offset) == Glob_Result::MATCHED)
|
||||
if (glob(label, (const char*)decrypted_buffer.buffer + pass[i].label + index->offset) == Glob_Result::MATCHED)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void delete_password_from_buffer(Buffer& in, int index_of_pass)
|
||||
void delete_password_from_buffer(Buffer& in, int index_of_pass)
|
||||
{
|
||||
Index* in_index = (Index*)in.buffer;
|
||||
Pass* in_pass = (Pass*)(in.buffer + sizeof(Index));
|
||||
@ -34,7 +34,7 @@ void delete_password_from_buffer(Buffer& in, int index_of_pass)
|
||||
in_pass[i].password -= size_pass;
|
||||
}
|
||||
|
||||
in.remove_fast((uint8_t*)& in_pass[index_of_pass], sizeof(Pass));
|
||||
in.remove_fast((uint8_t*)&in_pass[index_of_pass], sizeof(Pass));
|
||||
in_index->count -= 1;
|
||||
in_index->offset -= sizeof(Pass);
|
||||
}
|
||||
@ -53,7 +53,7 @@ void add_password_to_buffer(Buffer& in, const char* label, const char* password)
|
||||
index->offset += sizeof(Pass);
|
||||
|
||||
in.add_middle((uint8_t*)&pass, sizeof(Pass), index->offset - sizeof(Pass));
|
||||
|
||||
|
||||
}
|
||||
|
||||
const char* get_password_from_buffer(Buffer& decrypted_buffer, int label)
|
||||
|
Loading…
x
Reference in New Issue
Block a user