Browse Source

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

Neal Wilson 10 years ago
parent
commit
5b3e2e3604
1 changed files with 6 additions and 5 deletions
  1. 6
    5
      src/typica.w

+ 6
- 5
src/typica.w View File

1937
 QScriptValue QIODevice_open(QScriptContext *context, QScriptEngine *)
1937
 QScriptValue QIODevice_open(QScriptContext *context, QScriptEngine *)
1938
 {
1938
 {
1939
 	QIODevice *self = getself<QIODevice *>(context);
1939
 	QIODevice *self = getself<QIODevice *>(context);
1940
+	bool retval = false;
1940
 	if(context->argumentCount() == 1)
1941
 	if(context->argumentCount() == 1)
1941
 	{
1942
 	{
1942
 		switch(argument<int>(0, context))
1943
 		switch(argument<int>(0, context))
1943
 		{
1944
 		{
1944
 			case 1:
1945
 			case 1:
1945
-				self->open(QIODevice::ReadOnly);
1946
+				retval = self->open(QIODevice::ReadOnly);
1946
 				break;
1947
 				break;
1947
 			case 2:
1948
 			case 2:
1948
-				self->open(QIODevice::WriteOnly);
1949
+				retval = self->open(QIODevice::WriteOnly);
1949
 				break;
1950
 				break;
1950
 			case 3:
1951
 			case 3:
1951
-				self->open(QIODevice::ReadWrite);
1952
+				retval = self->open(QIODevice::ReadWrite);
1952
 				break;
1953
 				break;
1953
 			default:
1954
 			default:
1954
 				break;
1955
 				break;
1956
 	}
1957
 	}
1957
 	else
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
 QScriptValue QIODevice_close(QScriptContext *context, QScriptEngine *)
1965
 QScriptValue QIODevice_close(QScriptContext *context, QScriptEngine *)

Loading…
Cancel
Save