Changeset 102340 in vbox for trunk/src/libs/xpcom18a4
- Timestamp:
- Nov 27, 2023 5:50:21 PM (15 months ago)
- svn:sync-xref-src-repo-rev:
- 160476
- Location:
- trunk/src/libs/xpcom18a4
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/Makefile.kmk
r102328 r102340 384 384 nsprpub/lib/ds/plarena.c \ 385 385 nsprpub/lib/ds/plhash.c \ 386 nsprpub/lib/libc/src/strcpy.c \387 386 nsprpub/lib/libc/src/strcmp.c \ 388 387 nsprpub/lib/libc/src/strccmp.c \ -
trunk/src/libs/xpcom18a4/ipc/ipcd/shared/src/ipcConfig.cpp
r102249 r102340 37 37 #define LOG_GROUP LOG_GROUP_IPC 38 38 39 #if defined(XP_WIN)40 #elif defined(XP_OS2) && defined(XP_OS2_NATIVEIPC)41 #else42 #include <string.h>43 #ifdef XP_UNIX44 39 #include <unistd.h> 45 40 #include <sys/types.h> 46 41 #include <pwd.h> 47 #endif 42 48 43 #include "ipcConfig.h" 49 #include "plstr.h"50 44 51 45 #include <iprt/env.h> 46 #include <iprt/string.h> 52 47 #include <VBox/log.h> 53 48 54 #if defined(XP_OS2) && !defined(XP_OS2_NATIVEIPC)55 #ifdef VBOX56 static const char kDefaultSocketPrefix[] = "\\socket\\vbox-";57 #else58 static const char kDefaultSocketPrefix[] = "\\socket\\mozilla-";59 #endif60 static const char kDefaultSocketSuffix[] = "-ipc\\ipcd";61 #else62 #ifdef VBOX63 49 static const char kDefaultSocketPrefix[] = "/tmp/.vbox-"; 64 #else65 static const char kDefaultSocketPrefix[] = "/tmp/.mozilla-";66 #endif67 50 static const char kDefaultSocketSuffix[] = "-ipc/ipcd"; 68 #endif69 51 70 52 void IPC_GetDefaultSocketPath(char *buf, PRUint32 bufLen) … … 73 55 int len; 74 56 75 PL_strncpyz(buf, kDefaultSocketPrefix, bufLen); 76 buf += (sizeof(kDefaultSocketPrefix) - 1); 77 bufLen -= (sizeof(kDefaultSocketPrefix) - 1); 57 char *pszDst = buf; 58 size_t cbDst = bufLen; 59 int vrc = RTStrCopyP(&pszDst, &cbDst, kDefaultSocketPrefix); 60 AssertRC(vrc); RT_NOREF(vrc); 78 61 79 62 logName = RTEnvGet("VBOX_IPC_SOCKETID"); 80 #if defined(VBOX) && defined(XP_UNIX)81 63 if (!logName || !logName[0]) { 82 64 struct passwd *passStruct = getpwuid(getuid()); … … 84 66 logName = passStruct->pw_name; 85 67 } 86 #endif 68 87 69 if (!logName || !logName[0]) { 88 70 logName = RTEnvGet("LOGNAME"); … … 95 77 } 96 78 } 97 PL_strncpyz(buf, logName, bufLen); 98 len = strlen(logName); 99 buf += len; 100 bufLen -= len; 79 80 vrc = RTStrCopyP(&pszDst, &cbDst, logName); 81 AssertRC(vrc); RT_NOREF(vrc); 101 82 102 83 end: 103 PL_strncpyz(buf, kDefaultSocketSuffix, bufLen); 84 vrc = RTStrCopyP(&pszDst, &cbDst, kDefaultSocketSuffix); 85 AssertRC(vrc); RT_NOREF(vrc); 104 86 } 105 106 #endif -
trunk/src/libs/xpcom18a4/nsprpub/lib/libc/include/plstr.h
r102323 r102340 78 78 PR_BEGIN_EXTERN_C 79 79 /* 80 * PL_strncpy81 *82 * Copies the source string into the destination buffer, up to and including83 * the trailing '\0' or up to and including the max'th character, whichever84 * comes first. It does not (can not) verify that the destination buffer is85 * large enough. If the source string is longer than the maximum length,86 * the result will *not* be null-terminated (JLRU).87 */88 89 PR_EXTERN(char *)90 PL_strncpy(char *dest, const char *src, PRUint32 max);91 92 /*93 * PL_strncpyz94 *95 * Copies the source string into the destination buffer, up to and including96 * the trailing '\0' or up but not including the max'th character, whichever97 * comes first. It does not (can not) verify that the destination buffer is98 * large enough. The destination string is always terminated with a '\0',99 * unlike the traditional libc implementation. It returns the "dest" argument.100 *101 * NOTE: If you call this with a source "abcdefg" and a max of 5, the102 * destination will end up with "abcd\0" (i.e., it's strlen length will be 4)!103 *104 * This means you can do this:105 *106 * char buffer[ SOME_SIZE ];107 * PL_strncpyz(buffer, src, sizeof(buffer));108 *109 * and the result will be properly terminated.110 */111 112 PR_EXTERN(char *)113 PL_strncpyz(char *dest, const char *src, PRUint32 max);114 115 /*116 80 * PL_strcmp 117 81 *
Note:
See TracChangeset
for help on using the changeset viewer.