1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
//
// DO NOT EDIT.  THIS FILE IS GENERATED FROM ../../../dist/idl/nsIZipReader.idl
//


/// `interface nsIZipEntry : nsISupports`
///


// The actual type definition for the interface. This struct has methods
// declared on it which will call through its vtable. You never want to pass
// this type around by value, always pass it behind a reference.

#[repr(C)]
pub struct nsIZipEntry {
    vtable: *const nsIZipEntryVTable,

    /// This field is a phantomdata to ensure that the VTable type and any
    /// struct containing it is not safe to send across threads, as XPCOM is
    /// generally not threadsafe.
    ///
    /// XPCOM interfaces in general are not safe to send across threads.
    __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
}

// Implementing XpCom for an interface exposes its IID, which allows for easy
// use of the `.query_interface<T>` helper method. This also defines that
// method for nsIZipEntry.
unsafe impl XpCom for nsIZipEntry {
    const IID: nsIID = nsID(0xfad6f72f, 0x13d8, 0x4e26,
        [0x91, 0x73, 0x53, 0x00, 0x7a, 0x4a, 0xfe, 0x71]);
}

// We need to implement the RefCounted trait so we can be used with `RefPtr`.
// This trait teaches `RefPtr` how to manage our memory.
unsafe impl RefCounted for nsIZipEntry {
    #[inline]
    unsafe fn addref(&self) {
        self.AddRef();
    }
    #[inline]
    unsafe fn release(&self) {
        self.Release();
    }
}

// This trait is implemented on all types which can be coerced to from nsIZipEntry.
// It is used in the implementation of `fn coerce<T>`. We hide it from the
// documentation, because it clutters it up a lot.
#[doc(hidden)]
pub trait nsIZipEntryCoerce {
    /// Cheaply cast a value of this type from a `nsIZipEntry`.
    fn coerce_from(v: &nsIZipEntry) -> &Self;
}

// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIZipEntryCoerce for nsIZipEntry {
    #[inline]
    fn coerce_from(v: &nsIZipEntry) -> &Self {
        v
    }
}

impl nsIZipEntry {
    /// Cast this `nsIZipEntry` to one of its base interfaces.
    #[inline]
    pub fn coerce<T: nsIZipEntryCoerce>(&self) -> &T {
        T::coerce_from(self)
    }
}

// Every interface struct type implements `Deref` to its base interface. This
// causes methods on the base interfaces to be directly avaliable on the
// object. For example, you can call `.AddRef` or `.QueryInterface` directly
// on any interface which inherits from `nsISupports`.
impl ::std::ops::Deref for nsIZipEntry {
    type Target = nsISupports;
    #[inline]
    fn deref(&self) -> &nsISupports {
        unsafe {
            ::std::mem::transmute(self)
        }
    }
}

// Ensure we can use .coerce() to cast to our base types as well. Any type which
// our base interface can coerce from should be coercable from us as well.
impl<T: nsISupportsCoerce> nsIZipEntryCoerce for T {
    #[inline]
    fn coerce_from(v: &nsIZipEntry) -> &Self {
        T::coerce_from(v)
    }
}

// This struct represents the interface's VTable. A pointer to a statically
// allocated version of this struct is at the beginning of every nsIZipEntry
// object. It contains one pointer field for each method in the interface. In
// the case where we can't generate a binding for a method, we include a void
// pointer.
#[doc(hidden)]
#[repr(C)]
pub struct nsIZipEntryVTable {
    /// We need to include the members from the base interface's vtable at the start
    /// of the VTable definition.
    pub __base: nsISupportsVTable,

    /* readonly attribute unsigned short compression; */
    pub GetCompression: unsafe extern "system" fn (this: *const nsIZipEntry, aCompression: *mut libc::uint16_t) -> nsresult,

    /* readonly attribute unsigned long size; */
    pub GetSize: unsafe extern "system" fn (this: *const nsIZipEntry, aSize: *mut libc::uint32_t) -> nsresult,

