+ /*
+ * Handle compression and encryption options
+ */
+#ifdef HAVE_LIBZ
+ if (ff_pkt->flags & FO_GZIP) {
+ switch (stream) {
+ case STREAM_WIN32_DATA:
+ stream = STREAM_WIN32_GZIP_DATA;
+ break;
+ case STREAM_SPARSE_DATA:
+ stream = STREAM_SPARSE_GZIP_DATA;
+ break;
+ case STREAM_FILE_DATA:
+ stream = STREAM_GZIP_DATA;
+ break;
+ default:
+ /* All stream types that do not support gzip should clear out
+ * FO_GZIP above, and this code block should be unreachable. */
+ ASSERT(!(ff_pkt->flags & FO_GZIP));
+ return STREAM_NONE;
+ }
+ }
+#endif
+#ifdef HAVE_CRYPTO
+ if (ff_pkt->flags & FO_ENCRYPT) {
+ switch (stream) {
+ case STREAM_WIN32_DATA:
+ stream = STREAM_ENCRYPTED_WIN32_DATA;
+ break;
+ case STREAM_WIN32_GZIP_DATA:
+ stream = STREAM_ENCRYPTED_WIN32_GZIP_DATA;
+ break;
+ case STREAM_FILE_DATA:
+ stream = STREAM_ENCRYPTED_FILE_DATA;
+ break;
+ case STREAM_GZIP_DATA:
+ stream = STREAM_ENCRYPTED_FILE_GZIP_DATA;
+ break;
+ default:
+ /* All stream types that do not support encryption should clear out
+ * FO_ENCRYPT above, and this code block should be unreachable. */
+ ASSERT(!ff_pkt->flags & FO_ENCRYPT);
+ return STREAM_NONE;
+ }
+ }
+#endif
+
+ return stream;
+}
+
+
+/*
+ * Encode a stat structure into a base64 character string
+ * All systems must create such a structure.
+ * In addition, we tack on the LinkFI, which is non-zero in
+ * the case of a hard linked file that has no data. This
+ * is a File Index pointing to the link that does have the
+ * data (always the first one encountered in a save).
+ * You may piggyback attributes on this packet by encoding
+ * them in the encode_attribsEx() subroutine, but this is
+ * not recommended.
+ */
+void encode_stat(char *buf, FF_PKT *ff_pkt, int data_stream)