aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Woodward2018-07-03 19:31:23 -0400
committerJason Woodward2018-07-03 19:52:10 -0400
commit57f63030713f73556b4afb8f9f072f8693a46075 (patch)
treea2d7dbb878e7fff62b870380aa6c38456c98539a /src
parent264edab5be1d7e8aa2fddd59090fe6060c3f2d02 (diff)
downloadslapt-get-57f63030713f73556b4afb8f9f072f8693a46075.tar.gz
use uint32_t from stdint/inttypes
Diffstat (limited to 'src')
-rw-r--r--src/common.c12
-rw-r--r--src/common.h2
-rw-r--r--src/configuration.c8
-rw-r--r--src/configuration.h4
-rw-r--r--src/main.h1
-rw-r--r--src/package.c13
-rw-r--r--src/package.h14
-rw-r--r--src/transaction.h4
8 files changed, 29 insertions, 29 deletions
diff --git a/src/common.c b/src/common.c
index a259376..ac18814 100644
--- a/src/common.c
+++ b/src/common.c
@@ -81,7 +81,7 @@ char *slapt_regex_extract_match(const slapt_regex_t *r, const char *src, const i
char *str = NULL;
if (m.rm_so != -1) {
- unsigned int len = m.rm_eo - m.rm_so + 1;
+ uint32_t len = m.rm_eo - m.rm_so + 1;
str = malloc(sizeof *str * len);
str = strncpy(str, src + m.rm_so, len);
@@ -103,7 +103,7 @@ void slapt_gen_md5_sum_of_file(FILE *f, char *result_sum)
EVP_MD_CTX *mdctx = NULL;
const EVP_MD *md;
unsigned char md_value[EVP_MAX_MD_SIZE];
- unsigned int md_len = 0, i;
+ uint32_t md_len = 0;
ssize_t getline_read;
size_t getline_size;
char *result_sum_tmp = NULL;
@@ -135,7 +135,7 @@ void slapt_gen_md5_sum_of_file(FILE *f, char *result_sum)
result_sum[0] = '\0';
- for (i = 0; i < md_len; ++i) {
+ for (uint32_t i = 0; i < md_len; ++i) {
char *p = slapt_malloc(sizeof *p * 3);
if (snprintf(p, 3, "%02x", md_value[i]) > 0) {
@@ -254,12 +254,12 @@ int slapt_ask_yes_no(const char *format, ...)
char *slapt_str_replace_chr(const char *string, const char find,
const char replace)
{
- unsigned int i, len = 0;
+ uint32_t len = 0;
char *clean = slapt_calloc(strlen(string) + 1, sizeof *clean);
;
len = strlen(string);
- for (i = 0; i < len; ++i) {
+ for (uint32_t i = 0; i < len; ++i) {
if (string[i] == find) {
clean[i] = replace;
} else {
@@ -422,7 +422,7 @@ void slapt_add_list_item(slapt_list_t *list, const char *item)
void slapt_remove_list_item(slapt_list_t *list, const char *item)
{
- unsigned int i = 0;
+ uint32_t i = 0;
char *tmp = NULL;
while (i < list->count) {
diff --git a/src/common.h b/src/common.h
index 49f3b5c..fc55898 100644
--- a/src/common.h
+++ b/src/common.h
@@ -69,7 +69,7 @@ typedef struct {
typedef struct {
char **items;
- unsigned int count;
+ uint32_t count;
} slapt_list_t;
FILE *slapt_open_file(const char *file_name, const char *mode);
diff --git a/src/configuration.c b/src/configuration.c
index 71f936d..f92b7a6 100644
--- a/src/configuration.c
+++ b/src/configuration.c
@@ -219,7 +219,7 @@ void slapt_add_source(slapt_source_list_t *list, slapt_source_t *s)
void slapt_remove_source(slapt_source_list_t *list, const char *s)
{
slapt_source_t *src_to_discard = NULL;
- unsigned int i = 0;
+ uint32_t i = 0;
while (i < list->count) {
if (strcmp(s, list->src[i]->url) == 0 && src_to_discard == NULL) {
@@ -309,8 +309,8 @@ static void slapt_source_parse_attributes(slapt_source_t *s, const char *string)
slapt_source_t *slapt_init_source(const char *s)
{
slapt_source_t *src;
- unsigned int source_len = 0;
- unsigned int attribute_len = 0;
+ uint32_t source_len = 0;
+ uint32_t attribute_len = 0;
slapt_regex_t *attribute_regex = NULL;
char *source_string = NULL;
char *attribute_string = NULL;
@@ -382,7 +382,7 @@ void slapt_free_source(slapt_source_t *src)
int slapt_write_rc_config(const slapt_rc_config *global_config, const char *location)
{
- unsigned int i;
+ uint32_t i = 0;
FILE *rc;
rc = slapt_open_file(location, "w+");
diff --git a/src/configuration.h b/src/configuration.h
index c5fb74f..2bce6c9 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -31,7 +31,7 @@ typedef struct {
typedef struct {
slapt_source_t **src;
- unsigned int count;
+ uint32_t count;
} slapt_source_list_t;
typedef struct {
@@ -53,7 +53,7 @@ typedef struct {
bool dl_stats;
bool remove_obsolete;
bool no_upgrade;
- unsigned int retry;
+ uint32_t retry;
bool use_priority;
bool gpgme_allow_unauth;
} slapt_rc_config;
diff --git a/src/main.h b/src/main.h
index ad77a88..1b0533d 100644
--- a/src/main.h
+++ b/src/main.h
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
+#include <stdint.h>
#include <unistd.h>
#include <getopt.h>
#include <curl/curl.h>
diff --git a/src/package.c b/src/package.c
index 3618a29..267c725 100644
--- a/src/package.c
+++ b/src/package.c
@@ -20,7 +20,7 @@
struct slapt_pkg_version_parts {
char **parts;
- unsigned int count;
+ uint32_t count;
};
/* used by qsort */
@@ -986,8 +986,7 @@ void slapt_get_md5sums(slapt_pkg_list_t *pkgs, FILE *checksum_file)
static void slapt_free_pkg_version_parts(struct slapt_pkg_version_parts *parts)
{
- unsigned int i;
- for (i = 0; i < parts->count; i++) {
+ for (uint32_t i = 0; i < parts->count; i++) {
free(parts->parts[i]);
}
free(parts->parts);
@@ -1015,7 +1014,7 @@ int slapt_cmp_pkgs(slapt_pkg_info_t *a, slapt_pkg_info_t *b)
int slapt_cmp_pkg_versions(const char *a, const char *b)
{
- unsigned int position = 0;
+ uint32_t position = 0;
int greater = 1, lesser = -1, equal = 0;
struct slapt_pkg_version_parts *a_parts;
struct slapt_pkg_version_parts *b_parts;
@@ -1300,7 +1299,7 @@ int slapt_get_pkg_dependencies(const slapt_rc_config *global_config,
slapt_pkg_err_list_t *conflict_err,
slapt_pkg_err_list_t *missing_err)
{
- unsigned int i = 0;
+ uint32_t i = 0;
slapt_list_t *dep_parts = NULL;
/*
@@ -1674,7 +1673,7 @@ slapt_pkg_list_t *slapt_is_required_by(const slapt_rc_config *global_config,
static char *escape_package_name(slapt_pkg_info_t *pkg)
{
- unsigned int name_len = 0, escape_count = 0, i;
+ uint32_t name_len = 0, escape_count = 0, i;
char *escaped_name = NULL, *escaped_ptr;
char p;
@@ -2224,7 +2223,7 @@ slapt_code_t slapt_verify_downloaded_pkg(const slapt_rc_config *global_config,
since we are validating the checksum anyway.
file_size = slapt_get_pkg_file_size(global_config,pkg);
- if ((unsigned int)(file_size/1024) != pkg->size_c) {
+ if ((uint32_t)(file_size/1024) != pkg->size_c) {
return SLAPT_DOWNLOAD_INCOMPLETE;
}
*/
diff --git a/src/package.h b/src/package.h
index a1280f4..54b6fb5 100644
--- a/src/package.h
+++ b/src/package.h
@@ -63,15 +63,15 @@ typedef struct {
char *conflicts;
char *suggests;
char *file_ext;
- unsigned int size_c;
- unsigned int size_u;
- unsigned int priority;
+ uint32_t size_c;
+ uint32_t size_u;
+ uint32_t priority;
bool installed;
} slapt_pkg_info_t;
typedef struct {
slapt_pkg_info_t **pkgs;
- unsigned int pkg_count;
+ uint32_t pkg_count;
bool free_pkgs;
bool ordered;
} slapt_pkg_list_t;
@@ -84,8 +84,8 @@ typedef struct {
typedef struct {
slapt_pkg_upgrade_t **pkgs;
- unsigned int pkg_count;
- unsigned int reinstall_count;
+ uint32_t pkg_count;
+ uint32_t reinstall_count;
} slapt_pkg_upgrade_list_t;
typedef struct {
@@ -95,7 +95,7 @@ typedef struct {
typedef struct {
slapt_pkg_err_t **errs;
- unsigned int err_count;
+ uint32_t err_count;
} slapt_pkg_err_list_t;
/* returns an empty package structure */
diff --git a/src/transaction.h b/src/transaction.h
index b2455fa..eed7711 100644
--- a/src/transaction.h
+++ b/src/transaction.h
@@ -27,12 +27,12 @@ typedef struct {
slapt_pkg_info_t *i;
slapt_pkg_upgrade_t *u;
} pkg;
- unsigned int type; /* this is enum slapt_action defined in main.h */
+ uint32_t type; /* this is enum slapt_action defined in main.h */
} slapt_queue_i;
typedef struct {
slapt_queue_i **pkgs;
- unsigned int count;
+ uint32_t count;
} slapt_queue_t;
typedef struct {