    /* readonly attribute unsigned long realSize; */
    pub GetRealSize: unsafe extern "system" fn (this: *const nsIZipEntry, aRealSize: *mut libc::uint32_t) -> nsresult,

    /* readonly attribute unsigned long CRC32; */
    pub GetCRC32: unsafe extern "system" fn (this: *const nsIZipEntry, aCRC32: *mut libc::uint32_t) -> nsresult,

    /* readonly attribute boolean isDirectory; */
    pub GetIsDirectory: unsafe extern "system" fn (this: *const nsIZipEntry, aIsDirectory: *mut bool) -> nsresult,

    /* readonly attribute PRTime lastModifiedTime; */
    pub GetLastModifiedTime: unsafe extern "system" fn (this: *const nsIZipEntry, aLastModifiedTime: *mut PRTime) -> nsresult,

    /* readonly attribute boolean isSynthetic; */
    pub GetIsSynthetic: unsafe extern "system" fn (this: *const nsIZipEntry, aIsSynthetic: *mut bool) -> nsresult,

    /* readonly attribute unsigned long permissions; */
    pub GetPermissions: unsafe extern "system" fn (this: *const nsIZipEntry, aPermissions: *mut libc::uint32_t) -> nsresult,
}


// The implementations of the function wrappers which are exposed to rust code.
// Call these methods rather than manually calling through the VTable struct.
impl nsIZipEntry {

    /// ```text
    /// /**
    ///      * The type of compression used for the item.  The possible values and
    ///      * their meanings are defined in the zip file specification at
    ///      * http://www.pkware.com/business_and_developers/developer/appnote/
    ///      */
    /// ```
    ///

    /// `readonly attribute unsigned short compression;`
    #[inline]
    pub unsafe fn GetCompression(&self, aCompression: *mut libc::uint16_t) -> nsresult {
        ((*self.vtable).GetCompression)(self, aCompression)
    }


    /// ```text
    /// /**
    ///      * The compressed size of the data in the item.
    ///      */
    /// ```
    ///

    /// `readonly attribute unsigned long size;`
    #[inline]
    pub unsafe fn GetSize(&self, aSize: *mut libc::uint32_t) -> nsresult {
        ((*self.vtable).GetSize)(self, aSize)
    }


    /// ```text
    /// /**
    ///      * The uncompressed size of the data in the item.
    ///      */
    /// ```
    ///

    /// `readonly attribute unsigned long realSize;`
    #[inline]
    pub unsafe fn GetRealSize(&self, aRealSize: *mut libc::uint32_t) -> nsresult {
        ((*self.vtable).GetRealSize)(self, aRealSize)
    }


    /// ```text
    /// /**
    ///      * The CRC-32 hash of the file in the entry.
    ///      */
    /// ```
    ///

    /// `readonly attribute unsigned long CRC32;`
    #[inline]
    pub unsafe fn GetCRC32(&self, aCRC32: *mut libc::uint32_t) -> nsresult {
        ((*self.vtable).GetCRC32)(self, aCRC32)
    }


    /// ```text
    /// /**
    ///      * True if the name of the entry ends with '/' and false otherwise.
    ///      */
    /// ```
    ///

    /// `readonly attribute boolean isDirectory;`
    #[inline]
    pub unsafe fn GetIsDirectory(&self, aIsDirectory: *mut bool) -> nsresult {
        ((*self.vtable).GetIsDirectory)(self, aIsDirectory)
    }


    /// ```text
    /// /**
    ///      * The time at which this item was last modified.
    ///      */
    /// ```
    ///

    /// `readonly attribute PRTime lastModifiedTime;`
    #[inline]
    pub unsafe fn GetLastModifiedTime(&self, aLastModifiedTime: *mut PRTime) -> nsresult {
        ((*self.vtable).GetLastModifiedTime)(self, aLastModifiedTime)
    }


