Skip to content

Incorrect thread id type casts (should use intptr_t) #698

@danfe

Description

@danfe

Commit 366930c tried to fix return of and taking in thread id, but doing it via unsigned int is still wrong and in fact does not get rid of the warnings completely as I see it here with Clang 19 and -Werror=pointer-to-int-cast -Werror=int-to-pointer-cast. I believe you should restore original and correct pthread_t in functions' signatures and apply the following patch:

@@ -1215,14 +1215,14 @@ start_timeout_func (Camera *camera, unsigned int timeo
 
 	pthread_create (&tid, NULL, thread_func, td);
 
-	return (unsigned int)tid;
+	return (intptr_t)tid;
 }
 
 static void
 stop_timeout_func (Camera __unused__ *camera, unsigned int id,
 		   void __unused__ *data)
 {
-	pthread_t tid = (pthread_t)id;
+	pthread_t tid = (pthread_t)(intptr_t)id;
 
 	pthread_cancel (tid);
 	pthread_join (tid, NULL);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions