[PR #1160] [MERGED] [FIX] Get rid of a few compilation warnings #1946

Closed
opened 2026-01-29 17:19:24 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/1160
Author: @jshin313
Created: 12/28/2019
Status: Merged
Merged: 12/29/2019
Merged by: @cfsmp3

Base: masterHead: master


📝 Commits (10+)

  • efda07f Added underline support
  • bdf1bc4 Added changes to CHANGES.TXT
  • 790fbdb Delete CHANGES.TXT~
  • 2da2a0c Delete .CHANGES.TXT.un~
  • 3dc0ccf Update CHANGES.TXT
  • 82b3797 Merging
  • e11d2d6 Changed strncpy to memcpy when the size of the data being transferred is known
  • 16d0086 Add declaration of struct image_copy before function
  • 04563b3 Used strdup for duplicating strings
  • 857e14b Added error checking for strdup

📊 Changes

3 files changed (+13 additions, -6 deletions)

View changed files

📝 src/lib_ccx/ccx_encoders_spupng.c (+2 -2)
📝 src/lib_ccx/ocr.c (+4 -0)
📝 src/lib_ccx/params.c (+7 -4)

📄 Description

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.
  • I have mentioned this change in the changelog.

My familiarity with the project is as follows (check one):

  • I have never used CCExtractor.
  • I have used CCExtractor just a couple of times.
  • I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

The following warnings were displayed after running make on a Debian 9 linux machine using gcc 8.3.0:

../src/lib_ccx/params.c: In function ‘add_file_sequence’:
../src/lib_ccx/params.c:184:3: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
   strncpy(filename+m+(strlen(num)-strlen(temp)),temp,strlen(temp));
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/lib_ccx/params.c:182:7: note: length computed here
   if (strlen(temp) > strlen(num)) // From 999 to 1000, etc. 
 In function ‘spupng_export_string2png.part.3’,
    inlined from ‘spupng_export_string2png’ at ../src/lib_ccx/ccx_encoders_spupng.c:692:5:
 ../src/lib_ccx/ccx_encoders_spupng.c:733:2: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
  strncpy(tmp, str, strlen(str)+1);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/lib_ccx/ccx_encoders_spupng.c: In function ‘spupng_export_string2png’:
../src/lib_ccx/ccx_encoders_spupng.c:733:20: note: length computed here
  strncpy(tmp, str, strlen(str)+1);

The above warnings were fixed by changing strncpy to memcpy.

The next warning was fixed by declaring a struct before a function declaration;

 ../src/lib_ccx/ocr.c:1028:113: warning: ‘struct image_copy’ declared inside parameter list will not be visible outside of this definition or declaration
 * ocr_bitmap(png_color *palette,png_byte *alpha, unsigned char* indata,unsigned char d,int w, int h, struct image_copy *copy)

#780


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/CCExtractor/ccextractor/pull/1160 **Author:** [@jshin313](https://github.com/jshin313) **Created:** 12/28/2019 **Status:** ✅ Merged **Merged:** 12/29/2019 **Merged by:** [@cfsmp3](https://github.com/cfsmp3) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (10+) - [`efda07f`](https://github.com/CCExtractor/ccextractor/commit/efda07f36b49ee69ec95847ba27510709480a646) Added underline support - [`bdf1bc4`](https://github.com/CCExtractor/ccextractor/commit/bdf1bc4e0c71cd6f2e72ccbc5363d53631fd5ed5) Added changes to CHANGES.TXT - [`790fbdb`](https://github.com/CCExtractor/ccextractor/commit/790fbdb622a8bd71b5eb348e77f293a6b01ab54e) Delete CHANGES.TXT~ - [`2da2a0c`](https://github.com/CCExtractor/ccextractor/commit/2da2a0c971bc448e961cab2783825f82549dfde9) Delete .CHANGES.TXT.un~ - [`3dc0ccf`](https://github.com/CCExtractor/ccextractor/commit/3dc0ccfb9d70f78d574017de96953d366dcb119c) Update CHANGES.TXT - [`82b3797`](https://github.com/CCExtractor/ccextractor/commit/82b379764fe203795672ef85f5662a0d73682392) Merging - [`e11d2d6`](https://github.com/CCExtractor/ccextractor/commit/e11d2d6672c73f0f290256b98325d445eb849fe3) Changed strncpy to memcpy when the size of the data being transferred is known - [`16d0086`](https://github.com/CCExtractor/ccextractor/commit/16d0086011af5339d6f00d487d6072aef2068151) Add declaration of struct image_copy before function - [`04563b3`](https://github.com/CCExtractor/ccextractor/commit/04563b3f190c371f59d89cd429896d6dc8b65771) Used strdup for duplicating strings - [`857e14b`](https://github.com/CCExtractor/ccextractor/commit/857e14bb4c16d339ecc02d5ce9027f898591e117) Added error checking for strdup ### 📊 Changes **3 files changed** (+13 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `src/lib_ccx/ccx_encoders_spupng.c` (+2 -2) 📝 `src/lib_ccx/ocr.c` (+4 -0) 📝 `src/lib_ccx/params.c` (+7 -4) </details> ### 📄 Description - [X] I have read and understood the [contributors guide](https://github.com/CCExtractor/ccextractor/blob/master/.github/CONTRIBUTING.md). - [X] I have checked that another pull request for this purpose does not exist. - [X] I have considered, and confirmed that this submission will be valuable to others. - [X] I accept that this submission may not be used, and the pull request closed at the will of the maintainer. - [X] I give this submission freely, and claim no ownership to its content. - [ ] **I have mentioned this change in the [changelog](https://github.com/CCExtractor/ccextractor/blob/master/docs/CHANGES.TXT).** **My familiarity with the project is as follows (check one):** - [ ] I have never used CCExtractor. - [X] I have used CCExtractor just a couple of times. - [ ] I absolutely love CCExtractor, but have not contributed previously. - [ ] I am an active contributor to CCExtractor. --- The following warnings were displayed after running make on a Debian 9 linux machine using gcc 8.3.0: ``` ../src/lib_ccx/params.c: In function ‘add_file_sequence’: ../src/lib_ccx/params.c:184:3: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=] strncpy(filename+m+(strlen(num)-strlen(temp)),temp,strlen(temp)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/lib_ccx/params.c:182:7: note: length computed here if (strlen(temp) > strlen(num)) // From 999 to 1000, etc. ``` ``` In function ‘spupng_export_string2png.part.3’, inlined from ‘spupng_export_string2png’ at ../src/lib_ccx/ccx_encoders_spupng.c:692:5: ../src/lib_ccx/ccx_encoders_spupng.c:733:2: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=] strncpy(tmp, str, strlen(str)+1); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/lib_ccx/ccx_encoders_spupng.c: In function ‘spupng_export_string2png’: ../src/lib_ccx/ccx_encoders_spupng.c:733:20: note: length computed here strncpy(tmp, str, strlen(str)+1); ``` The above warnings were fixed by changing strncpy to memcpy. The next warning was fixed by declaring a struct before a function declaration; ``` ../src/lib_ccx/ocr.c:1028:113: warning: ‘struct image_copy’ declared inside parameter list will not be visible outside of this definition or declaration * ocr_bitmap(png_color *palette,png_byte *alpha, unsigned char* indata,unsigned char d,int w, int h, struct image_copy *copy) ``` #780 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 17:19:24 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#1946