    /// ```text
    /// /**
    ///      * Use this attribute to determine whether this item is an actual zip entry
    ///      * or is one synthesized for part of a real entry's path.  A synthesized
    ///      * entry represents a directory within the zip file which has no
    ///      * corresponding entry within the zip file.  For example, the entry for the
    ///      * directory foo/ in a zip containing exactly one entry for foo/bar.txt
    ///      * is synthetic.  If the zip file contains an actual entry for a directory,
    ///      * this attribute will be false for the nsIZipEntry for that directory.
    ///      * It is impossible for a file to be synthetic.
    ///      */
    /// ```
    ///

    /// `readonly attribute boolean isSynthetic;`
    #[inline]
    pub unsafe fn GetIsSynthetic(&self, aIsSynthetic: *mut bool) -> nsresult {
        ((*self.vtable).GetIsSynthetic)(self, aIsSynthetic)
    }


    /// ```text
    /// /**
    ///      * The UNIX style file permissions of this item.
    ///      */
    /// ```
    ///

    /// `readonly attribute unsigned long permissions;`
    #[inline]
    pub unsafe fn GetPermissions(&self, aPermissions: *mut libc::uint32_t) -> nsresult {
        ((*self.vtable).GetPermissions)(self, aPermissions)
    }


}


/// `interface nsIZipReader : nsISupports`
///


// The actual type definition for the interface. This struct has methods
// declared on it which will call through its vtable. You never want to pass
// this type around by value, always pass it behind a reference.

#[repr(C)]
pub struct nsIZipReader {
    vtable: *const nsIZipReaderVTable,

    /// This field is a phantomdata to ensure that the VTable type and any
    /// struct containing it is not safe to send across threads, as XPCOM is
    /// generally not threadsafe.
    ///
    /// XPCOM interfaces in general are not safe to send across threads.
    __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
}

// Implementing XpCom for an interface exposes its IID, which allows for easy
// use of the `.query_interface<T>` helper method. This also defines that
// method for nsIZipReader.
unsafe impl XpCom for nsIZipReader {
    const IID: nsIID = nsID(0x9ba4ef54, 0xe0a0, 0x4f65,
        [0x9d, 0x23, 0x12, 0x84, 0x82, 0x44, 0x88, 0x85]);
}

// We need to implement the RefCounted trait so we can be used with `RefPtr`.
// This trait teaches `RefPtr` how to manage our memory.
unsafe impl RefCounted for nsIZipReader {
    #[inline]
    unsafe fn addref(&self) {
        self.AddRef();
    }
    #[inline]
    unsafe fn release(&self) {
        self.Release();
    }
}

// This trait is implemented on all types which can be coerced to from nsIZipReader.
// It is used in the implementation of `fn coerce<T>`. We hide it from the
// documentation, because it clutters it up a lot.
#[doc(hidden)]
pub trait nsIZipReaderCoerce {
    /// Cheaply cast a value of this type from a `nsIZipReader`.
    fn coerce_from(v: &nsIZipReader) -> &Self;
}

// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIZipReaderCoerce for nsIZipReader {
    #[inline]
    fn coerce_from(v: &nsIZipReader) -> &Self {
        v
    }
}

impl nsIZipReader {
    /// Cast this `nsIZipReader` to one of its base interfaces.
    #[inline]
    pub fn coerce<T: nsIZipReaderCoerce>(&self) -> &T {
        T::coerce_from(self)
    }
}

// Every interface struct type implements `Deref` to its base interface. This
// causes methods on the base interfaces to be directly avaliable on the
// object. For example, you can call `.AddRef` or `.QueryInterface` directly
// on any interface which inherits from `nsISupports`.
impl ::std::ops::Deref for nsIZipReader {
    type Target = nsISupports;
    #[inline]
    fn deref(&self) -> &nsISupports {
        unsafe {
            ::std::mem::transmute(self)
        }
    }
}

// Ensure we can use .coerce() to cast to our base types as well. Any type which
// our base interface can coerce from should be coercable from us as well.
impl<T: nsISupportsCoerce> nsIZipReaderCoerce for T {
    #[inline]
    fn coerce_from(v: &nsIZipReader) -> &Self {
        T::coerce_from(v)
    }
}

