~ubuntu-branches/ubuntu/natty/evolution-data-server/natty

« back to all changes in this revision

Viewing changes to camel/camel-block-file.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-06-21 14:38:41 UTC
  • mfrom: (1.1.80 upstream)
  • Revision ID: james.westby@ubuntu.com-20100621143841-pdgwume6r8rhzoyo
Tags: 2.30.2-0ubuntu1
* New upstream release:
  - Mail inline parser doesn't always work (Milan Crha) (LP: #219104)
  - Corruption of mailbox and can't expunge trash (Milan Crha)
    (LP: #286497, #325157)
  - WebDAV addressbook is too strict about content-type (Petr Tomasek)
  - Handle server's resource rename on WebDAV PUT response (Milan Crha)
  - Use NSS SQLite database, if available (Craig Ringer)
  - Fix NULL return without exception on krb5-auth-dialog
    failure (David Woodhouse)
  - Categories not translated in menus (Matthew Barnes) (LP: #443215)
  - Fix translation domain for default categories (Gert Michael Kulyk)
  - Mishandling of '@' in WebDAV contacts username (Milan Crha)
    (LP: #497146)
  - Use CRLF in signed & encrypted S/MIME messages
  - Remove superfluous space in flags in APPEND command (David Woodhouse)
  - Crash in gnome_keyring_item_info_free from e-passwords.c (Milan Crha)
  - Fix GSSAPI (and other SASL) authentication for imapx (David Woodhouse)
  - Teach camel_sexp_to_sql_sexp about no-arg (match-all)
    (Matt McCutchen 2)
  - Contacts are not displayed in GW Addressbook (Bharath Acharya)
  - Don't use an unitialized key in folder_changed_remove_uid
    (Claudio Saavedra)
  - Evolution didn't quit due to deadlock (Milan Crha)
  - Crash of e-addressbook-factory on second start of evolution (Milan Crha)
  - Fix translation of birthday and anniversary events (Gert Michael Kulyk)
  - Return formatted address in e_destination_get_address (David Ayers)
    (LP: #229187)
  - Add imap-over-custom-command support for imapx (David Woodhouse)
  - Fix fetch of large mails from broken servers like Exchange
    (David Woodhouse)
  - Fix double command ->complete() in imapx_command_start_next()
    (David Woodhouse)
  - Fix double-free of is->literal in cancel_all_jobs() (David Woodhouse)
  - use 'UID FETCH' instead of 'FETCH' for scan_changes (David Woodhouse)
  - Remove GroupWise debugging messages. (Matthew Barnes)
  - Bump libedataserver soname twice. (Matthew Barnes)
  - Check EBook DBus error names without underscores too (Milan Crha)
  - Create a section in the name selector dialog in its own function
    (Federico Mena Quintero)
  - Create the configdir instead of bailing out if it does not exist
    (Fridrich Štrba)
  -  Don't set a default vertical size for the name selector window
    (Federico Mena Quintero)
  - Fix locking issues in cancel_all_jobs() (David Woodhouse)
  - Fix pointlessly narrow default width in the name selection dialog
  - Name the pointless label at the top, so it can be disabled for MeeGo
    (Michael Meeks)
  - Fix tagprefix for multiple accounts. (David Woodhouse)
  - Fix typo in patch for bug on WebDAV (Milan Crha)
  - Put the name selector's section labels in the same row as the
    treeviews (Federico Mena Quintero)
  - Redo the container hierarchy in the name selector dialog
    (Federico Mena Quintero)
  - Remove an unused label in the name selector dialog
    (Federico Mena Quintero)
  - Remove border_width from the name selector's dialog toplevel
    contents (Federico Mena Quintero)
  - Shrink the spacing between the name selector's sections
    (Federico Mena Quintero)
  - Skip WebDAV responses which don't begin with BEGIN:VCARD (Milan Crha)
  - Specify the executable extension where applicable in the service
    files (Fridrich Štrba)
  - updated translations
* Removed patches from upstream:
  - debian/patches/01_unitialized_key.patch
  - debian/patches/02_fix-warning-in_source_get_uri.patch
  - debian/patches/03_bump-soname-libedataserver.patch
* debian/patches/25_mute-debug-messages.patch updated
* debian/patches/90_autoreconf.patch: refreshed

Show diffs side-by-side

added added

removed removed

Lines of Context:
411
411
        struct stat st;
412
412
        gint err;
413
413
 
 
414
        g_return_val_if_fail (CAMEL_IS_BLOCK_FILE (bs), -1);
 
415
        g_return_val_if_fail (path != NULL, -1);
 
416
 
414
417
        CAMEL_BLOCK_FILE_LOCK(bs, io_lock);
415
418
 
416
419
        ret = g_rename(bs->path, path);
438
441
camel_block_file_delete(CamelBlockFile *bs)
439
442
{
440
443
        gint ret;
441
 
        struct _CamelBlockFilePrivate *p = bs->priv;
 
444
 
 
445
        g_return_val_if_fail (CAMEL_IS_BLOCK_FILE (bs), -1);
442
446
 
443
447
        CAMEL_BLOCK_FILE_LOCK(bs, io_lock);
444
448
 
450
454
                bs->fd = -1;
451
455
        }
452
456
 
453
 
        p->deleted = TRUE;
 
457
        bs->priv->deleted = TRUE;
454
458
        ret = g_unlink(bs->path);
455
459
 
456
460
        CAMEL_BLOCK_FILE_UNLOCK(bs, io_lock);
472
476
{
473
477
        CamelBlock *bl;
474
478
 
 
479
        g_return_val_if_fail (CAMEL_IS_BLOCK_FILE (bs), NULL);
 
480
 
475
481
        CAMEL_BLOCK_FILE_LOCK(bs, root_lock);
476
482
 
477
483
        if (bs->root->free) {
507
513
{
508
514
        CamelBlock *bl;
509
515
 
510
 
        bl = camel_block_file_get_block(bs, id);
 
516
        g_return_val_if_fail (CAMEL_IS_BLOCK_FILE (bs), -1);
 
517
 
 
518
        bl = camel_block_file_get_block (bs, id);
511
519
        if (bl == NULL)
512
520
                return -1;
513
521
 
538
546
{
539
547
        CamelBlock *bl, *flush, *prev;
540
548
 
 
549
        g_return_val_if_fail (CAMEL_IS_BLOCK_FILE (bs), NULL);
 
550
 
541
551
        /* Sanity check: Dont allow reading of root block (except before its been read)
542
552
           or blocks with invalid block id's */
543
553
        if ((bs->root == NULL && id != 0)
614
624
 * perform no writes of this block or flushing of it if the cache
615
625
 * fills.
616
626
 **/
617
 
void camel_block_file_detach_block(CamelBlockFile *bs, CamelBlock *bl)
 
627
void
 
628
camel_block_file_detach_block(CamelBlockFile *bs, CamelBlock *bl)
618
629
{
 
630
        g_return_if_fail (CAMEL_IS_BLOCK_FILE (bs));
 
631
        g_return_if_fail (bl != NULL);
 
632
 
619
633
        CAMEL_BLOCK_FILE_LOCK(bs, cache_lock);
620
634
 
621
635
        g_hash_table_remove(bs->blocks, GUINT_TO_POINTER(bl->id));
632
646
 *
633
647
 * Reattach a block that has been detached.
634
648
 **/
635
 
void camel_block_file_attach_block(CamelBlockFile *bs, CamelBlock *bl)
 
649
void
 
650
camel_block_file_attach_block(CamelBlockFile *bs, CamelBlock *bl)
636
651
{
 
652
        g_return_if_fail (CAMEL_IS_BLOCK_FILE (bs));
 
653
        g_return_if_fail (bl != NULL);
 
654
 
637
655
        CAMEL_BLOCK_FILE_LOCK(bs, cache_lock);
638
656
 
639
657
        g_hash_table_insert(bs->blocks, GUINT_TO_POINTER(bl->id), bl);
651
669
 * Mark a block as dirty.  The block will be written to disk if
652
670
 * it ever expires from the cache.
653
671
 **/
654
 
void camel_block_file_touch_block(CamelBlockFile *bs, CamelBlock *bl)
 
672
void
 
673
camel_block_file_touch_block(CamelBlockFile *bs, CamelBlock *bl)
655
674
{
 
675
        g_return_if_fail (CAMEL_IS_BLOCK_FILE (bs));
 
676
        g_return_if_fail (bl != NULL);
 
677
 
656
678
        CAMEL_BLOCK_FILE_LOCK(bs, root_lock);
657
679
        CAMEL_BLOCK_FILE_LOCK(bs, cache_lock);
658
680
 
680
702
 * If a block is detatched and this is the last reference, the
681
703
 * block will be freed.
682
704
 **/
683
 
void camel_block_file_unref_block(CamelBlockFile *bs, CamelBlock *bl)
 
705
void
 
706
camel_block_file_unref_block(CamelBlockFile *bs, CamelBlock *bl)
684
707
{
 
708
        g_return_if_fail (CAMEL_IS_BLOCK_FILE (bs));
 
709
        g_return_if_fail (bl != NULL);
 
710
 
685
711
        CAMEL_BLOCK_FILE_LOCK(bs, cache_lock);
686
712
 
687
713
        if (bl->refcount == 1 && (bl->flags & CAMEL_BLOCK_DETACHED))
749
775
 *
750
776
 * Returns: -1 on io error.
751
777
 **/
752
 
gint camel_block_file_sync_block(CamelBlockFile *bs, CamelBlock *bl)
 
778
gint
 
779
camel_block_file_sync_block(CamelBlockFile *bs, CamelBlock *bl)
753
780
{
754
781
        gint ret;
755
782
 
 
783
        g_return_val_if_fail (CAMEL_IS_BLOCK_FILE (bs), -1);
 
784
        g_return_val_if_fail (bl != NULL, -1);
 
785
 
756
786
        /* LOCK io_lock */
757
787
        if (block_file_use(bs) == -1)
758
788
                return -1;
772
802
 *
773
803
 * Returns: -1 on io error.
774
804
 **/
775
 
gint camel_block_file_sync(CamelBlockFile *bs)
 
805
gint
 
806
camel_block_file_sync(CamelBlockFile *bs)
776
807
{
777
808
        gint ret;
778
809
 
 
810
        g_return_val_if_fail (CAMEL_IS_BLOCK_FILE (bs), -1);
 
811
 
779
812
        CAMEL_BLOCK_FILE_LOCK(bs, root_lock);
780
813
        CAMEL_BLOCK_FILE_LOCK(bs, cache_lock);
781
814
 
1026
1059
        struct stat st;
1027
1060
        gint err;
1028
1061
 
 
1062
        g_return_val_if_fail (CAMEL_IS_KEY_FILE (kf), -1);
 
1063
        g_return_val_if_fail (path != NULL, -1);
 
1064
 
1029
1065
        CAMEL_KEY_FILE_LOCK(kf, lock);
1030
1066
 
1031
1067
        ret = g_rename(kf->path, path);
1053
1089
camel_key_file_delete(CamelKeyFile *kf)
1054
1090
{
1055
1091
        gint ret;
1056
 
        struct _CamelKeyFilePrivate *p = kf->priv;
 
1092
 
 
1093
        g_return_val_if_fail (CAMEL_IS_KEY_FILE (kf), -1);
1057
1094
 
1058
1095
        CAMEL_KEY_FILE_LOCK(kf, lock);
1059
1096
 
1065
1102
                kf->fp = NULL;
1066
1103
        }
1067
1104
 
1068
 
        p->deleted = TRUE;
 
1105
        kf->priv->deleted = TRUE;
1069
1106
        ret = g_unlink(kf->path);
1070
1107
 
1071
1108
        CAMEL_KEY_FILE_UNLOCK(kf, lock);
1092
1129
        guint32 size;
1093
1130
        gint ret = -1;
1094
1131
 
 
1132
        g_return_val_if_fail (CAMEL_IS_KEY_FILE (kf), -1);
 
1133
        g_return_val_if_fail (parent != NULL, -1);
 
1134
        g_return_val_if_fail (records != NULL, -1);
 
1135
 
1095
1136
        d(printf("write key %08x len = %d\n", *parent, len));
1096
1137
 
1097
1138
        if (len == 0) {
1144
1185
camel_key_file_read(CamelKeyFile *kf, camel_block_t *start, gsize *len, camel_key_t **records)
1145
1186
{
1146
1187
        guint32 size;
1147
 
        glong pos = *start;
 
1188
        glong pos;
1148
1189
        camel_block_t next;
1149
1190
        gint ret = -1;
1150
1191
 
 
1192
        g_return_val_if_fail (CAMEL_IS_KEY_FILE (kf), -1);
 
1193
        g_return_val_if_fail (start != NULL, -1);
 
1194
 
 
1195
        pos = *start;
1151
1196
        if (pos == 0)
1152
1197
                return 0;
1153
1198