After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 734629 - ChamplainFileCache appends garbage characters at the end of cached String.
ChamplainFileCache appends garbage characters at the end of cached String.
Status: RESOLVED NOTABUG
Product: libchamplain
Classification: Core
Component: General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: libchamplain-maint
libchamplain-maint
Depends on:
Blocks: 731587
 
 
Reported: 2014-08-11 20:30 UTC by Rishi Raj Singh Jhelumi
Modified: 2014-08-11 21:07 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Rishi Raj Singh Jhelumi 2014-08-11 20:30:20 UTC
I am caching POIs as a JSON String using ChamplainFileCache and in some cases it adds random characters at the end of the string.

I am caching the string after converting it to Unicode.
I am directly caching the data with no Information Header of any sort.

Do I need to add a header or ChamplainFileCache does it by itself??

For example,
"""
Data/Type : json
Data/Size : 1455...
[JSON DATA]
"""

Is ChamplainFileCache was made to cache images only and I need to implement my own caching for JSON strings???
Because in case of images (map tiles) a few garbage characters wont affect the image much.
Comment 1 Rishi Raj Singh Jhelumi 2014-08-11 20:41:10 UTC
Although ChamplainFileCache is able the JSON string (maybe not properly) but ,this line of code assumes the data to be cached as an image (".png").
https://github.com/GNOME/libchamplain/blob/master/champlain/champlain-file-
cache.c#L475
Comment 2 Jiri Techet 2014-08-11 21:07:10 UTC
The .png extension is no problem here (just the name of the file). The problem (probably ) is the result is ChamplainTile so you are probably seeing some binary data from that.

The cache definitely isn't meant for this use and implementing your own cache is the right way to go.