Changeset 551 for trunk/dll/error.c


Ignore:
Timestamp:
Feb 28, 2007, 2:33:51 AM (18 years ago)
Author:
Gregg Young
Message:

Indentation cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/error.c

    r452 r551  
    4343//== Win_Error: report Win...() error using passed message string ===
    4444
    45 VOID Win_Error(HWND hwndErr, HWND hwndOwner, PCSZ pszFileName, ULONG ulLineNo, PCSZ pszFmt,...)
     45VOID Win_Error(HWND hwndErr, HWND hwndOwner, PCSZ pszFileName, ULONG ulLineNo,
     46               PCSZ pszFmt, ...)
    4647{
    4748  PERRINFO pErrInfoBlk;         /* Pointer to ERRINFO structure filled
     
    5556
    5657  if (hwndErr == NULLHANDLE)
    57     hab = (HAB)0;
     58    hab = (HAB) 0;
    5859  else
    5960    hab = WinQueryAnchorBlock(hwndErr);
     
    6566
    6667  if (strchr(szMsg, ' ') == NULL)
    67     strcat(szMsg, " failed.");                  // Assume simple function name
     68    strcat(szMsg, " failed.");          // Assume simple function name
    6869
    6970  // Append file name and line number
    7071  sprintf(szMsg + strlen(szMsg),
    71           GetPString(IDS_GENERR1TEXT),
    72           pszFileName, ulLineNo, "  ");
     72          GetPString(IDS_GENERR1TEXT), pszFileName, ulLineNo, "  ");
    7373
    7474  // Get last PM error for the current thread
     
    8484       Assume 1 message - fixme?
    8585     */
    86     pszOffset = ((PSZ) pErrInfoBlk) + pErrInfoBlk -> offaoffszMsg;
     86    pszOffset = ((PSZ) pErrInfoBlk) + pErrInfoBlk->offaoffszMsg;
    8787    /* Address error message in array of messages and
    8888       append error message to source code linenumber
    8989     */
    9090    psz = szMsg + strlen(szMsg);
    91     sprintf(psz, "#0x%04x  \"", ERRORIDERROR(pErrInfoBlk -> idError));
     91    sprintf(psz, "#0x%04x  \"", ERRORIDERROR(pErrInfoBlk->idError));
    9292    psz += strlen(psz);
    93     strcpy(psz, ((PSZ)pErrInfoBlk) + *(PSHORT)pszOffset);
     93    strcpy(psz, ((PSZ) pErrInfoBlk) + *(PSHORT) pszOffset);
    9494    psz += strlen(psz);
    9595    strcpy(psz, "\"");
     
    9797  }
    9898
    99   showMsg(MB_ENTER | MB_ICONEXCLAMATION,
    100           hwndOwner,
    101           GetPString(IDS_GENERR2TEXT),  // Titlebar message
     99  showMsg(MB_ENTER | MB_ICONEXCLAMATION, hwndOwner, GetPString(IDS_GENERR2TEXT),        // Titlebar message
    102100          szMsg);                       // Formatted message
    103101
    104 } // Win_Error
     102}                                       // Win_Error
    105103
    106104//== Win_Error2: report Win...() error using passed message id ===
    107105
    108 VOID Win_Error2(HWND hwndErr, HWND hwndOwner, PCSZ pszFileName, ULONG ulLineNo, UINT idMsg)
     106VOID Win_Error2(HWND hwndErr, HWND hwndOwner, PCSZ pszFileName,
     107                ULONG ulLineNo, UINT idMsg)
    109108{
    110109  Win_Error(hwndErr, hwndOwner, pszFileName, ulLineNo, GetPString(idMsg));
    111110
    112 } // Win_Error2
     111}                                       // Win_Error2
    113112
    114113//== Dos_Error: report Dos...() error using passed message string ===
    115114
    116115INT Dos_Error(ULONG mb_type, ULONG ulRC, HWND hwndOwner, PCSZ pszFileName,
    117               ULONG ulLineNo, PCSZ pszFmt,...)
     116              ULONG ulLineNo, PCSZ pszFmt, ...)
    118117{
    119118  CHAR szMsg[4096];
     
    135134
    136135  if (strchr(szMsg, ' ') == NULL)
    137     strcat(szMsg, " failed.");                  // Assume simple function name
     136    strcat(szMsg, " failed.");          // Assume simple function name
    138137
    139138  DosErrClass(ulRC, &Class, &action, &Locus);
     
    149148  pszMsgStart = szMsg + strlen(szMsg) + 1;
    150149  // Get message leaving space for NL separator
    151   if (!DosGetMessage(NULL, 0L, (PCHAR)pszMsgStart + 1, 1024, ulRC, "OSO001.MSG", &ulMsgLen) ||
    152       !DosGetMessage(NULL, 0L, (PCHAR)pszMsgStart + 1, 1024, ulRC, "OSO001H.MSG", &ulMsgLen))
    153   {
     150  if (!DosGetMessage
     151      (NULL, 0L, (PCHAR) pszMsgStart + 1, 1024, ulRC, "OSO001.MSG", &ulMsgLen)
     152      || !DosGetMessage(NULL, 0L, (PCHAR) pszMsgStart + 1, 1024, ulRC,
     153                        "OSO001H.MSG", &ulMsgLen)) {
    154154    // Got message
    155155    pszMsgStart[ulMsgLen + 1] = 0;      // Terminate
     
    160160    // Chop trailing NL CR TAB
    161161    while (*psz &&
    162            (*psz == '\r' || *psz == '\n' || *psz == ' ' || *psz == '\t'))
    163     {
     162           (*psz == '\r' || *psz == '\n' || *psz == ' ' || *psz == '\t')) {
    164163      *psz-- = 0;
    165164    }
     
    168167    // Convert CR and NL combos to single space
    169168    psz = pszMsgStart;
    170     while (*psz)
    171     {
    172       if (*psz == '\n' || *psz == '\r')
    173       {
     169    while (*psz) {
     170      if (*psz == '\n' || *psz == '\r') {
    174171        while (*(psz + 1) == '\n' || *(psz + 1) == '\r')
    175172          memmove(psz, psz + 1, strlen(psz));
     
    181178  }
    182179
    183   return showMsg(mb_type | MB_ICONEXCLAMATION,
    184                  hwndOwner,
    185                  GetPString(IDS_DOSERR2TEXT),   // Title
     180  return showMsg(mb_type | MB_ICONEXCLAMATION, hwndOwner, GetPString(IDS_DOSERR2TEXT),  // Title
    186181                 szMsg);
    187182
    188 } // Dos_Error
     183}                                       // Dos_Error
    189184
    190185//== Dos_Error2: report Dos...() error using passed message id ===
    191186
    192187INT Dos_Error2(ULONG mb_type, ULONG ulRC, HWND hwndOwner, PCSZ pszFileName,
    193               ULONG ulLineNo, UINT idMsg)
    194 {
    195   return Dos_Error(mb_type, ulRC, hwndOwner, pszFileName,ulLineNo,
    196                     GetPString(idMsg));
    197 } // Dos_Error2
     188               ULONG ulLineNo, UINT idMsg)
     189{
     190  return Dos_Error(mb_type, ulRC, hwndOwner, pszFileName, ulLineNo,
     191                   GetPString(idMsg));
     192}                                       // Dos_Error2
    198193
    199194//== Runtime_Error: report runtime library error using passed message string ===
    200195
    201 VOID Runtime_Error(PCSZ pszSrcFile, UINT uSrcLineNo, PCSZ pszFmt,...)
     196VOID Runtime_Error(PCSZ pszSrcFile, UINT uSrcLineNo, PCSZ pszFmt, ...)
    202197{
    203198  CHAR szMsg[4096];
     
    211206
    212207  if (strchr(szMsg, ' ') == NULL)
    213     strcat(szMsg, " failed.");                  // Assume simple function name
     208    strcat(szMsg, " failed.");          // Assume simple function name
    214209
    215210  sprintf(szMsg + strlen(szMsg),
    216211          // GetPString(IDS_DOSERR1TEXT), fixme
    217           "\nModule: %s\nLinenumber: %u",
    218           pszSrcFile,
    219           uSrcLineNo);
    220 
    221   showMsg(MB_ICONEXCLAMATION,HWND_DESKTOP,DEBUG_STRING,szMsg);
    222 
    223 } // Runtime_Error
     212          "\nModule: %s\nLinenumber: %u", pszSrcFile, uSrcLineNo);
     213
     214  showMsg(MB_ICONEXCLAMATION, HWND_DESKTOP, DEBUG_STRING, szMsg);
     215
     216}                                       // Runtime_Error
    224217
    225218//== Runtime_Error2: report runtime library error using passed message id ===
     
    229222  Runtime_Error(pszSrcFile, uSrcLineNo, GetPString(idMsg));
    230223
    231 } // Runtime_Error2
     224}                                       // Runtime_Error2
    232225
    233226// fixme to be rename to Misc_Error
     
    235228//=== saymsg: report misc error using passed message ===
    236229
    237 APIRET saymsg(ULONG mb_type, HWND hwnd, PCSZ pszTitle, PCSZ pszFmt,...)
    238 {
    239   CHAR szMsg[4096];
    240   va_list va;
    241 
    242   va_start(va, pszFmt);
    243   vsprintf(szMsg, pszFmt, va);
    244   va_end(va);
    245 
    246   return showMsg(mb_type,hwnd,pszTitle,szMsg);
    247 
    248 } // saymsg
     230APIRET saymsg(ULONG mb_type, HWND hwnd, PCSZ pszTitle, PCSZ pszFmt, ...)
     231{
     232  CHAR szMsg[4096];
     233  va_list va;
     234
     235  va_start(va, pszFmt);
     236  vsprintf(szMsg, pszFmt, va);
     237  va_end(va);
     238
     239  return showMsg(mb_type, hwnd, pszTitle, szMsg);
     240
     241}                                       // saymsg
    249242
    250243//=== showMsg: display error popup ===
     
    252245static APIRET showMsg(ULONG mb_type, HWND hwnd, PCSZ pszTitle, PCSZ pszMsg)
    253246{
    254   if ((mb_type & (MB_YESNO | MB_YESNOCANCEL)) == 0)
    255   {
     247  if ((mb_type & (MB_YESNO | MB_YESNOCANCEL)) == 0) {
    256248    fputs(pszMsg, stderr);
    257249    fputc('\n', stderr);
     
    262254    hwnd = HWND_DESKTOP;
    263255
    264   DosBeep(250,100);
     256  DosBeep(250, 100);
    265257
    266258  return WinMessageBox(HWND_DESKTOP,    // Parent
    267259                       hwnd,            // Owner
    268                        (PSZ)pszMsg,
    269                        (PSZ)pszTitle,
    270                        0,               // help id
     260                       (PSZ) pszMsg, (PSZ) pszTitle, 0, // help id
    271261                       mb_type | MB_MOVEABLE);
    272 } // showMsg
     262}                                       // showMsg
Note: See TracChangeset for help on using the changeset viewer.