浏览代码

Script binding for QIODevice::open() no longer eats return value

Neal Wilson 10 年前
父节点
当前提交
5b3e2e3604
共有 1 个文件被更改,包括 6 次插入5 次删除
  1. 6
    5
      src/typica.w

+ 6
- 5
src/typica.w 查看文件

@@ -1937,18 +1937,19 @@ not passed, it is assumed that the user wants read and write access.
1937 1937
 QScriptValue QIODevice_open(QScriptContext *context, QScriptEngine *)
1938 1938
 {
1939 1939
 	QIODevice *self = getself<QIODevice *>(context);
1940
+	bool retval = false;
1940 1941
 	if(context->argumentCount() == 1)
1941 1942
 	{
1942 1943
 		switch(argument<int>(0, context))
1943 1944
 		{
1944 1945
 			case 1:
1945
-				self->open(QIODevice::ReadOnly);
1946
+				retval = self->open(QIODevice::ReadOnly);
1946 1947
 				break;
1947 1948
 			case 2:
1948
-				self->open(QIODevice::WriteOnly);
1949
+				retval = self->open(QIODevice::WriteOnly);
1949 1950
 				break;
1950 1951
 			case 3:
1951
-				self->open(QIODevice::ReadWrite);
1952
+				retval = self->open(QIODevice::ReadWrite);
1952 1953
 				break;
1953 1954
 			default:
1954 1955
 				break;
@@ -1956,9 +1957,9 @@ QScriptValue QIODevice_open(QScriptContext *context, QScriptEngine *)
1956 1957
 	}
1957 1958
 	else
1958 1959
 	{
1959
-		self->open(QIODevice::ReadWrite);
1960
+		retval = self->open(QIODevice::ReadWrite);
1960 1961
 	}
1961
-	return QScriptValue();
1962
+	return QScriptValue(retval);
1962 1963
 }
1963 1964
 
1964 1965
 QScriptValue QIODevice_close(QScriptContext *context, QScriptEngine *)

正在加载...
取消
保存