Previous 15994 Revisions Next

r7814 Thursday 15th April, 2010 at 15:25:47 UTC by Firewave
Fixed another parsing issue and a memory leak with -ram option
[src/mess]infomess.c
[src/mess/devices]messram.c
[src/mess/osd/winui]propertiesms.c

src/mess/devices/messram.c
r7813r7814
191191            {
192192               int j;
193193               int size = strlen(config->extra_options);
194               char *s = mame_strdup(config->extra_options);
194               char * const s = mame_strdup(config->extra_options);
195               char * const e = s + size;
196               char *p = s;
195197               for (j=0;j<size;j++) {
196                  if (s[j]==',') s[j]=0;
198                  if (p[j]==',') p[j]=0;
197199               }
198200               
199201               /* try to parse each option */
200               while(*s != '\0')
202               while(p <= e)
201203               {
202                  UINT32 option_ram_size = messram_parse_string(s);
204                  UINT32 option_ram_size = messram_parse_string(p);
203205
204206                  if (option_ram_size == 0)
205207                  {
206                     mame_printf_error("%s: '%s' has an invalid RAM option: %s\n", driver->source_file, driver->name, s);
208                     mame_printf_error("%s: '%s' has an invalid RAM option: %s\n", driver->source_file, driver->name, p);
207209                     error = TRUE;
208210                  }
209211
210212                  if (option_ram_size == specified_ram)
211213                     is_valid = TRUE;
212214
213                  s += strlen(s) + 1;
215                  p += strlen(p);
216                  if (p == e)
217                     break;
218                  p += 1;
214219               }
220
221               osd_free(s);
215222            }
216223
217224         } else {
src/mess/infomess.c
r7813r7814
103103      {
104104         int j;
105105         int size = strlen(ram->extra_options);
106         char *s = mame_strdup(ram->extra_options);
106         char * const s = mame_strdup(ram->extra_options);
107         char * const e = s + size;
108         char *p = s;
107109         for (j=0;j<size;j++) {
108            if (s[j]==',') s[j]=0;
110            if (p[j]==',') p[j]=0;
109111         }
110112         /* try to parse each option */
111         while(*s != '\0')
113         while(p <= e)
112114         {
113            fprintf(out, "\t\t<ramoption>%u</ramoption>\n",  messram_parse_string(s));
114            s += strlen(s) + 1;
115            fprintf(out, "\t\t<ramoption>%u</ramoption>\n",  messram_parse_string(p));
116            p += strlen(p);
117            if (p == e)
118               break;               
119            p += 1;
115120         }
121
122         osd_free(s);
116123      }
117124   }
118125}
src/mess/osd/winui/propertiesms.c
r7813r7814
441441      {
442442         int j;
443443         int size = strlen(config->extra_options);
444         char *s = mame_strdup(config->extra_options);
444         char * const s = mame_strdup(config->extra_options);
445         char * const e = s + size;
446         char *p = s;
445447         for (j=0;j<size;j++) {
446            if (s[j]==',') s[j]=0;
448            if (p[j]==',') p[j]=0;
447449         }
448450         
449451         /* try to parse each option */
450         while(*s != '\0')
452         while(p <= e)
451453         {
452454            i++;
453455            // identify this option
454            ram = messram_parse_string(s);
456            ram = messram_parse_string(p);
455457
456            this_ram_string = s;
458            this_ram_string = p;
457459
458460            t_ramstring = tstring_from_utf8(this_ram_string);
459461            if( !t_ramstring )
r7813r7814
469471            if (ram == current_ram)
470472               current_index = i;
471473
472            s += strlen(s) + 1;
474            p+= strlen(p);
475            if (p == e)
476               break;
477           
478            p += 1;
473479         }
480
481         osd_free(s);
474482      }
475483
476484      // set the combo box

Previous 15994 Revisions Next


© 1998-2018 The MESS Team