Wed, 31 Dec 2014 07:53:36 +0100
Correct small whitespace inconsistency, lost while renaming variables.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | /* |
michael@0 | 7 | ** File:plerror.c |
michael@0 | 8 | ** Description: Simple routine to print translate the calling thread's |
michael@0 | 9 | ** error numbers and print them to "syserr". |
michael@0 | 10 | */ |
michael@0 | 11 | |
michael@0 | 12 | #include "plerror.h" |
michael@0 | 13 | |
michael@0 | 14 | #include "prprf.h" |
michael@0 | 15 | #include "prerror.h" |
michael@0 | 16 | |
michael@0 | 17 | PR_IMPLEMENT(void) PL_FPrintError(PRFileDesc *fd, const char *msg) |
michael@0 | 18 | { |
michael@0 | 19 | PRErrorCode error = PR_GetError(); |
michael@0 | 20 | PRInt32 oserror = PR_GetOSError(); |
michael@0 | 21 | const char *name = PR_ErrorToName(error); |
michael@0 | 22 | |
michael@0 | 23 | if (NULL != msg) PR_fprintf(fd, "%s: ", msg); |
michael@0 | 24 | if (NULL == name) |
michael@0 | 25 | PR_fprintf( |
michael@0 | 26 | fd, " (%d)OUT OF RANGE, oserror = %d\n", error, oserror); |
michael@0 | 27 | else |
michael@0 | 28 | PR_fprintf( |
michael@0 | 29 | fd, "%s(%d), oserror = %d\n", |
michael@0 | 30 | name, error, oserror); |
michael@0 | 31 | } /* PL_FPrintError */ |
michael@0 | 32 | |
michael@0 | 33 | PR_IMPLEMENT(void) PL_PrintError(const char *msg) |
michael@0 | 34 | { |
michael@0 | 35 | static PRFileDesc *fd = NULL; |
michael@0 | 36 | if (NULL == fd) fd = PR_GetSpecialFD(PR_StandardError); |
michael@0 | 37 | PL_FPrintError(fd, msg); |
michael@0 | 38 | } /* PL_PrintError */ |
michael@0 | 39 | |
michael@0 | 40 | /* plerror.c */ |