Changeset 711 for trunk/gsdl/src/mgpp/text/StemBlock.cpp
- Timestamp:
- 1999-10-18T12:43:31+13:00 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/mgpp/text/StemBlock.cpp
r655 r711 45 45 int abortvar; 46 46 47 if (!(sd = (stemmed_dict *) Xmalloc (sizeof (stemmed_dict))))47 if (!(sd = new stemmed_dict)) 48 48 { 49 49 abort(0); … … 66 66 NTOHUL(sd->sdh.indexed); 67 67 68 if (!(buffer = (u_char *) Xmalloc (sd->sdh.index_chars)))68 if (!(buffer = new u_char[sd->sdh.index_chars])) 69 69 { 70 70 abort(1); … … 72 72 sd->MemForStemDict += sd->sdh.index_chars; 73 73 74 if (!(sd->index = (u_char **) Xmalloc (sd->sdh.num_blocks * sizeof (*sd->index))))74 if (!(sd->index = new (u_char *)[sd->sdh.num_blocks])) 75 75 { 76 76 abort(2); … … 78 78 sd->MemForStemDict += sd->sdh.num_blocks * sizeof (*sd->index); 79 79 80 if (!(sd->pos = (long unsigned int *) Xmalloc (sd->sdh.num_blocks * sizeof (*sd->pos))))80 if (!(sd->pos = new (long unsigned int)[sd->sdh.num_blocks])) 81 81 { 82 82 abort(3); … … 84 84 sd->MemForStemDict += sd->sdh.num_blocks * sizeof (*sd->pos); 85 85 86 if (!(sd->buffer = (u_char *) Xmalloc (sd->sdh.block_size * sizeof (*sd->buffer))))86 if (!(sd->buffer = new u_char[sd->sdh.block_size])) 87 87 { 88 88 abort(4); … … 95 95 { 96 96 register u_char len; 97 // Read an MG string from the blocked dictionary 97 98 sd->index[i] = buffer; 98 99 len = Getc (stem_file); … … 100 101 Fread (buffer, sizeof (u_char), len, stem_file); 101 102 buffer += len; 103 104 // Read the pointer into the blocks 102 105 Fread (&sd->pos[i], sizeof (*sd->pos), 1, stem_file); 106 103 107 NTOHUL(sd->pos[i]); /* [RPAP - Jan 97: Endian Ordering] */ 104 108 } … … 114 118 { 115 119 case 4: 116 Xfree (sd->buffer);120 delete sd->pos; 117 121 case 3: 118 Xfree (sd->index);122 delete sd->index; 119 123 case 2: 120 Xfree (buffer);124 delete buffer; 121 125 case 1: 122 Xfree (sd);126 delete sd; 123 127 break; 124 128 … … 158 162 159 163 /* [RPAP - Jan 97: Endian Ordering] */ 164 // first_word is the word number of the first word in the block 160 165 *first_word = (unsigned long *) (sd->buffer); 161 166 NTOHUL(**first_word); 167 162 168 *last_invf_len = (unsigned long *) ((*first_word) + 1); 163 169 NTOHUL(**last_invf_len); 170 171 // num_words is the number of words in the block 164 172 *num_words = (unsigned short *) ((*last_invf_len) + 1); 165 173 NTOHUS(**num_words); 174 166 175 *index = (*num_words) + 1; 167 176 *num_indexes = (((**num_words) - 1) / sd->sdh.lookback) + 1;
Note:
See TracChangeset
for help on using the changeset viewer.