Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
lektor
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Kubat
lektor
Validations
25eb4266
Vérifiée
Valider
25eb4266
rédigé
1 déc. 2021
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
DB: The 'unsigned int' version of config_get should be an octal version
parent
06421a70
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion
!179
Queue download if update asked per ID
Modifications
3
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
3 fichiers modifiés
inc/lektor/database.h
+3
-3
3 ajouts, 3 suppressions
inc/lektor/database.h
src/database/config.c
+13
-6
13 ajouts, 6 suppressions
src/database/config.c
src/module/module_repo.c
+2
-2
2 ajouts, 2 suppressions
src/module/module_repo.c
avec
18 ajouts
et
11 suppressions
inc/lektor/database.h
+
3
−
3
Voir le fichier @
25eb4266
...
...
@@ -186,7 +186,7 @@ bool database_config_set_strv_1_2 (lkt_db *db, const char *section, const
bool
database_config_get_text
(
lkt_db
*
db
,
const
char
*
section
,
const
char
*
key
,
char
*
value
,
size_t
len
);
bool
database_config_get_text_nospace
(
lkt_db
*
db
,
const
char
*
section
,
const
char
*
key
,
char
*
value
,
size_t
len
);
bool
database_config_get_int
(
lkt_db
*
db
,
const
char
*
section
,
const
char
*
key
,
int
*
value
);
bool
database_config_get_
uint
(
lkt_db
*
db
,
const
char
*
section
,
const
char
*
key
,
unsigned
int
*
value
);
bool
database_config_get_
octal
(
lkt_db
*
db
,
const
char
*
section
,
const
char
*
key
,
unsigned
int
*
value
);
bool
database_config_exists
(
lkt_db
*
db
,
const
char
*
section
,
const
char
*
key
);
bool
database_config_queue
(
lkt_db
*
db
,
const
char
*
option
,
int
value
);
bool
database_config_queue_default
(
lkt_db
*
db
);
...
...
@@ -201,8 +201,8 @@ void database_config_set_optional_fields(lkt_db *db);
#define DBCONF_GET_INT(db, section, key, value) \
FAIL_UNLESS(database_config_get_int(db, section, key, value), \
"Failed to get config '%s/%s' from database", section, key);
#define DBCONF_GET_
UINT
(db, section, key, value) \
FAIL_UNLESS(database_config_get_
uint
(db, section, key, value), \
#define DBCONF_GET_
OCTAL
(db, section, key, value) \
FAIL_UNLESS(database_config_get_
octal
(db, section, key, value), \
"Failed to get config '%s/%s' from database", section, key);
/* Dump configuration to any stream, form is undefined, this function is here
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/database/config.c
+
13
−
6
Voir le fichier @
25eb4266
...
...
@@ -154,13 +154,20 @@ error:
}
bool
database_config_get_
uint
(
lkt_db
*
db
,
const
char
*
section
,
const
char
*
key
,
unsigned
int
*
value
)
database_config_get_
octal
(
lkt_db
*
db
,
const
char
*
section
,
const
char
*
key
,
unsigned
int
*
value
)
{
int
int_value
;
const
bool
ret
=
database_config_get_int
(
db
,
section
,
key
,
&
int_value
);
FAIL_IF
(
int_value
<
0
,
"Can't cast a negative value to unsigned int!"
);
*
value
=
(
unsigned
int
)
int_value
;
return
ret
;
char
str_value
[
LKT_LINE_MAX
];
unless
(
database_config_get_text_nospace
(
db
,
section
,
key
,
str_value
,
LKT_LINE_MAX
))
return
false
;
const
long
octal
=
strtol
(
str_value
,
NULL
,
8
);
if
(
octal
<
0
||
octal
>
UINT_MAX
)
{
LOG_ERROR
(
"DB"
,
"The octal value is negative or to big for a uint!"
);
return
false
;
}
*
value
=
(
unsigned
int
)
octal
;
return
true
;
}
bool
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/module/module_repo.c
+
2
−
2
Voir le fichier @
25eb4266
...
...
@@ -438,7 +438,7 @@ ___handle_got_json_internal_callback(const char *key, const char *val, int comp,
uint64_t
filestamp
=
0
;
bool
magic_valid
=
0
;
unsigned
int
umask
=
0
;
DBCONF_GET_
UINT
(
kara
->
db
,
"database"
,
"dir_permission"
,
&
umask
);
DBCONF_GET_
OCTAL
(
kara
->
db
,
"database"
,
"dir_permission"
,
&
umask
);
/* Add the kara because it's not present */
kara
->
repo
->
craft_filename
(
kara
->
filename
,
kara
,
umask
);
...
...
@@ -473,7 +473,7 @@ ___handle_got_json_internal_callback(const char *key, const char *val, int comp,
int
current_id
=
0
;
bool
magic_valid
=
0
;
unsigned
int
umask
=
0
;
DBCONF_GET_
UINT
(
kara
->
db
,
"database"
,
"dir_permission"
,
&
umask
);
DBCONF_GET_
OCTAL
(
kara
->
db
,
"database"
,
"dir_permission"
,
&
umask
);
/* Timestamp and presence verification */
kara
->
repo
->
craft_filename
(
kara
->
filename
,
kara
,
umask
);
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter