Author: hbelusca Date: Sat Jan 31 18:44:28 2015 New Revision: 66127
URL: http://svn.reactos.org/svn/reactos?rev=66127&view=rev Log: [CDMAKE]: Have fun with cdmake: - Fix copyright headers - Fix string identifiers for ISO9660 and Joliet
Added: trunk/reactos/tools/cdmake/config.h (with props) Removed: trunk/reactos/tools/cdmake/dirsep.h Modified: trunk/reactos/tools/cdmake/cdmake.c trunk/reactos/tools/cdmake/dirhash.c trunk/reactos/tools/cdmake/llmsort.c
Modified: trunk/reactos/tools/cdmake/cdmake.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cdmake/cdmake.c?rev=6... ============================================================================== --- trunk/reactos/tools/cdmake/cdmake.c [iso-8859-1] (original) +++ trunk/reactos/tools/cdmake/cdmake.c [iso-8859-1] Sat Jan 31 18:44:28 2015 @@ -2,7 +2,19 @@ * CD-ROM Maker * by Philip J. Erdelsky * pje@acm.org - * http://www.alumni.caltech.edu/~pje/ + * http://alumnus.caltech.edu/~pje/ + */ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS CD-ROM Maker + * FILE: tools/cdmake/cdmake.c + * PURPOSE: CD-ROM Premastering Utility + * PROGRAMMERS: Eric Kohl + * Casper S. Hornstrup + * Filip Navara + * Magnus Olsen + * + * HISTORY: * * ElTorito-Support * by Eric Kohl @@ -18,10 +30,8 @@ * - No Joliet file name validations * - Very bad ISO file name generation * - * - * convert long filename to iso9660 file name by Magnus Olsen + * Convert long filename to ISO9660 file name by Magnus Olsen * magnus@greatlord.com - * */
/* According to his website, this file was released into the public domain by Phillip J. Erdelsky */ @@ -56,7 +66,7 @@ #include <ctype.h> #include <setjmp.h> #include <time.h> -#include "dirsep.h" +#include "config.h" #include "dirhash.h"
typedef unsigned char BYTE; @@ -349,6 +359,20 @@ write_byte(*s++); }
+static void write_bytecounted_string(unsigned bytecount, char *s) +{ + while (*s != 0 && bytecount != 0) + { + write_byte(*s++); + bytecount--; + } + while (bytecount != 0) + { + write_byte(' '); + bytecount--; + } +} + /*----------------------------------------------------------------------------- This function writes a ansi string as a big endian unicode string to the CD-ROM image. The terminating \0 is not written. @@ -358,9 +382,27 @@ { while (*s != 0) { - write_byte(0); - write_byte(*s++); - } + write_big_endian_word(*s++); + } +} + +static void write_bytecounted_string_as_big_endian_unicode(unsigned bytecount, char *s) +{ + unsigned wordcount = bytecount / 2; + + while (*s != 0 && wordcount != 0) + { + write_big_endian_word(*s++); + wordcount--; + } + while (wordcount != 0) + { + write_big_endian_word(' '); + wordcount--; + } + + if (bytecount % 2 != 0) + write_byte(' '); }
/*----------------------------------------------------------------------------- @@ -377,7 +419,7 @@ }
/*----------------------------------------------------------------------------- -This function writes a block of identical bige endian words to the CD-ROM image. +This function writes a block of identical big endian words to the CD-ROM image. -----------------------------------------------------------------------------*/
static void write_word_block(unsigned count, WORD value) @@ -1264,8 +1306,6 @@ { PDIR_RECORD d; PDIR_RECORD q; - unsigned int i; - char *t; unsigned int index; unsigned int name_length; DWORD size; @@ -1285,11 +1325,8 @@
write_string("\1CD001\1"); write_byte(0); - write_block(32, ' '); // system identifier - - t = volume_label; - for (i = 0; i < 32; i++) - write_byte( (BYTE)( (*t != 0) ? toupper(*t++) : ' ' ) ); + write_bytecounted_string(32, ""); // system identifier + write_bytecounted_string(32, volume_label); // volume label
write_block(8, 0); write_both_endian_dword(total_sectors); @@ -1303,13 +1340,16 @@ write_big_endian_dword(big_endian_path_table_sector); write_big_endian_dword((DWORD) 0); // second big endian path table write_directory_record(&root, DOT_RECORD, FALSE); - write_block(128, ' '); // volume set identifier - write_block(128, ' '); // publisher identifier - write_block(128, ' '); // data preparer identifier - write_block(128, ' '); // application identifier - write_block(37, ' '); // copyright file identifier - write_block(37, ' '); // abstract file identifier - write_block(37, ' '); // bibliographic file identifier + + write_bytecounted_string(128, volume_label); // volume set identifier + write_bytecounted_string(128, PUBLISHER_ID); // publisher identifier + write_bytecounted_string(128, DATA_PREP_ID); // data preparer identifier + write_bytecounted_string(128, APP_ID); // application identifier + + write_bytecounted_string(37, ""); // copyright file identifier + write_bytecounted_string(37, ""); // abstract file identifier + write_bytecounted_string(37, ""); // bibliographic file identifier + write_string(timestring); // volume creation write_byte(0); write_string(timestring); // most recent modification @@ -1342,12 +1382,8 @@ { write_string("\2CD001\1"); write_byte(0); - - write_word_block(16, L' '); // system identifier - - t = volume_label; - for (i = 0; i < 16; i++) - write_big_endian_word( (BYTE)( (*t != 0) ? *t++ : ' ' ) ); + write_bytecounted_string_as_big_endian_unicode(32, ""); // system identifier + write_bytecounted_string_as_big_endian_unicode(32, volume_label); // volume label
write_block(8, 0); write_both_endian_dword(total_sectors); @@ -1362,13 +1398,16 @@ write_big_endian_dword(joliet_big_endian_path_table_sector); write_big_endian_dword((DWORD) 0); // second big endian path table write_directory_record(&root, DOT_RECORD, TRUE); - write_word_block(64, ' '); // volume set identifier - write_word_block(64, ' '); // publisher identifier - write_word_block(64, ' '); // data preparer identifier - write_word_block(64, ' '); // application identifier - write_block(37, ' '); // copyright file identifier - write_block(37, ' '); // abstract file identifier - write_block(37, ' '); // bibliographic file identifier + + write_bytecounted_string_as_big_endian_unicode(128, volume_label); // volume set identifier + write_bytecounted_string_as_big_endian_unicode(128, PUBLISHER_ID); // publisher identifier + write_bytecounted_string_as_big_endian_unicode(128, DATA_PREP_ID); // data preparer identifier + write_bytecounted_string_as_big_endian_unicode(128, APP_ID); // application identifier + + write_bytecounted_string_as_big_endian_unicode(37, ""); // copyright file identifier + write_bytecounted_string_as_big_endian_unicode(37, ""); // abstract file identifier + write_bytecounted_string_as_big_endian_unicode(37, ""); // bibliographic file identifier + write_string(timestring); // volume creation write_byte(0); write_string(timestring); // most recent modification @@ -1651,22 +1690,27 @@ }
static char HELP[] = - "CDMAKE [-q] [-v] [-p] [-s N] [-m] [-b bootimage] [-j] source volume image\n" "\n" - " source specifications of base directory containing all files to\n" + "CDMAKE CD-ROM Premastering Utility\n" + "Copyright (C) Philip J. Erdelsky\n" + "Copyright (C) 2003-2015 ReactOS Team\n" + "\n\n" + "CDMAKE [-q] [-v] [-p] [-s N] [-m] [-b bootimage] [-j] source volume image\n" + "\n" + " source Specifications of base directory containing all files to\n" " be written to CD-ROM image\n" - " volume volume label\n" - " image image file or device\n" - " -q quiet mode - display nothing but error messages\n" - " -v verbose mode - display file information as files are\n" + " volume Volume label\n" + " image Image file or device\n" + " -q Quiet mode - display nothing but error messages\n" + " -v Verbose mode - display file information as files are\n" " scanned and written - overrides -p option\n" - " -p show progress while writing\n" - " -s N abort operation before beginning write if image will be\n" + " -p Show progress while writing\n" + " -s N Abort operation before beginning write if image will be\n" " larger than N megabytes (i.e. 1024*1024*N bytes)\n" - " -m accept punctuation marks other than underscores in\n" + " -m Accept punctuation marks other than underscores in\n" " names and extensions\n" - " -b bootimage create bootable ElTorito CD-ROM using 'no emulation' mode\n" - " -j generate Joliet filename records\n"; + " -b bootimage Create bootable ElTorito CD-ROM using 'no emulation' mode\n" + " -j Generate Joliet filename records\n";
/*----------------------------------------------------------------------------- Program execution starts here.
Added: trunk/reactos/tools/cdmake/config.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cdmake/config.h?rev=6... ============================================================================== --- trunk/reactos/tools/cdmake/config.h (added) +++ trunk/reactos/tools/cdmake/config.h [iso-8859-1] Sat Jan 31 18:44:28 2015 @@ -0,0 +1,14 @@ +#ifndef _WIN32 +#ifndef MAX_PATH +#define MAX_PATH 260 +#endif +#define DIR_SEPARATOR_CHAR '/' +#define DIR_SEPARATOR_STRING "/" +#else +#define DIR_SEPARATOR_CHAR '\' +#define DIR_SEPARATOR_STRING "\" +#endif + +#define PUBLISHER_ID "ReactOS Foundation" +#define DATA_PREP_ID "ReactOS Foundation" +#define APP_ID "CDMAKE CD-ROM Premastering Utility"
Propchange: trunk/reactos/tools/cdmake/config.h ------------------------------------------------------------------------------ svn:eol-style = native
Modified: trunk/reactos/tools/cdmake/dirhash.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cdmake/dirhash.c?rev=... ============================================================================== --- trunk/reactos/tools/cdmake/dirhash.c [iso-8859-1] (original) +++ trunk/reactos/tools/cdmake/dirhash.c [iso-8859-1] Sat Jan 31 18:44:28 2015 @@ -1,7 +1,7 @@ #include <string.h> #include <stdlib.h> #include <ctype.h> -#include "dirsep.h" +#include "config.h" #include "dirhash.h"
/* This is the famous DJB hash */
Removed: trunk/reactos/tools/cdmake/dirsep.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cdmake/dirsep.h?rev=6... ============================================================================== --- trunk/reactos/tools/cdmake/dirsep.h [iso-8859-1] (original) +++ trunk/reactos/tools/cdmake/dirsep.h (removed) @@ -1,10 +0,0 @@ -#ifndef _WIN32 -#ifndef MAX_PATH -#define MAX_PATH 260 -#endif -#define DIR_SEPARATOR_CHAR '/' -#define DIR_SEPARATOR_STRING "/" -#else -#define DIR_SEPARATOR_CHAR '\' -#define DIR_SEPARATOR_STRING "\" -#endif
Modified: trunk/reactos/tools/cdmake/llmsort.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cdmake/llmsort.c?rev=... ============================================================================== --- trunk/reactos/tools/cdmake/llmsort.c [iso-8859-1] (original) +++ trunk/reactos/tools/cdmake/llmsort.c [iso-8859-1] Sat Jan 31 18:44:28 2015 @@ -1,8 +1,9 @@ -/* A Linked-List Memory Sort - by Philip J. Erdelsky - pje@acm.org - http://www.alumni.caltech.edu/~pje/ -*/ +/* + * A Linked-List Memory Sort + * by Philip J. Erdelsky + * pje@acm.org + * http://alumnus.caltech.edu/~pje/ + */
/* According to his website, this file was released into the public domain by Phillip J. Erdelsky */