Closed Bug 1334318 Opened 8 years ago Closed 8 years ago

remove last uses of PR_smprintf

Categories

(Core :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: tromey, Assigned: tromey)

References

Details

Attachments

(2 files)

After bug 1060419 lands, there are still a few uses of PR_smprintf in the tree. These should be removed and replaced with mozilla::Smprintf. Excluding those in nspr and security/nss (and FakeLogging.h, which is covered by a separate bug), I see: dom/plugins/base/nsPluginHost.cpp: *result = PR_smprintf("PROXY %s:%d", host.get(), port); dom/plugins/base/nsPluginHost.cpp: *result = PR_smprintf("SOCKS %s:%d", host.get(), port); dom/plugins/base/nsPluginHost.cpp: *result = PR_smprintf("SOCKS %s:%d", host.get(), port); netwerk/test/TestOverlappedIO.cpp: char *buffer = PR_smprintf("GET %s HTTP/1.1" CRLF netwerk/test/TestSocketIO.cpp: char *buffer = PR_smprintf("GET %s HTTP/1.1" CRLF startupcache/test/TestStartupCache.cpp: char* env = PR_smprintf("MOZ_STARTUP_CACHE=%s", path.get()); toolkit/xre/nsAppRunner.cpp: char *expr = PR_smprintf("%s=%s", name, PromiseFlatCString(word).get()); toolkit/xre/nsAppRunner.cpp: savedVar.value = PR_smprintf("%s=%s", savedVar.name, s); toolkit/xre/nsUpdateDriver.cpp: char *s = PR_smprintf("%s=%s", LD_LIBRARY_PATH_ENVVAR_NAME, pathToAppend); toolkit/xre/nsUpdateDriver.cpp: char *s = PR_smprintf("%s=%s" PATH_SEPARATOR "%s", toolkit/xre/nsUpdateDriver.cpp: // call PR_smprintf_free on s. Subsequent calls to PR_SetEnv will free xpcom/ds/nsVariant.cpp: // Can't use PR_smprintf for floats, since it's locale-dependent xpcom/ds/nsVariant.cpp: // the rest can be PR_smprintf'd and use common code. xpcom/ds/nsVariant.cpp: ptr = PR_smprintf( format_ , (cast_) u.member_); \ xpcom/ds/nsVariant.cpp: PR_smprintf_free(ptr);
Attached file check_files.txt (deleted) —
Hi, Can I work on this? I am new to MDN network. I have compiled the list of files using the PR_smprintf excluding nspr and security/nss using below command. I have also attached the list of files for the same. Please suggest? Should I change all these files mentioned in the attachment?
Flags: needinfo?(ttromey)
grep -r "PR_smprintf" * | grep -v nspr | grep -v security/nss >> ~/check_files.txt Command used for the attached list of files.
Flags: needinfo?(ttromey)
I think this bug should should wait until bug 1060419 lands. That should be "soon" but I don't know exactly when. So I would say if you are looking for a way to contribute now, you would be better off with some other bug.
Assignee: nobody → ttromey
While doing this I found a latent bug here: https://dxr.mozilla.org/mozilla-central/rev/2cca333f546f38860f84940d4c72d7470a3410f4/toolkit/xre/nsAppRunner.cpp#4417 (note that it predates my recent change here). The bug is that this frees the pointer passed to PR_SetEnv, violating the contract. My patch fixes this buglet as well.
Attachment #8862915 - Flags: review?(nfroyd) → review+
Pushed by ttromey@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e78adb571ca9 remove last uses of PR_smprintf; r=froydnj
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: