• R/O
  • SSH

wp2latex: Commit

WP2LaTeX sources.


Commit MetaInfo

Revision1daa6fe8182820cc2da45103fcdb48576f83e477 (tree)
Zeit2022-11-25 18:05:52
AutorFojtik
CommiterFojtik

Log Message

Make SUN RAS format to be default for .ras extension.

Ändern Zusammenfassung

Diff

diff -r 8865df608664 -r 1daa6fe81828 trunk/sources.cc/images/imgsupp.cc
--- a/trunk/sources.cc/images/imgsupp.cc Thu Nov 24 00:08:04 2022 +0100
+++ b/trunk/sources.cc/images/imgsupp.cc Fri Nov 25 10:05:52 2022 +0100
@@ -286,6 +286,22 @@
286286 #endif
287287
288288
289+#ifdef SupportRAS_SUN
290+ ImplementReader(RAS_SUN, ".RAS")
291+ #if SupportRAS_SUN>=4 || SupportRAS_SUN==2
292+ LoadPictureRAS_SUN,
293+ #else
294+ NULL,
295+ #endif
296+ #if SupportRAS_SUN>=3
297+ SavePictureRAS_SUN,
298+ #else
299+ NULL,
300+ #endif
301+ "SUN");
302+#endif
303+
304+
289305 #ifdef SupportRAS
290306 ImplementReader(RAS,".RAS")
291307 #if SupportRAS>=4 || SupportRAS==2
@@ -302,22 +318,6 @@
302318 #endif
303319
304320
305-#ifdef SupportRAS_SUN
306- ImplementReader(RAS_SUN, ".RAS")
307- #if SupportRAS_SUN>=4 || SupportRAS_SUN==2
308- LoadPictureRAS_SUN,
309- #else
310- NULL,
311- #endif
312- #if SupportRAS_SUN>=3
313- SavePictureRAS_SUN,
314- #else
315- NULL,
316- #endif
317- "SUN");
318-#endif
319-
320-
321321 #ifdef SupportRAW
322322 ImplementReader(RAW,".RAW")
323323 //#if SupportRAW>=4 || SupportRAW==2
diff -r 8865df608664 -r 1daa6fe81828 trunk/sources.cc/images/ras_img.cc
--- a/trunk/sources.cc/images/ras_img.cc Thu Nov 24 00:08:04 2022 +0100
+++ b/trunk/sources.cc/images/ras_img.cc Fri Nov 25 10:05:52 2022 +0100
@@ -3500,6 +3500,20 @@
35003500
35013501
35023502 #if SupportOKO>=4 || SupportOKO==2
3503+
3504+inline long LoadOkoHeader(FILE *f, OkoHeader &HDR)
3505+{
3506+#if defined(__PackedStructures__)
3507+ return(fread(&SU,1,sizeof(SU),f));
3508+#else
3509+ return(loadstruct(f,"a80wwwwwwwwa416",
3510+ &HDR.identific, &HDR.ver, &HDR.modif,
3511+ &HDR.Histogram, &HDR.Text, &HDR.rows, &HDR.cols, &HDR.levels,
3512+ &HDR.identif, &HDR.dummy));
3513+#endif
3514+}
3515+
3516+
35033517 Image LoadPictureOKO(const char *Name)
35043518 {
35053519 FILE *f;
@@ -3511,7 +3525,7 @@
35113525
35123526 if((f=fopen(Name,"rb"))==NULL) return(Img);
35133527
3514- if(fread(&Header,sizeof(Header),1,f)!=1) goto ENDPROC;
3528+ if(LoadOkoHeader(f, Header) != 512) goto ENDPROC;
35153529 if(strncmp(Header.identific,"OBR2 Image File",15)) goto ENDPROC;
35163530
35173531 if(Header.levels==0) goto ENDPROC; //wrong image
@@ -3538,6 +3552,20 @@
35383552
35393553
35403554 #if SupportOKO>=3
3555+
3556+inline long SaveOkoHeader(FILE *f, const OkoHeader &HDR)
3557+{
3558+#if defined(__PackedStructures__)
3559+ return(fwrite(&SU,1,sizeof(SU),f));
3560+#else
3561+ return(savestruct(f,"a80wwwwwwwwa416",
3562+ HDR.identific, HDR.ver, HDR.modif,
3563+ HDR.Histogram, HDR.Text, HDR.rows, HDR.cols, HDR.levels,
3564+ HDR.identif, HDR.dummy));
3565+#endif
3566+}
3567+
3568+
35413569 int SavePictureOKO(const char *Name, const Image &Img)
35423570 {
35433571 FILE *f;
@@ -3571,7 +3599,7 @@
35713599
35723600 if((f=fopen(Name,"wb"))==NULL) return(-1);
35733601
3574- if(fwrite(&Header,sizeof(Header),1,f)!=1) goto FINISH;
3602+ if(SaveOkoHeader(f,Header) != 512) goto FINISH;
35753603
35763604 for(i=0;i<Header.cols;i++)
35773605 {
Show on old repository browser