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
a5e2e825
Vérifiée
Valider
a5e2e825
rédigé
Il y a 4 ans
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
CACHE & MKV: The cached duration should be OK now
parent
5a24c34f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion
!157
Caching for karas & refactor & others
Modifications
3
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
3 fichiers modifiés
inc/lektor/internal/os.h
+1
-15
1 ajout, 15 suppressions
inc/lektor/internal/os.h
src/base/os.c
+4
-4
4 ajouts, 4 suppressions
src/base/os.c
src/database/cache.c
+9
-8
9 ajouts, 8 suppressions
src/database/cache.c
avec
14 ajouts
et
27 suppressions
inc/lektor/internal/os.h
+
1
−
15
Voir le fichier @
a5e2e825
...
...
@@ -42,21 +42,7 @@ extern "C" {
#if defined(HAVE_ENDIAN_H) && HAVE_ENDIAN_H == 1
#include
<endian.h>
#ifdef LKT_ENDIANES_LITTLE
#undef LKT_ENDIANES_LITTLE
#endif
#ifdef LKT_ENDIANES_BIG
#undef LKT_ENDIANES_BIG
#endif
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define LKT_ENDIANES_LITTLE 1
#elif __BYTE_ORDER == __BIG_ENDIAN
#define LKT_ENDIANES_BIG 1
#else
#if !(__BYTE_ORDER == __LITTLE_ENDIAN || __BYTE_ORDER == __BIG_ENDIAN)
#error "Unsuported endiannes"
#endif
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/base/os.c
+
4
−
4
Voir le fichier @
a5e2e825
...
...
@@ -50,10 +50,10 @@ be_float_t(const uint8_t bytes[])
#if defined(LKT_ENDIANES_LITTLE) && (LKT_ENDIANES_LITTLE == 1)
for
(
size_t
i
=
0
;
i
<
4
;
++
i
)
ret
.
_data
[
i
]
=
bytes
[
i
];
ret
.
_data
[
i
]
=
bytes
[
3
-
i
];
#else
/* BIG ENDIAN */
for
(
size_t
i
=
0
;
i
<
4
;
++
i
)
ret
.
_data
[
i
]
=
bytes
[
3
-
i
];
ret
.
_data
[
i
]
=
bytes
[
i
];
#endif
return
ret
.
_float
;
...
...
@@ -70,10 +70,10 @@ be_double_t(const uint8_t bytes[])
#if defined(LKT_ENDIANES_LITTLE) && (LKT_ENDIANES_LITTLE == 1)
for
(
size_t
i
=
0
;
i
<
8
;
++
i
)
ret
.
_data
[
i
]
=
bytes
[
i
];
ret
.
_data
[
i
]
=
bytes
[
7
-
i
];
#else
/* BIG ENDIAN */
for
(
size_t
i
=
0
;
i
<
8
;
++
i
)
ret
.
_data
[
i
]
=
bytes
[
7
-
i
];
ret
.
_data
[
i
]
=
bytes
[
i
];
#endif
return
ret
.
_float
;
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/database/cache.c
+
9
−
8
Voir le fichier @
a5e2e825
...
...
@@ -3,6 +3,7 @@
#include
<lektor/common.h>
#include
<lektor/database.h>
#include
<lektor/internal/dbmacro.h>
#include
<math.h>
/* Cache operations */
#define _get_ 1
...
...
@@ -50,29 +51,29 @@ database_cache_kara(volatile sqlite3 *db, int id)
char
filepath
[
PATH_MAX
];
if
(
!
database_get_kara_path
(
db
,
id
,
filepath
))
{
LOG_ERROR
(
"CACHE"
,
"Failed to get a path for kara %
l
d, don't update cache"
,
id
);
LOG_ERROR
(
"CACHE"
,
"Failed to get a path for kara %d, don't update cache"
,
id
);
return
;
}
if
(
database_is_kara_cached
(
db
,
id
))
{
LOG_INFO
(
"CACHE"
,
"Kara %
l
d is already cached"
,
id
);
LOG_INFO
(
"CACHE"
,
"Kara %d is already cached"
,
id
);
return
;
}
else
LOG_INFO
(
"CACHE"
,
"Trying to cache kara %
l
d"
,
id
);
LOG_INFO
(
"CACHE"
,
"Trying to cache kara %d"
,
id
);
long
mtime
=
get_mtime
(
filepath
);
if
(
!
database_set_kara_mtime_id
(
db
,
id
,
mtime
))
LOG_ERROR
(
"CACHE"
,
"Failed to cache mtime for '%s' kara %
l
d to %ld"
,
filepath
,
id
,
mtime
);
LOG_ERROR
(
"CACHE"
,
"Failed to cache mtime for '%s' kara %d to %ld"
,
filepath
,
id
,
mtime
);
double
duration
=
0
.;
if
(
kara_read_length
(
&
duration
,
filepath
))
LOG_ERROR
(
"CACHE"
,
"Failed to read lengh of '%s' for kara %
l
d"
,
filepath
,
id
);
if
(
kara_read_length
(
&
duration
,
filepath
)
||
isnan
(
duration
)
)
LOG_ERROR
(
"CACHE"
,
"Failed to read lengh of '%s' for kara %d"
,
filepath
,
id
);
uint64_t
duration_uint
=
(
uint64_t
)
duration
;
if
(
!
database_set_kara_duration_id
(
db
,
id
,
duration_uint
))
LOG_ERROR
(
"CACHE"
,
"Failed to cache duration for '%s' kara %
l
d to %ld"
,
filepath
,
id
,
duration_uint
);
LOG_ERROR
(
"CACHE"
,
"Failed to cache duration for '%s' kara %d to %ld"
,
filepath
,
id
,
duration_uint
);
LOG_INFO
(
"CACHE"
,
"Cached mtime %ld and duration %ld for '%s' kara %
l
d"
,
mtime
,
duration_uint
,
filepath
,
id
);
LOG_INFO
(
"CACHE"
,
"Cached mtime %ld and duration %ld for '%s' kara %d"
,
mtime
,
duration_uint
,
filepath
,
id
);
}
#pragma message(TODO "Cache the 'get' with the next `N` karas. Use static __thread variables for that.")
...
...
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