air-dex / reyn-tweets

Client Twitter pour Windows, Linux et Symbian^3 écrit avec Qt
https://launchpad.net/reyn-tweets
0 stars 0 forks source link

[Sérialisation] Lecture des bornes des Tweet Entities #71

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
La borne minimum d'une Tweet Entity est toujours 0. Et des fois le max aussi.

À voir si le problème vient de Reyn Tweets (très probable) ou de Twitter 
(peu probable mais probable quand même).

Original issue reported on code.google.com by ducher.r...@gmail.com on 4 Apr 2012 at 2:35

GoogleCodeExporter commented 9 years ago
Analyse d'une timeline (/misc/RequestsToTwitter/myTimeline_201105041631.json) :

Résultats : la faute ne vient pas de Twitter (min != 0 sur la TL sauf quand 
c'est le cas) mais de Reyn Tweets où on a toujours [0,<bon maximum>].

Original comment by ducher.r...@gmail.com on 5 Apr 2012 at 3:23

GoogleCodeExporter commented 9 years ago
Problème trouvé :
- Un IndexBounds est initialisé avec min = 0 et max = 0 : [0, 0].
- Les bounds passés à l'objet via la QVariantList de 
IndexBounds::fillWithVariant(QVariantList); sont bons
- Lors de l'extraction, on etrait le 1er bound (supposé être le minimum) que 
l'on met dans la liste avec IndexBounds::setMin(int); et le 2nd bound (supposé 
être le minimum) que l'on met dans la liste avec IndexBounds::setMax(int);
- Dans les 2 setters setMax() et setMin(), le nouveau bound change remplace 
l'ancien puis ils sont triés via la méthode IndexBounds::sort().
- Soit [m, M] la QVariantList. On a 0 <= m < M.
- Avant le fillWithVariant(), on a *this == [0, 0].
- Quand on fait le setMin(), on fait :
min := newMin;  // *this == [m, 0]
sort();         // *this == [0, m] (si m > 0. Si m == 0, on est encore juste 
mais c'est un cas particulier où ça marche alors que ça ne devrait pas)
- Quand on fait le setMax(), on fait :
max := newMax;  // *this == [0, M] m est écrasé : le bug est ici !
sort();         // *this == [0, M]

Résolution : initialisation à [-1, -1] et vérification que les indices ne 
sont pas à -1. Ou alors intialisation à [141, 141] sachant que 141 > 140 == 
nb de caractères dans un tweet.

Original comment by ducher.r...@gmail.com on 5 Apr 2012 at 9:31

GoogleCodeExporter commented 9 years ago
Fixed avec -1.

Original comment by ducher.r...@gmail.com on 5 Apr 2012 at 10:43