// This struct represents the interface's VTable. A pointer to a statically
// allocated version of this struct is at the beginning of every nsIZipReader
// object. It contains one pointer field for each method in the interface. In
// the case where we can't generate a binding for a method, we include a void
// pointer.
#[doc(hidden)]
#[repr(C)]
pub struct nsIZipReaderVTable {
    /// We need to include the members from the base interface's vtable at the start
    /// of the VTable definition.
    pub __base: nsISupportsVTable,

    /* void open (in nsIFile zipFile); */
    pub Open: unsafe extern "system" fn (this: *const nsIZipReader, zipFile: *const nsIFile) -> nsresult,

    /* void openInner (in nsIZipReader zipReader, in AUTF8String zipEntry); */
    pub OpenInner: unsafe extern "system" fn (this: *const nsIZipReader, zipReader: *const nsIZipReader, zipEntry: &::nsstring::nsACString) -> nsresult,

    /* void openMemory (in voidPtr aData, in unsigned long aLength); */
    pub OpenMemory: unsafe extern "system" fn (this: *const nsIZipReader, aData: *mut libc::c_void, aLength: libc::uint32_t) -> nsresult,

    /* readonly attribute nsIFile file; */
    pub GetFile: unsafe extern "system" fn (this: *const nsIZipReader, aFile: *mut *const nsIFile) -> nsresult,

    /* void close (); */
    pub Close: unsafe extern "system" fn (this: *const nsIZipReader) -> nsresult,

    /* void test (in AUTF8String aEntryName); */
    pub Test: unsafe extern "system" fn (this: *const nsIZipReader, aEntryName: &::nsstring::nsACString) -> nsresult,

    /* void extract (in AUTF8String zipEntry, in nsIFile outFile); */
    pub Extract: unsafe extern "system" fn (this: *const nsIZipReader, zipEntry: &::nsstring::nsACString, outFile: *const nsIFile) -> nsresult,

    /* nsIZipEntry getEntry (in AUTF8String zipEntry); */
    pub GetEntry: unsafe extern "system" fn (this: *const nsIZipReader, zipEntry: &::nsstring::nsACString, _retval: *mut *const nsIZipEntry) -> nsresult,

    /* boolean hasEntry (in AUTF8String zipEntry); */
    pub HasEntry: unsafe extern "system" fn (this: *const nsIZipReader, zipEntry: &::nsstring::nsACString, _retval: *mut bool) -> nsresult,

    /* nsIUTF8StringEnumerator findEntries (in AUTF8String aPattern); */
    pub FindEntries: unsafe extern "system" fn (this: *const nsIZipReader, aPattern: &::nsstring::nsACString, _retval: *mut *const nsIUTF8StringEnumerator) -> nsresult,

    /* nsIInputStream getInputStream (in AUTF8String zipEntry); */
    pub GetInputStream: unsafe extern "system" fn (this: *const nsIZipReader, zipEntry: &::nsstring::nsACString, _retval: *mut *const nsIInputStream) -> nsresult,

    /* nsIInputStream getInputStreamWithSpec (in AUTF8String aJarSpec, in AUTF8String zipEntry); */
    pub GetInputStreamWithSpec: unsafe extern "system" fn (this: *const nsIZipReader, aJarSpec: &::nsstring::nsACString, zipEntry: &::nsstring::nsACString, _retval: *mut *const nsIInputStream) -> nsresult,
}


// The implementations of the function wrappers which are exposed to rust code.
// Call these methods rather than manually calling through the VTable struct.
impl nsIZipReader {

    /// ```text
    /// /**
    ///      * Opens a zip file for reading.
    ///      * It is allowed to open with another file,
    ///      * but it needs to be closed first with close().
    ///      */
    /// ```
    ///

    /// `void open (in nsIFile zipFile);`
    #[inline]
    pub unsafe fn Open(&self, zipFile: *const nsIFile) -> nsresult {
        ((*self.vtable).Open)(self, zipFile)
    }


    /// ```text
    /// /**
    ///      * Opens a zip file inside a zip file for reading.
    ///      */
    /// ```
    ///

