Skip to content

Commit

Permalink
Make functions static
Browse files Browse the repository at this point in the history
  • Loading branch information
Xpl0itU committed Nov 15, 2022
1 parent e70444b commit c8ba325
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions src/downloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ struct PathFileStruct {
FILE *file_pointer;
};

GtkWidget *progress_bar;
GtkWidget *window;
static GtkWidget *progress_bar;
static GtkWidget *window;

char currentFile[255] = "None";
char *selected_dir = NULL;
static char currentFile[255] = "None";
static char *selected_dir = NULL;

uint16_t bswap_16(uint16_t value) {
static inline uint16_t bswap_16(uint16_t value) {
return (uint16_t) ((0x00FF & (value >> 8)) | (0xFF00 & (value << 8)));
}

static inline uint32_t bswap_32(uint32_t __x) {
return __x >> 24 | __x >> 8 & 0xff00 | __x << 8 & 0xff0000 | __x << 24;
}

char *readable_fs(double size, char *buf) {
static char *readable_fs(double size, char *buf) {
int i = 0;
const char *units[] = {"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"};
while (size > 1024) {
Expand Down Expand Up @@ -88,7 +88,7 @@ static size_t WriteDataToMemory(void *contents, size_t size, size_t nmemb, void
return realsize;
}

void create_ticket(const char *title_id, const char *title_key, uint16_t title_version, const char *output_path) {
static void create_ticket(const char *title_id, const char *title_key, uint16_t title_version, const char *output_path) {
FILE *ticket_file = fopen(output_path, "wb");
if (!ticket_file) {
fprintf(stderr, "Error: The file \"%s\" couldn't be opened. Will exit now.\n", output_path);
Expand All @@ -105,7 +105,7 @@ void create_ticket(const char *title_id, const char *title_key, uint16_t title_v
printf("Finished creating \"%s\".\n", output_path);
}

void downloadCert(const char *outputPath) {
static void downloadCert(const char *outputPath) {
FILE *cetk = fopen(outputPath, "wb");
if(cetk == NULL)
return;
Expand All @@ -122,7 +122,7 @@ void downloadCert(const char *outputPath) {
fclose(cetk);
}

void progressDialog() {
static void progressDialog() {
gtk_init(NULL, NULL);

//Create window
Expand All @@ -145,7 +145,7 @@ void progressDialog() {
gtk_widget_show_all(window);
}

int downloadFile(const char *download_url, const char *output_path) {
static int downloadFile(const char *download_url, const char *output_path) {
FILE *file = fopen(output_path, "wb");
if(file == NULL)
return 1;
Expand All @@ -167,7 +167,7 @@ int downloadFile(const char *download_url, const char *output_path) {
}

// function to return the path of the selected folder
char *gtk3_show_folder_select_dialog() {
static char *gtk3_show_folder_select_dialog() {
GtkWidget *dialog;
GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
gint res;
Expand All @@ -194,13 +194,13 @@ char *gtk3_show_folder_select_dialog() {
return folder_path;
}

void prepend(char *s, const char *t) {
static void prepend(char *s, const char *t) {
size_t len = strlen(t);
memmove(s + len, s, strlen(s) + 1);
memcpy(s, t, len);
}

char *dirname(char *path) {
static char *dirname(char *path) {
int len = strlen(path);
int last = len - 1;
char *parent = malloc(sizeof(char) * (len + 1));
Expand Down
2 changes: 1 addition & 1 deletion src/keygen.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void hex2bytes(const char *input, uint8_t *output) {
}
}

bool encryptAES(void *data, int data_len, const unsigned char *key, unsigned char *iv, void *encrypted) {
static bool encryptAES(void *data, int data_len, const unsigned char *key, unsigned char *iv, void *encrypted) {
mbedtls_aes_context ctx;
mbedtls_aes_init(&ctx);
mbedtls_aes_setkey_enc(&ctx, key, 128);
Expand Down

0 comments on commit c8ba325

Please sign in to comment.