mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Fixed build failures - these files are NOT part of the seamonkey build.
This commit is contained in:
parent
0f3e5543f2
commit
59df6ba2b7
@ -81,6 +81,7 @@
|
||||
#include "jsscript.h"
|
||||
#include "jsstr.h"
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#include <string.h>
|
||||
|
||||
/* NSPR dependencies */
|
||||
#include "prio.h"
|
||||
@ -419,7 +420,7 @@ js_absolutePath(JSContext *cx, const char * path)
|
||||
|
||||
/* Side effect: will remove spaces in the beginning/end of the filename */
|
||||
static char *
|
||||
js_canonicalPath(JSContext *cx, const char *oldpath)
|
||||
js_canonicalPath(JSContext *cx, char *oldpath)
|
||||
{
|
||||
char *tmp;
|
||||
char *path = oldpath;
|
||||
@ -437,8 +438,7 @@ js_canonicalPath(JSContext *cx, const char *oldpath)
|
||||
strncpy(tmp, &path[i], j-i+1);
|
||||
tmp[j-i+1] = '\0';
|
||||
|
||||
strcpy(path, tmp);
|
||||
JS_free(cx, tmp);
|
||||
path = tmp;
|
||||
|
||||
/* pipe support */
|
||||
if(js_filenameHasAPipe(path))
|
||||
@ -1319,7 +1319,7 @@ file_close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
JS_ReportWarning(cx, "Unable to close a native file, proceeding", file->path);
|
||||
goto out;
|
||||
}else{
|
||||
if(PR_Close(file->handle)){
|
||||
if(file->handle && PR_Close(file->handle)){
|
||||
JS_ReportErrorNumber(cx, JSFile_GetErrorMessage, NULL,
|
||||
JSFILEMSG_OP_FAILED, "close", file->path);
|
||||
|
||||
@ -1519,7 +1519,8 @@ file_write(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
JSFile *file = JS_GetInstancePrivate(cx, obj, &file_class, NULL);
|
||||
JSString *str;
|
||||
int32 count, i;
|
||||
int32 count;
|
||||
uintN i;
|
||||
|
||||
SECURITY_CHECK(cx, NULL, "write", file);
|
||||
JSFILE_CHECK_WRITE;
|
||||
@ -1804,7 +1805,6 @@ file_list(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
|
||||
SECURITY_CHECK(cx, NULL, "list", file);
|
||||
JSFILE_CHECK_NATIVE("list");
|
||||
JSFILE_CHECK_READ;
|
||||
|
||||
if (argc==1) {
|
||||
if (JSVAL_IS_REGEXP(cx, argv[0])) {
|
||||
@ -1945,12 +1945,18 @@ file_toURL(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
JSFile *file = JS_GetInstancePrivate(cx, obj, &file_class, NULL);
|
||||
char url[MAX_PATH_LENGTH];
|
||||
jschar *urlChars;
|
||||
|
||||
JSFILE_CHECK_NATIVE("toURL");
|
||||
|
||||
sprintf(url, "file://%s", file->path);
|
||||
/* TODO: js_escape in jsstr.h may go away at some point */
|
||||
*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, js_escape(cx, obj, url)));
|
||||
|
||||
urlChars = js_InflateString(cx, url, strlen(url));
|
||||
if (urlChars == NULL) return JS_FALSE;
|
||||
*rval = STRING_TO_JSVAL(js_NewString(cx, urlChars, strlen(url), 0));
|
||||
if (!str_escape(cx, obj, 0, rval, rval)) return JS_FALSE;
|
||||
|
||||
return JS_TRUE;
|
||||
out:
|
||||
*rval = JSVAL_VOID;
|
||||
|
@ -71,5 +71,14 @@ MSG_DEF(JSFILEMSG_FIRST_ARGUMENT_MUST_BE_A_NUMBER, 32, 2, JSEXN_N
|
||||
MSG_DEF(JSFILEMSG_CANNOT_WRITE, 33, 1, JSEXN_NONE, "Cannot write to {0}, file mode is different")
|
||||
MSG_DEF(JSFILEMSG_CANNOT_READ, 34, 1, JSEXN_NONE, "Cannot read from {0}, file mode is different")
|
||||
MSG_DEF(JSFILEMSG_CANNOT_FLUSH, 35, 1, JSEXN_NONE, "Flush failed on {0}")
|
||||
MSG_DEF(JSFILEMSG_OP_FAILED, 36, 1, JSEXN_NONE, "File operation {0} failed")
|
||||
MSG_DEF(JSFILEMSG_FILE_MUST_BE_OPEN, 37, 1, JSEXN_NONE, "File must be open for {0}")
|
||||
MSG_DEF(JSFILEMSG_FILE_MUST_BE_CLOSED, 38, 1, JSEXN_NONE, "File must be closed for {0}")
|
||||
MSG_DEF(JSFILEMSG_NO_RANDOM_ACCESS, 39, 1, JSEXN_NONE, "File {0} doesn't allow random access")
|
||||
MSG_DEF(JSFILEMSG_OBJECT_CREATION_FAILED, 40, 1, JSEXN_NONE, "Couldn't create {0}")
|
||||
MSG_DEF(JSFILEMSG_CANNOT_OPEN_DIR, 41, 1, JSEXN_NONE, "Couldn't open directory {0}")
|
||||
MSG_DEF(JSFILEMSG_CANNOT_REPORT_POSITION, 42, 1, JSEXN_NONE, "Couldn't report position for {0}")
|
||||
MSG_DEF(JSFILEMSG_CANNOT_SET_POSITION, 43, 1, JSEXN_NONE, "Couldn't set position for {0}")
|
||||
MSG_DEF(JSFILEMSG_INIT_FAILED, 44, 0, JSEXN_NONE, "File class initialization failed")
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user