    /// `void openInner (in nsIZipReader zipReader, in AUTF8String zipEntry);`
    #[inline]
    pub unsafe fn OpenInner(&self, zipReader: *const nsIZipReader, zipEntry: &::nsstring::nsACString) -> nsresult {
        ((*self.vtable).OpenInner)(self, zipReader, zipEntry)
    }


    /// ```text
    /// /**
    ///      * Opens a zip file stored in memory; the file attribute will be null.
    ///      *
    ///      * The ZipReader does not copy or take ownership of this memory; the
    ///      * caller must ensure that it is valid and unmodified until the
    ///      * ZipReader is closed or destroyed, and must free the memory as
    ///      * appropriate afterwards.
    ///      */
    /// ```
    ///

    /// `void openMemory (in voidPtr aData, in unsigned long aLength);`
    #[inline]
    pub unsafe fn OpenMemory(&self, aData: *mut libc::c_void, aLength: libc::uint32_t) -> nsresult {
        ((*self.vtable).OpenMemory)(self, aData, aLength)
    }


    /// ```text
    /// /**
    ///      * The file that represents the zip with which this zip reader was
    ///      * initialized.  This will be null if there is no underlying file.
    ///      */
    /// ```
    ///

    /// `readonly attribute nsIFile file;`
    #[inline]
    pub unsafe fn GetFile(&self, aFile: *mut *const nsIFile) -> nsresult {
        ((*self.vtable).GetFile)(self, aFile)
    }


    /// ```text
    /// /**
    ///      * Closes a zip reader. Subsequent attempts to extract files or read from
    ///      * its input stream will result in an error.
    ///      *
    ///      * Subsequent attempts to access a nsIZipEntry obtained from this zip
    ///      * reader will cause unspecified behavior.
    ///      */
    /// ```
    ///

    /// `void close ();`
    #[inline]
    pub unsafe fn Close(&self, ) -> nsresult {
        ((*self.vtable).Close)(self, )
    }


    /// ```text
    /// /**
    ///      * Tests the integrity of the archive by performing a CRC check
    ///      * on each item expanded into memory.  If an entry is specified
    ///      * the integrity of only that item is tested.  If null (javascript)
    ///      * or EmptyCString() (c++) is passed in the integrity of all items
    ///      * in the archive are tested.
    ///      */
    /// ```
    ///

    /// `void test (in AUTF8String aEntryName);`
    #[inline]
    pub unsafe fn Test(&self, aEntryName: &::nsstring::nsACString) -> nsresult {
        ((*self.vtable).Test)(self, aEntryName)
    }


    /// ```text
    /// /**
    ///      * Extracts a zip entry into a local file specified by outFile.
    ///      * The entry must be stored in the zip in either uncompressed or
    ///      * DEFLATE-compressed format for the extraction to be successful.
    ///      * If the entry is a directory, the directory will be extracted
    ///      * non-recursively.
    ///      */
    /// ```
    ///

    /// `void extract (in AUTF8String zipEntry, in nsIFile outFile);`
    #[inline]
    pub unsafe fn Extract(&self, zipEntry: &::nsstring::nsACString, outFile: *const nsIFile) -> nsresult {
        ((*self.vtable).Extract)(self, zipEntry, outFile)
    }


    /// ```text
    /// /**
    ///      * Returns a nsIZipEntry describing a specified zip entry.
    ///      */
    /// ```
    ///

    /// `nsIZipEntry getEntry (in AUTF8String zipEntry);`
    #[inline]
    pub unsafe fn GetEntry(&self, zipEntry: &::nsstring::nsACString, _retval: *mut *const nsIZipEntry) -> nsresult {
        ((*self.vtable).GetEntry)(self, zipEntry, _retval)
    }


    /// ```text
    /// /**
    ///      * Checks whether the zipfile contains an entry specified by entryName.
    ///      */
    /// ```
    ///

    /// `boolean hasEntry (in AUTF8String zipEntry);`
    #[inline]
    pub unsafe fn HasEntry(&self, zipEntry: &::nsstring::nsACString, _retval: *mut bool) -> nsresult {
        ((*self.vtable).HasEntry)(self, zipEntry, _retval)
    }


