Changeset 33464 in vbox for trunk/src/VBox/Runtime/r3
- Timestamp:
- Oct 26, 2010 12:27:50 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 67055
- Location:
- trunk/src/VBox/Runtime/r3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/env-posix.cpp
r28800 r33464 103 103 AssertReturn(!strchr(pszVar, '='), VERR_INVALID_PARAMETER); 104 104 105 /* Check that it exists first. */ 105 /* 106 * Check that it exists first. 107 */ 106 108 if (!RTEnvExist(pszVar)) 107 109 return VINF_ENV_VAR_NOT_FOUND; 108 110 109 /* Ok, try remove it. */ 111 /* 112 * Ok, try remove it. 113 */ 110 114 #ifdef RT_OS_WINDOWS 111 /* Windows does not have unsetenv(). Clear the environment variable according to the MSN docs. */112 char *pszBuf;113 int rc = RTStrAPrintf(&pszBuf, "%s=", pszVar);114 if (RT_FAILURE(rc))115 return rc;116 rc = putenv(pszBuf);117 RTStrFree(pszBuf); 118 if (! rc)115 /* Use putenv(var=) since Windows does not have unsetenv(). */ 116 size_t cchVar = strlen(pszVar); 117 char *pszBuf = (char *)alloca(cchVar + 2); 118 memcpy(pszBuf, pszVar, cchVar); 119 pszBuf[cchVar] = '='; 120 pszBuf[cchVar + 1] = '\0'; 121 122 if (!putenv(pszBuf)) 119 123 return VINF_SUCCESS; 124 120 125 #else 121 126 /* This is the preferred function as putenv() like used above does neither work on Solaris nor on Darwin. */ -
trunk/src/VBox/Runtime/r3/xml.cpp
r33056 r33464 1045 1045 AttributeNode* ElementNode::setAttribute(const char *pcszName, int32_t i) 1046 1046 { 1047 char *psz = NULL; 1048 RTStrAPrintf(&psz, "%RI32", i); 1049 AttributeNode *p = setAttribute(pcszName, psz); 1050 RTStrFree(psz); 1047 char szValue[64]; 1048 RTStrPrintf(szValue, sizeof(szValue), "%RI32", i); 1049 AttributeNode *p = setAttribute(pcszName, szValue); 1051 1050 return p; 1052 1051 } 1053 1052 1054 AttributeNode* ElementNode::setAttribute(const char *pcszName, uint32_t i) 1055 { 1056 char *psz = NULL; 1057 RTStrAPrintf(&psz, "%RU32", i); 1058 AttributeNode *p = setAttribute(pcszName, psz); 1059 RTStrFree(psz); 1053 AttributeNode* ElementNode::setAttribute(const char *pcszName, uint32_t u) 1054 { 1055 char szValue[64]; 1056 RTStrPrintf(szValue, sizeof(szValue), "%RU32", u); 1057 AttributeNode *p = setAttribute(pcszName, szValue); 1060 1058 return p; 1061 1059 } … … 1063 1061 AttributeNode* ElementNode::setAttribute(const char *pcszName, int64_t i) 1064 1062 { 1065 char *psz = NULL; 1066 RTStrAPrintf(&psz, "%RI64", i); 1067 AttributeNode *p = setAttribute(pcszName, psz); 1068 RTStrFree(psz); 1063 char szValue[64]; 1064 RTStrPrintf(szValue, sizeof(szValue), "%RI64", i); 1065 AttributeNode *p = setAttribute(pcszName, szValue); 1069 1066 return p; 1070 1067 } 1071 1068 1072 AttributeNode* ElementNode::setAttribute(const char *pcszName, uint64_t i) 1073 { 1074 char *psz = NULL; 1075 RTStrAPrintf(&psz, "%RU64", i); 1076 AttributeNode *p = setAttribute(pcszName, psz); 1077 RTStrFree(psz); 1069 AttributeNode* ElementNode::setAttribute(const char *pcszName, uint64_t u) 1070 { 1071 char szValue[64]; 1072 RTStrPrintf(szValue, sizeof(szValue), "%RU64", u); 1073 AttributeNode *p = setAttribute(pcszName, szValue); 1078 1074 return p; 1079 1075 } 1080 1076 1081 AttributeNode* ElementNode::setAttributeHex(const char *pcszName, uint32_t i) 1082 { 1083 char *psz = NULL; 1084 RTStrAPrintf(&psz, "0x%RX32", i); 1085 AttributeNode *p = setAttribute(pcszName, psz); 1086 RTStrFree(psz); 1077 AttributeNode* ElementNode::setAttributeHex(const char *pcszName, uint32_t u) 1078 { 1079 char szValue[64]; 1080 RTStrPrintf(szValue, sizeof(szValue), "0x%RX32", u); 1081 AttributeNode *p = setAttribute(pcszName, szValue); 1087 1082 return p; 1088 1083 }
Note:
See TracChangeset
for help on using the changeset viewer.