Changeset 1593 for trunk/dll/command.c


Ignore:
Timestamp:
Jul 4, 2011, 4:32:25 AM (14 years ago)
Author:
Gregg Young
Message:

Fixed duplicate command ID generation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/command.c

    r1544 r1593  
    4040  01 May 10 GKY Add ENVIRONMENT_SIZE variable to standardize this size everywhere.
    4141  01 May 10 GKY Changes to move environment storage to INI file
     42  03 Jul 11 GKY Fixed problem with creation of duplicate command IDs.
    4243
    4344***********************************************************************/
     
    9596static PSZ pszSrcFile = __FILE__;
    9697static LINKCMDS *cmdtail;
    97 static BOOL UsedCommandIDs[300];
    98 static BOOL UsedHotKeyIDs[40];
     98static BOOL UsedCommandIDs[300] = {FALSE};
     99static BOOL UsedHotKeyIDs[40] = {FALSE};
    99100static PSZ pszCommandsList;
    100101static ULONG ulSizeCommandsList = 10000;
     
    377378
    378379
    379   size = sizeof(BOOL) * 300;
     380  /*size = sizeof(BOOL) * 300;
    380381  PrfQueryProfileData(fmprof, FM3Str, "COMMANDS.UsedCommandIDs", &UsedCommandIDs,
    381382                      &size);
    382383  size = sizeof(BOOL) * 40;
    383384  PrfQueryProfileData(fmprof, FM3Str, "COMMANDS.UsedHotKeyIDs", &UsedHotKeyIDs,
    384                       &size);
     385                      &size);*/    // No need to use profile just count them GKY 02 JUL 11
    385386  size = sizeof(BOOL);
    386387  PrfQueryProfileData(fmprof, FM3Str, "COMMANDS.LoadCommandsFromINI",
     
    507508            size = sizeof(ULONG);
    508509            PrfQueryProfileData(fmprof, FM3Str, key, &ID, &size);
     510            UsedCommandIDs[ID - IDM_COMMANDSTART] = TRUE; // No need to use profile just count them GKY 02 JUL 11
    509511            sprintf(key, "COMMAND.%sHotKeyID", szTitle);
    510512            size = sizeof(ULONG);
    511513            PrfQueryProfileData(fmprof, FM3Str, key, &HotKeyID, &size);
     514            UsedHotKeyIDs[HotKeyID - IDM_COMMANDNUM0] = TRUE;  // No need to use profile just count them GKY 02 JUL 11
    512515            sprintf(key, "COMMAND.%sflags", szTitle);
    513516            size = sizeof(ULONG);
     
    620623      sprintf(key, "COMMAND.%sID", info->title);
    621624      PrfWriteProfileData(fmprof, FM3Str, key, &info->ID, sizeof(INT));
     625      UsedCommandIDs[info->ID - IDM_COMMANDSTART] = TRUE;
    622626      sprintf(key, "COMMAND.%sHotKeyID", info->title);
    623627      PrfWriteProfileData(fmprof, FM3Str, key, &info->HotKeyID, sizeof(INT));
     628      UsedHotKeyIDs[info->HotKeyID - IDM_COMMANDNUM0] = TRUE;
    624629      if (info->env != NullStr) {
    625630        sprintf(key, "COMMAND.%senv", info->title);
     
    635640    } // while info
    636641    PrfWriteProfileData(fmprof, FM3Str, "COMMANDS.UsedCommandIDs", &UsedCommandIDs,
    637                         sizeof(BOOL) * 300);
     642                        sizeof(BOOL) * 300); // left for backward compatability GKY 02 Jul 11
    638643    PrfWriteProfileData(fmprof, FM3Str, "COMMANDS.UsedHotKeyIDs", &UsedHotKeyIDs,
    639                         sizeof(BOOL) * 40);
     644                        sizeof(BOOL) * 40);// left for backward compatability GKY 02 Jul 11
    640645    ulSizeCommandsList = strlen(pszCommandsList) + 1;
    641646    PrfWriteProfileData(fmprof, FM3Str, "COMMANDS.SizeSortOrder",
     
    682687        }
    683688        else
    684           return NULL;
     689          return (LINKCMDS *) -1;
    685690      }
    686691      info = info->next;
     
    10161021            fDontCheckHotKey = TRUE;
    10171022          info = add_command(temp, fDontCheckHotKey);
     1023          if (info == (LINKCMDS *) -1)
     1024            break;
    10181025        }
    10191026        else {
Note: See TracChangeset for help on using the changeset viewer.