    /// ```text
    /// /**
    ///      * Returns a string enumerator containing the matching entry names.
    ///      *
    ///      * @param aPattern
    ///      *   A regular expression used to find matching entries in the zip file.
    ///      *   Set this parameter to null (javascript) or EmptyCString() (c++) or "*"
    ///      *   to get all entries; otherwise, use the
    ///      *   following syntax:
    ///      *
    ///      *   o * matches anything
    ///      *   o ? matches one character
    ///      *   o $ matches the end of the string
    ///      *   o [abc] matches one occurrence of a, b, or c. The only character that
    ///      *           must be escaped inside the brackets is ].  ^ and - must never
///      *           appear in the first and second positions within the brackets,
///      *           respectively.  (In the former case, the behavior specified for
    ///      *           '[^az]' will happen.)
///      *   o [a-z] matches any character between a and z.  The characters a and z
///      *           must either both be letters or both be numbers, with the
///      *           character represented by 'a' having a lower ASCII value than
///      *           the character represented by 'z'.
///      *   o [^az] matches any character except a or z.  If ] is to appear inside
///      *           the brackets as a character to not match, it must be escaped.
///      *   o pat~pat2 returns matches to the pattern 'pat' which do not also match
///      *              the pattern 'pat2'.  This may be used to perform filtering
///      *              upon the results of one pattern to remove all matches which
///      *              also match another pattern.  For example, because '*'
///      *              matches any string and '*z*' matches any string containing a
///      *              'z', '*~*z*' will match all strings except those containing
///      *              a 'z'.  Note that a pattern may not use '~' multiple times,
///      *              so a string such as '*~*z*~*y*' is not a valid pattern.
///      *   o (foo|bar) will match either the pattern foo or the pattern bar.
///      *               Neither of the patterns foo or bar may use the 'pat~pat2'
///      *               syntax described immediately above.
///      *   o \ will escape a special character.  Escaping is required for all
///      *       special characters unless otherwise specified.
///      *   o All other characters match case-sensitively.
///      *
///      *   An aPattern not conforming to this syntax has undefined behavior.
///      *
///      * @throws NS_ERROR_ILLEGAL_VALUE on many but not all invalid aPattern
///      *                                values.
///      */
/// ```
///

/// `nsIUTF8StringEnumerator findEntries (in AUTF8String aPattern);`
#[inline]
pub unsafe fn FindEntries(&self, aPattern: &::nsstring::nsACString, _retval: *mut *const nsIUTF8StringEnumerator) -> nsresult {
((*self.vtable).FindEntries)(self, aPattern, _retval)
}


/// ```text
/// /**
///      * Returns an input stream containing the contents of the specified zip
///      * entry.
///      * @param zipEntry the name of the entry to open the stream from
///      */
/// ```
///

/// `nsIInputStream getInputStream (in AUTF8String zipEntry);`
#[inline]
pub unsafe fn GetInputStream(&self, zipEntry: &::nsstring::nsACString, _retval: *mut *const nsIInputStream) -> nsresult {
((*self.vtable).GetInputStream)(self, zipEntry, _retval)
}


/// ```text
/// /**
///      * Returns an input stream containing the contents of the specified zip
///      * entry. If the entry refers to a directory (ends with '/'), a directory stream
///      * is opened, otherwise the contents of the file entry is returned.
///      * @param aJarSpec the Spec of the URI for the JAR (only used for directory streams)
///      * @param zipEntry the name of the entry to open the stream from
///      */
/// ```
///

/// `nsIInputStream getInputStreamWithSpec (in AUTF8String aJarSpec, in AUTF8String zipEntry);`
#[inline]
pub unsafe fn GetInputStreamWithSpec(&self, aJarSpec: &::nsstring::nsACString, zipEntry: &::nsstring::nsACString, _retval: *mut *const nsIInputStream) -> nsresult {
((*self.vtable).GetInputStreamWithSpec)(self, aJarSpec, zipEntry, _retval)
}


}


