Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP2:GA
LibVNCServer
LibVNCServer-update-testsuite.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File LibVNCServer-update-testsuite.patch of Package LibVNCServer
diff -urp a/test/copyrecttest.c b/test/copyrecttest.c --- a/test/copyrecttest.c 2014-10-21 17:57:11.000000000 +0200 +++ b/test/copyrecttest.c 2020-06-13 20:49:53.000000000 +0200 @@ -2,6 +2,7 @@ #define _BSD_SOURCE #endif #include <rfb/rfb.h> +#define _USE_MATH_DEFINES #include <math.h> static void initBackground(rfbScreenInfoPtr server) diff -urp a/test/encodingstest.c b/test/encodingstest.c --- a/test/encodingstest.c 2014-10-21 17:57:11.000000000 +0200 +++ b/test/encodingstest.c 2020-06-13 20:49:53.000000000 +0200 @@ -6,8 +6,8 @@ #include <rfb/rfb.h> #include <rfb/rfbclient.h> -#ifndef LIBVNCSERVER_HAVE_LIBPTHREAD -#error This test need pthread support (otherwise the client blocks the client) +#if !defined(LIBVNCSERVER_HAVE_LIBPTHREAD) && !defined(LIBVNCSERVER_HAVE_WIN32THREADS) +#error "I need pthreads or win32 threads for that." #endif #define ALL_AT_ONCE @@ -66,7 +66,7 @@ static void updateStatistics(int encodin } /* Here begin the functions for the client. They will be called in a - * pthread. */ + * thread. */ /* maxDelta=0 means they are expected to match exactly; * maxDelta>0 means that the average difference must be lower than maxDelta */ @@ -148,14 +148,14 @@ static void update_finished(rfbClient* c } -static void* clientLoop(void* data) { +static THREAD_ROUTINE_RETURN_TYPE clientLoop(void* data) { rfbClient* client=(rfbClient*)data; clientData* cd=(clientData*)client->clientData; client->appData.encodingsString=strdup(testEncodings[cd->encodingIndex].str); client->appData.qualityLevel = 7; /* ZYWRLE fails the test with standard settings */ - sleep(1); + THREAD_SLEEP_MS(1000); rfbClientLog("Starting client (encoding %s, display %s)\n", testEncodings[cd->encodingIndex].str, cd->display); @@ -163,7 +163,7 @@ static void* clientLoop(void* data) { rfbClientErr("Had problems starting client (encoding %s)\n", testEncodings[cd->encodingIndex].str); updateStatistics(cd->encodingIndex,TRUE); - return NULL; + return THREAD_ROUTINE_RETURN_VALUE; } while(1) { if(WaitForMessage(client,50)>=0) @@ -176,10 +176,14 @@ static void* clientLoop(void* data) { if(client->frameBuffer) free(client->frameBuffer); rfbClientCleanup(client); - return NULL; + return THREAD_ROUTINE_RETURN_VALUE; } +#if defined(LIBVNCSERVER_HAVE_LIBPTHREAD) static pthread_t all_threads[NUMBER_OF_ENCODINGS_TO_TEST]; +#elif defined(LIBVNCSERVER_HAVE_WIN32THREADS) +static uintptr_t all_threads[NUMBER_OF_ENCODINGS_TO_TEST]; +#endif static int thread_counter; static void startClient(int encodingIndex,rfbScreenInfo* server) { @@ -187,6 +191,7 @@ static void startClient(int encodingInde clientData* cd; client->clientData=malloc(sizeof(clientData)); + if (!client->clientData) return; client->MallocFrameBuffer=resize; client->GotFrameBufferUpdate=update; client->FinishedFrameBufferUpdate=update_finished; @@ -195,9 +200,18 @@ static void startClient(int encodingInde cd->encodingIndex=encodingIndex; cd->server=server; cd->display=(char*)malloc(6); + if (!cd->display) { + free(client->clientData); + return; + } sprintf(cd->display,":%d",server->port-5900); +#if defined(LIBVNCSERVER_HAVE_LIBPTHREAD) pthread_create(&all_threads[thread_counter++],NULL,clientLoop,(void*)client); +#elif defined(LIBVNCSERVER_HAVE_WIN32THREADS) + all_threads[thread_counter++] = _beginthread(clientLoop, 0, client); +#endif + } /* Here begin the server functions */ @@ -279,15 +293,19 @@ int main(int argc,char** argv) /* Initialize server */ server=rfbGetScreen(&argc,argv,width,height,8,3,4); if(!server) - return 0; + return 1; server->frameBuffer=malloc(400*300*4); + if (!server->frameBuffer) + return 1; + server->cursor=NULL; for(j=0;j<400*300*4;j++) server->frameBuffer[j]=j; rfbInitServer(server); rfbProcessEvents(server,0); + INIT_MUTEX(frameBufferMutex); initStatistics(); #ifndef ALL_AT_ONCE @@ -322,7 +340,7 @@ int main(int argc,char** argv) rfbShutdownServer(server, TRUE); for(i=0;i<thread_counter;i++) - pthread_join(all_threads[i], NULL); + THREAD_JOIN(all_threads[i]); free(server->frameBuffer); rfbScreenCleanup(server); diff -urp a/test/tjbench.c b/test/tjbench.c --- a/test/tjbench.c 2014-10-21 17:57:11.000000000 +0200 +++ b/test/tjbench.c 2020-06-13 20:49:53.000000000 +0200 @@ -178,7 +178,8 @@ int decomptest(unsigned char *srcbuf, un int y=(int)((double)srcbuf[rindex]*0.299 + (double)srcbuf[gindex]*0.587 + (double)srcbuf[bindex]*0.114 + 0.5); - if(y>255) y=255; if(y<0) y=0; + if(y>255) y=255; + if(y<0) y=0; dstbuf[rindex]=abs(dstbuf[rindex]-y); dstbuf[gindex]=abs(dstbuf[gindex]-y); dstbuf[bindex]=abs(dstbuf[bindex]-y); @@ -226,7 +227,8 @@ void dotest(unsigned char *srcbuf, int w for(tilew=dotile? 8:w, tileh=dotile? 8:h; ; tilew*=2, tileh*=2) { - if(tilew>w) tilew=w; if(tileh>h) tileh=h; + if(tilew>w) tilew=w; + if(tileh>h) tileh=h; ntilesw=(w+tilew-1)/tilew; ntilesh=(h+tileh-1)/tileh; if((jpegbuf=(unsigned char **)malloc(sizeof(unsigned char *) @@ -323,7 +325,7 @@ void dotest(unsigned char *srcbuf, int w for(i=0; i<ntilesw*ntilesh; i++) { - if(jpegbuf[i]) free(jpegbuf[i]); jpegbuf[i]=NULL; + if(jpegbuf[i]) {free(jpegbuf[i]); jpegbuf[i]=NULL;} } free(jpegbuf); jpegbuf=NULL; free(jpegsize); jpegsize=NULL; @@ -337,7 +339,7 @@ void dotest(unsigned char *srcbuf, int w { for(i=0; i<ntilesw*ntilesh; i++) { - if(jpegbuf[i]) free(jpegbuf[i]); jpegbuf[i]=NULL; + if(jpegbuf[i]) {free(jpegbuf[i]); jpegbuf[i]=NULL;} } free(jpegbuf); jpegbuf=NULL; } @@ -392,7 +394,8 @@ void dodecomptest(char *filename) for(tilew=dotile? 16:w, tileh=dotile? 16:h; ; tilew*=2, tileh*=2) { - if(tilew>w) tilew=w; if(tileh>h) tileh=h; + if(tilew>w) tilew=w; + if(tileh>h) tileh=h; ntilesw=(w+tilew-1)/tilew; ntilesh=(h+tileh-1)/tileh; if((jpegbuf=(unsigned char **)malloc(sizeof(unsigned char *) @@ -455,7 +458,7 @@ void dodecomptest(char *filename) { for(i=0; i<ntilesw*ntilesh; i++) { - if(jpegbuf[i]) free(jpegbuf[i]); jpegbuf[i]=NULL; + if(jpegbuf[i]) {free(jpegbuf[i]); jpegbuf[i]=NULL;} } free(jpegbuf); jpegbuf=NULL; } @@ -507,7 +510,7 @@ void usage(char *progname) int main(int argc, char *argv[]) { - unsigned char *srcbuf=NULL; int w, h, i, j; + unsigned char *srcbuf=NULL; int w = 0, h = 0, i, j; int minqual=-1, maxqual=-1; char *temp; int minarg=2; int retval=0; @@ -599,7 +602,7 @@ int main(int argc, char *argv[]) } else usage(argv[0]); } - if(!strcasecmp(argv[i], "-benchtime") && i<argc-1) + if(i<argc-1 && !strcasecmp(argv[i], "-benchtime")) { double temp=atof(argv[++i]); if(temp>0.0) benchtime=temp; diff -urp a/test/tjutil.h b/test/tjutil.h --- a/test/tjutil.h 2014-10-21 17:57:11.000000000 +0200 +++ b/test/tjutil.h 2020-06-13 20:49:53.000000000 +0200 @@ -31,9 +31,9 @@ #include <stdio.h> #define snprintf(str, n, format, ...) \ _snprintf_s(str, n, _TRUNCATE, format, __VA_ARGS__) + #define strcasecmp stricmp + #define strncasecmp strnicmp #endif - #define strcasecmp stricmp - #define strncasecmp strnicmp #endif #ifndef min
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor