Bug 174175 - Windows Mac linefeeds exchanged in codegeneration
Summary: Windows Mac linefeeds exchanged in codegeneration
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-03 16:14 UTC by Ferenc Veres
Modified: 2017-03-13 13:44 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.21.80 (KDE Applications 17.03.80)


Attachments
Patch to replace dos and mac linefeed to make it correctly generated. (639 bytes, patch)
2008-11-03 16:16 UTC, Ferenc Veres
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ferenc Veres 2008-11-03 16:14:29 UTC
Version:           2.1.2 (using Devel)
Compiler:          gcc 
OS:                Linux
Installed from:    Compiled sources

Switch case for linefeed is wrong on code generating.

Selecting Windows linefeed on the dialog generates Mac line feeds and vice versa.

===================================================================
--- umbrello/codegenerators/codegenerationpolicy.cpp    (revision 879597)
+++ umbrello/codegenerators/codegenerationpolicy.cpp    (working copy)   
@@ -209,10 +209,10 @@                                                    
 {                                                                       
     Settings::getOptionState().codeGenerationState.lineEndingType = type;
     switch (Settings::getOptionState().codeGenerationState.lineEndingType) {
-    case MAC:                                                               
+    case DOS:                                                               
         m_lineEndingChars = QString("\r\n");                                
         break;                                                              
-    case DOS:                                                               
+    case MAC:                                                               
         m_lineEndingChars = QString("\r");                                  
         break;                                                              
     case UNIX:                                                              
Index: umbrello/codegenerators/csharp/csharpwriter.cpp
Comment 1 Ferenc Veres 2008-11-03 16:16:26 UTC
Created attachment 28299 [details]
Patch to replace dos and mac linefeed to make it correctly generated.
Comment 2 Ralf Habacker 2016-05-05 02:48:35 UTC
@Lays: Please add test cases for this issue to this bug and if you can confirm this bug. Then apply this patch to a local build and check if it solves the mentioned issues.
Comment 3 Ferenc Veres 2016-05-05 07:35:14 UTC
Hi guys,
The current code on quickgit.kde.org reads as:

    case MAC:
        m_lineEndingChars = QString(QLatin1String("\r\n"));
        break;
    case DOS:
        m_lineEndingChars = QString(QLatin1String("\r"));
        break;

It's no rocket science to see this problem still exists in the code, case MAC should be "\r" and case DOS should be "\r\n". 

However I didn't check if this code is still in use, as I remember a new code generating subsystem was being implemented back then.

https://quickgit.kde.org/?p=umbrello.git&a=blob&h=6033f2c2642dbdab7d351b622d0d631581cb5ea1&hb=6051fd05ef97566ea8122858c8c6a69a3b8c10ff&f=umbrello%2Fcodegenerators%2Fcodegenerationpolicy.cpp
Comment 4 Ralf Habacker 2016-05-07 07:19:29 UTC
(In reply to Ferenc Veres from comment #3)
> Hi guys,
> The current code on quickgit.kde.org reads as:
> 
>     case MAC:
>         m_lineEndingChars = QString(QLatin1String("\r\n"));
>         break;
>     case DOS:
>         m_lineEndingChars = QString(QLatin1String("\r"));
>         break;
> 
> It's no rocket science to see this problem still exists in the code, case
> MAC should be "\r" and case DOS should be "\r\n". 
> 
> However I didn't check if this code is still in use, as I remember a new
> code generating subsystem was being implemented back then.

Thanks for the info. There is a GSOC student currently studying umbrello code and bug fix workflow.  
This bug has been selected for this purpose.
Comment 5 Ralf Habacker 2017-03-13 13:44:35 UTC
Git commit eb4a0018810fc8c96fac93e39cd6a71115bb3036 by Ralf Habacker.
Committed on 13/03/2017 at 13:42.
Pushed by habacker into branch 'master'.

Fix 'Windows Mac linefeeds exchanged in codegeneration'.
FIXED-IN:2.21.80 (KDE Applications 17.03.80)

M  +2    -2    umbrello/codegenerators/codegenerationpolicy.cpp

https://commits.kde.org/umbrello/eb4a0018810fc8c96fac93e39cd6a71115bb3036