/// `interface nsIZipReaderCache : nsISupports`
///


// The actual type definition for the interface. This struct has methods
// declared on it which will call through its vtable. You never want to pass
// this type around by value, always pass it behind a reference.

#[repr(C)]
pub struct nsIZipReaderCache {
vtable: *const nsIZipReaderCacheVTable,

/// This field is a phantomdata to ensure that the VTable type and any
/// struct containing it is not safe to send across threads, as XPCOM is
/// generally not threadsafe.
///
/// XPCOM interfaces in general are not safe to send across threads.
__nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
}

// Implementing XpCom for an interface exposes its IID, which allows for easy
// use of the `.query_interface<T>` helper method. This also defines that
// method for nsIZipReaderCache.
unsafe impl XpCom for nsIZipReaderCache {
const IID: nsIID = nsID(0x31179807, 0x9fcd, 0x46c4,
[0xbe, 0xfa, 0x2a, 0xde, 0x20, 0x9a, 0x39, 0x4b]);
}

// We need to implement the RefCounted trait so we can be used with `RefPtr`.
// This trait teaches `RefPtr` how to manage our memory.
unsafe impl RefCounted for nsIZipReaderCache {
#[inline]
unsafe fn addref(&self) {
self.AddRef();
}
#[inline]
unsafe fn release(&self) {
self.Release();
}
}

// This trait is implemented on all types which can be coerced to from nsIZipReaderCache.
// It is used in the implementation of `fn coerce<T>`. We hide it from the
// documentation, because it clutters it up a lot.
#[doc(hidden)]
pub trait nsIZipReaderCacheCoerce {
/// Cheaply cast a value of this type from a `nsIZipReaderCache`.
fn coerce_from(v: &nsIZipReaderCache) -> &Self;
}

// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIZipReaderCacheCoerce for nsIZipReaderCache {
#[inline]
fn coerce_from(v: &nsIZipReaderCache) -> &Self {
v
}
}

impl nsIZipReaderCache {
/// Cast this `nsIZipReaderCache` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIZipReaderCacheCoerce>(&self) -> &T {
T::coerce_from(self)
}
}

// Every interface struct type implements `Deref` to its base interface. This
// causes methods on the base interfaces to be directly avaliable on the
// object. For example, you can call `.AddRef` or `.QueryInterface` directly
// on any interface which inherits from `nsISupports`.
impl ::std::ops::Deref for nsIZipReaderCache {
type Target = nsISupports;
#[inline]
fn deref(&self) -> &nsISupports {
unsafe {
    ::std::mem::transmute(self)
}
}
}

// Ensure we can use .coerce() to cast to our base types as well. Any type which
// our base interface can coerce from should be coercable from us as well.
impl<T: nsISupportsCoerce> nsIZipReaderCacheCoerce for T {
#[inline]
fn coerce_from(v: &nsIZipReaderCache) -> &Self {
T::coerce_from(v)
}
}

// This struct represents the interface's VTable. A pointer to a statically
// allocated version of this struct is at the beginning of every nsIZipReaderCache
// object. It contains one pointer field for each method in the interface. In
// the case where we can't generate a binding for a method, we include a void
// pointer.
#[doc(hidden)]
#[repr(C)]
pub struct nsIZipReaderCacheVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,

/* void init (in unsigned long cacheSize); */
pub Init: unsafe extern "system" fn (this: *const nsIZipReaderCache, cacheSize: libc::uint32_t) -> nsresult,

/* nsIZipReader getZip (in nsIFile zipFile); */
pub GetZip: unsafe extern "system" fn (this: *const nsIZipReaderCache, zipFile: *const nsIFile, _retval: *mut *const nsIZipReader) -> nsresult,

/* nsIZipReader getZipIfCached (in nsIFile zipFile); */
pub GetZipIfCached: unsafe extern "system" fn (this: *const nsIZipReaderCache, zipFile: *const nsIFile, _retval: *mut *const nsIZipReader) -> nsresult,

