Skip to content
Snippets Groups Projects
Commit cc9a94d5 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

up

parent b36f7eda
No related branches found
No related tags found
No related merge requests found
...@@ -22,7 +22,8 @@ ...@@ -22,7 +22,8 @@
// ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE // ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
// OF THIS SOFTWARE. // OF THIS SOFTWARE.
// //
// Please report all bugs and problems to the public mailing list <gmsh@geuz.org>. // Please report all bugs and problems to the public mailing list
// <gmsh@geuz.org>.
#ifndef _GMSH_SOCKET_H_ #ifndef _GMSH_SOCKET_H_
#define _GMSH_SOCKET_H_ #define _GMSH_SOCKET_H_
...@@ -80,6 +81,7 @@ class GmshSocket{ ...@@ -80,6 +81,7 @@ class GmshSocket{
GMSH_SPEED_TEST = 30, GMSH_SPEED_TEST = 30,
GMSH_PARAMETER_CLEAR = 31, GMSH_PARAMETER_CLEAR = 31,
GMSH_PARAMETER_UPDATE = 32, GMSH_PARAMETER_UPDATE = 32,
GMSH_OPEN_PROJECT = 33,
GMSH_OPTION_1 = 100, GMSH_OPTION_1 = 100,
GMSH_OPTION_2 = 101, GMSH_OPTION_2 = 101,
GMSH_OPTION_3 = 102, GMSH_OPTION_3 = 102,
...@@ -188,6 +190,7 @@ class GmshSocket{ ...@@ -188,6 +190,7 @@ class GmshSocket{
void Error(const char *str){ SendString(GMSH_ERROR, str); } void Error(const char *str){ SendString(GMSH_ERROR, str); }
void Progress(const char *str){ SendString(GMSH_PROGRESS, str); } void Progress(const char *str){ SendString(GMSH_PROGRESS, str); }
void MergeFile(const char *str){ SendString(GMSH_MERGE_FILE, str); } void MergeFile(const char *str){ SendString(GMSH_MERGE_FILE, str); }
void OpenProject(const char *str){ SendString(GMSH_OPEN_PROJECT, str); }
void ParseString(const char *str){ SendString(GMSH_PARSE_STRING, str); } void ParseString(const char *str){ SendString(GMSH_PARSE_STRING, str); }
void SpeedTest(const char *str){ SendString(GMSH_SPEED_TEST, str); } void SpeedTest(const char *str){ SendString(GMSH_SPEED_TEST, str); }
void Option(int num, const char *str) void Option(int num, const char *str)
...@@ -200,7 +203,6 @@ class GmshSocket{ ...@@ -200,7 +203,6 @@ class GmshSocket{
{ {
*swap = 0; *swap = 0;
if(_ReceiveData(type, sizeof(int)) > 0){ if(_ReceiveData(type, sizeof(int)) > 0){
if(*type < 0) return 0;
if(*type > 65535){ if(*type > 65535){
// the data comes from a machine with different endianness and // the data comes from a machine with different endianness and
// we must swap the bytes // we must swap the bytes
...@@ -208,7 +210,6 @@ class GmshSocket{ ...@@ -208,7 +210,6 @@ class GmshSocket{
_SwapBytes((char*)type, sizeof(int), 1); _SwapBytes((char*)type, sizeof(int), 1);
} }
if(_ReceiveData(len, sizeof(int)) > 0){ if(_ReceiveData(len, sizeof(int)) > 0){
if(*len < 0) return 0;
if(*swap) _SwapBytes((char*)len, sizeof(int), 1); if(*swap) _SwapBytes((char*)len, sizeof(int), 1);
return 1; return 1;
} }
...@@ -367,7 +368,7 @@ class GmshServer : public GmshSocket{ ...@@ -367,7 +368,7 @@ class GmshServer : public GmshSocket{
#if !defined(WIN32) || defined(__CYGWIN__) #if !defined(WIN32) || defined(__CYGWIN__)
if(tmpsock < 0) if(tmpsock < 0)
#else #else
if(tmpsock == (int)INVALID_SOCKET) if(tmpsock == (int)INVALID_SOCKET)
#endif #endif
throw "Couldn't create socket"; throw "Couldn't create socket";
// bind the socket to its name // bind the socket to its name
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment