Skip to content

Commit a05d43c

Browse files
Copilotwysaid
andcommitted
Remove 'global' keyword from error callback function names
Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com>
1 parent 433065c commit a05d43c

15 files changed

Lines changed: 44 additions & 44 deletions

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ Starting from v1.2.0, ccap uses a global error callback system for simplified er
122122
#include <iostream>
123123
124124
int main() {
125-
// Set global error callback to receive detailed error information
126-
ccap::setGlobalErrorCallback([](ccap::ErrorCode errorCode, const std::string& description) {
125+
// Set error callback to receive detailed error information
126+
ccap::setErrorCallback([](ccap::ErrorCode errorCode, const std::string& description) {
127127
std::cerr << "Camera Error - Code: " << static_cast<int>(errorCode)
128128
<< ", Description: " << description << std::endl;
129129
});
@@ -516,8 +516,8 @@ typedef enum {
516516
// Error callback function
517517
typedef void (*CcapErrorCallback)(CcapErrorCode errorCode, const char* errorDescription, void* userData);
518518
519-
// Set global error callback
520-
bool ccap_set_global_error_callback(CcapErrorCallback callback, void* userData);
519+
// Set error callback
520+
bool ccap_set_error_callback(CcapErrorCallback callback, void* userData);
521521
522522
// Get error description
523523
const char* ccap_error_code_to_string(CcapErrorCode errorCode);
@@ -528,8 +528,8 @@ void error_callback(CcapErrorCode errorCode, const char* errorDescription, void*
528528
}
529529
530530
int main() {
531-
// Set global error callback to receive error notifications
532-
ccap_set_global_error_callback(error_callback, NULL);
531+
// Set error callback to receive error notifications
532+
ccap_set_error_callback(error_callback, NULL);
533533
534534
CcapProvider* provider = ccap_provider_create();
535535

docs/C_Interface.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,8 @@ typedef enum {
272272
// 错误回调函数类型
273273
typedef void (*CcapErrorCallback)(CcapErrorCode errorCode, const char* errorDescription, void* userData);
274274

275-
// 设置全局错误回调
276-
bool ccap_set_global_error_callback(CcapErrorCallback callback, void* userData);
275+
// 设置错误回调
276+
bool ccap_set_error_callback(CcapErrorCallback callback, void* userData);
277277

278278
// 获取错误码描述
279279
const char* ccap_error_code_to_string(CcapErrorCode errorCode);
@@ -288,8 +288,8 @@ void error_callback(CcapErrorCode errorCode, const char* errorDescription, void*
288288
}
289289
290290
int main() {
291-
// 设置全局错误回调
292-
ccap_set_global_error_callback(error_callback, NULL);
291+
// 设置错误回调
292+
ccap_set_error_callback(error_callback, NULL);
293293
294294
CcapProvider* provider = ccap_provider_create();
295295

examples/desktop/0-print_camera.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ void printCameraInfo(const std::string& deviceName) {
6060
}
6161

6262
int main() {
63-
// Set global error callback to receive error notifications
64-
ccap::setGlobalErrorCallback([](ccap::ErrorCode errorCode, const std::string& description) {
63+
// Set error callback to receive error notifications
64+
ccap::setErrorCallback([](ccap::ErrorCode errorCode, const std::string& description) {
6565
std::cerr << "Camera Error - Code: " << static_cast<int>(errorCode)
6666
<< ", Description: " << description << std::endl;
6767
});

examples/desktop/0-print_camera_c.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ int main() {
3737
printf("ccap C Interface Example\n");
3838
printf("Version: %s\n\n", ccap_get_version());
3939

40-
// Set global error callback to receive error notifications
41-
ccap_set_global_error_callback(error_callback, NULL);
40+
// Set error callback to receive error notifications
41+
ccap_set_error_callback(error_callback, NULL);
4242

4343
// Create provider
4444
CcapProvider* provider = ccap_provider_create();

examples/desktop/1-minimal_example.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include <iostream>
1313

1414
int main() {
15-
// Set global error callback to receive error notifications
16-
ccap::setGlobalErrorCallback([](ccap::ErrorCode errorCode, const std::string& description) {
15+
// Set error callback to receive error notifications
16+
ccap::setErrorCallback([](ccap::ErrorCode errorCode, const std::string& description) {
1717
std::cerr << "Error occurred - Code: " << static_cast<int>(errorCode)
1818
<< ", Description: " << description << std::endl;
1919
});

examples/desktop/1-minimal_example_c.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ int main() {
2222
printf("ccap C Interface Minimal Example\n");
2323
printf("Version: %s\n\n", ccap_get_version());
2424

25-
// Set global error callback to receive error notifications
26-
ccap_set_global_error_callback(error_callback, NULL);
25+
// Set error callback to receive error notifications
26+
ccap_set_error_callback(error_callback, NULL);
2727

2828
// Create provider
2929
CcapProvider* provider = ccap_provider_create();

examples/desktop/2-capture_grab.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ int main(int argc, char** argv) {
1919
/// Enable verbose log to see debug information
2020
ccap::setLogLevel(ccap::LogLevel::Verbose);
2121

22-
// Set global error callback to receive error notifications
23-
ccap::setGlobalErrorCallback([](ccap::ErrorCode errorCode, const std::string& description) {
22+
// Set error callback to receive error notifications
23+
ccap::setErrorCallback([](ccap::ErrorCode errorCode, const std::string& description) {
2424
std::cerr << "Camera Error - Code: " << static_cast<int>(errorCode)
2525
<< ", Description: " << description << std::endl;
2626
});

examples/desktop/2-capture_grab_c.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ int main(int argc, char** argv) {
2727
// Enable verbose log to see debug information
2828
ccap_set_log_level(CCAP_LOG_LEVEL_VERBOSE);
2929

30-
// Set global error callback to receive error notifications
31-
ccap_set_global_error_callback(error_callback, NULL);
30+
// Set error callback to receive error notifications
31+
ccap_set_error_callback(error_callback, NULL);
3232

3333
// Get current working directory and create capture directory
3434
char cwd[1024];

examples/desktop/3-capture_callback.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ int main(int argc, char** argv) {
3636

3737
ccap::Provider cameraProvider;
3838

39-
// Set global error callback to receive error notifications
40-
ccap::setGlobalErrorCallback([](ccap::ErrorCode errorCode, const std::string& description) {
39+
// Set error callback to receive error notifications
40+
ccap::setErrorCallback([](ccap::ErrorCode errorCode, const std::string& description) {
4141
std::cerr << "Camera Error - Code: " << static_cast<int>(errorCode)
4242
<< ", Description: " << description << std::endl;
4343
});

examples/desktop/3-capture_callback_c.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ int main(int argc, char** argv) {
112112
return -1;
113113
}
114114

115-
// Set global error callback to receive error notifications
116-
ccap_set_global_error_callback(error_callback, NULL);
115+
// Set error callback to receive error notifications
116+
ccap_set_error_callback(error_callback, NULL);
117117

118118
// Find and print available devices
119119
CcapDeviceNamesList deviceList;

0 commit comments

Comments
 (0)