• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得cocoawindowspythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdombtronvb.netdirectxarduinopreviewerゲームエンジン

POSIX.1 National Language Support API for MinGW


Commit MetaInfo

Revisionbfb799dd8c9655d53b9e7aaf478b2112a06fd0ca (tree)
Zeit2008-01-11 07:47:42
AutorKeith Marshall <keithmarshall@user...>
CommiterKeith Marshall

Log Message

* gencat.c: Delay writing the catalogue header until *after* the message data has been fully committed; store the ultimate catalogue size in the header record, then rewind to write header and index records sequentially.

Ändern Zusammenfassung

Diff

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
1+2008-01-10 Keith Marshall <keithmarshall@users.sourceforge.net>
2+
3+ * gencat.c: Delay writing the catalogue header until *after* the
4+ message data has been fully committed; store the ultimate catalogue
5+ size in the header record, then rewind to write header and index
6+ records sequentially.
7+
18 2008-01-09 Keith Marshall <keithmarshall@users.sourceforge.net>
29
310 * README: Some minor wording improvements.
--- a/gencat.c
+++ b/gencat.c
@@ -258,12 +258,11 @@ int main( int argc, char **argv )
258258 return EXIT_FAILURE;
259259 }
260260
261- /* Write out the standard message catalogue header record,
262- * then seek beyond the space required for the index image,
263- * to commence writing out the message data.
261+ /* Seek forward in the temporary output file,
262+ * to reserve space into which we will later write the message
263+ * catalogue header record, and the message index.
264264 */
265- write( mc, &cat_index, sizeof( MSGCAT ) );
266- offset = lseek( mc, offset, SEEK_CUR );
265+ offset = lseek( mc, sizeof( MSGCAT ) + offset, SEEK_SET );
267266
268267 /* Compute the offset, ON DISK, for the start of the message
269268 * index, within the composite set and message index image, in
@@ -309,12 +308,18 @@ int main( int argc, char **argv )
309308 offset += write( mc, curr->base + curr->loc, curr->len );
310309 }
311310
312- /* Rewind the catalogue, to the start of the reserved index space...
311+ /* Store the effective data size of the catalogue into the header.
313312 */
314- lseek( mc, sizeof( MSGCAT ), SEEK_SET );
315- /*
316- * Locate the start of the in-memory image of the index, once more,
317- * and copy it into the generated message catalogue.
313+ cat_index.mc.extent = offset;
314+
315+ /* Rewind, and write out the message catalogue header record,
316+ * at the start of the file space reserved previously.
317+ */
318+ lseek( mc, 0L, SEEK_SET );
319+ write( mc, &cat_index, sizeof( MSGCAT ) );
320+
321+ /* Locate the start of the in-memory image of the index, once more,
322+ * and copy it into the remaining reserved space in the output file.
318323 */
319324 set_index = msg_index - numsets - msgcount;
320325 write( mc, set_index, (numsets + msgcount) * sizeof( struct key ) );
@@ -388,4 +393,4 @@ int main( int argc, char **argv )
388393 return EXIT_SUCCESS;
389394 }
390395
391-/* $RCSfile$Revision: 1.4 $: end of file */
396+/* $RCSfile$Revision: 1.5 $: end of file */