/* bool isCached (in nsIFile zipFile); */
pub IsCached: unsafe extern "system" fn (this: *const nsIZipReaderCache, zipFile: *const nsIFile, _retval: *mut bool) -> nsresult,

/* nsIZipReader getInnerZip (in nsIFile zipFile, in AUTF8String zipEntry); */
pub GetInnerZip: unsafe extern "system" fn (this: *const nsIZipReaderCache, zipFile: *const nsIFile, zipEntry: &::nsstring::nsACString, _retval: *mut *const nsIZipReader) -> nsresult,

/* PRFileDescStar getFd (in nsIFile zipFile); */
/// Unable to generate binding because `native type PRFileDesc is unsupported`
pub GetFd: *const ::libc::c_void,
}


// The implementations of the function wrappers which are exposed to rust code.
// Call these methods rather than manually calling through the VTable struct.
impl nsIZipReaderCache {

/// ```text
/// /**
///      * Initializes a new zip reader cache.
///      * @param cacheSize - the number of released entries to maintain before
///      *   beginning to throw some out (note that the number of outstanding
///      *   entries can be much greater than this number -- this is the count
///      *   for those otherwise unused entries)
///      */
/// ```
///

/// `void init (in unsigned long cacheSize);`
#[inline]
pub unsafe fn Init(&self, cacheSize: libc::uint32_t) -> nsresult {
((*self.vtable).Init)(self, cacheSize)
}


/// ```text
/// /**
///      * Returns a (possibly shared) nsIZipReader for an nsIFile.
///      *
///      * If the zip reader for given file is not in the cache, a new zip reader
///      * is created, initialized, and opened (see nsIZipReader::init and
///      * nsIZipReader::open). Otherwise the previously created zip reader is
///      * returned.
///      *
///      * @note If someone called close() on the shared nsIZipReader, this method
///      *       will return the closed zip reader.
///      */
/// ```
///

/// `nsIZipReader getZip (in nsIFile zipFile);`
#[inline]
pub unsafe fn GetZip(&self, zipFile: *const nsIFile, _retval: *mut *const nsIZipReader) -> nsresult {
((*self.vtable).GetZip)(self, zipFile, _retval)
}


/// ```text
/// /**
///      * Like getZip(), returns a (possibly shared) nsIZipReader for an nsIFile,
///      * but if a zip reader for the given file is not in the cache, returns
///      * error NS_ERROR_CACHE_KEY_NOT_FOUND rather than creating a new reader.
///      *
///      * @note If someone called close() on the shared nsIZipReader, this method
///      *       will return the closed zip reader.
///      */
/// ```
///

/// `nsIZipReader getZipIfCached (in nsIFile zipFile);`
#[inline]
pub unsafe fn GetZipIfCached(&self, zipFile: *const nsIFile, _retval: *mut *const nsIZipReader) -> nsresult {
((*self.vtable).GetZipIfCached)(self, zipFile, _retval)
}


/// ```text
/// /**
///      * returns true if this zipreader already has this file cached
///      */
/// ```
///

/// `bool isCached (in nsIFile zipFile);`
#[inline]
pub unsafe fn IsCached(&self, zipFile: *const nsIFile, _retval: *mut bool) -> nsresult {
((*self.vtable).IsCached)(self, zipFile, _retval)
}


/// ```text
/// /**
///      * Returns a (possibly shared) nsIZipReader for a zip inside another zip
///      *
///      * See getZip
///      */
/// ```
///

/// `nsIZipReader getInnerZip (in nsIFile zipFile, in AUTF8String zipEntry);`
#[inline]
pub unsafe fn GetInnerZip(&self, zipFile: *const nsIFile, zipEntry: &::nsstring::nsACString, _retval: *mut *const nsIZipReader) -> nsresult {
((*self.vtable).GetInnerZip)(self, zipFile, zipEntry, _retval)
}


/// ```text
/// /**
///      * Returns the cached NSPR file descriptor of the file.
///      * Note: currently not supported on Windows platform.
///      */
/// ```
///

/// `PRFileDescStar getFd (in nsIFile zipFile);`
const _GetFd: () = ();

}